protected synchronized boolean addPlugin(Plugin toAdd)
throws UndefinedTaggedTypeException {
assert toAdd != null;
plugins[size] = toAdd;
TaggedType in = PluginController.getInstance().getPluginIO(toAdd).get(
"In")[0];
switch (in) {
case NULL:
plugins[size] = toAdd;
break;
case VECTOR:
ports[size] = PortFactory.createPort(PluginController.getInstance()
.getPluginIO(toAdd).get("In"));
plugins[size] = toAdd;
size++;
break;
case DOUBLE:
case INT:
case STRING:
case LONG:
plugins[size] = toAdd;
try {
ports[size] = PortFactory.createPort(in);
} catch (UndefinedTaggedTypeException e) {
BackendLogger.getInstance().throwing(
this.getClass().toString(), "addPlugin(" + toAdd + ")",
e);
e.printStackTrace();
plugins[size] = null;
return false;
}
size++;
break;
default:
throw new UndefinedTaggedTypeException(in.toString());
}
if (size > capacity * .7) {
resize();
}
return true;