@Override protected Set<V> createSet() { return new ArraySet<>(); }
private ArraySet(Collection<T> other) { this(other.size(), true); addAll(other); }
@Override public Iterator<? extends U> getSuccLabels(T N) { return nodeToSuccLabels.get(N).iterator(); }
Collection<PointerKeyAndState> matchingTrackedQueried(PointerKeyAndState curPkAndState, PointerKey succPk, IFlowLabel label) { Collection<PointerKeyAndState> ret = ArraySet.make(); assert label.isBarred(); final State curState = curPkAndState.getState(); Set<State> succPkStates = trackedQueried.get(succPk); for (State succState : succPkStates) { State transState = stateMachine.transition(succState, label); if (transState.equals(curState)) { ret.add(new PointerKeyAndState(succPk, succState)); } } return ret; }
@Override public boolean remove(Object obj_) { int ind; for (ind = 0; ind < _curIndex && !_elems[ind].equals(obj_); ind++) { } // check if object was never there if (ind == _curIndex) return false; return remove(ind); }
@Override protected Set<V> emptySet() { return ArraySet.<V> empty(); }
/** * @throws UnsupportedOperationException if this {@link ArraySet} is immutable (optional) */ @Override @SuppressWarnings("all") public boolean add(T o) { if (o == null) { throw new IllegalArgumentException("null o"); } if (checkDupes && this.contains(o)) { return false; } if (_curIndex == _elems.length) { // lengthen array _elems = Arrays.copyOf(_elems, _elems.length * 2); } _elems[_curIndex] = o; _curIndex++; return true; }
@Override public Iterator<? extends U> getSuccLabels(T N) { return nodeToSuccLabels.get(N).iterator(); }
Collection<PointerKeyAndState> matchingTrackedQueried(PointerKeyAndState curPkAndState, PointerKey succPk, IFlowLabel label) { Collection<PointerKeyAndState> ret = ArraySet.make(); assert label.isBarred(); final State curState = curPkAndState.getState(); Set<State> succPkStates = trackedQueried.get(succPk); for (State succState : succPkStates) { State transState = stateMachine.transition(succState, label); if (transState.equals(curState)) { ret.add(new PointerKeyAndState(succPk, succState)); } } return ret; }
@Override public boolean remove(Object obj_) { int ind; for (ind = 0; ind < _curIndex && !_elems[ind].equals(obj_); ind++) { } // check if object was never there if (ind == _curIndex) return false; return remove(ind); }
@Override protected Set<V> emptySet() { return ArraySet.<V> empty(); }
/** * @throws UnsupportedOperationException if this {@link ArraySet} is immutable (optional) */ @Override @SuppressWarnings("all") public boolean add(T o) { if (o == null) { throw new IllegalArgumentException("null o"); } if (checkDupes && this.contains(o)) { return false; } if (_curIndex == _elems.length) { // lengthen array _elems = Arrays.copyOf(_elems, _elems.length * 2); } _elems[_curIndex] = o; _curIndex++; return true; }
@Override protected Set<V> createSet() { return new ArraySet<>(); }
@Override public Iterator<? extends U> getPredLabels(T N) { return nodeToPredLabels.get(N).iterator(); }
/** * @param label the label of the edge from curPk to predPk (must be barred) * @return those {@link PointerKeyAndState}s whose points-to sets have been queried, such that the {@link PointerKey} is predPk, * and transitioning from its state on {@code label.bar()} yields the state of {@code curPkAndState} */ protected Collection<PointerKeyAndState> matchingPToQueried(PointerKeyAndState curPkAndState, PointerKey predPk, IFlowLabel label) { Collection<PointerKeyAndState> ret = ArraySet.make(); assert label.isBarred(); IFlowLabel unbarredLabel = label.bar(); final State curState = curPkAndState.getState(); Set<State> predPkStates = pointsToQueried.get(predPk); for (State predState : predPkStates) { State transState = stateMachine.transition(predState, unbarredLabel); if (transState.equals(curState)) { // we have a winner! ret.add(new PointerKeyAndState(predPk, predState)); } } return ret; }