summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-10-15 14:03:53 +0200
committerSven Gothel <[email protected]>2015-10-15 14:03:53 +0200
commitacd52a1936090eee11b3220f5c75ee37763773c7 (patch)
tree239c23ecc917650bd59d9aaddb1b76b9a9d01197 /src/java/com/jogamp/common
parentf829ccd1696e3b4016f11319f7b6148a8a0a2c78 (diff)
Remove deprectated classes and methods
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r--src/java/com/jogamp/common/util/ArrayHashSet.java24
-rw-r--r--src/java/com/jogamp/common/util/FunctionTask.java17
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java32
-rw-r--r--src/java/com/jogamp/common/util/IntBitfield.java162
-rw-r--r--src/java/com/jogamp/common/util/JarUtil.java14
-rw-r--r--src/java/com/jogamp/common/util/RunnableTask.java20
-rw-r--r--src/java/com/jogamp/common/util/TaskBase.java31
-rw-r--r--src/java/com/jogamp/common/util/cache/TempJarCache.java21
8 files changed, 47 insertions, 274 deletions
diff --git a/src/java/com/jogamp/common/util/ArrayHashSet.java b/src/java/com/jogamp/common/util/ArrayHashSet.java
index 8f61a8a..c0ac2fa 100644
--- a/src/java/com/jogamp/common/util/ArrayHashSet.java
+++ b/src/java/com/jogamp/common/util/ArrayHashSet.java
@@ -82,30 +82,6 @@ public class ArrayHashSet<E>
private final boolean supportNullValue;
/**
- * @deprecated Use {@link #ArrayHashSet(boolean, int, float)}
- */
- public ArrayHashSet() {
- this(true, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR);
- }
-
- /**
- * @param initialCapacity
- * @deprecated Use {@link #ArrayHashSet(boolean, int, float)}
- */
- public ArrayHashSet(final int initialCapacity) {
- this(true, initialCapacity, DEFAULT_LOAD_FACTOR);
- }
-
- /**
- * @param initialCapacity
- * @param loadFactor
- * @deprecated Use {@link #ArrayHashSet(boolean, int, float)}
- */
- public ArrayHashSet(final int initialCapacity, final float loadFactor) {
- this(true, initialCapacity, loadFactor);
- }
-
- /**
*
* @param supportNullValue Use {@code true} for default behavior, i.e. {@code null} can be a valid value.
* Use {@code false} if {@code null} is not a valid value,
diff --git a/src/java/com/jogamp/common/util/FunctionTask.java b/src/java/com/jogamp/common/util/FunctionTask.java
index 630ae2f..9eb1ca5 100644
--- a/src/java/com/jogamp/common/util/FunctionTask.java
+++ b/src/java/com/jogamp/common/util/FunctionTask.java
@@ -42,10 +42,21 @@ public class FunctionTask<R,A> extends TaskBase implements Function<R,A> {
protected A[] args;
/**
- * @deprecated Simply invoke {@link Function#eval(Object...)}
+ * Invokes <code>func</code> on the current {@link Thread}.
+ * <p>
+ * The result can be retrieved via {@link FunctionTask#getResult()},
+ * using the returned instance.
+ * </p>
+ * @param func the {@link Function} to execute.
+ * @param args the {@link Function} arguments
+ * @return the newly created and invoked {@link FunctionTask}
+ * @since 2.4.0
*/
- public static <U,V> U invoke(final boolean waitUntilDone, final Function<U,V> func, final V... args) {
- return func.eval(args);
+ public static <U,V> FunctionTask<U,V> invokeOnCurrentThread(final Function<U,V> func, final V... args) {
+ final FunctionTask<U,V> rt = new FunctionTask<U,V>( func, null, false, null);
+ rt.args = args;
+ rt.run();
+ return rt;
}
/**
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 653520d..517c21c 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -454,14 +454,6 @@ public class IOUtil {
public final int resourceCount() { return resourcePaths.length; }
/**
- * @param contextCL class instance to {@link #resolve(int)} {@link #resourcePaths}.
- * @param resourcePaths array of strings denominating multiple resource paths. None shall be null.
- * @deprecated Use {@link #IOUtil(String[], ClassLoader, Class)} for clarity!
- */
- public ClassResources(final Class<?> contextCL, final String[] resourcePaths) {
- this(resourcePaths, contextCL.getClassLoader(), contextCL);
- }
- /**
* @param resourcePaths multiple relative or absolute resource locations
* @param classLoader optional {@link ClassLoader}, see {@link IOUtil#getResource(String, ClassLoader, Class)}
* @param relContext optional relative context, see {@link IOUtil#getResource(String, ClassLoader, Class)}
@@ -490,30 +482,6 @@ public class IOUtil {
/**
* Locating a resource using {@link #getResource(String, ClassLoader)}:
* <ul>
- * <li><i>relative</i>: <code>context</code>'s package name-path plus <code>resourcePath</code> via <code>context</code>'s ClassLoader.
- * This allows locations relative to JAR- and other URLs.
- * The <code>resourcePath</code> may start with <code>../</code> to navigate to parent folder.
- * This attempt is skipped if {@code context} is {@code null}.</li>
- * <li><i>absolute</i>: <code>resourcePath</code> as is via <code>context</code>'s ClassLoader.
- * In case {@code context} is {@code null}, this class {@link ClassLoader} is being used.</li>
- * </ul>
- * <p>
- * Returns the resolved and open URLConnection or null if not found.
- * </p>
- *
- * @see #getResource(String, ClassLoader)
- * @see ClassLoader#getResource(String)
- * @see ClassLoader#getSystemResource(String)
- * @deprecated Use {@link IOUtil#getResource(String, ClassLoader, Class)} for clarity!
- */
- public static URLConnection getResource(final Class<?> context, final String resourcePath) {
- final ClassLoader contextCL = null != context ? context.getClassLoader() : IOUtil.class.getClassLoader();
- return getResource(resourcePath, contextCL, context);
- }
-
- /**
- * Locating a resource using {@link #getResource(String, ClassLoader)}:
- * <ul>
* <li><i>relative</i>: <code>relContext</code>'s package name-path plus <code>resourcePath</code> via <code>classLoader</code>.
* This allows locations relative to JAR- and other URLs.
* The <code>resourcePath</code> may start with <code>../</code> to navigate to parent folder.
diff --git a/src/java/com/jogamp/common/util/IntBitfield.java b/src/java/com/jogamp/common/util/IntBitfield.java
deleted file mode 100644
index 6aad391..0000000
--- a/src/java/com/jogamp/common/util/IntBitfield.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Copyright 2012 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-package com.jogamp.common.util;
-
-/**
- * @deprecated Use {@link Bitfield} implementations via {@link Bitfield.Factory#create(int)}.
- * <p>
- * Simple bitfield holder class using an int[] storage.
- * </p>
- * <p>
- * IntBitfield allows convenient access of a wide field of transient bits using efficient storage in O(1).
- * </p>
- * <p>
- * It can be used e.g. to map key-codes to pressed-state etc.
- * </p>
- */
-public class IntBitfield {
- /** Unit size in bits, here 32 bits for one int unit. */
- public static final int UNIT_SIZE = 32;
-
- private static final long UNIT_SHIFT_L = 5L;
- private static final int UNIT_SHIFT_I = 5;
-
- private final int[] storage;
- private final long bitsCountL;
- private final int bitsCountI;
-
- /**
- * @param bitCount
- */
- public IntBitfield(final long bitCount) {
- final int units = (int) Math.max(1L, ( bitCount + 31L ) >>> UNIT_SHIFT_L);
- this.storage = new int[units];
- this.bitsCountL = (long)units << UNIT_SHIFT_L ;
- this.bitsCountI = bitsCountL > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)bitsCountL;
- }
-
- /**
- * @param bitCount
- */
- public IntBitfield(final int bitCount) {
- final int units = Math.max(1, ( bitCount + 31 ) >>> UNIT_SHIFT_I);
- this.storage = new int[units];
- this.bitsCountI = units << UNIT_SHIFT_I;
- this.bitsCountL = bitsCountI;
- }
-
- private final void check(final long bitnum) {
- if( 0 > bitnum || bitnum >= bitsCountL ) {
- throw new ArrayIndexOutOfBoundsException("Bitnum should be within [0.."+(bitsCountL-1)+"], but is "+bitnum);
- }
- }
- private final void check(final int bitnum) {
- if( 0 > bitnum || bitnum >= bitsCountI ) {
- throw new ArrayIndexOutOfBoundsException("Bitnum should be within [0.."+(bitsCountI-1)+"], but is "+bitnum);
- }
- }
-
- /** Return the capacity of this bit field, i.e. the number of bits stored int this field. */
- public final long capacity() { return bitsCountL; }
-
- /** Return <code>true</code> if the bit at position <code>bitnum</code> is set, otherwise <code>false</code>. */
- public final boolean get(final long bitnum) {
- check(bitnum);
- final int u = (int) ( bitnum >>> UNIT_SHIFT_L );
- final int b = (int) ( bitnum - ( (long)u << UNIT_SHIFT_L ) );
- return 0 != ( storage[u] & ( 1 << b ) ) ;
- }
-
- /** Return <code>true</code> if the bit at position <code>bitnum</code> is set, otherwise <code>false</code>. */
- public final boolean get(final int bitnum) {
- check(bitnum);
- final int u = bitnum >>> UNIT_SHIFT_I;
- final int b = bitnum - ( u << UNIT_SHIFT_I );
- return 0 != ( storage[u] & ( 1 << b ) ) ;
- }
-
- /**
- * Set or clear the bit at position <code>bitnum</code> according to <code>bit</code>
- * and return the previous value.
- */
- public final boolean put(final long bitnum, final boolean bit) {
- check(bitnum);
- final int u = (int) ( bitnum >>> UNIT_SHIFT_L );
- final int b = (int) ( bitnum - ( (long)u << UNIT_SHIFT_L ) );
- final int m = 1 << b;
- final boolean prev = 0 != ( storage[u] & m ) ;
- if( prev != bit ) {
- if( bit ) {
- storage[u] |= m;
- } else {
- storage[u] &= ~m;
- }
- }
- return prev;
- }
-
- /**
- * Set or clear the bit at position <code>bitnum</code> according to <code>bit</code>
- * and return the previous value.
- */
- public final boolean put(final int bitnum, final boolean bit) {
- check(bitnum);
- final int u = bitnum >>> UNIT_SHIFT_I;
- final int b = bitnum - ( u << UNIT_SHIFT_I );
- final int m = 1 << b;
- final boolean prev = 0 != ( storage[u] & m ) ;
- if( prev != bit ) {
- if( bit ) {
- storage[u] |= m;
- } else {
- storage[u] &= ~m;
- }
- }
- return prev;
- }
- /**
- * @deprecated Use {@link Bitfield.Util#bitCount(int)}.
- */
- public static final int getBitCount(final int n) {
- return Bitfield.Util.bitCount(n);
- }
-
- /**
- * Returns the number of set bits within this bitfield.
- * <p>
- * Utilizes {#link {@link #getBitCount(int)}}.
- * </p>
- */
- public long getBitCount() {
- long c = 0;
- for(int i = storage.length-1; i>=0; i--) {
- c += Bitfield.Util.bitCount(storage[i]);
- }
- return c;
- }
-}
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java
index 2580714..d6c8fd4 100644
--- a/src/java/com/jogamp/common/util/JarUtil.java
+++ b/src/java/com/jogamp/common/util/JarUtil.java
@@ -413,20 +413,6 @@ public class JarUtil {
}
/**
- * See {@link #getRelativeOf(Class, com.jogamp.common.net.Uri.Encoded, com.jogamp.common.net.Uri.Encoded)}.
- * @param classFromJavaJar URI encoded!
- * @param cutOffInclSubDir URI encoded!
- * @param relResPath URI encoded!
- * @return
- * @throws IllegalArgumentException
- * @throws IOException
- * @throws URISyntaxException
- * @deprecated Use {@link #getRelativeOf(Class, com.jogamp.common.net.Uri.Encoded, com.jogamp.common.net.Uri.Encoded)}.
- */
- public static java.net.URI getRelativeOf(final Class<?> classFromJavaJar, final String cutOffInclSubDir, final String relResPath) throws IllegalArgumentException, IOException, URISyntaxException {
- return getRelativeOf(classFromJavaJar, Uri.Encoded.cast(cutOffInclSubDir), Uri.Encoded.cast(relResPath)).toURI();
- }
- /**
* Locates the {@link JarUtil#getJarFileUri(Uri) Jar file Uri} of a given resource
* relative to a given class's Jar's Uri.
* <pre>
diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java
index 57809b9..2689de1 100644
--- a/src/java/com/jogamp/common/util/RunnableTask.java
+++ b/src/java/com/jogamp/common/util/RunnableTask.java
@@ -40,18 +40,16 @@ public class RunnableTask extends TaskBase {
protected final Runnable runnable;
/**
- * @deprecated Simply invoke {@link Runnable#run()}
- */
- public static void invoke(final boolean waitUntilDone, final Runnable runnable) {
- runnable.run();
- }
-
- /**
- * @deprecated Use {@link #invokeOnNewThread(ThreadGroup, String, boolean, Runnable)}
+ * Invokes <code>runnable</code> on the current {@link Thread}.
+ * @param runnable the {@link Runnable} to execute on the current thread.
+ * The runnable <b>must exit</b>, i.e. not loop forever.
+ * @return the newly created and invoked {@link RunnableTask}
+ * @since 2.4.0
*/
- public static Thread invokeOnNewThread(final ThreadGroup tg, final boolean waitUntilDone, final Runnable runnable, final String threadName) {
- final RunnableTask rt = invokeOnNewThread(tg, threadName, waitUntilDone, runnable);
- return rt.getExecutionThread();
+ public static RunnableTask invokeOnCurrentThread(final Runnable runnable) {
+ final RunnableTask rt = new RunnableTask( runnable, null, false, null );
+ rt.run();
+ return rt;
}
/**
diff --git a/src/java/com/jogamp/common/util/TaskBase.java b/src/java/com/jogamp/common/util/TaskBase.java
index 0fe85e4..64a8313 100644
--- a/src/java/com/jogamp/common/util/TaskBase.java
+++ b/src/java/com/jogamp/common/util/TaskBase.java
@@ -58,17 +58,25 @@ public abstract class TaskBase implements Runnable {
protected volatile boolean isFlushed;
protected volatile Thread execThread;
+ /**
+ * @param syncObject The synchronization object if caller wait until <code>runnable</code> execution is completed,
+ * or <code>null</code> if waiting is not desired.
+ * @param catchExceptions Influence an occurring exception during <code>runnable</code> execution.
+ * If <code>true</code>, the exception is silenced and can be retrieved via {@link #getThrowable()},
+ * otherwise the exception is thrown.
+ * @param exceptionOut If not <code>null</code>, exceptions are written to this {@link PrintStream}.
+ */
protected TaskBase(final Object syncObject, final boolean catchExceptions, final PrintStream exceptionOut) {
this.syncObject = syncObject;
this.catchExceptions = catchExceptions;
this.exceptionOut = exceptionOut;
this.sourceStack = TRACE_SOURCE ? new Throwable("Creation @") : null;
- tCreated = System.currentTimeMillis();
- tStarted = 0;
- tExecuted = 0;
- isExecuted = false;
- isFlushed = false;
- execThread = null;
+ this.tCreated = System.currentTimeMillis();
+ this.tStarted = 0;
+ this.tExecuted = 0;
+ this.isExecuted = false;
+ this.isFlushed = false;
+ this.execThread = null;
}
protected final String getExceptionOutIntro() {
@@ -171,7 +179,16 @@ public abstract class TaskBase implements Runnable {
@Override
public String toString() {
- return "RunnableTask[enqueued "+isInQueue()+"[executed "+isExecuted()+", flushed "+isFlushed()+"], tTotal "+getDurationTotal()+" ms, tExec "+getDurationInExec()+" ms, tQueue "+getDurationInQueue()+" ms, attachment "+attachment+", throwable "+getThrowable()+"]";
+ final String etn;
+ final String eth;
+ if( null != execThread ) {
+ etn = execThread.getName();
+ eth = "0x"+Integer.toHexString(execThread.hashCode());
+ } else {
+ etn = "n/a";
+ eth = "n/a";
+ }
+ return "RunnableTask[enqueued "+isInQueue()+"[executed "+isExecuted()+", flushed "+isFlushed()+", thread["+eth+", "+etn+"]], tTotal "+getDurationTotal()+" ms, tExec "+getDurationInExec()+" ms, tQueue "+getDurationInQueue()+" ms, attachment "+attachment+", throwable "+getThrowable()+"]";
}
}
diff --git a/src/java/com/jogamp/common/util/cache/TempJarCache.java b/src/java/com/jogamp/common/util/cache/TempJarCache.java
index ed69ddc..2ff5140 100644
--- a/src/java/com/jogamp/common/util/cache/TempJarCache.java
+++ b/src/java/com/jogamp/common/util/cache/TempJarCache.java
@@ -273,19 +273,6 @@ public class TempJarCache {
}
/**
- * See {@link #addResources(Class, Uri)}
- * @param certClass
- * @param jarURI
- * @throws IOException
- * @throws SecurityException
- * @throws IllegalArgumentException
- * @throws URISyntaxException
- * @deprecated Use {@link #addResources(Class, Uri)}
- */
- public synchronized static final void addResources(final Class<?> certClass, final java.net.URI jarURI) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
- addResources(certClass, Uri.valueOf(jarURI));
- }
- /**
* Adds native resources, if not yet added.
*
* @param certClass if class is certified, the JarFile entries needs to have the same certificate
@@ -421,14 +408,6 @@ public class TempJarCache {
return null;
}
- /**
- * See {@link #getResourceUri(String)}
- * @deprecated Use {@link #getResourceUri(String)}
- */
- public synchronized static final java.net.URI getResource(final String name) throws URISyntaxException {
- return getResourceUri(name).toURI();
- }
-
/** Similar to {@link ClassLoader#getResource(String)}. */
public synchronized static final Uri getResourceUri(final String name) throws URISyntaxException {
checkInitialized();