From 87c87869de95f98ce50a9cf83af3c8ba4f1a42eb Mon Sep 17 00:00:00 2001 From: Heather DeMarco Date: Mon, 11 Sep 2017 20:50:39 -0600 Subject: [PATCH] Adding DeviceUnlocker.java --- .idea/dictionaries/school.xml | 3 ++ DeviceUnlocker/DeviceUnlocker.iml | 20 ++++++++++++ DeviceUnlocker/src/DeviceUnlocker.java | 45 ++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 .idea/dictionaries/school.xml create mode 100644 DeviceUnlocker/DeviceUnlocker.iml create mode 100644 DeviceUnlocker/src/DeviceUnlocker.java diff --git a/.idea/dictionaries/school.xml b/.idea/dictionaries/school.xml new file mode 100644 index 0000000..ef55df9 --- /dev/null +++ b/.idea/dictionaries/school.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/DeviceUnlocker/DeviceUnlocker.iml b/DeviceUnlocker/DeviceUnlocker.iml new file mode 100644 index 0000000..158b73a --- /dev/null +++ b/DeviceUnlocker/DeviceUnlocker.iml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DeviceUnlocker/src/DeviceUnlocker.java b/DeviceUnlocker/src/DeviceUnlocker.java new file mode 100644 index 0000000..7710282 --- /dev/null +++ b/DeviceUnlocker/src/DeviceUnlocker.java @@ -0,0 +1,45 @@ +/** + * Provides for unlocking resource-control devices. + * + * @author Dr. Jody Paul + * @version 1.1.5 + * @see Device + * @see Project Description + */ +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; + } +} \ No newline at end of file