source: src/main/java/agents/anac/y2013/MetaAgent/parser/cart/tree/SurrogateSplit.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 1.3 KB
Line 
1package agents.anac.y2013.MetaAgent.parser.cart.tree;
2
3public class SurrogateSplit extends Split {
4 String _name;
5 double _value;
6 PrimarySplit.Direction _direction;
7 double _agree;
8 double _adj;
9 int _splitsCount;
10
11private 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
20public 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
41public String toString() {
42 return "SurrogateSplit [_name=" + _name + ", _value=" + _value
43 + ", _direction=" + _direction + ", _agree=" + _agree + ", _adj="
44 + _adj + ", _splitsCount=" + _splitsCount + "]";
45}
46}
Note: See TracBrowser for help on using the repository browser.