+ private void checkOrderingInheritance(ClassDescriptor superCd, ClassDescriptor cd) {
+ // here, we're going to check that sub class keeps same relative orderings
+ // in respect to super class
+
+ SSJavaLattice<String> superLattice = ssjava.getClassLattice(superCd);
+ SSJavaLattice<String> subLattice = ssjava.getClassLattice(cd);
+
+ Set<Pair<String, String>> superPairSet = superLattice.getOrderingPairSet();
+ Set<Pair<String, String>> subPairSet = subLattice.getOrderingPairSet();
+
+ for (Iterator iterator = superPairSet.iterator(); iterator.hasNext();) {
+ Pair<String, String> pair = (Pair<String, String>) iterator.next();
+
+ if (!subPairSet.contains(pair)) {
+ throw new Error("Subclass '" + cd + "' does not have the relative ordering '"
+ + pair.getSecond() + " < " + pair.getFirst() + "' that is defined by its superclass '"
+ + superCd + "'.");
+ }
+ }
+
+ }
+