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 String
ERROR
the error prefix.protected HashMap<String,List<String>>
m_Notes
the notes for the chromatogram (classname <-> list of notes).static String
PROCESS_INFORMATION
the process prefix.static String
WARNING
the 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 void
addError(Class cls, String note)
Adds the given error under the specified classname.void
addError(String classname, String note)
Adds the given error under the specified classname.void
addNote(Class cls, String note)
Adds the given note under the specified classname.void
addNote(String classname, String note)
Adds the given note under the specified classname.void
addProcessInformation(Object obj)
Adds the commandline from the given object as process information.void
addWarning(Class cls, String note)
Adds the given warning under the specified classname.void
addWarning(String classname, String note)
Adds the given warning under the specified classname.void
clear()
Removes all notes.boolean
equals(Object o)
Returns whether the notes are equal.Notes
getClone()
Returns a deep copy of this object.Notes
getErrors()
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.Notes
getOthers()
Returns the other notes, not warning/error/process information.Notes
getPrefixSubset(String prefix)
Returns the subset for the given prefix, e.g., PROCESS_INFORMATION.Notes
getProcessInformation()
Returns the process information subset.Notes
getSubset(String regex)
Returns the subset for the given prefix.Notes
getWarnings()
Returns the warning subset.boolean
hasError()
Checks whether at least one error is among the notes.int
hashCode()
Returns the hashtable's hash code.boolean
hasNotes(Class cls)
Checks whether there are any notes for the given class available.boolean
hasNotes(String classname)
Checks whether there are any notes for the given class available.boolean
hasOthers()
Checks whether at least one other (not warning/error/proc.info) is among the notes.boolean
hasProcessInformation()
Checks whether at least one process information is among the notes.boolean
hasWarning()
Checks whether at least one warning is among the notes.static void
main(String[] args)
For testing only.void
mergeWith(Notes other)
Merges the currently stored notes with the specified ones.Notes
minus(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.void
removeNotes(Class cls)
Removes all notes for the given class.void
removeNotes(String classname)
Removes all notes for the given class.int
size()
Returns the number of classes that have notes stored.String
toString()
Returns a string representation of the notes.Notes
union(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:
getClone
in 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
-
-