Package adams.data
Class Notes
- java.lang.Object
-
- adams.data.Notes
-
- All Implemented Interfaces:
CloneHandler<Notes>,Mergeable<Notes>,Serializable
public class Notes extends Object implements Serializable, CloneHandler<Notes>, Mergeable<Notes>
A helper class for the Chromatogram class for storing meta-data.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringERRORthe error prefix.protected HashMap<String,List<String>>m_Notesthe notes for the chromatogram (classname <-> list of notes).static StringPROCESS_INFORMATIONthe process prefix.static StringWARNINGthe warning prefix.
-
Constructor Summary
Constructors Constructor Description Notes()Initializes the notes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(Class cls, String note)Adds the given error under the specified classname.voidaddError(String classname, String note)Adds the given error under the specified classname.voidaddNote(Class cls, String note)Adds the given note under the specified classname.voidaddNote(String classname, String note)Adds the given note under the specified classname.voidaddProcessInformation(Object obj)Adds the commandline from the given object as process information.voidaddWarning(Class cls, String note)Adds the given warning under the specified classname.voidaddWarning(String classname, String note)Adds the given warning under the specified classname.voidclear()Removes all notes.booleanequals(Object o)Returns whether the notes are equal.NotesgetClone()Returns a deep copy of this object.NotesgetErrors()Returns the error subset.List<String>getNotes(Class cls)Returns the notes for the given class.List<String>getNotes(String classname)Returns the notes for the given class.NotesgetOthers()Returns the other notes, not warning/error/process information.NotesgetPrefixSubset(String prefix)Returns the subset for the given prefix, e.g., PROCESS_INFORMATION.NotesgetProcessInformation()Returns the process information subset.NotesgetSubset(String regex)Returns the subset for the given prefix.NotesgetWarnings()Returns the warning subset.booleanhasError()Checks whether at least one error is among the notes.inthashCode()Returns the hashtable's hash code.booleanhasNotes(Class cls)Checks whether there are any notes for the given class available.booleanhasNotes(String classname)Checks whether there are any notes for the given class available.booleanhasOthers()Checks whether at least one other (not warning/error/proc.info) is among the notes.booleanhasProcessInformation()Checks whether at least one process information is among the notes.booleanhasWarning()Checks whether at least one warning is among the notes.static voidmain(String[] args)For testing only.voidmergeWith(Notes other)Merges the currently stored notes with the specified ones.Notesminus(Notes exclude)Returns all the notes after removing the provided ones.Iterator<String>notes()Returns an enumeration over all classes that have notes stored for at the moment.voidremoveNotes(Class cls)Removes all notes for the given class.voidremoveNotes(String classname)Removes all notes for the given class.intsize()Returns the number of classes that have notes stored.StringtoString()Returns a string representation of the notes.Notesunion(Notes other)Merges the currently stored notes with the specified ones and returns the new notes (the current ones aren't changed).
-
-
-
Field Detail
-
WARNING
public static final String WARNING
the warning prefix.- See Also:
- Constant Field Values
-
ERROR
public static final String ERROR
the error prefix.- See Also:
- Constant Field Values
-
PROCESS_INFORMATION
public static final String PROCESS_INFORMATION
the process prefix.- See Also:
- Constant Field Values
-
-
Method Detail
-
clear
public void clear()
Removes all notes.
-
addNote
public void addNote(Class cls, String note)
Adds the given note under the specified classname. Skips duplicates.- Parameters:
cls- the class the note is fornote- the note to add
-
addNote
public void addNote(String classname, String note)
Adds the given note under the specified classname. Skips duplicates.- Parameters:
classname- the class the note is fornote- the note to add
-
addWarning
public void addWarning(Class cls, String note)
Adds the given warning under the specified classname. Skips duplicates.- Parameters:
cls- the class the note is fornote- the warning to add
-
addWarning
public void addWarning(String classname, String note)
Adds the given warning under the specified classname. Skips duplicates.- Parameters:
classname- the class the note is fornote- the warning to add
-
addError
public void addError(Class cls, String note)
Adds the given error under the specified classname. Skips duplicates.- Parameters:
cls- the class the note is fornote- the error to add
-
addError
public void addError(String classname, String note)
Adds the given error under the specified classname. Skips duplicates.- Parameters:
classname- the class the note is fornote- the error to add
-
addProcessInformation
public void addProcessInformation(Object obj)
Adds the commandline from the given object as process information.- Parameters:
obj- the object to add its commandline to the process information
-
hasNotes
public boolean hasNotes(Class cls)
Checks whether there are any notes for the given class available.- Parameters:
cls- the class to look for notes for- Returns:
- true if notes are available
-
hasNotes
public boolean hasNotes(String classname)
Checks whether there are any notes for the given class available.- Parameters:
classname- the class to look for notes for- Returns:
- true if notes are available
-
hasWarning
public boolean hasWarning()
Checks whether at least one warning is among the notes.- Returns:
- true if notes contain at least one warning
-
hasError
public boolean hasError()
Checks whether at least one error is among the notes.- Returns:
- true if notes contain at least one error
-
hasProcessInformation
public boolean hasProcessInformation()
Checks whether at least one process information is among the notes.- Returns:
- true if notes contain at least one process information
-
hasOthers
public boolean hasOthers()
Checks whether at least one other (not warning/error/proc.info) is among the notes.- Returns:
- true if notes contain at least one other note
-
getNotes
public List<String> getNotes(Class cls)
Returns the notes for the given class.- Parameters:
cls- the class to look for notes for- Returns:
- the notes or null if not available
-
getNotes
public List<String> getNotes(String classname)
Returns the notes for the given class.- Parameters:
classname- the class to look for notes for- Returns:
- the notes or null if not available
-
getSubset
public Notes getSubset(String regex)
Returns the subset for the given prefix.- Parameters:
regex- the regular expression that notes must match- Returns:
- the subset
-
getWarnings
public Notes getWarnings()
Returns the warning subset.- Returns:
- the warnings (if any)
-
getErrors
public Notes getErrors()
Returns the error subset.- Returns:
- the errors (if any)
-
getPrefixSubset
public Notes getPrefixSubset(String prefix)
Returns the subset for the given prefix, e.g., PROCESS_INFORMATION.- Parameters:
prefix- the prefix to return the subset for- Returns:
- the subset (if any)
-
getProcessInformation
public Notes getProcessInformation()
Returns the process information subset.- Returns:
- the process informations (if any)
-
getOthers
public Notes getOthers()
Returns the other notes, not warning/error/process information.- Returns:
- the other notes (if any)
-
removeNotes
public void removeNotes(Class cls)
Removes all notes for the given class.- Parameters:
cls- the class to remove the notes for
-
removeNotes
public void removeNotes(String classname)
Removes all notes for the given class.- Parameters:
classname- the class to remove the notes for
-
notes
public Iterator<String> notes()
Returns an enumeration over all classes that have notes stored for at the moment.- Returns:
- the enumeration
-
getClone
public Notes getClone()
Returns a deep copy of this object.- Specified by:
getClonein interfaceCloneHandler<Notes>- Returns:
- the cloned object
-
mergeWith
public void mergeWith(Notes other)
Merges the currently stored notes with the specified ones.
-
union
public Notes union(Notes other)
Merges the currently stored notes with the specified ones and returns the new notes (the current ones aren't changed).- Parameters:
other- the notes to merge with- Returns:
- the union
-
minus
public Notes minus(Notes exclude)
Returns all the notes after removing the provided ones.- Parameters:
exclude- the notes to exclude- Returns:
- the remaining notes
-
size
public int size()
Returns the number of classes that have notes stored.- Returns:
- the number of classes
-
equals
public boolean equals(Object o)
Returns whether the notes are equal.
-
hashCode
public int hashCode()
Returns the hashtable's hash code.
-
toString
public String toString()
Returns a string representation of the notes.
-
main
public static void main(String[] args)
For testing only.- Parameters:
args- ignored
-
-