Esempio n. 1
0
 /**
  * Resets the tree values and state. All the values are set to Integer.MAX_VALUE and the states to
  * 0.
  */
 public void reset() {
   int k;
   // Set all values to Integer.MAX_VALUE
   // and states to 0
   for (k = lvls - 1; k >= 0; k--) {
     ArrayUtil.intArraySet(treeV[k], Integer.MAX_VALUE);
     ArrayUtil.intArraySet(treeS[k], 0);
   }
   // Invalidate saved tree
   saved = false;
 }
Esempio n. 2
0
 /**
  * Creates a tag tree encoder with 'w' elements along the horizontal dimension and 'h' elements
  * along the vertical direction. The total number of elements is thus 'vdim' x 'hdim'.
  *
  * <p>The values of all elements are initialized to Integer.MAX_VALUE.
  *
  * @param h The number of elements along the horizontal direction.
  * @param w The number of elements along the vertical direction.
  */
 public TagTreeEncoder(int h, int w) {
   int k;
   // Check arguments
   if (w < 0 || h < 0) {
     throw new IllegalArgumentException();
   }
   // Initialize elements
   init(w, h);
   // Set values to max
   for (k = treeV.length - 1; k >= 0; k--) {
     ArrayUtil.intArraySet(treeV[k], Integer.MAX_VALUE);
   }
 }
Esempio n. 3
0
 /**
  * Resets the tree values and state. The values are set to the values in 'val'. The states are all
  * set to 0.
  *
  * @param val The new values for the leafs, in lexicographical order.
  */
 public void reset(int val[]) {
   int k;
   // Set values for leaf level
   for (k = w * h - 1; k >= 0; k--) {
     treeV[0][k] = val[k];
   }
   // Calculate values at other levels
   recalcTreeV();
   // Set all states to 0
   for (k = lvls - 1; k >= 0; k--) {
     ArrayUtil.intArraySet(treeS[k], 0);
   }
   // Invalidate saved tree
   saved = false;
 }