Skip to contentMethod: action(RouterSoftware, PackageDescriptionFileSymbol)
      1: package parser.states.packagestates;
2: 
3: import model.RouterSoftware;
4: import parser.PackageDescriptionFileParser;
5: import parser.ParserConstants;
6: import parser.ParserException;
7: import parser.TempPackageRule;
8: import parser.states.GlobalFunctions;
9: import symbols.PackageDescriptionFileSymbol;
10: 
11: /**
12:  * This class represents the value State for the PackageDescriptionFileParser.
13:  * 
14:  * @author HFW410
15:  * 
16:  */
17: public class ValueState extends AbstractPackageParserState {
18:         /**
19:          * The temporary Package Rule.
20:          */
21:         private final transient TempPackageRule tempPackageRule;
22: 
23:         /**
24:          * The constructor for the ValueState.
25:          * 
26:          * @param parser
27:          *            for the Descriptionfiles
28:          * @param tempPackageRule
29:          *            temp packageRule
30:          */
31:         public ValueState(final PackageDescriptionFileParser parser,
32:                         final TempPackageRule tempPackageRule) {
33:                 super(parser);
34:                 this.tempPackageRule = tempPackageRule;
35:         }
36: 
37:         @Override
38:         public AbstractPackageParserState action(final RouterSoftware rs,
39:                         final PackageDescriptionFileSymbol symbol) throws InterruptedException,
40:                         ParserException {
41:•                if (symbol.isValueSymbol()) {
42:                         this.tempPackageRule.setValue(GlobalFunctions.generateRegEx(symbol.toValueSymbol()
43:                                         .getContent()));
44:                         this.getMyParser().skip();
45:                         return new PathState(this.getMyParser(), this.tempPackageRule);
46:                 } else {
47:                         throw new ParserException(ParserConstants.VALUE_FEHLER);
48:                 }
49: 
50:         }
51: 
52: }