Class Report

    • Field Detail

      • FIELD_DUMMYREPORT

        public static final String FIELD_DUMMYREPORT
        field: Dummy report (in case there was no quantitation report and a dummy report was generated automatically).
        See Also:
        Constant Field Values
      • m_DatabaseID

        protected int m_DatabaseID
        the database ID of the data structure this report belongs to.
    • Constructor Detail

      • Report

        public Report()
        Default constructor.
    • Method Detail

      • setLoggingLevel

        public void setLoggingLevel​(LoggingLevel value)
        Sets the logging level.
        Parameters:
        value - the level
      • setDatabaseID

        public void setDatabaseID​(int value)
        Sets the parent ID, i.e., the database ID of the data container this report belongs to.
        Specified by:
        setDatabaseID in interface MutableDatabaseIDHandler
        Parameters:
        value - the database ID
      • getDatabaseID

        public int getDatabaseID()
        Returns the database ID of the data container this report belongs to.
        Specified by:
        getDatabaseID in interface DatabaseIDHandler
        Returns:
        the database ID, -1 if not set
      • initFields

        protected void initFields()
        Set field types.
      • addField

        public void addField​(AbstractField field)
        Adds the given field.
        Parameters:
        field - the field to add
      • hasField

        public boolean hasField​(String field)
        Checks whether the field is already stored.
        Parameters:
        field - the field to check
        Returns:
        true if already added
      • hasField

        public boolean hasField​(AbstractField field)
        Checks whether the field is already stored.
        Parameters:
        field - the field to check
        Returns:
        true if already added
      • getFields

        public List<AbstractField> getFields()
        Get all fields as vector.
        Returns:
        the fields
      • getFields

        public List<AbstractField> getFields​(PrefixOnlyField prefix)
        Get all fields as vector that have the same prefix.
        Parameters:
        prefix - the common prefix
        Returns:
        the fields that match the prefix
      • getFields

        public List<AbstractField> getFields​(SuffixOnlyField suffix)
        Get all fields as vector that have the same suffix.
        Parameters:
        suffix - the common suffix
        Returns:
        the fields that match the suffix
      • getPrefixFields

        public List<PrefixOnlyField> getPrefixFields()
        Returns all distinct prefix fields.
        Returns:
        the prefix fields
      • getSuffixFields

        public List<SuffixOnlyField> getSuffixFields()
        Returns all distinct suffix fields.
        Returns:
        the suffix fields
      • addParameter

        public void addParameter​(String key,
                                 String value)
        Add parameter value to store.
        Parameters:
        key - the key
        value - the value for the key
      • addParameter

        public void addParameter​(String key,
                                 Object value)
        Add parameter value to store.
        Parameters:
        key - the key
        value - the value for the key
      • hasValue

        public boolean hasValue​(AbstractField key)
        Returns whether a certain value is available in this report.
        Parameters:
        key - the value to look for
        Returns:
        true if the value is available
      • hasValue

        public boolean hasValue​(String key)
        Returns whether a certain value is available in this report.
        Parameters:
        key - the value to look for
        Returns:
        true if the value is available
      • hasValues

        protected boolean hasValues​(AbstractField[] fields)
        Checks whether all the fields are available.
        Parameters:
        fields - the required fields
        Returns:
        true if required fields available
      • hasValues

        public boolean hasValues​(String[] fields)
        Checks whether all the fields are available.
        Parameters:
        fields - the required fields
        Returns:
        true if required fields available
      • setValue

        public boolean setValue​(AbstractField key,
                                Object value)
        Sets a value.
        Parameters:
        key - the key of the value
        value - the new value
        Returns:
        whether successfully set
      • setNumericValue

        public void setNumericValue​(String key,
                                    double value)
        Sets a numeric value.
        Parameters:
        key - the key of the value
        value - the new value
      • setStringValue

        public void setStringValue​(String key,
                                   String value)
        Sets a string value.
        Parameters:
        key - the key of the value
        value - the new value
      • setBooleanValue

        public void setBooleanValue​(String key,
                                    boolean value)
        Sets a boolean value.
        Parameters:
        key - the key of the value
        value - the new value
      • getValue

        public Object getValue​(AbstractField key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value
      • getStringValue

        public String getStringValue​(String key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value
      • getStringValue

        public String getStringValue​(AbstractField key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value, null if not present
      • getBooleanValue

        public Boolean getBooleanValue​(String key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value
      • getBooleanValue

        public Boolean getBooleanValue​(AbstractField key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value, null if not present
      • getDoubleValue

        public Double getDoubleValue​(String key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value
      • getDoubleValue

        public Double getDoubleValue​(AbstractField key)
        Get parameter value, or null if not available.
        Parameters:
        key - the key
        Returns:
        parameter value, null if not present
      • removeValue

        public Object removeValue​(AbstractField key)
        Removes the specified field.
        Parameters:
        key - the key
        Returns:
        the value previously stored in the report, can be null if the field wasn't present
      • removeValues

        public boolean removeValues​(BaseRegExp regExp)
        Removes all fields that match the regular expression.
        Parameters:
        regExp - the regular expression to match the field names against
        Returns:
        true if report got modified (ie at least one field removed)
      • removeValuesStartingWith

        public boolean removeValuesStartingWith​(String prefix)
        Removes all fields that start with the provided string.
        Parameters:
        prefix - the prefix of fields to remove
        Returns:
        true if report got modified (ie at least one field removed)
      • update

        public void update()
        Updates certain dependant fields. This method should be called before saving it to the database, after loading it from the database or when a quantitation report has been created by hand. Default implementation does nothing.
      • toString

        public String toString()
        Return String representation of report.
        Overrides:
        toString in class Object
        Returns:
        string representation of report.
      • assign

        public void assign​(Report other)
        Obtains all the values from the specified report.
        Parameters:
        other - the report to obtain the values form
      • setDummyReport

        public void setDummyReport​(boolean value)
        Sets whether this report is dummy report or not.
        Parameters:
        value - if true then this report will be flagged as dummy report
      • isDummyReport

        public boolean isDummyReport()
        Returns whether this report is a dummy report or not.
        Returns:
        true if this report is a dummy report
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareTo in interface Comparable
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class Object
        Parameters:
        obj - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • hashCode

        public int hashCode()
        Hashcode so can be used as hashtable key. Returns the hashcode of the m_Params hashtable.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • intersect

        public Report intersect​(Report report)
        Returns the intersection with this Quantitation Report and the provided one. The result contains the values of this quantitation report. No merging of values between the two is performed.
        Parameters:
        report - the report to get the intersection with
        Returns:
        the intersection
      • minus

        public Report minus​(Report report)
        Returns the subset of values that this Quantitation Report contains, but not the provided one. The result contains the values of this quantitation report.
        Parameters:
        report - the report to get the fields from to not include in the result
        Returns:
        the new report
      • mergeWith

        public void mergeWith​(Report other)
        Merges its own data with the one provided by the specified object. Never overwrites its own values, only adds missing ones.
        Specified by:
        mergeWith in interface Mergeable<Report>
        Parameters:
        other - the object to merge with
      • newInstance

        public static Report newInstance​(Report report)
        Returns a new instance of the concrete subclass for the report.
        Parameters:
        report - the report class to create a new instance from
        Returns:
        the new instance
      • toProperties

        public Properties toProperties()
        Turns the report into a properties object. Also adds the parent ID.
        Returns:
        the generated
      • parseReport

        public static Report parseReport​(String s)
        Parses the string generated by the toString() method.
        Parameters:
        s - the string to parse
        Returns:
        the generated report
        See Also:
        toString()
      • parseProperties

        public static Report parseProperties​(Properties props)
        Parses the properties (generated with the toProperties() method) and generates a report object from it.
        Parameters:
        props - the properties to generate the report from
        Returns:
        the report
        See Also:
        toProperties()