org.deri.wsmo4j.logicalexpression
Class AtomImpl
java.lang.Object
org.deri.wsmo4j.logicalexpression.LogicalExpressionImpl
org.deri.wsmo4j.logicalexpression.AtomImpl
- All Implemented Interfaces:
- org.omwg.logicalexpression.Atom, org.omwg.logicalexpression.AtomicExpression, org.omwg.logicalexpression.LogicalExpression
- Direct Known Subclasses:
- BuiltInAtomImpl
public class AtomImpl
- extends LogicalExpressionImpl
- implements org.omwg.logicalexpression.Atom
This class is an atom expression with a n-ary domain, where n is
the arity of the predicate represented
- Version:
- $Revision: 1946 $ $Date: 2007-04-02 15:13:28 +0300 (Mon, 02 Apr 2007) $
- Author:
- DERI Innsbruck, reto.krummenacher@deri.org
|
Field Summary |
protected List<org.omwg.logicalexpression.terms.Term> |
args
|
protected org.wsmo.common.Identifier |
id
|
|
Constructor Summary |
AtomImpl(org.wsmo.common.Identifier id,
List<org.omwg.logicalexpression.terms.Term> args)
|
|
Method Summary |
void |
accept(org.omwg.logicalexpression.Visitor v)
|
boolean |
equals(Object o)
The equals method implements an equivalence relation
on non-null object references. |
int |
getArity()
|
org.wsmo.common.Identifier |
getIdentifier()
|
org.omwg.logicalexpression.terms.Term |
getParameter(int i)
|
int |
hashCode()
If two objects are equal according to the equals(Object) method, then calling
the hashCode method on each of the two objects must produce the same integer
result. |
List<org.omwg.logicalexpression.terms.Term> |
listParameters()
|
void |
setParameters(List<org.omwg.logicalexpression.terms.Term> parameter)
|
| Methods inherited from interface org.omwg.logicalexpression.LogicalExpression |
toString |
args
protected List<org.omwg.logicalexpression.terms.Term> args
id
protected org.wsmo.common.Identifier id
AtomImpl
public AtomImpl(org.wsmo.common.Identifier id,
List<org.omwg.logicalexpression.terms.Term> args)
throws IllegalArgumentException
- Parameters:
id - identifier of Atomargs - list of parameters for that atom
- Throws:
IllegalArgumentException - in case the parameter id is a Value or the arguments of
the list args aren't all of Type Term- See Also:
LogicalExpressionFactory.createAtom(Identifier, List)
getIdentifier
public org.wsmo.common.Identifier getIdentifier()
- Specified by:
getIdentifier in interface org.omwg.logicalexpression.Atom
- Returns:
- the identifier of the atom, i.e. the name of the predicate
- See Also:
Atom.getIdentifier()
getParameter
public org.omwg.logicalexpression.terms.Term getParameter(int i)
throws IllegalArgumentException
- Specified by:
getParameter in interface org.omwg.logicalexpression.Atom
- Parameters:
i - the position of the parameter desired, maximal value getArity-1
- Returns:
- the parameter at the position provided as parameter
- Throws:
IllegalArgumentException - in case i<0 or i exceeds the arity of the atom- See Also:
Atom.getParameter(int)
getArity
public int getArity()
- Specified by:
getArity in interface org.omwg.logicalexpression.Atom
- Returns:
- the arity of the atom, i.e. the number of parameters
- See Also:
Atom.getArity()
accept
public void accept(org.omwg.logicalexpression.Visitor v)
- Specified by:
accept in interface org.omwg.logicalexpression.LogicalExpression
- See Also:
LogicalExpression.accept(org.omwg.logicalexpression.Visitor)
equals
public boolean equals(Object o)
The equals method implements an equivalence relation
on non-null object references. Atoms are equal if their arity, their
identifier and all their parameters are equal.
It is generally necessary to override the hashCode method whenever this method
is overridden.
- Overrides:
equals in class Object
- Parameters:
o - the reference object with which to compare.
- Returns:
true if this object is the same as the obj
argument; false otherwise.- See Also:
Object.equals(java.lang.Object),
Object.hashCode()
hashCode
public int hashCode()
If two objects are equal according to the equals(Object) method, then calling
the hashCode method on each of the two objects must produce the same integer
result. However, it is not required that if two objects are unequal according to
the equals(Object) method, then calling the hashCode method on each of the two
objects must produce distinct integer results.
This method should be overriden, when the equals(Object) method is overriden.
- Overrides:
hashCode in class Object
- Returns:
- A hash code value for this Object.
- See Also:
Object.hashCode(),
Object.equals(Object)
listParameters
public List<org.omwg.logicalexpression.terms.Term> listParameters()
- Specified by:
listParameters in interface org.omwg.logicalexpression.Atom
setParameters
public void setParameters(List<org.omwg.logicalexpression.terms.Term> parameter)
throws IllegalArgumentException
- Specified by:
setParameters in interface org.omwg.logicalexpression.Atom
- Throws:
IllegalArgumentException
Copyright © 2004-2008 Ontotext Lab.. All Rights Reserved.