Changeset 1057
- Timestamp:
- 01/24/12 23:48:01 (4 months ago)
- Files:
-
- trunk/src/org/kahina/core/KahinaInstance.java (modified) (2 diffs)
- trunk/src/org/kahina/core/KahinaState.java (modified) (2 diffs)
- trunk/src/org/kahina/core/control/KahinaSystemEvent.java (modified) (1 diff)
- trunk/src/org/kahina/core/gui/windows/KahinaMainWindow.java (modified) (5 diffs)
- trunk/src/org/kahina/core/gui/windows/KahinaWindow.java (modified) (1 diff)
- trunk/src/org/kahina/lp/LogicProgrammingState.java (modified) (1 diff)
- trunk/src/org/kahina/lp/bridge/LogicProgrammingBridge.java (modified) (1 diff)
- trunk/src/org/kahina/tralesld/TraleSLDState.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/org/kahina/core/KahinaInstance.java
r1049 r1057 128 128 if (state != null) 129 129 { 130 state. reset();130 state.initialize(); 131 131 } else 132 132 { … … 228 228 gui.displayMainViews(); 229 229 KahinaRunner.processEvent(new KahinaSelectionEvent(state.getSelectedStepID())); 230 KahinaRunner.processEvent(new KahinaSystemEvent(KahinaSystemEvent.NODE_COUNT, state.getStepCount())); 230 231 } catch (Exception e) 231 232 { trunk/src/org/kahina/core/KahinaState.java
r1049 r1057 50 50 public KahinaState() 51 51 { 52 consoleMessages = new KahinaTextModel(); 53 consoleLines = new HashMap<Integer,Set<KahinaLineReference>>(); 54 warnThresholdByBreakpoint = new HashMap<KahinaBreakpoint, Integer>(); 55 matchCountByBreakpoint = new HashMap<KahinaBreakpoint, Integer>(); 52 initialize(); 56 53 KahinaRunner.getControl().registerListener(KahinaEventTypes.SELECTION, this); 57 54 } 58 55 59 public void reset()56 public void initialize() 60 57 { 58 selectedStepID = -1; 59 nextStepID = 1; 61 60 //console is refilled for each new process 62 61 //TODO: think about an additional console for global events (warnings etc.) … … 74 73 } 75 74 return nextStepID++; 75 } 76 77 public int getStepCount() 78 { 79 return nextStepID - 1; 76 80 } 77 81 trunk/src/org/kahina/core/control/KahinaSystemEvent.java
r1049 r1057 9 9 public static final int QUIT = 0; 10 10 public static final int APPLY_BREAKPOINTS = 1; 11 public static final int NODE_COUNT = 2; 11 12 12 13 public KahinaSystemEvent(int systemEventType) trunk/src/org/kahina/core/gui/windows/KahinaMainWindow.java
r1050 r1057 3 3 import java.awt.Container; 4 4 import java.awt.dnd.DropTarget; 5 import java.awt.event.WindowAdapter;6 import java.awt.event.WindowEvent;7 5 8 6 import javax.swing.JMenuBar; 9 7 10 import org.kahina.core.KahinaRunner;11 8 import org.kahina.core.control.KahinaEvent; 12 9 import org.kahina.core.control.KahinaEventTypes; 13 10 import org.kahina.core.control.KahinaListener; 14 import org.kahina.core.control.KahinaSessionEvent;15 11 import org.kahina.core.control.KahinaSystemEvent; 16 import org.kahina.core.data.tree.KahinaTreeEvent;17 import org.kahina.core.data.tree.KahinaTreeEventType;18 12 import org.kahina.core.gui.KahinaSessionMenu; 19 13 import org.kahina.core.gui.KahinaWindowManager; … … 48 42 { 49 43 this.setTitle("Kahina"); 50 wm.getControl().registerListener(KahinaEventTypes.TREE, this);51 44 // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 52 45 // Uncomment this in order to be able to profile using JRat. … … 64 57 65 58 wm.getControl().registerListener(KahinaEventTypes.SYSTEM, this); 66 wm.getControl().registerListener(KahinaEventTypes.SESSION, this);67 59 } 68 60 … … 148 140 public void processEvent(KahinaEvent event) 149 141 { 150 if (event instanceof KahinaTreeEvent) 151 { 152 processTreeEvent((KahinaTreeEvent) event); 153 } else if (event instanceof KahinaSystemEvent) 142 if (event instanceof KahinaSystemEvent) 154 143 { 155 144 processSystemEvent((KahinaSystemEvent) event); 156 } else if (event instanceof KahinaSessionEvent)157 {158 processSessionEvent((KahinaSessionEvent) event);159 }160 }161 162 private void processSessionEvent(KahinaSessionEvent event)163 {164 if (event.getSessionEventType() == KahinaSessionEvent.LOAD_SESSION)165 {166 // TODO This is a kludge, see below.167 setTitle("Kahina");168 }169 }170 171 private void processTreeEvent(KahinaTreeEvent event)172 {173 if (event.getTreeEventType() == KahinaTreeEventType.NEW_NODE)174 {175 // TODO This is a kludge, we should synchronize the step176 // count with the state. But first, the architecture needs to be177 // changed to allow access to the state.178 setTitle("Kahina (" + event.getFirstID() + ")");179 145 } 180 146 } … … 182 148 private void processSystemEvent(KahinaSystemEvent event) 183 149 { 184 if (event.getSystemEventType() == KahinaSystemEvent.QUIT) 150 if (event.getSystemEventType() == KahinaSystemEvent.NODE_COUNT) 151 { 152 setTitle("Kahina (" + event.getIntContent() + ")"); 153 } else if (event.getSystemEventType() == KahinaSystemEvent.QUIT) 185 154 { 186 155 disposeAllWindows(); trunk/src/org/kahina/core/gui/windows/KahinaWindow.java
r1054 r1057 150 150 public void setTitle(String title) 151 151 { 152 System.err.println(this + ".setTitle(" + title + ")"); 152 if (VERBOSE) 153 { 154 System.err.println(this + ".setTitle(" + title + ")"); 155 } 153 156 super.setTitle(title); 154 157 mainPanel.setTitle(title); trunk/src/org/kahina/lp/LogicProgrammingState.java
r1049 r1057 63 63 } 64 64 65 public void reset()66 { 67 super. reset();65 public void initialize() 66 { 67 super.initialize(); 68 68 stepTree = new KahinaMemTree(); 69 69 secondaryStepTree = new KahinaMemTree(); trunk/src/org/kahina/lp/bridge/LogicProgrammingBridge.java
r1049 r1057 247 247 KahinaRunner.processEvent(new LogicProgrammingBridgeEvent(LogicProgrammingBridgeEventType.STEP_CALL, stepID, parentCandidateID)); 248 248 // used by node counter: 249 KahinaRunner.processEvent(new Kahina TreeEvent(KahinaTreeEventType.NEW_NODE, stepID, parentCandidateID));249 KahinaRunner.processEvent(new KahinaSystemEvent(KahinaSystemEvent.NODE_COUNT, stepID)); 250 250 currentID = stepID; 251 251 parentCandidateID = stepID; trunk/src/org/kahina/tralesld/TraleSLDState.java
r865 r1057 38 38 } 39 39 40 public void reset()40 public void initialize() 41 41 { 42 super. reset();42 super.initialize(); 43 43 //keep signature and auxiliary instance (constant across parses) 44 44 chart = new KahinaMemChart();
