Class InstructionCollection<T extends Instruction>

java.lang.Object
net.covers1624.coffeegrinder.bytecode.InstructionSlot<T>
net.covers1624.coffeegrinder.bytecode.InstructionCollection<T>
All Implemented Interfaces:
Iterable<T>, net.covers1624.quack.collection.FastStream<T>
Direct Known Subclasses:
IndexedInstructionCollection

public class InstructionCollection<T extends Instruction> extends InstructionSlot<T> implements net.covers1624.quack.collection.FastStream<T>
Represents an InstructionSlot capable of holding multiple instructions.

Created by covers1624 on 22/9/21.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
     

    Nested classes/interfaces inherited from interface net.covers1624.quack.collection.FastStream

    net.covers1624.quack.collection.FastStream.Bucket<V>, net.covers1624.quack.collection.FastStream.Concatenated<T>, net.covers1624.quack.collection.FastStream.ConcatenatedN<T>, net.covers1624.quack.collection.FastStream.Distinct<T>, net.covers1624.quack.collection.FastStream.Filtered<T>, net.covers1624.quack.collection.FastStream.FlatMapped<T,R>, net.covers1624.quack.collection.FastStream.Group<K,V>, net.covers1624.quack.collection.FastStream.Grouped<T,K,V>, net.covers1624.quack.collection.FastStream.Internal, net.covers1624.quack.collection.FastStream.Mapped<T,R>, net.covers1624.quack.collection.FastStream.OfN<T>, net.covers1624.quack.collection.FastStream.OfSingle<T>, net.covers1624.quack.collection.FastStream.Partitioned<V>, net.covers1624.quack.collection.FastStream.Peeked<T>, net.covers1624.quack.collection.FastStream.Reversed<T>, net.covers1624.quack.collection.FastStream.Sliced<T>, net.covers1624.quack.collection.FastStream.Sorted<T>, net.covers1624.quack.collection.FastStream.TypeCheck<T,S>, net.covers1624.quack.collection.FastStream.Wrapped<T>, net.covers1624.quack.collection.FastStream.WrappedSpl<T>
  • Field Summary

    Fields inherited from interface net.covers1624.quack.collection.FastStream

    EMPTY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new InstructionCollection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T value)
    Add an Instruction to the end of this collection.
    protected void
     
    void
    addAll(Iterable<? extends T> values)
    Adds multiple Instructions to the end of this collection.
    void
    addAllFirst(Iterable<? extends T> values)
     
    void
    addFirst(T value)
    Adds an instruction to the start of this collection.
    protected void
     
    void
    Removes all elements from this collection.
    int
     
    Return the value stored inside the slot.
    boolean
     
    @NotNull Iterator<T>
     
    Returns the second to last Instruction in this collection or null.
    void
    Set the value in this slot.
    int
    Get the number of elements stored in this collection.

    Methods inherited from class net.covers1624.coffeegrinder.bytecode.InstructionSlot

    get

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.covers1624.quack.collection.FastStream

    allMatch, anyMatch, concat, distinct, doubleSum, filter, filterNot, findFirst, findLast, first, firstOrDefault, firstOrDefault, flatMap, fold, fold, groupBy, groupBy, intSum, join, knownLength, knownLength, last, lastOrDefault, lastOrDefault, limit, longSum, map, maxBy, maxByDouble, maxByDoubleOrDefault, maxByDoubleOrDefault, maxByLong, maxByLongOrDefault, maxByLongOrDefault, maxByOrDefault, maxByOrDefault, minBy, minByDouble, minByDoubleOrDefault, minByDoubleOrDefault, minByLong, minByLongOrDefault, minByLongOrDefault, minByOrDefault, minByOrDefault, noneMatch, only, onlyOrDefault, onlyOrDefault, partition, peek, reversed, skip, sorted, sorted, toArray, toArray, toArray, toImmutableList, toImmutableList, toImmutableMap, toImmutableMap, toImmutableSet, toImmutableSet, toLinkedHashMap, toLinkedHashMap, toLinkedHashSet, toLinkedHashSet, toLinkedList, toLinkedList, toList, toList, toMap, toMap, toMap, toMap, toSet, toSet

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • InstructionCollection

      public InstructionCollection(Instruction parent)
      Create a new InstructionCollection.
      Parameters:
      parent - The parent owning instruction.
  • Method Details

    • addFirst

      public void addFirst(T value)
      Adds an instruction to the start of this collection.
      Parameters:
      value - The value.
    • add

      public void add(T value)
      Add an Instruction to the end of this collection.
      Parameters:
      value - The Instruction.
    • addAllFirst

      public void addAllFirst(Iterable<? extends T> values)
    • addAll

      public void addAll(Iterable<? extends T> values)
      Adds multiple Instructions to the end of this collection.
      Parameters:
      values - The Instructions.
    • secondToLastOrDefault

      @Nullable public T secondToLastOrDefault()
      Returns the second to last Instruction in this collection or null.
      Returns:
      The Instruction.
    • size

      public int size()
      Get the number of elements stored in this collection.
      Returns:
      The size.
    • clear

      public void clear()
      Removes all elements from this collection.
    • add

      protected void add(T value, InstructionCollection<T>.CollectionSlot newSlot)
    • getValueOrNull

      public T getValueOrNull()
      Description copied from class: InstructionSlot
      Return the value stored inside the slot.
      Overrides:
      getValueOrNull in class InstructionSlot<T extends Instruction>
      Returns:
      The value, otherwise null
    • checkInvariant

      protected void checkInvariant()
      Overrides:
      checkInvariant in class InstructionSlot<T extends Instruction>
    • set

      public void set(Instruction value)
      Description copied from class: InstructionSlot
      Set the value in this slot.
      Overrides:
      set in class InstructionSlot<T extends Instruction>
      Parameters:
      value - The value.
    • count

      public int count()
      Specified by:
      count in interface net.covers1624.quack.collection.FastStream<T extends Instruction>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface net.covers1624.quack.collection.FastStream<T extends Instruction>
    • iterator

      @NotNull public @NotNull Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends Instruction>