[Swift-commit] r2349 - trunk/src/org/griphyn/vdl/karajan/lib
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Thu Nov 27 16:52:03 CST 2008
Author: benc
Date: 2008-11-27 16:52:02 -0600 (Thu, 27 Nov 2008)
New Revision: 2349
Modified:
trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
Log:
remove dead code from filename and tighten up some method signatures on helper methods
Modified: trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java 2008-11-27 21:44:04 UTC (rev 2348)
+++ trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java 2008-11-27 22:52:02 UTC (rev 2349)
@@ -173,40 +173,16 @@
public static final String[] EMPTY_STRING_ARRAY = new String[0];
- /**
- * Given a field (or Collection of fields) on the stack, returns the
- * filename(s) that are mapped that field(s).
- */
public String[] filename(VariableStack stack) throws ExecutionException {
- Object ovar = PA_VAR.getValue(stack);
- if (ovar instanceof DSHandle) {
- try {
- return filename((DSHandle) ovar);
- }
- catch (HandleOpenException e) {
- throw new FutureNotYetAvailable(addFutureListener(stack, e.getSource()));
- }
+ DSHandle ovar = (DSHandle)PA_VAR.getValue(stack);
+ try {
+ return filename(ovar);
}
- else if (ovar instanceof Collection) {
- return filename((Collection) ovar);
+ catch (HandleOpenException e) {
+ throw new FutureNotYetAvailable(addFutureListener(stack, e.getSource()));
}
- else {
- return new String[0];
- }
- }
+ }
- public String[] filename(Collection vars) throws ExecutionException {
- // assume here that the Collection is all DSHandles
- Iterator iterator = vars.iterator();
- ArrayList out = new ArrayList();
- while (iterator.hasNext()) {
- DSHandle h = (DSHandle) iterator.next();
- String filename = leafFileName(h);
- out.add(filename);
- }
- return (String[]) out.toArray(EMPTY_STRING_ARRAY);
- }
-
public String[] filename(DSHandle var) throws ExecutionException, HandleOpenException {
try {
if (var.getType().isArray()) {
@@ -221,7 +197,7 @@
}
}
- public String[] leavesFileNames(DSHandle var) throws ExecutionException, HandleOpenException {
+ private String[] leavesFileNames(DSHandle var) throws ExecutionException, HandleOpenException {
List l = new ArrayList();
Iterator i;
try {
@@ -292,7 +268,7 @@
}
}
- public String leafFileName(DSHandle var) throws ExecutionException {
+ private String leafFileName(DSHandle var) throws ExecutionException {
if (Types.STRING.equals(var.getType())) {
return relativize(String.valueOf(var.getValue()));
}
@@ -394,17 +370,6 @@
}
}
- protected String getFileName(VariableStack stack) throws ExecutionException {
- DSHandle var = (DSHandle) PA_VAR.getValue(stack);
- try {
- Path path = parsePath(PA_PATH.getValue(stack), stack);
- return leafFileName(var.getField(path));
- }
- catch (InvalidPathException e) {
- throw new ExecutionException(e);
- }
- }
-
protected boolean compatible(Type expectedType, Type actualType) {
if (expectedType.equals(Types.FLOAT)) {
if (actualType.equals(Types.FLOAT) || actualType.equals(Types.INT)) {
More information about the Swift-commit
mailing list