Class UnitWas

  • All Implemented Interfaces:
    java.lang.Comparable<UnitWas>

    public class UnitWas
    extends java.lang.Object
    implements java.lang.Comparable<UnitWas>
    Helper container to remember a unit state prior to some change, and fire off any consequent property changes.
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • unit

        private final Unit unit
      • role

        private final Role role
      • roleCount

        private final int roleCount
      • workAmount

        private final int workAmount
      • movesLeft

        private final int movesLeft
      • units

        private final java.util.List<Unit> units
      • colony

        private final Colony colony
    • Constructor Detail

      • UnitWas

        public UnitWas​(Unit unit)
        Record the state of a unit.
        Parameters:
        unit - The Unit to remember.
    • Method Detail

      • getUnit

        public Unit getUnit()
      • getLocation

        public Location getLocation()
      • getWorkType

        public GoodsType getWorkType()
      • fireChanges

        public boolean fireChanges()
        Fire any property changes resulting from actions of a unit.
        Returns:
        True if something changed.
      • compareTo

        public int compareTo​(UnitWas uw)
        Specified by:
        compareTo in interface java.lang.Comparable<UnitWas>
      • equals

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

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

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