Class ResultPath

java.lang.Object
com.amalgamasimulation.studies.result.ResultPath

public class ResultPath extends Object
A class representing a path composed of string elements joined by a delimiter. The path is used to obtain the ResultElement.

The delimiter used to join elements is defined by DELIMITER. Path elements cannot contain the delimiter string.

  • Field Details

  • Constructor Details

    • ResultPath

      public ResultPath(List<String> elements)
      Constructs a new ResultPath from the given elements.
      Parameters:
      elements - the list of path elements
      Throws:
      IllegalArgumentException - if any element contains the delimiter string
  • Method Details

    • of

      public static ResultPath of(String... elements)
      Creates a new ResultPath from the given elements. Each string argument may contain multiple elements separated by the delimiter.
      Parameters:
      elements - the path elements (may be delimited strings)
      Returns:
      a new ResultPath containing all elements
    • empty

      public static ResultPath empty()
      Returns an empty ResultPath.
      Returns:
      an empty ResultPath
    • append

      public ResultPath append(String element)
      Appends an element to this path and returns a new ResultPath.
      Parameters:
      element - the element to append
      Returns:
      a new ResultPath with the element appended
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • contains

      public boolean contains(ResultPath otherPath)
      Checks if this path contains another path as a substring.
      Parameters:
      otherPath - the path to check for containment
      Returns:
      true if this path's string representation contains the other path's string representation
    • elements

      public List<String> elements()
      Returns an unmodifiable view of the path elements.
      Returns:
      the list of path elements
    • isEmpty

      public boolean isEmpty()
      Checks if this path is empty (has no elements).
      Returns:
      true if this path has no elements, false otherwise
    • localizedFullPath

      public String localizedFullPath(Function<ResultPath,String> localizedTitleSupplier)