ObjectPiece - PendulumProject2020/PendulumProject GitHub Wiki

Version: 0.1.9+

public class ObjectPiece extends Piece

This class belongs to the main package. This class belongs to the Methodological layer.

One of the two direct subclasses of the Piece class. The ObjectPiece subclasses allows the creation of objects under them. Each ObjectPiece instance has the data storage variables pieceSpecificDataSets and nameSpecificDataSets. The latter allows variables to be named and declared in run-time. Each instance can carry out commands given to it (via the methods executeCommand and executeCommandWithDataSet) and evaluate instance-specific information (via the methods evaluateInstanceInformation and evaluateInstanceInformationWithDataSet). What it does in response to commands and information requests is governed by the instance-specific Functional Interfaces commandExecutor and instanceInformationEvaluator. The behaviors of the instance can be customized by setting these Functional Interfaces.

Field Summary

private Map<Class<Piece>, DataSet> pieceSpecificDataSets The collection of instance variables associated with particular Piece subclasses.

private Map<String, DataSet> nameSpecificDataSets The collection of instance variables associated with names.

private Class<?> actualClass The ObjectPiece subclass the instance was constructed under.

private CommandExecutor commandExecutor The Functional Interface governing the instance's command execution.

private InstanceInformationEvaluator instanceInformationEvaluator The Functional Interface governing the instance's information evaluation.

Constructor Summary

public ObjectPiece() The actualClass field is set as ObjectPiece.class. The commandExecutor and instanceInformationEvaluator fields are set as default.

Method Summary

public static ObjectPiece makeClone(ObjectPiece objectPiece) Returns a clone of objectPiece. The Map fields are shallow-cloned, while the Class and Interface fields are copied.

public void setDefaultCommandExecutor() Sets the default value for commandExecutor.

public void setDefaultInstanceInformationEvaluator() Sets the default value of instanceInformationEvaluator.

public void executeCommand(String command) Perform the action as specified by command.

public void executeCommandWithDataSet(String command, DataSet dataSet) Perform the action as specified by command, with the help of dataSet.

public DataSet evaluateInstanceInformation(String informationName) Evaluates the instance-specific information as specified by informationName.

public DataSet evaluateInstanceInformationWithDataSet(String informationName, DataSet dataSet) Evaluates the instance-specific information as specified by informationName, with the help of dataSet.

public DataSet getDataSet(Class<Piece> pieceClass) Returns the instance-specific DataSet associated with pieceClass.

public void setDataSet(Class<Piece> pieceClass, DataSet dataSet) Sets dataSet as the instance-specific DataSet associated with pieceClass.

public DataSet getDataSet(String dataSetName) Returns the instance-specific DataSet associated with dataSetName.

public void setDataSet(String dataSetName, DataSet dataSet) Sets dataSet as the instance-specific DataSet associated with dataSetName.

Getters and Setters

public Map<Class<Piece>, DataSet> getPieceSpecificDataSets() Returns the value of the pieceSpecificDataSets field.

public void setPieceSpecificDataSets(Map<Class<Piece>, DataSet> pieceSpecificDataSets Sets the value of the pieceSpecificDataSets field.

public Map<String, DataSet> getNameSpecificDataSets() Returns the value of the nameSpecificDataSets field.

public void setNameSpecificDataSets(Map<String, DataSet> nameSpecificDataSets) Sets the value of the nameSpecificDataSets field.

public Class<?> getActualClass() Returns the value of the actualClass field.

public void setActualClass(Class<?> actualClass) Sets the value of the actualClass field.

public CommandExecutor getCommandExecutor() Returns the value of the commandExecutor field.

public void setCommandExecutor(CommandExecutor commandExecutor) Sets the value of the commandExecutor field.

public InstanceInformationEvaluator getInstanceInformationEvaluator() Returns the value of the instanceInformationEvaluator field.

public void setInstanceInformationEvaluator(InstanceInformationEvaluator instanceInformationEvaluator) Sets the value of the instanceInformationEvaluator field.

⚠️ **GitHub.com Fallback** ⚠️