@Override public int getNumberOfStatementsThatDef(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return 0; } int result = delegateGraph.getPredNodeCount(v); for (IBinaryNaturalRelation R : implicitUnaryMap.values()) { IntSet s = R.getRelated(number); if (s != null) { result += s.size(); } } return result; }
@Override public int getNumberOfStatementsThatDef(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return 0; } int result = delegateGraph.getPredNodeCount(v); for (IBinaryNaturalRelation R : implicitUnaryMap.values()) { IntSet s = R.getRelated(number); if (s != null) { result += s.size(); } } return result; }
@Override @SuppressWarnings("unchecked") public Iterator<AbstractStatement> getStatementsThatDef(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return EmptyIterator.instance(); } Iterator<INodeWithNumber> result = delegateGraph.getPredNodes(v); for (int i = 0; i < implicitUnaryMap.size(); i++) { UnaryOperator op = implicitUnaryMap.getKey(i); IBinaryNaturalRelation R = implicitUnaryMap.getValue(i); IntSet s = R.getRelated(number); if (s != null) { result = new CompoundIterator<>(new ImplicitDefIterator(op, s, v), result); } } List<AbstractStatement> list = new ArrayList<>(); while (result.hasNext()) { list.add((AbstractStatement) result.next()); } return list.iterator(); }
@Override @SuppressWarnings("unchecked") public Iterator<AbstractStatement> getStatementsThatUse(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return EmptyIterator.instance(); } Iterator<INodeWithNumber> result = delegateGraph.getSuccNodes(v); for (int i = 0; i < invImplicitUnaryMap.size(); i++) { UnaryOperator op = invImplicitUnaryMap.getKey(i); IBinaryNaturalRelation R = invImplicitUnaryMap.getValue(i); IntSet s = R.getRelated(number); if (s != null) { result = new CompoundIterator<>(new ImplicitUseIterator(op, v, s), result); } } List<AbstractStatement> list = new ArrayList<>(); while (result.hasNext()) { list.add((AbstractStatement) result.next()); } return list.iterator(); }
/** * Note that this implementation consults the implicit relation for each and every operator cached. This will be inefficient if * there are many implicit operators. * * @throws IllegalArgumentException if v is null * */ @Override public int getNumberOfStatementsThatUse(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return 0; } int result = delegateGraph.getSuccNodeCount(v); for (IBinaryNaturalRelation R : invImplicitUnaryMap.values()) { IntSet s = R.getRelated(number); if (s != null) { result += s.size(); } } return result; }
/** * Note that this implementation consults the implicit relation for each and every operator cached. This will be inefficient if * there are many implicit operators. * * @throws IllegalArgumentException if v is null * */ @Override public int getNumberOfStatementsThatUse(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return 0; } int result = delegateGraph.getSuccNodeCount(v); for (IBinaryNaturalRelation R : invImplicitUnaryMap.values()) { IntSet s = R.getRelated(number); if (s != null) { result += s.size(); } } return result; }
@Override @SuppressWarnings("unchecked") public Iterator<AbstractStatement> getStatementsThatDef(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return EmptyIterator.instance(); } Iterator<INodeWithNumber> result = delegateGraph.getPredNodes(v); for (int i = 0; i < implicitUnaryMap.size(); i++) { UnaryOperator op = implicitUnaryMap.getKey(i); IBinaryNaturalRelation R = implicitUnaryMap.getValue(i); IntSet s = R.getRelated(number); if (s != null) { result = new CompoundIterator<>(new ImplicitDefIterator(op, s, v), result); } } List<AbstractStatement> list = new ArrayList<>(); while (result.hasNext()) { list.add((AbstractStatement) result.next()); } return list.iterator(); }
@Override @SuppressWarnings("unchecked") public Iterator<AbstractStatement> getStatementsThatUse(PointsToSetVariable v) { if (v == null) { throw new IllegalArgumentException("v is null"); } int number = v.getGraphNodeId(); if (number == -1) { return EmptyIterator.instance(); } Iterator<INodeWithNumber> result = delegateGraph.getSuccNodes(v); for (int i = 0; i < invImplicitUnaryMap.size(); i++) { UnaryOperator op = invImplicitUnaryMap.getKey(i); IBinaryNaturalRelation R = invImplicitUnaryMap.getValue(i); IntSet s = R.getRelated(number); if (s != null) { result = new CompoundIterator<>(new ImplicitUseIterator(op, v, s), result); } } List<AbstractStatement> list = new ArrayList<>(); while (result.hasNext()) { list.add((AbstractStatement) result.next()); } return list.iterator(); }
private void removeImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (DEBUG) { System.err.println(("removeImplicitStatement " + eq)); } int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); if (DEBUG) { System.err.println(("lhs rhs " + lhs + ' ' + rhs)); } IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, eq.getOperator()); R.remove(lhs, rhs); IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, eq.getOperator()); iR.remove(rhs, lhs); implicitUnaryCount--; }
private void removeImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (DEBUG) { System.err.println(("removeImplicitStatement " + eq)); } int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); if (DEBUG) { System.err.println(("lhs rhs " + lhs + ' ' + rhs)); } IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, eq.getOperator()); R.remove(lhs, rhs); IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, eq.getOperator()); iR.remove(rhs, lhs); implicitUnaryCount--; }
/** * @return true iff the graph already contains this equation */ private boolean containsImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (!containsVariable(eq.getLHS())) { return false; } if (!containsVariable(eq.getRightHandSide())) { return false; } int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); UnaryOperator op = eq.getOperator(); IBinaryNaturalRelation R = implicitUnaryMap.get(op); if (R != null) { return R.contains(lhs, rhs); } else { return false; } }
/** * @return true iff the graph already contains this equation */ private boolean containsImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (!containsVariable(eq.getLHS())) { return false; } if (!containsVariable(eq.getRightHandSide())) { return false; } int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); UnaryOperator op = eq.getOperator(); IBinaryNaturalRelation R = implicitUnaryMap.get(op); if (R != null) { return R.contains(lhs, rhs); } else { return false; } }
private void addImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (DEBUG) { System.err.println(("addImplicitStatement " + eq)); } delegateGraph.addVariable(eq.getLHS()); delegateGraph.addVariable(eq.getRightHandSide()); int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); if (DEBUG) { System.err.println(("lhs rhs " + lhs + ' ' + rhs)); } IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, eq.getOperator()); boolean b = R.add(lhs, rhs); if (b) { implicitUnaryCount++; IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, eq.getOperator()); iR.add(rhs, lhs); } }
private void addImplicitStatement(UnaryStatement<PointsToSetVariable> eq) { if (DEBUG) { System.err.println(("addImplicitStatement " + eq)); } delegateGraph.addVariable(eq.getLHS()); delegateGraph.addVariable(eq.getRightHandSide()); int lhs = eq.getLHS().getGraphNodeId(); int rhs = eq.getRightHandSide().getGraphNodeId(); if (DEBUG) { System.err.println(("lhs rhs " + lhs + ' ' + rhs)); } IBinaryNaturalRelation R = findOrCreateRelation(implicitUnaryMap, eq.getOperator()); boolean b = R.add(lhs, rhs); if (b) { implicitUnaryCount++; IBinaryNaturalRelation iR = findOrCreateRelation(invImplicitUnaryMap, eq.getOperator()); iR.add(rhs, lhs); } }
if (L.getGraphNodeId() > -1) { changedVariable(L);
if (L.getGraphNodeId() > -1) { changedVariable(L);