Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
222100117oyq
0
提交
68478a6f
0
0
项目概览
222100117oyq
/
0
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
0
0
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
68478a6f
编写于
2月 29, 2024
作者:
222100117oyq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
初步完成功能二
上级
858ea852
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
105 addition
and
331 deletion
+105
-331
DWASearch/output.txt
DWASearch/output.txt
+33
-329
DWASearch/src/main/java/org/example/DWASearch.java
DWASearch/src/main/java/org/example/DWASearch.java
+42
-2
DWASearch/src/main/java/org/example/ResultSimply.java
DWASearch/src/main/java/org/example/ResultSimply.java
+30
-0
未找到文件。
DWASearch/output.txt
浏览文件 @
68478a6f
Full Name:HART Alexander
Gender:Male
Country:Austria
-----
Full Name:LOTFI Dariush
Gender:Male
Country:Austria
-----
Full Name:SCHALLER Nikolaj
Gender:Male
Country:Austria
-----
Full Name:ABRAMOWICZ Tazman
Gender:Male
Country:Canada
-----
Full Name:BELANGER Eloise
Gender:Female
Country:Canada
Full Name:MULLER Jette
Rank:1
Score:51.60 + 52.00 + 51.75 + 46.80 + 46.80 = 248.95
-----
Full Name:
DICK Elaena
Gender:Female
Country:Canada
Full Name:
ROLLINSON Amy
Rank:2
Score:46.00 + 42.90 + 50.70 + 54.00 + 46.80 = 240.40
-----
Full Name:
ERLAM Margo
Gender:Female
Country:Canada
Full Name:
SKRZEK Kaja
Rank:3
Score:50.40 + 46.80 + 48.30 + 45.60 + 48.75 = 239.85
-----
Full Name:
FUNG Katelyn
Gender:Female
Country:Canada
Full Name:
BENT-ASHMEIL Desharne
Rank:4
Score:46.80 + 50.70 + 48.30 + 43.20 + 45.50 = 234.50
-----
Full Name:JASMIN Amelie-Laura
Gender:Female
Country:Canada
Rank:5
Score:50.40 + 45.50 + 43.70 + 46.80 + 43.75 = 230.15
-----
Full Name:
TESSIER Benjamin
Gender:Male
Country:Canada
Full Name:
BLAZOWSKA Aleksandra
Rank:6
Score:43.20 + 44.85 + 45.60 + 53.30 + 41.80 = 228.75
-----
Full Name:WILSON Aimee
Gender:Female
Country:Canada
-----
Full Name:JELINKOVA Tereza
Gender:Female
Country:Czechia
-----
Full Name:SANTIAGO Dominique
Gender:Female
Country:Czechia
-----
Full Name:ABADIA Adrian
Gender:Male
Country:Spain
-----
Full Name:ANTOLINO Valeria
Gender:Female
Country:Spain
-----
Full Name:CAMACHO DEL HOYO Carlos
Gender:Male
Country:Spain
-----
Full Name:CARVAJAL Ana
Gender:Female
Country:Spain
-----
Full Name:GARCIA BOISSIER Nicolas
Gender:Male
Country:Spain
-----
Full Name:LINAN Max
Gender:Male
Country:Spain
-----
Full Name:PAPWORTH BURREL Maria
Gender:Female
Country:Spain
-----
Full Name:RODRIGUEZ LEDESMA Jorge
Gender:Male
Country:Spain
-----
Full Name:VELAZQUEZ Rocio
Gender:Female
Country:Spain
-----
Full Name:BENT-ASHMEIL Desharne
Gender:Female
Country:Great Britain
-----
Full Name:BOND Maisie
Gender:Female
Country:Great Britain
-----
Full Name:DIXON Matthew
Gender:Male
Country:Great Britain
-----
Full Name:HEATLY James
Gender:Male
Country:Great Britain
-----
Full Name:HOULDEN Jordan Christopher
Gender:Male
Country:Great Britain
-----
Full Name:LEE Robbie
Gender:Male
Country:Great Britain
-----
Full Name:MCCABE Euan
Gender:Male
Country:Great Britain
-----
Full Name:ROLLINSON Amy
Gender:Female
Country:Great Britain
-----
Full Name:ONIKASHVILI Tornike
Gender:Male
Country:Georgia
-----
Full Name:SAKANDELIDZE Irakli
Gender:Male
Country:Georgia
-----
Full Name:SHANIDZE Mariam
Gender:Female
Country:Georgia
-----
Full Name:SHARIA Tekle
Gender:Female
Country:Georgia
-----
Full Name:TSULUKIDZE Giorgi
Gender:Male
Country:Georgia
-----
Full Name:AVILA SANCHEZ Luis Carlo
Gender:Male
Country:Germany
-----
Full Name:BARTHEL Timo
Gender:Male
Country:Germany
-----
Full Name:COORDES Carolina
Gender:Female
Country:Germany
-----
Full Name:EIKERMANN GREGORCHUK Jaden Shiloh
Gender:Male
Country:Germany
-----
Full Name:HENTSCHEL Lena
Gender:Female
Country:Germany
-----
Full Name:LUBE Alexander
Gender:Male
Country:Germany
-----
Full Name:MULLER Jette
Gender:Female
Country:Germany
-----
Full Name:OETTINGHAUS Saskia
Gender:Female
Country:Germany
-----
Full Name:PFEIF Pauline Alexandra
Gender:Female
Country:Germany
-----
Full Name:PRENZYNA Espen
Gender:Male
Country:Germany
-----
Full Name:ROSLER Ole Johannes
Gender:Male
Country:Germany
-----
Full Name:ROTHER Jana Lisa
Gender:Female
Country:Germany
-----
Full Name:RUDIGER Lars
Gender:Male
Country:Germany
-----
Full Name:WALDSTEINER Tom Laszlo
Gender:Male
Country:Germany
-----
Full Name:WASSEN Elena
Gender:Female
Country:Germany
-----
Full Name:WASSEN Christina
Gender:Female
Country:Germany
-----
Full Name:WESEMANN Moritz
Gender:Male
Country:Germany
-----
Full Name:TSIRIKOS Athanasios
Gender:Male
Country:Greece
-----
Full Name:BAEK Sunjin
Gender:Female
Country:Republic of Korea
-----
Full Name:CHOI Gangin
Gender:Male
Country:Republic of Korea
-----
Full Name:HAN Jiwoo
Gender:Female
Country:Republic of Korea
-----
Full Name:KANG Jiho
Gender:Male
Country:Republic of Korea
-----
Full Name:KIM Gyeongbin
Gender:Male
Country:Republic of Korea
-----
Full Name:LEE Yejoo
Gender:Female
Country:Republic of Korea
-----
Full Name:LEE Wonseop
Gender:Male
Country:Republic of Korea
Rank:7
Score:50.40 + 44.85 + 38.40 + 44.20 + 50.70 = 228.55
-----
Full Name:OH Sooyeon
Gender:Female
Country:Republic of Korea
-----
Full Name:JANSEN Inge
Gender:Female
Country:Netherlands
-----
Full Name:PRAASTERINK Else
Gender:Female
Country:Netherlands
-----
Full Name:VAN DUIJN Celine
Gender:Female
Country:Netherlands
-----
Full Name:BLAZOWSKA Aleksandra
Gender:Female
Country:Poland
-----
Full Name:JACHIM Filip
Gender:Male
Country:Poland
-----
Full Name:LESIAK Kacper
Gender:Male
Country:Poland
-----
Full Name:LUKASZEWICZ Robert
Gender:Male
Country:Poland
-----
Full Name:RZESZUTEK Andrzej
Gender:Male
Country:Poland
-----
Full Name:SKRZEK Kaja
Gender:Female
Country:Poland
-----
Full Name:MUSCALU Nicoleta-Angelica
Gender:Female
Country:Romania
-----
Full Name:COQUOZ Madeline
Gender:Female
Country:Switzerland
-----
Full Name:DUTOIT Guillaume
Gender:Male
Country:Switzerland
-----
Full Name:SUCKOW Jonathan
Gender:Male
Country:Switzerland
-----
Full Name:LUNDIN Amanda
Gender:Female
Country:Sweden
Rank:8
Score:45.60 + 36.80 + 46.80 + 46.80 + 46.80 = 222.80
-----
Full Name:AVANESOV Danylo
Gender:Male
Country:Ukraine
-----
Full Name:AZAROV Kyrylo
Gender:Male
Country:Ukraine
-----
Full Name:CHYZHOVSKYI Bohdan
Gender:Male
Country:Ukraine
-----
Full Name:HRYTSENKO Mark
Gender:Male
Country:Ukraine
-----
Full Name:KESAR Viktoriya
Gender:Female
Country:Ukraine
-----
Full Name:KONOVALOV Danylo
Gender:Male
Country:Ukraine
-----
Full Name:NAUMENKO Yevhen
Gender:Male
Country:Ukraine
-----
Full Name:OLIFERCHYK Stanislav
Gender:Male
Country:Ukraine
Full Name:LEE Yejoo
Rank:9
Score:43.20 + 41.40 + 43.20 + 41.60 + 39.60 = 209.00
-----
Full Name:
PYSMENSKA Ann
a
Gender:Female
Country:Ukraine
Full Name:
JELINKOVA Terez
a
Rank:10
Score:46.80 + 42.90 + 41.40 + 26.40 + 38.50 = 196.00
-----
Full Name:
KACHANOV Vyacheslav
Gender:Male
Country:Uzbekistan
Full Name:
SHARIA Tekle
Rank:11
Score:38.40 + 41.60 + 30.00 + 30.45 + 34.10 = 174.55
-----
Full Name:
MYALIN Igor
Gender:Male
Country:Uzbekistan
Full Name:
SANTIAGO Dominique
Rank:12
Score:42.00 + 18.20 + 35.70 + 34.50 + 32.55 = 162.95
-----
DWASearch/src/main/java/org/example/DWASearch.java
浏览文件 @
68478a6f
...
...
@@ -39,11 +39,29 @@ public class DWASearch {
// } catch (IOException e) {
// e.printStackTrace();
// }
String
jsonFile
=
"src/data/athletes.json"
;
String
outputFile
=
"output.txt"
;
try
(
BufferedWriter
bw
=
new
BufferedWriter
(
new
FileWriter
(
outputFile
)))
{
getAthletes
(
jsonFile
,
bw
);
String
line
=
"result women 1m springboard"
;
String
[]
word
=
line
.
split
(
" "
);
//from here
// Process the input data here
// For example, write the input data to the output file
if
(
word
[
0
].
equals
(
"players"
)&&
word
.
length
==
1
)
{
String
jsonFile
=
"src/data/athletes.json"
;
getAthletes
(
jsonFile
,
bw
);
}
else
if
(
word
[
0
].
equals
(
"result"
)){
if
(
word
[
word
.
length
-
1
].
equals
(
"detail"
)){
}
else
{
String
jsonFile
=
"src/data/women 1m springboard.json"
;
getResultSimple
(
jsonFile
,
bw
);
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -65,5 +83,27 @@ public class DWASearch {
}
public
static
void
getResultSimple
(
String
jsonFile
,
BufferedWriter
bw
)
throws
IOException
{
String
content
=
FileUtils
.
readFileToString
(
new
File
(
jsonFile
),
StandardCharsets
.
UTF_8
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
content
);
JSONArray
jsonArray
=
JSON
.
parseArray
(
jsonObject
.
getString
(
"Heats"
));
JSONObject
jsonObject1
=
JSON
.
parseObject
(
jsonArray
.
getString
(
0
));
JSONArray
jsonArray1
=
JSON
.
parseArray
(
jsonObject1
.
getString
(
"Results"
));
for
(
int
i
=
0
;
i
<
jsonArray1
.
size
();
i
++){
JSONObject
result
=
JSON
.
parseObject
(
jsonArray1
.
getString
(
i
));
Double
total
=
result
.
getDouble
(
"TotalPoints"
);
String
fullName
=
result
.
getString
(
"FullName"
);
int
rank
=
result
.
getIntValue
(
"Rank"
);
JSONArray
resultDetails
=
JSON
.
parseArray
(
result
.
getString
(
"Dives"
));
Double
[]
score
=
new
Double
[
resultDetails
.
size
()];
for
(
int
j
=
0
;
j
<
resultDetails
.
size
();
j
++){
JSONObject
detail
=
JSON
.
parseObject
(
resultDetails
.
getString
(
j
));
score
[
j
]
=
detail
.
getDouble
(
"DivePoints"
);
}
ResultSimply
resultSimply
=
new
ResultSimply
(
fullName
,
rank
,
score
,
total
);
bw
.
write
(
resultSimply
.
toString
());
}
}
}
\ No newline at end of file
DWASearch/src/main/java/org/example/ResultSimply.java
0 → 100644
浏览文件 @
68478a6f
package
org.example
;
import
java.util.Arrays
;
public
class
ResultSimply
{
private
String
FullName
;
private
int
Rank
;
private
Double
[]
Score
;
private
Double
TotalPoints
;
public
ResultSimply
(
String
fullName
,
int
rank
,
Double
[]
score
,
Double
totalPoints
)
{
FullName
=
fullName
;
Rank
=
rank
;
Score
=
score
;
TotalPoints
=
totalPoints
;
}
@Override
public
String
toString
()
{
String
ss
=
"Full Name:"
+
FullName
+
"\nRank:"
+
Rank
+
"\nScore:"
+
String
.
format
(
"%.2f"
,
Score
[
0
]);
for
(
int
i
=
1
;
i
<
Score
.
length
;
i
++){
ss
+=
" + "
+
String
.
format
(
"%.2f"
,
Score
[
i
]);
}
ss
=
ss
+
" = "
+
String
.
format
(
"%.2f"
,
TotalPoints
)
+
"\n-----\n"
;
return
ss
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录