[Swift-commit] r3167 - in trunk/src/org/griphyn/vdl/type: . impl
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Fri Oct 16 16:53:10 CDT 2009
Author: hategan
Date: 2009-10-16 16:53:10 -0500 (Fri, 16 Oct 2009)
New Revision: 3167
Modified:
trunk/src/org/griphyn/vdl/type/Type.java
trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java
trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java
Log:
added isComposite() to distinguish between array or struct and non-array and non-struct types
Modified: trunk/src/org/griphyn/vdl/type/Type.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/Type.java 2009-10-16 20:14:48 UTC (rev 3166)
+++ trunk/src/org/griphyn/vdl/type/Type.java 2009-10-16 21:53:10 UTC (rev 3167)
@@ -52,6 +52,11 @@
public URI getNamespaceURI();
boolean isArray();
+
+ /**
+ * Returns true if this type is a composite type (array or struct).
+ */
+ boolean isComposite();
/**
* set the full name as a QName
Modified: trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java 2009-10-16 20:14:48 UTC (rev 3166)
+++ trunk/src/org/griphyn/vdl/type/impl/TypeImpl.java 2009-10-16 21:53:10 UTC (rev 3167)
@@ -107,8 +107,13 @@
public void setPrimitive() {
primitive = true;
}
+
- private static class Array extends TypeImpl {
+ public boolean isComposite() {
+ return isArray() || !fields.isEmpty();
+ }
+
+ private static class Array extends TypeImpl {
private Field field;
/** Constructs an array that will contain elements of the
Modified: trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java
===================================================================
--- trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java 2009-10-16 20:14:48 UTC (rev 3166)
+++ trunk/src/org/griphyn/vdl/type/impl/UnresolvedType.java 2009-10-16 21:53:10 UTC (rev 3167)
@@ -86,8 +86,12 @@
public boolean isArray() {
return this.name.endsWith("[]");
}
+
+ public boolean isComposite() {
+ return isArray();
+ }
- public void setBaseType(Type base) {
+ public void setBaseType(Type base) {
throw new UnsupportedOperationException();
}
More information about the Swift-commit
mailing list