blib/lib/SPVM/Point3D.pm

filter: Statementstmt 100% 1 / 1 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 1 / 1 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/SPVM/Native/Compiler.build ↑ Summary blib/lib/SPVM/Sync/Mutex.build »
1 package SPVM::Point3D;
2  
3 2 1;
4  
5 =head1 Name
6  
7 SPVM::Point3D - Point 3D
8  
9 =head1 Usage
10  
11 use Point3D;
12
13 my $point = Point3D->new;
14 my $point = Point3D->new(1, 2, 3);
15  
16 my $x = $point->x;
17 my $y = $point->y;
18 my $z = $point->z;
19
20 my $point_string = $point->to_string;
21  
22 =head1 Description
23  
24 C<Point3D> is a class for a point 3D.
25  
26 =head1 Super Class
27  
28 L<Point|SPVM::Point> is the super class of C<Point3D>.
29  
30 =head1 Fields
31  
32 C<Point3D> inherits the fields of L<Point|SPVM::Point/"Fields">.
33  
34 =head2 z
35  
36 has z : ro int;
37  
38 C<z>.
39  
40 =head1 Class Methods
41  
42 =head2 new
43  
44 C<static method new : L<Point3D|SPVM::Point3D> ($x : int = 0, $y : int = 0, $z : int = 0);>
45  
46 Creates a new C<Point3D> object with $x, $y, $z.
47  
48 =head1 Instance Methods
49  
50 C<Point3D> inherits the instance methods of L<Point|SPVM::Point/"Instance Methods">.
51  
52 =head2 init
53  
54 protected method init : Point3D ($x : int = 0, $y : int = 0, $z : int = 0)
55  
56 Initializes L</"x">, L</"y">, and L</"z">.
57  
58 =head2 clear
59  
60 C<method clear : void ();>
61  
62 Sets L<x|SPVM::Point/"x">, L<y|SPVM::Point/"y">, and L</"z"> to 0.
63  
64 =head2 clone
65  
66 C<method clone : L<Point3D|SPVM::Point3D> ();>
67  
68 Creates a new C<Point3D> object that clones myself.
69  
70 =head2 to_string
71  
72 C<method to_string : string ();>
73  
74 Stringifies C<Point3D> object as the following format.
75  
76 (1,2,3)
77  
78 =head2 eq
79  
80 C<method eq : int ($a : Point, $b : Point);>
81  
82 If $a is equal to $b, returns 1, otherwise returns 0.
83  
84 Implementation:
85  
86 If $a and $b is defined and L</"x"> and L</"y"> fields in $a are equals to L</"x"> and L</"y"> fields in $b, returns 1.
87  
88 If only $a is not defined, returns 0.
89  
90 If only $b is not defined, returns 0.
91  
92 If both $a and $b is not defined, returns 1.
93  
94 =head1 Copyright & License
95  
96 Copyright (c) 2023 Yuki Kimoto
97  
98 MIT License
« blib/lib/SPVM/Native/Compiler.build ↑ Summary blib/lib/SPVM/Sync/Mutex.build »