1 | package agents.anac.y2013.MetaAgent.parser.cart.tree;
|
---|
2 |
|
---|
3 | public class SurrogateSplit extends Split {
|
---|
4 | String _name;
|
---|
5 | double _value;
|
---|
6 | PrimarySplit.Direction _direction;
|
---|
7 | double _agree;
|
---|
8 | double _adj;
|
---|
9 | int _splitsCount;
|
---|
10 |
|
---|
11 | private SurrogateSplit(String name, double value, PrimarySplit.Direction direction,
|
---|
12 | double agree, double adj, int splitsCount) {
|
---|
13 | super(name,value,direction);
|
---|
14 | this._agree = agree;
|
---|
15 | this._adj = adj;
|
---|
16 | this._splitsCount = splitsCount;
|
---|
17 | }
|
---|
18 |
|
---|
19 |
|
---|
20 | public static SurrogateSplit factory(String text){
|
---|
21 | text=text.trim();
|
---|
22 | String[]wordstext=text.split(" +");
|
---|
23 | String name=wordstext[0];
|
---|
24 | double value=Double.parseDouble(wordstext[2]);
|
---|
25 | PrimarySplit.Direction dir;
|
---|
26 | if(wordstext[5].contains("left"))
|
---|
27 | dir=PrimarySplit.Direction.LEFT;
|
---|
28 | else
|
---|
29 | dir=PrimarySplit.Direction.RIGHT;
|
---|
30 |
|
---|
31 |
|
---|
32 | double agree=Double.parseDouble(Node.substring(text,"agree=",","));
|
---|
33 | double adj=Double.parseDouble(Node.substring(text,"adj=",","));
|
---|
34 | int count=Integer.parseInt(Node.substring(text, "(",text.indexOf("split")).trim());
|
---|
35 | SurrogateSplit s=new SurrogateSplit(name, value, dir, agree, adj, count);
|
---|
36 | return s;
|
---|
37 |
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public String toString() {
|
---|
42 | return "SurrogateSplit [_name=" + _name + ", _value=" + _value
|
---|
43 | + ", _direction=" + _direction + ", _agree=" + _agree + ", _adj="
|
---|
44 | + _adj + ", _splitsCount=" + _splitsCount + "]";
|
---|
45 | }
|
---|
46 | } |
---|