/*
* $Id$
*/
package edu.jas.structure;
import java.io.Serializable;
/**
* Element interface. Basic functionality of elements, e.g. compareTo, equals,
* clone.
* Note: extension of Cloneable removed in
* 2012-08-18, clone() is renamed to copy().
* @param element type. See the discussion in
* Bloch on Cloning.
* @author Heinz Kredel
*/
public interface Element> extends Comparable, Serializable {
/**
* Clone this Element.
* @return Creates and returns a copy of this Element.
*/
public C copy();
/**
* Test if this is equal to b.
* @param b
* @return true if this is equal to b, else false.
*/
public boolean equals(Object b);
/**
* Hashcode of this Element.
* @return the hashCode.
*/
public int hashCode();
/**
* Compare this to b. I.e. this < b iff this.compareTo(b) < 0.
* Note: may not be meaningful if structure has no order.
* @param b
* @return 0 if this is equal to b, -1 if this is less then b, else +1.
*/
public int compareTo(C b);
/**
* Get the corresponding element factory.
* @return factory for this Element.
*/
public ElemFactory factory();
/**
* Get a scripting compatible string representation.
* @return script compatible representation for this Element.
*/
public String toScript();
/**
* Get a scripting compatible string representation of the factory.
* @return script compatible representation for this ElemFactory.
*/
public String toScriptFactory();
}
Ads help maintain this website.