A Size object encapsulates a width and height dimension in a 2-D coordinate system.
The Size class requires the class definition file oodPlain.cls:
::requires "oodPlain.cls"
Instances of the Size class implement the methods listed in the following table:
+-0-----+ +-width---+
>>-.Size~new(--+-------+--,--+---------+--)----------------><
+-width-+ +-height--+Instantiates a new Size object with the dimensions specified.
The arguments are:
The whole number value of the width of the new object. The defualt is 0.
The whole number value of the height for the new object. The default is the width value.
This method returns the new Size object.
size = .Size~new(4, 8) say 'Width:' size~width 'Height:' size~height say size2 = .Size~new(16) say 'A new size object:' say ' Width: ' size2~width say ' Height:' size2~height say size2~width = 100 size2~height = 300 say 'New width:' size2~width 'new height:' size2~height say ::requires 'oodPlain.cls' /* Output would be: Width: 4 Height: 8 A new size object: Width: 16 Height: 16 New width: 100 new height: 300 */
>>-aSize~width---------------------------------------------><
Retrieves the width of the size object.
This method takes no arguments
The return value is the width of the object
See .Size~new example.
>>-aSize~width=value---------------------------------------><
Sets the width of the size object.
This method has one argument:
The new width of the size object.
This method does not return a value.
See .Size~new example.