Package adams.ml.capabilities
Class Capabilities
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.ml.capabilities.Capabilities
-
- All Implemented Interfaces:
LoggingSupporter,Mergeable<Capabilities>,SizeOfHandler,Serializable
public class Capabilities extends LoggingObject implements Mergeable<Capabilities>
Encapsulates the capabilities for an algorithm.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<Capability>m_Capabilitiesthe capabilities.protected Set<Capability>m_DependentCapabilitiesthe dependent capabilities.protected intm_MaxClassColumnsthe maximum number of class attributes (-1 is undefined).protected intm_MaxColumnsthe maximum number of columns (-1 is undefined).protected intm_MaxRowsthe maximum number of columns (-1 is undefined).protected intm_MinClassColumnsthe minimum number of class attributes (-1 is undefined).protected intm_MinColumnsthe minimum number of columns (-1 is undefined).protected intm_MinRowsthe minimum number of columns (-1 is undefined).protected CapabilitiesHandlerm_Ownerthe owner.-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Capabilities()Initializes the capabilities with no owner.Capabilities(CapabilitiesHandler owner)Initializes the capabilities.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(Capabilities other)Uses the capabilities from the provided capabilities object.Set<Capability>capabilities()Returns the capabilities.Capabilitiesclone()Creates a clone of itself.Set<Capability>dependentCapabilities()Returns the dependent capabilities.voiddisable(Capability cap)Disables the capability.voiddisableAll()Disables all capabilities.voiddisableAll(Collection<Capability> caps)Disables all capabilities.voiddisableAllClass()Disables all class capabilities.voiddisableAllDependent()Disables all the dependent capabilities.voiddisableAllDependent(Collection<Capability> caps)Disables the dependent capabilities.voiddisableDependent(Capability cap)Disables the dependent capability.voidenable(Capability cap)Enables the capability.voidenableAll()Enables all capabilities.voidenableAll(Collection<Capability> caps)Enables all capabilities.voidenableAllClass()Enables all class capabilities.voidenableAllDependent()Enables the dependent capabilities for all currently set capabilities.voidenableAllDependent(Collection<Capability> caps)Enables the dependent capabilities.voidenableDependent(Capability cap)Enables the dependent capability.intgetMaxClassColumns()Returns the maximum number of required class columns.intgetMaxColumns()Returns the maximum number of required columns.intgetMaxRows()Returns the maximum number of required columns.intgetMinClassColumns()Returns the minimum number of required class columns.intgetMinColumns()Returns the minimum number of required columns.intgetMinRows()Returns the minimum number of required columns.CapabilitiesHandlergetOwner()Returns the owner of these capabilities.booleanisDependentEnabled(Capability cap)Returns whether the specified dependent capability is enabled, i.e., supported.booleanisEnabled(Capability cap)Returns whether the specified capability is enabled, i.e., supported.voidmergeWith(Capabilities other)Merges with the capabilities from the provided capabilities object.protected voidreset()Resets the capabilities.voidsetMaxClassColumns(int value)Sets the maximum number of required class columns.voidsetMaxColumns(int value)Sets the maximum number of required columns.voidsetMaxRows(int value)Sets the maximum number of required columns.voidsetMinClassColumns(int value)Sets the minimum number of required class columns.voidsetMinColumns(int value)Sets the minimum number of required columns.voidsetMinRows(int value)Sets the minimum number of required columns.voidsetOwner(CapabilitiesHandler value)Sets the owner of these capabilities.StringtoString()Returns a short description of itself.protected intwiden(int current, int proposed, boolean up)Widens the min/max values.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Owner
protected CapabilitiesHandler m_Owner
the owner.
-
m_Capabilities
protected Set<Capability> m_Capabilities
the capabilities.
-
m_DependentCapabilities
protected Set<Capability> m_DependentCapabilities
the dependent capabilities.
-
m_MinRows
protected int m_MinRows
the minimum number of columns (-1 is undefined).
-
m_MaxRows
protected int m_MaxRows
the maximum number of columns (-1 is undefined).
-
m_MinColumns
protected int m_MinColumns
the minimum number of columns (-1 is undefined).
-
m_MaxColumns
protected int m_MaxColumns
the maximum number of columns (-1 is undefined).
-
m_MinClassColumns
protected int m_MinClassColumns
the minimum number of class attributes (-1 is undefined).
-
m_MaxClassColumns
protected int m_MaxClassColumns
the maximum number of class attributes (-1 is undefined).
-
-
Constructor Detail
-
Capabilities
public Capabilities()
Initializes the capabilities with no owner.
-
Capabilities
public Capabilities(CapabilitiesHandler owner)
Initializes the capabilities.- Parameters:
owner- the owner
-
-
Method Detail
-
reset
protected void reset()
Resets the capabilities.
-
setOwner
public void setOwner(CapabilitiesHandler value)
Sets the owner of these capabilities.- Parameters:
value- the owner
-
getOwner
public CapabilitiesHandler getOwner()
Returns the owner of these capabilities.- Returns:
- the owner
-
clone
public Capabilities clone()
Creates a clone of itself.
-
assign
public void assign(Capabilities other)
Uses the capabilities from the provided capabilities object.- Parameters:
other- the capabilities to use instead
-
widen
protected int widen(int current, int proposed, boolean up)Widens the min/max values.- Parameters:
current- the current valueproposed- the proposed valueup- whether a maximum (= true) or minimum (= false)- Returns:
- the new value
-
mergeWith
public void mergeWith(Capabilities other)
Merges with the capabilities from the provided capabilities object. Min/Max properties get widened, if necessary, to accommodate both capabilities. Capabilities and dependent ones simply get added.- Specified by:
mergeWithin interfaceMergeable<Capabilities>- Parameters:
other- the capabilities to merge with
-
capabilities
public Set<Capability> capabilities()
Returns the capabilities.- Returns:
- the capabilities
-
dependentCapabilities
public Set<Capability> dependentCapabilities()
Returns the dependent capabilities.- Returns:
- the capabilities
-
enable
public void enable(Capability cap)
Enables the capability.- Parameters:
cap- the capability to enable
-
disable
public void disable(Capability cap)
Disables the capability.- Parameters:
cap- the capability to disable
-
enableAll
public void enableAll(Collection<Capability> caps)
Enables all capabilities.- Parameters:
caps- the capabilities to enable
-
disableAll
public void disableAll(Collection<Capability> caps)
Disables all capabilities.- Parameters:
caps- the capabilities to disable
-
enableAll
public void enableAll()
Enables all capabilities.
-
disableAll
public void disableAll()
Disables all capabilities.
-
enableAllClass
public void enableAllClass()
Enables all class capabilities.
-
disableAllClass
public void disableAllClass()
Disables all class capabilities.
-
isEnabled
public boolean isEnabled(Capability cap)
Returns whether the specified capability is enabled, i.e., supported.- Parameters:
cap- the capability to check- Returns:
- true if enabled
-
enableDependent
public void enableDependent(Capability cap)
Enables the dependent capability.- Parameters:
cap- the capability to enable
-
disableDependent
public void disableDependent(Capability cap)
Disables the dependent capability.- Parameters:
cap- the capability to disable
-
enableAllDependent
public void enableAllDependent(Collection<Capability> caps)
Enables the dependent capabilities.- Parameters:
caps- the capabilities to enable
-
disableAllDependent
public void disableAllDependent(Collection<Capability> caps)
Disables the dependent capabilities.- Parameters:
caps- the capabilities to disable
-
enableAllDependent
public void enableAllDependent()
Enables the dependent capabilities for all currently set capabilities.
-
disableAllDependent
public void disableAllDependent()
Disables all the dependent capabilities.
-
isDependentEnabled
public boolean isDependentEnabled(Capability cap)
Returns whether the specified dependent capability is enabled, i.e., supported.- Parameters:
cap- the capability to check- Returns:
- true if enabled
-
setMinRows
public void setMinRows(int value)
Sets the minimum number of required columns.- Parameters:
value- the minimum, -1 for undefined
-
getMinRows
public int getMinRows()
Returns the minimum number of required columns.- Returns:
- the minimum, -1 if undefined
-
setMaxRows
public void setMaxRows(int value)
Sets the maximum number of required columns.- Parameters:
value- the maximum, -1 for undefined
-
getMaxRows
public int getMaxRows()
Returns the maximum number of required columns.- Returns:
- the maximum, -1 if undefined
-
setMinColumns
public void setMinColumns(int value)
Sets the minimum number of required columns.- Parameters:
value- the minimum, -1 for undefined
-
getMinColumns
public int getMinColumns()
Returns the minimum number of required columns.- Returns:
- the minimum, -1 if undefined
-
setMaxColumns
public void setMaxColumns(int value)
Sets the maximum number of required columns.- Parameters:
value- the maximum, -1 for undefined
-
getMaxColumns
public int getMaxColumns()
Returns the maximum number of required columns.- Returns:
- the maximum, -1 if undefined
-
setMinClassColumns
public void setMinClassColumns(int value)
Sets the minimum number of required class columns.- Parameters:
value- the minimum, -1 for undefined
-
getMinClassColumns
public int getMinClassColumns()
Returns the minimum number of required class columns.- Returns:
- the minimum, -1 if undefined
-
setMaxClassColumns
public void setMaxClassColumns(int value)
Sets the maximum number of required class columns.- Parameters:
value- the maximum, -1 for undefined
-
getMaxClassColumns
public int getMaxClassColumns()
Returns the maximum number of required class columns.- Returns:
- the maximum, -1 if undefined
-
-