Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangkb
indicators
Commits
77b79e0e
Commit
77b79e0e
authored
Jun 08, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改排名逻辑
parent
41339ac0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
33 deletions
+22
-33
CalculateUtils.java
...n/java/com/keymobile/indicators/utils/CalculateUtils.java
+22
-33
No files found.
src/main/java/com/keymobile/indicators/utils/CalculateUtils.java
View file @
77b79e0e
...
@@ -72,6 +72,8 @@ public class CalculateUtils {
...
@@ -72,6 +72,8 @@ public class CalculateUtils {
int
order
=
0
;
int
order
=
0
;
Double
headIndValue
=
0.0
;
Double
headIndValue
=
0.0
;
int
i
=
0
;
int
i
=
0
;
int
isEquals
=
0
;
int
equalsCount
=
1
;
for
(
Entry
<
String
,
Double
>
entry
:
compareMap
.
entrySet
())
{
for
(
Entry
<
String
,
Double
>
entry
:
compareMap
.
entrySet
())
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
result
.
put
(
entry
.
getKey
(),
1
);
result
.
put
(
entry
.
getKey
(),
1
);
...
@@ -81,8 +83,16 @@ public class CalculateUtils {
...
@@ -81,8 +83,16 @@ public class CalculateUtils {
}
}
if
(
entry
.
getValue
().
equals
(
headIndValue
))
{
if
(
entry
.
getValue
().
equals
(
headIndValue
))
{
result
.
put
(
entry
.
getKey
(),
order
);
result
.
put
(
entry
.
getKey
(),
order
);
isEquals
=
1
;
equalsCount
+=
1
;
}
else
{
if
(
isEquals
==
1
)
{
order
+=
equalsCount
;
isEquals
=
0
;
equalsCount
=
1
;
}
else
{
}
else
{
order
+=
1
;
order
+=
1
;
}
result
.
put
(
entry
.
getKey
(),
order
);
result
.
put
(
entry
.
getKey
(),
order
);
}
}
headIndValue
=
entry
.
getValue
();
headIndValue
=
entry
.
getValue
();
...
@@ -204,38 +214,17 @@ public class CalculateUtils {
...
@@ -204,38 +214,17 @@ public class CalculateUtils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// System.out.println(AviatorEvaluator.execute("(35.9756-84.4884)/(35.9756-2556.3310)*10"));
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"1001"
,
"1"
);
// Map<String, Object> env = Maps.newHashMap();
map
.
put
(
"1002"
,
"2"
);
// env.put("F004", 18471.8080);
map
.
put
(
"1003"
,
"3"
);
// env.put("F002", 197125.8532);
map
.
put
(
"1004"
,
"4"
);
// // 输出的是6.333333333333333
map
.
put
(
"1005"
,
"4"
);
// System.out.println(AviatorEvaluator.execute("F004/F002*100", env));
map
.
put
(
"1006"
,
"5"
);
map
.
put
(
"1007"
,
"6"
);
// List<String> values = new ArrayList<>();
map
.
put
(
"1008"
,
"3"
);
// values.add("0");
CalculateUtils
cal
=
new
CalculateUtils
();
// values.add("18");
Map
<
String
,
Integer
>
result
=
cal
.
rankValue
(
map
,
"1"
);
// values.add("18");
System
.
out
.
println
(
result
);
// values.add("17.2837");
// CalculateUtils cal = new CalculateUtils();
// String average = cal.sumValue(values);
// System.out.println(average);
// Map<String,String> map = new HashMap<>();
// map.put("1", "NaN");
// map.put("2", "12.3345");
// map.put("3", "9.2349");
// map.put("4", "10.2457");
// map.put("5", "7.2221");
// map.put("6", "10.2457");
// map.put("7", "NaN");
// map.put("8", "8.343");
// CalculateUtils cal = new CalculateUtils();
// Map<String,Integer> result = cal.rankValue(map, "1");
// System.out.println(result);
String
version
=
"1.0"
;
double
anoterVersion
=
Double
.
valueOf
(
version
)+
1
;
System
.
out
.
println
(
String
.
valueOf
(
anoterVersion
));
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment