Class Do<T extends ACell>

Type Parameters:
T - Result type of Do Op
All Implemented Interfaces:
IValidated, IWriteable

public class Do<T extends ACell> extends AMultiOp<T>
Op for executing a sequence of child operations in order "Design is to take things apart in such a way that they can be put back together" - Rich Hickey
  • Field Details

    • EMPTY

      public static final Do<?> EMPTY
  • Constructor Details

  • Method Details

    • create

      public static <T extends ACell> Do<T> create(AOp<?>... ops)
    • recreate

      protected Do<T> recreate(ASequence<AOp<ACell>> newOps)
      Description copied from class: AMultiOp
      Recreates this object with an updated list of child Ops.
      Specified by:
      recreate in class AMultiOp<T extends ACell>
      Returns:
    • create

      public static <T extends ACell> Do<T> create(ASequence<AOp<ACell>> ops)
    • execute

      public Context execute(Context context)
      Description copied from class: AOp
      Executes this op with the given context. Must preserve depth unless an exceptional is returned.
      Specified by:
      execute in class AOp<T extends ACell>
      Parameters:
      context - Initial Context
      Returns:
      The updated Context after executing this operation
    • print

      public boolean print(BlobBuilder bb, long limit)
      Description copied from class: AObject
      Prints this Object to a readable String Representation. SECURITY: Must halt and return false in O(1) time when limit of printing is exceeded otherwise DoS attacks may be possible.
      Specified by:
      print in class AObject
      Parameters:
      bb - BlobBuilder to append to. May be partially written if print limit exceeded
      limit - Limit of printing in string bytes
      Returns:
      True if fully printed within limit, false otherwise
    • opCode

      public byte opCode()
      Description copied from class: AOp
      Returns the opcode for this op
      Specified by:
      opCode in class AOp<T extends ACell>
      Returns:
      Opcode as a byte
    • read

      public static <T extends ACell> Do<T> read(Blob b, int pos) throws BadFormatException
      Decodes a Do op from a Blob encoding
      Type Parameters:
      T -
      Parameters:
      b - Blob to read from
      pos - Start position in Blob (location of tag byte)
      Returns:
      New decoded instance
      Throws:
      BadFormatException - In the event of any encoding error