Ejemplo n.º 1
0
/*****************************************************************************
  Create a Decision node that is a split in the tree.
 
  @param {ValueP, char, int, MushroomP, MushroomP, ValueP} splitValue, letter, attribute, positiveShrooms, negativeShrooms, availableValues
  @return {DecisionP} pointer to the split for attaching to the parent node
 *****************************************************************************/
DecisionP createSplitNode( ValueP splitValue, char letter, int attribute, MushroomP positiveShrooms, MushroomP negativeShrooms, ValueP availableValues, int mushroomCount ){
  DecisionP decision;
  decision = newDecision();
 
  decision->isLeaf = 0;
  decision->splitValue = splitValue;
  decision->mushroomCount = mushroomCount;
  decision->left = createDecisionTree( letter, attribute, positiveShrooms, cloneValues( availableValues ) );
  decision->right = createDecisionTree( letter, attribute, negativeShrooms, cloneValues( availableValues ) );
	
  return decision;
}
Ejemplo n.º 2
0
struct annoFilter *annoFilterCloneList(struct annoFilter *list)
/* Copy a list of annoFilters. */
{
struct annoFilter *newList = NULL, *oldF;
for (oldF = list;  oldF != NULL;  oldF = oldF->next)
    {
    struct annoFilter *newF = CloneVar(oldF);
    newF->label = cloneString(oldF->label);
    newF->values = cloneValues(oldF->values, oldF->type);
    slAddHead(&newList, newF);
    }
slReverse(&newList);
return newList;
}