@Override public int compare(String c1,String c2){
  if (c1.equals(c2)) {
    return 0;
  }
  if (c1.equals(SIMPLE.key()) || c1.equals(XTENSION.key())) {
    return -1;
  }
 else   if (c2.equals(SIMPLE.key()) || c2.equals(XTENSION.key())) {
    return 1;
  }
 else   if (c1.equals(BITPIX.key())) {
    return -1;
  }
 else   if (c2.equals(BITPIX.key())) {
    return 1;
  }
 else   if (c1.equals(NAXIS.key())) {
    return -1;
  }
 else   if (c2.equals(NAXIS.key())) {
    return 1;
  }
  final int naxisNc1=naxisN(c1);
  final int naxisNc2=naxisN(c2);
  if (naxisNc1 > 0) {
    if (naxisNc2 > 0) {
      if (naxisNc1 < naxisNc2) {
        return -1;
      }
 else {
        return 1;
      }
    }
    return -1;
  }
 else   if (naxisNc2 > 0) {
    return 1;
  }
  if (c1.equals(EXTEND.key())) {
    return -1;
  }
 else   if (c2.equals(EXTEND.key())) {
    return 1;
  }
 else   if (c1.equals(PCOUNT.key())) {
    return -1;
  }
 else   if (c2.equals(PCOUNT.key())) {
    return 1;
  }
 else   if (c1.equals(GCOUNT.key())) {
    return -1;
  }
 else   if (c2.equals(GCOUNT.key())) {
    return 1;
  }
 else   if (c1.equals(TFIELDS.key())) {
    return -1;
  }
 else   if (c2.equals(TFIELDS.key())) {
    return 1;
  }
  if (c1.equals(BLOCKED.key())) {
    return -1;
  }
 else   if (c2.equals(BLOCKED.key())) {
    return 1;
  }
  if (c1.equals(THEAP.key())) {
    return 1;
  }
 else   if (c2.equals(THEAP.key())) {
    return -1;
  }
 else   if (c1.equals(END.key())) {
    return 1;
  }
 else   if (c2.equals(END.key())) {
    return -1;
  }
  return 0;
}

@ Override public int compare ( String c1 , String c2 ) { if ( c1 . equals ( c2 ) ) { return 0 ; } if ( c1 . equals ( SIMPLE . key ( ) ) || c1 . equals ( XTENSION . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( SIMPLE . key ( ) ) || c2 . equals ( XTENSION . key ( ) ) ) { return 1 ; } else if ( c1 . equals ( BITPIX . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( BITPIX . key ( ) ) ) { return 1 ; } else if ( c1 . equals ( NAXIS . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( NAXIS . key ( ) ) ) { return 1 ; } final int naxisNc1 = naxisN ( c1 ) ; final int naxisNc2 = naxisN ( c2 ) ; if ( naxisNc1 > 0 ) { if ( naxisNc2 > 0 ) { if ( naxisNc1 < naxisNc2 ) { return - 1 ; } else { return 1 ; } } return - 1 ; } else if ( naxisNc2 > 0 ) { return 1 ; } if ( c1 . equals ( EXTEND . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( EXTEND . key ( ) ) ) { return 1 ; } else if ( c1 . equals ( PCOUNT . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( PCOUNT . key ( ) ) ) { return 1 ; } else if ( c1 . equals ( GCOUNT . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( GCOUNT . key ( ) ) ) { return 1 ; } else if ( c1 . equals ( TFIELDS . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( TFIELDS . key ( ) ) ) { return 1 ; } if ( c1 . equals ( BLOCKED . key ( ) ) ) { return - 1 ; } else if ( c2 . equals ( BLOCKED . key ( ) ) ) { return 1 ; } if ( c1 . equals ( THEAP . key ( ) ) ) { return 1 ; } else if ( c2 . equals ( THEAP . key ( ) ) ) { return - 1 ; } else if ( c1 . equals ( END . key ( ) ) ) { return 1 ; } else if ( c2 . equals ( END . key ( ) ) ) { return - 1 ; } return 0 ; }
which order should the cards indexed by these keys be written out ? this method assumes that the arguments are either the fits header keywords as strings , and some other type ( or null ) for comment style keywords .
