Revision 7
Added by Willibald K. over 8 years ago
TernaryOperator.java | ||
---|---|---|
1 |
/**
|
|
2 |
*
|
|
3 |
* OOAS Compiler
|
|
4 |
*
|
|
5 |
* Copyright 2015, AIT Austrian Institute of Technology.
|
|
6 |
* This code is based on the C# Version of the OOAS Compiler, which is
|
|
7 |
* copyright 2015 by the Institute of Software Technology, Graz University
|
|
8 |
* of Technology with portions copyright by the AIT Austrian Institute of
|
|
9 |
* Technology. All rights reserved.
|
|
10 |
*
|
|
11 |
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
|
12 |
*
|
|
13 |
* If you modify the file please update the list of contributors below to in-
|
|
14 |
* clude your name. Please also stick to the coding convention of using TABs
|
|
15 |
* to do the basic (block-level) indentation and spaces for anything after
|
|
16 |
* that. (Enable the display of special chars and it should be pretty obvious
|
|
17 |
* what this means.) Also, remove all trailing whitespace.
|
|
18 |
*
|
|
19 |
* Contributors:
|
|
20 |
* Willibald Krenn (AIT)
|
|
21 |
* Stephan Zimmerer (AIT)
|
|
22 |
* Markus Demetz (AIT)
|
|
23 |
* Christoph Czurda (AIT)
|
|
24 |
*
|
|
25 |
*/
|
|
1 |
/** |
|
2 |
* |
|
3 |
* OOAS Compiler |
|
4 |
* |
|
5 |
* Copyright 2015, AIT Austrian Institute of Technology. |
|
6 |
* This code is based on the C# Version of the OOAS Compiler, which is |
|
7 |
* copyright 2015 by the Institute of Software Technology, Graz University |
|
8 |
* of Technology with portions copyright by the AIT Austrian Institute of |
|
9 |
* Technology. All rights reserved. |
|
10 |
* |
|
11 |
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED. |
|
12 |
* |
|
13 |
* If you modify the file please update the list of contributors below to in- |
|
14 |
* clude your name. Please also stick to the coding convention of using TABs |
|
15 |
* to do the basic (block-level) indentation and spaces for anything after |
|
16 |
* that. (Enable the display of special chars and it should be pretty obvious |
|
17 |
* what this means.) Also, remove all trailing whitespace. |
|
18 |
* |
|
19 |
* Contributors: |
|
20 |
* Willibald Krenn (AIT) |
|
21 |
* Stephan Zimmerer (AIT) |
|
22 |
* Markus Demetz (AIT) |
|
23 |
* Christoph Czurda (AIT) |
|
24 |
* |
|
25 |
*/ |
|
26 | 26 |
|
27 | 27 |
|
28 |
package org.momut.ooas.ast.expressions;
|
|
29 |
|
|
28 |
package org.momut.ooas.ast.expressions; |
|
29 |
|
|
30 | 30 |
import org.momut.ooas.ast.IAstVisitor; |
31 | 31 |
import org.momut.ooas.ast.IScope; |
32 |
|
|
33 |
|
|
34 |
/////////////////////////////////////////////// |
|
35 |
/// === Ternary Operator === |
|
36 |
/// |
|
37 |
public final class TernaryOperator extends Expression |
|
38 |
{ |
|
39 |
private Expression m_left; |
|
40 |
private Expression m_mid; |
|
41 |
private Expression m_right; |
|
42 |
private final IScope m_definingScope; |
|
43 |
|
|
44 |
public Expression left() { return m_left; } |
|
45 |
public Expression mid() { return m_mid; } |
|
46 |
public Expression right() { return m_right; } |
|
47 |
public IScope definingScope() { return m_definingScope; } |
|
48 |
|
|
49 |
public TernaryOperator(ExpressionKind aKind, Expression left, Expression mid, Expression right, int line, int pos, IScope aScope) |
|
50 |
{ |
|
51 |
super (aKind, line, pos); |
|
52 |
m_left = left; |
|
53 |
m_mid = mid; |
|
54 |
m_right = right; |
|
55 |
m_definingScope = aScope; |
|
56 |
} |
|
57 |
|
|
58 |
public TernaryOperator(TernaryOperator toCopy) |
|
59 |
{ |
|
60 |
super (toCopy); |
|
61 |
m_left = toCopy.m_left; |
|
62 |
m_mid = toCopy.m_mid; |
|
63 |
m_right = toCopy.m_right; |
|
64 |
m_definingScope = toCopy.definingScope(); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public /*override*/ Expression Clone() |
|
69 |
{ |
|
70 |
return new TernaryOperator(this); |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public /*override*/ void Accept(IAstVisitor visitor) |
|
75 |
{ |
|
76 |
visitor.visit(this); |
|
77 |
} |
|
78 |
|
|
79 |
public void SetLeftChild(Expression newExpression) |
|
80 |
{ |
|
81 |
m_left = newExpression; |
|
82 |
} |
|
83 |
public void SetMidChild(Expression newExpression) |
|
84 |
{ |
|
85 |
m_mid = newExpression; |
|
86 |
} |
|
87 |
public void SetRightChild(Expression newExpression) |
|
88 |
{ |
|
89 |
m_right = newExpression; |
|
90 |
} |
|
91 |
|
|
92 |
} |
|
93 |
|
|
32 |
|
|
33 |
|
|
34 |
/////////////////////////////////////////////// |
|
35 |
/// === Ternary Operator === |
|
36 |
/// |
|
37 |
public final class TernaryOperator extends Expression |
|
38 |
{ |
|
39 |
private Expression m_left; |
|
40 |
private Expression m_mid; |
|
41 |
private Expression m_right; |
|
42 |
private final IScope m_definingScope; |
|
43 |
|
|
44 |
public Expression left() { return m_left; } |
|
45 |
public Expression mid() { return m_mid; } |
|
46 |
public Expression right() { return m_right; } |
|
47 |
public IScope definingScope() { return m_definingScope; } |
|
48 |
|
|
49 |
public TernaryOperator(ExpressionKind aKind, Expression left, Expression mid, Expression right, int line, int pos, IScope aScope) |
|
50 |
{ |
|
51 |
super (aKind, line, pos); |
|
52 |
m_left = left; |
|
53 |
m_mid = mid; |
|
54 |
m_right = right; |
|
55 |
m_definingScope = aScope; |
|
56 |
} |
|
57 |
|
|
58 |
public TernaryOperator(TernaryOperator toCopy) |
|
59 |
{ |
|
60 |
super (toCopy); |
|
61 |
m_left = toCopy.m_left; |
|
62 |
m_mid = toCopy.m_mid; |
|
63 |
m_right = toCopy.m_right; |
|
64 |
m_definingScope = toCopy.definingScope(); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public /*override*/ Expression Clone() |
|
69 |
{ |
|
70 |
return new TernaryOperator(this); |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public /*override*/ void Accept(IAstVisitor visitor) |
|
75 |
{ |
|
76 |
visitor.visit(this); |
|
77 |
} |
|
78 |
|
|
79 |
public void SetLeftChild(Expression newExpression) |
|
80 |
{ |
|
81 |
m_left = newExpression; |
|
82 |
} |
|
83 |
public void SetMidChild(Expression newExpression) |
|
84 |
{ |
|
85 |
m_mid = newExpression; |
|
86 |
} |
|
87 |
public void SetRightChild(Expression newExpression) |
|
88 |
{ |
|
89 |
m_right = newExpression; |
|
90 |
} |
|
91 |
|
|
92 |
} |
|
93 |
|
Also available in: Unified diff
changing java, cpp, hpp files to unix line endings