1 package org.jacorb.notification.filter.etcl; 2 3 23 24 import org.jacorb.notification.filter.ComponentName; 25 import org.jacorb.notification.filter.EvaluationContext; 26 import org.jacorb.notification.filter.EvaluationException; 27 import org.jacorb.notification.filter.EvaluationResult; 28 import org.jacorb.notification.interfaces.Message; 29 30 import antlr.Token; 31 32 38 39 public class ETCLComponentName extends AbstractTCLNode implements ComponentName 40 { 41 private final String value_; 42 43 private String componentName_; 44 45 47 protected ETCLComponentName() { 48 super(); 49 50 value_ = null; 51 } 52 53 public ETCLComponentName( Token tok ) 54 { 55 super( tok ); 56 57 setName( "ComponentName" ); 58 value_ = tok.getText(); 59 } 60 61 63 public EvaluationResult evaluate( EvaluationContext context ) 64 throws EvaluationException 65 { 66 EvaluationResult _ret; 67 68 Message _event = context.getCurrentMessage(); 69 70 AbstractTCLNode _left = left(); 71 72 if (_left == null) { 73 76 return EvaluationResult.fromAny( _event.toAny() ); 77 } 78 79 switch (_left.getType()) { 80 81 case AbstractTCLNode.RUNTIME_VAR: 82 RuntimeVariableNode _var = ( RuntimeVariableNode ) _left; 83 84 _ret = _event.extractValue( context, 85 this, 86 _var ); 87 88 break; 89 90 case AbstractTCLNode.DOT: 91 case AbstractTCLNode.ASSOC: 93 _ret = _event.extractValue(context, 94 this ); 95 96 break; 97 default: 98 throw new RuntimeException ("Unexpected Nodetype: " 100 + getNameForType(_left.getType())); 101 } 102 103 return _ret; 104 } 105 106 107 public String toString() 108 { 109 return value_; 110 } 111 112 113 public void setComponentName( String name ) 114 { 115 componentName_ = name; 116 } 117 118 119 public String getComponentName() 120 { 121 return componentName_; 122 } 123 124 125 public void acceptPostOrder( AbstractTCLVisitor visitor ) throws VisitorException 126 { 127 if (getFirstChild() != null) { 128 ( ( AbstractTCLNode ) getFirstChild() ).acceptPostOrder( visitor ); 129 } 130 visitor.visitComponent( this ); 131 } 132 133 134 public void acceptPreOrder( AbstractTCLVisitor visitor ) throws VisitorException 135 { 136 visitor.visitComponent( this ); 137 ( ( AbstractTCLNode ) getFirstChild() ).acceptPreOrder( visitor ); 138 } 139 140 141 public void acceptInOrder( AbstractTCLVisitor visitor ) throws VisitorException 142 { 143 ( ( AbstractTCLNode ) getFirstChild() ).acceptInOrder( visitor ); 144 visitor.visitComponent( this ); 145 } 146 } 147 | Popular Tags |