FunctionKey.java
01 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
02  *
03  * Copyright 2000-2011,  Michael Meyling <mime@qedeq.org>.
04  *
05  * "Hilbert II" is free software; you can redistribute
06  * it and/or modify it under the terms of the GNU General Public
07  * License as published by the Free Software Foundation; either
08  * version 2 of the License, or (at your option) any later version.
09  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  */
15 
16 package org.qedeq.kernel.bo.logic.common;
17 
18 import org.qedeq.base.utility.EqualsUtility;
19 
20 /**
21  * Function constant key, describing a function constant.
22  *
23  @author  Michael Meyling
24  */
25 public final class FunctionKey {
26 
27     /** Function name. */
28     private String name;
29 
30     /** Function argument number. */
31     private String arguments;
32 
33     /**
34      * Constructor.
35      *
36      @param   name        Function name.
37      @param   arguments   Function argument number.
38      */
39     public FunctionKey(final String name, final String arguments) {
40         this.name = name;
41         this.arguments = arguments;
42     }
43 
44     /**
45      * Get function name.
46      *
47      @return  Function name.
48      */
49     public String getName() {
50         return name;
51     }
52 
53     /**
54      * Get function argument number.
55      *
56      @return  Number of arguments.
57      */
58     public String getArguments() {
59         return arguments;
60     }
61 
62     public int hashCode() {
63         return (getName() != null ? getName().hashCode() 0)
64             (getArguments() != null ? getArguments().hashCode() 0);
65     }
66 
67     public boolean equals(final Object obj) {
68         if (!(obj instanceof FunctionKey)) {
69             return false;
70         }
71         final FunctionKey other = (FunctionKeyobj;
72         return EqualsUtility.equals(getName(), other.getName())
73             && EqualsUtility.equals(getArguments(), other.getArguments());
74     }
75 
76     public String toString() {
77         return getName() "[" + getArguments() "]";
78     }
79 
80 
81 }