Class BuildQueue<T extends BuildableType>

  • All Implemented Interfaces:
    Consumer

    public class BuildQueue<T extends BuildableType>
    extends java.lang.Object
    implements Consumer
    A queue of things for a colony to build.
    • Field Detail

      • queue

        private final java.util.List<T extends BuildableType> queue
        A list of Buildable items.
      • priority

        private int priority
        The build priority.
      • colony

        private final Colony colony
        The colony to queue buildables for.
    • Constructor Detail

      • BuildQueue

        public BuildQueue​(Colony colony,
                          BuildQueue.CompletionAction action,
                          int priority)
        Create a new build queue.
        Parameters:
        colony - The Colony to build for.
        action - The action on build completion.
        priority - The build priority.
    • Method Detail

      • clear

        public void clear()
      • add

        public void add​(T buildable)
      • getValues

        public java.util.List<T> getValues()
      • setValues

        public void setValues​(java.util.List<T> values)
      • remove

        public void remove​(int index)
      • size

        public int size()
      • isEmpty

        public boolean isEmpty()
      • getCurrentlyBuilding

        public T getCurrentlyBuilding()
        Get the type of building currently being built.
        Returns:
        The type of building currently being built.
      • setCurrentlyBuilding

        public void setCurrentlyBuilding​(T buildable)
        Sets the current type of buildable to be built and if it is a building insist that there is only one in the queue.
        Parameters:
        buildable - The T to build.
      • getProductionInfo

        public ProductionInfo getProductionInfo​(java.util.List<AbstractGoods> input)
        Get the ProductionInfo for this BuildQueue.
        Parameters:
        input - A list of input AbstractGoods.
        Returns:
        The ProductionInfo for this BuildQueue.
      • getConsumedGoods

        public java.util.List<AbstractGoods> getConsumedGoods()
        Returns a list of GoodsTypes this Consumer consumes.
        Specified by:
        getConsumedGoods in interface Consumer
        Returns:
        a List value
      • getPriority

        public int getPriority()
        The priority of this Consumer. The higher the priority, the earlier will the Consumer be allowed to consume the goods it requires.
        Specified by:
        getPriority in interface Consumer
        Returns:
        an int value
      • getConsumptionModifiers

        public java.util.stream.Stream<Modifier> getConsumptionModifiers​(java.lang.String id)
        Get the modifier set with the given id. The modifier most relevant to consumers is "consumeOnlySurplusProduction", which implies that the consumer does not consume stored goods (used by the country and stables).
        Specified by:
        getConsumptionModifiers in interface Consumer
        Parameters:
        id - The object identifier.
        Returns:
        The stream of Modifiers found.
      • toString

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