📄 replacement.java
字号:
/*
* Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.mandarax.kernel;
/**
* Replacement of terms.
* @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
* @version 3.4 <7 March 05>
* @since 1.0
*/
public class Replacement extends LObject {
public Term original;
public Term replacement;
/**
* Constructor.
*/
public Replacement() {
super ();
}
/**
* Constructor.
* @param o the original term
* @param r the term replacing the original term
*/
public Replacement(Term o, Term r) {
super ();
original = o;
replacement = r;
}
/**
* Compares two objects.
* @return true if the objects are equal, false otherwise
* @param obj the object to compare
*/
public boolean equals(Object obj) {
if((obj != null) && (obj instanceof Replacement)) {
Replacement r = (Replacement) obj;
return(original == null)
? r.original == null
: (r.original.equals (original) && (replacement == null))
? r.replacement == null
: r.replacement.equals (replacement);
}
return false;
}
/**
* Get the hashcode of the object.
* @return the hash value of this object
*/
public int hashCode() {
if(replacement == null) {
return(original == null)
? 0
: original.hashCode ();
}
if(original == null) {
return replacement.hashCode ();
}
return replacement.hashCode () ^ original.hashCode () * 31;
}
/**
* Convert the object to a string.
* @return the string representation of this object
*/
public String toString() {
return original.toString () + " / " + replacement.toString ();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -