Merging mk rev. 519 and some more bug fixing (introspection) in synch with MK branch

This commit is contained in:
Marcel Kronfeld 2010-04-23 09:11:25 +00:00
parent 6ea578615c
commit 6923956e29
3 changed files with 8 additions and 5 deletions

View File

@ -151,7 +151,7 @@ public class BeanInspector {
sbuf.append(delim);
if (!tight) sbuf.append(" ");
}
if (!tight) sbuf.setCharAt(sbuf.length()-2, ' ');
if (!tight && (sbuf.charAt(sbuf.length()-2) == delim)) sbuf.setCharAt(sbuf.length()-2, ' '); // delete the delim
sbuf.setCharAt(sbuf.length()-1, ']');
return sbuf.toString();
}
@ -331,6 +331,8 @@ public class BeanInspector {
return meth.invoke(obj, args);
} catch(Exception e) {
System.err.println("Error on calling method "+mName + " on " + obj.getClass().getName());
System.err.println("Object: " + obj.toString() + ", method name: " + mName);
System.err.println("Arguments were " + BeanInspector.toString(args));
e.printStackTrace();
return null;
}
@ -348,7 +350,7 @@ public class BeanInspector {
if (o==null) return null;
Class[] clz = new Class[o.length];
for (int i=0; i<o.length; i++) {
clz[i]=o.getClass();
clz[i]=o[i].getClass();
}
return clz;
}
@ -388,7 +390,7 @@ public class BeanInspector {
if (paramTypes!=null && (methParamTypes.length==paramTypes.length)) {
boolean mismatch = false; int i=0;
while ((i<methParamTypes.length) && (!mismatch)) {
if (!methParamTypes[i].equals(paramTypes[i])) mismatch=true;
if (!methParamTypes[i].isAssignableFrom(paramTypes[i])) mismatch=true;
i++;
}
if (!mismatch) return method; // parameter match, otherwise search on

View File

@ -150,6 +150,7 @@ public class ParameterControlManager implements InterfaceParameterControl, Seria
/**
* Retrieve a list of objects which are properties of the given target object (retrievable by a
* getter method) and which implement the getParamControl method.
* This can be used to avoid a GUI layer as stated in the class comment.
*
* @param target
* @return

View File

@ -310,7 +310,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
else if (terminator instanceof EvaluationTerminator)
args = new Object[] {optimizer, optimizer.getPopulation(), optimizer.getPopulation().getFunctionCalls(), ((EvaluationTerminator)terminator).getFitnessCalls()};
// ((InterfaceParameterControl)paramCtrl).updateParameters(optimizer, optimizer.getPopulation().getFunctionCalls(), ((EvaluationTerminator)terminator).getFitnessCalls());
else args = new Object[]{optimizer, optimizer.getPopulation()};
else args = new Object[]{optimizer};
// ((InterfaceParameterControl)paramCtrl).updateParameters(optimizer);
if (args != null) { // only if iteration counting is available