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.model.symbol;
10:
11: /**
12: * This class represent a nonterminal symbol.
13: *
14: * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
15: * @version CVS $Id: Nonterminal.java,v 1.5 2003/12/09 19:55:53 benedikta Exp $
16: */
17: public class Nonterminal extends Symbol {
18: /**
19: * Create a nonterminal symbol.
20: *
21: * @param name Name of the symbol.
22: */
23: public Nonterminal(String name) {
24: super (name);
25: }
26:
27: /**
28: * Returns a hash code value for the symbol.
29: *
30: * @return Hash code value for the symbol.
31: */
32: public int hashCode() {
33: return name.hashCode() << (1 + 1);
34: }
35:
36: /**
37: * Compares the with another symbol.
38: *
39: * @param o Another object
40: *
41: * @return True, if the symbol are equal.
42: */
43: public boolean equals(Object o) {
44: if (o == this )
45: return true;
46:
47: if ((o != null) && (o instanceof Nonterminal)) {
48: Symbol symbol = (Nonterminal) o;
49:
50: return symbol.name.equals(name);
51: }
52:
53: return false;
54: }
55: }
|