Titan Core Initial Contribution
[deliverable/titan.core.git] / regression_test / XML / XER / ObjectClass.asn
1 --/////////////////////////////////////////////////////////////////////////////
2 -- Copyright (c) 2000-2014 Ericsson Telecom AB
3 -- All rights reserved. This program and the accompanying materials
4 -- are made available under the terms of the Eclipse Public License v1.0
5 -- which accompanies this distribution, and is available at
6 -- http://www.eclipse.org/legal/epl-v10.html
7 --/////////////////////////////////////////////////////////////////////////////
8 ObjectClass DEFINITIONS
9 AUTOMATIC TAGS ::=
10 BEGIN
11
12 IMPORTS /* nothing */ ;
13
14
15 Matrix ::= SEQUENCE OF SEQUENCE OF INTEGER
16
17 TwoMat ::= SEQUENCE {
18 left Matrix,
19 right Matrix
20 }
21
22
23 zero Matrix ::=
24 {{0, 0, 0, 0},
25 {0, 0, 0, 0},
26 {0, 0, 0, 0},
27 {0, 0, 0, 0}}
28
29 identity Matrix ::=
30 {{1, 0, 0, 0},
31 {0, 1, 0, 0},
32 {0, 0, 1, 0},
33 {0, 0, 0, 1}}
34
35 pimat Matrix ::=
36 {{3, 1, 4, 1},
37 {5, 9, 2, 6},
38 {5, 3, 5, 8},
39 {9, 7, 9, 3}}
40
41 invpimat Matrix ::= -- the adjugate of pimat
42 {{-467, -123, 79, 191},
43 { 171, 57, -39, -67},
44 { 326, 76, -52, -122},
45 { 24, 8, 10, -18}}
46
47 matrixPair TwoMat ::= { left identity, right pimat }
48
49
50 -- object class definition
51
52 OPERATION ::= CLASS
53 {
54 &ArgumentType OPTIONAL,
55 &ResultType OPTIONAL,
56 &Errors ERROR OPTIONAL,
57 &Linked OPERATION OPTIONAL,
58 &resultReturned BOOLEAN DEFAULT TRUE,
59 &operationCode PrintableString UNIQUE
60 }
61
62 ERROR ::= CLASS
63 {
64 &ParameterType OPTIONAL,
65 &errorCode INTEGER UNIQUE
66 }
67
68 --
69
70
71
72 -- object assignment, default syntax
73
74
75 invertMatrix OPERATION ::=
76 {
77 &ArgumentType Matrix,
78 &ResultType Matrix,
79 &Errors {determinantIsZero},
80 &operationCode "invert"
81 }
82
83 determinantIsZero ERROR ::=
84 {
85 &errorCode 1
86 }
87
88 addMatrices OPERATION ::=
89 {
90 &ArgumentType TwoMat,
91 &ResultType Matrix,
92 &Errors {sizeMismatch},
93 &operationCode "add"
94 }
95
96 subtractMatrices OPERATION ::=
97 {
98 &ArgumentType TwoMat,
99 &ResultType Matrix,
100 &Errors {sizeMismatch},
101 &operationCode "subtract"
102 }
103
104 sizeMismatch ERROR ::=
105 {
106 &errorCode 2
107 }
108
109
110 -- object set
111
112 MatrixOperations OPERATION ::=
113 {
114 invertMatrix
115 | addMatrices
116 | subtractMatrices
117 -- | multiplyMatrices
118 }
119
120 -- types
121
122 MatOp ::= SEQUENCE {
123 op OPERATION.&operationCode ({MatrixOperations}),
124 arg OPERATION.&ArgumentType ({MatrixOperations} {@op}),
125 rez OPERATION.&ResultType ({MatrixOperations} {@op})
126 -- This is not how a real protocol would be put together
127 }
128
129 -- objects
130
131 addition MatOp ::= {
132 op "add",
133 arg twoMat : { left zero, right pimat },
134 rez matrix : pimat
135 }
136
137 subtraction MatOp ::= {
138 op "subtract",
139 arg twoMat : { left identity, right identity },
140 rez matrix : zero
141 }
142
143 inversion MatOp ::= {
144 op "invert",
145 arg matrix : pimat,
146 rez matrix : invpimat
147 }
148
149 END
This page took 0.034383 seconds and 6 git commands to generate.