Class Covariant<C>
- java.lang.Object
-
- org.tensorics.core.tensor.variance.Covariant<C>
-
- Type Parameters:
C
- the type of the (contravariant!) coordinate
public class Covariant<C> extends java.lang.Object
Coordinates inheriting from this class mark are treated as covariant axis. The type of 'variance' is defined, as in tensor-algebra, by transformation of the values of the tensor when transforming the basis of the values.'Physical' vectors/quantities usually transform in such a way, that they transform inverse to the basis. For example, lets assume a vector of 3 values, representing karthesian coordinates in a certain base. If now the basis vectors would be multiplied by a factor, the values of the vector would have to be divided by the same factor. This transformation property is called 'contravariance'.
If the vectors would transform in the same way as the basis, we would say the vector (tensor in that direction) transforms 'covariant'. This is for example the case for tensors that represent transformations themselves.
Within the tensorics framework, because of the forementioned reasons, the contravariant case is considered as the default. Simply any object can be put as contravariant coordinate. On the other hand, covariant axes have to be marked explicitely, by inheriting from this class.
All sub classes are obliged to provide a public constructor with a single argument, taking the coordinate itself as an argument. This inheritance structure is necessary, to be able to have several covariant coordinates in one tensor (because tensorics treats coordinates of the same class as the same coordinate-dimension).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
C
get()
Retrieves the coordinate value from the covariant coordinate.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Covariant
protected Covariant(C coordinate)
The single-argument constructor that has to be overriden by subclasses. It takes the coordinate itself.- Parameters:
coordinate
- the coordinate, which will be treated as a covariant axis- Throws:
java.lang.NullPointerException
- if the given coordinate is null
-
-
Method Detail
-
get
public C get()
Retrieves the coordinate value from the covariant coordinate.- Returns:
- the coordinate value
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-