Package qupath.lib.lazy.interfaces
Interface LazyValue<S,T>
- Type Parameters:
S- type of the input object used to determine the valueT- type of the output value
- All Known Subinterfaces:
LazyBooleanValue<S>,LazyNumericValue<S>,LazyStringValue<S>
- All Known Implementing Classes:
MeasurementListValue
public interface LazyValue<S,T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant representing that the default number of decimal places should be used to convert floating point numbers to strings. -
Method Summary
Modifier and TypeMethodDescriptionstatic <S,T> LazyValue <S, T> Create aLazyValuewith specified name and help text.static <S> LazyBooleanValue<S> createBoolean(String name, String helpText, Function<S, Boolean> fun) Create aLazyBooleanValuewith specified name and help text.static <S> LazyNumericValue<S> createNumeric(String name, String helpText, Function<S, Number> fun) Create aLazyNumericValuewith specified name and help text.static <S> LazyStringValue<S> createString(String name, String helpText, Function<S, String> fun) Create aLazyStringValuewith specified name and help text.Optional help text that explained the value.Get the generic type of the measurement.getName()The name of the value.default StringgetStringValue(S input) Get a default string representation of an object measurement.default StringgetStringValue(S input, int decimalPlaces) Get a default string representation of an object measurement.Calculate a value from the input.default booleanCheck whether the value returned by this measurement is an instance ofBoolean.default booleanCheck whether the value returned by this measurement is an instance ofNumber.default booleanisString()Check whether the value returned by this measurement is an instance ofString.
-
Field Details
-
DEFAULT_DECIMAL_PLACES
static final int DEFAULT_DECIMAL_PLACESConstant representing that the default number of decimal places should be used to convert floating point numbers to strings.- See Also:
-
-
Method Details
-
create
static <S,T> LazyValue<S,T> create(String name, String helpText, Function<S, T> fun, Class<T> valueType) Create aLazyValuewith specified name and help text.- Type Parameters:
S- input typeT- value type- Parameters:
name- namehelpText- help text or descriptionfun- function to calculate the valuevalueType- return type of the function- Returns:
- a new lazy value
-
createNumeric
Create aLazyNumericValuewith specified name and help text.- Type Parameters:
S- input type- Parameters:
name- namehelpText- help text or descriptionfun- function to calculate the value- Returns:
- a new lazy value
-
createString
Create aLazyStringValuewith specified name and help text.- Type Parameters:
S- input type- Parameters:
name- namehelpText- help text or descriptionfun- function to calculate the value- Returns:
- a new lazy value
-
createBoolean
Create aLazyBooleanValuewith specified name and help text.- Type Parameters:
S- input type- Parameters:
name- namehelpText- help text or descriptionfun- function to calculate the value- Returns:
- a new lazy value
-
getName
String getName()The name of the value. When showing a measurement table, this would be the column header.- Returns:
- the name of the value
-
getMeasurementType
Get the generic type of the measurement.- Returns:
-
isNumeric
default boolean isNumeric()Check whether the value returned by this measurement is an instance ofNumber.- Returns:
-
isString
default boolean isString()Check whether the value returned by this measurement is an instance ofString.- Returns:
-
isBoolean
default boolean isBoolean()Check whether the value returned by this measurement is an instance ofBoolean.- Returns:
-
getValue
Calculate a value from the input.- Parameters:
input- the input that should be measured- Returns:
- the output value
-
getStringValue
Get a default string representation of an object measurement.- Parameters:
input- the object to measuredecimalPlaces- number of decimal places; if < 0 then this will be calculated automatically- Returns:
-
getStringValue
Get a default string representation of an object measurement. If the value is numeric, it is converted to a string using the default number of decimal places.- Parameters:
input- the object to measure- Returns:
- See Also:
-
getHelpText
String getHelpText()Optional help text that explained the value. This may be displayed in a tooltip.- Returns:
- the help text, or null if no help text is available
-