Last change
on this file was 201, checked in by Katsuhide Fujita, 5 years ago |
Add ANAC 2019 agents (2)
|
-
Property svn:executable
set to
*
|
File size:
895 bytes
|
Rev | Line | |
---|
[201] | 1 | package agents.anac.y2019.agentgg;
|
---|
| 2 |
|
---|
| 3 | import genius.core.issue.Value;
|
---|
| 4 |
|
---|
| 5 | import java.util.Comparator;
|
---|
| 6 |
|
---|
| 7 | //importance单元
|
---|
| 8 | public class impUnit {
|
---|
| 9 | public Value valueOfIssue;
|
---|
| 10 | public int weightSum = 0;
|
---|
| 11 | public int count = 0;
|
---|
| 12 | public double meanWeightSum = 0.0f;
|
---|
| 13 |
|
---|
| 14 | public impUnit(Value value) {
|
---|
| 15 | this.valueOfIssue = value;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | public String toString() {
|
---|
| 19 | return String.format("%s %f", valueOfIssue, meanWeightSum);
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 | //重写comparator接口
|
---|
| 24 | static class meanWeightSumComparator implements Comparator<impUnit> {
|
---|
| 25 | public int compare(impUnit o1, impUnit o2) {// 实现接口中的方法
|
---|
| 26 | if (o1.meanWeightSum < o2.meanWeightSum) {
|
---|
| 27 | return 1;
|
---|
| 28 | } else if (o1.meanWeightSum > o2.meanWeightSum) {
|
---|
| 29 | return -1;
|
---|
| 30 | }
|
---|
| 31 | return 0;
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.