Class WarningPropertySet<T extends WarningProperty>

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class WarningPropertySet<T extends WarningProperty>
    extends java.lang.Object
    implements java.lang.Cloneable
    A Set of WarningProperty objects, each with an optional attribute Object. A WarningPropertySet is useful for collecting heuristics to use in the determination of whether or not a warning is a false positive, or what the warning's priority should be.
    Author:
    David Hovemeyer
    • Constructor Summary

      Constructors 
      Constructor Description
      WarningPropertySet()
      Constructor Creates empty object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      WarningPropertySet<T> addProperty​(T prop)
      Add a warning property to the set.
      boolean checkProperty​(T prop, java.lang.Object value)
      Check whether or not the given WarningProperty has the given attribute value.
      java.lang.Object clone()  
      int computePriority​(int basePriority)
      Use the PriorityAdjustments specified by the set's WarningProperty elements to compute a warning priority from the given base priority.
      boolean containsProperty​(T prop)
      Return whether or not the set contains the given WarningProperty.
      void decorateBugInstance​(BugInstance bugInstance)
      Decorate given BugInstance with properties.
      java.lang.Object getProperty​(T prop)
      Get the value of the attribute for the given WarningProperty.
      boolean isFalsePositive​(int priority)
      Determine whether or not a warning with given priority is expected to be a false positive.
      WarningPropertySet<T> removeProperty​(T prop)
      Remove a warning property from the set.
      void setProperty​(T prop, java.lang.Boolean value)
      Add a warning property and its attribute value.
      WarningPropertySet<T> setProperty​(T prop, java.lang.String value)
      Add a warning property and its attribute value.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WarningPropertySet

        public WarningPropertySet()
        Constructor Creates empty object.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object
      • addProperty

        public WarningPropertySet<T> addProperty​(T prop)
        Add a warning property to the set. The warning implicitly has the boolean value "true" as its attribute.
        Parameters:
        prop - the WarningProperty
        Returns:
        this object
      • removeProperty

        public WarningPropertySet<T> removeProperty​(T prop)
        Remove a warning property from the set.
        Parameters:
        prop - the WarningProperty
        Returns:
        this object
      • setProperty

        public WarningPropertySet<T> setProperty​(T prop,
                                                 java.lang.String value)
        Add a warning property and its attribute value.
        Parameters:
        prop - the WarningProperty
        value - the attribute value
        Returns:
        this object
      • setProperty

        public void setProperty​(T prop,
                                java.lang.Boolean value)
        Add a warning property and its attribute value.
        Parameters:
        prop - the WarningProperty
        value - the attribute value
      • containsProperty

        @CheckReturnValue
        public boolean containsProperty​(T prop)
        Return whether or not the set contains the given WarningProperty.
        Parameters:
        prop - the WarningProperty
        Returns:
        true if the set contains the WarningProperty, false if not
      • checkProperty

        public boolean checkProperty​(T prop,
                                     java.lang.Object value)
        Check whether or not the given WarningProperty has the given attribute value.
        Parameters:
        prop - the WarningProperty
        value - the attribute value
        Returns:
        true if the set contains the WarningProperty and has an attribute equal to the one given, false otherwise
      • getProperty

        public java.lang.Object getProperty​(T prop)
        Get the value of the attribute for the given WarningProperty. Returns null if the set does not contain the WarningProperty.
        Parameters:
        prop - the WarningProperty
        Returns:
        the WarningProperty's attribute value, or null if the set does not contain the WarningProperty
      • computePriority

        public int computePriority​(int basePriority)
        Use the PriorityAdjustments specified by the set's WarningProperty elements to compute a warning priority from the given base priority.
        Parameters:
        basePriority - the base priority
        Returns:
        the computed warning priority
      • isFalsePositive

        public boolean isFalsePositive​(int priority)
        Determine whether or not a warning with given priority is expected to be a false positive.
        Parameters:
        priority - the priority
        Returns:
        true if the warning is expected to be a false positive, false if not
      • decorateBugInstance

        public void decorateBugInstance​(BugInstance bugInstance)
        Decorate given BugInstance with properties.
        Parameters:
        bugInstance - the BugInstance