Package gnu.trove.list.array

Examples of gnu.trove.list.array.TIntArrayList


    index.put(11, 11.0);
    index.put(11, 11.0);
    index.put(11, 11.0);
    index.put(8, 8.0);

    final TIntArrayList list = index.getValues(ComparisonPredicate.LESS_OP, 10.0);
    // TIntArrayList list= index.getValues(ComparisonPredicate.GREATER_OP,
    // 7.0);

    for (int i = 0; i < list.size(); i++)
      LOG.info(list.get(i));

  }
View Full Code Here


   *            If it's a greater-equal search
   * @return
   */
  public TIntArrayList myGreater(KeyType key, boolean includeEqual) {

    final TIntArrayList values = new TIntArrayList();
    LeafNode<KeyType, TIntArrayList> ln;
    int keyIndex;

    boolean isFinalBreak = false;

    final boolean first = true;
    // Find leaf node where it should be
    ln = _index.findLeafNode(key);
    if (ln == null)
      return null;

    boolean keepGoing = false;

    // Iterate over leaf nodes
    do {
      keyIndex = -1;
      final int numSlots = ln.getSlots();

      // If this is the first leaf node -> Get the index of the key inside
      // leaf node
      // If it's one of the following leaf nodes, start from the beginning
      if (first)
        keyIndex = ln.getKeyIndex(key);

      if (keyIndex < 0)
        keyIndex = 0;

      // For each slot in the current leaf
      for (int s = keyIndex; s < numSlots; s++)
        if (keepGoing || ln.getKey(s).compareTo(key) > 0
            || (ln.getKey(s).compareTo(key) == 0 && includeEqual)) {
          if ((_diff != null && key.compareTo(performOperation(ln.getKey(s), _diff)) < 0))// second
          // part
          // for
          // ranges
          {
            isFinalBreak = true;
            break;
            // continue;
          }

          // Get the corresponding list with values and append its
          // contents to the final result
          final TIntArrayList slotVals = ln.getValue(s);
          for (int i = 0; i < slotVals.size(); i++)
            values.add(slotVals.get(i));

          keepGoing = true;
        }
      if (isFinalBreak)
        break;
View Full Code Here

    // one
    // only
    // for
    // ranges!

    final TIntArrayList values = new TIntArrayList();

    LeafNode<KeyType, TIntArrayList> ln = null;
    Node<KeyType, TIntArrayList> nd;
    boolean isFinalBreak = false;

    if (_diff == null) {
      // Get root
      if (_index.getRoot() instanceof MemoryInnerNode) {
        final MemoryInnerNode<KeyType, TIntArrayList> root = (MemoryInnerNode<KeyType, TIntArrayList>) _index
            .getRoot();
        if (root == null)
          return null;

        // Go down to left most node
        nd = root.getChild(0);
        while (nd != null && nd instanceof MemoryInnerNode)
          nd = ((MemoryInnerNode<KeyType, TIntArrayList>) nd).getChild(0);

        if (nd == null)
          return null;

        ln = (MemoryLeafNode<KeyType, TIntArrayList>) nd;
      } else
        ln = (MemoryLeafNode<KeyType, TIntArrayList>) _index.getRoot();
    } else {
      ln = _index.findLeafNode(performOperation(key, _diff));
      if (ln == null)
        return null;
    }

    // Iterate over leaf nodes
    do {
      // For each slot in the current leaf
      if (ln == null)
        break;
      for (int s = 0; s < ln.getSlots(); s++)
        // While the key is less or equal (if needed), continue
        if (ln.getKey(s).compareTo(key) < 0
            || (ln.getKey(s).compareTo(key) == 0 && includeEqual)) {
          if ((_diff != null && ln.getKey(s).compareTo(performOperation(key, _diff)) < 0))
            // break;
            continue;
          // Get the corresponding list with values and append its
          // contents to the final result
          final TIntArrayList slotVals = ln.getValue(s);
          for (int i = 0; i < slotVals.size(); i++)
            values.add(slotVals.get(i));
        } else {
          isFinalBreak = true;
          break;
        }
      if (isFinalBreak)
View Full Code Here

  @Override
  public void put(Integer row_id, KeyType key) {

    _index.findLeafNode(key);

    TIntArrayList idsList = _index.get(key);
    if (idsList == null) {
      idsList = new TIntArrayList(1);
      _index.put(key, idsList);

    }
    idsList.add(row_id);
  }
View Full Code Here

    return _index.get(key);
  }

  @Override
  public void put(Integer row_id, KeyType key) {
    TIntArrayList idsList = _index.get(key);
    if (idsList == null) {
      idsList = new TIntArrayList(1);
      _index.put(key, idsList);
    }
    idsList.add(row_id);

  }
View Full Code Here

    DisposableIntIterator iterator;

    public CacheIntIterator(DisposableIntIterator iterator) {
        this.iterator = iterator;
        values = new TIntArrayList();
    }
View Full Code Here

        super(new BoolVar[]{solver.ONE}, PropagatorPriority.VERY_SLOW, true);// adds solver.ONE to fit to the super constructor
    this.vars = new BoolVar[0]// erase solver.ONE from the variable scope

        this.indices_ = new TObjectIntHashMap<BoolVar>();
        sat_ = new SatSolver();
        early_deductions_ = new TIntArrayList();
        sat_trail_ = solver.getEnvironment().makeInt();
    }
View Full Code Here

            maxValue = Math.max(maxValue, vars[i].getUB());
        }
        nbMaxValues = maxValue - minValue + 1;
        bound = new TIntArrayList[nbMaxValues];
        for (int i = 0; i < nbMaxValues; i++) {
            bound[i] = new TIntArrayList();
        }
        minVal = new int[n];
        maxVal = new int[n];
        stamp = new TIntArrayList();
        kerRepresentant = new BitSet(n);
        orderedNodes = new int[n];
    }
View Full Code Here

    // METHODS
    //***********************************************************************************

    @Override
    public void propagate(int evtmask) throws ContradictionException {
        TIntArrayList fixedVar = new TIntArrayList();
        for (int i = 0; i < n; i++) {
            vars[i].updateLowerBound(offset, aCause);
            vars[i].updateUpperBound(n - 1 + offset, aCause);
            if (vars[i].isInstantiated() && i + offset != vars[i].getValue()) {
                fixedVar.add(i);
            }
        }
        for (int i = 0; i < fixedVar.size(); i++) {
            varInstantiated(fixedVar.get(i), vars[fixedVar.get(i)].getValue() - offset);
        }
    }
View Full Code Here

    // METHODS
    //***********************************************************************************

    @Override
    public void propagate(int evtmask) throws ContradictionException {
        TIntArrayList fixedVar = new TIntArrayList();
        for (int i = 0; i < n; i++) {
            vars[i].removeValue(i + offset, aCause);
            vars[i].updateLowerBound(offset, aCause);
            vars[i].updateUpperBound(n - 1 + offset, aCause);
            if (vars[i].isInstantiated()) {
                fixedVar.add(i);
            }
        }
        for (int i = 0; i < fixedVar.size(); i++) {
            varInstantiated(fixedVar.get(i), vars[fixedVar.get(i)].getValue() - offset);
        }
    }
View Full Code Here

TOP

Related Classes of gnu.trove.list.array.TIntArrayList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.