Class Vec2
- java.lang.Object
-
- com.thingworx.types.primitives.structs.Vec2
-
- Direct Known Subclasses:
Vec3
@ThingworxExtensionApiClass(since={7,1}, canInstantiate=true) public class Vec2 extends java.lang.Object
BaseType used to represent a Vector of 2 decimal values modeled with x and y.
Default x value is 0.0.
Default y value is 0.0.
-
-
Constructor Summary
Constructors Constructor Description Vec2()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
compare(Vec2 v1, Vec2 v2)
int
compareTo(java.lang.Object value)
static Vec2
fromString(java.lang.String value)
Construct a Vec2 from the provided string value.double
getX()
Get the x value.double
getY()
Get the y value.boolean
isDefaultValue()
Check if this Vec2 instance is in its default state.void
setX(double value)
Set the x value.void
setY(double value)
Set the y value.java.lang.String
toString()
Construct a string representation of this Vec2 instance.
-
-
-
Field Detail
-
X
public static final java.lang.String X
- See Also:
- Constant Field Values
-
Y
public static final java.lang.String Y
- See Also:
- Constant Field Values
-
-
Method Detail
-
getX
@ThingworxExtensionApiMethod(since={7,1}) public double getX()
Get the x value.- Returns:
- The value of x
-
setX
@ThingworxExtensionApiMethod(since={7,1}) public void setX(double value)
Set the x value.- Parameters:
value
- - double value to be set for x
-
getY
@ThingworxExtensionApiMethod(since={7,1}) public double getY()
Get the y value.- Returns:
- The value of y
-
setY
@ThingworxExtensionApiMethod(since={7,1}) public void setY(double value)
Set the y value.- Parameters:
value
- - double value to be set for y
-
compareTo
@ThingworxExtensionApiMethod(since={7,1}) public int compareTo(java.lang.Object value)
-
compare
@ThingworxExtensionApiMethod(since={7,1}) protected int compare(Vec2 v1, Vec2 v2)
-
toString
@ThingworxExtensionApiMethod(since={7,1}) public java.lang.String toString()
Construct a string representation of this Vec2 instance.- Overrides:
toString
in classjava.lang.Object
-
isDefaultValue
@ThingworxExtensionApiMethod(since={7,1}) public boolean isDefaultValue()
Check if this Vec2 instance is in its default state.- Returns:
- true, when x equals 0.0 and y equals 0.0, false otherwise
-
fromString
@ThingworxExtensionApiMethod(since={7,1}) public static Vec2 fromString(java.lang.String value)
Construct a Vec2 from the provided string value.- Parameters:
value
- - String to split by ',' then taking the first result as value for x and the second result as value for y- Returns:
- A new Vec2 from the string value
-
-