summaryrefslogtreecommitdiff
path: root/BJC-Utils2
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-09-28 07:54:53 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-09-28 07:54:53 -0400
commitba0a3f53a88842a94ea6a1a6d45f61416b593e47 (patch)
tree4a528eea60842d5f73bf243653bd6ff7424d153b /BJC-Utils2
parent387febf2477ce0fab627ef2d163ffbf36741ab0e (diff)
Update various things.
Diffstat (limited to 'BJC-Utils2')
-rw-r--r--BJC-Utils2/.amateras11
-rw-r--r--BJC-Utils2/.classpath6
-rw-r--r--BJC-Utils2/.settings/org.eclipse.jdt.core.prefs93
-rw-r--r--BJC-Utils2/pom.xml1
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/WrappedLazy.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/WrappedOption.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java2
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java43
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java4
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java8
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java4
11 files changed, 160 insertions, 16 deletions
diff --git a/BJC-Utils2/.amateras b/BJC-Utils2/.amateras
new file mode 100644
index 0000000..b00142f
--- /dev/null
+++ b/BJC-Utils2/.amateras
@@ -0,0 +1,11 @@
+#EclipseHTMLEditor configuration file
+#Sat Sep 24 10:15:28 EDT 2016
+validateDTD=true
+useDTD=true
+validateJSP=true
+validateXML=true
+validateJS=true
+removeMarkers=false
+root=/
+validateHTML=true
+javaScripts=
diff --git a/BJC-Utils2/.classpath b/BJC-Utils2/.classpath
index 17c9f20..16e7185 100644
--- a/BJC-Utils2/.classpath
+++ b/BJC-Utils2/.classpath
@@ -18,10 +18,6 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/BJC-Utils2/.settings/org.eclipse.jdt.core.prefs b/BJC-Utils2/.settings/org.eclipse.jdt.core.prefs
index 13b3428..ddf2f32 100644
--- a/BJC-Utils2/.settings/org.eclipse.jdt.core.prefs
+++ b/BJC-Utils2/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,13 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
@@ -7,7 +16,91 @@ org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=info
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/BJC-Utils2/pom.xml b/BJC-Utils2/pom.xml
index 1eb345b..1a57d4c 100644
--- a/BJC-Utils2/pom.xml
+++ b/BJC-Utils2/pom.xml
@@ -12,6 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jvmtarget>1.8</jvmtarget>
</properties>
<dependencies>
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/WrappedLazy.java b/BJC-Utils2/src/main/java/bjc/utils/data/WrappedLazy.java
index 8ca29bc..b894ac7 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/WrappedLazy.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/WrappedLazy.java
@@ -13,7 +13,7 @@ class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
// This has an extra parameter, because otherwise it erases to the same
// as the public one
private WrappedLazy(IHolder<IHolder<ContainedType>> wrappedHolder,
- @SuppressWarnings("unused") boolean dummy) {
+ boolean dummy) {
held = wrappedHolder;
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/WrappedOption.java b/BJC-Utils2/src/main/java/bjc/utils/data/WrappedOption.java
index 5be55cc..fea4cb9 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/WrappedOption.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/WrappedOption.java
@@ -11,7 +11,7 @@ class WrappedOption<ContainedType> implements IHolder<ContainedType> {
}
private WrappedOption(IHolder<IHolder<ContainedType>> toHold,
- @SuppressWarnings("unused") boolean dummy) {
+ boolean dummy) {
held = toHold;
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
index f1616b2..4fb7c2b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcdata/IMap.java
@@ -141,7 +141,7 @@ public interface IMap<KeyType, ValueType> {
default ValueType getOrDefault(KeyType key, ValueType defaultValue) {
try {
return get(key);
- } catch (@SuppressWarnings("unused") IllegalArgumentException iaex) {
+ } catch (IllegalArgumentException iaex) {
// We don't care about this, because it indicates a key is
// missing
return defaultValue;
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
index f09a794..d65603b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/ListUtils.java
@@ -3,6 +3,7 @@ package bjc.utils.funcutils;
import java.util.ArrayList;
import java.util.Deque;
import java.util.function.Function;
+import java.util.function.Supplier;
import bjc.utils.data.IHolder;
import bjc.utils.data.IPair;
@@ -175,6 +176,7 @@ public class ListUtils {
* The function to determine the count for each element for
* @param numberPerPartition
* The number of elements to put in each partition
+ *
* @return A list partitioned according to the above rules
*/
public static <E> IList<IList<E>> groupPartition(IList<E> input,
@@ -294,4 +296,45 @@ public class ListUtils {
return returnedList.getValue();
}
+
+ public static <E> IList<E> padList(IList<E> list,
+ Function<E, Integer> counter, int size,
+ Supplier<E> padSource) {
+ IHolder<Integer> countHolder = new Identity<>(0);
+
+ IList<E> ret = list.map((elm) -> {
+ countHolder.map((val) -> val + counter.apply(elm));
+
+ return elm;
+ });
+
+ if (countHolder.unwrap((val) -> val % size != 0)) {
+ // We need to pad
+ int needed = countHolder.unwrap((val) -> val % size);
+ int threshold = 0;
+
+ while (needed > 0 && threshold <= MAX_NTRIESPART) {
+ E val = padSource.get();
+ int count = counter.apply(val);
+
+ if (count <= needed) {
+ ret.add(val);
+
+ threshold = 0;
+
+ needed -= count;
+ } else {
+ threshold += 1;
+ }
+ }
+
+ if (threshold > MAX_NTRIESPART) {
+ throw new IllegalArgumentException("Heuristic (more than "
+ + MAX_NTRIESPART
+ + " iterations of attempting to pad) detected unpaddable list ");
+ }
+ }
+
+ return ret;
+ }
} \ No newline at end of file
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java
index 51d9d5d..77e518e 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleDialogs.java
@@ -43,7 +43,7 @@ public class SimpleDialogs {
int value = Integer.parseInt(strang);
return (value < upperBound) && (value > lowerBound);
- } catch (@SuppressWarnings("unused") NumberFormatException nfex) {
+ } catch (NumberFormatException nfex) {
// We don't care about the specifics of the exception, just
// that this value isn't good
return false;
@@ -127,7 +127,7 @@ public class SimpleDialogs {
try {
Integer.parseInt(strang);
return true;
- } catch (@SuppressWarnings("unused") NumberFormatException nfex) {
+ } catch (NumberFormatException nfex) {
// We don't care about this exception, just mark the value
// as not good
return false;
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java
index b4c6d73..010de5f 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleFileChooser.java
@@ -31,7 +31,7 @@ public class SimpleFileChooser {
maybeDoOpenFile(parent, files);
success = true;
- } catch (@SuppressWarnings("unused") FileNotChosenException fncx) {
+ } catch (FileNotChosenException fncx) {
// We don't care about specifics
SimpleDialogs.showError(parent, "I/O Error",
"Please pick a file to open");
@@ -56,7 +56,7 @@ public class SimpleFileChooser {
maybeDoSaveFile(parent, files);
return files.getSelectedFile();
- } catch (@SuppressWarnings("unused") FileNotChosenException fncex) {
+ } catch (FileNotChosenException fncex) {
// We don't care about specifics
SimpleDialogs.showError(parent, "I/O Error",
"Please pick a file to save to");
@@ -189,7 +189,7 @@ public class SimpleFileChooser {
try {
maybeDoOpenFile(parent, files);
- } catch (@SuppressWarnings("unused") FileNotChosenException fncex) {
+ } catch (FileNotChosenException fncex) {
// We don't care about specifics
}
@@ -215,7 +215,7 @@ public class SimpleFileChooser {
try {
maybeDoSaveFile(parent, files);
- } catch (@SuppressWarnings("unused") FileNotChosenException fncex) {
+ } catch (FileNotChosenException fncex) {
// We don't care about specifics
}
diff --git a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
index 82946f0..8246822 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/gui/SimpleInternalDialogs.java
@@ -36,7 +36,7 @@ public class SimpleInternalDialogs {
int value = Integer.parseInt(strang);
return (value < upperBound) && (value > lowerBound);
- } catch (@SuppressWarnings("unused") NumberFormatException nfex) {
+ } catch (NumberFormatException nfex) {
// We don't care about the specifics of the exception, just
// that this value isn't good
return false;
@@ -61,7 +61,7 @@ public class SimpleInternalDialogs {
try {
Integer.parseInt(strang);
return true;
- } catch (@SuppressWarnings("unused") NumberFormatException nfex) {
+ } catch (NumberFormatException nfex) {
// We don't care about this exception, just mark the value
// as not good
return false;