public void endRepresentation(){
  if (!representationProtectionsSet) {
    if (currentRepresentationProtections != null) {
      Collections.sort(currentRepresentationProtections,this);
    }
    representationProtections=currentRepresentationProtections;
    representationProtectionsSet=true;
  }
 else {
    if (currentRepresentationProtections == null) {
      Assertions.checkState(representationProtections == null);
    }
 else {
      Collections.sort(currentRepresentationProtections,this);
      Assertions.checkState(currentRepresentationProtections.equals(representationProtections));
    }
  }
  currentRepresentationProtections=null;
}

public void endRepresentation ( ) { if ( ! representationProtectionsSet ) { if ( currentRepresentationProtections != null ) { Collections . sort ( currentRepresentationProtections , this ) ; } representationProtections = currentRepresentationProtections ; representationProtectionsSet = true ; } else { if ( currentRepresentationProtections == null ) { Assertions . checkState ( representationProtections == null ) ; } else { Collections . sort ( currentRepresentationProtections , this ) ; Assertions . checkState ( currentRepresentationProtections . equals ( representationProtections ) ) ; } } currentRepresentationProtections = null ; }
should be invoked after processing each child representation element , in order to apply consistency checks .
