-
Notifications
You must be signed in to change notification settings - Fork 1
ExperimentObject
An ExperimentObject is an object which can be used in an Experiment. This currently means Chemicals and Equipment.
To see examples of how to create a new Equipment, look at Container and Beaker.
ExperimentObjects all have a mass, this is the only common attribute. The main purpose of ExperimentObject is for Chemical and Equipment controllers to have shared methods with their own implementations.
getID Determines the ID which will be used to store this ExperimentObject in the database. Each ID should be stored as a constant in ObjectIDs, which is in the main folder for the Simulation. Depending on if this ExperimentObject is Equipment or a Chemical, it must also be added to either idToEquipment or idToChemical, respectively. The specific ID should be a new case in the switch statement to create the appropriate Equipment or Chemical. If the object is not added to these methods, it cannot be used by the database.
getObject
This is a method used to get the model object of a controller. This is implemented by Chemical and Equipment, it does not need to be further implemented.
canPlace
This determines if the object can be placed physically in the experiment. In most cases, all Equipment can be placed, and all Chemicals cannot be placed, however, a scenario may exist where a piece of Equipment should not be able to be placed, or a Chemical should be able to be placed. If such a case arises, override this method to define if it can or cannot be placed.
idToFunc and funcToId
This is for functions specific to an object which extends ExperimentObject. These functions are only ones which cause one ExperimentObject to interact with another. If no functions fit this criteria, then these methods should always return null. The IDs are used by Instructions to reference specific functions. Given an ID, this function should return the particular function associated with the ID. Each ID should be defined as a constant with a specific and descriptive name, for easy referencing of each function. Functions used by this ExperimentObject must take an ExperimentObjectController2D as a parameter, and no other parameters. If this is not correctly implemented, then Instructions will be unable to use the ExperimentObject, and the database will be unable to store the methods. idToFunc is simply the inverse of funcToId.