/** * * Transforms a given ScalarConstantPtg to its correspondent in the internal model. * * @param scalar The given ScalarConstantPtg. * @return The correspondent of the given ScalarConstantPtg in the internal model. */ private ScalarConstant transform(ScalarConstantPtg scalar) { ScalarConstant constant = new ScalarConstant(); // Transform to Integer. if (scalar instanceof IntPtg) { constant.setIntegerValue(((IntPtg) scalar).getValue()); } // Transform to Double. if (scalar instanceof NumberPtg) { constant.setNumericValue(((NumberPtg) scalar).getValue()); } // Transform to String. if (scalar instanceof StringPtg) { constant.setTextValue(((StringPtg) scalar).getValue()); } // Transform to Boolean. if (scalar instanceof BoolPtg) { constant.setBooleanValue(((BoolPtg) scalar).getValue()); } // Transform to Error. if (scalar instanceof ErrPtg) { constant.setErrorValue(ErrorEval.getText(((ErrPtg) scalar).getErrorCode())); } if (scalar instanceof MissingArgPtg) { // TODO: Implement. } return constant; }