Class NamePiece

java.lang.Object

public class NamePiece
extends ExpressionPiece
Reads letters, digits, and some predefined characters.
  • Constructor Summary

    Constructors
    Constructor Description
    NamePiece​(FilePointer ptr, java.lang.String specialChars)
    Construct a name piece at a position.
  • Method Summary

    Modifier and Type Method Description
    static boolean check​(char c, java.lang.String specialChars)
    Check whether a character can be read by a name piece with given special chars.
    java.lang.String name()
    Get parsed value of the name piece.
    PieceResult read​(char c, FilePointer ptr)
    Parse a character by this piece.
    java.lang.String toString()
    Get parsed value of the name piece.

    Methods inherited from class net.diversionmc.parser.expression.ExpressionPiece

    replace

    Methods inherited from class net.diversionmc.parser.util.Pointable

    pointer

    Methods inherited from class java.lang.Object

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

    • NamePiece

      public NamePiece​(FilePointer ptr, java.lang.String specialChars)
      Construct a name piece at a position.
      Parameters:
      ptr - Creation position.
      specialChars - Additional characters to read.
  • Method Details

    • read

      public PieceResult read​(char c, FilePointer ptr)
      Description copied from class: ExpressionPiece
      Parse a character by this piece.
      Specified by:
      read in class ExpressionPiece
      Parameters:
      c - Character to parse.
      ptr - Character position in file.
      Returns:
      PieceResult
    • name

      public java.lang.String name()
      Get parsed value of the name piece.
      Returns:
      Name piece value.
    • toString

      public java.lang.String toString()
      Get parsed value of the name piece.
      Overrides:
      toString in class java.lang.Object
      Returns:
      name()
    • check

      public static boolean check​(char c, java.lang.String specialChars)
      Check whether a character can be read by a name piece with given special chars.
      Parameters:
      c - Character to check.
      specialChars - Additional characters to read.
      Returns:
      True if character is a letter, digit, or in the specialChars supplied.