@Override public void addNode(T n) { if (n == null) { throw new IllegalArgumentException("n is null"); } map.add(n); }
@Override public void addNode(T n) { if (n == null) { throw new IllegalArgumentException("n is null"); } map.add(n); }
@Override public void addNode(T n) { if (n == null) { throw new IllegalArgumentException("n is null"); } map.add(n); }
private static <T, L> OrdinalSetMapping<L> makeDomain(Map<T, Collection<L>> gen) { MutableMapping<L> result = MutableMapping.make(); if (gen == null) { throw new IllegalArgumentException("null gen"); } for (Collection<L> c : gen.values()) { for (L p : c) { result.add(p); } } return result; }
private int findOrCreateIndex(PointerKey key) { int result = pointerKeys.getMappedIndex(key); if (result == -1) { result = pointerKeys.add(key); } return result; }
private static <T, L> OrdinalSetMapping<L> makeDomain(Map<T, Collection<L>> gen) { MutableMapping<L> result = MutableMapping.make(); if (gen == null) { throw new IllegalArgumentException("null gen"); } for (Collection<L> c : gen.values()) { for (L p : c) { result.add(p); } } return result; }
public int findOrCreateIndexForInstanceKey(InstanceKey key) { int result = instanceKeys.getMappedIndex(key); if (result == -1) { result = instanceKeys.add(key); } if (DEBUG) { System.err.println("getIndexForInstanceKey " + key + ' ' + result); } return result; }
public int findOrCreateIndexForInstanceKey(InstanceKey key) { int result = instanceKeys.getMappedIndex(key); if (result == -1) { result = instanceKeys.add(key); } if (DEBUG) { System.err.println("getIndexForInstanceKey " + key + ' ' + result); } return result; }
private int findOrCreateIndex(PointerKey key) { int result = pointerKeys.getMappedIndex(key); if (result == -1) { result = pointerKeys.add(key); } return result; }
private OrdinalSetMapping<PointerKey> getPointerKeys() { MutableMapping<PointerKey> result = MutableMapping.make(); for (PointerKey p : getPointerAnalysis().getPointerKeys()) { result.add(p); } return result; }
private OrdinalSetMapping<PointerKey> getPointerKeys() { MutableMapping<PointerKey> result = MutableMapping.make(); for (PointerKey p : getPointerAnalysis().getPointerKeys()) { result.add(p); } return result; }
/** * @param c {@code Collection<IClass>} */ private static MutableMapping<InstanceKey> makeInstanceKeys(Collection<IClass> c) { if (c == null) { throw new IllegalArgumentException("null c"); } MutableMapping<InstanceKey> result = MutableMapping.make(); for (IClass klass : c) { if (!klass.isAbstract() && !klass.isInterface()) { result.add(new ConcreteTypeKey(klass)); } } return result; }
/** * @param c {@code Collection<IClass>} */ private static MutableMapping<InstanceKey> makeInstanceKeys(Collection<IClass> c) { if (c == null) { throw new IllegalArgumentException("null c"); } MutableMapping<InstanceKey> result = MutableMapping.make(); for (IClass klass : c) { if (!klass.isAbstract() && !klass.isInterface()) { result.add(new ConcreteTypeKey(klass)); } } return result; }
@Override @SuppressWarnings("unchecked") public OrdinalSet<InstanceKey> getPointsToSet(PointerKey key) { if (pointsToMap.isImplicit(key)) { return computeImplicitPointsToSet(key); } // special logic to handle contents of char[] from string constants. if (key instanceof InstanceFieldKey) { InstanceFieldKey ifk = (InstanceFieldKey) key; if (ifk.getInstanceKey() instanceof ConstantKey) { ConstantKey<?> i = (ConstantKey<?>) ifk.getInstanceKey(); if (i.getValue() instanceof String && i.getConcreteType().getClassLoader().getLanguage().equals(Language.JAVA)) { StringConstantCharArray contents = StringConstantCharArray.make((ConstantKey<String>) i); instanceKeys.add(contents); Collection<InstanceKey> singleton = HashSetFactory.make(); singleton.add(contents); return OrdinalSet.toOrdinalSet(singleton, instanceKeys); } } } PointsToSetVariable v = pointsToMap.getPointsToSet(key); if (v == null) { return OrdinalSet.empty(); } else { IntSet S = v.getValue(); return new OrdinalSet<>(S, instanceKeys); } }
@Override @SuppressWarnings("unchecked") public OrdinalSet<InstanceKey> getPointsToSet(PointerKey key) { if (pointsToMap.isImplicit(key)) { return computeImplicitPointsToSet(key); } // special logic to handle contents of char[] from string constants. if (key instanceof InstanceFieldKey) { InstanceFieldKey ifk = (InstanceFieldKey) key; if (ifk.getInstanceKey() instanceof ConstantKey) { ConstantKey<?> i = (ConstantKey<?>) ifk.getInstanceKey(); if (i.getValue() instanceof String && i.getConcreteType().getClassLoader().getLanguage().equals(Language.JAVA)) { StringConstantCharArray contents = StringConstantCharArray.make((ConstantKey<String>) i); instanceKeys.add(contents); Collection<InstanceKey> singleton = HashSetFactory.make(); singleton.add(contents); return OrdinalSet.toOrdinalSet(singleton, instanceKeys); } } } PointsToSetVariable v = pointsToMap.getPointsToSet(key); if (v == null) { return OrdinalSet.empty(); } else { IntSet S = v.getValue(); return new OrdinalSet<>(S, instanceKeys); } }