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_Capabilities
the capabilities.protected Set<Capability>
m_DependentCapabilities
the dependent capabilities.protected int
m_MaxClassColumns
the maximum number of class attributes (-1 is undefined).protected int
m_MaxColumns
the maximum number of columns (-1 is undefined).protected int
m_MaxRows
the maximum number of columns (-1 is undefined).protected int
m_MinClassColumns
the minimum number of class attributes (-1 is undefined).protected int
m_MinColumns
the minimum number of columns (-1 is undefined).protected int
m_MinRows
the minimum number of columns (-1 is undefined).protected CapabilitiesHandler
m_Owner
the 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 void
assign(Capabilities other)
Uses the capabilities from the provided capabilities object.Set<Capability>
capabilities()
Returns the capabilities.Capabilities
clone()
Creates a clone of itself.Set<Capability>
dependentCapabilities()
Returns the dependent capabilities.void
disable(Capability cap)
Disables the capability.void
disableAll()
Disables all capabilities.void
disableAll(Collection<Capability> caps)
Disables all capabilities.void
disableAllClass()
Disables all class capabilities.void
disableAllDependent()
Disables all the dependent capabilities.void
disableAllDependent(Collection<Capability> caps)
Disables the dependent capabilities.void
disableDependent(Capability cap)
Disables the dependent capability.void
enable(Capability cap)
Enables the capability.void
enableAll()
Enables all capabilities.void
enableAll(Collection<Capability> caps)
Enables all capabilities.void
enableAllClass()
Enables all class capabilities.void
enableAllDependent()
Enables the dependent capabilities for all currently set capabilities.void
enableAllDependent(Collection<Capability> caps)
Enables the dependent capabilities.void
enableDependent(Capability cap)
Enables the dependent capability.int
getMaxClassColumns()
Returns the maximum number of required class columns.int
getMaxColumns()
Returns the maximum number of required columns.int
getMaxRows()
Returns the maximum number of required columns.int
getMinClassColumns()
Returns the minimum number of required class columns.int
getMinColumns()
Returns the minimum number of required columns.int
getMinRows()
Returns the minimum number of required columns.CapabilitiesHandler
getOwner()
Returns the owner of these capabilities.boolean
isDependentEnabled(Capability cap)
Returns whether the specified dependent capability is enabled, i.e., supported.boolean
isEnabled(Capability cap)
Returns whether the specified capability is enabled, i.e., supported.void
mergeWith(Capabilities other)
Merges with the capabilities from the provided capabilities object.protected void
reset()
Resets the capabilities.void
setMaxClassColumns(int value)
Sets the maximum number of required class columns.void
setMaxColumns(int value)
Sets the maximum number of required columns.void
setMaxRows(int value)
Sets the maximum number of required columns.void
setMinClassColumns(int value)
Sets the minimum number of required class columns.void
setMinColumns(int value)
Sets the minimum number of required columns.void
setMinRows(int value)
Sets the minimum number of required columns.void
setOwner(CapabilitiesHandler value)
Sets the owner of these capabilities.String
toString()
Returns a short description of itself.protected int
widen(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:
mergeWith
in 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
-
-