Skip to content

Commit

Permalink
More documentation for the new ripping methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gabegorelick committed Apr 17, 2011
1 parent 677b70f commit 5273415
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 13 deletions.
48 changes: 46 additions & 2 deletions src/edu/umd/cs/guitar/ripper/SWTGuitarExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
import edu.umd.cs.guitar.util.DefaultFactory;
import edu.umd.cs.guitar.util.GUITARLog;

/**
* <p>
* This is the parent class of <code>SWTRipper</code> and
* <code>SWTReplayer</code>. Responsible for abstracting away the differences
* between the two and implementing common functionality.
* </p>
* <p>
* Subclasses are responsible for implementing the {@link #onExecute()} method,
* which does most of the work of running the ripper or replayer.
* </p>
*
* @author Gabe Gorelick
*
*/
public abstract class SWTGuitarExecutor {

private final SWTGuitarConfiguration config;
Expand All @@ -29,11 +43,41 @@ public abstract class SWTGuitarExecutor {
private final Configuration xmlConfig;

private long startTime;


/**
* Constructs a new <code>SWTGuitarExecutor</code>. This constructor is
* equivalent to
*
* <pre>
* SWTGuitarExecutor(config, Thread.currentThread())
* </pre>
*
* Consequently, this constructor must be called on the same thread that the
* application under test is running on (usually the <code>main</code>
* thread).
*
* @param config
* configuration
*
* @see SWTApplicationRunner
*/
protected SWTGuitarExecutor(SWTGuitarConfiguration config) {
this(config, Thread.currentThread());
}


/**
* Constructs a new <code>SWTGuitarExecutor</code>. The thread passed in is
* the thread on which the SWT application under test runs. This is almost
* always the <code>main</code> thread (and actually must be the
* <code>main</code> thread on Cocoa).
*
* @param config
* configuration
* @param guiThread
* thread the GUI runs on
*
* @see SWTApplicationRunner
*/
protected SWTGuitarExecutor(SWTGuitarConfiguration config, Thread guiThread) {
if (config == null) {
config = new SWTRipperConfiguration();
Expand Down
44 changes: 33 additions & 11 deletions src/edu/umd/cs/guitar/ripper/SWTRipper.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@
import edu.umd.cs.guitar.util.GUITARLog;

/**
* Executing class for SWTRipper
* Adapts a {@link Ripper} for use with SWT GUIs.
*
* @author Gabe Gorelick
* @author <a href="mailto:[email protected]"> Matt Kirn </a>
* @author <a href="mailto:[email protected]"> Alex Loeb </a>
*
*/
public class SWTRipper extends SWTGuitarExecutor {

Expand All @@ -50,25 +52,38 @@ public class SWTRipper extends SWTGuitarExecutor {
private final Ripper ripper;

/**
* Constructs a new <code>SWTRipper</code>. This constructor is equivalent
* to <code>SWTRipper(config, Thread.currentThread())</code>. Consequently,
* this constructor must be called on the same thread that the application
* under test is running on (usually the <code>main</code> thread).
* Constructs a new <code>SWTRipper</code>. This constructor is equivalent
* to
*
* <pre>
* SWTRipper(config, Thread.currentThread())
* </pre>
*
* Consequently, this constructor must be called on the same thread that the
* application under test is running on (usually the <code>main</code>
* thread).
*
* @param config
* @param appThread thread the application under test runs on
* configuration
*
* @see SWTApplicationRunner
*/
public SWTRipper(SWTRipperConfiguration config) {
this(config, Thread.currentThread());
}

/**
* Constructs a new <code>SWTRipper</code>. The thread passed in is the
* thread on which the SWT application under test runs. This is almost
* always the main thread and actually must be the main thread on Cocoa.
* thread on which the SWT application under test runs. This is almost
* always the <code>main</code> thread (and actually must be the
* <code>main</code> thread on Cocoa).
*
* @param config
* @param guiThread thread the GUI runs on
* configuration
* @param guiThread
* thread the GUI runs on
*
* @see SWTApplicationRunner
*/
public SWTRipper(SWTRipperConfiguration config, Thread guiThread) {
super(config, guiThread);
Expand Down Expand Up @@ -97,8 +112,11 @@ private Ripper initRipper() {
}

/**
* Execute the SWT ripper.
* Execute the ripper.
*
* @see Ripper#execute()
*/
@Override
protected void onExecute() {
try {
ripper.execute();
Expand All @@ -107,6 +125,10 @@ protected void onExecute() {
}
}

/**
* Log the results of ripping.
*/
@Override
protected void onAfterExecute() {
GUIStructure dGUIStructure = ripper.getResult();
IO.writeObjToFile(dGUIStructure, config.getGuiFile());
Expand Down

0 comments on commit 5273415

Please sign in to comment.