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 ClassesNested 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
ConstructorsConstructorDescriptionInstructionCollection(Instruction parent) Create a newInstructionCollection. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd anInstructionto the end of this collection.protected voidadd(T value, InstructionCollection<T>.CollectionSlot newSlot) voidAdds multipleInstructions to the end of this collection.voidaddAllFirst(Iterable<? extends T> values) voidAdds an instruction to the start of this collection.protected voidvoidclear()Removes all elements from this collection.intcount()Return the value stored inside the slot.booleanisEmpty()iterator()Returns the second to lastInstructionin this collection ornull.voidset(Instruction value) Set the value in this slot.intsize()Get the number of elements stored in this collection.Methods inherited from class net.covers1624.coffeegrinder.bytecode.InstructionSlot
getMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, toSetMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
InstructionCollection
Create a newInstructionCollection.- Parameters:
parent- The parent owning instruction.
-
-
Method Details
-
addFirst
Adds an instruction to the start of this collection.- Parameters:
value- The value.
-
add
Add anInstructionto the end of this collection.- Parameters:
value- TheInstruction.
-
addAllFirst
-
addAll
Adds multipleInstructions to the end of this collection.- Parameters:
values- TheInstructions.
-
secondToLastOrDefault
Returns the second to lastInstructionin this collection ornull.- 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
-
getValueOrNull
Description copied from class:InstructionSlotReturn the value stored inside the slot.- Overrides:
getValueOrNullin classInstructionSlot<T extends Instruction>- Returns:
- The value, otherwise
null
-
checkInvariant
protected void checkInvariant()- Overrides:
checkInvariantin classInstructionSlot<T extends Instruction>
-
set
Description copied from class:InstructionSlotSet the value in this slot.- Overrides:
setin classInstructionSlot<T extends Instruction>- Parameters:
value- The value.
-
count
public int count()- Specified by:
countin interfacenet.covers1624.quack.collection.FastStream<T extends Instruction>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfacenet.covers1624.quack.collection.FastStream<T extends Instruction>
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends Instruction>
-