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
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
Unknown
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Strict
whether 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 HashSet<Class>
getCompatibleClasses(OutputProducer output, InputConsumer input)
Returns all the classes that the two actors have in common, in producing and consuming.boolean
isCompatible(OutputProducer output, InputConsumer input)
Checks whether the two actors are compatible.boolean
isCompatible(Class[] outCls, Class[] inCls)
Checks whether the two class sets are compatible.boolean
isCompatible(Class output, Class input)
Checks whether the two classes are compatible.boolean
isStrict()
Returns whether strict or relaxed compatibility checks are used.void
setStrict(boolean value)
Sets whether to use strict or relaxed compatibility checks.String
toString()
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:
isCompatible
in 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:
isCompatible
in 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 HashSet<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
-
-