26 |
|
|
27 |
public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc, WritableType { |
public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc, WritableType { |
28 |
|
|
29 |
|
private ClassDoc baseClassDoc; |
30 |
private ClassDoc[] importedClasses; |
private ClassDoc[] importedClasses; |
31 |
private PackageDoc[] importedPackages; |
private PackageDoc[] importedPackages; |
32 |
private boolean definesSerializableFields; |
private boolean definesSerializableFields; |
38 |
PackageDoc containingPackage, |
PackageDoc containingPackage, |
39 |
int accessLevel, |
int accessLevel, |
40 |
boolean isFinal, |
boolean isFinal, |
41 |
boolean isStatic) { |
boolean isStatic, |
42 |
|
SourcePosition position) { |
43 |
super(containingClass, containingPackage, accessLevel, isFinal, isStatic, |
super(containingClass, containingPackage, accessLevel, isFinal, isStatic, |
44 |
null); |
position); |
45 |
|
this.baseClassDoc = this; |
46 |
} |
} |
47 |
|
|
48 |
public ClassDocImpl(ClassDoc containingClass, |
public ClassDocImpl(ClassDoc containingClass, |
49 |
PackageDoc containingPackage, |
PackageDoc containingPackage, |
50 |
ClassDoc[] importedClasses, |
ClassDoc[] importedClasses, |
51 |
PackageDoc[] importedPackages) { |
PackageDoc[] importedPackages, |
52 |
|
SourcePosition position) { |
53 |
super(containingClass, containingPackage, |
super(containingClass, containingPackage, |
54 |
null); |
position); |
55 |
this.importedClasses=importedClasses; |
this.importedClasses=importedClasses; |
56 |
this.importedPackages=importedPackages; |
this.importedPackages=importedPackages; |
57 |
|
this.baseClassDoc = this; |
58 |
} |
} |
59 |
|
|
60 |
// Return constructors in class. |
// Return constructors in class. |
262 |
ClassDocImpl rc=new ClassDocImpl(containingClass, |
ClassDocImpl rc=new ClassDocImpl(containingClass, |
263 |
containingPackage, |
containingPackage, |
264 |
importedClasses, |
importedClasses, |
265 |
importedPackages); |
importedPackages, |
266 |
|
null); |
267 |
|
rc.setPosition(ClassDocImpl.getPosition(rc, source, startIndex)); |
268 |
List implementedInterfaces = new ArrayList(); |
List implementedInterfaces = new ArrayList(); |
269 |
|
|
270 |
String word=""; |
String word=""; |
583 |
|
|
584 |
// return true if this Doc is include in the active set. |
// return true if this Doc is include in the active set. |
585 |
public boolean isIncluded() { |
public boolean isIncluded() { |
586 |
return isIncluded; // && Main.getRootDoc().includeAccessLevel(accessLevel); |
if (this == baseClassDoc) { |
587 |
|
return isIncluded; // && Main.getRootDoc().includeAccessLevel(accessLevel); |
588 |
|
} |
589 |
|
else { |
590 |
|
return baseClassDoc.isIncluded(); |
591 |
|
} |
592 |
} |
} |
593 |
|
|
594 |
void setIsIncluded(boolean b) { |
void setIsIncluded(boolean b) { |
619 |
ClassDoc classDoc = findClass(typeName); |
ClassDoc classDoc = findClass(typeName); |
620 |
if (null!=classDoc) { |
if (null!=classDoc) { |
621 |
try { |
try { |
622 |
Type rc = (Type) ((WritableType)classDoc).clone(); |
if (classDoc.dimension().equals(dim)) { |
623 |
((WritableType)rc).setDimension(dim); |
return classDoc; |
624 |
return rc; |
} |
625 |
|
else { |
626 |
|
Type rc = (Type) ((WritableType)classDoc).clone(); |
627 |
|
((WritableType)rc).setDimension(dim); |
628 |
|
return rc; |
629 |
|
} |
630 |
} |
} |
631 |
catch (CloneNotSupportedException e) { |
catch (CloneNotSupportedException e) { |
632 |
throw new ParseException(e.toString()); |
throw new ParseException(e.toString()); |
636 |
Type type = (Type)typeMap.get(typeName+dim); |
Type type = (Type)typeMap.get(typeName+dim); |
637 |
if (null!=type) { |
if (null!=type) { |
638 |
try { |
try { |
639 |
Type rc = (Type) ((WritableType)type).clone(); |
if (type.dimension().equals(dim)) { |
640 |
((WritableType)rc).setDimension(dim); |
return type; |
641 |
return rc; |
} |
642 |
|
else { |
643 |
|
Type rc = (Type) ((WritableType)type).clone(); |
644 |
|
((WritableType)rc).setDimension(dim); |
645 |
|
return rc; |
646 |
|
} |
647 |
} |
} |
648 |
catch (CloneNotSupportedException e) { |
catch (CloneNotSupportedException e) { |
649 |
throw new ParseException(e.toString()); |
throw new ParseException(e.toString()); |
727 |
int ndx=nameAndSignature.indexOf('('); |
int ndx=nameAndSignature.indexOf('('); |
728 |
if (ndx<=0) |
if (ndx<=0) |
729 |
return null; |
return null; |
730 |
else |
else { |
731 |
|
String fullSignature = resolveSignature(nameAndSignature.substring(ndx)); |
732 |
return findConstructor(nameAndSignature.substring(0,ndx), |
return findConstructor(nameAndSignature.substring(0,ndx), |
733 |
nameAndSignature.substring(ndx)); |
fullSignature); |
734 |
|
} |
735 |
} |
} |
736 |
|
|
737 |
public ConstructorDoc findConstructor(String name, String signature) { |
public ConstructorDoc findConstructor(String name, String signature) { |
746 |
|
|
747 |
public MethodDoc findMethod(String nameAndSignature) { |
public MethodDoc findMethod(String nameAndSignature) { |
748 |
int ndx=nameAndSignature.indexOf('('); |
int ndx=nameAndSignature.indexOf('('); |
749 |
if (ndx<=0) |
if (ndx<=0) { |
750 |
return null; |
return null; |
751 |
else |
} |
752 |
return findMethod(nameAndSignature.substring(0,ndx), |
else { |
753 |
nameAndSignature.substring(ndx)); |
String name = nameAndSignature.substring(0,ndx); |
754 |
|
String fullSignature = resolveSignature(nameAndSignature.substring(ndx)); |
755 |
|
return findMethod(name, fullSignature); |
756 |
|
} |
757 |
|
} |
758 |
|
|
759 |
|
private String resolveSignature(String signature) |
760 |
|
{ |
761 |
|
signature = signature.substring(1, signature.length() - 1); |
762 |
|
StringTokenizer st = new StringTokenizer(signature, ","); |
763 |
|
StringBuffer fullSignature = new StringBuffer("("); |
764 |
|
while (st.hasMoreTokens()) { |
765 |
|
String type = st.nextToken().trim(); |
766 |
|
int ndx = type.length(); |
767 |
|
while (ndx > 0 && type.charAt(ndx - 1) == '[' || type.charAt(ndx - 1) == ']') { |
768 |
|
-- ndx; |
769 |
|
} |
770 |
|
String dim = type.substring(ndx); |
771 |
|
type = type.substring(0, ndx); |
772 |
|
ClassDoc typeClass = findClass(type); |
773 |
|
if (fullSignature.length() > 1) { |
774 |
|
fullSignature.append(","); |
775 |
|
} |
776 |
|
if (null != typeClass) { |
777 |
|
fullSignature.append(typeClass.qualifiedName()); |
778 |
|
} |
779 |
|
else { |
780 |
|
fullSignature.append(type); |
781 |
|
} |
782 |
|
fullSignature.append(dim); |
783 |
|
} |
784 |
|
fullSignature.append(')'); |
785 |
|
return fullSignature.toString(); |
786 |
} |
} |
787 |
|
|
788 |
public MethodDoc findMethod(String name, String signature) { |
public MethodDoc findMethod(String name, String signature) { |
812 |
} |
} |
813 |
|
|
814 |
public Object clone() throws CloneNotSupportedException { |
public Object clone() throws CloneNotSupportedException { |
815 |
return super.clone(); |
ClassDocImpl result = (ClassDocImpl)super.clone(); |
816 |
|
result.baseClassDoc = baseClassDoc; |
817 |
|
return result; |
818 |
|
} |
819 |
|
|
820 |
|
public int superHashCode() |
821 |
|
{ |
822 |
|
return super.hashCode(); |
823 |
} |
} |
824 |
|
|
825 |
public int hashCode() |
public int hashCode() |
826 |
{ |
{ |
827 |
return qualifiedTypeName().hashCode(); |
return qualifiedTypeName().hashCode(); |
828 |
} |
} |
829 |
|
|
830 |
|
public ClassDoc getBaseClassDoc() |
831 |
|
{ |
832 |
|
return baseClassDoc; |
833 |
|
} |
834 |
} |
} |
835 |
|
|