Project

General

Profile

Revision 7

Added by Willibald K. over 8 years ago

changing java, cpp, hpp files to unix line endings

View differences:

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

  
34
///////////////////////////////////////////////
35
///  Constructor: Map
36
///
37
public final class MapConstructor extends TypeConstructionExpression
38
{
39
	public static final class MapItem
40
	{
41
		public Expression key;
42
		public Expression value;
43
		public MapItem(Expression aKey, Expression aValue)
44
		{
45
			key = aKey;
46
			value = aValue;
47
		}
48
		public MapItem(MapItem toCopy)
49
		{
50
			key = toCopy.key;
51
			value = toCopy.value;
52
		}
53
	}
54

  
55
	private ArrayList<MapItem> m_items;
56

  
57
	public ArrayList<MapItem> items() { return m_items; }
58

  
59
	public MapConstructor(int line, int pos)
60
	{
61
		super (ExpressionKind.MapConstr, line, pos);
62
		m_items = new ArrayList<MapItem>();
63
	}
64

  
65
	public MapConstructor(MapConstructor toCopy)
66
	{
67
		super (toCopy);
68
		m_items = new ArrayList<MapItem>(toCopy.m_items);
69
	}
70

  
71
	@Override
72
	public /*override*/ Expression Clone()
73
	{
74
		return new MapConstructor(this);
75
	}
76

  
77
	public void AddItem(Expression mapFrom, Expression mapTo)
78
	{
79
		MapItem newitem = new MapItem(mapFrom, mapTo);
80
		m_items.add(newitem);
81
	}
82

  
83
	public /*override*/ void Accept(IAstVisitor visitor)
84
	{
85
		visitor.visit(this);
86
	}
87

  
88
	public void SetItems(ArrayList<MapItem> newItems)
89
	{
90
		m_items = newItems;
91
	}
92

  
93
}
33

  
34
///////////////////////////////////////////////
35
///  Constructor: Map
36
///
37
public final class MapConstructor extends TypeConstructionExpression
38
{
39
	public static final class MapItem
40
	{
41
		public Expression key;
42
		public Expression value;
43
		public MapItem(Expression aKey, Expression aValue)
44
		{
45
			key = aKey;
46
			value = aValue;
47
		}
48
		public MapItem(MapItem toCopy)
49
		{
50
			key = toCopy.key;
51
			value = toCopy.value;
52
		}
53
	}
54

  
55
	private ArrayList<MapItem> m_items;
56

  
57
	public ArrayList<MapItem> items() { return m_items; }
58

  
59
	public MapConstructor(int line, int pos)
60
	{
61
		super (ExpressionKind.MapConstr, line, pos);
62
		m_items = new ArrayList<MapItem>();
63
	}
64

  
65
	public MapConstructor(MapConstructor toCopy)
66
	{
67
		super (toCopy);
68
		m_items = new ArrayList<MapItem>(toCopy.m_items);
69
	}
70

  
71
	@Override
72
	public /*override*/ Expression Clone()
73
	{
74
		return new MapConstructor(this);
75
	}
76

  
77
	public void AddItem(Expression mapFrom, Expression mapTo)
78
	{
79
		MapItem newitem = new MapItem(mapFrom, mapTo);
80
		m_items.add(newitem);
81
	}
82

  
83
	public /*override*/ void Accept(IAstVisitor visitor)
84
	{
85
		visitor.visit(this);
86
	}
87

  
88
	public void SetItems(ArrayList<MapItem> newItems)
89
	{
90
		m_items = newItems;
91
	}
92

  
93
}

Also available in: Unified diff