Skip to content

Commit

Permalink
Fixed bug with MTT who give more than one answer at request
Browse files Browse the repository at this point in the history
  • Loading branch information
Anatoli-Grishenko committed Jan 2, 2023
1 parent 55593d2 commit bc29cc5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
1 change: 1 addition & 0 deletions src/agents/MTT.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ protected Status processAsynchronousMessages() {
if (Math.random() <= 0.5) {
this.Dialogue(this.respondTo(m, ACLMessage.REFUSE, "Sorry, but I decline your request", null));
forget(m);
return myStatus;
} else if (m.getContent().equals("BACKUP")) {
this.forget(m);
return this.onDemandBackup(m);
Expand Down
8 changes: 4 additions & 4 deletions src/agents/SSD.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public Status MyCheckin() {
problemManager = this.DFGetAllProvidersOf(service).get(0);
Info("Found problem manager " + problemManager);
problem = this.inputSelect("Please select problem to solve", problems, problem);
// defSessionAlias(inputLine("Please type in session ALIAS"));
defSessionAlias(Keygen.getHexaKey());
defSessionAlias(inputLine("Please type in session ALIAS"));
// defSessionAlias(Keygen.getHexaKey());
// problem = "CoruscantApr";
if (problem == null) {
return changeStatus(Status.CHECKOUT);
Expand Down Expand Up @@ -488,8 +488,8 @@ public void Draw(Graphics2D g) {
public void frameActionListener(ActionEvent e) {
if (e.getActionCommand().equals("Load Passport")) {
String passportfile;
// passportfile = OleDialog.doSelectFile("./", "passport");
passportfile = "config/ANATOLI_GRISHENKO.passport";
passportfile = OleDialog.doSelectFile("./", "passport");
// passportfile = "config/ANATOLI_GRISHENKO.passport";
if (passportfile != null) {
this.loadMyPassport(passportfile);
waitS.release();
Expand Down
28 changes: 7 additions & 21 deletions src/swing/OleApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.ObjectInputFilter.Status;
Expand Down Expand Up @@ -175,8 +176,10 @@ public void OleDraw(Graphics2D g) {

getMainPanel().add(osDiagram, BorderLayout.CENTER);
getMainPanel().validate();
this.addKeyListener(this);
this.pack();
for (KeyListener kl : this.getKeyListeners()) {
this.removeKeyListener(kl);
}
this.addKeyListener(this); this.pack();
return this;
}

Expand Down Expand Up @@ -266,12 +269,12 @@ public void keyTyped(KeyEvent e) {

@Override
public void keyPressed(KeyEvent e) {
// myKeyListener(e);
myKeyListener(e);
}

@Override
public void keyReleased(KeyEvent e) {
// myKeyListener(e);
myKeyListener(e);
}

public void cleanStatus() {
Expand Down Expand Up @@ -465,21 +468,4 @@ public boolean Confirm(String message) {
return bResult;
}

public JPanel getpMain() {
return pMain;
}

public JPanel getpStatus() {
return pStatus;
}

public JPanel getpToolBar() {
return pToolBar;
}

public JPanel getpHeader() {
return pHeader;
}


}
12 changes: 5 additions & 7 deletions src/swing/OleFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public OleFrame init() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
return this;
}

public void reDimension(Dimension d) {
setSize(d);
validate();
// pack();
}
@Override
public void actionPerformed(ActionEvent e) {
myActionListener(e);
Expand All @@ -54,12 +58,6 @@ public void actionPerformed(ActionEvent e) {
public abstract void myActionListener(ActionEvent e);

public abstract void myKeyListener(KeyEvent e);

public void reDimension(Dimension d) {
setSize(d);
validate();
// pack();
}

// public void Info(String message) {
// JOptionPane.showMessageDialog(this,
Expand Down

0 comments on commit bc29cc5

Please sign in to comment.