Class Statement

java.lang.Object
io.crums.model.hashing.Statement

public class Statement
extends java.lang.Object
Two entities separated by an '=' sign.
See Also:
Parser
  • Constructor Summary

    Constructors
    Constructor Description
    Statement​(Entity left, Entity right)  
  • Method Summary

    Modifier and Type Method Description
    boolean eval()
    Evaluates the left- and righthand side and returns whether they evaluated to the same bytes sequence.
    Entity left()
    Returns the LHS of the statement.
    static Statement parse​(java.io.Reader reader)
    Parses and returns a statement.
    static Statement parse​(java.lang.String statement)
    Parses and returns a statement.
    Entity right()
    Returns the RHS of the statement.
    java.lang.String toString()  
    java.lang.CharSequence toText()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Statement

      public Statement​(Entity left, Entity right)
  • Method Details

    • parse

      public static Statement parse​(java.lang.String statement)
      Parses and returns a statement. The argument must include exactly 1 (one) equal sign '='.
    • parse

      public static Statement parse​(java.io.Reader reader) throws java.io.UncheckedIOException
      Parses and returns a statement. The stream must include exactly 1 (one) equal sign '='. Note the stream must end at the end of the RHS (it is not a self-delimiting structure).
      Throws:
      java.io.UncheckedIOException
    • left

      public Entity left()
      Returns the LHS of the statement.
    • right

      public Entity right()
      Returns the RHS of the statement.
    • eval

      public boolean eval()
      Evaluates the left- and righthand side and returns whether they evaluated to the same bytes sequence.
      Returns:
      left().bytes().equals(right().bytes())
      See Also:
      Entity.bytes()
    • toText

      public java.lang.CharSequence toText()
    • toString

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