Class ConfEAtom

Object
com.tailf.proto.ConfEObject
com.tailf.proto.ConfEAtom
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ConfEBoolean

public class ConfEAtom extends ConfEObject implements Serializable, Cloneable
Provides a Java representation of E atoms. Atoms can be created from strings whose length is not more than maxAtomLength characters.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The maximun allowed length of an atom, in characters
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConfEAtom(boolean t)
    Create an atom whose value is "true" or "false".
    Create an atom from a stream containing an atom encoded in E external format.
    Create an atom from the given string.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the actual string contained in this object.
    boolean
    The boolean value of this atom.
    void
    Convert this atom to the equivalent E external representation.
    boolean
    Determine if two atoms are equal.
    int
     
    Get the printname of the atom represented by this object.

    Methods inherited from class com.tailf.proto.ConfEObject

    clone, decode

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • maxAtomLength

      public static final int maxAtomLength
      The maximun allowed length of an atom, in characters
      See Also:
  • Constructor Details

    • ConfEAtom

      public ConfEAtom(String atom)
      Create an atom from the given string.
      Parameters:
      atom - the string to create the atom from.
      Throws:
      IllegalArgumentException - if the string contains more than maxAtomLength characters.
    • ConfEAtom

      public ConfEAtom(ConfInputStream buf) throws ConfEDecodeException
      Create an atom from a stream containing an atom encoded in E external format.
      Parameters:
      buf - the stream containing the encoded atom.
      Throws:
      ConfEDecodeException - if the buffer does not contain a valid external representation of an E atom.
    • ConfEAtom

      public ConfEAtom(boolean t)
      Create an atom whose value is "true" or "false".
      Parameters:
      t - boolean value true/false
  • Method Details

    • atomValue

      public String atomValue()
      Get the actual string contained in this object.
      Returns:
      the raw string contained in this object, without regard to E quoting rules.
      See Also:
    • booleanValue

      public boolean booleanValue()
      The boolean value of this atom.
      Returns:
      the value of this atom expressed as a boolean value. If the atom consists of the characters "true" (independent of case) the value will be true. For any other values, the value will be false.
    • toString

      public String toString()
      Get the printname of the atom represented by this object. The difference between this method and {link #atomValue atomValue()} is that the printname is quoted and escaped where necessary, according to the E rules for atom naming.
      Specified by:
      toString in class ConfEObject
      Returns:
      the printname representation of this atom object.
      See Also:
    • equals

      public boolean equals(Object o)
      Determine if two atoms are equal.
      Specified by:
      equals in class ConfEObject
      Parameters:
      o - the other object to compare to.
      Returns:
      true if the atoms are equal, false otherwise.
    • hashCode

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

      public void encode(ConfOutputStream buf)
      Convert this atom to the equivalent E external representation.
      Specified by:
      encode in class ConfEObject
      Parameters:
      buf - an output stream to which the encoded atom should be written.