|
@@ -71,7 +71,7 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
//access
|
|
|
private ArrayList<AccessWrapper> access;
|
|
|
LinkedList<List<Boolean>> resetChain = new LinkedList<List<Boolean>>();
|
|
|
-
|
|
|
+ boolean algoUseElements = true, algoUseSwitches = true, algoUseFlexes = true;
|
|
|
|
|
|
//time
|
|
|
private long startTime;
|
|
@@ -141,6 +141,24 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
progressBar.setStringPainted(true);
|
|
|
parameterPanel.add(progressBar);
|
|
|
|
|
|
+ JCheckBox useElements = new JCheckBox("Elements");
|
|
|
+ useElements.setSelected(algoUseElements);
|
|
|
+ useElements.setBounds(500, 70, 185, 20);
|
|
|
+ useElements.addActionListener(actionEvent -> algoUseElements = useElements.isSelected());
|
|
|
+ parameterPanel.add(useElements);
|
|
|
+
|
|
|
+ JCheckBox useSwitches = new JCheckBox("Switches");
|
|
|
+ useSwitches.setSelected(algoUseSwitches);
|
|
|
+ useSwitches.setBounds(500, 90, 185, 20);
|
|
|
+ useSwitches.addActionListener(actionEvent -> algoUseSwitches = useSwitches.isSelected());
|
|
|
+ parameterPanel.add(useSwitches);
|
|
|
+
|
|
|
+
|
|
|
+ JCheckBox useFlexes = new JCheckBox("Flexibilities");
|
|
|
+ useFlexes.setSelected(algoUseFlexes);
|
|
|
+ useFlexes.setBounds(500, 110, 185, 20);
|
|
|
+ useFlexes.addActionListener(actionEvent -> algoUseFlexes = useFlexes.isSelected());
|
|
|
+ parameterPanel.add(useFlexes);
|
|
|
return parameterPanel;
|
|
|
}
|
|
|
private JPanel createButtonPanel() {
|
|
@@ -425,9 +443,11 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
List<Boolean> initialState = new ArrayList<Boolean>();
|
|
|
rollOutNodes((useGroupNode && (dGroupNode != null))? dGroupNode.getModel().getNodes() :model.getObjectsOnCanvas(), initialState, model.getCurIteration());
|
|
|
resetChain.add(initialState);
|
|
|
- for(FlexWrapper flex :control.getSimManager().getActualFlexManager().getAllFlexWrapperWithState(FlexState.OFFERED)){
|
|
|
- access.add(new AccessWrapper(flex.getFlex()));
|
|
|
- initialState.add(false);
|
|
|
+ if(algoUseFlexes) {
|
|
|
+ for(FlexWrapper flex :control.getSimManager().getActualFlexManager().getAllFlexWrapperWithState(FlexState.OFFERED)){
|
|
|
+ access.add(new AccessWrapper(flex.getFlex()));
|
|
|
+ initialState.add(false);
|
|
|
+ }
|
|
|
}
|
|
|
console.println(access.stream().map(Object::toString).collect(Collectors.joining(", ")));
|
|
|
return initialState;
|
|
@@ -441,13 +461,13 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
*/
|
|
|
private void rollOutNodes(List<AbstractCpsObject> nodes, List<Boolean> positionToInit, int timeStep) {
|
|
|
for(AbstractCpsObject aCps : nodes) {
|
|
|
- if (aCps instanceof HolonObject) {
|
|
|
+ if (aCps instanceof HolonObject && algoUseElements) {
|
|
|
for (HolonElement hE : ((HolonObject) aCps).getElements()) {
|
|
|
positionToInit.add(hE.isActive());
|
|
|
access.add(new AccessWrapper(hE));
|
|
|
}
|
|
|
}
|
|
|
- else if (aCps instanceof HolonSwitch) {
|
|
|
+ else if (aCps instanceof HolonSwitch&& algoUseSwitches) {
|
|
|
HolonSwitch sw = (HolonSwitch) aCps;
|
|
|
positionToInit.add(sw.getState(timeStep));
|
|
|
access.add(new AccessWrapper(sw));
|
|
@@ -591,15 +611,10 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
hSwitch.setManualState(state);
|
|
|
break;
|
|
|
case FLEXIBILITY:
|
|
|
-
|
|
|
if(state) {
|
|
|
- console.println("Flex True");
|
|
|
- if(flex == null) console.println("flex == null");
|
|
|
- if(control.getSimManager() == null) console.println("control.getSimManager() == null");
|
|
|
- if(control.getSimManager().getActualFlexManager() == null) console.println("control.getSimManager().getActualFlexManager() == null");
|
|
|
+// if(control.getSimManager() == null) console.println("control.getSimManager() == null");
|
|
|
+// if(control.getSimManager().getActualFlexManager() == null) console.println("control.getSimManager().getActualFlexManager() == null");
|
|
|
control.getSimManager().getActualFlexManager().orderFlex(flex);
|
|
|
- }else {
|
|
|
- console.println("Flex false");
|
|
|
}
|
|
|
break;
|
|
|
default:
|