99 |
|
|
100 |
private Map findClassCache = new HashMap(); |
private Map findClassCache = new HashMap(); |
101 |
|
|
102 |
|
public ClassDoc findClass(String className, String dimension) |
103 |
|
{ |
104 |
|
ClassDoc cached = (ClassDoc)findClassCache.get(className + dimension); |
105 |
|
if (null != cached) { |
106 |
|
return cached; |
107 |
|
} |
108 |
|
else { |
109 |
|
ClassDoc classDoc = findClass(className); |
110 |
|
|
111 |
|
if (null!=classDoc) { |
112 |
|
try { |
113 |
|
if (classDoc.dimension().equals(dimension)) { |
114 |
|
return classDoc; |
115 |
|
} |
116 |
|
else { |
117 |
|
ClassDoc rc = (ClassDoc) ((WritableType)classDoc).clone(); |
118 |
|
((WritableType)rc).setDimension(dimension); |
119 |
|
findClassCache.put(className + dimension, rc); |
120 |
|
return rc; |
121 |
|
} |
122 |
|
} |
123 |
|
catch (CloneNotSupportedException e) { |
124 |
|
throw new RuntimeException(e); |
125 |
|
} |
126 |
|
} |
127 |
|
else { |
128 |
|
return null; |
129 |
|
} |
130 |
|
} |
131 |
|
} |
132 |
|
|
133 |
public ClassDoc findClass(String className) |
public ClassDoc findClass(String className) |
134 |
{ |
{ |
135 |
String qualifiedName = Main.getRootDoc().resolveClassName(className, this); |
String qualifiedName = Main.getRootDoc().resolveClassName(className, this); |
714 |
typeName=typeName.substring(0,ndx).trim(); |
typeName=typeName.substring(0,ndx).trim(); |
715 |
} |
} |
716 |
|
|
717 |
ClassDoc classDoc = findClass(typeName); |
ClassDoc classDoc = findClass(typeName, dim); |
718 |
if (null!=classDoc) { |
if (null != classDoc) { |
719 |
try { |
return classDoc; |
|
if (classDoc.dimension().equals(dim)) { |
|
|
return classDoc; |
|
|
} |
|
|
else { |
|
|
Type rc = (Type) ((WritableType)classDoc).clone(); |
|
|
((WritableType)rc).setDimension(dim); |
|
|
return rc; |
|
|
} |
|
|
} |
|
|
catch (CloneNotSupportedException e) { |
|
|
throw new ParseException(e.toString()); |
|
|
} |
|
720 |
} |
} |
721 |
|
|
722 |
Type type = (Type)typeMap.get(typeName+dim); |
Type type = (Type)typeMap.get(typeName+dim); |