Package org.tweetyproject.commons
Class SingleSetSignature<T>
java.lang.Object
org.tweetyproject.commons.SingleSetSignature<T>
- Type Parameters:
T
- The type of formulas in this signature.
- Direct Known Subclasses:
DungSignature
,PlSignature
,SetAfSignature
This class models a signature as a set of formulas.
- Author:
- Matthias Thimm, Anna Gessler
-
Constructor Summary
ConstructorDescriptionCreates a new empty signature.SingleSetSignature
(Set<T> formulas) Creates a new signature with the given set of elements. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given formulas to the signature.void
addAll
(Collection<?> c) Adds all elements of this collection to this signature.void
addSignature
(Signature other) Adds the elements of the given signature to this signature.void
clear()
Removes all elements of this signature.abstract SingleSetSignature
<T> clone()
clones signatureboolean
Returns true if this signature contains the specified formula.boolean
containsAll
(Collection<T> c) Returns true if this signature contains all of the elements in the specified collection.boolean
int
hashCode()
boolean
isEmpty()
Returns true if this signature is empty.boolean
isOverlappingSignature
(Signature other) Checks whether this signature has common elements with the given signature, i.e.boolean
isSubSignature
(Signature other) Checks whether this signature is a sub-signature of the given signature, i.e.iterator()
void
Removes the given formula from this signature, if it is present (optional operation).void
removeAll
(Collection<?> c) Removes all of this signature elements that are also contained in the specified collection (optional operation).void
retainAll
(Collection<?> c) retainAllint
size()
Returns the number of elements in this signature, i.e.Object[]
toArray()
Returns an array containing all of the elements in this signature.Returns a collection containing all of the elements in this signature.toString()
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SingleSetSignature
public SingleSetSignature()Creates a new empty signature. -
SingleSetSignature
-
-
Method Details
-
isSubSignature
Description copied from interface:Signature
Checks whether this signature is a sub-signature of the given signature, i.e. whether each logical expression expressible with this signature is also expressible with the given signature.- Specified by:
isSubSignature
in interfaceSignature
- Parameters:
other
- a signature.- Returns:
- "true" iff this signature is a sub-signature of the given one.
-
isOverlappingSignature
Description copied from interface:Signature
Checks whether this signature has common elements with the given signature, i.e. whether there are logical expressions expressible with this signature that are also expressible with the given signature.- Specified by:
isOverlappingSignature
in interfaceSignature
- Parameters:
other
- a signature.- Returns:
- "true" iff this signature is overlapping with the given one.
-
addSignature
Description copied from interface:Signature
Adds the elements of the given signature to this signature.- Specified by:
addSignature
in interfaceSignature
- Parameters:
other
- a signature.
-
hashCode
-
equals
-
addAll
Description copied from interface:Signature
Adds all elements of this collection to this signature. -
add
Description copied from interface:Signature
Adds the given formulas to the signature.- Specified by:
add
in interfaceSignature
- Parameters:
objects
- some objects to be added- Throws:
IllegalArgumentException
-
remove
-
isEmpty
-
removeAll
Description copied from interface:Signature
Removes all of this signature elements that are also contained in the specified collection (optional operation). After this call returns, this signature will contain no elements in common with the specified collection. -
retainAll
-
clear
-
iterator
-
toString
-
size
public int size()Returns the number of elements in this signature, i.e. the the size of the set that represents the signature.- Returns:
- size of the signature
-
contains
Returns true if this signature contains the specified formula.- Parameters:
f
- a formula- Returns:
- true if the signature contains f, false otherwise
-
containsAll
Returns true if this signature contains all of the elements in the specified collection.- Parameters:
c
- collection of formulas- Returns:
- true if the signature contains c, false otherwise
-
toArray
Returns an array containing all of the elements in this signature.- Returns:
- signature as array
-
toCollection
Returns a collection containing all of the elements in this signature.- Returns:
- formulas of this signature
-
clone
Description copied from interface:Signature
clones signature
-