public boolean sort(String inPackage){
  if (isAddressSet) {
    try {
switch (inPackage.charAt(0)) {
case 'V':
        setSpeed(Integer.parseInt(inPackage.substring(1)));
      break;
case 'X':
    eStop();
  break;
case 'F':
handleFunction(inPackage);
break;
case 'f':
forceFunction(inPackage.substring(1));
break;
case 'R':
setDirection(!inPackage.endsWith("0"));
break;
case 'r':
addressRelease();
break;
case 'd':
addressDispatch();
break;
case 'L':
addressRelease();
int addr=Integer.parseInt(inPackage.substring(1));
setAddress(addr,true);
break;
case 'S':
addressRelease();
addr=Integer.parseInt(inPackage.substring(1));
setAddress(addr,false);
break;
case 'E':
addressRelease();
requestEntryFromID(inPackage.substring(1));
break;
case 'C':
setLocoForConsistFunctions(inPackage.substring(1));
break;
case 'c':
setRosterLocoForConsistFunctions(inPackage.substring(1));
break;
case 'I':
idle();
break;
case 's':
handleSpeedStepMode(Integer.parseInt(inPackage.substring(1)));
break;
case 'm':
handleMomentary(inPackage.substring(1));
break;
case 'q':
handleRequest(inPackage.substring(1));
break;
}
}
 catch (NullPointerException e) {
log.warn("No throttle frame to receive: " + inPackage);
return false;
}
try {
Thread.sleep(20);
}
 catch (java.lang.InterruptedException ex) {
}
}
 else {
switch (inPackage.charAt(0)) {
case 'L':
int addr=Integer.parseInt(inPackage.substring(1));
setAddress(addr,true);
break;
case 'S':
addr=Integer.parseInt(inPackage.substring(1));
setAddress(addr,false);
break;
case 'E':
requestEntryFromID(inPackage.substring(1));
break;
case 'C':
setLocoForConsistFunctions(inPackage.substring(1));
break;
case 'c':
setRosterLocoForConsistFunctions(inPackage.substring(1));
break;
default :
break;
}
}
if (inPackage.charAt(0) == 'Q') {
shutdownThrottle();
return false;
}
return true;
}

public boolean sort ( String inPackage ) { if ( isAddressSet ) { try { switch ( inPackage . charAt ( 0 ) ) { case 'V' : setSpeed ( Integer . parseInt ( inPackage . substring ( 1 ) ) ) ; break ; case 'X' : eStop ( ) ; break ; case 'F' : handleFunction ( inPackage ) ; break ; case 'f' : forceFunction ( inPackage . substring ( 1 ) ) ; break ; case 'R' : setDirection ( ! inPackage . endsWith ( "0" ) ) ; break ; case 'r' : addressRelease ( ) ; break ; case 'd' : addressDispatch ( ) ; break ; case 'L' : addressRelease ( ) ; int addr = Integer . parseInt ( inPackage . substring ( 1 ) ) ; setAddress ( addr , true ) ; break ; case 'S' : addressRelease ( ) ; addr = Integer . parseInt ( inPackage . substring ( 1 ) ) ; setAddress ( addr , false ) ; break ; case 'E' : addressRelease ( ) ; requestEntryFromID ( inPackage . substring ( 1 ) ) ; break ; case 'C' : setLocoForConsistFunctions ( inPackage . substring ( 1 ) ) ; break ; case 'c' : setRosterLocoForConsistFunctions ( inPackage . substring ( 1 ) ) ; break ; case 'I' : idle ( ) ; break ; case 's' : handleSpeedStepMode ( Integer . parseInt ( inPackage . substring ( 1 ) ) ) ; break ; case 'm' : handleMomentary ( inPackage . substring ( 1 ) ) ; break ; case 'q' : handleRequest ( inPackage . substring ( 1 ) ) ; break ; } } catch ( NullPointerException e ) { log . warn ( "No throttle frame to receive: " + inPackage ) ; return false ; } try { Thread . sleep ( 20 ) ; } catch ( java . lang . InterruptedException ex ) { } } else { switch ( inPackage . charAt ( 0 ) ) { case 'L' : int addr = Integer . parseInt ( inPackage . substring ( 1 ) ) ; setAddress ( addr , true ) ; break ; case 'S' : addr = Integer . parseInt ( inPackage . substring ( 1 ) ) ; setAddress ( addr , false ) ; break ; case 'E' : requestEntryFromID ( inPackage . substring ( 1 ) ) ; break ; case 'C' : setLocoForConsistFunctions ( inPackage . substring ( 1 ) ) ; break ; case 'c' : setRosterLocoForConsistFunctions ( inPackage . substring ( 1 ) ) ; break ; default : break ; } } if ( inPackage . charAt ( 0 ) == 'Q' ) { shutdownThrottle ( ) ; return false ; } return true ; }
figure out what the received command means , where it has to go , and translate to a jmri method .
