scale.annot
Interface AnnotationInterface

All Known Implementing Classes:
Root

public interface AnnotationInterface

Defins the operations required of a class in order to use annotations.

$Id: AnnotationInterface.java,v 1.12 2002/01/03 21:41:26 burrill Exp $

Copyright 2002 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

Each node contains a container of annotations that have been associated with it. For the key to retrieve annotations, we use the value returned by the static method Annotation.annotationKey().

The goal of this interface is to make sure that details about how annotations are actually managed stay hidden. The interface provides only very general container operations, plus a few specialized routines unique to annotations.

See Also:
Annotation

Method Summary
 void addAnnotation(Annotation a)
          Adds an annotation to this node's annotation list.
 java.util.Enumeration allAnnotations()
           
 java.util.Enumeration allMatchingAnnotations(java.lang.Object annotation_key)
           
 Annotation getAnnotation(java.lang.Object annotation_key)
          Returns a single instance of the annotation with the given key.
 boolean hasAnnotation(java.lang.Object annotation_key)
           
 boolean hasEqualAnnotation(Annotation a)
           
 void removeAnnotation(Annotation annotation)
          Delete all annotations which match the key of the given Annotation.
 

Method Detail

addAnnotation

public void addAnnotation(Annotation a)
Adds an annotation to this node's annotation list. Redundant annotations are permitted.

removeAnnotation

public void removeAnnotation(Annotation annotation)
Delete all annotations which match the key of the given Annotation.

getAnnotation

public Annotation getAnnotation(java.lang.Object annotation_key)
Returns a single instance of the annotation with the given key. This method may return null.
Parameters:
annotation_key - the annotation key
Returns:
an arbitrary annotation of the indicated kind or null.

hasAnnotation

public boolean hasAnnotation(java.lang.Object annotation_key)
Parameters:
annotation_key - the annotation key
Returns:
true if the indicated kind of annotation is associated with the node.

hasEqualAnnotation

public boolean hasEqualAnnotation(Annotation a)
Parameters:
annotation_key - the annotation key
Returns:
true if an equivalent annotation is associated with the node. Note - the Creator, Beliefs, and the Combining Rule are not used in equivalence testing.

allAnnotations

public java.util.Enumeration allAnnotations()
Returns:
an enumeration of all the annotations associated with this node.

allMatchingAnnotations

public java.util.Enumeration allMatchingAnnotations(java.lang.Object annotation_key)
Returns:
an enumeration of all the annotations of the given kind associated with this node.