01: /*
02: * Copyright (C) Chaperon. All rights reserved.
03: * -------------------------------------------------------------------------
04: * This software is published under the terms of the Apache Software License
05: * version 1.1, a copy of which has been included with this distribution in
06: * the LICENSE file.
07: */
08:
09: package net.sourceforge.chaperon.process.extended;
10:
11: import net.sourceforge.chaperon.model.extended.Pattern;
12:
13: /**
14: * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
15: * @version CVS $Id: GotoAction.java,v 1.1 2004/01/04 16:49:12 benedikta Exp $
16: */
17: public class GotoAction {
18: public final String symbol;
19: public final Pattern pattern;
20: public final State state;
21:
22: public GotoAction(String symbol, State state) {
23: if (symbol == null)
24: throw new IllegalArgumentException("Symbol is null");
25:
26: if (state == null)
27: throw new IllegalArgumentException("State is null");
28:
29: this .symbol = symbol;
30: this .pattern = null;
31: this .state = state;
32: }
33:
34: public GotoAction(Pattern pattern, State state) {
35: if (pattern == null)
36: throw new IllegalArgumentException("Pattern is null");
37:
38: if (state == null)
39: throw new IllegalArgumentException("State is null");
40:
41: this .symbol = null;
42: this .pattern = pattern;
43: this .state = state;
44: }
45:
46: public boolean equals(Object o) {
47: if (o instanceof GotoAction) {
48: GotoAction gotoAction = (GotoAction) o;
49:
50: if (symbol != null)
51: return (gotoAction.symbol != null)
52: && symbol.equals(gotoAction.symbol);
53:
54: return (pattern == gotoAction.pattern);
55: }
56:
57: return false;
58: }
59: }
|