public String toString(){
  String str="";
  String followedBy="";
  int lastType=-1;
  String lastString="";
  int singlesCount=0;
  for (Enumeration e=formatConstraints.elements(); e.hasMoreElements(); ) {
    FormatConstraint constraint=(FormatConstraint)e.nextElement();
    if (constraint.count == FormatConstraint.COUNT_EXACTLY_ONE) {
      if (lastType != -1) {
        if (lastType != constraint.type) {
          str+=followedBy + singlesCount + lastString;
          followedBy=" followed by ";
          singlesCount=1;
          lastType=constraint.type;
          lastString=constraint.toString();
        }
 else {
          singlesCount++;
        }
      }
 else {
        lastType=constraint.type;
        lastString=constraint.toString();
        singlesCount=1;
      }
    }
 else {
      if (lastType != -1) {
        str+=followedBy + singlesCount + lastString;
        followedBy=" followed by ";
        lastType=-1;
        singlesCount=0;
        lastString="";
      }
      str+=followedBy + constraint.toString();
      followedBy=" followed by ";
    }
  }
  if (lastType != -1) {
    str+=followedBy + singlesCount + lastString;
  }
  return str;
}

public String toString ( ) { String str = "" ; String followedBy = "" ; int lastType = - 1 ; String lastString = "" ; int singlesCount = 0 ; for ( Enumeration e = formatConstraints . elements ( ) ; e . hasMoreElements ( ) ; ) { FormatConstraint constraint = ( FormatConstraint ) e . nextElement ( ) ; if ( constraint . count == FormatConstraint . COUNT_EXACTLY_ONE ) { if ( lastType != - 1 ) { if ( lastType != constraint . type ) { str += followedBy + singlesCount + lastString ; followedBy = " followed by " ; singlesCount = 1 ; lastType = constraint . type ; lastString = constraint . toString ( ) ; } else { singlesCount ++ ; } } else { lastType = constraint . type ; lastString = constraint . toString ( ) ; singlesCount = 1 ; } } else { if ( lastType != - 1 ) { str += followedBy + singlesCount + lastString ; followedBy = " followed by " ; lastType = - 1 ; singlesCount = 0 ; lastString = "" ; } str += followedBy + constraint . toString ( ) ; followedBy = " followed by " ; } } if ( lastType != - 1 ) { str += followedBy + singlesCount + lastString ; } return str ; }
a printout of a user - friendly string describing the format
