Project

General

Profile

Revision 7

Added by Willibald K. over 8 years ago

changing java, cpp, hpp files to unix line endings

View differences:

ObjectConstructor.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.ArrayList;
28
package org.momut.ooas.ast.expressions;
31 29

  
30
import java.util.ArrayList;
31

  
32 32
import org.momut.ooas.ast.IAstVisitor;
33 33
import org.momut.ooas.ast.types.OoActionSystemInstance;
34 34
import org.momut.ooas.ast.types.OpaqueType;
35

  
36
public final class ObjectConstructor extends TypeConstructionExpression
37
{
38
	private final ArrayList<OoActionSystemInstance> m_instances;
39
	private int m_currentInstance;
40
	private String m_fixedObjectName;
41

  
42
	public int currentInstance() { return m_currentInstance; }
43
	public ArrayList<OoActionSystemInstance> instances() { return m_instances; }
44
	public String givenObjectName() { return m_fixedObjectName; }
45

  
46
	public void ResetCurrentInstance() { m_currentInstance = 0; }
47

  
48
	public ObjectConstructor(OpaqueType aType, int line, int pos)
49
	{
50
		super (ExpressionKind.ObjectConstr, line, pos);
51
		SetType(aType);
52
		m_instances = new ArrayList<OoActionSystemInstance>();
53
		m_currentInstance = 0;
54
	}
55

  
56
	public ObjectConstructor(OpaqueType aType, String aName, int line, int pos)
57
	{
58
		super (ExpressionKind.ObjectConstr, line, pos);
59
		SetType(aType);
60
		m_instances = new ArrayList<OoActionSystemInstance>();
61
		m_currentInstance = 0;
62
		m_fixedObjectName = aName;
63
	}
64

  
65

  
66
	public ObjectConstructor(ObjectConstructor toCopy)
67
	{
68
		super (toCopy);
69
		m_instances = new ArrayList<OoActionSystemInstance>( toCopy.m_instances);
70
		m_currentInstance = toCopy.m_currentInstance;
71
		m_fixedObjectName = toCopy.m_fixedObjectName;
72
	}
73

  
74
	@Override
75
	public /*override*/ Expression Clone()
76
	{
77
		return new ObjectConstructor(this);
78
	}
79

  
80
	public /*override*/ void Accept(IAstVisitor visitor)
81
	{
82
		visitor.visit(this);
83
	}
84

  
85
	public void AddInstance(OoActionSystemInstance anInstance)
86
	{
87
		m_instances.add(anInstance);
88
	}
89

  
90
	public OoActionSystemInstance GetNextInstance()
91
	{
92
		OoActionSystemInstance result = m_instances.get(m_currentInstance);
93
		m_currentInstance++;
94
		return result;
95
	}
96
}
35

  
36
public final class ObjectConstructor extends TypeConstructionExpression
37
{
38
	private final ArrayList<OoActionSystemInstance> m_instances;
39
	private int m_currentInstance;
40
	private String m_fixedObjectName;
41

  
42
	public int currentInstance() { return m_currentInstance; }
43
	public ArrayList<OoActionSystemInstance> instances() { return m_instances; }
44
	public String givenObjectName() { return m_fixedObjectName; }
45

  
46
	public void ResetCurrentInstance() { m_currentInstance = 0; }
47

  
48
	public ObjectConstructor(OpaqueType aType, int line, int pos)
49
	{
50
		super (ExpressionKind.ObjectConstr, line, pos);
51
		SetType(aType);
52
		m_instances = new ArrayList<OoActionSystemInstance>();
53
		m_currentInstance = 0;
54
	}
55

  
56
	public ObjectConstructor(OpaqueType aType, String aName, int line, int pos)
57
	{
58
		super (ExpressionKind.ObjectConstr, line, pos);
59
		SetType(aType);
60
		m_instances = new ArrayList<OoActionSystemInstance>();
61
		m_currentInstance = 0;
62
		m_fixedObjectName = aName;
63
	}
64

  
65

  
66
	public ObjectConstructor(ObjectConstructor toCopy)
67
	{
68
		super (toCopy);
69
		m_instances = new ArrayList<OoActionSystemInstance>( toCopy.m_instances);
70
		m_currentInstance = toCopy.m_currentInstance;
71
		m_fixedObjectName = toCopy.m_fixedObjectName;
72
	}
73

  
74
	@Override
75
	public /*override*/ Expression Clone()
76
	{
77
		return new ObjectConstructor(this);
78
	}
79

  
80
	public /*override*/ void Accept(IAstVisitor visitor)
81
	{
82
		visitor.visit(this);
83
	}
84

  
85
	public void AddInstance(OoActionSystemInstance anInstance)
86
	{
87
		m_instances.add(anInstance);
88
	}
89

  
90
	public OoActionSystemInstance GetNextInstance()
91
	{
92
		OoActionSystemInstance result = m_instances.get(m_currentInstance);
93
		m_currentInstance++;
94
		return result;
95
	}
96
}

Also available in: Unified diff