Skip to content
Snippets Groups Projects
Commit c9b96ac9 authored by Alan Birchler De Allende's avatar Alan Birchler De Allende
Browse files

Merge branch 'master' into 'alan_attack_tree_gen'

# Conflicts:
#   src/main/java/ui/atd/ATDAttack.java
#   src/main/java/ui/atd/AttackTreeDiagramPanel.java
parents efa94d92 b0fec70a
No related branches found
No related tags found
2 merge requests!489AI Attack Tree Generator, Version 3,!488AI Pipelines and AT Drawing Functionality
14744 14746
\ No newline at end of file \ No newline at end of file
...@@ -62,6 +62,7 @@ public class Attack extends AttackElement { ...@@ -62,6 +62,7 @@ public class Attack extends AttackElement {
private ArrayList<AttackNode> destinationNodes; private ArrayList<AttackNode> destinationNodes;
private boolean isRoot; private boolean isRoot;
private boolean isEnabled = true; private boolean isEnabled = true;
private String description;
private int attackCost; private int attackCost;
private int attackExperience; private int attackExperience;
...@@ -81,6 +82,14 @@ public class Attack extends AttackElement { ...@@ -81,6 +82,14 @@ public class Attack extends AttackElement {
isRoot = _root; isRoot = _root;
} }
public String getDescription() {
return description;
}
public void setDescription(String _description) {
description = _description;
}
public boolean isEnabled() { public boolean isEnabled() {
return isEnabled; return isEnabled;
} }
......
...@@ -76,6 +76,9 @@ public abstract class AttackNode extends AttackElement { ...@@ -76,6 +76,9 @@ public abstract class AttackNode extends AttackElement {
} }
public String getType() {
return type;
}
public void setResultingAttack(Attack _attack) { public void setResultingAttack(Attack _attack) {
resultingAttack = _attack; resultingAttack = _attack;
} }
......
...@@ -455,7 +455,10 @@ CanBeDisabled*/ { ...@@ -455,7 +455,10 @@ CanBeDisabled*/ {
return isRootAttack; return isRootAttack;
} }
public void setIsRootAttack(boolean bool) { isRootAttack = bool; } public void setRootAttack(boolean _isRootAttack) {
isRootAttack = _isRootAttack;
}
public void wasUnswallowed() { public void wasUnswallowed() {
setFather(null); setFather(null);
......
...@@ -253,6 +253,18 @@ public class ATDConstraint extends TGCScalableWithInternalComponent implements S ...@@ -253,6 +253,18 @@ public class ATDConstraint extends TGCScalableWithInternalComponent implements S
return (value.compareTo(STEREOTYPES[5]) == 0); return (value.compareTo(STEREOTYPES[5]) == 0);
} }
public void setType(String _type) {
_type = _type.toUpperCase();
for(int i=STEREOTYPES.length-1; i>0; i--) {
if (STEREOTYPES[i].indexOf(_type) > - 1) {
value = STEREOTYPES[i];
break;
}
}
value = STEREOTYPES[0];
}
protected String translateExtraParam() { protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n"); StringBuffer sb = new StringBuffer("<extraparam>\n");
sb.append("<info equation=\"" + GTURTLEModeling.transformString(getEquation())); sb.append("<info equation=\"" + GTURTLEModeling.transformString(getEquation()));
......
...@@ -203,13 +203,8 @@ public class AttackTreeDiagramPanel extends TDiagramPanel implements TDPWithAttr ...@@ -203,13 +203,8 @@ public class AttackTreeDiagramPanel extends TDiagramPanel implements TDPWithAttr
// We draw the attack // We draw the attack
ATDAttack attack = new ATDAttack(_x, _y, getMinX(), getMaxX(), getMinY(), getMaxY(), true, null, this); ATDAttack attack = new ATDAttack(_x, _y, getMinX(), getMaxX(), getMinY(), getMaxY(), true, null, this);
attack.setValue(_att.getName()); attack.setValue(_att.getName());
attack.setIsRootAttack(_att.isRoot()); attack.setRootAttack(_att.isRoot());
attack.setDescription(_att.getDescription());
String attackDesc = _att.getDescription();
if (!attackDesc.isEmpty()) {
attack.setDescription(attackDesc);
}
addBuiltComponent(attack); addBuiltComponent(attack);
_mapOfComponents.put(_att, attack); _mapOfComponents.put(_att, attack);
...@@ -253,11 +248,8 @@ public class AttackTreeDiagramPanel extends TDiagramPanel implements TDPWithAttr ...@@ -253,11 +248,8 @@ public class AttackTreeDiagramPanel extends TDiagramPanel implements TDPWithAttr
// We create the ATDConstraint // We create the ATDConstraint
_y = _y + 70; _y = _y + 70;
ATDConstraint constraint = new ATDConstraint(_x, _y, getMinX(), getMaxX(), getMinY(), getMaxY(), true, null, this); ATDConstraint constraint = new ATDConstraint(_x, _y, getMinX(), getMaxX(), getMinY(), getMaxY(), true, null, this);
//constraint.setValue(nextNode.getName());
String contraintType = "<<" + nextNode.getType() + ">>"; constraint.setType(nextNode.getType());
constraint.setValue(contraintType);
addBuiltComponent(constraint); addBuiltComponent(constraint);
_mapOfComponents.put(nextNode, constraint); _mapOfComponents.put(nextNode, constraint);
......
...@@ -50,8 +50,8 @@ package ui.util; ...@@ -50,8 +50,8 @@ package ui.util;
*/ */
public class DefaultText { public class DefaultText {
public static String BUILD = "14743"; public static String BUILD = "14745";
public static String DATE = "2024/04/09 03:22:30 CET"; public static String DATE = "2024/04/11 03:22:09 CET";
public static StringBuffer sbAbout = makeAbout(); public static StringBuffer sbAbout = makeAbout();
......
...@@ -218,6 +218,7 @@ public class JFrameAI extends JFrame implements ActionListener { ...@@ -218,6 +218,7 @@ public class JFrameAI extends JFrame implements ActionListener {
chatPanelAction.add(listOfPossibleActions); chatPanelAction.add(listOfPossibleActions);
panelTop.add(chatPanelAction, BorderLayout.CENTER); panelTop.add(chatPanelAction, BorderLayout.CENTER);
listOfPossibleActions.addActionListener(this); listOfPossibleActions.addActionListener(this);
listOfPossibleActions.setMinimumSize(new Dimension(50, 100));
JPanel modelSelectionPanel = new JPanel(); JPanel modelSelectionPanel = new JPanel();
modelSelectionPanel.add(new JLabel("Selected AI model:")); modelSelectionPanel.add(new JLabel("Selected AI model:"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment