Package civitas.celestis.util.tuple
Class Long4
java.lang.Object
civitas.celestis.util.tuple.Long4
- All Implemented Interfaces:
BaseTuple<Long>,LongTuple,Serializable
An immutable type containing four primitive
longs.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong[]array()Returns an array containing the components of this tuple in their proper order.boxed()Returns a tuple containing the components of this tuple in their boxed form.booleancontains(long v) Checks if this tuple contains the provided valuev.booleancontainsAll(Iterable<Long> i) Checks if this tuple contains multiple values.booleanChecks for equality between this tuple and the provided objectobj.longget(int i) Returns theith component of this tuple.inthashCode()Returns the hash code of this instance.booleanisZero()Returns whether this tuple represents zero.list()Returns an unmodifiable list containing the components of this tuple in their proper order.Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf.<F> Tuple<F>mapToObj(LongFunction<? extends F> f) Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf.intsize()Returns the size of this tuple.stream()Returns a stream whose source is the elements of this tuple.toString()Serializes this tuple into a string.longw()Returns the W component of this tuple.longx()Returns the X component of this tuple.longy()Returns the Y component of this tuple.longz()Returns the Z component of this tuple.
-
Field Details
-
w
protected final long wThe W component of this tuple. -
x
protected final long xThe X component of this tuple. -
y
protected final long yThe Y component of this tuple. -
z
protected final long zThe Z component of this tuple.
-
-
Constructor Details
-
Long4
public Long4(long w, long x, long y, long z) Creates a newLong4.- Parameters:
w- The W component of this tuplex- The X component of this tupley- The Y component of this tuplez- The Z component of this tuple
-
Long4
public Long4(@Nonnull long[] components) Creates a newLong4.- Parameters:
components- An array containing the components of this tuple in XYZ order- Throws:
IllegalArgumentException- When the provided array's length is not4
-
Long4
Creates a newLong4.- Parameters:
t- The tuple of which to copy component values from- Throws:
IllegalArgumentException- When the provided tuplet's size is not4
-
-
Method Details
-
size
public int size()Returns the size of this tuple. (the number of components it has) -
isZero
public boolean isZero()Returns whether this tuple represents zero. (whether every component is zero) -
contains
public boolean contains(long v) Checks if this tuple contains the provided valuev. -
containsAll
Checks if this tuple contains multiple values.- Specified by:
containsAllin interfaceLongTuple- Parameters:
i- The iterable object of which to check for containment- Returns:
trueif this tuple contains every component of the iterable object
-
get
Returns theith component of this tuple.- Specified by:
getin interfaceLongTuple- Parameters:
i- The index of the component to get- Returns:
- The
ith component of this tuple - Throws:
IndexOutOfBoundsException- When the indexiis out of bounds
-
w
public long w()Returns the W component of this tuple.- Returns:
- The W component of this tuple
-
x
public long x()Returns the X component of this tuple.- Returns:
- The X component of this tuple
-
y
public long y()Returns the Y component of this tuple.- Returns:
- The Y component of this tuple
-
z
public long z()Returns the Z component of this tuple.- Returns:
- The Z component of this tuple
-
map
Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf. -
mapToObj
Applies the provided mapper functionfto each component of this tuple, then returns a new tuple containing the return values of the functionf. -
array
@Nonnull public long[] array()Returns an array containing the components of this tuple in their proper order. -
stream
Returns a stream whose source is the elements of this tuple. -
list
Returns an unmodifiable list containing the components of this tuple in their proper order. -
boxed
Returns a tuple containing the components of this tuple in their boxed form. -
equals
Checks for equality between this tuple and the provided objectobj. -
toString
Serializes this tuple into a string. -
hashCode
public int hashCode()Returns the hash code of this instance.
-