Object and Class Specfication

Class: Shared Motor

1.0 Precise and Concise Description

  1. A motor is an abstraction of a physical motor device that converts energy into movement. Movement is delivered in the form of the rotation of the motor's rotor. A rotor may be viewed as a shaft which is part of a motor, and to which varying devices may be attached.

  2. "Share semantics" allow for the creation of aliases for an object. This has the advantage of possible increases in time and space efficiency. However, it increases the possibility of actions with unintended results, e.g., unintentional deletion or alteration of an object through operations performed using the alias. (Instances of this class may have more than one alias.)

  3. The suffered operations for a motor include movement operations (rotate_clockwise, rotate_counterclockwise, stop), operations for detecting movement (is_rotating_clockwise, is_rotating_counterclockwise, is_stopped), assign (the state of one instance of this class to another instance of the same class), and operations for share semantics (share, is_shared, remove_alias, and clear_aliases).

  4. If a motor object is in the "stop" state then either the rotate_clockwise or rotate_counterclockwise operations may be accomplished. If the motor's rotor is rotating clockwise or counterclockwise, and rotation in the opposite direction is desired, the motor must first be stopped. If a motor is in a particular state, and an operation is invoked which would result in the motor maintaining that state, no state changes will occur, i.e., the operation will be ignored.

  5. This motor abstraction represents a motor which produces movement of constant speed, i.e., it is incapable of varying speeds of rotation.

  6. The motor contains state information about the current direction of rotation, or, more precisely, about the direction of rotation of the motor's rotor. The allowed states for direction of rotation are: clockwise, counterclockwise, and stopped. A second piece of state information is whether a given motor object has aliases, i.e., is shared. Finally, a motor may have mechanical problems, i.e., a motor may be in working condition, or have a mechanical failure.

  7. The exceptions for a shared motor object are Not_Stopped and Mechanical_Failure.

  8. There are no constants associated with the instances of the Shared_Motor class.

2.0 Graphical Representations

2.1 Static Representations

2.1.1 Semantic Networks

2.1.2 Notes On the Semantic Networks

  1. Direction of rotation can only assume one of three values: rotating clockwise, rotating counterclockwise, and stopped.

  2. We can determine whether or not a given instance of this class has aliases, and we can determine how many aliases it has.

2.2 Dynamic Representations

2.2.1 State Transition Diagrams

2.2.1.1 State Transition Diagrams for Non-Spontaneous State Changes

2.2.1.1.1 Notes on State Transition Diagrams for Non-Spontaneous State Changes

  1. The operations: Is_Rotating_Clockwise, Is_Rotating_Counterclockwise, and Is_Stopped, are selector operations which can be used to determine if a given motor is in one of the states shown.

  2. The operation Is_Shared can be used to determine if a given motor object has aliases. The operation Number_Of_Aliases can be used to determine the number of aliases that an instance of Shared_Motor currently has.

  3. The only way it can be determined if a particular motor has a mechanical problem is to detect the raising of the Mechanical_Failure exception upon invocation of the one of rotate_clockwise, rotate_counterclockwise, or stop operations.

  4. The operation "assign" requires two instances of this class, and, thus, cannot easily be shown on a simple state transition diagram. Please note that, while whether a particular shared motor is experiencing mechanical failure is indeed part of the state for that motor, mechanical failure cannot be assigned from one shared motor object to the other. The Petri Net Graph representation of this operation is:

3.0 Operations

3.1 Required Operations

Operation Method
Rotate_Clockwise Connects the motor with the necessary operations to rotate clockwise.
Rotate_Counterclockwise Connects the motor with the necessary operations to rotate counterclockwise.
Stop Connects the motor with the necessary operations to stop.
Is_Rotating_Clockwise Connects the motor with the necessary operations to determine if the motor's rotor is rotating clockwise
Is_Rotating_Counterclockwise Connects the motor with the necessary operations to determine if the motor's rotor is rotating counterclockwise
Is_Stopped Connects the motor with the necessary operations to determine if the motor's rotor is stopped

3.2 Suffered Operations

Operation Method
Rotate_Clockwise Causes the motor's rotor to rotate clockwise
Rotate_Counterclockwise Causes the motor's rotor to rotate counterclockwise
Stop Causes the motor's rotor to stop rotating
Is_Rotating_Clockwise Returns true if the motor's rotor is rotating clockwise
Is_Rotating_Counterclockwise Returns true if the motor's rotor is rotating counterclockwise
Is_Stopped Returns true if the motor's rotor is not rotating
Assign Assigns the state of one instance of this class to another instance of the same class -- but, cannot assign a mechanically failed state from one motor object to another.
Share Allows for share semantics, i.e., allows for the creation of aliases for instances of the motor class.
Is_Shared Returns true if the given instance of the motor class has an alias.
Number_Of_Aliases Returns the number of aliases currently assigned to the specified shared motor
Remove_Alias Removes a specified alias from a specified shared motor object
Clear_Aliases Removes all existing aliases from a given shared motor object.

4.0 State Information

  1. The state information for a motor includes the direction of rotation, which typically assumes values of: clockwise, counterclockwise, and stopped.

  2. The creation of aliases for instances of this class does change their states, i.e., they now have aliases. Therefore, part of the state information for an instance of this class is whether the instance has aliases.

  3. If a shared motor is experiencing mechanical failure, that is also part of the state for that object. However, it is a state which cannot be assigned from one motor object to another.

5.0 Constants and Exceptions

5.1 Constants

  1. This class will provide no constants.

5.2 Exceptions

  1. This class will provide the following exceptions:

[TOA Home Page] [HTML
Documents] [Contact TOA]