Class ValuedAIObject

    • Field Detail

      • ascendingValueComparator

        public static final java.util.Comparator<? super ValuedAIObject> ascendingValueComparator
        A comparator by ascending AI object value.
      • descendingValueComparator

        public static final java.util.Comparator<? super ValuedAIObject> descendingValueComparator
        A comparator by descending AI object value.
      • value

        private int value
        The value of this AIObject.
    • Constructor Detail

      • ValuedAIObject

        public ValuedAIObject​(AIMain aiMain)
        Creates a new ValuedAIObject instance.
        Parameters:
        aiMain - an AIMain value
      • ValuedAIObject

        public ValuedAIObject​(AIMain aiMain,
                              java.lang.String id)
        Creates a new uninitialized ValuedAIObject instance.
        Parameters:
        aiMain - an AIMain value
        id - The object identifier.
      • ValuedAIObject

        public ValuedAIObject​(AIMain aiMain,
                              FreeColXMLReader xr)
                       throws javax.xml.stream.XMLStreamException
        Creates a new ValuedAIObject from the given XML-representation.
        Parameters:
        aiMain - The main AI-object.
        xr - The input stream containing the XML.
        Throws:
        javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.
    • Method Detail

      • getValue

        public final int getValue()
        Get the value.
        Returns:
        The value.
      • setValue

        public final void setValue​(int newValue)
        Set the value.
        Parameters:
        newValue - The new value.
      • 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.
      • equals

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