Class distribute

java.lang.Object
name.moore.kevin.ze.game.verbs.distribute

public class distribute extends Object
Move power from the output of an engine to the associated parts according to the distribution component.

A common usage is new distribute(id).set( Map... ).getEnergy().allocate(); or if the distribution isn't being changed new distribute(id).getEnergy().allocate();

components used

  • distribution = rw
  • health = r
  • spec = r
  • physical = r
  • accumulator = w
Author:
Kevin Moore <dev@kevin.moore.name>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static org.slf4j.Logger
     
    private com.simsilica.es.EntityId
     
    private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    distribute​(com.simsilica.es.EntityId vehicle)
    The constructor anticipates the parameter as the EntityId of something like a ship, but passing the id of a single engine is also possible.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.jscience.physics.amount.Amount<javax.measure.quantity.Energy>
    The end of the chain, returns any unused energy.
    Map<com.simsilica.es.EntityId,​Double>
    get()
    End of chain, returns the current vehicles distribution scheme.
    Sum the available energy from the engines (though we only expect one) ready for distribution.
    set​(Map<com.simsilica.es.EntityId,​Double> distvalues)
    Set a distribution scheme, optional.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • m

      private com.simsilica.es.EntityId m
    • output

      private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> output
  • Constructor Details

    • distribute

      public distribute(com.simsilica.es.EntityId vehicle)
      The constructor anticipates the parameter as the EntityId of something like a ship, but passing the id of a single engine is also possible.
      Parameters:
      vehicle -
  • Method Details

    • set

      public distribute set(Map<com.simsilica.es.EntityId,​Double> distvalues)
      Set a distribution scheme, optional.
      Parameters:
      distvalues -
      Returns:
    • get

      public Map<com.simsilica.es.EntityId,​Double> get()
      End of chain, returns the current vehicles distribution scheme.
      Returns:
    • getEnergy

      public distribute getEnergy()
      Sum the available energy from the engines (though we only expect one) ready for distribution. Sets output

      Without the inefficiency calculation this is a lovely simple stream calc. But since we can't split a stream calculation its 3 blocks.

      Returns:
    • allocate

      public org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> allocate()
      The end of the chain, returns any unused energy.
      Returns: