Ignore:
Timestamp:
06/06/08 12:42:25 (16 years ago)
Author:
ra33
Message:

Added getTreeStats

Location:
trunk/src/org/expeditee/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Misc.java

    r87 r90  
    1111import java.io.IOException;
    1212import java.lang.reflect.Method;
    13 import java.sql.Time;
    1413import java.util.ArrayList;
    1514import java.util.List;
     
    2322import org.expeditee.gui.FrameMouseActions;
    2423import org.expeditee.gui.TimeKeeper;
    25 import org.expeditee.io.Logger;
    2624import org.expeditee.items.Item;
    2725import org.expeditee.items.Text;
     26import org.expeditee.stats.CometStats;
    2827import org.expeditee.stats.SessionStats;
    2928import org.expeditee.stats.StatsLogger;
     29import org.expeditee.stats.TreeStats;
    3030
    3131/**
     
    5656        public static void Restore() {
    5757                FrameIO.Reload();
    58                 //FrameGraphics.DisplayMessage("Restoration complete.");
     58                // FrameGraphics.DisplayMessage("Restoration complete.");
    5959        }
    6060
     
    232232         */
    233233        public static void GetCometStats(Frame frame) {
    234                 FrameGraphics.DisplayMessage("Extracting comet stats...");
    235 
    236                 StringBuffer sb = new StringBuffer();
    237                 Time active = frame.getCometActiveTime(true);
    238                 Time dark = frame.getCometDarkTime(true);
    239                 Time total = new Time(active.getTime() + dark.getTime());
    240                 int length = frame.getCometLength();
    241                 sb.append("CometName: ").append(frame.getName()).append('\n');
    242                 sb.append("Length: ").append(length).append('\n');
    243                 sb.append("            Current  Average  Total").append('\n');
    244                 Time averageActive = new Time((long) (0.5 + active.getTime()
    245                                 / (1.0 * length)));
    246                 Time averageDark = new Time((long) (0.5 + dark.getTime()
    247                                 / (1.0 * length)));
    248                 Time averageTotal = new Time((long) (0.5 + total.getTime()
    249                                 / (1.0 * length)));
    250                 Time currentActive = SessionStats.getFrameActiveTime();
    251                 Time currentDark = SessionStats.getFrameDarkTime();
    252                 Time currentTotal = SessionStats.getFrameTotalTime();
    253                
    254                 sb.append("ActiveTime: ").append(Logger.EasyTimeFormat(currentActive)).append(
    255                 ' ').append(Logger.EasyTimeFormat(averageActive)).append(
    256                                 ' ').append(Logger.EasyTimeFormat(active)).append('\n');
    257                 sb.append("  DarkTime: ").append(Logger.EasyTimeFormat(currentDark)).append(
    258                 ' ').append(Logger.EasyTimeFormat(averageDark)).append(
    259                                 ' ').append(Logger.EasyTimeFormat(dark)).append('\n');
    260                 sb.append(" TotalTime: ").append(Logger.EasyTimeFormat(currentTotal)).append(
    261                 ' ').append(Logger.EasyTimeFormat(averageTotal)).append(
    262                                 ' ').append(Logger.EasyTimeFormat(total));
    263                 CreateTextItem(sb.toString());
    264 
    265                 FrameGraphics.OverwriteMessage("Comet stats complete");
     234                TimeKeeper timer = new TimeKeeper();
     235                FrameGraphics.DisplayMessage("Computing comet stats...");
     236
     237                CometStats cometStats = new CometStats(frame, true);
     238                CreateTextItem(cometStats.toString());
     239                FrameGraphics.OverwriteMessage("Comet stats time: "
     240                                + timer.getElapsedStringSeconds());
     241        }
     242
     243        public static void GetTreeStats(Frame frame) {
     244                TimeKeeper timer = new TimeKeeper();
     245                FrameGraphics.DisplayMessage("Computing tree stats...");
     246
     247                TreeStats treeStats = new TreeStats(frame, true);
     248                CreateTextItem(treeStats.toString());
     249                FrameGraphics.OverwriteMessage("Tree stats time: "
     250                                + timer.getElapsedStringSeconds());
    266251        }
    267252
  • trunk/src/org/expeditee/actions/Simple.java

    r88 r90  
    239239                                        // if the throws exception annotation is on the frame then
    240240                                        // it passes only if an exception is thrown
    241                                         if (title.getParentOrCurrentFrame().hasAnnotation("ThrowsException")) {
     241                                        if (title.getParentOrCurrentFrame().hasAnnotation(
     242                                                        "ThrowsException")) {
    242243                                                errorMessage = "Expected exception " + title.toString();
    243244                                                passed = false;
     
    245246                                } catch (Exception e) {
    246247                                        _programsRunning--;
    247                                         if (!title.getParentOrCurrentFrame().hasAnnotation("ThrowsException")) {
     248                                        if (!title.getParentOrCurrentFrame().hasAnnotation(
     249                                                        "ThrowsException")) {
    248250                                                errorMessage = e.getMessage();
    249251                                                passed = false;
     
    390392
    391393                if (_step) {
    392                         DisplayIO.setCurrentFrame(child);
     394                        if (child != DisplayIO.getCurrentFrame()) {
     395                                DisplayIO.setCurrentFrame(child);
     396                        }
    393397                        DisplayIO.addToBack(child);
    394398                }
     
    437441                                        if (lastItemStatus != Status.TrueIf
    438442                                                        && lastItemStatus != Status.FalseIf) {
     443                                                if (_step) {
     444                                                        DisplayIO.removeFromBack();
     445                                                }
    439446                                                return lastItemStatus;
    440447                                        }
     
    456463
    457464                if (_step) {
     465                        DisplayIO.removeFromBack();
    458466                        DisplayIO.setCurrentFrame(current.getParent());
    459                         DisplayIO.removeFromBack();
    460467                }
    461468
     
    525532                ArrayList<String> tokens = new ArrayList<String>();
    526533
    527                 //At the moment annotation items are ignored by the interpreter
    528 //              // Check special annotation tags for programs
    529 //              if (statement.length() > 0 && statement.charAt(0) == '@') {
    530 //                      statement = statement.toLowerCase();
    531 //                      // Flags the next unit test as being required to throw an exception
    532 //                      if (statement.equals("@throwsexception")) {
    533 //                              code.getParentOrCurrentFrame().setThrowsException(true);
    534 //                      }
    535 //                      return null;
    536 //              }
     534                // At the moment annotation items are ignored by the interpreter
     535                // // Check special annotation tags for programs
     536                // if (statement.length() > 0 && statement.charAt(0) == '@') {
     537                // statement = statement.toLowerCase();
     538                // // Flags the next unit test as being required to throw an exception
     539                // if (statement.equals("@throwsexception")) {
     540                // code.getParentOrCurrentFrame().setThrowsException(true);
     541                // }
     542                // return null;
     543                // }
    537544
    538545                for (int i = 0; i < statement.length(); i++) {
Note: See TracChangeset for help on using the changeset viewer.