Skip to content

Commit

Permalink
Merge pull request rooftopsparrow#8 from rooftopsparrow/AddDeviceUnlo…
Browse files Browse the repository at this point in the history
…cker

Adding DeviceUnlocker.java
  • Loading branch information
hdemarco4 authored Sep 13, 2017
2 parents 6d74872 + 87c8786 commit b55583e
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/school.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions DeviceUnlocker/DeviceUnlocker.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/Device-dist.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
45 changes: 45 additions & 0 deletions DeviceUnlocker/src/DeviceUnlocker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Provides for unlocking resource-control devices.
*
* @author Dr. Jody Paul
* @version 1.1.5
* @see Device
* @see <a href="../projectDescription.html">Project Description</a>
*/
public abstract class DeviceUnlocker {
/**
* Unlocks a device-controlled resource.
* This method must be guaranteed to halt, regardless of
* whether or not it successfully unlocked the resource.
* @param dev the device controlling the resource to unlock
* @return true if the resource is unlocked (all bits in the
* device are now identical); false otherwise
*/
public static boolean unlock(final Device dev) {
return false;
}

/** Establish a string for tracing progress. */
private static String trace = "";

/**
* Utility to append a line to the trace.
* @param message the line to append;
* if null, the trace is reset to empty
*/
protected static void log(final String message) {
if (message == null) {
trace = "";
} else {
trace += message + "\n";
}
}

/**
* Retrieve trace of previous unlock process.
* @return rendering of steps in the unlock process
*/
public static String showTrace() {
return trace;
}
}

0 comments on commit b55583e

Please sign in to comment.