F2SF.java
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package is2.data;
final public class F2SF extends IFV {
final private float[] parameters;
public float score =0;
public F2SF(float[] p) {
parameters =p;
}
@Override
final public void add(int i) {
if (i>0) score += parameters[i];
}
final public void add(int[] i) {
for(int k=0;k<i.length;k++) {
if (i[k]>0) score += parameters[i[k]];
}
}
final public void sub(float[] px,int i, Long2IntInterface li) {
if (i>0) {
score -= px[li.l2i(i)];
// score -= px[i];
//else score -=px[];
}
}
@Override
public void clear() {
score =0;
}
/* (non-Javadoc)
* @see is2.IFV#getScore()
*/
@Override
public double getScore() {
return score;
}
public float getScoreF() {
return score;
}
/* (non-Javadoc)
* @see is2.IFV#clone()
*/
@Override
public IFV clone() {
return new F2SF(this.parameters);
}
/**
* @param l2i
*/
public void addRel(int i, float f) {
if (i>0) score += parameters[i]*f;
}
public int length() {
return this.parameters.length;
}
}