private static Processor getProcessor ( Opcode opcode ) { switch ( opcode ) { case NOT_EMPTY : return NOT_EPMTY_PROCESSOR ; case EQUALS : if ( EQUALS_PROCESSOR == null ) { EQUALS_PROCESSOR = new EqualsProcessor ( ) ; } return EQUALS_PROCESSOR ; case LESS_THAN : if ( LESS_THAN_PROCESSOR == null ) { LESS_THAN_PROCESSOR = new LessThanProcessor ( ) ; } return LESS_THAN_PROCESSOR ; case GREATER_THAN : if ( GREATER_THAN_PROCESSOR == null ) { GREATER_THAN_PROCESSOR = new GreaterThanProcessor ( ) ; } return GREATER_THAN_PROCESSOR ; default : throw new BugError ( "Unsupported opcode |%s|." , opcode ) ; } }
Operator processor factory . Returned processor instance is a singleton that is reused on running virtual machine .