{
String s = inherited.get(j).toString().intern();
//Make sure that the inheritance list doesn't contain itself or a package.
if (!s.equals(debug) && !s.equals(otherPackage))
{
QName q = new QName(s);
if (!q.getLocalPart().equals(""))
{
assert !((q.getLocalPart().equals(cls)) && (q.getNamespace().equals(pkg))) : "same class";
inherit.add(q);
}
}
}
}
}
else if (current.def instanceof FunctionDefinitionNode)
{
FunctionDefinitionNode fd = (FunctionDefinitionNode)current.def;
debug = fd.fexpr.debug_name;
int colon = debug.indexOf(':');
int slash = debug.indexOf('/');
if (colon < 0)
{
pkg = "";
if (slash < 0) //when there's only a name (Ex. debug == Foobar)
cls = "";
else //when there happens to be a slash (Ex. debug == Class/Function)
cls = debug.substring(0, slash).intern();
}
else
{
pkg = debug.substring(0, colon).intern();
if (slash < 0) //when you have debug == packageName:Function
cls = "";
else if (slash < colon) //when debug == className/private:something (mxml case)
{
pkg = "";
cls = debug.substring(0, slash).intern();
}
else //when debug == packageName:className/Function
cls = debug.substring(colon + 1, slash).intern();
}
}
else if (current.def instanceof VariableDefinitionNode)
{
VariableBindingNode vb = (VariableBindingNode)(((VariableDefinitionNode)current.def).list.items.get(0));
debug = vb.debug_name;
int colon = debug.indexOf(':');
int slash = debug.indexOf('/');
if (colon < 0)
{
pkg = "";
if (slash < 0)
cls = "";
else
cls = debug.substring(0, slash).intern();
}
else
{
pkg = debug.substring(0, colon).intern();
if (slash < 0)
cls = "";
else if (slash < colon)
{
pkg = "";
cls = debug.substring(0, slash).intern();
}
else
cls = debug.substring(colon + 1, slash).intern();
}
}
//Add to list for other classes (they will be in a separate package)
if (!pkg.equals(packageName))
{
if (cls.equals(""))
cls = "null";
List<DocCommentNode> l = otherClasses.get(cls);
if (l == null)
l = new ArrayList<DocCommentNode>();
l.add(current);
otherClasses.put(cls, l);
}
else //Add to list for public class
mainClass.add(current);
}
if (mainDef) //there exists a public class definition
this.put(name, mainClass, inheritance, exclude, cx, abcClass);
else //null classname for package level functions
this.put(new QName(packageName, "null"), mainClass, inheritance, exclude, cx, abcClass);
//for classes outside the package but in the same sourcefile (should be private, but we exclude anyway)
if (otherPackage != null)
{
Iterator<String> iter = otherClasses.keySet().iterator();
while (iter.hasNext())
{
//Add other classes under asc generated package name
String cls = iter.next().intern();
this.put(new QName(otherPackage, cls), otherClasses.get(cls), otherInheritance.get(cls), true, cx, abcClass);
}
}
//This is to ensure that the packageTable contains all the package names (as keys).
if (!packageTable.containsKey(packageName))