Permalink
Browse files

Cleaned up some more comments.

  • Loading branch information...
enternoescape committed Apr 24, 2017
1 parent 6b7622a commit a14630a37f7ef0a3f32e5c52e64eb0dfb00b9ba9
Showing with 13 additions and 9 deletions.
  1. +4 −0 build.gradle
  2. +9 −9 java/sage/util/IntBinarySet.java
View
@@ -312,6 +312,10 @@ def getBuildNumber() {
buildVer = ant.sagebuildnum
}else if (OperatingSystem.current().isWindows()) {
//ensure full path to git\bin is in the Path Environment variable on windows
// 04-24-2017 JS: I changed this to remove the dependency on sh. Also we should note that
// you will get error code 128 if you have git installed, but you did not pull this project
// using git because git will not know where to get the commit count from. This is likely
// true for Linux too.
new ByteArrayOutputStream().withStream { outputStream ->
exec {
executable 'git'
@@ -20,7 +20,7 @@
/**
* This is a very basic binary search based class that will only store unique {@link Integer} on a
* binary sorted array. It's primary purpose is to reduce Integer object creation which will
* extremely rapidly grow when we are building the maps.
* extremely rapidly grow when we are building sets or maps using {@link Integer}.
* <p/>
* We store Integer objects, but we actually search them using primitives. This works well because
* we are only unboxing. This was also attempted with a two array approach, but this turns out to
@@ -154,37 +154,37 @@ public boolean containsInt(int lookup)
}
/**
* Get the boxed Integer object for the provided int if it is a part of this set.
* Get the boxed {@link Integer} object for the provided int if it is a part of this set.
* <p/>
* This method is intended to greatly reduce object creation when dealing with very large amounts
* of autoboxing since beyond a certain number range, all boxing results in new object creation
* even if it is for a number we just boxed a second ago.
* <p/>
* This should be used instead of {@link #containsInt(int)} if the resulting actions of true will
* involve using an Integer.
* involve using an {@link Integer}.
*
* @param lookup The int to look up.
* @return <code>null</code> if the set does not contain the provided int or an Integer of the
* same value if it does.
* @return <code>null</code> if the set does not contain the provided int or an {@link Integer} of
* the same value if it does.
*/
public Integer getInteger(int lookup)
{
return binarySearchReturn(lookup);
}
/**
* Get a boxed Integer object if it is already a part of this set or insert a new one and return
* a boxed Integer.
* Get a boxed {@link Integer} if it is already a part of this set or insert a new one and return
* a boxed {@link Integer}.
* <p/>
* This is intended as a speedup for use of this class for on the spot caching. This is also
* limited to 100,000 entries before the cache will start just autoboxing without caching. This
* should only be used as a temporary object for very intense interactions with things like maps
* or sets when using Integer.
* or sets when using {@link Integer}.
* <p/>
* This will also filter out any numbers that the JVM always caches (-128 to 127).
*
* @param lookup The int to look up.
* @return An Integer of the same value if it does.
* @return An {@link Integer} of the same value if it does.
*/
public Integer addOrGet(int lookup)
{

0 comments on commit a14630a

Please sign in to comment.