Class NamingRule

  • All Implemented Interfaces:
    java.lang.Comparable<NamingRule>
    Direct Known Subclasses:
    DefaultNamingRule

    public abstract class NamingRule
    extends java.lang.Object
    implements java.lang.Comparable<NamingRule>
    Class used for representing Naming Rules.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<NamingRuleIdentifier> identifiers
      The identifiers of this naming rule.
      protected java.lang.String name
      The rule's name.
      protected int priority
      The rule's priority.
      static java.lang.String UNDEFINED_NAME
      Default name set to naming rules if no other can be found.
      static int UNDEFINED_PRIORITY
      Default priority set to naming rules if no other can be found.
    • Constructor Summary

      Constructors 
      Constructor Description
      NamingRule()  
    • Field Detail

      • UNDEFINED_PRIORITY

        public static final int UNDEFINED_PRIORITY
        Default priority set to naming rules if no other can be found.
        See Also:
        Constant Field Values
      • UNDEFINED_NAME

        public static final java.lang.String UNDEFINED_NAME
        Default name set to naming rules if no other can be found.
        See Also:
        Constant Field Values
      • priority

        protected int priority
        The rule's priority.
      • name

        protected java.lang.String name
        The rule's name.
      • identifiers

        protected java.util.Set<NamingRuleIdentifier> identifiers
        The identifiers of this naming rule.
    • Constructor Detail

      • NamingRule

        public NamingRule()
    • Method Detail

      • getIdentifiers

        public final java.util.Set<NamingRuleIdentifier> getIdentifiers()
        Returns the identifiers of the Naming Rule.
        Returns:
        rule's identifiers.
      • getName

        public final java.lang.String getName()
        Returns the name of the Naming Rule.
        Returns:
        rule's name.
      • getPriority

        public final int getPriority()
        Returns the priority of the Naming Rule.
        Returns:
        rule's priority.
      • isEmpty

        public final boolean isEmpty()
        Checks whether this naming rule has any Naming Identifiers.
        Returns:
        true if the rule is empty, otherwise false.
      • compareTo

        public int compareTo​(NamingRule other)
        Specified by:
        compareTo in interface java.lang.Comparable<NamingRule>
      • toString

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • matches

        public boolean matches​(java.util.Set<java.lang.String> attributes)
        Checks if the provided attributes match this naming rule.
        Parameters:
        attributes - the attributes to be checked.
        Returns:
        true if the attributes match this rule, otherwise false.
      • intersect

        public NamingRule intersect​(java.util.Set<NamingRuleIdentifier> attributes)
        Checks if the provided attributes match this naming rule.
        Parameters:
        attributes - the attributes to be checked.
        Returns:
        NaminRule that contains unsatisfied NamingRuleIdentifiers.