Project

General

Profile

Revision 7

Added by Willibald K. over 8 years ago

changing java, cpp, hpp files to unix line endings

View differences:

QValConstructor.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

  
30
import java.util.Arrays;
28
package org.momut.ooas.ast.expressions;
31 29

  
30
import java.util.Arrays;
31

  
32 32
import org.momut.ooas.ast.IAstVisitor;
33

  
34
///////////////////////////////////////////////
35
///  Constructor: Qualitative Value
36
///
37
public final class QValConstructor extends TypeConstructionExpression
38
{
39
	public enum QValDeriv { DonTCare, Dec, Steady, Inc }
40

  
41
	private Expression[] m_value;
42
	private QValDeriv m_derivValue;
43

  
44
	public Expression[] value() { return m_value; }
45
	public QValDeriv valueDeriv() { return m_derivValue; }
46

  
47

  
48
	public QValConstructor(int line, int pos)
49
	{
50
		super (ExpressionKind.QValConstr, line, pos);
51
		m_value = new Expression[1];
52
		m_value[0] = null;
53
		m_derivValue = QValDeriv.DonTCare;
54
	}
55

  
56
	public QValConstructor(QValConstructor toCopy)
57
	{
58
		super (toCopy);
59
		m_value = Arrays.copyOf(toCopy.m_value, toCopy.m_value.length);
60
		m_derivValue = toCopy.m_derivValue;
61
	}
62

  
63
	@Override
64
	public /*override*/ Expression Clone()
65
	{
66
		return new QValConstructor(this);
67
	}
68

  
69

  
70
	public /*override*/ void Accept(IAstVisitor visitor)
71
	{
72
		visitor.visit(this);
73
	}
74

  
75
	public void SetValue(Expression aval)
76
	{
77
		m_value[0] = aval;
78
	}
79

  
80
	public void AddRange(Expression toRange)
81
	{
82
		Expression currVal = m_value[0];
83
		m_value = new Expression[2];
84
		m_value[0] = currVal;
85
		m_value[1] = toRange;
86
	}
87

  
88
	public void SetDerivation(QValDeriv newValue)
89
	{
90
		m_derivValue = newValue;
91
	}
92
}
33

  
34
///////////////////////////////////////////////
35
///  Constructor: Qualitative Value
36
///
37
public final class QValConstructor extends TypeConstructionExpression
38
{
39
	public enum QValDeriv { DonTCare, Dec, Steady, Inc }
40

  
41
	private Expression[] m_value;
42
	private QValDeriv m_derivValue;
43

  
44
	public Expression[] value() { return m_value; }
45
	public QValDeriv valueDeriv() { return m_derivValue; }
46

  
47

  
48
	public QValConstructor(int line, int pos)
49
	{
50
		super (ExpressionKind.QValConstr, line, pos);
51
		m_value = new Expression[1];
52
		m_value[0] = null;
53
		m_derivValue = QValDeriv.DonTCare;
54
	}
55

  
56
	public QValConstructor(QValConstructor toCopy)
57
	{
58
		super (toCopy);
59
		m_value = Arrays.copyOf(toCopy.m_value, toCopy.m_value.length);
60
		m_derivValue = toCopy.m_derivValue;
61
	}
62

  
63
	@Override
64
	public /*override*/ Expression Clone()
65
	{
66
		return new QValConstructor(this);
67
	}
68

  
69

  
70
	public /*override*/ void Accept(IAstVisitor visitor)
71
	{
72
		visitor.visit(this);
73
	}
74

  
75
	public void SetValue(Expression aval)
76
	{
77
		m_value[0] = aval;
78
	}
79

  
80
	public void AddRange(Expression toRange)
81
	{
82
		Expression currVal = m_value[0];
83
		m_value = new Expression[2];
84
		m_value[0] = currVal;
85
		m_value[1] = toRange;
86
	}
87

  
88
	public void SetDerivation(QValDeriv newValue)
89
	{
90
		m_derivValue = newValue;
91
	}
92
}

Also available in: Unified diff