Changeset 161 for trunk/src/org/expeditee/actions/Simple.java
- Timestamp:
- 07/25/08 16:37:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Simple.java
r156 r161 44 44 import org.expeditee.simple.BelowMinParametreCountException; 45 45 import org.expeditee.simple.Context; 46 import org.expeditee.simple.ExpediteeJEP; 46 47 import org.expeditee.simple.IncorrectParametreCountException; 47 48 import org.expeditee.simple.IncorrectTypeException; … … 59 60 import org.expeditee.stats.AgentStats; 60 61 import org.expeditee.stats.SessionStats; 62 import org.nfunk.jep.Node; 61 63 62 64 public class Simple implements Runnable { … … 313 315 t.start(); 314 316 } else { 315 if (!testSuite.runSuite()) {317 if (!testSuite.runSuite()) { 316 318 throw new RuntimeException(frameset + " failed"); 317 319 } … … 780 782 // Check if the user wants to display a message 781 783 // Check for set statements 782 } else if (tokens[0].startsWith("issearchpatternvalid")) { 784 } else if (tokens[0].startsWith("calculatestring")) { 785 assertMinParametreCount(tokens, 2); 786 String toCalculate = context.getPrimitives().getStringValue(tokens[1]); 787 boolean result = true; 788 ExpediteeJEP myParser = new ExpediteeJEP(); 789 //Add the variables in the system 790 context.getPrimitives().addToParser(myParser); 791 Node equation = myParser.parseExpression(toCalculate); 792 //TODO get the answer 793 794 } else if (tokens[0].startsWith("calculateitem")) { 795 assertMinParametreCount(tokens, 1); 796 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 797 Item item = (Item)context.getPointers().getVariable(tokens[1]).getValue(); 798 Frame frame = null; 799 if(tokens.length > 2){ 800 assertVariableType(tokens[2], 2, SPointer.framePrefix); 801 frame = (Frame)context.getPointers().getVariable(tokens[2]).getValue(); 802 } 803 Misc.calculate(frame, item); 804 }else if (tokens[0].startsWith("issearchpatternvalid")) { 783 805 assertExactParametreCount(tokens, 2); 784 806 boolean result = true; … … 901 923 SearchAgent searchAgent = new SearchTree(); 902 924 _agent = searchAgent; 903 searchAgent.initialise(null, null, topFrameName, resultsFrameset,904 re placementString, pattern);925 searchAgent.initialise(null, null, topFrameName, 926 resultsFrameset, replacementString, pattern); 905 927 searchAgent.run(); 906 928 _agent = null; … … 964 986 Item valueItem = null; 965 987 // Begin the search 966 for (Text text : targetFrame.getTextItems()) {988 for (Text text : targetFrame.getTextItems()) { 967 989 String s = text.getText().toLowerCase(); 968 990 … … 1271 1293 context.getPointers().setObject(frameTitleVar, 1272 1294 frame.getTitleItem()); 1273 } else if (tokens[0].startsWith("getframefilepath")) {1295 } else if (tokens[0].startsWith("getframefilepath")) { 1274 1296 assertExactParametreCount(tokens, 2); 1275 1297 String frameName = context.getPrimitives().getStringValue( … … 1999 2021 } else 2000 2022 context.readFrame(frameName, frameVar, null); 2001 } else if (tokens[0].equals("exitexpeditee")) {2023 } else if (tokens[0].equals("exitexpeditee")) { 2002 2024 Browser._theBrowser.exit(); 2003 } else if (tokens[0].equals("readkbdcond")) {2025 } else if (tokens[0].equals("readkbdcond")) { 2004 2026 2005 2027 String nextCharVarName = DEFAULT_CHAR; … … 2483 2505 assertExactParametreCount(tokens, 0); 2484 2506 FrameMouseActions.leftButton(); 2485 // DisplayIO.clickMouse(InputEvent.BUTTON1_MASK);2507 // DisplayIO.clickMouse(InputEvent.BUTTON1_MASK); 2486 2508 } else if (tokens[0].equals("clickmiddlebutton")) { 2487 2509 assertExactParametreCount(tokens, 0); 2488 2510 FrameMouseActions.middleButton(); 2489 // DisplayIO.clickMouse(InputEvent.BUTTON2_MASK);2511 // DisplayIO.clickMouse(InputEvent.BUTTON2_MASK); 2490 2512 } else if (tokens[0].equals("clickrightbutton")) { 2491 2513 assertExactParametreCount(tokens, 0); 2492 2514 FrameMouseActions.rightButton(); 2493 // DisplayIO.clickMouse(InputEvent.BUTTON3_MASK);2515 // DisplayIO.clickMouse(InputEvent.BUTTON3_MASK); 2494 2516 } else if (tokens[0].equals("repaint")) { 2495 2517 assertExactParametreCount(tokens, 0);
Note:
See TracChangeset
for help on using the changeset viewer.