01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2004-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.io.IOException;
22:
23: /**
24: * A not-followed-by predicate.
25: *
26: * @author Robert Grimm
27: * @version $Revision: 1.9 $
28: */
29: public class NotFollowedBy extends Predicate {
30:
31: /**
32: * Create a new not-followed-by predicate.
33: *
34: * @param element The grammar element.
35: */
36: public NotFollowedBy(Element element) {
37: super (element);
38: }
39:
40: public Tag tag() {
41: return Tag.NOT_FOLLOWED_BY;
42: }
43:
44: public int hashCode() {
45: return element.hashCode();
46: }
47:
48: public boolean equals(Object o) {
49: if (this == o)
50: return true;
51: if (!(o instanceof NotFollowedBy))
52: return false;
53: return element.equals(((NotFollowedBy) o).element);
54: }
55:
56: public void write(Appendable out) throws IOException {
57: out.append('!');
58: element.write(out);
59: }
60:
61: }
|