foray-commit Mailing List for FOray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
|
10
|
11
|
12
|
13
|
14
|
15
|
16
(6) |
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
|
31
|
|
|
|
|
|
|
|
From: <vic...@us...> - 2020-05-16 23:52:18
|
Revision: 11567
http://sourceforge.net/p/foray/code/11567
Author: victormote
Date: 2020-05-16 23:52:15 +0000 (Sat, 16 May 2020)
Log Message:
-----------
Upgrade to Java 1.8.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ant/RunTest.java
trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/PreviewDialog.java
trunk/foray/master/build.gradle
trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch
trunk/foray/master/ide/eclipse/launch-configurations/fonts-basic.launch
trunk/foray/master/ide/eclipse/launch-configurations/graphics-basic.launch
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ant/RunTest.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ant/RunTest.java 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ant/RunTest.java 2020-05-16 23:52:15 UTC (rev 11567)
@@ -171,32 +171,25 @@
// need to check that files have actually been created.
// return;
// } else {
- ClassLoader loader = null;
- try {
- loader = new URLClassLoader(new URL[] {
- UrlFactory.createURL("file:" + this.referenceJar)
- });
- } catch (final MalformedURLException mue) {
- throw new BuildException(mue);
- }
- // }
- boolean failed = false;
- try {
+ try (URLClassLoader loader = new URLClassLoader(new URL[] {
+ UrlFactory.createURL("file:" + this.referenceJar)
+ })) {
final String version = Application.getVersion();
if (! version.equals(this.refVersion)) {
throw new BuildException("Reference jar is not correct "
+ "version it must be: " + this.refVersion);
}
+ f.mkdirs();
+ runConverter(loader, "reference/output/", null);
+ } catch (final MalformedURLException mue) {
+ throw new BuildException(mue);
} catch (final IllegalArgumentException are) {
- failed = true;
- }
- if (failed) {
throw new BuildException("Reference jar could not be found in: "
- + this.basedir + "/reference/");
+ + this.basedir + "/reference/");
+ } catch (final IOException e) {
+ throw new BuildException(e);
}
- f.mkdirs();
- runConverter(loader, "reference/output/", null);
}
/**
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/PreviewDialog.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/PreviewDialog.java 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/awt/viewer/PreviewDialog.java 2020-05-16 23:52:15 UTC (rev 11567)
@@ -198,7 +198,7 @@
private JLabel zoomLabel = new JLabel();
/** Combo box for selecting the zoom factor. */
- private JComboBox scale = new JComboBox() {
+ private JComboBox<String> scale = new JComboBox<String>() {
private static final long serialVersionUID = 76538924635317660L;
@Override
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/master/build.gradle 2020-05-16 23:52:15 UTC (rev 11567)
@@ -13,6 +13,10 @@
*/
apply plugin: 'java'
+
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
def buildDate = new Date().format("yyyy-MM-dd 'at' HH:mm 'GMT'", TimeZone.getTimeZone("GMT"))
allprojects {
@@ -52,8 +56,8 @@
apply plugin: 'checkstyle'
apply plugin: 'maven-publish'
- sourceCompatibility = 1.6
- targetCompatibility = 1.6
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
checkstyle {
configFile = new File(rootProject.projectDir.absolutePath + '/config/checkstyle/checkstyle-config.xml')
Modified: trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2020-05-16 23:52:15 UTC (rev 11567)
@@ -1,21 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/foray-hyphen/src/main/java/org/foray/hyphen/DictionarySerializer.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
-<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-hyphen" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-hyphen"/> </runtimeClasspathEntry> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.buildship.core.classpathprovider"/>
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.hyphen.DictionarySerializer"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/src/main/data/word-lists --output ${project_loc}/src/main/resources/resources/org/foray/dictionaries --pattern "eng-word-list-moby.txt""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-hyphen"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-hyphen/src/main/java/org/foray/hyphen/DictionarySerializer.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-hyphen" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-hyphen"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.hyphen.DictionarySerializer"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/src/main/data/word-lists --output ${project_loc}/src/main/resources/resources/org/foray/dictionaries --pattern "eng-word-list-moby.txt""/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-hyphen"/>
</launchConfiguration>
Modified: trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch 2020-05-16 23:52:15 UTC (rev 11567)
@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/foray-hyphen/src/main/java/org/foray/hyphen/PatternSerializer.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.buildship.core.classpathprovider"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.hyphen.PatternSerializer"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/../foray-hyphen/src/main/data/hyph-patterns --output ${project_loc}/../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns --pattern ".*\.xml""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-hyphen"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-hyphen/src/main/java/org/foray/hyphen/PatternSerializer.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.hyphen.PatternSerializer"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/../foray-hyphen/src/main/data/hyph-patterns --output ${project_loc}/../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns --pattern ".*\.xml""/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-hyphen"/>
</launchConfiguration>
Modified: trunk/foray/master/ide/eclipse/launch-configurations/fonts-basic.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/fonts-basic.launch 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/master/ide/eclipse/launch-configurations/fonts-basic.launch 2020-05-16 23:52:15 UTC (rev 11567)
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<stringAttribute key="org.eclipse.buildship.core.originalclasspathprovider" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
-<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-app" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.buildship.core.classpathprovider"/>
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-configuration-file ${foray-config} -fo ${fo-example-path}/basic/fonts.fo -pdf ${foray-test-output}/fonts-basic.pdf"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-app" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-configuration-file ${foray-config} -fo ${fo-example-path}/basic/fonts.fo -pdf ${foray-test-output}/fonts-basic.pdf"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
</launchConfiguration>
Modified: trunk/foray/master/ide/eclipse/launch-configurations/graphics-basic.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/graphics-basic.launch 2020-05-16 23:12:41 UTC (rev 11566)
+++ trunk/foray/master/ide/eclipse/launch-configurations/graphics-basic.launch 2020-05-16 23:52:15 UTC (rev 11567)
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<stringAttribute key="org.eclipse.buildship.core.originalclasspathprovider" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
-<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-app" path="1" type="4"/> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
-<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.buildship.core.classpathprovider"/>
-<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-configuration-file ${foray-config} -fo ${fo-example-path}/basic/graphics.fo -pdf ${foray-test-output}/graphics-basic.pdf"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+ <listEntry value="/foray-app/src/main/java/org/foray/app/FOray.java"/>
+ </listAttribute>
+ <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+ <listEntry value="1"/>
+ </listAttribute>
+ <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
+ <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-app" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-app"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
+ </listAttribute>
+ <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+ <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.app.FOray"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-configuration-file ${foray-config} -fo ${fo-example-path}/basic/graphics.fo -pdf ${foray-test-output}/graphics-basic.pdf"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-app"/>
+ <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
</launchConfiguration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2020-05-16 23:12:43
|
Revision: 11566
http://sourceforge.net/p/foray/code/11566
Author: victormote
Date: 2020-05-16 23:12:41 +0000 (Sat, 16 May 2020)
Log Message:
-----------
Upgrade gradle to 6.4.1.
Modified Paths:
--------------
trunk/foray/master/gradle/wrapper/gradle-wrapper.jar
trunk/foray/master/gradle/wrapper/gradle-wrapper.properties
trunk/foray/master/gradlew
trunk/foray/master/gradlew.bat
Modified: trunk/foray/master/gradle/wrapper/gradle-wrapper.jar
===================================================================
(Binary files differ)
Modified: trunk/foray/master/gradle/wrapper/gradle-wrapper.properties
===================================================================
--- trunk/foray/master/gradle/wrapper/gradle-wrapper.properties 2020-05-16 18:04:10 UTC (rev 11565)
+++ trunk/foray/master/gradle/wrapper/gradle-wrapper.properties 2020-05-16 23:12:41 UTC (rev 11566)
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Modified: trunk/foray/master/gradlew
===================================================================
--- trunk/foray/master/gradlew 2020-05-16 18:04:10 UTC (rev 11565)
+++ trunk/foray/master/gradlew 2020-05-16 23:12:41 UTC (rev 11566)
@@ -1,5 +1,21 @@
#!/usr/bin/env sh
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m"'
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -66,6 +82,7 @@
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -159,14 +177,9 @@
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
-APP_ARGS=$(save "$@")
+APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
exec "$JAVACMD" "$@"
Modified: trunk/foray/master/gradlew.bat
===================================================================
--- trunk/foray/master/gradlew.bat 2020-05-16 18:04:10 UTC (rev 11565)
+++ trunk/foray/master/gradlew.bat 2020-05-16 23:12:41 UTC (rev 11566)
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,8 +29,11 @@
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m"
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2020-05-16 18:04:12
|
Revision: 11565
http://sourceforge.net/p/foray/code/11565
Author: victormote
Date: 2020-05-16 18:04:10 +0000 (Sat, 16 May 2020)
Log Message:
-----------
Conform to new requirement to use https when accessing Maven repositories.
Modified Paths:
--------------
trunk/foray/master/build.gradle
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2020-05-16 16:13:32 UTC (rev 11564)
+++ trunk/foray/master/build.gradle 2020-05-16 18:04:10 UTC (rev 11565)
@@ -110,7 +110,7 @@
repositories {
mavenLocal()
- maven { url "http://repo.maven.apache.org/maven2" }
+ maven { url "https://repo.maven.apache.org/maven2" }
}
publishing {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2020-05-16 16:13:34
|
Revision: 11564
http://sourceforge.net/p/foray/code/11564
Author: victormote
Date: 2020-05-16 16:13:32 +0000 (Sat, 16 May 2020)
Log Message:
-----------
Remove suppression of javadoc warnings, as they appear to have been corrected.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/PatternTreeTests.java
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/PatternTreeTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/PatternTreeTests.java 2020-05-16 16:08:14 UTC (rev 11563)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/PatternTreeTests.java 2020-05-16 16:13:32 UTC (rev 11564)
@@ -85,7 +85,6 @@
* @throws IOException For error creating hyphenation server.
* @throws HyphenationException For error getting the hyphenation tree.
*/
- @SuppressWarnings("javadoc")
@Test
public void hyphenateTest01() throws IOException, HyphenationException {
final String testString = "in";
@@ -99,7 +98,6 @@
* @throws IOException For error creating hyphenation server.
* @throws HyphenationException For error getting the hyphenation tree.
*/
- @SuppressWarnings("javadoc")
@Test
public void hyphenateTest02() throws IOException, HyphenationException {
final String testString = "hyphenation";
@@ -115,7 +113,6 @@
* @throws IOException For error creating hyphenation server.
* @throws HyphenationException For error getting the hyphenation tree.
*/
- @SuppressWarnings("javadoc")
@Test
public void hyphenateTest03() throws IOException, HyphenationException {
final String testString = "times";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2020-05-16 16:08:16
|
Revision: 11563
http://sourceforge.net/p/foray/code/11563
Author: victormote
Date: 2020-05-16 16:08:14 +0000 (Sat, 16 May 2020)
Log Message:
-----------
Update checkstyle config to conform to latest release.
Modified Paths:
--------------
trunk/foray/master/config/checkstyle/checkstyle-config.xml
Modified: trunk/foray/master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/master/config/checkstyle/checkstyle-config.xml 2020-05-16 14:29:53 UTC (rev 11562)
+++ trunk/foray/master/config/checkstyle/checkstyle-config.xml 2020-05-16 16:08:14 UTC (rev 11563)
@@ -27,6 +27,13 @@
<!-- Make sure each package has javadoc package.html -->
<module name="JavadocPackage"/>
+ <module name="LineLength">
+ <property name="ignorePattern" value="^$"/>
+ <property name="max" value="120"/>
+ <property name="severity" value="warning"/>
+ <property name="tabWidth" value="4"/>
+ </module>
+
<module name="TreeWalker">
<!-- Allow otherwise Illegal Types to be used in certain circumstances. -->
@@ -78,12 +85,6 @@
<property name="severity" value="error"/>
<property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_IF, LITERAL_FOR, LITERAL_WHILE"/>
</module>
- <module name="LineLength">
- <property name="ignorePattern" value="^$"/>
- <property name="max" value="120"/>
- <property name="severity" value="warning"/>
- <property name="tabWidth" value="4"/>
- </module>
<module name="EmptyForInitializerPad">
<property name="option" value="nospace"/>
<property name="severity" value="warning"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2020-05-16 14:29:55
|
Revision: 11562
http://sourceforge.net/p/foray/code/11562
Author: victormote
Date: 2020-05-16 14:29:53 +0000 (Sat, 16 May 2020)
Log Message:
-----------
Improvements to BitUtils tests.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/primitive/BitUtils.java
trunk/foray/foray-common/src/test/java/org/foray/common/primitive/BitUtilsTests.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/primitive/BitUtils.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/primitive/BitUtils.java 2019-04-02 12:03:43 UTC (rev 11561)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/primitive/BitUtils.java 2020-05-16 14:29:53 UTC (rev 11562)
@@ -28,8 +28,6 @@
package org.foray.common.primitive;
-import org.foray.common.WellKnownConstants;
-
/**
* Utility class containing numeric routines, especially bit operators.
*/
@@ -41,6 +39,12 @@
/** Mark for zeroing the 4 low-order bits in a byte. */
private static final byte BYTE_LOW_ORDER_MASK = (byte) 0xF0;
+ /** The maximum bit index in an integer (31). */
+ private static final byte MAX_INTEGER_BIT_INDEX = Integer.SIZE - 1;
+
+ /** The maximum bit index in a long (63). */
+ private static final byte MAX_LONG_BIT_INDEX = Long.SIZE - 1;
+
/**
* Private constructor. This is a utility class and should never be
* instantiated.
@@ -48,17 +52,16 @@
private BitUtils() { }
/**
- * Turns a specific bit value "on".
+ * Turns a specific bit in an integer value "on".
* @param input The integer to be converted.
- * @param bit The bit position to be set. Zero is the low-order bit.
- * @return The converted integer. If <tt>bit</tt> is less than zero or
- * more than 31, <tt>input</tt> is returned.
+ * @param bit The bit position to be set. Zero is the low-order bit. If <tt>bit</tt> is less than zero or more than
+ * 31, an IllegalArgumentException is thrown.
+ * @return The converted integer.
*/
public static int setBit(final int input, final int bit) {
if (bit < 0
- || bit > WellKnownConstants.BYTES_PER_INT * WellKnownConstants.BITS_PER_BYTE
- - 1) {
- return input;
+ || bit > MAX_INTEGER_BIT_INDEX) {
+ throw new IllegalArgumentException("Bit position is not valid: " + bit);
}
int mask = 1;
mask <<= bit;
@@ -67,15 +70,15 @@
/**
* Returns the value of a specific bit.
- * @param input The integer to be checked.
- * @param bit The bit position to be checked. Zero is the low-order bit.
+ * @param input The long to be checked.
+ * @param bit The bit position to be checked. Zero is the low-order bit. If <tt>bit</tt> is less than zero or more
+ * than 31, an IllegalArgumentException is thrown.
* @return True if the bit is on (1), or false if the bit is off (0).
*/
public static boolean getBit(final long input, final int bit) {
if (bit < 0
- || bit > WellKnownConstants.BYTES_PER_LONG * WellKnownConstants.BITS_PER_BYTE
- - 1) {
- return false;
+ || bit > MAX_LONG_BIT_INDEX) {
+ throw new IllegalArgumentException("Bit position is not valid: " + bit);
}
int mask = 1;
mask <<= bit;
@@ -100,4 +103,48 @@
return (byte) (input & BitUtils.BYTE_LOW_ORDER_MASK);
}
+ /**
+ * Extracts a range of bits from a long and returns the value as a long.
+ * @param input The long containing the bits to be extracted.
+ * @param position The position in {@code input} at which the bits should be extracted.
+ * Position 0 is the low-order bit, position 63 is the high-order bit.
+ * Values outside of that range will produce undefined results.
+ * @param qtyBits The number of bits that should be extracted.
+ * Values outside of 0 inclusive through 64 inclusive will produce undefined results.
+ * @return The extracted value.
+ */
+ public static long extractBits(final long input, final int position, final int qtyBits) {
+ final long rightShifted = input >>> position;
+ long mask = -1;
+ if (qtyBits < Long.SIZE) {
+ mask = (1L << qtyBits) - 1L;
+ }
+ return rightShifted & mask;
+ }
+
+ /**
+ * Replaces a range of bits in a long with a new value.
+ * @param input The long containing the bits to be replaced.
+ * @param position The position in {@code input} at which the bits should be replaced.
+ * Position 0 is the low-order bit, position 63 is the high-order bit.
+ * Values outside of that range will produce undefined results.
+ * @param qtyBits The number of bits that should be replaced.
+ * Values outside of 0 inclusive through 64 inclusive will produce undefined results.
+ * @param newValue The value of the bits that will replace the existing bits.
+ * @return The new value.
+ */
+ public static long replaceBits(final long input, final int position, final int qtyBits, final long newValue) {
+ if (qtyBits < 1) {
+ return input;
+ }
+ long leftBits = extractBits(input, position + qtyBits, Long.SIZE - qtyBits);
+ leftBits = leftBits << (position + qtyBits);
+ final long rightBits = extractBits(input, 0, position);
+ /* Strip off any high-order bits that exceed the qtyBits. */
+ long middleBits = newValue << (Long.SIZE - qtyBits);
+ middleBits = middleBits >>> (Long.SIZE - qtyBits);
+ middleBits = middleBits << position;
+ return leftBits | middleBits | rightBits;
+ }
+
}
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/primitive/BitUtilsTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/primitive/BitUtilsTests.java 2019-04-02 12:03:43 UTC (rev 11561)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/primitive/BitUtilsTests.java 2020-05-16 14:29:53 UTC (rev 11562)
@@ -68,4 +68,115 @@
Assert.assertEquals(expectedOutput, actualOutput);
}
+ /**
+ * Test of {@link BitUtils#extractBits(long, int, int)}.
+ */
+ @Test
+ public void testExtractBits() {
+ /* Binary 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0101 1001. */
+ long input = 601;
+ Assert.assertEquals(1, BitUtils.extractBits(input, 4, 1)); // ...0010010[1]1001
+ Assert.assertEquals(1, BitUtils.extractBits(input, 4, 2)); // ...001001[01]1001
+ Assert.assertEquals(5, BitUtils.extractBits(input, 4, 3)); // ...00100[101]1001
+ Assert.assertEquals(5, BitUtils.extractBits(input, 4, 4)); // ...0010[0101]1001
+ Assert.assertEquals(5, BitUtils.extractBits(input, 4, 5)); // ...001[00101]1001
+ Assert.assertEquals(37, BitUtils.extractBits(input, 4, 6)); // ...00[100101]1001
+ Assert.assertEquals(1, BitUtils.extractBits(input, 0, 1)); // ...00100101100[1]
+ Assert.assertEquals(1, BitUtils.extractBits(input, 0, 2)); // ...0010010110[01]
+ Assert.assertEquals(1, BitUtils.extractBits(input, 0, 3)); // ...001001011[001]
+ Assert.assertEquals(9, BitUtils.extractBits(input, 0, 4)); // ...00100101[1001]
+ Assert.assertEquals(25, BitUtils.extractBits(input, 0, 5)); // ...0010010[11001]
+
+ /* Binary 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1101 1010 0111. */
+ input = -601;
+ Assert.assertEquals(0, BitUtils.extractBits(input, 4, 1)); // ...1101101[0]0111
+ Assert.assertEquals(2, BitUtils.extractBits(input, 4, 2)); // ...110110[10]0111
+ Assert.assertEquals(2, BitUtils.extractBits(input, 4, 3)); // ...11011[010]0111
+ Assert.assertEquals(10, BitUtils.extractBits(input, 4, 4)); // ...1101[1010]0111
+ Assert.assertEquals(26, BitUtils.extractBits(input, 4, 5)); // ...110[11010]0111
+ Assert.assertEquals(26, BitUtils.extractBits(input, 4, 6)); // ...11[011010]0111
+ Assert.assertEquals(7, BitUtils.extractBits(input, 31, 3));
+ /* The high-order 63 bits. */
+ Assert.assertEquals(9223372036854775207L,
+ BitUtils.extractBits(input, 0, 63));
+ Assert.assertEquals(9223372036854775507L,
+ BitUtils.extractBits(input, 1, 63));
+
+ /* Binary 0110 0100 1000 0110 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000. */
+ input = 7243477050672021504L;
+ Assert.assertEquals(0, BitUtils.extractBits(input, 63, 1)); // [0]110010010000110...
+ Assert.assertEquals(1, BitUtils.extractBits(input, 62, 2)); // [01]10010010000110...
+ Assert.assertEquals(3, BitUtils.extractBits(input, 61, 3)); // [011]0010010000110...
+ Assert.assertEquals(6, BitUtils.extractBits(input, 60, 4)); // [0110]010010000110...
+ Assert.assertEquals(12, BitUtils.extractBits(input, 59, 5)); // [01100]10010000110...
+ Assert.assertEquals(25, BitUtils.extractBits(input, 58, 6)); // [011001]0010000110...
+
+ /* Test some qtyBits of zero, which should always return 0. */
+ Assert.assertEquals(0, BitUtils.extractBits(Long.MIN_VALUE, 0, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(Long.MIN_VALUE, 63, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(0, 0, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(0, 63, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(1, 0, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(1, 63, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(601, 8, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(601, 8, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(Long.MAX_VALUE, 0, 0));
+ Assert.assertEquals(0, BitUtils.extractBits(Long.MAX_VALUE, 63, 0));
+
+ /* Test some position 0, qtyBits 64, which should always return the input. */
+ Assert.assertEquals(Long.MIN_VALUE, BitUtils.extractBits(Long.MIN_VALUE, 0, 64));
+ Assert.assertEquals(-601, BitUtils.extractBits(-601, 0, 64));
+ Assert.assertEquals(-1, BitUtils.extractBits(-1, 0, 64));
+ Assert.assertEquals(0, BitUtils.extractBits(0, 0, 64));
+ Assert.assertEquals(1, BitUtils.extractBits(1, 0, 64));
+ Assert.assertEquals(601, BitUtils.extractBits(601, 0, 64));
+ Assert.assertEquals(Long.MAX_VALUE, BitUtils.extractBits(Long.MAX_VALUE, 0, 64));
+
+ /* Test some invalid position values. */
+ Assert.assertEquals(0, BitUtils.extractBits(1, -600, 3));
+ Assert.assertEquals(0, BitUtils.extractBits(1, -1, 3));
+ Assert.assertEquals(1, BitUtils.extractBits(1, 64, 3));
+ Assert.assertEquals(1, BitUtils.extractBits(1, 128, 3));
+
+ /* Test some invalid qtyBits values. */
+ Assert.assertEquals(0, BitUtils.extractBits(1, 1, -600));
+ Assert.assertEquals(0, BitUtils.extractBits(1, 1, -1));
+ Assert.assertEquals(0, BitUtils.extractBits(1, 1, 65));
+ Assert.assertEquals(0, BitUtils.extractBits(1, 1, 128));
+ }
+
+ /**
+ * Test of {@link BitUtils#replaceBits(long, int, int, long)}.
+ */
+ @Test
+ public void testReplaceBits() {
+ /* Binary 1001011001. */
+ int input = 601;
+ Assert.assertEquals(521, BitUtils.replaceBits(input, 4, 5, 0)); // 001<00101>1001 --> 001<00000>1001
+ Assert.assertEquals(521, BitUtils.replaceBits(input, 4, 5, 0)); // 001<00101>1001 --> 001<00000>1001
+ Assert.assertEquals(585, BitUtils.replaceBits(input, 4, 5, 4)); // 001<00101>1001 --> 001<00100>1001
+ Assert.assertEquals(1017, BitUtils.replaceBits(input, 4, 5, 31)); // 001<00101>1001 --> 001<11111>1001
+
+ input = -601;
+ Assert.assertEquals(-1017, BitUtils.replaceBits(input, 4, 5, 0)); // ...1110<11010>0111 --> ...110<00000>0111
+
+ /* Test some qtyBits of zero, which should always return the input value. */
+ Assert.assertEquals(Long.MIN_VALUE, BitUtils.replaceBits(Long.MIN_VALUE, 0, 0, 1400));
+ Assert.assertEquals(Long.MIN_VALUE, BitUtils.replaceBits(Long.MIN_VALUE, 63, 0, 1400));
+ Assert.assertEquals(0, BitUtils.replaceBits(0, 0, 0, 1400));
+ Assert.assertEquals(0, BitUtils.replaceBits(0, 63, 0, 1400));
+ Assert.assertEquals(1, BitUtils.replaceBits(1, 0, 0, 1400));
+ Assert.assertEquals(1, BitUtils.replaceBits(1, 63, 0, 1400));
+ Assert.assertEquals(601, BitUtils.replaceBits(601, 8, 0, 1400));
+ Assert.assertEquals(601, BitUtils.replaceBits(601, 8, 0, 1400));
+ Assert.assertEquals(Long.MAX_VALUE, BitUtils.replaceBits(Long.MAX_VALUE, 0, 0, 1400));
+ Assert.assertEquals(Long.MAX_VALUE, BitUtils.replaceBits(Long.MAX_VALUE, 63, 0, 1400));
+
+ /* Wipe out all bits. */
+ Assert.assertEquals(0, BitUtils.replaceBits(Long.MIN_VALUE, 0, 64, 0));
+
+ /* Set all bits to true. */
+ Assert.assertEquals(Long.MIN_VALUE, BitUtils.replaceBits(0, 0, 64, Long.MIN_VALUE));
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|