47 |
|
|
48 |
class pattern (inputVector : 'a) (outputVector : 'b) = |
class pattern (inputVector : 'a) (outputVector : 'b) = |
49 |
object |
object |
50 |
|
|
51 |
constraint 'a = float array array |
constraint 'a = float array array |
52 |
|
|
53 |
constraint 'b = float array array |
constraint 'b = float array array |
54 |
|
|
55 |
|
(** |
56 |
|
A vector which contains the pattern's inputs. |
57 |
|
*) |
58 |
val mutable _inputs = inputVector |
val mutable _inputs = inputVector |
59 |
|
|
60 |
|
(** |
61 |
|
A vector which contains the pattern's outputs. |
62 |
|
*) |
63 |
val mutable _outputs = outputVector |
val mutable _outputs = outputVector |
64 |
|
|
65 |
(* initializer match (inputVector, outputVector) with |
(* initializer match (inputVector, outputVector) with |
66 |
a, b when Array.length a != 0 && Array.length b != 0 -> () |
a, b when Array.length a != 0 && Array.length b != 0 -> () |
67 |
| _, _ -> (Env.getEnv())#toChannel "Class Pattern : The input and output are empty.\n" *) |
| _, _ -> (Env.getEnv())#toChannel "Class Pattern : The input and output are empty.\n" *) |
68 |
|
|
69 |
|
(** |
70 |
|
A get*. |
71 |
|
@return the input vector. |
72 |
|
*) |
73 |
method getInputs = _inputs |
method getInputs = _inputs |
74 |
|
|
75 |
|
(** |
76 |
|
A get*. |
77 |
|
@return the output vector. |
78 |
|
*) |
79 |
method getOutputs = _outputs |
method getOutputs = _outputs |
80 |
|
|
81 |
|
(** |
82 |
|
A get*. |
83 |
|
@return the input which corresponds to the "index" parameter. |
84 |
|
*) |
85 |
method getInput index = _inputs.(index) |
method getInput index = _inputs.(index) |
86 |
|
|
87 |
|
(** |
88 |
|
A get*. |
89 |
|
@return the output which corresponds to the "index" parameter. |
90 |
|
*) |
91 |
method getOutput index = _outputs.(index) |
method getOutput index = _outputs.(index) |
92 |
|
|
93 |
|
(** |
94 |
|
A get*. |
95 |
|
@return the number of vectors in the pattern. |
96 |
|
*) |
97 |
method getVectorNumber = Array.length _inputs |
method getVectorNumber = Array.length _inputs |
98 |
|
|
99 |
|
(** |
100 |
|
A get*. |
101 |
|
@return the input vector's size. |
102 |
|
*) |
103 |
method getInputSize = Array.length _inputs.(0) |
method getInputSize = Array.length _inputs.(0) |
104 |
|
|
105 |
|
(** |
106 |
|
A get*. |
107 |
|
@return the output vector's size. |
108 |
|
*) |
109 |
method getOutputSize = Array.length _outputs.(0) |
method getOutputSize = Array.length _outputs.(0) |
110 |
|
|
111 |
end |
end |