private static Property makeProperty(Tree child, boolean isRootedInDynamic) {
   switch (child.getType()) {
     case EsperEPL2GrammarParser.EVENT_PROP_SIMPLE:
       if (!isRootedInDynamic) {
         return new SimpleProperty(child.getChild(0).getText());
       } else {
         return new DynamicSimpleProperty(child.getChild(0).getText());
       }
     case EsperEPL2GrammarParser.EVENT_PROP_MAPPED:
       String key = StringValue.parseString(child.getChild(1).getText());
       if (!isRootedInDynamic) {
         return new MappedProperty(child.getChild(0).getText(), key);
       } else {
         return new DynamicMappedProperty(child.getChild(0).getText(), key);
       }
     case EsperEPL2GrammarParser.EVENT_PROP_INDEXED:
       int index = IntValue.parseString(child.getChild(1).getText());
       if (!isRootedInDynamic) {
         return new IndexedProperty(child.getChild(0).getText(), index);
       } else {
         return new DynamicIndexedProperty(child.getChild(0).getText(), index);
       }
     case EsperEPL2GrammarParser.EVENT_PROP_DYNAMIC_SIMPLE:
       return new DynamicSimpleProperty(child.getChild(0).getText());
     case EsperEPL2GrammarParser.EVENT_PROP_DYNAMIC_INDEXED:
       index = IntValue.parseString(child.getChild(1).getText());
       return new DynamicIndexedProperty(child.getChild(0).getText(), index);
     case EsperEPL2GrammarParser.EVENT_PROP_DYNAMIC_MAPPED:
       key = StringValue.parseString(child.getChild(1).getText());
       return new DynamicMappedProperty(child.getChild(0).getText(), key);
     default:
       throw new IllegalStateException(
           "Event property AST node not recognized, type=" + child.getType());
   }
 }
Esempio n. 2
0
 private static Object parseNumOrVariableIdent(Tree child) {
   if (child.getType() == EsperEPL2GrammarParser.IDENT) {
     return child.getText();
   } else {
     return IntValue.parseString(child.getText());
   }
 }