private static SingleID specsToID(Specs specs, int dir) {
        String canonID = "";
        String basicID = "";
        String basicPrefix = "";
        if (specs != null) {
            StringBuilder buf = new StringBuilder();
            if (dir == FORWARD) {
                if (specs.sawSource) {
                    buf.append(specs.source).append(TARGET_SEP);
                } else {
                    basicPrefix = specs.source + TARGET_SEP;
                }
                buf.append(specs.target);
            } else {
                buf.append(specs.target).append(TARGET_SEP).append(specs.source);
            }
            if (specs.variant != null) {
                buf.append(VARIANT_SEP).append(specs.variant);
            }
            basicID = basicPrefix + buf.toString();
            if (specs.filter != null) {
                buf.insert(0, specs.filter);
            }
            canonID = buf.toString();
        }
        return new SingleID(canonID, basicID);
    }
private static SingleID specsToID ( Specs specs , int dir ) { String canonID = "" ; String basicID = "" ; String basicPrefix = "" ; if ( specs != null ) { StringBuilder buf = new StringBuilder ( ) ; if ( dir == FORWARD ) { if ( specs . sawSource ) { buf . append ( specs . source ) . append ( TARGET_SEP ) ; } else { basicPrefix = specs . source + TARGET_SEP ; } buf . append ( specs . target ) ; } else { buf . append ( specs . target ) . append ( TARGET_SEP ) . append ( specs . source ) ; } if ( specs . variant != null ) { buf . append ( VARIANT_SEP ) . append ( specs . variant ) ; } basicID = basicPrefix + buf . toString ( ) ; if ( specs . filter != null ) { buf . insert ( 0 , specs . filter ) ; } canonID = buf . toString ( ) ; } return new SingleID ( canonID , basicID ) ; }
Givens a Spec object, convert it to a SingleID object.  The
Spec object is a more unprocessed parse result.  The SingleID
object contains information about canonical and basic IDs.
@return a SingleID; never returns null.  Returned object always
has 'filter' field of null.