Class AttributeModifierCriteria

  • Direct Known Subclasses:
    ImmutableAttributeModifierCriteria

    public class AttributeModifierCriteria
    extends java.lang.Object
    Class that contains combined criteria for searching and filtering attribute descriptors. Criteria are defined as three sections:
    • exclusive - they should be matched exactly
    • alternative - all set modifiers should be matched
    • disallowed - none of set modifiers should be matched
    Each of section is represented as integer value build as set of bits. Use constants from AttributeModifiers to build the criteria.
    • Constructor Summary

      Constructors 
      Constructor Description
      AttributeModifierCriteria​(int exclusive, int alternative, int disallowed)
      Instantiates a new attribute modifier criteria with the given parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAlternative​(int modifier)
      Adds the alternative attribute modifier for filtering.
      void addDisallowed​(int modifier)
      Adds the disallowed attribute modifier for filtering.
      void addRequired​(int modifier)
      Adds the required attribute modifier for filtering.
      boolean matches​(int actualAttributeModifiers)
      Function checks if the given combined attribute modifier matches current state of this criteria.
      • Methods inherited from class java.lang.Object

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

      • AttributeModifierCriteria

        public AttributeModifierCriteria​(int exclusive,
                                         int alternative,
                                         int disallowed)
        Instantiates a new attribute modifier criteria with the given parameters.
        Parameters:
        exclusive - the exclusive
        alternative - the alternative
        disallowed - the disallowed
    • Method Detail

      • addRequired

        public void addRequired​(int modifier)
        Adds the required attribute modifier for filtering. Selected attribute modifier is mandatory in the search result.
        Parameters:
        modifier - the modifier
      • addAlternative

        public void addAlternative​(int modifier)
        Adds the alternative attribute modifier for filtering. At least one of the alternative modifiers is mandatory in the search result.
        Parameters:
        modifier - the modifier
      • addDisallowed

        public void addDisallowed​(int modifier)
        Adds the disallowed attribute modifier for filtering. None of the disallowed modifiers must be present in the attribute descriptor that is in the search result.
        Parameters:
        modifier - the modifier
      • matches

        public boolean matches​(int actualAttributeModifiers)
        Function checks if the given combined attribute modifier matches current state of this criteria.
        Parameters:
        actualAttributeModifiers - the actual attribute modifiers
        Returns:
        true, if successful