-
- All Known Implementing Classes:
AudioCodeDelegate,CoreCodeDelegate,CoreContainerDelegate,DefaultCodeDelegate,P2DCodeDelegate,P3DCodeDelegate,TFCodeDelegate,VideoCodeDelegate
public interface DefaultDelegateAPIDefault delegate API for use as trait by delegate subclasses.
-
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default doubleabs(double n)Calculate the absolute value of the given value.default doubleacos(double value)Returns the arc cosine of a value.default PArrayarray(String s)Parse the given String into aPArray.default PArrayarray(Property p)Attempt to extract aPArrayfrom the given Property.default PArrayarray(Value v)Convert the given Value into aPArray.default doubleasin(double value)Returns the arc sine of a value.default doubleatan(double value)Returns the arc tangent of a value.default doubleatan2(double y, double x)Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).default booleanb(String s)Deprecated.default booleanb(Property p)Deprecated.default booleanb(Value v)Deprecated.default booleanB(Object value)Casting function to convert an object into a boolean value.default doubleconstrain(double amt, double low, double high)Constrain a value between the range of the given low and high values.default intconstrain(int amt, int low, int high)Constrain a value between the range of the given low and high values.default doublecos(double angle)Returns the trigonometric cosine of an angle.default doubled(String s)Deprecated.default doubled(Property p)Deprecated.default doubled(Value v)Deprecated.default doubleD(Object value)Casting function to convert an object into a double value.default doubleD(Object value, double def)Casting function to convert an object into a double value.default doubledegrees(double radians)Converts an angle in radians to an angle in degrees.default doubledist(double x1, double y1, double x2, double y2)Calculates the distance between two points.default doubledist(double x1, double y1, double z1, double x2, double y2, double z2)Calculates the distance between two points.default doubleexp(double a)Calculate Euler's number raised to the power of the given value.default inti(String s)Deprecated.default inti(Property p)Deprecated.default inti(Value v)Deprecated.default intI(Object value)Casting function to convert an object into an int value.default intI(Object value, int def)Casting function to convert an object into an int value.default doublelerp(double start, double stop, double amt)Calculates a number between two numbers at a specific increment.default doublelog(double a)Calculate the natural logarithm if the given value.default doublemap(double value, double start1, double stop1, double start2, double stop2)Re-map (scale) an input value from one range to another.default doublemax(double... values)Calculate the maximum value in the provided array.default doublemax(double a, double b)Calculate the maximum of two values.default doublemax(double a, double b, double c)Calculate the maximum of three values.default intmax(int... values)Calculate the maximum value in the provided array.default intmax(int a, int b)Calculate the maximum of two values.default intmax(int a, int b, int c)Calculate the maximum of three values.default doublemin(double... values)Calculate the minimum value in the provided array.default doublemin(double a, double b)Calculate the minimum of two values.default doublemin(double a, double b, double c)Calculate the minimum of three values.default intmin(int... values)Calculate the minimum value in the provided array.default intmin(int a, int b)Calculate the minimum of two values.default intmin(int a, int b, int c)Calculate the minimum of three values.default doublenorm(double value, double start, double stop)Normalizes a number from another range into a value between 0 and 1.default doublepow(double a, double b)Calculate the value of the first argument raised to the power of the second argument.default doubleradians(double degrees)Converts an angle in degrees to an angle in radians.default doublerandom(double max)Return a random number between zero and max (exclusive)default doublerandom(double min, double max)Return a random number between min (inclusive) and max (exclusive)default doublerandomOf(double... values)Return a random element from an array of values.default intrandomOf(int... values)Return a random element from an array of values.default StringrandomOf(String... values)Return a random element from an array of values.default intround(double amt)Round a value to the nearest integer.default Strings(Property p)Deprecated.default Strings(Value v)Deprecated.default StringS(Object value)Casting function to convert an object into a String value.default doublesin(double angle)Returns the trigonometric sine of an angledefault doublesq(double a)Calculate the square of the given value.default doublesqrt(double a)Calculate the square root of the given value.default doubletan(double angle)Returns the trigonometric tangent of an angle.default ValueV(Object value)Casting function to convert an object into an appropriate Value subtype.
-
-
-
Method Detail
-
D
default double D(Object value)
Casting function to convert an object into a double value. If the value is aPNumberthe value will be extracted directly. If the value is aPropertythe value will be extracted usingProperty.getDouble(). All other types will be converted into a Value (if necessary) and an attempt made to coerce into a PNumber. Otherwise zero is returned.- Parameters:
value- object value to convert- Returns:
- value as double or zero
-
D
default double D(Object value, double def)
Casting function to convert an object into a double value. If the value is aPNumberthe value will be extracted directly. If the value is aPropertythe value will be extracted usingProperty.getDouble(double). All other types will be converted into a Value (if necessary) and an attempt made to coerce into a PNumber. Otherwise the provided default is returned.- Parameters:
value- object value to convertdef- default value- Returns:
- value as double or default value
-
I
default int I(Object value)
Casting function to convert an object into an int value. If the value is aPNumberthe value will be extracted directly. If the value is aPropertythe value will be extracted usingProperty.getInt(). All other types will be converted into a Value (if necessary) and an attempt made to coerce into a PNumber. Otherwise zero is returned.- Parameters:
value- object value to convert- Returns:
- value as int or zero
-
I
default int I(Object value, int def)
Casting function to convert an object into an int value. If the value is aPNumberthe value will be extracted directly. If the value is aPropertythe value will be extracted usingProperty.getInt(int). All other types will be converted into a Value (if necessary) and an attempt made to coerce into a PNumber. Otherwise the provided default is returned.- Parameters:
value- object value to convertdef- default value- Returns:
- value as int or default value
-
B
default boolean B(Object value)
Casting function to convert an object into a boolean value. If the value is aPBooleanthe value will be extracted directly. If the value is aPropertythe value will be extracted usingProperty.getBoolean(). All other types will be converted into a Value (if necessary) and an attempt made to coerce into a PBoolean. Otherwise false is returned.- Parameters:
value- object value to convert- Returns:
- value as boolean or false
-
S
default String S(Object value)
Casting function to convert an object into a String value. If the value is aPropertythe value is extracted and converted to a String. Otherwise the value is converted to a String directly, which covers Value and non-Value types. Null values are returned as an empty String.- Parameters:
value- object value to convert- Returns:
- value as String
-
V
default Value V(Object value)
Casting function to convert an object into an appropriate Value subtype. If the input is already a Value it is returned directly. If the input is aPropertythe value is extracted usingProperty.get(). Otherwise the input is converted usingValue.ofObject(java.lang.Object).- Parameters:
value- object value to convert- Returns:
- value as Value subtype
-
d
@Deprecated default double d(Property p)
Deprecated.Extract a double from the Property's current Value, or zero if the value cannot be coerced.- Parameters:
p-- Returns:
-
d
@Deprecated default double d(Value v)
Deprecated.Convert the provided Value into a double, or zero if the Value cannot be coerced.- Parameters:
v-- Returns:
-
d
@Deprecated default double d(String s)
Deprecated.Parse the provided String into a double, or zero if invalid.- Parameters:
s-- Returns:
-
i
@Deprecated default int i(Property p)
Deprecated.Extract an int from the Property's current Value, or zero if the value cannot be coerced.- Parameters:
p-- Returns:
-
i
@Deprecated default int i(Value v)
Deprecated.Convert the provided Value into an int, or zero if the Value cannot be coerced.- Parameters:
v-- Returns:
-
i
@Deprecated default int i(String s)
Deprecated.Parse the provided String into an int, or zero if invalid.- Parameters:
s-- Returns:
-
b
@Deprecated default boolean b(Property p)
Deprecated.Extract the Property's current value as a boolean. If the value cannot be coerced, returns false.- Parameters:
p-- Returns:
-
b
@Deprecated default boolean b(Value v)
Deprecated.Convert the provided Value into a boolean according to the parsing rules ofPBoolean. If the Value cannot be coerced, returns false.- Parameters:
v-- Returns:
-
b
@Deprecated default boolean b(String s)
Deprecated.Parse the given String into a boolean according to the parsing rules ofPBoolean. If the String is invalid, returns false.- Parameters:
s-- Returns:
-
s
@Deprecated default String s(Property p)
Deprecated.Extract the Property's current value into a String representation.- Parameters:
p-- Returns:
-
s
@Deprecated default String s(Value v)
Deprecated.Convert the provided Value into a String representation.- Parameters:
v-- Returns:
-
array
default PArray array(Property p)
Attempt to extract aPArrayfrom the given Property. An empty PArray will be returned if the property's value is not a PArray and cannot be coerced.- Parameters:
p-- Returns:
- See Also:
array(org.praxislive.core.types.Value)
-
array
default PArray array(Value v)
Convert the given Value into aPArray. If the Value is already a PArray it will be returned, otherwise an attempt will be made to coerce it. If the Value cannot be converted, an empty PArray will be returned.- Parameters:
s-- Returns:
-
array
default PArray array(String s)
Parse the given String into aPArray. If the String is not a valid representation of an array, returns an empty PArray.- Parameters:
s-- Returns:
-
random
default double random(double max)
Return a random number between zero and max (exclusive)- Parameters:
max- the upper bound of the range- Returns:
-
random
default double random(double min, double max)Return a random number between min (inclusive) and max (exclusive)- Parameters:
min- the lower bound of the rangemax- the upper bound of the range- Returns:
-
randomOf
default double randomOf(double... values)
Return a random element from an array of values.- Parameters:
values- list of values, may not be empty- Returns:
- random element
-
randomOf
default int randomOf(int... values)
Return a random element from an array of values.- Parameters:
values- list of values, may not be empty- Returns:
- random element
-
randomOf
default String randomOf(String... values)
Return a random element from an array of values.- Parameters:
values- list of values, may not be empty- Returns:
- random element
-
abs
default double abs(double n)
Calculate the absolute value of the given value. If the value is positive, the value is returned. If the value is negative, the negation of the value is returned.- Parameters:
n-- Returns:
-
sq
default double sq(double a)
Calculate the square of the given value.- Parameters:
a-- Returns:
-
sqrt
default double sqrt(double a)
Calculate the square root of the given value.- Parameters:
a-- Returns:
- See Also:
Math.sqrt(double)
-
log
default double log(double a)
Calculate the natural logarithm if the given value.- Parameters:
a-- Returns:
- See Also:
Math.log(double)
-
exp
default double exp(double a)
Calculate Euler's number raised to the power of the given value.- Parameters:
a-- Returns:
- See Also:
Math.exp(double)
-
pow
default double pow(double a, double b)Calculate the value of the first argument raised to the power of the second argument.- Parameters:
a- the baseb- the exponent- Returns:
- the value ab
- See Also:
Math.pow(double, double)
-
max
default int max(int a, int b)Calculate the maximum of two values.- Parameters:
a-b-- Returns:
-
max
default int max(int a, int b, int c)Calculate the maximum of three values.- Parameters:
a-b-c-- Returns:
-
max
default int max(int... values)
Calculate the maximum value in the provided array.- Parameters:
values- value list - must not be empty- Returns:
- maximum value
-
max
default double max(double a, double b)Calculate the maximum of two values.- Parameters:
a-b-- Returns:
-
max
default double max(double a, double b, double c)Calculate the maximum of three values.- Parameters:
a-b-c-- Returns:
-
max
default double max(double... values)
Calculate the maximum value in the provided array.- Parameters:
values- value list - must not be empty- Returns:
- maximum value
-
min
default int min(int a, int b)Calculate the minimum of two values.- Parameters:
a-b-- Returns:
-
min
default int min(int a, int b, int c)Calculate the minimum of three values.- Parameters:
a-b-c-- Returns:
-
min
default int min(int... values)
Calculate the minimum value in the provided array.- Parameters:
values- value list - must not be empty- Returns:
- minimum value
-
min
default double min(double a, double b)Calculate the minimum of two values.- Parameters:
a-b-- Returns:
-
min
default double min(double a, double b, double c)Calculate the minimum of three values.- Parameters:
a-b-c-- Returns:
-
min
default double min(double... values)
Calculate the minimum value in the provided array.- Parameters:
values- value list - must not be empty- Returns:
- minimum value
-
constrain
default int constrain(int amt, int low, int high)Constrain a value between the range of the given low and high values.- Parameters:
amt- input valuelow- lowest allowed valuehigh- highest allowed value- Returns:
- constrained value
-
constrain
default double constrain(double amt, double low, double high)Constrain a value between the range of the given low and high values.- Parameters:
amt- input valuelow- lowest allowed valuehigh- highest allowed value- Returns:
- constrained value
-
round
default int round(double amt)
Round a value to the nearest integer.- Parameters:
amt- input value- Returns:
- rounded value
-
degrees
default double degrees(double radians)
Converts an angle in radians to an angle in degrees.- Parameters:
radians-- Returns:
- See Also:
Math.toDegrees(double)
-
radians
default double radians(double degrees)
Converts an angle in degrees to an angle in radians.- Parameters:
degrees-- Returns:
- See Also:
Math.toRadians(double)
-
sin
default double sin(double angle)
Returns the trigonometric sine of an angle- Parameters:
angle-- Returns:
- See Also:
Math.sin(double)
-
cos
default double cos(double angle)
Returns the trigonometric cosine of an angle.- Parameters:
angle-- Returns:
- See Also:
Math.cos(double)
-
tan
default double tan(double angle)
Returns the trigonometric tangent of an angle.- Parameters:
angle-- Returns:
- See Also:
Math.tan(double)
-
asin
default double asin(double value)
Returns the arc sine of a value.- Parameters:
value-- Returns:
- See Also:
Math.asin(double)
-
acos
default double acos(double value)
Returns the arc cosine of a value.- Parameters:
value-- Returns:
- See Also:
Math.acos(double)
-
atan
default double atan(double value)
Returns the arc tangent of a value.- Parameters:
value-- Returns:
- See Also:
Math.atan(double)
-
atan2
default double atan2(double y, double x)Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).- Parameters:
y-x-- Returns:
- See Also:
Math.atan2(double, double)
-
map
default double map(double value, double start1, double stop1, double start2, double stop2)Re-map (scale) an input value from one range to another. Numbers outside the range are not clamped.- Parameters:
value- the value to be convertedstart1- lower bound of the value's current rangestop1- upper bound of the value's current rangestart2- lower bound of the value's target rangestop2- upper bound of the value's target range- Returns:
-
dist
default double dist(double x1, double y1, double x2, double y2)Calculates the distance between two points.- Parameters:
x1- x-coordinate of the first pointy1- y-coordinate of the first pointx2- x-coordinate of the second pointy2- y-coordinate of the second point- Returns:
-
dist
default double dist(double x1, double y1, double z1, double x2, double y2, double z2)Calculates the distance between two points.- Parameters:
x1- x-coordinate of the first pointy1- y-coordinate of the first pointz1- z-coordinate of the first pointx2- x-coordinate of the second pointy2- y-coordinate of the second pointz2- z-coordinate of the second point- Returns:
-
lerp
default double lerp(double start, double stop, double amt)Calculates a number between two numbers at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc. The lerp function is convenient for creating motion along a straight path and for drawing dotted lines.- Parameters:
start- first valuestop- second valueamt- between 0.0 and 1.0- Returns:
-
norm
default double norm(double value, double start, double stop)Normalizes a number from another range into a value between 0 and 1.Identical to map(value, low, high, 0, 1);
Numbers outside the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful.
- Parameters:
value- the incoming value to be convertedstart- lower bound of the value's current rangestop- upper bound of the value's current range- Returns:
-
-