/** * @param toCmp * @param testCondition associated with each decision tree node, int index for features included * in CandleStick 0-time, 1-high bid price, 2-low bid price, 3-close bid price * @return */ public int compareWith(CandleStick toCmp, int testCondition) { if (testCondition == 0) { return this.getTime().compareTo(toCmp.getTime()); } else if (testCondition == 1) { return this.getHigh().compareTo(toCmp.getHigh()); } else if (testCondition == 2) { return this.getLow().compareTo(toCmp.getLow()); } else if (testCondition == 3) { return this.getClose().compareTo(toCmp.getClose()); } else { System.err.println("invalid attribute idx...error"); return 0; } }
@Override public int compare(CandleStick o1, CandleStick o2) { // TODO Auto-generated method stub return o1.getHigh().compareTo(o2.getHigh()); }