forked from rooftopsparrow/resource-locking
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rooftopsparrow#8 from rooftopsparrow/AddDeviceUnlo…
…cker Adding DeviceUnlocker.java
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |