Exemplo n.º 1
0
 /*
  * Does not recalculate if greedySplits are already cached.
  */
 private void findGreedySplits() {
   if (greedySplits != null) return;
   sortSplits();
   int nGreedySplits = idg.getIdCount() - 3;
   greedySplits = new Vector<Split>(nGreedySplits);
   greedySplitIndex = new Vector<Integer>(nGreedySplits);
   for (int i = 0; i < sortedSplits.size() && greedySplits.size() < nGreedySplits; i++) {
     String splitStr = sortedSplits.elementAt(i);
     Split split = splits.get(splitStr);
     if (split.compatible(greedySplits)) {
       greedySplits.add(split);
       greedySplitIndex.add(i);
     }
   }
 }
  static void markNode(IdGroup idGroup, Node node, boolean[] split) {
    if (node.isLeaf()) {
      String name = node.getIdentifier().getName();
      int index = idGroup.whichIdNumber(name);

      if (index < 0) {
        throw new IllegalArgumentException("INCOMPATIBLE IDENTIFIER (" + name + ")");
      }

      split[index] = true;
    } else {
      for (int i = 0; i < node.getChildCount(); i++) {
        markNode(idGroup, node.getChild(i), split);
      }
    }
  }
Exemplo n.º 3
0
 @Override
 public int whichIdNumber(String name) {
   return idg.whichIdNumber(name);
 }
Exemplo n.º 4
0
 @Override
 public void setIdentifier(int i, Identifier id) {
   idg.setIdentifier(i, id);
 };
Exemplo n.º 5
0
 @Override
 public Identifier getIdentifier(int i) {
   return idg.getIdentifier(i);
 }
Exemplo n.º 6
0
 /*
  * Methods to implement IdGroup, which just pass through to 'idg' member
  */
 @Override
 public int getIdCount() {
   return idg.getIdCount();
 }