Package adams.ml.capabilities
Class CapabilitiesHelper
- java.lang.Object
-
- adams.ml.capabilities.CapabilitiesHelper
-
public class CapabilitiesHelper extends Object
Helper class for capabilities.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description CapabilitiesHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Dataset
adjust(Dataset data, Capabilities caps)
Tries to adjust the dataset to the capabilities.static Dataset
adjust(Dataset data, CapabilitiesHandler handler)
Tries to adjust the dataset to the capabilities of the handler.static Capability
contentTypeToCapability(Cell.ContentType type, boolean isClass)
Turns the content type of a cell into the corresponding capability.static Capabilities
forDataset(Dataset data)
Returns capabilities that are required for the specified dataset.static Capabilities
forDataset(Dataset data, int col)
Returns capabilities that are required for the specified dataset column.static String
handles(CapabilitiesHandler handler, Dataset data)
Returns whether the capabilities handler handles the dataset.static String
handles(Capabilities caps, Dataset data)
Returns whether the capabilities can handle the dataset.static String
handles(Capabilities caps, Dataset data, int col)
Returns whether the capabilities can handle the dataset column.
-
-
-
Method Detail
-
contentTypeToCapability
public static Capability contentTypeToCapability(Cell.ContentType type, boolean isClass)
Turns the content type of a cell into the corresponding capability.- Parameters:
type
- the type of the cellisClass
- whether the column represents a class column- Returns:
- the capability
-
forDataset
public static Capabilities forDataset(Dataset data, int col)
Returns capabilities that are required for the specified dataset column. UsesCapability.UNKNOWN_ATTRIBUTE
andCapability.UNKNOWN_CLASS
for mixed columns.- Parameters:
data
- the dataset to get the capabilities forcol
- the column to generate the capabilities for- Returns:
- the capabilities
-
forDataset
public static Capabilities forDataset(Dataset data)
Returns capabilities that are required for the specified dataset.- Parameters:
data
- the dataset to get the capabilities for- Returns:
- the capabilities
-
handles
public static String handles(CapabilitiesHandler handler, Dataset data)
Returns whether the capabilities handler handles the dataset.- Parameters:
handler
- the handler to checkdata
- the dataset to check against- Returns:
- null if OK, otherwise error message
-
handles
public static String handles(Capabilities caps, Dataset data)
Returns whether the capabilities can handle the dataset.- Parameters:
caps
- the capabilities to use as basisdata
- the dataset to check against- Returns:
- null if OK, otherwise error message
-
handles
public static String handles(Capabilities caps, Dataset data, int col)
Returns whether the capabilities can handle the dataset column.- Parameters:
caps
- the capabilities to use as basisdata
- the dataset to check againstcol
- the column to check- Returns:
- null if OK, otherwise error message
-
adjust
public static Dataset adjust(Dataset data, CapabilitiesHandler handler) throws Exception
Tries to adjust the dataset to the capabilities of the handler. Cannot adjust capabilities related to class columns- Parameters:
handler
- the handler to adjust the dataset fordata
- the dataset to adjust- Returns:
- the adjusted dataset
- Throws:
Exception
- if failed to adjust
-
adjust
public static Dataset adjust(Dataset data, Capabilities caps) throws Exception
Tries to adjust the dataset to the capabilities. Cannot adjust capabilities related to class columns- Parameters:
caps
- the capabilities to adjust the dataset fordata
- the dataset to adjust- Returns:
- the adjusted dataset
- Throws:
Exception
- if failed to adjust
-
-