Class Scope

  • All Implemented Interfaces:
    java.lang.Comparable<FreeColObject>, ObjectWithId
    Direct Known Subclasses:
    Operand

    public class Scope
    extends FreeColObject
    The Scope class determines whether a given FreeColSpecObjectType fulfills certain requirements.
    • Field Detail

      • type

        private java.lang.String type
        The identifier of a FreeColSpecObjectType, or Option.
      • abilityId

        private java.lang.String abilityId
        The object identifier of an Ability.
      • abilityValue

        private boolean abilityValue
        The value of an Ability.
      • methodName

        private java.lang.String methodName
        The name of an Method.
      • methodValue

        private java.lang.String methodValue
        The String representation of the value of an Method.
      • matchesNull

        private boolean matchesNull
        True if the scope applies to a null object.
      • matchNegated

        private boolean matchNegated
        Whether the match is negated.
      • ABILITY_VALUE_TAG

        private static final java.lang.String ABILITY_VALUE_TAG
        See Also:
        Constant Field Values
      • MATCH_NEGATED_TAG

        private static final java.lang.String MATCH_NEGATED_TAG
        See Also:
        Constant Field Values
      • MATCHES_NULL_TAG

        private static final java.lang.String MATCHES_NULL_TAG
        See Also:
        Constant Field Values
      • METHOD_VALUE_TAG

        private static final java.lang.String METHOD_VALUE_TAG
        See Also:
        Constant Field Values
      • OLD_MATCH_NEGATED_TAG

        private static final java.lang.String OLD_MATCH_NEGATED_TAG
        See Also:
        Constant Field Values
      • OLD_MATCHES_NULL_TAG

        private static final java.lang.String OLD_MATCHES_NULL_TAG
        See Also:
        Constant Field Values
      • OLD_METHOD_NAME_TAG

        private static final java.lang.String OLD_METHOD_NAME_TAG
        See Also:
        Constant Field Values
      • OLD_METHOD_VALUE_TAG

        private static final java.lang.String OLD_METHOD_VALUE_TAG
        See Also:
        Constant Field Values
    • Constructor Detail

      • Scope

        public Scope()
        Deliberately empty constructor.
      • Scope

        public Scope​(FreeColXMLReader xr)
              throws javax.xml.stream.XMLStreamException
        Creates a new Scope instance from a stream.
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is an error reading the stream.
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Get a key to display this scope with.
        Returns:
        A suitable key, or null if none found.
      • getFeatureString

        public java.lang.String getFeatureString()
        Get a string describing this scope for display within a feature.
        Returns:
        A suitable string.
      • getMatchesNull

        private boolean getMatchesNull()
        Does this scope match null?
        Returns:
        True if this scope matches null.
      • setMatchesNull

        public void setMatchesNull​(boolean newMatchesNull)
        Set the match-null value. Public for the test suite.
        Parameters:
        newMatchesNull - The new match-null value.
      • getMatchNegated

        public boolean getMatchNegated()
        Is the match negated for this scope?
        Returns:
        True if this match is negated.
      • setMatchNegated

        public void setMatchNegated​(boolean newMatchNegated)
      • getType

        public java.lang.String getType()
      • setType

        public void setType​(java.lang.String newType)
      • getAbilityId

        public java.lang.String getAbilityId()
        Gets the ability identifier.
        Returns:
        The ability id.
      • setAbilityId

        public void setAbilityId​(java.lang.String newAbilityId)
        Sets the ability identifier.
        Parameters:
        newAbilityId - The new ability id.
      • getAbilityValue

        public boolean getAbilityValue()
      • setAbilityValue

        public void setAbilityValue​(boolean newAbilityValue)
      • getMethodName

        public java.lang.String getMethodName()
      • setMethodName

        public void setMethodName​(java.lang.String newMethodName)
      • getMethodValue

        public java.lang.String getMethodValue()
      • setMethodValue

        public void setMethodValue​(java.lang.String newMethodValue)
      • appliesTo

        public boolean appliesTo​(FreeColObject object)
        Does this scope apply to a given object?
        Parameters:
        object - The FreeColSpecObjectType to test.
        Returns:
        True if the scope is applicable.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class FreeColObject
        Type Parameters:
        T - The FreeColObject subclass of the object to copy in.
        Parameters:
        other - The other object.
        Returns:
        True if the copy in is succesful.
      • writeAttributes

        protected void writeAttributes​(FreeColXMLWriter xw)
                                throws javax.xml.stream.XMLStreamException
        Write the attributes of this object to a stream. To be overridden if required by any object that has attributes and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeAttributes in class FreeColObject
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • readAttributes

        protected void readAttributes​(FreeColXMLReader xr)
                               throws javax.xml.stream.XMLStreamException
        Reads the attributes of this object from an XML stream.
        Overrides:
        readAttributes in class FreeColObject
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
      • getXMLTagName

        public java.lang.String getXMLTagName()
        Get the serialization tag for this object.
        Specified by:
        getXMLTagName in class FreeColObject
        Returns:
        The tag.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class FreeColObject