if (step1.getType() != step2.getType()) {
int type1 = step1.getType(); int type2 = step2.getType();  if (type1 == Step.TAIL && type2 == Step.ELEM) { return 1; }  if (type1 == Step.ELEM && type2 == Step.TAIL) { return -1; }  if (type1 != type2) {
  public Iterator altFieldIterator(final String altId)  {    Comparator comp;    //{{{ comp = new Comparator() { ... }    comp = new Comparator() {      public int compare(Object o1, Object o2) {	Field field1 = (Field)o1;	Field field2 = (Field)o2;	Iterator path1 = field1.getLocation(altId).stepIterator();	Iterator path2 = field2.getLocation(altId).stepIterator();	while (path1.hasNext()) {	  if (!path2.hasNext()) {	    throw new RuntimeException("incompatible paths: "				       + field1 + "," + field2);	  }	  Step step1 = (Step)path1.next();	  Step step2 = (Step)path2.next();	  if (step1.getType() != step2.getType()) {	    throw new RuntimeException("incompatible paths: "				       + field1 + "," + field2);	  }	  if (step1.getIndex() < step2.getIndex()) {	    return -1;	  }	  if (step1.getIndex() > step2.getIndex()) {	    return 1;	  }	}	if (path2.hasNext()) {	  throw new RuntimeException("incompatible paths: " 				     + field1 + "," + field2);	}	if (o1 != o2) {	  throw new RuntimeException("asjemenou?");	}	return 0;      }    };    //}}}    SortedSet sortedAltFields = new TreeSet(comp);    Iterator iter = fields.values().iterator();    while (iter.hasNext()) {      Field field = (Field)iter.next();      if (field.hasAltId(altId)) {	sortedAltFields.add(field);      }    }    return sortedAltFields.iterator();  }