java.lang.Object
com.tccc.kos.ext.dispense.pipeline.beverage.graph.GraphNode
com.tccc.kos.ext.dispense.pipeline.beverage.graph.OrNode
All Implemented Interfaces:
Comparable<GraphNode>
Direct Known Subclasses:
IngredientNode

public class OrNode extends GraphNode
A GraphNode that reports availability as the logical OR of all of its child nodes. That is, this node is available/visible if any of its child nodes is available/visible.

This is useful for relationships such as a beverages in a brand, where a brand is available when any beverage associated with the brand is available.

The default type of this node is "OR", but a custom type can be used to allow for improved searchability.

Since:
1.0
Version:
2023-02-10
  • Field Details

  • Constructor Details

    • OrNode

      public OrNode(String id)
      Creates an OR node with the specified ID and a type of "OR".
      Parameters:
      id - the ID of the node
    • OrNode

      public OrNode(String type, String id)
      Creates an OR node with the specified ID and type.

      Although the node has the specified type name, it still functions as an OR node. This is useful for creating a layer of OR nodes in a graph that can be easily searched by type.

      Parameters:
      type - the type of the node
      id - the ID of the node
  • Method Details

    • computeVisible

      public boolean computeVisible()
      Computes this node's visiblity.

      An OR node is visible if any of its child nodes are visible.

      Overrides:
      computeVisible in class GraphNode
    • computeAvailable

      public boolean computeAvailable()
      Computes this node's availability.

      An OR node is available if any of its child nodes are available.

      Overrides:
      computeAvailable in class GraphNode