/** * Return the (integer) value number for a given variable * * @param name name of the variable to look up * @return its value number */ int getValueNumber(Object name) { ValueGraphVertex v = valueGraph.getVertex(name); if (v == null) { return UNKNOWN; } return v.getValueNumber(); }
/** * Definitely-different relation. Returns true for the following cases: * * <ul> * <li>name1 and name2 are both constants, but don't match * <li>name1 and name2 both result from NEW statements, but don't match * <li>one of name1 and name2 is a parameter, and the other results from a new statement * </ul> * * <p>TODO: add more smarts * * @param name1 name of first object to compare * @param name2 name of second object to compare * @return true iff the value numbers for two variables are definitely different */ boolean DD(Object name1, Object name2) { ValueGraphVertex v1 = valueGraph.getVertex(name1); ValueGraphVertex v2 = valueGraph.getVertex(name2); return DD(v1.getValueNumber(), v2.getValueNumber()); }
GVCongruenceClass congruenceClass(Object name) { ValueGraphVertex v = valueGraph.getVertex(name); return B.get(v.getValueNumber()); }
/** * Definitely-same relation. * * @param name1 first variable * @param name2 second variable * @return true iff the value numbers for two variables are equal */ boolean DS(Object name1, Object name2) { ValueGraphVertex v1 = valueGraph.getVertex(name1); ValueGraphVertex v2 = valueGraph.getVertex(name2); return v1.getValueNumber() == v2.getValueNumber(); }