Class ParameterProperty


  • public class ParameterProperty
    extends java.lang.Object
    Method property recording which parameters are have some property (originally, which were required to be nonnull, now made more generic)
    Author:
    David Hovemeyer
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_PARAMS
      Maximum number of parameters that can be represented by a ParameterProperty.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copyFrom​(ParameterProperty other)
      Make this object the same as the given one.
      java.util.BitSet getAsBitSet()  
      java.util.BitSet getMatchingParameters​(java.util.BitSet nullArgSet)
      Given a bitset of null arguments passed to the method represented by this property, return a bitset indicating which null arguments correspond to an non-null param.
      int getParamsWithProperty()
      Get the non-null param bitset.
      boolean hasProperty​(int param)
      Return whether or not a parameter might be non-null.
      void intersectWith​(ParameterProperty targetDerefParamSet)
      Intersect this set with the given set.
      boolean isEmpty()
      Return whether or not the set of non-null parameters is empty.
      java.lang.Iterable<java.lang.Integer> iterable()  
      void setParamsWithProperty​(int nonNullParamSet)
      Set the non-null param bitset.
      void setParamsWithProperty​(java.util.BitSet nonNullSet)
      Set the non-null param set from given BitSet.
      void setParamWithProperty​(int param, boolean hasProperty)
      Set whether or not a parameter might be non-null.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • MAX_PARAMS

        public static final int MAX_PARAMS
        Maximum number of parameters that can be represented by a ParameterProperty.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ParameterProperty

        public ParameterProperty()
        Constructor. Parameters are all assumed not to be non-null.
      • ParameterProperty

        public ParameterProperty​(int bits)
        Constructor. Parameters are all assumed not to be non-null.
    • Method Detail

      • getParamsWithProperty

        public int getParamsWithProperty()
        Get the non-null param bitset.
        Returns:
        the non-null param bitset
      • iterable

        public java.lang.Iterable<java.lang.Integer> iterable()
      • setParamsWithProperty

        public void setParamsWithProperty​(int nonNullParamSet)
        Set the non-null param bitset.
        Parameters:
        nonNullParamSet - the non-null param bitset
      • setParamsWithProperty

        public void setParamsWithProperty​(java.util.BitSet nonNullSet)
        Set the non-null param set from given BitSet.
        Parameters:
        nonNullSet - BitSet indicating which parameters are non-null
      • setParamWithProperty

        public void setParamWithProperty​(int param,
                                         boolean hasProperty)
        Set whether or not a parameter might be non-null.
        Parameters:
        param - the parameter index
        hasProperty - true if the parameter might be non-null, false otherwise
      • hasProperty

        public boolean hasProperty​(int param)
        Return whether or not a parameter might be non-null.
        Parameters:
        param - the parameter index
        Returns:
        true if the parameter might be non-null, false otherwise
      • getMatchingParameters

        public java.util.BitSet getMatchingParameters​(java.util.BitSet nullArgSet)
        Given a bitset of null arguments passed to the method represented by this property, return a bitset indicating which null arguments correspond to an non-null param.
        Parameters:
        nullArgSet - bitset of null arguments
        Returns:
        bitset intersecting null arguments and non-null params
      • getAsBitSet

        public java.util.BitSet getAsBitSet()
      • isEmpty

        public boolean isEmpty()
        Return whether or not the set of non-null parameters is empty.
        Returns:
        true if the set is empty, false if it contains at least one parameter
      • toString

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

        public void intersectWith​(ParameterProperty targetDerefParamSet)
        Intersect this set with the given set. Useful for summarizing the properties of multiple methods.
        Parameters:
        targetDerefParamSet - another set
      • copyFrom

        public void copyFrom​(ParameterProperty other)
        Make this object the same as the given one.
        Parameters:
        other - another ParameterNullnessProperty