From acd52a1936090eee11b3220f5c75ee37763773c7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 15 Oct 2015 14:03:53 +0200 Subject: Remove deprectated classes and methods --- src/java/com/jogamp/common/util/ArrayHashSet.java | 24 --- src/java/com/jogamp/common/util/FunctionTask.java | 17 ++- src/java/com/jogamp/common/util/IOUtil.java | 32 ---- src/java/com/jogamp/common/util/IntBitfield.java | 162 --------------------- src/java/com/jogamp/common/util/JarUtil.java | 14 -- src/java/com/jogamp/common/util/RunnableTask.java | 20 ++- src/java/com/jogamp/common/util/TaskBase.java | 31 +++- .../com/jogamp/common/util/cache/TempJarCache.java | 21 --- 8 files changed, 47 insertions(+), 274 deletions(-) delete mode 100644 src/java/com/jogamp/common/util/IntBitfield.java (limited to 'src/java/com/jogamp/common/util') 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 @@ -81,30 +81,6 @@ public class ArrayHashSet private final ArrayList data; // list of objects 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. 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 extends TaskBase implements Function { protected A[] args; /** - * @deprecated Simply invoke {@link Function#eval(Object...)} + * Invokes func on the current {@link Thread}. + *

+ * The result can be retrieved via {@link FunctionTask#getResult()}, + * using the returned instance. + *

+ * @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 invoke(final boolean waitUntilDone, final Function func, final V... args) { - return func.eval(args); + public static FunctionTask invokeOnCurrentThread(final Function func, final V... args) { + final FunctionTask rt = new FunctionTask( 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 @@ -453,14 +453,6 @@ public class IOUtil { /** Returns the number of resources, i.e. resourcePaths.length. */ 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)} @@ -487,30 +479,6 @@ public class IOUtil { } } - /** - * Locating a resource using {@link #getResource(String, ClassLoader)}: - *
    - *
  • relative: context's package name-path plus resourcePath via context's ClassLoader. - * This allows locations relative to JAR- and other URLs. - * The resourcePath may start with ../ to navigate to parent folder. - * This attempt is skipped if {@code context} is {@code null}.
  • - *
  • absolute: resourcePath as is via context's ClassLoader. - * In case {@code context} is {@code null}, this class {@link ClassLoader} is being used.
  • - *
- *

- * Returns the resolved and open URLConnection or null if not found. - *

- * - * @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)}: *
    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)}. - *

    - * Simple bitfield holder class using an int[] storage. - *

    - *

    - * IntBitfield allows convenient access of a wide field of transient bits using efficient storage in O(1). - *

    - *

    - * It can be used e.g. to map key-codes to pressed-state etc. - *

    - */ -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 true if the bit at position bitnum is set, otherwise false. */ - 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 true if the bit at position bitnum is set, otherwise false. */ - 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 bitnum according to bit - * 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 bitnum according to bit - * 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. - *

    - * Utilizes {#link {@link #getBitCount(int)}}. - *

    - */ - 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 @@ -412,20 +412,6 @@ public class JarUtil { return null; } - /** - * 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. 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 runnable on the current {@link Thread}. + * @param runnable the {@link Runnable} to execute on the current thread. + * The runnable must exit, 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 runnable execution is completed, + * or null if waiting is not desired. + * @param catchExceptions Influence an occurring exception during runnable execution. + * If true, the exception is silenced and can be retrieved via {@link #getThrowable()}, + * otherwise the exception is thrown. + * @param exceptionOut If not null, 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 @@ -272,19 +272,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. * @@ -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(); -- cgit v1.2.3