01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2005-2007 Robert Grimm
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * version 2 as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.parser;
20:
21: import java.util.List;
22:
23: /**
24: * An alternative removal. An alternative removal's attributes,
25: * qualified name, and choice fields are ignored.
26: *
27: * @author Robert Grimm
28: * @version $Revision: 1.6 $
29: */
30: public class AlternativeRemoval extends PartialProduction {
31:
32: /** The list of {@link SequenceName sequences} to be removed. */
33: public List<SequenceName> sequences;
34:
35: /**
36: * Create a new alternative removal.
37: *
38: * @param dType The declared type.
39: * @param name The name.
40: * @param sequences The sequence names.
41: */
42: public AlternativeRemoval(String dType, NonTerminal name,
43: List<SequenceName> sequences) {
44: super (null, dType, name, null);
45: this .sequences = sequences;
46: }
47:
48: public boolean isRemoval() {
49: return true;
50: }
51:
52: public boolean equals(Object o) {
53: if (this == o)
54: return true;
55: if (!(o instanceof AlternativeRemoval))
56: return false;
57: AlternativeRemoval other = (AlternativeRemoval) o;
58: if (!name.equals(other.name))
59: return false;
60: if (null == type) {
61: if (!dType.equals(other.dType))
62: return false;
63: } else {
64: if (!type.equals(other.type))
65: return false;
66: }
67: return sequences.equals(other.sequences);
68: }
69:
70: }
|