Changeset 396
- Timestamp:
- 08/06/10 13:09:16 (2 years ago)
- Files:
-
- kahina/trunk/src/org/kahina/core/gui/profiler (added)
- kahina/trunk/src/org/kahina/core/profiler (added)
- kahina/trunk/src/org/kahina/core/profiler/DefaultProfileEntryMapper.java (added)
- kahina/trunk/src/org/kahina/core/profiler/Profile.java (added)
- kahina/trunk/src/org/kahina/core/profiler/ProfileEntry.java (added)
- kahina/trunk/src/org/kahina/core/util/Mapper.java (added)
- kahina/trunk/src/org/kahina/lp/bridge/LogicProgrammingBridge.java (modified) (24 diffs)
- kahina/trunk/src/org/kahina/lp/profiler (added)
- kahina/trunk/src/org/kahina/lp/profiler/LogicProgrammingProfiler.java (added)
- kahina/trunk/src/org/kahina/tralesld/bridge/TraleSLDBridge.java (modified) (22 diffs)
- kahina/trunk/src/org/kahina/tralesld/profiler (added)
- kahina/trunk/src/org/kahina/tralesld/profiler/TraleSLDProfileEntryMapper.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
kahina/trunk/src/org/kahina/lp/bridge/LogicProgrammingBridge.java
r387 r396 22 22 public class LogicProgrammingBridge extends KahinaBridge 23 23 { 24 private static final boolean verbose= false;24 private static final boolean VERBOSE = false; 25 25 26 26 // a dynamic map from external step IDs to most recent corresponding tree … … 52 52 KahinaRunner.getControl().registerListener(KahinaEventTypes.SYSTEM, this); 53 53 KahinaRunner.getControl().registerListener(KahinaEventTypes.SELECTION, this); 54 if ( verbose)54 if (VERBOSE) 55 55 System.err.println("new LogicProgrammingBridge()"); 56 56 } … … 65 65 public int convertStepID(int extID) 66 66 { 67 if ( verbose)67 if (VERBOSE) 68 68 System.err.println("LogicProgrammingBridge.convertStepID(" + extID + ")"); 69 69 Integer intID = stepIDConv.get(extID); … … 76 76 stepIDConv.put(extID, intID); 77 77 } 78 if ( verbose)78 if (VERBOSE) 79 79 System.err.println("LogicProgrammingBridge.convertStepID(" + extID + ") = " + intID); 80 80 return intID; … … 85 85 try 86 86 { 87 if ( verbose)87 if (VERBOSE) 88 88 System.err.println("LogicProgrammingBridge.registerStepInformation(" + extID + ",\"" + nodeLabel + "\")"); 89 89 int stepID = convertStepID(extID); … … 95 95 currentID = stepID; 96 96 state.consoleMessage(stepID, extID, LogicProgrammingStepType.CALL, consoleMessage); 97 if ( verbose)97 if (VERBOSE) 98 98 System.err.println("//LogicProgrammingBridge.registerStepInformation(" + extID + ",\"" + nodeLabel + "\")"); 99 99 } catch (Exception e) … … 108 108 try 109 109 { 110 if ( verbose)110 if (VERBOSE) 111 111 System.err.println("LogicProgrammingBridge.registerStepSourceCodeLocation(" + extID + ",\"" + absolutePath + "\"," + lineNumber + ")"); 112 112 int stepID = convertStepID(extID); … … 126 126 try 127 127 { 128 if ( verbose)128 if (VERBOSE) 129 129 System.err.println("LogicProgrammingBridge.registerStepLocation(" + extID + "," + parentID + ")"); 130 130 int stepID = convertStepID(extID); 131 131 KahinaRunner.processEvent(new KahinaTreeEvent(KahinaTreeEventType.NEW_NODE, stepID, convertStepID(parentID))); 132 132 currentID = stepID; 133 if ( verbose)133 if (VERBOSE) 134 134 { 135 135 System.err.println("Bridge state: " + bridgeState); … … 150 150 try 151 151 { 152 if ( verbose)152 if (VERBOSE) 153 153 System.err.println("LogicProgrammingBridge.registerStepRedo(" + extID + ")"); 154 154 int lastStepID = convertStepID(extID); … … 178 178 try 179 179 { 180 if ( verbose)180 if (VERBOSE) 181 181 System.err.println("LogicProgrammingBridge.registerStepExit(" + extID + "," + deterministic + ")"); 182 182 int stepID = convertStepID(extID); … … 212 212 try 213 213 { 214 if ( verbose)214 if (VERBOSE) 215 215 System.err.println("LogicProgrammingBridge.registerStepFailure(" + extID + ")"); 216 216 int stepID = convertStepID(extID); … … 231 231 public LogicProgrammingStep generateStep() 232 232 { 233 if ( verbose)233 if (VERBOSE) 234 234 System.err.println("LogicProgrammingBridge.generateStep()"); 235 235 return new LogicProgrammingStep(); … … 242 242 if (skipFlag) 243 243 { 244 if ( verbose)244 if (VERBOSE) 245 245 { 246 246 System.err.println("Bridge state/pressed button: " + bridgeState + "/s"); … … 253 253 case 'n': 254 254 { 255 if ( verbose)255 if (VERBOSE) 256 256 { 257 257 // System.err.println("Bridge state/pressed button: n/n"); … … 261 261 case 'p': 262 262 { 263 if ( verbose)263 if (VERBOSE) 264 264 { 265 265 System.err.println("Bridge state/pressed button: p/n"); … … 269 269 case 'q': 270 270 { 271 if ( verbose)271 if (VERBOSE) 272 272 { 273 273 System.err.println("Bridge state/pressed button: q/n"); … … 277 277 case 'c': 278 278 { 279 if ( verbose)279 if (VERBOSE) 280 280 { 281 281 System.err.println("Bridge state/pressed button: c/c"); … … 286 286 case 'f': 287 287 { 288 if ( verbose)288 if (VERBOSE) 289 289 { 290 290 System.err.println("Bridge state/pressed button: f/f"); … … 295 295 case 'l': 296 296 { 297 if ( verbose)297 if (VERBOSE) 298 298 { 299 299 System.err.println("Bridge state/pressed button: l/c"); … … 304 304 case 't': 305 305 { 306 if ( verbose)306 if (VERBOSE) 307 307 { 308 308 System.err.println("Bridge state/pressed button: t/c"); … … 315 315 if (skipID == currentID) 316 316 { 317 if ( verbose)317 if (VERBOSE) 318 318 { 319 319 System.err.println("Bridge state/pressed button: s/n"); … … 325 325 } else 326 326 { 327 if ( verbose)327 if (VERBOSE) 328 328 { 329 329 System.err.println("Bridge state/pressed button: s/c"); … … 334 334 case 'a': 335 335 { 336 if ( verbose)336 if (VERBOSE) 337 337 { 338 338 System.err.println("Bridge state/pressed button: a/a"); … … 342 342 default: 343 343 { 344 if ( verbose)344 if (VERBOSE) 345 345 { 346 346 System.err.println("Bridge state/pressed button: " + bridgeState + "/n"); kahina/trunk/src/org/kahina/tralesld/bridge/TraleSLDBridge.java
r392 r396 32 32 public class TraleSLDBridge extends LogicProgrammingBridge 33 33 { 34 public static final boolean verbose= false;34 public static final boolean VERBOSE = false; 35 35 36 36 private static final Pattern NOW_PATTERN = Pattern.compile("now\\((\\d+)\\)"); … … 64 64 try 65 65 { 66 if ( verbose)66 if (VERBOSE) 67 67 System.err.println("TraleSLDBridgeinitializeParseTrace(\"" + parsedSentenceList + "\")"); 68 68 List<String> wordList = PrologUtilities.parsePrologStringList(parsedSentenceList); … … 97 97 try 98 98 { 99 if ( verbose)99 if (VERBOSE) 100 100 { 101 101 System.err.println(this + ".registerStepInformation(" + extID + "," + nodeLabel + "," + consoleMessage + ")"); … … 106 106 state.linkEdgeToNode(lastRegisteredChartEdge, currentID); 107 107 } 108 if ( verbose)108 if (VERBOSE) 109 109 { 110 110 System.err.println("Matching..."); … … 121 121 */ 122 122 } 123 if ( verbose)123 if (VERBOSE) 124 124 { 125 125 System.err.println("Done matching."); 126 126 } 127 if ( verbose)127 if (VERBOSE) 128 128 { 129 129 System.err.println("//" + this + ".registerStepInformation(" + extID + "," + nodeLabel + "," + consoleMessage + ")"); … … 149 149 try 150 150 { 151 if ( verbose)151 if (VERBOSE) 152 152 { 153 153 System.err.println(this + ".registerProspectiveEdge(" + ruleApplicationExtID + "," + ruleName + "," + leftmostDaughter); … … 164 164 state.linkEdgeToNode(newEdgeID, stepIDConv.get(ruleApplicationExtID)); 165 165 KahinaRunner.processEvent(new KahinaChartUpdateEvent(newEdgeID)); 166 if ( verbose)166 if (VERBOSE) 167 167 { 168 168 System.err.println("//" + this + ".registerProspectiveEdge(" + ruleApplicationExtID + "," + ruleName + "," + leftmostDaughter); … … 179 179 try 180 180 { 181 if ( verbose)181 if (VERBOSE) 182 182 { 183 183 System.err.println(this + "registerEdgeRetrieval(" + daughterID + ")"); … … 188 188 if (!chart.getDaughterEdgesForEdge(mother).contains(daughter)) 189 189 { 190 if ( verbose)190 if (VERBOSE) 191 191 { 192 192 System.err.println("Setting right bound for " + mother + " to that of" + daughter); … … 197 197 // lastRegisteredChartEdge = mother; 198 198 KahinaRunner.processEvent(new KahinaChartUpdateEvent(mother)); 199 if ( verbose)199 if (VERBOSE) 200 200 { 201 201 System.err.println("//" + this + ".registerEdgeRetrieval(" + daughterID + ")"); … … 212 212 try 213 213 { 214 if ( verbose)214 if (VERBOSE) 215 215 { 216 216 System.err.println("TraleSLDBridge.registerRuleApplication(" + extID + ",\"" + ruleName + "," + leftmostDaughter + "\")"); … … 222 222 stepIDConv.put(extID, newStepID); 223 223 registerProspectiveEdge(extID, ruleName, leftmostDaughter); 224 if ( verbose)224 if (VERBOSE) 225 225 { 226 226 System.err.println("Storing new step."); 227 227 } 228 228 KahinaRunner.store(newStepID, newStep); 229 if ( verbose)229 if (VERBOSE) 230 230 { 231 231 System.err.println("Firing rule application event."); … … 233 233 // let TraleSLDTreeBehavior do the rest 234 234 KahinaRunner.processEvent(new TraleSLDBridgeEvent(TraleSLDBridgeEventType.RULE_APP, newStepID, ruleName, extID)); 235 if ( verbose)235 if (VERBOSE) 236 236 { 237 237 System.err.println("Creating console message."); … … 239 239 // experimental: message for console 240 240 state.consoleMessage(newStepID, extID, LogicProgrammingStepType.CALL, consoleMessage); 241 if ( verbose)241 if (VERBOSE) 242 242 { 243 243 System.err.println("Firing selection event."); … … 251 251 // be superfluous 252 252 // lastEdge = currentEdge; 253 if ( verbose)253 if (VERBOSE) 254 254 { 255 255 System.err.println("//TraleSLDBridge.registerRuleApplication(" + extID + ",\"" + ruleName + "," + leftmostDaughter + "\")"); … … 266 266 try 267 267 { 268 if ( verbose)268 if (VERBOSE) 269 269 { 270 270 System.err.println("TraleSLDBridge.registerChartEdge(" + externalEdgeID + "," + left + "," + right + ",\"" + ruleName + "\")"); 271 271 } 272 272 int internalEdgeID = state.getChart().addEdge(left, right, ruleName, TraleSLDChartEdgeStatus.SUCCESSFUL); 273 if ( verbose)273 if (VERBOSE) 274 274 System.err.println("Internal edge ID: " + internalEdgeID); 275 275 edgeIDConv.put(externalEdgeID, internalEdgeID); 276 276 lastRegisteredChartEdge = internalEdgeID; 277 277 KahinaRunner.processEvent(new KahinaChartUpdateEvent(internalEdgeID)); 278 if ( verbose)278 if (VERBOSE) 279 279 { 280 280 System.err.println("//TraleSLDBridge.registerChartEdge(" + externalEdgeID + "," + left + "," + right + ",\"" + ruleName + "\")"); … … 291 291 try 292 292 { 293 if ( verbose)293 if (VERBOSE) 294 294 { 295 295 System.err.println("TraleSLDBridge.registerEdgeDependency(" + motherID + "," + daughterID + ")"); … … 371 371 try 372 372 { 373 if ( verbose)373 if (VERBOSE) 374 374 System.err.println("registerParseEnd()"); 375 375 bridgeState = 'n'; … … 390 390 try 391 391 { 392 if ( verbose)392 if (VERBOSE) 393 393 { 394 394 System.err.println("registerStepFailure(" + externalStepID + ")"); … … 400 400 int currentEdge = prospectiveEdgeStack.remove(0); 401 401 prospectiveEdgeCanFail = false; 402 if ( verbose)402 if (VERBOSE) 403 403 { 404 404 System.err.println("Prospective edge " + currentEdge + " failed."); … … 414 414 } 415 415 currentID = stepID; 416 if ( verbose)416 if (VERBOSE) 417 417 { 418 418 System.err.println("Bridge state after chart edge was marked as failed: " + bridgeState); … … 433 433 try 434 434 { 435 if ( verbose)435 if (VERBOSE) 436 436 { 437 437 System.err.println("LogicProgrammingBridge.registerStepFailure(" + extID + ")");
