|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.util.DelegateCollection orbital.util.DelegateSet orbital.util.DelegateSortedSet orbital.logic.sign.SignatureBase
public class SignatureBase
A basic signature implementation.
ExpressionSyntax.scanSignature(java.lang.String)
,
Serialized FormField Summary | |
---|---|
static SignatureBase |
EMPTY
Empty signature ∅. |
Constructor Summary | |
---|---|
SignatureBase()
Construct an empty signature ∅. |
|
SignatureBase(java.util.Collection symbols)
Construct a new signature with the given set of symbols. |
|
SignatureBase(java.util.SortedSet symbols)
|
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
Ensures that this collection contains the specified element (optional operation). |
boolean |
contains(java.lang.String signifier,
java.lang.Object[] arg)
Deprecated. Since Orbital1.1 use get(String,Object[]) ≠null instead. |
Signature |
difference(Signature sigma2)
Returns the difference to another signature. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this collection for equality. |
Symbol |
get(java.lang.String signifier,
java.lang.Object[] arg)
Returns the symbol with the specified signifier of a functor. |
Symbol |
get(java.lang.String signifier,
Type maxType)
Returns the symbol with the specified signifier. |
java.util.SortedSet |
getSymbols()
Get the set of symbols in this signature. |
int |
hashCode()
Returns the hash code value for this collection. |
Signature |
intersection(Signature sigma2)
Returns the intersection of two signatures. |
void |
setSymbols(java.util.SortedSet symbols)
Set the set of symbols in this signature. |
Signature |
symmetricDifference(Signature sigma2)
Returns the difference to another signature. |
java.lang.String |
toString()
Returns a string representation of the object. |
Signature |
union(Signature sigma2)
Returns the union of two signatures. |
static Signature |
unmodifiableSignature(Signature s)
Returns an unmodifiable view of the specified signature. |
Methods inherited from class orbital.util.DelegateSortedSet |
---|
comparator, first, headSet, last, setDelegatee, setDelegatee, subSet, tailSet |
Methods inherited from class orbital.util.DelegateSet |
---|
setDelegatee |
Methods inherited from class orbital.util.DelegateCollection |
---|
addAll, clear, contains, containsAll, getDelegatee, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.SortedSet |
---|
comparator, first, headSet, last, subSet, tailSet |
Methods inherited from interface java.util.Set |
---|
addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Field Detail |
---|
public static final SignatureBase EMPTY
Constructor Detail |
---|
public SignatureBase(java.util.Collection symbols)
The argument is a collection as per general contract of the interface java.util.Set, but will be transformed into this signature set with the call to this constructor.
symbols
- the set of symbols in the signature.public SignatureBase(java.util.SortedSet symbols)
public SignatureBase()
Method Detail |
---|
public boolean equals(java.lang.Object o)
DelegateCollection
While the Collection interface adds no stipulations to the general contract for the Object.equals, programmers who implement the Collection interface "directly" (in other words, create a class that is a Collection but is not a Set or a List) must exercise care if they choose to override the Object.equals. It is not necessary to do so, and the simplest course of action is to rely on Object's implementation, but the implementer may wish to implement a "value comparison" in place of the default "reference comparison." (The List and Set interfaces mandate such value comparisons.)
The general contract for the Object.equals method states that equals must be symmetric (in other words, a.equals(b) if and only if b.equals(a)). The contracts for List.equals and Set.equals state that lists are only equal to other lists, and sets to other sets. Thus, a custom equals method for a collection class that implements neither the List nor Set interface must return false when this collection is compared to any list or set. (By the same logic, it is not possible to write a class that correctly implements both the Set and List interfaces.)
equals
in interface java.util.Collection
equals
in interface java.util.Set
equals
in interface Signature
equals
in class DelegateCollection
o
- Object to be compared for equality with this collection.
Object.equals(Object)
,
Set.equals(Object)
,
List.equals(Object)
public int hashCode()
DelegateCollection
hashCode
in interface java.util.Collection
hashCode
in interface java.util.Set
hashCode
in interface Signature
hashCode
in class DelegateCollection
Object.hashCode()
,
Object.equals(Object)
public java.util.SortedSet getSymbols()
public void setSymbols(java.util.SortedSet symbols)
symbols
- the new set of symbols in this signature.public boolean contains(java.lang.String signifier, java.lang.Object[] arg)
get(String,Object[])
≠null instead.
public Symbol get(java.lang.String signifier, java.lang.Object[] arg)
Signature
The most usual use of the arguments array is to check for its length to distinguish unary minus '-' from binary subtraction '-'. But in principle, type checking could be required as well.
Note: if there are multiple symbols that match the given signifier and arguments, which symbol will be selected is unspecified.
This method equals
get
(signifier, typeOf(args)→⊤).
get
in interface Signature
signifier
- the signifier of the symbol.arg
- the arguments that the functor belonging to the signifier is called with.
null
, or an array of length 0 can be used for zero arguments.
null
otherwise.Signature.get(String,Type)
public Symbol get(java.lang.String signifier, Type maxType)
Signature
Note: if there are multiple symbols that match the given signifier and type, which symbol will be selected is unspecified.
get
in interface Signature
signifier
- the signifier of the symbol.maxType
- the maximum type that the symbol can have.
null
otherwise.Signature.get(String,Object[])
public Signature union(Signature sigma2)
Signature
union
in interface Signature
Setops.union(java.util.Collection,java.util.Collection)
public Signature intersection(Signature sigma2)
Signature
intersection
in interface Signature
Setops.intersection(java.util.Collection,java.util.Collection)
public Signature difference(Signature sigma2)
Signature
difference
in interface Signature
Setops.difference(java.util.Collection,java.util.Collection)
public Signature symmetricDifference(Signature sigma2)
Signature
symmetricDifference
in interface Signature
Setops.symmetricDifference(java.util.Collection,java.util.Collection)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean add(java.lang.Object o)
DelegateCollection
Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
add
in interface java.util.Collection
add
in interface java.util.Set
add
in class DelegateCollection
o
- element whose presence in this collection is to be ensured.
public static final Signature unmodifiableSignature(Signature s)
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |