ActionInsertFact ins = new ActionInsertFact(ac.factType);
a.action = ins;
actions.add(a);
}
ActionInsertFact ins = (ActionInsertFact) a.action;
ActionFieldValue val = new ActionFieldValue(ac.factField, cell, ac.type);
ins.addFieldValue(val);
} else if (c instanceof ActionRetractFactCol) {
ActionRetractFactCol rf = (ActionRetractFactCol)c;
LabelledAction a = findByLabelledAction(actions, rf.boundName);
if (a == null) {
a = new LabelledAction();
a.action = new ActionRetractFact(rf.boundName);
a.boundName = rf.boundName;
actions.add(a);
}
} else if (c instanceof ActionSetFieldCol) {
ActionSetFieldCol sf = (ActionSetFieldCol)c;
LabelledAction a = findByLabelledAction(actions, sf.boundName);
if (a == null) {
a = new LabelledAction();
a.boundName = sf.boundName;
if (!sf.update) {
a.action = new ActionSetField(sf.boundName);
} else {
a.action = new ActionUpdateField(sf.boundName);
}
actions.add(a);
} else if (sf.update && !(a.action instanceof ActionUpdateField)) {
//lets swap it out for an update as the user has asked for it.
ActionSetField old = (ActionSetField) a.action;
ActionUpdateField update = new ActionUpdateField(sf.boundName);
update.fieldValues = old.fieldValues;
a.action = update;
}
ActionSetField asf = (ActionSetField) a.action;
ActionFieldValue val = new ActionFieldValue(sf.factField, cell, sf.type);
asf.addFieldValue(val);
}
}
}