private Base processConstant(FHIRLexer lexer) throws FHIRLexerException { if (lexer.isStringConstant()) { return new StringType(processConstantString(lexer.take(), lexer)).noExtensions(); } else if (Utilities.isInteger(lexer.getCurrent())) { return new IntegerType(lexer.take()).noExtensions(); } else if (Utilities.isDecimal(lexer.getCurrent())) { return new DecimalType(lexer.take()).noExtensions(); } else if (Utilities.existsInList(lexer.getCurrent(), "true", "false")) { return new BooleanType(lexer.take()).noExtensions(); } else if (lexer.getCurrent().equals("{}")) { lexer.take(); return null; } else if (lexer.getCurrent().startsWith("%") || lexer.getCurrent().startsWith("@")) { return new FHIRConstant(lexer.take()); } else throw lexer.error("Invalid Constant "+lexer.getCurrent()); }
private Base resolveConstant(ExecutionContext context, Base constant, boolean beforeContext) throws PathEngineException { if (!(constant instanceof FHIRConstant)) return constant; FHIRConstant c = (FHIRConstant) constant; if (c.getValue().startsWith("%")) { return resolveConstant(context, c.getValue(), beforeContext); } else if (c.getValue().startsWith("@")) { return processDateConstant(context.appInfo, c.getValue().substring(1)); } else throw new PathEngineException("Invaild FHIR Constant "+c.getValue()); }
private Base processConstant(FHIRLexer lexer) throws FHIRLexerException { if (lexer.isStringConstant()) { return new StringType(processConstantString(lexer.take(), lexer)).noExtensions(); } else if (Utilities.isInteger(lexer.getCurrent())) { return new IntegerType(lexer.take()).noExtensions(); } else if (Utilities.isDecimal(lexer.getCurrent())) { return new DecimalType(lexer.take()).noExtensions(); } else if (Utilities.existsInList(lexer.getCurrent(), "true", "false")) { return new BooleanType(lexer.take()).noExtensions(); } else if (lexer.getCurrent().equals("{}")) { lexer.take(); return null; } else if (lexer.getCurrent().startsWith("%") || lexer.getCurrent().startsWith("@")) { return new FHIRConstant(lexer.take()); } else throw lexer.error("Invalid Constant "+lexer.getCurrent()); }
private TypeDetails resolveConstantType(ExecutionTypeContext context, Base constant) throws PathEngineException { if (constant instanceof BooleanType) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Boolean); else if (constant instanceof IntegerType) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Integer); else if (constant instanceof DecimalType) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Decimal); else if (constant instanceof Quantity) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Quantity); else if (constant instanceof FHIRConstant) return resolveConstantType(context, ((FHIRConstant) constant).getValue()); else return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_String); }
private Base resolveConstant(ExecutionContext context, Base constant, boolean beforeContext) throws PathEngineException { if (!(constant instanceof FHIRConstant)) return constant; FHIRConstant c = (FHIRConstant) constant; if (c.getValue().startsWith("%")) { return resolveConstant(context, c.getValue(), beforeContext); } else if (c.getValue().startsWith("@")) { return processDateConstant(context.appInfo, c.getValue().substring(1)); } else throw new PathEngineException("Invaild FHIR Constant "+c.getValue()); }
private TypeDetails resolveConstantType(ExecutionTypeContext context, Base constant) throws PathEngineException { if (constant instanceof BooleanType) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Boolean); else if (constant instanceof IntegerType) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Integer); else if (constant instanceof DecimalType) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Decimal); else if (constant instanceof Quantity) return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Quantity); else if (constant instanceof FHIRConstant) return resolveConstantType(context, ((FHIRConstant) constant).getValue()); else return new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_String); }