Package de.linusdev.lutils.math.vector
Class Vector.View<V extends Vector>
java.lang.Object
de.linusdev.lutils.math.vector.Vector.View<V>
- All Implemented Interfaces:
Vector
- Direct Known Subclasses:
FloatN.View
- Enclosing interface:
Vector
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.linusdev.lutils.math.vector.Vector
Vector.View<V extends Vector> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Vector.View<V>Used to avoid unsafe casting.@NotNull ObjectThe factor for each component.int @NotNull []The returned mapping must always map to a non view vector.abstract booleanbooleanWhether this vector is array backed.booleanWhether this vector is buffer backed.static booleanisMappingSpecial(int @NotNull [] defaultMapping, @NotNull Vector viewToCheck) static booleanisMappingSpecial(@NotNull Vector view) Checks if themappingof given view is special.
A non-special mapping is the following: mapping[0]=0, mapping[1]=1, ...
or generally speaking: mapping[i]=i.
Everything else is a special mapping.booleanisView()Whether this vector is only a view onto another vector.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.linusdev.lutils.math.vector.Vector
getMemberCount, getStructure
-
Field Details
-
original
-
mapping
protected final int @NotNull [] mapping
-
-
Constructor Details
-
View
-
-
Method Details
-
isMappingSpecial
Checks if themappingof given view is special.
A non-special mapping is the following: mapping[0]=0, mapping[1]=1, ...
or generally speaking: mapping[i]=i.
Everything else is a special mapping. -
isMappingSpecial
public static boolean isMappingSpecial(int @NotNull [] defaultMapping, @NotNull @NotNull Vector viewToCheck) Checks if themappingof givenviewToCheckis special compared to the givendefaultMapping. A non-special mapping is the following: mapping[0]=defaultMapping[0], mapping[1]=defaultMapping[1], ...
or generally speaking: mapping[i]=defaultMapping[i].
Everything else is a special mapping. -
getOriginal
- Returns:
- the original vector this vector views to
-
getMapping
public int @NotNull [] getMapping()The returned mapping must always map to a non view vector.- Returns:
- the mapping to the original vector
- Throws:
UnsupportedOperationException- if this vector is nota view on another vector.
-
isArrayBacked
public boolean isArrayBacked()Description copied from interface:VectorWhether this vector is array backed.- Specified by:
isArrayBackedin interfaceVector- Returns:
trueif this vector is array backed.
-
isBufferBacked
public boolean isBufferBacked()Description copied from interface:VectorWhether this vector is buffer backed. If this method returnstrue,Vector.getStructure()will not throw anUnsupportedOperationException.- Specified by:
isBufferBackedin interfaceVector- Returns:
trueif this vector is buffer backed.
-
isView
public boolean isView()Description copied from interface:VectorWhether this vector is only a view onto another vector. -
hasFactor
public abstract boolean hasFactor()- Returns:
trueif this view has a factor when getting/setting values.
-
getFactor
The factor for each component. The factor[i] is used for the i-component of this view vector, not on the original.
The returned array will always be of the same type as the vector (FloatN -> float[], ...).- Returns:
- factor array
-
getAsView
Description copied from interface:VectorUsed to avoid unsafe casting.- Specified by:
getAsViewin interfaceVector- Returns:
- the vector itself, but as
Vector.View.
-