code: public static boolean contextIsCompatible(InstancesHeader originalContext,
              InstancesHeader newContext) {
  
          if (newContext.numClasses() < originalContext.numClasses()) {
              return false; // rule 1
          }
          if (newContext.numAttributes() < originalContext.numAttributes()) {
              return false; // rule 2
          }
          int oPos = 0;
          int nPos = 0;
          while (oPos < originalContext.numAttributes()) {
              if (oPos == originalContext.classIndex()) {
                  oPos++;
                  if (!(oPos < originalContext.numAttributes())) {
                      break;
                  }
              }
              if (nPos == newContext.classIndex()) {
                  nPos++;
              }
              if (originalContext.attribute(oPos).isNominal()) {
                  if (!newContext.attribute(nPos).isNominal()) {
                      return false; // rule 4
                  }
                  if (newContext.attribute(nPos).numValues() < originalContext.attribute(oPos).numValues()) {
                      return false; // rule 3
                  }
              } else {
                  assert (originalContext.attribute(oPos).isNumeric());
                  if (!newContext.attribute(nPos).isNumeric()) {
                      return false; // rule 4
                  }
              }
              oPos++;
              nPos++;
          }
          return true; // all checks clear
      }
docs: Returns if two contexts or headers of instances are compatible.<br><br>
  
  Two contexts are compatible if they follow the following rules:<br>
  Rule 1: num classes can increase but never decrease<br>
  Rule 2: num attributes can increase but never decrease<br>
  Rule 3: num nominal attribute values can increase but never decrease<br>
  Rule 4: attribute types must stay in the same order (although class
  can move; is always skipped over)<br><br>
  
  Attribute names are free to change, but should always still represent
  the original attributes.
  
  @param originalContext the first context to compare
  @param newContext the second context to compare
  @return true if the two contexts are compatible.