Record Class PortDefinition

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.machine.PortDefinition
Record Components:
id - unique within the machine type
storage - the storage exposed
direction - what callers may do through it
sides - faces it is exposed on, relative to the machine's facing
filter - what may pass, on top of the storage's own filter
ratePerTick - most that may pass per game tick (Long.MAX_VALUE: unlimited); scaled by the machineengine:transfer_rate modifier
group - ports of one group share sides in side configuration: each side shows at most one of them (e.g. items, energy); null if not configurable

public record PortDefinition(@NotNull String id, @NotNull String storage, @NotNull PortDirection direction, @NotNull Set<RelativeSide> sides, @NotNull ResourcePredicate filter, long ratePerTick, @Nullable String group) extends Record
A configured exposure of one of the machine's storages on some faces (ARCHITECTURE.md ยง11.2). Other machines, transports and hoppers reach the storage only through ports.
  • Constructor Details

    • PortDefinition

      public PortDefinition(@NotNull @NotNull String id, @NotNull @NotNull String storage, @NotNull @NotNull PortDirection direction, @NotNull @NotNull Set<RelativeSide> sides, @NotNull @NotNull ResourcePredicate filter, long ratePerTick, @Nullable @Nullable String group)
      Creates an instance of a PortDefinition record class.
      Parameters:
      id - the value for the id record component
      storage - the value for the storage record component
      direction - the value for the direction record component
      sides - the value for the sides record component
      filter - the value for the filter record component
      ratePerTick - the value for the ratePerTick record component
      group - the value for the group record component
  • Method Details

    • builder

      @NotNull public static @NotNull PortDefinition.Builder builder(@NotNull @NotNull String id, @NotNull @NotNull String storage)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • storage

      @NotNull public @NotNull String storage()
      Returns the value of the storage record component.
      Returns:
      the value of the storage record component
    • direction

      @NotNull public @NotNull PortDirection direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • sides

      @NotNull public @NotNull Set<RelativeSide> sides()
      Returns the value of the sides record component.
      Returns:
      the value of the sides record component
    • filter

      @NotNull public @NotNull ResourcePredicate filter()
      Returns the value of the filter record component.
      Returns:
      the value of the filter record component
    • ratePerTick

      public long ratePerTick()
      Returns the value of the ratePerTick record component.
      Returns:
      the value of the ratePerTick record component
    • group

      @Nullable public @Nullable String group()
      Returns the value of the group record component.
      Returns:
      the value of the group record component