From d83bec61030bfe9a702f16466f119e02260327c5 Mon Sep 17 00:00:00 2001 From: dblouin <dominique.blouin@telecom-paristech.fr> Date: Tue, 7 Mar 2017 15:37:18 +0100 Subject: [PATCH] Issue #17: Limit the size of opening dialogs to the size of the screen + general code review --- src/TMLTranslator.java | 7 +- src/avatartranslator/AvatarPragma.java | 22 +- .../AvatarPragmaAuthenticity.java | 17 +- .../AvatarPragmaInitialKnowledge.java | 23 +- src/avatartranslator/AvatarRelation.java | 69 ++- src/avatartranslator/AvatarSpecification.java | 183 +++--- .../toproverif/AVATAR2ProVerif.java | 59 +- src/avatartranslator/totpn/AVATAR2TPN.java | 26 +- .../touppaal/AVATAR2UPPAAL.java | 78 +-- src/ddtranslator/DDStructSynchro.java | 39 +- src/ddtranslator/DDTranslator.java | 12 +- .../AvatarddSpecification.java | 67 +-- .../toSoclib/TasksAndMainGenerator.java | 85 ++- src/dseengine/DSEConfiguration.java | 33 +- src/myutil/Conversion.java | 20 +- src/myutil/SortedVector.java | 13 +- src/sddescription/HMSC.java | 68 +-- src/sddescription/HMSCNode.java | 48 +- src/sddescription/MSC.java | 109 ++-- src/sdtranslator/SDTranslator.java | 350 ++++++------ src/tmatrix/RequirementModeling.java | 38 +- src/tmltranslator/HwNode.java | 1 - src/tmltranslator/TMLActivityElement.java | 4 +- src/tmltranslator/TMLModeling.java | 357 +++++++----- src/tmltranslator/toautomata/TML2AUT.java | 2 +- .../toautomata/TML2AUTviaLOTOS.java | 34 +- src/tmltranslator/toavatar/TML2Avatar.java | 452 ++++++++------- .../tomappingsystemc/MappedSystemCTask.java | 20 +- .../tomappingsystemc/TML2MappingSystemC.java | 77 +-- .../toproverif/TML2ProVerif.java | 308 ++++++----- src/tmltranslator/tosystemc/TML2SystemC.java | 54 +- src/tmltranslator/toturtle/TML2TURTLE.java | 61 +- src/tmltranslator/touppaal/TML2UPPAAL.java | 34 +- src/translator/ADComponent.java | 12 +- src/translator/ActivityDiagram.java | 17 +- src/translator/Gate.java | 13 +- src/translator/GroupOfGates.java | 21 +- src/translator/MasterGateManager.java | 89 +-- src/translator/Param.java | 3 +- src/translator/TClass.java | 34 +- src/ui/ActivityDiagramPanelInterface.java | 3 +- src/ui/AnalysisPanelTranslator.java | 79 ++- src/ui/AvatarDeploymentPanelTranslator.java | 18 +- src/ui/AvatarDesignPanel.java | 30 +- src/ui/AvatarDesignPanelTranslator.java | 69 +-- src/ui/ClassDiagramPanelInterface.java | 2 +- src/ui/CorrespondanceTGElement.java | 26 +- src/ui/DesignPanel.java | 7 +- src/ui/DesignPanelTranslator.java | 30 +- src/ui/EBRDDTranslator.java | 11 +- src/ui/GProactiveDesign.java | 481 ++++++++-------- src/ui/GTMLModeling.java | 520 +++++++++--------- src/ui/GTURTLEModeling.java | 491 ++++++++++------- src/ui/MainGUI.java | 122 ++-- src/ui/TAttribute.java | 6 +- src/ui/TClassInterface.java | 6 +- src/ui/TClassSynchroInterface.java | 4 +- src/ui/TDiagramMouseManager.java | 9 +- src/ui/TDiagramPanel.java | 36 +- src/ui/TGCAttributeBox.java | 10 +- src/ui/TGComponent.java | 58 +- src/ui/TGConnector.java | 18 +- src/ui/TMLArchiPanel.java | 4 +- src/ui/TMLCommunicationPatternPanel.java | 12 +- src/ui/TMLComponentDesignPanel.java | 52 +- src/ui/TMLDesignPanel.java | 18 +- src/ui/TURTLEPanel.java | 9 +- src/ui/TURTLEPanelPopupListener.java | 105 ++-- src/ui/ad/TActivityDiagramPanel.java | 11 +- src/ui/atd/ATDAttack.java | 21 +- src/ui/atd/ATDConstraint.java | 27 +- src/ui/avatarbd/AvatarBDBlock.java | 4 +- src/ui/avatarbd/AvatarBDDataType.java | 31 +- src/ui/avatarbd/AvatarBDFirewall.java | 22 +- src/ui/avatarbd/AvatarBDLibraryFunction.java | 4 +- src/ui/avatarbd/AvatarBDPortConnector.java | 10 +- src/ui/avatarbd/AvatarBDPragma.java | 10 +- src/ui/avatarbd/AvatarBDSafetyPragma.java | 21 +- src/ui/avatardd/ADDBlockArtifact.java | 15 +- src/ui/avatardd/ADDBusNode.java | 19 +- src/ui/avatardd/ADDCPUNode.java | 22 +- src/ui/avatardd/ADDChannelArtifact.java | 32 +- src/ui/avatardd/ADDCommunicationNode.java | 10 - src/ui/avatardd/ADDCoproMWMRNode.java | 16 +- src/ui/avatardd/ADDCrossbarNode.java | 12 +- src/ui/avatardd/ADDICUNode.java | 15 +- src/ui/avatardd/ADDMemoryNode.java | 13 +- src/ui/avatardd/ADDRAMNode.java | 15 +- src/ui/avatardd/ADDTTYNode.java | 15 +- src/ui/avatardd/ADDTimerNode.java | 15 +- src/ui/avatardd/ADDVgmnNode.java | 15 +- .../AvatarMADVersioningConnector.java | 7 +- .../AvatarMethodologyDiagramReference.java | 18 +- .../avatarpd/AvatarPDLogicalConstraint.java | 15 +- src/ui/avatarpd/AvatarPDProperty.java | 7 +- .../avatarpd/AvatarPDPropertyConnector.java | 9 +- src/ui/avatarpd/AvatarPDPropertyRelation.java | 15 +- src/ui/avatarrd/AvatarRDRequirement.java | 22 +- src/ui/avatarsmd/AvatarSMDExpireTimer.java | 8 +- .../AvatarSMDLibraryFunctionCall.java | 11 +- src/ui/avatarsmd/AvatarSMDRandom.java | 14 +- src/ui/avatarsmd/AvatarSMDReceiveSignal.java | 8 +- src/ui/avatarsmd/AvatarSMDResetTimer.java | 8 +- src/ui/avatarsmd/AvatarSMDSendSignal.java | 8 +- src/ui/avatarsmd/AvatarSMDSetTimer.java | 8 +- src/ui/avatarsmd/AvatarSMDTransitionInfo.java | 14 +- src/ui/cd/TCDAttributeBox.java | 6 +- src/ui/cd/TCDReducedAttributeBox.java | 2 +- src/ui/cd/TCDReducedAttributeGateBox.java | 3 +- src/ui/cd/TCDSynchroGateList.java | 10 +- src/ui/cd/TCDTClass.java | 30 +- src/ui/cd/TCDTData.java | 22 +- src/ui/cd/TCDTObject.java | 36 +- src/ui/cd/TClassDiagramPanel.java | 18 +- src/ui/cd/TGCReducedAttributeBox.java | 14 +- src/ui/dd/TDDArtifact.java | 23 +- src/ui/dd/TDDNode.java | 18 +- src/ui/dd/TDeploymentDiagramPanel.java | 25 +- src/ui/dd/TGConnectorLinkNode.java | 14 +- ...DiplodocusMethodologyDiagramReference.java | 18 +- src/ui/ebrdd/EBRDDAttributeBox.java | 4 +- src/ui/ebrdd/EBRDDERB.java | 10 +- src/ui/ebrdd/EBRDDESO.java | 26 +- src/ui/ebrdd/EBRDDForLoop.java | 14 +- src/ui/ncdd/NCConnectorNode.java | 13 +- src/ui/ncdd/NCEqNode.java | 8 +- src/ui/ncdd/NCRouteArtifact.java | 12 +- src/ui/ncdd/NCSwitchNode.java | 10 +- src/ui/ncdd/NCTrafficArtifact.java | 13 +- src/ui/oscd/TOSCDAttributeBox.java | 13 +- src/ui/oscd/TOSClass.java | 26 +- .../ProActiveCompSpecificationCSDPanel.java | 2 - src/ui/procsd/ProCSDComponent.java | 48 +- src/ui/procsd/ProCSDInterface.java | 7 +- src/ui/procsd/ProCSDPort.java | 323 ++++++----- src/ui/procsd/ProactiveCSDPanel.java | 47 +- src/ui/req/Requirement.java | 21 +- src/ui/req/RequirementDiagramPanel.java | 20 +- src/ui/req/TAttributeObserver.java | 6 +- src/ui/sd/SDAbsoluteTimeConstraint.java | 10 +- src/ui/sd/SDInstance.java | 11 +- src/ui/sd/SDTimerSetting.java | 12 +- src/ui/sd/TGConnectorRelativeTimeSD.java | 10 +- .../SysmlsecMethodologyDiagramReference.java | 18 +- src/ui/tmlad/TGConnectorTMLAD.java | 3 +- src/ui/tmlad/TMLADDecrypt.java | 36 +- src/ui/tmlad/TMLADEncrypt.java | 73 ++- src/ui/tmlad/TMLADForLoop.java | 14 +- src/ui/tmlad/TMLADNotifiedEvent.java | 14 +- src/ui/tmlad/TMLADRandom.java | 14 +- src/ui/tmlad/TMLADReadChannel.java | 10 +- src/ui/tmlad/TMLADReadRequestArg.java | 10 +- src/ui/tmlad/TMLADSendEvent.java | 10 +- src/ui/tmlad/TMLADSendRequest.java | 10 +- src/ui/tmlad/TMLADWaitEvent.java | 10 +- src/ui/tmlad/TMLADWriteChannel.java | 28 +- src/ui/tmlcd/TMLAttributeBox.java | 4 +- src/ui/tmlcd/TMLChannelProperties.java | 14 +- src/ui/tmlcd/TMLEventProperties.java | 6 +- src/ui/tmlcd/TMLRequestProperties.java | 6 +- src/ui/tmlcompd/TMLCCompositeComponent.java | 18 +- src/ui/tmlcompd/TMLCPrimitiveComponent.java | 34 +- src/ui/tmlcompd/TMLCPrimitivePort.java | 8 +- src/ui/tmlcompd/TMLCRecordComponent.java | 23 +- .../TMLCRemoteCompositeComponent.java | 32 +- .../TMLComponentTaskDiagramPanel.java | 477 ++++++++-------- src/ui/tmlcp/TMLCPForLoop.java | 14 +- src/ui/tmldd/TMLArchiArtifact.java | 13 +- src/ui/tmldd/TMLArchiBUSNode.java | 13 +- src/ui/tmldd/TMLArchiBridgeNode.java | 13 +- src/ui/tmldd/TMLArchiCPNode.java | 17 +- .../tmldd/TMLArchiCommunicationArtifact.java | 13 +- src/ui/tmldd/TMLArchiCrossbarNode.java | 13 +- src/ui/tmldd/TMLArchiDMANode.java | 13 +- src/ui/tmldd/TMLArchiEventArtifact.java | 13 +- src/ui/tmldd/TMLArchiFirewallNode.java | 16 +- src/ui/tmldd/TMLArchiHWANode.java | 12 +- src/ui/tmldd/TMLArchiKey.java | 15 +- src/ui/tmldd/TMLArchiMemoryNode.java | 13 +- src/ui/tmldd/TMLArchiPortArtifact.java | 16 +- src/ui/tmldd/TMLArchiVGMNNode.java | 13 +- src/ui/tmlsd/TGConnectorMessageTMLSD.java | 57 +- src/ui/tmlsd/TMLSDTransferInstance.java | 14 +- src/ui/tree/GraphTree.java | 2 +- src/ui/tree/InvariantDataTree.java | 2 +- src/ui/tree/SyntaxAnalysisErrorTree.java | 6 +- src/ui/tree/SyntaxAnalysisWarningTree.java | 6 +- src/ui/ucd/UCDUseCase.java | 18 +- src/ui/window/JDialogAttribute.java | 20 +- ...JDialogAvatarExecutableCodeGeneration.java | 8 +- ...ialogAvatarddExecutableCodeGeneration.java | 15 +- src/ui/window/JDialogGenAUT.java | 13 +- src/ui/window/JDialogGenAUTS.java | 20 +- src/ui/window/JDialogModelChecking.java | 15 +- src/ui/window/JDialogPortArtifact.java | 66 +-- src/ui/window/JDialogProjection.java | 18 +- src/ui/window/JDialogReducedAttribute.java | 4 +- src/ui/window/JDialogReferenceCP.java | 91 ++- src/ui/window/JDialogSearchBox.java | 16 +- src/ui/window/JDialogSelectCPDiagrams.java | 39 +- src/ui/window/JDialogSelectRequirements.java | 46 +- src/ui/window/JDialogSelectTMLComponent.java | 52 +- src/ui/window/JDialogSelectTMLNodes.java | 46 +- src/ui/window/JDialogSelectTMLTask.java | 43 +- src/ui/window/JDialogSynchro.java | 16 +- src/ui/window/JDialogUPPAALValidation.java | 19 +- src/uppaaldesc/UPPAALSpec.java | 25 +- src/uppaaldesc/UPPAALTransition.java | 8 +- 208 files changed, 4224 insertions(+), 4187 deletions(-) diff --git a/src/TMLTranslator.java b/src/TMLTranslator.java index 7504b9a395..e1a90b6b98 100755 --- a/src/TMLTranslator.java +++ b/src/TMLTranslator.java @@ -47,9 +47,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.util.ArrayList; +import java.util.List; -//import uppaaldesc.*; import myutil.FileUtils; import tmltranslator.TMLError; import tmltranslator.TMLMapping; @@ -190,7 +189,7 @@ public class TMLTranslator { TMLMappingTextSpecification spec = new TMLMappingTextSpecification(title); ret = spec.makeTMLMapping(inputData, path); System.out.println("load ended"); - ArrayList<TMLError> warnings; + List<TMLError> warnings; if (!ret) { System.out.println("Compilation:\n" + spec.printSummary()); @@ -232,7 +231,7 @@ public class TMLTranslator { public static boolean loadTML(String title) { boolean ret = false; - ArrayList<TMLError> warnings; + List<TMLError> warnings; //System.out.println("load"); TMLTextSpecification spec = new TMLTextSpecification(title, true); ret = spec.makeTMLModeling(inputData); diff --git a/src/avatartranslator/AvatarPragma.java b/src/avatartranslator/AvatarPragma.java index 4f1eea15bb..134916b807 100644 --- a/src/avatartranslator/AvatarPragma.java +++ b/src/avatartranslator/AvatarPragma.java @@ -68,11 +68,11 @@ public abstract class AvatarPragma extends AvatarElement { proofStatus = status; } - public static LinkedList<AvatarPragma> createFromString(String str, Object obj, LinkedList<AvatarBlock> blocks, HashMap<String, LinkedList<TAttribute>> typeAttributesMap, HashMap<String, String> nameTypeMap, ErrorAccumulator errorAcc){ + public static List<AvatarPragma> createFromString(String str, Object obj, List<AvatarBlock> blocks, Map<String, List<TAttribute>> typeAttributesMap, Map<String, String> nameTypeMap, ErrorAccumulator errorAcc){ //createFromString takes in a pragma string (with # removed), the containing object, and the list of AvatarBlocks, and returns the corresponding AvatarPragma or null if an error occurred //The attributes referenced must exist - LinkedList<AvatarPragma> pragmas = new LinkedList<AvatarPragma>(); + List<AvatarPragma> pragmas = new LinkedList<AvatarPragma>(); AvatarBDPragma pragmaObj = (AvatarBDPragma) obj; //Remove leading spaces str = str.trim(); @@ -144,9 +144,10 @@ public abstract class AvatarPragma extends AvatarElement { } //Generate a fun lot of pragmas... //For each attribute, generate an authenticity pragma - LinkedList<TAttribute> typeAttrs = typeAttributesMap.get(nameTypeMap.get(blockName1+"."+attrName1)); + List<TAttribute> typeAttrs = typeAttributesMap.get(nameTypeMap.get(blockName1+"."+attrName1)); + for (TAttribute ta: typeAttrs) { - LinkedList<AvatarAttributeState> attrStates = new LinkedList<AvatarAttributeState>(); + List<AvatarAttributeState> attrStates = new LinkedList<AvatarAttributeState>(); String suffix = ta.getId(); for (String arg: args){ AvatarAttributeState res = parseAuthAttr(arg+"__"+suffix, blocks); @@ -287,10 +288,12 @@ public abstract class AvatarPragma extends AvatarElement { } pragmas.add(new AvatarPragmaInitialKnowledge(str, obj, attrs, header.equals("InitialSystemKnowledge"))); } else { - LinkedList<TAttribute> typeAttrs = typeAttributesMap.get(types.first()); + List<TAttribute> typeAttrs = typeAttributesMap.get(types.first()); + for (TAttribute ta: typeAttrs) { - LinkedList<AvatarAttribute> attrs = new LinkedList<AvatarAttribute>(); + List<AvatarAttribute> attrs = new LinkedList<AvatarAttribute>(); String suffix = ta.getId(); + for (String arg: args){ String[] sp = arg.split("\\."); String blockName = sp[0]; @@ -323,7 +326,8 @@ public abstract class AvatarPragma extends AvatarElement { String attrName = sp[1]; if (nameTypeMap.containsKey(blockName+"."+attrName)){ //Composed type, YAY#$%^&* - LinkedList<TAttribute> typeAttrs = typeAttributesMap.get(nameTypeMap.get(blockName+"."+attrName)); + List<TAttribute> typeAttrs = typeAttributesMap.get(nameTypeMap.get(blockName+"."+attrName)); + for (TAttribute ta: typeAttrs) { String suffix = ta.getId(); AvatarAttribute res = parseAttr(blockName, attrName+"__"+suffix, blocks); @@ -368,7 +372,7 @@ public abstract class AvatarPragma extends AvatarElement { } return pragmas; } - public static AvatarAttribute parseAttr(String blockName, String attrName, LinkedList<AvatarBlock> blocks){ + public static AvatarAttribute parseAttr(String blockName, String attrName, List<AvatarBlock> blocks){ //Iterate through blocks for (AvatarBlock block:blocks){ if (block.getName().equals(blockName)){ @@ -379,7 +383,7 @@ public abstract class AvatarPragma extends AvatarElement { TraceManager.addDev("Pragma Attribute Block not found "+ blockName); return null; } - public static AvatarAttributeState parseAuthAttr(String arg, LinkedList<AvatarBlock> blocks){ + public static AvatarAttributeState parseAuthAttr(String arg, List<AvatarBlock> blocks){ //Iterate through the list of blocks String[] split = arg.split("\\."); String blockName = split[0]; diff --git a/src/avatartranslator/AvatarPragmaAuthenticity.java b/src/avatartranslator/AvatarPragmaAuthenticity.java index 56b9f4b76d..c1b9204e9f 100644 --- a/src/avatartranslator/AvatarPragmaAuthenticity.java +++ b/src/avatartranslator/AvatarPragmaAuthenticity.java @@ -47,28 +47,27 @@ package avatartranslator; import java.util.*; -import myutil.*; - - public class AvatarPragmaAuthenticity extends AvatarPragma { private AvatarAttributeState attrA; private AvatarAttributeState attrB; - public AvatarPragmaAuthenticity(String _name, Object _referenceObject, LinkedList<AvatarAttributeState> args) { + public AvatarPragmaAuthenticity(String _name, Object _referenceObject, List<AvatarAttributeState> args) { super(_name, _referenceObject); - attrA= args.get(0); - attrB= args.get(1); + + attrA= args.get(0); + attrB= args.get(1); } public AvatarPragmaAuthenticity(String _name, Object _referenceObject, AvatarAttributeState a, AvatarAttributeState b) { super(_name, _referenceObject); - attrA= a; - attrB= b; + + attrA= a; + attrB= b; } public AvatarAttributeState getAttrA(){ - return attrA; + return attrA; } public AvatarAttributeState getAttrB(){ diff --git a/src/avatartranslator/AvatarPragmaInitialKnowledge.java b/src/avatartranslator/AvatarPragmaInitialKnowledge.java index 51fa037d5a..6622210b2b 100644 --- a/src/avatartranslator/AvatarPragmaInitialKnowledge.java +++ b/src/avatartranslator/AvatarPragmaInitialKnowledge.java @@ -47,33 +47,36 @@ package avatartranslator; import java.util.*; -import myutil.*; - - public class AvatarPragmaInitialKnowledge extends AvatarPragma { - private LinkedList<AvatarAttribute> arguments; + private List<AvatarAttribute> arguments; private boolean isSystem; - public AvatarPragmaInitialKnowledge(String _name, Object _referenceObject, LinkedList<AvatarAttribute> args, boolean isSystem) { + public AvatarPragmaInitialKnowledge(String _name, Object _referenceObject, List<AvatarAttribute> args, boolean isSystem) { super(_name, _referenceObject); + arguments = args; - this.isSystem = isSystem; + this.isSystem = isSystem; } - public LinkedList<AvatarAttribute> getArgs(){ - return arguments; + + public List<AvatarAttribute> getArgs(){ + return arguments; } + public boolean isSystem(){ - return isSystem; + return isSystem; } @Override public AvatarPragmaInitialKnowledge advancedClone (AvatarSpecification avspec) { - LinkedList<AvatarAttribute> l = new LinkedList<AvatarAttribute> (); + List<AvatarAttribute> l = new LinkedList<AvatarAttribute> (); + for (AvatarAttribute aa: this.arguments) l.add (avspec.getMatchingAttribute (aa)); + AvatarPragmaInitialKnowledge result = new AvatarPragmaInitialKnowledge (this.name, this.referenceObject, l, this.isSystem); this.cloneLinkToReferenceObjects (result); + return result; } } diff --git a/src/avatartranslator/AvatarRelation.java b/src/avatartranslator/AvatarRelation.java index b79ded3215..548f6d1275 100644 --- a/src/avatartranslator/AvatarRelation.java +++ b/src/avatartranslator/AvatarRelation.java @@ -49,13 +49,11 @@ package avatartranslator; import java.util.*; -import myutil.*; - public class AvatarRelation extends AvatarElement { public AvatarBlock block1, block2; - private LinkedList<AvatarSignal> signals1, signals2; + private List<AvatarSignal> signals1, signals2; private boolean blocking, asynchronous, isPrivate, isBroadcast, isLossy; private int sizeOfFIFO; // -1 means infinite public int id;//DG @@ -249,39 +247,36 @@ public class AvatarRelation extends AvatarElement { signals2 = signals2_tmp; }*/ - public AvatarRelation advancedClone(HashMap<AvatarBlock, AvatarBlock> correspondenceBlocks) { - AvatarBlock b1, b2; - b1 = correspondenceBlocks.get(block1); - b2 = correspondenceBlocks.get(block2); - if ((b1 == null) || (b2 == null)) { - return null; - } - AvatarRelation ar = new AvatarRelation(getName(), b1, b2, getReferenceObject()); - ar.setAsynchronous(isAsynchronous()); - ar.setBlocking(isBlocking()); - ar.setPrivate(isPrivate()); - ar.setBroadcast(isBroadcast()); - ar.setLossy(isLossy()); - ar.setSizeOfFIFO(getSizeOfFIFO()); - - // Signals - for(int i=0; i<signals1.size(); i++) { - AvatarSignal s1 = getSignal1(i); - AvatarSignal s2 = getSignal2(i); - - AvatarSignal ns1 = b1.getSignalByName(s1.getName()); - AvatarSignal ns2 = b2.getSignalByName(s2.getName()); - if ((ns1 == null) || (ns2 == null)) { - continue; - } - ar.addSignals(ns1, ns2); - } - - cloneLinkToReferenceObjects(ar); - - return ar; + public AvatarRelation advancedClone( Map<AvatarBlock, AvatarBlock> correspondenceBlocks) { + AvatarBlock b1, b2; + b1 = correspondenceBlocks.get(block1); + b2 = correspondenceBlocks.get(block2); + if ((b1 == null) || (b2 == null)) { + return null; + } + AvatarRelation ar = new AvatarRelation(getName(), b1, b2, getReferenceObject()); + ar.setAsynchronous(isAsynchronous()); + ar.setBlocking(isBlocking()); + ar.setPrivate(isPrivate()); + ar.setBroadcast(isBroadcast()); + ar.setLossy(isLossy()); + ar.setSizeOfFIFO(getSizeOfFIFO()); + + // Signals + for(int i=0; i<signals1.size(); i++) { + AvatarSignal s1 = getSignal1(i); + AvatarSignal s2 = getSignal2(i); + + AvatarSignal ns1 = b1.getSignalByName(s1.getName()); + AvatarSignal ns2 = b2.getSignalByName(s2.getName()); + if ((ns1 == null) || (ns2 == null)) { + continue; + } + ar.addSignals(ns1, ns2); + } + + cloneLinkToReferenceObjects(ar); + + return ar; } - - - } diff --git a/src/avatartranslator/AvatarSpecification.java b/src/avatartranslator/AvatarSpecification.java index 931d3c15c2..059c167392 100644 --- a/src/avatartranslator/AvatarSpecification.java +++ b/src/avatartranslator/AvatarSpecification.java @@ -49,20 +49,18 @@ package avatartranslator; import java.util.*; - -import avatartranslator.modelchecker.*; import myutil.*; public class AvatarSpecification extends AvatarElement { public static String[] ops = {">", "<", "+", "-", "*", "/", "[", "]", "(", ")", ":", "=", "==", ",", "!", "?", "{", "}", "|", "&"}; - private LinkedList<AvatarBlock> blocks; - private LinkedList<AvatarRelation> relations; + private List<AvatarBlock> blocks; + private List<AvatarRelation> relations; /** * The list of all library functions that can be called. */ - private LinkedList<AvatarLibraryFunction> libraryFunctions; + private List<AvatarLibraryFunction> libraryFunctions; private String applicationCode; @@ -91,7 +89,7 @@ public class AvatarSpecification extends AvatarElement { this.libraryFunctions = new LinkedList<AvatarLibraryFunction> (); } - public LinkedList<AvatarLibraryFunction> getListOfLibraryFunctions () { + public List<AvatarLibraryFunction> getListOfLibraryFunctions () { return this.libraryFunctions; } @@ -134,21 +132,21 @@ public class AvatarSpecification extends AvatarElement { return informationSource; } - public LinkedList<AvatarBlock> getListOfBlocks() { + public List<AvatarBlock> getListOfBlocks() { return blocks; } - public LinkedList<AvatarRelation> getRelations() { + public List<AvatarRelation> getRelations() { return relations; } - public LinkedList<AvatarPragma> getPragmas() { + public List<AvatarPragma> getPragmas() { return pragmas; } - public LinkedList<String> getSafetyPragmas() { + public List<String> getSafetyPragmas() { return safety_pragmas; } - public LinkedList<AvatarConstant> getAvatarConstants() { + public List<AvatarConstant> getAvatarConstants() { return constants; } @@ -172,13 +170,16 @@ public class AvatarSpecification extends AvatarElement { } //DG - public boolean ASynchronousExist(){ - LinkedList<AvatarRelation> asynchro = getRelations(); - for ( AvatarRelation ar : asynchro ) - if (ar.isAsynchronous()) - return true; - return false; + public boolean ASynchronousExist(){ + List<AvatarRelation> asynchro = getRelations(); + + for ( AvatarRelation ar : asynchro ) + if (ar.isAsynchronous()) + return true; + + return false; } + // end DG public void addBlock(AvatarBlock _block) { blocks.add(_block); @@ -299,27 +300,27 @@ public class AvatarSpecification extends AvatarElement { addBlock(addedBlocks.get(i)); } } - - private void renameTimers() { - // Check whether timers have the same name in different blocks - ArrayList<AvatarAttribute> allTimers = new ArrayList<AvatarAttribute>(); - for(AvatarBlock block: blocks) { - allTimers.clear(); - block.putAllTimers(allTimers); - for(AvatarAttribute att: allTimers) { - for(AvatarBlock bl: blocks) { - if (block != bl) { - if (bl.hasTimer(att.getName())) { - // Must change name of timer - TraceManager.addDev("Changing name of Timer:" + att); - att.setName(att.getName() + "__" + block.getName()); - } - } - } - } - } - - } +// +// private void renameTimers() { +// // Check whether timers have the same name in different blocks +// ArrayList<AvatarAttribute> allTimers = new ArrayList<AvatarAttribute>(); +// for(AvatarBlock block: blocks) { +// allTimers.clear(); +// block.putAllTimers(allTimers); +// for(AvatarAttribute att: allTimers) { +// for(AvatarBlock bl: blocks) { +// if (block != bl) { +// if (bl.hasTimer(att.getName())) { +// // Must change name of timer +// TraceManager.addDev("Changing name of Timer:" + att); +// att.setName(att.getName() + "__" + block.getName()); +// } +// } +// } +// } +// } +// +// } /** * Removes all FIFOs by replacing them with @@ -581,63 +582,63 @@ public class AvatarSpecification extends AvatarElement { } public AvatarSpecification advancedClone() { - AvatarSpecification spec = new AvatarSpecification(this.getName(), this.getReferenceObject()); - HashMap<AvatarBlock, AvatarBlock> correspondenceBlocks = new HashMap<AvatarBlock, AvatarBlock>(); - - // Cloning block definition - for(AvatarBlock block: blocks) { - AvatarBlock nB = block.advancedClone(spec); - correspondenceBlocks.put(block, nB); - spec.addBlock(nB); - } - - // Handling the clone of fathers - for(AvatarBlock block: blocks) { - AvatarBlock father = block.getFather(); - if (father != null) { - AvatarBlock nb = spec.getBlockWithName(block.getName()); - if (nb != null) { - AvatarBlock nf = spec.getBlockWithName(father.getName()); - if (nf != null) { - TraceManager.addDev("Setting "+ nf.getName() + " as the father of " + nb.getName()); - nb.setFather(nf); + AvatarSpecification spec = new AvatarSpecification(this.getName(), this.getReferenceObject()); + Map<AvatarBlock, AvatarBlock> correspondenceBlocks = new HashMap<AvatarBlock, AvatarBlock>(); + + // Cloning block definition + for(AvatarBlock block: blocks) { + AvatarBlock nB = block.advancedClone(spec); + correspondenceBlocks.put(block, nB); + spec.addBlock(nB); + } + + // Handling the clone of fathers + for(AvatarBlock block: blocks) { + AvatarBlock father = block.getFather(); + if (father != null) { + AvatarBlock nb = spec.getBlockWithName(block.getName()); + if (nb != null) { + AvatarBlock nf = spec.getBlockWithName(father.getName()); + if (nf != null) { + TraceManager.addDev("Setting "+ nf.getName() + " as the father of " + nb.getName()); + nb.setFather(nf); + } + } } } - } - } - - // Cloning asm - for(AvatarBlock block: blocks) { - AvatarBlock nb = spec.getBlockWithName(block.getName()); - block.getStateMachine().advancedClone(nb.getStateMachine(), nb); - } - - // Relations - for(AvatarRelation relation: relations) { - AvatarRelation nR = relation.advancedClone(correspondenceBlocks); - if (nR != null) { - spec.addRelation(nR); - } - } - - /*for(AvatarPragma pragma: pragmas) { - AvatarPragma nP = pragma.advancedClone(); - spec.addPragma(nP); - }*/ - - for(String safetyPragma: safety_pragmas) { - spec.addSafetyPragma(safetyPragma); - } - - for(AvatarConstant constant: constants) { - AvatarConstant cN = constant.advancedClone(); - spec.addConstant(cN); - } + + // Cloning asm + for(AvatarBlock block: blocks) { + AvatarBlock nb = spec.getBlockWithName(block.getName()); + block.getStateMachine().advancedClone(nb.getStateMachine(), nb); + } + + // Relations + for(AvatarRelation relation: relations) { + AvatarRelation nR = relation.advancedClone(correspondenceBlocks); + if (nR != null) { + spec.addRelation(nR); + } + } + + /*for(AvatarPragma pragma: pragmas) { + AvatarPragma nP = pragma.advancedClone(); + spec.addPragma(nP); + }*/ + + for(String safetyPragma: safety_pragmas) { + spec.addSafetyPragma(safetyPragma); + } + + for(AvatarConstant constant: constants) { + AvatarConstant cN = constant.advancedClone(); + spec.addConstant(cN); + } - spec.setInformationSource(getInformationSource()); - spec.addApplicationCode(getApplicationCode()); + spec.setInformationSource(getInformationSource()); + spec.addApplicationCode(getApplicationCode()); - return spec; + return spec; } public AvatarAttribute getMatchingAttribute (AvatarAttribute aa) { diff --git a/src/avatartranslator/toproverif/AVATAR2ProVerif.java b/src/avatartranslator/toproverif/AVATAR2ProVerif.java index 1b5f76e359..a95368b344 100755 --- a/src/avatartranslator/toproverif/AVATAR2ProVerif.java +++ b/src/avatartranslator/toproverif/AVATAR2ProVerif.java @@ -46,14 +46,12 @@ package avatartranslator.toproverif; import java.util.LinkedList; +import java.util.List; import java.util.HashMap; import java.util.HashSet; -import java.util.Vector; import java.io.*; import javax.swing.*; - -import javax.xml.parsers.*; import ui.ConfigurationTTool; import ui.CheckingError; import ui.AvatarDesignPanel; @@ -125,7 +123,7 @@ public class AVATAR2ProVerif implements AvatarTranslator { //Our hash is saved in config String hashCode= Integer.toString(this.spec.getStringSpec().hashCode()); File file = new File(path); - BufferedReader br; + BufferedReader br = null; if (file.exists()){ String hash = ConfigurationTTool.ProVerifHash; if (!hash.equals("")){ @@ -142,9 +140,18 @@ public class AVATAR2ProVerif implements AvatarTranslator { return false; } } - br.close(); +// br.close(); } catch (Exception e) { - // + e.printStackTrace(); + } + finally { + if ( br != null ) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } } } @@ -184,7 +191,7 @@ public class AVATAR2ProVerif implements AvatarTranslator { this.dummyDataCounter = 0; - LinkedList<AvatarAttribute> allKnowledge = this.makeStartingProcess(); + List<AvatarAttribute> allKnowledge = this.makeStartingProcess(); this.makeHeader(); @@ -474,8 +481,8 @@ public class AVATAR2ProVerif implements AvatarTranslator { this.spec.addDeclaration (new ProVerifFunc (PEANO_N, new String[] {"bitstring"}, "bitstring")); /* Declare all the call__*** variables */ - LinkedList<AvatarBlock> blocks = this.avspec.getListOfBlocks(); - String action = "("; + List<AvatarBlock> blocks = this.avspec.getListOfBlocks(); + // String action = "("; for(AvatarBlock block: blocks) { HashMap<AvatarStateMachineElement, Integer> simplifiedElements = block.getStateMachine ().getSimplifiedElements (); if (simplifiedElements.get (block.getStateMachine ().getStartState ()) == null) @@ -588,7 +595,7 @@ public class AVATAR2ProVerif implements AvatarTranslator { } } - private LinkedList<AvatarAttribute> makeStartingProcess() { + private List<AvatarAttribute> makeStartingProcess() { TraceManager.addDev("\n\n=+=+=+ Making Starting Process +=+=+="); // Create starting process @@ -596,7 +603,7 @@ public class AVATAR2ProVerif implements AvatarTranslator { ProVerifProcInstr lastInstr = p; // Get all the blocks - LinkedList<AvatarBlock> blocks = avspec.getListOfBlocks(); + List<AvatarBlock> blocks = avspec.getListOfBlocks(); // Used to store the names that are public keys this.pubs = new HashMap<AvatarAttribute, AvatarAttribute> (); @@ -604,11 +611,11 @@ public class AVATAR2ProVerif implements AvatarTranslator { if (pragma instanceof AvatarPragmaPrivatePublicKey) this.pubs.put (((AvatarPragmaPrivatePublicKey) pragma).getPublicKey (), ((AvatarPragmaPrivatePublicKey) pragma).getPrivateKey ()); - String blockName, paramName; + //String blockName, paramName; // Store all the names that are system knowledge // Enable to raise warning when an attribute is both system and session knowledge - LinkedList<AvatarAttribute> systemKnowledge = new LinkedList<AvatarAttribute> (); + List<AvatarAttribute> systemKnowledge = new LinkedList<AvatarAttribute> (); this.nameEquivalence = new HashMap<AvatarAttribute, AvatarAttribute> (); @@ -664,7 +671,7 @@ public class AVATAR2ProVerif implements AvatarTranslator { containsPublicKey = this.nameEquivalence.get (privateK); // Let the public key - lastInstr = lastInstr.setNextInstr (new ProVerifProcLet (new ProVerifVar[] {new ProVerifVar (AVATAR2ProVerif.translateTerm (first, null), "bitstring")}, PK_PK + "(" + privateKStr + ")"));; + lastInstr = lastInstr.setNextInstr (new ProVerifProcLet (new ProVerifVar[] {new ProVerifVar (AVATAR2ProVerif.translateTerm (first, null), "bitstring")}, PK_PK + "(" + privateKStr + ")")); // Make the public key public tmpInstr = new ProVerifProcRaw ("out (" + CH_MAINCH + ", " + AVATAR2ProVerif.translateTerm (first, null) + ");"); } else @@ -807,7 +814,7 @@ public class AVATAR2ProVerif implements AvatarTranslator { // Concatenate system and session knowledge systemKnowledge.addAll (sessionKnowledge); - LinkedList<ProVerifVar> processArgs = this.getProVerifVarFromAttr (systemKnowledge); + List<ProVerifVar> processArgs = this.getProVerifVarFromAttr (systemKnowledge); processArgs.add (new ProVerifVar ("sessionID", "bitstring")); // Call every start process @@ -826,18 +833,21 @@ public class AVATAR2ProVerif implements AvatarTranslator { /** * Generate ProVerif code for each process for each Avatar block */ - private void makeBlocks(LinkedList<AvatarAttribute> allKnowledge) { + private void makeBlocks( List<AvatarAttribute> allKnowledge) { TraceManager.addDev("\n\n=+=+=+ Making Blocks +=+=+="); - LinkedList<AvatarBlock> blocks = avspec.getListOfBlocks(); + List<AvatarBlock> blocks = avspec.getListOfBlocks(); + for(AvatarBlock block: blocks) makeBlock(block, allKnowledge); } - private LinkedList<ProVerifVar> getProVerifVarFromAttr (LinkedList<AvatarAttribute> attrs) { - LinkedList<ProVerifVar> result = new LinkedList<ProVerifVar> (); + private List<ProVerifVar> getProVerifVarFromAttr (List<AvatarAttribute> attrs) { + List<ProVerifVar> result = new LinkedList<ProVerifVar> (); + for(AvatarAttribute aa: attrs) result.add (new ProVerifVar (AVATAR2ProVerif.translateTerm (aa, null), "bitstring")); + return result; } @@ -845,20 +855,21 @@ public class AVATAR2ProVerif implements AvatarTranslator { * Compute a list of ProVerifVar corresponding to the attributes of the block */ private ProVerifVar[] getAttributesFromBlock (AvatarBlock ab) { - LinkedList<ProVerifVar> result = this.getProVerifVarFromAttr (ab.getAttributes ()); + List<ProVerifVar> result = this.getProVerifVarFromAttr (ab.getAttributes ()); + return result.toArray (new ProVerifVar[result.size ()]); } /** * Generate ProVerif code for one Avatar block */ - private void makeBlock(AvatarBlock ab, LinkedList<AvatarAttribute> _allKnowledge) { + private void makeBlock(AvatarBlock ab, List<AvatarAttribute> _allKnowledge) { TraceManager.addDev("\nAvatarBlock: " + ab.getName ()); - LinkedList<AvatarAttribute> allKnowledge = (LinkedList<AvatarAttribute>) _allKnowledge.clone (); + List<AvatarAttribute> allKnowledge = new LinkedList<AvatarAttribute>( _allKnowledge );//.clone(); // Create first ProVerif process for this block and add it to the ProVerif specification - LinkedList<ProVerifVar> knowledgeArray = this.getProVerifVarFromAttr (allKnowledge); - LinkedList<ProVerifVar> processArgs = (LinkedList<ProVerifVar>) knowledgeArray.clone (); + List<ProVerifVar> knowledgeArray = this.getProVerifVarFromAttr (allKnowledge); + List<ProVerifVar> processArgs = new LinkedList<ProVerifVar>( knowledgeArray );//.clone (); processArgs.add (new ProVerifVar ("sessionID", "bitstring")); ProVerifProcInstr lastInstr = new ProVerifProcess(ab.getName() + "__start", processArgs.toArray (new ProVerifVar[processArgs.size ()])); diff --git a/src/avatartranslator/totpn/AVATAR2TPN.java b/src/avatartranslator/totpn/AVATAR2TPN.java index 096ee084b4..f73e774b28 100755 --- a/src/avatartranslator/totpn/AVATAR2TPN.java +++ b/src/avatartranslator/totpn/AVATAR2TPN.java @@ -45,7 +45,6 @@ package avatartranslator.totpn; -import java.awt.*; import java.util.*; import tpndescription.*; @@ -54,20 +53,20 @@ import avatartranslator.*; public class AVATAR2TPN { - private static int GENERAL_ID = 0; + // private static int GENERAL_ID = 0; private TPN tpn; private AvatarSpecification avspec; - private Hashtable<AvatarStateMachineElement, Place> entryPlaces; - private Hashtable<AvatarStateMachineElement, Place> exitPlaces; - private LinkedList<AvatarActionOnSignal> sendActions; - private LinkedList<AvatarActionOnSignal> receiveActions; + private Map<AvatarStateMachineElement, Place> entryPlaces; + private Map<AvatarStateMachineElement, Place> exitPlaces; + private List<AvatarActionOnSignal> sendActions; + private List<AvatarActionOnSignal> receiveActions; - private Vector warnings; + // private Vector warnings; @@ -77,13 +76,13 @@ public class AVATAR2TPN { - public Vector getWarnings() { - return warnings; - } +// public Vector getWarnings() { +// return warnings; +// } public TPN generateTPN(boolean _debug, boolean _optimize) { - GENERAL_ID = 0; + // GENERAL_ID = 0; entryPlaces = new Hashtable<AvatarStateMachineElement, Place>(); exitPlaces = new Hashtable<AvatarStateMachineElement, Place>(); @@ -91,7 +90,7 @@ public class AVATAR2TPN { sendActions = new LinkedList<AvatarActionOnSignal>(); receiveActions = new LinkedList<AvatarActionOnSignal>(); - warnings = new Vector(); + // warnings = new Vector(); tpn = new TPN(); avspec.removeCompositeStates(); @@ -112,7 +111,8 @@ public class AVATAR2TPN { } public void makeBlocks() { - LinkedList<AvatarBlock> blocks = avspec.getListOfBlocks(); + java.util.List<AvatarBlock> blocks = avspec.getListOfBlocks(); + for(AvatarBlock block: blocks) { makeBlock(block); } diff --git a/src/avatartranslator/touppaal/AVATAR2UPPAAL.java b/src/avatartranslator/touppaal/AVATAR2UPPAAL.java index 286667f0a8..160038df26 100755 --- a/src/avatartranslator/touppaal/AVATAR2UPPAAL.java +++ b/src/avatartranslator/touppaal/AVATAR2UPPAAL.java @@ -67,11 +67,11 @@ public class AVATAR2UPPAAL { private int currentX, currentY; - private LinkedList gatesNotSynchronized; // String - private LinkedList gatesSynchronized; - private LinkedList gatesSynchronizedRelations; - private LinkedList gatesAsynchronized; - private LinkedList<String> unoptStates; + private java.util.List<String> gatesNotSynchronized; // String + private java.util.List<String> gatesSynchronized; + private java.util.List<AvatarRelation> gatesSynchronizedRelations; + private java.util.List<String> gatesAsynchronized; + private java.util.List<String> unoptStates; private int nbOfIntParameters, nbOfBooleanParameters; private Hashtable <AvatarStateMachineElement, UPPAALLocation> hash; @@ -161,7 +161,7 @@ public class AVATAR2UPPAAL { avspec.removeTimers(); //avspec.removeFIFOs(2); avspec.makeRobustness(); - LinkedList<String> uppaalPragmas = avspec.getSafetyPragmas(); + java.util.List<String> uppaalPragmas = avspec.getSafetyPragmas(); unoptStates= new LinkedList<String>(); for (String s: uppaalPragmas){ String[] split = s.split("[^a-zA-Z0-9\\.]"); @@ -175,11 +175,11 @@ public class AVATAR2UPPAAL { //TraceManager.addDev("-> Spec:" + avspec.toString()); UPPAALLocation.reinitID(); - gatesNotSynchronized = new LinkedList(); + gatesNotSynchronized = new LinkedList<String>(); gatesNotSynchronized.add("makeChoice"); - gatesSynchronized = new LinkedList(); - gatesSynchronizedRelations = new LinkedList(); - gatesAsynchronized = new LinkedList(); + gatesSynchronized = new LinkedList<String>(); + gatesSynchronizedRelations = new LinkedList<AvatarRelation>(); + gatesAsynchronized = new LinkedList<String>(); // Deal with blocks translateBlocks(); @@ -258,7 +258,7 @@ public class AVATAR2UPPAAL { } public void translationRelations() { - AvatarSignal si1, sig2; + // AvatarSignal si1, sig2; for(AvatarRelation ar: avspec.getRelations()) { if (ar.isAsynchronous()) { for(int i=0; i<ar.nbOfSignals(); i++) { @@ -356,7 +356,7 @@ public class AVATAR2UPPAAL { } public void makeMethods(AvatarBlock _block, UPPAALTemplate _template) { - String s; + //String s; for(AvatarMethod method: _block.getMethods()) { gatesNotSynchronized.add(_block.getName() + "__" + method.getName()); } @@ -380,9 +380,9 @@ public class AVATAR2UPPAAL { spec.addGlobalDeclaration("\n//Declarations used for non synchronized gates\n"); String action; - ListIterator iterator = gatesNotSynchronized.listIterator(); + Iterator<String> iterator = gatesNotSynchronized.listIterator(); while(iterator.hasNext()) { - action = (String)(iterator.next()); + action = iterator.next(); tr = addTransition(templateNotSynchronized, loc, loc); setSynchronization(tr, action+"?"); //addGuard(tr, action + TURTLE2UPPAAL.SYNCID + " == 0"); @@ -411,13 +411,13 @@ public class AVATAR2UPPAAL { spec.addTemplate(templateAsynchronous); UPPAALLocation loc = addLocation(templateAsynchronous); templateAsynchronous.setInitLocation(loc); - UPPAALTransition tr, tr1; + UPPAALTransition tr;//, tr1; spec.addGlobalDeclaration("\n//Declarations for asynchronous channels\n"); String action; - ListIterator iterator = gatesAsynchronized.listIterator(); + Iterator<String> iterator = gatesAsynchronized.listIterator(); while(iterator.hasNext()) { - action = (String)(iterator.next()); + action = iterator.next(); spec.addGlobalDeclaration("urgent chan " + action + ";\n"); } @@ -515,11 +515,11 @@ public class AVATAR2UPPAAL { String action; AvatarRelation ar; - ListIterator iterator = gatesSynchronized.listIterator(); - ListIterator iterator0 = gatesSynchronizedRelations.listIterator(); + Iterator<String> iterator = gatesSynchronized.listIterator(); + Iterator<AvatarRelation> iterator0 = gatesSynchronizedRelations.listIterator(); while(iterator.hasNext()) { - action = (String)(iterator.next()); - ar = (AvatarRelation)(iterator0.next()); + action = iterator.next(); + ar = iterator0.next(); if (!(ar.isBroadcast())) { spec.addGlobalDeclaration("urgent chan " + action + ";\n"); } else { @@ -549,13 +549,13 @@ public class AVATAR2UPPAAL { } public void makeElementBehavior(AvatarBlock _block, UPPAALTemplate _template, AvatarStateMachineElement _elt, UPPAALLocation _previous, UPPAALLocation _end, String _guard, boolean _previousState, boolean _severalTransitions) { - AvatarActionOnSignal aaos; + // AvatarActionOnSignal aaos; UPPAALLocation loc, loc1; UPPAALTransition tr; AvatarTransition at; - int i, j; - String tmps, tmps0; - AvatarAttribute aa; + int i;//, j; + String tmps;//, tmps0; + // AvatarAttribute aa; AvatarState state; AvatarRandom arand; @@ -740,7 +740,7 @@ public class AVATAR2UPPAAL { TraceManager.addDev("[CHECKING] Action on signal ??? " + _aaos.getSignal().getName()); if (hashChecking.get(_aaos) == null) { UPPAALLocation loc1 = addLocation(_template); - UPPAALTransition tr1 = addTransition(_template, loc, loc1); + /*UPPAALTransition tr1 =*/ addTransition(_template, loc, loc1); TraceManager.addDev("[CHECKING] +-+-+-+- action on signal " + _aaos + " is selected for checking"); hashChecking.put(_aaos, loc); loc.unsetOptimizable(); @@ -873,8 +873,8 @@ public class AVATAR2UPPAAL { UPPAALLocation loc1, loc2; String tmps, tmps0; AvatarTransition at; - UPPAALLocation loc; - UPPAALTransition tr, tr1; + // UPPAALLocation loc; + UPPAALTransition tr;//, tr1; AvatarActionOnSignal aaos; @@ -1024,12 +1024,12 @@ public class AVATAR2UPPAAL { } public void makeMethodCall(AvatarBlock _block, UPPAALTransition _tr, AvatarTermFunction action) { - int j; + // int j; AvatarAttribute aa; String result = ""; int nbOfInt = 0; int nbOfBool = 0; - String tmps; + // String tmps; TraceManager.addDev("Making method call:" + action.toString ()); @@ -1097,7 +1097,7 @@ public class AVATAR2UPPAAL { } public String [] manageSynchro(AvatarBlock _block, AvatarActionOnSignal _aaos) { - AvatarSignal as = _aaos.getSignal(); + // AvatarSignal as = _aaos.getSignal(); return manageSynchroSynchronous(_block, _aaos); @@ -1177,7 +1177,7 @@ public class AVATAR2UPPAAL { nbOfBool++; } else { try { - int myint = Integer.decode(val); + /*int myint =*/ Integer.decode(val); result[1] = result[1] + ACTION_INT + nbOfInt + " = " + val; nbOfInt++; } catch (Exception e) { @@ -1338,12 +1338,12 @@ public class AVATAR2UPPAAL { } public void makeSystem() { - ListIterator iterator = spec.getTemplates().listIterator(); + Iterator<UPPAALTemplate> iterator = spec.getTemplates().listIterator(); UPPAALTemplate template; String system = "system "; String dec = ""; int id = 0; - int i; + // int i; while(iterator.hasNext()) { template = (UPPAALTemplate)(iterator.next()); @@ -1431,15 +1431,15 @@ public class AVATAR2UPPAAL { } public int getIndexOfTranslatedTemplate(UPPAALTemplate _temp) { - ListIterator iterator = spec.getTemplates().listIterator(); + Iterator<UPPAALTemplate> iterator = spec.getTemplates().listIterator(); UPPAALTemplate template; - String system = "system "; - String dec = ""; + // String system = "system "; + // String dec = ""; int id = 0; - int i; + // int i; while(iterator.hasNext()) { - template = (UPPAALTemplate)(iterator.next()); + template = iterator.next(); if (template == _temp) { return id; } diff --git a/src/ddtranslator/DDStructSynchro.java b/src/ddtranslator/DDStructSynchro.java index 26eff0b8f0..46b6a9e875 100755 --- a/src/ddtranslator/DDStructSynchro.java +++ b/src/ddtranslator/DDStructSynchro.java @@ -50,14 +50,14 @@ import java.util.*; import translator.*; public class DDStructSynchro { - private LinkedList list; + private List<String> list; public DDStructSynchro() { - list = new LinkedList(); + list = new LinkedList<String>(); } public DDStructSynchro(String actionValue, TClass t) { - list = new LinkedList(); + list = new LinkedList<String>(); constructList(actionValue, t); } @@ -115,10 +115,10 @@ public class DDStructSynchro { int b = 0; String type; - ListIterator iterator = list.listIterator(); + Iterator<String> iterator = list.listIterator(); while(iterator.hasNext()) { - type = (String)(iterator.next()); + type = iterator.next(); if (type.compareTo(Param.NAT) ==0) { call += "?x" + x + ":nat"; x ++; @@ -133,11 +133,11 @@ public class DDStructSynchro { public int nbNat() { int nb = 0; - ListIterator iterator = list.listIterator(); + Iterator<String> iterator = list.listIterator(); String type; while(iterator.hasNext()) { - type = (String)(iterator.next()); + type = iterator.next(); if (type.compareTo(Param.NAT) ==0) { nb ++; } @@ -148,10 +148,10 @@ public class DDStructSynchro { public int nbBool() { int nb = 0; - ListIterator iterator = list.listIterator(); + Iterator<String> iterator = list.listIterator(); String type; while(iterator.hasNext()) { - type = (String)(iterator.next()); + type = iterator.next(); if (type.compareTo(Param.BOOL) ==0) { nb ++; } @@ -163,14 +163,14 @@ public class DDStructSynchro { public int compareTo(Object o) { if (o instanceof DDStructSynchro) { DDStructSynchro ddss = (DDStructSynchro)o; - LinkedList listd = ddss.getList(); + List<String> listd = ddss.getList(); if (list.size() == listd.size()) { - ListIterator li1 = list.listIterator(); - ListIterator li2 = listd.listIterator(); + Iterator<String> li1 = list.listIterator(); + Iterator<String> li2 = listd.listIterator(); String s1, s2; while(li1.hasNext()) { - s1 = (String)(li1.next()); - s2 = (String)(li2.next()); + s1 = li1.next(); + s2 = li2.next(); if (s1.compareTo(s2) != 0) { return -1; } @@ -182,7 +182,7 @@ public class DDStructSynchro { return -1; } - public LinkedList getList() { + public List<String> getList() { return list; } @@ -190,18 +190,15 @@ public class DDStructSynchro { return list.size(); } - public boolean isInList(LinkedList _list) { - ListIterator iterator = _list.listIterator(); + public boolean isInList(List<DDStructSynchro> _list) { + Iterator<DDStructSynchro> iterator = _list.listIterator(); DDStructSynchro ddss; while(iterator.hasNext()) { - ddss = (DDStructSynchro)(iterator.next()); + ddss = iterator.next(); if (compareTo(ddss) == 0) { return true; } } return false; } - - - } // Class \ No newline at end of file diff --git a/src/ddtranslator/DDTranslator.java b/src/ddtranslator/DDTranslator.java index 110531abcf..70889f87c1 100755 --- a/src/ddtranslator/DDTranslator.java +++ b/src/ddtranslator/DDTranslator.java @@ -70,14 +70,14 @@ public class DDTranslator { public void translateLinks() throws DDSyntaxException { // We go throughout links - LinkedList ll; - ListIterator iterator; - TDDNode node; + List<TGConnectorLinkNode> ll; + Iterator<TGConnectorLinkNode> iterator; + //TDDNode node; TGConnectorLinkNode link; VectorLRArtifactTClassGate assocs; LRArtifactTClassGate lratg; TClassLinkNode t; - TClass tcl; + // TClass tcl; int i; ll = dp.tddp.getListOfLinks(); @@ -87,7 +87,7 @@ public class DDTranslator { // Loop on links while(iterator.hasNext()) { - link = (TGConnectorLinkNode)(iterator.next()); + link = iterator.next(); assocs = link.getList(); System.out.println("assocs=" + assocs); if (assocs.size() > 0) { @@ -181,7 +181,7 @@ public class DDTranslator { // Analyse Tclass1 System.out.println("Toto02"); - LinkedList synchros = new LinkedList(); + List<DDStructSynchro> synchros = new LinkedList<DDStructSynchro>(); ad = tclass1.getActivityDiagram(); for(i=0; i<ad.size(); i++) { diff --git a/src/ddtranslatorSoclib/AvatarddSpecification.java b/src/ddtranslatorSoclib/AvatarddSpecification.java index fa1e936aa0..25532d2c89 100755 --- a/src/ddtranslatorSoclib/AvatarddSpecification.java +++ b/src/ddtranslatorSoclib/AvatarddSpecification.java @@ -49,9 +49,9 @@ import java.util.*; public class AvatarddSpecification{ - private LinkedList<AvatarComponent> components; - private LinkedList<AvatarConnector> connectors; - private LinkedList<AvatarMappedObject> mappedObjects; + private List<AvatarComponent> components; + private List<AvatarConnector> connectors; + private List<AvatarMappedObject> mappedObjects; private int nb_init = 0; @@ -75,34 +75,36 @@ There always is a RAM0, a TTY and an interconnect (Bus or VGMN or crossbar) othe int nb_target = 6; int nb_mwmr_segments = 0; - public AvatarddSpecification(LinkedList<AvatarComponent> _components, LinkedList<AvatarConnector> _connectors, LinkedList<AvatarMappedObject> _mappedObjects, int _nb_target, int _nb_init){ - components = _components ; - connectors = _connectors ; - mappedObjects = _mappedObjects ; + public AvatarddSpecification( List<AvatarComponent> _components, List<AvatarConnector> _connectors, List<AvatarMappedObject> _mappedObjects, int _nb_target, int _nb_init){ + components = _components ; + connectors = _connectors ; + mappedObjects = _mappedObjects ; nb_target = _nb_target; nb_init = _nb_init; } - public LinkedList<AvatarComponent> getComponents(){ + public List<AvatarComponent> getComponents(){ return components; } - public LinkedList<AvatarConnector> getConnectors(){ + public List<AvatarConnector> getConnectors(){ return connectors; } - public LinkedList<AvatarMappedObject> getMappedObjects(){ + public List<AvatarMappedObject> getMappedObjects(){ return mappedObjects; } - public LinkedList<AvatarTask> getAllMappedTask(){ - LinkedList<AvatarTask> tasks = new LinkedList<AvatarTask>(); - for (AvatarMappedObject task : mappedObjects ) - { - if (task instanceof AvatarTask) - tasks.add((AvatarTask)task); + public List<AvatarTask> getAllMappedTask(){ + List<AvatarTask> tasks = new LinkedList<AvatarTask>(); + + for (AvatarMappedObject task : mappedObjects ) { + if (task instanceof AvatarTask) { + tasks.add((AvatarTask)task); + } } - return tasks; + + return tasks; } public LinkedList<AvatarChannel> getAllMappedChannels(){ @@ -116,7 +118,7 @@ There always is a RAM0, a TTY and an interconnect (Bus or VGMN or crossbar) othe } public LinkedList<AvatarTTY> getAllTTY(){ - int i=0; + //int i=0; LinkedList<AvatarTTY> ttys = new LinkedList<AvatarTTY>(); for (AvatarComponent tty : components ) { @@ -138,21 +140,20 @@ There always is a RAM0, a TTY and an interconnect (Bus or VGMN or crossbar) othe return cpus; } - public LinkedList<AvatarRAM> getAllRAM(){ - int i=0; - LinkedList<AvatarRAM> rams = new LinkedList<AvatarRAM>(); - for (AvatarComponent ram : components ) - { - if (ram instanceof AvatarRAM){ - - rams.add((AvatarRAM)ram); - - } - } - return rams; + public List<AvatarRAM> getAllRAM(){ + //int i=0; + List<AvatarRAM> rams = new LinkedList<AvatarRAM>(); + + for (AvatarComponent ram : components ) { + if (ram instanceof AvatarRAM){ + rams.add((AvatarRAM)ram); + } + } + + return rams; } - public LinkedList<AvatarBus> getAllBus(){ + public List<AvatarBus> getAllBus(){ LinkedList<AvatarBus> buss = new LinkedList<AvatarBus>(); for (AvatarComponent bus : components ) { @@ -208,8 +209,8 @@ There always is a RAM0, a TTY and an interconnect (Bus or VGMN or crossbar) othe return getAllCrossbar().size(); } - public LinkedList<AvatarCoproMWMR> getAllCoproMWMR(){ - LinkedList<AvatarCoproMWMR> copros = new LinkedList<AvatarCoproMWMR>(); + public List<AvatarCoproMWMR> getAllCoproMWMR(){ + List<AvatarCoproMWMR> copros = new LinkedList<AvatarCoproMWMR>(); for (AvatarComponent copro : components ) { if (copro instanceof AvatarCoproMWMR) diff --git a/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java b/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java index 8210266f56..c4f9517719 100755 --- a/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java +++ b/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java @@ -49,6 +49,7 @@ package ddtranslatorSoclib.toSoclib; import java.io.File; import java.util.LinkedList; +import java.util.List; import java.util.Vector; import avatartranslator.AvatarAction; @@ -185,38 +186,35 @@ public class TasksAndMainGenerator { public void makeMainMutex() { // Create a main mutex - mainFile.appendToBeforeMainCode("/* Main mutex */" + CR); - - mainFile.appendToHCode("extern pthread_mutex_t __mainMutex;" + CR + CR); - // mainFile.appendToBeforeMainCode("pthread_mutex_t __mainMutex;" + CR + CR); - mainFile.appendToBeforeMainCode("pthread_barrier_t barrier ;" + CR ); - mainFile.appendToBeforeMainCode("pthread_attr_t *attr_t;" + CR ); - mainFile.appendToBeforeMainCode("pthread_mutex_t __mainMutex;" + CR2 ); - - int d=0; - - //for(AvatarRelation ar: avspec.getRelations()) { - for (AvatarRAM ram : TopCellGenerator.avatardd.getAllRAM()) { - //for(AvatarChannel ar: avspec.getChannels()) { - for(AvatarChannel channel: ram.getChannels()){ - mainFile.appendToBeforeMainCode("#define CHANNEL"+d+" __attribute__((section(\"section_channel"+d+"\")))" + CR ); - mainFile.appendToBeforeMainCode("#define LOCK"+d+" __attribute__((section(\"section_lock"+d+"\")))" + CR );//one lock per channel - d++; - } - } - - - mainFile.appendToBeforeMainCode("#define base(arg) arg" + CR2 ); - mainFile.appendToBeforeMainCode("typedef struct mwmr_s mwmr_t;" + CR2); - - - - - mainFile.appendToMainCode("void *ptr;" + CR); - mainFile.appendToMainCode("pthread_barrier_init(&barrier,NULL, NB_PROC);" +CR); - mainFile.appendToMainCode("pthread_attr_t *attr_t = malloc(sizeof(pthread_attr_t));" +CR); - mainFile.appendToMainCode("pthread_attr_init(attr_t);" + CR ); - mainFile.appendToMainCode("pthread_mutex_init(&__mainMutex, NULL);" +CR2); + mainFile.appendToBeforeMainCode("/* Main mutex */" + CR); + + mainFile.appendToHCode("extern pthread_mutex_t __mainMutex;" + CR + CR); + // mainFile.appendToBeforeMainCode("pthread_mutex_t __mainMutex;" + CR + CR); + mainFile.appendToBeforeMainCode("pthread_barrier_t barrier ;" + CR ); + mainFile.appendToBeforeMainCode("pthread_attr_t *attr_t;" + CR ); + mainFile.appendToBeforeMainCode("pthread_mutex_t __mainMutex;" + CR2 ); + + int d=0; + + //for(AvatarRelation ar: avspec.getRelations()) { + for (AvatarRAM ram : TopCellGenerator.avatardd.getAllRAM()) { + //for(AvatarChannel ar: avspec.getChannels()) { + for(AvatarChannel channel: ram.getChannels()){ + mainFile.appendToBeforeMainCode("#define CHANNEL"+d+" __attribute__((section(\"section_channel"+d+"\")))" + CR ); + mainFile.appendToBeforeMainCode("#define LOCK"+d+" __attribute__((section(\"section_lock"+d+"\")))" + CR );//one lock per channel + d++; + } + } + + + mainFile.appendToBeforeMainCode("#define base(arg) arg" + CR2 ); + mainFile.appendToBeforeMainCode("typedef struct mwmr_s mwmr_t;" + CR2); + + mainFile.appendToMainCode("void *ptr;" + CR); + mainFile.appendToMainCode("pthread_barrier_init(&barrier,NULL, NB_PROC);" +CR); + mainFile.appendToMainCode("pthread_attr_t *attr_t = malloc(sizeof(pthread_attr_t));" +CR); + mainFile.appendToMainCode("pthread_attr_init(attr_t);" + CR ); + mainFile.appendToMainCode("pthread_mutex_init(&__mainMutex, NULL);" +CR2); } public void makeSynchronousChannels() { @@ -321,7 +319,7 @@ public class TasksAndMainGenerator { mainFile.appendToMainCode(getChannelName(ar, i)+".status->wptr=0;" + CR); - int seg_no=0; + //int seg_no=0; mainFile.appendToBeforeMainCode("uint32_t const "+ getChannelName(ar, i)+"_lock LOCK"+ar.getId()+";" + CR); mainFile.appendToBeforeMainCode("struct mwmr_status_s "+ getChannelName(ar, i) +"_status CHANNEL"+ar.getId()+";" + CR); @@ -336,14 +334,15 @@ public class TasksAndMainGenerator { } public int FindCPUidFromTask(AvatarBlock block){ - LinkedList<AvatarTask> tasks = avddspec.getAllMappedTask(); - for (AvatarTask task : tasks){ - if (task.getTaskName().equals(block.getName())){ - return task.getCPUNo(); - } - } + List<AvatarTask> tasks = avddspec.getAllMappedTask(); + + for (AvatarTask task : tasks){ + if (task.getTaskName().equals(block.getName())){ + return task.getCPUNo(); + } + } - return -1; + return -1; } public void makeTasks() { @@ -762,7 +761,7 @@ public class TasksAndMainGenerator { if (_asme instanceof AvatarState) { - int cpuid = FindCPUidFromTask(_block); + //int cpuid = FindCPUidFromTask(_block); // ret += "printf(\"tracing cycles --- block: "+_block.getName()+" cpu: %d cycle count: %d \\n\","+ cpuid+", cpu_cycle_count());"+CR; if (!firstCall) { if (debug) { @@ -859,8 +858,8 @@ public class TasksAndMainGenerator { if (_asme instanceof AvatarActionOnSignal) { AvatarActionOnSignal aaos = (AvatarActionOnSignal)_asme; ret += makeSignalAction(aaos, 0, false, "", ""); - AvatarSignal as = aaos.getSignal(); - AvatarRelation ar = avspec.getAvatarRelationWithSignal(as); + // AvatarSignal as = aaos.getSignal(); + // AvatarRelation ar = avspec.getAvatarRelationWithSignal(as); ret += executeOneRequest("__req0"); ret += traceRequest(); } diff --git a/src/dseengine/DSEConfiguration.java b/src/dseengine/DSEConfiguration.java index a58e97e158..58733a4e5a 100755 --- a/src/dseengine/DSEConfiguration.java +++ b/src/dseengine/DSEConfiguration.java @@ -46,6 +46,7 @@ knowledge of the CeCILL license and that you accept its terms. package dseengine; +import java.awt.Point; import java.io.*; import java.util.*; @@ -104,7 +105,7 @@ public class DSEConfiguration implements Runnable { private TMLMapping tmap; private TMLModeling tmlm; - private TMLModeling stmlm; +// private TMLModeling stmlm; private boolean optionChanged = true; @@ -134,7 +135,7 @@ public class DSEConfiguration implements Runnable { private int maxNbOfCoresPerCPU = 2; private int nbOfSimulationsPerMapping = 1; private TMLModeling taskModel = null; - private TMLModeling secModel = null; +// private TMLModeling secModel = null; private Vector<TMLMapping> mappings; private DSEMappingSimulationResults dsemapresults; @@ -458,7 +459,7 @@ public class DSEConfiguration implements Runnable { TMLMappingTextSpecification spec = new TMLMappingTextSpecification("LoadedSpecification"); ret = spec.makeTMLMapping(inputData, modelPath); TraceManager.addDev("load ended"); - ArrayList<TMLError> warnings; + List<TMLError> warnings; if (!ret) { TraceManager.addDev("Compilation:\n" + spec.printSummary()); @@ -510,7 +511,7 @@ public class DSEConfiguration implements Runnable { TMLTextSpecification tmlts = new TMLTextSpecification("LoadedTaskModel"); ret = tmlts.makeTMLModeling(inputData); TraceManager.addDev("Load of task model done"); - ArrayList<TMLError> warnings; + List<TMLError> warnings; if (!ret) { TraceManager.addDev("Compilation:\n" + tmlts.printSummary()); @@ -982,7 +983,7 @@ public class DSEConfiguration implements Runnable { for(int i=0; i<dsemapresults.nbOfElements(); i++) { res = dsemapresults.getResults(i); try { - sres = res.getAllExplanationHeader() + "\n"; + sres = DSESimulationResult.getAllExplanationHeader() + "\n"; sres += "#Mapping description: " + dsemapresults.getMapping(i).getSummaryTaskMapping() + "\n"; sres += res.getAllComments() + "\n" + res.getAllResults(); FileUtils.saveFile(pathToResults + "alldseresults_mapping" + cpt + ".txt", sres); @@ -1012,9 +1013,9 @@ public class DSEConfiguration implements Runnable { // Saving to file try { - TraceManager.addDev(results.getAllExplanationHeader()); + TraceManager.addDev(DSESimulationResult.getAllExplanationHeader()); TraceManager.addDev("----\n" + results.getAllResults()); - FileUtils.saveFile(pathToResults + "allresults" + resultsID + ".txt", results.getAllExplanationHeader() + "\n" + results.getAllComments() + "\n" + results.getAllResults()); + FileUtils.saveFile(pathToResults + "allresults" + resultsID + ".txt", DSESimulationResult.getAllExplanationHeader() + "\n" + results.getAllComments() + "\n" + results.getAllResults()); } catch (Exception e){ TraceManager.addDev("Error when saving results file" + e.getMessage()); return -1; @@ -1037,7 +1038,7 @@ public class DSEConfiguration implements Runnable { res = dsemapresults.getResults(i); try { - sres = res.getExplanationHeader() + "\n"; + sres = DSESimulationResult.getExplanationHeader() + "\n"; sres += "#Mapping description: " + dsemapresults.getMapping(i).getSummaryTaskMapping() + "\n"; sres += res.getAllComments() + "\n" + res.getWholeResults(); FileUtils.saveFile(pathToResults + "summary_dseresults_ofmapping" + cpt + ".txt", sres); @@ -1169,7 +1170,7 @@ public class DSEConfiguration implements Runnable { // Saving to file try { - FileUtils.saveFile(pathToResults + "summary" + resultsID + ".txt", results.getExplanationHeader() + "\n" + results.getAllComments() + "\n" + results.getWholeResults()); + FileUtils.saveFile(pathToResults + "summary" + resultsID + ".txt", DSESimulationResult.getExplanationHeader() + "\n" + results.getAllComments() + "\n" + results.getWholeResults()); } catch (Exception e){ TraceManager.addDev("Error when saving results file"); return -1; @@ -1345,7 +1346,7 @@ public class DSEConfiguration implements Runnable { String cmd = prepareCommand(); String tmp; - long t0 = System.currentTimeMillis(); + //long t0 = System.currentTimeMillis(); while(nbOfSimulations >0) { tmp = putSimulationNbInCommand(cmd, simulationID); @@ -1391,7 +1392,7 @@ public class DSEConfiguration implements Runnable { String cmd = prepareCommand(); String tmp; - long t0 = System.currentTimeMillis(); + //long t0 = System.currentTimeMillis(); while(nbOfSimulations >0) { tmp = putSimulationNbInCommand(cmd, simulationID); @@ -1414,9 +1415,9 @@ public class DSEConfiguration implements Runnable { return 0; } public TMLArchiPanel drawMapping(TMLMapping map, String name){ - Map<HwNode, TGConnectingPoint> connectMap; + //Map<HwNode, TGConnectingPoint> connectMap; Map<HwNode, TMLArchiNode> objMap = new HashMap<HwNode, TMLArchiNode>(); - int index = mainGUI.createTMLArchitecture(name); + /*int index =*/ mainGUI.createTMLArchitecture(name); TMLArchiPanel archPanel = (TMLArchiPanel) mainGUI.tabs.get(mainGUI.tabs.size()-1); TMLArchiDiagramPanel ap = archPanel.tmlap; TMLArchitecture arch = map.getArch(); @@ -1455,7 +1456,7 @@ public class DSEConfiguration implements Runnable { for (HwLink link: hwlinks){ TMLArchiNode n1 = objMap.get(link.hwnode); TMLArchiNode n2 = objMap.get(link.bus); - TMLArchiConnectorNode conn = new TMLArchiConnectorNode(x, y, ap.getMinX(), ap.getMaxX(), ap.getMinY(), ap.getMaxY(), false, null, ap, n1.getTGConnectingPointAtIndex(0), n2.getTGConnectingPointAtIndex(0), new Vector()); + TMLArchiConnectorNode conn = new TMLArchiConnectorNode(x, y, ap.getMinX(), ap.getMaxX(), ap.getMinY(), ap.getMaxY(), false, null, ap, n1.getTGConnectingPointAtIndex(0), n2.getTGConnectingPointAtIndex(0), new Vector<Point>()); ap.addComponent(conn,x,y,false,true); } for (TMLTask task:map.getTMLModeling().getTasks()){ @@ -1476,7 +1477,7 @@ public class DSEConfiguration implements Runnable { //TraceManager.addDev("Going to start command " + cmd); ProcessBuilder pb = new ProcessBuilder(constructCommandList(cmd)); - Map<String, String> env = pb.environment(); + /*Map<String, String> env =*/ pb.environment(); java.lang.Process proc = pb.start(); proc_in = new BufferedReader(new InputStreamReader(proc.getInputStream())); @@ -1614,7 +1615,7 @@ public class DSEConfiguration implements Runnable { } private void generateMappings(TMLModeling _tmlm, Vector<TMLMapping> maps, int nbOfCPUs) { - ArrayList<TMLTask> tasks = _tmlm.getTasks(); + List<TMLTask> tasks = _tmlm.getTasks(); CPUWithTasks cpus_tasks[] = new CPUWithTasks[nbOfCPUs]; TraceManager.addDev("Nb of cpus = " + nbOfCPUs); diff --git a/src/myutil/Conversion.java b/src/myutil/Conversion.java index e42d95a4f6..52c48e6a42 100755 --- a/src/myutil/Conversion.java +++ b/src/myutil/Conversion.java @@ -336,7 +336,7 @@ public class Conversion { //System.out.println("Replace op s=" + s + " from=" + from + " to=" + to); int fromIndex = 0; int index; - int len; + // int len; boolean b1, b2; String s1, s2; @@ -423,17 +423,17 @@ public class Conversion { return output + _input; } - public static boolean containsStringInList(LinkedList ll, String s) { - ListIterator iterator = ll.listIterator(); - Object o; + public static boolean containsStringInList( List<String> ll, String s) { + Iterator<String> iterator = ll.listIterator(); + String o; while(iterator.hasNext()) { o = iterator.next(); - if (o instanceof String) { - if (s.compareTo((String)o) == 0) { + //if (o instanceof String) { + if (s.compareTo(o) == 0) { return true; } - } + // } } return false; @@ -459,8 +459,8 @@ public class Conversion { boolean inQuote = false; boolean isSlashed = false; boolean isEscaped = false; - boolean inStarComment = false; - boolean inLineComment = false; + // boolean inStarComment = false; +// boolean inLineComment = false; String ret = ""; char c; @@ -603,7 +603,7 @@ public class Conversion { */ public static int findMatchingParenthesis(String expr, int indexFirst, char openPar, char closePar) { int index = indexFirst + 1; - boolean found = true; + // boolean found = true; int total = 0; while(index < expr.length()) { if (expr.charAt(index) == openPar) { diff --git a/src/myutil/SortedVector.java b/src/myutil/SortedVector.java index 9de6ed0aeb..1f60d0a7da 100755 --- a/src/myutil/SortedVector.java +++ b/src/myutil/SortedVector.java @@ -49,9 +49,14 @@ package myutil; import java.util.Vector; -public class SortedVector extends Vector{ +public class SortedVector<T> extends Vector<T>{ - public SortedVector(int cpt) { + /** + * + */ + private static final long serialVersionUID = -7882498373642597896L; + + public SortedVector(int cpt) { super(cpt); } @@ -59,8 +64,8 @@ public class SortedVector extends Vector{ super(); } - public boolean add(Object o) { - if (o instanceof Comparable) { + public boolean add(T o) { + if (o instanceof Comparable<?>) { int i = 0; while((i<size()) && (((Comparable)o).compareTo(elementAt(i)) >= 0)) { i++; diff --git a/src/sddescription/HMSC.java b/src/sddescription/HMSC.java index b2d7c96fca..309dfb8555 100755 --- a/src/sddescription/HMSC.java +++ b/src/sddescription/HMSC.java @@ -50,12 +50,12 @@ import java.util.*; public class HMSC { private String name; private HMSCNode startNode; - private LinkedList instances; + private List<Instance> instances; public HMSC(String _name, HMSCNode _startNode) { startNode = _startNode; name = _name; - instances = new LinkedList(); + instances = new LinkedList<Instance>(); } public void addInstance(Instance instance) { @@ -72,10 +72,10 @@ public class HMSC { } public Instance getInstance(String name) { - Iterator iterator = instances.listIterator(); + Iterator<Instance> iterator = instances.listIterator(); Instance ins; while(iterator.hasNext()) { - ins = (Instance)(iterator.next()); + ins = iterator.next(); if (ins.getName().compareTo(name) == 0) { return ins; } @@ -83,26 +83,26 @@ public class HMSC { return null; } - public LinkedList getInstances() { + public List<Instance> getInstances() { return instances; } public String getName() { return name; } - public LinkedList getListOfNodesExceptStartStop() { - LinkedList nodes = new LinkedList(); + public List<HMSCNode> getListOfNodesExceptStartStop() { + List<HMSCNode> nodes = new LinkedList<HMSCNode>(); addNodesExceptStartStop(startNode, nodes); return nodes; } - public LinkedList getListOfNodes() { - LinkedList nodes = new LinkedList(); + public List<HMSCNode> getListOfNodes() { + List<HMSCNode> nodes = new LinkedList<HMSCNode>(); addNodes(startNode, nodes); return nodes; } - public void addNodesExceptStartStop(HMSCNode n, LinkedList list) { + public void addNodesExceptStartStop(HMSCNode n, List<HMSCNode> list) { if (n == null) { return; } @@ -120,25 +120,25 @@ public class HMSC { // recursive call; MSC msc; HMSCNode n1; - LinkedList ll = n.getNextNodes(); - ListIterator iterator1 = ll.listIterator(); + List<HMSCNode> nodes = n.getNextNodes(); + Iterator<HMSCNode> nodesIterator = nodes.listIterator(); // direct nodes - while(iterator1.hasNext()) { - n1 = (HMSCNode)(iterator1.next()); + while( nodesIterator.hasNext() ) { + n1 = nodesIterator.next(); addNodesExceptStartStop(n1, list); } // nodes after MSCs - ll = n.getNextMSCs(); - iterator1 = ll.listIterator(); - while(iterator1.hasNext()) { - msc = (MSC)(iterator1.next()); + List<MSC> mscs = n.getNextMSCs(); + Iterator<MSC> mscIerator = mscs.listIterator(); + while( mscIerator.hasNext() ) { + msc = mscIerator.next(); addNodesExceptStartStop(msc.getNextNode(), list); } } - public void addNodes(HMSCNode n, LinkedList list) { + public void addNodes(HMSCNode n, List<HMSCNode> list) { if (n == null) { return; } @@ -152,32 +152,32 @@ public class HMSC { // recursive call; MSC msc; HMSCNode n1; - LinkedList ll = n.getNextNodes(); - ListIterator iterator1 = ll.listIterator(); + List<HMSCNode> ll = n.getNextNodes(); + Iterator<HMSCNode> iterator1 = ll.listIterator(); // direct nodes while(iterator1.hasNext()) { - n1 = (HMSCNode)(iterator1.next()); + n1 = iterator1.next(); addNodes(n1, list); } // nodes after MSCs - ll = n.getNextMSCs(); - iterator1 = ll.listIterator(); - while(iterator1.hasNext()) { - msc = (MSC)(iterator1.next()); + Iterator<MSC> mscsIt = n.getNextMSCs().iterator(); + //iterator1 = ll.listIterator(); + while( mscsIt.hasNext()) { + msc = mscsIt.next(); addNodes(msc.getNextNode(), list); } } - public LinkedList getMSCs() { - LinkedList ll = getListOfNodes(); + public List<MSC> getMSCs() { + List<HMSCNode> ll = getListOfNodes(); HMSCNode n; - LinkedList mscs = new LinkedList(); - Iterator iterator = ll.listIterator(); + List<MSC> mscs = new LinkedList<MSC>(); + Iterator<HMSCNode> iterator = ll.listIterator(); while(iterator.hasNext()) { - n = (HMSCNode)(iterator.next()); + n = iterator.next(); mscs.addAll(n.getNextMSCs()); } @@ -185,12 +185,12 @@ public class HMSC { } public void print() { - LinkedList ll = getListOfNodes(); - Iterator iterator = ll.listIterator(); + // LinkedList ll = getListOfNodes(); + Iterator<HMSCNode> iterator = getListOfNodes().listIterator(); HMSCNode n; while(iterator.hasNext()) { - n = (HMSCNode)(iterator.next()); + n = iterator.next(); System.out.println(n.toString()); } diff --git a/src/sddescription/HMSCNode.java b/src/sddescription/HMSCNode.java index a4b88aea50..83bdeaabef 100755 --- a/src/sddescription/HMSCNode.java +++ b/src/sddescription/HMSCNode.java @@ -57,22 +57,22 @@ public class HMSCNode extends HMSCElement { public static final int SEQUENCE = 5; private int type; - private LinkedList nextMSCs; - protected LinkedList nextNodes; - private LinkedList nextInformationMSCs; - private LinkedList nextInformationNodes; - private LinkedList nextMSCGuards; - private LinkedList nextNodeGuards; + private List<MSC> nextMSCs; + protected List<HMSCNode> nextNodes; + private List<MSC> nextInformationMSCs; + private List<HMSCNode> nextInformationNodes; + private List<String> nextMSCGuards; + private List<String> nextNodeGuards; public HMSCNode(String _name, int _type) { super(_name); type = _type; - nextMSCs = new LinkedList(); - nextNodes = new LinkedList(); - nextInformationMSCs = new LinkedList(); - nextInformationNodes = new LinkedList(); - nextMSCGuards = new LinkedList(); - nextNodeGuards = new LinkedList(); + nextMSCs = new LinkedList<MSC>(); + nextNodes = new LinkedList<HMSCNode>(); + nextInformationMSCs = new LinkedList<MSC>(); + nextInformationNodes = new LinkedList<HMSCNode>(); + nextMSCGuards = new LinkedList<String>(); + nextNodeGuards = new LinkedList<String>(); } public void addNextNode(HMSCNode c) { @@ -114,25 +114,24 @@ public class HMSCNode extends HMSCElement { public int getType() { return type; } - public LinkedList getNextNodes() { + public List<HMSCNode> getNextNodes() { return nextNodes; } - public LinkedList getNextMSCs() { + public List<MSC> getNextMSCs() { return nextMSCs; } - public LinkedList getInformationNextNodes() { + public List<HMSCNode> getInformationNextNodes() { return nextInformationNodes; } - public LinkedList getInformationNextMSCs() { + public List<MSC> getInformationNextMSCs() { return nextInformationMSCs; } public String toString() { - LinkedList ll; - ListIterator iterator; + // List ll; int index = 0; HMSCNode n; MSC msc; @@ -141,9 +140,9 @@ public class HMSCNode extends HMSCElement { s += "Name=" + getName(); s += "\n\tnextNodes= "; - iterator = getNextNodes().listIterator(); - while(iterator.hasNext()) { - n = (HMSCNode)(iterator.next()); + final Iterator<HMSCNode> nodeIterator = getNextNodes().listIterator(); + while( nodeIterator.hasNext()) { + n = nodeIterator.next(); s += n.getName() + " "; if (sizeNodeGuard() > index) { s += "guard= " + getNodeGuard(index) + " "; @@ -153,9 +152,9 @@ public class HMSCNode extends HMSCElement { s += "\n\tnextMSCs= "; index = 0; - iterator = getNextMSCs().listIterator(); - while(iterator.hasNext()) { - msc = (MSC)(iterator.next()); + final Iterator<MSC> mscIterator = getNextMSCs().listIterator(); + while( mscIterator.hasNext()) { + msc = mscIterator.next(); s += msc.getName() + " "; if (sizeMSCGuard() > index) { s += "guard= " + getMSCGuard(index) + " "; @@ -164,6 +163,5 @@ public class HMSCNode extends HMSCElement { } //s+="\n"; return s; - } } \ No newline at end of file diff --git a/src/sddescription/MSC.java b/src/sddescription/MSC.java index 6b6131cbc0..14c5b3526a 100755 --- a/src/sddescription/MSC.java +++ b/src/sddescription/MSC.java @@ -49,33 +49,34 @@ import java.util.*; public class MSC extends HMSCElement { private HMSCNode nextNode; - private LinkedList evts; - private LinkedList orders; - private LinkedList linkevts; - private LinkedList timeconstraints; + private List<Evt> evts; + private List<Order> orders; + private List<LinkEvts> linkevts; + private List<TimeConstraint> timeconstraints; public MSC(String _name, HMSCNode _nextNode) { super(_name); + nextNode = _nextNode; - evts = new LinkedList(); - orders = new LinkedList(); - linkevts = new LinkedList(); - timeconstraints = new LinkedList(); + evts = new LinkedList<Evt>(); + orders = new LinkedList<Order>(); + linkevts = new LinkedList<LinkEvts>(); + timeconstraints = new LinkedList<TimeConstraint>(); } public MSC(String _name) { super(_name); - evts = new LinkedList(); - orders = new LinkedList(); - linkevts = new LinkedList(); - timeconstraints = new LinkedList(); + evts = new LinkedList<Evt>(); + orders = new LinkedList<Order>(); + linkevts = new LinkedList<LinkEvts>(); + timeconstraints = new LinkedList<TimeConstraint>(); } public HMSCNode getNextNode() { return nextNode; } - public LinkedList getEvts() { return evts; } - public LinkedList getOrders() { return orders; } - public LinkedList getLinksEvts() { return linkevts; } - public LinkedList getTimeConstraints() { return timeconstraints; } + public List<Evt> getEvts() { return evts; } + public List<Order> getOrders() { return orders; } + public List<LinkEvts> getLinksEvts() { return linkevts; } + public List<TimeConstraint> getTimeConstraints() { return timeconstraints; } public void addEvt(Evt evt) { evts.add(evt); @@ -99,9 +100,9 @@ public class MSC extends HMSCElement { public Evt getEvtByID(int _id) { Evt evt; - Iterator li = evts.listIterator(); + Iterator<Evt> li = evts.listIterator(); while(li.hasNext()) { - evt = (Evt)(li.next()); + evt = li.next(); if (evt.getID() == _id) { return evt; } @@ -112,10 +113,10 @@ public class MSC extends HMSCElement { public Evt hasExactlyOnePreviousEvt(Evt evt) { Evt evtret = null; Order order; - Iterator li = orders.listIterator(); + Iterator<Order> li = orders.listIterator(); while(li.hasNext()) { - order = (Order)(li.next()); + order = li.next(); if (order.evt2 == evt) { if (evtret != null) { // at least two previous events @@ -130,10 +131,10 @@ public class MSC extends HMSCElement { public boolean isEndOfExactlyOneRelativeTC(Evt evt) { boolean ret = false; TimeConstraint tc; - Iterator li = timeconstraints.listIterator(); + Iterator<TimeConstraint> li = timeconstraints.listIterator(); while(li.hasNext()) { - tc = (TimeConstraint)(li.next()); + tc = li.next(); if (tc.evt2 == evt) { if (ret == true) { // at least two tcs @@ -151,7 +152,7 @@ public class MSC extends HMSCElement { return ""; } - ArrayList<Evt> al = getEffectiveGuardEvtsBefore(evt); + List<Evt> al = getEffectiveGuardEvtsBefore(evt); if ((al == null) || (al.size() == 0)) { return ""; @@ -177,9 +178,9 @@ public class MSC extends HMSCElement { return guard; } - private ArrayList<Evt> getEffectiveGuardEvtsBefore(Evt evt) { - ArrayList<Evt> al = new ArrayList(); - ArrayList<Evt> tmp = getAllPredecesorsOf(evt); + private List<Evt> getEffectiveGuardEvtsBefore(Evt evt) { + List<Evt> al = new ArrayList<Evt>(); + List<Evt> tmp = getAllPredecesorsOf(evt); int i; Evt evt1; @@ -188,7 +189,7 @@ public class MSC extends HMSCElement { evt1 = tmp.get(i); if ((evt1 != evt) && (evt1.getType() == Evt.GUARD)) { // test if no [end] guard which is after evt1 but before evt - ArrayList<Evt> intersec = getIntersecOf(tmp, getAllNextsOf(evt1)); + List<Evt> intersec = getIntersecOf(tmp, getAllNextsOf(evt1)); if (!hasEndGuard(intersec)) { al.add(evt1); } @@ -199,10 +200,10 @@ public class MSC extends HMSCElement { } public Evt getEndGuard(Evt evt) { - ArrayList<Evt> al = getAllNextsOf(evt); - ArrayList<Evt> eal = new ArrayList<Evt>(); + List<Evt> al = getAllNextsOf(evt); + List<Evt> eal = new ArrayList<Evt>(); - int i; + //int i; for(Evt evt1: al) { if (evt1.getType() == Evt.END_GUARD) { @@ -219,10 +220,10 @@ public class MSC extends HMSCElement { } public Evt getPreviousGuardEvt(Evt evt) { - ArrayList<Evt> al = getAllPredecesorsOf(evt); - ArrayList<Evt> eal = new ArrayList<Evt>(); + List<Evt> al = getAllPredecesorsOf(evt); + List<Evt> eal = new ArrayList<Evt>(); - int i; + //int i; for(Evt evt1: al) { if (evt1.isAGuardEvt()) { @@ -243,7 +244,7 @@ public class MSC extends HMSCElement { } - private boolean hasEndGuard(ArrayList<Evt> list) { + private boolean hasEndGuard( List<Evt> list) { for(Evt evt:list) { if (evt.getType() == Evt.END_GUARD) { return true; @@ -252,9 +253,9 @@ public class MSC extends HMSCElement { return false; } - private ArrayList<Evt> getAllPredecesorsOf(Evt evt) { - ArrayList<Evt> al = getImmediatePredecessorsOf(evt); - ArrayList<Evt> tmp; + private List<Evt> getAllPredecesorsOf(Evt evt) { + List<Evt> al = getImmediatePredecessorsOf(evt); + List<Evt> tmp; Evt evt1, evt2; int i, j; @@ -276,14 +277,14 @@ public class MSC extends HMSCElement { return al; } - private ArrayList<Evt> getImmediatePredecessorsOf(Evt evt) { - ArrayList<Evt> al = new ArrayList<Evt>(); + private List<Evt> getImmediatePredecessorsOf(Evt evt) { + List<Evt> al = new ArrayList<Evt>(); Order order; - ListIterator iterator = orders.listIterator(); + Iterator<Order> iterator = orders.listIterator(); while(iterator.hasNext()) { - order = (Order)(iterator.next()); + order = iterator.next(); if (order.evt2 == evt) { if (order.evt1 != evt) { al.add(order.evt1); @@ -294,9 +295,9 @@ public class MSC extends HMSCElement { return al; } - private ArrayList<Evt> getAllNextsOf(Evt evt) { - ArrayList<Evt> al = getAllImmediateNextsOf(evt); - ArrayList<Evt> tmp; + private List<Evt> getAllNextsOf(Evt evt) { + List<Evt> al = getAllImmediateNextsOf(evt); + List<Evt> tmp; Evt evt1, evt2; int i, j; @@ -317,14 +318,14 @@ public class MSC extends HMSCElement { return al; } - private ArrayList<Evt> getAllImmediateNextsOf(Evt evt) { - ArrayList<Evt> al = new ArrayList<Evt>(); + private List<Evt> getAllImmediateNextsOf(Evt evt) { + List<Evt> al = new ArrayList<Evt>(); Order order; - ListIterator iterator = orders.listIterator(); + Iterator<Order> iterator = orders.listIterator(); while(iterator.hasNext()) { - order = (Order)(iterator.next()); + order = iterator.next(); if (order.evt1 == evt) { if (order.evt2 != evt) { al.add(order.evt2); @@ -335,8 +336,8 @@ public class MSC extends HMSCElement { return al; } - private ArrayList<Evt> getIntersecOf(ArrayList<Evt> list1, ArrayList<Evt> list2) { - ArrayList<Evt> list = new ArrayList<Evt>(); + private List<Evt> getIntersecOf( List<Evt> list1, List<Evt> list2) { + List<Evt> list = new ArrayList<Evt>(); for(Evt evt:list1) { if (list2.contains(evt)) { list.add(evt); @@ -349,7 +350,7 @@ public class MSC extends HMSCElement { // Computes the nb of evts that occur in the instance before // the evt given as parameter - ArrayList<Evt> metEvts = new ArrayList<Evt>(); + List<Evt> metEvts = new ArrayList<Evt>(); computeAllEvtsBefore(metEvts, _evt); @@ -357,15 +358,15 @@ public class MSC extends HMSCElement { return (metEvts.size() - 1); } - private void computeAllEvtsBefore(ArrayList<Evt> _metEvts, Evt _evt) { - ListIterator iterator; + private void computeAllEvtsBefore( List<Evt> _metEvts, Evt _evt) { + Iterator<Order> iterator; Order order; _metEvts.add(_evt); iterator = orders.listIterator(); while(iterator.hasNext()) { - order = (Order)(iterator.next()); + order = iterator.next(); if(order.evt2 == _evt) { if (order.evt1.getInstance() == _evt.getInstance()) { if (!_metEvts.contains(order.evt1)) { diff --git a/src/sdtranslator/SDTranslator.java b/src/sdtranslator/SDTranslator.java index 638205d84b..8cac629639 100755 --- a/src/sdtranslator/SDTranslator.java +++ b/src/sdtranslator/SDTranslator.java @@ -53,10 +53,10 @@ import java.util.*; public class SDTranslator { private HMSC hmsc; - private LinkedList instances; - private LinkedList evtstolink; - private LinkedList tctolink; - private LinkedList actionInstances; // for managing instances having no action in sds. + private List<Instance> instances; + private List<EvtToLink> evtstolink; + private List<TimeConstraintLink> tctolink; + // private List<Instance> actionInstances; // for managing instances having no action in sds. private TURTLEModeling tm; @@ -70,10 +70,10 @@ public class SDTranslator { } public TURTLEModeling toTURTLEModeling() throws SDTranslationException { - evtstolink = new LinkedList(); - tctolink = new LinkedList(); + evtstolink = new LinkedList<EvtToLink>(); + tctolink = new LinkedList<TimeConstraintLink>(); tm = new TURTLEModeling(); - actionInstances = new LinkedList(); + // actionInstances = new LinkedList<Instance>(); //renameMessages(); //should be unique -> a from I1 to I2 : a__I1__to__I2 //System.out.println("\n\ntoTURTLEModeling:\nMaking instances"); addClasses(); @@ -132,9 +132,9 @@ public class SDTranslator { private void addClasses() throws SDTranslationException { Instance ins; TClass t; - ListIterator iterator = instances.listIterator(); + Iterator<Instance> iterator = instances.listIterator(); while(iterator.hasNext()) { - ins = (Instance)(iterator.next()); + ins = iterator.next(); t = new TClass(ins.getName(), true); //System.out.println("Adding TClass: " + t.getName()); tm.addTClass(t); @@ -143,10 +143,10 @@ public class SDTranslator { private void makeInstancesBehavior() throws SDTranslationException{ Instance ins; - ListIterator iterator = instances.listIterator(); + Iterator<Instance> iterator = instances.listIterator(); TClass t; while(iterator.hasNext()) { - ins = (Instance)(iterator.next()); + ins = iterator.next(); t = tm.getTClassWithName(ins.getName()); //System.out.println("Managing instance: " + ins.getName()); makeInstanceBehavior(ins, t); @@ -155,11 +155,11 @@ public class SDTranslator { // The hmsc is considered to be safe private void makeInstanceBehavior(Instance ins, TClass t) throws SDTranslationException { - ListIterator iterator = instances.listIterator(); + //Iterator<Instance> iterator = instances.listIterator(); ActivityDiagram ad; - LinkedList nodes; - LinkedList nodesUsed; - LinkedList adcomponents; + List<HMSCNode> nodes; + // List<HMSCNode> nodesUsed; + List<ADComponent> adcomponents; int i; int type; ADJunction adj; @@ -183,11 +183,11 @@ public class SDTranslator { // Building correspondance between nodes and junction + choice //hmsc.print(); nodes = hmsc.getListOfNodes(); - adcomponents = new LinkedList(); - iterator = nodes.listIterator(); + adcomponents = new LinkedList<ADComponent>(); + Iterator<HMSCNode> iterator = nodes.listIterator(); while(iterator.hasNext()) { - node = (HMSCNode)(iterator.next()); + node = iterator.next(); type = node.getType(); switch(type) { case HMSCNode.STOP: @@ -241,14 +241,14 @@ public class SDTranslator { } } - private void translateNode(Instance ins, TClass t, HMSCNode n, ADComponent adc, ActivityDiagram ad, LinkedList nodes, LinkedList adcomponents) throws SDTranslationException { + private void translateNode(Instance ins, TClass t, HMSCNode n, ADComponent adc, ActivityDiagram ad, List<HMSCNode> nodes, List<ADComponent> adcomponents) throws SDTranslationException { translateNodetoNodes(ins, n, adc, nodes, adcomponents); translateNodetoMSCs(ins, t, n, adc, ad, nodes, adcomponents); } - private void translateNodetoNodes(Instance ins, HMSCNode n, ADComponent adc, LinkedList nodes, LinkedList adcomponents) { - LinkedList list = n.getNextNodes(); - ListIterator iterator = list.listIterator(); + private void translateNodetoNodes(Instance ins, HMSCNode n, ADComponent adc, List<HMSCNode> nodes, List<ADComponent> adcomponents) { + List<HMSCNode> list = n.getNextNodes(); + Iterator<HMSCNode> iterator = list.listIterator(); HMSCNode node; ADComponent adc1; int index; @@ -275,14 +275,14 @@ public class SDTranslator { } } - private void translateNodetoMSCs(Instance ins, TClass t, HMSCNode n, ADComponent adc, ActivityDiagram ad, LinkedList nodes, LinkedList adcomponents) throws SDTranslationException{ + private void translateNodetoMSCs(Instance ins, TClass t, HMSCNode n, ADComponent adc, ActivityDiagram ad, List<HMSCNode> nodes, List<ADComponent> adcomponents) throws SDTranslationException{ MSC msc; - LinkedList mscs = n.getNextMSCs(); + List<MSC> mscs = n.getNextMSCs(); int id = 0; - ListIterator iterator = mscs.listIterator(); + Iterator<MSC> iterator = mscs.listIterator(); while(iterator.hasNext()) { - msc = (MSC)(iterator.next()); + msc = iterator.next(); translateNodeToMSC(ins, t, msc, n, adc, id, ad, nodes, adcomponents); id ++; } @@ -292,19 +292,21 @@ public class SDTranslator { // for example, if e1 < e2 and e2 <e3, the list does not contain e1 < e3 // If an event is not ordered with regard to another one -> link to the last Parallel bar // id of the MSCs in the list of next MSCs ... - private void translateNodeToMSC(Instance ins, TClass t, MSC msc, HMSCNode n, ADComponent adc, int id, ActivityDiagram ad, LinkedList nodes, LinkedList adcomponents) throws SDTranslationException{ + private void translateNodeToMSC(Instance ins, TClass t, MSC msc, HMSCNode n, ADComponent adc, int id, ActivityDiagram ad, List<HMSCNode> nodes, List<ADComponent> adcomponents) throws SDTranslationException{ HMSCNode node; int index; ADParallel last, first; //ADParallel bar1, bar2; - LinkedList evts, orders, actions; + List<Evt> evts; + List<Order> orders; + List<ActionEvt> actions; Evt evt1; - ListIterator iterator, iterator1; + //Iterator iterator, iterator1; Order order1; ActionEvt aevt, aevt1, aevt2; EvtToLink etl; String guard; - ADChoice adch; + //ADChoice adch; // Settling the last bar and its link to next ADComponent last = new ADParallel(); @@ -335,12 +337,12 @@ public class SDTranslator { } // Building an action per event - actions = new LinkedList(); + actions = new LinkedList<ActionEvt>(); evts = msc.getEvts(); - iterator = evts.listIterator(); + Iterator<Evt> iterator = evts.listIterator(); while(iterator.hasNext()) { - evt1 = (Evt)(iterator.next()); + evt1 = iterator.next(); if (evt1.getInstance() == ins){ aevt = new ActionEvt(evt1, ad); @@ -365,17 +367,17 @@ public class SDTranslator { // Dealing with orders between events // first iteration -> link those leading ordered orders = msc.getOrders(); - iterator = orders.listIterator(); + Iterator<Order> ordIterator = orders.listIterator(); //System.out.println("Dealing with order "); - while(iterator.hasNext()) { - order1 = (Order)(iterator.next()); + while(ordIterator.hasNext()) { + order1 = ordIterator.next(); //System.out.println("order "); // if the two evts are involved -> used at activity diagram level - iterator1 = actions.listIterator(); + Iterator<ActionEvt> actIt = actions.listIterator(); aevt1 = null; aevt2 = null; - while(iterator1.hasNext()) { - aevt = (ActionEvt)(iterator1.next()); + while( actIt.hasNext()) { + aevt = actIt.next(); if (aevt.evt == order1.evt1) aevt1 = aevt; if (aevt.evt == order1.evt2) @@ -424,9 +426,9 @@ public class SDTranslator { } // second iteration -> when no order, executed at the beginning, and when no following order -> linked to last one - iterator1 = actions.listIterator(); - while(iterator1.hasNext()) { - aevt = (ActionEvt)(iterator1.next()); + Iterator<ActionEvt> actIterator = actions.listIterator(); + while( actIterator.hasNext()) { + aevt = actIterator.next(); //order before? if (ad.getNbComponentLeadingTo(aevt.getFirst()) == 0) { @@ -477,26 +479,27 @@ public class SDTranslator { // sync, inv between instances private void makeInstancesRelations() throws SDTranslationException { - Iterator iterator1, iterator2, iterator3; - LinkedList mscs, links; + //Iterator iterator1, iterator2, iterator3; + List<MSC> mscs; + List<LinkEvts> links; MSC msc; LinkEvts le; EvtToLink evtlink, evtlk1, evtlk2; Relation r; mscs = hmsc.getMSCs(); - iterator1 = mscs.listIterator(); + Iterator<MSC> mscIterator = mscs.listIterator(); - while(iterator1.hasNext()) { - msc = (MSC)(iterator1.next()); + while( mscIterator.hasNext()) { + msc = mscIterator.next(); links = msc.getLinksEvts(); - iterator2 = links.listIterator(); - while(iterator2.hasNext()) { - le = (LinkEvts)(iterator2.next()); - iterator3 = evtstolink.listIterator(); + Iterator<LinkEvts> linksIterator = links.listIterator(); + while( linksIterator.hasNext()) { + le = linksIterator.next(); + Iterator<EvtToLink> evtLinkIterator = evtstolink.listIterator(); evtlk1 = null; evtlk2 = null; - while(iterator3.hasNext()) { - evtlink = (EvtToLink)(iterator3.next()); + while( evtLinkIterator.hasNext()) { + evtlink = evtLinkIterator.next(); if (evtlink.evt == le.evt1) { evtlk1 = evtlink; } @@ -622,55 +625,55 @@ public class SDTranslator { } } } - - private void makeChannelsRelations() { - - // Synchro between in channels and out channels (same name : Channel__msg__IN and Channel__msg__OUT) - TClass tin, tout; - int i, j, k; - String sin, sout, param; - Relation r; - Gate gin, gout; - - for(i=0; i<tm.classNb(); i++) { - tin = tm.getTClassAtIndex(i); - if (tin instanceof TClassBufferIn) { - for(j=0; j<tm.classNb(); j++) { - tout = tm.getTClassAtIndex(j); - if (tout instanceof TClassBufferOut) { - //System.out.println("Found corresponding tin and tout"); - sin = tin.getName(); - sin = sin.substring(0, sin.length() - 2); - sout = tout.getName(); - sout = sout.substring(0, sout.length() - 3); - //System.out.println("name tin = " + sin + " name tout = " + sout); - if (sin.compareTo(sout) ==0) { - //System.out.println("Same name!"); - r = tm.syncRelationBetween(tin, tout); - if (r == null) { - r = new Relation(Relation.SYN, tin, tout, false); - tm.addRelation(r); - } - // Obtain param - for(k=0; k<((TClassBuffer)tin).getParamInNb(); k++) { - param = ((TClassBuffer)tin).getParamInAt(k); - gin = tin.getGateByName(param); - gout = tout.getGateByName(param); - if ((gin != null) && (gout != null)) { - r.addGates(gin, gout); - } - } - // Get gates - // Connect gates - } - } - } - } - } - } - +// +// private void makeChannelsRelations() { +// +// // Synchro between in channels and out channels (same name : Channel__msg__IN and Channel__msg__OUT) +// TClass tin, tout; +// int i, j, k; +// String sin, sout, param; +// Relation r; +// Gate gin, gout; +// +// for(i=0; i<tm.classNb(); i++) { +// tin = tm.getTClassAtIndex(i); +// if (tin instanceof TClassBufferIn) { +// for(j=0; j<tm.classNb(); j++) { +// tout = tm.getTClassAtIndex(j); +// if (tout instanceof TClassBufferOut) { +// //System.out.println("Found corresponding tin and tout"); +// sin = tin.getName(); +// sin = sin.substring(0, sin.length() - 2); +// sout = tout.getName(); +// sout = sout.substring(0, sout.length() - 3); +// //System.out.println("name tin = " + sin + " name tout = " + sout); +// if (sin.compareTo(sout) ==0) { +// //System.out.println("Same name!"); +// r = tm.syncRelationBetween(tin, tout); +// if (r == null) { +// r = new Relation(Relation.SYN, tin, tout, false); +// tm.addRelation(r); +// } +// // Obtain param +// for(k=0; k<((TClassBuffer)tin).getParamInNb(); k++) { +// param = ((TClassBuffer)tin).getParamInAt(k); +// gin = tin.getGateByName(param); +// gout = tout.getGateByName(param); +// if ((gin != null) && (gout != null)) { +// r.addGates(gin, gout); +// } +// } +// // Get gates +// // Connect gates +// } +// } +// } +// } +// } +// } +// private void makeTimers() throws SDTranslationException { - Iterator iterator1; + //Iterator iterator1; //LinkedList mscs, links; //MSC msc; @@ -682,9 +685,9 @@ public class SDTranslator { String timerName, tclassName; - iterator1 = evtstolink.listIterator(); + Iterator<EvtToLink> iterator1 = evtstolink.listIterator(); while(iterator1.hasNext()) { - evtlink = (EvtToLink)(iterator1.next()); + evtlink = iterator1.next(); if (evtlink.evt.getType() == Evt.TIMER_SET) { //System.out.println("Timer set"); timerName = evtlink.evt.getTimerName(); @@ -854,8 +857,9 @@ public class SDTranslator { } private void makeTimeConstraints() { - LinkedList mscs, tcs; - ListIterator iterator1, iterator2; + List<MSC> mscs; + List<TimeConstraint> tcs; + //ListIterator iterator1, iterator2; TimeConstraint tc; TimeConstraintLink tcl; MSC msc; @@ -865,14 +869,14 @@ public class SDTranslator { // For each time constraint, a TimeConstraintLink is built mscs = hmsc.getMSCs(); - iterator1 = mscs.listIterator(); + Iterator<MSC> iterator1 = mscs.listIterator(); while(iterator1.hasNext()) { - msc = (MSC)(iterator1.next()); + msc = iterator1.next(); tcs = msc.getTimeConstraints(); - iterator2 = tcs.listIterator(); + Iterator<TimeConstraint> iterator2 = tcs.listIterator(); while(iterator2.hasNext()) { - tc = (TimeConstraint)(iterator2.next()); + tc = iterator2.next(); //System.out.println("tc found"); tcl = new TimeConstraintLink(tc, msc); tcl.build(); @@ -888,9 +892,9 @@ public class SDTranslator { // * no absolute constraint on the end TimeConstraintLink tclink; - iterator1 = tctolink.listIterator(); - while(iterator1.hasNext()) { - tclink = (TimeConstraintLink)(iterator1.next()); + Iterator<TimeConstraintLink> tclIterator = tctolink.listIterator(); + while( tclIterator.hasNext()) { + tclink = tclIterator.next(); if (tclink.tc.type == TimeConstraint.RELATIVE) { evt1 = null; evt1 = tclink.msc.hasExactlyOnePreviousEvt(tclink.tc.evt2); @@ -908,13 +912,13 @@ public class SDTranslator { private void manageTimeConstraint(ActionEvt aevt, TClass t) { // Is there a time constraint regarding this evt ? - ListIterator iterator1; + // ListIterator iterator1; TimeConstraintLink tclink; - Param p; + // Param p; - iterator1 = tctolink.listIterator(); + Iterator<TimeConstraintLink> iterator1 = tctolink.listIterator(); while(iterator1.hasNext()) { - tclink = (TimeConstraintLink)(iterator1.next()); + tclink = iterator1.next(); if (tclink.tc.type == TimeConstraint.RELATIVE) { //System.out.println("*** -> Relative time constraint"); if (tclink.tc.evt1 == aevt.evt) { @@ -957,67 +961,67 @@ public class SDTranslator { } } - private void manageInfiniteLoops() { - ActionInstance ai1, ai2; - boolean found; - Iterator iterator1, iterator2; - ADActionStateWithGate adsg1, adsg2; - ADStop adstop; - Gate g1, g2; - - //looks for instances with no action in sd; - iterator1 = actionInstances.listIterator(); - - while (iterator1.hasNext()) { - ai1 = (ActionInstance)(iterator1.next()); - if (ai1.nbAction == 0) { - // look for another instance with actions and in the same msc - iterator2 = actionInstances.listIterator(); - found = false; - ai2 = null; - while (iterator2.hasNext()) { - ai2 = (ActionInstance)(iterator2.next()); - if ((ai2.msc == ai1.msc) && (ai2.nbAction >0)) { - found = true; - break; - } - } - if (found) { - g1 = ai1.t.addNewGateIfApplicable("NoAction__" + ai1.ins.getName() + "__" + ai2.ins.getName() + "__" + ai1.msc.getName()); - adsg1 = new ADActionStateWithGate(g1); - adsg1.setActionValue(""); - ai1.first.addNext(adsg1); - adsg1.addNext(ai1.last); - ai1.t.getActivityDiagram().add(adsg1); - - g2 = ai2.t.addNewGateIfApplicable("NoAction__" + ai1.ins.getName() + "__" + ai2.ins.getName() + "__" + ai1.msc.getName()); - adsg2 = new ADActionStateWithGate(g2); - adsg2.setActionValue(""); - ai2.first.addNext(adsg2); - adstop = new ADStop(); - adsg2.addNext(adstop); - ai2.t.getActivityDiagram().add(adsg2); - ai2.t.getActivityDiagram().add(adstop); - - // synchro link between the two tclasses - tm.addSynchroRelation(ai1.t, g1, ai2.t, g2); - //System.out.println("Adding synchro relation between " + ai1.t.getName() + " and " + ai2.t.getName()); - - } else { - // potential infinite loop - System.out.println("Warning: instance " + ai1.ins + " has no action in scenario " + ai1.msc.getName()); - ai1.first.addNext(ai1.last); - } - } - } - } +// private void manageInfiniteLoops() { +// ActionInstance ai1, ai2; +// boolean found; +// Iterator iterator1, iterator2; +// ADActionStateWithGate adsg1, adsg2; +// ADStop adstop; +// Gate g1, g2; +// +// //looks for instances with no action in sd; +// iterator1 = actionInstances.listIterator(); +// +// while (iterator1.hasNext()) { +// ai1 = (ActionInstance)(iterator1.next()); +// if (ai1.nbAction == 0) { +// // look for another instance with actions and in the same msc +// iterator2 = actionInstances.listIterator(); +// found = false; +// ai2 = null; +// while (iterator2.hasNext()) { +// ai2 = (ActionInstance)(iterator2.next()); +// if ((ai2.msc == ai1.msc) && (ai2.nbAction >0)) { +// found = true; +// break; +// } +// } +// if (found) { +// g1 = ai1.t.addNewGateIfApplicable("NoAction__" + ai1.ins.getName() + "__" + ai2.ins.getName() + "__" + ai1.msc.getName()); +// adsg1 = new ADActionStateWithGate(g1); +// adsg1.setActionValue(""); +// ai1.first.addNext(adsg1); +// adsg1.addNext(ai1.last); +// ai1.t.getActivityDiagram().add(adsg1); +// +// g2 = ai2.t.addNewGateIfApplicable("NoAction__" + ai1.ins.getName() + "__" + ai2.ins.getName() + "__" + ai1.msc.getName()); +// adsg2 = new ADActionStateWithGate(g2); +// adsg2.setActionValue(""); +// ai2.first.addNext(adsg2); +// adstop = new ADStop(); +// adsg2.addNext(adstop); +// ai2.t.getActivityDiagram().add(adsg2); +// ai2.t.getActivityDiagram().add(adstop); +// +// // synchro link between the two tclasses +// tm.addSynchroRelation(ai1.t, g1, ai2.t, g2); +// //System.out.println("Adding synchro relation between " + ai1.t.getName() + " and " + ai2.t.getName()); +// +// } else { +// // potential infinite loop +// System.out.println("Warning: instance " + ai1.ins + " has no action in scenario " + ai1.msc.getName()); +// ai1.first.addNext(ai1.last); +// } +// } +// } +// } - private ActionEvt getActionEvt(LinkedList actions, Evt evtToFind) { - ListIterator iterator = actions.listIterator(); + private ActionEvt getActionEvt( List<ActionEvt> actions, Evt evtToFind) { + Iterator<ActionEvt> iterator = actions.listIterator(); ActionEvt ae; while(iterator.hasNext()) { - ae = (ActionEvt)(iterator.next()); + ae = iterator.next(); if (ae.evt == evtToFind) { return ae; } diff --git a/src/tmatrix/RequirementModeling.java b/src/tmatrix/RequirementModeling.java index 7344ea9f94..2cb02d15a9 100755 --- a/src/tmatrix/RequirementModeling.java +++ b/src/tmatrix/RequirementModeling.java @@ -62,16 +62,16 @@ public class RequirementModeling { protected static final String UNKNOWN_DIAGRAM_NAME = "is an unknown diagram"; protected static final String BAD_FORMATTING = "Bad formal description"; - private LinkedList matrix; - private LinkedList<CheckingError> errors, warnings; + private List<Requirements> matrix; + private List<CheckingError> errors, warnings; private MainGUI mgui; // reqs should contain only formal requirement - public RequirementModeling(Vector reqs, RequirementDiagramPanel rdp, MainGUI _mgui) { + public RequirementModeling(Vector<Requirement> reqs, RequirementDiagramPanel rdp, MainGUI _mgui) { mgui = _mgui; - matrix = new LinkedList(); + matrix = new LinkedList<Requirements>(); errors = new LinkedList<CheckingError> (); warnings = new LinkedList<CheckingError> (); @@ -82,19 +82,19 @@ public class RequirementModeling { } - public void generateFirstMatrix(Vector reqs, RequirementDiagramPanel rdp) { + public void generateFirstMatrix(Vector<Requirement> reqs, RequirementDiagramPanel rdp) { Requirement r; int i, j; CheckingError ce; Requirements rs; - ListIterator iterator; + Iterator<TGComponent> iterator; TGComponent tgc; int cpt; String tab[]; RequirementObserver ro; for(i=0; i<reqs.size(); i++) { - r = (Requirement)(reqs.elementAt(i)); + r = reqs.elementAt(i); if (!(r.isFormal())) { ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, NOT_FORMAL); ce.setTDiagramPanel(rdp); @@ -105,7 +105,7 @@ public class RequirementModeling { // Search for all observers linked only to this formal requirement with a "verify" semantics iterator = rdp.getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof RequirementObserver) { ro = (RequirementObserver)tgc; cpt = rdp.nbOfVerifyStartingAt(tgc); @@ -139,7 +139,7 @@ public class RequirementModeling { // For each (req,obs,diagram), a TURTLE modeling is generated public void generateTURTLEModelings() { Requirements reqs; - ListIterator iterator = matrix.listIterator(); + Iterator<Requirements> iterator = matrix.listIterator(); TURTLEPanel tp; CheckingError ce; //int sizee; @@ -171,7 +171,7 @@ public class RequirementModeling { // RT-LOTOS is used by default public void generateFormalSpecification() { Requirements reqs; - ListIterator iterator = matrix.listIterator(); + Iterator<Requirements> iterator = matrix.listIterator(); //TURTLEPanel tp; //CheckingError ce; @@ -186,15 +186,15 @@ public class RequirementModeling { } } - public LinkedList<CheckingError> getCheckingErrors() { + public List<CheckingError> getCheckingErrors() { return errors; } - public LinkedList<CheckingError> getWarnings() { + public List<CheckingError> getWarnings() { return warnings; } - public LinkedList getMatrix() { + public List<Requirements> getMatrix() { return matrix; } @@ -212,11 +212,11 @@ public class RequirementModeling { public String toString() { Requirements reqs; - ListIterator iterator = matrix.listIterator(); + Iterator<Requirements> iterator = matrix.listIterator(); String ret = ""; while(iterator.hasNext()) { - reqs = (Requirements)(iterator.next()); + reqs = iterator.next(); ret += reqs.toString() + "\n"; } @@ -225,7 +225,7 @@ public class RequirementModeling { private void buildTURTLEModelingFromTURTLEPanel(Requirements reqs, TURTLEPanel tp) { TURTLEModeling tm; - CorrespondanceTGElement listE; + // CorrespondanceTGElement listE; LinkedList<CheckingError> errorstmp; CheckingError ce; @@ -274,7 +274,7 @@ public class RequirementModeling { //tm.print(); - listE = dpt.getCorrespondanceTGElement(); + // listE = dpt.getCorrespondanceTGElement(); errors = dpt.getErrors(); if ((errors != null) && (errors.size()>0)) { //System.out.println("Errors 1"); @@ -465,7 +465,7 @@ public class RequirementModeling { public boolean analysisTime(Requirements reqs, String time) { try { - int i = Integer.decode(time).intValue(); + /*int i =*/ Integer.decode(time).intValue(); } catch (NumberFormatException nfe) { CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, reqs.req.getValue() + ", value: " + time + " " + "is not a correct time value"); ce.setTDiagramPanel(reqs.req.getTDiagramPanel()); @@ -895,7 +895,7 @@ public class RequirementModeling { System.out.println("Criticality: MEDIUM"); ADStop adstop; ADParallel adpar = new ADParallel(); - Vector tclasses = new Vector(); + Vector<TClass> tclasses = new Vector<TClass>(); Gate g, go; TClass to; ADActionStateWithGate action; diff --git a/src/tmltranslator/HwNode.java b/src/tmltranslator/HwNode.java index 5dddcfc2a4..4f0be4994e 100755 --- a/src/tmltranslator/HwNode.java +++ b/src/tmltranslator/HwNode.java @@ -45,7 +45,6 @@ knowledge of the CeCILL license and that you accept its terms. package tmltranslator; -import java.util.*; import tmltranslator.modelcompiler.*; diff --git a/src/tmltranslator/TMLActivityElement.java b/src/tmltranslator/TMLActivityElement.java index 8ae3fbdd6d..b415034d78 100755 --- a/src/tmltranslator/TMLActivityElement.java +++ b/src/tmltranslator/TMLActivityElement.java @@ -54,7 +54,7 @@ public class TMLActivityElement extends TMLElement{ private String value=""; public TMLActivityElement(String _name, Object _referenceObject) { super(_name, _referenceObject); - nexts = new Vector(); + nexts = new Vector<TMLActivityElement>(); } @@ -91,7 +91,7 @@ public class TMLActivityElement extends TMLElement{ return nexts; } - public void setNexts(Vector _nexts) { + public void setNexts(Vector<TMLActivityElement> _nexts) { nexts = _nexts; } diff --git a/src/tmltranslator/TMLModeling.java b/src/tmltranslator/TMLModeling.java index aef4ea23eb..1abcaa0520 100755 --- a/src/tmltranslator/TMLModeling.java +++ b/src/tmltranslator/TMLModeling.java @@ -52,24 +52,23 @@ import ui.tmlcompd.*; import ui.TAttribute; import avatartranslator.*; import proverifspec.*; -//import compiler.expression.*; public class TMLModeling { - private ArrayList<TMLTask> tasks; - private ArrayList<TMLChannel> channels; - private ArrayList<TMLRequest> requests; - private ArrayList<TMLEvent> events; - private ArrayList<String[]> pragmas; - public ArrayList<String> securityPatterns=new ArrayList<String>(); + private List<TMLTask> tasks; + private List<TMLChannel> channels; + private List<TMLRequest> requests; + private List<TMLEvent> events; + private List<String[]> pragmas; + public List<String> securityPatterns=new ArrayList<String>(); private TMLElement correspondance[]; - public ArrayList<SecurityPattern> secPatterns = new ArrayList<SecurityPattern>(); + public List<SecurityPattern> secPatterns = new ArrayList<SecurityPattern>(); private boolean optimized = false; - public HashMap<String, String> secChannelMap = new HashMap<String, String>(); - public HashMap<SecurityPattern, ArrayList<TMLTask>> securityTaskMap = new HashMap<SecurityPattern, ArrayList<TMLTask>>(); + public Map<String, String> secChannelMap = new HashMap<String, String>(); + public Map<SecurityPattern, List<TMLTask>> securityTaskMap = new HashMap<SecurityPattern, List<TMLTask>>(); private String[] ops = {">", "<", "+", "-", "*", "/", "[", "]", "(", ")", ":", "=", "==", ","}; - private HashMap<TGComponent, String> checkedActivities = new HashMap<TGComponent, String>(); + private Map<TGComponent, String> checkedActivities = new HashMap<TGComponent, String>(); private int hashCode; private boolean hashCodeComputed = false; @@ -94,7 +93,7 @@ public class TMLModeling { checkedActivities.put(tgc,s); } - public HashMap<TGComponent, String> getCheckedComps(){ + public Map<TGComponent, String> getCheckedComps(){ return checkedActivities; } public SecurityPattern getSecurityPattern(String s){ @@ -261,23 +260,26 @@ public class TMLModeling { } - public String listToString(ArrayList ll) { + public String listToString( List<? extends TMLElement> ll) { String s=""; - ListIterator iterator = ll.listIterator(); + Iterator<? extends TMLElement> iterator = ll.listIterator(); TMLElement tmle; while(iterator.hasNext()) { - tmle = (TMLElement)(iterator.next()); + tmle = iterator.next(); s += tmle.getName() + " "; } + return s; } public boolean hasSameChannelName(TMLChannel _channel) { TMLChannel channel; - ListIterator iterator = channels.listIterator(); + Iterator<TMLChannel> iterator = channels.listIterator(); + while(iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + channel = iterator.next(); + if (channel.getName().compareTo(_channel.getName()) == 0) { return true; } @@ -288,9 +290,11 @@ public class TMLModeling { public boolean hasAlmostSimilarChannel(TMLChannel _channel) { TMLChannel channel; - ListIterator iterator = channels.listIterator(); + Iterator<TMLChannel> iterator = channels.listIterator(); + while(iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + channel = iterator.next(); + if (channel.getName().compareTo(_channel.getName()) == 0) { if (channel.getSize() != _channel.getSize()) { return true; @@ -313,7 +317,8 @@ public class TMLModeling { public boolean hasSameRequestName(TMLRequest _request) { TMLRequest request; - ListIterator iterator = requests.listIterator(); + Iterator<TMLRequest> iterator = requests.listIterator(); + while(iterator.hasNext()) { request = (TMLRequest)(iterator.next()); if (request != _request) { @@ -327,9 +332,10 @@ public class TMLModeling { public TMLRequest getRequestNamed(String name) { TMLRequest request; - ListIterator iterator = requests.listIterator(); + Iterator<TMLRequest> iterator = requests.listIterator(); + while(iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + request = iterator.next(); //System.out.println("Request=" +request.getName() + " name=" + name); if (request.getName().compareTo(name) == 0) { return request; @@ -341,13 +347,14 @@ public class TMLModeling { // Returns a similar request if found public TMLRequest hasSimilarRequest(TMLRequest _request) { - TMLRequest request; + TMLRequest request; int i; - ListIterator iterator = requests.listIterator(); + Iterator<TMLRequest> iterator = requests.listIterator(); while(iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + request = iterator.next(); + if (request.getName().compareTo(_request.getName()) == 0) { // must verify whether a param is different or not. if (request.getNbOfParams() != _request.getNbOfParams()) { @@ -375,9 +382,11 @@ public class TMLModeling { public boolean hasSameEventName(TMLEvent _event) { TMLEvent event; - ListIterator iterator = events.listIterator(); + Iterator<TMLEvent> iterator = events.listIterator(); + while(iterator.hasNext()) { - event = (TMLEvent)(iterator.next()); + event = iterator.next(); + if (event.getName().compareTo(_event.getName()) == 0) { return true; } @@ -389,7 +398,7 @@ public class TMLModeling { TMLEvent event; int i; - ListIterator iterator = events.listIterator(); + Iterator<TMLEvent> iterator = events.listIterator(); while(iterator.hasNext()) { event = (TMLEvent)(iterator.next()); @@ -419,9 +428,11 @@ public class TMLModeling { public TMLTask getTMLTaskByName(String _name) { TMLTask task; - ListIterator iterator = tasks.listIterator(); + Iterator<TMLTask> iterator = tasks.listIterator(); + while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + task = iterator.next(); + if (task.getName().compareTo(_name) == 0) { return task; } @@ -436,10 +447,11 @@ public class TMLModeling { String [] list = new String[tasks.size()]; TMLTask task; - ListIterator iterator = tasks.listIterator(); + Iterator<TMLTask> iterator = tasks.listIterator(); int cpt = 0; + while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + task = iterator.next(); list[cpt] = task.getName() + " (" + task.getID() + ")"; cpt ++; } @@ -453,13 +465,15 @@ public class TMLModeling { String [] list = new String[channels.size()]; TMLChannel ch; - ListIterator iterator = channels.listIterator(); + Iterator<TMLChannel> iterator = channels.listIterator(); int cpt = 0; + while(iterator.hasNext()) { - ch = (TMLChannel)(iterator.next()); + ch = iterator.next(); list[cpt] = ch.getName() + " (" + ch.getID() + ")"; cpt ++; } + return list; } @@ -491,13 +505,16 @@ public class TMLModeling { public TMLTask getTMLTaskByCommandID(int id) { TMLTask task; - ListIterator iterator = tasks.listIterator(); + Iterator<TMLTask> iterator = tasks.listIterator(); + while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + task = iterator.next(); + if (task.hasCommand(id)) { return task; } } + return null; } @@ -517,61 +534,76 @@ public class TMLModeling { public TMLChannel getChannelByName(String _name) { TMLChannel ch; - ListIterator iterator = channels.listIterator(); + Iterator<TMLChannel> iterator = channels.listIterator(); + while(iterator.hasNext()) { - ch = (TMLChannel)(iterator.next()); + ch = iterator.next(); + if (ch.getName().compareTo(_name) == 0) { return ch; } } + return null; } public TMLChannel getChannelByShortName(String _name) { TMLChannel ch; - ListIterator iterator = channels.listIterator(); + Iterator<TMLChannel> iterator = channels.listIterator(); + while(iterator.hasNext()) { - ch = (TMLChannel)(iterator.next()); + ch = iterator.next(); + if (ch.getName().endsWith(_name)) { return ch; } } + return null; } public TMLChannel getChannelByDestinationPortName(String _portName) { TMLChannel ch; - ListIterator iterator = channels.listIterator(); + Iterator<TMLChannel> iterator = channels.listIterator(); + while(iterator.hasNext()) { - ch = (TMLChannel)(iterator.next()); + ch = iterator.next(); + if (ch.hasDestinationPort(_portName) != null) { return ch; } } + return null; } public TMLEvent getEventByName(String _name) { TMLEvent evt; - ListIterator iterator = events.listIterator(); + Iterator<TMLEvent> iterator = events.listIterator(); + while(iterator.hasNext()) { - evt = (TMLEvent)(iterator.next()); + evt = iterator.next(); + if (evt.getName().compareTo(_name) == 0) { return evt; } } + return null; } public TMLRequest getRequestByName(String _name) { TMLRequest req; - ListIterator iterator = requests.listIterator(); + Iterator<TMLRequest> iterator = requests.listIterator(); + while(iterator.hasNext()) { - req = (TMLRequest)(iterator.next()); + req = iterator.next(); + if (req.getName().compareTo(_name) == 0) { return req; } } + return null; } @@ -581,74 +613,83 @@ public class TMLModeling { } TMLRequest req; - ListIterator iterator = requests.listIterator(); + Iterator<TMLRequest> iterator = requests.listIterator(); + while(iterator.hasNext()) { - req = (TMLRequest)(iterator.next()); + req = iterator.next(); + if (req.getDestinationTask() == tmlt) { return req; } } + return null; } - public ArrayList<TMLTask> getTasks() { + public List<TMLTask> getTasks() { return tasks; } - public ArrayList<String[]> getPragmas(){ + public List<String[]> getPragmas(){ return pragmas; } - public ListIterator getListIteratorTasks() { + public Iterator<TMLTask> getListIteratorTasks() { return tasks.listIterator(); } - public ArrayList<TMLChannel> getChannels() { + public List<TMLChannel> getChannels() { return channels; } - public ArrayList<TMLEvent> getEvents() { + public List<TMLEvent> getEvents() { return events; } - public ArrayList<TMLRequest> getRequests() { + public List<TMLRequest> getRequests() { return requests; } - public ListIterator getListIteratorChannels() { + public Iterator<TMLChannel> getListIteratorChannels() { return channels.listIterator(); } - public ListIterator getListIteratorEvents() { + public Iterator<TMLEvent> getListIteratorEvents() { return events.listIterator(); } - public ListIterator getListIteratorRequests() { + public Iterator<TMLRequest> getListIteratorRequests() { return requests.listIterator(); } - public ArrayList<TMLChannel> getChannels(TMLTask t) { + public List<TMLChannel> getChannels(TMLTask t) { TMLChannel ch; - ArrayList<TMLChannel> list = new ArrayList<TMLChannel>(); - ListIterator iterator = getListIteratorChannels(); + List<TMLChannel> list = new ArrayList<TMLChannel>(); + Iterator<TMLChannel> iterator = getListIteratorChannels(); + while(iterator.hasNext()) { - ch = (TMLChannel)(iterator.next()); + ch = iterator.next(); if ((ch.getOriginTask() == t) || (ch.getDestinationTask() == t)) { list.add(ch); } } + return list; } - public ArrayList<TMLChannel> getChannels(TMLTask originTask, TMLTask destTask){ + public List<TMLChannel> getChannels(TMLTask originTask, TMLTask destTask){ TMLChannel ch; - ArrayList<TMLChannel> list = new ArrayList<TMLChannel>(); - ListIterator iterator = getListIteratorChannels(); + List<TMLChannel> list = new ArrayList<TMLChannel>(); + Iterator<TMLChannel> iterator = getListIteratorChannels(); + while(iterator.hasNext()) { - ch = (TMLChannel)(iterator.next()); + ch = iterator.next(); + if ((ch.getOriginTask() == originTask) && (ch.getDestinationTask() == destTask)) { list.add(ch); } } + return list; } + public void backtrace(ProVerifOutputAnalyzer pvoa, String mappingName){ //System.out.println("Backtracing Confidentiality"); LinkedList<AvatarAttribute> secretAttributes = pvoa.getSecretTerms (); @@ -975,90 +1016,99 @@ public class TMLModeling { return; } public void clearBacktracing(){ - for (TMLChannel channel: getChannels()){ - for (TMLCPrimitivePort port:channel.ports){ - if (port.checkConfStatus>1){ - port.checkConfStatus=1; - port.mappingName="???"; - port.secName=""; - } - if (port.checkStrongAuthStatus>1 || port.checkWeakAuthStatus>1){ - port.checkStrongAuthStatus = 1; - port.checkWeakAuthStatus=1; - } - } - } - for (TMLRequest req: getRequests()){ - for (TMLCPrimitivePort port:req.ports){ - if (port.checkConfStatus>1){ - port.checkConfStatus=1; - port.mappingName="???"; - } - if (port.checkStrongAuthStatus>1 || port.checkWeakAuthStatus>1){ - port.checkStrongAuthStatus = 1; - port.checkWeakAuthStatus=1; + for (TMLChannel channel: getChannels()){ + for (TMLCPrimitivePort port:channel.ports){ + if (port.checkConfStatus>1){ + port.checkConfStatus=1; + port.mappingName="???"; + port.secName=""; + } + if (port.checkStrongAuthStatus>1 || port.checkWeakAuthStatus>1){ + port.checkStrongAuthStatus = 1; + port.checkWeakAuthStatus=1; + } + } } - } - } - for (TMLEvent evt: getEvents()){ - if (evt.port!=null && evt.port2!=null){ - if (evt.port.checkConfStatus>1){ - evt.port.checkConfStatus=1; - evt.port.mappingName="???"; - } - if (evt.port.checkStrongAuthStatus>1 || evt.port.checkWeakAuthStatus>1){ - evt.port.checkStrongAuthStatus=1; - evt.port.checkWeakAuthStatus=1; + for (TMLRequest req: getRequests()){ + for (TMLCPrimitivePort port:req.ports){ + if (port.checkConfStatus>1){ + port.checkConfStatus=1; + port.mappingName="???"; + } + if (port.checkStrongAuthStatus>1 || port.checkWeakAuthStatus>1){ + port.checkStrongAuthStatus = 1; + port.checkWeakAuthStatus=1; + } + } } - if (evt.port2.checkConfStatus>1){ - evt.port2.checkConfStatus=1; - evt.port2.mappingName="???"; - } - if (evt.port2.checkStrongAuthStatus>1 || evt.port2.checkWeakAuthStatus>1){ - evt.port2.checkStrongAuthStatus=1; - evt.port2.checkWeakAuthStatus=1; + for (TMLEvent evt: getEvents()){ + if (evt.port!=null && evt.port2!=null){ + if (evt.port.checkConfStatus>1){ + evt.port.checkConfStatus=1; + evt.port.mappingName="???"; + } + if (evt.port.checkStrongAuthStatus>1 || evt.port.checkWeakAuthStatus>1){ + evt.port.checkStrongAuthStatus=1; + evt.port.checkWeakAuthStatus=1; + } + if (evt.port2.checkConfStatus>1){ + evt.port2.checkConfStatus=1; + evt.port2.mappingName="???"; + } + if (evt.port2.checkStrongAuthStatus>1 || evt.port2.checkWeakAuthStatus>1){ + evt.port2.checkStrongAuthStatus=1; + evt.port2.checkWeakAuthStatus=1; + } + } } - } - } - return; + + return; } - public ArrayList<TMLEvent> getEvents(TMLTask t) { + + public List<TMLEvent> getEvents(TMLTask t) { TMLEvent evt; - ArrayList<TMLEvent> list = new ArrayList<TMLEvent>(); - ListIterator iterator = getListIteratorEvents(); + List<TMLEvent> list = new ArrayList<TMLEvent>(); + Iterator<TMLEvent> iterator = getListIteratorEvents(); + while(iterator.hasNext()) { - evt= (TMLEvent)(iterator.next()); + evt= iterator.next(); + if ((evt.origin == t) || (evt.destination == t)) { list.add(evt); } } + return list; } - public ArrayList<TMLRequest> getRequests(TMLTask t) { + public List<TMLRequest> getRequests(TMLTask t) { TMLRequest request; - ArrayList<TMLRequest> list = new ArrayList<TMLRequest>(); - ListIterator iterator = getListIteratorRequests(); + List<TMLRequest> list = new ArrayList<TMLRequest>(); + Iterator<TMLRequest> iterator = getListIteratorRequests(); + while(iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + request = iterator.next(); + if ((request.getDestinationTask() == t) || (request.isAnOriginTask(t))) { list.add(request); } } + return list; } - public LinkedList getRequestsToMe(TMLTask task) { + public List<TMLRequest> getRequestsToMe(TMLTask task) { TMLRequest req; - LinkedList ll = new LinkedList(); + List<TMLRequest> ll = new LinkedList<TMLRequest>(); // Must search each task for SendRequest operator, check the request for destination class - ListIterator iterator= getListIteratorRequests(); + Iterator<TMLRequest> iterator= getListIteratorRequests(); while (iterator.hasNext()) { - req = (TMLRequest)(iterator.next()); + req = iterator.next(); + if (req.getDestinationTask() == task) { ll.add(req); } @@ -1068,23 +1118,26 @@ public class TMLModeling { } public TMLRequest getRequestToMe(TMLTask task) { - LinkedList ll = getRequestsToMe(task); + List<TMLRequest> ll = getRequestsToMe(task); + if ((ll == null) || (ll.size() == 0)) { return null; } - return (TMLRequest)(ll.get(0)); + + return ll.get(0); } - public LinkedList getChannelsToMe(TMLTask task) { + public List<TMLChannel> getChannelsToMe(TMLTask task) { TMLChannel chan; - LinkedList ll = new LinkedList(); + List<TMLChannel> ll = new LinkedList<TMLChannel>(); // Must search each task for SendRequest operator, check the request for destination class - ListIterator iterator= getListIteratorChannels(); + Iterator<TMLChannel> iterator= getListIteratorChannels(); while (iterator.hasNext()) { - chan = (TMLChannel)(iterator.next()); + chan = iterator.next(); + if (chan.hasDestinationTask(task)) { ll.add(chan); } @@ -1094,23 +1147,26 @@ public class TMLModeling { } public TMLChannel getChannelToMe(TMLTask task) { - LinkedList ll = getChannelsToMe(task); + List<TMLChannel> ll = getChannelsToMe(task); + if ((ll == null) || (ll.size() == 0)) { return null; } - return (TMLChannel)(ll.get(0)); + + return ll.get(0); } - public LinkedList getChannelsFromMe(TMLTask task) { + public List<TMLChannel> getChannelsFromMe(TMLTask task) { TMLChannel chan; - LinkedList ll = new LinkedList(); + List<TMLChannel> ll = new LinkedList<TMLChannel>(); // Must search each task for SendRequest operator, check the request for destination class - ListIterator iterator= getListIteratorChannels(); + Iterator<TMLChannel> iterator = getListIteratorChannels(); while (iterator.hasNext()) { - chan = (TMLChannel)(iterator.next()); + chan = iterator.next(); + if (chan.hasOriginTask(task)) { ll.add(chan); } @@ -1120,11 +1176,13 @@ public class TMLModeling { } public TMLChannel getChannelFromMe(TMLTask task) { - LinkedList ll = getChannelsFromMe(task); + List<TMLChannel> ll = getChannelsFromMe(task); + if ((ll == null) || (ll.size() == 0)) { return null; } - return (TMLChannel)(ll.get(0)); + + return ll.get(0); } public void prefixAllNamesWith(String _prefix) { @@ -1268,7 +1326,7 @@ public class TMLModeling { } } - public String printSummary(ArrayList<TMLError> warnings) { + public String printSummary( List<TMLError> warnings) { String ret = "Optimization warnings:\n"; int cpt = 1; for(TMLError error: warnings) { @@ -1279,8 +1337,9 @@ public class TMLModeling { return ret; } - public ArrayList<TMLError> optimize() { - ArrayList<TMLError> warnings = new ArrayList<TMLError>(); + public List<TMLError> optimize() { + List<TMLError> warnings = new ArrayList<TMLError>(); + if (!optimized) { TraceManager.addDev("Optimizing TML modeling"); optimized = true; @@ -1291,7 +1350,7 @@ public class TMLModeling { return warnings; } - public void optimize(TMLTask task, ArrayList<TMLError> warnings) { + public void optimize(TMLTask task, List<TMLError> warnings) { TMLActivity activity = task.getActivityDiagram(); optimizeVariables(task, activity, warnings); optimizeMergeEXECs(activity); @@ -1304,11 +1363,11 @@ public class TMLModeling { * Constant variables are also removed from the class, and each time * they are used, they are replaced by their respective value. */ - public void optimizeVariables(TMLTask task, TMLActivity activity, ArrayList<TMLError> warnings) { + public void optimizeVariables(TMLTask task, TMLActivity activity, List<TMLError> warnings) { int i; int usage; TMLAttribute attr; - ArrayList<TMLAttribute> attributes = task.getAttributes(); + List<TMLAttribute> attributes = task.getAttributes(); String name; TMLError error; @@ -1372,8 +1431,8 @@ public class TMLModeling { int index; String s, s0, s1; String name = " " + attr.getName() + " "; - String namebis = attr.getName() + " "; - String nameter = attr.getName(); + //String namebis = attr.getName() + " "; + //String nameter = attr.getName(); for(i=0; i<activity.nElements(); i++) { element = activity.get(i); @@ -1545,11 +1604,11 @@ public class TMLModeling { TMLSendRequest tmlasr; TMLRandom tmlrandom; int i, j; - int usage = 0; - int index; - String s, s0, s1; - String name = " " + attr.getName() + " "; - String namebis = attr.getName() + " "; + // int usage = 0; + // int index; + // String s;//, s0, s1; + // String name = " " + attr.getName() + " "; + //String namebis = attr.getName() + " "; for(i=0; i<activity.nElements(); i++) { element = activity.get(i); @@ -1620,7 +1679,7 @@ public class TMLModeling { */ public void optimizeMergeEXECs(TMLActivity activity) { TMLActivityElement elt0, elt1; - String action0, action1; + //String action0, action1; TMLExecIInterval int0, int1; TMLExecCInterval exec0, exec1; @@ -1755,7 +1814,7 @@ public class TMLModeling { */ public void optimizeMergeDELAYSs(TMLActivity activity) { TMLActivityElement elt0, elt1; - String action0, action1; + // String action0, action1; TMLDelay del0, del1; diff --git a/src/tmltranslator/toautomata/TML2AUT.java b/src/tmltranslator/toautomata/TML2AUT.java index f50febed7e..90e09d4cc5 100755 --- a/src/tmltranslator/toautomata/TML2AUT.java +++ b/src/tmltranslator/toautomata/TML2AUT.java @@ -71,7 +71,7 @@ public class TML2AUT { } // Returns a list of all file names .. - public LinkedList<String> saveInFiles(String path) throws FileException { + public List<String> saveInFiles(String path) throws FileException { //print(); ListIterator<Automata> iterator = automatas.listIterator(); diff --git a/src/tmltranslator/toautomata/TML2AUTviaLOTOS.java b/src/tmltranslator/toautomata/TML2AUTviaLOTOS.java index cb9bfb29af..d3f8067a45 100755 --- a/src/tmltranslator/toautomata/TML2AUTviaLOTOS.java +++ b/src/tmltranslator/toautomata/TML2AUTviaLOTOS.java @@ -59,10 +59,10 @@ public class TML2AUTviaLOTOS { private TMLModeling tmlmodeling; private TURTLEModeling tm; - private LinkedList automatas; - private LinkedList specs; /* name, then spec, then name, then spec. All specs are in LOTOS !*/ + private List<Automata> automatas; + private List<String> specs; /* name, then spec, then name, then spec. All specs are in LOTOS !*/ - private boolean debug; + // private boolean debug; public static String FC2_EXTENSION = "fc2"; public static String AUT_EXTENSION = "aut"; @@ -78,40 +78,41 @@ public class TML2AUTviaLOTOS { } // Returns a list of all file names .. - public LinkedList saveInFiles(String path) throws FileException { + public List<String> saveInFiles(String path) throws FileException { //print(); - ListIterator iterator = automatas.listIterator(); + Iterator<Automata> iterator = automatas.listIterator(); Automata aut; String name; - LinkedList ll = new LinkedList(); + List<String> ll = new LinkedList<String>(); while(iterator.hasNext()) { - aut = (Automata)(iterator.next()); + aut = iterator.next(); name = aut.getName() + "." + AUT_EXTENSION; ll.add(name); System.out.println("File: " + path + aut.getName() + "." + AUT_EXTENSION); FileUtils.saveFile(path + aut.getName() + "." + AUT_EXTENSION, aut.toAUT()); } + return ll; } public void print() { // Print each automatas - ListIterator iterator = automatas.listIterator(); + Iterator<Automata> iterator = automatas.listIterator(); Automata aut; while(iterator.hasNext()) { - aut = (Automata)(iterator.next()); + aut = iterator.next(); System.out.println("Automata: " + aut.getName()); System.out.println(aut.toAUT()); } } public void generateLOTOS(boolean _debug) { - debug = _debug; - specs = new LinkedList(); + // debug = _debug; + specs = new LinkedList<String>(); // Generate one LOTOS spec per TMLTask generateLOTOSTMLTasks(); @@ -119,17 +120,18 @@ public class TML2AUTviaLOTOS { } public void generateLOTOSTMLTasks() { - TMLTask task; - ListIterator iterator = tmlmodeling.getTasks().listIterator(); + TMLTask task; + Iterator<TMLTask> iterator = tmlmodeling.getTasks().listIterator(); + while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + task = iterator.next(); specs.add(task.getName()); specs.add(generateLOTOS(task)); } } - public LinkedList getSpecs() { - return specs; + public List<String> getSpecs() { + return specs; } public String generateLOTOS(TMLTask task) { diff --git a/src/tmltranslator/toavatar/TML2Avatar.java b/src/tmltranslator/toavatar/TML2Avatar.java index 506fb93890..406dd8f5b0 100644 --- a/src/tmltranslator/toavatar/TML2Avatar.java +++ b/src/tmltranslator/toavatar/TML2Avatar.java @@ -49,22 +49,13 @@ import java.util.List; import java.util.LinkedList; import java.util.HashMap; import java.util.Map; -import java.util.HashSet; -import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.io.*; -import javax.swing.*; import java.util.ArrayList; -import javax.xml.parsers.*; -import ui.ConfigurationTTool; -import ui.CheckingError; -import ui.AvatarDesignPanel; import ui.tmlcompd.*; import ui.tmlad.*; import ui.TGComponent; -import proverifspec.*; import myutil.*; import avatartranslator.*; @@ -110,231 +101,236 @@ public class TML2Avatar { } public void checkConnections(){ - List<HwLink> links = tmlmap.getTMLArchitecture().getHwLinks(); - for (TMLTask t1:tmlmodel.getTasks()){ - ArrayList<SecurityPattern> keys = new ArrayList<SecurityPattern>(); - accessKeys.put(t1, keys); - HwExecutionNode node1 = (HwExecutionNode) tmlmap.getHwNodeOf(t1); - //Try to find memory using only private buses - List<HwNode> toVisit = new ArrayList<HwNode>(); - List<HwNode> toMemory = new ArrayList<HwNode>(); - List<HwNode> complete = new ArrayList<HwNode>(); - for (HwLink link:links){ - if (link.hwnode==node1){ - if (link.bus.privacy==1){ - toVisit.add(link.bus); - } - } - } - boolean memory=false; - memloop: - while (toVisit.size()>0){ - HwNode curr = toVisit.remove(0); - for (HwLink link: links){ - if (curr == link.bus){ - if (link.hwnode instanceof HwMemory){ - memory=true; - ArrayList<SecurityPattern> patterns = tmlmap.getMappedPatterns((HwMemory) link.hwnode); - accessKeys.get(t1).addAll(patterns); - // break memloop; - } - if (!complete.contains(link.hwnode) && !toVisit.contains(link.hwnode) && link.hwnode instanceof HwBridge){ - toVisit.add(link.hwnode); - } - } - else if (curr == link.hwnode){ - if (!complete.contains(link.bus) && !toVisit.contains(link.bus)){ - toVisit.add(link.bus); - } - } - } - complete.add(curr); - } -// System.out.println("Memory found ?"+ memory); - for (TMLTask t2:tmlmodel.getTasks()){ - HwExecutionNode node2 = (HwExecutionNode) tmlmap.getHwNodeOf(t2); - if (!memory){ - //There is no path to a private memory - originDestMap.put(t1.getName()+"__"+t2.getName(), channelPublic); - } - else if (node1==node2){ - originDestMap.put(t1.getName()+"__"+t2.getName(), channelPrivate); - } - else { - //Navigate architecture for node - - HwNode last = node1; - List<HwNode> found = new ArrayList<HwNode>(); - List<HwNode> done = new ArrayList<HwNode>(); - List<HwNode> path = new ArrayList<HwNode>(); - Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); - for (HwLink link: links){ - if (link.hwnode == node1){ - found.add(link.bus); - List<HwNode> tmp = new ArrayList<HwNode>(); - tmp.add(link.bus); - pathMap.put(link.bus, tmp); - } - } - outerloop: - while (found.size()>0){ - HwNode curr = found.remove(0); + List<HwLink> links = tmlmap.getTMLArchitecture().getHwLinks(); + for (TMLTask t1:tmlmodel.getTasks()){ + ArrayList<SecurityPattern> keys = new ArrayList<SecurityPattern>(); + accessKeys.put(t1, keys); + HwExecutionNode node1 = (HwExecutionNode) tmlmap.getHwNodeOf(t1); + //Try to find memory using only private buses + List<HwNode> toVisit = new ArrayList<HwNode>(); + //List<HwNode> toMemory = new ArrayList<HwNode>(); + List<HwNode> complete = new ArrayList<HwNode>(); + for (HwLink link:links){ + if (link.hwnode==node1){ + if (link.bus.privacy==1){ + toVisit.add(link.bus); + } + } + } + boolean memory=false; + //memloop: + while (toVisit.size()>0){ + HwNode curr = toVisit.remove(0); for (HwLink link: links){ if (curr == link.bus){ - if (link.hwnode == node2){ - path = pathMap.get(curr); - break outerloop; + if (link.hwnode instanceof HwMemory){ + memory=true; + ArrayList<SecurityPattern> patterns = tmlmap.getMappedPatterns((HwMemory) link.hwnode); + accessKeys.get(t1).addAll(patterns); + // break memloop; } - if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge){ - found.add(link.hwnode); - List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); - tmp.add(link.hwnode); - pathMap.put(link.hwnode, tmp); + if (!complete.contains(link.hwnode) && !toVisit.contains(link.hwnode) && link.hwnode instanceof HwBridge){ + toVisit.add(link.hwnode); } - } + } else if (curr == link.hwnode){ - if (!done.contains(link.bus) && !found.contains(link.bus)){ - found.add(link.bus); - List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); - tmp.add(link.bus); - pathMap.put(link.bus, tmp); - } - } + if (!complete.contains(link.bus) && !toVisit.contains(link.bus)){ + toVisit.add(link.bus); + } + } } - done.add(curr); - } - if (path.size() ==0){ - originDestMap.put(t1.getName()+"__"+t2.getName(), channelUnreachable); - } - else { - int priv=1; - HwBus bus; - //Check if all buses and bridges are private - for (HwNode n: path){ - if (n instanceof HwBus){ - bus = (HwBus) n; - if (bus.privacy ==0){ - priv=0; - break; - } - } - } - originDestMap.put(t1.getName()+"__"+t2.getName(), priv); - } - } + complete.add(curr); + } + // System.out.println("Memory found ?"+ memory); + for (TMLTask t2:tmlmodel.getTasks()){ + HwExecutionNode node2 = (HwExecutionNode) tmlmap.getHwNodeOf(t2); + if (!memory){ + //There is no path to a private memory + originDestMap.put(t1.getName()+"__"+t2.getName(), channelPublic); + } + else if (node1==node2){ + originDestMap.put(t1.getName()+"__"+t2.getName(), channelPrivate); + } + else { + //Navigate architecture for node + + //HwNode last = node1; + List<HwNode> found = new ArrayList<HwNode>(); + List<HwNode> done = new ArrayList<HwNode>(); + List<HwNode> path = new ArrayList<HwNode>(); + Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); + for (HwLink link: links){ + if (link.hwnode == node1){ + found.add(link.bus); + List<HwNode> tmp = new ArrayList<HwNode>(); + tmp.add(link.bus); + pathMap.put(link.bus, tmp); + } + } + outerloop: + while (found.size()>0){ + HwNode curr = found.remove(0); + for (HwLink link: links){ + if (curr == link.bus){ + if (link.hwnode == node2){ + path = pathMap.get(curr); + break outerloop; + } + if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge){ + found.add(link.hwnode); + List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); + tmp.add(link.hwnode); + pathMap.put(link.hwnode, tmp); + } + } + else if (curr == link.hwnode){ + if (!done.contains(link.bus) && !found.contains(link.bus)){ + found.add(link.bus); + List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); + tmp.add(link.bus); + pathMap.put(link.bus, tmp); + } + } + } + done.add(curr); + } + if (path.size() ==0){ + originDestMap.put(t1.getName()+"__"+t2.getName(), channelUnreachable); + } + else { + int priv=1; + HwBus bus; + //Check if all buses and bridges are private + for (HwNode n: path){ + if (n instanceof HwBus){ + bus = (HwBus) n; + if (bus.privacy ==0){ + priv=0; + break; + } + } + } + originDestMap.put(t1.getName()+"__"+t2.getName(), priv); + } + } + } } } - } + public void checkChannels(){ - ArrayList<TMLChannel> channels = tmlmodel.getChannels(); - List<TMLTask> destinations = new ArrayList<TMLTask>(); - TMLTask a; - for (TMLChannel channel: channels){ - destinations.clear(); - if (channel.isBasicChannel()){ - a = channel.getOriginTask(); - destinations.add(channel.getDestinationTask()); - } - else { - a=channel.getOriginTasks().get(0); - destinations.addAll(channel.getDestinationTasks()); - } - HwExecutionNode node1 = (HwExecutionNode) tmlmap.getHwNodeOf(a); - for (TMLTask t: destinations){ - List<HwBus> buses = new ArrayList<HwBus>(); - HwNode node2 = tmlmap.getHwNodeOf(t); - if (node1==node2){ - channelMap.put(channel, channelPrivate); - } - if (node1!=node2){ - //Navigate architecture for node - List<HwLink> links = tmlmap.getTMLArchitecture().getHwLinks(); - HwNode last = node1; - List<HwNode> found = new ArrayList<HwNode>(); - List<HwNode> done = new ArrayList<HwNode>(); - List<HwNode> path = new ArrayList<HwNode>(); - Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); - for (HwLink link: links){ - if (link.hwnode == node1){ - found.add(link.bus); - List<HwNode> tmp = new ArrayList<HwNode>(); - tmp.add(link.bus); - pathMap.put(link.bus, tmp); - } - } - outerloop: - while (found.size()>0){ - HwNode curr = found.remove(0); - for (HwLink link: links){ - if (curr == link.bus){ - if (link.hwnode == node2){ - path = pathMap.get(curr); - break outerloop; + List<TMLChannel> channels = tmlmodel.getChannels(); + List<TMLTask> destinations = new ArrayList<TMLTask>(); + TMLTask a; + for (TMLChannel channel: channels){ + destinations.clear(); + if (channel.isBasicChannel()){ + a = channel.getOriginTask(); + destinations.add(channel.getDestinationTask()); + } + else { + a=channel.getOriginTasks().get(0); + destinations.addAll(channel.getDestinationTasks()); + } + HwExecutionNode node1 = (HwExecutionNode) tmlmap.getHwNodeOf(a); + for (TMLTask t: destinations){ + //List<HwBus> buses = new ArrayList<HwBus>(); + HwNode node2 = tmlmap.getHwNodeOf(t); + + if (node1==node2){ + channelMap.put(channel, channelPrivate); + } + + if (node1!=node2){ + //Navigate architecture for node + List<HwLink> links = tmlmap.getTMLArchitecture().getHwLinks(); + //HwNode last = node1; + List<HwNode> found = new ArrayList<HwNode>(); + List<HwNode> done = new ArrayList<HwNode>(); + List<HwNode> path = new ArrayList<HwNode>(); + Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); + + for (HwLink link: links){ + if (link.hwnode == node1){ + found.add(link.bus); + List<HwNode> tmp = new ArrayList<HwNode>(); + tmp.add(link.bus); + pathMap.put(link.bus, tmp); } - if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge){ - found.add(link.hwnode); - List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); - tmp.add(link.hwnode); - pathMap.put(link.hwnode, tmp); + } + outerloop: + while (found.size()>0){ + HwNode curr = found.remove(0); + for (HwLink link: links){ + if (curr == link.bus){ + if (link.hwnode == node2){ + path = pathMap.get(curr); + break outerloop; + } + if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge){ + found.add(link.hwnode); + List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); + tmp.add(link.hwnode); + pathMap.put(link.hwnode, tmp); + } + } + else if (curr == link.hwnode){ + if (!done.contains(link.bus) && !found.contains(link.bus)){ + found.add(link.bus); + List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); + tmp.add(link.bus); + pathMap.put(link.bus, tmp); + } + } } - } - else if (curr == link.hwnode){ - if (!done.contains(link.bus) && !found.contains(link.bus)){ - found.add(link.bus); - List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); - tmp.add(link.bus); - pathMap.put(link.bus, tmp); - } - } + done.add(curr); + } + + if (path.size() ==0){ + // System.out.println("Path does not exist for channel " + channel.getName() + " between Task " + a.getTaskName() + " and Task " + t.getTaskName()); + channelMap.put(channel, channelUnreachable); + } + else { + int priv=1; + HwBus bus; + //Check if all buses and bridges are private + for (HwNode n: path){ + if (n instanceof HwBus){ + bus = (HwBus) n; + if (bus.privacy ==0){ + priv=0; + break; + } + } + } + + channelMap.put(channel, priv); + //System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is " + (priv==1 ? "confidential" : "not confidential")); + } } - done.add(curr); - } - if (path.size() ==0){ - // System.out.println("Path does not exist for channel " + channel.getName() + " between Task " + a.getTaskName() + " and Task " + t.getTaskName()); - channelMap.put(channel, channelUnreachable); - } - else { - int priv=1; - HwBus bus; - //Check if all buses and bridges are private - for (HwNode n: path){ - if (n instanceof HwBus){ - bus = (HwBus) n; - if (bus.privacy ==0){ - priv=0; - break; - } - } - } - channelMap.put(channel, priv); - //System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is " + (priv==1 ? "confidential" : "not confidential")); - } - } - } - } + } + } } - public List<AvatarStateMachineElement> translateState(TMLActivityElement ae, AvatarBlock block){ - TMLActionState tmlaction; - TMLChoice tmlchoice; - TMLExecI tmlexeci; - TMLExecIInterval tmlexecii; - TMLExecC tmlexecc; - TMLExecCInterval tmlexecci; - TMLForLoop tmlforloop; - TMLReadChannel tmlreadchannel; - TMLSendEvent tmlsendevent; - TMLSendRequest tmlsendrequest; - TMLStopState tmlstopstate; - TMLWaitEvent tmlwaitevent; - TMLNotifiedEvent tmlnotifiedevent; - TMLWriteChannel tmlwritechannel; - TMLSequence tmlsequence; - TMLRandomSequence tmlrsequence; - TMLSelectEvt tmlselectevt; - TMLDelay tmldelay; +// TMLActionState tmlaction; +// TMLChoice tmlchoice; +// TMLExecI tmlexeci; +// TMLExecIInterval tmlexecii; + // TMLExecC tmlexecc; + // TMLExecCInterval tmlexecci; +// TMLForLoop tmlforloop; +// TMLReadChannel tmlreadchannel; +// TMLSendEvent tmlsendevent; +// TMLSendRequest tmlsendrequest; +// TMLStopState tmlstopstate; +// TMLWaitEvent tmlwaitevent; +// TMLNotifiedEvent tmlnotifiedevent; +// TMLWriteChannel tmlwritechannel; +// TMLSequence tmlsequence; +// TMLRandomSequence tmlrsequence; +// TMLSelectEvt tmlselectevt; +// TMLDelay tmldelay; AvatarTransition tran= new AvatarTransition(block, "", null); List<AvatarStateMachineElement> elementList = new ArrayList<AvatarStateMachineElement>(); @@ -455,7 +451,7 @@ public class TML2Avatar { elementList.add(tran); } else if (ae instanceof TMLRandomSequence){ - HashMap<Integer, List<AvatarStateMachineElement>> seqs = new HashMap<Integer, List<AvatarStateMachineElement>>(); + //HashMap<Integer, List<AvatarStateMachineElement>> seqs = new HashMap<Integer, List<AvatarStateMachineElement>>(); AvatarState choiceState = new AvatarState("seqchoice__"+ae.getName(), ae.getReferenceObject()); elementList.add(choiceState); if (ae.getNbNext()==2){ @@ -1098,7 +1094,7 @@ public class TML2Avatar { if (loop.isInfinite()){ //Make initializaton, then choice state with transitions List<AvatarStateMachineElement> elements=translateState(ae.getNextElement(0), block); - List<AvatarStateMachineElement> afterloop = translateState(ae.getNextElement(1), block); + /*List<AvatarStateMachineElement> afterloop =*/ translateState(ae.getNextElement(1), block); AvatarState initState = new AvatarState(ae.getName()+"__init", ae.getReferenceObject()); elementList.add(initState); //Build transition to choice @@ -1169,7 +1165,7 @@ public class TML2Avatar { tran = new AvatarTransition(block, "loop_increment__"+ae.getName(), ae.getReferenceObject()); //Set default loop limit guard tran.setGuard(AvatarGuard.createFromString(block, "loop_index != "+loopLimit)); - AvatarGuard guard = AvatarGuard.createFromString (block, loop.getCondition().replaceAll("<", "!=")); + /*AvatarGuard guard = */AvatarGuard.createFromString (block, loop.getCondition().replaceAll("<", "!=")); int error = AvatarSyntaxChecker.isAValidGuard(avspec, block, loop.getCondition().replaceAll("<","!=")); if (error != 0) { tran.addGuard(loop.getCondition().replaceAll("<", "!=")); @@ -1234,7 +1230,7 @@ public class TML2Avatar { AvatarState as = new AvatarState(ae.getName(), ae.getReferenceObject()); elementList.add(as); //Make many choices - TMLSelectEvt c = (TMLSelectEvt) ae; + //TMLSelectEvt c = (TMLSelectEvt) ae; for (int i=0; i < ae.getNbNext(); i++){ tran = new AvatarTransition(block, "__after_"+ae.getName()+"_"+i, ae.getReferenceObject()); as.addNext(tran); @@ -1322,7 +1318,9 @@ public class TML2Avatar { topasm.setStartState(topss); topasm.addElement(topss); } - ArrayList<TMLTask> tasks = tmlmap.getTMLModeling().getTasks(); + + List<TMLTask> tasks = tmlmap.getTMLModeling().getTasks(); + for (TMLTask task:tasks){ AvatarBlock block = new AvatarBlock(task.getName().split("__")[task.getName().split("__").length-1], avspec, task.getReferenceObject()); if (mc){ @@ -1393,7 +1391,7 @@ public class TML2Avatar { AvatarAttribute avattr = new AvatarAttribute(attr.getName(), type, block, null); block.addAttribute(avattr); } - AvatarTransition last; + //AvatarTransition last; AvatarStateMachine asm = block.getStateMachine(); //TODO: Create a fork with many requests. This looks terrible @@ -1446,8 +1444,8 @@ public class TML2Avatar { } //Create exit after # of loop iterations is maxed out - AvatarStopState stop = new AvatarStopState("stop", task.getActivityDiagram().get(0).getReferenceObject()); - AvatarTransition exitTran = new AvatarTransition(block, "to_stop", task.getActivityDiagram().get(0).getReferenceObject()); + /*AvatarStopState stop =*/ new AvatarStopState("stop", task.getActivityDiagram().get(0).getReferenceObject()); + /*AvatarTransition exitTran = */new AvatarTransition(block, "to_stop", task.getActivityDiagram().get(0).getReferenceObject()); //Add Requests, direct transition to start of state machine @@ -1838,7 +1836,7 @@ public class TML2Avatar { } } public void distributeKeys(){ - ArrayList<TMLTask> tasks = tmlmap.getTMLModeling().getTasks(); + List<TMLTask> tasks = tmlmap.getTMLModeling().getTasks(); for (TMLTask t:accessKeys.keySet()){ AvatarBlock b = taskBlockMap.get(t); for (SecurityPattern sp: accessKeys.get(t)){ diff --git a/src/tmltranslator/tomappingsystemc/MappedSystemCTask.java b/src/tmltranslator/tomappingsystemc/MappedSystemCTask.java index 6a5548c9c6..180f448f73 100755 --- a/src/tmltranslator/tomappingsystemc/MappedSystemCTask.java +++ b/src/tmltranslator/tomappingsystemc/MappedSystemCTask.java @@ -55,9 +55,9 @@ public class MappedSystemCTask { //private TMLModeling tmlm; private TMLTask task; private String reference, cppcode, hcode; - private ArrayList<TMLChannel> channels; - private ArrayList<TMLEvent> events; - private ArrayList<TMLRequest> requests; + private List<TMLChannel> channels; + private List<TMLEvent> events; + private List<TMLRequest> requests; private int nbOfFunc = 0; @@ -74,7 +74,7 @@ public class MappedSystemCTask { private final static String EF = "}"; - public MappedSystemCTask(TMLTask _task, ArrayList<TMLChannel> _channels, ArrayList<TMLEvent> _events, ArrayList<TMLRequest> _requests) { + public MappedSystemCTask(TMLTask _task, List<TMLChannel> _channels, List<TMLEvent> _events, List<TMLRequest> _requests) { task = _task; channels = _channels; events = _events; @@ -321,12 +321,12 @@ public class MappedSystemCTask { private String makeAttributesCode() { String code = ""; TMLAttribute att; - int i; + // int i; - ListIterator iterator = task.getAttributes().listIterator(); + Iterator<TMLAttribute> iterator = task.getAttributes().listIterator(); while(iterator.hasNext()) { - att = (TMLAttribute)(iterator.next()); + att = iterator.next(); if (att.hasInitialValue()) { code += att.name + " = " + att.initialValue; code += ";\n"; @@ -340,12 +340,12 @@ public class MappedSystemCTask { private String makeAttributesDeclaration() { String code = ""; TMLAttribute att; - int i; + // int i; - ListIterator iterator = task.getAttributes().listIterator(); + Iterator<TMLAttribute> iterator = task.getAttributes().listIterator(); while(iterator.hasNext()) { - att = (TMLAttribute)(iterator.next()); + att = iterator.next(); code += TMLType.getStringType(att.type.getType()) + " " + att.name; code += ";\n"; } diff --git a/src/tmltranslator/tomappingsystemc/TML2MappingSystemC.java b/src/tmltranslator/tomappingsystemc/TML2MappingSystemC.java index 6e954a0bab..f7a173d7e3 100755 --- a/src/tmltranslator/tomappingsystemc/TML2MappingSystemC.java +++ b/src/tmltranslator/tomappingsystemc/TML2MappingSystemC.java @@ -58,9 +58,9 @@ public class TML2MappingSystemC { private final static String CR = "\n"; private final static String CR2 = "\n\n"; private final static String SCCR = ";\n"; - private final static String EFCR = "}\n"; +// private final static String EFCR = "}\n"; private final static String EFCR2 = "}\n\n"; - private final static String EF = "}"; +// private final static String EF = "}"; private final static int MAX_EVENT = 1024; @@ -88,10 +88,10 @@ public class TML2MappingSystemC { tmlmapping = new TMLMapping(tmlmodeling, tmla, false); - ListIterator iterator = _tmlm.getTasks().listIterator(); + Iterator<TMLTask> iterator = _tmlm.getTasks().listIterator(); TMLTask t; while(iterator.hasNext()) { - t = (TMLTask)(iterator.next()); + t = iterator.next(); tmlmapping.addTaskToHwExecutionNode(t, cpu); } } @@ -180,7 +180,7 @@ public class TML2MappingSystemC { declaration += CR; // Channels, events, requests - ListIterator iterator; + Iterator<TMLChannel> chanIterator; TMLChannel channel; TMLEvent evt; TMLRequest req; @@ -188,9 +188,9 @@ public class TML2MappingSystemC { String tmp; declaration += "//Declaration of channels" + CR; - iterator = tmlmodeling.getListIteratorChannels(); - while(iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + chanIterator = tmlmodeling.getListIteratorChannels(); + while( chanIterator.hasNext()) { + channel = chanIterator.next(); type = channel.getType(); switch(type) { case TMLChannel.BRBW: @@ -208,9 +208,9 @@ public class TML2MappingSystemC { declaration += CR; declaration += "//Declaration of events" + CR; - iterator = tmlmodeling.getListIteratorEvents(); - while(iterator.hasNext()) { - evt = (TMLEvent)(iterator.next()); + Iterator<TMLEvent> evtIterato = tmlmodeling.getListIteratorEvents(); + while(evtIterato.hasNext()) { + evt = (TMLEvent)(evtIterato.next()); if (evt.isInfinite()) { tmp = "InfiniteFIFO_Event "; } else { @@ -225,9 +225,9 @@ public class TML2MappingSystemC { declaration += CR; declaration += "//Declaration of requests" + CR; - iterator = tmlmodeling.getListIteratorRequests(); - while(iterator.hasNext()) { - req = (TMLRequest)(iterator.next()); + Iterator<TMLRequest> reqIterator = tmlmodeling.getListIteratorRequests(); + while( reqIterator.hasNext()) { + req = reqIterator.next(); declaration += "InfiniteFIFO_Event " + req.getExtendedName() + SCCR; } declaration += CR; @@ -256,7 +256,7 @@ public class TML2MappingSystemC { } public void makeThreadCode(HwExecutionNode node) { - ListIterator iterator; + Iterator<TMLChannel> chanIterator; TMLChannel channel; TMLEvent event; TMLRequest request; @@ -271,9 +271,9 @@ public class TML2MappingSystemC { // Setting internal channels thread += CR + "// Setting channels" + CR; - iterator = tmlmodeling.getListIteratorChannels(); - while(iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + chanIterator = tmlmodeling.getListIteratorChannels(); + while( chanIterator.hasNext()) { + channel = chanIterator.next(); if ((tmlmapping.isTaskMappedOn(channel.getOriginTask(), node)) && (tmlmapping.isTaskMappedOn(channel.getDestinationTask(), node))) { thread += channel.getExtendedName() + ".initialize()" + SCCR; thread += channel.getExtendedName() + ".setNode(&" + node.getName() + ")" + SCCR; @@ -288,9 +288,9 @@ public class TML2MappingSystemC { // Setting internal events thread += "// Setting events" + CR; - iterator = tmlmodeling.getListIteratorEvents(); - while(iterator.hasNext()) { - event = (TMLEvent)(iterator.next()); + Iterator<TMLEvent> evtIterator = tmlmodeling.getListIteratorEvents(); + while( evtIterator.hasNext()) { + event = evtIterator.next(); if ((tmlmapping.isTaskMappedOn(event.getOriginTask(), node)) && (tmlmapping.isTaskMappedOn(event.getDestinationTask(), node))) { thread += event.getExtendedName() + ".initialize()" + SCCR; thread += event.getExtendedName() + ".setNode(&" + node.getName() + ")" + SCCR; @@ -305,9 +305,9 @@ public class TML2MappingSystemC { // Setting internal requests thread += "// Setting requests" + CR; - iterator = tmlmodeling.getListIteratorRequests(); - while(iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + Iterator<TMLRequest> reqIterator = tmlmodeling.getListIteratorRequests(); + while( reqIterator.hasNext()) { + request = reqIterator.next(); if (tmlmapping.oneTaskMappedOn(request, node)) { thread += request.getExtendedName() + ".initialize()" + SCCR; thread += request.getExtendedName() + ".setNode(&" + node.getName() + ")" + SCCR; @@ -317,9 +317,9 @@ public class TML2MappingSystemC { thread += CR; // Setting tasks - iterator = tmlmodeling.getListIteratorTasks(); - while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + Iterator<TMLTask> taskIterator = tmlmodeling.getListIteratorTasks(); + while( taskIterator.hasNext()) { + task = taskIterator.next(); if (tmlmapping.getHwNodeOf(task) == node) { thread += "task__" + task.getName() + ".initialize()" + SCCR; thread += "task__" + task.getName() + ".setNode(&" + node.getName() + ")" + SCCR; @@ -387,9 +387,9 @@ public class TML2MappingSystemC { } thread += node.getName() + ".initialize()" + SCCR; - iterator = tmlmodeling.getListIteratorTasks(); - while(iterator.hasNext()){ - task = (TMLTask)(iterator.next()); + taskIterator = tmlmodeling.getListIteratorTasks(); + while( taskIterator.hasNext()){ + task = taskIterator.next(); if (tmlmapping.isTaskMappedOn(task, node)) { thread += node.getName() + ".addTask(&task__" + task.getName() + ")" + SCCR; } @@ -445,9 +445,10 @@ public class TML2MappingSystemC { simulation += "// Tracing tasks" + CR; TMLTask task; - ListIterator iterator = tmlmodeling.getListIteratorTasks(); - while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + Iterator<TMLTask> taskIterator = tmlmodeling.getListIteratorTasks(); + while( taskIterator.hasNext()) { + task = taskIterator.next(); + if (tmlmapping.isTaskMapped(task)) { traceTask(task); } @@ -514,15 +515,15 @@ public class TML2MappingSystemC { // *************** Internal structure manipulation ******************************* / public void generateSystemCTasks() { - ListIterator iterator = tmlmodeling.getTasks().listIterator(); + Iterator<TMLTask> iterator = tmlmodeling.getTasks().listIterator(); TMLTask t; MappedSystemCTask mst; - ArrayList<TMLChannel> channels; - ArrayList<TMLEvent> events; - ArrayList<TMLRequest> requests; + List<TMLChannel> channels; + List<TMLEvent> events; + List<TMLRequest> requests; while(iterator.hasNext()) { - t = (TMLTask)(iterator.next()); + t = iterator.next(); if (tmlmapping.isTaskMapped(t)) { channels = tmlmodeling.getChannels(t); events = tmlmodeling.getEvents(t); diff --git a/src/tmltranslator/toproverif/TML2ProVerif.java b/src/tmltranslator/toproverif/TML2ProVerif.java index 6baa71032b..6ecbf60350 100644 --- a/src/tmltranslator/toproverif/TML2ProVerif.java +++ b/src/tmltranslator/toproverif/TML2ProVerif.java @@ -51,21 +51,18 @@ import java.util.List; import java.util.HashMap; import java.util.Map; import java.util.HashSet; -import java.util.Vector; import java.io.*; import javax.swing.*; -import javax.xml.parsers.*; import ui.ConfigurationTTool; -import ui.CheckingError; import proverifspec.*; import myutil.*; import tmltranslator.*; public class TML2ProVerif { - private final static String ATTR_DELIM = "__"; + // private final static String ATTR_DELIM = "__"; private final static String UNKNOWN = "UNKNOWN"; @@ -97,155 +94,156 @@ public class TML2ProVerif { private final static String CHCTRL_CH = "chControl"; private final static String CHCTRL_ENCRYPT = "chControlEnc"; private final static String CHCTRL_DECRYPT = "chControlDec"; - private final static Integer channelPublic = 0; + // private final static Integer channelPublic = 0; private final static Integer channelPrivate = 1; private final static Integer channelUnreachable = 2; private ProVerifSpec spec; private TMLMapping tmlmap; private TMLModeling tmlmodel; - private boolean stateReachability; + // private boolean stateReachability; - private Vector warnings; - public HashMap<String, Integer> channelMap = new HashMap<String,Integer>(); + // private Vector warnings; + public Map<String, Integer> channelMap = new HashMap<String,Integer>(); public TML2ProVerif(TMLMapping _tmlmap) { this.tmlmap = _tmlmap; this.spec = null; - this.tmlmodel= tmlmap.getTMLModeling(); + this.tmlmodel= tmlmap.getTMLModeling(); } public void checkChannels(){ - ArrayList<TMLChannel> channels = tmlmodel.getChannels(); - List<TMLTask> destinations = new ArrayList<TMLTask>(); - TMLTask a; - for (TMLChannel channel: channels){ - destinations.clear(); - if (channel.isBasicChannel()){ - a = channel.getOriginTask(); - destinations.add(channel.getDestinationTask()); - } - else { - a=channel.getOriginTasks().get(0); - destinations.addAll(channel.getDestinationTasks()); - } - HwCPU node1 = (HwCPU) tmlmap.getHwNodeOf(a); - for (TMLTask t: destinations){ - List<HwBus> buses = new ArrayList<HwBus>(); - HwNode node2 = tmlmap.getHwNodeOf(t); - if (node1==node2){ - System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is confidential"); - channelMap.put(channel.getName(), channelPrivate); - } - if (node1!=node2){ - //Navigate architecture for node - List<HwLink> links = tmlmap.getTMLArchitecture().getHwLinks(); - HwNode last = node1; - List<HwNode> found = new ArrayList<HwNode>(); - List<HwNode> done = new ArrayList<HwNode>(); - List<HwNode> path = new ArrayList<HwNode>(); - Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); - for (HwLink link: links){ - if (link.hwnode == node1){ - found.add(link.bus); - List<HwNode> tmp = new ArrayList<HwNode>(); - tmp.add(link.bus); - pathMap.put(link.bus, tmp); - } - } - outerloop: - while (found.size()>0){ - HwNode curr = found.remove(0); - for (HwLink link: links){ - if (curr == link.bus){ - if (link.hwnode == node2){ - path = pathMap.get(curr); - break outerloop; - } - if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge){ - found.add(link.hwnode); - List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); - tmp.add(link.hwnode); - pathMap.put(link.hwnode, tmp); - } - } - else if (curr == link.hwnode){ - if (!done.contains(link.bus) && !found.contains(link.bus)){ - found.add(link.bus); - List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); - tmp.add(link.bus); - pathMap.put(link.bus, tmp); - } - } - } - done.add(curr); - } - if (path.size() ==0){ - System.out.println("Path does not exist for channel " + channel.getName() + " between Task " + a.getTaskName() + " and Task " + t.getTaskName()); - channelMap.put(channel.getName(), channelUnreachable); - } - else { - int priv=1; - HwBus bus; - //Check if all buses and bridges are private - for (HwNode n: path){ - if (n instanceof HwBus){ - bus = (HwBus) n; - System.out.println("BUS PRIVACY "+bus.privacy); - if (bus.privacy ==0){ - priv=0; - break; - } - } - } - channelMap.put(channel.getName(), priv); - System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is " + (priv==1 ? "confidential" : "not confidential")); - } - } - } - } + List<TMLChannel> channels = tmlmodel.getChannels(); + List<TMLTask> destinations = new ArrayList<TMLTask>(); + TMLTask a; + for (TMLChannel channel: channels){ + destinations.clear(); + if (channel.isBasicChannel()){ + a = channel.getOriginTask(); + destinations.add(channel.getDestinationTask()); + } + else { + a=channel.getOriginTasks().get(0); + destinations.addAll(channel.getDestinationTasks()); + } + HwCPU node1 = (HwCPU) tmlmap.getHwNodeOf(a); + for (TMLTask t: destinations){ + // List<HwBus> buses = new ArrayList<HwBus>(); + HwNode node2 = tmlmap.getHwNodeOf(t); + if (node1==node2){ + System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is confidential"); + channelMap.put(channel.getName(), channelPrivate); + } + if (node1!=node2){ + //Navigate architecture for node + List<HwLink> links = tmlmap.getTMLArchitecture().getHwLinks(); + // HwNode last = node1; + List<HwNode> found = new ArrayList<HwNode>(); + List<HwNode> done = new ArrayList<HwNode>(); + List<HwNode> path = new ArrayList<HwNode>(); + Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); + for (HwLink link: links){ + if (link.hwnode == node1){ + found.add(link.bus); + List<HwNode> tmp = new ArrayList<HwNode>(); + tmp.add(link.bus); + pathMap.put(link.bus, tmp); + } + } + outerloop: + while (found.size()>0){ + HwNode curr = found.remove(0); + for (HwLink link: links){ + if (curr == link.bus){ + if (link.hwnode == node2){ + path = pathMap.get(curr); + break outerloop; + } + if (!done.contains(link.hwnode) && !found.contains(link.hwnode) && link.hwnode instanceof HwBridge){ + found.add(link.hwnode); + List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); + tmp.add(link.hwnode); + pathMap.put(link.hwnode, tmp); + } + } + else if (curr == link.hwnode){ + if (!done.contains(link.bus) && !found.contains(link.bus)){ + found.add(link.bus); + List<HwNode> tmp = new ArrayList<HwNode>(pathMap.get(curr)); + tmp.add(link.bus); + pathMap.put(link.bus, tmp); + } + } + } + done.add(curr); + } + if (path.size() ==0){ + System.out.println("Path does not exist for channel " + channel.getName() + " between Task " + a.getTaskName() + " and Task " + t.getTaskName()); + channelMap.put(channel.getName(), channelUnreachable); + } + else { + int priv=1; + HwBus bus; + //Check if all buses and bridges are private + for (HwNode n: path){ + if (n instanceof HwBus){ + bus = (HwBus) n; + System.out.println("BUS PRIVACY "+bus.privacy); + if (bus.privacy ==0){ + priv=0; + break; + } + } + } + channelMap.put(channel.getName(), priv); + System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is " + (priv==1 ? "confidential" : "not confidential")); + } + } + } + } } + public boolean saveInFile(String path) throws FileException { - //Our hash is saved in config - System.out.println(this.spec); - String hashCode= Integer.toString(this.spec.getStringSpec().hashCode()); - File file = new File(path); - BufferedReader br; - if (file.exists()){ - String hash = ConfigurationTTool.ProVerifHash; - if (!hash.equals("")){ - try { - br = new BufferedReader(new FileReader(path)); - String s = br.readLine(); - String tmp; - while ((tmp = br.readLine()) !=null){ - s = s+"\n" + tmp; - } - String fileHash = Integer.toString(s.hashCode()); - if (!hash.equals(fileHash)){ - if(JOptionPane.showConfirmDialog(null, "File " + path + " already exists. Do you want to overwrite?", "Overwrite File?", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION){ - return false; - } - } - br.close(); - } catch (Exception e) { - // - } - } - } - FileUtils.saveFile(path, this.spec.getStringSpec()); - ConfigurationTTool.ProVerifHash = hashCode; - try { - ConfigurationTTool.saveConfiguration(); - } catch (Exception e){ -// - } - return true; + //Our hash is saved in config + System.out.println(this.spec); + String hashCode= Integer.toString(this.spec.getStringSpec().hashCode()); + File file = new File(path); + BufferedReader br; + if (file.exists()){ + String hash = ConfigurationTTool.ProVerifHash; + if (!hash.equals("")){ + try { + br = new BufferedReader(new FileReader(path)); + String s = br.readLine(); + String tmp; + while ((tmp = br.readLine()) !=null){ + s = s+"\n" + tmp; + } + String fileHash = Integer.toString(s.hashCode()); + if (!hash.equals(fileHash)){ + if(JOptionPane.showConfirmDialog(null, "File " + path + " already exists. Do you want to overwrite?", "Overwrite File?", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION){ + return false; + } + } + br.close(); + } catch (Exception e) { + // + } + } + } + FileUtils.saveFile(path, this.spec.getStringSpec()); + ConfigurationTTool.ProVerifHash = hashCode; + try { + ConfigurationTTool.saveConfiguration(); + } catch (Exception e){ + // + } + return true; } - public Vector getWarnings() { - return this.warnings; - } +// public Vector getWarnings() { +// return this.warnings; +// } public TMLMapping getMapping () { return this.tmlmap; @@ -254,8 +252,8 @@ public class TML2ProVerif { public ProVerifSpec generateProVerif(boolean _debug, boolean _optimize, boolean _stateReachability, boolean _typed) { System.out.println("generating spec..."); - this.stateReachability = _stateReachability; - this.warnings = new Vector(); + // this.stateReachability = _stateReachability; + // this.warnings = new Vector(); if (_typed) this.spec = new ProVerifSpec (new ProVerifPitypeSyntaxer ()); else @@ -276,19 +274,19 @@ public class TML2ProVerif { } */ - - private static String makeAttrName (String... _params) { - String result = ""; - boolean first = true; - for (String p: _params) { - if (first) - first = false; - else - result += ATTR_DELIM; - result += p; - } - return result; - } +// +// private static String makeAttrName (String... _params) { +// String result = ""; +// boolean first = true; +// for (String p: _params) { +// if (first) +// first = false; +// else +// result += ATTR_DELIM; +// result += p; +// } +// return result; +// } public void makeHeader() { TraceManager.addDev("\n\n=+=+=+ Making Headers +=+=+="); @@ -378,7 +376,7 @@ public class TML2ProVerif { this.spec.addDeclaration (new ProVerifVar ("call__" + task.getName() + "__0", "bitstring", true)); } - String action = "("; + // String action = "("; this.spec.addDeclaration (new ProVerifComment ("Data")); @@ -522,10 +520,10 @@ TMLActivity act= task.getActivityDiagram(); p = p.setNextInstr (new ProVerifProcRaw ("event enteringState__" + task.getName() + "__" + stateNum + "()", true)); stateNum++; if (ae instanceof TMLChoice){ - TMLChoice aechoice = (TMLChoice) ae; - for (int i=0; i< ae.getNbNext(); i++){ - - } + //TMLChoice aechoice = (TMLChoice) ae; +// for (int i=0; i< ae.getNbNext(); i++){ +// +// } } else { if (ae instanceof TMLActivityElementChannel){ diff --git a/src/tmltranslator/tosystemc/TML2SystemC.java b/src/tmltranslator/tosystemc/TML2SystemC.java index cca8de9143..44fd92b0d8 100755 --- a/src/tmltranslator/tosystemc/TML2SystemC.java +++ b/src/tmltranslator/tosystemc/TML2SystemC.java @@ -56,9 +56,9 @@ public class TML2SystemC { //private static int gateId; private TMLModeling tmlmodeling; - private LinkedList tasks; + private List<SystemCTask> tasks; - private boolean debug; + // private boolean debug; public static String SYSTEMC_EXTENSION = "cpp"; @@ -81,9 +81,9 @@ public class TML2SystemC { } public void generateSystemC(boolean _debug) { - debug = _debug; + // debug = _debug; - tasks = new LinkedList(); + tasks = new LinkedList<SystemCTask>(); generateSystemCTasks(); @@ -118,13 +118,13 @@ public class TML2SystemC { } public String getFullCodeTasks() { - ListIterator iterator = tasks.listIterator(); + Iterator<SystemCTask> iterator = tasks.listIterator(); SystemCTask st; String output = "\n\n"; while(iterator.hasNext()) { - st = (SystemCTask)(iterator.next()); + st = iterator.next(); output += st.getFullCode() + "\n\n"; } @@ -147,12 +147,12 @@ public class TML2SystemC { referencesToTMLTasks = "// references to each TML tasks (Task_ID)\n"; referencesToTMLTasks += "TML_tasks "; - ListIterator iterator = tasks.listIterator(); + Iterator<SystemCTask> iterator = tasks.listIterator(); SystemCTask st; boolean first = true; while(iterator.hasNext()) { - st = (SystemCTask)(iterator.next()); + st = iterator.next(); if (!first) { referencesToTMLTasks += ", "; } @@ -165,11 +165,11 @@ public class TML2SystemC { public void generateChannelsDec() { channelsDec = "// Communication channels declaration (see channels.h)\n"; - ListIterator iterator = tmlmodeling.getListIteratorChannels(); + Iterator<TMLChannel> iterator = tmlmodeling.getListIteratorChannels(); TMLChannel channel; while (iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + channel = iterator.next(); channelsDec += "channel" + channel.getType()+"<s" + channel.getSize() + "> " + channel.getName() + ";\n"; } } @@ -177,11 +177,11 @@ public class TML2SystemC { public void generateEventsDec() { eventsDec = "// Events declaration (for NOTIFY)\n"; - ListIterator iterator = tmlmodeling.getListIteratorEvents(); + Iterator<TMLEvent> iterator = tmlmodeling.getListIteratorEvents(); TMLEvent event; while (iterator.hasNext()) { - event = (TMLEvent)(iterator.next()); + event = iterator.next(); eventsDec += "sc_event " + event.getName() + ";\n"; } } @@ -189,11 +189,11 @@ public class TML2SystemC { public void generateRequestsDec() { requestsDec = "// Events declaration (for requests)\n"; - ListIterator iterator = tmlmodeling.getListIteratorRequests(); + Iterator<TMLRequest> iterator = tmlmodeling.getListIteratorRequests(); TMLRequest request; while (iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + request = iterator.next(); requestsDec += "sc_event " + request.getName() + ";\n"; } } @@ -205,14 +205,14 @@ public class TML2SystemC { public void generateTestBench() { testBench = "testbench(sc_module_name nm) { \n"; - ListIterator iterator = tmlmodeling.getListIteratorTasks(); + Iterator<TMLTask> iterator = tmlmodeling.getListIteratorTasks(); TMLTask task; - LinkedList ll; - ListIterator itereq; + List<TMLRequest> ll; + Iterator<TMLRequest> itereq; TMLRequest req; while (iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + task = iterator.next(); testBench += "SC_THREAD(" + task.getName() + ");\n"; ll = tmlmodeling.getRequestsToMe(task); if (ll.size() == 0) { @@ -220,10 +220,11 @@ public class TML2SystemC { } else { itereq = ll.listIterator(); while(itereq.hasNext()) { - req = (TMLRequest)(itereq.next()); + req = itereq.next(); testBench += "sensitive<<" + req.getName() + ";\n"; } } + testBench += "dont_initialize();\n\n"; } @@ -235,7 +236,7 @@ public class TML2SystemC { } public void generateMainFunction() { - ListIterator iterator; + Iterator<SystemCTask> iterator; SystemCTask st; TMLChannel channel; @@ -249,14 +250,15 @@ public class TML2SystemC { mainFunction += "// Task req tracings\n"; iterator = tasks.listIterator(); while(iterator.hasNext()) { - st = (SystemCTask)(iterator.next()); + st = iterator.next(); mainFunction += "sc_trace(tf, tb." + st.reference + ".active, \"TASK_" + st.reference + "\");\n"; } mainFunction += "\n// Channel RD/WR tracings\n"; - iterator = tmlmodeling.getListIteratorChannels(); - while (iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + final Iterator<TMLChannel> chanIterator = tmlmodeling.getListIteratorChannels(); + + while (chanIterator.hasNext()) { + channel = chanIterator.next(); mainFunction += "sc_trace(tf, tb." + channel.getName() + ".wr, \"" + channel.getName() + "_WR\");\n"; mainFunction += "sc_trace(tf, tb." + channel.getName() + ".rd, \"" + channel.getName() + "_RD\");\n\n"; } @@ -281,12 +283,12 @@ public class TML2SystemC { // *************** Internal structure manipulation ******************************* / public void generateSystemCTasks() { - ListIterator iterator = tmlmodeling.getTasks().listIterator(); + Iterator<TMLTask> iterator = tmlmodeling.getTasks().listIterator(); TMLTask t; SystemCTask st; while(iterator.hasNext()) { - t = (TMLTask)(iterator.next()); + t = iterator.next(); st = new SystemCTask(t); tasks.add(st); } diff --git a/src/tmltranslator/toturtle/TML2TURTLE.java b/src/tmltranslator/toturtle/TML2TURTLE.java index 2892cd8db7..0f880b1965 100755 --- a/src/tmltranslator/toturtle/TML2TURTLE.java +++ b/src/tmltranslator/toturtle/TML2TURTLE.java @@ -59,7 +59,7 @@ public class TML2TURTLE { private static String nameChannelNBRNBW = "ChannelNBRNBW__"; private static String nameChannelBRNBW = "ChannelBRNBW__"; - private static String nameChannelBRBW = "ChannelBRBW__"; + // private static String nameChannelBRBW = "ChannelBRBW__"; private static String nameEvent = "Event__"; @@ -67,7 +67,7 @@ public class TML2TURTLE { private TMLModeling tmlmodeling; private TURTLEModeling tm; - private Vector checkingErrors; + private Vector<CheckingError> checkingErrors; private int nbClass; @@ -76,7 +76,7 @@ public class TML2TURTLE { tmlmodeling = _tmlmodeling; } - public Vector getCheckingErrors() { + public Vector<CheckingError> getCheckingErrors() { return checkingErrors; } @@ -86,7 +86,7 @@ public class TML2TURTLE { tmlmodeling.removeAllRandomSequences(); tm = new TURTLEModeling(); - checkingErrors = new Vector(); + checkingErrors = new Vector<CheckingError>(); // Create TClasses -> same name as TML tasks nbClass = 0; @@ -106,12 +106,12 @@ public class TML2TURTLE { } private void createTClasses() { - ListIterator iterator = tmlmodeling.getListIteratorTasks(); + Iterator<TMLTask> iterator = tmlmodeling.getListIteratorTasks(); TMLTask task; TClass tcl; while(iterator.hasNext()) { - task = (TMLTask)(iterator.next()); + task = iterator.next(); tcl = new TClass(task.getName(), true); tm.addTClass(tcl); @@ -122,7 +122,7 @@ public class TML2TURTLE { } private void createChannelTClasses() { - ListIterator iterator = tmlmodeling.getListIteratorChannels(); + Iterator<TMLChannel> iterator = tmlmodeling.getListIteratorChannels(); TMLChannel channel; TClassChannelBRNBW tch1; TClassChannelNBRNBW tch2; @@ -130,7 +130,7 @@ public class TML2TURTLE { String name; while(iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + channel = iterator.next(); name = getChannelString(channel); switch(channel.getType()) { case TMLChannel.BRNBW: @@ -164,14 +164,14 @@ public class TML2TURTLE { } private void createEventTClasses() { - ListIterator iterator = tmlmodeling.getListIteratorEvents(); + Iterator<TMLEvent> iterator = tmlmodeling.getListIteratorEvents(); TMLEvent event; TClassEventInfinite tce; TClassEventFinite tcef; TClassEventFiniteBlocking tcefb; while(iterator.hasNext()) { - event = (TMLEvent)(iterator.next()); + event = iterator.next(); TraceManager.addDev("Making event"); if (event.isInfinite()) { TraceManager.addDev("Making event infinite"); @@ -208,18 +208,18 @@ public class TML2TURTLE { } private void createRequestTClasses() { - ListIterator iterator = tmlmodeling.getListIteratorRequests(); + Iterator<TMLRequest> iterator = tmlmodeling.getListIteratorRequests(); TMLRequest request; TClassRequest tcr; - ListIterator ite; + Iterator<TMLTask> ite; TMLTask task; while(iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + request = iterator.next(); tcr = new TClassRequest(nameRequest + request.getName(), request.getName(), request.getNbOfParams()); ite = request.getOriginTasks().listIterator(); while(ite.hasNext()) { - task = (TMLTask)(ite.next()); + task = ite.next(); tcr.addWriteGate(task.getName()); } tcr.addReadGate(); // Assume that request is going to only one class @@ -241,8 +241,8 @@ public class TML2TURTLE { private void createADOfTClass(TClass tclass, TMLTask task) { // For each element, make a translation - Vector newElements = new Vector(); // elements of AD - Vector baseElements = new Vector(); // elements of basic task + Vector<ADComponent> newElements = new Vector<ADComponent>(); // elements of AD + Vector<TMLActivityElement> baseElements = new Vector<TMLActivityElement>(); // elements of basic task //System.out.println("Making AD of " + tclass.getName()); translateAD(newElements, baseElements, tclass, task, task.getActivityDiagram().getFirst(), null, null); @@ -258,7 +258,7 @@ public class TML2TURTLE { } /* ADJunction adjunc represents the junction to which the activity should be branched when it terminates */ - private ADComponent translateAD(Vector newElements, Vector baseElements, TClass tclass, TMLTask task, TMLActivityElement tmle, ADComponent previous, ADJunction adjunc) { + private ADComponent translateAD(Vector<ADComponent> newElements, Vector<TMLActivityElement> baseElements, TClass tclass, TMLTask task, TMLActivityElement tmle, ADComponent previous, ADJunction adjunc) { //ADEmpty empty; ADActionStateWithParam adacparam, adacparam1, adacparam2, adacparam3, adacparam4; ADChoice adchoice; @@ -300,7 +300,7 @@ public class TML2TURTLE { if (tmle instanceof TMLStartState) { adc = tclass.getActivityDiagram().getStartState(); baseElements.add(tmle); - newElements.add(adc); + newElements.add( adc ); adc1 = translateAD(newElements, baseElements, tclass, task, tmle.getNextElement(0), adc, adjunc); adc.addNext(adc1); return adc; @@ -1072,13 +1072,13 @@ public class TML2TURTLE { } private void setGatesEvt(TClass tclass, TMLTask task) { - ListIterator iterator = tmlmodeling.getListIteratorEvents(); + Iterator<TMLEvent> iterator = tmlmodeling.getListIteratorEvents(); TMLEvent event; Gate g, g1; TClass tcl; while(iterator.hasNext()) { - event = (TMLEvent)(iterator.next()); + event = iterator.next(); if (task == event.getOriginTask()) { g = tclass.addNewGateIfApplicable("notify__" + event.getName()); @@ -1104,14 +1104,14 @@ public class TML2TURTLE { } private void setGatesRequest(TClass tclass, TMLTask task) { - ListIterator iterator = tmlmodeling.getListIteratorRequests(); + Iterator<TMLRequest> iterator = tmlmodeling.getListIteratorRequests(); TMLRequest request; Gate g, g1; TClass tcl; int index; while(iterator.hasNext()) { - request = (TMLRequest)(iterator.next()); + request = iterator.next(); g = tclass.addNewGateIfApplicable("sendReq__" + request.getName() + "__" + task.getName()); tcl = tm.getTClassWithName(nameRequest + request.getName()); //g1 = tcl.getGateByName("sendReq"); @@ -1126,7 +1126,7 @@ public class TML2TURTLE { } private void setGatesChannel(TClass tclass, TMLTask task) { - ListIterator iterator = tmlmodeling.getListIteratorChannels(); + Iterator<TMLChannel> iterator = tmlmodeling.getListIteratorChannels(); TMLChannel channel; Gate g, g1; TClass tcl; @@ -1134,7 +1134,7 @@ public class TML2TURTLE { //String name; while(iterator.hasNext()) { - channel = (TMLChannel)(iterator.next()); + channel = iterator.next(); if (task == channel.getOriginTask()) { g = tclass.addNewGateIfApplicable("wr__" + channel.getName()); @@ -1153,14 +1153,13 @@ public class TML2TURTLE { } } - - - - private ADComponent endOfActivity(Vector newElements, Vector baseElements, TClass tclass, ADJunction adjunc) { + private ADComponent endOfActivity(Vector<ADComponent> newElements, Vector<TMLActivityElement> baseElements, TClass tclass, ADJunction adjunc) { if (adjunc == null) { ADStop adstop = new ADStop(); newElements.add(adstop); - baseElements.add(adstop); + + // DB Issue #17: This is not a type that can be added to this list + //baseElements.add(adstop); tclass.getActivityDiagram().add(adstop); return adstop; } else { @@ -1196,12 +1195,12 @@ public class TML2TURTLE { } private void makeAttributes(TMLTask task, TClass tcl) { - ListIterator iterator = task.getAttributes().listIterator(); + Iterator<TMLAttribute> iterator = task.getAttributes().listIterator(); TMLAttribute tmla; //Param para; while(iterator.hasNext()) { - tmla = (TMLAttribute)(iterator.next()); + tmla = iterator.next(); switch (tmla.type.getType()) { case TMLType.NATURAL: //System.out.println("Adding nat attribute:" + modifyString(tmla.name)); diff --git a/src/tmltranslator/touppaal/TML2UPPAAL.java b/src/tmltranslator/touppaal/TML2UPPAAL.java index 373f533c95..c1950d6ccb 100755 --- a/src/tmltranslator/touppaal/TML2UPPAAL.java +++ b/src/tmltranslator/touppaal/TML2UPPAAL.java @@ -62,7 +62,7 @@ public class TML2UPPAAL { private UPPAALTemplate lossTemplate; private Vector<String> lossNames; - private boolean debug; + // private boolean debug; private int sizeInfiniteFIFO = DEFAULT_INFINITE_FIFO_SIZE; private int currentX, currentY; @@ -126,7 +126,7 @@ public class TML2UPPAAL { TraceManager.addDev("Generating UPPAAL Specification from TML"); tmlmodeling.removeAllRandomSequences(); - debug = _debug; + // debug = _debug; spec = new UPPAALSpec(); rtu = new RelationTMLUPPAAL(); lossTemplate = null; @@ -156,9 +156,10 @@ public class TML2UPPAAL { } public void makeChannels() { - ListIterator iterator = tmlmodeling.getListIteratorChannels(); + Iterator<TMLChannel> iterator = tmlmodeling.getListIteratorChannels(); + while(iterator.hasNext()) { - makeChannel((TMLChannel)(iterator.next())); + makeChannel(iterator.next()); } } @@ -193,9 +194,10 @@ public class TML2UPPAAL { } public void makeRequests() { - ListIterator iterator = tmlmodeling.getListIteratorRequests(); + Iterator<TMLRequest> iterator = tmlmodeling.getListIteratorRequests(); + while(iterator.hasNext()) { - makeRequest((TMLRequest)(iterator.next())); + makeRequest( iterator.next() ); } } @@ -216,9 +218,10 @@ public class TML2UPPAAL { } public void makeEvents() { - ListIterator iterator = tmlmodeling.getListIteratorEvents(); + Iterator<TMLEvent> iterator = tmlmodeling.getListIteratorEvents(); + while(iterator.hasNext()) { - makeEvent((TMLEvent)(iterator.next())); + makeEvent( iterator.next()); } } @@ -238,9 +241,10 @@ public class TML2UPPAAL { } public void makeTasks() { - ListIterator iterator = tmlmodeling.getListIteratorTasks(); + Iterator<TMLTask> iterator = tmlmodeling.getListIteratorTasks(); + while(iterator.hasNext()) { - makeTask((TMLTask)(iterator.next())); + makeTask( iterator.next() ); } } @@ -262,11 +266,11 @@ public class TML2UPPAAL { } public void makeAttributes(TMLTask task, UPPAALTemplate template) { - ListIterator iterator = task.getAttributes().listIterator(); + Iterator<TMLAttribute> iterator = task.getAttributes().listIterator(); TMLAttribute tmlatt; while(iterator.hasNext()) { - tmlatt = (TMLAttribute)(iterator.next()); + tmlatt = iterator.next(); if (tmlatt.hasInitialValue()) { template.addDeclaration(tmlatt.getType().toString() + " " + tmlatt.getName() + " = " + tmlatt.getInitialValue() +";\n"); } else { @@ -326,7 +330,7 @@ public class TML2UPPAAL { } public void makeElementBehavior(TMLTask task, UPPAALTemplate template, TMLActivityElement elt, UPPAALLocation previous, UPPAALLocation end) { - UPPAALLocation loc, loc1, loc2, loc3, loc4; + UPPAALLocation loc, loc1, loc2,/* loc3,*/ loc4; UPPAALTransition tr, tr1, tr2, tr3; TMLReadChannel rc; TMLWriteChannel wc; @@ -738,14 +742,14 @@ public class TML2UPPAAL { } public void makeSystem() { - ListIterator iterator = spec.getTemplates().listIterator(); + Iterator<UPPAALTemplate> iterator = spec.getTemplates().listIterator(); UPPAALTemplate template; String system = "system "; String dec = ""; int id = 0; while(iterator.hasNext()) { - template = (UPPAALTemplate)(iterator.next()); + template = iterator.next(); template.setIdInstanciation(id); dec += template.getName() + "__" + id + " = " + template.getName() + "();\n"; system += template.getName() + "__" + id; diff --git a/src/translator/ADComponent.java b/src/translator/ADComponent.java index 63af601d26..bdbb0d9168 100755 --- a/src/translator/ADComponent.java +++ b/src/translator/ADComponent.java @@ -51,12 +51,12 @@ public abstract class ADComponent implements Cloneable { protected boolean selected = false; protected int nbNext; protected int minNbNext; - protected Vector next; + protected Vector<ADComponent> next; public ADComponent substitute; // For modification of AD protected String pre, post; public ADComponent() { - next = new Vector(); + next = new Vector<ADComponent>(); minNbNext = 1; } @@ -68,7 +68,7 @@ public abstract class ADComponent implements Cloneable { public ADComponent getNext(int index) { if (index < next.size()) { - return (ADComponent)(next.elementAt(index)); + return next.elementAt(index); } else { return null; } @@ -86,11 +86,11 @@ public abstract class ADComponent implements Cloneable { return next.size(); } - public Vector getAllNext() { + public Vector<ADComponent> getAllNext() { return next; } - public void setNewNext(Vector newNext) { + public void setNewNext(Vector<ADComponent> newNext) { next = newNext; } @@ -187,7 +187,7 @@ public abstract class ADComponent implements Cloneable { return post; } - public Vector getLastBeforeStop(Vector v, ADComponent previous) { + public Vector<ADComponent> getLastBeforeStop(Vector<ADComponent> v, ADComponent previous) { if (this instanceof ADStop) { v.add(previous); return v; diff --git a/src/translator/ActivityDiagram.java b/src/translator/ActivityDiagram.java index 022123a9b1..457a8f07c6 100755 --- a/src/translator/ActivityDiagram.java +++ b/src/translator/ActivityDiagram.java @@ -48,9 +48,8 @@ package translator; import java.util.*; import myutil.*; -import ui.*; -public class ActivityDiagram extends Vector{ +public class ActivityDiagram extends Vector<ADComponent>{ protected ADStart ads; @@ -203,7 +202,7 @@ public class ActivityDiagram extends Vector{ ADComponent adc; ADActionStateWithGate adg, adg1; Gate g1; - Vector next; + Vector<ADComponent> next; String s, s1; int sizeBegin = size(); for(int i=0; i<sizeBegin; i++) { @@ -218,7 +217,7 @@ public class ActivityDiagram extends Vector{ // link the old one to the new one adg1.setNewNext(adg.getAllNext()); //link the new one to the previous next of the old one. - next = new Vector(); + next = new Vector<ADComponent>(); next.add(adg1); adg.setNewNext(next); // add new component to activity diagram @@ -329,7 +328,7 @@ public class ActivityDiagram extends Vector{ public StringBuffer printNextsToStringBuffer(ADComponent adc) { String s = ""; - Vector v = adc.getAllNext(); + Vector<ADComponent> v = adc.getAllNext(); ADComponent adcbis; //System.out.println("Size of v:" + v.size()); s = s+"\n\tNext: "; @@ -402,8 +401,8 @@ public class ActivityDiagram extends Vector{ public void setRegularJunctions() { ADComponent adc, adc2; int i, j, cpt, index1, index2; - Vector list; - Vector junctions = new Vector(); + Vector<ADComponent> list; + Vector<ADComponent> junctions = new Vector<ADComponent>(); ADJunction adj1, adj2; for(i=0; i<size(); i++) { adc = (ADComponent)(elementAt(i)); @@ -526,7 +525,7 @@ public class ActivityDiagram extends Vector{ ADChoice adch1; boolean go = true; int delay = 0; - LinkedList met; + List<ADComponent> met; ADActionStateWithGate adag, adag1; ADJunction adj; @@ -537,7 +536,7 @@ public class ActivityDiagram extends Vector{ if (!adch.isSpecialChoice(i, variableAsActions)) { // Go through the elements adc = adch.getNext(i); - met = new LinkedList(); + met = new LinkedList<ADComponent>(); while(go) { if (met.contains(adc)) { go = false; diff --git a/src/translator/Gate.java b/src/translator/Gate.java index b4c89b3f51..40051e78ce 100755 --- a/src/translator/Gate.java +++ b/src/translator/Gate.java @@ -45,7 +45,7 @@ knowledge of the CeCILL license and that you accept its terms. package translator; -public class Gate implements Comparable { +public class Gate implements Comparable<Gate> { private String name; private String lotosName; public String tmp = null; @@ -101,12 +101,13 @@ public class Gate implements Comparable { return name; } - public int compareTo(Object o) { - if (!(o instanceof Gate)) { - return 0; - } else { + @Override + public int compareTo(Gate o) { + // if (!(o instanceof Gate)) { +// return 0; + // } else { return toString().compareTo(o.toString()); - } + // } } diff --git a/src/translator/GroupOfGates.java b/src/translator/GroupOfGates.java index 905321995a..c58770a47b 100755 --- a/src/translator/GroupOfGates.java +++ b/src/translator/GroupOfGates.java @@ -48,10 +48,14 @@ package translator; import myutil.*; -import ui.tree.*; -public class GroupOfGates extends SortedVector implements Comparable, GenericTree { - private Gate masterGate; +public class GroupOfGates extends SortedVector implements Comparable<GroupOfGates>, GenericTree { + /** + * + */ + private static final long serialVersionUID = -2577784112172937239L; + + private Gate masterGate; public GroupOfGates() { } @@ -123,12 +127,13 @@ public class GroupOfGates extends SortedVector implements Comparable, GenericTre return s; } - public int compareTo(Object o) { - if (!(o instanceof GroupOfGates)) { - return 0; - } else { + @Override + public int compareTo( GroupOfGates o) { +// if (!(o instanceof GroupOfGates)) { +// return 0; +// } else { return toString().compareTo(o.toString()); - } +// } } diff --git a/src/translator/MasterGateManager.java b/src/translator/MasterGateManager.java index 9988e6d554..da136afea5 100755 --- a/src/translator/MasterGateManager.java +++ b/src/translator/MasterGateManager.java @@ -50,16 +50,16 @@ import java.util.*; public class MasterGateManager { - private Vector groups; // GroupsOfGates - private Vector master; - private Vector forbiddenNames; - private static LinkedList topMaster = new LinkedList(); + private Vector<GroupOfGates> groups; // GroupsOfGates + private Vector<Gate> master; + private Vector<Gate> forbiddenNames; + private static List<MasterGateManager> topMaster = new LinkedList<MasterGateManager>(); public MasterGateManager(TURTLEModeling tm) { topMaster.add(this); - groups = new Vector(); - master = new Vector(); - forbiddenNames = new Vector(); + groups = new Vector<GroupOfGates>(); + master = new Vector<Gate>(); + forbiddenNames = new Vector<Gate>(); initGates(tm, false); generateGates(); } @@ -69,31 +69,33 @@ public class MasterGateManager { reinitNameRestriction(); } topMaster.add(this); - groups = new Vector(); - master = new Vector(); - forbiddenNames = new Vector(); + groups = new Vector<GroupOfGates>(); + master = new Vector<Gate>(); + forbiddenNames = new Vector<Gate>(); initGates(tm, false); generateGates(); } // Observer public MasterGateManager() { - groups = new Vector(); - master = new Vector(); - forbiddenNames = new Vector(); + groups = new Vector<GroupOfGates>(); + master = new Vector<Gate>(); + forbiddenNames = new Vector<Gate>(); } public static void reinitNameRestriction() { - topMaster = new LinkedList(); + topMaster = new LinkedList<MasterGateManager>(); } public int getTotalGateNumber() { MasterGateManager mgm; int cpt = 0; + for(int k=0; k<topMaster.size(); k++) { - mgm = (MasterGateManager)(topMaster.get(k)); + mgm = topMaster.get(k); cpt += mgm.nbMasterGate(); } + return cpt; } @@ -123,10 +125,11 @@ public class MasterGateManager { name = name.toLowerCase(); - ListIterator ite = topMaster.listIterator(); + Iterator<MasterGateManager> ite = topMaster.listIterator(); while(ite.hasNext()) { - mgm = (MasterGateManager)(ite.next()); + mgm = ite.next(); + for(i=0; i<mgm.nbMasterGate(); i++) { //System.out.println("i:" + i + "k:" + k); g = mgm.getMasterGateAtIndex(i); @@ -138,13 +141,13 @@ public class MasterGateManager { return cpt; } - public Hashtable getGatesUpperCaseHashTable() { - Hashtable ht = new Hashtable(); + public Map<String, Gate> getGatesUpperCaseHashTable() { + Map<String, Gate> ht = new Hashtable<String, Gate>(); MasterGateManager mgm; int i; Gate g; - ListIterator ite = topMaster.listIterator(); + Iterator<MasterGateManager> ite = topMaster.listIterator(); while(ite.hasNext()) { mgm = (MasterGateManager)(ite.next()); for(i=0; i<mgm.nbMasterGate(); i++) { @@ -163,9 +166,11 @@ public class MasterGateManager { Gate g; name = name.toLowerCase(); - ListIterator ite = topMaster.listIterator(); + Iterator<MasterGateManager> ite = topMaster.listIterator(); + while(ite.hasNext()) { - mgm = (MasterGateManager)(ite.next()); + mgm = ite.next(); + for(i=0; i<mgm.nbMasterGate(); i++) { //System.out.println("i:" + i + "k:" + k); g = mgm.getMasterGateAtIndex(i); @@ -174,6 +179,7 @@ public class MasterGateManager { } } } + return null; } @@ -212,12 +218,12 @@ public class MasterGateManager { } public int getMasterIndexOf(GroupOfGates gog) { - MasterGateManager mgm; + // MasterGateManager mgm; GroupOfGates gog1; int cpt = 0; int i; for(int k=0; k<topMaster.size(); k++) { - mgm = (MasterGateManager)(topMaster.get(k)); + // mgm = (MasterGateManager)(topMaster.get(k)); for(i=0; i<groups.size(); i++) { gog1 = (GroupOfGates)(groups.elementAt(i)); if (gog1 == gog) { @@ -235,17 +241,17 @@ public class MasterGateManager { public MasterGateManager(TURTLEModeling tm, boolean startTakenIntoAccount) { topMaster.add(this); - groups = new Vector(); - master = new Vector(); - forbiddenNames = new Vector(); + groups = new Vector<GroupOfGates>(); + master = new Vector<Gate>(); + forbiddenNames = new Vector<Gate>(); initGates(tm, startTakenIntoAccount); generateGates(); } - public MasterGateManager(TURTLEModeling tm, Vector forbidden) { + public MasterGateManager(TURTLEModeling tm, Vector<Gate> forbidden) { topMaster.add(this); - groups = new Vector(); - master = new Vector(); + groups = new Vector<GroupOfGates>(); + master = new Vector<Gate>(); forbiddenNames = forbidden; initGates(tm, false); generateGates(); @@ -254,7 +260,7 @@ public class MasterGateManager { private void initGates(TURTLEModeling tm, boolean start) { TClass tc, tmp_tc; Gate g, tmp_g; - Vector list1, list2; + Vector<Gate> list1;//, list2; Relation r; GroupOfGates gog, gog1, gog2; @@ -266,7 +272,7 @@ public class MasterGateManager { // for each public gate, we add it a a group of gates if not connected a a gate already added list1 = tc.getGateList(); for(int j=0; j<list1.size(); j++) { - g = (Gate)(list1.elementAt(j)); + g = list1.elementAt(j); //System.out.println("Tclass:" + tc.getLotosName() + " Gate:" + g.getLotosName()); //if (!g.isInternal()) { @@ -324,17 +330,17 @@ public class MasterGateManager { } } } - - private void addForbiddenNames(Vector gates) { - forbiddenNames.addElement(gates); - } +// +// private void addForbiddenNames(Vector gates) { +// forbiddenNames.addElement(gates); +// } private void generateGates() { GroupOfGates gog; - TClass tc; + // TClass tc; Gate g, master; - String s; + // String s; int i; for(i=0; i<groups.size(); i++) { @@ -351,7 +357,7 @@ public class MasterGateManager { s = generateGateName(s); } //Gate new_g = new Gate(s, g.GATE, false); - Gate new_g = new Gate(s, g.GATE, g.isInternal()); + Gate new_g = new Gate(s, Gate.GATE, g.isInternal()); new_g.setLotosName(s); master.add(new_g); return new_g; @@ -400,7 +406,7 @@ public class MasterGateManager { } for(int j=0; j<forbiddenNames.size(); j++) { - g2 = (Gate)(forbiddenNames.elementAt(j)); + g2 = forbiddenNames.elementAt(j); if ((g2.getLotosName() != null) && (s != null)){ if (g2.getLotosName().equals(s)) { return true; @@ -432,7 +438,7 @@ public class MasterGateManager { return cpt; } - public Vector getAllMasterGates() { + public Vector<Gate> getAllMasterGates() { return master; } @@ -574,5 +580,4 @@ public class MasterGateManager { Collections.sort(master); Collections.sort(groups); } - } \ No newline at end of file diff --git a/src/translator/Param.java b/src/translator/Param.java index f0f8fdaf7f..ef8e66544b 100755 --- a/src/translator/Param.java +++ b/src/translator/Param.java @@ -46,7 +46,6 @@ knowledge of the CeCILL license and that you accept its terms. package translator; import translator.tojava.*; -import myutil.*; public class Param { private String name; @@ -139,7 +138,7 @@ public class Param { } String lowerid = id.toLowerCase(); - boolean b1, b2, b3, b4, b5; + boolean b1, b2, b3, b5; b1 = (id.substring(0,1)).matches("[a-zA-Z]"); b2 = id.matches("\\w*"); b3 = !RTLOTOSKeyword.isAKeyword(lowerid); diff --git a/src/translator/TClass.java b/src/translator/TClass.java index 532d63c0a7..26b4027a1e 100755 --- a/src/translator/TClass.java +++ b/src/translator/TClass.java @@ -54,8 +54,8 @@ public class TClass { private boolean activeClass; private Process process; private HLProcess hlprocess; - private Vector gateList; // list of the gate - private Vector paramList; // list of parameters + private Vector<Gate> gateList; // list of the gate + private Vector<Param> paramList; // list of parameters private boolean selected = false; private ActivityDiagram ad; private String packageName = ""; @@ -65,16 +65,16 @@ public class TClass { public TClass(String name, boolean isActive) { this.name = name; activeClass = isActive; - gateList = new Vector(); - paramList = new Vector(); + gateList = new Vector<Gate>(); + paramList = new Vector<Param>(); } public void removeAllAttributes() { - paramList = new Vector(); + paramList = new Vector<Param>(); } public void removeAllGates() { - gateList = new Vector(); + gateList = new Vector<Gate>(); } public boolean has(ADComponent adc) { @@ -191,7 +191,7 @@ public class TClass { public Param getParamByName(String s) { Param p; for(int i=0; i<paramList.size(); i++) { - p = (Param)(paramList.elementAt(i)); + p = paramList.elementAt(i); if (p.getName().equals(s)) { return p; } @@ -199,18 +199,20 @@ public class TClass { return null; } - public Vector getParamStartingWith(String name) { - Param p; - Vector v = new Vector(); - for(int i=0; i<paramList.size(); i++) { - p = (Param)(paramList.elementAt(i)); + public Vector<Param> getParamStartingWith(String name) { + Param p; + Vector<Param> v = new Vector<Param>(); + + for(int i=0; i<paramList.size(); i++) { + p = paramList.elementAt(i); //System.out.println("Param=" + p.getName() + " vs " + name); + if (p.getName().startsWith(name)) { v.add(p); } } + return v; - } public void setProcess(Process _process) { @@ -221,7 +223,7 @@ public class TClass { hlprocess = _hlprocess; } - public void setGateList(Vector v) { + public void setGateList(Vector<Gate> v) { gateList = v; } @@ -276,7 +278,7 @@ public class TClass { return ad; } - public Vector getGateList() { + public Vector<Gate> getGateList() { return gateList; } @@ -288,7 +290,7 @@ public class TClass { return (Gate)(gateList.get(index)); } - public Vector getParamList() { + public Vector<Param> getParamList() { return paramList; } diff --git a/src/ui/ActivityDiagramPanelInterface.java b/src/ui/ActivityDiagramPanelInterface.java index 00aa5e128f..28c5c635fd 100755 --- a/src/ui/ActivityDiagramPanelInterface.java +++ b/src/ui/ActivityDiagramPanelInterface.java @@ -46,9 +46,10 @@ package ui; + import java.util.*; public interface ActivityDiagramPanelInterface { - public LinkedList getComponentList(); + public List<TGComponent> getComponentList(); } \ No newline at end of file diff --git a/src/ui/AnalysisPanelTranslator.java b/src/ui/AnalysisPanelTranslator.java index 73b6304adc..fd9d3b2887 100755 --- a/src/ui/AnalysisPanelTranslator.java +++ b/src/ui/AnalysisPanelTranslator.java @@ -95,25 +95,25 @@ public class AnalysisPanelTranslator { int i, j; TDiagramPanel thmsc, thmsctmp; int nodeCounter = 0; - HMSCNode node, node1, node2; - LinkedList list; + HMSCNode node, node1;//, node2; + List<TGComponent> list; TGComponent tgc; MSC msc; int startCounter = 0; HMSCNode start = null; - ListIterator iterator; + Iterator<TGComponent> iterator; String action; boolean test = false; // For each IOD, we create a node - Vector iodsPanels = new Vector(); - Vector iodsNodes = new Vector() ; + Vector<InteractionOverviewDiagramPanel> iodsPanels = new Vector<InteractionOverviewDiagramPanel>(); + Vector<HMSCNode> iodsNodes = new Vector<HMSCNode>() ; for(i=0; i<ap.panels.size(); i++) { thmsc = (TDiagramPanel)(ap.panels.elementAt(i)); if (thmsc instanceof InteractionOverviewDiagramPanel) { System.out.println("Dealing with " + thmsc.getName()); - iodsPanels.add(thmsc); + iodsPanels.add( (InteractionOverviewDiagramPanel) thmsc); node = new HMSCNode("n"+nodeCounter + "choice_refiod", HMSCNode.CHOICE); iodsNodes.add(node); } @@ -131,7 +131,7 @@ public class AnalysisPanelTranslator { list = thmsc.getComponentList(); iterator = list.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); node = null; if (tgc instanceof IODChoice) { node = new HMSCNode("n"+nodeCounter + "choice", HMSCNode.CHOICE); @@ -325,11 +325,11 @@ public class AnalysisPanelTranslator { MSC msc; SequenceDiagramPanel sdp; - LinkedList ll = hmsc.getMSCs(); - Iterator iterator = ll.listIterator(); + //List ll = hmsc.getMSCs(); + Iterator<MSC> iterator = hmsc.getMSCs().listIterator(); while(iterator.hasNext()) { - msc = (MSC)(iterator.next()); + msc = iterator.next(); sdp = mgui.getSequenceDiagramPanel(ap, msc.getName()); if (sdp == null) { throw new AnalysisSyntaxException("No Sequence Diagram named " + msc.getName()); @@ -356,12 +356,12 @@ public class AnalysisPanelTranslator { } private void createAllNecessaryInstances(HMSC hmsc, SequenceDiagramPanel sdp) throws AnalysisSyntaxException { - LinkedList list = sdp.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = sdp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof SDInstance) { hmsc.getCreateInstanceIfNecessary(((SDInstance)tgc).getInstanceName()); @@ -371,8 +371,8 @@ public class AnalysisPanelTranslator { private void createEvt(HMSC hmsc, MSC msc, SequenceDiagramPanel sdp, CorrespondanceTGElement correspondance) throws AnalysisSyntaxException { // regular evt i.e. not message sending / receiving - LinkedList list = sdp.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = sdp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc, tgc1, tgc2, tgc3; TGComponent internal; TGConnectingPoint p1, p2; @@ -390,7 +390,7 @@ public class AnalysisPanelTranslator { // internal component of instances while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof SDInstance) { sdi = (SDInstance)tgc; @@ -530,7 +530,7 @@ public class AnalysisPanelTranslator { private void createTimeConstraints(HMSC hmsc, MSC msc, SequenceDiagramPanel sdp, CorrespondanceTGElement correspondance) throws AnalysisSyntaxException { // regular evt i.e. not message sending / receiving - Iterator iterator = sdp.getComponentList().listIterator(); + Iterator<TGComponent> iterator = sdp.getComponentList().listIterator(); TGComponent tgc, tgc1, tgc4; TGComponent internal; //TGConnectingPoint p1, p2; @@ -549,7 +549,7 @@ public class AnalysisPanelTranslator { // internal component of instances while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); //System.out.println("i=" + i); if (tgc instanceof SDInstance) { @@ -738,12 +738,12 @@ public class AnalysisPanelTranslator { } private void createEvtsOrder(HMSC hmsc, MSC msc, SequenceDiagramPanel sdp, CorrespondanceTGElement correspondance) throws AnalysisSyntaxException { - LinkedList ll = hmsc.getInstances(); - Iterator iterator = ll.listIterator(); + List<Instance> ll = hmsc.getInstances(); + Iterator<Instance> iterator = ll.listIterator(); Instance ins; while(iterator.hasNext()) { - ins = (Instance)(iterator.next()); + ins = iterator.next(); createEvtsOrderForInstance(msc, ins, sdp, correspondance); } } @@ -751,10 +751,10 @@ public class AnalysisPanelTranslator { private void createEvtsOrderForInstance(MSC msc, Instance ins, SequenceDiagramPanel sdp, CorrespondanceTGElement correspondance) throws AnalysisSyntaxException { Evt evt, evt1, nextEvt, lastEvt; - LinkedList ll = msc.getEvts(); - Iterator iterator = ll.listIterator(); - LinkedList orderedy = new LinkedList(); - LinkedList grouped = new LinkedList(); + List<Evt> ll = msc.getEvts(); + Iterator<Evt> iterator = ll.listIterator(); + List<Evt> orderedy = new LinkedList<Evt>(); + List<List<Evt>> grouped = new LinkedList<List<Evt>>(); SDInstance sdi = sdp.getSDInstance(ins.getName()); @@ -777,7 +777,7 @@ public class AnalysisPanelTranslator { iterator = ll.listIterator(); y = Integer.MAX_VALUE; while(iterator.hasNext()) { - evt = (Evt)(iterator.next()); + evt = iterator.next(); if ((evt.y <= y) && (!orderedy.contains(evt)) && (evt.getInstance() == ins)) { nextEvt = evt; y = evt.y; @@ -798,7 +798,7 @@ public class AnalysisPanelTranslator { //System.out.println("Order on " + msc.getName() + " and on instance " + sdi.getValue()); while(iterator.hasNext()) { - evt = (Evt)(iterator.next()); + evt = iterator.next(); //System.out.println("Evt=" + evt.getActionId()); } //events in the same coregion are regrouped: @@ -806,8 +806,8 @@ public class AnalysisPanelTranslator { iterator = orderedy.listIterator(); // first evt -> special algorithm if (iterator.hasNext()) { - evt = (Evt)(iterator.next()); - ll = new LinkedList(); + evt = iterator.next(); + ll = new LinkedList<Evt>(); ll.add(evt); grouped.add(ll); lastEvt = evt; @@ -825,7 +825,7 @@ public class AnalysisPanelTranslator { ll.add(evt); lastEvt = evt; } else { - ll = new LinkedList(); + ll = new LinkedList<Evt>(); ll.add(evt); grouped.add(ll); lastEvt = evt; @@ -837,22 +837,22 @@ public class AnalysisPanelTranslator { } // Orders are created! - Iterator iterator1, iterator2, iterator3; - iterator1 = grouped.listIterator(); - LinkedList previous, current; + //Iterator iterator1, iterator2, iterator3; + Iterator<List<Evt>> iterator1 = grouped.listIterator(); + List<Evt> previous, current; Order order; // first groups has no previous evts - previous = (LinkedList)(iterator1.next()); + previous = iterator1.next(); while(iterator1.hasNext()) { - current = (LinkedList)(iterator1.next()); - iterator2 = current.listIterator(); + current = iterator1.next(); + Iterator<Evt> iterator2 = current.listIterator(); while(iterator2.hasNext()) { - evt = (Evt)(iterator2.next()); - iterator3 = previous.listIterator(); + evt = iterator2.next(); + Iterator<Evt> iterator3 = previous.listIterator(); while(iterator3.hasNext()) { - evt1 = (Evt)(iterator3.next()); + evt1 = iterator3.next(); order = new Order(evt1, evt); //System.out.println("New order between " + evt1.getActionId() + " and " + evt.getActionId()); msc.addOrder(order); @@ -868,5 +868,4 @@ public class AnalysisPanelTranslator { } checkingErrors.add (ce); } - } diff --git a/src/ui/AvatarDeploymentPanelTranslator.java b/src/ui/AvatarDeploymentPanelTranslator.java index 709807323a..b3e509acbf 100644 --- a/src/ui/AvatarDeploymentPanelTranslator.java +++ b/src/ui/AvatarDeploymentPanelTranslator.java @@ -48,6 +48,7 @@ package ui; import java.util.HashMap; import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.Vector; @@ -111,11 +112,11 @@ public class AvatarDeploymentPanelTranslator { private int no_tty = 0; private int nb_clusters = 0; - private LinkedList<TGComponent> tgcComponents; + private List<TGComponent> tgcComponents; - private LinkedList<AvatarComponent> avatarComponents; - private LinkedList<AvatarConnector> avatarConnectors; - private LinkedList<AvatarMappedObject> avatarMappedObject; + private List<AvatarComponent> avatarComponents; + private List<AvatarConnector> avatarConnectors; + private List<AvatarMappedObject> avatarMappedObject; public AvatarDeploymentPanelTranslator(ADDDiagramPanel _avatarddDiagramPanel) { tgcComponents = _avatarddDiagramPanel.getComponentList(); @@ -151,9 +152,10 @@ System.out.println("ADD CPU monitored "+ monitored); nb_init++; no_proc++; - Vector tasks = addCPUNode.getArtifactList(); + Vector<ADDBlockArtifact> tasks = addCPUNode.getArtifactList(); + for (int i = 0; i < tasks.size(); i++) { - ADDBlockArtifact task = (ADDBlockArtifact) tasks.get(i); + ADDBlockArtifact task = tasks.get(i); String taskName = task.getTaskName(); String referenceTaskName = task.getReferenceTaskName(); @@ -294,9 +296,9 @@ System.out.println("ADD CPU monitored "+ monitored); no_ram++; nb_target++; - Vector channels = addRamNode.getArtifactList(); + Vector<ADDChannelArtifact> channels = addRamNode.getArtifactList(); for (int i = 0; i < channels.size(); i++) { - ADDChannelArtifact c = (ADDChannelArtifact) channels.get(i); + ADDChannelArtifact c = channels.get(i); String referenceDiagram = c.getReferenceDiagram(); String channelName = c.getChannelName(); diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java index 7808c5e8d9..825fbd3ac8 100644 --- a/src/ui/AvatarDesignPanel.java +++ b/src/ui/AvatarDesignPanel.java @@ -144,7 +144,7 @@ public class AvatarDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(asmdp); asmdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT); toolBarPanel.add(toolBarActivity, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(asmdp); @@ -171,7 +171,7 @@ public class AvatarDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(abdp); abdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarAvatarBD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("Design", IconManager.imgic80, toolBarPanel, "Opens the Design"); @@ -220,9 +220,9 @@ public class AvatarDesignPanel extends TURTLEPanel { TGComponent tgc; for(int i=0; i<panels.size(); i++) { - ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + Iterator<TGComponent> iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); tgc.setAVATARMet(0); tgc.setInternalAvatarMet(0); @@ -242,9 +242,9 @@ public class AvatarDesignPanel extends TURTLEPanel { for(int i=0; i<panels.size(); i++) { tdp = (TDiagramPanel)(panels.get(i)); if (tdp instanceof AvatarSMDPanel) { - ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + Iterator<TGComponent> iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); tgc.getAllCheckableInvariant(list); } } @@ -259,9 +259,9 @@ public class AvatarDesignPanel extends TURTLEPanel { for(int i=0; i<panels.size(); i++) { tdp = (TDiagramPanel)(panels.get(i)); if (tdp instanceof AvatarSMDPanel) { - ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + Iterator<TGComponent> iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); tgctmp = tgc.hasCheckableMasterMutex(); if (tgctmp != null) { //TraceManager.addDev("Found element with master mutex: " + tgctmp); @@ -279,9 +279,9 @@ public class AvatarDesignPanel extends TURTLEPanel { for(int i=0; i<panels.size(); i++) { tdp = (TDiagramPanel)(panels.get(i)); if (tdp instanceof AvatarSMDPanel) { - ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + Iterator<TGComponent> iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); tgc.removeAllMutualExclusionWithMasterMutex(); } } @@ -293,9 +293,9 @@ public class AvatarDesignPanel extends TURTLEPanel { for(int i=0; i<panels.size(); i++) { tdp = (TDiagramPanel)(panels.get(i)); if (tdp instanceof AvatarSMDPanel) { - ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + Iterator<TGComponent> iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof AvatarSMDState) { ((AvatarSMDState)tgc).reinitMutualExclusionStates(); } @@ -336,7 +336,7 @@ public class AvatarDesignPanel extends TURTLEPanel { } - public void modelBacktracingUppaal(HashMap verifMap){ + public void modelBacktracingUppaal( Map<String, Integer> verifMap){ for (Object ob: abdp.getComponentList()) { if (ob instanceof AvatarBDSafetyPragma) { AvatarBDSafetyPragma pragma = (AvatarBDSafetyPragma) ob; @@ -397,7 +397,7 @@ public class AvatarDesignPanel extends TURTLEPanel { String block, state; int index; int i; - ListIterator iterator; + Iterator<TGComponent> iterator; TGComponent tgc; // Reachable states @@ -415,7 +415,7 @@ public class AvatarDesignPanel extends TURTLEPanel { if ((tdp instanceof AvatarSMDPanel) && (tdp.getName().compareTo(block) == 0)){ iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof AvatarSMDState) { ((AvatarSMDState)tgc).setSecurityInfo(AvatarSMDState.REACHABLE, state); } diff --git a/src/ui/AvatarDesignPanelTranslator.java b/src/ui/AvatarDesignPanelTranslator.java index 912578aee6..867d588cd6 100644 --- a/src/ui/AvatarDesignPanelTranslator.java +++ b/src/ui/AvatarDesignPanelTranslator.java @@ -46,26 +46,22 @@ package ui; import java.util.*; - - import myutil.*; import ui.avatarbd.*; import ui.avatarsmd.*; import avatartranslator.*; -//import translator.*; -import ui.window.*; - public class AvatarDesignPanelTranslator { protected AvatarDesignPanel adp; - protected LinkedList<CheckingError> checkingErrors, warnings; + protected List<CheckingError> checkingErrors, warnings; protected CorrespondanceTGElement listE; // usual list //protected CorrespondanceTGElement listB; // list for particular element -> first element of group of blocks - protected LinkedList <TDiagramPanel> panels; - protected HashMap<String, LinkedList<TAttribute>> typeAttributesMap; - protected HashMap<String, String> nameTypeMap; + protected List <TDiagramPanel> panels; + protected Map<String, List<TAttribute>> typeAttributesMap; + protected Map<String, String> nameTypeMap; + public AvatarDesignPanelTranslator(AvatarDesignPanel _adp) { adp = _adp; reinit(); @@ -78,11 +74,11 @@ public class AvatarDesignPanelTranslator { panels = new LinkedList <TDiagramPanel>(); } - public LinkedList<CheckingError> getErrors() { + public List<CheckingError> getErrors() { return checkingErrors; } - public LinkedList<CheckingError> getWarnings() { + public List<CheckingError> getWarnings() { return warnings; } @@ -90,9 +86,9 @@ public class AvatarDesignPanelTranslator { return listE; } - public AvatarSpecification generateAvatarSpecification(LinkedList<AvatarBDStateMachineOwner> _blocks) { - LinkedList<AvatarBDBlock> blocks = new LinkedList<AvatarBDBlock>(); - LinkedList<AvatarBDLibraryFunction> libraryFunctions = new LinkedList<AvatarBDLibraryFunction>(); + public AvatarSpecification generateAvatarSpecification( List<AvatarBDStateMachineOwner> _blocks) { + List<AvatarBDBlock> blocks = new LinkedList<AvatarBDBlock>(); + List<AvatarBDLibraryFunction> libraryFunctions = new LinkedList<AvatarBDLibraryFunction>(); for (AvatarBDStateMachineOwner owner: _blocks) if (owner instanceof AvatarBDBlock) @@ -108,7 +104,7 @@ public class AvatarDesignPanelTranslator { as.addApplicationCode(abdp.getMainCode()); } } - typeAttributesMap = new HashMap<String, LinkedList<TAttribute>>(); + typeAttributesMap = new HashMap<String, List<TAttribute>>(); nameTypeMap = new HashMap<String,String>(); createLibraryFunctions (as, libraryFunctions); createBlocks(as, blocks); @@ -169,16 +165,17 @@ public class AvatarDesignPanelTranslator { } } - public void createPragmas(AvatarSpecification _as, LinkedList<AvatarBDBlock> _blocks) { - Iterator iterator = adp.getAvatarBDPanel().getComponentList().listIterator(); + public void createPragmas(AvatarSpecification _as, List<AvatarBDBlock> _blocks) { + Iterator<TGComponent> iterator = adp.getAvatarBDPanel().getComponentList().listIterator(); TGComponent tgc; AvatarBDPragma tgcn; AvatarBDSafetyPragma tgsp; String values []; String tmp; - LinkedList<AvatarPragma> pragmaList; + List<AvatarPragma> pragmaList; + while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof AvatarBDPragma) { ErrorAccumulator errorAcc = new ErrorAccumulator (tgc, adp.getAvatarBDPanel()); tgcn = (AvatarBDPragma)tgc; @@ -218,7 +215,7 @@ public class AvatarDesignPanelTranslator { } } } - public boolean checkSafetyPragma(String _pragma, LinkedList<AvatarBDBlock> _blocks, AvatarSpecification as){ + public boolean checkSafetyPragma(String _pragma, List<AvatarBDBlock> _blocks, AvatarSpecification as){ //Todo: check types //Todo: handle complex types _pragma = _pragma.trim(); @@ -286,7 +283,7 @@ public class AvatarDesignPanelTranslator { AvatarType p1Type= AvatarType.UNDEFINED; AvatarBlock bl1 = as.getBlockWithName(block1); if (bl1 !=null){ - AvatarStateMachine asm = bl1.getStateMachine(); + //AvatarStateMachine asm = bl1.getStateMachine(); if (bl1.getIndexOfAvatarAttributeWithName(attr1)==-1){ TraceManager.addDev("UPPAAL Pragma " + _pragma + " contains invalid attribute name " + attr1); return false; @@ -409,7 +406,7 @@ public class AvatarDesignPanelTranslator { LinkedList<TAttribute> types; AvatarBDBlock block; TAttribute ta; - AvatarBlock ab; + // AvatarBlock ab; String myBlockName = ""; @@ -625,7 +622,7 @@ public class AvatarDesignPanelTranslator { _ab.addAttribute(this.createRegularAttribute (_ab, _a, _preName)); } - public void createLibraryFunctions (AvatarSpecification _as, LinkedList<AvatarBDLibraryFunction> _libraryFunctions) { + public void createLibraryFunctions (AvatarSpecification _as, List<AvatarBDLibraryFunction> _libraryFunctions) { for (AvatarBDLibraryFunction libraryFunction: _libraryFunctions) { AvatarLibraryFunction alf = new AvatarLibraryFunction (libraryFunction.getFunctionName (), _as, libraryFunction); _as.addLibraryFunction (alf); @@ -731,9 +728,9 @@ public class AvatarDesignPanelTranslator { } // Create signals - for (ui.AvatarSignal uias: libraryFunction.getSignals ()) { + for ( AvatarSignal uias: libraryFunction.getSignals ()) { avatartranslator.AvatarSignal atas; - if (uias.getInOut() == uias.IN) + if (uias.getInOut() == AvatarSignal.IN) atas = new avatartranslator.AvatarSignal(uias.getId(), avatartranslator.AvatarSignal.IN, uias); else atas = new avatartranslator.AvatarSignal(uias.getId(), avatartranslator.AvatarSignal.OUT, uias); @@ -744,7 +741,7 @@ public class AvatarDesignPanelTranslator { } } - public void createBlocks(AvatarSpecification _as, LinkedList<AvatarBDBlock> _blocks) { + public void createBlocks(AvatarSpecification _as, List<AvatarBDBlock> _blocks) { for(AvatarBDBlock block: _blocks) { AvatarBlock ab = new AvatarBlock(block.getBlockName(), _as, block); _as.addBlock(ab); @@ -800,7 +797,7 @@ public class AvatarDesignPanelTranslator { // Create signals for (ui.AvatarSignal uias: block.getSignalList ()) { avatartranslator.AvatarSignal atas; - if (uias.getInOut() == uias.IN) { + if (uias.getInOut() == AvatarSignal.IN) { atas = new avatartranslator.AvatarSignal(uias.getId(), avatartranslator.AvatarSignal.IN, uias); } else { atas = new avatartranslator.AvatarSignal(uias.getId(), avatartranslator.AvatarSignal.OUT, uias); @@ -1644,7 +1641,7 @@ public class AvatarDesignPanelTranslator { asm.handleUnfollowedStartState(_ab); // Investigate all states -> put warnings for all empty transitions from a state to the same one (infinite loop) - int nb; + // int nb; for (AvatarStateMachineElement asmee: asm.getListOfElements()) if (asmee instanceof AvatarState && ((AvatarState)asmee).hasEmptyTransitionsOnItself(asm) > 0) { CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, "State(s) " + asmee.getName() + " has empty transitions on itself"); @@ -1677,9 +1674,11 @@ public class AvatarDesignPanelTranslator { // Checks whether all states with internal state machines have at most one start state private TGComponent checkForStartStateOfCompositeStates(AvatarSMDPanel _panel) { TGComponent tgc; - ListIterator iterator = _panel.getComponentList().listIterator(); + Iterator<TGComponent> iterator = _panel.getComponentList().listIterator(); + while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof AvatarSMDState) { tgc = (((AvatarSMDState)(tgc)).checkForStartStateOfCompositeStates()); if (tgc != null) { @@ -1687,13 +1686,14 @@ public class AvatarDesignPanelTranslator { } } } + return null; } - public void createRelationsBetweenBlocks(AvatarSpecification _as, LinkedList<AvatarBDBlock> _blocks) { + public void createRelationsBetweenBlocks(AvatarSpecification _as, List<AvatarBDBlock> _blocks) { adp.getAvatarBDPanel().updateAllSignalsOnConnectors(); - Iterator iterator = adp.getAvatarBDPanel().getComponentList().listIterator(); + Iterator<TGComponent> iterator = adp.getAvatarBDPanel().getComponentList().listIterator(); TGComponent tgc; AvatarBDPortConnector port; @@ -1706,7 +1706,8 @@ public class AvatarDesignPanelTranslator { avatartranslator.AvatarSignal atas1, atas2; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof AvatarBDPortConnector) { port = (AvatarBDPortConnector)tgc; block1 = port.getAvatarBDBlock1(); @@ -1793,7 +1794,7 @@ public class AvatarDesignPanelTranslator { String s = _input.substring(index0+1, index1).trim(); - String output = ""; + // String output = ""; if (s.length() == 0) { return _input; diff --git a/src/ui/ClassDiagramPanelInterface.java b/src/ui/ClassDiagramPanelInterface.java index e621c1e57d..c121ae4ac9 100755 --- a/src/ui/ClassDiagramPanelInterface.java +++ b/src/ui/ClassDiagramPanelInterface.java @@ -50,7 +50,7 @@ package ui; import java.util.*; public interface ClassDiagramPanelInterface { - public LinkedList getComponentList(); + public List<TGComponent> getComponentList(); public TClassSynchroInterface getTClass1ToWhichIamConnected(CompositionOperatorInterface coi); public TClassSynchroInterface getTClass2ToWhichIamConnected(CompositionOperatorInterface coi); public TGConnector getTGConnectorAssociationOf(CompositionOperatorInterface coi); diff --git a/src/ui/CorrespondanceTGElement.java b/src/ui/CorrespondanceTGElement.java index 4386d04f6a..5444bde99d 100755 --- a/src/ui/CorrespondanceTGElement.java +++ b/src/ui/CorrespondanceTGElement.java @@ -59,23 +59,23 @@ import ui.cd.*; import tepe.*; public class CorrespondanceTGElement { - private Vector tg; //tgelement - private Vector names; //prename - private Vector data; // turtle modeling elements - private Vector panelNames; //to look for an element only in it's panel + private Vector<TGComponent> tg; //tgelement + private Vector<String> names; //prename + private Vector<Object> data; // turtle modeling elements + private Vector<String> panelNames; //to look for an element only in it's panel //It is more natural than using indexes and easyer to use in a recursive context public CorrespondanceTGElement() { - tg = new Vector(); - data = new Vector(); - names = new Vector(); - panelNames=new Vector(); + tg = new Vector<TGComponent>(); + data = new Vector<Object>(); + names = new Vector<String>(); + panelNames=new Vector<String>(); } - public Vector getTG() { return tg;} - public Vector getNames() { return names;} - public Vector getData() { return data;} - public Vector getPanelNames() { return panelNames;} + public Vector<TGComponent> getTG() { return tg;} + public Vector<String> getNames() { return names;} + public Vector<Object> getData() { return data;} + public Vector<String> getPanelNames() { return panelNames;} public void merge(CorrespondanceTGElement ce) { tg.addAll(ce.getTG()); @@ -99,7 +99,7 @@ public class CorrespondanceTGElement { public TGComponent getTG(Object o) { int index = data.indexOf(o); if ((index != -1) && (tg.size() > index)) { - return (TGComponent)(tg.elementAt(index)); + return tg.elementAt(index); } return null; } diff --git a/src/ui/DesignPanel.java b/src/ui/DesignPanel.java index a55dd0bdb7..054630708d 100755 --- a/src/ui/DesignPanel.java +++ b/src/ui/DesignPanel.java @@ -49,13 +49,12 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; -import java.util.*; import ui.cd.*; import ui.ad.*; public class DesignPanel extends TURTLEPanel implements TURTLEDesignPanelInterface { public TClassDiagramPanel tcdp; - public LinkedList<TClassInterface> validated, ignored; + public java.util.List<TClassInterface> validated, ignored; public DesignPanel(MainGUI _mgui) { @@ -102,7 +101,7 @@ public class DesignPanel extends TURTLEPanel implements TURTLEDesignPanelInterfa JScrollDiagramPanel jsp = new JScrollDiagramPanel(tadp); tadp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarActivity, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(tadp); @@ -133,7 +132,7 @@ public class DesignPanel extends TURTLEPanel implements TURTLEDesignPanelInterfa JScrollDiagramPanel jsp = new JScrollDiagramPanel(tcdp); tcdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarClass, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("Class Diagram", IconManager.imgic14, toolBarPanel, "Opens class diagram"); diff --git a/src/ui/DesignPanelTranslator.java b/src/ui/DesignPanelTranslator.java index 73ddd38647..593a3f4deb 100755 --- a/src/ui/DesignPanelTranslator.java +++ b/src/ui/DesignPanelTranslator.java @@ -46,18 +46,14 @@ package ui; import java.util.*; - - import myutil.*; import ui.ad.*; import ui.cd.*; import translator.*; -import ui.window.*; import ui.osad.*; - public class DesignPanelTranslator { protected TURTLEDesignPanelInterface dp; protected LinkedList<CheckingError> checkingErrors, warnings; @@ -136,7 +132,7 @@ public class DesignPanelTranslator { } private void addTClassesFromPanel(TDiagramPanel diag, ClassDiagramPanelInterface tdp, LinkedList<TClassInterface> tclasses, String preName, TURTLEModeling tm) { - LinkedList list = tdp.getComponentList(); + // LinkedList list = tdp.getComponentList(); // search for tclasses for (Object tgc: tdp.getComponentList ()) @@ -148,7 +144,7 @@ public class DesignPanelTranslator { //System.out.println("Adding TClass: " + tgc.getClassName()); TClass t = new TClass(preName + tgc.getClassName(), tgc.isStart()); - int i, j; + int j; Param p; Gate g; boolean internal; int type; int value; @@ -317,13 +313,13 @@ public class DesignPanelTranslator { } // search for start state - LinkedList list = adpi.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = adpi.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc; TGComponent tss = null; int cptStart = 0; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TADStartState){ tss = tgc; cptStart ++; @@ -355,7 +351,7 @@ public class DesignPanelTranslator { //ADActionState ada; ADActionStateWithGate adag; ADActionStateWithParam adap; - ADActionStateWithMultipleParam adamp; + //ADActionStateWithMultipleParam adamp; ADChoice adch; ADDelay add; ADJunction adj; @@ -374,7 +370,7 @@ public class DesignPanelTranslator { int nbActions; String sTmp; - int startIndex = listE.getSize(); + // int startIndex = listE.getSize(); // Creation of the activity diagram ads = new ADStart(); @@ -460,7 +456,7 @@ public class DesignPanelTranslator { //System.out.println("Action state with multi param found " + p.getName() + " value:" + t.getExprValueFromActionState(s)); // Checking params CheckingError ce; - Vector v; + // Vector v; for(j=0; j<nbActions; j++) { sTmp = TURTLEModeling.manageDataStructures(t,((TADActionState)(tgc)).getAction(j)); if (sTmp == null) { @@ -525,11 +521,11 @@ public class DesignPanelTranslator { tadas.setStateAction(ErrorHighlight.ATTRIBUTE); String nameTmp; - Vector v0 = t.getParamStartingWith(ta0.getId()+ "__"); + Vector<Param> v0 = t.getParamStartingWith(ta0.getId()+ "__"); ADComponent adtmp = null; for(j=0; j<v0.size(); j++) { - p = (Param)(v0.get(j)); + p = v0.get(j); adap = new ADActionStateWithParam(p); ad.addElement(adap); if (adtmp != null) { @@ -1080,13 +1076,13 @@ public class DesignPanelTranslator { } private void addRelationFromPanel(ClassDiagramPanelInterface tdp, String prename, TURTLEModeling tm) { - LinkedList list = tdp.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = tdp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); // search for Composition Operator TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof CompositionOperatorInterface) { addRelationFromCompositionOperator((CompositionOperatorInterface)tgc, tdp, prename, tm); } diff --git a/src/ui/EBRDDTranslator.java b/src/ui/EBRDDTranslator.java index e9abaeea08..646fbaa626 100755 --- a/src/ui/EBRDDTranslator.java +++ b/src/ui/EBRDDTranslator.java @@ -46,9 +46,6 @@ package ui; import java.util.*; - - -import myutil.*; import ui.ebrdd.*; import req.ebrdd.*; import tmltranslator.*; @@ -102,14 +99,14 @@ public class EBRDDTranslator { ebrdd = new EBRDD(_name); // Search for start state - LinkedList list = ebrddp.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = ebrddp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc, tgc1, tgc2, tgc3, tgc1tmp, tgc2tmp; TGComponent tss = null; int cptStart = 0; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof EBRDDStartState){ tss = tgc; cptStart ++; @@ -217,7 +214,7 @@ public class EBRDDTranslator { } } - Vector v = listE.getData(); + Vector<Object> v = listE.getData(); Object o; for(i=0; i<v.size(); i++) { o = v.get(i); diff --git a/src/ui/GProactiveDesign.java b/src/ui/GProactiveDesign.java index bbb2039e41..cf7c201368 100755 --- a/src/ui/GProactiveDesign.java +++ b/src/ui/GProactiveDesign.java @@ -50,7 +50,6 @@ package ui; import java.util.*; import fr.inria.oasis.vercors.cttool.model.Attribute; -import fr.inria.oasis.vercors.cttool.model.AttributeImpl; import fr.inria.oasis.vercors.cttool.model.Component; import fr.inria.oasis.vercors.cttool.model.ComponentImpl; import fr.inria.oasis.vercors.cttool.model.InPort; @@ -70,12 +69,12 @@ import ui.prosmd.util.CorrespondanceSMDManager; public class GProactiveDesign { private TURTLEModeling tm; private ProactiveDesignPanel pdp; - private LinkedList portsList=new LinkedList(); //list of ProCSDPort - private LinkedList connectorsList =new LinkedList(); //list of TGConnectorProCSD - private LinkedList connectorsPortInterfacesList=new LinkedList(); - private LinkedList interfacesList =new LinkedList(); //list of ProCSDInterface - private LinkedList ProCSDComponentsList=new LinkedList(); - private LinkedList<CheckingError> checkingErrors=new LinkedList<CheckingError> (); + private List<ProCSDPort> portsList=new LinkedList<ProCSDPort>(); //list of ProCSDPort + private List<TGConnectorProCSD> connectorsList =new LinkedList<TGConnectorProCSD>(); //list of TGConnectorProCSD + private List<TGConnectorPortInterface> connectorsPortInterfacesList=new LinkedList<TGConnectorPortInterface>(); + private List<ProCSDInterface> interfacesList =new LinkedList<ProCSDInterface>(); //list of ProCSDInterface + private List<ProCSDComponent> proCSDComponentsList=new LinkedList<ProCSDComponent>(); + private List<CheckingError> checkingErrors=new LinkedList<CheckingError> (); // private CorrespondanceTGElement listE; private CorrespondanceSMDManager corespManager; private boolean buildErrors; @@ -95,12 +94,12 @@ public class GProactiveDesign { private void init() { checkingErrors = new LinkedList<CheckingError> (); // listE = new CorrespondanceTGElement(); - portsList=new LinkedList(); //list of ProCSDPort - connectorsList =new LinkedList(); //list of TGConnectorProCSD - interfacesList =new LinkedList(); //list of ProCSDInterface - ProCSDComponentsList=new LinkedList(); + portsList=new LinkedList<ProCSDPort>(); //list of ProCSDPort + connectorsList =new LinkedList<TGConnectorProCSD>(); //list of TGConnectorProCSD + interfacesList =new LinkedList<ProCSDInterface>(); //list of ProCSDInterface + proCSDComponentsList=new LinkedList<ProCSDComponent>(); ProactiveCSDPanel csd = (ProactiveCSDPanel)(pdp.panels.elementAt(0)); - LinkedList list = csd.getComponentList(); + List<TGComponent> list = csd.getComponentList(); boolean cyclefound=false; for (int i=0;i<list.size();i++) { @@ -146,10 +145,10 @@ public class GProactiveDesign { //we add attributes - LinkedList attribs=comp.getMyAttributes(); + List<TAttribute> attribs=comp.getMyAttributes(); for (int at=0;at<attribs.size();at++) { - TAttribute a=(TAttribute)attribs.get(at); + TAttribute a= attribs.get(at); Attribute attrib=new fr.inria.oasis.vercors.cttool.model.AttributeImpl(a.getId(),a.getType(),a.getAccess(),a.getInitialValue()); modelComp.addAttribute(attrib); } @@ -160,7 +159,7 @@ public class GProactiveDesign { //are not already //created - Vector portsList=comp.getPortsList(); + Vector<ProCSDPort> portsList=comp.getPortsList(); for (int k=0;k<portsList.size();k++) { ProCSDPort p =(ProCSDPort)portsList.get(k); @@ -177,11 +176,11 @@ public class GProactiveDesign { { ProCSDInterface proI=p.getMyInterface(); Interface modelI=new InterfaceImpl(proI.getValue(),proI.isMandatory()); - LinkedList proMsgs=proI.getMyMessages(); + List<TAttribute> proMsgs=proI.getMyMessages(); for(int i=0; i<proMsgs.size(); i++) { - TAttribute a = (TAttribute)(proMsgs.get(i)); + TAttribute a = proMsgs.get(i); Message m=new MessageImpl(a.getId()); modelI.addMessage(m); } @@ -194,10 +193,10 @@ public class GProactiveDesign { modelComp.setBehaviour(comp.getMySMD()); - Vector subComps=comp.getComponentList(); + Vector<ProCSDComponent> subComps=comp.getComponentList(); for (int k=0;k<subComps.size();k++) { - ProCSDComponent subComp=(ProCSDComponent)subComps.get(k); + ProCSDComponent subComp= subComps.get(k); Component sc=createModelComp(subComp); @@ -214,10 +213,10 @@ public class GProactiveDesign { private Component initModel(ProactiveCSDPanel mainCsd) throws Exception { Component mainAppComp=new ComponentImpl("Application"); - LinkedList comps = mainCsd.getComponentList(); + List<TGComponent> comps = mainCsd.getComponentList(); for (int k=0;k<comps.size();k++) { - TGComponent t=(TGComponent)comps.get(k); + TGComponent t= comps.get(k); if (t instanceof ProCSDComponent) { ProCSDComponent comp=(ProCSDComponent)t; @@ -253,10 +252,10 @@ public class GProactiveDesign { private void updatePortsBindingInModel(Component modelComp, ProCSDComponent proComp) throws Exception { //we consider pairs of (model Out Port, ProCSDOutPort) - Vector ports=proComp.getPortsList(); + Vector<ProCSDPort> ports=proComp.getPortsList(); for (int k=0;k<ports.size();k++) { - ProCSDPort p=(ProCSDPort)ports.get(k); + ProCSDPort p= ports.get(k); if (p instanceof ProCSDOutPort) { ProCSDOutPort proPort=(ProCSDOutPort)p; @@ -293,7 +292,7 @@ public class GProactiveDesign { if (proFromPort!=null) { Port modelFromPort=null; - ProCSDComponent proFromPortFather =(ProCSDComponent)proFromPort.getFather(); + //ProCSDComponent proFromPortFather =(ProCSDComponent)proFromPort.getFather(); String modelFromPortFatherName=proPort.getFromPort().getFather().getValue(); if (proFromPort!=proPort.getFromPort()) @@ -348,7 +347,8 @@ public class GProactiveDesign { if (proComp.getThisCompDesign()!=null) proComp=proComp.getThisCompDesign(); - Vector v=proComp.getComponentList(); + Vector<ProCSDComponent> v = proComp.getComponentList(); + for (int k=0;k<v.size();k++) { ProCSDComponent proSubComp=(ProCSDComponent)v.get(k); @@ -370,10 +370,10 @@ public class GProactiveDesign { { //we consider pairs of components (Component c, ProCSDComponent pc) and update potrs bindings in - LinkedList comps = mainCsd.getComponentList(); + List<TGComponent> comps = mainCsd.getComponentList(); for (int k=0;k<comps.size();k++) { - TGComponent t=(TGComponent)comps.get(k); + TGComponent t= comps.get(k); if (t instanceof ProCSDComponent) { ProCSDComponent proComp=(ProCSDComponent)t; @@ -639,7 +639,7 @@ public class GProactiveDesign { private boolean isPrimitive(ProCSDComponent comp) { - LinkedList l=getSubComponents(comp,TGComponentManager.PROCSD_COMPONENT); + List<TGComponent> l=getSubComponents(comp,TGComponentManager.PROCSD_COMPONENT); if (l==null) return true; if (l.size()==0) return true; else return false; @@ -652,14 +652,14 @@ public class GProactiveDesign { * @param tgc A component * @return selectedSubComps A LinkedList of subcomponents of the type */ - private LinkedList getSubComponents(TGComponent tgc, int type) + private List<TGComponent> getSubComponents(TGComponent tgc, int type) { if (!(tgc.getType()==TGComponentManager.PROCSD_COMPONENT)) return null; - LinkedList subcompList=getSubComponents(tgc); - LinkedList selectedSubComps=new LinkedList(); + List<TGComponent> subcompList=getSubComponents(tgc); + List<TGComponent> selectedSubComps=new LinkedList<TGComponent>(); for (int i=0;i<subcompList.size();i++) { - TGComponent tmp=(TGComponent)subcompList.get(i); + TGComponent tmp=subcompList.get(i); if (tmp.getType()==type) selectedSubComps.add(tmp); @@ -675,9 +675,9 @@ public class GProactiveDesign { * @param tgc A component * @return subcompList A LinkedList of subcomponents */ - private LinkedList getSubComponents(TGComponent tgc) + private List<TGComponent> getSubComponents(TGComponent tgc) { - LinkedList subcompList=new LinkedList(); + List<TGComponent> subcompList=new LinkedList<TGComponent>(); int nb=tgc.getNbInternalTGComponent(); for (int j=0;j<nb;j++) { @@ -693,62 +693,62 @@ public class GProactiveDesign { * @param tgc A component * @return portsList A LinkedList with ports of the component */ - private LinkedList getPorts(TGComponent tgc) - { - if (!(tgc.getType()==TGComponentManager.PROCSD_COMPONENT)) return null; - LinkedList subcompList=getSubComponents(tgc); - LinkedList portsList=new LinkedList(); - for (int i=0;i<subcompList.size();i++) - { - TGComponent tmp=(TGComponent)subcompList.get(i); - //Remove option delegate ports, by Solange - if ((tmp.getType()==TGComponentManager.PROCSD_IN_PORT) || (tmp.getType()==TGComponentManager.PROCSD_OUT_PORT))// || ( tmp.getType()==TGComponentManager.PROCSD_DELEGATE_PORT)) - portsList.add(tmp); - } - return portsList; - } +// private List<ProCSDPort> getPorts(TGComponent tgc) +// { +// if (!(tgc.getType()==TGComponentManager.PROCSD_COMPONENT)) return null; +// List<TGComponent> subcompList=getSubComponents(tgc); +// List<ProCSDPort> portsList=new LinkedList<ProCSDPort>(); +// for (int i=0;i<subcompList.size();i++) +// { +// TGComponent tmp=subcompList.get(i); +// //Remove option delegate ports, by Solange +// if ((tmp.getType()==TGComponentManager.PROCSD_IN_PORT) || (tmp.getType()==TGComponentManager.PROCSD_OUT_PORT))// || ( tmp.getType()==TGComponentManager.PROCSD_DELEGATE_PORT)) +// portsList.add( (ProCSDPort) tmp); +// } +// return portsList; +// } /* * gets the port connected to the port in parameter via a TGConnector ProCSD if there is one, null if not * @param port A port * @return p1 (or p2) The connected port, or null if not connected */ - private ProCSDPort getConnectedProCSDPort(ProCSDPort port) - { - //Remove option delegate ports, by Solange - //if (port.getType()==TGComponentManager.PROCSD_DELEGATE_PORT) return null; - - //System.out.println("cherche un port pour le port " +port.getValue()); comented by Emil - - TGConnectorProCSD myConnector=port.getTGConnector(); - - if (myConnector==null) - { - //Commented because is not always an error to be free, by Solange - //addCheckingError(CheckingError.STRUCTURE_ERROR,"We didn't find any connector for the port " +port.getValue()); - return null; - } - - // System.out.println("...... (ProCSDPort).. my connector is "+myConnector.toString()); - - //ProCSDPort p1=myConnector.getMyPort1(portsList); - ProCSDPort p1=myConnector.getMyPort1(); - - /* if (p1!=null) System.out.println(p1.toString()); - else - System.out.println("NULL!!!!!!!!!"); - */ - - //System.out.println("......... my connector's Port1 is "+p1.toString()); - - if ((p1!=null) && (!p1.equals(port))) return p1; - - ProCSDPort p2=myConnector.getMyPort2(); - - if ((p2!=null) && (!p2.equals(port))) return p2; - - return null; - } +// private ProCSDPort getConnectedProCSDPort(ProCSDPort port) +// { +// //Remove option delegate ports, by Solange +// //if (port.getType()==TGComponentManager.PROCSD_DELEGATE_PORT) return null; +// +// //System.out.println("cherche un port pour le port " +port.getValue()); comented by Emil +// +// TGConnectorProCSD myConnector=port.getTGConnector(); +// +// if (myConnector==null) +// { +// //Commented because is not always an error to be free, by Solange +// //addCheckingError(CheckingError.STRUCTURE_ERROR,"We didn't find any connector for the port " +port.getValue()); +// return null; +// } +// +// // System.out.println("...... (ProCSDPort).. my connector is "+myConnector.toString()); +// +// //ProCSDPort p1=myConnector.getMyPort1(portsList); +// ProCSDPort p1=myConnector.getMyPort1(); +// +// /* if (p1!=null) System.out.println(p1.toString()); +// else +// System.out.println("NULL!!!!!!!!!"); +// */ +// +// //System.out.println("......... my connector's Port1 is "+p1.toString()); +// +// if ((p1!=null) && (!p1.equals(port))) return p1; +// +// ProCSDPort p2=myConnector.getMyPort2(); +// +// if ((p2!=null) && (!p2.equals(port))) return p2; +// +// return null; +// } //Added by Solange for the subcomponents /* @@ -924,17 +924,17 @@ public class GProactiveDesign { if (t.getType()==TGComponentManager.PROCSD_INTERFACE) { - interfacesList.add(t); + interfacesList.add( (ProCSDInterface) t); } if (t.getType()==TGComponentManager.CONNECTOR_PROCSD) { - connectorsList.add(t); + connectorsList.add( (TGConnectorProCSD) t); } if (t.getType()==TGComponentManager.CONNECTOR_PROCSD_PORT_INTERFACE) { - connectorsPortInterfacesList.add(t); + connectorsPortInterfacesList.add( (TGConnectorPortInterface) t); } /* @@ -949,7 +949,7 @@ public class GProactiveDesign { // return false; // else { - ProCSDComponentsList.add(t); + proCSDComponentsList.add( (ProCSDComponent) t); int nb=t.getNbInternalTGComponent(); @@ -989,23 +989,23 @@ public class GProactiveDesign { if (t.getType()==TGComponentManager.PROCSD_INTERFACE) { - interfacesList.add(t); + interfacesList.add((ProCSDInterface) t); } if (t.getType()==TGComponentManager.CONNECTOR_PROCSD) { - connectorsList.add(t); + connectorsList.add( (TGConnectorProCSD) t); } if (t.getType()==TGComponentManager.CONNECTOR_PROCSD_PORT_INTERFACE) { - connectorsPortInterfacesList.add(t); + connectorsPortInterfacesList.add( (TGConnectorPortInterface) t ); } //Delegate ports removed, by Solange if ( (t.getType()==TGComponentManager.PROCSD_IN_PORT) || (t.getType()==TGComponentManager.PROCSD_OUT_PORT))// || (t.getType()==TGComponentManager.PROCSD_DELEGATE_PORT)) - portsList.add(t); + portsList.add( (ProCSDPort) t); if ((t.getType()==TGComponentManager.PROCSD_COMPONENT) ) @@ -1016,8 +1016,7 @@ public class GProactiveDesign { // return false; // } - - ProCSDComponentsList.add(t); + proCSDComponentsList.add( (ProCSDComponent) t); int nb=t.getNbInternalTGComponent(); @@ -1183,17 +1182,17 @@ public class GProactiveDesign { * Fill the primitive LinkedList * @return primitives The List of primitive components */ - private LinkedList getPrimitives() - { - LinkedList primitives=new LinkedList(); - - for (int i=0;i<ProCSDComponentsList.size();i++) - { - ProCSDComponent comp=(ProCSDComponent)ProCSDComponentsList.get(i); - if (isPrimitive(comp)) primitives.add(comp); - } - return primitives; - } +// private List<ProCSDComponent> getPrimitives() +// { +// List<ProCSDComponent> primitives=new LinkedList<ProCSDComponent>(); +// +// for (int i=0;i< proCSDComponentsList.size();i++) +// { +// ProCSDComponent comp= proCSDComponentsList.get(i); +// if (isPrimitive(comp)) primitives.add(comp); +// } +// return primitives; +// } /* @@ -1272,57 +1271,57 @@ public class GProactiveDesign { * Method implementing the algorithm used to create TClasses from a ProCSDComponent * @param tm TurtleModeling to be updated with TClasses */ - private void addTClasses(TURTLEModeling tm) - { - LinkedList primitives=getPrimitives(); - for (int i=0;i<primitives.size();i++) - { - ProCSDComponent comp=(ProCSDComponent)primitives.get(i); - TClass tclass =new TClass(comp.getValue(),true); - // System.out.println("tClass created: "+comp.getValue()); - LinkedList attribs=comp.getMyAttributes(); - - for (int at=0;at<attribs.size();at++) - { - TAttribute a=(TAttribute)attribs.get(at); - //if (a.getType() == TAttribute.NATURAL) - { - Param p = new Param(a.getId(), Param.NAT, a.getInitialValue()); - p.setAccess(a.getAccessString()); - tclass.addParameter(p); - } - - } - LinkedList ports=getPorts(comp); - for (int j=0;j<ports.size();j++) - { - ProCSDPort p=(ProCSDPort)ports.get(j); - ProCSDInterface myInterface=p.getMyInterface(interfacesList); - if (myInterface==null) - { - addCheckingError(CheckingError.STRUCTURE_ERROR,"No interface found for the port " +p.getValue()+" in component "+p.getFather().getValue()); - return; - - } - LinkedList gates=myInterface.getMyMessages(); - - for (int g=0;g<gates.size();g++) - { - TAttribute ta=(TAttribute)gates.get(g); - //!!!! to see: - // the gate type - // internal gates - Gate gt=new Gate(p.getValue()+"_"+ta.getId(),Gate.GATE,false); - tclass.addGate(gt); - } - - }//for ports - tm.addTClass(tclass); - ProactiveSMDPanel psmdp=pdp.getSMDPanel(tclass.getName()); - buildErrors=false; - buildActivityDiagram(tclass,psmdp,false,comp.getName()+"_SMD"); - }//for all primitives - } +// private void addTClasses(TURTLEModeling tm) +// { +// List<ProCSDComponent> primitives=getPrimitives(); +// for (int i=0;i<primitives.size();i++) +// { +// ProCSDComponent comp= primitives.get(i); +// TClass tclass =new TClass(comp.getValue(),true); +// // System.out.println("tClass created: "+comp.getValue()); +// List<TAttribute> attribs=comp.getMyAttributes(); +// +// for (int at=0;at<attribs.size();at++) +// { +// TAttribute a= attribs.get(at); +// //if (a.getType() == TAttribute.NATURAL) +// { +// Param p = new Param(a.getId(), Param.NAT, a.getInitialValue()); +// p.setAccess(a.getAccessString()); +// tclass.addParameter(p); +// } +// +// } +// List<ProCSDPort> ports=getPorts(comp); +// for (int j=0;j<ports.size();j++) +// { +// ProCSDPort p= ports.get(j); +// ProCSDInterface myInterface=p.getMyInterface(interfacesList); +// if (myInterface==null) +// { +// addCheckingError(CheckingError.STRUCTURE_ERROR,"No interface found for the port " +p.getValue()+" in component "+p.getFather().getValue()); +// return; +// +// } +// List<TAttribute> gates=myInterface.getMyMessages(); +// +// for (int g=0;g<gates.size();g++) +// { +// TAttribute ta= gates.get(g); +// //!!!! to see: +// // the gate type +// // internal gates +// Gate gt=new Gate(p.getValue()+"_"+ta.getId(),Gate.GATE,false); +// tclass.addGate(gt); +// } +// +// }//for ports +// tm.addTClass(tclass); +// ProactiveSMDPanel psmdp=pdp.getSMDPanel(tclass.getName()); +// buildErrors=false; +// buildActivityDiagram(tclass,psmdp,false,comp.getName()+"_SMD"); +// }//for all primitives +// } @@ -1333,7 +1332,7 @@ public class GProactiveDesign { int iSend=action.indexOf("!"); int iReceived=action.indexOf("?"); int end=action.length(); - boolean finished=false; + // boolean finished=false; if (iSend==-1) iSend=end; if(iReceived==-1) iReceived=end; @@ -1407,19 +1406,19 @@ public class GProactiveDesign { // System.out.println("building activity diagram for "+t.getName() + " from panel "+psmdp.getName()); String name=t.getName(); - - if (psmdp == null) { - return; - } + // DB Issue #17 Dead code +// if (psmdp == null) { +// return; +// } - LinkedList list = psmdp.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = psmdp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc; ProSMDStartState proStart = null; int cptStart = 0; // System.out.println(t.getName()+" smd elements: "); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); //System.out.println(tgc.getName()+":"+tgc.getValue()); if (tgc instanceof ProSMDStartState) { proStart = (ProSMDStartState) tgc; @@ -1754,8 +1753,8 @@ public class GProactiveDesign { private TGComponent getStartComp(ProSMDSubmachine subMachine) { ProactiveSMDPanel subMachinePanel=pdp.getSMDPanel(subMachine.getValue()); - LinkedList list = subMachinePanel.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = subMachinePanel.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc; ProSMDStartState proStart = null; while(iterator.hasNext()) { @@ -1774,27 +1773,22 @@ public class GProactiveDesign { - private TGComponent getStopComp(ProSMDSubmachine subMachine) - { - ProactiveSMDPanel subMachinePanel=pdp.getSMDPanel(subMachine.getValue()); - LinkedList list = subMachinePanel.getComponentList(); - Iterator iterator = list.listIterator(); - TGComponent tgc; - ProSMDStopState proStop = null; - while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); - if (tgc instanceof ProSMDStopState) { - proStop = (ProSMDStopState) tgc; - return proStop; - }//if - }//while - - return null; - - + private TGComponent getStopComp(ProSMDSubmachine subMachine) { + ProactiveSMDPanel subMachinePanel=pdp.getSMDPanel(subMachine.getValue()); + List<TGComponent> list = subMachinePanel.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); + TGComponent tgc; + ProSMDStopState proStop = null; + while(iterator.hasNext()) { + tgc = iterator.next(); + if (tgc instanceof ProSMDStopState) { + proStop = (ProSMDStopState) tgc; + return proStop; + }//if + }//while + + return null; } - - /* * Method used when converting from ProactiveDesign to TurtleModeling @@ -1977,62 +1971,61 @@ public class GProactiveDesign { * Tclasses. * @param tm TurtleModeling to be updated */ - private void addSynchronisations(TURTLEModeling tm) - { - String gname1="", gname2=""; - LinkedList primitives=getPrimitives(); - for (int i=0;i<primitives.size();i++) - { - ProCSDComponent comp=(ProCSDComponent)primitives.get(i); - LinkedList ports=getPorts(comp); - - for (int j=0;j<ports.size();j++) - { - ProCSDPort p=(ProCSDPort)ports.get(j); - ProCSDPort toP=p.getToFinalPort(); - ProCSDPort fromP=p.getFromFinalPort(); - - //Added by Solange - TClass t1=tm.getTClassWithName(p.getFather().getValue()); - //Added by Solange - TClass t2=null; - ProCSDPort connectedPort=null; - - if (toP!=null) - { - connectedPort=toP; - } - else if (fromP!=null) - { - connectedPort=fromP; - } - else - { - // System.out.println("Problem in finding conection for "+p.toString()); - addCheckingError(CheckingError.STRUCTURE_ERROR,"Problem in finding conection for "+p.toString()+" in component "+p.getFather().toString()); - //TODO add an error here - } - t2=tm.getTClassWithName(connectedPort.getFather().getValue()); - ProCSDInterface myInterface=p.getMyInterface(); - LinkedList gates=myInterface.getMyMessages(); - for (int k=0;k<gates.size();k++) - { - TAttribute a = (TAttribute)(gates.get(k)); - gname1=p.getValue()+"_"+a.getId(); - gname2=connectedPort.getValue()+"_"+a.getId(); - //i want to see the value, by Solange - // Added by Solange to handle messages not received - if((t1!=null)&&(t2!=null)) - { - Gate h=t1.getGateByName(gname1); - Gate y=t2.getGateByName(gname2); - tm.addSynchroRelation(t1,h,t2,y); - } - } - } - - }//for all components - } +// private void addSynchronisations(TURTLEModeling tm) { +// String gname1="", gname2=""; +// List<ProCSDComponent> primitives=getPrimitives(); +// for (int i=0;i<primitives.size();i++) +// { +// ProCSDComponent comp= primitives.get(i); +// List<ProCSDPort> ports=getPorts(comp); +// +// for (int j=0;j<ports.size();j++) +// { +// ProCSDPort p=ports.get(j); +// ProCSDPort toP=p.getToFinalPort(); +// ProCSDPort fromP=p.getFromFinalPort(); +// +// //Added by Solange +// TClass t1=tm.getTClassWithName(p.getFather().getValue()); +// //Added by Solange +// TClass t2=null; +// ProCSDPort connectedPort=null; +// +// if (toP!=null) +// { +// connectedPort=toP; +// } +// else if (fromP!=null) +// { +// connectedPort=fromP; +// } +// else +// { +// // System.out.println("Problem in finding conection for "+p.toString()); +// addCheckingError(CheckingError.STRUCTURE_ERROR,"Problem in finding conection for "+p.toString()+" in component "+p.getFather().toString()); +// //TODO add an error here +// } +// t2=tm.getTClassWithName(connectedPort.getFather().getValue()); +// ProCSDInterface myInterface=p.getMyInterface(); +// LinkedList gates=myInterface.getMyMessages(); +// for (int k=0;k<gates.size();k++) +// { +// TAttribute a = (TAttribute)(gates.get(k)); +// gname1=p.getValue()+"_"+a.getId(); +// gname2=connectedPort.getValue()+"_"+a.getId(); +// //i want to see the value, by Solange +// // Added by Solange to handle messages not received +// if((t1!=null)&&(t2!=null)) +// { +// Gate h=t1.getGateByName(gname1); +// Gate y=t2.getGateByName(gname2); +// tm.addSynchroRelation(t1,h,t2,y); +// } +// } +// } +// +// }//for all components +// } //Method created by Solange // and removed by emil @@ -2097,11 +2090,11 @@ public class GProactiveDesign { */ - public LinkedList<CheckingError> getCheckingWarnings() { + public List<CheckingError> getCheckingWarnings() { return null; } - public LinkedList<CheckingError> getCheckingErrors() { + public List<CheckingError> getCheckingErrors() { return checkingErrors; } diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index 54d979e17a..f0d56cb4b5 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -54,13 +54,9 @@ import ui.tmlad.*; import ui.tmlcd.*; import ui.tmlcompd.*; import ui.tmldd.*; -import ui.tmlcp.*; import ui.tmlsd.*; import tmltranslator.*; -import tmltranslator.toavatar.*; import tmltranslator.tmlcp.*; -import tmltranslator.toproverif.*; -import proverifspec.*; import myutil.*; import tmltranslator.modelcompiler.*; import avatartranslator.*; @@ -71,29 +67,27 @@ public class GTMLModeling { private TMLComponentDesignPanel tmlcdp; private TMLArchiPanel tmlap; private TMLModeling tmlm; - private LinkedList<CheckingError> checkingErrors, warnings; - private LinkedList tasksToTakeIntoAccount; - private LinkedList componentsToTakeIntoAccount; - private LinkedList components; - private LinkedList removedChannels, removedRequests, removedEvents; + private List<CheckingError> checkingErrors, warnings; + private List<? extends TGComponent> tasksToTakeIntoAccount; + private List<? extends TGComponent> componentsToTakeIntoAccount; + private List<? extends TGComponent> components; + private List<String> removedChannels, removedRequests, removedEvents; private static CorrespondanceTGElement listE; - private Hashtable<String, String> table; + private Map<String, String> table; public AvatarSpecification avspec; //private ArrayList<HwNode> nodesToTakeIntoAccount; - private LinkedList nodesToTakeIntoAccount; + private List<TGComponent> nodesToTakeIntoAccount; private TMLMapping map; private TMLArchitecture archi; - - //Attributes specific to Communication Patterns private TMLCP tmlcp; private TMLCommunicationPatternPanel tmlcpp; - private Vector<TDiagramPanel> diagramPanelsToTakeIntoAccount; - private Vector<TDiagramPanel> panels; + // private Vector<TDiagramPanel> diagramPanelsToTakeIntoAccount; +// private Vector<TDiagramPanel> panels; - private HashMap<String, SecurityPattern> securityPatterns = new HashMap<String, SecurityPattern>(); + private Map<String, SecurityPattern> securityPatterns = new HashMap<String, SecurityPattern>(); private boolean putPrefixName = false; @@ -153,9 +147,9 @@ public class GTMLModeling { if (tasksToTakeIntoAccount == null) { tasksToTakeIntoAccount = components; } - removedChannels = new LinkedList(); - removedRequests = new LinkedList(); - removedEvents = new LinkedList(); + removedChannels = new LinkedList<String>(); + removedRequests = new LinkedList<String>(); + removedEvents = new LinkedList<String>(); try { addTMLTasks(); @@ -212,9 +206,9 @@ public class GTMLModeling { } } - removedChannels = new LinkedList(); - removedRequests = new LinkedList(); - removedEvents = new LinkedList(); + removedChannels = new LinkedList<String>(); + removedRequests = new LinkedList<String>(); + removedEvents = new LinkedList<String>(); try { addTMLComponents(); @@ -272,56 +266,57 @@ public class GTMLModeling { return listE; } - public void setTasks(Vector tasks) { - tasksToTakeIntoAccount = new LinkedList(tasks); + public void setTasks(Vector<? extends TGComponent> tasks) { + tasksToTakeIntoAccount = new LinkedList<TGComponent>(tasks); } - public void setComponents(Vector components) { - componentsToTakeIntoAccount = new LinkedList(components); + public void setComponents(Vector<? extends TGComponent> components) { + componentsToTakeIntoAccount = new LinkedList<TGComponent>(components); } - public void setNodes(Vector nodes) { - nodesToTakeIntoAccount = new LinkedList(nodes); + public void setNodes(Vector<TGComponent> nodes) { + nodesToTakeIntoAccount = new LinkedList<TGComponent>(nodes); } - public void setDiagramPanels( Vector panels ) { - diagramPanelsToTakeIntoAccount = new Vector<TDiagramPanel>( panels ); - } +// public void setDiagramPanels( Vector<TDiagramPanel> panels ) { +// diagramPanelsToTakeIntoAccount = new Vector<TDiagramPanel>( panels ); +// } - public LinkedList<CheckingError> getCheckingErrors() { + public List<CheckingError> getCheckingErrors() { return checkingErrors; } - public LinkedList<CheckingError> getCheckingWarnings() { + public List<CheckingError> getCheckingWarnings() { return warnings; } - private void addTMLPragmas(){ - TGComponent tgc; - components = tmlap.tmlap.getComponentList(); - ListIterator iterator = components.listIterator(); - while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); - if (tgc instanceof TGCNote){ - TGCNote note = (TGCNote) tgc; - String[] vals = note.getValues(); - for (String s: vals){ - TraceManager.addDev("Val " + s); - if (s.contains("#") && s.contains(" ")){ - map.addPragma(s.split(" ")); - } - } - } - } - } +// +// private void addTMLPragmas(){ +// TGComponent tgc; +// components = tmlap.tmlap.getComponentList(); +// ListIterator iterator = components.listIterator(); +// while(iterator.hasNext()) { +// tgc = (TGComponent)(iterator.next()); +// if (tgc instanceof TGCNote){ +// TGCNote note = (TGCNote) tgc; +// String[] vals = note.getValues(); +// for (String s: vals){ +// TraceManager.addDev("Val " + s); +// if (s.contains("#") && s.contains(" ")){ +// map.addPragma(s.split(" ")); +// } +// } +// } +// } +// } private void addTMLTasks() throws MalformedTMLDesignException { TGComponent tgc; TMLTask tmlt; TMLTaskOperator tmlto; TMLActivityDiagramPanel tmladp; - ListIterator iterator = tasksToTakeIntoAccount.listIterator(); + Iterator<? extends TGComponent> iterator = tasksToTakeIntoAccount.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLTaskOperator) { tmlto = (TMLTaskOperator)tgc; tmladp = tmldp.getTMLActivityDiagramPanel(tmlto.getValue()); @@ -359,9 +354,9 @@ public class GTMLModeling { TMLTask tmlt; TMLComponentDesignPanel tmlcdptmp; - ListIterator iterator = componentsToTakeIntoAccount.listIterator(); + Iterator<? extends TGComponent> iterator = componentsToTakeIntoAccount.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCPrimitiveComponent) { tmlcpc = (TMLCPrimitiveComponent)tgc; tmlcdptmp = (TMLComponentDesignPanel)(tmlcpc.getTDiagramPanel().getMGUI().getTURTLEPanelOfTDiagramPanel(tmlcpc.getTDiagramPanel())); @@ -396,14 +391,14 @@ public class GTMLModeling { private void addTMLChannels() throws MalformedTMLDesignException { TGComponent tgc; TMLChannelOperator tmlco; - ListIterator iterator = components.listIterator(); + Iterator<? extends TGComponent> iterator = components.listIterator(); TMLTaskInterface t1, t2; TMLChannel channel; TMLTask tt1, tt2; String name; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLChannelOperator) { tmlco = (TMLChannelOperator)tgc; //TraceManager.addDev("Found channel: " + tmlco.getChannelName()); @@ -449,7 +444,7 @@ public class GTMLModeling { private void addTMLEvents() throws MalformedTMLDesignException { TGComponent tgc; TMLEventOperator tmleo; - ListIterator iterator = components.listIterator(); + Iterator<? extends TGComponent> iterator = components.listIterator(); TMLTaskInterface t1, t2; TMLEvent event; TType tt; @@ -509,7 +504,7 @@ public class GTMLModeling { private void addTMLRequests() throws MalformedTMLDesignException { TGComponent tgc; TMLRequestOperator tmlro; - ListIterator iterator = components.listIterator(); + Iterator<? extends TGComponent> iterator = components.listIterator(); TMLTaskInterface t1, t2; TMLRequest request; TType tt; @@ -651,9 +646,9 @@ public class GTMLModeling { TGComponent tgc; TMLCPrimitiveComponent tmlc; - ListIterator iterator = components.listIterator(); - ListIterator li, li2; - LinkedList ports, portstome; + Iterator<? extends TGComponent> iterator = components.listIterator(); + Iterator<TMLCPrimitivePort> li;//, li2; + List<TMLCPrimitivePort> ports, portstome; String name, name1, name2; TMLCPrimitivePort port1, port2; @@ -663,12 +658,12 @@ public class GTMLModeling { TMLChannel channel; TMLTask tt1, tt2; - ArrayList<TGComponent> alreadyConsidered = new ArrayList<TGComponent>(); + List<TGComponent> alreadyConsidered = new ArrayList<TGComponent>(); TraceManager.addDev("*** Adding channels ***"); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCPrimitiveComponent) { tmlc = (TMLCPrimitiveComponent)tgc; //TraceManager.addDev("Component:" + tmlc.getValue()); @@ -681,7 +676,7 @@ public class GTMLModeling { portstome = tmlcdp.tmlctdp.getPortsConnectedTo(port1, componentsToTakeIntoAccount); TraceManager.addDev("******** Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); - ListIterator ite = portstome.listIterator(); + Iterator<TMLCPrimitivePort> ite = portstome.listIterator(); while(ite.hasNext()) { TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); } @@ -886,9 +881,9 @@ public class GTMLModeling { private void addTMLCEvents() throws MalformedTMLDesignException { TGComponent tgc; TMLCPrimitiveComponent tmlc; - ListIterator iterator = components.listIterator(); - ListIterator li, li2; - LinkedList ports, portstome; + Iterator<? extends TGComponent> iterator = components.listIterator(); + Iterator<TMLCPrimitivePort> li;//, li2; + List<TMLCPrimitivePort> ports, portstome; String name; TMLCPrimitivePort port1, port2; @@ -918,7 +913,7 @@ public class GTMLModeling { portstome = tmlcdp.tmlctdp.getPortsConnectedTo(port1, componentsToTakeIntoAccount); TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); - ListIterator ite = portstome.listIterator(); + Iterator<?> ite = portstome.listIterator(); while(ite.hasNext()) { TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); } @@ -1038,9 +1033,9 @@ public class GTMLModeling { private void addTMLCRequests() throws MalformedTMLDesignException { TGComponent tgc; TMLCPrimitiveComponent tmlc; - ListIterator iterator = components.listIterator(); - ListIterator li, li2; - LinkedList ports, portstome; + Iterator<? extends TGComponent> iterator = components.listIterator(); + Iterator<TMLCPrimitivePort> li;//, li2; + List<TMLCPrimitivePort> ports, portstome; String name; TMLCPrimitivePort port1, port2, port3; @@ -1072,7 +1067,7 @@ public class GTMLModeling { portstome = tmlcdp.tmlctdp.getPortsConnectedTo(port1, componentsToTakeIntoAccount); //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); - ListIterator ite = portstome.listIterator(); + // ListIterator ite = portstome.listIterator(); //while(ite.hasNext()) { //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); //} @@ -1224,15 +1219,15 @@ public class GTMLModeling { } private void addAttributesTo(TMLTask tmltask, TMLCPrimitiveComponent tmlcpc) { - LinkedList<TAttribute> attributes = tmlcpc.getAttributes(); + List<TAttribute> attributes = tmlcpc.getAttributes(); addAttributesTo(tmlcpc, tmltask, attributes); } - private void addAttributesTo(TGComponent tgc, TMLTask tmltask, LinkedList<TAttribute> attributes) { + private void addAttributesTo(TGComponent tgc, TMLTask tmltask, List<TAttribute> attributes) { TMLType tt; - String name; + // String name; TMLAttribute tmlt; - TMLRequest req; + // TMLRequest req; TMLCRecordComponent rc; for (TAttribute ta: attributes) { @@ -1295,35 +1290,37 @@ public class GTMLModeling { } private void createSecurityPatterns(TMLTask tmltask){ - TMLActivity activity = tmltask.getActivityDiagram(); + TMLActivity activity = tmltask.getActivityDiagram(); TMLActivityDiagramPanel tadp = (TMLActivityDiagramPanel)(activity.getReferenceObject()); - TGComponent tgc; + TGComponent tgc; TraceManager.addDev("Generating activity diagram of:" + tmltask.getName()); // search for start state - LinkedList list = tadp.getComponentList(); - Iterator iterator = list.listIterator(); - while(iterator.hasNext()){ - tgc = (TGComponent)(iterator.next()); - if (tgc instanceof TMLADEncrypt) { - SecurityPattern securityPattern = new SecurityPattern(((TMLADEncrypt)tgc).securityContext, ((TMLADEncrypt)tgc).type, ((TMLADEncrypt)tgc).message_overhead, ((TMLADEncrypt)tgc).size, ((TMLADEncrypt)tgc).encTime, ((TMLADEncrypt)tgc).decTime, ((TMLADEncrypt)tgc).nonce, ((TMLADEncrypt)tgc).formula, ((TMLADEncrypt)tgc).key); - securityPatterns.put(securityPattern.name, securityPattern); - tmlm.addSec(securityPattern); - ArrayList<TMLTask> l = new ArrayList<TMLTask>(); - tmlm.securityTaskMap.put(securityPattern, l); - TraceManager.addDev("Adding Security Pattern " + securityPattern.name); - } - } - + List<TGComponent> list = tadp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); + while(iterator.hasNext()){ + tgc = iterator.next(); + if (tgc instanceof TMLADEncrypt) { + if (!((TMLADEncrypt)tgc).securityContext.isEmpty()){ + SecurityPattern securityPattern = new SecurityPattern(((TMLADEncrypt)tgc).securityContext, ((TMLADEncrypt)tgc).type, ((TMLADEncrypt)tgc).message_overhead, ((TMLADEncrypt)tgc).size, ((TMLADEncrypt)tgc).encTime, ((TMLADEncrypt)tgc).decTime, ((TMLADEncrypt)tgc).nonce, ((TMLADEncrypt)tgc).formula, ((TMLADEncrypt)tgc).key); + securityPatterns.put(securityPattern.name, securityPattern); + tmlm.addSec(securityPattern); + ArrayList<TMLTask> l = new ArrayList<TMLTask>(); + tmlm.securityTaskMap.put(securityPattern, l); + TraceManager.addDev("Adding Security Pattern " + securityPattern.name); + } + } + } } + private void generateTasksActivityDiagrams() throws MalformedTMLDesignException { TMLTask tmltask; - //First generate security patterns over all tasks - ListIterator iterator = tmlm.getTasks().listIterator(); + //First generate security patterns over all tasks + Iterator<TMLTask> iterator = tmlm.getTasks().listIterator(); while(iterator.hasNext()) { - tmltask = (TMLTask)(iterator.next()); + tmltask = iterator.next(); createSecurityPatterns(tmltask); } @@ -1381,15 +1378,16 @@ public class GTMLModeling { TraceManager.addDev("Generating activity diagram of:" + tmltask.getName()); // search for start state - LinkedList list = tadp.getComponentList(); - Iterator iterator = list.listIterator(); + List<TGComponent> list = tadp.getComponentList(); + Iterator<TGComponent> iterator = list.listIterator(); TGComponent tgc; TMLADStartState tss = null; int cptStart = 0; - boolean rndAdded = false; + // boolean rndAdded = false; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLADStartState) { tss = (TMLADStartState) tgc; cptStart ++; @@ -1517,37 +1515,39 @@ public class GTMLModeling { } else if (tgc instanceof TMLADEncrypt) { tmlexecc = new TMLExecC("encrypt", tgc); activity.addElement(tmlexecc); - SecurityPattern sp = securityPatterns.get(((TMLADEncrypt)tgc).securityContext); - if (sp ==null && !((TMLADEncrypt)tgc).securityContext.isEmpty()){ - //Throw error for missing security pattern + SecurityPattern sp = securityPatterns.get(((TMLADEncrypt)tgc).securityContext); + if (sp ==null){ + //Throw error for missing security pattern CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADEncrypt)tgc).securityContext + " not found"); ce.setTDiagramPanel(tadp); ce.setTGComponent(tgc); checkingErrors.add(ce); - } - tmlexecc.securityPattern = sp; - tmlexecc.setAction(Integer.toString(sp.encTime)); - ((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK); - tmlm.securityTaskMap.get(sp).add(tmltask); - listE.addCor(tmlexecc, tgc); - + } + else { + tmlexecc.securityPattern = sp; + tmlexecc.setAction(Integer.toString(sp.encTime)); + ((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK); + tmlm.securityTaskMap.get(sp).add(tmltask); + listE.addCor(tmlexecc, tgc); + } } else if (tgc instanceof TMLADDecrypt) { tmlexecc = new TMLExecC("decrypt_"+((TMLADDecrypt)tgc).securityContext, tgc); activity.addElement(tmlexecc); - SecurityPattern sp = securityPatterns.get(((TMLADDecrypt)tgc).securityContext); - if (sp ==null && !((TMLADDecrypt)tgc).securityContext.isEmpty()){ - //Throw error for missing security pattern + SecurityPattern sp = securityPatterns.get(((TMLADDecrypt)tgc).securityContext); + if (sp ==null){ + //Throw error for missing security pattern CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADDecrypt)tgc).securityContext + " not found"); ce.setTDiagramPanel(tadp); ce.setTGComponent(tgc); checkingErrors.add(ce); - } - tmlexecc.securityPattern = sp; - tmlexecc.setAction(Integer.toString(sp.decTime)); - ((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK); - listE.addCor(tmlexecc, tgc); - tmlm.securityTaskMap.get(sp).add(tmltask); - + } + else { + tmlexecc.securityPattern = sp; + tmlexecc.setAction(Integer.toString(sp.decTime)); + ((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK); + listE.addCor(tmlexecc, tgc); + tmlm.securityTaskMap.get(sp).add(tmltask); + } } else if (tgc instanceof TMLADExecC) { tmlexecc = new TMLExecC("execc", tgc); @@ -1666,33 +1666,32 @@ public class GTMLModeling { tmlreadchannel = new TMLReadChannel("read channel", tgc); tmlreadchannel.setNbOfSamples(modifyString(((TMLADReadChannel)tgc).getSamplesValue())); tmlreadchannel.addChannel(channel); - //security pattern - if (securityPatterns.get(((TMLADReadChannel)tgc).securityContext)!=null){ - tmlreadchannel.securityPattern= securityPatterns.get(((TMLADReadChannel)tgc).securityContext); - //NbOfSamples will increase due to extra overhead from MAC - int cur = Integer.valueOf(modifyString(((TMLADReadChannel)tgc).getSamplesValue())); - int add = Integer.valueOf(tmlreadchannel.securityPattern.overhead); - if (!tmlreadchannel.securityPattern.nonce.equals("")){ - SecurityPattern nonce = securityPatterns.get(tmlreadchannel.securityPattern.nonce); - if (nonce!=null){ - add = Integer.valueOf(nonce.overhead); - } - } - cur = cur+ add; - tmlreadchannel.setNbOfSamples(Integer.toString(cur)); - } - else if (!((TMLADReadChannel)tgc).securityContext.isEmpty()){ - //Throw error for missing security pattern - CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADReadChannel)tgc).securityContext + " not found"); - ce.setTDiagramPanel(tadp); - ce.setTGComponent(tgc); - checkingErrors.add(ce); - } - activity.addElement(tmlreadchannel); - ((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK); - listE.addCor(tmlreadchannel, tgc); - } - + //security pattern + if (securityPatterns.get(((TMLADReadChannel)tgc).securityContext)!=null){ + tmlreadchannel.securityPattern= securityPatterns.get(((TMLADReadChannel)tgc).securityContext); + //NbOfSamples will increase due to extra overhead from MAC + int cur = Integer.valueOf(modifyString(((TMLADReadChannel)tgc).getSamplesValue())); + int add = Integer.valueOf(tmlreadchannel.securityPattern.overhead); + if (!tmlreadchannel.securityPattern.nonce.equals("")){ + SecurityPattern nonce = securityPatterns.get(tmlreadchannel.securityPattern.nonce); + if (nonce!=null){ + add = Integer.valueOf(nonce.overhead); + } + } + cur = cur+ add; + tmlreadchannel.setNbOfSamples(Integer.toString(cur)); + } + else if (!((TMLADReadChannel)tgc).securityContext.isEmpty()){ + //Throw error for missing security pattern + CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Security Pattern " + ((TMLADReadChannel)tgc).securityContext + " not found"); + ce.setTDiagramPanel(tadp); + ce.setTGComponent(tgc); + checkingErrors.add(ce); + } + activity.addElement(tmlreadchannel); + ((BasicErrorHighlight)tgc).setStateAction(ErrorHighlight.OK); + listE.addCor(tmlreadchannel, tgc); + } } else if (tgc instanceof TMLADSendEvent) { event = tmlm.getEventByName(getFromTable(tmltask, ((TMLADSendEvent)tgc).getEventName())); if (event == null) { @@ -2296,7 +2295,7 @@ public class GTMLModeling { return tmlcp; } - private boolean nameInUse(ArrayList<String> _names, String _name) { + private boolean nameInUse( List<String> _names, String _name) { for(String s: _names) { if (s.equals(_name)) { return true; @@ -2311,9 +2310,10 @@ public class GTMLModeling { if (nodesToTakeIntoAccount == null) { components = tmlap.tmlap.getComponentList(); } else { + // DB: TODO this is a bug. Stuff in nodesToTakeIntoAccount are not components components = nodesToTakeIntoAccount; } - ListIterator iterator = components.listIterator(); + Iterator<? extends TGComponent> iterator = components.listIterator(); TGComponent tgc; TMLArchiCPUNode node; @@ -2334,10 +2334,11 @@ public class GTMLModeling { HwMemory memory; HwDMA dma; - ArrayList<String> names = new ArrayList<String>(); + List<String> names = new ArrayList<String>(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLArchiCPUNode) { node = (TMLArchiCPUNode)tgc; if (nameInUse(names, node.getName())) { @@ -2617,12 +2618,12 @@ if (tgc instanceof TMLArchiCrossbarNode) { private void makeCPDataStructure() throws MalformedTMLDesignException { - TGComponent tgc; - ui.tmlsd.TMLSDPanel SDpanel; - ui.tmlcp.TMLCPPanel ADpanel; - ArrayList<String> names = new ArrayList<String>(); - TMLCPSequenceDiagram SD; - TMLCPActivityDiagram AD; + // TGComponent tgc; + // ui.tmlsd.TMLSDPanel SDpanel; + // ui.tmlcp.TMLCPPanel ADpanel; + List<String> names = new ArrayList<String>(); + // TMLCPSequenceDiagram SD; + // TMLCPActivityDiagram AD; Vector<TDiagramPanel> panelList = tmlcpp.getPanels(); @@ -2655,15 +2656,15 @@ if (tgc instanceof TMLArchiCrossbarNode) { private tmltranslator.tmlcp.TMLCPActivityDiagram createActivityDiagramDataStructure( ui.tmlcp.TMLCPPanel panel, - ArrayList<String> names ) throws MalformedTMLDesignException { - + List<String> names ) + throws MalformedTMLDesignException { tmltranslator.tmlcp.TMLCPStart start; tmltranslator.tmlcp.TMLCPStop stop; tmltranslator.tmlcp.TMLCPJunction junction; tmltranslator.tmlcp.TMLCPJoin join; tmltranslator.tmlcp.TMLCPFork fork; tmltranslator.tmlcp.TMLCPChoice choice; - tmltranslator.tmlcp.TMLCPConnector TMLCPconnector; + // tmltranslator.tmlcp.TMLCPConnector TMLCPconnector; tmltranslator.tmlcp.TMLCPRefAD refAD; tmltranslator.tmlcp.TMLCPRefSD refSD; tmltranslator.tmlcp.TMLCPForLoop loop; @@ -2677,7 +2678,8 @@ if (tgc instanceof TMLArchiCrossbarNode) { throw new MalformedTMLDesignException(tmlto.getValue() + " msg"); }*/ - LinkedList components = panel.getComponentList(); + List<TGComponent> components = panel.getComponentList(); + if( nameInUse( names, panel.getName() ) ) { String msg = panel.getName() + " already exists"; CheckingError ce = new CheckingError( CheckingError.STRUCTURE_ERROR, "Two diagrams have the same name: " + panel.getName() ); @@ -2800,20 +2802,20 @@ if (tgc instanceof TMLArchiCrossbarNode) { private tmltranslator.tmlcp.TMLCPSequenceDiagram createSequenceDiagramDataStructure( ui.tmlsd.TMLSDPanel panel, - ArrayList<String> names ) throws MalformedTMLDesignException { + List<String> names ) throws MalformedTMLDesignException { LinkedList<TAttribute> attributes; int index1; int index2; TGComponent[] components; TMLType type; - String toParse; + // String toParse; TAttribute attribute; TGConnectorMessageTMLSD connector; TMLSDMessage message; tmltranslator.tmlcp.TMLSDInstance instance; - String[] tokens; //used to get the tokens of the string for a SD attribute - String delims = "[ +=:;]+"; //the delimiter chars used to parse attributes of SD instance + // String[] tokens; //used to get the tokens of the string for a SD attribute + // String delims = "[ +=:;]+"; //the delimiter chars used to parse attributes of SD instance //TraceManager.addDev( "ADDING TO DATA STRUCTURE THE DIAGRAM " + panel.getName() ); if( nameInUse( names, panel.getName() ) ) { @@ -2829,7 +2831,7 @@ if (tgc instanceof TMLArchiCrossbarNode) { else { names.add( panel.getName() ); tmltranslator.tmlcp.TMLCPSequenceDiagram SD = new tmltranslator.tmlcp.TMLCPSequenceDiagram( panel.getName(), panel ); - LinkedList elemList = panel.getComponentList(); + List<TGComponent> elemList = panel.getComponentList(); //TraceManager.addDev("Adding to the data structure the elements of: " + panel.getName() ); //order messages according to the inverse of Y coordinate int j; @@ -2950,11 +2952,10 @@ if (tgc instanceof TMLArchiCrossbarNode) { private boolean makeTMLModeling() { // Determine all TML Design to be used -> TMLDesignPanels - ArrayList<TMLDesignPanel> panels = new ArrayList<TMLDesignPanel>(); - ArrayList<TMLComponentDesignPanel> cpanels = new ArrayList<TMLComponentDesignPanel>(); - Vector taskss = new Vector(); - Vector allcomp = new Vector(); - Vector tmp; + List<TMLDesignPanel> panels = new ArrayList<TMLDesignPanel>(); + List<TMLComponentDesignPanel> cpanels = new ArrayList<TMLComponentDesignPanel>(); + Vector<Vector<TGComponent>> taskss = new Vector<Vector<TGComponent>>(); + Vector<TMLCPrimitiveComponent> allcomp = new Vector<TMLCPrimitiveComponent>(); int index; if (nodesToTakeIntoAccount == null) { @@ -2962,11 +2963,12 @@ if (tgc instanceof TMLArchiCrossbarNode) { } else { components = nodesToTakeIntoAccount; } - ListIterator iterator = components.listIterator(); + + Iterator<? extends TGComponent> iterator = components.listIterator(); - TGComponent tgc, tgctask; - TMLArchiNode node; - ArrayList<TMLArchiArtifact> artifacts; + TGComponent tgc;//, tgctask; + // TMLArchiNode node; + List<TMLArchiArtifact> artifacts; String namePanel; TMLDesignPanel tmldp; TURTLEPanel tup; @@ -2975,11 +2977,15 @@ if (tgc instanceof TMLArchiCrossbarNode) { TMLCPrimitiveComponent pc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLArchiNode) { + Vector<TGComponent> tmp; + artifacts = ((TMLArchiNode)(tgc)).getAllTMLArchiArtifacts(); - for(TMLArchiArtifact artifact:artifacts) { + for( TMLArchiArtifact artifact:artifacts) { namePanel = artifact.getReferenceTaskName(); + try { tup = (TURTLEPanel)(tmlap.getMainGUI().getTURTLEPanel(namePanel)); @@ -2988,19 +2994,21 @@ if (tgc instanceof TMLArchiCrossbarNode) { tmldp = (TMLDesignPanel)tup; if (panels.contains(tmldp)) { index = panels.indexOf(tmldp); - tmp = (Vector)(taskss.get(index)); + tmp = taskss.get(index); } else { panels.add(tmldp); - this.tmldp = tmldp; - tmp = new Vector(); + this.tmldp = tmldp; + tmp = new Vector<TGComponent>(); taskss.add(tmp); } // Search for the corresponding TMLTask task = tmldp.getTaskByName(artifact.getTaskName()); + if (task != null) { tmp.add(task); - } else { + } + else { CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Task " + artifact.getTaskName() + " referenced by artifact " + artifact.getValue() + " is unknown"); //ce.setTMLTask(tmltask); ce.setTDiagramPanel(tmlap.tmlap); @@ -3013,10 +3021,10 @@ if (tgc instanceof TMLArchiCrossbarNode) { tmlcdp = (TMLComponentDesignPanel)(tup); if (cpanels.contains(tmlcdp)) { index = cpanels.indexOf(tmlcdp); - tmp = (Vector)(taskss.get(index)); + tmp = taskss.get(index); } else { cpanels.add(tmlcdp); - tmp = new Vector(); + tmp = new Vector<TGComponent>(); taskss.add(tmp); } @@ -3051,7 +3059,7 @@ if (tgc instanceof TMLArchiCrossbarNode) { for(TMLDesignPanel panel: panels) { gtml = new GTMLModeling(panel, false); gtml.putPrefixName(true); - gtml.setTasks((Vector)(taskss.get(index))); + gtml.setTasks( taskss.get(index) ); index ++; tmpm = gtml.translateToTMLModeling(false); warnings.addAll(gtml.getCheckingWarnings()); @@ -3068,7 +3076,7 @@ if (tgc instanceof TMLArchiCrossbarNode) { if (cpanels.size() > 0) { for(TMLComponentDesignPanel panel: cpanels) { - this.tmlcdp = panel; + this.tmlcdp = panel; gtml = new GTMLModeling(panel, false); gtml.setComponents(allcomp); gtml.putPrefixName(true); @@ -3147,65 +3155,64 @@ if (tgc instanceof TMLArchiCrossbarNode) { } //Inspect the architecture diagrams and retrieve mapping of channels onto CPs - private void makeCPMapping() { - - //Why this code? - //if( nodesToTakeIntoAccount == null ) { - - //take the architecture panel if it exists, otherwise return - Vector<TDiagramPanel> panelList = tmlap.getPanels(); - for( TDiagramPanel panel: panelList ) { - TraceManager.addDev( "Name of Panel: " + panel.getName() ); - } - //} - //else { - // components = nodesToTakeIntoAccount; - //} - ListIterator iterator = components.listIterator(); - - TGComponent tgc; - ArrayList<TMLArchiArtifact> artifacts; - ArrayList<TMLArchiCommunicationArtifact> artifactscomm; - ArrayList<TMLArchiEventArtifact> artifactsEvt; - HwNode node; - TMLTask task; - TMLElement elt; - String s; - - while( iterator.hasNext() ) { - TraceManager.addDev( "makeCPMapping 1" ); - tgc = (TGComponent)( iterator.next() ); - if( tgc instanceof TMLArchiCPNode ) { - TraceManager.addDev( "makeCPMapping 2" ); - node = archi.getHwNodeByName( tgc.getName() ); - if ( ( node != null ) && ( node instanceof HwCommunicationNode ) ) { - TraceManager.addDev( "makeCPMapping 3" ); - artifactscomm = ( (TMLArchiCommunicationNode)(tgc) ).getChannelArtifactList(); - for( TMLArchiCommunicationArtifact artifact: artifactscomm ) { - TraceManager.addDev("Exploring artifact " + artifact.getValue()); - s = artifact.getReferenceCommunicationName(); - s = s.replaceAll("\\s", ""); - s = s + "__" + artifact.getCommunicationName(); - TraceManager.addDev("Searching for:" + s); - elt = tmlm.getCommunicationElementByName(s); - TraceManager.addDev("comm elts:" + tmlm.getStringListCommunicationElements()); - if( elt instanceof TMLChannel ) { - //TraceManager.addDev("Setting priority"); - ( (TMLChannel)(elt) ).setPriority( artifact.getPriority() ); - } - if (elt != null) { - map.addCommToHwCommNode( elt, (HwCommunicationNode)node ); - } else { - TraceManager.addDev("Null mapping: no element named: " + artifact.getCommunicationName()); - } - } - - - } - } - } - } //End of method - +// private void makeCPMapping() { +// +// //Why this code? +// //if( nodesToTakeIntoAccount == null ) { +// +// //take the architecture panel if it exists, otherwise return +// Vector<TDiagramPanel> panelList = tmlap.getPanels(); +// for( TDiagramPanel panel: panelList ) { +// TraceManager.addDev( "Name of Panel: " + panel.getName() ); +// } +// //} +// //else { +// // components = nodesToTakeIntoAccount; +// //} +// ListIterator iterator = components.listIterator(); +// +// TGComponent tgc; +// ArrayList<TMLArchiArtifact> artifacts; +// ArrayList<TMLArchiCommunicationArtifact> artifactscomm; +// ArrayList<TMLArchiEventArtifact> artifactsEvt; +// HwNode node; +// TMLTask task; +// TMLElement elt; +// String s; +// +// while( iterator.hasNext() ) { +// TraceManager.addDev( "makeCPMapping 1" ); +// tgc = (TGComponent)( iterator.next() ); +// if( tgc instanceof TMLArchiCPNode ) { +// TraceManager.addDev( "makeCPMapping 2" ); +// node = archi.getHwNodeByName( tgc.getName() ); +// if ( ( node != null ) && ( node instanceof HwCommunicationNode ) ) { +// TraceManager.addDev( "makeCPMapping 3" ); +// artifactscomm = ( (TMLArchiCommunicationNode)(tgc) ).getChannelArtifactList(); +// for( TMLArchiCommunicationArtifact artifact: artifactscomm ) { +// TraceManager.addDev("Exploring artifact " + artifact.getValue()); +// s = artifact.getReferenceCommunicationName(); +// s = s.replaceAll("\\s", ""); +// s = s + "__" + artifact.getCommunicationName(); +// TraceManager.addDev("Searching for:" + s); +// elt = tmlm.getCommunicationElementByName(s); +// TraceManager.addDev("comm elts:" + tmlm.getStringListCommunicationElements()); +// if( elt instanceof TMLChannel ) { +// //TraceManager.addDev("Setting priority"); +// ( (TMLChannel)(elt) ).setPriority( artifact.getPriority() ); +// } +// if (elt != null) { +// map.addCommToHwCommNode( elt, (HwCommunicationNode)node ); +// } else { +// TraceManager.addDev("Null mapping: no element named: " + artifact.getCommunicationName()); +// } +// } +// +// +// } +// } +// } +// } //End of method private void makeTMLCPLib() { if (nodesToTakeIntoAccount == null) { @@ -3213,16 +3220,16 @@ if (tgc instanceof TMLArchiCrossbarNode) { } else { components = nodesToTakeIntoAccount; } - ListIterator iterator = components.listIterator(); + Iterator<? extends TGComponent> iterator = components.listIterator(); TGComponent tgc; - ArrayList<TMLArchiArtifact> artifacts; - ArrayList<TMLArchiCommunicationArtifact> artifactscomm; - ArrayList<TMLArchiEventArtifact> artifactsEvt; - HwNode node; - TMLTask task; - TMLElement elt; - String s; +// ArrayList<TMLArchiArtifact> artifacts; +// ArrayList<TMLArchiCommunicationArtifact> artifactscomm; +// ArrayList<TMLArchiEventArtifact> artifactsEvt; + // HwNode node; + // TMLTask task; + // TMLElement elt; + // String s; TMLArchiCPNode cp; while(iterator.hasNext()) { @@ -3253,12 +3260,13 @@ if (tgc instanceof TMLArchiCrossbarNode) { } else { components = nodesToTakeIntoAccount; } - ListIterator iterator = components.listIterator(); + + Iterator<? extends TGComponent> iterator = components.listIterator(); TGComponent tgc; - ArrayList<TMLArchiArtifact> artifacts; - ArrayList<TMLArchiCommunicationArtifact> artifactscomm; - ArrayList<TMLArchiEventArtifact> artifactsEvt; + List<TMLArchiArtifact> artifacts; + List<TMLArchiCommunicationArtifact> artifactscomm; + List<TMLArchiEventArtifact> artifactsEvt; HwNode node; TMLTask task; TMLElement elt; diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index e504644f71..6af5902752 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -58,7 +58,6 @@ import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; -import java.util.ListIterator; import java.util.Map; import java.util.Set; import java.util.Vector; @@ -201,6 +200,7 @@ import ui.oscd.TURTLEOSClassDiagramPanel; import ui.procsd.ProCSDComponent; import ui.procsd.ProactiveCSDPanel; import ui.prosmd.ProactiveSMDPanel; +import ui.req.Requirement; import ui.req.RequirementDiagramPanel; import ui.sd.SequenceDiagramPanel; import ui.sysmlsecmethodology.SysmlsecMethodologyDiagramPanel; @@ -232,7 +232,6 @@ import ui.tmlsd.TMLSDPanel; import ui.tree.InvariantDataTree; import ui.tree.SearchTree; import ui.tree.SyntaxAnalysisTree; -import ui.tree.SyntaxAnalysisTree.*; import ui.ucd.UseCaseDiagramPanel; import ui.window.JFrameSimulationTrace; import uppaaldesc.UPPAALSpec; @@ -252,7 +251,7 @@ public class GTURTLEModeling { // - private Vector panels; /* analysis, design, deployment, tml design */ + private Vector<TURTLEPanel> panels; /* analysis, design, deployment, tml design */ private TURTLEModeling tm; private AvatarSpecification avatarspec; // private AttackTree attackTree; @@ -296,7 +295,7 @@ public class GTURTLEModeling { private String tlsa; private String tlsadot; - private ArrayList<RG> graphs; + private List<RG> graphs; private GraphTree gt; private int nbRTLOTOS; @@ -309,15 +308,15 @@ public class GTURTLEModeling { private SyntaxAnalysisTree mcvdt; private InvariantDataTree idt; - private LinkedList<CheckingError> checkingErrors; - private LinkedList<CheckingError> warnings; + private List<CheckingError> checkingErrors; + private List<CheckingError> warnings; - private LinkedList<Invariant> invariants; + private List<Invariant> invariants; - ArrayList<TGConnectorInfo> pendingConnectors; + List<TGConnectorInfo> pendingConnectors; - private Vector savedOperations; - private Vector savedPanels; + private Vector<String> savedOperations; + private Vector<Point> savedPanels; private int nbMaxSavedOperations = 10; private int pointerOperation; @@ -343,7 +342,7 @@ public class GTURTLEModeling { boolean hasCrypto=false; //private Charset chset1, chset2; - public GTURTLEModeling(MainGUI _mgui, Vector _panels) { + public GTURTLEModeling(MainGUI _mgui, Vector<TURTLEPanel> _panels) { mgui = _mgui; panels = _panels; try { @@ -353,8 +352,8 @@ public class GTURTLEModeling { dbf = null; db = null; } - savedOperations = new Vector(); - savedPanels = new Vector(); + savedOperations = new Vector<String>(); + savedPanels = new Vector<Point>(); pointerOperation = -1; graphs = new ArrayList<RG>(); @@ -384,7 +383,7 @@ public class GTURTLEModeling { return tm.isARegularTIFSpec(); } - public ArrayList<RG> getRGs() { + public List<RG> getRGs() { return graphs; } @@ -399,7 +398,7 @@ public class GTURTLEModeling { } - public LinkedList<Invariant> getInvariants() { + public List<Invariant> getInvariants() { return invariants; } @@ -535,7 +534,7 @@ public class GTURTLEModeling { mgui.setMode(MainGUI.RTLOTOS_OK); } - public LinkedList generateAUT(String path) { + public List<String> generateAUT(String path) { TML2AUT tml2aut = new TML2AUT(tmlm); tml2aut.generateAutomatas(true); try { @@ -547,9 +546,9 @@ public class GTURTLEModeling { public boolean generateCCode( String _title ) { - CheckingError ce; - int type; - TGComponent tgc; + //CheckingError ce; + //int type; + // TGComponent tgc; String applicationName; TMLModelCompiler CCode; @@ -558,7 +557,7 @@ public class GTURTLEModeling { return true; } // Get the file from DiplodocusPECPragma - LinkedList components = mgui.getCurrentArchiPanel().tmlap.getComponentList(); + //List<TGComponent> components = mgui.getCurrentArchiPanel().tmlap.getComponentList(); // Parse the PEC file and the library of code snippets for each DIPLODOCUS unit applicationName = tmap.getMappedTasks().get(0).getName().split("__")[0]; // Remember that it works only for one application CCode = new TMLModelCompiler( _title, applicationName, mgui.frame, mgui.getAllTMLCP(), tmap ); @@ -605,12 +604,13 @@ public class GTURTLEModeling { //get the architecture panel and the nodes TMLArchiDiagramPanel tmlap = mgui.getTMLArchiDiagramPanels().get(0).tmlap; - LinkedList components = tmlap.getComponentList(); - ListIterator iterator = components.listIterator(); + List<TGComponent> components = tmlap.getComponentList(); + Iterator<TGComponent> iterator = components.listIterator(); TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLArchiCPNode) { TMLArchiCPNode node = (TMLArchiCPNode) tgc; TraceManager.addDev( "Found CP node: " + node.getName() ); @@ -618,10 +618,11 @@ public class GTURTLEModeling { } } - ArrayList<TMLCommunicationPatternPanel> tmlcpPanelsList = new ArrayList<TMLCommunicationPatternPanel>(); + List<TMLCommunicationPatternPanel> tmlcpPanelsList = new ArrayList<TMLCommunicationPatternPanel>(); //get the TMLCommunicationPatternPanels :) for( int i = 0; i < mgui.tabs.size(); i++ ) { - TURTLEPanel panel = (TURTLEPanel)( mgui.tabs.get(i) ); + TURTLEPanel panel = mgui.tabs.get(i); + if( panel instanceof TMLCommunicationPatternPanel ) { tmlcpPanelsList.add( (TMLCommunicationPatternPanel) panel ); TraceManager.addDev( "Found TMLCommunicationPatternPanel: " + ((TMLCommunicationPatternPanel)panel).toString() ); @@ -776,7 +777,7 @@ public class GTURTLEModeling { if (node1!=node2){ //Navigate architecture for node List<HwLink> links = map.getTMLArchitecture().getHwLinks(); - HwNode last = node1; + // HwNode last = node1; List<HwNode> found = new ArrayList<HwNode>(); List<HwNode> done = new ArrayList<HwNode>(); Map<HwNode, List<HwNode>> pathMap = new HashMap<HwNode, List<HwNode>>(); @@ -832,7 +833,7 @@ public class GTURTLEModeling { int ind = gui.tabs.indexOf(tmlcdp); String tabName = gui.getTitleAt(tmlcdp); gui.cloneRenameTab(ind, "firewallDesign"); - TMLComponentDesignPanel tcp = (TMLComponentDesignPanel) gui.tabs.get(gui.tabs.size()-1); + // TMLComponentDesignPanel tcp = (TMLComponentDesignPanel) gui.tabs.get(gui.tabs.size()-1); newarch.renameMapping(tabName, tabName+"_firewallDesign"); } @@ -863,8 +864,9 @@ public class GTURTLEModeling { firewallComp.setValueWithChange(firewallNode.getName()+link); firewallADP = tmlcdp.getTMLActivityDiagramPanel(firewallNode.getName()+link); } - ArrayList<TMLChannel> channelsCopy = tmlm.getChannels(); - ArrayList<TMLChannel> toAdd = new ArrayList<TMLChannel>(); + + List<TMLChannel> channelsCopy = tmlm.getChannels(); + List<TMLChannel> toAdd = new ArrayList<TMLChannel>(); TMLTask firewall = new TMLTask("TASK__"+firewallNode.getName()+"_"+link, firewallComp,firewallADP); @@ -914,13 +916,13 @@ public class GTURTLEModeling { //add loop adLoop = new TMLADForEverLoop(400,150,firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false,null, firewallADP); firewallADP.addComponent(adLoop,400,150,false,true); - TGConnector tmp =new TGConnectorTMLAD(adLoop.getX(), adLoop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adStart.getTGConnectingPointAtIndex(0),adLoop.getTGConnectingPointAtIndex(0), new Vector()); + TGConnector tmp =new TGConnectorTMLAD(adLoop.getX(), adLoop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adStart.getTGConnectingPointAtIndex(0),adLoop.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, adLoop.getX(),adLoop.getY(),false,true); //add choice adChoice = new TMLADChoice(400,300, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false,null, firewallADP); firewallADP.addComponent(adChoice, 400,300,false,true); - tmp =new TGConnectorTMLAD(adChoice.getX(), adChoice.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adLoop.getTGConnectingPointAtIndex(1), adChoice.getTGConnectingPointAtIndex(0), new Vector()); + tmp =new TGConnectorTMLAD(adChoice.getX(), adChoice.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adLoop.getTGConnectingPointAtIndex(1), adChoice.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, adChoice.getX(),adChoice.getY(),false,true); for (TMLChannel chan: inChans.keySet()){ TMLChannel newChan = inChans.get(chan); @@ -941,7 +943,7 @@ public class GTURTLEModeling { } } } - TMLCPortConnector conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector()); + TMLCPortConnector conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>()); tcdp.addComponent(conn, 0,0,false,true); TMLChannel wrChan = outChans.get(chan); @@ -960,7 +962,7 @@ public class GTURTLEModeling { } } } - conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector()); + conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>()); tcdp.addComponent(conn, 0,0,false,true); } int xpos=200; @@ -971,7 +973,7 @@ public class GTURTLEModeling { adRC.setChannelName(newChan.getName()); adRC.setSamples("1"); - tmp =new TGConnectorTMLAD(adRC.getX(), adRC.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adChoice.getTGConnectingPointAtIndex(i), adRC.getTGConnectingPointAtIndex(0), new Vector()); + tmp =new TGConnectorTMLAD(adRC.getX(), adRC.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adChoice.getTGConnectingPointAtIndex(i), adRC.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, adRC.getX(),adRC.getY(),false,true); firewallADP.addComponent(adRC,xpos,350,false,true); @@ -982,7 +984,7 @@ public class GTURTLEModeling { exec.setDelayValue(Integer.toString(firewallNode.latency)); firewallADP.addComponent(exec,400,200,false,true); - tmp =new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adRC.getTGConnectingPointAtIndex(1), exec.getTGConnectingPointAtIndex(0), new Vector()); + tmp =new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adRC.getTGConnectingPointAtIndex(1), exec.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, exec.getX(),exec.getY(),false,true); if (channelAllowed(map,chan)){ @@ -993,19 +995,19 @@ public class GTURTLEModeling { adWC.setSamples("1"); firewallADP.addComponent(adWC, xpos,400, false,true); - tmp =new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,exec.getTGConnectingPointAtIndex(1), adWC.getTGConnectingPointAtIndex(0), new Vector()); + tmp =new TGConnectorTMLAD(exec.getX(), exec.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,exec.getTGConnectingPointAtIndex(1), adWC.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, exec.getX(),exec.getY(),false,true); adStop = new TMLADStopState(xpos,500, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false,null, firewallADP); firewallADP.addComponent(adStop, xpos,500, false,true); - tmp =new TGConnectorTMLAD(adStop.getX(), adStop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adWC.getTGConnectingPointAtIndex(1), adStop.getTGConnectingPointAtIndex(0), new Vector()); + tmp =new TGConnectorTMLAD(adStop.getX(), adStop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,adWC.getTGConnectingPointAtIndex(1), adStop.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, adStop.getX(),adStop.getY(),false,true); } else { adStop = new TMLADStopState(xpos,500, firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false,null, firewallADP); firewallADP.addComponent(adStop, xpos,500, false,true); - tmp =new TGConnectorTMLAD(adStop.getX(), adStop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,exec.getTGConnectingPointAtIndex(1), adStop.getTGConnectingPointAtIndex(0), new Vector()); + tmp =new TGConnectorTMLAD(adStop.getX(), adStop.getY(), firewallADP.getMinX(), firewallADP.getMaxX(), firewallADP.getMinY(), firewallADP.getMaxY(), false, null,firewallADP,exec.getTGConnectingPointAtIndex(1), adStop.getTGConnectingPointAtIndex(0), new Vector<Point>()); firewallADP.addComponent(tmp, adStop.getX(),adStop.getY(),false,true); } xpos+=100; @@ -1089,7 +1091,56 @@ public class GTURTLEModeling { return map; } + public void addHSM(MainGUI gui, String compName){ + List<String> hsmInChans = new ArrayList<String>(); + String name="hsm"; + if (tmap==null){ + return; + } + //Clone diagrams + int arch = gui.tabs.indexOf(tmap.tmlap); + gui.cloneRenameTab(arch,"enc"); + TMLArchiPanel newarch = (TMLArchiPanel) gui.tabs.get(gui.tabs.size()-1); + TMLComponentDesignPanel tmlcdp = tmap.getTMLCDesignPanel(); + int ind = gui.tabs.indexOf(tmlcdp); + String tabName = gui.getTitleAt(tmlcdp); + gui.cloneRenameTab(ind, name); + TMLComponentDesignPanel t = (TMLComponentDesignPanel) gui.tabs.get(gui.tabs.size()-1); + TMLComponentTaskDiagramPanel tcdp = t.tmlctdp; + //Create clone of architecture panel and map tasks to it + newarch.renameMapping(tabName, tabName+"_"+name); + + TMLCPrimitiveComponent comp =null; + for (TGComponent tg: tcdp.getComponentList()){ + if (tg instanceof TMLCPrimitiveComponent){ + if (tg.getValue().equals(compName)){ + comp = (TMLCPrimitiveComponent) tg; + } + } + } + if (comp==null){ + return; + } + TMLCPrimitiveComponent hsm = new TMLCPrimitiveComponent(0, 500, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxY(), false, null, tcdp); + hsm.setValue("HSM"); + tcdp.addComponent(hsm, 0,500,false,true); + + for (String hsmChan: hsmInChans){ + TMLCChannelOutPort originPort =new TMLCChannelOutPort(comp.getX(), comp.getY(), tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, hsm, tcdp); + TMLCChannelOutPort destPort = new TMLCChannelOutPort(comp.getX(), comp.getY(), tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, comp, tcdp); + originPort.commName=hsmChan; + tcdp.addComponent(originPort,comp.getX(), comp.getY(),true,true); + + destPort.isOrigin=false; + destPort.commName=hsmChan; + tcdp.addComponent(destPort,comp.getX(), comp.getY(),true,true); + + TMLCPortConnector conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>()); + tcdp.addComponent(conn, 0,0,false,true); + } + + } public TMLMapping autoSecure(MainGUI gui, boolean autoConf, boolean autoAuth){ //TODO add more options @@ -1242,7 +1293,7 @@ public class GTURTLEModeling { if (chan!=null){ if (chan.checkConf){ // System.out.println(chan.getOriginTask().getName().split("__")[1]); - if (nonSecChans.contains(chan.getOriginTask().getName().split("__")[1]+"__"+writeChannel.getChannelName()+"_chData")){ + if (nonSecChans.contains(chan.getOriginTask().getName().split("__")[1]+"__"+writeChannel.getChannelName()+"_chData") && !secInChannels.get(chan.getDestinationTask()).contains(writeChannel.getChannelName())){ // if (!securePath(map, chan.getOriginTask(), chan.getDestinationTask())){ secOutChannels.get(chan.getOriginTask()).add(writeChannel.getChannelName()); secInChannels.get(chan.getDestinationTask()).add(writeChannel.getChannelName()); @@ -1274,13 +1325,14 @@ public class GTURTLEModeling { System.out.println("nonceout " +nonceOutChannels); // System.out.println(secOutChanannels.toString()); - int num=0; - int nonceNum=0; - //Create reverse channels to send nonces if they don't already exist + // int num=0; + //int nonceNum=0; + //Create reverse channels on component diagram to send nonces if they don't already exist // if (autoAuth){ for (TMLTask task: toSecureRev.keySet()){ TraceManager.addDev("Adding nonces to " + task.getName()); - LinkedList<TMLChannel> chans = tmlmodel.getChannelsFromMe(task); + List<TMLChannel> chans = tmlmodel.getChannelsFromMe(task); + for (TMLTask task2: toSecureRev.get(task)){ boolean addChan = true; for (TMLChannel chan:chans){ @@ -1288,6 +1340,7 @@ public class GTURTLEModeling { addChan=false; } } + if (addChan){ TMLCChannelOutPort originPort = new TMLCChannelOutPort(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp); TMLCChannelOutPort destPort = new TMLCChannelOutPort(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp); @@ -1308,7 +1361,7 @@ public class GTURTLEModeling { } tmlmodel.addChannel(new TMLChannel("nonceCh"+task.getName().split("__")[1] + "_"+ task2.getName().split("__")[1], originPort)); //Add connection - TMLCPortConnector conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector()); + TMLCPortConnector conn = new TMLCPortConnector(0, 0, tcdp.getMinX(), tcdp.getMaxX(), tcdp.getMinY(), tcdp.getMaxX(), true, null, tcdp, originPort.getTGConnectingPointAtIndex(0), destPort.getTGConnectingPointAtIndex(0), new Vector<Point>()); tcdp.addComponent(conn, 0,0,false,true); } } @@ -1322,12 +1375,13 @@ public class GTURTLEModeling { //Get start state position, shift everything down int xpos=0; int ypos=0; - TGConnector fromStart= new TGConnectorTMLAD(0, 0, 0, 0, 0, 0, false, null, tad, null, null, new Vector()); + TGConnector fromStart= new TGConnectorTMLAD(0, 0, 0, 0, 0, 0, false, null, tad, null, null, new Vector<Point>()); TGConnectingPoint point = new TGConnectingPoint(null, 0, 0, false, false); //Find states immediately before the write channel operator //For each occurence of a write channel operator, add encryption/nonces before it for (String channel: secOutChannels.get(task)){ + HashSet<TGComponent> channelInstances = new HashSet<TGComponent>(); int yShift=50; TMLChannel tmlc = tmlmodel.getChannelByName(title +"__"+channel); //First, find the connector that points to it. We will add the encryption, nonce operators directly before the write channel operator @@ -1335,23 +1389,26 @@ public class GTURTLEModeling { if (tg instanceof TMLADWriteChannel){ TMLADWriteChannel writeChannel = (TMLADWriteChannel) tg; if (writeChannel.getChannelName().equals(channel) && writeChannel.securityContext.equals("")){ - xpos = tg.getX(); - ypos = tg.getY(); - fromStart = tad.findTGConnectorEndingAt(tg.getTGConnectingPointAtIndex(0)); + if (fromStart!=null){ - point = fromStart.getTGConnectingPointP2(); + channelInstances.add(tg); } - break; } } } + for (TGComponent comp: channelInstances){ + //TMLADWriteChannel writeChannel = (TMLADWriteChannel) comp; + xpos = comp.getX(); + ypos = comp.getY(); + fromStart = tad.findTGConnectorEndingAt(comp.getTGConnectingPointAtIndex(0)); + point = fromStart.getTGConnectingPointP2(); //Add encryption operator TMLADEncrypt enc = new TMLADEncrypt(xpos, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); TMLADReadChannel rd=new TMLADReadChannel(0, 0, 0, 0, 0, 0, false, null, tad); if (nonceOutChannels.get(task).contains(channel)){ //Receive any nonces if ensuring authenticity rd = new TMLADReadChannel(xpos, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); - ArrayList<TMLChannel> matches = tmlmodel.getChannels(tmlc.getDestinationTask(), tmlc.getOriginTask()); + List<TMLChannel> matches = tmlmodel.getChannels(tmlc.getDestinationTask(), tmlc.getOriginTask()); if (matches.size()>0){ rd.setChannelName(matches.get(0).getName().replaceAll(title+"__","")); @@ -1362,7 +1419,7 @@ public class GTURTLEModeling { rd.securityContext = "nonce_"+ tmlc.getDestinationTask().getName().split("__")[1] + "_"+tmlc.getOriginTask().getName().split("__")[1]; tad.addComponent(rd, xpos, ypos+yShift, false,true); fromStart.setP2(rd.getTGConnectingPointAtIndex(0)); - fromStart=new TGConnectorTMLAD(enc.getX(), enc.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector()); + fromStart=new TGConnectorTMLAD(enc.getX(), enc.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector<Point>()); tad.addComponent(fromStart, xpos, ypos, false, true); fromStart.setP1(rd.getTGConnectingPointAtIndex(1)); yShift+=60; @@ -1381,7 +1438,7 @@ public class GTURTLEModeling { tad.addComponent(enc, xpos ,ypos+yShift, false, true); yShift+=60; fromStart.setP2(enc.getTGConnectingPointAtIndex(0)); - fromStart=new TGConnectorTMLAD(enc.getX(), enc.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector()); + fromStart=new TGConnectorTMLAD(enc.getX(), enc.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector<Point>()); tad.addComponent(fromStart, xpos, ypos, false, true); fromStart.setP1(enc.getTGConnectingPointAtIndex(1)); @@ -1391,12 +1448,12 @@ public class GTURTLEModeling { //Shift components down to make room for the added ones, and add security contexts to write channels for (TGComponent tg:tad.getComponentList()){ if (tg instanceof TMLADWriteChannel){ - TMLADWriteChannel writeChannel = (TMLADWriteChannel) tg; - TraceManager.addDev("Inspecting write channel " + writeChannel.getChannelName()); - if (channel.equals(writeChannel.getChannelName()) && writeChannel.securityContext.equals("")){ - TraceManager.addDev("Securing write channel " + writeChannel.getChannelName()); - writeChannel.securityContext = "autoEncrypt_"+writeChannel.getChannelName(); - tad.repaint(); + TMLADWriteChannel wChannel = (TMLADWriteChannel) tg; + TraceManager.addDev("Inspecting write channel " + wChannel.getChannelName()); + if (channel.equals(wChannel.getChannelName()) && wChannel.securityContext.equals("")){ + TraceManager.addDev("Securing write channel " + wChannel.getChannelName()); + wChannel.securityContext = "autoEncrypt_"+wChannel.getChannelName(); + } } if (tg.getY() >= ypos && tg !=enc && tg!=rd){ @@ -1404,13 +1461,16 @@ public class GTURTLEModeling { } } tad.setMaxPanelSize(tad.getMaxX(), tad.getMaxY()+yShift); + tad.repaint(); } + } for (String channel: macOutChannels.get(task)){ //Add MAC before writechannel int yShift=50; //TMLChannel tmlc = tmlmodel.getChannelByName(title +"__"+channel); //First, find the connector that points to it. We will add the encryption, nonce operators directly before the write channel operator + HashSet<TGComponent> channelInstances = new HashSet<TGComponent>(); for (TGComponent tg: tad.getComponentList()){ if (tg instanceof TMLADWriteChannel){ TMLADWriteChannel writeChannel = (TMLADWriteChannel) tg; @@ -1419,12 +1479,18 @@ public class GTURTLEModeling { ypos = tg.getY(); fromStart = tad.findTGConnectorEndingAt(tg.getTGConnectingPointAtIndex(0)); if (fromStart!=null){ - point = fromStart.getTGConnectingPointP2(); + channelInstances.add(tg); } break; } } } + for (TGComponent comp: channelInstances){ + //TMLADWriteChannel writeChannel = (TMLADWriteChannel) comp; + xpos = comp.getX(); + ypos = comp.getY(); + fromStart = tad.findTGConnectorEndingAt(comp.getTGConnectingPointAtIndex(0)); + point = fromStart.getTGConnectingPointP2(); //Add encryption operator TMLADEncrypt enc = new TMLADEncrypt(xpos, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); enc.securityContext = "autoEncrypt_"+channel; @@ -1436,7 +1502,7 @@ public class GTURTLEModeling { tad.addComponent(enc, xpos ,ypos+yShift, false, true); yShift+=60; fromStart.setP2(enc.getTGConnectingPointAtIndex(0)); - fromStart=new TGConnectorTMLAD(enc.getX(), enc.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector()); + fromStart=new TGConnectorTMLAD(enc.getX(), enc.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, null, null, new Vector<Point>()); tad.addComponent(fromStart, xpos, ypos, false, true); fromStart.setP1(enc.getTGConnectingPointAtIndex(1)); @@ -1446,11 +1512,11 @@ public class GTURTLEModeling { //Shift components down to make room for the added ones, and add security contexts to write channels for (TGComponent tg:tad.getComponentList()){ if (tg instanceof TMLADWriteChannel){ - TMLADWriteChannel writeChannel = (TMLADWriteChannel) tg; - TraceManager.addDev("Inspecting write channel " + writeChannel.getChannelName()); - if (channel.equals(writeChannel.getChannelName()) && writeChannel.securityContext.equals("")){ - TraceManager.addDev("Securing write channel " + writeChannel.getChannelName()); - writeChannel.securityContext = "autoEncrypt_"+writeChannel.getChannelName(); + TMLADWriteChannel wChannel = (TMLADWriteChannel) tg; + TraceManager.addDev("Inspecting write channel " + wChannel.getChannelName()); + if (channel.equals(wChannel.getChannelName()) && wChannel.securityContext.equals("")){ + TraceManager.addDev("Securing write channel " + wChannel.getChannelName()); + wChannel.securityContext = "autoEncrypt_"+wChannel.getChannelName(); tad.repaint(); } } @@ -1460,53 +1526,52 @@ public class GTURTLEModeling { } tad.setMaxPanelSize(tad.getMaxX(), tad.getMaxY()+yShift); } - + } for (String channel: macInChannels.get(task)){ //Add decryptmac after readchannel int yShift=50; - TGConnector conn =new TGConnectorTMLAD(0, 0, 0, 0, 0, 0, false, null, tad, null, null, new Vector()); + HashSet<TGComponent> channelInstances = new HashSet<TGComponent>(); + TGConnector conn =new TGConnectorTMLAD(0, 0, 0, 0, 0, 0, false, null, tad, null, null, new Vector<Point>()); TGConnectingPoint next = new TGConnectingPoint(null, 0, 0, false, false); //Find read channel operator - TMLADReadChannel readChannel = new TMLADReadChannel(xpos, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); + for (TGComponent tg: tad.getComponentList()){ if (tg instanceof TMLADReadChannel){ - readChannel = (TMLADReadChannel) tg; + TMLADReadChannel readChannel = (TMLADReadChannel) tg; if (readChannel.getChannelName().equals(channel) && readChannel.securityContext.equals("")){ fromStart = tad.findTGConnectorEndingAt(tg.getTGConnectingPointAtIndex(0)); if (fromStart!=null){ - point = fromStart.getTGConnectingPointP2(); - } - else { - continue; + channelInstances.add(tg); } - conn = tad.findTGConnectorStartingAt(tg.getTGConnectingPointAtIndex(1)); - xpos = fromStart.getX(); - ypos = fromStart.getY(); - if (conn==null){ - System.out.println("no connection"); - //Create a connector to decrypt operator - } - next = conn.getTGConnectingPointP2(); - break; } } } - //Check if there is an operator to secure - if (fromStart==null){ - continue; - } + + + for (TGComponent comp: channelInstances){ + + fromStart = tad.findTGConnectorEndingAt(comp.getTGConnectingPointAtIndex(0)); + point = fromStart.getTGConnectingPointP2(); + conn = tad.findTGConnectorStartingAt(comp.getTGConnectingPointAtIndex(1)); + next= conn.getTGConnectingPointP2(); + xpos = fromStart.getX(); + ypos = fromStart.getY(); + + + TMLADReadChannel readChannel = (TMLADReadChannel) comp; TraceManager.addDev("Securing read channel " + readChannel.getChannelName()); readChannel.securityContext = "autoEncrypt_"+readChannel.getChannelName(); tad.repaint(); //Add decryption operator if it does not already exist xpos = conn.getX(); ypos = conn.getY(); + TMLADDecrypt dec = new TMLADDecrypt(xpos+10, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); dec.securityContext = "autoEncrypt_" + readChannel.getChannelName(); tad.addComponent(dec, dec.getX(), dec.getY(), false, true); conn.setP2(dec.getTGConnectingPointAtIndex(0)); yShift+=60; - conn = new TGConnectorTMLAD(xpos,ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, dec.getTGConnectingPointAtIndex(1), next, new Vector()); + conn = new TGConnectorTMLAD(xpos,ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, dec.getTGConnectingPointAtIndex(1), next, new Vector<Point>()); conn.setP1(dec.getTGConnectingPointAtIndex(1)); conn.setP2(next); tad.addComponent(conn, conn.getX(), conn.getY(), false,true); @@ -1530,44 +1595,38 @@ public class GTURTLEModeling { tad.setMaxPanelSize(tad.getMaxX(), tad.getMaxY()+yShift); tad.repaint(); - + } } for (String channel: secInChannels.get(task)){ - System.out.println("securting channel "+channel); + TraceManager.addDev("securing channel "+channel); int yShift=20; // String title = task.getName().split("__")[0]; TMLChannel tmlc = tmlmodel.getChannelByName(title +"__"+channel); - TGConnector conn =new TGConnectorTMLAD(0, 0, 0, 0, 0, 0, false, null, tad, null, null, new Vector()); + TGConnector conn =new TGConnectorTMLAD(0, 0, 0, 0, 0, 0, false, null, tad, null, null, new Vector<Point>()); TGConnectingPoint next = new TGConnectingPoint(null, 0, 0, false, false); //Find read channel operator TMLADReadChannel readChannel = new TMLADReadChannel(xpos, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); + HashSet<TGComponent> channelInstances = new HashSet<TGComponent>(); for (TGComponent tg: tad.getComponentList()){ if (tg instanceof TMLADReadChannel){ readChannel = (TMLADReadChannel) tg; if (readChannel.getChannelName().equals(channel) && readChannel.securityContext.equals("")){ fromStart = tad.findTGConnectorEndingAt(tg.getTGConnectingPointAtIndex(0)); if (fromStart!=null){ - point = fromStart.getTGConnectingPointP2(); - } - else { - continue; - } - conn = tad.findTGConnectorStartingAt(tg.getTGConnectingPointAtIndex(1)); - xpos = fromStart.getX(); - ypos = fromStart.getY(); - if (conn==null){ - System.out.println("no connection"); - //Create a connector to decrypt operator + channelInstances.add(tg); } - next = conn.getTGConnectingPointP2(); - break; } } } - //Check if there is an operator to secure - if (fromStart==null){ - continue; - } + + for (TGComponent comp: channelInstances){ + + fromStart = tad.findTGConnectorEndingAt(comp.getTGConnectingPointAtIndex(0)); + point = fromStart.getTGConnectingPointP2(); + conn = tad.findTGConnectorStartingAt(comp.getTGConnectingPointAtIndex(1)); + next = conn.getTGConnectingPointP2(); + xpos = fromStart.getX(); + ypos = fromStart.getY(); TMLADWriteChannel wr = new TMLADWriteChannel(0, 0, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); if (nonceInChannels.get(task).contains(channel)){ //Create a nonce operator and a write channel operator @@ -1583,7 +1642,8 @@ public class GTURTLEModeling { wr = new TMLADWriteChannel(xpos, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); //Send nonce along channel, the newly created nonce channel or an existing channel with the matching sender and receiver //Find matching channels - ArrayList<TMLChannel> matches = tmlmodel.getChannels(tmlc.getDestinationTask(), tmlc.getOriginTask()); + List<TMLChannel> matches = tmlmodel.getChannels(tmlc.getDestinationTask(), tmlc.getOriginTask()); + if (matches.size()>0){ wr.setChannelName(matches.get(0).getName().replaceAll(title+"__","")); } @@ -1594,9 +1654,9 @@ public class GTURTLEModeling { wr.securityContext = "nonce_"+tmlc.getDestinationTask().getName().split("__")[1] + "_"+tmlc.getOriginTask().getName().split("__")[1]; tad.addComponent(wr,xpos,ypos+yShift,false,true); wr.makeValue(); - TGConnector tmp =new TGConnectorTMLAD(wr.getX(), wr.getY()+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null,tad,nonce.getTGConnectingPointAtIndex(1), wr.getTGConnectingPointAtIndex(0), new Vector()); + TGConnector tmp =new TGConnectorTMLAD(wr.getX(), wr.getY()+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null,tad,nonce.getTGConnectingPointAtIndex(1), wr.getTGConnectingPointAtIndex(0), new Vector<Point>()); tad.addComponent(tmp, xpos,ypos,false,true); - fromStart=new TGConnectorTMLAD(wr.getX(), wr.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, wr.getTGConnectingPointAtIndex(1), null, new Vector()); + fromStart=new TGConnectorTMLAD(wr.getX(), wr.getY(), tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, wr.getTGConnectingPointAtIndex(1), null, new Vector<Point>()); tad.addComponent(fromStart, xpos, ypos, false, true); //Connect created write channel operator to start of read channel operator fromStart.setP1(wr.getTGConnectingPointAtIndex(1)); @@ -1616,15 +1676,16 @@ public class GTURTLEModeling { readChannel.securityContext = "autoEncrypt_"+readChannel.getChannelName(); tad.repaint(); //Add decryption operator if it does not already exist - xpos = next.getX(); - ypos = next.getY(); + xpos = fromStart.getX(); + ypos = fromStart.getY(); TMLADDecrypt dec = new TMLADDecrypt(xpos+10, ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad); dec.securityContext = "autoEncrypt_" + readChannel.getChannelName(); tad.addComponent(dec, dec.getX(), dec.getY(), false, true); conn.setP2(dec.getTGConnectingPointAtIndex(0)); yShift+=100; - conn = new TGConnectorTMLAD(xpos,ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, dec.getTGConnectingPointAtIndex(1), next, new Vector()); + conn = new TGConnectorTMLAD(xpos,ypos+yShift, tad.getMinX(), tad.getMaxX(), tad.getMinY(), tad.getMaxY(), false, null, tad, dec.getTGConnectingPointAtIndex(1), next, new Vector<Point>()); conn.setP1(dec.getTGConnectingPointAtIndex(1)); + conn.setP2(next); tad.addComponent(conn, conn.getX(), conn.getY(), false,true); //Shift everything down @@ -1647,7 +1708,8 @@ public class GTURTLEModeling { tad.setMaxPanelSize(tad.getMaxX(), tad.getMaxY()+yShift); tad.repaint(); - } + } + } } GTMLModeling gtm = new GTMLModeling(t, false); TMLModeling newmodel = gtm.translateToTMLModeling(false,false); @@ -1973,7 +2035,7 @@ public class GTURTLEModeling { s = uppaalTMLTable.getRQuery(task, elt); if (s != null) { //TraceManager.addDev("Adding query:" + s); - Object ref; + // Object ref; if (elt.getReferenceObject() instanceof TGComponent) { tmpQ = new TGComponentAndUPPAALQuery((TGComponent)(elt.getReferenceObject()), s + "$" + elt); } else { @@ -2016,7 +2078,7 @@ public class GTURTLEModeling { return listQ; } - public LinkedList generateLOTOSAUT(String path) { + public List<String> generateLOTOSAUT(String path) { TML2AUTviaLOTOS tml2aut = new TML2AUTviaLOTOS(tmlm, tm); tml2aut.generateLOTOS(true); return tml2aut.getSpecs(); @@ -2599,16 +2661,16 @@ public class GTURTLEModeling { String actionName, actionName1; int index, index1, index2; MasterGateManager mgm = new MasterGateManager(tm, 1); - Gate g; + // Gate g; GroupOfGates gog; Hashtable <String, GroupOfGates> hashtable = new Hashtable<String, GroupOfGates>(); - int cpt = 0; + // int cpt = 0; //TraceManager.addDev("input data=" + inputData); // Fill Hashtable - int j; + // int j; for (TClassAndGateDS tag: gates) { //TraceManager.addDev("TClass:" + tag.getTClassName() + " Gate:" + tag.getGateName()); //actionName = tag.getGateName(); @@ -2634,7 +2696,7 @@ public class GTURTLEModeling { /*if (cpt % 10000 == 0) { TraceManager.addDev("cpt=" + cpt); }*/ - cpt ++; + // cpt ++; if (s.startsWith("des")) { result.append(s + "\n"); @@ -2723,16 +2785,16 @@ public class GTURTLEModeling { String g0, g1, g2; int cpt, transi=0; MasterGateManager mgm = new MasterGateManager(tm, 1); - Hashtable ht = mgm.getGatesUpperCaseHashTable(); + Map<String, Gate> ht = mgm.getGatesUpperCaseHashTable(); warnings = new LinkedList<CheckingError> (); //TraceManager.addDev("input data=" + inputData); - int cpt1 = 0; + // int cpt1 = 0; try { while((s = br.readLine()) != null) { - cpt1 ++; + // cpt1 ++; //if (cpt1 % 100000 == 0) { //TraceManager.addDev("=" + cpt1 + " / " + transi); //} @@ -2925,7 +2987,7 @@ public class GTURTLEModeling { return new String(result); }*/ - public boolean belongTo(GroupOfGates gog, Vector gates) { + public boolean belongTo(GroupOfGates gog, Vector<TClassAndGateDS> gates) { int i, j; TClassAndGateDS tcg; String nameTClass, nameGate; @@ -2933,7 +2995,8 @@ public class GTURTLEModeling { nameTClass = gog.getTClassAt(i).getName(); nameGate = gog.getGateAt(i).getName(); for(j=0; j<gates.size(); j++) { - tcg = (TClassAndGateDS)(gates.elementAt(j)); + tcg = gates.elementAt(j); + if ((tcg.getTClassName().compareTo(nameTClass) == 0) && (tcg.getGateName().compareTo(nameGate) == 0)) { //TraceManager.addDev("Projected gate"); return true; @@ -2992,7 +3055,7 @@ public class GTURTLEModeling { // save actions on tab int size = savedPanels.size(); if (size > 0) { - Point p1 = (Point)(savedPanels.elementAt(size - 1)); // panels are saved under the form of a point -> x = analysis/design, y = panel + Point p1 = savedPanels.elementAt(size - 1); // panels are saved under the form of a point -> x = analysis/design, y = panel if (p == null) p = p1; /*if ((p1.x != p.x) || (p1.y != p.y)){ @@ -3043,7 +3106,7 @@ public class GTURTLEModeling { if (p != null) { TraceManager.addDev("Selecting tab panel=" + p.getX() + " diagram=" + p.getY()); TDiagramPanel tdp = mgui.selectTab(p); - tdp.mode = tdp.NORMAL; + tdp.mode = TDiagramPanel.NORMAL; tdp.setDraw(true); tdp.repaint(); } @@ -3290,8 +3353,9 @@ public class GTURTLEModeling { public int computeMutexStatesWith(AvatarSMDState state) { Vector<TGComponent> list = new Vector<TGComponent>(); - if (state == null) { - state.setMutexWith(TGComponent.MUTEX_UNKNOWN); + if (state == null) { + // DB Issue 17 this will cause null pointer exception +// state.setMutexWith(TGComponent.MUTEX_UNKNOWN); return -1; } @@ -3395,11 +3459,11 @@ public class GTURTLEModeling { } - public LinkedList<CheckingError> getCheckingErrors() { + public List<CheckingError> getCheckingErrors() { return checkingErrors; } - public LinkedList<CheckingError> getCheckingWarnings() { + public List<CheckingError> getCheckingWarnings() { return warnings; } @@ -3504,7 +3568,8 @@ public class GTURTLEModeling { if (tgc instanceof TMLCCompositeComponent) { TMLActivityDiagramPanel tmladp3; - ArrayList<TMLCPrimitiveComponent> list = ((TMLCCompositeComponent)tgc).getAllPrimitiveComponents(); + List<TMLCPrimitiveComponent> list = ((TMLCCompositeComponent)tgc).getAllPrimitiveComponents(); + for (TMLCPrimitiveComponent comp: list) { tmladp3 = mgui.getTMLActivityDiagramPanel(mgui.getCurrentSelectedIndex(), comp.getValue()); s.append(tmladp3.saveInXML()); @@ -3542,13 +3607,13 @@ public class GTURTLEModeling { s = tdp.saveSelectedInXML(); - Vector v = tdp.selectedTclasses(); + final Vector<TCDTClass> classes = tdp.selectedTclasses(); - if ((v != null) && (v.size() > 0)) { + if ((classes != null) && (classes.size() > 0)) { TCDTClass t; TActivityDiagramPanel tadp; - for(int i=0; i<v.size(); i++) { - t = (TCDTClass)(v.elementAt(i)); + for(int i=0; i<classes.size(); i++) { + t = classes.elementAt(i); tadp = mgui.getActivityDiagramPanel(mgui.getCurrentSelectedIndex(), t.getValue()); s.append(tadp.saveInXML()); } @@ -3556,67 +3621,69 @@ public class GTURTLEModeling { //Added by Solange //bug removed by Emil - if (tdp instanceof ProactiveCSDPanel) - { - v=((ProactiveCSDPanel)tdp).selectedProCSDComponent(null); - if ((v != null) && (v.size() > 0)) { - ProCSDComponent t; - ProactiveSMDPanel psmd; - for(int i=0; i<v.size(); i++) { - t = (ProCSDComponent)(v.elementAt(i)); - psmd = mgui.getSMDPanel(mgui.getCurrentSelectedIndex(), t.getValue()); - if (psmd!=null) - s.append(psmd.saveInXML()); - } + if (tdp instanceof ProactiveCSDPanel) { + final Vector<ProCSDComponent> comp =((ProactiveCSDPanel)tdp).selectedProCSDComponent(null); + + if ((comp != null) && (comp.size() > 0)) { + ProCSDComponent t; + ProactiveSMDPanel psmd; + for(int i=0; i<comp.size(); i++) { + t = comp.elementAt(i); + psmd = mgui.getSMDPanel(mgui.getCurrentSelectedIndex(), t.getValue()); + if (psmd!=null) + s.append(psmd.saveInXML()); } } + } //until here - v = tdp.selectedTURTLEOSClasses(); - if ((v != null) && (v.size() > 0)) { + final Vector<TOSClass> toClasses = tdp.selectedTURTLEOSClasses(); + + if ((toClasses != null) && (toClasses.size() > 0)) { //TraceManager.addDev("Saving TURTLEOS activity diagram Panel..."); TOSClass t; TURTLEOSActivityDiagramPanel tosadp; - for(int i=0; i<v.size(); i++) { - t = (TOSClass)(v.elementAt(i)); + for(int i=0; i<toClasses.size(); i++) { + t = toClasses.elementAt(i); tosadp = mgui.getTURTLEOSActivityDiagramPanel(mgui.getCurrentSelectedIndex(), t.getValue()); s.append(tosadp.saveInXML()); } } - v = tdp.selectedTMLTasks(); - if ((v != null) && (v.size() > 0)) { + final Vector<TMLTaskOperator> operators = tdp.selectedTMLTasks(); + if ((operators != null) && (operators.size() > 0)) { //TraceManager.addDev("Saving TML activity diagram Panel..."); TMLTaskOperator t; TMLActivityDiagramPanel tmladp; - for(int i=0; i<v.size(); i++) { - t = (TMLTaskOperator)(v.elementAt(i)); + for(int i=0; i<operators.size(); i++) { + t = operators.elementAt(i); tmladp = mgui.getTMLActivityDiagramPanel(mgui.getCurrentSelectedIndex(), t.getValue()); s.append(tmladp.saveInXML()); } } - v = tdp.selectedAvatarBDBlocks(); - if ((v != null) && (v.size() > 0)) { + final Vector<AvatarBDBlock> blocks = tdp.selectedAvatarBDBlocks(); + if ((blocks != null) && (blocks.size() > 0)) { //TraceManager.addDev("Saving TML activity diagram Panel..."); AvatarBDBlock abdb; AvatarSMDPanel asmdp; - for(int i=0; i<v.size(); i++) { - abdb = (AvatarBDBlock)(v.elementAt(i)); + for(int i=0; i<blocks.size(); i++) { + abdb = blocks.elementAt(i); asmdp = mgui.getAvatarSMDPanel(mgui.getCurrentSelectedIndex(), abdb.getBlockName()); s.append(asmdp.saveInXML()); } } - v = tdp.selectedCPrimitiveComponent(); - if ((v != null) && (v.size() > 0)) { + final Vector<TMLCPrimitiveComponent> primComps = tdp.selectedCPrimitiveComponent(); + + if ((primComps != null) && (primComps.size() > 0)) { //TraceManager.addDev("Saving TML activity diagram Panel..."); TMLCPrimitiveComponent ct; TMLActivityDiagramPanel tmladp; - for(int i=0; i<v.size(); i++) { - ct = (TMLCPrimitiveComponent)(v.elementAt(i)); + for(int i=0; i<primComps.size(); i++) { + ct = primComps.elementAt(i); tmladp = mgui.getTMLActivityDiagramPanel(mgui.getCurrentSelectedIndex(), ct.getValue()); s.append(tmladp.saveInXML()); } @@ -3695,10 +3762,10 @@ public class GTURTLEModeling { public void removeAllComponents() { TDiagramPanel tdp; int i, j; - Vector panelss; + Vector<TDiagramPanel> panelss; // search for diagram panels for(i=0; i<panels.size(); i++) { - panelss = (Vector)(((TURTLEPanel)(panels.elementAt(i))).panels); + panelss = (((TURTLEPanel)(panels.elementAt(i))).panels); for(j=0; j<panelss.size(); j++) { tdp = (TDiagramPanel)(panelss.elementAt(j)); tdp.removeAll(); @@ -5566,7 +5633,7 @@ public class GTURTLEModeling { String nameTab; NodeList diagramNl; int indexTMLCP; - int cpt = 0; + // int cpt = 0; nameTab = elt.getAttribute("nameTab"); @@ -5582,11 +5649,11 @@ public class GTURTLEModeling { if (elt.getTagName().compareTo("CommunicationPatternDiagramPanel") == 0) { // CP loadTMLCPDiagram(elt, indexTMLCP); - cpt ++; + // cpt ++; } else { // Managing sequence diagrams if (elt.getTagName().compareTo("TMLSDPanel") == 0) { loadTMLSDDiagram(elt, indexTMLCP); - cpt ++; + // cpt ++; } } } @@ -6882,10 +6949,10 @@ public class GTURTLEModeling { //TraceManager.addDev("Post loading of diagram " + tdp.toString()); - LinkedList list = tdp.getComponentList(); + List<TGComponent> list = tdp.getComponentList(); for(int i=0; i<list.size()-beginIndex; i++) { - tgc = (TGComponent)(list.get(i)); + tgc = list.get(i); //TraceManager.addDev(tgc.getName()); //TraceManager.addDev(tgc.getValue()); tgc.makePostLoading(decId); @@ -6951,7 +7018,7 @@ public class GTURTLEModeling { int myMinWidth = -1, myMinHeight = -1, myMinDesiredWidth = -1, myMinDesiredHeight = -1; int myMinX = -1, myMaxX = -1, myMinY = -1, myMaxY = -1; String myName = null, myValue = null; - Vector tgcpList = new Vector(); + Vector<Point> tgcpList = new Vector<Point>(); Point p; int i, x, y; int fatherId = -1, fatherNum = -1; @@ -7286,7 +7353,7 @@ public class GTURTLEModeling { } public void connectConnectorsToRealPoints(TDiagramPanel tdp) throws MalformedModelingException { - LinkedList list = tdp.getComponentList(); + List<TGComponent> list = tdp.getComponentList(); TGConnectingPoint p1, p2, p3, p4; //TGConnectingPointTmp p; int i; @@ -7423,9 +7490,9 @@ public class GTURTLEModeling { String myName = null, myValue = null; int tmpx, tmpy, tmpid; TGConnectingPoint p1 = null, p2=null; - Vector pointList = new Vector(); + Vector<Point> pointList = new Vector<Point>(); - Vector tgcpList = new Vector(); + Vector<Point> tgcpList = new Vector<Point>(); Point p; int i, x, y; //int fatherId = -1, fatherNum = -1; @@ -7571,7 +7638,7 @@ public class GTURTLEModeling { warnings = new LinkedList<CheckingError> (); //TraceManager.addDev("Step 02"); - mgui.setMode(mgui.VIEW_SUGG_DESIGN_KO); + mgui.setMode( MainGUI.VIEW_SUGG_DESIGN_KO); //TraceManager.addDev("Step 1"); try { @@ -7629,7 +7696,6 @@ public class GTURTLEModeling { mgui.changeMade(null, -1); } - public boolean translateDeployment(DeploymentPanel dp) { // Builds a TURTLE modeling from a deployment diagram TraceManager.addDev("deployement"); @@ -7641,14 +7707,14 @@ public class GTURTLEModeling { listE = new CorrespondanceTGElement(); mgui.reinitCountOfPanels(); - LinkedList ll; - ListIterator iterator, iterator2; + List<TDDNode> ll; + Iterator<TDDNode> iterator;//, iterator2; // First step: adding all necessary classes + their ad ll = dp.tddp.getListOfNodes(); iterator = ll.listIterator(); TDDNode node; - Vector artifacts; + Vector<TDDArtifact> artifacts; TDDArtifact art; int i; DesignPanel dp2; @@ -7660,18 +7726,18 @@ public class GTURTLEModeling { // Loop on nodes while(iterator.hasNext()) { - node = (TDDNode)(iterator.next()); + node = iterator.next(); // Loop on artifact artifacts = node.getArtifactList(); for(i=0; i<artifacts.size(); i++) { - art = (TDDArtifact)(artifacts.elementAt(i)); + art = artifacts.elementAt(i); dp2 = art.getDesignPanel(); - iterator2 = dp2.tcdp.getComponentList().listIterator(); + final Iterator<TGComponent> iterator2 = dp2.tcdp.getComponentList().listIterator(); LinkedList<TClassInterface> tclasses = new LinkedList<TClassInterface> (); while(iterator2.hasNext()) { - tgc = (TGComponent)(iterator2.next()); + tgc = iterator2.next(); if (tgc instanceof TClassInterface) { TraceManager.addDev("Found tclass: " + tgc.getValue()); tclasses.add((TClassInterface) tgc); @@ -7793,9 +7859,9 @@ public class GTURTLEModeling { } - public boolean translateTMLDesign(Vector tasksToTakeIntoAccount, TMLDesignPanel tmldp, boolean optimize) { + public boolean translateTMLDesign(Vector<? extends TGComponent> tasksToTakeIntoAccount, TMLDesignPanel tmldp, boolean optimize) { nullifyTMLModeling(); - ArrayList<TMLError> warningsOptimize = new ArrayList<TMLError>(); + // List<TMLError> warningsOptimize = new ArrayList<TMLError>(); warnings = new LinkedList<CheckingError> (); mgui.setMode(MainGUI.VIEW_SUGG_DESIGN_KO); @@ -7816,11 +7882,12 @@ public class GTURTLEModeling { if ((checkingErrors != null) && (checkingErrors.size() > 0)){ analyzeErrors(); + return false; } else { - if (optimize) { - warningsOptimize = tmlm.optimize(); - } +// if (optimize) { +// warningsOptimize = tmlm.optimize(); +// } tmState = 2; mgui.resetAllDIPLOIDs(); @@ -7831,19 +7898,21 @@ public class GTURTLEModeling { } } - public Vector<CheckingError> convertToCheckingErrorTMLErrors(ArrayList<TMLError> warningsOptimize, TDiagramPanel _tdp) { + public Vector<CheckingError> convertToCheckingErrorTMLErrors( List<TMLError> warningsOptimize, TDiagramPanel _tdp) { Vector<CheckingError> v = new Vector<CheckingError>(); CheckingError warning; + for(TMLError error: warningsOptimize) { warning = new CheckingError(CheckingError.BEHAVIOR_ERROR, error.message); warning.setTDiagramPanel(_tdp); warning.setTMLTask(error.task); v.add(warning); } + return v; } - public boolean translateTMLComponentDesign(Vector componentsToTakeIntoAccount, TMLComponentDesignPanel tmlcdp, boolean optimize) { + public boolean translateTMLComponentDesign(Vector<? extends TGComponent> componentsToTakeIntoAccount, TMLComponentDesignPanel tmlcdp, boolean optimize) { nullifyTMLModeling(); // ArrayList<TMLError> warningsOptimize = new ArrayList<TMLError>(); warnings = new LinkedList<CheckingError> (); @@ -7908,8 +7977,8 @@ public class GTURTLEModeling { } } - public boolean checkSyntaxTMLMapping(Vector nodesToTakeIntoAccount, TMLArchiPanel tmlap, boolean optimize) { - ArrayList<TMLError> warningsOptimize = new ArrayList<TMLError>(); + public boolean checkSyntaxTMLMapping(Vector<TGComponent> nodesToTakeIntoAccount, TMLArchiPanel tmlap, boolean optimize) { + List<TMLError> warningsOptimize = new ArrayList<TMLError>(); warnings = new LinkedList<CheckingError> (); mgui.setMode(MainGUI.VIEW_SUGG_DESIGN_KO); //TraceManager.addDev("New TML Mapping"); @@ -7947,10 +8016,10 @@ public class GTURTLEModeling { //Newly introduced to perform Syntax check of CP diagrams. Actually the mapping of CPs onto the architecture is done via SDs, //onto the application is done onto blocks in the architecture. It would be better to have all the mapping information in one //diagram. Up to now, not taking the mapping information into account - public boolean checkSyntaxTMLCP( Vector nodesToTakeIntoAccount, TMLCommunicationPatternPanel tmlcpp, boolean optimize ) { + public boolean checkSyntaxTMLCP( Vector<TGComponent> nodesToTakeIntoAccount, TMLCommunicationPatternPanel tmlcpp, boolean optimize ) { //nodesToTakeIntoAccount is the list of SDs and ADs corresponding that compose the CP selected for syntax checking - ArrayList<TMLError> warningsOptimize = new ArrayList<TMLError>(); + // List<TMLError> warningsOptimize = new ArrayList<TMLError>(); warnings = new LinkedList<CheckingError> (); mgui.setMode( MainGUI.VIEW_SUGG_DESIGN_KO ); GTMLModeling gtmlm = new GTMLModeling( tmlcpp, true ); @@ -8108,7 +8177,7 @@ public class GTURTLEModeling { public void addStates(AvatarStateMachineElement asme, int x, int y, AvatarSMDPanel smp, AvatarBDBlock bl, Map<AvatarStateMachineElement, TGComponent> SMDMap, Map<AvatarStateMachineElement, TGComponent> locMap, Map<AvatarTransition, AvatarStateMachineElement> tranDestMap, Map<AvatarTransition, TGComponent> tranSourceMap){ - TGConnectingPoint tp = new TGConnectingPoint(null, x, y, false, false); + // TGConnectingPoint tp = new TGConnectingPoint(null, x, y, false, false); //Create dummy tgcomponent TGComponent tgcomp = new AvatarSMDStartState(x,y,x,x*2,y,y*2,false,null,smp); if (asme instanceof AvatarStartState){ @@ -8116,7 +8185,7 @@ public class GTURTLEModeling { tgcomp = smdss; smp.addComponent(smdss, x, y, false, true); SMDMap.put(asme, smdss); - tp = smdss.tgconnectingPointAtIndex(0); + // tp = smdss.tgconnectingPointAtIndex(0); locMap.put(asme, smdss); } if (asme instanceof AvatarTransition){ @@ -8133,8 +8202,8 @@ public class GTURTLEModeling { // sig.setName(name); smdrs.recalculateSize(); SMDMap.put(asme, smdrs); - tp = smdrs.getFreeTGConnectingPoint(x+smdrs.getWidth()/2,y+smdrs.getHeight()); - TGConnectingPoint tp2 = smdrs.getFreeTGConnectingPoint(x+smdrs.getWidth()/2,y); + // tp = smdrs.getFreeTGConnectingPoint(x+smdrs.getWidth()/2,y+smdrs.getHeight()); + // TGConnectingPoint tp2 = smdrs.getFreeTGConnectingPoint(x+smdrs.getWidth()/2,y); locMap.put(asme, smdrs); if (bl.getAvatarSignalFromName(name) ==null){ //bl.addSignal(new ui.AvatarSignal(0, name, new String[0], new String[0])); @@ -8149,8 +8218,8 @@ public class GTURTLEModeling { smdss.setValue(name); smdss.recalculateSize(); SMDMap.put(asme, smdss); - tp = smdss.getFreeTGConnectingPoint(x+smdss.getWidth()/2,y+smdss.getHeight()); - TGConnectingPoint tp2 = smdss.getFreeTGConnectingPoint(x+smdss.getWidth()/2,y); + // tp = smdss.getFreeTGConnectingPoint(x+smdss.getWidth()/2,y+smdss.getHeight()); + // TGConnectingPoint tp2 = smdss.getFreeTGConnectingPoint(x+smdss.getWidth()/2,y); locMap.put(asme, smdss); if (bl.getAvatarSignalFromName(name) == null){ // bl.addSignal(new ui.AvatarSignal(1, name, new String[0], new String[0])); @@ -8163,7 +8232,7 @@ public class GTURTLEModeling { tgcomp=smdstop; SMDMap.put(asme, smdstop); smp.addComponent(smdstop, x, y, false, true); - tp = smdstop.tgconnectingPointAtIndex(0); + // tp = smdstop.tgconnectingPointAtIndex(0); locMap.put(asme, smdstop); } if (asme instanceof AvatarState){ @@ -8188,8 +8257,8 @@ public class GTURTLEModeling { smdstate.setValue(asme.getName()); smdstate.recalculateSize(); SMDMap.put(asme, smdstate); - tp = smdstate.getFreeTGConnectingPoint(x+smdstate.getWidth()/2,y+smdstate.getHeight()); - TGConnectingPoint tp2 = smdstate.getFreeTGConnectingPoint(x+smdstate.getWidth()/2,y); + // tp = smdstate.getFreeTGConnectingPoint(x+smdstate.getWidth()/2,y+smdstate.getHeight()); + // TGConnectingPoint tp2 = smdstate.getFreeTGConnectingPoint(x+smdstate.getWidth()/2,y); locMap.put(asme, smdstate); } int i=0; @@ -8361,7 +8430,7 @@ public class GTURTLEModeling { for (String bl1: originDestMap.keySet()){ for (String bl2:originDestMap.get(bl1)){ - Vector points=new Vector(); + Vector<Point> points=new Vector<Point>(); TGConnectingPoint p1= blockMap.get(bl1).findFirstFreeTGConnectingPoint(true,true); p1.setFree(false); @@ -8414,9 +8483,9 @@ public class GTURTLEModeling { ypos+=100; //Add Pragmas AvatarBDPragma pragma=new AvatarBDPragma(xpos, ypos, xpos, xpos*2, ypos, ypos*2, false, null,abd); - String[] arr = new String[avspec.getPragmas().size()]; + // String[] arr = new String[avspec.getPragmas().size()]; String s=""; - int i=0; + // int i=0; for (AvatarPragma p: avspec.getPragmas()){ // arr[i] = p.getName(); @@ -8437,7 +8506,7 @@ public class GTURTLEModeling { else if (p.getName().contains("Authenticity")){ } s=s.concat(t+"\n"); - i++; + // i++; } pragma.setValue(s); pragma.makeValue(); @@ -8513,7 +8582,7 @@ public class GTURTLEModeling { if (p2==null){ p2=locMap.get(tranDestMap.get(t)).closerFreeTGConnectingPoint(x,y,true, true); } - Vector points = new Vector(); + Vector<Point> points = new Vector<Point>(); if (p1==null || p2 ==null){ System.out.println(tranSourceMap.get(t)+" "+locMap.get(tranDestMap.get(t))); @@ -8541,7 +8610,7 @@ public class GTURTLEModeling { } // Generates for all observers, a TURTLE modeling for checking it - public boolean generateTMsForRequirementAnalysis(Vector reqs, RequirementDiagramPanel rdp) { + public boolean generateTMsForRequirementAnalysis(Vector<Requirement> reqs, RequirementDiagramPanel rdp) { rm = new RequirementModeling(reqs, rdp, mgui); checkingErrors = rm.getCheckingErrors(); warnings = rm.getWarnings(); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index c856bf69ab..1fec9ddb96 100644 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -47,6 +47,7 @@ */ package ui; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -70,8 +71,9 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; -import java.util.HashMap; import java.util.LinkedList; +import java.util.List; +import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -147,11 +149,11 @@ import ui.interactivesimulation.SimulationTransaction; import ui.iod.InteractionOverviewDiagramPanel; import ui.osad.TURTLEOSActivityDiagramPanel; import ui.prosmd.ProactiveSMDPanel; +import ui.req.Requirement; import ui.req.RequirementDiagramPanel; import ui.sd.SequenceDiagramPanel; import ui.tmlad.TMLActivityDiagramPanel; import ui.tmlcd.TMLTaskDiagramPanel; -import ui.tmlcd.TMLTaskOperator; import ui.tmlcompd.TMLCCompositeComponent; import ui.tmlcompd.TMLComponentTaskDiagramPanel; import ui.tmlcp.TMLCPPanel; @@ -189,11 +191,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe public Container panelForTab, panelForTree; //panelForAnalysisTab; //panelForDesignTab; public JSplitPane split; - - - // Multi analysis / design / deployment - public Vector tabs; + public Vector<TURTLEPanel> tabs; /* This dummySelectedTab is used when loading a model from XML. * It enables to use standard getCurrentTURTLEPanel even though * the mainTabbedPane has not yet been created. @@ -694,7 +693,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe TURTLEPanel panel; for(int i=0; i<tabs.size(); i++) { - panel = (TURTLEPanel)(tabs.get(i)); + panel = tabs.get(i); panel.searchForText(text.toLowerCase(), elements); } @@ -704,11 +703,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } - public LinkedList<Invariant> getInvariants() { + public List<Invariant> getInvariants() { return gtm.getInvariants(); } - public ArrayList<RG> getRGs() { + public List<RG> getRGs() { return gtm.getRGs(); } @@ -1069,17 +1068,17 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return list; } - public Vector getAllApplicationTMLTasksAttributes() { - + public Vector<String> getAllApplicationTMLTasksAttributes() { TURTLEPanel tp; - Vector<TMLTaskOperator> list = new Vector<TMLTaskOperator>(); + Vector<String> list = new Vector<String>(); for( int i = 0; i < tabs.size(); i++ ) { - tp = (TURTLEPanel)(tabs.elementAt(i)); + tp = tabs.elementAt(i); if( tp instanceof TMLComponentDesignPanel ) { list.addAll( ((TMLComponentDesignPanel)tp).getAllTMLTasksAttributes() ); } } + return list; } @@ -1503,12 +1502,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe panelForTab.add(mainTabbedPane, BorderLayout.CENTER); mainTabbedPane.addMouseListener(new PopupListener(this)); - tabs = new Vector(); + tabs = new Vector<TURTLEPanel>(); frame.setVisible(true); } - public Vector getTabs() { + public Vector<TURTLEPanel> getTabs() { return tabs; } @@ -1616,7 +1615,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe // tabbed pane for(int i=0; i<tabs.size(); i++) { - ((TURTLEPanel)(tabs.elementAt(i))).tabbedPane.removeAll(); + tabs.elementAt(i).tabbedPane.removeAll(); } tabs = null; @@ -1817,8 +1816,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe public void newProactiveDesign() { //TraceManager.addDev("NEW DESIGN"); - int index = addProActiveDesignPanel("ProActive Design", -1); - ((TURTLEPanel)tabs.elementAt(tabs.size()-1)).tabbedPane.setSelectedIndex(0); + /*int index = */addProActiveDesignPanel("ProActive Design", -1); + tabs.elementAt(tabs.size()-1).tabbedPane.setSelectedIndex(0); mainTabbedPane.setSelectedIndex(tabs.size()-1); //paneAction(null); //frame.repaint();*/ @@ -2797,7 +2796,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe //open a new External Search Dialog public void showExternalSearch(){ String textSearchField = mainBar.search.getText(); - ArrayList<String> listSearch = new ArrayList<String>(); + List<String> listSearch = new ArrayList<String>(); if (null == this.searchBox) { if (getCurrentTDiagramPanel()!=null) { @@ -2815,7 +2814,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } else { if (this.searchBox.isShowing()) { - this.searchBox.show(); + this.searchBox.setVisible( true ); } else { this.searchBox = null; @@ -2862,7 +2861,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } public void oneClickLOTOSRG() { - boolean ret; + // boolean ret; if (!checkModelingSyntax(true)) { TraceManager.addDev("Syntax error"); return; @@ -2877,7 +2876,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } public void oneClickRTLOTOSRG() { - boolean ret; + // boolean ret; if (!checkModelingSyntax(true)) { TraceManager.addDev("Syntax error"); return; @@ -2914,7 +2913,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } public boolean checkModelingSyntax(TURTLEPanel tp, boolean automatic) { - String msg = ""; + //String msg = ""; boolean b = false; boolean ret = false; @@ -2932,7 +2931,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe b = gtm.buildTURTLEModelingFromAnalysis((AnalysisPanel)tp); } catch (AnalysisSyntaxException ae) { //TraceManager.addDev("Exception AnalysisSyntaxException"); - msg = ae.getMessage(); + //msg = ae.getMessage(); b = false; } if (b) { @@ -3185,7 +3184,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe TMLDesignPanel tmldp = (TMLDesignPanel)tp; JDialogSelectTMLTask.validated = tmldp.validated; JDialogSelectTMLTask.ignored = tmldp.ignored; - Vector tmlTasksToValidate = new Vector(); + Vector<TGComponent> tmlTasksToValidate = new Vector<TGComponent>(); JDialogSelectTMLTask jdstmlt = new JDialogSelectTMLTask(frame, tmlTasksToValidate, tmldp.tmltdp.getComponentList(), "Choosing TML tasks to validate"); if (!automatic) { GraphicLib.centerOnParent(jdstmlt); @@ -3221,7 +3220,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe TMLComponentDesignPanel tmlcdp = (TMLComponentDesignPanel)tp; JDialogSelectTMLComponent.validated = tmlcdp.validated; JDialogSelectTMLComponent.ignored = tmlcdp.ignored; - Vector tmlComponentsToValidate = new Vector(); + Vector<TGComponent> tmlComponentsToValidate = new Vector<TGComponent>(); JDialogSelectTMLComponent jdstmlc = new JDialogSelectTMLComponent(frame, tmlComponentsToValidate, tmlcdp.tmlctdp.getComponentList(), "Choosing TML components to validate"); if (!automatic) { GraphicLib.centerOnParent(jdstmlc); @@ -3257,7 +3256,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe tmlap = (TMLArchiPanel)tp; JDialogSelectTMLNodes.validated = tmlap.validated; JDialogSelectTMLNodes.ignored = tmlap.ignored; - Vector tmlNodesToValidate = new Vector(); + Vector<TGComponent> tmlNodesToValidate = new Vector<TGComponent>(); JDialogSelectTMLNodes jdstmln = new JDialogSelectTMLNodes(frame, tmlNodesToValidate, tmlap.tmlap.getComponentList(), "Choosing Nodes to validate", tmlap.tmlap.getMasterClockFrequency()); if (!automatic) { GraphicLib.centerOnParent(jdstmln); @@ -3297,7 +3296,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe TMLCommunicationPatternPanel tmlcpp = (TMLCommunicationPatternPanel) tp; JDialogSelectCPDiagrams.validated = tmlcpp.validated; JDialogSelectCPDiagrams.ignored = tmlcpp.ignored; - Vector tmlDiagramsToValidate = new Vector(); + Vector<TGComponent> tmlDiagramsToValidate = new Vector<TGComponent>(); JDialogSelectCPDiagrams jdscpd = new JDialogSelectCPDiagrams( frame, tmlDiagramsToValidate, tmlcpp.tmlcpp.getComponentList(), "Choosing Diagrams to validate" ); if( !automatic ) { @@ -3359,12 +3358,14 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe RequirementDiagramPanel rdp= (RequirementDiagramPanel)tdp; JDialogSelectRequirements.validated = rdp.validated; JDialogSelectRequirements.ignored = rdp.ignored; - Vector reqsToValidate = new Vector(); + Vector<Requirement> reqsToValidate = new Vector<Requirement>(); JDialogSelectRequirements jdsreq = new JDialogSelectRequirements(frame, reqsToValidate, rdp.getComponentList(), "Choosing requirements to verify"); + if (!automatic) { GraphicLib.centerOnParent(jdsreq); jdsreq.setVisible(true); // Blocked until dialog has been closed } + if (reqsToValidate.size() > 0) { rdp.validated = JDialogSelectRequirements.validated; rdp.ignored = JDialogSelectRequirements.ignored; @@ -3640,11 +3641,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return adp.getAllTimers(name); } - public LinkedList<CheckingError> getCheckingErrors() { + public List<CheckingError> getCheckingErrors() { return gtm.getCheckingErrors(); } - public LinkedList<CheckingError> getCheckingWarnings() { + public List<CheckingError> getCheckingWarnings() { return gtm.getCheckingWarnings(); } @@ -3680,7 +3681,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return; } - public void modelBacktracingUPPAAL(HashMap<String, Integer> verifMap) { + public void modelBacktracingUPPAAL( Map<String, Integer> verifMap) { TURTLEPanel tp = getCurrentTURTLEPanel(); if (tp == null) { return; @@ -3861,7 +3862,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe jdgaut.setVisible(true); //Update menu - Vector v = jdgaut.getFiles(); + Vector<String> v = jdgaut.getFiles(); JMenu menu = jmenubarturtle.getJMenuGraph(); menu.removeAll(); String s; @@ -3874,9 +3875,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe public void generateAUTS() { JDialogGenAUTS jdgauts = new JDialogGenAUTS(frame, this, "Generation of automata via LOTOS", gtm.getPathCaesar(), - gtm.getPathBcgio(), + GTURTLEModeling.getPathBcgio(), REMOTE_RTL_LOTOS_FILE, - gtm.getCaesarHost(), ConfigurationTTool.TGraphPath); + GTURTLEModeling.getCaesarHost(), ConfigurationTTool.TGraphPath); // jdgauts.setSize(450, 600); GraphicLib.centerOnParent(jdgauts, 450, 600); jdgauts.setVisible(true); @@ -4025,8 +4026,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe //TraceManager.addDev("After UPPAAL"); if (showWindow) { JDialogUPPAALGeneration jgen = new JDialogUPPAALGeneration(frame, this, "UPPAAL code generation", ConfigurationTTool.UPPAALCodeDirectory, JDialogUPPAALGeneration.TURTLE_MODE); - jgen.setSize(450, 600); - GraphicLib.centerOnParent(jgen); + //jgen.setSize(450, 600); + GraphicLib.centerOnParent(jgen, 450, 600); jgen.setVisible(true); //dtree.toBeUpdated(); } @@ -4073,11 +4074,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } - public LinkedList generateAllAUT(String path) { + public List<String> generateAllAUT(String path) { return gtm.generateAUT(path); } - public LinkedList generateAllLOTOS(String path) { + public List<String> generateAllLOTOS(String path) { return gtm.generateLOTOSAUT(path); } @@ -4333,7 +4334,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe gtm.getPathCaesar(), REMOTE_RTL_LOTOS_FILE, gtm.getLastRTLOTOSSpecification(), - gtm.getCaesarHost()); + GTURTLEModeling.getCaesarHost()); // jdla.setSize(450, 600); GraphicLib.centerOnParent(jdla, 450, 600); jdla.setVisible(true); @@ -4390,8 +4391,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe REMOTE_RTL_LOTOS_FILE, gtm.getLastRTLOTOSSpecification(), gtm.getHost(), - gtm.getHostAldebaran(), - gtm.getPathBcgio()); + GTURTLEModeling.getHostAldebaran(), + GTURTLEModeling.getPathBcgio()); jdfv.setAutomatic(automatic); // jdfv.setSize(450, 600); GraphicLib.centerOnParent(jdfv, 450, 600); @@ -4402,11 +4403,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe this, "Generating RG with CAESAR", gtm.getPathCaesar(), gtm.getPathCaesarOpen(), - gtm.getPathBcgio(), + GTURTLEModeling.getPathBcgio(), gtm.getPathBcgmerge(), REMOTE_RTL_LOTOS_FILE, gtm.getLastRTLOTOSSpecification(), - gtm.getCaesarHost()); + GTURTLEModeling.getCaesarHost()); jdla.setAutomatic(automatic); // jdla.setSize(450, 600); GraphicLib.centerOnParent(jdla, 450, 600); @@ -4437,7 +4438,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe REMOTE_RTL_LOTOS_FILE, gtm.getHost(), GTURTLEModeling.getHostAldebaran(), - gtm.getPathBcgio()); + GTURTLEModeling.getPathBcgio()); // jdfv.setSize(550, 600); jdfv.setIconImage(IconManager.img8); GraphicLib.centerOnParent(jdfv, 550, 600); @@ -4458,7 +4459,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe GTURTLEModeling.getHostAldebaran(), GTURTLEModeling.getPathAldebaran(), gtm.getPathBcgmin(), - gtm.getPathBcgio(), + GTURTLEModeling.getPathBcgio(), gtm.getLastRGAUT(), REMOTE_ALDEBARAN_AUT_FILE, "Minimization using Aldebaran"); @@ -4479,7 +4480,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } else { jdgm = new JDialogGraphModification(frame, GTURTLEModeling.getHostAldebaran(), - gtm.getPathBcgio(), + GTURTLEModeling.getPathBcgio(), "graph", "Minimization using Aldebaran", gtm.getLastRGAUT(), @@ -5050,7 +5051,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe TURTLEPanel tp;// = getCurrentTURTLEPanel(); TDiagramPanel tdp1; - BufferedImage image; + // BufferedImage image; File file1; String name = file.getAbsolutePath(); name = name.substring(0, name.length() - 4); @@ -5338,15 +5339,18 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe return al; } - public LinkedList getAllTMLComponents() { + public List<TGComponent> getAllTMLComponents() { TURTLEPanel tp; - LinkedList ll = new LinkedList(); + List<TGComponent> ll = new LinkedList<TGComponent>(); + for(int i=0; i<tabs.size(); i++) { tp = (TURTLEPanel)(tabs.elementAt(i)); + if (tp instanceof TMLComponentDesignPanel) { ll.addAll(((TMLComponentDesignPanel)tp).tmlctdp.getComponentList()); } } + return ll; } @@ -6296,7 +6300,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe public void generateOntologyForAllDiagrams() { TraceManager.addDev("Ontology for all diagrams"); try { - String modeling = gtm.makeXMLFromTurtleModeling(-1); + /*String modeling =*/ gtm.makeXMLFromTurtleModeling(-1); TraceManager.addDev("Model made"); } catch (Exception e) { } @@ -7093,15 +7097,13 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe mainTabbedPane.setForegroundAt(dst, fg); mainTabbedPane.setBackgroundAt(dst, bg); - Object o = tabs.elementAt(src); + TURTLEPanel o = tabs.elementAt(src); tabs.removeElementAt(src); tabs.insertElementAt(o, dst); mainTabbedPane.setSelectedIndex(dst); } - - public void requestRenameTab(int index) { String oldName = mainTabbedPane.getTitleAt(index); String s = (String)JOptionPane.showInputDialog(frame, "Name: ", "Renaming a tab", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101, null, mainTabbedPane.getTitleAt(index)); @@ -7110,7 +7112,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe if (s.compareTo(oldName) != 0) { if (isAValidTabName(s)) { mainTabbedPane.setTitleAt(index, s); - changeMade(getCurrentTDiagramPanel(), ((TURTLEPanel)(tabs.elementAt(index))).tdp.MOVE_COMPONENT); + changeMade(getCurrentTDiagramPanel(), /*((TURTLEPanel)(tabs.elementAt(index))).tdp*/TDiagramPanel.MOVE_COMPONENT); TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(index)); if ((tp instanceof TMLDesignPanel) || (tp instanceof TMLComponentDesignPanel)) { @@ -7318,12 +7320,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe AvatarDesignPanel designDiagramPanel = getFirstAvatarDesignPanelFound(); AvatarDeploymentPanelTranslator avdeploymenttranslator = new AvatarDeploymentPanelTranslator(deploymentDiagramPanel); - AvatarddSpecification avddspec = avdeploymenttranslator.getAvatarddSpecification(); + /*AvatarddSpecification avddspec =*/ avdeploymenttranslator.getAvatarddSpecification(); AvatarDesignPanelTranslator avdesigntranslator = new AvatarDesignPanelTranslator( designDiagramPanel); - LinkedList<AvatarBDStateMachineOwner> adp = designDiagramPanel.getAvatarBDPanel().getFullStateMachineOwnerList(); - AvatarSpecification avaspec = avdesigntranslator.generateAvatarSpecification(adp); + List<AvatarBDStateMachineOwner> adp = designDiagramPanel.getAvatarBDPanel().getFullStateMachineOwnerList(); + /*AvatarSpecification avaspec =*/ avdesigntranslator.generateAvatarSpecification(adp); //DG //LinkedList<AvatarComponent> components = AvatarddSpecification.getComponents(); @@ -7859,7 +7861,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe private MainGUI mgui; private JPopupMenu menu; - private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement, newTMLDesign, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, + private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement/*, newTMLDesign*/, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, newNCDesign, sort, clone, newAttackTree, newAVATARBD, newAVATARRequirement, newMAD, newTMLCP, newTMLMethodo, newAvatarMethodo, newAVATARDD, newSysmlsecMethodo; private JMenuItem newAVATARAnalysis; @@ -7903,7 +7905,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe newTMLMethodo = createMenuItem("New DIPLODOCUS Methodology"); - newTMLDesign = createMenuItem("New Partitioning - Design"); + /*newTMLDesign =*/ createMenuItem("New Partitioning - Design"); newTMLComponentDesign = createMenuItem("New Partitioning - Functional view"); newTMLArchi = createMenuItem("New Partitioning - Architecture and Mapping"); newTMLCP = createMenuItem("New Partitioning - Communication Pattern"); diff --git a/src/ui/TAttribute.java b/src/ui/TAttribute.java index 83304d727c..35112d8f45 100755 --- a/src/ui/TAttribute.java +++ b/src/ui/TAttribute.java @@ -49,8 +49,6 @@ package ui; import java.util.*; - -import myutil.*; import translator.*; import translator.tojava.*; import tmltranslator.*; @@ -199,7 +197,7 @@ public class TAttribute { } public static boolean isAValidInitialValue(int type, String value) { - boolean b; + //boolean b; int val; //TraceManager.addDev("Is A Valid Inital Value type=" + type + " value=" + value); @@ -243,7 +241,7 @@ public class TAttribute { } } - public static boolean notIn(String s, LinkedList<TAttribute> forbidden) { + public static boolean notIn(String s, List<TAttribute> forbidden) { if (forbidden == null) return true; diff --git a/src/ui/TClassInterface.java b/src/ui/TClassInterface.java index 40f9463e17..4625067f79 100755 --- a/src/ui/TClassInterface.java +++ b/src/ui/TClassInterface.java @@ -47,7 +47,7 @@ knowledge of the CeCILL license and that you accept its terms. package ui; -import java.util.LinkedList; +import java.util.List; public interface TClassInterface { @@ -55,8 +55,8 @@ public interface TClassInterface { public String getValue(); public int getId(); public boolean isStart(); - public LinkedList<TAttribute> getAttributes(); - public LinkedList<TAttribute> getGates(); + public List<TAttribute> getAttributes(); + public List<TAttribute> getGates(); //public TActivityDiagramPanel getActivityDiagramPanel(); public ActivityDiagramPanelInterface getBehaviourDiagramPanel(); diff --git a/src/ui/TClassSynchroInterface.java b/src/ui/TClassSynchroInterface.java index 477b072cbf..93950a64df 100755 --- a/src/ui/TClassSynchroInterface.java +++ b/src/ui/TClassSynchroInterface.java @@ -47,10 +47,10 @@ knowledge of the CeCILL license and that you accept its terms. package ui; -import java.util.LinkedList; +import java.util.List; import ui.cd.*; public interface TClassSynchroInterface extends TClassInterface { - public LinkedList<TAttribute> gatesNotSynchronizedOn(TCDSynchroGateList tcdsgl); + public List<TAttribute> gatesNotSynchronizedOn(TCDSynchroGateList tcdsgl); } diff --git a/src/ui/TDiagramMouseManager.java b/src/ui/TDiagramMouseManager.java index c0b0ff98ef..4572dae2e5 100755 --- a/src/ui/TDiagramMouseManager.java +++ b/src/ui/TDiagramMouseManager.java @@ -49,12 +49,9 @@ package ui; import java.awt.*; import java.awt.event.*; -import myutil.*; - import java.util.ArrayList; import ui.window.JDialogSearchBox; -import myutil.TraceManager; public class TDiagramMouseManager implements MouseListener, MouseMotionListener { @@ -88,7 +85,7 @@ public class TDiagramMouseManager implements MouseListener, MouseMotionListener private boolean isOut; //store selected components - private ArrayList selectedMultiComponents=new ArrayList<String>(); + private java.util.List<String> selectedMultiComponents=new ArrayList<String>(); // Constructor public TDiagramMouseManager(TDiagramPanel _tdp) { @@ -357,7 +354,7 @@ public class TDiagramMouseManager implements MouseListener, MouseMotionListener else { if (tdp.mgui.searchBox.isShowing()) { tdp.mgui.searchBox.addValueListKeyword(search); - tdp.mgui.searchBox.show(); + tdp.mgui.searchBox.setVisible( true ); } else{ tdp.mgui.searchBox=null; tdp.mgui.searchBox = new JDialogSearchBox(tdp.getGUI().getFrame(), "Search Box", selectedMultiComponents, this); @@ -649,7 +646,7 @@ public class TDiagramMouseManager implements MouseListener, MouseMotionListener } //Author: huytruong - public ArrayList getSelectComponents(){ + public java.util.List<String> getSelectComponents(){ return selectedMultiComponents ; } public void clearSelectComponents(){ diff --git a/src/ui/TDiagramPanel.java b/src/ui/TDiagramPanel.java index cb3770c470..b699cfb15c 100755 --- a/src/ui/TDiagramPanel.java +++ b/src/ui/TDiagramPanel.java @@ -59,6 +59,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; +import java.util.List; import java.util.Vector; import javax.swing.JMenuItem; @@ -102,8 +103,6 @@ import ui.window.JDialogCode; import ui.window.JDialogNote; import ui.window.JDialogSearchBox; - - public abstract class TDiagramPanel extends JPanel implements GenericTree { protected TDiagramMouseManager tdmm; @@ -167,7 +166,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { protected final int increment = 500; private double zoom = 1.0; - private boolean zoomed = false; + // private boolean zoomed = false; private boolean draw; @@ -191,7 +190,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { protected int y1; protected int x2; protected int y2; - protected Vector listPoint; + protected Vector<Point> listPoint; protected TGConnectingPoint p1, p2; protected int type; @@ -535,11 +534,11 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { int s = listPoint.size(); Point p3, p4; if (s > 0) { - p3 = (Point)(listPoint.elementAt(0)); + p3 = listPoint.elementAt(0); g.drawLine(p1.getX(), p1.getY(), p3.x, p3.y); for (int i=0; i< s - 1; i++) { - p3 = (Point)(listPoint.elementAt(i)); - p4 = (Point)(listPoint.elementAt(i+1)); + p3 = listPoint.elementAt(i); + p4 = listPoint.elementAt(i+1); g.drawLine(p3.x, p3.y, p4.x, p4.y); } } @@ -566,7 +565,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { }*/ public void loadFromXML(String s) { - this.componentList = new LinkedList(); + this.componentList = new LinkedList<TGComponent>(); mode = NORMAL; } @@ -616,7 +615,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { StringBuffer s; //Added by Solange to see the components in the list - LinkedList<TGComponent> ruteoList=this.componentList; + // LinkedList<TGComponent> ruteoList = this.componentList; // for (TGComponent tgc: this.componentList) @@ -889,7 +888,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { public boolean highlightInAndFreeConnectingPoint(int x, int y, int type) { TGConnectingPoint cp; - int state; + // int state; boolean b = false; boolean pointedElementFound = false; selectedConnectingPoint = null; @@ -988,7 +987,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { } } - public LinkedList<TGComponent> getComponentList() { + public List<TGComponent> getComponentList() { return this.componentList; } @@ -1005,7 +1004,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { // Adding connector public void addingTGConnector() { - listPoint = new Vector(); + listPoint = new Vector<Point>(); p1 = getSelectedTGConnectingPoint(); x1 = p1.getX(); y1 = p1.getY(); selectedConnectingPoint.setFree(false); @@ -1616,10 +1615,11 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { if (e.getSource() == setInternalComment) { JDialogNote jdn = new JDialogNote(mgui.getFrame(), "Setting an internal comment", componentPopup.getInternalComment()); GraphicLib.centerOnParent(jdn); - jdn.show(); // blocked until dialog has been closed + jdn.setVisible( true ); // blocked until dialog has been closed componentPopup.setInternalComment(jdn.getText()); mgui.changeMade(this, CHANGE_VALUE_COMPONENT); repaint(); + return; } @@ -2286,7 +2286,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { } public TGConnector getNextTGConnector(TGComponent tgc, int index) { - TGConnectingPoint pt1, pt2; + TGConnectingPoint pt1;//, pt2; pt1 = tgc.getNextTGConnectingPoint(index); @@ -2316,7 +2316,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { return null; } - public static TGComponent getComponentToWhichBelongs (LinkedList<TGComponent> components, TGConnectingPoint p) { + public static TGComponent getComponentToWhichBelongs ( List<TGComponent> components, TGConnectingPoint p) { for (TGComponent tgc1: components) { TGComponent tgc2 = tgc1.belongsToMeOrSon(p); if (tgc2 != null) @@ -2819,7 +2819,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { return v; } - public void removeSynchronizedGates(LinkedList<TAttribute> v, TClassInterface t, TCDSynchroGateList tcdsgl ) { + public void removeSynchronizedGates(List<TAttribute> v, TClassInterface t, TCDSynchroGateList tcdsgl ) { for (TGComponent tgc: this.componentList) if (tgc instanceof TCDCompositionOperatorWithSynchro) { TCDCompositionOperatorWithSynchro tgso = (TCDCompositionOperatorWithSynchro)tgc; @@ -3077,9 +3077,9 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { //TraceManager.addDev("Autoconnect"); - Vector listPoint = new Vector(); + Vector<Point> listPoint = new Vector<Point>(); - Vector v = new Vector(); + // Vector v = new Vector(); int distance = 100; TGConnectingPoint found = null; diff --git a/src/ui/TGCAttributeBox.java b/src/ui/TGCAttributeBox.java index 7ef86760c8..b39df326e4 100755 --- a/src/ui/TGCAttributeBox.java +++ b/src/ui/TGCAttributeBox.java @@ -62,8 +62,8 @@ public abstract class TGCAttributeBox extends TGCWithoutInternalComponent { protected String attributeText; protected int textX = 5; protected int textY = 20; - protected LinkedList<TAttribute> myAttributes; - protected LinkedList<TAttribute> forbiddenNames; + protected java.util.List<TAttribute> myAttributes; + protected java.util.List<TAttribute> forbiddenNames; protected Graphics myG; protected Color myColor; protected boolean attributes; @@ -91,15 +91,15 @@ public abstract class TGCAttributeBox extends TGCWithoutInternalComponent { myAttributes = new LinkedList<TAttribute> (); } - public LinkedList<TAttribute> getAttributeList() { + public java.util.List<TAttribute> getAttributeList() { return myAttributes; } - public void setAttributeList(LinkedList<TAttribute> attributes) { + public void setAttributeList(java.util.List<TAttribute> attributes) { myAttributes = attributes; } - public void setForbiddenNames(LinkedList<TAttribute> v) { + public void setForbiddenNames(java.util.List<TAttribute> v) { forbiddenNames = v; } diff --git a/src/ui/TGComponent.java b/src/ui/TGComponent.java index 40a683048b..38536a970f 100755 --- a/src/ui/TGComponent.java +++ b/src/ui/TGComponent.java @@ -53,23 +53,17 @@ import java.awt.event.*; import java.awt.geom.*; import java.util.*; -import java.util.concurrent.*; import org.w3c.dom.*; import myutil.*; import ui.procsd.ProCSDPort; -//Added by Solange import ui.procsd.ProCSDComponent; import ui.tmlad.*; import ui.tmlcd.*; import ui.tmlcompd.*; import ui.tmldd.*; -import ui.tree.*; import ui.interactivesimulation.*; -import ui.avatarbd.AvatarBDPragma; - -import tmltranslator.*; public abstract class TGComponent implements CDElement, GenericTree { @@ -113,12 +107,12 @@ public abstract class TGComponent implements CDElement, GenericTree { // DIPLODOCUS ID private int DIPLOID = -1; - private boolean DIPLO_running = false; +// private boolean DIPLO_running = false; private int DIPLO_met = 0; // AVATAR ID private int AVATARID = -1; - private boolean AVATAR_running = false; +// private boolean AVATAR_running = false; private int AVATAR_met = 0; // TEPE ID @@ -353,13 +347,14 @@ public abstract class TGComponent implements CDElement, GenericTree { return false; } - public LinkedList getAllCheckableAccessibility() { - LinkedList list = new LinkedList(); + public LinkedList<TGComponent> getAllCheckableAccessibility() { + LinkedList<TGComponent> list = new LinkedList<TGComponent>(); getAllCheckableAccessibility(list); + return list; } - public void getAllCheckableAccessibility(LinkedList _list) { + public void getAllCheckableAccessibility(LinkedList<TGComponent> _list) { if (accessibility) { _list.add(this); } @@ -413,13 +408,13 @@ public abstract class TGComponent implements CDElement, GenericTree { latencyCheck=b; } - public LinkedList getAllCheckableInvariant() { - LinkedList list = new LinkedList(); + public LinkedList<TGComponent> getAllCheckableInvariant() { + LinkedList<TGComponent> list = new LinkedList<TGComponent>(); getAllCheckableInvariant(list); return list; } - public void getAllCheckableInvariant(LinkedList _list) { + public void getAllCheckableInvariant(LinkedList<TGComponent> _list) { if (invariant) { _list.add(this); } @@ -881,7 +876,7 @@ public abstract class TGComponent implements CDElement, GenericTree { //TraceManager.addDev("Drawing diplo ID id=" + li.id); int sizeRect = 6; int sizeOval = 8; - Color c = g.getColor(); + // Color c = g.getColor(); Color myCol = new Color(135, Math.min(255, Math.max(0, (int)(255-(li.load*255)))), 0); g.setColor(myCol); g.fillRect(x, y, width, sizeRect); @@ -940,7 +935,7 @@ public abstract class TGComponent implements CDElement, GenericTree { } public void drawLatencyCheck(Graphics g, int _x, int _y){ - Color c= g.getColor(); + // Color c= g.getColor(); g.setColor(Color.BLUE); int[] xs = new int[]{_x-12,_x-4, _x-12}; int[] ys= new int[]{_y, _y+5, _y+10}; @@ -1024,7 +1019,7 @@ public abstract class TGComponent implements CDElement, GenericTree { } - if (tdp.DIPLO_ANIMATE_ON) { + if ( TDiagramPanel.DIPLO_ANIMATE_ON ) { if (breakpoint) { //System.out.println("breakpoint"); g.setColor(ColorManager.BREAKPOINT); @@ -1036,7 +1031,7 @@ public abstract class TGComponent implements CDElement, GenericTree { if (! ((this instanceof TGConnector) || (this instanceof TGCNote) || (this instanceof TMLArchiFirewallNode))) { if (tdp instanceof TMLActivityDiagramPanel) { if (getFather() == null) { - if (tdp.DIPLO_ID_ON) { + if ( TDiagramPanel.DIPLO_ID_ON ) { drawDiploID(g); } @@ -1051,13 +1046,13 @@ public abstract class TGComponent implements CDElement, GenericTree { } } else if (tdp instanceof TMLComponentTaskDiagramPanel) { if (this instanceof TMLCPrimitiveComponent) { - if (tdp.DIPLO_ID_ON) { + if ( TDiagramPanel.DIPLO_ID_ON ) { drawDiploID(g); } } } else if (tdp instanceof TMLTaskDiagramPanel) { if (getDIPLOID() != -1) { - if (tdp.DIPLO_ID_ON) { + if ( TDiagramPanel.DIPLO_ID_ON ) { drawDiploID(g); } } @@ -1075,7 +1070,7 @@ public abstract class TGComponent implements CDElement, GenericTree { }*/ } else if (tdp instanceof TMLArchiDiagramPanel) { if (getDIPLOID() != -1) { - if (tdp.DIPLO_ID_ON) { + if ( TDiagramPanel.DIPLO_ID_ON ) { drawDiploID(g); } li = tdp.getMGUI().isLoadID(getDIPLOID()); @@ -1149,12 +1144,12 @@ public abstract class TGComponent implements CDElement, GenericTree { }*/ } } - } else if (tdp.DIPLO_ID_ON) { + } else if ( TDiagramPanel.DIPLO_ID_ON ) { drawDiploID(g); - } else if (tdp.AVATAR_ID_ON) { + } else if ( TDiagramPanel.AVATAR_ID_ON ) { drawAVATARID(g); - } else if (tdp.TEPE_ID_ON) { + } else if ( TDiagramPanel.TEPE_ID_ON ) { drawTEPEID(g); } else { runningStatus=""; @@ -1162,7 +1157,7 @@ public abstract class TGComponent implements CDElement, GenericTree { } - if (tdp.AVATAR_ANIMATE_ON) { + if ( TDiagramPanel.AVATAR_ANIMATE_ON) { //TraceManager.addDev("Avatar animate?"); if (breakpoint) { //System.out.println("breakpoint"); @@ -1378,7 +1373,7 @@ public abstract class TGComponent implements CDElement, GenericTree { // operations on internal components public boolean areAllInRectangle(int x1, int y1, int width, int height) { - TGComponent tgc; + // TGComponent tgc; if (!isInRectangle(x1, y1, width, height)) { return false; @@ -1555,8 +1550,9 @@ public abstract class TGComponent implements CDElement, GenericTree { return tgcomponent[index]; } - public LinkedList getRecursiveAllInternalComponent() { - LinkedList ll = new LinkedList(); + public LinkedList<TGComponent> getRecursiveAllInternalComponent() { + LinkedList<TGComponent> ll = new LinkedList<TGComponent>(); + for(int i=0; i<nbInternalTGComponent; i++) { ll.add(tgcomponent[i]); ll.addAll(tgcomponent[i].getRecursiveAllInternalComponent()); @@ -2716,7 +2712,7 @@ public abstract class TGComponent implements CDElement, GenericTree { } public boolean belongsToMe(TGComponent t) { - TGComponent tgc; + // TGComponent tgc; for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] == t) { return true; @@ -2772,7 +2768,7 @@ public abstract class TGComponent implements CDElement, GenericTree { nbInternalTGComponent ++; TGComponent [] tgcomponentbis = new TGComponent[nbInternalTGComponent]; - TGComponent tgc; + // TGComponent tgc; for(int i=0; i<nbInternalTGComponent; i++) { if (i < index) { tgcomponentbis[i] = tgcomponent[i]; @@ -3070,7 +3066,7 @@ public abstract class TGComponent implements CDElement, GenericTree { for(int i=0; i<nbInternalTGComponent; i++) { //Added by Solange - TGComponent ruteo=tgcomponent[i]; + // TGComponent ruteo=tgcomponent[i]; if ((tgcomponent[i].getType()==TGComponentManager.PROCSD_OUT_PORT)||(tgcomponent[i].getType()==TGComponentManager.PROCSD_IN_PORT)) { //I need to save the interface of the port too diff --git a/src/ui/TGConnector.java b/src/ui/TGConnector.java index dbe101aa3e..95f1af8fe0 100755 --- a/src/ui/TGConnector.java +++ b/src/ui/TGConnector.java @@ -75,7 +75,7 @@ public abstract class TGConnector extends TGCWithInternalComponent { // WARNING: point of connectors must be put first in the list of internal components ... - public TGConnector(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) { + public TGConnector(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector<Point> _listPoint) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); p1 = _p1; p2 = _p2; @@ -86,7 +86,7 @@ public abstract class TGConnector extends TGCWithInternalComponent { Point p; //System.out.println("nbInternalTGComponent" + nbInternalTGComponent); for(int i=0; i<nbInternalTGComponent; i++) { - p = (Point)(_listPoint.elementAt(i)); + p = _listPoint.elementAt(i); //System.out.println("p.x " + p.x + " p.y" + p.y + " minX" + _minX + " maxX" + _maxX); tgcomponent[i] = new TGCPointOfConnector(p.x, p.y, _minX, _maxX, _minY, _maxY, false, this, _tdp); } @@ -96,12 +96,14 @@ public abstract class TGConnector extends TGCWithInternalComponent { removable = true; } - public Vector getListOfPoints() { - Vector v = new Vector(); - for(int i=0; i<nbInternalTGComponent; i++) { - v.add(new Point(tgcomponent[i].getX(), tgcomponent[i].getY())); - } - return v; + public Vector<Point> getListOfPoints() { + Vector<Point> v = new Vector<Point>(); + + for(int i=0; i<nbInternalTGComponent; i++) { + v.add(new Point(tgcomponent[i].getX(), tgcomponent[i].getY())); + } + + return v; } public int getIndexOfLastTGCPointOfConnector() { diff --git a/src/ui/TMLArchiPanel.java b/src/ui/TMLArchiPanel.java index b666993252..50c3cd5d02 100755 --- a/src/ui/TMLArchiPanel.java +++ b/src/ui/TMLArchiPanel.java @@ -54,7 +54,7 @@ import ui.tmldd.*; public class TMLArchiPanel extends TURTLEPanel { public TMLArchiDiagramPanel tmlap; - public Vector validated, ignored; + public Vector<TGComponent> validated, ignored; public TMLArchiPanel(MainGUI _mgui) { super(_mgui); @@ -90,7 +90,7 @@ public class TMLArchiPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmlap); tmlap.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarTML, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("DIPLODOCUS architecture and mapping Diagram", IconManager.imgic60, toolBarPanel, "Opens DIPLODOCUS architecture diagram"); diff --git a/src/ui/TMLCommunicationPatternPanel.java b/src/ui/TMLCommunicationPatternPanel.java index 65e6331383..d468db0f4b 100755 --- a/src/ui/TMLCommunicationPatternPanel.java +++ b/src/ui/TMLCommunicationPatternPanel.java @@ -51,16 +51,12 @@ import javax.swing.*; import javax.swing.event.*; import java.util.*; -import ui.iod.*; -import ui.sd.*; -import ui.ucd.*; import ui.tmlcp.*; import ui.tmlsd.*; -import myutil.*; public class TMLCommunicationPatternPanel extends TURTLEPanel { public TMLCPPanel tmlcpp; - public Vector validated, ignored; + public Vector<TGComponent> validated, ignored; public TMLCommunicationPatternPanel(MainGUI _mgui) { super(_mgui); @@ -92,7 +88,7 @@ public class TMLCommunicationPatternPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmlcpp); tmlcpp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarMainCP, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("MainCP", IconManager.imgic17, toolBarPanel, "Opens the main communication pattern"); @@ -116,7 +112,7 @@ public class TMLCommunicationPatternPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel( sdp ); sdp.jsp = jsp; jsp.setWheelScrollingEnabled( true ); - jsp.getVerticalScrollBar().setUnitIncrement( mgui.INCREMENT ); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarSequence, BorderLayout.NORTH ); toolBarPanel.add( jsp, BorderLayout.CENTER ); tabbedPane.addTab( s, IconManager.imgic18, toolBarPanel, "Open the communication pattern sequence diagram of " + s ); @@ -158,7 +154,7 @@ public class TMLCommunicationPatternPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmlcppNew); tmlcppNew.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarMainCP, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic17, toolBarPanel, "Opens communication pattern diagram"); diff --git a/src/ui/TMLComponentDesignPanel.java b/src/ui/TMLComponentDesignPanel.java index 39934522dd..c5eaab940e 100755 --- a/src/ui/TMLComponentDesignPanel.java +++ b/src/ui/TMLComponentDesignPanel.java @@ -51,18 +51,13 @@ import java.awt.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; -//import ui.tmlcd.*; import ui.tmlcompd.*; import ui.tmlad.*; import ui.tmldd.*; -import ui.tmlcd.*; -import avatartranslator.*; -import proverifspec.*; -import myutil.*; public class TMLComponentDesignPanel extends TURTLEPanel { public TMLComponentTaskDiagramPanel tmlctdp; - public Vector validated, ignored; + public Vector<TGComponent> validated, ignored; public TMLComponentDesignPanel(MainGUI _mgui) { super(_mgui); @@ -113,7 +108,7 @@ public class TMLComponentDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmladp); tmladp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarActivity, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(tmladp); @@ -140,7 +135,7 @@ public class TMLComponentDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmlctdp); tmlctdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarTML, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("TML Component Task Diagram", IconManager.imgic1208, toolBarPanel, "Opens TML component task diagram"); @@ -164,7 +159,7 @@ public class TMLComponentDesignPanel extends TURTLEPanel { return mgui.getTitleAt(this) + "(DIPLODOCUS Component Application diagram)"; } - public ArrayList<String> getAllNonMappedTMLPrimitiveComponentNames(String _name, TMLArchiDiagramPanel _tadp, boolean ref, String name) { + public java.util.List<String> getAllNonMappedTMLPrimitiveComponentNames(String _name, TMLArchiDiagramPanel _tadp, boolean ref, String name) { return tmlctdp.getAllNonMappedTMLPrimitiveComponentNames(_name, _tadp, ref, name); } @@ -172,51 +167,52 @@ public class TMLComponentDesignPanel extends TURTLEPanel { return tmlctdp.getPrimitiveComponentByName(_name); } - public ArrayList<String> getAllTMLCommunicationNames(String _name) { + public java.util.List<String> getAllTMLCommunicationNames(String _name) { return tmlctdp.getAllTMLCommunicationNames(_name); } - public ArrayList<String> getAllTMLInputPorts( String _name ) { + public java.util.List<String> getAllTMLInputPorts( String _name ) { return tmlctdp.getAllTMLInputPorts( _name ); } - public ArrayList<String> getAllTMLEventNames( String _name ) { + public java.util.List<String> getAllTMLEventNames( String _name ) { return tmlctdp.getAllTMLEventNames( _name ); } - public ArrayList<String> getAllCompositeComponent(String _name) { + public java.util.List<String> getAllCompositeComponent(String _name) { return tmlctdp.getAllCompositeComponent(_name); } - public Vector getAllTMLTasksAttributes() { + public Vector<String> getAllTMLTasksAttributes() { return tmlctdp.getAllTMLTasksAttributes(); } - public ArrayList<String> getAllTMLTaskNames(String _name) { + public java.util.List<String> getAllTMLTaskNames(String _name) { return tmlctdp.getAllTMLTaskNames(_name); } public void getListOfBreakPoints(ArrayList<Point> points) { - TGComponent tgc; - ListIterator iterator = tmlctdp.getPrimitiveComponentList().listIterator(); + // TGComponent tgc; + Iterator<TMLCPrimitiveComponent> iterator = tmlctdp.getPrimitiveComponentList().listIterator(); TMLCPrimitiveComponent tmlcpc; TMLActivityDiagramPanel tmladp; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); - if (tgc instanceof TMLCPrimitiveComponent) { - tmlcpc = (TMLCPrimitiveComponent)tgc; - if (tmlcpc.getDIPLOID() != -1) { - //System.out.println("Searching for ad of name: " + tmlcpc.getValue()); - tmladp = mgui.getReferencedTMLActivityDiagramPanel(tmlcpc.getTDiagramPanel(), tmlcpc.getValue()); - if (tmladp != null) { - tmladp.getListOfBreakPoints(points, tmlcpc.getDIPLOID()); - } else { - System.out.println("Unknown panel:" + tmlcpc.getValue()); - } + // tgc = (TGComponent)(iterator.next()); + //if (tgc instanceof TMLCPrimitiveComponent) { + tmlcpc = iterator.next(); + if (tmlcpc.getDIPLOID() != -1) { + //System.out.println("Searching for ad of name: " + tmlcpc.getValue()); + tmladp = mgui.getReferencedTMLActivityDiagramPanel(tmlcpc.getTDiagramPanel(), tmlcpc.getValue()); + if (tmladp != null) { + tmladp.getListOfBreakPoints(points, tmlcpc.getDIPLOID()); + } else { + System.out.println("Unknown panel:" + tmlcpc.getValue()); } } +// } } } + public ArrayList<String> getAllCryptoConfig(){ ArrayList<String> cryptoConfigs=new ArrayList<String>(); TMLActivityDiagramPanel tmladp; diff --git a/src/ui/TMLDesignPanel.java b/src/ui/TMLDesignPanel.java index c95954086d..f841c483cf 100755 --- a/src/ui/TMLDesignPanel.java +++ b/src/ui/TMLDesignPanel.java @@ -54,10 +54,10 @@ import java.util.*; import ui.tmlcd.*; import ui.tmlad.*; import ui.tmldd.*; -import proverifspec.*; + public class TMLDesignPanel extends TURTLEPanel { public TMLTaskDiagramPanel tmltdp; - public Vector validated, ignored; + public Vector<TGComponent> validated, ignored; public TMLDesignPanel(MainGUI _mgui) { super(_mgui); @@ -94,7 +94,7 @@ public class TMLDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmladp); tmladp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarActivity, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(tmladp); @@ -121,7 +121,7 @@ public class TMLDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmltdp); tmltdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); toolBarPanel.add(toolBarTML, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("TML Task Diagram", IconManager.imgic62, toolBarPanel, "Opens TML task diagram"); @@ -157,7 +157,7 @@ public class TMLDesignPanel extends TURTLEPanel { return tmltdp.getAllTMLEventNames( _name ); } - public ArrayList<String> getAllNonMappedTMLTaskNames(String _name, TMLArchiDiagramPanel _tadp, boolean ref, String name) { + public java.util.List<String> getAllNonMappedTMLTaskNames(String _name, TMLArchiDiagramPanel _tadp, boolean ref, String name) { return tmltdp.getAllNonMappedTMLTaskNames(_name, _tadp, ref, name); } @@ -167,15 +167,17 @@ public class TMLDesignPanel extends TURTLEPanel { public void getListOfBreakPoints(ArrayList<Point> points) { TGComponent tgc; - ListIterator iterator = tmltdp.getComponentList().listIterator(); + Iterator<TGComponent> iterator = tmltdp.getComponentList().listIterator(); TMLTaskOperator tmlto; TMLActivityDiagramPanel tmladp; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLTaskOperator) { tmlto = (TMLTaskOperator)tgc; - if (tmlto.getDIPLOID() != -1) { + + if (tmlto.getDIPLOID() != -1) { tmladp = getTMLActivityDiagramPanel(tmlto.getValue()); tmladp.getListOfBreakPoints(points, tmlto.getDIPLOID()); } diff --git a/src/ui/TURTLEPanel.java b/src/ui/TURTLEPanel.java index c9d8020ddb..4cf9dd39ac 100755 --- a/src/ui/TURTLEPanel.java +++ b/src/ui/TURTLEPanel.java @@ -47,18 +47,15 @@ package ui; import java.awt.*; -//import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; -//import ui.cd.*; -//import ui.tree.*; import myutil.*; public abstract class TURTLEPanel implements GenericTree { public JTabbedPane tabbedPane; protected MainGUI mgui; - public Vector toolbars; + public Vector<TToolBar> toolbars; public JPanel toolBarPanel; public Vector<TDiagramPanel> panels; protected ChangeListener cl; @@ -66,8 +63,8 @@ public abstract class TURTLEPanel implements GenericTree { public TURTLEPanel(MainGUI _mgui) { mgui = _mgui; - toolbars = new Vector(); - panels = new Vector(); + toolbars = new Vector<TToolBar>(); + panels = new Vector<TDiagramPanel>(); } public abstract void init(); diff --git a/src/ui/TURTLEPanelPopupListener.java b/src/ui/TURTLEPanelPopupListener.java index d162a3d6f8..4d6a528723 100755 --- a/src/ui/TURTLEPanelPopupListener.java +++ b/src/ui/TURTLEPanelPopupListener.java @@ -198,57 +198,58 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t private Action listener = new AbstractAction() { - public void actionPerformed(ActionEvent e) { - JMenuItem item = (JMenuItem)e.getSource(); - String ac = item.getActionCommand(); - if(ac.equals("Rename")) { - tp.requestRenameTab(tp.tabbedPane.getSelectedIndex()); - } else if (ac.equals("Remove")) { - tp.requestRemoveTab(tp.tabbedPane.getSelectedIndex()); - } else if (ac.equals("Move to the left")) { - tp.requestMoveLeftTab(tp.tabbedPane.getSelectedIndex()); - } else if (ac.equals("Move to the right")) { - tp.requestMoveRightTab(tp.tabbedPane.getSelectedIndex()); - } else if (ac.equals("Sort")) { - GraphicLib.sortJTabbedPane(tp.tabbedPane, tp.panels, 1, tp.tabbedPane.getTabCount()); - mgui.changeMade(null, -1); - } else if (ac.equals("New Use Case Diagram")) { - mgui.createUniqueUseCaseDiagram(tp, "Use Case Diagram"); - mgui.changeMade(null, -1); - } else if (ac.equals("New Sequence Diagram")) { - mgui.createUniqueSequenceDiagram(tp, "MyScenario"); - mgui.changeMade(null, -1); - } else if (item == newsdfromucd) { - mgui.createSequenceDiagramFromUCD(tp, "ScenarioFromUCD", (UseCaseDiagramPanel)(mgui.getCurrentTDiagramPanel())); - mgui.changeMade(null, -1); - } else if (ac.equals("New Requirement Diagram")) { - mgui.createRequirementDiagram(tp, "Requirement Diagram"); - mgui.changeMade(null, -1); - } else if (ac.equals("New Attack Tree Diagram")) { - mgui.createAttackTreeDiagram(tp, "Attack Tree"); - mgui.changeMade(null, -1); - } else if (ac.equals("New Event-Based Requirement Description Diagram")) { - mgui.createEBRDD(tp, "EBRDD"); - mgui.changeMade(null, -1); - } else if (ac.equals("New ProActive State Machine Diagram")) { - mgui.createProActiveSMD(tp, "ProActive SMD"); - mgui.changeMade(null, -1); - } else if (e.getSource() == newavatarrd) { - mgui.createAvatarRD(tp, "AVATAR RD"); - mgui.changeMade(null, -1); - } else if (e.getSource() == newavatarpd) { - mgui.createAvatarPD(tp, "AVATAR PD"); - mgui.changeMade(null, -1); - } else if (e.getSource() == newavatarcd) { - mgui.createUniqueAvatarCD(tp, "Context Diagram"); - mgui.changeMade(null, -1); - } else if (e.getSource() == newavatarad) { - mgui.createUniqueAvatarAD(tp, "Activity Diagram"); - mgui.changeMade(null, -1); - } else if (e.getSource() == newavatarmad) { - mgui.createAvatarMAD(tp, "Modeling Assumptions Diagram"); - mgui.changeMade(null, -1); - } + @Override + public void actionPerformed(ActionEvent e) { + JMenuItem item = (JMenuItem)e.getSource(); + String ac = item.getActionCommand(); + if(ac.equals("Rename")) { + tp.requestRenameTab(tp.tabbedPane.getSelectedIndex()); + } else if (ac.equals("Remove")) { + tp.requestRemoveTab(tp.tabbedPane.getSelectedIndex()); + } else if (ac.equals("Move to the left")) { + tp.requestMoveLeftTab(tp.tabbedPane.getSelectedIndex()); + } else if (ac.equals("Move to the right")) { + tp.requestMoveRightTab(tp.tabbedPane.getSelectedIndex()); + } else if (ac.equals("Sort")) { + GraphicLib.sortJTabbedPane(tp.tabbedPane, tp.panels, 1, tp.tabbedPane.getTabCount()); + mgui.changeMade(null, -1); + } else if (ac.equals("New Use Case Diagram")) { + mgui.createUniqueUseCaseDiagram(tp, "Use Case Diagram"); + mgui.changeMade(null, -1); + } else if (ac.equals("New Sequence Diagram")) { + mgui.createUniqueSequenceDiagram(tp, "MyScenario"); + mgui.changeMade(null, -1); + } else if (item == newsdfromucd) { + mgui.createSequenceDiagramFromUCD(tp, "ScenarioFromUCD", (UseCaseDiagramPanel)(mgui.getCurrentTDiagramPanel())); + mgui.changeMade(null, -1); + } else if (ac.equals("New Requirement Diagram")) { + mgui.createRequirementDiagram(tp, "Requirement Diagram"); + mgui.changeMade(null, -1); + } else if (ac.equals("New Attack Tree Diagram")) { + mgui.createAttackTreeDiagram(tp, "Attack Tree"); + mgui.changeMade(null, -1); + } else if (ac.equals("New Event-Based Requirement Description Diagram")) { + mgui.createEBRDD(tp, "EBRDD"); + mgui.changeMade(null, -1); + } else if (ac.equals("New ProActive State Machine Diagram")) { + mgui.createProActiveSMD(tp, "ProActive SMD"); + mgui.changeMade(null, -1); + } else if (e.getSource() == newavatarrd) { + mgui.createAvatarRD(tp, "AVATAR RD"); + mgui.changeMade(null, -1); + } else if (e.getSource() == newavatarpd) { + mgui.createAvatarPD(tp, "AVATAR PD"); + mgui.changeMade(null, -1); + } else if (e.getSource() == newavatarcd) { + mgui.createUniqueAvatarCD(tp, "Context Diagram"); + mgui.changeMade(null, -1); + } else if (e.getSource() == newavatarad) { + mgui.createUniqueAvatarAD(tp, "Activity Diagram"); + mgui.changeMade(null, -1); + } else if (e.getSource() == newavatarmad) { + mgui.createAvatarMAD(tp, "Modeling Assumptions Diagram"); + mgui.changeMade(null, -1); } - }; + } + }; } diff --git a/src/ui/ad/TActivityDiagramPanel.java b/src/ui/ad/TActivityDiagramPanel.java index 58cd9f76c9..f02e8928f3 100755 --- a/src/ui/ad/TActivityDiagramPanel.java +++ b/src/ui/ad/TActivityDiagramPanel.java @@ -46,12 +46,9 @@ package ui.ad; -//import java.awt.*; import java.util.*; import org.w3c.dom.*; -//import org.xml.sax.*; -//import javax.xml.parsers.*; import ui.*; @@ -148,9 +145,9 @@ public class TActivityDiagramPanel extends TDiagramPanel implements ActivityDiag public void enhance() { //System.out.println("enhance"); - Vector v = new Vector(); - Object o; - Iterator iterator = componentList.listIterator(); + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { o = iterator.next(); @@ -163,7 +160,7 @@ public class TActivityDiagramPanel extends TDiagramPanel implements ActivityDiag repaint(); } - public void enhance(Vector v, TGComponent tgc) { + public void enhance(Vector<TGComponent> v, TGComponent tgc) { TGComponent tgc1; TGConnector tgcon; int i; diff --git a/src/ui/atd/ATDAttack.java b/src/ui/atd/ATDAttack.java index 69a360a75e..8f343100da 100755 --- a/src/ui/atd/ATDAttack.java +++ b/src/ui/atd/ATDAttack.java @@ -47,7 +47,6 @@ package ui.atd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -58,9 +57,9 @@ import ui.window.*; public class ATDAttack extends TGCScalableWithInternalComponent implements SwallowedTGComponent, WithAttributes, CheckableAccessibility, CanBeDisabled { private int textY1 = 3; - private int textY2 = 3; + // private int textY2 = 3; - private static int arc = 7; + // private static int arc = 7; //private int textX = 10; protected String oldValue = ""; @@ -243,7 +242,7 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall if (!isEnabled()) { String val = "disabled"; w = g.getFontMetrics().stringWidth(val); - int h = currentFontSize + (int)(textY1 * tdp.getZoom()); + //int h = currentFontSize + (int)(textY1 * tdp.getZoom()); g.setFont(f.deriveFont(Font.ITALIC)); g.drawString(val, x + (width - w - 5), y + height - 2); } @@ -305,9 +304,9 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall boolean error = false; JDialogAttack dialog = new JDialogAttack(frame, "Setting attack attributes", this); - dialog.setSize(450, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(450, 350); + GraphicLib.centerOnParent(dialog, 450, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -371,9 +370,9 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sdescription = null; - String prio; + // String prio; String isRoot = null; for(int i=0; i<nl.getLength(); i++) { @@ -381,8 +380,8 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/atd/ATDConstraint.java b/src/ui/atd/ATDConstraint.java index 9f909456c7..fb8b9b18b2 100755 --- a/src/ui/atd/ATDConstraint.java +++ b/src/ui/atd/ATDConstraint.java @@ -47,7 +47,6 @@ package ui.atd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -68,7 +67,7 @@ public class ATDConstraint extends TGCScalableWithInternalComponent implements private static int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; - private int textX = 1; + // private int textX = 1; private static int arc = 7; @@ -114,7 +113,7 @@ public class ATDConstraint extends TGCScalableWithInternalComponent implements public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; + // Font fold = f; if (currentFontSize == -1) { currentFontSize = f.getSize(); @@ -182,13 +181,13 @@ public class ATDConstraint extends TGCScalableWithInternalComponent implements public boolean editOndoubleClick(JFrame frame) { - String tmp; - boolean error = false; +// String tmp; +// boolean error = false; JDialogConstraintText dialog = new JDialogConstraintText(frame, "Setting constraint attributes", (ConstraintListInterface)this, equation, "Equation"); - dialog.setSize(450, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(450, 350); + GraphicLib.centerOnParent(dialog, 450, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -272,18 +271,18 @@ public class ATDConstraint extends TGCScalableWithInternalComponent implements NodeList nli; Node n1, n2; Element elt; - int t1id; - String sdescription = null; - String prio; - String isRoot = null; +// int t1id; +// String sdescription = null; +// String prio; +// String isRoot = null; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatarbd/AvatarBDBlock.java b/src/ui/avatarbd/AvatarBDBlock.java index 0e477ecde4..006a5326bc 100644 --- a/src/ui/avatarbd/AvatarBDBlock.java +++ b/src/ui/avatarbd/AvatarBDBlock.java @@ -605,8 +605,8 @@ public class AvatarBDBlock extends TGCScalableWithInternalComponent implements S } JDialogAvatarBlock jdab = new JDialogAvatarBlock(this.myAttributes, this.myMethods, this.mySignals, null, frame, "Setting attributes of " + value, "Attribute", tab, globalCode, true, mainCode); setJDialogOptions(jdab); - jdab.setSize(650, 575); - GraphicLib.centerOnParent(jdab); +// jdab.setSize(650, 575); + GraphicLib.centerOnParent(jdab, 650, 575); jdab.setVisible(true); // blocked until dialog has been closed //makeValue(); //if (oldValue.equals(value)) { diff --git a/src/ui/avatarbd/AvatarBDDataType.java b/src/ui/avatarbd/AvatarBDDataType.java index 4447d83fff..aaab8f9ba7 100644 --- a/src/ui/avatarbd/AvatarBDDataType.java +++ b/src/ui/avatarbd/AvatarBDDataType.java @@ -55,7 +55,6 @@ import org.w3c.dom.*; import myutil.*; import ui.*; import ui.window.*; -import ui.avatarsmd.*; public class AvatarBDDataType extends TGCScalableWithInternalComponent implements GenericTree { @@ -69,12 +68,12 @@ public class AvatarBDDataType extends TGCScalableWithInternalComponent implement private int textX = 7; private int limitName = -1; - private int limitAttr = -1; - private int limitMethod = -1; + // private int limitAttr = -1; + // private int limitMethod = -1; // Icon private int iconSize = 15; - private boolean iconIsDrawn = false; + // private boolean iconIsDrawn = false; // TAttribute, AvatarMethod, AvatarSignal @@ -206,16 +205,17 @@ public class AvatarBDDataType extends TGCScalableWithInternalComponent implement // Icon if ((width>30) && (height > (iconSize + 2*textX))) { - iconIsDrawn = true; + // iconIsDrawn = true; g.drawImage(IconManager.img5100, x + width - iconSize - textX, y + textX, null); - } else { - iconIsDrawn = false; } +// else { +// iconIsDrawn = false; +// } int cpt = h; // Attributes if (((AvatarBDPanel)tdp).areAttributesVisible()) { - limitAttr = -1; + // limitAttr = -1; int index = 0; String attr; @@ -238,13 +238,13 @@ public class AvatarBDDataType extends TGCScalableWithInternalComponent implement w = g.getFontMetrics().stringWidth(attr); if ((w + (2 * textX) + 1) < width) { g.drawString(attr, x + textX, y + cpt); - limitAttr = y + cpt; + // limitAttr = y + cpt; } else { attr = "..."; w = g.getFontMetrics().stringWidth(attr); if ((w + textX + 2) < width) { g.drawString(attr, x + textX + 1, y + cpt); - limitAttr = y + cpt; + // limitAttr = y + cpt; } else { // skip attribute cpt -= step; @@ -252,9 +252,10 @@ public class AvatarBDDataType extends TGCScalableWithInternalComponent implement } index ++; } - } else { - limitAttr = -1; - } + } +// else { +// limitAttr = -1; +// } g.setFont(fold); @@ -332,8 +333,8 @@ public class AvatarBDDataType extends TGCScalableWithInternalComponent implement JDialogAvatarBlock jdab = new JDialogAvatarBlock(myAttributes, null, null, null, frame, "Setting attributes of " + value, "Attribute", 0, null, false, null); setJDialogOptions(jdab); - jdab.setSize(650, 575); - GraphicLib.centerOnParent(jdab); + // jdab.setSize(650, 575); + GraphicLib.centerOnParent(jdab, 650, 575); jdab.setVisible(true); // blocked until dialog has been closed //makeValue(); //if (oldValue.equals(value)) { diff --git a/src/ui/avatarbd/AvatarBDFirewall.java b/src/ui/avatarbd/AvatarBDFirewall.java index 97c65c8f9d..9242f34243 100755 --- a/src/ui/avatarbd/AvatarBDFirewall.java +++ b/src/ui/avatarbd/AvatarBDFirewall.java @@ -56,8 +56,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class AvatarBDFirewall extends TGCScalableWithoutInternalComponent { private int textY1 = 15; private int textY2 = 30; @@ -169,14 +167,12 @@ public class AvatarBDFirewall extends TGCScalableWithoutInternalComponent { public boolean editOndoubleClick(JFrame frame) { boolean error = false; String errors = ""; - int tmp; String tmpName; - // DB: commented until JDialogAvatarFirewall is added to repository JDialogAvatarFirewall dialog = new JDialogAvatarFirewall(frame, "Setting firewall attributes", this); - dialog.setSize(600, 600); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(600, 600); + GraphicLib.centerOnParent(dialog, 600, 600); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -233,7 +229,7 @@ public class AvatarBDFirewall extends TGCScalableWithoutInternalComponent { NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -241,8 +237,8 @@ public class AvatarBDFirewall extends TGCScalableWithoutInternalComponent { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; @@ -260,9 +256,9 @@ public class AvatarBDFirewall extends TGCScalableWithoutInternalComponent { if (elt.getTagName().equals("attributes")) { latency = Integer.decode(elt.getAttribute("latency")).intValue(); } - if (elt.getTagName().equals("rule")){ - rules.add(elt.getAttribute("value")); - } + if (elt.getTagName().equals("rule")){ + rules.add(elt.getAttribute("value")); + } } } } diff --git a/src/ui/avatarbd/AvatarBDLibraryFunction.java b/src/ui/avatarbd/AvatarBDLibraryFunction.java index c078f7795e..0dfbb12c78 100644 --- a/src/ui/avatarbd/AvatarBDLibraryFunction.java +++ b/src/ui/avatarbd/AvatarBDLibraryFunction.java @@ -670,8 +670,8 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent "Settings of library function " + value, "Library Function"); this.setJDialogOptions (dialog); - dialog.setSize (650, 575); - GraphicLib.centerOnParent (dialog); + // dialog.setSize (650, 575); + GraphicLib.centerOnParent (dialog,650, 575); // Focus on the right input depending on the part that was clicked. // FIXME: if nothing is displayed, focus will go on tab 2 instead of tab 0 diff --git a/src/ui/avatarbd/AvatarBDPortConnector.java b/src/ui/avatarbd/AvatarBDPortConnector.java index 4e598e6f84..2885979b50 100644 --- a/src/ui/avatarbd/AvatarBDPortConnector.java +++ b/src/ui/avatarbd/AvatarBDPortConnector.java @@ -48,7 +48,6 @@ package ui.avatarbd; import java.awt.*; -import java.awt.geom.*; import javax.swing.*; import java.util.*; @@ -57,7 +56,6 @@ import org.w3c.dom.*; import myutil.*; import ui.*; import ui.window.*; -import myutil.*; public class AvatarBDPortConnector extends TGConnectorWithCommentConnectionPoints implements ScalableTGComponent { //protected int arrowLength = 10; @@ -297,13 +295,13 @@ public class AvatarBDPortConnector extends TGConnectorWithCommentConnectionPoint AvatarBDBlock block1 = getAvatarBDBlock1(); AvatarBDBlock block2 = getAvatarBDBlock2(); - Vector v = getAssociationSignals(); + Vector v = getAssociationSignals(); JDialogSignalAssociation jdas = new JDialogSignalAssociation(frame, block1, block2, v, this, "Setting signal association"); - jdas.setSize(800, 550); - GraphicLib.centerOnParent(jdas); - jdas.show(); // blocked until dialog has been closed + //jdas.setSize(800, 550); + GraphicLib.centerOnParent(jdas, 800, 550); + jdas.setVisible( true ); // blocked until dialog has been closed if (jdas.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarbd/AvatarBDPragma.java b/src/ui/avatarbd/AvatarBDPragma.java index c5e888e0bb..d4ce33103b 100755 --- a/src/ui/avatarbd/AvatarBDPragma.java +++ b/src/ui/avatarbd/AvatarBDPragma.java @@ -75,9 +75,9 @@ public class AvatarBDPragma extends TGCScalableWithoutInternalComponent { protected Color myColor; - private Font myFont, myFontB; - private int maxFontSize = 30; - private int minFontSize = 4; + private Font myFont;//, myFontB; + // private int maxFontSize = 30; + // private int minFontSize = 4; private int currentFontSize = -1; private final String[] mPragma = {"#PublicConstant", "#PrivateConstant", "#InitialSystemKnowledge", "#InitialSessionKnowledge", "#PrivatePublicKeys", "#Public"}; private final String[] pPragma = {"#Confidentiality", "#Secret", "#SecrecyAssumption", "#Authenticity"}; @@ -162,7 +162,7 @@ public class AvatarBDPragma extends TGCScalableWithoutInternalComponent { makeValue(); } - int h = g.getFontMetrics().getHeight(); +// int h = g.getFontMetrics().getHeight(); Color c = g.getColor(); /* !!! WARNING !!! @@ -379,7 +379,7 @@ public class AvatarBDPragma extends TGCScalableWithoutInternalComponent { jdn.blockAttributeMap = abdp.getBlockStrings(true,false); jdn.blockStateMap = abdp.getBlockStrings(false,true); GraphicLib.centerOnParent(jdn); - jdn.show(); // blocked until dialog has been closed + jdn.setVisible( true ); // blocked until dialog has been closed String s = jdn.getText(); if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { diff --git a/src/ui/avatarbd/AvatarBDSafetyPragma.java b/src/ui/avatarbd/AvatarBDSafetyPragma.java index ec38f3077b..42223145ee 100644 --- a/src/ui/avatarbd/AvatarBDSafetyPragma.java +++ b/src/ui/avatarbd/AvatarBDSafetyPragma.java @@ -56,7 +56,6 @@ import org.w3c.dom.*; import myutil.*; import ui.window.*; import ui.*; -import avatartranslator.*; public class AvatarBDSafetyPragma extends TGCScalableWithoutInternalComponent { @@ -73,15 +72,15 @@ public class AvatarBDSafetyPragma extends TGCScalableWithoutInternalComponent { protected Color myColor; - private Font myFont, myFontB; - private int maxFontSize = 30; - private int minFontSize = 4; + private Font myFont;//, myFontB; +// private int maxFontSize = 30; +// private int minFontSize = 4; public final static int PROVED_TRUE = 1; public final static int PROVED_FALSE = 0; public final static int PROVED_ERROR=2; private int currentFontSize = -1; private final String[] pPragma = {"A[]", "A<>", "E[]", "E<>"}; - public HashMap<String, Integer> verifMap = new HashMap<String, Integer>(); + public Map<String, Integer> verifMap = new HashMap<String, Integer>(); protected Graphics graphics; public AvatarBDSafetyPragma(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { @@ -150,16 +149,16 @@ public class AvatarBDSafetyPragma extends TGCScalableWithoutInternalComponent { makeValue(); } - int h = g.getFontMetrics().getHeight(); + // int h = g.getFontMetrics().getHeight(); Color c = g.getColor(); int desiredWidth = minWidth; - desiredWidth = Math.max(desiredWidth, 2*g.getFontMetrics().stringWidth("Safety Pragma") + marginX+ textX); + desiredWidth = Math.max(desiredWidth, 2*g.getFontMetrics().stringWidth("Safety Pragma") + marginX+ textX); for(int i=0; i< values.length; i++) { desiredWidth = Math.max(desiredWidth, g.getFontMetrics().stringWidth(values[i]) + marginX+textX); } -// currentFontSize= 5; + int desiredHeight = (properties.size()+2)*currentFontSize + textY + 1; //TraceManager.addDev("resize: " + desiredWidth + "," + desiredHeight); @@ -257,11 +256,11 @@ public class AvatarBDSafetyPragma extends TGCScalableWithoutInternalComponent { GraphicLib.centerOnParent(jdn); AvatarBDPanel abdp = (AvatarBDPanel) tdp; jdn.blockAttributeMap = abdp.getBlockStrings(true,true); - jdn.show(); // blocked until dialog has been closed + jdn.setVisible( true ); // blocked until dialog has been closed String s = jdn.getText(); if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { - String tmp = s; + //String tmp = s; setValue(s); makeValue(); return true; @@ -306,7 +305,7 @@ public class AvatarBDSafetyPragma extends TGCScalableWithoutInternalComponent { } private void drawVerification(String s, Graphics g, int _x, int _y){ Color c = g.getColor(); - Color c1; + // Color c1; int status; if (verifMap.containsKey(s)){ status = verifMap.get(s); diff --git a/src/ui/avatardd/ADDBlockArtifact.java b/src/ui/avatardd/ADDBlockArtifact.java index 29c3151409..bd4e943dda 100755 --- a/src/ui/avatardd/ADDBlockArtifact.java +++ b/src/ui/avatardd/ADDBlockArtifact.java @@ -47,7 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -149,9 +148,9 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa boolean error = false; JDialogAvatarBlockArtifact dialog = new JDialogAvatarBlockArtifact(frame, "Setting artifact attributes", this); - dialog.setSize(400, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog, 400, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -224,17 +223,17 @@ public class ADDBlockArtifact extends TGCWithoutInternalComponent implements Swa NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sname = null, sreferenceTask = null; - String prio; + //String prio; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDBusNode.java b/src/ui/avatardd/ADDBusNode.java index a3e858f537..f01e2d6f1e 100755 --- a/src/ui/avatardd/ADDBusNode.java +++ b/src/ui/avatardd/ADDBusNode.java @@ -47,7 +47,6 @@ package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -56,8 +55,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -184,9 +181,9 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { String tmpName; JDialogADDBusNode dialog = new JDialogADDBusNode(frame, "Setting bus attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -319,7 +316,7 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -327,8 +324,12 @@ public class ADDBusNode extends ADDCommunicationNode implements WithAttributes { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + + // DB: Looks like i was used instead of j! + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); +// for(int j=0; i<nli.getLength(); i++) { +// n2 = nli.item(i); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDCPUNode.java b/src/ui/avatardd/ADDCPUNode.java index 2f36a07d9f..c28ed4e4fb 100755 --- a/src/ui/avatardd/ADDCPUNode.java +++ b/src/ui/avatardd/ADDCPUNode.java @@ -56,8 +56,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDCPUNode extends ADDNode implements SwallowTGComponent, WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -187,9 +185,9 @@ public class ADDCPUNode extends ADDNode implements SwallowTGComponent, WithAttri String tmpName; JDialogADDCPUNode dialog = new JDialogADDCPUNode(frame, "Setting CPU attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -407,13 +405,15 @@ public class ADDCPUNode extends ADDNode implements SwallowTGComponent, WithAttri } - public Vector getArtifactList() { - Vector v = new Vector(); + public Vector<ADDBlockArtifact> getArtifactList() { + Vector<ADDBlockArtifact> v = new Vector<ADDBlockArtifact>(); + for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof ADDBlockArtifact) { - v.add(tgcomponent[i]); + v.add( (ADDBlockArtifact) tgcomponent[i] ); } } + return v; } @@ -450,7 +450,7 @@ public class ADDCPUNode extends ADDNode implements SwallowTGComponent, WithAttri NodeList nli; Node n1, n2; Element elt; - int t1id; + //int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -458,8 +458,8 @@ public class ADDCPUNode extends ADDNode implements SwallowTGComponent, WithAttri //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDChannelArtifact.java b/src/ui/avatardd/ADDChannelArtifact.java index a2e66915cd..26c7476013 100755 --- a/src/ui/avatardd/ADDChannelArtifact.java +++ b/src/ui/avatardd/ADDChannelArtifact.java @@ -47,7 +47,6 @@ package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -150,9 +149,9 @@ public class ADDChannelArtifact extends TGCWithoutInternalComponent implements S boolean error = false; JDialogAvatarChannelArtifact dialog = new JDialogAvatarChannelArtifact(frame, "Setting artifact attributes", this); - dialog.setSize(650, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(650, 350); + GraphicLib.centerOnParent(dialog, 650, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -184,9 +183,9 @@ public class ADDChannelArtifact extends TGCWithoutInternalComponent implements S String newChannelName = channelName; int pos1=channelName.indexOf('('); if(pos1 != -1) { - int pos2=channelName.lastIndexOf(')'); - int pos3=channelName.indexOf('('); - int pos4=channelName.lastIndexOf('('); +// int pos2=channelName.lastIndexOf(')'); +// int pos3=channelName.indexOf('('); +// int pos4=channelName.lastIndexOf('('); newChannelName = channelName.substring(0,pos1); @@ -228,38 +227,39 @@ public class ADDChannelArtifact extends TGCWithoutInternalComponent implements S NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sname = null, fname = null, sreferenceTask = null; - String prio; + // String prio; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("info")) { svalue = elt.getAttribute("value"); sname = elt.getAttribute("channelName"); - fname = elt.getAttribute("fullChannelName"); + fname = elt.getAttribute("fullChannelName"); sreferenceTask = elt.getAttribute("referenceDiagram"); - } + if (svalue != null) { value = svalue; } if (sname != null){ channelName = sname; } - if (fname != null){ + + if (fname != null){ fullChannelName = fname; } else { - fullChannelName = channelName; - } + fullChannelName = channelName; + } if (sreferenceTask != null) { referenceDiagram = sreferenceTask; } diff --git a/src/ui/avatardd/ADDCommunicationNode.java b/src/ui/avatardd/ADDCommunicationNode.java index 06736166e3..db8330745d 100755 --- a/src/ui/avatardd/ADDCommunicationNode.java +++ b/src/ui/avatardd/ADDCommunicationNode.java @@ -47,17 +47,7 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatardd; -import java.awt.*; -import java.util.*; -import javax.swing.*; - -import org.w3c.dom.*; - -import myutil.*; import ui.*; -import ui.window.*; - -import tmltranslator.*; public abstract class ADDCommunicationNode extends ADDNode { diff --git a/src/ui/avatardd/ADDCoproMWMRNode.java b/src/ui/avatardd/ADDCoproMWMRNode.java index 40ab9ad61b..22f19fef6e 100755 --- a/src/ui/avatardd/ADDCoproMWMRNode.java +++ b/src/ui/avatardd/ADDCoproMWMRNode.java @@ -47,7 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -56,8 +55,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDCoproMWMRNode extends ADDCommunicationNode implements WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -181,9 +178,9 @@ public class ADDCoproMWMRNode extends ADDCommunicationNode implements WithAttrib String tmpName; JDialogADDCoproMWMRNode dialog = new JDialogADDCoproMWMRNode(frame, "Setting " + stereotype + " attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -383,7 +380,7 @@ public class ADDCoproMWMRNode extends ADDCommunicationNode implements WithAttrib NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null, tmp = null; for(int i=0; i<nl.getLength(); i++) { @@ -391,8 +388,9 @@ public class ADDCoproMWMRNode extends ADDCommunicationNode implements WithAttrib //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + // DB: Looks like i was used instead of j! + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDCrossbarNode.java b/src/ui/avatardd/ADDCrossbarNode.java index 05924e618f..4abdf30bd5 100755 --- a/src/ui/avatardd/ADDCrossbarNode.java +++ b/src/ui/avatardd/ADDCrossbarNode.java @@ -184,9 +184,9 @@ public class ADDCrossbarNode extends ADDCommunicationNode implements WithAttribu String tmpName; JDialogADDCrossbarNode dialog = new JDialogADDCrossbarNode(frame, "Setting crossbar attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -318,7 +318,7 @@ public class ADDCrossbarNode extends ADDCommunicationNode implements WithAttribu NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -326,8 +326,8 @@ public class ADDCrossbarNode extends ADDCommunicationNode implements WithAttribu //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDICUNode.java b/src/ui/avatardd/ADDICUNode.java index 6767b7d9c1..1a1ab377b6 100755 --- a/src/ui/avatardd/ADDICUNode.java +++ b/src/ui/avatardd/ADDICUNode.java @@ -47,7 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -56,8 +55,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDICUNode extends ADDCommunicationNode implements WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -187,9 +184,9 @@ public class ADDICUNode extends ADDCommunicationNode implements WithAttributes { String tmpName; JDialogADDICUNode dialog = new JDialogADDICUNode(frame, "Setting " + stereotype + " attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -273,7 +270,7 @@ public class ADDICUNode extends ADDCommunicationNode implements WithAttributes { NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -281,8 +278,8 @@ public class ADDICUNode extends ADDCommunicationNode implements WithAttributes { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDMemoryNode.java b/src/ui/avatardd/ADDMemoryNode.java index 56106392ee..6da4ab2167 100755 --- a/src/ui/avatardd/ADDMemoryNode.java +++ b/src/ui/avatardd/ADDMemoryNode.java @@ -47,7 +47,6 @@ package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -152,9 +151,9 @@ public abstract class ADDMemoryNode extends ADDCommunicationNode implements With String tmpName; JDialogADDMemoryNode dialog = new JDialogADDMemoryNode(frame, "Setting " + stereotype + " attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -260,7 +259,7 @@ public abstract class ADDMemoryNode extends ADDCommunicationNode implements With NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; monitored = 0; @@ -269,8 +268,8 @@ public abstract class ADDMemoryNode extends ADDCommunicationNode implements With //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDRAMNode.java b/src/ui/avatardd/ADDRAMNode.java index d41f803a8c..808d31213a 100755 --- a/src/ui/avatardd/ADDRAMNode.java +++ b/src/ui/avatardd/ADDRAMNode.java @@ -46,17 +46,9 @@ package ui.avatardd; -import java.awt.*; import java.util.*; -import javax.swing.*; -import org.w3c.dom.*; - -import myutil.*; import ui.*; -import ui.window.*; - -import tmltranslator.*; public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, WithAttributes { @@ -146,11 +138,12 @@ public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, Wit } - public Vector getArtifactList() { - Vector v = new Vector(); + public Vector<ADDChannelArtifact> getArtifactList() { + Vector<ADDChannelArtifact> v = new Vector<ADDChannelArtifact>(); + for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof ADDChannelArtifact) { - v.add(tgcomponent[i]); + v.add( (ADDChannelArtifact) tgcomponent[i] ); } } return v; diff --git a/src/ui/avatardd/ADDTTYNode.java b/src/ui/avatardd/ADDTTYNode.java index f3f32e2c37..0cc29b38ac 100755 --- a/src/ui/avatardd/ADDTTYNode.java +++ b/src/ui/avatardd/ADDTTYNode.java @@ -47,7 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -56,8 +55,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDTTYNode extends ADDNode implements WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -183,9 +180,9 @@ public class ADDTTYNode extends ADDNode implements WithAttributes { String tmpName; JDialogADDTTYNode dialog = new JDialogADDTTYNode(frame, "Setting TTY attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -253,7 +250,7 @@ public class ADDTTYNode extends ADDNode implements WithAttributes { NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -261,8 +258,8 @@ public class ADDTTYNode extends ADDNode implements WithAttributes { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDTimerNode.java b/src/ui/avatardd/ADDTimerNode.java index 73ea734550..24fc27dbf8 100755 --- a/src/ui/avatardd/ADDTimerNode.java +++ b/src/ui/avatardd/ADDTimerNode.java @@ -47,7 +47,6 @@ package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -56,8 +55,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDTimerNode extends ADDCommunicationNode implements WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -187,9 +184,9 @@ public class ADDTimerNode extends ADDCommunicationNode implements WithAttributes String tmpName; JDialogADDTimerNode dialog = new JDialogADDTimerNode(frame, "Setting " + stereotype + " attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -273,7 +270,7 @@ public class ADDTimerNode extends ADDCommunicationNode implements WithAttributes NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -281,8 +278,8 @@ public class ADDTimerNode extends ADDCommunicationNode implements WithAttributes //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatardd/ADDVgmnNode.java b/src/ui/avatardd/ADDVgmnNode.java index 480727a7ba..e984e3aea2 100755 --- a/src/ui/avatardd/ADDVgmnNode.java +++ b/src/ui/avatardd/ADDVgmnNode.java @@ -47,7 +47,6 @@ package ui.avatardd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -56,8 +55,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class ADDVgmnNode extends ADDCommunicationNode implements WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -184,9 +181,9 @@ public class ADDVgmnNode extends ADDCommunicationNode implements WithAttributes String tmpName; JDialogADDVgmnNode dialog = new JDialogADDVgmnNode(frame, "Setting vgmn attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -319,7 +316,7 @@ public class ADDVgmnNode extends ADDCommunicationNode implements WithAttributes NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -327,8 +324,8 @@ public class ADDVgmnNode extends ADDCommunicationNode implements WithAttributes //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatarmad/AvatarMADVersioningConnector.java b/src/ui/avatarmad/AvatarMADVersioningConnector.java index 7158ca4db9..435bdc79e4 100644 --- a/src/ui/avatarmad/AvatarMADVersioningConnector.java +++ b/src/ui/avatarmad/AvatarMADVersioningConnector.java @@ -47,7 +47,6 @@ package ui.avatarmad; import java.awt.*; -import java.awt.event.*; import javax.swing.*; import java.util.*; @@ -111,9 +110,9 @@ public class AvatarMADVersioningConnector extends TGConnectorWithCommentConnect public boolean editOndoubleClick(JFrame frame) { JDialogVersioningConnector jdvc = new JDialogVersioningConnector(frame, oldVersion, newVersion); - jdvc.setSize(400, 300); - GraphicLib.centerOnParent(jdvc); - jdvc.show(); // blocked until dialog has been closed + // jdvc.setSize(400, 300); + GraphicLib.centerOnParent(jdvc, 400, 300); + jdvc.setVisible( true ); // blocked until dialog has been closed if (jdvc.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java b/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java index cbb2c42341..37acee7b05 100755 --- a/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java +++ b/src/ui/avatarmethodology/AvatarMethodologyDiagramReference.java @@ -53,8 +53,6 @@ import java.awt.event.*; import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -114,7 +112,7 @@ public abstract class AvatarMethodologyDiagramReference extends TGCScalableWithI nbInternalTGComponent = 0; //tgcomponent = new TGComponent[nbInternalTGComponent]; - int h = 1; + // int h = 1; //TAttributeRequirement tgc0; //tgc0 = new TAttributeRequirement(x, y+height+h, 0, 0, height + h, height+h, true, this, _tdp); //tgcomponent[0] = tgc0; @@ -138,8 +136,8 @@ public abstract class AvatarMethodologyDiagramReference extends TGCScalableWithI public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; - int w, c; + // Font fold = f; + // int w, c; int size; value = TYPE_STR[typeOfReference]; @@ -165,7 +163,7 @@ public abstract class AvatarMethodologyDiagramReference extends TGCScalableWithI displayText = true; } - int h = g.getFontMetrics().getHeight(); + // int h = g.getFontMetrics().getHeight(); g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); g.fillRect(x, y, width, height); @@ -372,7 +370,7 @@ public abstract class AvatarMethodologyDiagramReference extends TGCScalableWithI } public boolean eventOnPopup(ActionEvent e) { - String s = e.getActionCommand(); + // String s = e.getActionCommand(); if (e.getSource() == diagramReference) { addDiagramReference(null); @@ -392,9 +390,9 @@ public abstract class AvatarMethodologyDiagramReference extends TGCScalableWithI fillIgnoredSelectedFromInternalComponents(ignored, selected); jdmlos = new JDialogManageListOfString(frame, ignored, selected, "Selection of diagrams"); - jdmlos.setSize(550, 350); - GraphicLib.centerOnParent(jdmlos); - jdmlos.show(); + //jdmlos.setSize(550, 350); + GraphicLib.centerOnParent(jdmlos, 550, 350); + jdmlos.setVisible( true ); ignored = jdmlos.getIgnored(); selected = jdmlos.getSelected(); diff --git a/src/ui/avatarpd/AvatarPDLogicalConstraint.java b/src/ui/avatarpd/AvatarPDLogicalConstraint.java index 91ea878323..ef7c0a6b28 100644 --- a/src/ui/avatarpd/AvatarPDLogicalConstraint.java +++ b/src/ui/avatarpd/AvatarPDLogicalConstraint.java @@ -47,11 +47,8 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatarpd; import java.awt.*; -import java.util.*; import javax.swing.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -121,7 +118,7 @@ public class AvatarPDLogicalConstraint extends TGCScalableWithInternalComponent public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; + // Font fold = f; if ((rescaled) && (!tdp.isScaled())) { @@ -200,13 +197,13 @@ public class AvatarPDLogicalConstraint extends TGCScalableWithInternalComponent public boolean editOndoubleClick(JFrame frame) { - String tmp; - boolean error = false; +// String tmp; +// boolean error = false; JDialogConstraint dialog = new JDialogConstraint(frame, "Setting constraint attributes", (ConstraintListInterface)this); - dialog.setSize(450, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(450, 350); + GraphicLib.centerOnParent(dialog, 450, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; diff --git a/src/ui/avatarpd/AvatarPDProperty.java b/src/ui/avatarpd/AvatarPDProperty.java index 9e9a667944..e9fc6923a3 100644 --- a/src/ui/avatarpd/AvatarPDProperty.java +++ b/src/ui/avatarpd/AvatarPDProperty.java @@ -47,7 +47,6 @@ package ui.avatarpd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -58,7 +57,7 @@ import ui.window.*; public class AvatarPDProperty extends TGCScalableWithInternalComponent implements WithAttributes { private int textY1 = 3; - private int textY2 = 3; + //private int textY2 = 3; //private int textX = 10; protected String oldValue = ""; @@ -240,8 +239,8 @@ public class AvatarPDProperty extends TGCScalableWithInternalComponent implement public boolean editOndoubleClick(JFrame frame) { String oldValue = value; JDialogAvatarProperty jdap = new JDialogAvatarProperty(frame, value, kind, not); - jdap.setSize(300, 280); - GraphicLib.centerOnParent(jdap); + // jdap.setSize(300, 280); + GraphicLib.centerOnParent(jdap, 300, 280); jdap.setVisible(true); // blocked until dialog has been closed if (jdap.hasBeenCancelled()) { diff --git a/src/ui/avatarpd/AvatarPDPropertyConnector.java b/src/ui/avatarpd/AvatarPDPropertyConnector.java index 7ab67730ac..4e881e35e0 100644 --- a/src/ui/avatarpd/AvatarPDPropertyConnector.java +++ b/src/ui/avatarpd/AvatarPDPropertyConnector.java @@ -53,11 +53,8 @@ import java.awt.geom.*; import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; -import ui.cd.*; import ui.window.*; public class AvatarPDPropertyConnector extends TGConnectorWithCommentConnectionPoints implements ScalableTGComponent { @@ -152,10 +149,10 @@ public class AvatarPDPropertyConnector extends TGConnectorWithCommentConnection } public boolean editOndoubleClick(JFrame frame) { - String oldValue = value; + // String oldValue = value; JDialogAvatarPropertyConnector jdapc = new JDialogAvatarPropertyConnector(frame, getValue().compareTo("not") == 0); - jdapc.setSize(300, 200); - GraphicLib.centerOnParent(jdapc); + // jdapc.setSize(300, 200); + GraphicLib.centerOnParent(jdapc, 300, 200); jdapc.setVisible(true); // blocked until dialog has been closed if (jdapc.hasBeenCancelled()) { diff --git a/src/ui/avatarpd/AvatarPDPropertyRelation.java b/src/ui/avatarpd/AvatarPDPropertyRelation.java index 29e4447178..509b5ea274 100644 --- a/src/ui/avatarpd/AvatarPDPropertyRelation.java +++ b/src/ui/avatarpd/AvatarPDPropertyRelation.java @@ -47,11 +47,8 @@ knowledge of the CeCILL license and that you accept its terms. package ui.avatarpd; import java.awt.*; -import java.util.*; import javax.swing.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -123,7 +120,7 @@ public class AvatarPDPropertyRelation extends TGCScalableWithInternalComponent i public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; + // Font fold = f; if ((rescaled) && (!tdp.isScaled())) { @@ -201,13 +198,13 @@ public class AvatarPDPropertyRelation extends TGCScalableWithInternalComponent i public boolean editOndoubleClick(JFrame frame) { - String tmp; - boolean error = false; +// String tmp; +// boolean error = false; JDialogConstraint dialog = new JDialogConstraint(frame, "Setting constraint attributes", (ConstraintListInterface)this); - dialog.setSize(450, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(450, 350); + GraphicLib.centerOnParent(dialog, 450, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; diff --git a/src/ui/avatarrd/AvatarRDRequirement.java b/src/ui/avatarrd/AvatarRDRequirement.java index c9bcc57a81..cb0c8b014d 100755 --- a/src/ui/avatarrd/AvatarRDRequirement.java +++ b/src/ui/avatarrd/AvatarRDRequirement.java @@ -70,7 +70,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem //protected int iconSize = 30; private Font myFont, myFontB; - private int maxFontSize = 30; + // private int maxFontSize = 30; private int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; @@ -111,7 +111,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem // Icon private int iconSize = 18; - private boolean iconIsDrawn = false; + // private boolean iconIsDrawn = false; public AvatarRDRequirement(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); @@ -174,7 +174,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem nbInternalTGComponent = 0; //tgcomponent = new TGComponent[nbInternalTGComponent]; - int h = 1; +// int h = 1; //TAttributeRequirement tgc0; //tgc0 = new TAttributeRequirement(x, y+height+h, 0, 0, height + h, height+h, true, this, _tdp); //tgcomponent[0] = tgc0; @@ -212,8 +212,8 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; - int w, c; + // Font fold = f; + // int w, c; int size; if (texts == null) { @@ -241,7 +241,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem displayText = true; } - int h = g.getFontMetrics().getHeight(); + // int h = g.getFontMetrics().getHeight(); g.drawRect(x, y, width, height); @@ -263,7 +263,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem size += currentFontSize; g.setFont(myFontB); - w = g.getFontMetrics().stringWidth(value); + // w = g.getFontMetrics().stringWidth(value); drawLimitedString(g, value, x, y + size, width, 1); } @@ -418,9 +418,9 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem } JDialogRequirement jdr = new JDialogRequirement(tdp.getGUI().getFrame(), "Setting attributes of Requirement " + getRequirementName(), id, text, kind, criticality, va, reqType, atn, referenceElements); - jdr.setSize(750, 400); - GraphicLib.centerOnParent(jdr); - jdr.show(); + // jdr.setSize(750, 400); + GraphicLib.centerOnParent(jdr, 750, 400); + jdr.setVisible( true ); if (!jdr.isRegularClose()) { return false; @@ -535,7 +535,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem } public boolean eventOnPopup(ActionEvent e) { - String s = e.getActionCommand(); + // String s = e.getActionCommand(); if (e.getSource() == menuNonSatisfied) { satisfied = false; diff --git a/src/ui/avatarsmd/AvatarSMDExpireTimer.java b/src/ui/avatarsmd/AvatarSMDExpireTimer.java index e9956b0437..74eee38370 100644 --- a/src/ui/avatarsmd/AvatarSMDExpireTimer.java +++ b/src/ui/avatarsmd/AvatarSMDExpireTimer.java @@ -52,8 +52,6 @@ import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -193,9 +191,9 @@ public class AvatarSMDExpireTimer extends AvatarSMDBasicComponent implements Bas TraceManager.addDev("Nb of timers:" + timers.size()); JDialogAvatarTimer jdat = new JDialogAvatarTimer(frame, "Timer expiration", getTimerName(), "", timers, false); - jdat.setSize(350, 300); - GraphicLib.centerOnParent(jdat); - jdat.show(); // blocked until dialog has been closed + // jdat.setSize(350, 300); + GraphicLib.centerOnParent(jdat, 350, 300); + jdat.setVisible( true ); // blocked until dialog has been closed if (jdat.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarsmd/AvatarSMDLibraryFunctionCall.java b/src/ui/avatarsmd/AvatarSMDLibraryFunctionCall.java index 4f614f8467..5768175039 100644 --- a/src/ui/avatarsmd/AvatarSMDLibraryFunctionCall.java +++ b/src/ui/avatarsmd/AvatarSMDLibraryFunctionCall.java @@ -41,7 +41,6 @@ package ui.avatarsmd; import java.util.LinkedList; import java.awt.Graphics; -import java.awt.Font; import java.awt.Color; import javax.swing.JFrame; @@ -150,11 +149,11 @@ public class AvatarSMDLibraryFunctionCall extends TGCScalableWithoutInternalComp return; int stringWidth = this.tdp.stringWidth (graph, this.value); - if (stringWidth + 2*AvatarSMDLibraryFunctionCall.paddingHorizontal >= this.width-2*this.linebreak) { + if (stringWidth + 2*AvatarSMDLibraryFunctionCall.paddingHorizontal >= this.width-2*linebreak) { for (int stringLength = this.value.length ()-1; stringLength >= 0; stringLength--) { String abbrev = this.value.substring (0, stringLength) + "..."; int w = this.tdp.stringWidth (graph, abbrev); - if (w + 2*AvatarSMDLibraryFunctionCall.paddingHorizontal < this.width-2*this.linebreak) { + if (w + 2*AvatarSMDLibraryFunctionCall.paddingHorizontal < this.width-2*linebreak) { graph.drawString (abbrev, this.x + (this.width - w)/2, this.y + (this.height+h)/2); break; } @@ -194,10 +193,10 @@ public class AvatarSMDLibraryFunctionCall extends TGCScalableWithoutInternalComp this, frame, "Setting of library function call"); - dialog.setSize (650, 590); - GraphicLib.centerOnParent(dialog); + //dialog.setSize (650, 590); + GraphicLib.centerOnParent(dialog, 650, 590); - dialog.show(); // blocked until dialog has been closed + dialog.setVisible( true ); // blocked until dialog has been closed return true; } diff --git a/src/ui/avatarsmd/AvatarSMDRandom.java b/src/ui/avatarsmd/AvatarSMDRandom.java index 248ed2fa88..cc2756112a 100755 --- a/src/ui/avatarsmd/AvatarSMDRandom.java +++ b/src/ui/avatarsmd/AvatarSMDRandom.java @@ -135,13 +135,13 @@ public class AvatarSMDRandom extends AvatarSMDBasicComponent implements Embedde public boolean editOndoubleClick(JFrame frame) { boolean error = false; String errors = ""; - int tmp; + //int tmp; String tmpName; JDialogTMLADRandom dialog = new JDialogTMLADRandom(frame, "Setting RANDOM attributes", getVariable(), getMinValue(), getMaxValue(), getFunctionId()); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -241,7 +241,7 @@ public class AvatarSMDRandom extends AvatarSMDBasicComponent implements Embedde NodeList nli; Node n1, n2; Element elt; - int k; + // int k; String s; //System.out.println("Loading Synchronization gates"); @@ -252,8 +252,8 @@ public class AvatarSMDRandom extends AvatarSMDBasicComponent implements Embedde //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/avatarsmd/AvatarSMDReceiveSignal.java b/src/ui/avatarsmd/AvatarSMDReceiveSignal.java index 35c8ac8371..628091304f 100644 --- a/src/ui/avatarsmd/AvatarSMDReceiveSignal.java +++ b/src/ui/avatarsmd/AvatarSMDReceiveSignal.java @@ -51,8 +51,6 @@ import java.awt.geom.*; import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -226,9 +224,9 @@ public class AvatarSMDReceiveSignal extends AvatarSMDBasicComponent implements C TraceManager.addDev("Nb of signals:" + signals.size()); JDialogAvatarSignal jdas = new JDialogAvatarSignal(frame, "Setting receive signal", value, signals, false); - jdas.setSize(350, 300); - GraphicLib.centerOnParent(jdas); - jdas.show(); // blocked until dialog has been closed + //jdas.setSize(350, 300); + GraphicLib.centerOnParent(jdas, 350, 300); + jdas.setVisible( true ); // blocked until dialog has been closed if (jdas.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarsmd/AvatarSMDResetTimer.java b/src/ui/avatarsmd/AvatarSMDResetTimer.java index e64d80e417..bfd106d458 100644 --- a/src/ui/avatarsmd/AvatarSMDResetTimer.java +++ b/src/ui/avatarsmd/AvatarSMDResetTimer.java @@ -52,8 +52,6 @@ import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -189,9 +187,9 @@ public class AvatarSMDResetTimer extends AvatarSMDBasicComponent implements Basi TraceManager.addDev("Nb of timers:" + timers.size()); JDialogAvatarTimer jdat = new JDialogAvatarTimer(frame, "Reset timer", getTimerName(), "", timers, false); - jdat.setSize(350, 300); - GraphicLib.centerOnParent(jdat); - jdat.show(); // blocked until dialog has been closed + //jdat.setSize(350, 300); + GraphicLib.centerOnParent(jdat, 350, 300); + jdat.setVisible( true ); // blocked until dialog has been closed if (jdat.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarsmd/AvatarSMDSendSignal.java b/src/ui/avatarsmd/AvatarSMDSendSignal.java index fbfbdd37e1..1a0435b6c5 100644 --- a/src/ui/avatarsmd/AvatarSMDSendSignal.java +++ b/src/ui/avatarsmd/AvatarSMDSendSignal.java @@ -52,8 +52,6 @@ import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -224,9 +222,9 @@ public class AvatarSMDSendSignal extends AvatarSMDBasicComponent implements Chec //TraceManager.addDev("Nb of signals:" + signals.size()); JDialogAvatarSignal jdas = new JDialogAvatarSignal(frame, "Setting send signal", value, signals, true); - jdas.setSize(350, 300); - GraphicLib.centerOnParent(jdas); - jdas.show(); // blocked until dialog has been closed + // jdas.setSize(350, 300); + GraphicLib.centerOnParent(jdas, 350, 300); + jdas.setVisible( true ); // blocked until dialog has been closed if (jdas.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarsmd/AvatarSMDSetTimer.java b/src/ui/avatarsmd/AvatarSMDSetTimer.java index 8b37ea6ac2..b302328678 100644 --- a/src/ui/avatarsmd/AvatarSMDSetTimer.java +++ b/src/ui/avatarsmd/AvatarSMDSetTimer.java @@ -52,8 +52,6 @@ import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -195,9 +193,9 @@ public class AvatarSMDSetTimer extends AvatarSMDBasicComponent implements BasicE TraceManager.addDev("Nb of timers:" + timers.size()); JDialogAvatarTimer jdat = new JDialogAvatarTimer(frame, "Setting timer set", getTimerName(), getTimerValue(), timers, true); - jdat.setSize(350, 300); - GraphicLib.centerOnParent(jdat); - jdat.show(); // blocked until dialog has been closed + // jdat.setSize(350, 300); + GraphicLib.centerOnParent(jdat, 350, 300); + jdat.setVisible( true ); // blocked until dialog has been closed if (jdat.hasBeenCancelled()) { return false; diff --git a/src/ui/avatarsmd/AvatarSMDTransitionInfo.java b/src/ui/avatarsmd/AvatarSMDTransitionInfo.java index 75e91ad4cc..691a30702c 100755 --- a/src/ui/avatarsmd/AvatarSMDTransitionInfo.java +++ b/src/ui/avatarsmd/AvatarSMDTransitionInfo.java @@ -60,8 +60,8 @@ import ui.window.*; public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent { - private static String FILE_INFO = "(user files specified)"; - private static String CODE_INFO = "(user code specified)"; +// private static String FILE_INFO = "(user files specified)"; + // private static String CODE_INFO = "(user code specified)"; protected String guard; @@ -270,9 +270,9 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent { LinkedList<TAttribute> attributes = tdp.getMGUI().getAllAttributes(); LinkedList<AvatarMethod> methods = tdp.getMGUI().getAllMethods(); JDialogAvatarTransition jdat = new JDialogAvatarTransition(frame, "Setting transition parameters", guard, afterMin, afterMax, computeMin, computeMax, listOfActions, attributes, methods, filesToInclude, codeToInclude); - jdat.setSize(600, 550); - GraphicLib.centerOnParent(jdat); - jdat.show(); // blocked until dialog has been closed + // jdat.setSize(600, 550); + GraphicLib.centerOnParent(jdat, 600, 550); + jdat.setVisible( true ); // blocked until dialog has been closed if (jdat.hasBeenCancelled()) { @@ -360,8 +360,8 @@ public class AvatarSMDTransitionInfo extends TGCWithoutInternalComponent { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element)n2; diff --git a/src/ui/cd/TCDAttributeBox.java b/src/ui/cd/TCDAttributeBox.java index 22892e2723..b0ef717590 100755 --- a/src/ui/cd/TCDAttributeBox.java +++ b/src/ui/cd/TCDAttributeBox.java @@ -87,11 +87,11 @@ public class TCDAttributeBox extends TGCAttributeBox { jda.enableJavaKeyword(false); //jda.enableOtherTypes(true); - LinkedList ll = tdp.getComponentList(); - Iterator iterator = ll.listIterator(); + List<TGComponent> ll = tdp.getComponentList(); + Iterator<TGComponent> iterator = ll.listIterator(); TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TCDTData) { jda.addType(tgc.getValue(), false); } diff --git a/src/ui/cd/TCDReducedAttributeBox.java b/src/ui/cd/TCDReducedAttributeBox.java index 32bc2f615e..0985000b70 100755 --- a/src/ui/cd/TCDReducedAttributeBox.java +++ b/src/ui/cd/TCDReducedAttributeBox.java @@ -79,7 +79,7 @@ public class TCDReducedAttributeBox extends TGCReducedAttributeBox { protected void setJDialogOptions(JDialogReducedAttribute jda) { } - protected LinkedList<TAttribute> getCustomAttributes() { + protected List<TAttribute> getCustomAttributes() { TCDTObject to = (TCDTObject)(getFather()); TCDTClass tc = to.getMasterTClass(); return tc.getAttributes(); diff --git a/src/ui/cd/TCDReducedAttributeGateBox.java b/src/ui/cd/TCDReducedAttributeGateBox.java index 7f78e35788..07aea5e64f 100755 --- a/src/ui/cd/TCDReducedAttributeGateBox.java +++ b/src/ui/cd/TCDReducedAttributeGateBox.java @@ -48,7 +48,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.cd; import java.awt.*; -import java.util.*; import ui.*; import ui.window.*; @@ -100,7 +99,7 @@ public class TCDReducedAttributeGateBox extends TGCReducedAttributeBox { ColorManager.setColor(g, getState(), 0); } - protected LinkedList<TAttribute> getCustomAttributes() { + protected java.util.List<TAttribute> getCustomAttributes() { TCDTObject to = (TCDTObject)(getFather()); TCDTClass tc = to.getMasterTClass(); return tc.getGates(); diff --git a/src/ui/cd/TCDSynchroGateList.java b/src/ui/cd/TCDSynchroGateList.java index f41f1ff768..4082bc0d76 100755 --- a/src/ui/cd/TCDSynchroGateList.java +++ b/src/ui/cd/TCDSynchroGateList.java @@ -228,9 +228,9 @@ public class TCDSynchroGateList extends TGCWithoutInternalComponent { String oldValue = value; JDialogSynchro jda = new JDialogSynchro(frame, t1, t2, gates, this, "Setting synchronization gates"); - jda.setSize(750, 400); - GraphicLib.centerOnParent(jda); - jda.show(); // blocked until dialog has been closed + // jda.setSize(750, 400); + GraphicLib.centerOnParent(jda, 750, 400); + jda.setVisible( true ); // blocked until dialog has been closed makeValue(); @@ -278,8 +278,8 @@ public class TCDSynchroGateList extends TGCWithoutInternalComponent { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/cd/TCDTClass.java b/src/ui/cd/TCDTClass.java index ed9c6272a5..a149cfb1e1 100755 --- a/src/ui/cd/TCDTClass.java +++ b/src/ui/cd/TCDTClass.java @@ -129,7 +129,7 @@ public class TCDTClass extends TGCWithInternalComponent implements TClassInterfa public void recalculateSize() { //System.out.println("Recalculate size of " + this); - int i, j; + int i;//, j; for(i=0; i<nbInternalTGComponent; i++) { tgcomponent[i].calculateMyDesiredSize(); @@ -167,13 +167,13 @@ public class TCDTClass extends TGCWithInternalComponent implements TClassInterfa return minDesiredWidth; } - - private int calculateDesiredWidth() { - int w = Math.max(minDesiredWidth, tgcomponent[0].getMinDesiredWidth()); - w = Math.max(w, tgcomponent[1].getMinDesiredWidth()); - return w; - } - +// +// private int calculateDesiredWidth() { +// int w = Math.max(minDesiredWidth, tgcomponent[0].getMinDesiredWidth()); +// w = Math.max(w, tgcomponent[1].getMinDesiredWidth()); +// return w; +// } +// public void internalDrawing(Graphics g) { if (!tdp.isScaled()) { @@ -182,7 +182,7 @@ public class TCDTClass extends TGCWithInternalComponent implements TClassInterfa //System.out.println("My width = " + width + " this=" + this); Font f = g.getFont(); - int size = f.getSize(); + // int size = f.getSize(); g.drawRect(x, y, width, height); g.setColor(Color.yellow); g.fillRect(x+1, y+1, width-1, height-1); @@ -293,11 +293,11 @@ public class TCDTClass extends TGCWithInternalComponent implements TClassInterfa return TGComponentManager.TCD_TCLASS; } - public LinkedList<TAttribute> getAttributes(){ + public java.util.List<TAttribute> getAttributes(){ return ((TGCAttributeBox)(tgcomponent[0])).getAttributeList(); } - public LinkedList<TAttribute> getGates() { + public java.util.List<TAttribute> getGates() { return ((TGCAttributeBox)(tgcomponent[1])).getAttributeList(); } @@ -310,19 +310,19 @@ public class TCDTClass extends TGCWithInternalComponent implements TClassInterfa ((TGCAttributeBox)(tgcomponent[0])).setAttributeList(attributes); } - public void setGates(LinkedList<TAttribute> gates) { + public void setGates(java.util.List<TAttribute> gates) { ((TGCAttributeBox)(tgcomponent[1])).setAttributeList(gates); } // builds a new LinkedList - public LinkedList<TAttribute> gatesNotSynchronizedOn(TCDSynchroGateList tcdsgl) { - LinkedList<TAttribute> v = (LinkedList<TAttribute>)(getGates().clone()); + public java.util.List<TAttribute> gatesNotSynchronizedOn(TCDSynchroGateList tcdsgl) { + java.util.List<TAttribute> v = new LinkedList<TAttribute>( getGates() );//.clone()); tdp.removeSynchronizedGates(v, this, tcdsgl); return v; } public TAttribute getGateById(String name) { - LinkedList<TAttribute> list = ((TGCAttributeBox)(tgcomponent[1])).getAttributeList(); + java.util.List<TAttribute> list = ((TGCAttributeBox)(tgcomponent[1])).getAttributeList(); for (TAttribute ta: list) if (ta.getId().equals(name)) return ta; diff --git a/src/ui/cd/TCDTData.java b/src/ui/cd/TCDTData.java index 4527a8673f..ae07cd4cc5 100755 --- a/src/ui/cd/TCDTData.java +++ b/src/ui/cd/TCDTData.java @@ -170,7 +170,7 @@ public class TCDTData extends TGCWithInternalComponent { public void recalculateSize() { //System.out.println("Recalculate size of " + this); - int i, j; + int i;//, j; for(i=0; i<nbInternalTGComponent; i++) { tgcomponent[i].calculateMyDesiredSize(); @@ -208,12 +208,12 @@ public class TCDTData extends TGCWithInternalComponent { minDesiredWidth = Math.max(size, minWidth); return minDesiredWidth; } - - private int calculateDesiredWidth() { - int w = Math.max(minDesiredWidth, tgcomponent[0].getMinDesiredWidth()); - w = Math.max(w, tgcomponent[1].getMinDesiredWidth()); - return w; - } +// +// private int calculateDesiredWidth() { +// int w = Math.max(minDesiredWidth, tgcomponent[0].getMinDesiredWidth()); +// w = Math.max(w, tgcomponent[1].getMinDesiredWidth()); +// return w; +// } public void internalDrawing(Graphics g) { @@ -229,7 +229,7 @@ public class TCDTData extends TGCWithInternalComponent { graphics = g; } Font f = g.getFont(); - int size = f.getSize(); + //int size = f.getSize(); g.drawRect(x, y, width, height); g.setColor(Color.yellow); g.fillRect(x+1, y+1, width-1, height-1); @@ -298,8 +298,8 @@ public class TCDTData extends TGCWithInternalComponent { ((TCDReducedAttributeBox)tgcomponent[0]).checkMySize(); } - public void updateAttributes(LinkedList<TAttribute> v) { - LinkedList<TAttribute> setV = ((TCDReducedAttributeBox)tgcomponent[0]).getAttributes(); + public void updateAttributes( java.util.List<TAttribute> v) { + java.util.List<TAttribute> setV = ((TCDReducedAttributeBox)tgcomponent[0]).getAttributes(); int size = setV.size(); // adapt old vector to the new attributes @@ -338,7 +338,7 @@ public class TCDTData extends TGCWithInternalComponent { return TGComponentManager.TCD_TDATA; } - public LinkedList<TAttribute> getAttributes(){ + public java.util.List<TAttribute> getAttributes(){ return ((TGCAttributeBox)(tgcomponent[0])).getAttributeList(); } diff --git a/src/ui/cd/TCDTObject.java b/src/ui/cd/TCDTObject.java index 28a6a1d725..c38e6bf144 100755 --- a/src/ui/cd/TCDTObject.java +++ b/src/ui/cd/TCDTObject.java @@ -158,7 +158,7 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf public void recalculateSize() { //System.out.println("Recalculate size of " + this); - int i, j; + int i;//, j; for(i=0; i<nbInternalTGComponent; i++) { tgcomponent[i].calculateMyDesiredSize(); @@ -212,7 +212,7 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf graphics = g; } Font f = g.getFont(); - int size = f.getSize(); + // int size = f.getSize(); g.drawRect(x, y, width, height); g.setColor(Color.yellow); g.fillRect(x+1, y+1, width-1, height-1); @@ -236,9 +236,9 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf TCDTClass oldMasterTClass = masterTClass; JDialogTObjectName jd = new JDialogTObjectName(this, frame, "Setting the name and class"); - jd.setSize(325, 275); - GraphicLib.centerOnParent(jd); - jd.show(); // blocked until dialog has been closed + //jd.setSize(325, 275); + GraphicLib.centerOnParent(jd, 325, 275); + jd.setVisible( true ); // blocked until dialog has been closed // check for any change @@ -304,8 +304,8 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf return true; } - public void resetAttributes(LinkedList<TAttribute> v) { - LinkedList<TAttribute> setV = new LinkedList<TAttribute> (); + public void resetAttributes(java.util.List<TAttribute> v) { + java.util.List<TAttribute> setV = new LinkedList<TAttribute> (); for (TAttribute ta: v) setV.add (ta.makeClone()); @@ -313,8 +313,8 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf ((TCDReducedAttributeBox)tgcomponent[0]).checkMySize(); } - public void resetGates(LinkedList<TAttribute> v) { - LinkedList<TAttribute> setV = new LinkedList<TAttribute> (); + public void resetGates(java.util.List<TAttribute> v) { + java.util.List<TAttribute> setV = new LinkedList<TAttribute> (); for (TAttribute ta: v) setV.add (ta.makeClone()); @@ -322,8 +322,8 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf ((TCDReducedAttributeGateBox)tgcomponent[1]).checkMySize(); } - public void updateAttributes(LinkedList<TAttribute> v) { - LinkedList<TAttribute> setV = ((TCDReducedAttributeBox)tgcomponent[0]).getAttributes(); + public void updateAttributes( java.util.List<TAttribute> v) { + java.util.List<TAttribute> setV = ((TCDReducedAttributeBox)tgcomponent[0]).getAttributes(); int size = setV.size(); // adapt old vector to the new attributes @@ -350,8 +350,8 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf ((TCDReducedAttributeBox)tgcomponent[0]).checkMySize(); } - public void updateGates(LinkedList<TAttribute> v) { - LinkedList<TAttribute> setV = ((TCDReducedAttributeGateBox)tgcomponent[1]).getAttributes(); + public void updateGates( java.util.List<TAttribute> v) { + java.util.List<TAttribute> setV = ((TCDReducedAttributeGateBox)tgcomponent[1]).getAttributes(); int size = setV.size(); // adapt old vector to the new attributes @@ -419,23 +419,23 @@ public class TCDTObject extends TGCWithInternalComponent implements TClassInterf return TGComponentManager.TCD_TOBJECT; } - public LinkedList<TAttribute> getAttributes(){ + public java.util.List<TAttribute> getAttributes(){ return ((TGCReducedAttributeBox)(tgcomponent[0])).getAttributes(); } - public LinkedList<TAttribute> getGates() { + public java.util.List<TAttribute> getGates() { return ((TGCReducedAttributeBox)(tgcomponent[1])).getAttributes(); } // builds a new LinkedList - public LinkedList<TAttribute> gatesNotSynchronizedOn(TCDSynchroGateList tcdsgl) { - LinkedList<TAttribute> v = (LinkedList<TAttribute>)(getGates().clone()); + public java.util.List<TAttribute> gatesNotSynchronizedOn(TCDSynchroGateList tcdsgl) { + java.util.List<TAttribute> v = new LinkedList<TAttribute>( getGates() );//.clone()); tdp.removeSynchronizedGates(v, this, tcdsgl); return v; } public TAttribute getGateById(String name) { - LinkedList<TAttribute> list = ((TGCReducedAttributeBox)(tgcomponent[1])).getAttributes(); + java.util.List<TAttribute> list = ((TGCReducedAttributeBox)(tgcomponent[1])).getAttributes(); for (TAttribute ta: list) if (ta.getId().equals(name)) return ta; diff --git a/src/ui/cd/TClassDiagramPanel.java b/src/ui/cd/TClassDiagramPanel.java index a10b81105d..1b85b89a83 100755 --- a/src/ui/cd/TClassDiagramPanel.java +++ b/src/ui/cd/TClassDiagramPanel.java @@ -53,7 +53,6 @@ import org.w3c.dom.*; import ui.*; -import translator.*; public class TClassDiagramPanel extends TDiagramPanel implements ClassDiagramPanelInterface { @@ -139,10 +138,11 @@ public class TClassDiagramPanel extends TDiagramPanel implements ClassDiagramPan public void makePostLoadingProcessing() throws MalformedModelingException { TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TCDTObject) { ((TCDTObject)tgc).postLoadingProcessing(); } @@ -151,10 +151,11 @@ public class TClassDiagramPanel extends TDiagramPanel implements ClassDiagramPan public TCDTData findTData(String name) { TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TCDTData) { if (tgc.getValue().equals(name)) { return (TCDTData)tgc; @@ -167,10 +168,11 @@ public class TClassDiagramPanel extends TDiagramPanel implements ClassDiagramPan public TCDTClass getTCDTClass(String name) { TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TCDTClass) { if (((TCDTClass)tgc).getClassName().equals(name)) { return (TCDTClass)tgc; @@ -265,7 +267,7 @@ public class TClassDiagramPanel extends TDiagramPanel implements ClassDiagramPan DesignPanel dp = (DesignPanel)(mgui.getCurrentTURTLEPanel()); DesignPanelTranslator dpt = new DesignPanelTranslator(dp); - TURTLEModeling tm = dpt.generateTURTLEModeling(tclasses, ""); + /*TURTLEModeling tm =*/ dpt.generateTURTLEModeling(tclasses, ""); /*String name = tgc.getClassName(); tdp = (TDiagramPanel)(tgc.getBehaviourDiagramPanel()); diff --git a/src/ui/cd/TGCReducedAttributeBox.java b/src/ui/cd/TGCReducedAttributeBox.java index 4fd90adc39..cce1c3da1b 100755 --- a/src/ui/cd/TGCReducedAttributeBox.java +++ b/src/ui/cd/TGCReducedAttributeBox.java @@ -61,7 +61,7 @@ public abstract class TGCReducedAttributeBox extends TGCWithoutInternalComponent protected String attributeText; protected int textX = 5; protected int textY = 20; - protected LinkedList<TAttribute> myAttributes; + protected java.util.List<TAttribute> myAttributes; protected Graphics myG; protected Color myColor; protected boolean attributes; @@ -89,11 +89,11 @@ public abstract class TGCReducedAttributeBox extends TGCWithoutInternalComponent myAttributes = new LinkedList<TAttribute> (); } - public LinkedList<TAttribute> getAttributes() { + public java.util.List<TAttribute> getAttributes() { return myAttributes; } - public void setAttributes(LinkedList<TAttribute> v) { + public void setAttributes( java.util.List<TAttribute> v) { myAttributes = v; } @@ -207,15 +207,15 @@ public abstract class TGCReducedAttributeBox extends TGCWithoutInternalComponent JDialogReducedAttribute jda = new JDialogReducedAttribute(myAttributes, getCustomAttributes(), frame, "Setting initial values of " + attributeText + "s of " + father.getValue(), attributeText, to.getObjectName(), tc.getClassName()); setJDialogOptions(jda); - jda.setSize(650, 375); - GraphicLib.centerOnParent(jda); - jda.show(); // blocked until dialog has been closed + // jda.setSize(650, 375); + GraphicLib.centerOnParent(jda, 650, 375); + jda.setVisible( true ); // blocked until dialog has been closed return true; } protected abstract void setJDialogOptions(JDialogReducedAttribute jda); - protected abstract LinkedList<TAttribute> getCustomAttributes(); + protected abstract java.util.List<TAttribute> getCustomAttributes(); public TGComponent isOnMe(int x1, int y1) { if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { diff --git a/src/ui/dd/TDDArtifact.java b/src/ui/dd/TDDArtifact.java index e782209640..89522deada 100755 --- a/src/ui/dd/TDDArtifact.java +++ b/src/ui/dd/TDDArtifact.java @@ -156,9 +156,9 @@ public class TDDArtifact extends TGCWithoutInternalComponent implements Swallowe oldUserCode = userCode; JDialogArtifact jda = new JDialogArtifact(frame, value, jarValue, userCode); - jda.setSize(350, 250); - GraphicLib.centerOnParent(jda); - jda.show(); // blocked until dialog has been closed + // jda.setSize(350, 250); + GraphicLib.centerOnParent(jda, 350, 250); + jda.setVisible( true ); // blocked until dialog has been closed value = jda.getName(); jarValue = jda.getJarName(); @@ -222,7 +222,7 @@ public class TDDArtifact extends TGCWithoutInternalComponent implements Swallowe NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sjarValue = null, suserCode = null; for(int i=0; i<nl.getLength(); i++) { @@ -230,8 +230,8 @@ public class TDDArtifact extends TGCWithoutInternalComponent implements Swallowe //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; @@ -266,8 +266,8 @@ public class TDDArtifact extends TGCWithoutInternalComponent implements Swallowe return tdp.getGUI().getDesignPanel(value); } - public Vector getListOfATG() { - Vector v = new Vector(); + public Vector<ArtifactTClassGate> getListOfATG() { + Vector<ArtifactTClassGate> v = new Vector<ArtifactTClassGate>(); DesignPanel dp = tdp.getGUI().getDesignPanel(value); if (dp == null) { @@ -275,12 +275,12 @@ public class TDDArtifact extends TGCWithoutInternalComponent implements Swallowe } //System.out.println("DesignPanel ok"); - LinkedList<TGComponent> ll = dp.tcdp.getComponentList(); + java.util.List<TGComponent> ll = dp.tcdp.getComponentList(); TCDTClass tc; ArtifactTClassGate atg; - LinkedList<TAttribute> listGates; + java.util.List<TAttribute> listGates; - for (TGComponent tgc: ll) + for (TGComponent tgc: ll) { if (tgc instanceof TCDTClass) { tc = (TCDTClass)tgc; //System.out.println("Found class = " + tc.getClassName()); @@ -295,6 +295,7 @@ public class TDDArtifact extends TGCWithoutInternalComponent implements Swallowe } } } + } return v; } diff --git a/src/ui/dd/TDDNode.java b/src/ui/dd/TDDNode.java index a131b8a8be..70233be6d6 100755 --- a/src/ui/dd/TDDNode.java +++ b/src/ui/dd/TDDNode.java @@ -159,9 +159,9 @@ public class TDDNode extends TGCWithInternalComponent implements SwallowTGCompon array[0] = getStereotype(); array[1] = getNodeName(); JDialogTimeInterval jdti = new JDialogTimeInterval(frame, array, "Setting stereotype and name", "Stereotype", "Node's identifier"); - jdti.setSize(350, 250); - GraphicLib.centerOnParent(jdti); - jdti.show(); // blocked until dialog has been closed + // jdti.setSize(350, 250); + GraphicLib.centerOnParent(jdti, 350, 250); + jdti.setVisible( true ); // blocked until dialog has been closed stereotype = array[0].trim(); nodeName = array[1].trim(); @@ -216,11 +216,11 @@ public class TDDNode extends TGCWithInternalComponent implements SwallowTGCompon } - public Vector getArtifactList() { - Vector v = new Vector(); + public Vector<TDDArtifact> getArtifactList() { + Vector<TDDArtifact> v = new Vector<TDDArtifact>(); for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof TDDArtifact) { - v.add(tgcomponent[i]); + v.add( (TDDArtifact) tgcomponent[i]); } } return v; @@ -250,7 +250,7 @@ public class TDDNode extends TGCWithInternalComponent implements SwallowTGCompon NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -258,8 +258,8 @@ public class TDDNode extends TGCWithInternalComponent implements SwallowTGCompon //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/dd/TDeploymentDiagramPanel.java b/src/ui/dd/TDeploymentDiagramPanel.java index 734cd4ae68..e00318d910 100755 --- a/src/ui/dd/TDeploymentDiagramPanel.java +++ b/src/ui/dd/TDeploymentDiagramPanel.java @@ -134,10 +134,11 @@ public class TDeploymentDiagramPanel extends TDiagramPanel { public boolean isFree(ArtifactTClassGate atg) { TGConnectorLinkNode tgco; TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TGConnectorLinkNode) { tgco = (TGConnectorLinkNode)tgc; if (tgco.hasArtifactTClassGate(atg)) { @@ -149,30 +150,30 @@ public class TDeploymentDiagramPanel extends TDiagramPanel { return true; } - public LinkedList getListOfNodes() { - LinkedList ll = new LinkedList(); + public List<TDDNode> getListOfNodes() { + List<TDDNode> ll = new LinkedList<TDDNode>(); TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TDDNode) { - ll.add(tgc); + ll.add( (TDDNode) tgc ); } } return ll; } - public LinkedList getListOfLinks() { - LinkedList ll = new LinkedList(); + public List<TGConnectorLinkNode> getListOfLinks() { + List<TGConnectorLinkNode> ll = new LinkedList<TGConnectorLinkNode>(); TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TGConnectorLinkNode) { - ll.add(tgc); + ll.add( (TGConnectorLinkNode) tgc); } } diff --git a/src/ui/dd/TGConnectorLinkNode.java b/src/ui/dd/TGConnectorLinkNode.java index f9790da1d4..a7f5e3cba6 100755 --- a/src/ui/dd/TGConnectorLinkNode.java +++ b/src/ui/dd/TGConnectorLinkNode.java @@ -111,9 +111,9 @@ public class TGConnectorLinkNode extends TGConnector { //Vector v = tdp.getAllNotSelectedGatesFromNode(list); JDialogLinkNode jdln = new JDialogLinkNode(frame, delay, lossRate, implementation, oport, dport, llist, rlist, list); - jdln.setSize(800, 600); - GraphicLib.centerOnParent(jdln); - jdln.show(); // blocked until dialog has been closed +// jdln.setSize(800, 600); + GraphicLib.centerOnParent(jdln, 800, 600); + jdln.setVisible( true ); // blocked until dialog has been closed delay = jdln.getDelay(); lossRate = jdln.getLossRate(); @@ -257,7 +257,7 @@ public class TGConnectorLinkNode extends TGConnector { NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sdelay = null, slossRate = null; for(int i=0; i<nl.getLength(); i++) { @@ -265,8 +265,8 @@ public class TGConnectorLinkNode extends TGConnector { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; @@ -337,7 +337,7 @@ public class TGConnectorLinkNode extends TGConnector { return false; } - TAttribute ta = tc.getGateById(atg.gat); + // TAttribute ta = tc.getGateById(atg.gat); return (atg.gat != null); } diff --git a/src/ui/diplodocusmethodology/DiplodocusMethodologyDiagramReference.java b/src/ui/diplodocusmethodology/DiplodocusMethodologyDiagramReference.java index aacb5bb8f2..46a7f54ccf 100755 --- a/src/ui/diplodocusmethodology/DiplodocusMethodologyDiagramReference.java +++ b/src/ui/diplodocusmethodology/DiplodocusMethodologyDiagramReference.java @@ -54,8 +54,6 @@ import java.awt.event.*; import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -114,7 +112,7 @@ public abstract class DiplodocusMethodologyDiagramReference extends TGCScalableW nbInternalTGComponent = 0; //tgcomponent = new TGComponent[nbInternalTGComponent]; - int h = 1; + // int h = 1; //TAttributeRequirement tgc0; //tgc0 = new TAttributeRequirement(x, y+height+h, 0, 0, height + h, height+h, true, this, _tdp); //tgcomponent[0] = tgc0; @@ -138,8 +136,8 @@ public abstract class DiplodocusMethodologyDiagramReference extends TGCScalableW public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; - int w, c; + // Font fold = f; + // int w, c; int size; value = TYPE_STR[typeOfReference]; @@ -165,7 +163,7 @@ public abstract class DiplodocusMethodologyDiagramReference extends TGCScalableW displayText = true; } - int h = g.getFontMetrics().getHeight(); + // int h = g.getFontMetrics().getHeight(); g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); g.fillRect(x, y, width, height); @@ -372,7 +370,7 @@ public abstract class DiplodocusMethodologyDiagramReference extends TGCScalableW } public boolean eventOnPopup(ActionEvent e) { - String s = e.getActionCommand(); + //String s = e.getActionCommand(); if (e.getSource() == diagramReference) { addDiagramReference(getTDiagramPanel().getMGUI().getFrame()); @@ -392,9 +390,9 @@ public abstract class DiplodocusMethodologyDiagramReference extends TGCScalableW fillIgnoredSelectedFromInternalComponents(ignored, selected); jdmlos = new JDialogManageListOfString(frame, ignored, selected, "Selection of diagrams"); - jdmlos.setSize(550, 350); - GraphicLib.centerOnParent(jdmlos); - jdmlos.show(); + // jdmlos.setSize(550, 350); + GraphicLib.centerOnParent(jdmlos, 550, 350); + jdmlos.setVisible( true ); ignored = jdmlos.getIgnored(); selected = jdmlos.getSelected(); diff --git a/src/ui/ebrdd/EBRDDAttributeBox.java b/src/ui/ebrdd/EBRDDAttributeBox.java index dcb7902b50..1a7bc2a1fb 100644 --- a/src/ui/ebrdd/EBRDDAttributeBox.java +++ b/src/ui/ebrdd/EBRDDAttributeBox.java @@ -209,8 +209,8 @@ public class EBRDDAttributeBox extends TGCWithoutInternalComponent { String oldValue = value; JDialogAttribute jda = new JDialogAttribute(myAttributes, forbiddenNames, frame, "Setting variables", attributeText); setJDialogOptions(jda); - jda.setSize(650, 375); - GraphicLib.centerOnParent(jda); + // jda.setSize(650, 375); + GraphicLib.centerOnParent(jda, 650, 375); jda.setVisible(true); // blocked until dialog has been closed makeValue(); if (oldValue.equals(value)) { diff --git a/src/ui/ebrdd/EBRDDERB.java b/src/ui/ebrdd/EBRDDERB.java index af293f94eb..e1550c56f9 100644 --- a/src/ui/ebrdd/EBRDDERB.java +++ b/src/ui/ebrdd/EBRDDERB.java @@ -159,9 +159,9 @@ public class EBRDDERB extends TGCOneLineText implements SwallowedTGComponent { String val; JDialogERB dialog = new JDialogERB(frame, this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -248,8 +248,8 @@ public class EBRDDERB extends TGCOneLineText implements SwallowedTGComponent { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/ebrdd/EBRDDESO.java b/src/ui/ebrdd/EBRDDESO.java index 67a68742e5..dab7b90197 100644 --- a/src/ui/ebrdd/EBRDDESO.java +++ b/src/ui/ebrdd/EBRDDESO.java @@ -58,7 +58,7 @@ import org.w3c.dom.*; public class EBRDDESO extends TGCWithoutInternalComponent implements SwallowedTGComponent { private int lineLength = 0; - private int textX, textY; + //private int textX, textY; // Type public final static String [] ESOS = {"Conjunction", "Disjunction", "Sequence", "Strict sequence", "Simultaneous", "At least/At most"}; @@ -76,8 +76,8 @@ public class EBRDDESO extends TGCWithoutInternalComponent implements SwallowedTG width = 150; height = 5; - textX = width - 6; - textY = height + 2; +// textX = width - 6; +// textY = height + 2; nbConnectingPoint = 10; connectingPoint = new TGConnectingPoint[10]; @@ -108,7 +108,7 @@ public class EBRDDESO extends TGCWithoutInternalComponent implements SwallowedTG public void internalDrawing(Graphics g) { g.drawRect(x, y, width, height); g.fillRect(x, y, width, height); - Font f = g.getFont(); + //Font f = g.getFont(); int w = g.getFontMetrics().stringWidth(ESOS[id]); g.drawString(ESOS[id], x+width-w, y-2); } @@ -122,13 +122,13 @@ public class EBRDDESO extends TGCWithoutInternalComponent implements SwallowedTG public boolean editOndoubleClick(JFrame frame) { boolean error = false; String errors = ""; - int tmp; - String tmpName; +// int tmp; +// String tmpName; JDialogESO dialog = new JDialogESO(frame, this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -216,16 +216,16 @@ public class EBRDDESO extends TGCWithoutInternalComponent implements SwallowedTG NodeList nli; Node n1, n2; Element elt; - int t1id; - String sstereotype = null, snodeName = null; +// int t1id; +// String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/ebrdd/EBRDDForLoop.java b/src/ui/ebrdd/EBRDDForLoop.java index c395deb763..a6245f8cd1 100755 --- a/src/ui/ebrdd/EBRDDForLoop.java +++ b/src/ui/ebrdd/EBRDDForLoop.java @@ -134,9 +134,9 @@ public class EBRDDForLoop extends TGCWithoutInternalComponent implements Embedde JDialogMultiString jdms = new JDialogMultiString(frame, "Setting loop's properties", 3, labels, values); - jdms.setSize(350, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms, 350, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet()) { init = jdms.getString(0); @@ -207,8 +207,8 @@ public class EBRDDForLoop extends TGCWithoutInternalComponent implements Embedde NodeList nli; Node n1, n2; Element elt; - int k; - String s; + // int k; + // String s; //System.out.println("Loading Synchronization gates"); //System.out.println(nl.toString()); @@ -218,8 +218,8 @@ public class EBRDDForLoop extends TGCWithoutInternalComponent implements Embedde //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/ncdd/NCConnectorNode.java b/src/ui/ncdd/NCConnectorNode.java index 09faa3fa35..b5acc7f8f2 100755 --- a/src/ui/ncdd/NCConnectorNode.java +++ b/src/ui/ncdd/NCConnectorNode.java @@ -49,7 +49,6 @@ package ui.ncdd; import java.awt.*; -import java.awt.geom.*; import javax.swing.*; import java.util.*; @@ -128,9 +127,9 @@ public class NCConnectorNode extends TGConnector implements WithAttributes { String interfaceNameTmp; JDialogLinkNCNode jdlncn = new JDialogLinkNCNode(frame, "Setting link parameters", hasCapacity, capacity, capacityUnit, hasParameter, parameter, interfaceName); - jdlncn.setSize(650, 650); - GraphicLib.centerOnParent(jdlncn); - jdlncn.show(); // Blocked until dialog has been closed + //jdlncn.setSize(650, 650); + GraphicLib.centerOnParent(jdlncn, 650, 650); + jdlncn.setVisible( true ); // Blocked until dialog has been closed interfaceNameTmp = jdlncn.getInterfaceName().trim(); tmp = jdlncn.getCapacity(); @@ -224,7 +223,7 @@ public class NCConnectorNode extends TGConnector implements WithAttributes { NodeList nli; Node n1, n2; Element elt; - int t1id; + //int t1id; String prio; String unit; String has; @@ -234,8 +233,8 @@ public class NCConnectorNode extends TGConnector implements WithAttributes { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/ncdd/NCEqNode.java b/src/ui/ncdd/NCEqNode.java index cc3bf63399..4f22a9f717 100755 --- a/src/ui/ncdd/NCEqNode.java +++ b/src/ui/ncdd/NCEqNode.java @@ -50,8 +50,6 @@ import java.awt.*; import java.util.*; import javax.swing.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -177,15 +175,15 @@ public class NCEqNode extends TGCWithInternalComponent implements SwallowTGCompo return type; } - public boolean editOndoubleClick(JFrame frame) { + public boolean editOndoubleClick(JFrame frame) { //System.out.println("Double click"); String oldName = name; String tmp; JDialogNCEqNode jdncen = new JDialogNCEqNode(frame, "Setting equipment parameters", name, schedulingPolicy, type); jdncen.setSize(350, 250); - GraphicLib.centerOnParent(jdncen); - jdncen.show(); // Blocked until dialog has been closed + GraphicLib.centerOnParent(jdncen, 350, 250); + jdncen.setVisible( true ); // Blocked until dialog has been closed if (jdncen.hasBeenCancelled()) { return false; diff --git a/src/ui/ncdd/NCRouteArtifact.java b/src/ui/ncdd/NCRouteArtifact.java index 3b04f96b0d..781f4eee70 100755 --- a/src/ui/ncdd/NCRouteArtifact.java +++ b/src/ui/ncdd/NCRouteArtifact.java @@ -149,9 +149,9 @@ public class NCRouteArtifact extends TGCWithoutInternalComponent implements Swal ArrayList<String> outputInterfaces = (ArrayList<String>)(inputInterfaces.clone()); JDialogNCRoute dialog = new JDialogNCRoute(frame, "Setting route attributes", value, vroutes, inputInterfaces, traffics, outputInterfaces); - dialog.setSize(900, 500); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(900, 500); + GraphicLib.centerOnParent(dialog, 900, 500); + dialog.setVisible( true ); // blocked until dialog has been closed if (dialog.hasBeenCancelled()) { return false; @@ -225,7 +225,7 @@ public class NCRouteArtifact extends TGCWithoutInternalComponent implements Swal NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String s0 = null, s1 = null, s2 = null; NCRoute route; @@ -234,8 +234,8 @@ public class NCRouteArtifact extends TGCWithoutInternalComponent implements Swal //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/ncdd/NCSwitchNode.java b/src/ui/ncdd/NCSwitchNode.java index 3dded2def9..c7a6231f9f 100755 --- a/src/ui/ncdd/NCSwitchNode.java +++ b/src/ui/ncdd/NCSwitchNode.java @@ -198,9 +198,9 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC String tmp; JDialogNCSwitchNode jdncsn = new JDialogNCSwitchNode(frame, "Setting switch parameters", name, schedulingPolicy, switchingTechnique, capacity, capacityUnit, technicalLatency); - jdncsn.setSize(350, 300); - GraphicLib.centerOnParent(jdncsn); - jdncsn.show(); // Blocked until dialog has been closed + // jdncsn.setSize(350, 300); + GraphicLib.centerOnParent(jdncsn, 350, 300); + jdncsn.setVisible( true ); // Blocked until dialog has been closed if (jdncsn.hasBeenCancelled()) { return false; @@ -348,8 +348,8 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/ncdd/NCTrafficArtifact.java b/src/ui/ncdd/NCTrafficArtifact.java index 8788f94a79..c2cf982734 100755 --- a/src/ui/ncdd/NCTrafficArtifact.java +++ b/src/ui/ncdd/NCTrafficArtifact.java @@ -47,7 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.ncdd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -152,9 +151,9 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw String oldValue = value; JDialogNCTraffic dialog = new JDialogNCTraffic(frame, "Setting traffic attributes", value, periodicType, period, periodUnit, deadline, deadlineUnit, minPacketSize, maxPacketSize, priority); - dialog.setSize(300, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(300, 350); + GraphicLib.centerOnParent(dialog, 300, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (dialog.hasBeenCancelled()) { return false; @@ -242,7 +241,7 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, s0 = null, s1 = null, s2 = null, s3 = null, s4 = null, s5 = null, s6 = null, s7 = null; for(int i=0; i<nl.getLength(); i++) { @@ -250,8 +249,8 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/oscd/TOSCDAttributeBox.java b/src/ui/oscd/TOSCDAttributeBox.java index 594d161cfb..d950153535 100755 --- a/src/ui/oscd/TOSCDAttributeBox.java +++ b/src/ui/oscd/TOSCDAttributeBox.java @@ -47,13 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.oscd; -//import java.awt.*; -//import javax.swing.*; -import java.util.*; - -//import org.w3c.dom.*; - -//import myutil.*; import ui.*; import ui.window.*; @@ -86,9 +79,9 @@ public class TOSCDAttributeBox extends TGCAttributeBox { jda.enableJavaKeyword(false); //jda.enableOtherTypes(true); - LinkedList ll = tdp.getComponentList(); - Iterator iterator = ll.listIterator(); - TGComponent tgc; +// List ll = tdp.getComponentList(); +// Iterator iterator = ll.listIterator(); +// TGComponent tgc; /*while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); if (tgc instanceof TCDTData) { diff --git a/src/ui/oscd/TOSClass.java b/src/ui/oscd/TOSClass.java index 2c36ea6e74..82541aeb48 100755 --- a/src/ui/oscd/TOSClass.java +++ b/src/ui/oscd/TOSClass.java @@ -137,7 +137,7 @@ public class TOSClass extends TGCWithInternalComponent implements TClassInterfac public void recalculateSize() { //System.out.println("Recalculate size of " + this); - int i, j; + int i;//, j; for(i=0; i<nbInternalTGComponent; i++) { tgcomponent[i].calculateMyDesiredSize(); @@ -175,12 +175,12 @@ public class TOSClass extends TGCWithInternalComponent implements TClassInterfac return minDesiredWidth; } - - private int calculateDesiredWidth() { - int w = Math.max(minDesiredWidth, tgcomponent[0].getMinDesiredWidth()); - w = Math.max(w, tgcomponent[1].getMinDesiredWidth()); - return w; - } +// +// private int calculateDesiredWidth() { +// int w = Math.max(minDesiredWidth, tgcomponent[0].getMinDesiredWidth()); +// w = Math.max(w, tgcomponent[1].getMinDesiredWidth()); +// return w; +// } public void internalDrawing(Graphics g) { @@ -190,7 +190,7 @@ public class TOSClass extends TGCWithInternalComponent implements TClassInterfac //System.out.println("My width = " + width + " this=" + this); Font f = g.getFont(); - int size = f.getSize(); + // int size = f.getSize(); g.drawRect(x, y, width, height); g.setColor(Color.yellow); g.fillRect(x+1, y+1, width-1, height-1); @@ -216,8 +216,8 @@ public class TOSClass extends TGCWithInternalComponent implements TClassInterfac } JDialogTOSClass jdtosc = new JDialogTOSClass(frame, text, this); - jdtosc.setSize(350, 400); - GraphicLib.centerOnParent(jdtosc); + // jdtosc.setSize(350, 400); + GraphicLib.centerOnParent(jdtosc, 350, 400); jdtosc.setVisible(true); //System.out.println("toto"); @@ -316,11 +316,11 @@ public class TOSClass extends TGCWithInternalComponent implements TClassInterfac return TGComponentManager.TOSCD_TCLASS; } - public LinkedList<TAttribute> getAttributes(){ + public java.util.List<TAttribute> getAttributes(){ return ((TGCAttributeBox)(tgcomponent[0])).getAttributeList(); } - public LinkedList<TAttribute> getGates() { + public java.util.List<TAttribute> getGates() { return ((TGCAttributeBox)(tgcomponent[1])).getAttributeList(); } @@ -345,7 +345,7 @@ public class TOSClass extends TGCWithInternalComponent implements TClassInterfac } */ public TAttribute getGateById(String name) { - LinkedList<TAttribute> list = ((TGCAttributeBox)(tgcomponent[1])).getAttributeList(); + java.util.List<TAttribute> list = ((TGCAttributeBox)(tgcomponent[1])).getAttributeList(); for (TAttribute ta: list) if (ta.getId().equals(name)) return ta; diff --git a/src/ui/procsd/ProActiveCompSpecificationCSDPanel.java b/src/ui/procsd/ProActiveCompSpecificationCSDPanel.java index 8930d48202..43f01e1bb2 100644 --- a/src/ui/procsd/ProActiveCompSpecificationCSDPanel.java +++ b/src/ui/procsd/ProActiveCompSpecificationCSDPanel.java @@ -3,8 +3,6 @@ package ui.procsd; import java.util.Vector; import ui.MainGUI; -import ui.TDiagramMouseManager; -import ui.TGConnectingPoint; import ui.TToolBar; public class ProActiveCompSpecificationCSDPanel extends ProactiveCSDPanel{ diff --git a/src/ui/procsd/ProCSDComponent.java b/src/ui/procsd/ProCSDComponent.java index b939ab6ea8..da5c3fa811 100755 --- a/src/ui/procsd/ProCSDComponent.java +++ b/src/ui/procsd/ProCSDComponent.java @@ -48,30 +48,22 @@ package ui.procsd; import java.awt.*; import java.util.*; +import java.util.List; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.ByteArrayInputStream; import javax.swing.*; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.*; -import org.xml.sax.SAXException; import myutil.*; import ui.*; -import ui.cd.TCDTClass; -import ui.cd.TCDTObject; -import ui.oscd.TOSClass; import ui.prosmd.ProSMDStartState; import ui.prosmd.ProSMDStopState; import ui.prosmd.ProSMDSubmachine; import ui.prosmd.ProactiveSMDPanel; -import ui.tmlcd.TMLTaskOperator; import ui.window.*; public class ProCSDComponent extends TGCWithInternalComponent implements @@ -129,7 +121,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements } - public void setAttributes(Collection attribs) + public void setAttributes(Collection<TAttribute> attribs) { myAttributes=new LinkedList<TAttribute> (attribs); } @@ -299,11 +291,11 @@ public class ProCSDComponent extends TGCWithInternalComponent implements removeInternalComponent(tgc); } - public Vector getComponentList() { - Vector v = new Vector(); + public Vector<ProCSDComponent> getComponentList() { + Vector<ProCSDComponent> v = new Vector<ProCSDComponent>(); for (int i = 0; i < nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof ProCSDComponent) { - v.add(tgcomponent[i]); + v.add((ProCSDComponent)tgcomponent[i]); } } return v; @@ -351,8 +343,8 @@ public class ProCSDComponent extends TGCWithInternalComponent implements */ - public LinkedList getMyAttributes() { - return new LinkedList(myAttributes); + public List<TAttribute> getMyAttributes() { + return new LinkedList<TAttribute>(myAttributes); } // Attributes will be seen on the screen. Unimplemented @@ -474,7 +466,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements ProactiveDesignPanel pdp=(ProactiveDesignPanel)tdp.getGUI().getCurrentTURTLEPanel(); ProActiveCompSpecificationCSDPanel myPanel=pdp.addProActiveCompSpecificationPanel(this.value); - ProCSDComponent designComp=myPanel.createBlackBoxComp(this); + /*ProCSDComponent designComp=*/myPanel.createBlackBoxComp(this); @@ -492,7 +484,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements if (e.getActionCommand().equals("chooose digram for this comp design")) { - ProactiveDesignPanel pdp=(ProactiveDesignPanel)tdp.getGUI().getCurrentTURTLEPanel(); + //ProactiveDesignPanel pdp=(ProactiveDesignPanel)tdp.getGUI().getCurrentTURTLEPanel(); String s = (String) JOptionPane.showInputDialog(tdp, "Choose a component diagram", "Diagram name", JOptionPane.PLAIN_MESSAGE, @@ -531,9 +523,9 @@ public class ProCSDComponent extends TGCWithInternalComponent implements // must see in GProactiveDesign for bool params // dialog.addType("Boolean"); dialog.enableInitialValue(true); - dialog.setSize(650, 375); + // dialog.setSize(650, 375); - GraphicLib.centerOnParent(dialog); + GraphicLib.centerOnParent(dialog, 650, 375); //dialog.show(); // blocked until dialog has been closed dialog.setVisible(true); } @@ -871,10 +863,10 @@ public class ProCSDComponent extends TGCWithInternalComponent implements } }//if we have ports - Vector compList=this.getComponentList(); + Vector<ProCSDComponent> compList=this.getComponentList(); for (int k=0;k<compList.size();k++) { - ProCSDComponent pcomp=(ProCSDComponent)compList.get(k); + ProCSDComponent pcomp= compList.get(k); pcomp.selectComponent(value); } @@ -1063,7 +1055,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements out+=" **PROCSDCOMPONENT**\n"; out+="Name "+this.value+" design diagram: " +diag+"\n"; out+="---> Ports List \n"; - Vector v=this.getPortsList(); + Vector<ProCSDPort> v=this.getPortsList(); for (int i=0;i<v.size();i++) { ProCSDPort port=(ProCSDPort)v.get(i); @@ -1074,13 +1066,13 @@ public class ProCSDComponent extends TGCWithInternalComponent implements if (getMySMD()!=null) out+="My SMD: "+getMySMD().getName()+"\n"; - Vector comps=this.getComponentList(); + Vector<ProCSDComponent> comps=this.getComponentList(); if (comps.size()>0) { out+="---->SubComponents of "+this.value+"--->\n"; for (int i=0;i<comps.size();i++) { - ProCSDComponent cmp=(ProCSDComponent)comps.get(i); + ProCSDComponent cmp= comps.get(i); out+=cmp.prettyPrint(); } out+="<----SubComponents of "+this.value+"<---\n"; @@ -1324,7 +1316,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements TGConnectingPoint p1 = start_state.getTGConnectingPointAtIndex(0); TGConnectingPoint p2 = initActive_submachine.getTGConnectingPointAtIndex(0); - TGConnector conn01 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector()); + TGConnector conn01 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector<Point>()); mySMD.addBuiltConnector(conn01); @@ -1338,7 +1330,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements p1 = initActive_submachine.getTGConnectingPointAtIndex(1); p2 = runActive_submachine.getTGConnectingPointAtIndex(0); - TGConnector conn02 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector()); + TGConnector conn02 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector<Point>()); mySMD.addBuiltConnector(conn02); @@ -1351,7 +1343,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements p1 = runActive_submachine.getTGConnectingPointAtIndex(1); p2 = endActive_submachine.getTGConnectingPointAtIndex(0); - TGConnector conn03 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector()); + TGConnector conn03 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector<Point>()); mySMD.addBuiltConnector(conn03); @@ -1361,7 +1353,7 @@ public class ProCSDComponent extends TGCWithInternalComponent implements p1 = endActive_submachine.getTGConnectingPointAtIndex(1); p2 = stop_state.getTGConnectingPointAtIndex(0); - TGConnector conn04 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector()); + TGConnector conn04 = TGComponentManager.addConnector(p1.getX(), p2.getY(), TGComponentManager.CONNECTOR_PROSMD, tdp, p1, p2, new Vector<Point>()); mySMD.addBuiltConnector(conn04); } diff --git a/src/ui/procsd/ProCSDInterface.java b/src/ui/procsd/ProCSDInterface.java index 51015292a3..f2b77c0e34 100644 --- a/src/ui/procsd/ProCSDInterface.java +++ b/src/ui/procsd/ProCSDInterface.java @@ -64,12 +64,9 @@ import org.w3c.dom.NodeList; import myutil.GraphicLib; import java.util.Collection; -import java.util.Vector; import java.util.LinkedList; import ui.cd.TCDCompositionOperator; import ui.cd.TCDTClass; -import ui.cd.TGConnectingPointCompositionOperator; -import ui.window.JDialogAttribute; import ui.*; public class ProCSDInterface extends TCDCompositionOperator implements ActionListener { @@ -275,9 +272,9 @@ public class ProCSDInterface extends TCDCompositionOperator implements ActionLi dialog.addType("void"); dialog.addType("return result"); - dialog.setSize(650, 375); + // dialog.setSize(650, 375); - GraphicLib.centerOnParent(dialog); + GraphicLib.centerOnParent(dialog, 650, 375); // dialog.show(); // blocked until dialog has been closed dialog.setVisible(true); diff --git a/src/ui/procsd/ProCSDPort.java b/src/ui/procsd/ProCSDPort.java index 6324f27d6f..d23fe79cf6 100644 --- a/src/ui/procsd/ProCSDPort.java +++ b/src/ui/procsd/ProCSDPort.java @@ -47,7 +47,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.procsd; -import ui.CheckingError; import ui.IconManager; import ui.MalformedModelingException; import ui.TDiagramPanel; @@ -55,17 +54,15 @@ import ui.TGCWithoutInternalComponent; import ui.TGComponent; import ui.TGComponentManager; import ui.TGConnectingPoint; -import ui.cd.TGConnectorAssociation; -//Added by Solange import ui.TGConnectorAttribute; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.lang.reflect.Method; -import java.util.Iterator; import java.util.Vector; import ui.TAttribute; -import java.util.LinkedList; +import java.util.List; import javax.swing.JMenuItem; import javax.swing.JOptionPane; @@ -74,6 +71,7 @@ import javax.swing.JPopupMenu; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; + public abstract class ProCSDPort extends TGCWithoutInternalComponent implements ActionListener { private ProCSDInterface myInterface=null; @@ -83,7 +81,7 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements public boolean hidden=false; private String portCode; - private Class javaInterface=null; + //private Class javaInterface=null; public String getPortCode() { @@ -152,7 +150,7 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements TGConnectingPoint point1=this.getTGConnectingPointAtIndex(0); TGConnectingPoint point2=newInterface.getTGConnectingPointAtIndex(0); - TGConnectorPortInterface connector=new TGConnectorPortInterface(0,0,0,0,0,0,false,null,this.tdp,point1,point2,new Vector()); + TGConnectorPortInterface connector=new TGConnectorPortInterface(0,0,0,0,0,0,false,null,this.tdp,point1,point2,new Vector<Point>()); this.tdp.addBuiltConnector(connector); return true; @@ -166,7 +164,7 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements * for the delegate ports we return myInterface */ - public ProCSDInterface getMyInterface(LinkedList interfacesList) + public ProCSDInterface getMyInterface( List<ProCSDInterface> interfacesList) { if (myInterface!=null) @@ -206,10 +204,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements private TGConnectorAttribute getMyTGConnectorAttribute() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if ( (tgc.getType()== TGComponentManager.CONNECTOR_ATTRIBUTE) || (tgc.getType()== TGComponentManager.CONNECTOR_PROCSD_PORT_INTERFACE)) if (isMyAttribute((TGConnectorAttribute)tgc)) return (TGConnectorAttribute)tgc; } @@ -233,12 +231,12 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements //Added by Solange from TGConnectorProCSD.java - public ProCSDInterface getMyInterface2(LinkedList interfacesList) + public ProCSDInterface getMyInterface2( List<ProCSDInterface> interfacesList) { - TGConnectorAttribute tgca=getMyTGConnectorAttribute(); - if(tgca!=null) - { - LinkedList cmps=interfacesList; + TGConnectorAttribute tgca=getMyTGConnectorAttribute(); + + if(tgca!=null) { + List<ProCSDInterface> cmps=interfacesList; for (int i=0;i<cmps.size();i++) { TGComponent tgc = (TGComponent)cmps.get(i); @@ -378,10 +376,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements public TGConnectorProCSD getTGConnector() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if (tgc.getType()== TGComponentManager.CONNECTOR_PROCSD) { if (isMyConnector((TGConnectorProCSD)tgc)) return (TGConnectorProCSD)tgc; @@ -398,10 +396,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements */ public TGConnectorAttribute getTGConnectorInterface() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if ((tgc.getType()== TGComponentManager.CONNECTOR_ATTRIBUTE)|| (tgc.getType()== TGComponentManager.CONNECTOR_PROCSD_PORT_INTERFACE)) { if (isMyAttribute((TGConnectorAttribute)tgc)) return (TGConnectorAttribute)tgc; @@ -417,10 +415,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements */ public TGConnectorDelegateProCSD getTGConnectorDelegateOut() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if (tgc.getType()== TGComponentManager.CONNECTOR_DELEGATE_PROCSD) { if (isMyConnectorOut((TGConnectorDelegateProCSD)tgc)) return (TGConnectorDelegateProCSD)tgc; @@ -438,10 +436,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements */ public TGConnectorProCSD getBindingIn() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if (tgc instanceof TGConnectorProCSD) { if (isMyConnectorIn((TGConnectorProCSD)tgc)) return (TGConnectorProCSD)tgc; @@ -456,10 +454,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements */ public TGConnectorProCSD getBindingOut() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if (tgc instanceof TGConnectorProCSD) { if (isMyConnectorOut((TGConnectorProCSD)tgc)) return (TGConnectorProCSD)tgc; @@ -474,10 +472,10 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements */ public TGConnectorDelegateProCSD getTGConnectorDelegateIn() { - LinkedList cmps=this.tdp.getComponentList(); + List<TGComponent> cmps=this.tdp.getComponentList(); for (int i=0;i<cmps.size();i++) { - TGComponent tgc = (TGComponent)cmps.get(i); + TGComponent tgc = cmps.get(i); if (tgc.getType()== TGComponentManager.CONNECTOR_DELEGATE_PROCSD) { if (isMyConnectorIn((TGConnectorDelegateProCSD)tgc)) return (TGConnectorDelegateProCSD)tgc; @@ -498,7 +496,7 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements } - public LinkedList getMyMessages() + public List<TAttribute> getMyMessages() { return null; } @@ -525,24 +523,26 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements * @param p port connected to the interface * @return msgMandatory Vector of messages **/ - public Vector getMsgMandatory(ProCSDPort p, ProCSDInterface it){ - Vector msgMandatory=new Vector(); - if(it==null) - { - System.out.println("Interface not found for this port"); - return(null); + public Vector<TAttribute> getMsgMandatory(ProCSDPort p, ProCSDInterface it){ + Vector<TAttribute> msgMandatory=new Vector<TAttribute>(); + + if(it==null) { + System.out.println("Interface not found for this port"); + return(null); } - LinkedList myMessages= it.getMyMessages(); - TAttribute a; - if(isMandatory(it)) - { - for(int i=0; i<myMessages.size(); i++) - { - a = (TAttribute)(myMessages.get(i)); - msgMandatory.addElement(a); - } - } - return(msgMandatory); + + List<TAttribute> myMessages= it.getMyMessages(); + TAttribute a; + + if(isMandatory(it)) + { + for(int i=0; i<myMessages.size(); i++) { + a = myMessages.get(i); + msgMandatory.addElement(a); + } + } + + return(msgMandatory); } //Method Added by Solange @@ -552,98 +552,98 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements * @param it the interface * @param interfacelist A LinkedList of interfaces */ - public int Compatibility(ProCSDPort p, ProCSDInterface it,LinkedList interfacelist) - { - LinkedList myMessages1; - TGConnectorProCSD tgc; - ProCSDPort p2; - ProCSDInterface it2; - LinkedList myMessages2; - - if(it!=null) + public int Compatibility(ProCSDPort p, ProCSDInterface it, List<ProCSDInterface> interfacelist) { - myMessages1= it.getMyMessages(); - if (isMandatory(it)) + List<TAttribute> myMessages1; + TGConnectorProCSD tgc; + ProCSDPort p2; + ProCSDInterface it2; + List<TAttribute> myMessages2; + + if(it!=null) { - tgc=p.getTGConnector(); //reviso si puerto esta conectado - if (tgc==null) //no conectado - { - // System.out.println(p.toString() + " not connected"); - return(1); - } - else + myMessages1= it.getMyMessages(); + if (isMandatory(it)) { - p2=p.getFromPort(); - if(p2!=null) + tgc=p.getTGConnector(); //reviso si puerto esta conectado + if (tgc==null) //no conectado { - it2=p2.getMyInterface(interfacelist); - //it2=p2.getMyInterface(); - if(it2!=null) + return(1); + } + else + { + p2=p.getFromPort(); + + if(p2!=null) { - myMessages2= it2.getMyMessages(); - if(myMessages2.containsAll(myMessages1)) + it2=p2.getMyInterface(interfacelist); + + if(it2!=null) { - // System.out.println(it2.toString() + " is compatible with mandatory " + it.toString()); - return(0); + myMessages2= it2.getMyMessages(); + if(myMessages2.containsAll(myMessages1)) + { + // System.out.println(it2.toString() + " is compatible with mandatory " + it.toString()); + return(0); + } + else + { + // System.out.println("ERROR: " + it2.toString() + " is not compatible with mandatory " + it.toString()); + return(2); + } } else { - // System.out.println("ERROR: " + it2.toString() + " is not compatible with mandatory " + it.toString()); + // System.out.println(p2.toString() + " doesn't have an Interface connected. No compatibility with mandatory " + it.toString()); return(2); } } else { - // System.out.println(p2.toString() + " doesn't have an Interface connected. No compatibility with mandatory " + it.toString()); - return(2); - } - } - else - { - p2=p.getToPort(); - if(p2!=null) - { - it2=p2.getMyInterface(interfacelist); - //it2=p2.getMyInterface(); - if(it2!=null) + p2=p.getToPort(); + if(p2!=null) { - myMessages2= it2.getMyMessages(); - if(myMessages2.containsAll(myMessages1)) + it2=p2.getMyInterface(interfacelist); + //it2=p2.getMyInterface(); + if(it2!=null) { - // System.out.println(it2.toString() + " is compatible with mandatory " + it.toString()); - return(0); + myMessages2= it2.getMyMessages(); + if(myMessages2.containsAll(myMessages1)) + { + // System.out.println(it2.toString() + " is compatible with mandatory " + it.toString()); + return(0); + } + else + { + // System.out.println("ERROR: " + it2.toString() + " is not compatible with mandatory " + it.toString()); + return(2); + } } else { - // System.out.println("ERROR: " + it2.toString() + " is not compatible with mandatory " + it.toString()); - return(2); + // System.out.println("ERROR!!!!!"); + return(3); } } else { - // System.out.println("ERROR!!!!!"); - return(3); + // System.out.println(p2.toString() + " doesn't have an Interface connected. No compatibility with mandatory " + it.toString()); + return(2); } - } - else - { - // System.out.println(p2.toString() + " doesn't have an Interface connected. No compatibility with mandatory " + it.toString()); - return(2); - } + } } } + else //not mandatory + { + // System.out.println(it.toString() + " is OPTIONAL so can be connected or not, and is compatible with any interface"); + return(0); + } } - else //not mandatory + else { - // System.out.println(it.toString() + " is OPTIONAL so can be connected or not, and is compatible with any interface"); - return(0); + // System.out.println(p.toString() + " doesn't have an Interface connected"); + return(2); } - } - else - { - // System.out.println(p.toString() + " doesn't have an Interface connected"); - return(2); - } }//end method //Method added by Solange to put this option in the right click button menu of the mouse @@ -669,72 +669,71 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements componentMenu.add(pp); } - - - + public void actionPerformed(ActionEvent e) { - Class javaInt=null; + Class<?> javaInt=null; if (e.getActionCommand().equals("bind java interface")) { String currentInterface=""; - if (javaInt!=null) currentInterface=javaInt.getName(); + // DB Ticket #17 Dead code + //if (javaInt!=null) currentInterface=javaInt.getName(); String className = (String) JOptionPane.showInputDialog(tdp, "java interface name", - "choosing java interface", JOptionPane.PLAIN_MESSAGE, - IconManager.imgic101, null, currentInterface); - - - if (className==null) return; - + "choosing java interface", JOptionPane.PLAIN_MESSAGE, + IconManager.imgic101, null, currentInterface); + + + if (className==null) return; + try{ - javaInt=Class.forName(className); - } - catch(ClassNotFoundException ex) - { - JOptionPane.showMessageDialog(tdp,"Class "+className+" not found. Verify the class is in your classpath"); - return; - } - + javaInt=Class.forName(className); + } + catch(ClassNotFoundException ex) + { + JOptionPane.showMessageDialog(tdp,"Class "+className+" not found. Verify the class is in your classpath"); + return; + } + - - if (!javaInt.isInterface()) - { - JOptionPane.showMessageDialog(tdp,"Class "+className+" is not an interface. Please choose an interface"); - return; - } - - this.javaInterface=javaInt; - if (this.getMyInterface()!=null) - { - - - // setting messages for myInterface - Vector<TAttribute> msgs=new Vector<TAttribute>(); - - Method[] mthds=javaInt.getMethods(); - for (int k=0;k<mthds.length;k++) - { - Method m=mthds[k]; - TAttribute ta=new TAttribute(TAttribute.PUBLIC,m.getName(),"",m.getReturnType().getName()); - msgs.add(ta); - } - - myInterface.setMessages(msgs); - } + + if (!javaInt.isInterface()) + { + JOptionPane.showMessageDialog(tdp,"Class "+className+" is not an interface. Please choose an interface"); + return; + } + + //this.javaInterface=javaInt; + if (this.getMyInterface()!=null) + { + + + // setting messages for myInterface + Vector<TAttribute> msgs=new Vector<TAttribute>(); + + Method[] mthds=javaInt.getMethods(); + for (int k=0;k<mthds.length;k++) + { + Method m=mthds[k]; + TAttribute ta=new TAttribute(TAttribute.PUBLIC,m.getName(),"",m.getReturnType().getName()); + msgs.add(ta); + } + + myInterface.setMessages(msgs); + } } - + if (e.getActionCommand().equals("hide/show interface")) { if (myInterface==null) return; - + if(myInterface.shome==true) - { - myInterface.shome=false; - myInterface.getMyConnector().show=false; - hidden=true; - - } + { + myInterface.shome=false; + myInterface.getMyConnector().show=false; + hidden=true; + + } else { myInterface.shome=true; @@ -746,10 +745,8 @@ public abstract class ProCSDPort extends TGCWithoutInternalComponent implements { System.out.println(this.prettyPrint()); } - + } - - public String prettyPrint() { diff --git a/src/ui/procsd/ProactiveCSDPanel.java b/src/ui/procsd/ProactiveCSDPanel.java index 8de40cfad6..4e1e8e4e04 100755 --- a/src/ui/procsd/ProactiveCSDPanel.java +++ b/src/ui/procsd/ProactiveCSDPanel.java @@ -50,16 +50,9 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; - - import javax.swing.JMenuItem; - import ui.*; -import ui.cd.TCDTClass; -import ui.prosmd.ProactiveSMDPanel; - - public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { public static int NORMAL_FONT=1; @@ -139,7 +132,7 @@ public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { TGComponent tgc; SwallowTGComponent father=null; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); @@ -276,10 +269,10 @@ public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { private ProCSDComponent getSelectedChild(ProCSDComponent tgc) { - Vector v=tgc.getComponentList(); + Vector<ProCSDComponent> v=tgc.getComponentList(); for (int k=0;k<v.size();k++) { - ProCSDComponent child=(ProCSDComponent)v.get(k); + ProCSDComponent child= v.get(k); if (child.isSelected()) return child; ProCSDComponent childChild=getSelectedChild(child); @@ -297,9 +290,9 @@ public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { TGComponent tgc; //Added by Solange to see the components in the list - LinkedList ruteoList=componentList; + // LinkedList ruteoList=componentList; // - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); @@ -378,13 +371,13 @@ public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { //The methode should have been put here in the first place //we keep the method in TDiagramPanel for compatibility //but is this one which will be actually called - public Vector selectedProCSDComponent(ProCSDComponent root) { - TGComponent tgc, tgcomp; - ProCSDComponent tgchild; - TCDTClass t; - Vector v = new Vector(); - Vector rootChildren=null; - Iterator iterator=null; + public Vector<ProCSDComponent> selectedProCSDComponent(ProCSDComponent root) { + TGComponent tgc;//, tgcomp; + // ProCSDComponent tgchild; + // TCDTClass t; + Vector<ProCSDComponent> v = new Vector<ProCSDComponent>(); + Vector<ProCSDComponent> rootChildren=null; + Iterator<? extends TGComponent> iterator=null; if (root!=null) { @@ -397,25 +390,26 @@ public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { rootChildren=root.getComponentList(); iterator=rootChildren.listIterator(); } - else - iterator = componentList.listIterator(); + else { + iterator = componentList.listIterator(); + } - int ruteo=0; + // int ruteo=0; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof ProCSDComponent) { if ((tgc.isSelected()) && ((ProCSDComponent)tgc).getMySMD()!=null) { - v.addElement(tgc); + v.addElement((ProCSDComponent)tgc); } else { - Vector children=((ProCSDComponent)tgc).getComponentList(); + Vector<ProCSDComponent> children=((ProCSDComponent)tgc).getComponentList(); for (int q=0;q<children.size();q++) { - ProCSDComponent child=(ProCSDComponent)children.get(q); + ProCSDComponent child= children.get(q); v.addAll(selectedProCSDComponent(child)); } @@ -423,6 +417,7 @@ public class ProactiveCSDPanel extends TDiagramPanel implements ActionListener { }//if an smd found }//while iterator has next + return v; } diff --git a/src/ui/req/Requirement.java b/src/ui/req/Requirement.java index 55056519aa..3902d7fc07 100755 --- a/src/ui/req/Requirement.java +++ b/src/ui/req/Requirement.java @@ -70,7 +70,7 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit //protected int iconSize = 30; private Font myFont, myFontB; - private int maxFontSize = 30; +// private int maxFontSize = 30; private int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; @@ -106,7 +106,7 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit // Icon private int iconSize = 18; - private boolean iconIsDrawn = false; +// private boolean iconIsDrawn = false; public Requirement(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); @@ -157,7 +157,7 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit nbInternalTGComponent = 0; //tgcomponent = new TGComponent[nbInternalTGComponent]; - int h = 1; + // int h = 1; //TAttributeRequirement tgc0; //tgc0 = new TAttributeRequirement(x, y+height+h, 0, 0, height + h, height+h, true, this, _tdp); //tgcomponent[0] = tgc0; @@ -190,8 +190,8 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; - int w, c; + // Font fold = f; + // int w, c; int size; if (texts == null) { @@ -219,7 +219,7 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit displayText = true; } - int h = g.getFontMetrics().getHeight(); + // int h = g.getFontMetrics().getHeight(); g.drawRect(x, y, width, height); @@ -249,7 +249,7 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit } size += currentFontSize; g.setFont(myFontB); - w = g.getFontMetrics().stringWidth(value); + // w = g.getFontMetrics().stringWidth(value); drawLimitedString(g, value, x, y + size, width, 1); } @@ -385,9 +385,9 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit public boolean editAttributes() { //String oldValue = value; JDialogRequirement jdr = new JDialogRequirement(tdp.getGUI().getFrame(), "Setting attributes of Requirement " + getRequirementName(), id, text, kind, criticality, violatedAction, reqType, attackTreeNode, null); - jdr.setSize(750, 400); - GraphicLib.centerOnParent(jdr); - jdr.show(); + // jdr.setSize(750, 400); + GraphicLib.centerOnParent(jdr, 750, 400); + jdr.setVisible( true ); if (!jdr.isRegularClose()) { return false; @@ -401,6 +401,7 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit attackTreeNode = jdr.getAttackTreeNode(); makeValue(); + return true; } diff --git a/src/ui/req/RequirementDiagramPanel.java b/src/ui/req/RequirementDiagramPanel.java index d8f12efbcf..e96317eaf8 100755 --- a/src/ui/req/RequirementDiagramPanel.java +++ b/src/ui/req/RequirementDiagramPanel.java @@ -46,13 +46,13 @@ package ui.req; -//import java.awt.*; import java.util.*; import ui.*; public class RequirementDiagramPanel extends TDiagramPanel implements TDPWithAttributes { - public Vector validated, ignored; + + public Vector<Requirement> validated, ignored; public RequirementDiagramPanel(MainGUI mgui, TToolBar _ttb) { super(mgui, _ttb); @@ -149,14 +149,14 @@ public class RequirementDiagramPanel extends TDiagramPanel implements TDPWithAtt }*/ public int nbOfVerifyStartingAt(TGComponent tgc) { - ListIterator iterator = getComponentList().listIterator(); - TGComponent tgc1, tgc2; + Iterator<TGComponent> iterator = getComponentList().listIterator(); + TGComponent tgc1;//, tgc2; TGConnectingPoint p; int cpt = 0; while(iterator.hasNext()) { - tgc1 = (TGComponent)(iterator.next()); + tgc1 = iterator.next(); if (tgc1 instanceof TGConnectorVerify) { p = ((TGConnectorVerify)(tgc1)).getTGConnectingPointP1(); if (tgc.belongsToMeOrSon(p) != null) { @@ -172,10 +172,11 @@ public class RequirementDiagramPanel extends TDiagramPanel implements TDPWithAtt LinkedList<TGComponent> list = new LinkedList<TGComponent>(); TGComponent tgc; - ListIterator iterator = getComponentList().listIterator(); + Iterator<TGComponent> iterator = getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof Requirement) { list.add(tgc); } @@ -186,12 +187,13 @@ public class RequirementDiagramPanel extends TDiagramPanel implements TDPWithAtt } public boolean isLinkedByVerifyTo(TGComponent tgc1, TGComponent tgc2) { - ListIterator iterator = getComponentList().listIterator(); + Iterator<TGComponent> iterator = getComponentList().listIterator(); TGComponent tgc; TGConnectingPoint p1, p2; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TGConnectorVerify) { p1 = ((TGConnectorVerify)(tgc)).getTGConnectingPointP1(); p2 = ((TGConnectorVerify)(tgc)).getTGConnectingPointP2(); diff --git a/src/ui/req/TAttributeObserver.java b/src/ui/req/TAttributeObserver.java index ed2a26494b..26ff7c4403 100755 --- a/src/ui/req/TAttributeObserver.java +++ b/src/ui/req/TAttributeObserver.java @@ -188,9 +188,9 @@ public class TAttributeObserver extends TGCWithoutInternalComponent { public boolean editOndoubleClick(JFrame frame) { JDialogObserver jdo = new JDialogObserver(frame, "Setting diagrams of Observer " + ((RequirementObserver)(getTopFather())).getRequirementObserverName(), text, violatedAction); - jdo.setSize(750, 400); - GraphicLib.centerOnParent(jdo); - jdo.show(); + //jdo.setSize(750, 400); + GraphicLib.centerOnParent(jdo, 750, 400); + jdo.setVisible( true ); if (!jdo.isRegularClose()) { return false; diff --git a/src/ui/sd/SDAbsoluteTimeConstraint.java b/src/ui/sd/SDAbsoluteTimeConstraint.java index b866174262..ea51b29c3f 100755 --- a/src/ui/sd/SDAbsoluteTimeConstraint.java +++ b/src/ui/sd/SDAbsoluteTimeConstraint.java @@ -133,9 +133,9 @@ public class SDAbsoluteTimeConstraint extends TGCWithoutInternalComponent implem array[0] = getMinConstraint(); array[1] = getMaxConstraint(); JDialogTimeInterval jdti = new JDialogTimeInterval(frame, array, "Setting absolute time constraints"); - jdti.setSize(350, 250); - GraphicLib.centerOnParent(jdti); - jdti.show(); // blocked until dialog has been closed + // jdti.setSize(350, 250); + GraphicLib.centerOnParent(jdti, 350, 250); + jdti.setVisible( true ); // blocked until dialog has been closed minConstraint = array[0]; maxConstraint = array[1]; @@ -171,8 +171,8 @@ public class SDAbsoluteTimeConstraint extends TGCWithoutInternalComponent implem //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/sd/SDInstance.java b/src/ui/sd/SDInstance.java index 6f048909c4..f6809702f6 100755 --- a/src/ui/sd/SDInstance.java +++ b/src/ui/sd/SDInstance.java @@ -50,7 +50,6 @@ package ui.sd; import java.awt.*; import javax.swing.*; import org.w3c.dom.*; -import java.awt.event.*; import myutil.*; import ui.*; @@ -182,9 +181,9 @@ public class SDInstance extends TGCWithInternalComponent implements SwallowTGCom String oldValue = name; JDialogSDInstance jdsdi = new JDialogSDInstance(frame, name, isActor, "Instance attributes"); - jdsdi.setSize(300, 250); - GraphicLib.centerOnParent(jdsdi); - jdsdi.show(); // blocked until dialog has been closed + // jdsdi.setSize(300, 250); + GraphicLib.centerOnParent(jdsdi, 300, 250); + jdsdi.setVisible( true ); // blocked until dialog has been closed String text = getName() + ": "; @@ -547,8 +546,8 @@ public class SDInstance extends TGCWithInternalComponent implements SwallowTGCom //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/sd/SDTimerSetting.java b/src/ui/sd/SDTimerSetting.java index 66c3db110e..2a087e666b 100755 --- a/src/ui/sd/SDTimerSetting.java +++ b/src/ui/sd/SDTimerSetting.java @@ -150,9 +150,9 @@ public class SDTimerSetting extends TGCWithoutInternalComponent implements Swall array[0] = getTimer(); array[1] = getDuration(); JDialogTimeInterval jdti = new JDialogTimeInterval(frame, array, "Setting absolute time constraints", "timer", "duration"); - jdti.setSize(350, 250); - GraphicLib.centerOnParent(jdti); - jdti.show(); // blocked until dialog has been closed + //jdti.setSize(350, 250); + GraphicLib.centerOnParent(jdti, 350, 250); + jdti.setVisible( true ); // blocked until dialog has been closed timer = array[0]; duration = array[1]; @@ -171,7 +171,7 @@ public class SDTimerSetting extends TGCWithoutInternalComponent implements Swall boolean isInteger = true; try { - int tg = Integer.parseInt(duration); + /*int tg =*/ Integer.parseInt(duration); } catch (NumberFormatException nfe) { isInteger = false; } @@ -218,8 +218,8 @@ public class SDTimerSetting extends TGCWithoutInternalComponent implements Swall //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/sd/TGConnectorRelativeTimeSD.java b/src/ui/sd/TGConnectorRelativeTimeSD.java index 52c620d7f3..e32ddfbf13 100755 --- a/src/ui/sd/TGConnectorRelativeTimeSD.java +++ b/src/ui/sd/TGConnectorRelativeTimeSD.java @@ -120,9 +120,9 @@ public class TGConnectorRelativeTimeSD extends TGConnector { array[0] = getMinConstraint(); array[1] = getMaxConstraint(); JDialogTimeInterval jdti = new JDialogTimeInterval(frame, array, "Setting relative time constraints"); - jdti.setSize(350, 250); - GraphicLib.centerOnParent(jdti); - jdti.show(); // blocked until dialog has been closed + //jdti.setSize(350, 250); + GraphicLib.centerOnParent(jdti, 350, 250); + jdti.setVisible( true ); // blocked until dialog has been closed minConstraint = array[0]; maxConstraint = array[1]; @@ -159,8 +159,8 @@ public class TGConnectorRelativeTimeSD extends TGConnector { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java b/src/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java index 69bdc5809d..fe6cc995c4 100755 --- a/src/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java +++ b/src/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java @@ -53,8 +53,6 @@ import java.awt.event.*; import javax.swing.*; import java.util.*; -import org.w3c.dom.*; - import myutil.*; import ui.*; import ui.window.*; @@ -120,7 +118,7 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit nbInternalTGComponent = 0; //tgcomponent = new TGComponent[nbInternalTGComponent]; - int h = 1; + //int h = 1; //TAttributeRequirement tgc0; //tgc0 = new TAttributeRequirement(x, y+height+h, 0, 0, height + h, height+h, true, this, _tdp); //tgcomponent[0] = tgc0; @@ -144,8 +142,8 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit public void internalDrawing(Graphics g) { Font f = g.getFont(); - Font fold = f; - int w, c; +// Font fold = f; +// int w, c; int size; value = TYPE_STR[typeOfReference]; @@ -171,7 +169,7 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit displayText = true; } - int h = g.getFontMetrics().getHeight(); + // int h = g.getFontMetrics().getHeight(); g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); g.fillRect(x, y, width, height); @@ -378,7 +376,7 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit } public boolean eventOnPopup(ActionEvent e) { - String s = e.getActionCommand(); + // String s = e.getActionCommand(); if (e.getSource() == diagramReference) { addDiagramReference(null); @@ -398,9 +396,9 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit fillIgnoredSelectedFromInternalComponents(ignored, selected); jdmlos = new JDialogManageListOfString(frame, ignored, selected, "Selection of diagrams"); - jdmlos.setSize(550, 350); - GraphicLib.centerOnParent(jdmlos); - jdmlos.show(); + //jdmlos.setSize(550, 350); + GraphicLib.centerOnParent(jdmlos, 550, 350); + jdmlos.setVisible( true ); ignored = jdmlos.getIgnored(); selected = jdmlos.getSelected(); diff --git a/src/ui/tmlad/TGConnectorTMLAD.java b/src/ui/tmlad/TGConnectorTMLAD.java index c91b04104c..291b36d8fb 100755 --- a/src/ui/tmlad/TGConnectorTMLAD.java +++ b/src/ui/tmlad/TGConnectorTMLAD.java @@ -56,8 +56,9 @@ import ui.*; public class TGConnectorTMLAD extends TGConnector { protected int arrowLength = 10; - public TGConnectorTMLAD(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) { + public TGConnectorTMLAD(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector<Point> _listPoint) { super(_x, _y, _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint); + myImageIcon = IconManager.imgic202; } diff --git a/src/ui/tmlad/TMLADDecrypt.java b/src/ui/tmlad/TMLADDecrypt.java index 7cea44ed19..6f994a44ab 100755 --- a/src/ui/tmlad/TMLADDecrypt.java +++ b/src/ui/tmlad/TMLADDecrypt.java @@ -59,7 +59,7 @@ import myutil.*; public class TMLADDecrypt extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight { private int lineLength = 5; - private int textX, textY; +// private int textX, textY; private int ilength = 20; private int ex=5; private int lineLength1 = 2; @@ -71,9 +71,9 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde width = 15; height = 35; - textX = width + 5; - textY = height/2 + 5; - +// textX = width + 5; +// textY = height/2 + 5; + nbConnectingPoint = 2; connectingPoint = new TGConnectingPoint[2]; connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); @@ -128,22 +128,22 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde g.drawString("sec:"+ securityContext, x+3*width/2, y+ height/2); } -public boolean editOndoubleClick(JFrame frame) { + public boolean editOndoubleClick(JFrame frame) { String [] labels = new String[1]; String [] values = new String[1]; - labels[0] = "Security Pattern"; - values[0] = securityContext; + labels[0] = "Security Pattern"; + values[0] = securityContext; - ArrayList<String []> help = new ArrayList<String []>(); - help.add(tdp.getMGUI().getCurrentCryptoConfig()); + ArrayList<String []> help = new ArrayList<String []>(); + help.add(tdp.getMGUI().getCurrentCryptoConfig()); //JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples); - JDialogMultiString jdms = new JDialogMultiString(frame, "Setting Decryption", 1, labels, values,help); - jdms.setSize(600, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting Decryption", 1, labels, values,help); + // jdms.setSize(600, 300); + GraphicLib.centerOnParent(jdms, 600, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { - securityContext = jdms.getString(0); + securityContext = jdms.getString(0); return true; } @@ -183,8 +183,8 @@ public boolean editOndoubleClick(JFrame frame) { NodeList nli; Node n1, n2; Element elt; - int k; - String s; +// int k; +// String s; //System.out.println("Loading Synchronization gates"); //System.out.println(nl.toString()); @@ -194,8 +194,8 @@ public boolean editOndoubleClick(JFrame frame) { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADEncrypt.java b/src/ui/tmlad/TMLADEncrypt.java index d9ac938451..910306ec32 100755 --- a/src/ui/tmlad/TMLADEncrypt.java +++ b/src/ui/tmlad/TMLADEncrypt.java @@ -49,7 +49,6 @@ package ui.tmlad; import java.awt.*; import java.awt.geom.*; import javax.swing.*; -import java.util.*; import org.w3c.dom.*; @@ -59,7 +58,7 @@ import myutil.*; public class TMLADEncrypt extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight { private int lineLength = 5; - private int textX, textY; + // private int textX, textY; private int ex=5; private int ilength = 12; private int lineLength1 = 3; @@ -79,8 +78,8 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde width = 15; height = 35; - textX = width + 5; - textY = height/2 + 5; + // textX = width + 5; +// textY = height/2 + 5; nbConnectingPoint = 2; connectingPoint = new TGConnectingPoint[2]; @@ -208,32 +207,32 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde g.drawImage(IconManager.imgic7000.getImage(), x - 22, y + height/2, null); } -public boolean editOndoubleClick(JFrame frame) { + public boolean editOndoubleClick(JFrame frame) { //JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples);] - String[] values=new String[]{securityContext, type, message_overhead, encTime, size, nonce, formula, decTime, key}; - String[] nonces=tdp.getMGUI().getAllNonce(); - String[] keys = tdp.getMGUI().getAllKeys().toArray(new String[0]); - JDialogCryptographicConfiguration jdms = new JDialogCryptographicConfiguration(frame, "Setting Cryptographic Configuration properties", values, nonces, keys); - jdms.setSize(650, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed - - if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { - securityContext = jdms.getString(0); - type=jdms.getString(1); - message_overhead=jdms.getString(2); - encTime=jdms.getString(3); - size=jdms.getString(4); - nonce=jdms.getString(5); - formula = jdms.getString(6); - decTime = jdms.getString(7); - key = jdms.getString(8); - return true; - } + String[] values=new String[]{securityContext, type, message_overhead, encTime, size, nonce, formula, decTime, key}; + String[] nonces=tdp.getMGUI().getAllNonce(); + String[] keys = tdp.getMGUI().getAllKeys().toArray(new String[0]); + JDialogCryptographicConfiguration jdms = new JDialogCryptographicConfiguration(frame, "Setting Cryptographic Configuration properties", values, nonces, keys); + // jdms.setSize(650, 300); + GraphicLib.centerOnParent(jdms, 650, 300); + jdms.setVisible( true ); // blocked until dialog has been closed + + if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { + securityContext = jdms.getString(0); + type=jdms.getString(1); + message_overhead=jdms.getString(2); + encTime=jdms.getString(3); + size=jdms.getString(4); + nonce=jdms.getString(5); + formula = jdms.getString(6); + decTime = jdms.getString(7); + key = jdms.getString(8); + + return true; + } return false; - } public TGComponent isOnMe(int _x, int _y) { @@ -282,8 +281,8 @@ public boolean editOndoubleClick(JFrame frame) { NodeList nli; Node n1, n2; Element elt; - int k; - String s; + // int k; + // String s; //System.out.println("Loading Synchronization gates"); //System.out.println(nl.toString()); @@ -293,20 +292,20 @@ public boolean editOndoubleClick(JFrame frame) { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("Data")) { securityContext = elt.getAttribute("secContext"); - type= elt.getAttribute("type"); - message_overhead= elt.getAttribute("overhead"); - size= elt.getAttribute("size"); - encTime = elt.getAttribute("encTime"); - decTime = elt.getAttribute("decTime"); - nonce = elt.getAttribute("nonce"); - key = elt.getAttribute("key"); + type= elt.getAttribute("type"); + message_overhead= elt.getAttribute("overhead"); + size= elt.getAttribute("size"); + encTime = elt.getAttribute("encTime"); + decTime = elt.getAttribute("decTime"); + nonce = elt.getAttribute("nonce"); + key = elt.getAttribute("key"); //System.out.println("eventName=" +eventName + " variable=" + result); } } diff --git a/src/ui/tmlad/TMLADForLoop.java b/src/ui/tmlad/TMLADForLoop.java index 4195b611c7..6132811d5b 100755 --- a/src/ui/tmlad/TMLADForLoop.java +++ b/src/ui/tmlad/TMLADForLoop.java @@ -145,9 +145,9 @@ public class TMLADForLoop extends TGCWithoutInternalComponent implements Embedde JDialogMultiString jdms = new JDialogMultiString(frame, "Setting loop's properties", 3, labels, values); - jdms.setSize(600, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(600, 300); + GraphicLib.centerOnParent(jdms, 600, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet()) { init = jdms.getString(0); @@ -218,8 +218,8 @@ public class TMLADForLoop extends TGCWithoutInternalComponent implements Embedde NodeList nli; Node n1, n2; Element elt; - int k; - String s; +// int k; +// String s; //System.out.println("Loading Synchronization gates"); //System.out.println(nl.toString()); @@ -229,8 +229,8 @@ public class TMLADForLoop extends TGCWithoutInternalComponent implements Embedde //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADNotifiedEvent.java b/src/ui/tmlad/TMLADNotifiedEvent.java index d2c162d416..173d08929a 100755 --- a/src/ui/tmlad/TMLADNotifiedEvent.java +++ b/src/ui/tmlad/TMLADNotifiedEvent.java @@ -180,9 +180,9 @@ public class TMLADNotifiedEvent extends TGCWithoutInternalComponent implements E values[1] = result; JDialogMultiString jdms = new JDialogMultiString(frame, "Setting event's properties", 2, labels, values); - jdms.setSize(350, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms, 350, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { eventName = jdms.getString(0); @@ -214,8 +214,8 @@ public class TMLADNotifiedEvent extends TGCWithoutInternalComponent implements E NodeList nli; Node n1, n2; Element elt; - int k; - String s; +// int k; +// String s; //System.out.println("Loading Synchronization gates"); //System.out.println(nl.toString()); @@ -225,8 +225,8 @@ public class TMLADNotifiedEvent extends TGCWithoutInternalComponent implements E //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADRandom.java b/src/ui/tmlad/TMLADRandom.java index 7357257bc0..185a87f981 100755 --- a/src/ui/tmlad/TMLADRandom.java +++ b/src/ui/tmlad/TMLADRandom.java @@ -135,13 +135,13 @@ public class TMLADRandom extends TGCWithoutInternalComponent implements Embedded public boolean editOndoubleClick(JFrame frame) { boolean error = false; String errors = ""; - int tmp; + // int tmp; String tmpName; JDialogTMLADRandom dialog = new JDialogTMLADRandom(frame, "Setting RANDOM attributes", getVariable(), getMinValue(), getMaxValue(), getFunctionId()); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -241,7 +241,7 @@ public class TMLADRandom extends TGCWithoutInternalComponent implements Embedded NodeList nli; Node n1, n2; Element elt; - int k; + // int k; String s; //System.out.println("Loading Synchronization gates"); @@ -252,8 +252,8 @@ public class TMLADRandom extends TGCWithoutInternalComponent implements Embedded //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADReadChannel.java b/src/ui/tmlad/TMLADReadChannel.java index 7842c7b94f..aa2a080995 100755 --- a/src/ui/tmlad/TMLADReadChannel.java +++ b/src/ui/tmlad/TMLADReadChannel.java @@ -235,9 +235,9 @@ public class TMLADReadChannel extends TGCWithoutInternalComponent implements Che // JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples); JDialogMultiString jdms = new JDialogMultiString(frame, "Setting channel's properties", 3, labels, values, help); - jdms.setSize(600, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + //jdms.setSize(600, 300); + GraphicLib.centerOnParent(jdms, 600, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { channelName = jdms.getString(0); @@ -295,8 +295,8 @@ public class TMLADReadChannel extends TGCWithoutInternalComponent implements Che //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADReadRequestArg.java b/src/ui/tmlad/TMLADReadRequestArg.java index 0416df97cd..dd1426a0d2 100755 --- a/src/ui/tmlad/TMLADReadRequestArg.java +++ b/src/ui/tmlad/TMLADReadRequestArg.java @@ -191,9 +191,9 @@ public class TMLADReadRequestArg extends TGCWithoutInternalComponent implements } JDialogMultiString jdms = new JDialogMultiString(frame, "Setting the reading of request's arguments", nParam, labels, values); - jdms.setSize(350, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + //jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms, 350, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { for(int i=0; i<nParam; i++) { @@ -255,8 +255,8 @@ public class TMLADReadRequestArg extends TGCWithoutInternalComponent implements //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADSendEvent.java b/src/ui/tmlad/TMLADSendEvent.java index 51537ac70b..b2eebdf41b 100755 --- a/src/ui/tmlad/TMLADSendEvent.java +++ b/src/ui/tmlad/TMLADSendEvent.java @@ -276,9 +276,9 @@ public class TMLADSendEvent extends TGCWithoutInternalComponent implements Check JDialogMultiString jdms = new JDialogMultiString(frame, "Setting event's properties", nParam+1, labels, values, help); - jdms.setSize(450, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(450, 300); + GraphicLib.centerOnParent(jdms, 450, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { eventName = jdms.getString(0); @@ -332,8 +332,8 @@ public class TMLADSendEvent extends TGCWithoutInternalComponent implements Check //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADSendRequest.java b/src/ui/tmlad/TMLADSendRequest.java index 06dc68d2c8..2bcefc2fcf 100755 --- a/src/ui/tmlad/TMLADSendRequest.java +++ b/src/ui/tmlad/TMLADSendRequest.java @@ -264,9 +264,9 @@ public class TMLADSendRequest extends TGCWithoutInternalComponent implements Che help.add(allOutRequests); JDialogMultiString jdms = new JDialogMultiString(frame, "Setting request's properties", nParam+1, labels, values, help); - jdms.setSize(350, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms, 350, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { requestName = jdms.getString(0); @@ -320,8 +320,8 @@ public class TMLADSendRequest extends TGCWithoutInternalComponent implements Che //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADWaitEvent.java b/src/ui/tmlad/TMLADWaitEvent.java index f146325162..cee8f31ed2 100755 --- a/src/ui/tmlad/TMLADWaitEvent.java +++ b/src/ui/tmlad/TMLADWaitEvent.java @@ -266,9 +266,9 @@ public class TMLADWaitEvent extends TGCWithoutInternalComponent implements Check help.add(allInEvents); JDialogMultiString jdms = new JDialogMultiString(frame, "Setting event's properties", nParam+1, labels, values, help); - jdms.setSize(450, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(450, 300); + GraphicLib.centerOnParent(jdms, 450, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { eventName = jdms.getString(0); @@ -322,8 +322,8 @@ public class TMLADWaitEvent extends TGCWithoutInternalComponent implements Check //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlad/TMLADWriteChannel.java b/src/ui/tmlad/TMLADWriteChannel.java index 943274d9d1..478c331fca 100755 --- a/src/ui/tmlad/TMLADWriteChannel.java +++ b/src/ui/tmlad/TMLADWriteChannel.java @@ -222,26 +222,26 @@ public class TMLADWriteChannel extends TGCWithoutInternalComponent implements Ch } public boolean editOndoubleClick(JFrame frame) { - String [] labels = new String[3]; + String [] labels = new String[3]; String [] values = new String[3]; labels[0] = "Channel name"; values[0] = channelName; - labels[1] = "Nb of samples"; + labels[1] = "Nb of samples"; values[1] = nbOfSamples; - labels[2] = "Security Pattern"; - values[2] = securityContext; + labels[2] = "Security Pattern"; + values[2] = securityContext; ArrayList<String []> help = new ArrayList<String []>(); - String[] allOutChannels = tdp.getMGUI().getAllOutChannels(); - help.add(allOutChannels); - help.add(null); - help.add(tdp.getMGUI().getCurrentCryptoConfig()); + String[] allOutChannels = tdp.getMGUI().getAllOutChannels(); + help.add(allOutChannels); + help.add(null); + help.add(tdp.getMGUI().getCurrentCryptoConfig()); //JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples); - JDialogMultiString jdms = new JDialogMultiString(frame, "Setting channel's properties", 3, labels, values, help); - jdms.setSize(600, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting channel's properties", 3, labels, values, help); + //jdms.setSize(600, 300); + GraphicLib.centerOnParent(jdms, 600, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { channelName = jdms.getString(0); @@ -285,8 +285,8 @@ public class TMLADWriteChannel extends TGCWithoutInternalComponent implements Ch //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlcd/TMLAttributeBox.java b/src/ui/tmlcd/TMLAttributeBox.java index f5eae1af18..46c92f6492 100755 --- a/src/ui/tmlcd/TMLAttributeBox.java +++ b/src/ui/tmlcd/TMLAttributeBox.java @@ -239,8 +239,8 @@ public class TMLAttributeBox extends TGCWithoutInternalComponent { String oldValue = value; JDialogAttribute jda = new JDialogAttribute(myAttributes, forbiddenNames, frame, "Setting " + attributeText + "s of " + father.getValue(), attributeText); setJDialogOptions(jda); - jda.setSize(650, 375); - GraphicLib.centerOnParent(jda); + // jda.setSize(650, 375); + GraphicLib.centerOnParent(jda, 650, 375); jda.setVisible(true); // blocked until dialog has been closed makeValue(); if (oldValue.equals(value)) { diff --git a/src/ui/tmlcd/TMLChannelProperties.java b/src/ui/tmlcd/TMLChannelProperties.java index 3d363f5487..eee9012240 100755 --- a/src/ui/tmlcd/TMLChannelProperties.java +++ b/src/ui/tmlcd/TMLChannelProperties.java @@ -134,14 +134,14 @@ public class TMLChannelProperties extends TGCWithoutInternalComponent { public boolean editOndoubleClick(JFrame frame) { String oldValue = value; - String oldName = channelName; - int oldType = type; + // String oldName = channelName; +// int oldType = type; int oldSize = size; - int oldMax = maxElt; + // int oldMax = maxElt; JDialogChannel jda = new JDialogChannel(channelName, size, type, maxElt, frame, "Setting channel's properties"); jda.setSize(350, 300); - GraphicLib.centerOnParent(jda); - jda.show(); // blocked until dialog has been closed + GraphicLib.centerOnParent(jda, 350, 300); + jda.setVisible( true ); // blocked until dialog has been closed if (jda.hasNewData()) { try { @@ -202,8 +202,8 @@ public class TMLChannelProperties extends TGCWithoutInternalComponent { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlcd/TMLEventProperties.java b/src/ui/tmlcd/TMLEventProperties.java index a24b568b57..87ef7ade75 100755 --- a/src/ui/tmlcd/TMLEventProperties.java +++ b/src/ui/tmlcd/TMLEventProperties.java @@ -141,9 +141,9 @@ public class TMLEventProperties extends TGCWithoutInternalComponent { String oldValue = valueOCL; int oldSample = maxSamples; JDialogParamFIFO jda = new JDialogParamFIFO(eventName, list[0].getType(), list[1].getType(), list[2].getType(), isFinite, isBlocking, ""+maxSamples, frame, "Setting properties"); - jda.setSize(350, 350); - GraphicLib.centerOnParent(jda); - jda.show(); // blocked until dialog has been closed + // jda.setSize(350, 350); + GraphicLib.centerOnParent(jda, 350, 350); + jda.setVisible( true ); // blocked until dialog has been closed if (jda.hasNewData()) { try { diff --git a/src/ui/tmlcd/TMLRequestProperties.java b/src/ui/tmlcd/TMLRequestProperties.java index 67855e7c16..32e720bc5f 100755 --- a/src/ui/tmlcd/TMLRequestProperties.java +++ b/src/ui/tmlcd/TMLRequestProperties.java @@ -126,9 +126,9 @@ public class TMLRequestProperties extends TGCWithoutInternalComponent { public boolean editOndoubleClick(JFrame frame) { String oldValue = valueOCL; JDialogParam jda = new JDialogParam(reqName, list[0].getType(), list[1].getType(), list[2].getType(), frame, "Setting properties"); - jda.setSize(350, 350); - GraphicLib.centerOnParent(jda); - jda.show(); // blocked until dialog has been closed + // jda.setSize(350, 350); + GraphicLib.centerOnParent(jda, 350, 350); + jda.setVisible( true ); // blocked until dialog has been closed if (jda.hasNewData()) { reqName = jda.getParamName(); diff --git a/src/ui/tmlcompd/TMLCCompositeComponent.java b/src/ui/tmlcompd/TMLCCompositeComponent.java index 7ebb96d449..d8b0b3a38f 100755 --- a/src/ui/tmlcompd/TMLCCompositeComponent.java +++ b/src/ui/tmlcompd/TMLCCompositeComponent.java @@ -54,16 +54,13 @@ import org.w3c.dom.*; import myutil.*; import ui.*; -import ui.window.*; - -import tmltranslator.*; public class TMLCCompositeComponent extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, HiddenInternalComponents { private int maxFontSize = 20; private int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; - private int spacePt = 3; +// private int spacePt = 3; private Color myColor; private int iconSize = 17; @@ -397,7 +394,7 @@ public class TMLCCompositeComponent extends TGCScalableWithInternalComponent imp } } - public ArrayList<TMLCPrimitiveComponent> getAllPrimitiveComponents() { + public java.util.List<TMLCPrimitiveComponent> getAllPrimitiveComponents() { ArrayList<TMLCPrimitiveComponent> ll = new ArrayList<TMLCPrimitiveComponent>(); for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof TMLCCompositeComponent) { @@ -506,10 +503,11 @@ public class TMLCCompositeComponent extends TGCScalableWithInternalComponent imp public TMLCPrimitiveComponent getPrimitiveComponentByName(String _name) { TMLCPrimitiveComponent tgc; - ListIterator li = getAllPrimitiveComponents().listIterator(); + ListIterator<TMLCPrimitiveComponent> li = getAllPrimitiveComponents().listIterator(); while(li.hasNext()) { - tgc = (TMLCPrimitiveComponent)(li.next()); + tgc = li.next(); + if (tgc.getValue().equals(_name)) { return tgc; } @@ -581,15 +579,15 @@ public class TMLCCompositeComponent extends TGCScalableWithInternalComponent imp NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlcompd/TMLCPrimitiveComponent.java b/src/ui/tmlcompd/TMLCPrimitiveComponent.java index 46e9902006..3d259bd61b 100755 --- a/src/ui/tmlcompd/TMLCPrimitiveComponent.java +++ b/src/ui/tmlcompd/TMLCPrimitiveComponent.java @@ -56,14 +56,12 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent { private int maxFontSize = 14; private int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; - private int spacePt = 3; +// private int spacePt = 3; private Color myColor; // Icon @@ -71,7 +69,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp private boolean iconIsDrawn = false; // Attributes - private boolean attributesAreDrawn = false; + // private boolean attributesAreDrawn = false; public HashMap<String, Integer> attrMap = new HashMap<String, Integer>(); public String mappingName; protected LinkedList<TAttribute> myAttributes; @@ -328,8 +326,8 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp // And so -> attributes! JDialogAttribute jda = new JDialogAttribute(myAttributes, null, frame, "Setting attributes of " + value, "Attribute"); setJDialogOptions(jda); - jda.setSize(650, 375); - GraphicLib.centerOnParent(jda); + // jda.setSize(650, 375); + GraphicLib.centerOnParent(jda, 650, 375); jda.setVisible(true); // blocked until dialog has been closed //makeValue(); //if (oldValue.equals(value)) { @@ -467,7 +465,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp if (child instanceof String) { return 0; } else { - Object o; + // Object o; if (myAttributes.indexOf(child) > -1) { return myAttributes.indexOf(child) + 1; } else { @@ -564,36 +562,36 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp return currentFontSize; } - public LinkedList<TAttribute> getAttributes() { + public java.util.List<TAttribute> getAttributes() { return myAttributes; } - public LinkedList getAllChannelsOriginPorts() { + public java.util.List<TMLCPrimitivePort> getAllChannelsOriginPorts() { return getAllPorts(0, true); } - public LinkedList getAllChannelsDestinationPorts() { + public java.util.List<TMLCPrimitivePort> getAllChannelsDestinationPorts() { return getAllPorts(0, false); } - public LinkedList getAllEventsOriginPorts() { + public java.util.List<TMLCPrimitivePort> getAllEventsOriginPorts() { return getAllPorts(1, true); } - public LinkedList getAllEventsDestinationPorts() { + public java.util.List<TMLCPrimitivePort> getAllEventsDestinationPorts() { return getAllPorts(1, false); } - public LinkedList getAllRequestsDestinationPorts() { + public java.util.List<TMLCPrimitivePort> getAllRequestsDestinationPorts() { return getAllPorts(2, false); } - public LinkedList getAllRequestsOriginPorts() { + public java.util.List<TMLCPrimitivePort> getAllRequestsOriginPorts() { return getAllPorts(2, true); } - public LinkedList getAllPorts(int _type, boolean _isOrigin) { - LinkedList ret = new LinkedList(); + public java.util.List<TMLCPrimitivePort> getAllPorts(int _type, boolean _isOrigin) { + java.util.List<TMLCPrimitivePort> ret = new LinkedList<TMLCPrimitivePort>(); TMLCPrimitivePort port; //TraceManager.addDev("Type = " + _type + " isOrigin=" + _isOrigin); @@ -612,8 +610,8 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp return ret; } - public ArrayList<TMLCPrimitivePort> getAllInternalPrimitivePorts() { - ArrayList<TMLCPrimitivePort> list = new ArrayList<TMLCPrimitivePort>(); + public java.util.List<TMLCPrimitivePort> getAllInternalPrimitivePorts() { + java.util.List<TMLCPrimitivePort> list = new ArrayList<TMLCPrimitivePort>(); for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof TMLCPrimitivePort) { list.add((TMLCPrimitivePort)(tgcomponent[i])); diff --git a/src/ui/tmlcompd/TMLCPrimitivePort.java b/src/ui/tmlcompd/TMLCPrimitivePort.java index e5ca7f682d..28c5a81a51 100755 --- a/src/ui/tmlcompd/TMLCPrimitivePort.java +++ b/src/ui/tmlcompd/TMLCPrimitivePort.java @@ -56,8 +56,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent implements SwallowedTGComponent, WithAttributes { protected Color myColor; protected int orientation; @@ -460,7 +458,7 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent // TGConnecting points .. public void setOrientation(int orientation) { currentOrientation = orientation; - double w0, h0,w1, h1; + double w0, h0;//,w1, h1; switch(orientation) { case GraphicLib.NORTH: @@ -526,7 +524,7 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent //System.out.println("Double click!"); //String oldValue = valueOCL; int oldSample = maxSamples; - int oldWidthSample = widthSamples; + // int oldWidthSample = widthSamples; Vector<String> otherTypes; @@ -838,7 +836,7 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent // Event and Request } else { attr += "("; - TType type1; + // TType type1; for(int i=0; i<nbMaxAttribute; i++) { if (i!=0) { attr += ","; diff --git a/src/ui/tmlcompd/TMLCRecordComponent.java b/src/ui/tmlcompd/TMLCRecordComponent.java index 28db26a769..55fdaaabd5 100755 --- a/src/ui/tmlcompd/TMLCRecordComponent.java +++ b/src/ui/tmlcompd/TMLCRecordComponent.java @@ -56,22 +56,20 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class TMLCRecordComponent extends TGCScalableWithInternalComponent implements SwallowedTGComponent { private int maxFontSize = 14; private int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; - private int spacePt = 3; +// private int spacePt = 3; private Color myColor; // Icon private int iconSize = 15; - private boolean iconIsDrawn = false; + //private boolean iconIsDrawn = false; // Attributes - private boolean attributesAreDrawn = false; + //private boolean attributesAreDrawn = false; protected LinkedList<TAttribute> myAttributes; private int textX = 15; // border for ports private double dtextX = 0.0; @@ -183,11 +181,12 @@ public class TMLCRecordComponent extends TGCScalableWithInternalComponent implem // Icon if ((width>30) && (height > (iconSize + 2*textX))) { - iconIsDrawn = true; + //iconIsDrawn = true; g.drawImage(IconManager.imgic1200.getImage(), x + width - iconSize - textX, y + textX, null); - } else { - iconIsDrawn = false; - } + } +// else { +// iconIsDrawn = false; +// } // Attributes if (((TMLComponentTaskDiagramPanel)tdp).areAttributesVisible()) { @@ -289,8 +288,8 @@ public class TMLCRecordComponent extends TGCScalableWithInternalComponent implem // And so -> attributes! JDialogAttribute jda = new JDialogAttribute(myAttributes, null, frame, "Setting fields of " + value, "Field"); setJDialogOptions(jda); - jda.setSize(650, 375); - GraphicLib.centerOnParent(jda); + // jda.setSize(650, 375); + GraphicLib.centerOnParent(jda, 650, 375); jda.setVisible(true); // blocked until dialog has been closed //makeValue(); //if (oldValue.equals(value)) { @@ -361,7 +360,7 @@ public class TMLCRecordComponent extends TGCScalableWithInternalComponent implem if (child instanceof String) { return 0; } else { - Object o; + //Object o; return myAttributes.indexOf(child) + 1; } } diff --git a/src/ui/tmlcompd/TMLCRemoteCompositeComponent.java b/src/ui/tmlcompd/TMLCRemoteCompositeComponent.java index c27cb0d920..7e5b8027e1 100755 --- a/src/ui/tmlcompd/TMLCRemoteCompositeComponent.java +++ b/src/ui/tmlcompd/TMLCRemoteCompositeComponent.java @@ -56,14 +56,12 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class TMLCRemoteCompositeComponent extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent { private int maxFontSize = 20; private int minFontSize = 4; private int currentFontSize = -1; private boolean displayText = true; - private int spacePt = 3; +// private int spacePt = 3; private Color myColor; private int iconSize = 17; private boolean iconIsDrawn = false; @@ -295,9 +293,9 @@ public class TMLCRemoteCompositeComponent extends TGCScalableWithInternalCompone } JDialogTMLRemoteCompositeComponent dialog = new JDialogTMLRemoteCompositeComponent(frame, "Setting referenced component", this); - dialog.setSize(400, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog, 400, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -348,25 +346,25 @@ public class TMLCRemoteCompositeComponent extends TGCScalableWithInternalCompone NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; int j, k; int index; - int cpt; + // int cpt; int cptk = 0; - TMLCReferencePortConnectingPoint point; + // TMLCReferencePortConnectingPoint point; TMLCRemotePortCompositeComponent pcc; TGConnectingPoint[] old = null; ArrayList<TMLCCompositePort> tmp = null; - ArrayList<TMLCReferencePortConnectingPoint> points = new ArrayList<TMLCReferencePortConnectingPoint>(); + //ArrayList<TMLCReferencePortConnectingPoint> points = new ArrayList<TMLCReferencePortConnectingPoint>(); for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //TraceManager.addDev(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //TraceManager.addDev(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; @@ -513,22 +511,22 @@ public class TMLCRemoteCompositeComponent extends TGCScalableWithInternalCompone } } - public ArrayList<TMLCPrimitiveComponent> getAllPrimitiveComponents() { + public java.util.List<TMLCPrimitiveComponent> getAllPrimitiveComponents() { if (tmlcc == null) { return new ArrayList<TMLCPrimitiveComponent>(); } return tmlcc.getAllPrimitiveComponents(); } - public ArrayList<TMLCRecordComponent> getAllRecordComponents() { + public java.util.List<TMLCRecordComponent> getAllRecordComponents() { if (tmlcc == null) { return new ArrayList<TMLCRecordComponent>(); } return tmlcc.getAllRecordComponents(); } - public ArrayList<TMLCCompositePort> getAllInternalCompositePorts() { - ArrayList<TMLCCompositePort> list = new ArrayList<TMLCCompositePort>(); + public java.util.List<TMLCCompositePort> getAllInternalCompositePorts() { + java.util.List<TMLCCompositePort> list = new ArrayList<TMLCCompositePort>(); if (tmlcc == null) { return list; } @@ -588,7 +586,7 @@ public class TMLCRemoteCompositeComponent extends TGCScalableWithInternalCompone int i, j; TMLCCompositePort tmp; TMLCReferencePortConnectingPoint point; - int x1, y1, x2, y2, w, h; + // int x1, y1, x2, y2, w, h; // Close attention to the list diff --git a/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java b/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java index 28e9584989..3648a49109 100755 --- a/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java +++ b/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java @@ -52,7 +52,6 @@ import org.w3c.dom.*; import ui.*; import ui.tmldd.*; -import ui.tmlcd.*; import java.util.*; import myutil.*; @@ -107,12 +106,14 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi //resetAllInstancesOf(tgcc); return true; } + if (tgc instanceof TMLCCompositeComponent) { TMLCCompositeComponent tmcc = (TMLCCompositeComponent)(tgc); - ListIterator iterator = tmcc.getAllPrimitiveComponents().listIterator(); + Iterator<TMLCPrimitiveComponent> iterator = tmcc.getAllPrimitiveComponents().listIterator(); TMLCPrimitiveComponent tmcpc; + while(iterator.hasNext()) { - tmcpc = (TMLCPrimitiveComponent)(iterator.next()); + tmcpc = iterator.next(); mgui.removeTMLCPrimitiveComponent(tp, tmcpc.getValue()); } //resetAllInstancesOf(tgcc); @@ -180,12 +181,13 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } public boolean nameAllRecordComponentInUse(String oldValue, String newValue) { - LinkedList ll = getRecordComponentList(); - ListIterator iterator = ll.listIterator(); + // LinkedList ll = getRecordComponentList(); + Iterator<TMLCRecordComponent> iterator = getRecordComponentList().listIterator(); TMLCRecordComponent record; while(iterator.hasNext()) { - record = (TMLCRecordComponent)(iterator.next()); + record = iterator.next(); + if (record.getName().compareTo(newValue) == 0) { return true; } @@ -194,18 +196,17 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return false; } - - public LinkedList getRecordComponentList() { - LinkedList ll = new LinkedList(); + public LinkedList<TMLCRecordComponent> getRecordComponentList() { + LinkedList<TMLCRecordComponent> ll = new LinkedList<TMLCRecordComponent>(); TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCRecordComponent) { - ll.add(tgc); + ll.add((TMLCRecordComponent) tgc); } if (tgc instanceof TMLCCompositeComponent) { @@ -220,18 +221,17 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return ll; } - - public LinkedList getPrimitiveComponentList() { - LinkedList ll = new LinkedList(); + public List<TMLCPrimitiveComponent> getPrimitiveComponentList() { + List<TMLCPrimitiveComponent> ll = new LinkedList<TMLCPrimitiveComponent>(); TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCPrimitiveComponent) { - ll.add(tgc); + ll.add( (TMLCPrimitiveComponent) tgc ); } if (tgc instanceof TMLCCompositeComponent) { @@ -246,209 +246,213 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return ll; } - public LinkedList getPortsConnectedTo(TMLCPrimitivePort _port, LinkedList componentsToTakeIntoAccount) { - LinkedList ll; - LinkedList ret = new LinkedList(); + public List<TMLCPrimitivePort> getPortsConnectedTo(TMLCPrimitivePort _port, List<? extends TGComponent> componentsToTakeIntoAccount) { + List<TGComponent> ll; + List<TMLCPrimitivePort> ret = new LinkedList<TMLCPrimitivePort>(); Object o; TMLCPrimitivePort p; ll = getAllPortsConnectedTo(_port); - ListIterator li = ll.listIterator(); + Iterator<TGComponent> li = ll.listIterator(); while(li.hasNext()) { o = li.next(); + if (o instanceof TMLCPrimitivePort) { p = (TMLCPrimitivePort)o; - if (p.getFather() != null) { - if (p.getFather() instanceof TMLCPrimitiveComponent) { - if (componentsToTakeIntoAccount.contains(p.getFather())) { - TraceManager.addDev("-> port " + _port + " is connected to " + o); - ret.add(o); - } + + // if (p.getFather() != null) { + if (p.getFather() instanceof TMLCPrimitiveComponent) { + if (componentsToTakeIntoAccount.contains(p.getFather())) { + TraceManager.addDev("-> port " + _port + " is connected to " + o); + ret.add( p ); } } + // } } } return ret; } - public LinkedList getAllPortsConnectedTo(TMLCPrimitivePort _port) { - LinkedList ll = new LinkedList(); - getAllPortsConnectedTo(ll, _port); + public List<TGComponent> getAllPortsConnectedTo(TMLCPrimitivePort _port) { + List<TGComponent> ll = new LinkedList<TGComponent>(); + getAllPortsConnectedTo( ll, _port ); + return ll; } - public ArrayList<String> getAllTMLCommunicationNames(String _topname) { - ArrayList<String> al = new ArrayList<String>(); + public List<String> getAllTMLCommunicationNames(String _topname) { + List<String> al = new ArrayList<String>(); - TGComponent tgc; + // TGComponent tgc; TMLCPrimitiveComponent tmlc; - LinkedList components = getPrimitiveComponentList(); - ListIterator iterator = components.listIterator(); - ListIterator li, li2; - LinkedList ports, portstome; + List<TMLCPrimitiveComponent> components = getPrimitiveComponentList(); + Iterator<TMLCPrimitiveComponent> iterator = components.listIterator(); + Iterator<TMLCPrimitivePort> li;//, li2; + List<TMLCPrimitivePort> ports, portstome; String name, name1, name2; TMLCPrimitivePort port1, port2; int j; - //TMLTaskInterface t1, t2; - //TMLChannel channel; - //TMLTask tt1, tt2; - //TraceManager.addDev("*** Adding channels ***"); while( iterator.hasNext() ) { - tgc = ( TGComponent )( iterator.next() ); - if( tgc instanceof TMLCPrimitiveComponent ) { - tmlc = ( TMLCPrimitiveComponent )tgc; - //TraceManager.addDev("Component:" + tmlc.getValue()); - ports = tmlc.getAllChannelsOriginPorts(); - //TraceManager.addDev("Ports size:" + ports.size()); - li = ports.listIterator(); - while( li.hasNext() ) { - port1 = (TMLCPrimitivePort)( li.next() ); - portstome = getPortsConnectedTo( port1, components ); - //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); - - ListIterator ite = portstome.listIterator(); - while( ite.hasNext()) { - //if ( portstome.size() == 1 ) { - //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); - port2 = ( TMLCPrimitivePort )(ite.next()); - if (!port2.isOrigin()) { - String []text1 = port1.getPortName().split( "," ); - String []text2 = port2.getPortName().split( "," ); - for ( j = 0; j < Math.min( text1.length, text2.length ); j++ ) { - name1 = text1[j].trim(); - name2 = text2[j].trim(); - if( name1.equals( name2 ) ) { - name = name1; - } - else { - name = name1 + "__" + name2; - } - //TraceManager.addDev( "About to add " + _topname + " " + name + " " ); - al.add( _topname + "::" + name ); +// tgc = iterator.next(); +// if( tgc instanceof TMLCPrimitiveComponent ) { + tmlc = iterator.next(); + //TraceManager.addDev("Component:" + tmlc.getValue()); + ports = tmlc.getAllChannelsOriginPorts(); + //TraceManager.addDev("Ports size:" + ports.size()); + li = ports.listIterator(); + while( li.hasNext() ) { + port1 = li.next(); + portstome = getPortsConnectedTo( port1, components ); + //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); + + Iterator<TMLCPrimitivePort> ite = portstome.listIterator(); + + while( ite.hasNext()) { + //if ( portstome.size() == 1 ) { + //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); + port2 = ite.next(); + if (!port2.isOrigin()) { + String []text1 = port1.getPortName().split( "," ); + String []text2 = port2.getPortName().split( "," ); + for ( j = 0; j < Math.min( text1.length, text2.length ); j++ ) { + name1 = text1[j].trim(); + name2 = text2[j].trim(); + if( name1.equals( name2 ) ) { + name = name1; + } + else { + name = name1 + "__" + name2; } + //TraceManager.addDev( "About to add " + _topname + " " + name + " " ); + al.add( _topname + "::" + name ); } } } } +// } } + return al; } - public ArrayList<String> getAllTMLInputPorts( String _topname ) { //the destination ports + public List<String> getAllTMLInputPorts( String _topname ) { //the destination ports //Use HashSet to avoid returning multiple identical ports due to the presence of join nodes - HashSet<String> al = new HashSet<String>(); + Set<String> al = new HashSet<String>(); - TGComponent tgc; + // TGComponent tgc; TMLCPrimitiveComponent tmlc; - LinkedList components = getPrimitiveComponentList(); - ListIterator iterator = components.listIterator(); - ListIterator li, li2; - LinkedList ports, portstome; - String name, name1, name2; + List<TMLCPrimitiveComponent> components = getPrimitiveComponentList(); + Iterator<TMLCPrimitiveComponent> iterator = components.listIterator(); + Iterator<TMLCPrimitivePort> li;//, li2; + List<TMLCPrimitivePort> ports, portstome; + String name2; TMLCPrimitivePort port1, port2; int j; while( iterator.hasNext() ) { - tgc = ( TGComponent )( iterator.next() ); - if( tgc instanceof TMLCPrimitiveComponent ) { - tmlc = ( TMLCPrimitiveComponent )tgc; - //TraceManager.addDev("Component:" + tmlc.getValue()); - ports = tmlc.getAllChannelsOriginPorts(); - //TraceManager.addDev("Ports size:" + ports.size()); - li = ports.listIterator(); - while( li.hasNext() ) { - port1 = (TMLCPrimitivePort)( li.next() ); - portstome = getPortsConnectedTo( port1, components ); //this prints the ports via TraceManager - //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); - ListIterator ite = portstome.listIterator(); - while( ite.hasNext()) { - //if ( portstome.size() == 1 ) { - //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); - port2 = ( TMLCPrimitivePort )(ite.next()); - if( !port2.isOrigin() ) { - String []text1 = port1.getPortName().split( "," ); - String []text2 = port2.getPortName().split( "," ); - for( j = 0; j < Math.min( text1.length, text2.length ); j++ ) { - name1 = text1[j].trim(); - name2 = text2[j].trim(); - //TraceManager.addDev( "The input port is: " + name2 ); - al.add( _topname + "::" + name2 ); - } + //tgc = iterator.next(); + + //if( tgc instanceof TMLCPrimitiveComponent ) { + tmlc = iterator.next(); + //TraceManager.addDev("Component:" + tmlc.getValue()); + ports = tmlc.getAllChannelsOriginPorts(); + //TraceManager.addDev("Ports size:" + ports.size()); + li = ports.listIterator(); + while( li.hasNext() ) { + port1 = li.next(); + portstome = getPortsConnectedTo( port1, components ); //this prints the ports via TraceManager + //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); + Iterator<TMLCPrimitivePort> ite = portstome.listIterator(); + while( ite.hasNext()) { + //if ( portstome.size() == 1 ) { + //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); + port2 = ( TMLCPrimitivePort )(ite.next()); + if( !port2.isOrigin() ) { + String []text1 = port1.getPortName().split( "," ); + String []text2 = port2.getPortName().split( "," ); + for( j = 0; j < Math.min( text1.length, text2.length ); j++ ) { + //name1 = text1[j].trim(); + name2 = text2[j].trim(); + //TraceManager.addDev( "The input port is: " + name2 ); + al.add( _topname + "::" + name2 ); } } } } + //} } return new ArrayList<String>(al); //return ArrayList<String>( Arrays.asListal ); } - public ArrayList<String> getAllTMLEventNames( String _topname ) { + public List<String> getAllTMLEventNames( String _topname ) { - ArrayList<String> al = new ArrayList<String>(); - TGComponent tgc; + List<String> al = new ArrayList<String>(); + // TGComponent tgc; TMLCPrimitiveComponent tmlc; - LinkedList components = getPrimitiveComponentList(); - ListIterator iterator = components.listIterator(); - ListIterator li, li2; - LinkedList ports, portstome; + List<TMLCPrimitiveComponent> components = getPrimitiveComponentList(); + Iterator<TMLCPrimitiveComponent> iterator = components.listIterator(); + Iterator<TMLCPrimitivePort> li;//, li2; + List<TMLCPrimitivePort> ports, portstome; String name, name1, name2; TMLCPrimitivePort port1, port2; int j; while( iterator.hasNext() ) { - tgc = ( TGComponent )( iterator.next() ); - if( tgc instanceof TMLCPrimitiveComponent ) { - tmlc = ( TMLCPrimitiveComponent )tgc; + tmlc = iterator.next() ; + // if( tgc instanceof TMLCPrimitiveComponent ) { + // tmlc = ( TMLCPrimitiveComponent )tgc; //TraceManager.addDev("Component:" + tmlc.getValue()); - ports = tmlc.getAllEventsOriginPorts(); + ports = tmlc.getAllEventsOriginPorts(); //TraceManager.addDev("Ports size:" + ports.size()); - li = ports.listIterator(); - while( li.hasNext() ) { - port1 = (TMLCPrimitivePort)( li.next() ); - portstome = getPortsConnectedTo( port1, components ); - //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); - ListIterator ite = portstome.listIterator(); - //while(ite.hasNext()) { - //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); - //} - if ( portstome.size() == 1 ) { - port2 = ( TMLCPrimitivePort )( portstome.get(0) ); - String []text1 = port1.getPortName().split( "," ); - String []text2 = port2.getPortName().split( "," ); - for ( j = 0; j < Math.min( text1.length, text2.length ); j++ ) { - name1 = text1[j].trim(); - name2 = text2[j].trim(); - if( name1.equals( name2 ) ) { - name = name1; - } - else { - name = name1 + "__" + name2; - } - al.add( _topname + "::" + name ); + li = ports.listIterator(); + while( li.hasNext() ) { + port1 = li.next(); + portstome = getPortsConnectedTo( port1, components ); + //TraceManager.addDev("Considering port1 = " +port1.getPortName() + " size of connecting ports:" + portstome.size()); + //Iterator<TMLCPrimitivePort> ite = portstome.listIterator(); + //while(ite.hasNext()) { + //TraceManager.addDev("port=" + ((TMLCPrimitivePort)(ite.next())).getPortName()); + //} + if ( portstome.size() == 1 ) { + port2 = ( TMLCPrimitivePort )( portstome.get(0) ); + String []text1 = port1.getPortName().split( "," ); + String []text2 = port2.getPortName().split( "," ); + for ( j = 0; j < Math.min( text1.length, text2.length ); j++ ) { + name1 = text1[j].trim(); + name2 = text2[j].trim(); + if( name1.equals( name2 ) ) { + name = name1; + } + else { + name = name1 + "__" + name2; } + al.add( _topname + "::" + name ); } } } + //} } + return al; } - public void getAllPortsConnectedTo(LinkedList ll, TMLCPrimitivePort _port) { - LinkedList components = getMGUI().getAllTMLComponents(); - ListIterator iterator = components.listIterator(); + public void getAllPortsConnectedTo( List<TGComponent> ll, TMLCPrimitivePort _port) { + List<TGComponent> components = getMGUI().getAllTMLComponents(); + Iterator<TGComponent> iterator = components.listIterator(); TGComponent tgc, tgc1, tgc2; TMLCPortConnector portco; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLCPortConnector) { portco = (TMLCPortConnector)tgc; //System.out.println("portco"); @@ -546,14 +550,15 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return s; } - public ArrayList<String> getAllNonMappedTMLPrimitiveComponentNames(String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) { + public List<String> getAllNonMappedTMLPrimitiveComponentNames(String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) { TGComponent tgc; - Iterator iterator = componentList.listIterator(); - ArrayList<String> list = new ArrayList<String>(); - String name; + Iterator<TGComponent> iterator = componentList.listIterator(); + List<String> list = new ArrayList<String>(); + //String name; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLCPrimitiveComponent) { addNonMappedTMLPritimiveComponentsNames((TMLCPrimitiveComponent)tgc, list, _topName, _tadp, ref, _name); } @@ -561,10 +566,11 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi getAllNonMappedTMLPrimitiveComponentNamesByComponent(tgc, list, _topName, _tadp, ref, _name); } } + return list; } - public void getAllNonMappedTMLPrimitiveComponentNamesByComponent(TGComponent tgc, ArrayList<String> list, String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) { + public void getAllNonMappedTMLPrimitiveComponentNamesByComponent(TGComponent tgc, List<String> list, String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) { TGComponent tgc1; for(int i=0; i<tgc.getNbInternalTGComponent(); i++) { @@ -583,10 +589,10 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi TGComponent tgc1; String s; TMLCCompositeComponent tmlcc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc1 = (TGComponent)(iterator.next()); + tgc1 = iterator.next(); if (tgc1 instanceof TMLCCompositeComponent) { tmlcc = (TMLCCompositeComponent)tgc1; @@ -599,8 +605,9 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return list; } - public void addNonMappedTMLPritimiveComponentsNames(TMLCPrimitiveComponent tgc, ArrayList<String> list, String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) { + public void addNonMappedTMLPritimiveComponentsNames(TMLCPrimitiveComponent tgc, List<String> list, String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) { String name1 = tgc.getValue(); + if (ref && name1.equals(_name)) { list.add(_topName + "::" + name1); } else { @@ -612,8 +619,8 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi public TMLCPrimitiveComponent getPrimitiveComponentByName(String _name) { TGComponent tgc; - Iterator iterator = componentList.listIterator(); - ArrayList<String> list = new ArrayList<String>(); + Iterator<TGComponent> iterator = componentList.listIterator(); + // List<String> list = new ArrayList<String>(); TMLCPrimitiveComponent tmp; while(iterator.hasNext()) { @@ -644,11 +651,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi public void updateReferenceToTMLCCompositeComponent(TMLCCompositeComponent tmlcc) { //System.out.println("Update from " + tmlcc.getValue()); - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLCCompositeComponent) { ((TMLCCompositeComponent)tgc).updateReferenceToTMLCCompositeComponent(tmlcc); } @@ -661,11 +669,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi public TMLCCompositeComponent getCompositeComponentByName(String _name) { TGComponent tgc; - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); TMLCCompositeComponent tmp; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLCCompositeComponent) { tmp = (TMLCCompositeComponent)tgc; if (tmp.getValue().equals(_name)) { @@ -682,14 +691,15 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } public void hideConnectors() { - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); TMLCPortConnector connector; TGComponent tgc; TGComponent tgc1; TGComponent tgc2; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLCPortConnector) { connector = (TMLCPortConnector) tgc; tgc1 = getComponentToWhichBelongs(connector.getTGConnectingPointP1()); @@ -862,12 +872,13 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi //System.out.println("list size=" + componentList.size()); - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); - ArrayList<TGComponent> list = new ArrayList<TGComponent>(); + List<TGComponent> list = new ArrayList<TGComponent>(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (!(tgc instanceof TGConnector)) { list.add(tgc); } @@ -883,13 +894,13 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } public void delayedLoad() { - Iterator iterator; + Iterator<TGComponent> iterator; TGComponent tgc; iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCCompositeComponent) { ((TMLCCompositeComponent)(tgc)).delayedLoad(); @@ -906,7 +917,7 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi public void updatePorts() { TraceManager.addDev("Making paths"); - ArrayList<TMLCPath> paths = makePaths(); + List<TMLCPath> paths = makePaths(); // Checking rules of paths, and setting colors accordingly for(TMLCPath path: paths) { @@ -922,19 +933,19 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi public void updatePorts_oldVersion() { TraceManager.addDev("Update ports / nb of components = " + componentList.size()); - Iterator iterator; + Iterator<TGComponent> iterator; TGComponent tgc; // Get all TMLCPrimitivePort - ArrayList<TMLCCompositePort> ports = new ArrayList<TMLCCompositePort>(); - ArrayList<TMLCCompositePort> referencedports = new ArrayList<TMLCCompositePort>(); - ArrayList<TMLCPrimitivePort> pports = new ArrayList<TMLCPrimitivePort>(); - ArrayList<TMLCChannelFacility> facilities = new ArrayList<TMLCChannelFacility>(); + List<TMLCCompositePort> ports = new ArrayList<TMLCCompositePort>(); + List<TMLCCompositePort> referencedports = new ArrayList<TMLCCompositePort>(); + List<TMLCPrimitivePort> pports = new ArrayList<TMLCPrimitivePort>(); + List<TMLCChannelFacility> facilities = new ArrayList<TMLCChannelFacility>(); iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCCompositeComponent) { ports.addAll(((TMLCCompositeComponent)tgc).getAllInternalCompositePorts()); @@ -1003,7 +1014,7 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi //boolean conflict = false; String conflictMessage = null; String conflictMessageTmp; - boolean ret; + // boolean ret; int outindex, inindex; if (tp == connector.getTGConnectingPointP1()) { @@ -1208,20 +1219,21 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } } - public ArrayList<String> getAllTMLTaskNames(String _topname) { + public List<String> getAllTMLTaskNames(String _topname) { TGComponent tgc; - Iterator iterator = componentList.listIterator(); - ArrayList<String> list = new ArrayList<String>(); + Iterator<TGComponent> iterator = componentList.listIterator(); + List<String> list = new ArrayList<String>(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); - if (tgc instanceof TMLCPrimitiveComponent) { - list.add(_topname + "::" + ((TMLCPrimitiveComponent)tgc).getValue()); - } + tgc = iterator.next(); + + if (tgc instanceof TMLCPrimitiveComponent) { + list.add(_topname + "::" + ((TMLCPrimitiveComponent)tgc).getValue()); + } } return list; - } + } /*public ArrayList<String> getAllTMLCommunicationNames(String _topname) { TGComponent tgc; @@ -1292,24 +1304,25 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; }*/ - public Vector getAllTMLTasksAttributes() { + public Vector<String> getAllTMLTasksAttributes() { TGComponent tgc; - Iterator iterator = componentList.listIterator(); - Vector list = new Vector(); + Iterator<TGComponent> iterator = componentList.listIterator(); + Vector<String> list = new Vector<String>(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if( tgc instanceof TMLCCompositeComponent ) { - for( TMLCPrimitiveComponent primComp: ((TMLCCompositeComponent)tgc).getAllPrimitiveComponents() ) { + for( TMLCPrimitiveComponent primComp: ((TMLCCompositeComponent)tgc).getAllPrimitiveComponents() ) { for( Object o: primComp.getAttributes() ) { String s = o.toString(); list.add( primComp.getValue() + "." + s.substring( 2, s.length()-1 ) ); } - //list.add( primComp.getAttributes() ); } } } + return list; } @@ -1319,13 +1332,14 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return list; } - public void getAllRecords(TMLCCompositeComponent comp, Vector<String> list) { + public void getAllRecords(TMLCCompositeComponent comp, Vector<String> list) { TGComponent tgc; if (comp == null) { - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLCRecordComponent) { list.add(tgc.getValue()); } @@ -1350,10 +1364,10 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi public TMLCRecordComponent getRecordNamed(TMLCCompositeComponent comp, String _nameOfRecord) { TGComponent tgc; if (comp == null) { - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCRecordComponent) { if (tgc.getValue().compareTo(_nameOfRecord) == 0) { return (TMLCRecordComponent)tgc; @@ -1376,7 +1390,7 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } - public void findAllReferencedPanels(ArrayList<TMLComponentTaskDiagramPanel> panels) { + public void findAllReferencedPanels( List<TMLComponentTaskDiagramPanel> panels) { if (panels.contains(this)) { return; } @@ -1384,11 +1398,11 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi panels.add(this); - ListIterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCRemoteCompositeComponent) { TMLCRemoteCompositeComponent remote = (TMLCRemoteCompositeComponent)tgc; @@ -1405,15 +1419,15 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } } - public ArrayList<TMLCPath> makePaths() { - ArrayList<TMLComponentTaskDiagramPanel> panels = new ArrayList<TMLComponentTaskDiagramPanel>(); + public List<TMLCPath> makePaths() { + List<TMLComponentTaskDiagramPanel> panels = new ArrayList<TMLComponentTaskDiagramPanel>(); // We first find all the implicated panels findAllReferencedPanels(panels); TraceManager.addDev("Nb of handled panels:" + panels.size()); - ArrayList<TMLCPath> paths = new ArrayList<TMLCPath>(); - ListIterator iterator; + List<TMLCPath> paths = new ArrayList<TMLCPath>(); + Iterator<TGComponent> iterator; TGComponent tgc; // Go through the compnent list of all panels, and make paths. Then, go thru connectors, and merge paths until no @@ -1423,12 +1437,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi iterator = panel.getComponentList().listIterator(); - ArrayList<TMLCCompositePort> listcp; - ArrayList<TMLCPrimitivePort> listpp; + List<TMLCCompositePort> listcp; + List<TMLCPrimitivePort> listpp; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCCompositeComponent) { listcp = ((TMLCCompositeComponent)tgc).getAllInternalCompositePorts(); @@ -1458,12 +1472,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } /* We also include the paths of diagrams referenced via referenced components */ - if (tgc instanceof TMLCRemoteCompositeComponent) { - TMLCRemoteCompositeComponent remote = (TMLCRemoteCompositeComponent)tgc; - - // Nothing to do: referenced ports are added thanks to the analyzes of the referenced panels - // and the handling of that issue in connector analysis - } +// if (tgc instanceof TMLCRemoteCompositeComponent) { +// TMLCRemoteCompositeComponent remote = (TMLCRemoteCompositeComponent)tgc; +// +// // Nothing to do: referenced ports are added thanks to the analyzes of the referenced panels +// // and the handling of that issue in connector analysis +// } } } @@ -1540,7 +1554,7 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } - public TMLCPath getPathOf(ArrayList<TMLCPath> paths, TGComponent tgc) { + public TMLCPath getPathOf( List<TMLCPath> paths, TGComponent tgc) { for(TMLCPath path: paths) { if (path.contains(tgc)) { return path; @@ -1550,12 +1564,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; } - public void addToPaths(ArrayList<TMLCPath> paths, TGComponent tgc) { - Boolean found = false; + public void addToPaths( List<TMLCPath> paths, TGComponent tgc) { + // Boolean found = false; for(TMLCPath path: paths) { if (path.contains(tgc)) { - found = true; + // found = true; return; } } @@ -1564,17 +1578,16 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi TMLCPath ph = new TMLCPath(); ph.addComponent(tgc); paths.add(ph); - } public void getPanelsUsingAComponent(TMLCCompositeComponent tmlcc, ArrayList<TMLComponentTaskDiagramPanel> panels) { //System.out.println("Update from " + tmlcc.getValue()); - Iterator iterator = componentList.listIterator(); + Iterator<TGComponent> iterator = componentList.listIterator(); TGComponent tgc; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLCCompositeComponent) { if (((TMLCCompositeComponent)tgc).hasRefencesTo(tmlcc)) { panels.add(this); @@ -1598,12 +1611,13 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; } - LinkedList ll = comp.getAllEventsOriginPorts(); + List<TMLCPrimitivePort> ll = comp.getAllEventsOriginPorts(); String[]terms = new String[ll.size()]; - ListIterator ite = ll.listIterator(); + Iterator<TMLCPrimitivePort> ite = ll.listIterator(); int i = 0; + while(ite.hasNext()) { - TMLCPrimitivePort port = (TMLCPrimitivePort)(ite.next()); + TMLCPrimitivePort port = ite.next(); terms[i] = port.getPortName(); i ++; } @@ -1617,12 +1631,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; } - LinkedList ll = comp.getAllEventsDestinationPorts(); + List<TMLCPrimitivePort> ll = comp.getAllEventsDestinationPorts(); String[]terms = new String[ll.size()]; - ListIterator ite = ll.listIterator(); + ListIterator<TMLCPrimitivePort> ite = ll.listIterator(); int i = 0; while(ite.hasNext()) { - TMLCPrimitivePort port = (TMLCPrimitivePort)(ite.next()); + TMLCPrimitivePort port = ite.next(); terms[i] = port.getPortName(); i ++; } @@ -1636,12 +1650,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; } - LinkedList ll = comp.getAllChannelsOriginPorts(); + List<TMLCPrimitivePort> ll = comp.getAllChannelsOriginPorts(); String[]terms = new String[ll.size()]; - ListIterator ite = ll.listIterator(); + Iterator<TMLCPrimitivePort> ite = ll.listIterator(); int i = 0; while(ite.hasNext()) { - TMLCPrimitivePort port = (TMLCPrimitivePort)(ite.next()); + TMLCPrimitivePort port = ite.next(); terms[i] = port.getPortName(); i++; } @@ -1655,12 +1669,12 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; } - LinkedList ll = comp.getAllRequestsOriginPorts(); + List<TMLCPrimitivePort> ll = comp.getAllRequestsOriginPorts(); String[]terms = new String[ll.size()]; - ListIterator ite = ll.listIterator(); + Iterator<TMLCPrimitivePort> ite = ll.listIterator(); int i = 0; while(ite.hasNext()) { - TMLCPrimitivePort port = (TMLCPrimitivePort)(ite.next()); + TMLCPrimitivePort port = ite.next(); terms[i] = port.getPortName(); i ++; } @@ -1674,12 +1688,13 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi return null; } - LinkedList ll = comp.getAllChannelsDestinationPorts(); + List<TMLCPrimitivePort> ll = comp.getAllChannelsDestinationPorts(); String[]terms = new String[ll.size()]; - ListIterator ite = ll.listIterator(); + Iterator<TMLCPrimitivePort> ite = ll.listIterator(); int i = 0; + while(ite.hasNext()) { - TMLCPrimitivePort port = (TMLCPrimitivePort)(ite.next()); + TMLCPrimitivePort port = ite.next(); terms[i] = port.getPortName(); i++; } diff --git a/src/ui/tmlcp/TMLCPForLoop.java b/src/ui/tmlcp/TMLCPForLoop.java index e9403575c0..30a5f1234c 100755 --- a/src/ui/tmlcp/TMLCPForLoop.java +++ b/src/ui/tmlcp/TMLCPForLoop.java @@ -134,9 +134,9 @@ public class TMLCPForLoop extends TGCWithoutInternalComponent implements Embedde JDialogMultiString jdms = new JDialogMultiString(frame, "Setting loop's properties", 3, labels, values); - jdms.setSize(400, 300); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + // jdms.setSize(400, 300); + GraphicLib.centerOnParent(jdms, 400, 300); + jdms.setVisible( true ); // blocked until dialog has been closed if (jdms.hasBeenSet()) { init = jdms.getString(0); @@ -207,8 +207,8 @@ public class TMLCPForLoop extends TGCWithoutInternalComponent implements Embedde NodeList nli; Node n1, n2; Element elt; - int k; - String s; +// int k; +// String s; //System.out.println("Loading Synchronization gates"); //System.out.println(nl.toString()); @@ -218,8 +218,8 @@ public class TMLCPForLoop extends TGCWithoutInternalComponent implements Embedde //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiArtifact.java b/src/ui/tmldd/TMLArchiArtifact.java index a4c8efe4fa..e27a5e9229 100755 --- a/src/ui/tmldd/TMLArchiArtifact.java +++ b/src/ui/tmldd/TMLArchiArtifact.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -187,9 +186,9 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa fatherArchUnitMECType = ((TMLArchiNode)father).getMECType(); } JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this, operation, fatherArchUnitMECType); - dialog.setSize(400, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog, 400, 350); + dialog.setVisible( true ); // blocked until dialog has been closed operation = dialog.getOperation(); if (!dialog.isRegularClose()) { @@ -266,7 +265,7 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sname = null, sreferenceTask = null; String prio; @@ -275,8 +274,8 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiBUSNode.java b/src/ui/tmldd/TMLArchiBUSNode.java index f6f436254d..fb5e040b3e 100755 --- a/src/ui/tmldd/TMLArchiBUSNode.java +++ b/src/ui/tmldd/TMLArchiBUSNode.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -201,9 +200,9 @@ public class TMLArchiBUSNode extends TMLArchiCommunicationNode implements Swallo String tmpName; JDialogBUSNode dialog = new JDialogBUSNode(frame, "Setting VGMN attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -335,15 +334,15 @@ public class TMLArchiBUSNode extends TMLArchiCommunicationNode implements Swallo NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiBridgeNode.java b/src/ui/tmldd/TMLArchiBridgeNode.java index c6b3df8ef9..c0a2d898e3 100755 --- a/src/ui/tmldd/TMLArchiBridgeNode.java +++ b/src/ui/tmldd/TMLArchiBridgeNode.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -176,9 +175,9 @@ public class TMLArchiBridgeNode extends TMLArchiCommunicationNode implements Swa String tmpName; JDialogBridgeNode dialog = new JDialogBridgeNode(frame, "Setting bridge attributes", this); - dialog.setSize(350, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(350, 350); + GraphicLib.centerOnParent(dialog, 350, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -260,7 +259,7 @@ public class TMLArchiBridgeNode extends TMLArchiCommunicationNode implements Swa NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -268,8 +267,8 @@ public class TMLArchiBridgeNode extends TMLArchiCommunicationNode implements Swa //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiCPNode.java b/src/ui/tmldd/TMLArchiCPNode.java index 6b7596383a..7eb8344b88 100755 --- a/src/ui/tmldd/TMLArchiCPNode.java +++ b/src/ui/tmldd/TMLArchiCPNode.java @@ -56,7 +56,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; import tmltranslator.modelcompiler.*; public class TMLArchiCPNode extends TMLArchiCommunicationNode implements SwallowTGComponent, WithAttributes, TMLArchiCPInterface { @@ -149,9 +148,11 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow for (int i=0; i<tabOfNames.length; i++) { String s = tabOfNames[i].trim(); if (s.length() > 0) { - ListIterator iterator = tdp.getComponentList().listIterator(); + ListIterator<TGComponent> iterator = tdp.getComponentList().listIterator(); + while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); + if (tgc instanceof TMLArchiNode) { //TraceManager.addDev("Testing |" + tgc.getName() + "| vs | " + s + "|"); if (tgc.getName().compareTo(s) == 0) { @@ -203,9 +204,9 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow String tmpName; JDialogReferenceCP dialog = new JDialogReferenceCP( frame, "Communication Pattern mapping", this, mappedUnits, name, cpMEC, assignedAttributes, transferType1, transferType2 ); - dialog.setSize( 700, 550 ); - GraphicLib.centerOnParent( dialog ); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize( 700, 550 ); + GraphicLib.centerOnParent( dialog, 700, 550 ); + dialog.setVisible( true ); // blocked until dialog has been closed //setJDialogOptions(jdab); name = dialog.getNodeName(); mappedUnits = dialog.getMappedUnits(); @@ -281,7 +282,7 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; mappedUnits.removeAllElements(); @@ -291,7 +292,7 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { + for(int j=0; j<nli.getLength(); j++) { n2 = nli.item(i); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { diff --git a/src/ui/tmldd/TMLArchiCommunicationArtifact.java b/src/ui/tmldd/TMLArchiCommunicationArtifact.java index f3e9163f26..a374e08677 100755 --- a/src/ui/tmldd/TMLArchiCommunicationArtifact.java +++ b/src/ui/tmldd/TMLArchiCommunicationArtifact.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -175,9 +174,9 @@ public class TMLArchiCommunicationArtifact extends TGCWithoutInternalComponent i boolean error = false; JDialogCommunicationArtifact dialog = new JDialogCommunicationArtifact(frame, "Setting channel artifact attributes", this); - dialog.setSize(700, 600); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(700, 600); + GraphicLib.centerOnParent(dialog, 700, 600); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -259,7 +258,7 @@ public class TMLArchiCommunicationArtifact extends TGCWithoutInternalComponent i NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sname = null, sreferenceCommunication = null, stype = null; String prio = null; @@ -268,8 +267,8 @@ public class TMLArchiCommunicationArtifact extends TGCWithoutInternalComponent i //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiCrossbarNode.java b/src/ui/tmldd/TMLArchiCrossbarNode.java index 915f1abfeb..5f79ae791c 100755 --- a/src/ui/tmldd/TMLArchiCrossbarNode.java +++ b/src/ui/tmldd/TMLArchiCrossbarNode.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -201,9 +200,9 @@ public class TMLArchiCrossbarNode extends TMLArchiCommunicationNode implements S String tmpName; JDialogCrossbarNode dialog = new JDialogCrossbarNode(frame, "Setting Crossbar attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -337,15 +336,15 @@ public class TMLArchiCrossbarNode extends TMLArchiCommunicationNode implements S NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiDMANode.java b/src/ui/tmldd/TMLArchiDMANode.java index 8d669b69f6..6435fe0f6c 100755 --- a/src/ui/tmldd/TMLArchiDMANode.java +++ b/src/ui/tmldd/TMLArchiDMANode.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -178,9 +177,9 @@ public class TMLArchiDMANode extends TMLArchiCommunicationNode implements Swallo String tmpName; JDialogDMANode dialog = new JDialogDMANode(frame, "Setting DMA attributes", this); - dialog.setSize(400, 300); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(400, 300); + GraphicLib.centerOnParent(dialog, 400, 300); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -276,7 +275,7 @@ public class TMLArchiDMANode extends TMLArchiCommunicationNode implements Swallo NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -284,8 +283,8 @@ public class TMLArchiDMANode extends TMLArchiCommunicationNode implements Swallo //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiEventArtifact.java b/src/ui/tmldd/TMLArchiEventArtifact.java index 1e67bdb02c..172a5baa80 100755 --- a/src/ui/tmldd/TMLArchiEventArtifact.java +++ b/src/ui/tmldd/TMLArchiEventArtifact.java @@ -48,7 +48,6 @@ knowledge of the CeCILL license and that you accept its terms. package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -166,9 +165,9 @@ public class TMLArchiEventArtifact extends TGCWithoutInternalComponent implement boolean error = false; JDialogEventArtifact dialog = new JDialogEventArtifact(frame, "Setting artifact attributes", this); - dialog.setSize(400, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog, 400, 350); + dialog.setVisible( true ); // blocked until dialog has been closed if( !dialog.isRegularClose() ) { return false; @@ -242,7 +241,7 @@ public class TMLArchiEventArtifact extends TGCWithoutInternalComponent implement NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sname = null, sreferenceCommunication = null, stype = null; String prio = null; @@ -251,8 +250,8 @@ public class TMLArchiEventArtifact extends TGCWithoutInternalComponent implement //System.out.println(n1); if( n1.getNodeType() == Node.ELEMENT_NODE ) { nli = n1.getChildNodes(); - for( int j = 0; i < nli.getLength(); i++ ) { - n2 = nli.item(i); + for( int j = 0; j < nli.getLength(); j++ ) { + n2 = nli.item(j); //System.out.println(n2); if( n2.getNodeType() == Node.ELEMENT_NODE ) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiFirewallNode.java b/src/ui/tmldd/TMLArchiFirewallNode.java index a0002a305d..ee04de7f50 100644 --- a/src/ui/tmldd/TMLArchiFirewallNode.java +++ b/src/ui/tmldd/TMLArchiFirewallNode.java @@ -56,8 +56,6 @@ import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.*; - public class TMLArchiFirewallNode extends TMLArchiCommunicationNode implements SwallowTGComponent, WithAttributes { private int textY1 = 15; private int textY2 = 30; @@ -170,13 +168,13 @@ public class TMLArchiFirewallNode extends TMLArchiCommunicationNode implements S public boolean editOndoubleClick(JFrame frame) { boolean error = false; String errors = ""; - int tmp; + // int tmp; String tmpName; JDialogFirewallNode dialog = new JDialogFirewallNode(frame, "Setting firewall attributes", this); - dialog.setSize(600, 600); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(600, 600); + GraphicLib.centerOnParent(dialog, 600, 600); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -233,7 +231,7 @@ public class TMLArchiFirewallNode extends TMLArchiCommunicationNode implements S NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -241,8 +239,8 @@ public class TMLArchiFirewallNode extends TMLArchiCommunicationNode implements S //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiHWANode.java b/src/ui/tmldd/TMLArchiHWANode.java index e8288c8a8d..0c7409e54b 100755 --- a/src/ui/tmldd/TMLArchiHWANode.java +++ b/src/ui/tmldd/TMLArchiHWANode.java @@ -178,9 +178,9 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, String tmpName; JDialogHwANode dialog = new JDialogHwANode(frame, "Setting HWA attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -321,7 +321,7 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -329,8 +329,8 @@ public class TMLArchiHWANode extends TMLArchiNode implements SwallowTGComponent, //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiKey.java b/src/ui/tmldd/TMLArchiKey.java index 5a97470238..68ac03149c 100755 --- a/src/ui/tmldd/TMLArchiKey.java +++ b/src/ui/tmldd/TMLArchiKey.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -181,9 +180,9 @@ public class TMLArchiKey extends TGCWithoutInternalComponent implements Swallowe public boolean editOndoubleClick(JFrame frame) { JDialogArchiKey dialog = new JDialogArchiKey(frame, "Setting channel artifact attributes", this); - dialog.setSize(700, 600); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(700, 600); + GraphicLib.centerOnParent(dialog, 700, 600); + dialog.setVisible( true ); // blocked until dialog has been closed String tmp; boolean error=false; if (!dialog.isRegularClose()) { @@ -262,8 +261,8 @@ public class TMLArchiKey extends TGCWithoutInternalComponent implements Swallowe NodeList nli; Node n1, n2; Element elt; - int t1id; - String svalue = null, sname = null, sreferenceCommunication = null, stype = null; + // int t1id; + String svalue = null, sreferenceCommunication = null, stype = null; String prio = null; for(int i=0; i<nl.getLength(); i++) { @@ -271,8 +270,8 @@ public class TMLArchiKey extends TGCWithoutInternalComponent implements Swallowe //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiMemoryNode.java b/src/ui/tmldd/TMLArchiMemoryNode.java index cde3f51b6a..73fa640f45 100755 --- a/src/ui/tmldd/TMLArchiMemoryNode.java +++ b/src/ui/tmldd/TMLArchiMemoryNode.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -188,9 +187,9 @@ public class TMLArchiMemoryNode extends TMLArchiCommunicationNode implements Swa String tmpName; JDialogMemoryNode dialog = new JDialogMemoryNode(frame, "Setting Memory attributes", this, bufferType ); - dialog.setSize(400, 300); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(400, 300); + GraphicLib.centerOnParent(dialog, 400, 300); + dialog.setVisible( true ); // blocked until dialog has been closed bufferType = dialog.getBufferType(); if (!dialog.isRegularClose()) { @@ -288,7 +287,7 @@ public class TMLArchiMemoryNode extends TMLArchiCommunicationNode implements Swa NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { @@ -296,8 +295,8 @@ public class TMLArchiMemoryNode extends TMLArchiCommunicationNode implements Swa //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiPortArtifact.java b/src/ui/tmldd/TMLArchiPortArtifact.java index 876024edbf..f1c6a4d457 100644 --- a/src/ui/tmldd/TMLArchiPortArtifact.java +++ b/src/ui/tmldd/TMLArchiPortArtifact.java @@ -157,9 +157,9 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements TGComponent tgc; if (tdp != null) { if (mappedMemory.length() > 0) { - ListIterator iterator = tdp.getComponentList().listIterator(); + ListIterator<TGComponent> iterator = tdp.getComponentList().listIterator(); while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if (tgc instanceof TMLArchiMemoryNode) { if (tgc.getName().compareTo(mappedMemory) == 0) { GraphicLib.dashedLine(g, getX() + getWidth()/2, getY() + getHeight()/2, tgc.getX() + tgc.getWidth()/2, tgc.getY() + tgc.getHeight()/2); @@ -202,9 +202,9 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements TraceManager.addDev( "bufferParameters before opening the window: " + bufferParameters.toString() ); JDialogPortArtifact dialog = new JDialogPortArtifact(frame, "Setting port artifact attributes", this, mappedMemory, bufferParameters, value ); - dialog.setSize(700, 600); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(700, 600); + GraphicLib.centerOnParent(dialog, 700, 600); + dialog.setVisible( true ); // blocked until dialog has been closed mappedMemory = dialog.getMappedMemory(); bufferParameters = dialog.getBufferParameters(); //becomes empty if closing the window without pushing Save TraceManager.addDev( "bufferParameters after closing the window: " + bufferParameters.toString() ); @@ -313,7 +313,7 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String svalue = null, sname = null, sreferenceCommunication = null, stype = null; //String prio = null; @@ -322,8 +322,8 @@ public class TMLArchiPortArtifact extends TGCWithoutInternalComponent implements //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmldd/TMLArchiVGMNNode.java b/src/ui/tmldd/TMLArchiVGMNNode.java index fe88239c25..25ea14221b 100755 --- a/src/ui/tmldd/TMLArchiVGMNNode.java +++ b/src/ui/tmldd/TMLArchiVGMNNode.java @@ -47,7 +47,6 @@ package ui.tmldd; import java.awt.*; -import java.util.*; import javax.swing.*; import org.w3c.dom.*; @@ -201,9 +200,9 @@ public class TMLArchiVGMNNode extends TMLArchiCommunicationNode implements Swall String tmpName; JDialogVGMNNode dialog = new JDialogVGMNNode(frame, "Setting VGMN attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + //dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -335,15 +334,15 @@ public class TMLArchiVGMNNode extends TMLArchiCommunicationNode implements Swall NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sstereotype = null, snodeName = null; for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/tmlsd/TGConnectorMessageTMLSD.java b/src/ui/tmlsd/TGConnectorMessageTMLSD.java index d873a1110d..63b6cb09e4 100755 --- a/src/ui/tmlsd/TGConnectorMessageTMLSD.java +++ b/src/ui/tmlsd/TGConnectorMessageTMLSD.java @@ -137,31 +137,34 @@ public abstract class TGConnectorMessageTMLSD extends TGConnector { return true; } - @Override public boolean editOndoubleClick( JFrame frame ) { - - String [] labels = new String[nParam + 1]; - String [] values = new String[nParam + 1]; - labels[0] = "Message name"; - values[0] = this.name; - for( int i = 0; i< nParam; i++ ) { - labels[i+1] = "Param #" + (i+1); + @Override + public boolean editOndoubleClick( JFrame frame ) { + String [] labels = new String[nParam + 1]; + String [] values = new String[nParam + 1]; + labels[0] = "Message name"; + values[0] = this.name; + + for( int i = 0; i< nParam; i++ ) { + labels[i+1] = "Param #" + (i+1); values[i+1] = params[i]; - } + } - JDialogMultiStringCP jdms = new JDialogMultiStringCP( frame, "Setting message properties", nParam+1, labels, values ); - jdms.setSize( 350, 300 ); - GraphicLib.centerOnParent(jdms); - jdms.show(); // blocked until dialog has been closed + JDialogMultiStringCP jdms = new JDialogMultiStringCP( frame, "Setting message properties", nParam+1, labels, values ); + //jdms.setSize( 350, 300 ); + GraphicLib.centerOnParent(jdms, 350, 300 ); + jdms.setVisible( true ); // blocked until dialog has been closed - if(jdms.hasBeenSet() && (jdms.hasValidString(0))) { - this.name = jdms.getString(0); - for( int i = 0; i < nParam; i++ ) { - params[i] = jdms.getString(i+1); - } - makeValue(); - return true; - } - return false; + if(jdms.hasBeenSet() && (jdms.hasValidString(0))) { + this.name = jdms.getString(0); + + for( int i = 0; i < nParam; i++ ) { + params[i] = jdms.getString(i+1); + } + makeValue(); + return true; + } + + return false; } public void makeValue() { @@ -224,17 +227,17 @@ public abstract class TGConnectorMessageTMLSD extends TGConnector { NodeList nli; Node n1, n2; Element elt; - int access, type, k = 0; - String typeOther; - String id, valueAtt; + int /*access, type,*/ k = 0; +// String typeOther; + String id;//, valueAtt; for( int i = 0; i < nl.getLength(); i++ ) { n1 = nl.item(i); //System.out.println(n1); if( n1.getNodeType() == Node.ELEMENT_NODE ) { nli = n1.getChildNodes(); - for( int j = 0; i < nli.getLength(); i++ ) { - n2 = nli.item(i); + for( int j = 0; j < nli.getLength(); j++ ) { + n2 = nli.item(j); //System.out.println(n2); if( n2.getNodeType() == Node.ELEMENT_NODE ) { elt = (Element) n2; diff --git a/src/ui/tmlsd/TMLSDTransferInstance.java b/src/ui/tmlsd/TMLSDTransferInstance.java index 6d84980489..6a34ab6aa3 100755 --- a/src/ui/tmlsd/TMLSDTransferInstance.java +++ b/src/ui/tmlsd/TMLSDTransferInstance.java @@ -47,19 +47,11 @@ knowledge of the CeCILL license and that you accept its terms. package ui.tmlsd; -import java.awt.*; import javax.swing.*; -import org.w3c.dom.*; -import java.awt.event.*; - -import java.util.*; -import ui.tmldd.*; import myutil.*; import ui.*; import ui.window.*; -import tmltranslator.tmlcp.*; - public class TMLSDTransferInstance extends TMLSDInstance implements SwallowTGComponent { public TMLSDTransferInstance( int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, @@ -98,9 +90,9 @@ public class TMLSDTransferInstance extends TMLSDInstance implements SwallowTGCom JDialogTMLCPTransferInstance jdab = new JDialogTMLCPTransferInstance( myAttributes, null, frame, "Setting properties of " + name, "Attribute", name ); setJDialogOptions(jdab); - jdab.setSize(650, 575); - GraphicLib.centerOnParent(jdab); - jdab.setVisible(true); // blocked until dialog has been closed + // jdab.setSize(650, 575); + GraphicLib.centerOnParent(jdab, 650, 575); + jdab.setVisible(true); // blocked until dialog has been closed name = jdab.getName(); //makeValue(); //if (oldValue.equals(value)) { diff --git a/src/ui/tree/GraphTree.java b/src/ui/tree/GraphTree.java index 0977150bf0..4162b83936 100755 --- a/src/ui/tree/GraphTree.java +++ b/src/ui/tree/GraphTree.java @@ -75,7 +75,7 @@ public class GraphTree implements GenericTree { } public Object getChild(int index) { - ArrayList<RG> rgs = mgui.getRGs(); + List<RG> rgs = mgui.getRGs(); if (rgs.size() == 0) { return "No graph"; } diff --git a/src/ui/tree/InvariantDataTree.java b/src/ui/tree/InvariantDataTree.java index 45cc9c0c55..4fc05e0286 100755 --- a/src/ui/tree/InvariantDataTree.java +++ b/src/ui/tree/InvariantDataTree.java @@ -74,7 +74,7 @@ public class InvariantDataTree implements GenericTree { } public Object getChild(int index) { - LinkedList<Invariant> invs = mgui.getInvariants(); + List<Invariant> invs = mgui.getInvariants(); if (invs.size() == 0) { return "No invariant"; } diff --git a/src/ui/tree/SyntaxAnalysisErrorTree.java b/src/ui/tree/SyntaxAnalysisErrorTree.java index e725c89ae5..7f4028540a 100755 --- a/src/ui/tree/SyntaxAnalysisErrorTree.java +++ b/src/ui/tree/SyntaxAnalysisErrorTree.java @@ -45,7 +45,7 @@ knowledge of the CeCILL license and that you accept its terms. package ui.tree; -import java.util.LinkedList; +import java.util.List; import ui.*; import myutil.*; @@ -64,7 +64,7 @@ public class SyntaxAnalysisErrorTree implements GenericTree { } public int getChildCount() { - LinkedList<CheckingError> errors = mgui.getCheckingErrors(); + List<CheckingError> errors = mgui.getCheckingErrors(); if (errors == null) { return 1; } else { @@ -77,7 +77,7 @@ public class SyntaxAnalysisErrorTree implements GenericTree { } public Object getChild(int index) { - LinkedList<CheckingError> errors = mgui.getCheckingErrors(); + List<CheckingError> errors = mgui.getCheckingErrors(); if (errors == null) { return "Not yet performed"; } else { diff --git a/src/ui/tree/SyntaxAnalysisWarningTree.java b/src/ui/tree/SyntaxAnalysisWarningTree.java index d2738edbc9..6f7278b9eb 100755 --- a/src/ui/tree/SyntaxAnalysisWarningTree.java +++ b/src/ui/tree/SyntaxAnalysisWarningTree.java @@ -45,7 +45,7 @@ knowledge of the CeCILL license and that you accept its terms. package ui.tree; -import java.util.LinkedList; +import java.util.List; import ui.*; import myutil.*; @@ -64,7 +64,7 @@ public class SyntaxAnalysisWarningTree implements GenericTree { } public int getChildCount() { - LinkedList<CheckingError> warnings = mgui.getCheckingWarnings(); + List<CheckingError> warnings = mgui.getCheckingWarnings(); if (warnings == null) { return 1; } else { @@ -77,7 +77,7 @@ public class SyntaxAnalysisWarningTree implements GenericTree { } public Object getChild(int index) { - LinkedList<CheckingError> warnings = mgui.getCheckingWarnings(); + List<CheckingError> warnings = mgui.getCheckingWarnings(); if (warnings == null) { return "Not yet performed"; } else { diff --git a/src/ui/ucd/UCDUseCase.java b/src/ui/ucd/UCDUseCase.java index b2debe445b..61abadfca7 100755 --- a/src/ui/ucd/UCDUseCase.java +++ b/src/ui/ucd/UCDUseCase.java @@ -149,15 +149,15 @@ public class UCDUseCase extends TGCWithoutInternalComponent { } public boolean editOndoubleClick(JFrame frame) { - boolean error = false; - String errors = ""; - int tmp; +// boolean error = false; +// String errors = ""; +// int tmp; String tmpName; JDialogUseCase dialog = new JDialogUseCase(frame, "Setting Use Case attributes", value, extension); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed + // dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog, 500, 450); + dialog.setVisible( true ); // blocked until dialog has been closed if (!dialog.isRegularClose()) { return false; @@ -189,7 +189,7 @@ public class UCDUseCase extends TGCWithoutInternalComponent { NodeList nli; Node n1, n2; Element elt; - int t1id; + // int t1id; String sextension = null; for(int i=0; i<nl.getLength(); i++) { @@ -197,8 +197,8 @@ public class UCDUseCase extends TGCWithoutInternalComponent { //System.out.println(n1); if (n1.getNodeType() == Node.ELEMENT_NODE) { nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); + for(int j=0; j<nli.getLength(); j++) { + n2 = nli.item(j); //System.out.println(n2); if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; diff --git a/src/ui/window/JDialogAttribute.java b/src/ui/window/JDialogAttribute.java index f1b9e5aaa7..dfd97f61ec 100755 --- a/src/ui/window/JDialogAttribute.java +++ b/src/ui/window/JDialogAttribute.java @@ -56,8 +56,8 @@ import ui.*; public class JDialogAttribute extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - protected LinkedList<TAttribute> attributes, attributesPar, forbidden; - protected LinkedList<Boolean> initValues; + protected java.util.List<TAttribute> attributes, attributesPar, forbidden; + protected java.util.List<Boolean> initValues; protected boolean checkKeyword, checkJavaKeyword, checkTMLKeyword; protected JPanel panel1, panel2; @@ -67,7 +67,7 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe protected String attrib; // "Attributes", "Gates", etc. // Panel1 - protected JComboBox accessBox, typeBox; + protected JComboBox<String> accessBox, typeBox; protected JTextField identifierText; protected JTextField initialValue; protected JButton addButton; @@ -83,7 +83,7 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe protected JButton cancelButton; /** Creates new form */ - public JDialogAttribute(LinkedList<TAttribute> _attributes, LinkedList<TAttribute>_forbidden, Frame f, String title, String attrib) { + public JDialogAttribute(java.util.List<TAttribute> _attributes, java.util.List<TAttribute>_forbidden, Frame f, String title, String attrib) { super(f, title, true); frame = f; attributesPar = _attributes; @@ -161,7 +161,7 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe c1.gridwidth = 1; c1.fill = GridBagConstraints.HORIZONTAL; c1.anchor = GridBagConstraints.CENTER; - accessBox = new JComboBox(); + accessBox = new JComboBox<String>(); panel1.add(accessBox, c1); identifierText = new JTextField(); identifierText.setColumns(15); @@ -179,7 +179,7 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe panel1.add(new JLabel(" : "), c1); c1.gridwidth = GridBagConstraints.REMAINDER; //end row - typeBox = new JComboBox(); + typeBox = new JComboBox<>(); typeBox.addActionListener(this); panel1.add(typeBox, c1); @@ -445,11 +445,11 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe TAttribute a = attributes.get (i); identifierText.setText(a.getId()); initialValue.setText(a.getInitialValue()); - select(accessBox, a.getStringAccess(a.getAccess())); + select(accessBox, TAttribute.getStringAccess(a.getAccess())); if (a.getType() == TAttribute.OTHER) { select(typeBox, a.getTypeOther()); } else { - select(typeBox, a.getStringType(a.getType())); + select(typeBox, TAttribute.getStringType(a.getType())); } removeButton.setEnabled(true); if (i > 0) { @@ -465,10 +465,10 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe } } - public void select(JComboBox jcb, String text) { + public void select(JComboBox<String> jcb, String text) { String s; for(int i=0; i<jcb.getItemCount(); i++) { - s = (String)(jcb.getItemAt(i)); + s = jcb.getItemAt(i); //System.out.println("String found: *" + s + "* *" + text + "*"); if (s.equals(text)) { jcb.setSelectedIndex(i); diff --git a/src/ui/window/JDialogAvatarExecutableCodeGeneration.java b/src/ui/window/JDialogAvatarExecutableCodeGeneration.java index 2b122dec97..e499c7fb3f 100644 --- a/src/ui/window/JDialogAvatarExecutableCodeGeneration.java +++ b/src/ui/window/JDialogAvatarExecutableCodeGeneration.java @@ -74,8 +74,6 @@ import javax.swing.JTextField; import avatartranslator.AvatarSpecification; import avatartranslator.toexecutable.AVATAR2CPOSIX; -import ddtranslatorSoclib.AvatarddSpecification; -import ddtranslatorSoclib.toSoclib.TasksAndMainGenerator; import launcher.LauncherException; import launcher.RshClient; import myutil.FileUtils; @@ -83,11 +81,9 @@ import myutil.GraphicLib; import myutil.MasterProcessInterface; import myutil.ScrolledJTextArea; import myutil.TraceManager; -import ui.AvatarDeploymentPanelTranslator; import ui.IconManager; import ui.JTextAreaWriter; import ui.MainGUI; -import ui.avatardd.ADDDiagramPanel; import ui.interactivesimulation.JFrameSimulationSDPanel; public class JDialogAvatarExecutableCodeGeneration extends javax.swing.JFrame implements ActionListener, Runnable, MasterProcessInterface { @@ -936,8 +932,8 @@ list = FileUtils.deleteFiles(code1.getText() + TasksAndMainGenerator.getGenerat public void showSimulationTrace() { JFrameSimulationSDPanel jfssdp = new JFrameSimulationSDPanel(f, mgui, "Simulation trace of " + simulationTraceFile.getText()); jfssdp.setIconImage(IconManager.img8); - jfssdp.setSize(600, 600); - GraphicLib.centerOnParent(jfssdp); + // jfssdp.setSize(600, 600); + GraphicLib.centerOnParent(jfssdp, 600, 600); if (selectedViewTrace == 0) { jfssdp.setFileReference(simulationTraceFile.getText()); } else { diff --git a/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java b/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java index 702660ea19..a6d6a09ef4 100755 --- a/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java +++ b/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java @@ -51,16 +51,13 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; import java.io.*; -import java.util.*; import myutil.*; import ui.*; import avatartranslator.*; -import avatartranslator.toexecutable.*; import launcher.*; import ui.interactivesimulation.*; @@ -84,7 +81,7 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame private String textSysC6 = "Show cycle accurate trace from MPSoC file:"; private String textSysC7 = "Base directory of topcell generation:"; - private static String unitCycle = "1"; + //private static String unitCycle = "1"; private static String[] codes = {"AVATAR SOCLIB"}; @@ -128,7 +125,7 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame private static boolean removeXFilesValue = true; private static boolean debugValue = false; private static boolean tracingValue = false; - private static boolean optimizeValue = true; +// private static boolean optimizeValue = true; private Thread t; private boolean go = false; @@ -505,8 +502,8 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame public void run() { String cmd; - String list, data; - int cycle = 0; + String list;//, data; + // int cycle = 0; hasError = false; @@ -763,8 +760,8 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame public void showSimulationTrace() { JFrameSimulationSDPanel jfssdp = new JFrameSimulationSDPanel(f, mgui, "Simulation trace of " + simulationTraceFile.getText()); jfssdp.setIconImage(IconManager.img8); - jfssdp.setSize(600, 600); - GraphicLib.centerOnParent(jfssdp); + // jfssdp.setSize(600, 600); + GraphicLib.centerOnParent(jfssdp, 600, 600); if (selectedViewTrace == 0) { jfssdp.setFileReference(simulationTraceFile.getText()); } else { diff --git a/src/ui/window/JDialogGenAUT.java b/src/ui/window/JDialogGenAUT.java index 9a85e1fecf..b068398d94 100755 --- a/src/ui/window/JDialogGenAUT.java +++ b/src/ui/window/JDialogGenAUT.java @@ -50,6 +50,7 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; +import java.util.List; import launcher.*; import myutil.*; @@ -82,7 +83,7 @@ public class JDialogGenAUT extends javax.swing.JDialog implements ActionListener protected JCheckBox makeDOT; - protected SortedVector files; + protected SortedVector<String> files; /** Creates new form */ public JDialogGenAUT(Frame f, MainGUI _mgui, String title, String _cmdbcgio, String _host, String _path) { @@ -218,7 +219,7 @@ public class JDialogGenAUT extends javax.swing.JDialog implements ActionListener t.start(); } - public SortedVector getFiles() { + public SortedVector<String> getFiles() { return files; } @@ -227,10 +228,10 @@ public class JDialogGenAUT extends javax.swing.JDialog implements ActionListener String cmd1 = ""; String data; String fileName; - LinkedList ll; - ListIterator iterator; + List<String> ll; + Iterator<String> iterator; path = jtf.getText(); - files = new SortedVector(); + files = new SortedVector<String>(); rshc = new RshClient(host); @@ -244,7 +245,7 @@ public class JDialogGenAUT extends javax.swing.JDialog implements ActionListener jta.append("Generation successful of:\n"); iterator = ll.listIterator(); while(iterator.hasNext()) { - fileName = (String)(iterator.next()); + fileName = iterator.next(); jta.append(fileName + "\n"); } diff --git a/src/ui/window/JDialogGenAUTS.java b/src/ui/window/JDialogGenAUTS.java index 1aef51c5c4..826b4859a8 100755 --- a/src/ui/window/JDialogGenAUTS.java +++ b/src/ui/window/JDialogGenAUTS.java @@ -86,7 +86,7 @@ public class JDialogGenAUTS extends javax.swing.JDialog implements ActionListene protected JCheckBox makeDOT, fc2; - protected SortedVector files; + protected SortedVector<String> files; /** Creates new form */ public JDialogGenAUTS(Frame f, MainGUI _mgui, String title, String _cmdCaesar, String _cmdBcgio, String _fileName, String _host, String _path) { @@ -231,7 +231,7 @@ public class JDialogGenAUTS extends javax.swing.JDialog implements ActionListene t.start(); } - public SortedVector getFiles() { + public SortedVector<String> getFiles() { return files; } @@ -239,15 +239,15 @@ public class JDialogGenAUTS extends javax.swing.JDialog implements ActionListene String cmd1 = ""; String data; - LinkedList ll; - ListIterator iterator; + java.util.List<String> ll; + Iterator<String> iterator; path = jtf.getText(); - files = new SortedVector(); - Point p; + files = new SortedVector<String>(); + // Point p; String taskName; String saveFileName; String spec; - int i = 0; + // int i = 0; rshc = new RshClient(host); String basicFileName = fileName.substring(0, fileName.length()-4); @@ -263,13 +263,13 @@ public class JDialogGenAUTS extends javax.swing.JDialog implements ActionListene iterator = ll.listIterator(); while(iterator.hasNext()) { - taskName =(String)(iterator.next()); + taskName = iterator.next(); jta.append("Generating RG of name=" + taskName + "\n"); - spec =(String)(iterator.next()); + spec = iterator.next(); //jta.append("spec=" + (String)(iterator.next())); jta.append("Sending LOTOS specification data\n"); saveFileName = basicFileName + "_" + taskName; - i ++; + // i ++; rshc.deleteFile(basicFileName+".lot"); // file data diff --git a/src/ui/window/JDialogModelChecking.java b/src/ui/window/JDialogModelChecking.java index 56cb28b126..7236c11c46 100755 --- a/src/ui/window/JDialogModelChecking.java +++ b/src/ui/window/JDialogModelChecking.java @@ -54,12 +54,11 @@ import java.util.*; import ui.*; - public class JDialogModelChecking extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - public static LinkedList<TClassInterface> validated, ignored; + public static java.util.List<TClassInterface> validated, ignored; private static boolean overideSyntaxChecking = false; - private LinkedList<TClassInterface> val, ign, back; + private java.util.List<TClassInterface> val, ign, back; //subpanels private JPanel panel1, panel2, panel3, panel4, panel5, panel6; @@ -76,7 +75,7 @@ public class JDialogModelChecking extends javax.swing.JDialog implements ActionL private JButton cancelButton; /** Creates new form */ - public JDialogModelChecking(Frame f, LinkedList<TClassInterface> _back, LinkedList<TGComponent> componentList, String title) { + public JDialogModelChecking(Frame f, LinkedList<TClassInterface> _back, java.util.List<TGComponent> componentList, String title) { super(f, title, true); back = _back; @@ -98,8 +97,8 @@ public class JDialogModelChecking extends javax.swing.JDialog implements ActionL pack(); } - private LinkedList<TClassInterface> makeNewVal(LinkedList<TGComponent> list) { - LinkedList<TClassInterface> v = new LinkedList<TClassInterface> (); + private java.util.List<TClassInterface> makeNewVal(java.util.List<TGComponent> list) { + java.util.List<TClassInterface> v = new LinkedList<TClassInterface> (); for (TGComponent tgc: list) if (tgc instanceof TClassInterface) @@ -108,7 +107,7 @@ public class JDialogModelChecking extends javax.swing.JDialog implements ActionL return v; } - private void checkTClasses(LinkedList<TClassInterface> tobeChecked, LinkedList<TGComponent> source) { + private void checkTClasses(java.util.List<TClassInterface> tobeChecked, java.util.List<TGComponent> source) { Iterator<TClassInterface> iter = tobeChecked.iterator (); while (iter.hasNext ()) { TClassInterface t = iter.next (); @@ -117,7 +116,7 @@ public class JDialogModelChecking extends javax.swing.JDialog implements ActionL } } - public void addNewTclasses(LinkedList<TClassInterface> added, LinkedList<TGComponent> source, LinkedList<TClassInterface> notSource) { + public void addNewTclasses(java.util.List<TClassInterface> added, java.util.List<TGComponent> source, java.util.List<TClassInterface> notSource) { for (TGComponent tgc: source) if ((tgc instanceof TClassInterface) && (!added.contains(tgc)) && (!notSource.contains(tgc))) added.add ((TClassInterface) tgc); diff --git a/src/ui/window/JDialogPortArtifact.java b/src/ui/window/JDialogPortArtifact.java index f603ef1942..c2a3c9dced 100755 --- a/src/ui/window/JDialogPortArtifact.java +++ b/src/ui/window/JDialogPortArtifact.java @@ -68,20 +68,20 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private TMLArchiPortArtifact artifact; private String mappedMemory = "VOID"; - protected JComboBox mappedPortCB, memoryCB; + protected JComboBox<String> mappedPortCB, memoryCB; protected JTextField baseAddressTF, numSamplesTF, bitsPerSymbolTF; protected String baseAddress, mappedPort, sampleLength, numSamples, bitsPerSymbol; protected String bank, dataType, symmetricalValue; - protected JComboBox dataTypeCB, bankCB, symmetricalValueCB; + protected JComboBox<String> dataTypeCB, bankCB, symmetricalValueCB; //Intl Data In protected JTextField widthIntl_TF, bitInOffsetIntl_TF, inputOffsetIntl_TF; protected String widthIntl, bitInOffsetIntl, inputOffsetIntl, packedBinaryInIntl; - protected JComboBox packedBinaryInIntl_CB; + protected JComboBox<String> packedBinaryInIntl_CB; //Intl Data Out protected JTextField bitOutOffsetIntl_TF, outputOffsetIntl_TF; - protected JComboBox packedBinaryOutIntl_CB; + protected JComboBox<String> packedBinaryOutIntl_CB; protected String packedBinaryOutIntl, bitOutOffsetIntl, outputOffsetIntl; //Intl Perm @@ -91,7 +91,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi //Mapper Data In protected JTextField baseAddressDataInMapp_TF, numSamplesDataInMapp_TF, bitsPerSymbolDataInMapp_TF; protected String baseAddressDataInMapp, numSamplesDataInMapp, bitsPerSymbolDataInMapp, symmetricalValueDataInMapp; - protected JComboBox symmetricalValueDataInMapp_CB; + protected JComboBox<String> symmetricalValueDataInMapp_CB; //Mapper Data Out protected JTextField baseAddressDataOutMapp_TF; protected String baseAddressDataOutMapp; @@ -104,11 +104,11 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private JButton cancelButton; //Code generation - private JPanel panel3, panel4, panel5; + private JPanel panel3; /*panel4, panel5*/; private JTabbedPane tabbedPane; private int bufferType = 0; private ArrayList<String> bufferParameters; - private String appName = ""; +//private String appName = ""; /** Creates new form */ public JDialogPortArtifact(Frame _frame, String _title, TMLArchiPortArtifact _artifact, String _mappedMemory, ArrayList<String> _bufferParameters, String _mappedPort ) { @@ -118,7 +118,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi mappedMemory = _mappedMemory; bufferParameters = _bufferParameters; //contains a set of parameters that are read from the xml description. The first parameters is the buffer type mappedPort = _mappedPort; - appName = mappedPort.split("::")[0]; + //appName = mappedPort.split("::")[0]; TraceManager.addDev("init components"); @@ -132,7 +132,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi Container c = getContentPane(); GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); + // GridBagLayout gridbag1 = new GridBagLayout(); GridBagLayout gridbag2 = new GridBagLayout(); GridBagConstraints c0 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints(); @@ -154,8 +154,8 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi panel3.setPreferredSize(new Dimension(650, 350)); tabbedPane = new JTabbedPane(); - panel4 = new JPanel(); - panel5 = new JPanel(); +// panel4 = new JPanel(); +// panel5 = new JPanel(); c1.gridwidth = 1; c1.gridheight = 1; @@ -204,7 +204,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi TraceManager.addDev( "Got communications" ); - mappedPortCB = new JComboBox( portsList ); + mappedPortCB = new JComboBox<String>( portsList ); if( !mappedPort.equals( "VOID" ) && !mappedPort.equals( "" ) ) { mappedPortCB.setSelectedIndex( portsList.indexOf( mappedPort ) ); } @@ -216,7 +216,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi panel2.add( mappedPortCB, c1 ); //Make the list of memories that are available for being mapped - LinkedList componentList = artifact.getTDiagramPanel().getComponentList(); + java.util.List<TGComponent> componentList = artifact.getTDiagramPanel().getComponentList(); Vector<String> memoryList = new Vector<String>(); for( int k = 0; k < componentList.size(); k++ ) { if( componentList.get(k) instanceof TMLArchiMemoryNode ) { @@ -227,7 +227,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi memoryList.add( "No available memory" ); } - memoryCB = new JComboBox( memoryList ); + memoryCB = new JComboBox<String>( memoryList ); if( !mappedMemory.equals( "VOID" ) && !mappedMemory.equals( "" ) ) { memoryCB.setSelectedIndex( memoryList.indexOf( mappedMemory ) ); } @@ -255,7 +255,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi } } } - String memoryName = memoryList.get(0); + // String memoryName = memoryList.get(0); //TraceManager.addDev( "bufferType of " + memoryName + " is " + bufferType ); } else { @@ -332,8 +332,8 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private int getBufferTypeFromSelectedMemory( String mappedMemory ) { - LinkedList componentList = artifact.getTDiagramPanel().getComponentList(); - Vector<String> list = new Vector<String>(); + java.util.List<TGComponent> componentList = artifact.getTDiagramPanel().getComponentList(); + //Vector<String> list = new Vector<String>(); for( int k = 0; k < componentList.size(); k++ ) { if( componentList.get(k) instanceof TMLArchiMemoryNode ) { @@ -555,21 +555,21 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi } return params; } - - private void cleanPanels() { - panel3.removeAll(); - panel4.removeAll(); - panel5.removeAll(); - tabbedPane.removeAll(); - } - - private void revalidateAndRepaintPanels() { - panel3.revalidate(); - panel3.repaint(); - panel4.revalidate(); - panel4.repaint(); - panel5.revalidate(); - panel5.repaint(); - } +// +// private void cleanPanels() { +// panel3.removeAll(); +// panel4.removeAll(); +// panel5.removeAll(); +// tabbedPane.removeAll(); +// } +// +// private void revalidateAndRepaintPanels() { +// panel3.revalidate(); +// panel3.repaint(); +// panel4.revalidate(); +// panel4.repaint(); +// panel5.revalidate(); +// panel5.repaint(); +// } } //End of class diff --git a/src/ui/window/JDialogProjection.java b/src/ui/window/JDialogProjection.java index 6022472f93..079f67913a 100755 --- a/src/ui/window/JDialogProjection.java +++ b/src/ui/window/JDialogProjection.java @@ -139,11 +139,11 @@ public class JDialogProjection extends javax.swing.JDialog implements ActionList gatesIgnored = new LinkedList<TClassAndGateDS> (); gatesProjected = new LinkedList<TClassAndGateDS> (); - LinkedList<TGComponent> list = tcd.getComponentList(); + java.util.List<TGComponent> list = tcd.getComponentList(); for (TGComponent tgc: list) if (tgc instanceof TClassInterface) { TClassInterface tci = (TClassInterface)tgc; - LinkedList<TAttribute> gates = tci.getGates(); + java.util.List<TAttribute> gates = tci.getGates(); for (TAttribute ta: gates) { TClassAndGateDS tcg = new TClassAndGateDS(tci, ta); gatesIgnored.add (tcg); @@ -160,9 +160,9 @@ public class JDialogProjection extends javax.swing.JDialog implements ActionList for(int i=0; i<tm.classNb(); i++) { TClass t = tm.getTClassAtIndex(i); - Vector gateList = t.getGateList(); + Vector<Gate> gateList = t.getGateList(); for(int j=0; j<gateList.size(); j++) { - Gate g = (Gate)(gateList.elementAt(j)); + Gate g = gateList.elementAt(j); TClassAndGateDS tcg = new TClassAndGateDS(t, g); gatesIgnored.add (tcg); } @@ -605,7 +605,7 @@ public class JDialogProjection extends javax.swing.JDialog implements ActionList String cmd1 = ""; String autproj; String autprojdot; - String data; + // String data; int id = 0; String filenamebcg; Point p; @@ -705,7 +705,7 @@ public class JDialogProjection extends javax.swing.JDialog implements ActionList // Converting to bcg format jta.append("Converting data to bcg format\n"); cmd1 = bcgioPath + " -aldebaran " + fileName + " -bcg " + filenamebcg; - data = processCmd(cmd1); + /*data =*/ processCmd(cmd1); cmd1 = bcgminPath; if (isStrongSelected) { @@ -715,12 +715,12 @@ public class JDialogProjection extends javax.swing.JDialog implements ActionList } cmd1 += filenamebcg+ " " + filenamebcg; jta.append("Performing minimization\n"); - data = processCmd(cmd1); + /*data =*/ processCmd(cmd1); jta.append("Minimization done\n"); jta.append("Converting data to aut format\n"); cmd1 = bcgioPath + " -bcg " + filenamebcg+ " -aldebaran " + fileName; - data = processCmd(cmd1); + /*data = */processCmd(cmd1); jta.append("Getting aut data\n"); autproj = rshc.getFileData(fileName); @@ -737,7 +737,7 @@ public class JDialogProjection extends javax.swing.JDialog implements ActionList jta.append("\nConverting to dotty format\n"); rshc.sendFileData(fileName, autproj); cmd1 = bcgioPath + " -bcg " + filenamebcg + " -graphviz " + fileName + ".dot"; - data = processCmd(cmd1); + /*data =*/ processCmd(cmd1); jta.append("Getting dot data\n"); autprojdot = rshc.getFileData(fileName + ".dot"); mgui.gtm.setRGAUTPROJDOT(autprojdot); diff --git a/src/ui/window/JDialogReducedAttribute.java b/src/ui/window/JDialogReducedAttribute.java index e49861d6a2..550232057a 100755 --- a/src/ui/window/JDialogReducedAttribute.java +++ b/src/ui/window/JDialogReducedAttribute.java @@ -55,7 +55,7 @@ import java.util.*; import ui.*; public class JDialogReducedAttribute extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - private LinkedList<TAttribute> attributesPar, setList, unsetList, tclassAttributes; + private java.util.List<TAttribute> attributesPar, setList, unsetList, tclassAttributes; private JPanel panel1, panel2; @@ -80,7 +80,7 @@ public class JDialogReducedAttribute extends javax.swing.JDialog implements Acti private JButton cancelButton; /** Creates new form */ - public JDialogReducedAttribute(LinkedList<TAttribute> _attributes, LinkedList<TAttribute> _tclassAttributes, Frame f, String title, String _attrib, String _nameTObject, String _nameTClass) { + public JDialogReducedAttribute(java.util.List<TAttribute> _attributes, java.util.List<TAttribute> _tclassAttributes, Frame f, String title, String _attrib, String _nameTObject, String _nameTClass) { super(f, title, true); frame = f; attributesPar = _attributes; diff --git a/src/ui/window/JDialogReferenceCP.java b/src/ui/window/JDialogReferenceCP.java index 55355866fc..94f18c1723 100644 --- a/src/ui/window/JDialogReferenceCP.java +++ b/src/ui/window/JDialogReferenceCP.java @@ -57,9 +57,6 @@ import java.util.Collections; import ui.*; import ui.tmldd.*; import ui.tmlsd.*; -import ui.tmlcp.*; -import ui.tmlcd.*; -import ui.avatarbd.*; import tmltranslator.modelcompiler.*; import tmltranslator.tmlcp.*; import tmltranslator.*; @@ -81,7 +78,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private TMLArchiCPNode cp; protected JTextField nameOfCP; private String name = ""; - private LinkedList<TMLArchiNode> availableUnits; + //private LinkedList<TMLArchiNode> availableUnits; private Vector<String> mappedUnitsSL = new Vector<String>(); private ArrayList<TMLCommunicationPatternPanel> listCPs = new ArrayList<TMLCommunicationPatternPanel>(); @@ -97,7 +94,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private Vector<String> mappableArchUnitsSL; private Vector<String> sdInstancesSL; - private int indexListCPsNames = 0; + //private int indexListCPsNames = 0; private boolean emptyCPsList = false; private boolean emptyListOfMappedUnits = true; //true if there is no mapping info @@ -106,14 +103,14 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis // Panel1 private JPanel panel1; - private JComboBox sdInstancesCB, mappableArchUnitsCB, communicationPatternsCB; + private JComboBox<String> sdInstancesCB,/* mappableArchUnitsCB,*/ communicationPatternsCB; private JButton mapButton; - private JList mappableArchUnitsJL; + private JList<String> mappableArchUnitsJL; private JScrollPane mappableArchUnitsSP; //Panel2 private JPanel panel2; - private JList listMappedUnitsJL; + private JList<String> listMappedUnitsJL; private JButton upButton; private JButton downButton; private JButton removeButton; @@ -125,23 +122,23 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis //Panel3: assign a value to CP attributes private JPanel panel3; private JButton attributeButton, addressButton; - private JComboBox attributesList_CB, applicationAttributesList_CB, addressList_CB; + private JComboBox<String> attributesList_CB/*, applicationAttributesList_CB*/, addressList_CB; private JTextField attributesValue_TF, addressValue_TF; private Vector<String> attributesVector, applicationAttributesVector, addressVector; //Panel4: assign a value to CP attributes private JPanel panel4; private JScrollPane scrollPaneAttributes; - private JList scrollPaneAttributes_JL; - private Vector<String> assignedAttributes, assignedAddresses; + private JList<String> scrollPaneAttributes_JL; + private Vector<String> assignedAttributes/*, assignedAddresses*/; private JButton removeAttributeButton; private JTabbedPane tabbedPane; //Panel5, code generation private JPanel panel5; - private JComboBox cpMECsCB, transferTypeCB1, transferTypeCB2; - private JList cpMECsList; + private JComboBox<String> cpMECsCB, transferTypeCB1, transferTypeCB2; +// private JList<String> cpMECsList; private String cpMEC; private int transferType1, transferType2; @@ -175,26 +172,26 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis } else { assignedAttributes = new Vector<String>(); - assignedAddresses = new Vector<String>(); + //assignedAddresses = new Vector<String>(); } initComponents(); valueChanged( null ); //myInitComponents(); pack(); - } + } - private void myInitComponents() { - removeButton.setEnabled( false ); - upButton.setEnabled( false ); - downButton.setEnabled( false ); - if( mappableArchUnitsSL.size() > 0 ) { - mapButton.setEnabled( true ); - } - else { - mapButton.setEnabled( false ); - } - } +// private void myInitComponents() { +// removeButton.setEnabled( false ); +// upButton.setEnabled( false ); +// downButton.setEnabled( false ); +// if( mappableArchUnitsSL.size() > 0 ) { +// mapButton.setEnabled( true ); +// } +// else { +// mapButton.setEnabled( false ); +// } +// } private void initComponents() { @@ -205,7 +202,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis GridBagLayout gridbag3 = new GridBagLayout(); GridBagLayout gridbag4 = new GridBagLayout(); GridBagLayout gridbag5 = new GridBagLayout(); - GridBagLayout gridbag125 = new GridBagLayout(); + // GridBagLayout gridbag125 = new GridBagLayout(); GridBagConstraints c0 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints(); GridBagConstraints c2 = new GridBagConstraints(); @@ -288,7 +285,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis //fifth line panel1 panel1.add( new JLabel( "Available CPs:"), c1 ); - communicationPatternsCB = new JComboBox( communicationPatternsSL ); + communicationPatternsCB = new JComboBox<String>( communicationPatternsSL ); if( !emptyListOfMappedUnits ) { communicationPatternsCB.setSelectedItem( cp.getReference() ); } @@ -314,7 +311,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis //seventh line panel1 panel1.add( new JLabel( "Available instances:" ), c1 ); - sdInstancesCB = new JComboBox( sdInstancesSL ); + sdInstancesCB = new JComboBox<String>( sdInstancesSL ); sdInstancesCB.setSelectedIndex( 0 ); sdInstancesCB.addActionListener( this ); sdInstancesCB.setPreferredSize( new Dimension(150, 30) ); @@ -333,7 +330,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis makeListOfMappableArchUnitsSL(); //nineth line panel1 - mappableArchUnitsJL = new JList( mappableArchUnitsSL ); + mappableArchUnitsJL = new JList<String>( mappableArchUnitsSL ); mappableArchUnitsJL.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); mappableArchUnitsJL.addListSelectionListener( this ); mappableArchUnitsSP = new JScrollPane( mappableArchUnitsJL ); @@ -361,7 +358,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis // 1st line panel2 - listMappedUnitsJL = new JList( mappedUnitsSL ); + listMappedUnitsJL = new JList<String>( mappedUnitsSL ); listMappedUnitsJL.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listMappedUnitsJL.addListSelectionListener(this); scrollPane = new JScrollPane( listMappedUnitsJL ); @@ -419,7 +416,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis filterOutAssignedAttributes( attributesVector ); //eliminate the attributes that have already been assigned a value } panel3.add( new JLabel("CP attribute:"), c3 ); - attributesList_CB = new JComboBox( attributesVector ); + attributesList_CB = new JComboBox<String>( attributesVector ); attributesList_CB.addActionListener(this); panel3.add( attributesList_CB, c3 ); @@ -462,7 +459,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis } panel3.add( new JLabel("CP address:"), c3 ); - addressList_CB = new JComboBox( addressVector ); + addressList_CB = new JComboBox<String>( addressVector ); addressList_CB.addActionListener(this); panel3.add( addressList_CB, c3 ); @@ -486,7 +483,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis panel3.add( addressButton, c3 ); //panel4 - scrollPaneAttributes_JL = new JList( assignedAttributes ); + scrollPaneAttributes_JL = new JList<String>( assignedAttributes ); scrollPaneAttributes_JL.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scrollPaneAttributes_JL.addListSelectionListener(this); scrollPaneAttributes = new JScrollPane( scrollPaneAttributes_JL ); @@ -516,7 +513,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis c5.fill = GridBagConstraints.HORIZONTAL; c5.anchor = GridBagConstraints.LINE_START; panel5.add( new JLabel( "CP Extension Construct:" ), c5 ); - cpMECsCB = new JComboBox( new Vector<String>( Arrays.asList( CPMEC.cpTypes ) ) ); + cpMECsCB = new JComboBox<String>( new Vector<String>( Arrays.asList( CPMEC.cpTypes ) ) ); if( cpMEC.equals( "VOID" ) || cpMEC.equals( "" ) ) { cpMECsCB.setSelectedIndex( 0 ); } @@ -536,7 +533,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis c5.fill = GridBagConstraints.HORIZONTAL; c5.anchor = GridBagConstraints.LINE_START; panel5.add( new JLabel( "Type of DMA transfer n.1:" ), c5 ); - transferTypeCB1 = new JComboBox( new Vector<String>( Arrays.asList( CPMEC.transferTypes ) ) ); + transferTypeCB1 = new JComboBox<String>( new Vector<String>( Arrays.asList( CPMEC.transferTypes ) ) ); if( transferType1 == -1 ) { transferTypeCB1.setSelectedIndex( 0 ); } @@ -556,7 +553,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis c5.fill = GridBagConstraints.HORIZONTAL; c5.anchor = GridBagConstraints.LINE_START; panel5.add( new JLabel( "Type of DMA transfer n.2:" ), c5 ); - transferTypeCB2 = new JComboBox( new Vector<String>( Arrays.asList( CPMEC.transferTypes ) ) ); + transferTypeCB2 = new JComboBox<String>( new Vector<String>( Arrays.asList( CPMEC.transferTypes ) ) ); if( transferType2 == -1 ) { transferTypeCB2.setSelectedIndex( 0 ); } @@ -930,7 +927,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private void removeMappedInstance() { - String archUnitName, CPName, instanceName; + String /*archUnitName, */CPName, instanceName; if( listMappedUnitsJL.getSelectedIndex() >= 0 ) { ArrayList<String> info = splitMappingString( mappedUnitsSL.get( listMappedUnitsJL.getSelectedIndex() ) ); @@ -1354,9 +1351,9 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis //TraceManager.addDev( "Into createListInstances, panel name: " + panel.getName() ); if( panel instanceof TMLSDPanel ) { //TraceManager.addDev( "Found TMLSDPanel named: " + panel.getName() ); - LinkedList componentsList = panel.getComponentList(); + java.util.List<TGComponent> componentsList = panel.getComponentList(); for( int k = 0; k < componentsList.size(); k++ ) { - TGComponent elem = (TGComponent) componentsList.get(k); + TGComponent elem = componentsList.get(k); if( elem instanceof ui.tmlsd.TMLSDInstance ) { sdInstancesNames.add( elem.getName() ); if( elem instanceof TMLSDStorageInstance ) { @@ -1416,7 +1413,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private Vector<String> makeListOfMappableArchUnits( int instanceType ) { //0 = storage, 1 = transfer, 2 = controller - LinkedList componentList = cp.getTDiagramPanel().getComponentList(); + java.util.List<TGComponent> componentList = cp.getTDiagramPanel().getComponentList(); Vector<String> list = new Vector<String>(); for( int k = 0; k < componentList.size(); k++ ) { @@ -1453,7 +1450,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private void filterOutAssignedAttributes( Vector<String> attributesVector ) { - ArrayList<Integer> indexList = new ArrayList<Integer>(); + // ArrayList<Integer> indexList = new ArrayList<Integer>(); for( String s: assignedAttributes ) { String token = s.split( " = " )[0]; for( Iterator<String> iterator = attributesVector.iterator(); iterator.hasNext(); ) { @@ -1467,7 +1464,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private void filterOutAssignedAddresses( Vector<String> addressVector ) { - ArrayList<Integer> indexList = new ArrayList<Integer>(); +// ArrayList<Integer> indexList = new ArrayList<Integer>(); for( String s: assignedAttributes ) { String token = s.split( " = " )[0]; for( Iterator<String> iterator = addressVector.iterator(); iterator.hasNext(); ) { @@ -1485,7 +1482,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private void createAttributesAndAddressVector() { - String selectedCPName = (String)communicationPatternsCB.getSelectedItem(); + //String selectedCPName = (String)communicationPatternsCB.getSelectedItem(); int index = getIndexOfSelectedCP(); // returns -1 upon error TraceManager.addDev( "The selected CP has index: " + index ); @@ -1529,9 +1526,9 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis private void createApplicationAttributesVector() { applicationAttributesVector = new Vector<String>(); //I have to get all the attributes of all tasks in the application model AND their values - Vector listAttributes = cp.getTDiagramPanel().getMGUI().getAllApplicationTMLTasksAttributes(); - for( Object o: listAttributes ) { - String s = o.toString(); + Vector<String> listAttributes = cp.getTDiagramPanel().getMGUI().getAllApplicationTMLTasksAttributes(); + for( String s: listAttributes ) { + //String s = o.toString(); TraceManager.addDev( "Attribute *" + s + "*" ); String attrName = s.split(" ")[0]; String attrType = s.split(" : ")[1]; diff --git a/src/ui/window/JDialogSearchBox.java b/src/ui/window/JDialogSearchBox.java index 0eb47dfa69..3cafd3ff7a 100644 --- a/src/ui/window/JDialogSearchBox.java +++ b/src/ui/window/JDialogSearchBox.java @@ -165,7 +165,7 @@ public class JDialogSearchBox extends javax.swing.JFrame { private ArrayList<Object[]> rowsGoogleScholar; private ArrayList<Object[]> rowsDB; /** Creates new form */ - public JDialogSearchBox(Frame _frame, String _title, ArrayList<String> l, TDiagramMouseManager tdmm) { + public JDialogSearchBox(Frame _frame, String _title, java.util.List<String> l, TDiagramMouseManager tdmm) { //super(_frame, _title, true); initComponents(); this.tdmm = tdmm; @@ -402,7 +402,7 @@ public class JDialogSearchBox extends javax.swing.JFrame { javax.swing.GroupLayout jPanel_GoogleScholarTabLayout = new javax.swing.GroupLayout(jPanel_GoogleScholarTab); jPanel_GoogleScholarTab.setLayout(jPanel_GoogleScholarTabLayout); - GroupLayout.ParallelGroup groupScholar = jPanel_GoogleScholarTabLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + // GroupLayout.ParallelGroup groupScholar = jPanel_GoogleScholarTabLayout.createParallelGroup(GroupLayout.Alignment.LEADING); jPanel_GoogleScholarTabLayout.setHorizontalGroup( jPanel_GoogleScholarTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 729, Short.MAX_VALUE) @@ -799,15 +799,15 @@ public class JDialogSearchBox extends javax.swing.JFrame { }; JOptionPane joptionpane = new JOptionPane(); - int i = joptionpane.showOptionDialog(null, inputs, SETUP_ADDRESS_DB, - joptionpane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, + int i = JOptionPane.showOptionDialog(null, inputs, SETUP_ADDRESS_DB, + JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{"Save", "Cancel"}, "OK"); - if (i == joptionpane.OK_OPTION) { + if (i == JOptionPane.OK_OPTION) { while (!isAddressDBFormatted()) { JOptionPane.showMessageDialog(null, "Address:Port", "Wrong format", JOptionPane.WARNING_MESSAGE); - i = joptionpane.showOptionDialog(null, inputs, SETUP_ADDRESS_DB, - joptionpane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, + i = JOptionPane.showOptionDialog(null, inputs, SETUP_ADDRESS_DB, + JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{"Save", "Cancel"}, "OK"); } ConfigurationTTool.ExternalServer = jTextaddressDB.getText(); @@ -861,7 +861,7 @@ public class JDialogSearchBox extends javax.swing.JFrame { } }); - jTextaddressDB.getDocument().addDocumentListener(new DocumentListener() { + jTextaddressDB.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent documentEvent) { diff --git a/src/ui/window/JDialogSelectCPDiagrams.java b/src/ui/window/JDialogSelectCPDiagrams.java index a171fc0a10..c00440bd90 100755 --- a/src/ui/window/JDialogSelectCPDiagrams.java +++ b/src/ui/window/JDialogSelectCPDiagrams.java @@ -52,25 +52,25 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; +import java.util.List; import myutil.*; import ui.*; -import ui.tmldd.*; import ui.tmlcp.*; public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - public static Vector validated, ignored; + public static Vector<TGComponent> validated, ignored; private static boolean optimized = true; - private Vector val, ign, back; //val for validated, ign for ignored + private Vector<TGComponent> val, ign, back; //val for validated, ign for ignored //subpanels private JPanel panel1, panel2, panel3, panel4, panel5, panel6; - private JList listIgnored; - private JList listValidated; + private JList<TGComponent> listIgnored; + private JList<TGComponent> listValidated; private JButton allValidated; private JButton addOneValidated; private JButton addOneIgnored; @@ -83,7 +83,7 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti private JButton cancelButton; /** Creates new form */ - public JDialogSelectCPDiagrams( Frame f, Vector _back, LinkedList componentList, String title ) { + public JDialogSelectCPDiagrams( Frame f, Vector<TGComponent> _back, List<TGComponent> componentList, String title ) { super(f, title, true); @@ -93,7 +93,7 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti if( ( validated == null ) || ( ignored == null ) ) { val = makeNewVal( componentList ); //componentList must already contain something. Val contains a list of all TMLArchiNodes //originally contained in componentList - ign = new Vector(); //empty + ign = new Vector<TGComponent>(); //empty //val and ign are the lists that are printed in the Syntax Analysis window } else { @@ -110,13 +110,13 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti } //From componentList, filter out all the elements which are not TMLArchiNode - private Vector makeNewVal( LinkedList list ) { + private Vector<TGComponent> makeNewVal( List<TGComponent> list ) { - Vector v = new Vector(); + Vector<TGComponent> v = new Vector<TGComponent>(); TGComponent tgc; for( int i = 0; i < list.size(); i++ ) { - tgc = (TGComponent)( list.get(i) ); + tgc = list.get(i); //System.out.println(tgc); if ( ( tgc instanceof TMLCPRefSD ) || ( tgc instanceof TMLCPRefAD ) ) { v.addElement( tgc ); @@ -125,7 +125,7 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti return v; } - private void checkDiagram( Vector tobeChecked, LinkedList source ) { + private void checkDiagram( Vector<TGComponent> tobeChecked, List<TGComponent> source ) { TMLCPRefSD sd; TMLCPRefAD cp; @@ -168,12 +168,12 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti return ignored; }*/ - public void addNewDiagram( Vector added, LinkedList source, Vector notSource ) { + public void addNewDiagram( Vector<TGComponent> added, List<TGComponent> source, Vector<TGComponent> notSource ) { TGComponent tgc; for( int i = 0; i < source.size(); i++ ) { - tgc = (TGComponent)( source.get(i) ); + tgc = source.get(i); if( ( tgc instanceof TMLCPRefSD ) && ( tgc instanceof TMLCPRefAD ) && ( !added.contains(tgc) ) && ( !notSource.contains(tgc) ) ) { added.addElement( tgc ); //System.out.println("New element"); @@ -207,7 +207,7 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti panel1 = new JPanel(); panel1.setLayout( new BorderLayout() ); panel1.setBorder( new javax.swing.border.TitledBorder( "Diagrams ignored" ) ); - listIgnored = new JList( ign ); + listIgnored = new JList<TGComponent>( ign ); //listIgnored.setPreferredSize(new Dimension(200, 250)); listIgnored.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listIgnored.addListSelectionListener( this ); @@ -260,7 +260,7 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti panel2 = new JPanel(); panel2.setLayout( new BorderLayout() ); panel2.setBorder( new javax.swing.border.TitledBorder( "Diagrams taken into account" ) ); - listValidated = new JList( val ); + listValidated = new JList<TGComponent>( val ); //listValidated.setPreferredSize(new Dimension(200, 250)); listValidated.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listValidated.addListSelectionListener( this ); @@ -338,8 +338,8 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti private void addOneIgnored() { int [] list = listValidated.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; for (int i=0; i<list.length; i++){ o = val.elementAt(list[i]); ign.addElement(o); @@ -354,8 +354,9 @@ public class JDialogSelectCPDiagrams extends javax.swing.JDialog implements Acti private void addOneValidated() { int [] list = listIgnored.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; + for (int i=0; i<list.length; i++){ o = ign.elementAt(list[i]); val.addElement(o); diff --git a/src/ui/window/JDialogSelectRequirements.java b/src/ui/window/JDialogSelectRequirements.java index 238148c9ff..df06f3c3a8 100755 --- a/src/ui/window/JDialogSelectRequirements.java +++ b/src/ui/window/JDialogSelectRequirements.java @@ -57,14 +57,15 @@ import ui.req.*; public class JDialogSelectRequirements extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - public static Vector validated, ignored; - private Vector val, ign, back; + public static Vector<Requirement> validated, ignored; + + private Vector<Requirement> val, ign, back; //subpanels private JPanel panel1, panel2, panel3, panel4; - private JList listIgnored; - private JList listValidated; + private JList<TGComponent> listIgnored; + private JList<TGComponent> listValidated; private JButton allValidated; private JButton addOneValidated; private JButton addOneIgnored; @@ -75,14 +76,14 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac private JButton cancelButton; /** Creates new form */ - public JDialogSelectRequirements(Frame f, Vector _back, LinkedList componentList, String title) { + public JDialogSelectRequirements(Frame f, Vector<Requirement> _back, java.util.List<TGComponent> componentList, String title) { super(f, title, true); back = _back; if ((validated == null) || (ignored == null)) { val = makeNewVal(componentList); - ign = new Vector(); + ign = new Vector<Requirement>(); } else { val = validated; ign = ignored; @@ -96,27 +97,29 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac pack(); } - private Vector makeNewVal(LinkedList list) { - Vector v = new Vector(); + private Vector<Requirement> makeNewVal( java.util.List<TGComponent> list) { + Vector<Requirement> v = new Vector<Requirement>(); TGComponent tgc; for(int i=0; i<list.size(); i++) { - tgc = (TGComponent)(list.get(i)); + tgc = list.get(i); //System.out.println(tgc); if (tgc instanceof Requirement) { if (((Requirement)tgc).isFormal()) { - v.addElement(tgc); + v.addElement( (Requirement) tgc ); } } } + return v; } - private void checkRequirement(Vector tobeChecked, LinkedList source) { + private void checkRequirement(Vector<Requirement> tobeChecked, java.util.List<TGComponent> source) { Requirement r; for(int i=0; i<tobeChecked.size(); i++) { - r = (Requirement)(tobeChecked.elementAt(i)); + r = tobeChecked.elementAt(i); + if (!source.contains(r)) { tobeChecked.removeElementAt(i); i--; @@ -124,13 +127,14 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac } } - public void addNewRequirement(Vector added, LinkedList source, Vector notSource) { + public void addNewRequirement(Vector<Requirement> added, java.util.List<TGComponent> source, Vector<Requirement> notSource) { TGComponent tgc; for(int i=0; i<source.size(); i++) { - tgc = (TGComponent)(source.get(i)); + tgc = source.get(i); + if ((tgc instanceof Requirement) && (((Requirement)tgc).isFormal()) && (!added.contains(tgc)) && (!notSource.contains(tgc))){ - added.addElement(tgc); + added.addElement( (Requirement) tgc); //System.out.println("New element"); } } @@ -152,7 +156,7 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac panel1 = new JPanel(); panel1.setLayout(new BorderLayout()); panel1.setBorder(new javax.swing.border.TitledBorder("Ignored formal requirements")); - listIgnored = new JList(ign); + listIgnored = new JList<TGComponent>(ign); //listIgnored.setPreferredSize(new Dimension(200, 250)); listIgnored.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listIgnored.addListSelectionListener(this); @@ -165,7 +169,7 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac panel2 = new JPanel(); panel2.setLayout(new BorderLayout()); panel2.setBorder(new javax.swing.border.TitledBorder("Formal requirements taken into account")); - listValidated = new JList(val); + listValidated = new JList<TGComponent>(val); //listValidated.setPreferredSize(new Dimension(200, 250)); listValidated.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listValidated.addListSelectionListener(this); @@ -253,8 +257,8 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac private void addOneIgnored() { int [] list = listValidated.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + Requirement o; for (int i=0; i<list.length; i++){ o = val.elementAt(list[i]); ign.addElement(o); @@ -269,8 +273,8 @@ public class JDialogSelectRequirements extends javax.swing.JDialog implements Ac private void addOneValidated() { int [] list = listIgnored.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + Requirement o; for (int i=0; i<list.length; i++){ o = ign.elementAt(list[i]); val.addElement(o); diff --git a/src/ui/window/JDialogSelectTMLComponent.java b/src/ui/window/JDialogSelectTMLComponent.java index d4972a5880..bce97693a5 100755 --- a/src/ui/window/JDialogSelectTMLComponent.java +++ b/src/ui/window/JDialogSelectTMLComponent.java @@ -51,21 +51,23 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; +import java.util.List; import ui.*; import ui.tmlcompd.*; public class JDialogSelectTMLComponent extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - public static Vector validated, ignored; + public static Vector<TGComponent> validated, ignored; private static boolean optimized = true; - private Vector val, ign, back; + private Vector<TGComponent> val; + private Vector<TGComponent> ign, back; //subpanels private JPanel panel1, panel2, panel3, panel4, panel5, panel6; - private JList listIgnored; - private JList listValidated; + private JList<TGComponent> listIgnored; + private JList<TGComponent> listValidated; private JButton allValidated; private JButton addOneValidated; private JButton addOneIgnored; @@ -77,17 +79,17 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac private JButton cancelButton; /** Creates new form */ - public JDialogSelectTMLComponent(Frame f, Vector _back, LinkedList componentList, String title) { + public JDialogSelectTMLComponent(Frame f, Vector<TGComponent> _back, List<TGComponent> componentList, String title) { super(f, title, true); back = _back; - LinkedList pcl = new LinkedList(); + List<TGComponent> pcl = new LinkedList<TGComponent>(); makeComponentList(pcl, componentList); if ((validated == null) || (ignored == null)) { val = makeNewVal(pcl); - ign = new Vector(); + ign = new Vector<TGComponent>(); } else { val = validated; ign = ignored; @@ -101,7 +103,7 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac pack(); } - private void makeComponentList(LinkedList cs, LinkedList lcs) { + private void makeComponentList(List<TGComponent> cs, List<TGComponent> lcs) { TGComponent tgc; TMLCCompositeComponent ccomp; @@ -121,25 +123,26 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac } } - private Vector makeNewVal(LinkedList list) { - Vector v = new Vector(); + private Vector<TGComponent> makeNewVal( List<TGComponent> list) { + Vector<TGComponent> v = new Vector<TGComponent>(); TGComponent tgc; for(int i=0; i<list.size(); i++) { - tgc = (TGComponent)(list.get(i)); + tgc = list.get(i); //System.out.println(tgc); if (tgc instanceof TMLCPrimitiveComponent) { - v.addElement(tgc); + v.addElement( (TMLCPrimitiveComponent) tgc); } } return v; } - private void checkTask(Vector tobeChecked, LinkedList source) { - TMLCPrimitiveComponent t; + private void checkTask(Vector<? extends TGComponent> tobeChecked, List<TGComponent> source) { + TGComponent t; for(int i=0; i<tobeChecked.size(); i++) { - t = (TMLCPrimitiveComponent)(tobeChecked.elementAt(i)); + t = tobeChecked.elementAt(i); + if (!source.contains(t)) { tobeChecked.removeElementAt(i); i--; @@ -147,13 +150,14 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac } } - public void addNewTask(Vector added, LinkedList source, Vector notSource) { + public void addNewTask(Vector<TGComponent> added, List<TGComponent> source, Vector<TGComponent> notSource) { TGComponent tgc; for(int i=0; i<source.size(); i++) { - tgc = (TGComponent)(source.get(i)); + tgc = source.get(i); + if ((tgc instanceof TMLCPrimitiveComponent) && (!added.contains(tgc)) && (!notSource.contains(tgc))){ - added.addElement(tgc); + added.addElement( tgc ) ; //System.out.println("New element"); } } @@ -184,7 +188,7 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac panel1 = new JPanel(); panel1.setLayout(new BorderLayout()); panel1.setBorder(new javax.swing.border.TitledBorder("Ignored components")); - listIgnored = new JList(ign); + listIgnored = new JList<TGComponent>(ign); //listIgnored.setPreferredSize(new Dimension(200, 250)); listIgnored.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listIgnored.addListSelectionListener(this); @@ -237,7 +241,7 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac panel2 = new JPanel(); panel2.setLayout(new BorderLayout()); panel2.setBorder(new javax.swing.border.TitledBorder("Used components")); - listValidated = new JList(val); + listValidated = new JList<TGComponent>(val); //listValidated.setPreferredSize(new Dimension(200, 250)); listValidated.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listValidated.addListSelectionListener(this); @@ -301,8 +305,8 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac private void addOneIgnored() { int [] list = listValidated.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; for (int i=0; i<list.length; i++){ o = val.elementAt(list[i]); ign.addElement(o); @@ -317,8 +321,8 @@ public class JDialogSelectTMLComponent extends javax.swing.JDialog implements Ac private void addOneValidated() { int [] list = listIgnored.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; for (int i=0; i<list.length; i++){ o = ign.elementAt(list[i]); val.addElement(o); diff --git a/src/ui/window/JDialogSelectTMLNodes.java b/src/ui/window/JDialogSelectTMLNodes.java index 8086592ad6..51b33da2e7 100755 --- a/src/ui/window/JDialogSelectTMLNodes.java +++ b/src/ui/window/JDialogSelectTMLNodes.java @@ -57,17 +57,17 @@ import ui.tmldd.*; public class JDialogSelectTMLNodes extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - public static Vector validated, ignored; + public static Vector<TGComponent> validated, ignored; private static boolean optimized = true; private int clock; - private Vector val, ign, back; + private Vector<TGComponent> val, ign, back; //subpanels private JPanel panel1, panel2, panel3, panel4, panel5, panel6; - private JList listIgnored; - private JList listValidated; + private JList<TGComponent> listIgnored; + private JList<TGComponent> listValidated; private JButton allValidated; private JButton addOneValidated; private JButton addOneIgnored; @@ -80,7 +80,7 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action private JButton cancelButton; /** Creates new form */ - public JDialogSelectTMLNodes(Frame f, Vector _back, LinkedList componentList, String title, int _clock) { + public JDialogSelectTMLNodes(Frame f, Vector<TGComponent> _back, java.util.List<TGComponent> componentList, String title, int _clock) { super(f, title, true); back = _back; @@ -89,7 +89,7 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action if ((validated == null) || (ignored == null)) { val = makeNewVal(componentList); - ign = new Vector(); + ign = new Vector<TGComponent>(); } else { val = validated; ign = ignored; @@ -103,25 +103,27 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action pack(); } - private Vector makeNewVal(LinkedList list) { - Vector v = new Vector(); + private Vector<TGComponent> makeNewVal( java.util.List<TGComponent> list) { + Vector<TGComponent> v = new Vector<TGComponent>(); TGComponent tgc; for(int i=0; i<list.size(); i++) { - tgc = (TGComponent)(list.get(i)); + tgc = list.get(i); //System.out.println(tgc); if (tgc instanceof TMLArchiNode) { v.addElement(tgc); } } + return v; } - private void checkNode(Vector tobeChecked, LinkedList source) { - TMLArchiNode t; + private void checkNode(Vector<TGComponent> tobeChecked, java.util.List<TGComponent> source) { + TGComponent t; for(int i=0; i<tobeChecked.size(); i++) { - t = (TMLArchiNode)(tobeChecked.elementAt(i)); + t = tobeChecked.elementAt(i); + if (!source.contains(t)) { tobeChecked.removeElementAt(i); i--; @@ -129,11 +131,12 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action } } - public void addNewNode(Vector added, LinkedList source, Vector notSource) { + public void addNewNode(Vector<TGComponent> added, java.util.List<TGComponent> source, Vector<TGComponent> notSource) { TGComponent tgc; for(int i=0; i<source.size(); i++) { - tgc = (TGComponent)(source.get(i)); + tgc = source.get(i); + if ((tgc instanceof TMLArchiNode) && (!added.contains(tgc)) && (!notSource.contains(tgc))){ added.addElement(tgc); //System.out.println("New element"); @@ -165,7 +168,7 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action panel1 = new JPanel(); panel1.setLayout(new BorderLayout()); panel1.setBorder(new javax.swing.border.TitledBorder("Nodes ignored")); - listIgnored = new JList(ign); + listIgnored = new JList<TGComponent>(ign); //listIgnored.setPreferredSize(new Dimension(200, 250)); listIgnored.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listIgnored.addListSelectionListener(this); @@ -218,7 +221,7 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action panel2 = new JPanel(); panel2.setLayout(new BorderLayout()); panel2.setBorder(new javax.swing.border.TitledBorder("Nodes taken into account")); - listValidated = new JList(val); + listValidated = new JList<TGComponent>(val); //listValidated.setPreferredSize(new Dimension(200, 250)); listValidated.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listValidated.addListSelectionListener(this); @@ -233,7 +236,7 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action panel6.setLayout(new BorderLayout()); panel5 = new JPanel(); - GridBagLayout gridbag3 = new GridBagLayout(); + //GridBagLayout gridbag3 = new GridBagLayout(); GridBagConstraints c3 = new GridBagConstraints(); panel5.setLayout(gridbag2); @@ -296,8 +299,8 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action private void addOneIgnored() { int [] list = listValidated.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; for (int i=0; i<list.length; i++){ o = val.elementAt(list[i]); ign.addElement(o); @@ -312,8 +315,9 @@ public class JDialogSelectTMLNodes extends javax.swing.JDialog implements Action private void addOneValidated() { int [] list = listIgnored.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; + for (int i=0; i<list.length; i++){ o = ign.elementAt(list[i]); val.addElement(o); diff --git a/src/ui/window/JDialogSelectTMLTask.java b/src/ui/window/JDialogSelectTMLTask.java index bed6804b55..2092c58e5f 100755 --- a/src/ui/window/JDialogSelectTMLTask.java +++ b/src/ui/window/JDialogSelectTMLTask.java @@ -57,15 +57,15 @@ import ui.tmlcd.*; public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - public static Vector validated, ignored; + public static Vector<TGComponent> validated, ignored; private static boolean optimized = true; - private Vector val, ign, back; + private Vector<TGComponent> val, ign, back; //subpanels private JPanel panel1, panel2, panel3, panel4, panel5, panel6; - private JList listIgnored; - private JList listValidated; + private JList<TGComponent> listIgnored; + private JList<TGComponent> listValidated; private JButton allValidated; private JButton addOneValidated; private JButton addOneIgnored; @@ -77,14 +77,14 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL private JButton cancelButton; /** Creates new form */ - public JDialogSelectTMLTask(Frame f, Vector _back, LinkedList componentList, String title) { + public JDialogSelectTMLTask(Frame f, Vector<TGComponent> _back, java.util.List<TGComponent> componentList, String title) { super(f, title, true); back = _back; if ((validated == null) || (ignored == null)) { val = makeNewVal(componentList); - ign = new Vector(); + ign = new Vector<TGComponent>(); } else { val = validated; ign = ignored; @@ -98,25 +98,27 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL pack(); } - private Vector makeNewVal(LinkedList list) { - Vector v = new Vector(); + private Vector<TGComponent> makeNewVal( java.util.List<TGComponent> list) { + Vector<TGComponent> v = new Vector<TGComponent>(); TGComponent tgc; for(int i=0; i<list.size(); i++) { - tgc = (TGComponent)(list.get(i)); + tgc = list.get(i); //System.out.println(tgc); if (tgc instanceof TMLTaskOperator) { v.addElement(tgc); } } + return v; } - private void checkTask(Vector tobeChecked, LinkedList source) { - TMLTaskOperator t; + private void checkTask(Vector<TGComponent> tobeChecked, java.util.List<TGComponent> source) { + TGComponent t; for(int i=0; i<tobeChecked.size(); i++) { - t = (TMLTaskOperator)(tobeChecked.elementAt(i)); + t = tobeChecked.elementAt(i); + if (!source.contains(t)) { tobeChecked.removeElementAt(i); i--; @@ -124,11 +126,12 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL } } - public void addNewTask(Vector added, LinkedList source, Vector notSource) { + public void addNewTask(Vector<TGComponent> added, java.util.List<TGComponent> source, Vector<TGComponent> notSource) { TGComponent tgc; for(int i=0; i<source.size(); i++) { - tgc = (TGComponent)(source.get(i)); + tgc = source.get(i); + if ((tgc instanceof TMLTaskOperator) && (!added.contains(tgc)) && (!notSource.contains(tgc))){ added.addElement(tgc); //System.out.println("New element"); @@ -152,7 +155,7 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL panel1 = new JPanel(); panel1.setLayout(new BorderLayout()); panel1.setBorder(new javax.swing.border.TitledBorder("TML tasks ignored")); - listIgnored = new JList(ign); + listIgnored = new JList<TGComponent>(ign); //listIgnored.setPreferredSize(new Dimension(200, 250)); listIgnored.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listIgnored.addListSelectionListener(this); @@ -165,7 +168,7 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL panel2 = new JPanel(); panel2.setLayout(new BorderLayout()); panel2.setBorder(new javax.swing.border.TitledBorder("TML tasks taken into account")); - listValidated = new JList(val); + listValidated = new JList<TGComponent>(val); //listValidated.setPreferredSize(new Dimension(200, 250)); listValidated.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); listValidated.addListSelectionListener(this); @@ -266,8 +269,8 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL private void addOneIgnored() { int [] list = listValidated.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; for (int i=0; i<list.length; i++){ o = val.elementAt(list[i]); ign.addElement(o); @@ -282,8 +285,8 @@ public class JDialogSelectTMLTask extends javax.swing.JDialog implements ActionL private void addOneValidated() { int [] list = listIgnored.getSelectedIndices(); - Vector v = new Vector(); - Object o; + Vector<TGComponent> v = new Vector<TGComponent>(); + TGComponent o; for (int i=0; i<list.length; i++){ o = ign.elementAt(list[i]); val.addElement(o); diff --git a/src/ui/window/JDialogSynchro.java b/src/ui/window/JDialogSynchro.java index eb811c2ed1..9dbcee1405 100755 --- a/src/ui/window/JDialogSynchro.java +++ b/src/ui/window/JDialogSynchro.java @@ -57,15 +57,15 @@ import ui.cd.*; public class JDialogSynchro extends javax.swing.JDialog implements ActionListener, ListSelectionListener { - private LinkedList<TAttribute> gatesOfT1, gatesOfT2; - private LinkedList<TTwoAttributes> synchro, newSynchro; + private java.util.List<TAttribute> gatesOfT1, gatesOfT2; + private java.util.List<TTwoAttributes> synchro, newSynchro; private TClassSynchroInterface t1, t2; //private TDiagramPanel _tdp; private JPanel panel1, panel2; // Panel1 - private JComboBox gatesBox1, gatesBox2; + private JComboBox<String> gatesBox1, gatesBox2; private JButton addButton; //Panel2 @@ -79,7 +79,7 @@ public class JDialogSynchro extends javax.swing.JDialog implements ActionListene private JButton cancelButton; /** Creates new form */ - public JDialogSynchro(Frame f, TClassSynchroInterface _t1, TClassSynchroInterface _t2, LinkedList<TTwoAttributes> _synchro, TCDSynchroGateList _tcdsgl, String title) { + public JDialogSynchro(Frame f, TClassSynchroInterface _t1, TClassSynchroInterface _t2, java.util.List<TTwoAttributes> _synchro, TCDSynchroGateList _tcdsgl, String title) { super(f, title, true); t1 = _t1; t2 = _t2; @@ -93,7 +93,7 @@ public class JDialogSynchro extends javax.swing.JDialog implements ActionListene checkGates(synchro); // clone synchronization gates -> for cancel - newSynchro = (LinkedList<TTwoAttributes>)(synchro.clone()); + newSynchro = new LinkedList<TTwoAttributes>( synchro );//.clone()); // remove gates involved in synchro adjustGatesOfTClasses(); @@ -103,7 +103,7 @@ public class JDialogSynchro extends javax.swing.JDialog implements ActionListene pack(); } - private void checkGates(LinkedList<TTwoAttributes> sync) { + private void checkGates( java.util.List<TTwoAttributes> sync) { for(int i=0; i<sync.size(); i++) { TTwoAttributes tt = sync.get (i); if ((tt.t1 != t1) || (tt.t2 != t2) || (!gatesOfT1.contains(tt.ta1)) || (!gatesOfT2.contains(tt.ta2))) { @@ -193,13 +193,13 @@ public class JDialogSynchro extends javax.swing.JDialog implements ActionListene c1.fill = GridBagConstraints.HORIZONTAL; c1.anchor = GridBagConstraints.CENTER; - gatesBox1 = new JComboBox(); + gatesBox1 = new JComboBox<String>(); panel1.add(gatesBox1, c1); c1.gridwidth = 1; panel1.add(new JLabel(" = "), c1); c1.gridwidth = GridBagConstraints.REMAINDER; //end row - gatesBox2 = new JComboBox(); + gatesBox2 = new JComboBox<String>(); panel1.add(gatesBox2, c1); // third line panel1 diff --git a/src/ui/window/JDialogUPPAALValidation.java b/src/ui/window/JDialogUPPAALValidation.java index 339febba5c..013c16abba 100755 --- a/src/ui/window/JDialogUPPAALValidation.java +++ b/src/ui/window/JDialogUPPAALValidation.java @@ -49,9 +49,7 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import java.io.*; import java.util.*; -import java.util.regex.*; import avatartranslator.*; import avatartranslator.touppaal.*; @@ -61,7 +59,7 @@ import myutil.*; import ui.*; public class JDialogUPPAALValidation extends javax.swing.JDialog implements ActionListener, Runnable { - private static boolean deadlockAChecked, deadlockEChecked, generateTraceChecked, customChecked, stateAChecked, stateEChecked, stateLChecked, showDetailsChecked, translateChecked; + private static boolean deadlockAChecked/*, deadlockEChecked*/, generateTraceChecked, customChecked, stateAChecked, stateEChecked, stateLChecked, showDetailsChecked, translateChecked; protected MainGUI mgui; @@ -89,10 +87,10 @@ public class JDialogUPPAALValidation extends javax.swing.JDialog implements Acti protected JTextField customText; protected JTextField translatedText; protected TURTLEPanel tp; - protected LinkedList<JCheckBox> customChecks; + protected java.util.List<JCheckBox> customChecks; - protected LinkedList<String> customQueries; - public HashMap<String, Integer> verifMap; + protected java.util.List<String> customQueries; + public Map<String, Integer> verifMap; protected int status = -1; /** Creates new form */ public JDialogUPPAALValidation(Frame f, MainGUI _mgui, String title, String _cmdVerifyta, String _pathTrace, String _fileName, String _spec, String _host, TURTLEPanel _tp) { @@ -318,8 +316,8 @@ public class JDialogUPPAALValidation extends javax.swing.JDialog implements Acti public void run() { - String cmd1 = ""; - String data1; + // String cmd1 = ""; + // String data1; int id = 0; String query; String name; @@ -481,7 +479,8 @@ public class JDialogUPPAALValidation extends javax.swing.JDialog implements Acti trace_id++; } } - mgui.modelBacktracingUPPAAL(verifMap); + + mgui.modelBacktracingUPPAAL(verifMap); } //Removing files @@ -551,7 +550,7 @@ public class JDialogUPPAALValidation extends javax.swing.JDialog implements Acti return ""; } - LinkedList<AvatarBlock> blocks = avspec.getListOfBlocks(); + java.util.List<AvatarBlock> blocks = avspec.getListOfBlocks(); for (AvatarBlock block:blocks){ UPPAALTemplate temp = spec.getTemplateByName(block.getName()); if (temp !=null){ diff --git a/src/uppaaldesc/UPPAALSpec.java b/src/uppaaldesc/UPPAALSpec.java index 9e3d2b25f1..ac0a720a76 100755 --- a/src/uppaaldesc/UPPAALSpec.java +++ b/src/uppaaldesc/UPPAALSpec.java @@ -53,13 +53,13 @@ import myutil.*; public class UPPAALSpec { private String header = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; private String globalDeclaration = ""; - private LinkedList templates; + private List<UPPAALTemplate> templates; private String instanciations = ""; private String fullSpec; public UPPAALSpec() { - templates = new LinkedList(); + templates = new LinkedList<UPPAALTemplate>(); } public String getStringSpec() { @@ -67,7 +67,7 @@ public class UPPAALSpec { } public String makeSpec() { - ListIterator iterator = templates.listIterator(); + Iterator<UPPAALTemplate> iterator = templates.listIterator(); UPPAALTemplate template; globalDeclaration = "<declaration>\n//Global declarations\n" + Conversion.transformToXMLString(globalDeclaration) + "</declaration>\n"; @@ -75,7 +75,7 @@ public class UPPAALSpec { while(iterator.hasNext()) { //System.out.println("Template!"); - template = (UPPAALTemplate)(iterator.next()); + template = iterator.next(); templatesString.append(template.makeTemplate()); } @@ -85,7 +85,7 @@ public class UPPAALSpec { return fullSpec; } - public LinkedList getTemplates() { + public List<UPPAALTemplate> getTemplates() { return templates; } @@ -96,10 +96,10 @@ public class UPPAALSpec { public UPPAALTemplate getTemplateByName(String name) { UPPAALTemplate template; - ListIterator ite = templates.listIterator(); + Iterator<UPPAALTemplate> ite = templates.listIterator(); while(ite.hasNext()){ - template = (UPPAALTemplate)(ite.next()); + template = ite.next(); if (template.getName().compareTo(name) == 0) { return template; } @@ -124,26 +124,23 @@ public class UPPAALSpec { } public void enhanceGraphics() { - ListIterator iterator = templates.listIterator(); + Iterator<UPPAALTemplate> iterator = templates.listIterator(); UPPAALTemplate template; - while(iterator.hasNext()) { //System.out.println("Template!"); - template = (UPPAALTemplate)(iterator.next()); + template = iterator.next(); template.enhanceGraphics(); } } public void optimize() { - - ListIterator iterator = templates.listIterator(); + Iterator<UPPAALTemplate> iterator = templates.listIterator(); UPPAALTemplate template; - while(iterator.hasNext()) { //System.out.println("Template!"); - template = (UPPAALTemplate)(iterator.next()); + template = iterator.next(); template.optimize(); } diff --git a/src/uppaaldesc/UPPAALTransition.java b/src/uppaaldesc/UPPAALTransition.java index b91a27f779..ffd2cc2854 100755 --- a/src/uppaaldesc/UPPAALTransition.java +++ b/src/uppaaldesc/UPPAALTransition.java @@ -54,7 +54,7 @@ import myutil.Conversion; public class UPPAALTransition { public UPPAALLocation destinationLoc, sourceLoc; - public LinkedList points; //nails -> intermediate graphical points on transitions + public List<Point> points; //nails -> intermediate graphical points on transitions public String guard = ""; public Point guardPoint; @@ -64,7 +64,7 @@ public class UPPAALTransition { public Point assignmentPoint; public UPPAALTransition() { - points = new LinkedList(); + points = new LinkedList<Point>(); guardPoint = new Point(); synchronizationPoint = new Point(); assignmentPoint = new Point(); @@ -90,10 +90,10 @@ public class UPPAALTransition { ret += "<label kind=\"synchronisation\" x=\"" + synchronizationPoint.x + "\" y=\"" + synchronizationPoint.y + "\">" + Conversion.transformToXMLString(synchronization) + "</label>\n"; ret += "<label kind=\"assignment\" x=\"" + assignmentPoint.x + "\" y=\"" + assignmentPoint.y + "\">" + Conversion.transformToXMLString(assignment) + "</label>\n"; - ListIterator iterator = points.listIterator(); + Iterator<Point> iterator = points.listIterator(); Point p; while(iterator.hasNext()) { - p = (Point)(iterator.next()); + p = iterator.next(); ret += "<nail x=\"" + p.x + "\" y=\"" + p.y + "\" />\n"; } -- GitLab