SPVM::Point − Point
use Point;
my $point = Point−>new;
my $point = Point−>new(1, 2);
my $x = $point−>x;
my $y = $point−>y;
my $point_string = $point−>to_string;
"Point" is a class for a point.
"Point" class has the following interfaces.
|
• |
Stringable |
|||
|
• |
Cloneable |
|||
|
• |
EqualityCheckable |
has x : protected ro int;
"x".
has y : protected ro int;
"y".
"static method new : Point ($x : int = 0, $y : int = 0);"
Create a new "Point" object with $x and $y.
protected method init : Point ($x : int = 0, $y : int = 0)
Initializes "x" and "y".
"method clear : void ();"
Sets "x" and "y" to 0.
"method clone : Point ();"
Creates a new "Point" object that clones myself.
"method to_string : string ();"
Stringifies "Point" object as the following format.
(1,2)
"method eq : int ($a : Point, $b : Point);"
If $a is equal to $b, returns 1, otherwise returns 0.
Implementation:
If $a and $b is defined and "x", "y", and "z" fields in $a are equals to "x", "y", and "z" fields in $b, returns 1.
If only $a is not defined, returns 0.
If only $b is not defined, returns 0.
If both $a and $b is not defined, returns 1.
Copyright (c) 2023 Yuki Kimoto
MIT License