private Instance updateDecisionList(Random random,Instance example) throws Exception {
  ArrayList<Test> TestList;
  Instances format=getDatasetFormat();
  if (format == null) {
    throw new Exception("Dataset format not defined.");
  }
  TestList=generateTestList(random,example);
  int maxSize=getMaxRuleSize() < TestList.size() ? getMaxRuleSize() : TestList.size();
  int ruleSize=((int)(random.nextDouble() * (maxSize - getMinRuleSize()))) + getMinRuleSize();
  RuleList newRule=new RuleList();
  for (int i=0; i < ruleSize; i++) {
    int testIndex=(int)(random.nextDouble() * TestList.size());
    Test test=TestList.get(testIndex);
    newRule.addTest(test);
    TestList.remove(testIndex);
  }
  double newClassValue=0.0;
  if (m_DecisionList.size() > 0) {
    RuleList r=(m_DecisionList.get(m_DecisionList.size() - 1));
    double oldClassValue=(r.getClassValue());
    newClassValue=(double)((int)oldClassValue + 1) % getNumClasses();
  }
  newRule.setClassValue(newClassValue);
  m_DecisionList.add(newRule);
  example=(Instance)example.copy();
  example.setDataset(format);
  example.setClassValue(newClassValue);
  return example;
}

private Instance updateDecisionList ( Random random , Instance example ) throws Exception { ArrayList < Test > TestList ; Instances format = getDatasetFormat ( ) ; if ( format == null ) { throw new Exception ( "Dataset format not defined." ) ; } TestList = generateTestList ( random , example ) ; int maxSize = getMaxRuleSize ( ) < TestList . size ( ) ? getMaxRuleSize ( ) : TestList . size ( ) ; int ruleSize = ( ( int ) ( random . nextDouble ( ) * ( maxSize - getMinRuleSize ( ) ) ) ) + getMinRuleSize ( ) ; RuleList newRule = new RuleList ( ) ; for ( int i = 0 ; i < ruleSize ; i ++ ) { int testIndex = ( int ) ( random . nextDouble ( ) * TestList . size ( ) ) ; Test test = TestList . get ( testIndex ) ; newRule . addTest ( test ) ; TestList . remove ( testIndex ) ; } double newClassValue = 0.0 ; if ( m_DecisionList . size ( ) > 0 ) { RuleList r = ( m_DecisionList . get ( m_DecisionList . size ( ) - 1 ) ) ; double oldClassValue = ( r . getClassValue ( ) ) ; newClassValue = ( double ) ( ( int ) oldClassValue + 1 ) % getNumClasses ( ) ; } newRule . setClassValue ( newClassValue ) ; m_DecisionList . add ( newRule ) ; example = ( Instance ) example . copy ( ) ; example . setDataset ( format ) ; example . setClassValue ( newClassValue ) ; return example ; }
generates a new rule for the decision list . and classifies the new example
