/** * Determine the relationship of one item type to another. * @param t1 the first item type * @param t2 the second item type * @return {@link #SAME_TYPE} if the types are the same; {@link #SUBSUMES} if the first * type subsumes the second (that is, all instances of the second type are also instances * of the first); {@link #SUBSUMED_BY} if the second type subsumes the first; * {@link #OVERLAPS} if the two types overlap (have a non-empty intersection, but neither * subsumes the other); {@link #DISJOINT} if the two types are disjoint (have an empty intersection) */ public int relationship(ItemType t1, ItemType t2) { if (t1 == null) { throw new NullPointerException(); } if (t1.equals(t2)) { return SAME_TYPE; } ItemTypePair pair = new ItemTypePair(t1, t2); Integer result = (Integer)map.get(pair); if (result == null) { final int r = computeRelationship(t1, t2); result = new Integer(r); map.put(pair, result); } return result.intValue(); }
/** * Determine the relationship of one item type to another. * @param t1 the first item type * @param t2 the second item type * @return {@link #SAME_TYPE} if the types are the same; {@link #SUBSUMES} if the first * type subsumes the second (that is, all instances of the second type are also instances * of the first); {@link #SUBSUMED_BY} if the second type subsumes the first; * {@link #OVERLAPS} if the two types overlap (have a non-empty intersection, but neither * subsumes the other); {@link #DISJOINT} if the two types are disjoint (have an empty intersection) */ public int relationship(ItemType t1, ItemType t2) { if (t1 == null) { throw new NullPointerException(); } if (t1.equals(t2)) { return SAME_TYPE; } ItemTypePair pair = new ItemTypePair(t1, t2); Integer result = (Integer)map.get(pair); if (result == null) { final int r = computeRelationship(t1, t2); result = new Integer(r); map.put(pair, result); } return result.intValue(); }
Integer result = map.get(pair); if (result == null) { result = computeRelationship(t1, t2); map.put(pair, result);
Integer result = map.get(pair); if (result == null) { result = computeRelationship(t1, t2); map.put(pair, result);