hep.aida
Interface IAnnotation
-
- All Known Implementing Classes:
- Annotation
public interface IAnnotationThe annotation holds arbitrary information represented with (key,value) pairs of strings. A sticky bit is associated to every item to protect it (or not) from a reset operation. The following is the list of the default keys (they are stycky): "Title" for the title. The order of the default keys is not specified.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidaddItem(java.lang.String key, java.lang.String value)Add a key/value pair with a given sticky flag.voidaddItem(java.lang.String key, java.lang.String value, boolean sticky)Add a key/value pair with a given sticky flag.intfindKey(java.lang.String key)Find the index of a key.booleanhasKey(java.lang.String key)Check if a given key exists in IAnnotationbooleanisSticky(java.lang.String key)Get the stickyness for a given key.java.lang.Stringkey(int index)Get the key at a given position within the IAnnotation.voidremoveItem(java.lang.String key)Remove the item indicated by a given key.voidreset()Remove all the non-sticky items.voidsetSticky(java.lang.String key, boolean sticky)Set the sticky flag for a given key.voidsetValue(java.lang.String key, java.lang.String value)Set the value for a given key.intsize()Get the size of the IAnnotation, i.e.java.lang.Stringvalue(int index)Get the value at a given position within the IAnnotation.java.lang.Stringvalue(java.lang.String key)Retrieve the value for a given key.
-
-
-
Method Detail
-
addItem
void addItem(java.lang.String key, java.lang.String value) throws java.lang.IllegalArgumentExceptionAdd a key/value pair with a given sticky flag. If key alredy exists, its value is overwritten.- Parameters:
key- The key to be added.value- The key's value. not be removed when the method reset or removeItem are invoked. The default value for the sticky flag isfalse.- Throws:
java.lang.IllegalArgumentException- If the key already exists.
-
addItem
void addItem(java.lang.String key, java.lang.String value, boolean sticky) throws java.lang.IllegalArgumentExceptionAdd a key/value pair with a given sticky flag. If key alredy exists, its value is overwritten.- Parameters:
key- The key to be added.value- The key's value.sticky- The key's sticky flag. Iftruethe item will not be removed when the method reset or removeItem are invoked. The default value for the sticky flag isfalse.- Throws:
java.lang.IllegalArgumentException- If the key already exists.
-
removeItem
void removeItem(java.lang.String key) throws java.lang.IllegalArgumentExceptionRemove the item indicated by a given key.- Parameters:
key- The key to be removed. If the key is flagged as "sticky" it will not be removed.- Throws:
java.lang.IllegalArgumentException- If the key is sticky.
-
value
java.lang.String value(java.lang.String key)
Retrieve the value for a given key.- Parameters:
key- The key.- Returns:
- The corresponding value.
-
setValue
void setValue(java.lang.String key, java.lang.String value)Set the value for a given key.- Parameters:
key- The key whose vale is to be changed.value- The new value.
-
setSticky
void setSticky(java.lang.String key, boolean sticky)Set the sticky flag for a given key.- Parameters:
key- The key whose stick flag is to be set.sticky- The new sticky flag.
-
isSticky
boolean isSticky(java.lang.String key)
Get the stickyness for a given key.- Parameters:
key- The item's key.- Returns:
- The stickyness for the corresponding item.
-
hasKey
boolean hasKey(java.lang.String key)
Check if a given key exists in IAnnotation- Parameters:
key- The item's key.- Returns:
- true if the key exists.
-
size
int size()
Get the size of the IAnnotation, i.e. the number of keys contained in it.- Returns:
- The size of the IAnnotation.
-
findKey
int findKey(java.lang.String key)
Find the index of a key.- Parameters:
key- The key to find.- Returns:
- The key index. Return -1 if not found.
-
key
java.lang.String key(int index)
Get the key at a given position within the IAnnotation.- Parameters:
index- The key's position within the IAnnotation.- Returns:
- The corresponding key.
-
value
java.lang.String value(int index)
Get the value at a given position within the IAnnotation.- Parameters:
index- The value's position within the IAnnotation.- Returns:
- The corresponding value.
-
reset
void reset()
Remove all the non-sticky items.
-
-
DMelt 3.0 © DataMelt by jWork.ORG