/** * This is used to handle an operation. * * @param operator The operation to perform. * @param operands The list of arguments. * @throws IOException If there is an error processing the operation. */ protected void processOperator(Operator operator, List<COSBase> operands) throws IOException { String name = operator.getName(); OperatorProcessor processor = operators.get(name); if (processor != null) { processor.setContext(this); try { processor.process(operator, operands); } catch (IOException e) { operatorException(operator, operands, e); } } else { unsupportedOperator(operator, operands); } }
/** * Adds an operator processor to the engine. * * @param op operator processor */ public final void addOperator(OperatorProcessor op) { op.setContext(this); operators.put(op.getName(), op); }
/** * Register a custom operator processor with the engine. * * @param operator The operator as a string. * @param op Processor instance. * @deprecated Use {@link #addOperator(OperatorProcessor)} instead */ @Deprecated public void registerOperatorProcessor(String operator, OperatorProcessor op) { op.setContext(this); operators.put(operator, op); }