diff --git a/src/ui/ColorManager.java b/src/ui/ColorManager.java index d999a5183cf0f1d51ce8dddeb2e5f435ff411db2..1756118bd0145fd3b311f4e7d9c10460e44a86ce 100755 --- a/src/ui/ColorManager.java +++ b/src/ui/ColorManager.java @@ -54,50 +54,50 @@ import myutil.*; * @see */ public class ColorManager { - + public static final Color DEFAULT = Color.black; - + public static final Color NORMAL_0 = Color.black; public static final Color POINTER_ON_ME_0 = Color.red; - public static final Color ACCESSIBILITY = Color.red; - public static final Color MUTEX_OK = new Color(5, 100, 7); - public static final Color BREAKPOINT = new Color(13, 248, 18); - public static final Color CURRENT_COMMAND_RUNNING = new Color(13, 248, 18, 200); - public static final Color CURRENT_COMMAND_RUNNABLE = new Color(162, 178, 22, 200); - public static final Color CURRENT_COMMAND_SUSPENDED = new Color(255, 184, 13, 200); - public static final Color CURRENT_COMMAND_TERMINATED = new Color(255, 42, 50, 200); - public static final Color CURRENT_COMMAND_UNKNOWN = new Color(107, 97, 97, 200); - public static final Color DIPLOID = new Color(163, 5, 253); - public static final Color TEPEID = new Color(163, 5, 253); - public static final Color AVATARID = new Color(163, 5, 253); + public static final Color ACCESSIBILITY = Color.red; + public static final Color MUTEX_OK = new Color(5, 100, 7); + public static final Color BREAKPOINT = new Color(13, 248, 18); + public static final Color CURRENT_COMMAND_RUNNING = new Color(13, 248, 18, 200); + public static final Color CURRENT_COMMAND_RUNNABLE = new Color(162, 178, 22, 200); + public static final Color CURRENT_COMMAND_SUSPENDED = new Color(255, 184, 13, 200); + public static final Color CURRENT_COMMAND_TERMINATED = new Color(255, 42, 50, 200); + public static final Color CURRENT_COMMAND_UNKNOWN = new Color(107, 97, 97, 200); + public static final Color DIPLOID = new Color(163, 5, 253); + public static final Color TEPEID = new Color(163, 5, 253); + public static final Color AVATARID = new Color(163, 5, 253); public static Color SELECTED_0 = Color.blue; public static final Color MOVING_0 = Color.magenta; public static final Color ADDING_0 = Color.lightGray; - + //public static final Color POINTED_0 = Color.orange; - //public static final Color POINTED_0 = new Color(231, 132, 19); + //public static final Color POINTED_0 = new Color(231, 132, 19); public static final Color POINTED_0 = new Color(139, 79, 11); - - //public static final Color UML_NOTE_BG = new Color(189, 91, 13, 200); - public static Color UML_NOTE_BG = new Color(173, 190, 234); - + + //public static final Color UML_NOTE_BG = new Color(189, 91, 13, 200); + public static Color UML_NOTE_BG = new Color(173, 190, 234); + public static final Color COMPOSITION_OPERATOR = Color.yellow; public static final Color ATTRIBUTE_BOX = new Color(199, 243, 105); - public static final Color ATTRIBUTE_BOX_ACTION = new Color(199, 243, 105); + public static final Color ATTRIBUTE_BOX_ACTION = new Color(199, 243, 105); public static final Color GATE_BOX_ACTION = new Color(215, 241, 247); public static final Color ARRAY_BOX_ACTION = new Color(227, 215, 31); public static final Color GATE_BOX = new Color(215, 241, 247); public static final Color OPERATION_BOX = new Color(243, 207, 158); public static final Color ACTIVITY_BOX = new Color(255, 208, 255); public static final Color RESIZE_POINTED = new Color(26, 114, 244); - //public static final Color UNKNOWN_BOX_ACTION = new Color(239, 44, 12, 125); - public static final Color UNKNOWN_BOX_ACTION = new Color(255, 12, 27); - + //public static final Color UNKNOWN_BOX_ACTION = new Color(239, 44, 12, 125); + public static final Color UNKNOWN_BOX_ACTION = new Color(255, 12, 27); + //public static final Color RANDOM = new Color(113, 170, 155); //public static final Color CHOICE = new Color(255, 255, 0); //public static final Color FOR = new Color(255, 167, 11); //public static final Color EXEC = new Color(143, 149, 255); - + public static final Color RANDOM = new Color(199, 243, 105); public static final Color CHOICE = new Color(199, 243, 105); public static final Color FOR = new Color(199, 243, 105); @@ -105,177 +105,174 @@ public class ColorManager { public static Color REQ_TOP_BOX = Color.yellow; public static Color REQ_ATTRIBUTE_BOX = new Color(179, 249, 179); - - public static final Color LOSSY = new Color(139, 139, 139); + + public static final Color LOSSY = new Color(139, 139, 139); //public static final Color REQ_ATTRIBUTE_BOX = new Color(190, 229, 158); public static Color OBS_ATTRIBUTE_BOX = new Color(225, 247, 225); - - public static Color CPU_BOX_1 = new Color(198, 235, 249); - public static Color CPU_BOX_2 = new Color(198, 227, 249); - //public static final Color BUS_BOX = new Color(255, 207, 114); - public static Color BUS_BOX = new Color(215, 188, 128); - public static Color BRIDGE_BOX = new Color(215, 166, 72); - public static Color MEMORY_BOX = new Color(172, 234, 211); - public static Color DMA_BOX = new Color(172, 234, 211); - public static Color HWA_BOX = new Color(144, 201, 211); - - public static Color TML_COMPOSITE_COMPONENT = new Color(239, 212, 176, 125); - - - public static Color TML_PORT_CHANNEL = new Color(104, 229, 255); - public static Color TML_PORT_EVENT = new Color(216, 187, 249); - public static Color TML_PORT_REQUEST = new Color(196, 166, 122); - + + public static Color CPU_BOX_1 = new Color(198, 235, 249); + public static Color CPU_BOX_2 = new Color(198, 227, 249); + //public static final Color BUS_BOX = new Color(255, 207, 114); + public static Color BUS_BOX = new Color(215, 188, 128); + public static Color BRIDGE_BOX = new Color(215, 166, 72); + public static Color MEMORY_BOX = new Color(172, 234, 211); + public static Color DMA_BOX = new Color(172, 234, 211); + public static Color HWA_BOX = new Color(144, 201, 211); + + public static Color TML_COMPOSITE_COMPONENT = new Color(239, 212, 176, 125); + + + public static Color TML_PORT_CHANNEL = new Color(104, 229, 255); + public static Color TML_PORT_EVENT = new Color(216, 187, 249); + public static Color TML_PORT_REQUEST = new Color(196, 166, 122); + public static final Color UML_NOTE = Color.lightGray; - - public static final Color SD_REFERENCE = new Color(104, 229, 255); - public static final Color IOD_REFERENCE = new Color(216, 187, 249); - - - public static Color ATD_BLOCK = new Color(196, 232, 195); - public static Color ATD_ATTACK = new Color(214, 187, 158); - public static Color ATD_ROOT_ATTACK = new Color(243, 131, 10); - public static Color ATD_CONSTRAINT = new Color(191, 153, 161); - - //public static final Color AVATAR_BLOCK = new Color(128, 180, 205); - //public static final Color AVATAR_BLOCK = new Color(158, 218, 227); - //public static final Color AVATAR_BLOCK = new Color(149, 193, 210); - public static Color AVATAR_BLOCK = new Color(193, 218, 241); - //public static final Color AVATAR_DATATYPE = new Color(109, 193, 210); - public static Color AVATAR_DATATYPE = new Color(156, 220, 162); - public static Color AVATAR_SEND_SIGNAL = new Color(128, 180, 205); - public static Color AVATAR_RECEIVE_SIGNAL = new Color(128, 180, 205); - //public static final Color AVATAR_GUARD = new Color(128, 180, 205); - public static Color AVATAR_GUARD = new Color(0, 89, 26); - //public static final Color AVATAR_TIME = new Color(108, 92, 67); - public static Color AVATAR_TIME = new Color(105, 75, 11); - //public static final Color AVATAR_ACTION = new Color(128, 92, 168); - public static Color AVATAR_ACTION = new Color(119, 16, 243); - public static Color AVATAR_CODE = new Color(255, 176, 37); - //public static final Color AVATAR_STATE = new Color(149, 193, 210); - public static Color AVATAR_STATE = new Color(193, 218, 241); - - public static Color AVATAR_SET_TIMER = new Color(255, 180, 105); - public static Color AVATAR_RESET_TIMER = new Color(255, 180, 105); - public static Color AVATAR_EXPIRE_TIMER = new Color(255, 180, 105); - - - public static Color AVATAR_ASSUMPTION_ATTRIBUTES = new Color(160, 212, 221); - //public static Color AVATAR_ASSUMPTION_ATTRIBUTES = new Color(183, 225, 203); - //public static Color AVATAR_ASSUMPTION_TOP = new Color(141, 181, 161); - public static Color AVATAR_ASSUMPTION_TOP = new Color(131, 209, 221); - - public static Color AVATAR_REQUIREMENT_TOP = new Color(228, 241, 242); - public static Color AVATAR_REQUIREMENT_ATTRIBUTES = new Color(205, 196, 109); - - public static Color AVATARPD_ATTRIBUTE = new Color(143, 182, 110); - public static Color AVATARPD_SIGNAL = new Color(205, 196, 109); - public static Color AVATARPD_PROPERTY = new Color(228, 241, 242); - public static Color AVATARPD_PROPERTY_RELATION = AVATARPD_PROPERTY; - public static Color AVATARPD_LOGICAL_CONSTRAINT = AVATARPD_SIGNAL; - public static Color AVATARPD_TEMPORAL_CONSTRAINT = AVATARPD_SIGNAL; - public static Color AVATARPD_ALIAS = AVATARPD_SIGNAL; - public static Color AVATARPD_ATTRIBUTE_SETTING = AVATARPD_ATTRIBUTE; - public static Color AVATARPD_BOOLEQ = AVATARPD_ATTRIBUTE; - - + + public static final Color SD_REFERENCE = new Color(104, 229, 255); + public static final Color IOD_REFERENCE = new Color(216, 187, 249); + + + public static Color ATD_BLOCK = new Color(196, 232, 195); + public static Color ATD_ATTACK = new Color(214, 187, 158); + public static Color ATD_ROOT_ATTACK = new Color(243, 131, 10); + public static Color ATD_CONSTRAINT = new Color(191, 153, 161); + + //public static final Color AVATAR_BLOCK = new Color(128, 180, 205); + //public static final Color AVATAR_BLOCK = new Color(158, 218, 227); + //public static final Color AVATAR_BLOCK = new Color(149, 193, 210); + public static Color AVATAR_BLOCK = new Color(193, 218, 241); + //public static final Color AVATAR_DATATYPE = new Color(109, 193, 210); + public static Color AVATAR_DATATYPE = new Color(156, 220, 162); + public static Color AVATAR_SEND_SIGNAL = new Color(128, 180, 205); + public static Color AVATAR_RECEIVE_SIGNAL = new Color(128, 180, 205); + //public static final Color AVATAR_GUARD = new Color(128, 180, 205); + public static Color AVATAR_GUARD = new Color(0, 89, 26); + //public static final Color AVATAR_TIME = new Color(108, 92, 67); + public static Color AVATAR_TIME = new Color(105, 75, 11); + //public static final Color AVATAR_ACTION = new Color(128, 92, 168); + public static Color AVATAR_ACTION = new Color(119, 16, 243); + public static Color AVATAR_CODE = new Color(255, 176, 37); + //public static final Color AVATAR_STATE = new Color(149, 193, 210); + public static Color AVATAR_STATE = new Color(193, 218, 241); + + public static Color AVATAR_SET_TIMER = new Color(255, 180, 105); + public static Color AVATAR_RESET_TIMER = new Color(255, 180, 105); + public static Color AVATAR_EXPIRE_TIMER = new Color(255, 180, 105); + + + public static Color AVATAR_ASSUMPTION_ATTRIBUTES = new Color(160, 212, 221); + //public static Color AVATAR_ASSUMPTION_ATTRIBUTES = new Color(183, 225, 203); + //public static Color AVATAR_ASSUMPTION_TOP = new Color(141, 181, 161); + public static Color AVATAR_ASSUMPTION_TOP = new Color(131, 209, 221); + + public static Color AVATAR_REQUIREMENT_TOP = new Color(228, 241, 242); + public static Color AVATAR_REQUIREMENT_ATTRIBUTES = new Color(205, 196, 109); + + public static Color AVATARPD_ATTRIBUTE = new Color(143, 182, 110); + public static Color AVATARPD_SIGNAL = new Color(205, 196, 109); + public static Color AVATARPD_PROPERTY = new Color(228, 241, 242); + public static Color AVATARPD_PROPERTY_RELATION = AVATARPD_PROPERTY; + public static Color AVATARPD_LOGICAL_CONSTRAINT = AVATARPD_SIGNAL; + public static Color AVATARPD_TEMPORAL_CONSTRAINT = AVATARPD_SIGNAL; + public static Color AVATARPD_ALIAS = AVATARPD_SIGNAL; + public static Color AVATARPD_ATTRIBUTE_SETTING = AVATARPD_ATTRIBUTE; + public static Color AVATARPD_BOOLEQ = AVATARPD_ATTRIBUTE; + + public static final Color DIAGRAM_BACKGROUND = Color.white; - - public static final Color MainTabbedPane = new Color(231, 214, 176); - //public static final Color MainTabbedPaneBack = new Color(136, 94, 4); - public static final Color MainTabbedPaneBack = new Color(9, 7, 85); - public static final Color MainTabbedPaneSelect = new Color(231, 178, 60); - - public static final Color InteractiveSimulationJTABackground = new Color(50, 40, 40); - public static final Color InteractiveSimulationJTAForeground = new Color(255, 166, 38); - public static final Color InteractiveSimulationBackground = new Color(5, 100, 7); - public static final Color InteractiveSimulationText = new Color(5, 100, 7); - - public static final Color InteractiveSimulationText_READY = new Color(5, 100, 7); - public static final Color InteractiveSimulationText_BUSY = new Color(255, 166, 38); - public static final Color InteractiveSimulationText_TERM = new Color(241, 6, 6); - public static final Color InteractiveSimulationText_UNKNOWN = new Color(6, 6, 241); - + + public static final Color MainTabbedPane = new Color(231, 214, 176); + //public static final Color MainTabbedPaneBack = new Color(136, 94, 4); + public static final Color MainTabbedPaneBack = new Color(9, 7, 85); + public static final Color MainTabbedPaneSelect = new Color(231, 178, 60); + + public static final Color InteractiveSimulationJTABackground = new Color(50, 40, 40); + public static final Color InteractiveSimulationJTAForeground = new Color(255, 166, 38); + public static final Color InteractiveSimulationBackground = new Color(5, 100, 7); + public static final Color InteractiveSimulationText = new Color(5, 100, 7); + + public static final Color InteractiveSimulationText_READY = new Color(5, 100, 7); + public static final Color InteractiveSimulationText_BUSY = new Color(255, 166, 38); + public static final Color InteractiveSimulationText_TERM = new Color(241, 6, 6); + public static final Color InteractiveSimulationText_UNKNOWN = new Color(6, 6, 241); + public final static void setColor(Graphics g, int state, int type) { if (type == 0) { switch(state) { - case 0: - g.setColor(NORMAL_0); - break; - case 1: - g.setColor(POINTER_ON_ME_0); - GraphicLib.setMediumStroke(g); - break; - case 2: - g.setColor(SELECTED_0); - break; - case 3: - g.setColor(MOVING_0); - break; - case 4: - g.setColor(ADDING_0); - break; - case 5: - g.setColor(POINTED_0); - break; - case 6: - g.setColor(RESIZE_POINTED); - break; - case 7: - g.setColor(RESIZE_POINTED); - break; - default: - g.setColor(DEFAULT); + case 0: + g.setColor(NORMAL_0); + break; + case 1: + g.setColor(POINTER_ON_ME_0); + GraphicLib.setMediumStroke(g); + break; + case 2: + g.setColor(SELECTED_0); + break; + case 3: + g.setColor(MOVING_0); + break; + case 4: + g.setColor(ADDING_0); + break; + case 5: + g.setColor(POINTED_0); + break; + case 6: + g.setColor(RESIZE_POINTED); + break; + case 7: + g.setColor(RESIZE_POINTED); + break; + default: + g.setColor(DEFAULT); } } } - - public static void noColor() { - UML_NOTE_BG = Color.white; - AVATAR_BLOCK = Color.white; - AVATAR_DATATYPE = Color.white; - AVATAR_STATE = Color.white; - AVATAR_REQUIREMENT_TOP = Color.white; - AVATAR_REQUIREMENT_ATTRIBUTES = Color.white; - AVATARPD_ATTRIBUTE = Color.white; - AVATARPD_SIGNAL = Color.white; - AVATARPD_PROPERTY = Color.white; - AVATARPD_PROPERTY_RELATION = Color.white; - AVATARPD_LOGICAL_CONSTRAINT = Color.white; - AVATARPD_TEMPORAL_CONSTRAINT = Color.white; - AVATARPD_ALIAS = Color.white; - AVATARPD_ATTRIBUTE_SETTING = Color.white; - AVATARPD_BOOLEQ = Color.white; - REQ_ATTRIBUTE_BOX = Color.white; - REQ_TOP_BOX = Color.white; - OBS_ATTRIBUTE_BOX = Color.white; - TML_COMPOSITE_COMPONENT = Color.white; - TML_PORT_CHANNEL = Color.white; - TML_PORT_EVENT = Color.white; - TML_PORT_REQUEST = Color.white; - CPU_BOX_1 = Color.white; - CPU_BOX_2 = Color.white; - BUS_BOX = Color.white; - BRIDGE_BOX = Color.white; - MEMORY_BOX = Color.white; - DMA_BOX = Color.white; - HWA_BOX = Color.white; - ATD_BLOCK = Color.white; - ATD_ATTACK = Color.white; - ATD_ROOT_ATTACK = Color.white; - ATD_CONSTRAINT = Color.white; - AVATAR_GUARD = Color.black; - AVATAR_TIME = Color.black; - AVATAR_ACTION = Color.black; - AVATAR_CODE = Color.black; - AVATAR_SEND_SIGNAL = Color.white; - AVATAR_RECEIVE_SIGNAL = Color.white; - AVATAR_ASSUMPTION_ATTRIBUTES = Color.white; - AVATAR_ASSUMPTION_TOP = Color.white; - - } - -} // Class Color + public static void noColor() { + UML_NOTE_BG = Color.white; + AVATAR_BLOCK = Color.white; + AVATAR_DATATYPE = Color.white; + AVATAR_STATE = Color.white; + AVATAR_REQUIREMENT_TOP = Color.white; + AVATAR_REQUIREMENT_ATTRIBUTES = Color.white; + AVATARPD_ATTRIBUTE = Color.white; + AVATARPD_SIGNAL = Color.white; + AVATARPD_PROPERTY = Color.white; + AVATARPD_PROPERTY_RELATION = Color.white; + AVATARPD_LOGICAL_CONSTRAINT = Color.white; + AVATARPD_TEMPORAL_CONSTRAINT = Color.white; + AVATARPD_ALIAS = Color.white; + AVATARPD_ATTRIBUTE_SETTING = Color.white; + AVATARPD_BOOLEQ = Color.white; + REQ_ATTRIBUTE_BOX = Color.white; + REQ_TOP_BOX = Color.white; + OBS_ATTRIBUTE_BOX = Color.white; + TML_COMPOSITE_COMPONENT = Color.white; + TML_PORT_CHANNEL = Color.white; + TML_PORT_EVENT = Color.white; + TML_PORT_REQUEST = Color.white; + CPU_BOX_1 = Color.white; + CPU_BOX_2 = Color.white; + BUS_BOX = Color.white; + BRIDGE_BOX = Color.white; + MEMORY_BOX = Color.white; + DMA_BOX = Color.white; + HWA_BOX = Color.white; + ATD_BLOCK = Color.white; + ATD_ATTACK = Color.white; + ATD_ROOT_ATTACK = Color.white; + ATD_CONSTRAINT = Color.white; + AVATAR_GUARD = Color.black; + AVATAR_TIME = Color.black; + AVATAR_ACTION = Color.black; + AVATAR_CODE = Color.black; + AVATAR_SEND_SIGNAL = Color.white; + AVATAR_RECEIVE_SIGNAL = Color.white; + AVATAR_ASSUMPTION_ATTRIBUTES = Color.white; + AVATAR_ASSUMPTION_TOP = Color.white; + } +} // Class Color diff --git a/src/ui/TGConnectorComment.java b/src/ui/TGConnectorComment.java index c8efd76121b65fa06eb0c4adc3275244ba6fdf02..a33dea21b68d4ba8187c475551209f673941768b 100755 --- a/src/ui/TGConnectorComment.java +++ b/src/ui/TGConnectorComment.java @@ -53,31 +53,24 @@ import java.util.*; import myutil.*; public class TGConnectorComment extends TGConnector { - + public TGConnectorComment(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) { super(_x, _y, _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint); myImageIcon = IconManager.imgic108; automaticDrawing = false; } - + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ GraphicLib.dashedLine(g, x1, y1, x2, y2); - + } - + protected void drawMiddleSegment(Graphics g, int x1, int y1, int x2, int y2) { GraphicLib.dashedLine(g, x1, y1, x2, y2); } - + public int getType() { return TGComponentManager.CONNECTOR_COMMENT; } - -} - - - - - - +} diff --git a/src/ui/tmldd/TMLArchiCPNode.java b/src/ui/tmldd/TMLArchiCPNode.java index ed3023031e4eba95603efa9677b3d70884d0f999..68e54f3be2beeaaa6b4b9a8fc539982949db2434 100755 --- a/src/ui/tmldd/TMLArchiCPNode.java +++ b/src/ui/tmldd/TMLArchiCPNode.java @@ -145,6 +145,36 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow //g.drawImage(IconManager.imgic1102.getImage(), x + width - 20, y + 4, null); g.drawImage(IconManager.imgic1102.getImage(), x + 4, y + 4, null); g.drawImage(IconManager.img9, x + width - 20, y + 4, null); + + // Link to mapped units + if (c == ColorManager.POINTER_ON_ME_0) { + TDiagramPanel tdp = getTDiagramPanel(); + TGComponent tgc; + if (tdp != null) { + for(String ss: mappedUnits) { + int index = ss.indexOf(":"); + if (index > -1) { + String[] tabOfNames = ss.substring(index+1, ss.length()).trim().split(","); + for (int i=0; i<tabOfNames.length; i++) { + String s = tabOfNames[i].trim(); + if (s.length() > 0) { + ListIterator iterator = tdp.getComponentList().listIterator(); + while(iterator.hasNext()) { + tgc = (TGComponent)(iterator.next()); + if (tgc instanceof TMLArchiNode) { + //TraceManager.addDev("Testing |" + tgc.getName() + "| vs | " + s + "|"); + if (tgc.getName().compareTo(s) == 0) { + //TraceManager.addDev("Ok"); + GraphicLib.dashedLine(g, getX() + getWidth()/2, getY() + getHeight()/2, tgc.getX() + tgc.getWidth()/2, tgc.getY() + tgc.getHeight()/2); + } + } + } + } + } + } + } + } + } } public TGComponent isOnOnlyMe(int x1, int y1) { @@ -296,62 +326,62 @@ public class TMLArchiCPNode extends TMLArchiCommunicationNode implements Swallow } - public boolean addSwallowedTGComponent( TGComponent tgc, int x, int y ) { - - if( tgc instanceof TMLArchiCommunicationArtifact ) { - // Make it an internal component - // It's one of my son - //Set its coordinates - tgc.setFather(this); - tgc.setDrawingZone(true); - //System.out.println("Internal component"); - //tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt); - //System.out.println("cdRect comp swallow"); - ((TMLArchiCommunicationArtifact)tgc).resizeWithFather(); - //tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight()); - //tgc.setCd(x, y); - //add it - addInternalComponent( tgc, 0 ); - return true; - } - else { - if( tgc instanceof TMLArchiPortArtifact ) { - tgc.setFather( this ); - tgc.setDrawingZone( true ); - ( (TMLArchiPortArtifact)tgc ).resizeWithFather(); - addInternalComponent( tgc, 0 ); - return true; - } - return false; + public boolean addSwallowedTGComponent( TGComponent tgc, int x, int y ) { + + if( tgc instanceof TMLArchiCommunicationArtifact ) { + // Make it an internal component + // It's one of my son + //Set its coordinates + tgc.setFather(this); + tgc.setDrawingZone(true); + //System.out.println("Internal component"); + //tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt); + //System.out.println("cdRect comp swallow"); + ((TMLArchiCommunicationArtifact)tgc).resizeWithFather(); + //tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight()); + //tgc.setCd(x, y); + //add it + addInternalComponent( tgc, 0 ); + return true; + } + else { + if( tgc instanceof TMLArchiPortArtifact ) { + tgc.setFather( this ); + tgc.setDrawingZone( true ); + ( (TMLArchiPortArtifact)tgc ).resizeWithFather(); + addInternalComponent( tgc, 0 ); + return true; + } + return false; + } + } + + public void hasBeenResized() { + + for( int i = 0; i < nbInternalTGComponent; i++ ) { + if( tgcomponent[i] instanceof TMLArchiCommunicationArtifact ) { + ( (TMLArchiCommunicationArtifact)tgcomponent[i] ).resizeWithFather(); + } + else { + if( tgcomponent[i] instanceof TMLArchiPortArtifact ) { + ( (TMLArchiPortArtifact)tgcomponent[i] ).resizeWithFather(); + } + } + } } - } - - public void hasBeenResized() { - - for( int i = 0; i < nbInternalTGComponent; i++ ) { - if( tgcomponent[i] instanceof TMLArchiCommunicationArtifact ) { - ( (TMLArchiCommunicationArtifact)tgcomponent[i] ).resizeWithFather(); - } - else { - if( tgcomponent[i] instanceof TMLArchiPortArtifact ) { - ( (TMLArchiPortArtifact)tgcomponent[i] ).resizeWithFather(); - } - } - } - } - - public ArrayList<TMLArchiPortArtifact> getPortArtifactList() { - - ArrayList<TMLArchiPortArtifact> v = new ArrayList<TMLArchiPortArtifact>(); - for( int i = 0; i < nbInternalTGComponent; i++ ) { - if( tgcomponent[i] instanceof TMLArchiPortArtifact ) { - v.add( (TMLArchiPortArtifact)(tgcomponent[i]) ); - } + + public ArrayList<TMLArchiPortArtifact> getPortArtifactList() { + + ArrayList<TMLArchiPortArtifact> v = new ArrayList<TMLArchiPortArtifact>(); + for( int i = 0; i < nbInternalTGComponent; i++ ) { + if( tgcomponent[i] instanceof TMLArchiPortArtifact ) { + v.add( (TMLArchiPortArtifact)(tgcomponent[i]) ); + } + } + return v; } - return v; - } - public Vector<String> getMappedUnits() { - return mappedUnits; - } + public Vector<String> getMappedUnits() { + return mappedUnits; + } } diff --git a/src/ui/tmldd/TMLArchiCPUNode.java b/src/ui/tmldd/TMLArchiCPUNode.java index d86def507b0f7e59491bbd1f29b8170fd9a0cef5..923a50af499f3e41a12fca81c54f8c12c9139459 100755 --- a/src/ui/tmldd/TMLArchiCPUNode.java +++ b/src/ui/tmldd/TMLArchiCPUNode.java @@ -1,48 +1,48 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.fr - -This software is a computer program whose purpose is to allow the -edition of TURTLE analysis, design and deployment diagrams, to -allow the generation of RT-LOTOS or Java code from this diagram, -and at last to allow the analysis of formal validation traces -obtained from external tools, e.g. RTL from LAAS-CNRS and CADP -from INRIA Rhone-Alpes. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms. - -/** -* Class TMLArchiCPUNode -* Node. To be used in TML architecture diagrams. -* Creation: 02/05/2005 -* @version 1.1 21/05/2008 -* @author Ludovic APVRILLE -* @see -*/ + ludovic.apvrille AT enst.fr + + This software is a computer program whose purpose is to allow the + edition of TURTLE analysis, design and deployment diagrams, to + allow the generation of RT-LOTOS or Java code from this diagram, + and at last to allow the analysis of formal validation traces + obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + from INRIA Rhone-Alpes. + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited + liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + /** + * Class TMLArchiCPUNode + * Node. To be used in TML architecture diagrams. + * Creation: 02/05/2005 + * @version 1.1 21/05/2008 + * @author Ludovic APVRILLE + * @see + */ package ui.tmldd; @@ -59,574 +59,574 @@ import ui.window.*; import tmltranslator.*; public class TMLArchiCPUNode extends TMLArchiNode implements SwallowTGComponent, WithAttributes { - private int textY1 = 15; - private int textY2 = 30; - private int derivationx = 2; - private int derivationy = 3; - private String stereotype = "CPU"; - - private int nbOfCores = HwCPU.DEFAULT_NB_OF_CORES; - private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE; - private int pipelineSize = HwCPU.DEFAULT_PIPELINE_SIZE; - private int goIdleTime = HwCPU.DEFAULT_GO_IDLE_TIME; - private int maxConsecutiveIdleCycles = HwCPU.DEFAULT_MAX_CONSECUTIVE_IDLE_CYCLES; - private int taskSwitchingTime = HwCPU.DEFAULT_TASK_SWITCHING_TIME; - private int branchingPredictionPenalty = HwCPU.DEFAULT_BRANCHING_PREDICTION_PENALTY; - private int schedulingPolicy = HwCPU.DEFAULT_SCHEDULING; - private int sliceTime = HwCPU.DEFAULT_SLICE_TIME; - private int execiTime = HwCPU.DEFAULT_EXECI_TIME; - private int execcTime = HwCPU.DEFAULT_EXECC_TIME; - private int cacheMiss = HwCPU.DEFAULT_CACHE_MISS; - - public TMLArchiCPUNode(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); - - width = 250; - height = 200; - minWidth = 150; - minHeight = 100; - - nbConnectingPoint = 16; - connectingPoint = new TGConnectingPoint[16]; - - connectingPoint[0] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.0); - connectingPoint[1] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.5, 0.0); - connectingPoint[2] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); - connectingPoint[3] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.5); - connectingPoint[4] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); - connectingPoint[5] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 1.0); - connectingPoint[6] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.5, 1.0); - connectingPoint[7] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); - - connectingPoint[8] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.25, 0.0); - connectingPoint[9] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.75, 0.0); - connectingPoint[10] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.25); - connectingPoint[11] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.25); - connectingPoint[12] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.75); - connectingPoint[13] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.75); - connectingPoint[14] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.25, 1.0); - connectingPoint[15] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.75, 1.0); - - addTGConnectingPointsComment(); - - nbInternalTGComponent = 0; - - moveable = true; - editable = true; - removable = true; - userResizable = true; - - name = tdp.findNodeName("CPU"); - value = "name"; - - myImageIcon = IconManager.imgic700; - } - - public void internalDrawing(Graphics g) { - Color c = g.getColor(); - g.draw3DRect(x, y, width, height, true); - - - // Top lines - g.drawLine(x, y, x + derivationx, y - derivationy); - g.drawLine(x + width, y, x + width + derivationx, y - derivationy); - g.drawLine(x + derivationx, y - derivationy, x + width + derivationx, y - derivationy); - - // Right lines - g.drawLine(x + width, y + height, x + width + derivationx, y - derivationy + height); - g.drawLine(x + derivationx + width, y - derivationy, x + width + derivationx, y - derivationy + height); - - // Filling color - g.setColor(ColorManager.CPU_BOX_1); - g.fill3DRect(x+1, y+1, width-1, height-1, true); - g.setColor(c); - - // Strings - String ster = "<<" + stereotype + ">>"; - int w = g.getFontMetrics().stringWidth(ster); - Font f = g.getFont(); - g.setFont(f.deriveFont(Font.BOLD)); - g.drawString(ster, x + (width - w)/2, y + textY1); - g.setFont(f); - w = g.getFontMetrics().stringWidth(name); - g.drawString(name, x + (width - w)/2, y + textY2); - - // Icon - g.drawImage(IconManager.imgic1100.getImage(), x + 4, y + 4, null); - g.drawImage(IconManager.img9, x + width - 20, y + 4, null); - } - - public TGComponent isOnOnlyMe(int x1, int y1) { - - Polygon pol = new Polygon(); - pol.addPoint(x, y); - pol.addPoint(x + derivationx, y - derivationy); - pol.addPoint(x + derivationx + width, y - derivationy); - pol.addPoint(x + derivationx + width, y + height - derivationy); - pol.addPoint(x + width, y + height); - pol.addPoint(x, y + height); - if (pol.contains(x1, y1)) { - return this; - } - - return null; - } - - public String getStereotype() { - return stereotype; - - } - - public String getNodeName() { - return name; - } - - public boolean editOndoubleClick(JFrame frame) { - boolean error = false; - String errors = ""; - int tmp; - String tmpName; - - JDialogCPUNode dialog = new JDialogCPUNode(frame, "Setting CPU attributes", this); - dialog.setSize(500, 450); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed - - if (!dialog.isRegularClose()) { - return false; - } - - if (dialog.getNodeName().length() != 0) { - tmpName = dialog.getNodeName(); - tmpName = tmpName.trim(); - if (!TAttribute.isAValidId(tmpName, false, false)) { - error = true; - errors += "Name of the node "; - } else { - name = tmpName; - } - } - - schedulingPolicy = dialog.getSchedulingPolicy(); - if (schedulingPolicy == HwCPU.BASIC_ROUND_ROBIN) { - stereotype = "CPURR"; - } - - if (schedulingPolicy == HwCPU.ROUND_ROBIN_PRIORITY_BASED) { - stereotype = "CPURRPB"; - } - - if (dialog.getSliceTime().length() != 0) { - try { - tmp = sliceTime; - sliceTime = Integer.decode(dialog.getSliceTime()).intValue(); - if (sliceTime <= 0) { - sliceTime = tmp; - error = true; - errors += "Slice time "; - } - } catch (Exception e) { - error = true; - errors += "Slice time "; - } - } - - if (dialog.getNbOfCores().length() != 0) { - try { - tmp = nbOfCores; - nbOfCores = Integer.decode(dialog.getNbOfCores()).intValue(); - if (nbOfCores <= 0) { - nbOfCores = tmp; - error = true; - errors += "Data size "; - } - } catch (Exception e) { - error = true; - errors += "Data size "; - } - } - - if (dialog.getByteDataSize().length() != 0) { - try { - tmp = byteDataSize; - byteDataSize = Integer.decode(dialog.getByteDataSize()).intValue(); - if (byteDataSize <= 0) { - byteDataSize = tmp; - error = true; - errors += "Data size "; - } - } catch (Exception e) { - error = true; - errors += "Data size "; - } - } - - if (dialog.getPipelineSize().length() != 0) { - try { - tmp = pipelineSize; - pipelineSize = Integer.decode(dialog.getPipelineSize()).intValue(); - if (pipelineSize <= 0) { - pipelineSize = tmp; - error = true; - errors += "Pipeline size "; - } - } catch (Exception e) { - error = true; - errors += "Pipeline size "; - } - } - - if (dialog.getGoIdleTime().length() != 0) { - try { - tmp = goIdleTime; - goIdleTime = Integer.decode(dialog.getGoIdleTime()).intValue(); - if (goIdleTime < 0) { - goIdleTime = tmp; - error = true; - errors += "Go idle time "; - } - } catch (Exception e) { - error = true; - errors += "Go idle time "; - } - } - - if (dialog.getMaxConsecutiveIdleCycles().length() != 0) { - try { - tmp = goIdleTime; - maxConsecutiveIdleCycles = Integer.decode(dialog.getMaxConsecutiveIdleCycles()).intValue(); - if (maxConsecutiveIdleCycles < 0) { - maxConsecutiveIdleCycles = tmp; - error = true; - errors += "Max consecutive idle cycles "; - } - } catch (Exception e) { - error = true; - errors += "Max consecutive idle cycles "; - } - } - - if (dialog.getExeciTime().length() != 0) { - try { - tmp = execiTime; - execiTime = Integer.decode(dialog.getExeciTime()).intValue(); - if (execiTime < 0) { - execiTime = tmp; - error = true; - errors += "execi time "; - } - } catch (Exception e) { - error = true; - errors += "execi time "; - } - } - - if (dialog.getExeccTime().length() != 0) { - try { - tmp = execcTime; - execcTime = Integer.decode(dialog.getExeccTime()).intValue(); - if (execcTime < 0) { - execcTime = tmp; - error = true; - errors += "execc time "; - } - } catch (Exception e) { - error = true; - errors += "execc time "; - } - } - - if (dialog.getTaskSwitchingTime().length() != 0) { - try { - tmp = taskSwitchingTime; - taskSwitchingTime = Integer.decode(dialog.getTaskSwitchingTime()).intValue(); - if (taskSwitchingTime <= 0) { - taskSwitchingTime = tmp; - error = true; - errors += "Task switching time "; - } - } catch (Exception e) { - error = true; - errors += "Task switching time "; - } - } - - if (dialog.getBranchingPredictionPenalty().length() != 0) { - try { - tmp = branchingPredictionPenalty; - branchingPredictionPenalty = Integer.decode(dialog.getBranchingPredictionPenalty()).intValue(); - if ((branchingPredictionPenalty < 0) || (branchingPredictionPenalty > 100)) { - branchingPredictionPenalty = tmp; - error = true; - errors += "Mis-branching prediction "; - } - } catch (Exception e) { - error = true; - errors += "Mis-branching prediction "; - } - } - - if (dialog.getCacheMiss().length() != 0) { - try { - tmp = cacheMiss; - cacheMiss = Integer.decode(dialog.getCacheMiss()).intValue(); - if ((cacheMiss < 0) || (cacheMiss > 100)) { - cacheMiss = tmp; - error = true; - errors += "Cache-miss "; - } - } catch (Exception e) { - error = true; - errors += "Cache-miss "; - } - } - - if (dialog.getClockRatio().length() != 0) { - try { - tmp = clockRatio; - clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); - if (clockRatio < 1) { - clockRatio = tmp; - error = true; - errors += "Clock ratio "; - } - } catch (Exception e) { - error = true; - errors += "Clock ratio "; - } - } - - if (error) { - JOptionPane.showMessageDialog(frame, - "Invalid value for the following attributes: " + errors, - "Error", - JOptionPane.INFORMATION_MESSAGE); - return false; - } - - return true; - } - - - public int getType() { - return TGComponentManager.TMLARCHI_CPUNODE; - } - - public boolean acceptSwallowedTGComponent(TGComponent tgc) { - if (tgc instanceof TMLArchiArtifact) { - return true; - } - - return false; - } - - public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { - - //Set its coordinates - if (tgc instanceof TMLArchiArtifact) { - tgc.setFather(this); - tgc.setDrawingZone(true); - ((TMLArchiArtifact)tgc).resizeWithFather(); - addInternalComponent(tgc, 0); - return true; - } - - return false; - - } - - public void removeSwallowedTGComponent(TGComponent tgc) { - removeInternalComponent(tgc); - } - - - public Vector getArtifactList() { - Vector v = new Vector(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLArchiArtifact) { - v.add(tgcomponent[i]); - } - } - return v; - } - - public void hasBeenResized() { - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLArchiArtifact) { - ((TMLArchiArtifact)tgcomponent[i]).resizeWithFather(); - } - } - - } - - protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); - sb.append("\" />\n"); - sb.append("<attributes nbOfCores=\"" + nbOfCores + "\" byteDataSize=\"" + byteDataSize + "\" "); - sb.append(" schedulingPolicy=\"" + schedulingPolicy + "\" "); - sb.append(" sliceTime=\"" + sliceTime + "\" "); - sb.append(" goIdleTime=\"" + goIdleTime + "\" "); - sb.append(" maxConsecutiveIdleCycles=\"" + maxConsecutiveIdleCycles + "\" "); - sb.append(" pipelineSize=\"" + pipelineSize + "\" "); - sb.append(" taskSwitchingTime=\"" + taskSwitchingTime + "\" "); - sb.append(" branchingPredictionPenalty=\"" + branchingPredictionPenalty + "\" "); - sb.append(" cacheMiss=\"" + cacheMiss + "\""); - sb.append(" execiTime=\"" + execiTime + "\""); - sb.append(" execcTime=\"" + execcTime + "\""); - sb.append(" clockRatio=\"" + clockRatio + "\""); - sb.append("/>\n"); - sb.append("</extraparam>\n"); - return new String(sb); - } - - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ - //System.out.println("*** load extra synchro ***"); - try { - - NodeList nli; - Node n1, n2; - Element elt; - 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); - //System.out.println(n2); - if (n2.getNodeType() == Node.ELEMENT_NODE) { - elt = (Element) n2; - if (elt.getTagName().equals("info")) { - sstereotype = elt.getAttribute("stereotype"); - snodeName = elt.getAttribute("nodeName"); - } - if (sstereotype != null) { - stereotype = sstereotype; - } - if (snodeName != null){ - name = snodeName; - } - - if (elt.getTagName().equals("attributes")) { - try { - // the "try" statement is for retro compatibility - nbOfCores = Integer.decode(elt.getAttribute("nbOfCores")).intValue(); - } catch (Exception e) { - } - byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue(); - schedulingPolicy =Integer.decode(elt.getAttribute("schedulingPolicy")).intValue(); - goIdleTime = Integer.decode(elt.getAttribute("goIdleTime")).intValue(); - pipelineSize = Integer.decode(elt.getAttribute("pipelineSize")).intValue(); - taskSwitchingTime = Integer.decode(elt.getAttribute("taskSwitchingTime")).intValue(); - branchingPredictionPenalty = Integer.decode(elt.getAttribute("branchingPredictionPenalty")).intValue(); - if ((elt.getAttribute("cacheMiss") != null) && (elt.getAttribute("cacheMiss").length() > 0)){ - cacheMiss = Integer.decode(elt.getAttribute("cacheMiss")).intValue(); - } - if ((elt.getAttribute("execiTime") != null) && (elt.getAttribute("execiTime").length() > 0)){ - execiTime = Integer.decode(elt.getAttribute("execiTime")).intValue(); - } - if ((elt.getAttribute("execcTime") != null) && (elt.getAttribute("execcTime").length() > 0)){ - execcTime = Integer.decode(elt.getAttribute("execcTime")).intValue(); - } - if ((elt.getAttribute("maxConsecutiveIdleCycles") != null) && (elt.getAttribute("maxConsecutiveIdleCycles").length() > 0)){ - maxConsecutiveIdleCycles = Integer.decode(elt.getAttribute("maxConsecutiveIdleCycles")).intValue(); - } - if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ - clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); - } - if ((elt.getAttribute("sliceTime") != null) && (elt.getAttribute("sliceTime").length() > 0)){ - sliceTime = Integer.decode(elt.getAttribute("sliceTime")).intValue(); - } - } - } - } - } - } - - } catch (Exception e) { - throw new MalformedModelingException(); - } - } - - public int getDefaultConnector() { - return TGComponentManager.CONNECTOR_NODE_TMLARCHI; - } - - public int getNbOfCores(){ - return nbOfCores; - } - - public int getByteDataSize(){ - return byteDataSize; - } - - public int getPipelineSize(){ - return pipelineSize; - } - - public int getGoIdleTime(){ - return goIdleTime; - } - - public int getMaxConsecutiveIdleCycles(){ - return maxConsecutiveIdleCycles; - } - - public int getExeciTime(){ - return execiTime; - } - - public int getExeccTime(){ - return execcTime; - } - - public int getTaskSwitchingTime(){ - return taskSwitchingTime; - } - - public int getBranchingPredictionPenalty(){ - return branchingPredictionPenalty; - } - - public int getCacheMiss(){ - return cacheMiss; - } - - public int getSchedulingPolicy(){ - return schedulingPolicy; - } - - public int getSliceTime(){ - return sliceTime; - } - - public String getAttributes() { - String attr = ""; - attr += "Nb of cores = " + nbOfCores + "\n"; - attr += "Data size (in byte) = " + byteDataSize + "\n"; - attr += "Pipeline size = " + pipelineSize + "\n"; - if (schedulingPolicy == HwCPU.DEFAULT_SCHEDULING) { - attr += "Sched. policy = basic Round Robin\n"; - } - attr += "Slice time (in microseconds) = " + sliceTime + "\n"; - attr += "Switching penalty (in cycle) = " + taskSwitchingTime + "\n"; - attr += "Go in idle mode (in cycle) = " + goIdleTime + "\n"; - attr += "Idle cycles to go idle = " + maxConsecutiveIdleCycles + "\n"; - attr += "EXECI exec. time (in cycle) = " + execiTime + "\n"; - attr += "EXECC exec. time (in cycle) = " + execcTime + "\n"; - attr += "Branch. pred. misrate (in %) = " + branchingPredictionPenalty + "\n"; - attr += "Cache miss (in %) = " + cacheMiss + "\n"; - attr += "Clock ratio = " + clockRatio + "\n"; - return attr; - - } - - public int getComponentType() { - return CONTROLLER; - } - + private int textY1 = 15; + private int textY2 = 30; + private int derivationx = 2; + private int derivationy = 3; + private String stereotype = "CPU"; + + private int nbOfCores = HwCPU.DEFAULT_NB_OF_CORES; + private int byteDataSize = HwCPU.DEFAULT_BYTE_DATA_SIZE; + private int pipelineSize = HwCPU.DEFAULT_PIPELINE_SIZE; + private int goIdleTime = HwCPU.DEFAULT_GO_IDLE_TIME; + private int maxConsecutiveIdleCycles = HwCPU.DEFAULT_MAX_CONSECUTIVE_IDLE_CYCLES; + private int taskSwitchingTime = HwCPU.DEFAULT_TASK_SWITCHING_TIME; + private int branchingPredictionPenalty = HwCPU.DEFAULT_BRANCHING_PREDICTION_PENALTY; + private int schedulingPolicy = HwCPU.DEFAULT_SCHEDULING; + private int sliceTime = HwCPU.DEFAULT_SLICE_TIME; + private int execiTime = HwCPU.DEFAULT_EXECI_TIME; + private int execcTime = HwCPU.DEFAULT_EXECC_TIME; + private int cacheMiss = HwCPU.DEFAULT_CACHE_MISS; + + public TMLArchiCPUNode(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); + + width = 250; + height = 200; + minWidth = 150; + minHeight = 100; + + nbConnectingPoint = 16; + connectingPoint = new TGConnectingPoint[16]; + + connectingPoint[0] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.0); + connectingPoint[1] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.5, 0.0); + connectingPoint[2] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.0); + connectingPoint[3] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.5); + connectingPoint[4] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.5); + connectingPoint[5] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 1.0); + connectingPoint[6] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.5, 1.0); + connectingPoint[7] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 1.0); + + connectingPoint[8] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.25, 0.0); + connectingPoint[9] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.75, 0.0); + connectingPoint[10] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.25); + connectingPoint[11] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.25); + connectingPoint[12] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.75); + connectingPoint[13] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 1.0, 0.75); + connectingPoint[14] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.25, 1.0); + connectingPoint[15] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.75, 1.0); + + addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + name = tdp.findNodeName("CPU"); + value = "name"; + + myImageIcon = IconManager.imgic700; + } + + public void internalDrawing(Graphics g) { + Color c = g.getColor(); + g.draw3DRect(x, y, width, height, true); + + + // Top lines + g.drawLine(x, y, x + derivationx, y - derivationy); + g.drawLine(x + width, y, x + width + derivationx, y - derivationy); + g.drawLine(x + derivationx, y - derivationy, x + width + derivationx, y - derivationy); + + // Right lines + g.drawLine(x + width, y + height, x + width + derivationx, y - derivationy + height); + g.drawLine(x + derivationx + width, y - derivationy, x + width + derivationx, y - derivationy + height); + + // Filling color + g.setColor(ColorManager.CPU_BOX_1); + g.fill3DRect(x+1, y+1, width-1, height-1, true); + g.setColor(c); + + // Strings + String ster = "<<" + stereotype + ">>"; + int w = g.getFontMetrics().stringWidth(ster); + Font f = g.getFont(); + g.setFont(f.deriveFont(Font.BOLD)); + g.drawString(ster, x + (width - w)/2, y + textY1); + g.setFont(f); + w = g.getFontMetrics().stringWidth(name); + g.drawString(name, x + (width - w)/2, y + textY2); + + // Icon + g.drawImage(IconManager.imgic1100.getImage(), x + 4, y + 4, null); + g.drawImage(IconManager.img9, x + width - 20, y + 4, null); + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + + Polygon pol = new Polygon(); + pol.addPoint(x, y); + pol.addPoint(x + derivationx, y - derivationy); + pol.addPoint(x + derivationx + width, y - derivationy); + pol.addPoint(x + derivationx + width, y + height - derivationy); + pol.addPoint(x + width, y + height); + pol.addPoint(x, y + height); + if (pol.contains(x1, y1)) { + return this; + } + + return null; + } + + public String getStereotype() { + return stereotype; + + } + + public String getNodeName() { + return name; + } + + public boolean editOndoubleClick(JFrame frame) { + boolean error = false; + String errors = ""; + int tmp; + String tmpName; + + JDialogCPUNode dialog = new JDialogCPUNode(frame, "Setting CPU attributes", this); + dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getNodeName().length() != 0) { + tmpName = dialog.getNodeName(); + tmpName = tmpName.trim(); + if (!TAttribute.isAValidId(tmpName, false, false)) { + error = true; + errors += "Name of the node "; + } else { + name = tmpName; + } + } + + schedulingPolicy = dialog.getSchedulingPolicy(); + if (schedulingPolicy == HwCPU.BASIC_ROUND_ROBIN) { + stereotype = "CPURR"; + } + + if (schedulingPolicy == HwCPU.ROUND_ROBIN_PRIORITY_BASED) { + stereotype = "CPURRPB"; + } + + if (dialog.getSliceTime().length() != 0) { + try { + tmp = sliceTime; + sliceTime = Integer.decode(dialog.getSliceTime()).intValue(); + if (sliceTime <= 0) { + sliceTime = tmp; + error = true; + errors += "Slice time "; + } + } catch (Exception e) { + error = true; + errors += "Slice time "; + } + } + + if (dialog.getNbOfCores().length() != 0) { + try { + tmp = nbOfCores; + nbOfCores = Integer.decode(dialog.getNbOfCores()).intValue(); + if (nbOfCores <= 0) { + nbOfCores = tmp; + error = true; + errors += "Data size "; + } + } catch (Exception e) { + error = true; + errors += "Data size "; + } + } + + if (dialog.getByteDataSize().length() != 0) { + try { + tmp = byteDataSize; + byteDataSize = Integer.decode(dialog.getByteDataSize()).intValue(); + if (byteDataSize <= 0) { + byteDataSize = tmp; + error = true; + errors += "Data size "; + } + } catch (Exception e) { + error = true; + errors += "Data size "; + } + } + + if (dialog.getPipelineSize().length() != 0) { + try { + tmp = pipelineSize; + pipelineSize = Integer.decode(dialog.getPipelineSize()).intValue(); + if (pipelineSize <= 0) { + pipelineSize = tmp; + error = true; + errors += "Pipeline size "; + } + } catch (Exception e) { + error = true; + errors += "Pipeline size "; + } + } + + if (dialog.getGoIdleTime().length() != 0) { + try { + tmp = goIdleTime; + goIdleTime = Integer.decode(dialog.getGoIdleTime()).intValue(); + if (goIdleTime < 0) { + goIdleTime = tmp; + error = true; + errors += "Go idle time "; + } + } catch (Exception e) { + error = true; + errors += "Go idle time "; + } + } + + if (dialog.getMaxConsecutiveIdleCycles().length() != 0) { + try { + tmp = goIdleTime; + maxConsecutiveIdleCycles = Integer.decode(dialog.getMaxConsecutiveIdleCycles()).intValue(); + if (maxConsecutiveIdleCycles < 0) { + maxConsecutiveIdleCycles = tmp; + error = true; + errors += "Max consecutive idle cycles "; + } + } catch (Exception e) { + error = true; + errors += "Max consecutive idle cycles "; + } + } + + if (dialog.getExeciTime().length() != 0) { + try { + tmp = execiTime; + execiTime = Integer.decode(dialog.getExeciTime()).intValue(); + if (execiTime < 0) { + execiTime = tmp; + error = true; + errors += "execi time "; + } + } catch (Exception e) { + error = true; + errors += "execi time "; + } + } + + if (dialog.getExeccTime().length() != 0) { + try { + tmp = execcTime; + execcTime = Integer.decode(dialog.getExeccTime()).intValue(); + if (execcTime < 0) { + execcTime = tmp; + error = true; + errors += "execc time "; + } + } catch (Exception e) { + error = true; + errors += "execc time "; + } + } + + if (dialog.getTaskSwitchingTime().length() != 0) { + try { + tmp = taskSwitchingTime; + taskSwitchingTime = Integer.decode(dialog.getTaskSwitchingTime()).intValue(); + if (taskSwitchingTime <= 0) { + taskSwitchingTime = tmp; + error = true; + errors += "Task switching time "; + } + } catch (Exception e) { + error = true; + errors += "Task switching time "; + } + } + + if (dialog.getBranchingPredictionPenalty().length() != 0) { + try { + tmp = branchingPredictionPenalty; + branchingPredictionPenalty = Integer.decode(dialog.getBranchingPredictionPenalty()).intValue(); + if ((branchingPredictionPenalty < 0) || (branchingPredictionPenalty > 100)) { + branchingPredictionPenalty = tmp; + error = true; + errors += "Mis-branching prediction "; + } + } catch (Exception e) { + error = true; + errors += "Mis-branching prediction "; + } + } + + if (dialog.getCacheMiss().length() != 0) { + try { + tmp = cacheMiss; + cacheMiss = Integer.decode(dialog.getCacheMiss()).intValue(); + if ((cacheMiss < 0) || (cacheMiss > 100)) { + cacheMiss = tmp; + error = true; + errors += "Cache-miss "; + } + } catch (Exception e) { + error = true; + errors += "Cache-miss "; + } + } + + if (dialog.getClockRatio().length() != 0) { + try { + tmp = clockRatio; + clockRatio = Integer.decode(dialog.getClockRatio()).intValue(); + if (clockRatio < 1) { + clockRatio = tmp; + error = true; + errors += "Clock ratio "; + } + } catch (Exception e) { + error = true; + errors += "Clock ratio "; + } + } + + if (error) { + JOptionPane.showMessageDialog(frame, + "Invalid value for the following attributes: " + errors, + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + return true; + } + + + public int getType() { + return TGComponentManager.TMLARCHI_CPUNODE; + } + + public boolean acceptSwallowedTGComponent(TGComponent tgc) { + if (tgc instanceof TMLArchiArtifact) { + return true; + } + + return false; + } + + public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { + + //Set its coordinates + if (tgc instanceof TMLArchiArtifact) { + tgc.setFather(this); + tgc.setDrawingZone(true); + ((TMLArchiArtifact)tgc).resizeWithFather(); + addInternalComponent(tgc, 0); + return true; + } + + return false; + + } + + public void removeSwallowedTGComponent(TGComponent tgc) { + removeInternalComponent(tgc); + } + + + public Vector getArtifactList() { + Vector v = new Vector(); + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof TMLArchiArtifact) { + v.add(tgcomponent[i]); + } + } + return v; + } + + public void hasBeenResized() { + for(int i=0; i<nbInternalTGComponent; i++) { + if (tgcomponent[i] instanceof TMLArchiArtifact) { + ((TMLArchiArtifact)tgcomponent[i]).resizeWithFather(); + } + } + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<info stereotype=\"" + stereotype + "\" nodeName=\"" + name); + sb.append("\" />\n"); + sb.append("<attributes nbOfCores=\"" + nbOfCores + "\" byteDataSize=\"" + byteDataSize + "\" "); + sb.append(" schedulingPolicy=\"" + schedulingPolicy + "\" "); + sb.append(" sliceTime=\"" + sliceTime + "\" "); + sb.append(" goIdleTime=\"" + goIdleTime + "\" "); + sb.append(" maxConsecutiveIdleCycles=\"" + maxConsecutiveIdleCycles + "\" "); + sb.append(" pipelineSize=\"" + pipelineSize + "\" "); + sb.append(" taskSwitchingTime=\"" + taskSwitchingTime + "\" "); + sb.append(" branchingPredictionPenalty=\"" + branchingPredictionPenalty + "\" "); + sb.append(" cacheMiss=\"" + cacheMiss + "\""); + sb.append(" execiTime=\"" + execiTime + "\""); + sb.append(" execcTime=\"" + execcTime + "\""); + sb.append(" clockRatio=\"" + clockRatio + "\""); + sb.append("/>\n"); + sb.append("</extraparam>\n"); + return new String(sb); + } + + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ + //System.out.println("*** load extra synchro ***"); + try { + + NodeList nli; + Node n1, n2; + Element elt; + 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); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("info")) { + sstereotype = elt.getAttribute("stereotype"); + snodeName = elt.getAttribute("nodeName"); + } + if (sstereotype != null) { + stereotype = sstereotype; + } + if (snodeName != null){ + name = snodeName; + } + + if (elt.getTagName().equals("attributes")) { + try { + // the "try" statement is for retro compatibility + nbOfCores = Integer.decode(elt.getAttribute("nbOfCores")).intValue(); + } catch (Exception e) { + } + byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue(); + schedulingPolicy =Integer.decode(elt.getAttribute("schedulingPolicy")).intValue(); + goIdleTime = Integer.decode(elt.getAttribute("goIdleTime")).intValue(); + pipelineSize = Integer.decode(elt.getAttribute("pipelineSize")).intValue(); + taskSwitchingTime = Integer.decode(elt.getAttribute("taskSwitchingTime")).intValue(); + branchingPredictionPenalty = Integer.decode(elt.getAttribute("branchingPredictionPenalty")).intValue(); + if ((elt.getAttribute("cacheMiss") != null) && (elt.getAttribute("cacheMiss").length() > 0)){ + cacheMiss = Integer.decode(elt.getAttribute("cacheMiss")).intValue(); + } + if ((elt.getAttribute("execiTime") != null) && (elt.getAttribute("execiTime").length() > 0)){ + execiTime = Integer.decode(elt.getAttribute("execiTime")).intValue(); + } + if ((elt.getAttribute("execcTime") != null) && (elt.getAttribute("execcTime").length() > 0)){ + execcTime = Integer.decode(elt.getAttribute("execcTime")).intValue(); + } + if ((elt.getAttribute("maxConsecutiveIdleCycles") != null) && (elt.getAttribute("maxConsecutiveIdleCycles").length() > 0)){ + maxConsecutiveIdleCycles = Integer.decode(elt.getAttribute("maxConsecutiveIdleCycles")).intValue(); + } + if ((elt.getAttribute("clockRatio") != null) && (elt.getAttribute("clockRatio").length() > 0)){ + clockRatio = Integer.decode(elt.getAttribute("clockRatio")).intValue(); + } + if ((elt.getAttribute("sliceTime") != null) && (elt.getAttribute("sliceTime").length() > 0)){ + sliceTime = Integer.decode(elt.getAttribute("sliceTime")).intValue(); + } + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_NODE_TMLARCHI; + } + + public int getNbOfCores(){ + return nbOfCores; + } + + public int getByteDataSize(){ + return byteDataSize; + } + + public int getPipelineSize(){ + return pipelineSize; + } + + public int getGoIdleTime(){ + return goIdleTime; + } + + public int getMaxConsecutiveIdleCycles(){ + return maxConsecutiveIdleCycles; + } + + public int getExeciTime(){ + return execiTime; + } + + public int getExeccTime(){ + return execcTime; + } + + public int getTaskSwitchingTime(){ + return taskSwitchingTime; + } + + public int getBranchingPredictionPenalty(){ + return branchingPredictionPenalty; + } + + public int getCacheMiss(){ + return cacheMiss; + } + + public int getSchedulingPolicy(){ + return schedulingPolicy; + } + + public int getSliceTime(){ + return sliceTime; + } + + public String getAttributes() { + String attr = ""; + attr += "Nb of cores = " + nbOfCores + "\n"; + attr += "Data size (in byte) = " + byteDataSize + "\n"; + attr += "Pipeline size = " + pipelineSize + "\n"; + if (schedulingPolicy == HwCPU.DEFAULT_SCHEDULING) { + attr += "Sched. policy = basic Round Robin\n"; + } + attr += "Slice time (in microseconds) = " + sliceTime + "\n"; + attr += "Switching penalty (in cycle) = " + taskSwitchingTime + "\n"; + attr += "Go in idle mode (in cycle) = " + goIdleTime + "\n"; + attr += "Idle cycles to go idle = " + maxConsecutiveIdleCycles + "\n"; + attr += "EXECI exec. time (in cycle) = " + execiTime + "\n"; + attr += "EXECC exec. time (in cycle) = " + execcTime + "\n"; + attr += "Branch. pred. misrate (in %) = " + branchingPredictionPenalty + "\n"; + attr += "Cache miss (in %) = " + cacheMiss + "\n"; + attr += "Clock ratio = " + clockRatio + "\n"; + return attr; + + } + + public int getComponentType() { + return CONTROLLER; + } + } diff --git a/src/ui/tmldd/TMLArchiNode.java b/src/ui/tmldd/TMLArchiNode.java index cb44c7013ae715bfd1bf7b334b9f7518896ed882..b4e39628750e91c70a06036f3dfb148e3831f1bd 100755 --- a/src/ui/tmldd/TMLArchiNode.java +++ b/src/ui/tmldd/TMLArchiNode.java @@ -1,48 +1,48 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.fr - -This software is a computer program whose purpose is to allow the -edition of TURTLE analysis, design and deployment diagrams, to -allow the generation of RT-LOTOS or Java code from this diagram, -and at last to allow the analysis of formal validation traces -obtained from external tools, e.g. RTL from LAAS-CNRS and CADP -from INRIA Rhone-Alpes. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms. - -/** - * Class TMLArchiNode - * Node. To be used in TML architecture diagrams. - * Creation: 02/05/2005 - * @version 1.0 02/05/2005 - * @author Ludovic APVRILLE - * @see - */ + ludovic.apvrille AT enst.fr + + This software is a computer program whose purpose is to allow the + edition of TURTLE analysis, design and deployment diagrams, to + allow the generation of RT-LOTOS or Java code from this diagram, + and at last to allow the analysis of formal validation traces + obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + from INRIA Rhone-Alpes. + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited + liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + /** + * Class TMLArchiNode + * Node. To be used in TML architecture diagrams. + * Creation: 02/05/2005 + * @version 1.0 02/05/2005 + * @author Ludovic APVRILLE + * @see + */ package ui.tmldd; @@ -61,32 +61,32 @@ import tmltranslator.*; public abstract class TMLArchiNode extends TGCWithInternalComponent implements SwallowTGComponent { protected int clockRatio = HwNode.DEFAULT_CLOCK_RATIO; - //the return type of method getComponentType - public final static int STORAGE = 0; - public final static int TRANSFER = 1; - public final static int CONTROLLER = 2; - public final static int OTHER = 3; //for CPNodes - + //the return type of method getComponentType + public final static int STORAGE = 0; + public final static int TRANSFER = 1; + public final static int CONTROLLER = 2; + public final static int OTHER = 3; //for CPNodes + public TMLArchiNode(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); } - - public ArrayList<TMLArchiArtifact> getAllTMLArchiArtifacts() { - ArrayList<TMLArchiArtifact> artifacts = new ArrayList<TMLArchiArtifact>(); - + + public ArrayList<TMLArchiArtifact> getAllTMLArchiArtifacts() { + ArrayList<TMLArchiArtifact> artifacts = new ArrayList<TMLArchiArtifact>(); + for(int i=0; i<nbInternalTGComponent; i++) { if (tgcomponent[i] instanceof TMLArchiArtifact) { artifacts.add((TMLArchiArtifact)(tgcomponent[i])); } } - - return artifacts; - } - - public abstract int getComponentType(); - - public int getClockRatio(){ - return clockRatio; - } - + + return artifacts; + } + + public abstract int getComponentType(); + + public int getClockRatio(){ + return clockRatio; + } + }