Class AString

All Implemented Interfaces:
IValidated, IWriteable, CharSequence, Comparable<AString>
Direct Known Subclasses:
StringShort, StringSlice, StringTree

public abstract class AString extends ACountable<CVMChar> implements CharSequence, Comparable<AString>
Class representing a CVM String
  • Field Details

    • length

      protected int length
  • Constructor Details

    • AString

      protected AString(int length)
  • Method Details

    • getType

      public AType getType()
      Description copied from class: ACell
      Gets the most specific known runtime Type for this Cell.
      Overrides:
      getType in class ACell
      Returns:
      The Type of this Call
    • print

      public void print(StringBuilder sb)
      Description copied from class: AObject
      Prints this Object to a readable String Representation
      Specified by:
      print in class AObject
      Parameters:
      sb - StringBuilder to append to
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • count

      public long count()
      Description copied from class: ACountable
      Returns the number of elements in this data structure
      Specified by:
      count in class ACountable<CVMChar>
      Returns:
      Number of elements in this collection.
    • empty

      public StringShort empty()
    • append

      protected abstract AString append(char charValue)
    • get

      public CVMChar get(long i)
      Description copied from class: ACountable
      Gets the element at the specified index in this collection
      Specified by:
      get in class ACountable<CVMChar>
      Parameters:
      i - Index of element to get
      Returns:
      Element at the specified index
    • getElementRef

      public Ref<CVMChar> getElementRef(long i)
      Description copied from class: ACountable
      Gets a Ref to the element at the specified index in this collection
      Specified by:
      getElementRef in class ACountable<CVMChar>
      Parameters:
      i - Index of element to get
      Returns:
      Element at the specified index
    • compareTo

      public int compareTo(AString o)
      Specified by:
      compareTo in interface Comparable<AString>
    • toString

      public String toString()
      Description copied from class: ACell
      Returns the String representation of this Cell. The String representation is intended to be a easy-to-read textual representation of the Cell's data content.
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class ACell
    • appendToStringBuffer

      protected abstract void appendToStringBuffer(StringBuilder sb, int start, int length)
    • subSequence

      public abstract AString subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence
    • encode

      public int encode(byte[] bs, int pos)
      Description copied from class: ACell
      Writes this Cell's encoding to a byte array, including a tag byte which will be written first
      Specified by:
      encode in interface IWriteable
      Specified by:
      encode in class ACell
      Parameters:
      bs - A byte array to which to write the encoding
      pos - The offset into the byte array
      Returns:
      New position after writing
    • getTag

      public final byte getTag()
      Description copied from class: ACell
      Gets the tag byte for this cell. The tag byte is always written as the first byte of the Cell's Encoding
      Specified by:
      getTag in class ACell
      Returns:
      Tag byte for this Cell