blob: c0be6af587a4f58c0d3ec0c2f12e0bd40ef7eeff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/**
* Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ibrahim Sallam - initial API and implementation
*/
package org.eclipse.emf.cdo.server.internal.objectivity.db;
import com.objy.as.app.Class_Position;
import com.objy.as.app.d_Attribute;
import com.objy.as.app.d_Class;
import java.util.HashMap;
/**
* Wrapper around the AS class to be able to cache attributes.
*
* @author ibrahim
*/
public class ObjyClass
{
protected d_Class asClass;
protected String asClassName;
protected HashMap<String, d_Attribute> attributeMap = new HashMap<String, d_Attribute>();
protected HashMap<String, Class_Position> classPositionMap = new HashMap<String, Class_Position>();
public ObjyClass(d_Class asClass/* , EClass eClass */)
{
this.asClass = asClass;
asClassName = asClass.name();
}
public d_Attribute resolve_attribute(String attribute_name)
{
d_Attribute attr = attributeMap.get(attribute_name);
if (attr == null)
{
attr = asClass.resolve_attribute(attribute_name);
attributeMap.put(attribute_name, attr);
}
return attr;
}
public Class_Position resolve_position(String attribute_name)
{
Class_Position attr = classPositionMap.get(attribute_name);
if (attr == null)
{
attr = asClass.position_in_class(attribute_name);
classPositionMap.put(attribute_name, attr);
}
return attr;
}
public d_Class getASClass()
{
return asClass;
}
public String getASClassName()
{
return asClassName;
}
}
|