Package adams.flow.core
Class Compatibility
- java.lang.Object
-
- adams.flow.core.Compatibility
-
- All Implemented Interfaces:
ClassCompatibilityChecker,Serializable
public class Compatibility extends Object implements Serializable, ClassCompatibilityChecker
Class that determines compatibility between inputs and outputs.
An input and output are compatible, if...- either output or input is Unknown.class
- input is Object.class
- output and input are the same class
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
Unknown, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_Strictwhether to use strict compatibility, ie, no special handling for Unknown/Object.
-
Constructor Summary
Constructors Constructor Description Compatibility()Initializes the checker with non-strict behavior.Compatibility(boolean strict)Initializes the checker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Class>getCompatibleClasses(OutputProducer output, InputConsumer input)Returns all the classes that the two actors have in common, in producing and consuming.Set<Class>getCompatibleClasses(Class[] first, Class[] second)Returns all the classes that the two arrays have in common.booleanisCompatible(OutputProducer output, InputConsumer input)Checks whether the two actors are compatible.booleanisCompatible(Class[] outCls, Class[] inCls)Checks whether the two class sets are compatible.booleanisCompatible(Class output, Class input)Checks whether the two classes are compatible.booleanisStrict()Returns whether strict or relaxed compatibility checks are used.voidsetStrict(boolean value)Sets whether to use strict or relaxed compatibility checks.StringtoString()Returns a short string representation of this object.
-
-
-
Constructor Detail
-
Compatibility
public Compatibility()
Initializes the checker with non-strict behavior.
-
Compatibility
public Compatibility(boolean strict)
Initializes the checker.- Parameters:
strict- whether to perform strict checks or not- See Also:
setStrict(boolean)
-
-
Method Detail
-
setStrict
public void setStrict(boolean value)
Sets whether to use strict or relaxed compatibility checks. "Strict" does not cater for Unknown/Object.- Parameters:
value- if true strict mode is enabled
-
isStrict
public boolean isStrict()
Returns whether strict or relaxed compatibility checks are used.- Returns:
- true if strict mode is enabled
-
isCompatible
public boolean isCompatible(Class output, Class input)
Checks whether the two classes are compatible.- Specified by:
isCompatiblein interfaceClassCompatibilityChecker- Parameters:
output- the generated output of the first actorinput- the accepted input of the second actor- Returns:
- true if compatible
-
isCompatible
public boolean isCompatible(Class[] outCls, Class[] inCls)
Checks whether the two class sets are compatible.- Specified by:
isCompatiblein interfaceClassCompatibilityChecker- Parameters:
outCls- the classes of the generating actorinCls- the classes of the accepting actor- Returns:
- true if compatible
-
isCompatible
public boolean isCompatible(OutputProducer output, InputConsumer input)
Checks whether the two actors are compatible.- Parameters:
output- the generating actorinput- the accepting actor- Returns:
- true if compatible
-
getCompatibleClasses
public Set<Class> getCompatibleClasses(OutputProducer output, InputConsumer input)
Returns all the classes that the two actors have in common, in producing and consuming.- Parameters:
output- the generating actorinput- the accepting actor- Returns:
- the classes that are in common
-
getCompatibleClasses
public Set<Class> getCompatibleClasses(Class[] first, Class[] second)
Returns all the classes that the two arrays have in common.- Parameters:
first- the first array of classessecond- the second array of classes- Returns:
- the classes that are in common
-
-