Enum PieceResult

java.lang.Object
java.lang.Enum<PieceResult>
net.diversionmc.parser.expression.PieceResult
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<PieceResult>, java.lang.constant.Constable

public enum PieceResult
extends java.lang.Enum<PieceResult>
Piece result shows whether a piece should stop consuming characters or continue.
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    CONTINUE
    Ask for another character to consume.
    LEAVE
    Stop reading and leave the supplied character.
    REPLACE_LEAVE
    Stop reading and leave the supplied character, call ExpressionPiece.replace(FilePointer) and proceed to read that character in the new piece.
    REPLACE_TAKE
    Stop reading and consume the supplied character, call ExpressionPiece.replace(FilePointer) and proceed to read next characters in the new piece.
    TAKE
    Stop reading and consume the supplied character.
  • Method Summary

    Modifier and Type Method Description
    static PieceResult valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static PieceResult[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • TAKE

      public static final PieceResult TAKE
      Stop reading and consume the supplied character. The parse pointer will be incremented by 1. Default piece result when a null is given.
    • LEAVE

      public static final PieceResult LEAVE
      Stop reading and leave the supplied character. The parse pointer will stay as is, leaving the current character for the next piece iteration.
    • REPLACE_TAKE

      public static final PieceResult REPLACE_TAKE
      Stop reading and consume the supplied character, call ExpressionPiece.replace(FilePointer) and proceed to read next characters in the new piece. Behaves same as TAKE if replacement piece is null, except does not call Parser.pieceFinish(Consumer).
    • REPLACE_LEAVE

      public static final PieceResult REPLACE_LEAVE
      Stop reading and leave the supplied character, call ExpressionPiece.replace(FilePointer) and proceed to read that character in the new piece. Behaves same as LEAVE if replacement piece is null, except does not call Parser.pieceFinish(Consumer).
    • CONTINUE

      public static final PieceResult CONTINUE
      Ask for another character to consume. The parse pointer will be incremented by 1 and ExpressionPiece.read(char, FilePointer) will be called again.
  • Method Details

    • values

      public static PieceResult[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PieceResult valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      java.lang.NullPointerException - if the argument is null