laser.util
Interface Annotatable

All Known Subinterfaces:
AlphabetInterface<L>, DFAInterface<L>, FSAEpsilonTransitionInterface<L>, FSAInterface<L>, FSALabelPatternTransitionInterface<L>, FSALabelTransitionInterface<L>, FSAStateInterface<L>, FSATransitionInterface<L>, MutableDFAInterface<L>, MutableFSAInterface<L>, RunnableDFAInterface<L>, RunnableFSAInterface<L>
All Known Implementing Classes:
AbstractFSA, AbstractFSATransition, AbstractMutableFSA, AbstractRunnableFSA, Alphabet, AnnotationTable, FSAEpsilonTransition, FSALabelPatternTransition, FSALabelTransition, FSAState, IndexedAlphabet, MutableDFA, MutableFSA, RunnableDFA, RunnableFSA

public interface Annotatable

The Annotatable interface allows the user to associate user-defined annotations with an Object that implements it. The annotations are of type Annotation.

Author:
Heather M. Conboy (laser-software@cs.umass.edu), Nathan A. Jokel
See Also:
Annotation

Method Summary
 boolean addAnnotation(Annotation annotation)
          Associates the given Annotation with this Object.
 boolean addAnnotations(java.util.Collection<? extends Annotation> annotations)
          Associates all of the Annotations in the given Collection with this Object.
 boolean copyAnnotations(Annotatable container)
          Copies all of the Annotations associated with this Object that pass the filters and associates them with the specified Object.
 java.util.Set<java.lang.Class<? extends Annotation>> getAnnotationClasses()
          Gets all of the Annotation Classes associated with this Object.
 java.util.Set<java.lang.Class<? extends Annotation>> getAnnotationClasses(java.lang.Class<? extends Annotation> query)
          Gets all of the Annotation Classes associated with this Object of the specified Annotation Class.
 java.util.Set<java.lang.Class<? extends Annotation>> getAnnotationFilters()
          Gets the filters to use when copying the Annotations.
 java.util.Collection<Annotation> getAnnotations()
          Gets all of the Annotations associated with this Object.
 java.util.Collection<Annotation> getAnnotations(java.lang.Class<? extends Annotation> query)
          Gets all of the Annotations associated with this Object that have an equal Class to or are a Subclass of the Class of the specified Annotation.
 boolean removeAnnotation(Annotation annotation)
          Removes the association of the given Annotation with this Object.
 void removeAnnotations()
          Removes all of the Annotations associated with this Object.
 boolean removeAnnotations(java.lang.Class<? extends Annotation> query)
          Removes the association of all of the Annotations of the specified Class or Subclasses of the specified Class with this Object, returning true if any Annotations were so associated, false otherwise.
 boolean removeAnnotations(java.util.Collection<? extends Annotation> annotations)
          Removes the association of all the Annotations in the given Collection with this Object.
 void setAnnotationFilters(java.util.Set<java.lang.Class<? extends Annotation>> filters)
          Sets the filters to use when copying the Annotations.
 

Method Detail

addAnnotation

boolean addAnnotation(Annotation annotation)
Associates the given Annotation with this Object. If an equal Annotation was already so associated, false is returned, otherwise true is returned.

Parameters:
annotation - The Annotation to associate with this Object.
Returns:
false if an equal Annotation was already associated with this Object and true otherwise.
Throws:
java.lang.IllegalArgumentException - if annotation is null.

addAnnotations

boolean addAnnotations(java.util.Collection<? extends Annotation> annotations)
Associates all of the Annotations in the given Collection with this Object. If an equal Annotation to every Annotation in the Collection was already so associated, false is returned, otherwise true is returned.

Parameters:
annotations - The Collection of Annotations to associate with this Object.
Returns:
false if an equal Annotation to every Annotation in the specified Collection was already associated with this Object and true otherwise.
Throws:
java.lang.IllegalArgumentException - if annotations or any annotation is null.

copyAnnotations

boolean copyAnnotations(Annotatable container)
Copies all of the Annotations associated with this Object that pass the filters and associates them with the specified Object. If equal Annotations to every Annotation that was copied from this Object were already associated with the specified Object, false is returned, otherwise true is returned.

Parameters:
container - The Object to associate the copied Annotations with.
Returns:
false if the specified Object was already associated with equal Annotations to every Annotation that was copied from this Object, true otherwise.
Throws:
java.lang.IllegalArgumentException - if container is null.
See Also:
getAnnotationFilters()

getAnnotationClasses

java.util.Set<java.lang.Class<? extends Annotation>> getAnnotationClasses(java.lang.Class<? extends Annotation> query)
Gets all of the Annotation Classes associated with this Object of the specified Annotation Class.

Parameters:
query - The Annotation Class of interest
Returns:
A Set of all of the Annotation Classes of the specified Annotation Class
Throws:
java.lang.IllegalArgumentException - if query is null.

getAnnotationClasses

java.util.Set<java.lang.Class<? extends Annotation>> getAnnotationClasses()
Gets all of the Annotation Classes associated with this Object.

Returns:
A Set of all of the Annotation Classes

getAnnotations

java.util.Collection<Annotation> getAnnotations(java.lang.Class<? extends Annotation> query)
Gets all of the Annotations associated with this Object that have an equal Class to or are a Subclass of the Class of the specified Annotation.

Parameters:
query - The Class of which Annotations of equal Class or Subclasses of the Class are to be returned.
Returns:
A Collection containing all of the Annotations associated with this Object that have an equal Class or are Subclasses of the specified Class.
Throws:
java.lang.IllegalArgumentException - if query is null.

getAnnotations

java.util.Collection<Annotation> getAnnotations()
Gets all of the Annotations associated with this Object.

Returns:
A Collection containing the Annotations associated with this Object.

getAnnotationFilters

java.util.Set<java.lang.Class<? extends Annotation>> getAnnotationFilters()
Gets the filters to use when copying the Annotations. The returned Set contains the Classes of Annotations that are not to be copied by the copyAnnotations(laser.util.Annotatable) method.

Returns:
The filters for the Annotations.
See Also:
copyAnnotations(laser.util.Annotatable)

setAnnotationFilters

void setAnnotationFilters(java.util.Set<java.lang.Class<? extends Annotation>> filters)
Sets the filters to use when copying the Annotations. The Set contains the Classes of Annotations that are not to be copied by the copyAnnotations(laser.util.Annotatable) method.

Parameters:
filters - The filters for the Annotations
Throws:
java.lang.IllegalArgumentException - if the filters are null
See Also:
copyAnnotations(laser.util.Annotatable)

removeAnnotation

boolean removeAnnotation(Annotation annotation)
Removes the association of the given Annotation with this Object. If an equal Annotation was so associated, true is returned, otherwise false is returned.

Parameters:
annotation - The Annotation of which the association with this Object is to be removed.
Returns:
true if an equal Annotation was associated with this Object and false otherwise.
Throws:
java.lang.IllegalArgumentException - if annotation is null.

removeAnnotations

boolean removeAnnotations(java.util.Collection<? extends Annotation> annotations)
Removes the association of all the Annotations in the given Collection with this Object. If an equal Annotation to any Annotation in the Collection was so associated, true is returned, otherwise false is returned.

Parameters:
annotations - The Collection of Annotations of which the association with this Object is to be removed.
Returns:
true if an equal Annotation to any Annotation in the specified Collection was associated with this Object and false otherwise.
Throws:
java.lang.IllegalArgumentException - if annotations or any annotation is null.

removeAnnotations

boolean removeAnnotations(java.lang.Class<? extends Annotation> query)
Removes the association of all of the Annotations of the specified Class or Subclasses of the specified Class with this Object, returning true if any Annotations were so associated, false otherwise.

Parameters:
query - The Class of Annotations that are to be removed.
Returns:
true if any associations with Annotations were removed, false otherwise.
Throws:
java.lang.IllegalArgumentException - if query is null.

removeAnnotations

void removeAnnotations()
Removes all of the Annotations associated with this Object.