Class HistoryEvent

    • Field Detail

      • turn

        private Turn turn
        The turn in which the event took place
      • playerId

        private java.lang.String playerId
        Which player gets credit for the event, if any.
      • score

        private int score
        Points for this event, if any.
    • Constructor Detail

      • HistoryEvent

        public HistoryEvent()
        Trivial constructor to allow creation with Game.newInstance.
      • HistoryEvent

        public HistoryEvent​(Turn turn,
                            HistoryEvent.HistoryEventType eventType,
                            Player player)
        Create a new history event of given turn and type.
        Parameters:
        turn - The Turn of the event.
        eventType - The EventType.
        player - An optional Player responsible for this event.
      • HistoryEvent

        public HistoryEvent​(FreeColXMLReader xr)
                     throws javax.xml.stream.XMLStreamException
        Create a new history event by reading a stream.
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
    • Method Detail

      • getTurn

        public final Turn getTurn()
        Get the turn of this history event.
        Returns:
        The turn.
      • getEventTypeFromStance

        public static final HistoryEvent.HistoryEventType getEventTypeFromStance​(Stance stance)
        Given a new stance, get the appropriate event type.
        Parameters:
        stance - The new Stance.
        Returns:
        The corresponding event type.
      • getPlayerId

        public final java.lang.String getPlayerId()
        Get the id for the player that is credited with this event, if any.
        Returns:
        The credited Player id.
      • setPlayerId

        public void setPlayerId​(java.lang.String playerId)
        Set the id for the player to credit for this event.
        Parameters:
        playerId - The new credited Player id.
      • getScore

        public final int getScore()
        Get the score for this event.
        Returns:
        The score.
      • setScore

        public void setScore​(int score)
        Set the score for this event.
        Parameters:
        score - The new score for this event.
      • copyIn

        public <T extends FreeColObject> boolean copyIn​(T other)
        Copy another FreeColObject into this one if it is compatible.
        Overrides:
        copyIn in class StringTemplate
        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 StringTemplate
        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 StringTemplate
        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.
        Overrides:
        getXMLTagName in class StringTemplate
        Returns:
        The tag.
      • equals

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