summaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-02-26 17:59:27 +0100
committerMichael Bien <[email protected]>2011-02-26 17:59:27 +0100
commitbe26200a6d2fbeff6df49aada0bcf7cad91fe64f (patch)
treed058fe9abcb2388cd480a16d95adb167f52284e1 /src/java/com
parenta1c22f48aef28165b0112e3bab223fe5ea2fa4fd (diff)
small cleanup in uitl package
- StringBuffer -> StringBuilder - ReflectionUtil.getBaseName -> class.getSimpleName() - cleanup imports, generics and @Override for all touched classes
Diffstat (limited to 'src/java/com')
-rw-r--r--src/java/com/jogamp/common/jvm/JNILibLoaderBase.java2
-rw-r--r--src/java/com/jogamp/common/util/IntIntHashMap.java18
-rw-r--r--src/java/com/jogamp/common/util/JogampVersion.java17
-rw-r--r--src/java/com/jogamp/common/util/ReflectionUtil.java4
-rw-r--r--src/java/com/jogamp/common/util/RunnableTask.java3
-rw-r--r--src/java/com/jogamp/common/util/VersionNumber.java3
-rw-r--r--src/java/com/jogamp/common/util/VersionUtil.java12
7 files changed, 30 insertions, 29 deletions
diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
index cbc5959..2ad0504 100644
--- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
+++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
@@ -39,8 +39,6 @@
package com.jogamp.common.jvm;
-// FIXME: refactor Java SE dependencies
-//import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java
index e18468b..f449a95 100644
--- a/src/java/com/jogamp/common/util/IntIntHashMap.java
+++ b/src/java/com/jogamp/common/util/IntIntHashMap.java
@@ -235,8 +235,8 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
* Returns a new {@link Iterator}.
* Note: this Iterator does not yet support removal of elements.
*/
-// @Override
- public Iterator/*<Entry>*/ iterator() {
+ @Override
+ public Iterator<Entry> iterator() {
return new EntryIterator(table);
}
@@ -264,7 +264,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
return keyNotFoundValue;
}
-// @Override
+ @Override
public String toString() {
// TODO use StringBuilder as soon we are at language level 5
String str = "{";
@@ -279,7 +279,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
return str;
}
- private final static class EntryIterator implements Iterator/*<Entry>*/ {
+ private final static class EntryIterator implements Iterator<Entry> {
private final Entry[] entries;
@@ -292,13 +292,13 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
next();
}
-// @Override
+ @Override
public boolean hasNext() {
return next != null;
}
-// @Override
- public Object next() {
+ @Override
+ public Entry next() {
Entry current = next;
if(current != null && current.next != null) {
@@ -317,7 +317,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
return current;
}
-// @Override
+ @Override
public void remove() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -361,7 +361,7 @@ public class /*name*/IntIntHashMap/*name*/ implements Iterable {
this.value = value;
}
-// @Override
+ @Override
public String toString() {
return "["+key+":"+value+"]";
}
diff --git a/src/java/com/jogamp/common/util/JogampVersion.java b/src/java/com/jogamp/common/util/JogampVersion.java
index f7da413..1af86d3 100644
--- a/src/java/com/jogamp/common/util/JogampVersion.java
+++ b/src/java/com/jogamp/common/util/JogampVersion.java
@@ -37,8 +37,8 @@ import java.util.jar.Manifest;
public class JogampVersion {
- public static Attributes.Name IMPLEMENTATION_BRANCH = new Attributes.Name("Implementation-Branch");
- public static Attributes.Name IMPLEMENTATION_COMMIT = new Attributes.Name("Implementation-Commit");
+ public static final Attributes.Name IMPLEMENTATION_BRANCH = new Attributes.Name("Implementation-Branch");
+ public static final Attributes.Name IMPLEMENTATION_COMMIT = new Attributes.Name("Implementation-Commit");
private String packageName;
private Manifest mf;
@@ -54,10 +54,12 @@ public class JogampVersion {
mainAttributeNames = mainAttributes.keySet();
}
+ @Override
public final int hashCode() {
return hash;
}
+ @Override
public final boolean equals(Object o) {
if (o instanceof JogampVersion) {
return mf.equals(((JogampVersion) o).getManifest());
@@ -139,13 +141,13 @@ public class JogampVersion {
return this.getAttribute(Attributes.Name.SPECIFICATION_VERSION);
}
- public final StringBuffer getFullManifestInfo(StringBuffer sb) {
+ public final StringBuilder getFullManifestInfo(StringBuilder sb) {
return VersionUtil.getFullManifestInfo(getManifest(), sb);
}
- public StringBuffer getManifestInfo(StringBuffer sb) {
+ public StringBuilder getManifestInfo(StringBuilder sb) {
if(null==sb) {
- sb = new StringBuffer();
+ sb = new StringBuilder();
}
String nl = Platform.getNewline();
sb.append("Package: ").append(getPackageName()).append(nl);
@@ -163,9 +165,9 @@ public class JogampVersion {
return sb;
}
- public StringBuffer toString(StringBuffer sb) {
+ public StringBuilder toString(StringBuilder sb) {
if(null==sb) {
- sb = new StringBuffer();
+ sb = new StringBuilder();
}
sb.append(VersionUtil.SEPERATOR).append(Platform.getNewline());
@@ -175,6 +177,7 @@ public class JogampVersion {
return sb;
}
+ @Override
public String toString() {
return toString(null).toString();
}
diff --git a/src/java/com/jogamp/common/util/ReflectionUtil.java b/src/java/com/jogamp/common/util/ReflectionUtil.java
index 24aba2f..80c892c 100644
--- a/src/java/com/jogamp/common/util/ReflectionUtil.java
+++ b/src/java/com/jogamp/common/util/ReflectionUtil.java
@@ -288,9 +288,5 @@ public final class ReflectionUtil {
return callMethod(null, getMethod(clazzName, methodName, argTypes, cl), args);
}
- public static String getBaseName(Class clazz) {
- String s = clazz.toString();
- return s.substring(s.lastIndexOf(".")+1);
- }
}
diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java
index d5622b2..3707ce8 100644
--- a/src/java/com/jogamp/common/util/RunnableTask.java
+++ b/src/java/com/jogamp/common/util/RunnableTask.java
@@ -34,7 +34,7 @@ package com.jogamp.common.util;
*/
public class RunnableTask implements Runnable {
Runnable runnable;
- Object notifyObject;
+ final Object notifyObject;
boolean catchExceptions;
Object attachment;
@@ -121,6 +121,7 @@ public class RunnableTask implements Runnable {
public long getDurationInExec() { return ts2 - ts1; }
public long getDurationTotal() { return ts2 - ts0; }
+ @Override
public String toString() {
return "RunnableTask[executed "+isExecuted()+", t2-t0 "+getDurationTotal()+", t2-t1 "+getDurationInExec()+", t1-t0 "+getDurationInQueue()+", throwable "+getThrowable()+", Runnable "+runnable+", Attachment "+attachment+"]";
}
diff --git a/src/java/com/jogamp/common/util/VersionNumber.java b/src/java/com/jogamp/common/util/VersionNumber.java
index f0ba820..7e86e72 100644
--- a/src/java/com/jogamp/common/util/VersionNumber.java
+++ b/src/java/com/jogamp/common/util/VersionNumber.java
@@ -42,6 +42,7 @@ public class VersionNumber implements Comparable {
protected VersionNumber() { }
+ @Override
public final int hashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + major;
@@ -49,6 +50,7 @@ public class VersionNumber implements Comparable {
return ((hash << 5) - hash) + sub;
}
+ @Override
public final boolean equals(Object o) {
return 0 == compareTo(o);
}
@@ -88,6 +90,7 @@ public class VersionNumber implements Comparable {
return sub;
}
+ @Override
public String toString() {
return major + "." + minor + "." + sub ;
}
diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java
index 6868175..632e127 100644
--- a/src/java/com/jogamp/common/util/VersionUtil.java
+++ b/src/java/com/jogamp/common/util/VersionUtil.java
@@ -43,11 +43,11 @@ public class VersionUtil {
public static final String SEPERATOR = "-----------------------------------------------------------------------------------------------------";
/**
- * Appends environment information like OS, JVM and CPU architecture properties to the StringBuffer.
+ * Appends environment information like OS, JVM and CPU architecture properties to the StringBuilder.
*/
- public static StringBuffer getPlatformInfo(StringBuffer sb) {
+ public static StringBuilder getPlatformInfo(StringBuilder sb) {
if(null == sb) {
- sb = new StringBuffer();
+ sb = new StringBuilder();
}
sb.append(SEPERATOR).append(Platform.getNewline());
@@ -73,7 +73,7 @@ public class VersionUtil {
/**
* Prints platform info.
- * @see #getPlatformInfo(java.lang.StringBuffer)
+ * @see #getPlatformInfo(java.lang.StringBuilder)
*/
public static String getPlatformInfo() {
return getPlatformInfo(null).toString();
@@ -102,13 +102,13 @@ public class VersionUtil {
return null;
}
- public static StringBuffer getFullManifestInfo(Manifest mf, StringBuffer sb) {
+ public static StringBuilder getFullManifestInfo(Manifest mf, StringBuilder sb) {
if(null==mf) {
return sb;
}
if(null==sb) {
- sb = new StringBuffer();
+ sb = new StringBuilder();
}
Attributes attr = mf.getMainAttributes();