From 3f478d16652ec95003957b9735d8e7035fe2ae39 Mon Sep 17 00:00:00 2001 From: Adam Murdoch Date: Sat, 8 Sep 2012 10:11:39 +1000 Subject: [PATCH] Added @ThreadSafe to a bunch of stuff. --- .../net/rubygrapefruit/platform/Process.java | 4 ++-- .../rubygrapefruit/platform/SystemInfo.java | 4 ++++ .../net/rubygrapefruit/platform/Terminal.java | 19 ++++++++++++++++++- .../rubygrapefruit/platform/TerminalSize.java | 3 +++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/rubygrapefruit/platform/Process.java b/src/main/java/net/rubygrapefruit/platform/Process.java index 74b5741..ba877ac 100755 --- a/src/main/java/net/rubygrapefruit/platform/Process.java +++ b/src/main/java/net/rubygrapefruit/platform/Process.java @@ -2,14 +2,14 @@ package net.rubygrapefruit.platform; /** * Functions to query and modify a process' state. - * - * Supported on Linux, OS X, Windows. */ +@ThreadSafe public interface Process extends NativeIntegration { /** * Returns the process identifier. * * @throws NativeException On failure. */ + @ThreadSafe int getProcessId() throws NativeException; } diff --git a/src/main/java/net/rubygrapefruit/platform/SystemInfo.java b/src/main/java/net/rubygrapefruit/platform/SystemInfo.java index a16912c..77fe936 100644 --- a/src/main/java/net/rubygrapefruit/platform/SystemInfo.java +++ b/src/main/java/net/rubygrapefruit/platform/SystemInfo.java @@ -3,19 +3,23 @@ package net.rubygrapefruit.platform; /** * Provides access to some system information. This is a snapshot view and does not change. */ +@ThreadSafe public interface SystemInfo extends NativeIntegration { /** * Returns the name of the kernel for the current operating system. */ + @ThreadSafe String getKernelName(); /** * Returns the version of the kernel for the current operating system. */ + @ThreadSafe String getKernelVersion(); /** * Returns the machine architecture, as reported by the operating system. */ + @ThreadSafe String getMachineArchitecture(); } diff --git a/src/main/java/net/rubygrapefruit/platform/Terminal.java b/src/main/java/net/rubygrapefruit/platform/Terminal.java index d7230f0..08e4b71 100644 --- a/src/main/java/net/rubygrapefruit/platform/Terminal.java +++ b/src/main/java/net/rubygrapefruit/platform/Terminal.java @@ -3,8 +3,11 @@ package net.rubygrapefruit.platform; /** * Allows the terminal/console to be manipulated. * - * Supported on Linux, OS X, Windows. + *

On UNIX based platforms, this provides access to the terminal. On Windows platforms, this provides access to the + * console. + *

*/ +@ThreadSafe public interface Terminal { /** * Colors supported by a terminal. @@ -16,16 +19,19 @@ public interface Terminal { /** * Returns true if this terminal supports setting text attributes, such as bold. */ + @ThreadSafe boolean supportsTextAttributes(); /** * Returns true if this terminal supports setting output colors. */ + @ThreadSafe boolean supportsColor(); /** * Returns true if this terminal supports moving the cursor. */ + @ThreadSafe boolean supportsCursorMotion(); /** @@ -33,6 +39,7 @@ public interface Terminal { * * @throws NativeException On failure. */ + @ThreadSafe TerminalSize getTerminalSize() throws NativeException; /** @@ -41,6 +48,7 @@ public interface Terminal { * * @throws NativeException On failure. */ + @ThreadSafe Terminal foreground(Color color) throws NativeException; /** @@ -48,6 +56,7 @@ public interface Terminal { * * @throws NativeException On failure. */ + @ThreadSafe Terminal bold() throws NativeException; /** @@ -55,6 +64,7 @@ public interface Terminal { * * @throws NativeException On failure. */ + @ThreadSafe Terminal normal() throws NativeException; /** @@ -62,6 +72,7 @@ public interface Terminal { * * @throws NativeException On failure. */ + @ThreadSafe Terminal reset() throws NativeException; /** @@ -69,6 +80,7 @@ public interface Terminal { * * @throws NativeException On failure, or if this terminal does not support cursor motion. */ + @ThreadSafe Terminal cursorLeft(int count) throws NativeException; /** @@ -76,6 +88,7 @@ public interface Terminal { * * @throws NativeException On failure, or if this terminal does not support cursor motion. */ + @ThreadSafe Terminal cursorRight(int count) throws NativeException; /** @@ -83,6 +96,7 @@ public interface Terminal { * * @throws NativeException On failure, or if this terminal does not support cursor motion. */ + @ThreadSafe Terminal cursorUp(int count) throws NativeException; /** @@ -90,6 +104,7 @@ public interface Terminal { * * @throws NativeException On failure, or if this terminal does not support cursor motion. */ + @ThreadSafe Terminal cursorDown(int count) throws NativeException; /** @@ -97,6 +112,7 @@ public interface Terminal { * * @throws NativeException On failure, or if this terminal does not support cursor motion. */ + @ThreadSafe Terminal cursorStartOfLine() throws NativeException; /** @@ -104,5 +120,6 @@ public interface Terminal { * * @throws NativeException On failure, or if this terminal does not support clearing. */ + @ThreadSafe Terminal clearToEndOfLine() throws NativeException; } diff --git a/src/main/java/net/rubygrapefruit/platform/TerminalSize.java b/src/main/java/net/rubygrapefruit/platform/TerminalSize.java index e9bb74f..445fba7 100644 --- a/src/main/java/net/rubygrapefruit/platform/TerminalSize.java +++ b/src/main/java/net/rubygrapefruit/platform/TerminalSize.java @@ -3,14 +3,17 @@ package net.rubygrapefruit.platform; /** * The size of a terminal. This is a snapshot view and does not change. */ +@ThreadSafe public interface TerminalSize { /** * Returns the number of character columns in the terminal. */ + @ThreadSafe public int getCols(); /** * Returns the number of character rows in the terminal. */ + @ThreadSafe public int getRows(); }