You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(49) |
Sep
(134) |
Oct
(33) |
Nov
(18) |
Dec
(51) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(50) |
Feb
(32) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(9) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(1) |
Feb
(4) |
Mar
(8) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(1) |
Feb
|
Mar
(54) |
Apr
(21) |
May
(13) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(9) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <be...@us...> - 2010-03-28 12:20:28
|
Revision: 321
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=321&view=rev
Author: benoitx
Date: 2010-03-28 12:20:22 +0000 (Sun, 28 Mar 2010)
Log Message:
-----------
100% coverage for ObjectHolder
Modified Paths:
--------------
trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java
trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java 2010-03-28 11:46:42 UTC (rev 320)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java 2010-03-28 12:20:22 UTC (rev 321)
@@ -33,15 +33,21 @@
package net.objectlab.kit.util;
/**
+ * An object holder just in case one needs to give it as an argement to a method.
* @author Benoit Xhenseval
- *
*/
public class ObjectHolder<T> {
private T value;
+ /**
+ * value is null
+ */
public ObjectHolder() {
}
+ /**
+ * with a default value
+ */
public ObjectHolder(final T value) {
this.value = value;
}
Modified: trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java 2010-03-28 11:46:42 UTC (rev 320)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java 2010-03-28 12:20:22 UTC (rev 321)
@@ -1,6 +1,7 @@
package net.objectlab.kit.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
@@ -8,22 +9,27 @@
@Test
public void testObjectHolder() {
- fail("Not yet implemented");
+ final ObjectHolder<Integer> it = new ObjectHolder<Integer>();
+ assertNull(it.getValue());
}
@Test
public void testObjectHolderT() {
- fail("Not yet implemented");
+ final ObjectHolder<Integer> it = new ObjectHolder<Integer>(Integer.valueOf(987987));
+ assertEquals("value", Integer.valueOf(987987), it.getValue());
}
@Test
- public void testGetValue() {
- fail("Not yet implemented");
- }
+ public void testSetValue() {
+ final ObjectHolder<Integer> it = new ObjectHolder<Integer>();
+ assertNull(it.getValue());
+ final Integer val = Integer.valueOf(9879872);
+ it.setValue(val);
+ assertEquals("value 1", val, it.getValue());
- @Test
- public void testSetValue() {
- fail("Not yet implemented");
+ final ObjectHolder<Integer> it2 = new ObjectHolder<Integer>(Integer.valueOf(987987));
+ assertEquals("value 2", Integer.valueOf(987987), it2.getValue());
+ it.setValue(val);
+ assertEquals("value 3", val, it.getValue());
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-28 11:46:48
|
Revision: 320
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=320&view=rev
Author: benoitx
Date: 2010-03-28 11:46:42 +0000 (Sun, 28 Mar 2010)
Log Message:
-----------
100% coverage for BooleanUtil
Modified Paths:
--------------
trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java
trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java 2010-03-28 11:31:34 UTC (rev 319)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java 2010-03-28 11:46:42 UTC (rev 320)
@@ -52,7 +52,7 @@
* @return true if string is Y,y,YES,yes,TRUE,true,T,t
*/
public static boolean isTrue(final String str) {
- return str == null ? false : StringUtil.equalsAnyIgnoreCase(str, "yes", "y", "TRUE", "t");
+ return str == null ? false : StringUtil.equalsAnyIgnoreCase(StringUtil.trim(str), "yes", "y", "TRUE", "t");
}
public static boolean isFalse(final Boolean b) {
Modified: trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java 2010-03-28 11:31:34 UTC (rev 319)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java 2010-03-28 11:46:42 UTC (rev 320)
@@ -8,27 +8,51 @@
@Test
public void testIsTrueOrNull() {
- fail("Not yet implemented");
+ assertTrue("null", BooleanUtil.isTrueOrNull(null));
+ assertTrue("Boolean.TRUE", BooleanUtil.isTrueOrNull(Boolean.TRUE));
+ assertTrue("true", BooleanUtil.isTrueOrNull(true));
+ assertFalse("Boolean.FALSE", BooleanUtil.isTrueOrNull(Boolean.FALSE));
+ assertFalse("false", BooleanUtil.isTrueOrNull(false));
}
@Test
public void testIsFalseOrNull() {
- fail("Not yet implemented");
+ assertTrue("null", BooleanUtil.isFalseOrNull(null));
+ assertFalse("Boolean.TRUE", BooleanUtil.isFalseOrNull(Boolean.TRUE));
+ assertFalse("true", BooleanUtil.isFalseOrNull(true));
+ assertTrue("Boolean.FALSE", BooleanUtil.isFalseOrNull(Boolean.FALSE));
+ assertTrue("false", BooleanUtil.isFalseOrNull(false));
}
@Test
public void testIsTrueBoolean() {
- fail("Not yet implemented");
+ assertFalse("null", BooleanUtil.isTrue((Boolean)null));
+ assertTrue("Boolean.TRUE", BooleanUtil.isTrue(Boolean.TRUE));
+ assertFalse("Boolean.FALSE", BooleanUtil.isTrue(Boolean.FALSE));
}
@Test
public void testIsTrueString() {
- fail("Not yet implemented");
+ assertFalse("null", BooleanUtil.isTrue((String)null));
+ assertFalse("empty", BooleanUtil.isTrue(""));
+ assertFalse("sjs", BooleanUtil.isTrue("sjs"));
+ assertFalse("space", BooleanUtil.isTrue(" "));
+ assertTrue("y", BooleanUtil.isTrue("y"));
+ assertTrue("yEs", BooleanUtil.isTrue("yEs"));
+ assertTrue("Y", BooleanUtil.isTrue("Y"));
+ assertTrue("YES", BooleanUtil.isTrue("YES"));
+ assertTrue("YeS", BooleanUtil.isTrue("YeS"));
+ assertTrue("t", BooleanUtil.isTrue("t"));
+ assertFalse("tru", BooleanUtil.isTrue("tru"));
+ assertTrue("true", BooleanUtil.isTrue("true"));
+ assertTrue("True", BooleanUtil.isTrue("True"));
+ assertTrue("t ", BooleanUtil.isTrue("t "));
}
@Test
public void testIsFalse() {
- fail("Not yet implemented");
+ assertFalse("null", BooleanUtil.isFalse((Boolean)null));
+ assertFalse("Boolean.TRUE", BooleanUtil.isFalse(Boolean.TRUE));
+ assertTrue("Boolean.FALSE", BooleanUtil.isFalse(Boolean.FALSE));
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-28 11:31:41
|
Revision: 319
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=319&view=rev
Author: benoitx
Date: 2010-03-28 11:31:34 +0000 (Sun, 28 Mar 2010)
Log Message:
-----------
100% coverage for CollectionUtil
and make the deliverable an osgi bundle!
Modified Paths:
--------------
trunk/utils/pom.xml
trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java
trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java
Modified: trunk/utils/pom.xml
===================================================================
--- trunk/utils/pom.xml 2010-03-28 10:55:09 UTC (rev 318)
+++ trunk/utils/pom.xml 2010-03-28 11:31:34 UTC (rev 319)
@@ -6,7 +6,7 @@
<groupId>net.objectlab.kit</groupId>
<artifactId>objectlab-utils</artifactId>
<version>1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<name>ObjectLab Kit - General Utilities</name>
@@ -39,6 +39,20 @@
<target>1.5</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.objectlab.kit.*;version="${pom.version}"</Export-Package>
+ <Private-Package />
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
+ </instructions>
+ </configuration>
+ </plugin>
</plugins>
</build>
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java 2010-03-28 10:55:09 UTC (rev 318)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java 2010-03-28 11:31:34 UTC (rev 319)
@@ -103,6 +103,9 @@
* @return true if none of the collections are empty or null
*/
public static boolean noneEmpty(final Collection... collections) {
+ if (collections == null) {
+ return false;
+ }
for (final Collection col : collections) {
if (isEmpty(col)) {
return false;
@@ -112,8 +115,11 @@
}
public static boolean sameContent(final Collection c1, final Collection c2) {
- boolean same = c1 != null && c2 != null || c1 == c2 || c1 == null && c2 == null;
- if (same && c1 != null) {
+ if (c1 == c2 || (isEmpty(c2) && isEmpty(c1))) {
+ return true;
+ }
+ boolean same = false;
+ if (c1 != null && c2 != null) {
same = c1.size() == c2.size();
if (same) {
same = c1.equals(c2);
Modified: trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java 2010-03-28 10:55:09 UTC (rev 318)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java 2010-03-28 11:31:34 UTC (rev 319)
@@ -1,8 +1,12 @@
package net.objectlab.kit.util;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import org.junit.Test;
@@ -12,47 +16,116 @@
@Test
public void testIsEmpty() {
assertTrue("null", CollectionUtil.isEmpty(null));
- assertTrue("empty set", CollectionUtil.isEmpty(new HashSet()));
+ HashSet col = new HashSet();
+ assertTrue("empty set", CollectionUtil.isEmpty(col));
+ col.add(1);
+ assertFalse("not empty set", CollectionUtil.isEmpty(col));
+ col.add(2);
+ assertFalse("not empty set", CollectionUtil.isEmpty(col));
}
@Test
- public void testIsNotEmptyCollectionOfQ() {
- fail("Not yet implemented");
+ public void testIsNotEmptyCollection() {
+ assertFalse("null", CollectionUtil.isNotEmpty((Collection) null));
+ HashSet col = new HashSet();
+ assertFalse("empty set", CollectionUtil.isNotEmpty(col));
+ col.add(1);
+ assertTrue("not empty set", CollectionUtil.isNotEmpty(col));
+ col.add(2);
+ assertTrue("2 empty set", CollectionUtil.isNotEmpty(col));
}
@Test
- public void testHasOneItem() {
- fail("Not yet implemented");
+ public void testIsNotEmptyObjectArray() {
+ assertFalse("null", CollectionUtil.isNotEmpty((Object[]) null));
+ Object[] col = new String[0];
+ assertFalse("empty set", CollectionUtil.isNotEmpty(col));
+ col = new String[1];
+ assertTrue("not empty set", CollectionUtil.isNotEmpty(col));
}
@Test
- public void testIsNotEmptyObjectArray() {
- fail("Not yet implemented");
+ public void testHasOneItem() {
+ assertFalse("null", CollectionUtil.hasOneItem((Collection) null));
+ HashSet col = new HashSet();
+ assertFalse("empty set", CollectionUtil.hasOneItem(col));
+ col.add(1);
+ assertTrue("not empty set", CollectionUtil.hasOneItem(col));
+ col.add(2);
+ assertFalse("2 items set", CollectionUtil.hasOneItem(col));
}
@Test
public void testSize() {
- fail("Not yet implemented");
+ assertEquals("null", 0, CollectionUtil.size((Collection) null));
+ HashSet col = new HashSet();
+ assertEquals("empty ", 0, CollectionUtil.size(col));
+ col.add(1);
+ assertEquals("1", 1, CollectionUtil.size(col));
+ col.add(2);
+ assertEquals("2", 2, CollectionUtil.size(col));
}
@Test
public void testContains() {
- fail("Not yet implemented");
+ assertFalse("null", CollectionUtil.contains((Collection) null, "bla"));
+ HashSet col = new HashSet();
+ assertFalse("empty", CollectionUtil.contains(col, "bla"));
+ col.add(1);
+ assertFalse("1", CollectionUtil.contains(col, "bla"));
+ col.add("bla");
+ assertTrue("1 + bla", CollectionUtil.contains(col, "bla"));
}
@Test
public void testContainsAny() {
- fail("Not yet implemented");
+ assertFalse("null", CollectionUtil.containsAny((Collection) null, "bla", 2));
+ HashSet col = new HashSet();
+ assertFalse("empty", CollectionUtil.containsAny(col, "bla", 2));
+ col.add(1);
+ assertFalse("contains 1", CollectionUtil.containsAny(col, "bla", 2));
+ col.add(2);
+ assertTrue("contains 2", CollectionUtil.containsAny(col, "bla", 2));
+ col.add("bla");
+ assertTrue("contains 2 and bla", CollectionUtil.containsAny(col, "bla", 2));
+ col.remove(2);
+ assertTrue("contains bla", CollectionUtil.containsAny(col, "bla", 2));
+ col.remove("bla");
+ assertFalse("contains nothing", CollectionUtil.containsAny(col, "bla", 2));
}
@Test
public void testNoneEmpty() {
- fail("Not yet implemented");
+ assertFalse("1 null", CollectionUtil.noneEmpty(null));
+ assertFalse("2 null", CollectionUtil.noneEmpty(null, null));
+ assertFalse("empty null", CollectionUtil.noneEmpty(Collections.EMPTY_LIST, null));
+ assertFalse("empty empty", CollectionUtil.noneEmpty(Collections.EMPTY_LIST, Collections.EMPTY_LIST));
+ HashSet col = new HashSet();
+ assertFalse("empty empty", CollectionUtil.noneEmpty(col, col));
+ col.add(1);
+ assertTrue("1", CollectionUtil.noneEmpty(col));
+ HashSet col2 = new HashSet();
+ assertFalse("1 and 2 empty", CollectionUtil.noneEmpty(col, col2));
+ assertFalse("1 and null 2 empty", CollectionUtil.noneEmpty(col, null, col2));
+ col2.add("bla");
+ assertFalse("1 and null 2", CollectionUtil.noneEmpty(col, null, col2));
+ assertTrue("1 and 2", CollectionUtil.noneEmpty(col, col2));
}
@Test
public void testSameContent() {
- fail("Not yet implemented");
+ assertTrue("null null", CollectionUtil.sameContent(null, null));
+ HashSet col = new HashSet();
+ assertTrue("empty null", CollectionUtil.sameContent(col, null));
+ assertTrue("same", CollectionUtil.sameContent(col, col));
+ HashSet col1 = new HashSet();
+ col.add(1);
+ assertFalse("not same empty 1", CollectionUtil.sameContent(col, col1));
+ assertFalse("not same 1 empty", CollectionUtil.sameContent(col1, col));
+ col1.add(1);
+ assertTrue("same 1 1", CollectionUtil.sameContent(col1, col));
+ col1.add(2);
+ assertFalse("same 1 2", CollectionUtil.sameContent(col1, col));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-28 10:55:15
|
Revision: 318
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=318&view=rev
Author: benoitx
Date: 2010-03-28 10:55:09 +0000 (Sun, 28 Mar 2010)
Log Message:
-----------
Adding tests.
Modified Paths:
--------------
trunk/utils/pom.xml
trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java
Modified: trunk/utils/pom.xml
===================================================================
--- trunk/utils/pom.xml 2010-03-26 21:32:38 UTC (rev 317)
+++ trunk/utils/pom.xml 2010-03-28 10:55:09 UTC (rev 318)
@@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>net.objectlab.kit.util</groupId>
- <artifactId>utils</artifactId>
+ <groupId>net.objectlab.kit</groupId>
+ <artifactId>objectlab-utils</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java 2010-03-26 21:32:38 UTC (rev 317)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java 2010-03-28 10:55:09 UTC (rev 318)
@@ -119,7 +119,7 @@
/**
* Add 2 BigDecimal safely (i.e. handles nulls)
*/
- public static BigDecimal add(final BigDecimal v1, final BigDecimal v2) {
+ private static BigDecimal doAdd(final BigDecimal v1, final BigDecimal v2) {
BigDecimal total = v1;
if (v1 != null && v2 != null) {
total = v1.add(v2);
@@ -133,21 +133,23 @@
* Add n BigDecimal safely (i.e. handles nulls)
*/
public static BigDecimal add(final BigDecimal start, final BigDecimal... values) {
- BigDecimal total = start;
- for (final BigDecimal v : values) {
- total = add(total, v);
+ BigDecimal total = start != null ? start : BigDecimal.ZERO;
+ if (values != null) {
+ for (final BigDecimal v : values) {
+ total = doAdd(total, v);
+ }
}
return total;
}
/**
- * Subtract n BigDecimal safely (i.e. handles nulls)
+ * Subtract n BigDecimal safely (i.e. handles nulls), returns 0
*/
public static BigDecimal subtract(final BigDecimal start, final BigDecimal... values) {
- BigDecimal total = start;
+ BigDecimal total = start != null ? start : BigDecimal.ZERO;
if (values != null) {
for (final BigDecimal v : values) {
- total = subtract(total, v);
+ total = doSubtract(total, v);
}
}
return total;
@@ -156,7 +158,7 @@
/**
* Subtract 2 BigDecimal safely (i.e. handles nulls) v1 - v2
*/
- public static BigDecimal subtract(final BigDecimal v1, final BigDecimal v2) {
+ private static BigDecimal doSubtract(final BigDecimal v1, final BigDecimal v2) {
BigDecimal diff = v1;
if (v1 != null && v2 != null) {
diff = v1.subtract(v2);
@@ -295,7 +297,7 @@
* @return true if the ABS( ABS(v1) - ABS(v2) )
*/
public static BigDecimal absDiff(final BigDecimal v1, final BigDecimal v2) {
- return abs(subtract(abs(v1), abs(v2)));
+ return abs(doSubtract(abs(v1), abs(v2)));
}
/**
@@ -422,7 +424,7 @@
*/
public static BigDecimal addWeightedConstituent(final BigDecimal runningWeightedVal, final BigDecimal valueToAdd, final BigDecimal weightForValueToAdd,
final BigDecimal totalWeight) {
- return BigDecimalUtil.add(runningWeightedVal, BigDecimalUtil.divide(BigDecimalUtil.multiply(valueToAdd, BigDecimalUtil.abs(weightForValueToAdd)),
+ return BigDecimalUtil.doAdd(runningWeightedVal, BigDecimalUtil.divide(BigDecimalUtil.multiply(valueToAdd, BigDecimalUtil.abs(weightForValueToAdd)),
BigDecimalUtil.abs(totalWeight), BigDecimal.ROUND_HALF_UP));
}
@@ -475,7 +477,7 @@
public static boolean movedStrictlyOutsideThresholdPercentage(final BigDecimal startValue, final BigDecimal newValue, final BigDecimal thresholdPercent) {
final BigDecimal s = BigDecimalUtil.setScale(startValue, 10);
final BigDecimal n = BigDecimalUtil.setScale(newValue, 10);
- final BigDecimal diff = BigDecimalUtil.divide(BigDecimalUtil.subtract(s, n), s, BigDecimal.ROUND_HALF_UP);
+ final BigDecimal diff = BigDecimalUtil.divide(BigDecimalUtil.doSubtract(s, n), s, BigDecimal.ROUND_HALF_UP);
// diff = BigDecimalUtil.safeAbsDiff(diff, MagicNumbers.ONE);
return BigDecimalUtil.absCompareTo(diff, thresholdPercent) > 0;
Modified: trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java 2010-03-28 10:55:09 UTC (rev 318)
@@ -17,6 +17,34 @@
public class BigDecimalUtilTest {
/**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#divide(java.math.BigDecimal, java.math.BigDecimal, int, int)}.
+ */
+ @Test
+ public void testDivideBigDecimalBigDecimalIntInt() {
+ assertEquals("3 null", null, BigDecimalUtil.divide(null, null, BigDecimal.ROUND_HALF_UP));
+ assertEquals("2a null", null, BigDecimalUtil.divide(BigDecimal.ONE, null, BigDecimal.ROUND_HALF_UP));
+ assertEquals("2c null", null, BigDecimalUtil.divide(null, BigDecimal.ONE, BigDecimal.ROUND_HALF_UP));
+ assertEquals("2d null", null, BigDecimalUtil.divide(null, BigDecimal.ONE, BigDecimal.ROUND_HALF_UP));
+ assertEquals("ONE 2", BigDecimal.ONE, BigDecimalUtil.divide(BigDecimal.ONE, BigDecimal.ONE, BigDecimal.ROUND_HALF_UP));
+ assertEquals("ONE 3", BigDecimal.ONE, BigDecimalUtil.divide(BigDecimal.ONE, BigDecimal.ONE, BigDecimal.ROUND_HALF_UP));
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#setScale(java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testSetScaleBigDecimalInt() {
+ assertEquals("null", null, BigDecimalUtil.setScale(null, 3));
+ assertEquals("1.000", new BigDecimal("1.000"), BigDecimalUtil.setScale(BigDecimal.ONE, 3));
+ assertEquals("1.000 same", new BigDecimal("1.000"), BigDecimalUtil.setScale(new BigDecimal("1.000"), 3));
+ assertEquals("1.00 to 3dp", new BigDecimal("1.000"), BigDecimalUtil.setScale(new BigDecimal("1.00"), 3));
+ assertEquals("1.000 to -1dp", new BigDecimal("0E+1"), BigDecimalUtil.setScale(new BigDecimal("1.000"), -1));
+ assertEquals("1.236 to 2", new BigDecimal("1.24"), BigDecimalUtil.setScale(new BigDecimal("1.236"), 2));
+ assertEquals("1.235 to 2", new BigDecimal("1.24"), BigDecimalUtil.setScale(new BigDecimal("1.235"), 2));
+ assertEquals("1.234 to 2", new BigDecimal("1.23"), BigDecimalUtil.setScale(new BigDecimal("1.23"), 2));
+ }
+
+ /**
* Test method for {@link net.objectlab.kit.util.BigDecimalUtil#inverse(java.math.BigDecimal, int)}.
*/
@Test
@@ -89,19 +117,19 @@
}
/**
- * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#add(java.math.BigDecimal, java.math.BigDecimal)}.
- */
- @Test
- public void testAddBigDecimalBigDecimal() {
- fail("Not yet implemented");
- }
-
- /**
* Test method for {@link net.objectlab.kit.util.BigDecimalUtil#add(java.math.BigDecimal, java.math.BigDecimal[])}.
*/
@Test
public void testAddBigDecimalBigDecimalArray() {
- fail("Not yet implemented");
+ assertEquals("null", BigDecimal.ZERO, BigDecimalUtil.add(null));
+ assertEquals("null+null", BigDecimal.ZERO, BigDecimalUtil.add(null, null));
+ assertEquals("null+null+0", BigDecimal.ZERO, BigDecimalUtil.add(null, null, BigDecimal.ZERO));
+ assertEquals("null+1", BigDecimal.ONE, BigDecimalUtil.add(null, BigDecimal.ONE));
+ assertEquals("1+null", BigDecimal.ONE, BigDecimalUtil.add(BigDecimal.ONE, null));
+ assertEquals("1+null+0", BigDecimal.ONE, BigDecimalUtil.add(BigDecimal.ONE, null, BigDecimal.ZERO));
+ assertEquals("1+null+1", new BigDecimal(2), BigDecimalUtil.add(BigDecimal.ONE, null, BigDecimal.ONE));
+ assertEquals("1+0+1", new BigDecimal(2), BigDecimalUtil.add(BigDecimal.ONE, BigDecimal.ZERO, BigDecimal.ONE));
+ assertEquals("1+1+1", new BigDecimal(3), BigDecimalUtil.add(BigDecimal.ONE, BigDecimal.ONE, BigDecimal.ONE));
}
/**
@@ -110,17 +138,17 @@
@Test
public void testSubtractBigDecimalBigDecimalArray() {
assertEquals("2 null", BigDecimal.ZERO, BigDecimalUtil.subtract(null, (BigDecimal[]) null));
+ assertEquals("3 null", BigDecimal.ZERO, BigDecimalUtil.subtract(null, null, null));
+ assertEquals("0 -null -null", BigDecimal.ZERO, BigDecimalUtil.subtract(BigDecimal.ZERO, null, null));
+ assertEquals("null 0 -null", BigDecimal.ZERO, BigDecimalUtil.subtract(null, BigDecimal.ZERO, null));
+ assertEquals("1 -null", BigDecimal.ONE, BigDecimalUtil.subtract(BigDecimal.ONE, null));
+ assertEquals("1 -null -0", BigDecimal.ONE, BigDecimalUtil.subtract(BigDecimal.ONE, null, BigDecimal.ZERO));
+ assertEquals("1 -0 -null", BigDecimal.ONE, BigDecimalUtil.subtract(BigDecimal.ONE, BigDecimal.ZERO, null));
+ assertEquals("1 -0 -1", BigDecimal.ZERO, BigDecimalUtil.subtract(BigDecimal.ONE, BigDecimal.ZERO, BigDecimal.ONE));
+ assertEquals("1 -null -1", BigDecimal.ZERO, BigDecimalUtil.subtract(BigDecimal.ONE, null, BigDecimal.ONE));
}
/**
- * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#subtract(java.math.BigDecimal, java.math.BigDecimal)}.
- */
- @Test
- public void testSubtractBigDecimalBigDecimal() {
- fail("Not yet implemented");
- }
-
- /**
* Test method for {@link net.objectlab.kit.util.BigDecimalUtil#divide(java.math.BigDecimal, java.math.BigDecimal, int)}.
*/
@Test
@@ -145,14 +173,6 @@
}
/**
- * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#divide(java.math.BigDecimal, java.math.BigDecimal, int, int)}.
- */
- @Test
- public void testDivideBigDecimalBigDecimalIntInt() {
- fail("Not yet implemented");
- }
-
- /**
* Test method for {@link net.objectlab.kit.util.BigDecimalUtil#multiply(java.math.BigDecimal, java.math.BigDecimal)}.
*/
@Test
@@ -257,14 +277,6 @@
}
/**
- * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#setScale(java.math.BigDecimal, int)}.
- */
- @Test
- public void testSetScaleBigDecimalInt() {
- fail("Not yet implemented");
- }
-
- /**
* Test method for {@link net.objectlab.kit.util.BigDecimalUtil#setScale(java.math.BigDecimal, java.lang.Integer)}.
*/
@Test
Modified: trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java 2010-03-28 10:55:09 UTC (rev 318)
@@ -1,14 +1,18 @@
package net.objectlab.kit.util;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import java.util.HashSet;
+
import org.junit.Test;
public class CollectionUtilTest {
@Test
public void testIsEmpty() {
- fail("Not yet implemented");
+ assertTrue("null", CollectionUtil.isEmpty(null));
+ assertTrue("empty set", CollectionUtil.isEmpty(new HashSet()));
}
@Test
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-26 21:32:45
|
Revision: 317
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=317&view=rev
Author: benoitx
Date: 2010-03-26 21:32:38 +0000 (Fri, 26 Mar 2010)
Log Message:
-----------
So very agile... prepared all tests... that will fail...
Modified Paths:
--------------
trunk/utils/src/main/java/net/objectlab/kit/util/Average.java
trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java
trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java
Added Paths:
-----------
trunk/utils/src/test/java/net/objectlab/kit/util/AverageTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/IntegerUtilTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/ObjectUtilTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/PairTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/QuadrupletTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/StringUtilTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/SumTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/TripletTest.java
trunk/utils/src/test/java/net/objectlab/kit/util/WeightedAverageTest.java
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/Average.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Average.java 2010-03-26 21:24:51 UTC (rev 316)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Average.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -32,13 +32,15 @@
*/
package net.objectlab.kit.util;
+import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author Benoit
*
*/
-public final class Average {
+public final class Average implements Serializable {
+ private static final long serialVersionUID = 4630559777899225672L;
private Sum sum = new Sum();
private int count = 0;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java 2010-03-26 21:24:51 UTC (rev 316)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -41,11 +41,7 @@
*
*/
public class Sum implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -8583271171731930344L;
private BigDecimal value = BigDecimal.ZERO;
private int count = 0;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java 2010-03-26 21:24:51 UTC (rev 316)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -40,7 +40,7 @@
*
*/
public class WeightedAverage implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 4687472725716492770L;
private final Sum total = new Sum();
private final Sum totalExpanded = new Sum();
private int count = 0;
Added: trunk/utils/src/test/java/net/objectlab/kit/util/AverageTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/AverageTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/AverageTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,80 @@
+/**
+ *
+ */
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * @author Benoit
+ *
+ */
+public class AverageTest {
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#Average()}.
+ */
+ @Test
+ public void testAverage() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#Average(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAverageBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#Average(int)}.
+ */
+ @Test
+ public void testAverageInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#add(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAdd() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#getTotal()}.
+ */
+ @Test
+ public void testGetTotal() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#getDataPoints()}.
+ */
+ @Test
+ public void testGetDataPoints() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#getAverage()}.
+ */
+ @Test
+ public void testGetAverage() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.Average#toString()}.
+ */
+ @Test
+ public void testToString() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/BooleanUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,34 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class BooleanUtilTest {
+
+ @Test
+ public void testIsTrueOrNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsFalseOrNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsTrueBoolean() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsTrueString() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsFalse() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/CollectionUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,54 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CollectionUtilTest {
+
+ @Test
+ public void testIsEmpty() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNotEmptyCollectionOfQ() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testHasOneItem() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNotEmptyObjectArray() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSize() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testContains() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testContainsAny() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testNoneEmpty() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSameContent() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/IntegerUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/IntegerUtilTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/IntegerUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,59 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class IntegerUtilTest {
+
+ @Test
+ public void testIsNotZero() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsZero() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNullOrZero() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsSameValue() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNotSameValue() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSafeAdd() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSafeSignum() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSafeCompare() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAssign() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNotZeroOrNegative() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/ObjectHolderTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,29 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ObjectHolderTest {
+
+ @Test
+ public void testObjectHolder() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testObjectHolderT() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetValue() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetValue() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/ObjectUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/ObjectUtilTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/ObjectUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,59 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ObjectUtilTest {
+
+ @Test
+ public void testEqualsIntegerInteger() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsBigDecimalBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsObjectObject() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsAny() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsAll() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testNotEqualsAny() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAnyNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAllNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAtLeastOneNotNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testNoneNull() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/PairTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/PairTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/PairTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,59 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class PairTest {
+
+ @Test
+ public void testHashCode() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testCreate() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testPairE1E2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testPair() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement1() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement1() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsObject() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToString() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/QuadrupletTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/QuadrupletTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/QuadrupletTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,74 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class QuadrupletTest {
+
+ @Test
+ public void testHashCode() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement1() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testCreate() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testQuadruplet() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement1() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement3() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement3() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement4() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement4() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsObject() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToString() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/StringUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/StringUtilTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/StringUtilTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,174 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class StringUtilTest {
+
+ @Test
+ public void testRemoveTrailingChar() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testDefaultFormatDatetime() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testDefaultFileFormatTimestamp() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testReplaceTokenStringStringObject() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testReplace() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testReplaceTokenStringStringString() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testReplaceCRToken() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testWrapText() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testTrimAndUpperCase() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToLowerCaseString() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToLowerCaseStringArray() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToUpperCase() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testProcessCaseTreatment() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToStringObject() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToStringOrEmpty() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSingleQuote() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNotBlank() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testNoneBlank() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAllEquals() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsAnyIgnoreCaseStringStringArray() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsAnyIgnoreCaseStringString() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testConcat() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testConcatWithSpaces() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEmptyIfNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsWildcardOrNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testReturnIfNotNull() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testFirstCharToUpper() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testTrim() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testPrepareForNumericParsing() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testNullIfEmpty() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testCompareTo() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAsList() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testBoxify() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/SumTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/SumTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/SumTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,99 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SumTest {
+
+ @Test
+ public void testSum() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSumBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSumBigDecimalInt() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSumSum() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetTotal() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetTotal() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAddBigDecimalArray() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSubtract() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAddInteger() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAddSum() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testMinusBigDecimalArray() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testMinusSum() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToString() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsZero() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNotZero() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsNegative() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testIsZeroOrLess() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetCount() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/TripletTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/TripletTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/TripletTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,64 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TripletTest {
+
+ @Test
+ public void testHashCode() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement1() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testCreate() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testTriplet() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement1() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement2() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetElement3() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testSetElement3() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testEqualsObject() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testToString() {
+ fail("Not yet implemented");
+ }
+
+}
Added: trunk/utils/src/test/java/net/objectlab/kit/util/WeightedAverageTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/WeightedAverageTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/WeightedAverageTest.java 2010-03-26 21:32:38 UTC (rev 317)
@@ -0,0 +1,29 @@
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class WeightedAverageTest {
+
+ @Test
+ public void testGetTotal() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testAdd() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetWeightedAverage() {
+ fail("Not yet implemented");
+ }
+
+ @Test
+ public void testGetCount() {
+ fail("Not yet implemented");
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-26 21:24:58
|
Revision: 316
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=316&view=rev
Author: benoitx
Date: 2010-03-26 21:24:51 +0000 (Fri, 26 Mar 2010)
Log Message:
-----------
Tidy up and adding a skeleton for test.
Modified Paths:
--------------
trunk/utils/pom.xml
trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java
trunk/utils/src/main/java/net/objectlab/kit/util/Average.java
trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java
trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java
trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java
trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java
trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java
trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java
Added Paths:
-----------
trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java
Modified: trunk/utils/pom.xml
===================================================================
--- trunk/utils/pom.xml 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/pom.xml 2010-03-26 21:24:51 UTC (rev 316)
@@ -21,6 +21,12 @@
<artifactId>joda-time</artifactId>
<version>1.6</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.console;
import java.io.BufferedReader;
@@ -206,8 +238,8 @@
* @return boolean as selected by the user of the console app
*/
public static boolean getBoolean(final String title, final boolean defaultValue) {
- final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(),
- Boolean.FALSE.toString() }, defaultValue ? 1 : 2);
+ final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() },
+ defaultValue ? 1 : 2);
return Boolean.valueOf(val);
}
Modified: trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.console;
import java.lang.reflect.Method;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/Average.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Average.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Average.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.math.BigDecimal;
@@ -18,11 +50,11 @@
}
public Average(final int scale) {
- BigDecimal bd = new BigDecimal(0);
+ final BigDecimal bd = new BigDecimal(0);
sum = new Sum(bd.setScale(scale));
}
- public void add(BigDecimal val) {
+ public void add(final BigDecimal val) {
sum.add(val);
count++;
}
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.math.BigDecimal;
@@ -113,8 +145,10 @@
*/
public static BigDecimal subtract(final BigDecimal start, final BigDecimal... values) {
BigDecimal total = start;
- for (final BigDecimal v : values) {
- total = subtract(total, v);
+ if (values != null) {
+ for (final BigDecimal v : values) {
+ total = subtract(total, v);
+ }
}
return total;
}
@@ -144,8 +178,8 @@
}
public static BigDecimal calculateWeight(final BigDecimal value, final BigDecimal total) {
- return BigDecimalUtil.setScale(BigDecimalUtil.divide(BigDecimalUtil.setScale(value, 9), BigDecimalUtil.setScale(total, 9),
- BigDecimal.ROUND_HALF_UP), 9);
+ return BigDecimalUtil
+ .setScale(BigDecimalUtil.divide(BigDecimalUtil.setScale(value, 9), BigDecimalUtil.setScale(total, 9), BigDecimal.ROUND_HALF_UP), 9);
}
/**
@@ -388,8 +422,8 @@
*/
public static BigDecimal addWeightedConstituent(final BigDecimal runningWeightedVal, final BigDecimal valueToAdd, final BigDecimal weightForValueToAdd,
final BigDecimal totalWeight) {
- return BigDecimalUtil.add(runningWeightedVal, BigDecimalUtil.divide(BigDecimalUtil
- .multiply(valueToAdd, BigDecimalUtil.abs(weightForValueToAdd)), BigDecimalUtil.abs(totalWeight), BigDecimal.ROUND_HALF_UP));
+ return BigDecimalUtil.add(runningWeightedVal, BigDecimalUtil.divide(BigDecimalUtil.multiply(valueToAdd, BigDecimalUtil.abs(weightForValueToAdd)),
+ BigDecimalUtil.abs(totalWeight), BigDecimal.ROUND_HALF_UP));
}
/**
@@ -611,7 +645,7 @@
return null;
}
BigDecimal max = null;
- for (BigDecimal bd : v1) {
+ for (final BigDecimal bd : v1) {
max = BigDecimalUtil.compareTo(max, bd) >= 0 ? max : bd;
}
return max;
@@ -643,7 +677,7 @@
/**
* @return true if value !=null and <=0.
*/
- public static boolean isZeroOrLess(BigDecimal value) {
+ public static boolean isZeroOrLess(final BigDecimal value) {
return value != null && value.signum() <= 0;
}
}
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
public final class BooleanUtil {
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
public enum CaseTreatment {
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.util.Collection;
@@ -57,8 +89,8 @@
*/
public static boolean containsAny(final Collection<?> collection, final Object... items) {
if (collection != null) {
- for (Object item : items) {
- boolean b = collection.contains(item);
+ for (final Object item : items) {
+ final boolean b = collection.contains(item);
if (b) {
return true;
}
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
/**
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
/**
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.math.BigDecimal;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.io.Serializable;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.io.Serializable;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.text.SimpleDateFormat;
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -42,6 +42,10 @@
*/
public class Sum implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private BigDecimal value = BigDecimal.ZERO;
private int count = 0;
@@ -55,7 +59,7 @@
}
}
- public Sum(final BigDecimal start, int scale) {
+ public Sum(final BigDecimal start, final int scale) {
if (start != null) {
value = start.setScale(scale, BigDecimal.ROUND_HALF_UP);
}
@@ -87,7 +91,7 @@
}
public Sum subtract(final BigDecimal... value) {
- this.value = BigDecimalUtil.subtract(this.value, value);
+ this.value = BigDecimalUtil.subtract(this.value, value);
count += value.length;
return this;
}
Modified: trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java 2010-03-26 21:09:51 UTC (rev 315)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -1,3 +1,35 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: AbstractDateCalculator.java 309 2010-03-23 21:01:49Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
package net.objectlab.kit.util;
import java.io.Serializable;
Added: trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java
===================================================================
--- trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java (rev 0)
+++ trunk/utils/src/test/java/net/objectlab/kit/util/BigDecimalUtilTest.java 2010-03-26 21:24:51 UTC (rev 316)
@@ -0,0 +1,491 @@
+/**
+ *
+ */
+package net.objectlab.kit.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.math.BigDecimal;
+
+import org.junit.Test;
+
+/**
+ * @author Benoit
+ *
+ */
+public class BigDecimalUtilTest {
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#inverse(java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testInverseBigDecimalInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#inverse(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testInverseBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isNotZero(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsNotZero() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isZero(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsZero() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isNegative(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsNegative() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isStrictlyPositive(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsStrictlyPositive() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isNullOrZero(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsNullOrZero() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isSameValue(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsSameValue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isSameValueTreatNullAsZero(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsSameValueTreatNullAsZero() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#add(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAddBigDecimalBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#add(java.math.BigDecimal, java.math.BigDecimal[])}.
+ */
+ @Test
+ public void testAddBigDecimalBigDecimalArray() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#subtract(java.math.BigDecimal, java.math.BigDecimal[])}.
+ */
+ @Test
+ public void testSubtractBigDecimalBigDecimalArray() {
+ assertEquals("2 null", BigDecimal.ZERO, BigDecimalUtil.subtract(null, (BigDecimal[]) null));
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#subtract(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testSubtractBigDecimalBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#divide(java.math.BigDecimal, java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testDivideBigDecimalBigDecimalInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#calculateWeight(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testCalculateWeight() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#divide(int, java.math.BigDecimal, java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testDivideIntBigDecimalBigDecimalInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#divide(java.math.BigDecimal, java.math.BigDecimal, int, int)}.
+ */
+ @Test
+ public void testDivideBigDecimalBigDecimalIntInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#multiply(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testMultiplyBigDecimalBigDecimal() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#multiply(java.math.BigDecimal, java.math.BigDecimal[])}.
+ */
+ @Test
+ public void testMultiplyBigDecimalBigDecimalArray() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#abs(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAbs() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#negate(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testNegate() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#negateIfTrue(boolean, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testNegateIfTrue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isNotSameAbsValue(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsNotSameAbsValue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isNotSameValue(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsNotSameValue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isSameAbsValue(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsSameAbsValue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#compareTo(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testCompareTo() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#absCompareTo(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAbsCompareTo() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#absDiff(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAbsDiff() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#movePoint(java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testMovePoint() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#roundTo(java.math.BigDecimal, int, int)}.
+ */
+ @Test
+ public void testRoundTo() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#setScale(java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testSetScaleBigDecimalInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#setScale(java.math.BigDecimal, java.lang.Integer)}.
+ */
+ @Test
+ public void testSetScaleBigDecimalInteger() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#setScale(java.math.BigDecimal, java.lang.Integer, int)}.
+ */
+ @Test
+ public void testSetScaleBigDecimalIntegerInt() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#signum(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testSignum() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isSameSignum(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsSameSignum() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#hasSignedFlippedAndNotZero(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testHasSignedFlippedAndNotZero() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#hasSignedChanged(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testHasSignedChanged() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isOutsideRange(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsOutsideRange() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isInsideInclusiveRange(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsInsideInclusiveRange() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#assignNonNull(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAssignNonNull() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#addWeightedConstituent(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testAddWeightedConstituent() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#allNullOrZero(java.math.BigDecimal[])}.
+ */
+ @Test
+ public void testAllNullOrZero() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#format(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testFormat() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#percentFormat(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testPercentFormat() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#movedInsideThresholdPercentage(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testMovedInsideThresholdPercentage() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#movedStrictlyOutsideThresholdPercentage(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testMovedStrictlyOutsideThresholdPercentage() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#roundUp(java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testRoundUp() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#roundDown(java.math.BigDecimal, int)}.
+ */
+ @Test
+ public void testRoundDown() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#roundUpForIncrement(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testRoundUpForIncrement() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#roundDownForIncrement(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testRoundDownForIncrement() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#ensureMin(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testEnsureMin() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#forceNegative(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testForceNegative() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#forceNegativeIfTrue(boolean, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testForceNegativeIfTrue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#min(java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testMin() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#max(java.math.BigDecimal[])}.
+ */
+ @Test
+ public void testMax() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#longForFraction(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testLongForFraction() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isDiffMoreThanAbsThreshold(java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsDiffMoreThanAbsThreshold() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#doubleValue(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testDoubleValue() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link net.objectlab.kit.util.BigDecimalUtil#isZeroOrLess(java.math.BigDecimal)}.
+ */
+ @Test
+ public void testIsZeroOrLess() {
+ fail("Not yet implemented");
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-26 21:09:57
|
Revision: 315
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=315&view=rev
Author: benoitx
Date: 2010-03-26 21:09:51 +0000 (Fri, 26 Mar 2010)
Log Message:
-----------
ignores
Property Changed:
----------------
trunk/utils/
Property changes on: trunk/utils
___________________________________________________________________
Added: svn:ignore
+ .classpath
.project
.settings
target
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-26 21:09:18
|
Revision: 314
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=314&view=rev
Author: benoitx
Date: 2010-03-26 21:09:11 +0000 (Fri, 26 Mar 2010)
Log Message:
-----------
First cut for the utils module.
Added Paths:
-----------
trunk/utils/
trunk/utils/pom.xml
trunk/utils/src/
trunk/utils/src/main/
trunk/utils/src/main/java/
trunk/utils/src/main/java/net/
trunk/utils/src/main/java/net/objectlab/
trunk/utils/src/main/java/net/objectlab/kit/
trunk/utils/src/main/java/net/objectlab/kit/console/
trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java
trunk/utils/src/main/java/net/objectlab/kit/util/
trunk/utils/src/main/java/net/objectlab/kit/util/Average.java
trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java
trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java
trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java
trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java
trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java
trunk/utils/src/main/java/net/objectlab/kit/util/Sum.java
trunk/utils/src/main/java/net/objectlab/kit/util/Triplet.java
trunk/utils/src/main/java/net/objectlab/kit/util/WeightedAverage.java
trunk/utils/src/test/
trunk/utils/src/test/java/
trunk/utils/src/test/java/net/
trunk/utils/src/test/java/net/objectlab/
trunk/utils/src/test/java/net/objectlab/kit/
trunk/utils/src/test/java/net/objectlab/kit/util/
Added: trunk/utils/pom.xml
===================================================================
--- trunk/utils/pom.xml (rev 0)
+++ trunk/utils/pom.xml 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>net.objectlab.kit.util</groupId>
+ <artifactId>utils</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>ObjectLab Kit - General Utilities</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>1.6</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,433 @@
+package net.objectlab.kit.console;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.joda.time.LocalDate;
+
+/**
+ * @author Benoit Xhenseval
+ *
+ */
+public class ConsoleMenu {
+ private static final int EXIT_CODE = 0;
+
+ private static final int SCREEN_COLUMNS = 110;
+
+ private static final int COL = 10;
+
+ private static final PrintStream OUT = System.out;
+
+ // ~ Instance fields
+ // ------------------------------------------------------------------------------------------------
+
+ private final List<String> menu = new ArrayList<String>();
+
+ private final List<String> methods = new ArrayList<String>();
+
+ private final List<Boolean> askForRepeat = new ArrayList<Boolean>();
+
+ private final Repeater target;
+
+ private int screenColumns = SCREEN_COLUMNS;
+
+ // ~ Constructors
+ // ---------------------------------------------------------------------------------------------------
+
+ /**
+ * @param containingObject
+ * the object that will be called back once an option is chosen
+ * in the menu
+ */
+ public ConsoleMenu(final Repeater containingObject) {
+ target = containingObject;
+ }
+
+ // ~ Methods
+ // --------------------------------------------------------------------------------------------------------
+
+ /**
+ * add an entry in the menu, sequentially
+ *
+ * @param menuDisplay
+ * how the entry will be displayed in the menu
+ * @param methodName
+ * name of the public method
+ * @parem askForRepeat call back for repeat
+ */
+ public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) {
+ menu.add(menuDisplay);
+ methods.add(methodName);
+ askForRepeat.add(Boolean.valueOf(repeat));
+ }
+
+ public void setScreenColumns(final int width) {
+ screenColumns = width;
+ }
+
+ /**
+ * display the menu, the application goes into a loop which provides the
+ * menu and fires the entries selected. It automatically adds an entry to
+ * exit.
+ */
+ public void displayMenu() {
+ while (true) {
+ ConsoleMenu.println("");
+ ConsoleMenu.println("Menu Options");
+
+ final int size = menu.size();
+
+ displayMenu(size);
+
+ int opt = -1;
+
+ do {
+ opt = ConsoleMenu.getInt("Enter your choice:", -1);
+ } while (((opt <= 0) || (opt > methods.size())) && (opt != EXIT_CODE));
+
+ if (opt == EXIT_CODE) {
+ ConsoleMenu.println("Exiting menu");
+ try {
+ final Method meth = target.getClass().getMethod("tearDown", new Class[0]);
+ if (meth != null) {
+ meth.invoke(target, new Object[0]);
+ }
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
+
+ return;
+ }
+
+ // now call the method
+ final String method = methods.get(opt - 1);
+ final Boolean repeat = askForRepeat.get(opt - 1);
+
+ try {
+ final Method meth = target.getClass().getMethod(method, new Class[0]);
+ if (repeat) {
+ target.repeat(meth);
+ } else {
+ meth.invoke(target, new Object[0]);
+ }
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void displayMenu(final int size) {
+ for (int i = 0; i < (size / 2); i++) {
+ final StringBuffer line = new StringBuffer();
+ final String col1 = menu.get(i);
+
+ if ((i + 1) < COL) {
+ line.append(" ");
+ }
+
+ final int pos = i + 1;
+ line.append(" ").append(pos).append(") ").append(col1);
+
+ while (line.length() < (screenColumns / 2)) {
+ line.append(" ");
+ }
+
+ if ((i + (size / 2)) < size) {
+ final String col2 = menu.get(i + (size / 2));
+ final int position = i + 1 + (size / 2);
+ line.append(" ").append(position).append(") ").append(col2);
+ }
+
+ ConsoleMenu.println(line.toString());
+ }
+
+ if (size % 2 != 0) {
+ final StringBuffer line = new StringBuffer();
+ final String col1 = menu.get(size - 1);
+
+ if (size < COL) {
+ line.append(" ");
+ }
+
+ line.append(" ").append(size).append(") ").append(col1);
+
+ while (line.length() < (screenColumns / 2)) {
+ line.append(" ");
+ }
+
+ line.append(" ").append(EXIT_CODE).append(") ").append("Exit");
+ ConsoleMenu.println(line.toString());
+ } else {
+ ConsoleMenu.println(" " + EXIT_CODE + ") Exit");
+ }
+ }
+
+ /**
+ * Gets an int from the System.in
+ *
+ * @param title
+ * for the command line
+ * @return int as entered by the user of the console app
+ */
+ public static int getInt(final String title, final int defaultValue) {
+ int opt = -1;
+
+ do {
+ try {
+ final String val = ConsoleMenu.getString(title + " (default:" + defaultValue + ")");
+ if (val.length() == 0) {
+ opt = defaultValue;
+ } else {
+ opt = Integer.parseInt(val);
+ }
+ } catch (final NumberFormatException e) {
+ opt = -1;
+ }
+ } while (opt == -1);
+
+ return opt;
+ }
+
+ /**
+ * Gets a boolean from the System.in
+ *
+ * @param title
+ * for the command line
+ * @return boolean as selected by the user of the console app
+ */
+ public static boolean getBoolean(final String title, final boolean defaultValue) {
+ final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(),
+ Boolean.FALSE.toString() }, defaultValue ? 1 : 2);
+
+ return Boolean.valueOf(val);
+ }
+
+ /**
+ * Gets an BigDecimal from the System.in
+ *
+ * @param title
+ * for the command line
+ * @return int as entered by the user of the console app
+ */
+ public static BigDecimal getBigDecimal(final String title, final BigDecimal defaultValue) {
+ BigDecimal opt = null;
+
+ do {
+ try {
+ final String val = ConsoleMenu.getString(title + " (default:" + defaultValue + ")");
+ if (val.length() == 0) {
+ opt = defaultValue;
+ } else {
+ opt = new BigDecimal(val);
+ }
+ } catch (final NumberFormatException e) {
+ opt = null;
+ }
+ } while (opt == null && defaultValue != null);
+
+ return opt;
+ }
+
+ public static Date getDate(final String title, final Date defaultValue) {
+ final SimpleDateFormat fmt = new SimpleDateFormat("dd-MM-yyyy");
+ final String date = ConsoleMenu.getString(title + "(dd-MM-yyyy" + (defaultValue != null ? ", default:" + fmt.format(defaultValue) : "") + ")");
+ try {
+ if (date == null || date.length() == 0) {
+ return defaultValue;
+ }
+ return fmt.parse(date);
+ } catch (final ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static LocalDate getYMD(final String title, final LocalDate defaultValue) {
+ final Date dateStr = ConsoleMenu.getDate(title, (defaultValue != null ? defaultValue.toDateMidnight().toDate() : null));
+ if (dateStr != null) {
+ return new LocalDate(dateStr);
+ }
+ return null;
+ }
+
+ /**
+ * Gets a String from the System.in
+ *
+ * @param msg
+ * for the command line
+ * @return String as entered by the user of the console app
+ */
+ public static String getString(final String msg) {
+ ConsoleMenu.print(msg);
+
+ BufferedReader bufReader = null;
+ String opt = null;
+
+ try {
+ bufReader = new BufferedReader(new InputStreamReader(System.in));
+ opt = bufReader.readLine();
+ } catch (final IOException ex) {
+ ex.printStackTrace();
+ System.exit(1);
+ }
+
+ return opt;
+ }
+
+ /**
+ * Gets a String from the System.in
+ *
+ * @param msg
+ * for the command line
+ * @return String as entered by the user of the console app
+ */
+ public static String getString(final String msg, final String defaultVal) {
+ String s = getString(msg + "(default:" + defaultVal + "):");
+ if (StringUtils.isBlank(s)) {
+ s = defaultVal;
+ }
+
+ return s;
+ }
+
+ /**
+ * Generates a menu with a list of options and return the value selected.
+ *
+ * @param title
+ * for the command line
+ * @param optionNames
+ * name for each option
+ * @param optionValues
+ * value for each option
+ * @return String as selected by the user of the console app
+ */
+ public static String selectOne(final String title, final String[] optionNames, final String[] optionValues, final int defaultOption) {
+ if (optionNames.length != optionValues.length) {
+ throw new IllegalArgumentException("option names and values must have same length");
+ }
+
+ ConsoleMenu.println("Please chose " + title + " (default:" + defaultOption + ")");
+
+ for (int i = 0; i < optionNames.length; i++) {
+ ConsoleMenu.println(i + 1 + ") " + optionNames[i]);
+ }
+
+ int choice = 0;
+
+ do {
+ choice = ConsoleMenu.getInt("Your Choice 1-" + optionNames.length + ": ", defaultOption);
+ } while ((choice <= 0) || (choice > optionNames.length));
+
+ return optionValues[choice - 1];
+ }
+
+ /**
+ * @param prompt
+ * The prompt to display to the user.
+ * @return The password as entered by the user.
+ */
+ public static String getPassword(final String prompt) {
+ try {
+ // password holder
+ final StringBuffer password = new StringBuffer();
+ final PasswordHidingThread maskingthread = new PasswordHidingThread(prompt);
+ final Thread thread = new Thread(maskingthread);
+ thread.start();
+
+ // block until enter is pressed
+ while (true) {
+ char c = (char) System.in.read();
+
+ // assume enter pressed, stop masking
+ maskingthread.stopMasking();
+
+ if (c == '\r') {
+ c = (char) System.in.read();
+
+ if (c == '\n') {
+ break;
+ }
+ continue;
+ } else if (c == '\n') {
+ break;
+ } else {
+ // store the password
+ password.append(c);
+ }
+ }
+
+ return password.toString();
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ // ~ Inner Classes
+ // --------------------------------------------------------------------------------------------------
+
+ /**
+ * This class attempts to erase characters echoed to the console.
+ */
+ static class PasswordHidingThread extends Thread {
+ private boolean stop = false;
+
+ private final String prompt;
+
+ /**
+ * @param prompt
+ * The prompt displayed to the user
+ */
+ public PasswordHidingThread(final String prompt) {
+ this.prompt = prompt;
+ }
+
+ /**
+ * Begin masking until asked to stop.
+ */
+ @Override
+ public void run() {
+ while (!stop) {
+ try {
+ // attempt masking at this rate
+ Thread.sleep(1);
+ } catch (final InterruptedException iex) {
+ iex.printStackTrace();
+ }
+
+ if (!stop) {
+ ConsoleMenu.print("\r" + prompt + " \r" + prompt);
+ }
+
+ System.out.flush();
+ }
+ }
+
+ /**
+ * Instruct the thread to stop masking.
+ */
+ public void stopMasking() {
+ this.stop = true;
+ }
+ }
+
+ private static void println(final String txt) {
+ OUT.println(txt);
+ }
+
+ private static void print(final String txt) {
+ OUT.print(txt);
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/console/Repeater.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,7 @@
+package net.objectlab.kit.console;
+
+import java.lang.reflect.Method;
+
+public interface Repeater {
+ void repeat(Method target);
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/Average.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Average.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Average.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,46 @@
+package net.objectlab.kit.util;
+
+import java.math.BigDecimal;
+
+/**
+ * @author Benoit
+ *
+ */
+public final class Average {
+ private Sum sum = new Sum();
+ private int count = 0;
+
+ public Average() {
+ }
+
+ public Average(final BigDecimal start) {
+ sum = new Sum(start);
+ }
+
+ public Average(final int scale) {
+ BigDecimal bd = new BigDecimal(0);
+ sum = new Sum(bd.setScale(scale));
+ }
+
+ public void add(BigDecimal val) {
+ sum.add(val);
+ count++;
+ }
+
+ public BigDecimal getTotal() {
+ return sum.getTotal();
+ }
+
+ public int getDataPoints() {
+ return count;
+ }
+
+ public BigDecimal getAverage() {
+ return BigDecimalUtil.divide(getTotal(), new BigDecimal(count), BigDecimal.ROUND_HALF_UP);
+ }
+
+ @Override
+ public String toString() {
+ return StringUtil.concatWithSpaces("Total:", getTotal(), "Points", getDataPoints(), "Avg:", getAverage());
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,649 @@
+package net.objectlab.kit.util;
+
+import java.math.BigDecimal;
+import java.text.NumberFormat;
+
+/**
+ * @author Benoit Xhenseval
+ *
+ */
+public final class BigDecimalUtil {
+ private static final double ROUNDING_UP_FLOAT = 0.5d;
+ private static final int MAX_SCALE_FOR_INVERSE = 20;
+ private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance();
+
+ private BigDecimalUtil() {
+ }
+
+ /**
+ * Return the inverse of value, using scale
+ */
+ public static BigDecimal inverse(final BigDecimal value, final int scale) {
+ if (isNotZero(value)) {
+ return BigDecimal.ONE.divide(value, scale, BigDecimal.ROUND_HALF_UP);
+ }
+ return null;
+ }
+
+ /**
+ * Return the inverse of value
+ */
+ public static BigDecimal inverse(final BigDecimal value) {
+ if (isNotZero(value)) {
+ return BigDecimal.ONE.setScale(MAX_SCALE_FOR_INVERSE).divide(value, BigDecimal.ROUND_HALF_UP);
+ }
+ return null;
+ }
+
+ /**
+ * @return true if value !=null and <> 0.
+ */
+ public static boolean isNotZero(final BigDecimal value) {
+ return value != null && value.signum() != 0;
+ }
+
+ /**
+ * @return true if value !=null and 0.
+ */
+ public static boolean isZero(final BigDecimal value) {
+ return value != null && value.signum() == 0;
+ }
+
+ /**
+ * @return true if value !=null and <0.
+ */
+ public static boolean isNegative(final BigDecimal value) {
+ return value != null && value.signum() == -1;
+ }
+
+ /**
+ * @return true if value !=null and >0.
+ */
+ public static boolean isStrictlyPositive(final BigDecimal value) {
+ return value != null && value.signum() == 1;
+ }
+
+ /**
+ * @return true if value ==null OR 0.
+ */
+ public static boolean isNullOrZero(final BigDecimal value) {
+ return value == null || value.signum() == 0;
+ }
+
+ /**
+ * @return true if val1 == val2 (ignoring scale and null are treated as 0)
+ */
+ public static boolean isSameValue(final BigDecimal val1, final BigDecimal val2) {
+ return val1 == null && val2 == null || val1 != null && val2 != null && val1.compareTo(val2) == 0;
+ }
+
+ /**
+ * @return true if val1 == val2 (ignoring scale and null are treated as 0)
+ */
+ public static boolean isSameValueTreatNullAsZero(final BigDecimal val1, final BigDecimal val2) {
+ return val1 == null && val2 == null || signum(val1) == 0 && signum(val2) == 0 || val1 != null && val2 != null && val1.compareTo(val2) == 0;
+ }
+
+ /**
+ * Add 2 BigDecimal safely (i.e. handles nulls)
+ */
+ public static BigDecimal add(final BigDecimal v1, final BigDecimal v2) {
+ BigDecimal total = v1;
+ if (v1 != null && v2 != null) {
+ total = v1.add(v2);
+ } else if (v2 != null) {
+ total = v2;
+ }
+ return total;
+ }
+
+ /**
+ * Add n BigDecimal safely (i.e. handles nulls)
+ */
+ public static BigDecimal add(final BigDecimal start, final BigDecimal... values) {
+ BigDecimal total = start;
+ for (final BigDecimal v : values) {
+ total = add(total, v);
+ }
+ return total;
+ }
+
+ /**
+ * Subtract n BigDecimal safely (i.e. handles nulls)
+ */
+ public static BigDecimal subtract(final BigDecimal start, final BigDecimal... values) {
+ BigDecimal total = start;
+ for (final BigDecimal v : values) {
+ total = subtract(total, v);
+ }
+ return total;
+ }
+
+ /**
+ * Subtract 2 BigDecimal safely (i.e. handles nulls) v1 - v2
+ */
+ public static BigDecimal subtract(final BigDecimal v1, final BigDecimal v2) {
+ BigDecimal diff = v1;
+ if (v1 != null && v2 != null) {
+ diff = v1.subtract(v2);
+ } else if (v2 != null) {
+ diff = v2.negate();
+ }
+ return diff;
+ }
+
+ /**
+ * @return numerator / denominator if they are not null and the denominator is not zero, it returns null otherwise.
+ */
+ public static BigDecimal divide(final BigDecimal numerator, final BigDecimal denominator, final int rounding) {
+ BigDecimal diff = null;
+ if (numerator != null && isNotZero(denominator)) {
+ diff = numerator.divide(denominator, rounding);
+ }
+ return diff;
+ }
+
+ public static BigDecimal calculateWeight(final BigDecimal value, final BigDecimal total) {
+ return BigDecimalUtil.setScale(BigDecimalUtil.divide(BigDecimalUtil.setScale(value, 9), BigDecimalUtil.setScale(total, 9),
+ BigDecimal.ROUND_HALF_UP), 9);
+ }
+
+ /**
+ * @return numerator / denominator if they are not null and the denominator is not zero, it returns null otherwise.
+ */
+ public static BigDecimal divide(final int numeratorScale, final BigDecimal numerator, final BigDecimal denominator, final int rounding) {
+ BigDecimal diff = null;
+ if (numerator != null && isNotZero(denominator)) {
+ diff = numerator.setScale(numeratorScale).divide(denominator, rounding);
+ }
+ return diff;
+ }
+
+ /**
+ * @return numerator / denominator if they are not null and the denominator is not zero, it returns null otherwise.
+ */
+ public static BigDecimal divide(final BigDecimal numerator, final BigDecimal denominator, final int scale, final int rounding) {
+ BigDecimal diff = null;
+ if (numerator != null && isNotZero(denominator)) {
+ diff = numerator.divide(denominator, rounding);
+ }
+ return BigDecimalUtil.setScale(diff, scale, rounding);
+ }
+
+ public static BigDecimal multiply(final BigDecimal value, final BigDecimal multiplicand) {
+ BigDecimal diff = null;
+ if (value != null && multiplicand != null) {
+ diff = value.multiply(multiplicand);
+ }
+ return diff;
+ }
+
+ public static BigDecimal multiply(final BigDecimal value, final BigDecimal... multiplicand) {
+ BigDecimal diff = null;
+ if (value != null && multiplicand != null) {
+ diff = value;
+ for (final BigDecimal bd : multiplicand) {
+ if (bd != null) {
+ diff = diff.multiply(bd);
+ }
+ }
+ }
+ return diff;
+ }
+
+ /**
+ * Returns the ABS of the value, handles null.
+ */
+ public static BigDecimal abs(final BigDecimal value) {
+ return value != null ? value.abs() : null;
+ }
+
+ /**
+ * Returns the negate of the value, handles null.
+ */
+ public static BigDecimal negate(final BigDecimal value) {
+ return value != null ? value.negate() : null;
+ }
+
+ /**
+ * Returns the negate of the value if condition is true, handles null.
+ */
+ public static BigDecimal negateIfTrue(final boolean condition, final BigDecimal value) {
+ return condition ? negate(value) : value;
+ }
+
+ /**
+ * @return false if the ABS value match!
+ */
+ public static boolean isNotSameAbsValue(final BigDecimal v1, final BigDecimal v2) {
+ return !isSameAbsValue(v1, v2);
+ }
+
+ /**
+ * @return false if the value match!
+ */
+ public static boolean isNotSameValue(final BigDecimal v1, final BigDecimal v2) {
+ return !isSameValue(v1, v2);
+ }
+
+ /**
+ * @return true if the ABS value match!
+ */
+ public static boolean isSameAbsValue(final BigDecimal v1, final BigDecimal v2) {
+ return isSameValue(abs(v1), abs(v2));
+ }
+
+ /**
+ * @return 1 if v1 > v2 or v2==null and v2!=null
+ * @return 0 if v1 == v2 or v1==null and v2==null
+ * @return -1 if v1 < v2 or v1==null and v2!=null
+ */
+ public static int compareTo(final BigDecimal v1, final BigDecimal v2) {
+ int ret = 1;
+ if (v1 != null && v2 != null) {
+ ret = v1.compareTo(v2);
+ } else if (v1 == null && v2 == null) {
+ ret = 0;
+ } else if (v1 == null) {
+ ret = -1;
+ }
+ return ret;
+ }
+
+ /**
+ * @return true if the ABS(v1) > ABS(v2)
+ */
+ public static int absCompareTo(final BigDecimal v1, final BigDecimal v2) {
+ return compareTo(abs(v1), abs(v2));
+ }
+
+ /**
+ * @return true if the ABS( ABS(v1) - ABS(v2) )
+ */
+ public static BigDecimal absDiff(final BigDecimal v1, final BigDecimal v2) {
+ return abs(subtract(abs(v1), abs(v2)));
+ }
+
+ /**
+ * Safe shift (check for null), shift RIGHT if shift>0.
+ */
+ public static BigDecimal movePoint(final BigDecimal v1, final int shift) {
+ return v1 == null ? null : v1.movePointRight(shift);
+ }
+
+ /**
+ * returns a new BigDecimal with correct scale after being round to n dec places.
+ *
+ * @param bd value
+ * @param numberOfDecPlaces number of dec place to round to
+ * @param finalScale final scale of result (typically numberOfDecPlaces < finalScale);
+ * @return new bd or null
+ */
+ public static BigDecimal roundTo(final BigDecimal bd, final int numberOfDecPlaces, final int finalScale) {
+ return setScale(setScale(bd, numberOfDecPlaces, BigDecimal.ROUND_HALF_UP), finalScale);
+ }
+
+ /**
+ * returns a new BigDecimal with correct scale.
+ *
+ * @param bd
+ * @return new bd or null
+ */
+ public static BigDecimal setScale(final BigDecimal bd, final int scale) {
+ return setScale(bd, scale, BigDecimal.ROUND_HALF_UP);
+ }
+
+ /**
+ * returns a new BigDecimal with correct Scale.
+ *
+ * @param bd
+ * @return new bd or null
+ */
+ public static BigDecimal setScale(final BigDecimal bd, final Integer scale) {
+ return setScale(bd, scale, BigDecimal.ROUND_HALF_UP);
+ }
+
+ /**
+ * returns a new BigDecimal with correct Scales.PERCENT_SCALE. This is used
+ * by the table renderer.
+ *
+ * @param bd
+ * @return new bd or null
+ */
+ public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) {
+ if (bd != null && scale != null) {
+ return bd.setScale(scale, rounding);
+ }
+ return null;
+ }
+
+ /**
+ * If value is null return 0 otherwise the signum().
+ * @param value
+ * @return
+ */
+ public static int signum(final BigDecimal value) {
+ return value == null ? 0 : value.signum();
+ }
+
+ /**
+ * @return true if both v1/v2 are null or same sign.
+ */
+ public static boolean isSameSignum(final BigDecimal v1, final BigDecimal v2) {
+ return signum(v1) == signum(v2);
+ }
+
+ /**
+ * @return true if both v1.signum() != v2.signum() and NOT zero.
+ */
+ public static boolean hasSignedFlippedAndNotZero(final BigDecimal v1, final BigDecimal v2) {
+ final int v1Sign = signum(v1);
+ final int v2Sign = signum(v2);
+ return v1Sign != v2Sign && v1Sign != 0 && v2Sign != 0;
+ }
+
+ /**
+ * @return true if v1.signum() != v2.signum().
+ */
+ public static boolean hasSignedChanged(final BigDecimal v1, final BigDecimal v2) {
+ return signum(v1) != signum(v2);
+ }
+
+ /**
+ * @param bd
+ * @param lowerLimit
+ * @param upperLimit
+ * @return true if outside the range
+ */
+ public static boolean isOutsideRange(final BigDecimal bd, final BigDecimal lowerLimit, final BigDecimal upperLimit) {
+ // TODO Auto-generated method stub
+ return !isInsideInclusiveRange(bd, lowerLimit, upperLimit);
+ }
+
+ /**
+ * @param bd
+ * @param lowerLimit
+ * @param upperLimit
+ * @return true if inside the inclusive range
+ */
+ public static boolean isInsideInclusiveRange(final BigDecimal bd, final BigDecimal lowerLimit, final BigDecimal upperLimit) {
+ return ObjectUtil.noneNull(bd, lowerLimit, upperLimit) && bd.compareTo(lowerLimit) >= 0 && bd.compareTo(upperLimit) <= 0;
+ }
+
+ /**
+ * @return o1 if not null, otherwise fallBack
+ */
+ public static BigDecimal assignNonNull(final BigDecimal o1, final BigDecimal fallBack) {
+ return o1 != null ? o1 : fallBack;
+ }
+
+ /**
+ * Calculate the weight of the constituent and add it to the running weighted value.
+ * runningWeightedVal + valueToAdd * weightForValueToAdd / totalWeight
+ * @param runningWeightedVal
+ * @param valueToAdd
+ * @param weightForValueToAdd
+ * @param totalWeight
+ * @return
+ */
+ public static BigDecimal addWeightedConstituent(final BigDecimal runningWeightedVal, final BigDecimal valueToAdd, final BigDecimal weightForValueToAdd,
+ final BigDecimal totalWeight) {
+ return BigDecimalUtil.add(runningWeightedVal, BigDecimalUtil.divide(BigDecimalUtil
+ .multiply(valueToAdd, BigDecimalUtil.abs(weightForValueToAdd)), BigDecimalUtil.abs(totalWeight), BigDecimal.ROUND_HALF_UP));
+ }
+
+ /**
+ * @return true if all values are either null or zero
+ */
+ public static boolean allNullOrZero(final BigDecimal... values) {
+ for (final BigDecimal bd : values) {
+ if (!isNullOrZero(bd)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * return a Number formatted or empty string if null.
+ * @param bd
+ */
+ public static String format(final BigDecimal bd) {
+ return bd != null ? NUMBER_FORMAT.format(bd) : "";
+ }
+
+ /**
+ * return a Number formatted or empty string if null.
+ * @param bd
+ */
+ public static String percentFormat(final BigDecimal bd) {
+ return bd != null ? NUMBER_FORMAT.format(bd.movePointRight(2)) : "";
+ }
+
+ /**
+ * true if ABS((startValue-newValue)/startValue) <= abs(thresholdPercent)
+ * @param startValue
+ * @param newValue
+ * @param thresholdPercent
+ * @return
+ */
+ public static boolean movedInsideThresholdPercentage(final BigDecimal startValue, final BigDecimal newValue, final BigDecimal thresholdPercent) {
+ return !movedStrictlyOutsideThresholdPercentage(startValue, newValue, thresholdPercent);
+ }
+
+ /**
+ * true if ABS((startValue-newValue)/startValue) > abs(thresholdPercent)
+ * @param startValue
+ * @param newValue
+ * @param thresholdPercent
+ * @return
+ */
+ public static boolean movedStrictlyOutsideThresholdPercentage(final BigDecimal startValue, final BigDecimal newValue, final BigDecimal thresholdPercent) {
+ final BigDecimal s = BigDecimalUtil.setScale(startValue, 10);
+ final BigDecimal n = BigDecimalUtil.setScale(newValue, 10);
+ final BigDecimal diff = BigDecimalUtil.divide(BigDecimalUtil.subtract(s, n), s, BigDecimal.ROUND_HALF_UP);
+ // diff = BigDecimalUtil.safeAbsDiff(diff, MagicNumbers.ONE);
+
+ return BigDecimalUtil.absCompareTo(diff, thresholdPercent) > 0;
+ }
+
+ private static double roundUp(final double n, final int p) {
+ double retval;
+
+ if (Double.isNaN(n) || Double.isInfinite(n)) {
+ retval = Double.NaN;
+ } else {
+ if (p != 0) {
+ final double temp = Math.pow(10, p);
+ final double nat = Math.abs(n * temp);
+
+ retval = sign(n) * (nat == (long) nat ? nat / temp : Math.round(nat + ROUNDING_UP_FLOAT) / temp);
+ } else {
+ final double na = Math.abs(n);
+ retval = sign(n) * (na == (long) na ? na : (long) na + 1);
+ }
+ }
+
+ return retval;
+ }
+
+ /**
+ * Returns a value rounded to p digits after decimal.
+ * If p is negative, then the number is rounded to
+ * places to the left of the decimal point. eg.
+ * 10.23 rounded to -1 will give: 10. If p is zero,
+ * the returned value is rounded to the nearest integral
+ * value.
+ * <p>If n is negative, the resulting value is obtained
+ * as the round-up value of absolute value of n multiplied
+ * by the sign value of n (@see MathX.sign(double d)).
+ * Thus, -0.8 rounded-down to p=0 will give 0 not -1.
+ * <p>If n is NaN, returned value is NaN.
+ * @param n
+ * @param p
+ * @return
+ */
+ private static double roundDown(final double n, final int p) {
+ double retval;
+
+ if (Double.isNaN(n) || Double.isInfinite(n)) {
+ retval = Double.NaN;
+ } else {
+ if (p != 0) {
+ final double temp = Math.pow(10, p);
+ retval = sign(n) * Math.round(Math.abs(n) * temp - ROUNDING_UP_FLOAT) / temp;
+ } else {
+ retval = (long) n;
+ }
+ }
+
+ return retval;
+ }
+
+ private static short sign(final double d) {
+ return (short) (d == 0 ? 0 : d < 0 ? -1 : 1);
+ }
+
+ /**
+ * Returns a value rounded-up to p digits after decimal.
+ * If p is negative, then the number is rounded to
+ * places to the left of the decimal point. eg.
+ * 10.23 rounded to -1 will give: 20. If p is zero,
+ * the returned value is rounded to the nearest integral
+ * value.
+ * <p>If n is negative, the resulting value is obtained
+ * as the round-up value of absolute value of n multiplied
+ * by the sign value of n (@see MathX.sign(double d)).
+ * Thus, -0.2 rounded-up to p=0 will give -1 not 0.
+ * <p>If n is NaN, returned value is NaN.
+ * @param n
+ * @param p
+ * @return
+ */
+ public static BigDecimal roundUp(final BigDecimal n, final int p) {
+ if (n == null) {
+ return null;
+ }
+ final int scale = n.scale();
+ return BigDecimalUtil.setScale(new BigDecimal(roundUp(n.doubleValue(), p)), scale);
+ }
+
+ /**
+ * Returns a value rounded to p digits after decimal.
+ * If p is negative, then the number is rounded to
+ * places to the left of the decimal point. eg.
+ * 10.23 rounded to -1 will give: 10. If p is zero,
+ * the returned value is rounded to the nearest integral
+ * value.
+ * <p>If n is negative, the resulting value is obtained
+ * as the round-up value of absolute value of n multiplied
+ * by the sign value of n (@see MathX.sign(double d)).
+ * Thus, -0.8 rounded-down to p=0 will give 0 not -1.
+ * <p>If n is NaN, returned value is NaN.
+ * @param n
+ * @param p
+ * @return
+ */
+ public static BigDecimal roundDown(final BigDecimal n, final int p) {
+ if (n == null) {
+ return null;
+ }
+ final int scale = n.scale();
+ return BigDecimalUtil.setScale(new BigDecimal(roundDown(n.doubleValue(), p)), scale);
+ }
+
+ public static BigDecimal roundUpForIncrement(final BigDecimal n, final BigDecimal increment) {
+ if (n == null) {
+ return null;
+ }
+ final int scale = n.scale();
+ final int p = (int) (increment != null ? -Math.log10(increment.abs().doubleValue()) : 0);
+ return BigDecimalUtil.setScale(new BigDecimal(roundUp(n.doubleValue(), p)), scale);
+ }
+
+ public static BigDecimal roundDownForIncrement(final BigDecimal n, final BigDecimal increment) {
+ if (n == null) {
+ return null;
+ }
+ final int p = (int) (increment != null ? -Math.log10(increment.abs().doubleValue()) : 0);
+ final int scale = n.scale();
+ return BigDecimalUtil.setScale(new BigDecimal(roundDown(n.doubleValue(), p)), scale);
+ }
+
+ /**
+ * Return minimum if the value is < minimum.
+ */
+ public static BigDecimal ensureMin(final BigDecimal minimum, final BigDecimal value) {
+ return BigDecimalUtil.compareTo(minimum, value) == 1 ? minimum : value;
+ }
+
+ /**
+ * Return a negative amount based on amount.
+ */
+ public static BigDecimal forceNegative(final BigDecimal amount) {
+ return BigDecimalUtil.negate(BigDecimalUtil.abs(amount));
+ }
+
+ /**
+ * Return a negative amount based on amount if true, otherwise return the ABS.
+ */
+ public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
+ return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
+ }
+
+ /**
+ * @return return the min amount
+ */
+ public static BigDecimal min(final BigDecimal v1, final BigDecimal v2) {
+ if (v1 == null) {
+ return v2;
+ } else if (v2 == null) {
+ return v1;
+ }
+ return v1.compareTo(v2) <= 0 ? v1 : v2;
+ }
+
+ /**
+ * @return return the max amount
+ */
+ public static BigDecimal max(final BigDecimal... v1) {
+ if (v1 == null) {
+ return null;
+ }
+ BigDecimal max = null;
+ for (BigDecimal bd : v1) {
+ max = BigDecimalUtil.compareTo(max, bd) >= 0 ? max : bd;
+ }
+ return max;
+ }
+
+ /**
+ * Move by 2 DEC place to the left and take the long value, this
+ * takes care of values like 0.18 in fractions.
+ */
+ public static long longForFraction(final BigDecimal v) {
+ if (v == null) {
+ return 0L;
+ }
+ return BigDecimalUtil.movePoint(v, 2).longValue();
+ }
+
+ /**
+ * @return true if abs(abs(v1)-abs(v2)) < abs(threshold)
+ */
+ public static boolean isDiffMoreThanAbsThreshold(final BigDecimal v1, final BigDecimal v2, final BigDecimal threshold) {
+ final BigDecimal diff = BigDecimalUtil.absDiff(v1, v2);
+ return BigDecimalUtil.compareTo(diff, BigDecimalUtil.abs(threshold)) > 0;
+ }
+
+ public static double doubleValue(final BigDecimal val) {
+ return val != null ? val.doubleValue() : 0.0;
+ }
+
+ /**
+ * @return true if value !=null and <=0.
+ */
+ public static boolean isZeroOrLess(BigDecimal value) {
+ return value != null && value.signum() <= 0;
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/BooleanUtil.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,29 @@
+package net.objectlab.kit.util;
+
+public final class BooleanUtil {
+ private BooleanUtil() {
+ }
+
+ public static boolean isTrueOrNull(final Boolean b) {
+ return b == null ? true : b;
+ }
+
+ public static boolean isFalseOrNull(final Boolean b) {
+ return b == null ? true : !b;
+ }
+
+ public static boolean isTrue(final Boolean b) {
+ return b == null ? false : b;
+ }
+
+ /**
+ * @return true if string is Y,y,YES,yes,TRUE,true,T,t
+ */
+ public static boolean isTrue(final String str) {
+ return str == null ? false : StringUtil.equalsAnyIgnoreCase(str, "yes", "y", "TRUE", "t");
+ }
+
+ public static boolean isFalse(final Boolean b) {
+ return b == null ? true : !b;
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/CaseTreatment.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,5 @@
+package net.objectlab.kit.util;
+
+public enum CaseTreatment {
+ UPPER_CASE, LOWER_CASE, UNCHANGED
+}
\ No newline at end of file
Added: trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/CollectionUtil.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,92 @@
+package net.objectlab.kit.util;
+
+import java.util.Collection;
+
+/**
+ * @author Benoit Xhenseval
+ *
+ */
+public final class CollectionUtil {
+ private CollectionUtil() {
+ }
+
+ /**
+ * @return true if collection null or empty.
+ */
+ public static boolean isEmpty(final Collection<?> col) {
+ return col == null || col.isEmpty();
+ }
+
+ /**
+ * @return true if collection not empty (null safe).
+ */
+ public static boolean isNotEmpty(final Collection<?> col) {
+ return col != null && !col.isEmpty();
+ }
+
+ /**
+ * @return true if collection has only 1 item (null safe).
+ */
+ public static boolean hasOneItem(final Collection<?> col) {
+ return col != null && col.size() == 1;
+ }
+
+ /**
+ * @return true if array not empty (null safe).
+ */
+ public static boolean isNotEmpty(final Object[] array) {
+ return array != null && array.length > 0;
+ }
+
+ /**
+ * @return size of collection if not null, otherwise 0.
+ */
+ public static int size(final Collection<?> col) {
+ return col != null ? col.size() : 0;
+ }
+
+ /**
+ * @return true if collection is not null and contains the items
+ */
+ public static boolean contains(final Collection<?> collection, final Object item) {
+ return collection != null && collection.contains(item) ? true : false;
+ }
+
+ /**
+ * @return true if collection is not null and contains the items
+ */
+ public static boolean containsAny(final Collection<?> collection, final Object... items) {
+ if (collection != null) {
+ for (Object item : items) {
+ boolean b = collection.contains(item);
+ if (b) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return true if none of the collections are empty or null
+ */
+ public static boolean noneEmpty(final Collection... collections) {
+ for (final Collection col : collections) {
+ if (isEmpty(col)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean sameContent(final Collection c1, final Collection c2) {
+ boolean same = c1 != null && c2 != null || c1 == c2 || c1 == null && c2 == null;
+ if (same && c1 != null) {
+ same = c1.size() == c2.size();
+ if (same) {
+ same = c1.equals(c2);
+ }
+ }
+ return same;
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/IntegerUtil.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,91 @@
+package net.objectlab.kit.util;
+
+/**
+ * @author Benoit Xhenseval
+ *
+ */
+public final class IntegerUtil {
+ private IntegerUtil() {
+ }
+
+ /**
+ * @return true if value !=null and <> 0.
+ */
+ public static boolean isNotZero(final Integer value) {
+ return value != null && value.intValue() != 0;
+ }
+
+ /**
+ * @return true if value !=null and 0.
+ */
+ public static boolean isZero(final Integer value) {
+ return value != null && value.intValue() == 0;
+ }
+
+ /**
+ * @return true if value ==null OR 0.
+ */
+ public static boolean isNullOrZero(final Integer value) {
+ return value == null || value.intValue() == 0;
+ }
+
+ /**
+ * @return true if val1 == val2 (ignoring scale)
+ */
+ public static boolean isSameValue(final Integer val1, final Integer val2) {
+ return val1 == null && val2 == null || val1 != null && val2 != null && val1.compareTo(val2) == 0;
+ }
+
+ /**
+ * @return true if val1 != val2 (ignoring scale)
+ */
+ public static boolean isNotSameValue(final Integer val1, final Integer val2) {
+ return !isSameValue(val1, val2);
+ }
+
+ /**
+ * Add 2 BigDecimal safely (i.e. handles nulls)
+ */
+ public static Integer safeAdd(final Integer v1, final Integer v2) {
+ Integer total = v1;
+ if (v1 != null && v2 != null) {
+ total = v1 + v2;
+ } else if (v2 != null) {
+ total = v2;
+ }
+ return total;
+ }
+
+ public static int safeSignum(final Integer v) {
+ if (v != null) {
+ return v.intValue() > 0 ? 1 : v.intValue() < 0 ? -1 : 0;
+ }
+ return 0;
+ }
+
+ public static int safeCompare(final Integer id, final Integer id2) {
+ int ret = -1;
+ if (id != null && id2 != null) {
+ ret = id.compareTo(id2);
+ } else if (id == null && id2 == null) {
+ ret = 0;
+ } else if (id != null) {
+ ret = 1;
+ }
+ return ret;
+ }
+
+ /**
+ * Return the value unless it is null, in which case it returns the default value.
+ * @param value
+ * @param defaultValueIfNull
+ * @return
+ */
+ public static Integer assign(final Integer value, final Integer defaultValueIfNull) {
+ return value != null ? value : defaultValueIfNull;
+ }
+
+ public static boolean isNotZeroOrNegative(final Integer id) {
+ return id != null && id.intValue() > 0;
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/ObjectHolder.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,24 @@
+package net.objectlab.kit.util;
+
+/**
+ * @author Benoit Xhenseval
+ *
+ */
+public class ObjectHolder<T> {
+ private T value;
+
+ public ObjectHolder() {
+ }
+
+ public ObjectHolder(final T value) {
+ this.value = value;
+ }
+
+ public T getValue() {
+ return value;
+ }
+
+ public void setValue(final T value) {
+ this.value = value;
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,133 @@
+package net.objectlab.kit.util;
+
+import java.math.BigDecimal;
+
+public final class ObjectUtil {
+ private ObjectUtil() {
+ }
+
+ /**
+ * Return true if i1 equals (according to {@link Integer#equals(Object)}) 12.
+ * Also returns true if 11 is null and 12 is null! Is safe on either 11 or 12 being null.
+ */
+ public static boolean equals(final Integer i1, final Integer i2) {
+ if (i1 == null) {
+ return i2 == null;
+ }
+ return i1.equals(i2);
+ }
+
+ /**
+ * Return true if bd1 has the same value (according to
+ * {@link BigDecimalUtil#isSameValue(BigDecimal, BigDecimal)}, which takes care of different scales)
+ * as bd2.
+ * Also returns true if bd1 is null and bd2 is null! Is safe on either bd1 or bd2 being null.
+ */
+ public static boolean equals(final BigDecimal bd1, final BigDecimal bd2) {
+ if (bd1 == null) {
+ return bd2 == null;
+ }
+ return BigDecimalUtil.isSameValue(bd1, bd2);
+ }
+
+ /**
+ * Return true if o1 equals (according to {@link Object#equals(Object)}) o2.
+ * Also returns true if o1 is null and o2 is null! Is safe on either o1 or o2 being null.
+ */
+ public static boolean equals(final Object o1, final Object o2) {
+ if (o1 == null) {
+ return o2 == null;
+ }
+ return o1.equals(o2);
+ }
+
+ /**
+ * Return true if o1 equals (according to {@link Object#equals(Object)} any of the given objects.
+ * Also returns true if o1 is null and any of the given objects is null as well!
+ */
+ public static boolean equalsAny(final Object o1, final Object... o2s) {
+ for (final Object o2 : o2s) {
+ if (o1 == null) {
+ if (o2 == null) {
+ return true;
+ }
+ continue;
+ }
+ // o1 != null
+ if (o1.equals(o2)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return true if o1 equals (according to {@link Object#equals(Object)} ALL of the given objects.
+ */
+ public static boolean equalsAll(final Object o1, final Object... o2s) {
+ for (final Object o2 : o2s) {
+ if (o1 == null) {
+ if (o2 != null) {
+ return false;
+ }
+ continue;
+ }
+ // o1 != null
+ if (!o1.equals(o2)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Return true if o1 does NOT equal (according to {@link Object#equals(Object)} any of the given objects.
+ * Also returns false if o1 is null and any of the given objects is null as well!
+ */
+ public static boolean notEqualsAny(final Object o1, final Object... o2s) {
+ return !equalsAny(o1, o2s);
+ }
+
+ /**
+ * Return true if any of the given objects are null.
+ */
+ public static boolean anyNull(final Object... o1s) {
+ for (final Object o1 : o1s) {
+ if (o1 == null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return true if ALL of the given objects are null.
+ */
+ public static boolean allNull(final Object... o1s) {
+ for (final Object o1 : o1s) {
+ if (o1 != null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Return true if at least one of the given objects is not null.
+ */
+ public static boolean atLeastOneNotNull(final Object... o1s) {
+ for (final Object o1 : o1s) {
+ if (o1 != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return true if NONE of the given objects are null.
+ */
+ public static boolean noneNull(final Object... o1s) {
+ return !anyNull(o1s);
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Pair.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,84 @@
+package net.objectlab.kit.util;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.StandardToStringStyle;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class Pair<E1, E2> implements Serializable {
+
+ private static final int MULTIPLIER = 31;
+ private static final long serialVersionUID = 1L;
+ private E1 element1;
+ private E2 element2;
+
+ public static <E1, E2> Pair<E1, E2> create(final E1 element1, final E2 element2) {
+ return new Pair<E1, E2>(element1, element2);
+ }
+
+ public Pair(final E1 element1, final E2 element2) {
+ this.element1 = element1;
+ this.element2 = element2;
+ }
+
+ public Pair() {
+ }
+
+ public E1 getElement1() {
+ return element1;
+ }
+
+ public E2 getElement2() {
+ return element2;
+ }
+
+ public void setElement1(final E1 element1) {
+ this.element1 = element1;
+ }
+
+ public void setElement2(final E2 element2) {
+ this.element2 = element2;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = MULTIPLIER * result + ((element1 == null) ? 0 : element1.hashCode());
+ result = MULTIPLIER * result + ((element2 == null) ? 0 : element2.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Pair other = (Pair) obj;
+ if (element1 == null) {
+ if (other.element1 != null) {
+ return false;
+ }
+ } else if (!element1.equals(other.element1)) {
+ return false;
+ }
+ if (element2 == null) {
+ if (other.element2 != null) {
+ return false;
+ }
+ } else if (!element2.equals(other.element2)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, new StandardToStringStyle());
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/Quadruplet.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,90 @@
+package net.objectlab.kit.util;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.StandardToStringStyle;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * @author xhensevalb
+ *
+ */
+public class Quadruplet<E1, E2, E3, E4> implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final int HASH_INITIAL_VAL = 17;
+ private static final int MULTIPLIER = 31;
+ private E1 element1;
+ private E2 element2;
+ private E3 element3;
+ private E4 element4;
+
+ public E1 getElement1() {
+ return element1;
+ }
+
+ public static <E1, E2, E3, E4> Quadruplet<E1, E2, E3, E4> create(final E1 element1, final E2 element2, final E3 element3, final E4 element4) {
+ return new Quadruplet<E1, E2, E3, E4>(element1, element2, element3, element4);
+ }
+
+ public Quadruplet(final E1 element1, final E2 element2, final E3 element3, final E4 element4) {
+ super();
+ this.element1 = element1;
+ this.element2 = element2;
+ this.element3 = element3;
+ this.element4 = element4;
+ }
+
+ public void setElement1(final E1 element1) {
+ this.element1 = element1;
+ }
+
+ public E2 getElement2() {
+ return element2;
+ }
+
+ public void setElement2(final E2 element2) {
+ this.element2 = element2;
+ }
+
+ public E3 getElement3() {
+ return element3;
+ }
+
+ public void setElement3(final E3 element3) {
+ this.element3 = element3;
+ }
+
+ public E4 getElement4() {
+ return element4;
+ }
+
+ public void setElement4(final E4 element4) {
+ this.element4 = element4;
+ }
+
+ @Override
+ public boolean equals(final Object rhs) {
+ if (rhs == null) {
+ return false;
+ }
+ if (!(rhs instanceof Quadruplet)) {
+ return false;
+ }
+ final Quadruplet that = (Quadruplet) rhs;
+
+ return new EqualsBuilder().append(element1, that.element1).append(element2, that.element2).append(element3, that.element3).append(element4,
+ that.element4).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(HASH_INITIAL_VAL, MULTIPLIER).append(element1).append(element2).append(element3).append(element4).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, new StandardToStringStyle());
+ }
+}
Added: trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java
===================================================================
--- trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java (rev 0)
+++ trunk/utils/src/main/java/net/objectlab/kit/util/StringUtil.java 2010-03-26 21:09:11 UTC (rev 314)
@@ -0,0 +1,488 @@
+package net.objectlab.kit.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.StandardToStringStyle;
+
+/**
+ * @aut...
[truncated message content] |
|
From: <be...@us...> - 2010-03-23 21:36:37
|
Revision: 313
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=313&view=rev
Author: benoitx
Date: 2010-03-23 21:36:31 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
Increased height to 69
Modified Paths:
--------------
trunk/src/site/resources/images/objectlab_logo.gif
Modified: trunk/src/site/resources/images/objectlab_logo.gif
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-23 21:09:16
|
Revision: 312
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=312&view=rev
Author: marchy
Date: 2010-03-23 21:09:10 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
Updated changes.xml with bugfix.
Modified Paths:
--------------
trunk/src/changes/changes.xml
Modified: trunk/src/changes/changes.xml
===================================================================
--- trunk/src/changes/changes.xml 2010-03-23 21:08:11 UTC (rev 311)
+++ trunk/src/changes/changes.xml 2010-03-23 21:09:10 UTC (rev 312)
@@ -7,6 +7,7 @@
</properties>
<body>
<release version="1.2.0" date="in SVN" description="Maintenance">
+ <action dev="marchy" type="fix" issue="atid=872033&aid=2963607" due-to="Aldo Tamburini">Fixed DefaultHolidayCalendar when used with java.util.Date / java.util.Calendar holidays.</action>
<action dev="benoitx" type="fix">Removed the deprecated constructors that used to take Set of "Date", use the HolidayCalendar.</action>
<action dev="benoitx" type="fix">Removed the deprecated method DateCalculator.setNonWorkingDays and getNonWorkingDays.</action>
<action dev="benoitx" type="add" due-to="Neil Bartlett">The ObjectLab Kit is now an OSGi Bundle!</action>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-23 21:08:20
|
Revision: 311
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=311&view=rev
Author: marchy
Date: 2010-03-23 21:08:11 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
Removing unused imports.
Modified Paths:
--------------
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPerformanceDateCalculatorTest.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPerformanceDateCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPerformanceDateCalculatorTest.java 2010-03-23 21:03:32 UTC (rev 310)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPerformanceDateCalculatorTest.java 2010-03-23 21:08:11 UTC (rev 311)
@@ -35,8 +35,6 @@
import java.util.Map;
import java.util.TreeMap;
-import junit.framework.Assert;
-
public abstract class AbstractPerformanceDateCalculatorTest<E> extends AbstractDateTestCase<E> {
private static final int REPEAT = 100000;
private static final Map<String, String> RESULTS = new TreeMap<String, String>();
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2010-03-23 21:03:32 UTC (rev 310)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2010-03-23 21:08:11 UTC (rev 311)
@@ -34,7 +34,6 @@
import java.util.Calendar;
import java.util.Collections;
-import java.util.Set;
import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
import net.objectlab.kit.datecalc.common.DateCalculator;
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java 2010-03-23 21:03:32 UTC (rev 310)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java 2010-03-23 21:08:11 UTC (rev 311)
@@ -35,7 +35,6 @@
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
-import java.util.Set;
import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
import net.objectlab.kit.datecalc.common.DateCalculator;
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2010-03-23 21:03:32 UTC (rev 310)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2010-03-23 21:08:11 UTC (rev 311)
@@ -33,7 +33,6 @@
package net.objectlab.kit.datecalc.joda;
import java.util.Collections;
-import java.util.Set;
import net.objectlab.kit.datecalc.common.AbstractDateCalculator;
import net.objectlab.kit.datecalc.common.DateCalculator;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-23 21:03:44
|
Revision: 310
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=310&view=rev
Author: marchy
Date: 2010-03-23 21:03:32 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
Removed OSGI comments in pom's.
Modified Paths:
--------------
trunk/datecalc-common/pom.xml
trunk/datecalc-joda/pom.xml
Modified: trunk/datecalc-common/pom.xml
===================================================================
--- trunk/datecalc-common/pom.xml 2010-03-23 21:01:49 UTC (rev 309)
+++ trunk/datecalc-common/pom.xml 2010-03-23 21:03:32 UTC (rev 310)
@@ -9,7 +9,7 @@
</parent>
<artifactId>datecalc-common</artifactId>
- <packaging>bundle</packaging> <!-- (1) OSGi -->
+ <packaging>bundle</packaging>
<name>DateCalc Commons</name>
<description>Common Date Calculator Code</description>
Modified: trunk/datecalc-joda/pom.xml
===================================================================
--- trunk/datecalc-joda/pom.xml 2010-03-23 21:01:49 UTC (rev 309)
+++ trunk/datecalc-joda/pom.xml 2010-03-23 21:03:32 UTC (rev 310)
@@ -59,7 +59,7 @@
</executions>
</plugin>
- <plugin> <!-- (2) OSGi START -->
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
@@ -70,12 +70,9 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${pom.version}</Bundle-Version>
<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
-
- <!--<Private-Package>com.my.company.*</Private-Package>-->
- <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
</instructions>
</configuration>
- </plugin> <!-- (2) END -->
+ </plugin>
</plugins>
</build>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-23 21:02:00
|
Revision: 309
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=309&view=rev
Author: marchy
Date: 2010-03-23 21:01:49 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
Getting rid of some eclipse warnings.
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2010-03-20 21:49:12 UTC (rev 308)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2010-03-23 21:01:49 UTC (rev 309)
@@ -38,7 +38,6 @@
import static net.objectlab.kit.datecalc.common.HolidayHandlerType.MODIFIED_PRECEDING;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -85,6 +84,7 @@
this.holidayHandler = holidayHandler;
}
+ @SuppressWarnings("unchecked")
public void setHolidayCalendar(final HolidayCalendar<E> calendar) {
if (calendar != null) {
if (calendar instanceof ImmutableHolidayCalendar) {
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2010-03-20 21:49:12 UTC (rev 308)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2010-03-23 21:01:49 UTC (rev 309)
@@ -33,7 +33,6 @@
package net.objectlab.kit.datecalc.common;
import java.util.List;
-import java.util.Set;
/**
* A DateCalculator is a lightweight container with an optional reference to a
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-20 21:49:21
|
Revision: 308
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=308&view=rev
Author: marchy
Date: 2010-03-20 21:49:12 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
Added property for activating profile when release:perform is run
Modified Paths:
--------------
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-19 19:47:27 UTC (rev 307)
+++ trunk/pom.xml 2010-03-20 21:49:12 UTC (rev 308)
@@ -148,7 +148,10 @@
<profile>
<id>code-sign</id>
<activation>
- <activeByDefault>false</activeByDefault>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
</activation>
<build>
<plugins>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 19:47:34
|
Revision: 307
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=307&view=rev
Author: marchy
Date: 2010-03-19 19:47:27 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
Fixing eclipse auto-format f-up.
Modified Paths:
--------------
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java 2010-03-19 19:42:44 UTC (rev 306)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java 2010-03-19 19:47:27 UTC (rev 307)
@@ -41,9 +41,7 @@
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
- * @version $Revision$ $Date: 2006-10-11 13:53:07 +0100 (Wed, 11 Oct 2006)
- * $
- *
+ * @version $Revision$ $Date$
*/
public class JodaWorkingWeek extends WorkingWeek {
@@ -102,13 +100,16 @@
/*
* ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
*
- * Based in London, we are world leaders in the design and development of
- * bespoke applications for the securities financing markets.
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
*
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more about
- * us</a> ___ _ _ _ _ _ / _ \| |__ (_) ___ ___| |_| | __ _| |__ | | | | '_ \| |/
- * _ \/ __| __| | / _` | '_ \ | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/ |__/
- *
- * www.ObjectLab.co.uk
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 19:42:50
|
Revision: 306
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=306&view=rev
Author: marchy
Date: 2010-03-19 19:42:44 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
Removed commented out local vars.
Modified Paths:
--------------
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java 2010-03-19 18:16:54 UTC (rev 305)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java 2010-03-19 19:42:44 UTC (rev 306)
@@ -52,8 +52,6 @@
public int dayDiff(final LocalDate start, final LocalDate end, final PeriodCountBasis basis) {
int diff = 0;
- // int dayStart;
- // int dayEnd;
switch (basis) {
case CONV_30_360:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 18:17:02
|
Revision: 305
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=305&view=rev
Author: marchy
Date: 2010-03-19 18:16:54 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
Formatting pom's - using spaces for indentation.
Modified Paths:
--------------
trunk/datecalc-common/pom.xml
trunk/datecalc-jdk/pom.xml
trunk/datecalc-joda/pom.xml
trunk/pom.xml
Modified: trunk/datecalc-common/pom.xml
===================================================================
--- trunk/datecalc-common/pom.xml 2010-03-19 18:13:44 UTC (rev 304)
+++ trunk/datecalc-common/pom.xml 2010-03-19 18:16:54 UTC (rev 305)
@@ -1,96 +1,98 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>datecalc-common</artifactId>
- <packaging>bundle</packaging> <!-- (1) OSGi -->
+ <artifactId>datecalc-common</artifactId>
+ <packaging>bundle</packaging> <!-- (1) OSGi -->
- <name>DateCalc Commons</name>
- <description>Common Date Calculator Code</description>
+ <name>DateCalc Commons</name>
+ <description>Common Date Calculator Code</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
- <Private-Package />
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
+ <Private-Package />
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>config/maven_checks.xml</configLocation>
- </configuration>
- </plugin>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ </configuration>
+ </plugin>
- <!--
- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin> <plugin>
- <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> <source>1.5</source> </configuration>
- </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>1.5</targetJdk>
- <rulesets>
- <ruleset>/rulesets/basic.xml</ruleset>
- <ruleset>/rulesets/controversial.xml</ruleset>
- </rulesets>
- <linkXref>true</linkXref>
- <minimumTokens>100</minimumTokens>
- </configuration>
- </plugin>
- <!--
- <plugin> <artifactId>maven-changes-plugin</artifactId> <configuration>
- <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate> </configuration> </plugin> <plugin>
- <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin> <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
- </plugin>
- -->
- </plugins>
- </reporting>
+ <!--
+ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
+ <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> <source>1.5</source>
+ </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/controversial.xml</ruleset>
+ </rulesets>
+ <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens>
+ </configuration>
+ </plugin>
+ <!--
+ <plugin> <artifactId>maven-changes-plugin</artifactId> <configuration>
+ <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate> </configuration> </plugin>
+ <plugin> <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin> <groupId>net.sf</groupId>
+ <artifactId>stat-scm</artifactId> </plugin>
+ -->
+ </plugins>
+ </reporting>
</project>
\ No newline at end of file
Modified: trunk/datecalc-jdk/pom.xml
===================================================================
--- trunk/datecalc-jdk/pom.xml 2010-03-19 18:13:44 UTC (rev 304)
+++ trunk/datecalc-jdk/pom.xml 2010-03-19 18:16:54 UTC (rev 305)
@@ -1,166 +1,159 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>datecalc-jdk</artifactId>
- <packaging>bundle</packaging>
+ <artifactId>datecalc-jdk</artifactId>
+ <packaging>bundle</packaging>
- <name>Date Calculator for JDK</name>
- <description>Date Calculator methods for JDK</description>
+ <name>Date Calculator for JDK</name>
+ <description>Date Calculator methods for JDK</description>
- <dependencies>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- </dependency>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <!-- UNIT tests -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-test</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- <excludes>
- <exclude>**/perf/**</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <build>
+ <plugins>
+ <!-- UNIT tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/perf/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
- <Private-Package />
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
+ <Private-Package />
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <profiles>
- <profile>
- <id>perf-testing</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-perf</id>
- <!-- use it mvn integration-test -P integration-test -->
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <argLine>-Xms256m -Xmx1024m</argLine>
- <skip>false</skip>
- <includes>
- <include>**/perf/*Test.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>perf-testing</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-perf</id>
+ <!-- use it mvn integration-test -P integration-test -->
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <argLine>-Xms256m -Xmx1024m</argLine>
+ <skip>false</skip>
+ <includes>
+ <include>**/perf/*Test.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>config/maven_checks.xml</configLocation>
- </configuration>
- </plugin>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ </configuration>
+ </plugin>
- <!--
- <plugin> <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
- <plugin> <artifactId>maven-javadoc-plugin</artifactId>
- <configuration> <aggregate>true</aggregate> </configuration>
- </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>jxr-maven-plugin</artifactId> </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>1.5</targetJdk>
- <rulesets>
- <ruleset>/rulesets/basic.xml</ruleset>
- <ruleset>/rulesets/controversial.xml</ruleset>
- </rulesets>
- <linkXref>true</linkXref>
- <minimumTokens>100</minimumTokens>
- </configuration>
- </plugin>
- <!--
- <plugin> <artifactId>maven-changes-plugin</artifactId>
- <configuration>
- <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate>
- </configuration> </plugin> <plugin>
- <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin>
- <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
- </plugin>
- -->
- </plugins>
- </reporting>
+ <!--
+ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
+ <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> </configuration>
+ </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/controversial.xml</ruleset>
+ </rulesets>
+ <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens>
+ </configuration>
+ </plugin>
+ <!--
+ <plugin> <artifactId>maven-changes-plugin</artifactId> <configuration>
+ <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate> </configuration> </plugin>
+ <plugin> <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin> <groupId>net.sf</groupId>
+ <artifactId>stat-scm</artifactId> </plugin>
+ -->
+ </plugins>
+ </reporting>
</project>
\ No newline at end of file
Modified: trunk/datecalc-joda/pom.xml
===================================================================
--- trunk/datecalc-joda/pom.xml 2010-03-19 18:13:44 UTC (rev 304)
+++ trunk/datecalc-joda/pom.xml 2010-03-19 18:16:54 UTC (rev 305)
@@ -1,175 +1,168 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>datecalc-joda</artifactId>
- <packaging>bundle</packaging>
+ <artifactId>datecalc-joda</artifactId>
+ <packaging>bundle</packaging>
- <name>Date Calculator for Joda</name>
- <description>Date Calculator methods for Joda</description>
+ <name>Date Calculator for Joda</name>
+ <description>Date Calculator methods for Joda</description>
- <dependencies>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>1.6</version>
- </dependency>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <!-- UNIT tests -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-test</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- <excludes>
- <exclude>**/perf/**</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <build>
+ <plugins>
+ <!-- UNIT tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/perf/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin> <!-- (2) OSGi START -->
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
- <Private-Package />
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
+ <plugin> <!-- (2) OSGi START -->
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
+ <Private-Package />
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
- <!--<Private-Package>com.my.company.*</Private-Package>-->
- <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
- </instructions>
- </configuration>
- </plugin> <!-- (2) END -->
- </plugins>
- </build>
+ <!--<Private-Package>com.my.company.*</Private-Package>-->
+ <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
+ </instructions>
+ </configuration>
+ </plugin> <!-- (2) END -->
+ </plugins>
+ </build>
- <profiles>
- <profile>
- <id>perf-testing</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-perf</id>
- <!-- use it mvn integration-test -P integration-test -->
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <argLine>-Xms256m -Xmx1024m</argLine>
- <skip>false</skip>
- <includes>
- <include>**/perf/*Test.java</include>
- </includes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>perf-testing</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-perf</id>
+ <!-- use it mvn integration-test -P integration-test -->
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <argLine>-Xms256m -Xmx1024m</argLine>
+ <skip>false</skip>
+ <includes>
+ <include>**/perf/*Test.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>config/maven_checks.xml</configLocation>
- </configuration>
- </plugin>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ </configuration>
+ </plugin>
- <!--
- <plugin> <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
- <plugin> <artifactId>maven-javadoc-plugin</artifactId>
- <configuration> <aggregate>true</aggregate> </configuration>
- </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>jxr-maven-plugin</artifactId> </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>1.5</targetJdk>
- <rulesets>
- <ruleset>/rulesets/basic.xml</ruleset>
- <ruleset>/rulesets/controversial.xml</ruleset>
- </rulesets>
- <linkXref>true</linkXref>
- <minimumTokens>100</minimumTokens>
- </configuration>
- </plugin>
- <!--
- <plugin> <artifactId>maven-changes-plugin</artifactId>
- <configuration>
- <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate>
- </configuration> </plugin> <plugin>
- <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin>
- <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
- </plugin>
- -->
- </plugins>
- </reporting>
+ <!--
+ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
+ <plugin> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> </configuration>
+ </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/controversial.xml</ruleset>
+ </rulesets>
+ <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens>
+ </configuration>
+ </plugin>
+ <!--
+ <plugin> <artifactId>maven-changes-plugin</artifactId> <configuration>
+ <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate> </configuration> </plugin>
+ <plugin> <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin> <groupId>net.sf</groupId>
+ <artifactId>stat-scm</artifactId> </plugin>
+ -->
+ </plugins>
+ </reporting>
</project>
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-19 18:13:44 UTC (rev 304)
+++ trunk/pom.xml 2010-03-19 18:16:54 UTC (rev 305)
@@ -1,260 +1,251 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <packaging>pom</packaging>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
- <modules>
- <module>datecalc-common</module>
- <module>datecalc-jdk</module>
- <module>datecalc-joda</module>
- </modules>
+ <modules>
+ <module>datecalc-common</module>
+ <module>datecalc-jdk</module>
+ <module>datecalc-joda</module>
+ </modules>
- <name>ObjectLab Kit</name>
+ <name>ObjectLab Kit</name>
- <description>
+ <description>
ObjectLab Kit provides a generic Business Calendar for calculating dates given set(s) of holidays.
Why re-invent the wheel?
</description>
- <inceptionYear>2006</inceptionYear>
- <url>http://objectlabkit.sourceforge.net/</url>
+ <inceptionYear>2006</inceptionYear>
+ <url>http://objectlabkit.sourceforge.net/</url>
- <organization>
- <name>Appendium - Portfolio Financing Platform</name>
- <url>http://www.appendium.com/</url>
- </organization>
+ <organization>
+ <name>Appendium - Portfolio Financing Platform</name>
+ <url>http://www.appendium.com/</url>
+ </organization>
- <developers>
- <developer>
- <id>benoitx</id>
- <name>Benoit Xhenseval</name>
- <roles>
- <role>Team Leader</role>
- <role>Developer</role>
- </roles>
- <organization>Appendium Ltd</organization>
- <organizationUrl>http://www.appendium.com/</organizationUrl>
- <email>kit AT appendium DOT com</email>
- <timezone>+0</timezone>
- </developer>
- <developer>
- <id>marchy</id>
- <name>Marcin Jekot</name>
- <roles>
- <role>Developer</role>
- </roles>
- <organization>ObjectLab Ltd</organization>
- <organizationUrl>http://www.objectlab.co.uk/</organizationUrl>
- <email>marchy AT users DOT sourceforge DOT net</email>
- <timezone>+2</timezone>
- </developer>
- </developers>
+ <developers>
+ <developer>
+ <id>benoitx</id>
+ <name>Benoit Xhenseval</name>
+ <roles>
+ <role>Team Leader</role>
+ <role>Developer</role>
+ </roles>
+ <organization>Appendium Ltd</organization>
+ <organizationUrl>http://www.appendium.com/</organizationUrl>
+ <email>kit AT appendium DOT com</email>
+ <timezone>+0</timezone>
+ </developer>
+ <developer>
+ <id>marchy</id>
+ <name>Marcin Jekot</name>
+ <roles>
+ <role>Developer</role>
+ </roles>
+ <organization>ObjectLab Ltd</organization>
+ <organizationUrl>http://www.objectlab.co.uk/</organizationUrl>
+ <email>marchy AT users DOT sourceforge DOT net</email>
+ <timezone>+2</timezone>
+ </developer>
+ </developers>
- <licenses>
- <license>
- <name>The Apache Software License, Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
- <mailingLists>
- <mailingList>
- <name>News about ObjectLab's projects (Alerts online)</name>
- <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-news</subscribe>
- <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-news</unsubscribe>
- <post />
- <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-news</archive>
- </mailingList>
- <mailingList>
- <name>Kit Announcements</name>
- <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-announce</subscribe>
- <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-announce</unsubscribe>
- <post />
- <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-announce</archive>
- </mailingList>
- <mailingList>
- <name>Kit User</name>
- <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-user</subscribe>
- <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-user</unsubscribe>
- <post>obj...@li...</post>
- <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-user</archive>
- </mailingList>
- <mailingList>
- <name>Kit Developers (SVN checkins)</name>
- <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-svn</subscribe>
- <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-svn</unsubscribe>
- <post />
- <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-svn</archive>
- </mailingList>
- </mailingLists>
+ <mailingLists>
+ <mailingList>
+ <name>News about ObjectLab's projects (Alerts online)</name>
+ <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-news</subscribe>
+ <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-news</unsubscribe>
+ <post />
+ <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-news</archive>
+ </mailingList>
+ <mailingList>
+ <name>Kit Announcements</name>
+ <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-announce</subscribe>
+ <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-announce</unsubscribe>
+ <post />
+ <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-announce</archive>
+ </mailingList>
+ <mailingList>
+ <name>Kit User</name>
+ <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-user</subscribe>
+ <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-user</unsubscribe>
+ <post>obj...@li...</post>
+ <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-user</archive>
+ </mailingList>
+ <mailingList>
+ <name>Kit Developers (SVN checkins)</name>
+ <subscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-svn</subscribe>
+ <unsubscribe>http://lists.sourceforge.net/lists/listinfo/objectlabkit-svn</unsubscribe>
+ <post />
+ <archive>http://sourceforge.net/mailarchive/forum.php?forum=objectlabkit-svn</archive>
+ </mailingList>
+ </mailingLists>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junitperf</groupId>
- <artifactId>junitperf</artifactId>
- <version>1.8</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junitperf</groupId>
+ <artifactId>junitperf</artifactId>
+ <version>1.8</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- <version>${pom.version}</version>
- </dependency>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- <version>${pom.version}</version>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.0.0</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <profiles>
- <profile>
- <id>code-sign</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-gpg-plugin</artifactId>
- <executions>
- <execution>
- <id>sign-artifacts</id>
- <phase>verify</phase>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>code-sign</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
- <scm>
- <connection>scm:svn:https://objectlabkit.svn.sourceforge.net/svnroot/objectlabkit/trunk/</connection>
- <developerConnection>scm:svn:https://objectlabkit.svn.sourceforge.net/svnroot/objectlabkit/trunk/</developerConnection>
- <url>http://objectlabkit.svn.sourceforge.net/viewvc/objectlabkit/</url>
- </scm>
+ <scm>
+ <connection>scm:svn:https://objectlabkit.svn.sourceforge.net/svnroot/objectlabkit/trunk/</connection>
+ <developerConnection>scm:svn:https://objectlabkit.svn.sourceforge.net/svnroot/objectlabkit/trunk/</developerConnection>
+ <url>http://objectlabkit.svn.sourceforge.net/viewvc/objectlabkit/</url>
+ </scm>
- <issueManagement>
- <system>sourceforge.net</system>
- <url>http://sourceforge.net/tracker/?group_id=175139</url>
- </issueManagement>
+ <issueManagement>
+ <system>sourceforge.net</system>
+ <url>http://sourceforge.net/tracker/?group_id=175139</url>
+ </issueManagement>
- <distributionManagement>
- <repository>
- <id>sourceforge.net</id>
- <url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/m2-repo</url>
- </repository>
+ <distributionManagement>
+ <repository>
+ <id>sourceforge.net</id>
+ <url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/m2-repo</url>
+ </repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
- <site>
- <id>objectlabkit.sf.net</id>
- <url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/test</url>
- </site>
- </distributionManagement>
+ <site>
+ <id>objectlabkit.sf.net</id>
+ <url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/test</url>
+ </site>
+ </distributionManagement>
- <reporting>
- <plugins>
- <!--
- <plugin> <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId> <configuration>
- <configLocation>/common_build/checkstyle_checks.xml</configLocation>
- </configuration> </plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jxr-maven-plugin</artifactId> </plugin> <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId> </plugin> <plugin>
- <artifactId>maven-surefire-plugin</artifactId> </plugin> <plugin>
- <artifactId>maven-clover-plugin</artifactId> </plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId> </plugin> <plugin>
- <artifactId>maven-pmd-plugin</artifactId> <configuration>
- <targetJdk>1.5</targetJdk> <rulesets>
- <ruleset>/rulesets/basic.xml</ruleset>
- <ruleset>/rulesets/controversial.xml</ruleset> </rulesets>
- <linkXref>true</linkXref> <minimumTokens>100</minimumTokens>
- </configuration> </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <code>javadoc:aggregate</code>
- <source>1.5</source>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-changes-plugin</artifactId>
- <configuration>
- <issueLinkTemplatePerSystem>
- <default>%URL%/?func=detail&group_id=175139&%ISSUE%</default>
- </issueLinkTemplatePerSystem>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-changelog-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>dashboard-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>net.sf</groupId>
- <artifactId>stat-scm</artifactId>
- </plugin>
- </plugins>
- </reporting>
+ <reporting>
+ <plugins>
+ <!--
+ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <configuration>
+ <configLocation>/common_build/checkstyle_checks.xml</configLocation> </configuration> </plugin> <plugin>
+ <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin> <plugin>
+ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> </plugin> <plugin>
+ <artifactId>maven-surefire-plugin</artifactId> </plugin> <plugin> <artifactId>maven-clover-plugin</artifactId> </plugin>
+ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> </plugin> <plugin>
+ <artifactId>maven-pmd-plugin</artifactId> <configuration> <targetJdk>1.5</targetJdk> <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset> <ruleset>/rulesets/controversial.xml</ruleset> </rulesets> <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens> </configuration> </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <code>javadoc:aggregate</code>
+ <source>1.5</source>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-changes-plugin</artifactId>
+ <configuration>
+ <issueLinkTemplatePerSystem>
+ <default>%URL%/?func=detail&group_id=175139&%ISSUE%</default>
+ </issueLinkTemplatePerSystem>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-changelog-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dashboard-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>net.sf</groupId>
+ <artifactId>stat-scm</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 18:14:02
|
Revision: 304
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=304&view=rev
Author: marchy
Date: 2010-03-19 18:13:44 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
Adding sonatype-nexus-snapshots repository.
Modified Paths:
--------------
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-19 17:32:03 UTC (rev 303)
+++ trunk/pom.xml 2010-03-19 18:13:44 UTC (rev 304)
@@ -191,10 +191,11 @@
<id>sourceforge.net</id>
<url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/m2-repo</url>
</repository>
- <snapshotRepository>
- <id>sourceforge.net</id>
- <url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/m2-snapshot-repo</url>
- </snapshotRepository>
+ <snapshotRepository>
+ <id>sonatype-nexus-snapshots</id>
+ <name>Sonatype Nexus Snapshots</name>
+ <url>http://oss.sonatype.org/content/repositories/snapshots</url>
+ </snapshotRepository>
<site>
<id>objectlabkit.sf.net</id>
<url>scp://shell.sourceforge.net/home/groups/o/ob/objectlabkit/htdocs/test</url>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 17:32:29
|
Revision: 303
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=303&view=rev
Author: marchy
Date: 2010-03-19 17:32:03 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
Corrected my email address.
Modified Paths:
--------------
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-19 17:31:22 UTC (rev 302)
+++ trunk/pom.xml 2010-03-19 17:32:03 UTC (rev 303)
@@ -50,7 +50,7 @@
</roles>
<organization>ObjectLab Ltd</organization>
<organizationUrl>http://www.objectlab.co.uk/</organizationUrl>
- <email>marchy AT users DOT users DOT sourceforge DOT net</email>
+ <email>marchy AT users DOT sourceforge DOT net</email>
<timezone>+2</timezone>
</developer>
</developers>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 17:31:49
|
Revision: 302
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=302&view=rev
Author: marchy
Date: 2010-03-19 17:31:22 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
Cleanup - Removed OSGI comment
Modified Paths:
--------------
trunk/datecalc-jdk/pom.xml
Modified: trunk/datecalc-jdk/pom.xml
===================================================================
--- trunk/datecalc-jdk/pom.xml 2010-03-19 17:30:27 UTC (rev 301)
+++ trunk/datecalc-jdk/pom.xml 2010-03-19 17:31:22 UTC (rev 302)
@@ -54,7 +54,7 @@
</executions>
</plugin>
- <plugin> <!-- (2) OSGi START -->
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
@@ -65,12 +65,9 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${pom.version}</Bundle-Version>
<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
-
- <!--<Private-Package>com.my.company.*</Private-Package>-->
- <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
</instructions>
</configuration>
- </plugin> <!-- (2) END -->
+ </plugin>
</plugins>
</build>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2010-03-19 17:30:53
|
Revision: 301
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=301&view=rev
Author: marchy
Date: 2010-03-19 17:30:27 +0000 (Fri, 19 Mar 2010)
Log Message:
-----------
typo
Modified Paths:
--------------
trunk/src/site/site.xml
Modified: trunk/src/site/site.xml
===================================================================
--- trunk/src/site/site.xml 2010-03-18 20:09:14 UTC (rev 300)
+++ trunk/src/site/site.xml 2010-03-19 17:30:27 UTC (rev 301)
@@ -14,7 +14,7 @@
<poweredBy>
<logo name="Hosted on SourceForge.net" href="http://sourceforge.net"
img="http://sflogo.sourceforge.net/sflogo.php?group_id=175139&type=2"/>
- <logo name="Build with Maven 2" href="http://maven.apache.org/"
+ <logo name="Built with Maven 2" href="http://maven.apache.org/"
img="http://maven.apache.org/images/logos/maven-feather.png"/>
</poweredBy>
<skin>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-18 20:09:25
|
Revision: 300
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=300&view=rev
Author: benoitx
Date: 2010-03-18 20:09:14 +0000 (Thu, 18 Mar 2010)
Log Message:
-----------
Fixing a few Sonar issues as well as physically removing the deprecated methods and constructors...
next release is going to be clean!
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java
trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPeriodCountCalculatorTest.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarPeriodCountCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
trunk/src/changes/changes.xml
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -126,27 +126,6 @@
}
/**
- * @deprecated should use getHolidayCalendar
- */
- @Deprecated
- public Set<E> getNonWorkingDays() {
- return Collections.unmodifiableSet(holidayCalendar.getHolidays());
- }
-
- /**
- * @deprecated use the HolidayCalendar
- */
- @Deprecated
- public void setNonWorkingDays(final Set<E> holidays) {
- if (holidays == null) {
- final Set<E> col = Collections.emptySet();
- holidayCalendar = new DefaultHolidayCalendar<E>(col);
- } else {
- holidayCalendar = new DefaultHolidayCalendar<E>(holidays);
- }
- }
-
- /**
* move the current date by a given tenor, this means that if a date is
* either a 'weekend' or holiday, it will be skipped acording to the holiday
* handler and not count towards the number of days to move.
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -118,17 +118,6 @@
/**
* This is typically used at the construction of a DateCalculator to give a
- * reference to a set of holidays.
- *
- * @param holidays
- * the holiday (if null, an empty set will be put in place)
- * @deprecated should use setHolidayCalendar
- */
- @Deprecated
- void setNonWorkingDays(final Set<E> holidays);
-
- /**
- * This is typically used at the construction of a DateCalculator to give a
* reference to a Holiday Calendar, if not the case, the calculator will
* make an immutable copy of the HolidayCalendar.
*
@@ -147,15 +136,6 @@
// -----------------------------------------------------------------------
/**
- * Gives a immutable copy of the set of registered holidays.
- *
- * @return an immutable copy of the holiday set.
- * @deprecated use getHolidayCalendar, likely to be REMOVED next release.
- */
- @Deprecated
- Set<E> getNonWorkingDays();
-
- /**
* Returns an immutable version of the HolidayCalendar.
* @return a copy of the holiday calendar
* @since 1.1.0
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/PeriodCountBasis.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -96,19 +96,7 @@
* the day count fraction is equal to the number of days between the last
* payment date and the next date divided by 365.
*/
- ACT_365,
-
- /**
- * @deprecated this is not a common convention, and won't be included in future releases
- */
- @Deprecated
- ACT_UST,
-
- /**
- * @deprecated this is not a common convention, and won't be included in future releases
- */
- @Deprecated
- END_365
+ ACT_365
}
/*
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractDateCalculatorFactoryTest.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -161,18 +161,6 @@
}
}
- public void testSetHol() {
- final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
-
- Assert.assertNotNull("No algo", cal1);
- Assert.assertNotNull("No hol", cal1.getHolidayCalendar().getHolidays());
- Assert.assertTrue("empty hol", cal1.getHolidayCalendar().getHolidays().isEmpty());
-
- cal1.setNonWorkingDays(null);
- Assert.assertNotNull("empty", cal1.getHolidayCalendar().getHolidays());
- Assert.assertTrue("empty hol", cal1.getHolidayCalendar().getHolidays().isEmpty());
- }
-
public void testSetHolCal() {
final DateCalculator<E> cal1 = getDateCalculatorFactory().getDateCalculator("bla", null);
Modified: trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPeriodCountCalculatorTest.java
===================================================================
--- trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPeriodCountCalculatorTest.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-common/src/test/java/net/objectlab/kit/datecalc/common/AbstractPeriodCountCalculatorTest.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -435,28 +435,6 @@
runtests(ACT_ACT);
}
- public void testUnsupportedType() {
- Assert.assertNotNull(cal);
-
- final PeriodCountBasis pcount = PeriodCountBasis.ACT_UST;
- final E start = getDate();
- final E end = getDate();
-
- try {
- cal.yearDiff(start, end, pcount);
- Assert.fail("Should have refused the algo...");
- } catch (final UnsupportedOperationException e) {
- // ok
- }
-
- try {
- cal.monthDiff(start, end, pcount);
- Assert.fail("Should have refused the algo...");
- } catch (final UnsupportedOperationException e) {
- // ok
- }
- }
-
private void runtests(final String[][] tests) {
for (final String[] test : tests) {
runtest(cal, test);
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarDateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -62,19 +62,6 @@
this(null, null, new DefaultHolidayCalendar<Calendar>(Collections.EMPTY_SET), null);
}
- /**
- * @deprecated should use the constructor with HolidayCalendar.
- * @param name
- * @param startDate
- * @param nonWorkingDays
- * @param holidayHandler
- */
- @Deprecated
- public CalendarDateCalculator(final String name, final Calendar startDate, final Set<Calendar> nonWorkingDays,
- final HolidayHandler<Calendar> holidayHandler) {
- this(name, startDate, new DefaultHolidayCalendar<Calendar>(nonWorkingDays), holidayHandler);
- }
-
public CalendarDateCalculator(final String name, final Calendar startDate, final HolidayCalendar<Calendar> holidayCalendar,
final HolidayHandler<Calendar> holidayHandler) {
super(name, holidayCalendar, holidayHandler);
@@ -138,7 +125,7 @@
}
@Override
- protected Calendar getToday() {
+ protected final Calendar getToday() {
return Utils.blastTime(Calendar.getInstance());
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarIMMDateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -111,8 +111,14 @@
moveToIMMDay(cal);
+ cal = handlePeriod(requestNextIMM, period, cal);
+
+ return cal;
+ }
+
+ private Calendar handlePeriod(final boolean requestNextIMM, final IMMPeriod period, final Calendar givenCal) {
+ Calendar cal = givenCal;
final int month = cal.get(MONTH);
-
switch (period) {
case BI_ANNUALY_JUN_DEC:
if (month == MARCH || month == SEPTEMBER) {
@@ -139,7 +145,6 @@
cal = getNextIMMDate(requestNextIMM, cal, QUARTERLY);
break;
}
-
return cal;
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarModifiedFollowingHandler.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -69,9 +69,9 @@
//
// -----------------------------------------------------------------------
- protected Calendar move(final DateCalculator<Calendar> calculator, int step) {
+ protected Calendar move(final DateCalculator<Calendar> calculator, final int givenStep) {
final Calendar cal = (Calendar) calculator.getCurrentBusinessDate().clone();
-
+ int step = givenStep;
final int month = cal.get(Calendar.MONTH);
while (calculator.isNonWorkingDay(cal)) {
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarPeriodCountCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarPeriodCountCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/CalendarPeriodCountCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -53,58 +53,74 @@
public int dayDiff(final Calendar start, final Calendar end, final PeriodCountBasis basis) {
int diff = 0;
- int dayStart;
- int dayEnd;
-
+
switch (basis) {
case CONV_30_360:
- dayStart = start.get(Calendar.DAY_OF_MONTH);
- dayEnd = end.get(Calendar.DAY_OF_MONTH);
- if (dayEnd == MONTH_31_DAYS && dayStart >= MONTH_30_DAYS) {
- dayEnd = MONTH_30_DAYS;
- }
- if (dayStart == MONTH_31_DAYS) {
- dayStart = MONTH_30_DAYS;
- }
- diff = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * YEAR_360
- + (end.get(Calendar.MONTH) - start.get(Calendar.MONTH)) * MONTH_30_DAYS + dayEnd - dayStart;
+ diff = calculateConv30360(start, end);
break;
case CONV_360E_ISDA:
- dayStart = start.get(Calendar.DAY_OF_MONTH);
- dayEnd = end.get(Calendar.DAY_OF_MONTH);
- final int monthStart = start.get(Calendar.MONTH);
- if ((monthStart == 2 && start.getActualMaximum(Calendar.DAY_OF_MONTH) == dayStart) || dayEnd == MONTH_31_DAYS) {
- dayEnd = MONTH_30_DAYS;
- }
- if (dayStart == MONTH_31_DAYS) {
- dayStart = MONTH_30_DAYS;
- }
-
- diff = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * YEAR_360
- + (end.get(Calendar.MONTH) - start.get(Calendar.MONTH)) * MONTH_30_DAYS + dayEnd - dayStart;
+ diff = calculateConv360EIsda(start, end);
break;
case CONV_360E_ISMA:
- dayStart = start.get(Calendar.DAY_OF_MONTH);
- dayEnd = end.get(Calendar.DAY_OF_MONTH);
- if (dayEnd == MONTH_31_DAYS) {
- dayEnd = MONTH_30_DAYS;
- }
- if (dayStart == MONTH_31_DAYS) {
- dayStart = MONTH_30_DAYS;
- }
- diff = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * YEAR_360
- + (end.get(Calendar.MONTH) - start.get(Calendar.MONTH)) * MONTH_30_DAYS + dayEnd - dayStart;
+ diff = calculateConv360EIsma(start, end);
break;
-
+
default:
diff = dayDiff(start, end);
}
-
+
return diff;
}
+ private int calculateConv360EIsma(final Calendar start, final Calendar end) {
+ int diff;
+ int dayStart = start.get(Calendar.DAY_OF_MONTH);
+ int dayEnd = end.get(Calendar.DAY_OF_MONTH);
+ if (dayEnd == MONTH_31_DAYS) {
+ dayEnd = MONTH_30_DAYS;
+ }
+ if (dayStart == MONTH_31_DAYS) {
+ dayStart = MONTH_30_DAYS;
+ }
+ diff = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * YEAR_360 + (end.get(Calendar.MONTH) - start.get(Calendar.MONTH)) * MONTH_30_DAYS + dayEnd
+ - dayStart;
+ return diff;
+ }
+
+ private int calculateConv360EIsda(final Calendar start, final Calendar end) {
+ int diff;
+ int dayStart = start.get(Calendar.DAY_OF_MONTH);
+ int dayEnd = end.get(Calendar.DAY_OF_MONTH);
+ final int monthStart = start.get(Calendar.MONTH);
+ if ((monthStart == 2 && start.getActualMaximum(Calendar.DAY_OF_MONTH) == dayStart) || dayEnd == MONTH_31_DAYS) {
+ dayEnd = MONTH_30_DAYS;
+ }
+ if (dayStart == MONTH_31_DAYS) {
+ dayStart = MONTH_30_DAYS;
+ }
+
+ diff = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * YEAR_360 + (end.get(Calendar.MONTH) - start.get(Calendar.MONTH)) * MONTH_30_DAYS + dayEnd
+ - dayStart;
+ return diff;
+ }
+
+ private int calculateConv30360(final Calendar start, final Calendar end) {
+ int diff;
+ int dayStart = start.get(Calendar.DAY_OF_MONTH);
+ int dayEnd = end.get(Calendar.DAY_OF_MONTH);
+ if (dayEnd == MONTH_31_DAYS && dayStart >= MONTH_30_DAYS) {
+ dayEnd = MONTH_30_DAYS;
+ }
+ if (dayStart == MONTH_31_DAYS) {
+ dayStart = MONTH_30_DAYS;
+ }
+ diff = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * YEAR_360 + (end.get(Calendar.MONTH) - start.get(Calendar.MONTH)) * MONTH_30_DAYS + dayEnd
+ - dayStart;
+ return diff;
+ }
+
// -----------------------------------------------------------------------
//
// ObjectLab, world leaders in the design and development of bespoke
@@ -113,7 +129,7 @@
//
// -----------------------------------------------------------------------
- private int dayDiff(final Calendar start, final Calendar end) {
+ private int dayDiff(final Calendar start, final Calendar end) {
final long diff = Math.abs(start.getTimeInMillis() - end.getTimeInMillis());
final double dayDiff = ((double) diff) / MILLIS_IN_DAY;
return (int) Math.round(dayDiff);
@@ -125,7 +141,7 @@
public double yearDiff(final Calendar start, final Calendar end, final PeriodCountBasis basis) {
double diff = 0.0;
-
+
switch (basis) {
case ACT_ACT:
final int startYear = start.get(Calendar.YEAR);
@@ -152,14 +168,13 @@
break;
case ACT_365:
- case END_365:
diff = (dayDiff(start, end, basis)) / YEAR_365_0;
break;
-
+
default:
throw new UnsupportedOperationException("Sorry no ACT_UST yet");
}
-
+
return diff;
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateDateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -63,19 +63,6 @@
this(null, null, new DefaultHolidayCalendar<Date>(Collections.EMPTY_SET), null);
}
- /**
- * @deprecated should use the constructor with HolidayCalendar.
- * @param name
- * @param startDate
- * @param nonWorkingDays
- * @param holidayHandler
- */
- @Deprecated
- public DateDateCalculator(final String name, final Date startDate, final Set<Date> nonWorkingDays,
- final HolidayHandler<Date> holidayHandler) {
- this(name, startDate, new DefaultHolidayCalendar<Date>(nonWorkingDays), holidayHandler);
- }
-
public DateDateCalculator(final String name, final Date startDate, final HolidayCalendar<Date> holidayCalendar,
final HolidayHandler<Date> holidayHandler) {
super(name, holidayCalendar, holidayHandler);
@@ -130,7 +117,7 @@
}
@Override
- public void setStartDate(final Date startDate) {
+ public final void setStartDate(final Date startDate) {
if (delegate != null) {
delegate.setStartDate(startDate != null ? Utils.getCal(startDate) : null);
}
@@ -138,7 +125,7 @@
}
@Override
- protected Date getToday() {
+ protected final Date getToday() {
return Utils.blastTime(Calendar.getInstance()).getTime();
}
Modified: trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-jdk/src/main/java/net/objectlab/kit/datecalc/jdk/DateModifiedFollowingHandler.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -72,9 +72,9 @@
//
// -----------------------------------------------------------------------
- protected Date move(final DateCalculator<Date> calculator, int step) {
+ protected Date move(final DateCalculator<Date> calculator, final int givenStep) {
final Calendar cal = (Calendar) Utils.getCal(calculator.getCurrentBusinessDate()).clone();
-
+ int step = givenStep;
final int month = cal.get(Calendar.MONTH);
while (calculator.isNonWorkingDay(cal.getTime())) {
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -63,19 +63,6 @@
this(null, null, new DefaultHolidayCalendar<LocalDate>(Collections.EMPTY_SET), null);
}
- /**
- * @deprecated should use the constructor with HolidayCalendar.
- * @param name
- * @param startDate
- * @param nonWorkingDays
- * @param holidayHandler
- */
- @Deprecated
- public LocalDateCalculator(final String name, final LocalDate startDate, final Set<LocalDate> nonWorkingDays,
- final HolidayHandler<LocalDate> holidayHandler) {
- this(name, startDate, new DefaultHolidayCalendar<LocalDate>(nonWorkingDays), holidayHandler);
- }
-
public LocalDateCalculator(final String name, final LocalDate startDate, final HolidayCalendar<LocalDate> holidayCalendar,
final HolidayHandler<LocalDate> holidayHandler) {
super(name, holidayCalendar, holidayHandler);
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -151,7 +151,6 @@
break;
case ACT_365:
- case END_365:
diff = (dayDiff(start, end, basis)) / YEAR_365_0;
break;
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java 2010-03-18 20:09:14 UTC (rev 300)
@@ -65,21 +65,8 @@
this(null, null, new DefaultHolidayCalendar<YearMonthDay>(Collections.EMPTY_SET), null);
}
- /**
- * @deprecated should use the constructor with HolidayCalendar.
- * @param name
- * @param startDate
- * @param nonWorkingDays
- * @param holidayHandler
- */
- @Deprecated
- public YearMonthDayDateCalculator(final String name, final YearMonthDay startDate, final Set<YearMonthDay> nonWorkingDays,
+ public YearMonthDayDateCalculator(final String name, final YearMonthDay startDate, final HolidayCalendar<YearMonthDay> nonWorkingDays,
final HolidayHandler<YearMonthDay> holidayHandler) {
- this(name, startDate, new DefaultHolidayCalendar<YearMonthDay>(nonWorkingDays), holidayHandler);
- }
-
- public YearMonthDayDateCalculator(final String name, final YearMonthDay startDate,
- final HolidayCalendar<YearMonthDay> nonWorkingDays, final HolidayHandler<YearMonthDay> holidayHandler) {
super(name, nonWorkingDays, holidayHandler);
final Set<LocalDate> dates = new HashSet<LocalDate>();
@@ -89,8 +76,8 @@
final YearMonthDay early = nonWorkingDays.getEarlyBoundary();
final YearMonthDay late = nonWorkingDays.getLateBoundary();
- final DefaultHolidayCalendar<LocalDate> cal = new DefaultHolidayCalendar<LocalDate>(dates, early != null ? new LocalDate(
- early) : null, late != null ? new LocalDate(late) : null);
+ final DefaultHolidayCalendar<LocalDate> cal = new DefaultHolidayCalendar<LocalDate>(dates, early != null ? new LocalDate(early) : null,
+ late != null ? new LocalDate(late) : null);
final HolidayHandler<LocalDate> locDate = new HolidayHandlerYearMonthDayWrapper(holidayHandler, this);
@@ -130,8 +117,8 @@
}
@Override
- protected DateCalculator<YearMonthDay> createNewCalculator(final String name, final YearMonthDay startDate,
- final HolidayCalendar<YearMonthDay> holidays, final HolidayHandler<YearMonthDay> handler) {
+ protected DateCalculator<YearMonthDay> createNewCalculator(final String name, final YearMonthDay startDate, final HolidayCalendar<YearMonthDay> holidays,
+ final HolidayHandler<YearMonthDay> handler) {
return new YearMonthDayDateCalculator(name, startDate, holidays, handler);
}
Modified: trunk/src/changes/changes.xml
===================================================================
--- trunk/src/changes/changes.xml 2010-03-13 10:14:05 UTC (rev 299)
+++ trunk/src/changes/changes.xml 2010-03-18 20:09:14 UTC (rev 300)
@@ -7,6 +7,8 @@
</properties>
<body>
<release version="1.2.0" date="in SVN" description="Maintenance">
+ <action dev="benoitx" type="fix">Removed the deprecated constructors that used to take Set of "Date", use the HolidayCalendar.</action>
+ <action dev="benoitx" type="fix">Removed the deprecated method DateCalculator.setNonWorkingDays and getNonWorkingDays.</action>
<action dev="benoitx" type="add" due-to="Neil Bartlett">The ObjectLab Kit is now an OSGi Bundle!</action>
<action dev="benoitx" type="fix" issue="atid=872033&aid=1929838" due-to="Anthony Whitford">Spelling for "PRECEEDING" corrected to PRECEDING, deprecated the mispelt name.</action>
<action dev="benoitx" type="add">Enhanced the KitCalculatorsFactory to be able to get the holidayCalendar names and unregister calendars.</action>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-13 10:14:11
|
Revision: 299
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=299&view=rev
Author: benoitx
Date: 2010-03-13 10:14:05 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
A few more Sonar fixes...
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2010-03-13 00:49:41 UTC (rev 298)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
@@ -179,8 +179,11 @@
unit *= MONTHS_IN_YEAR;
}
+ return applyTenor(tenorCode, unit);
+ }
+
+ private DateCalculator<E> applyTenor(final TenorCode tenorCode, final int unit) {
DateCalculator<E> calc;
-
// move by tenor
switch (tenorCode) {
case OVERNIGHT:
@@ -205,7 +208,6 @@
default:
throw new UnsupportedOperationException("Sorry not yet...");
}
-
return calc;
}
@@ -241,11 +243,11 @@
* @since 1.1.0
*/
public List<E> calculateTenorDates(final List<Tenor> tenors, final int spotLag) {
- List<E> list = new ArrayList<E>();
+ final List<E> list = new ArrayList<E>();
if (tenors != null) {
final E date = clone(getCurrentBusinessDate());
- for (Tenor tenor : tenors) {
+ for (final Tenor tenor : tenors) {
moveByTenor(tenor, spotLag);
list.add(getCurrentBusinessDate());
setCurrentBusinessDate(date);
@@ -313,12 +315,7 @@
}
public DateCalculator<E> moveByBusinessDays(final int businessDays) {
- if (businessDays > 0 && holidayHandler != null && (holidayHandler.getType().equals(BACKWARD) || holidayHandler.getType().equals(MODIFIED_PRECEDING))) {
- throw new IllegalArgumentException("A " + MODIFIED_PRECEDING + " or " + BACKWARD + " does not allow positive steps for moveByBusinessDays");
- } else if (businessDays < 0 && holidayHandler != null
- && (holidayHandler.getType().equals(FORWARD) || holidayHandler.getType().equals(MODIFIED_FOLLOWING))) {
- throw new IllegalArgumentException("A " + MODIFIED_FOLLOWING + " or " + FORWARD + " does not allow negative steps for moveByBusinessDays");
- }
+ checkHolidayValidity(businessDays);
final int numberOfStepsLeft = Math.abs(businessDays);
final int step = (businessDays < 0 ? -1 : 1);
@@ -330,6 +327,15 @@
return this;
}
+ private void checkHolidayValidity(final int businessDays) {
+ if (businessDays > 0 && holidayHandler != null && (holidayHandler.getType().equals(BACKWARD) || holidayHandler.getType().equals(MODIFIED_PRECEDING))) {
+ throw new IllegalArgumentException("A " + MODIFIED_PRECEDING + " or " + BACKWARD + " does not allow positive steps for moveByBusinessDays");
+ } else if (businessDays < 0 && holidayHandler != null
+ && (holidayHandler.getType().equals(FORWARD) || holidayHandler.getType().equals(MODIFIED_FOLLOWING))) {
+ throw new IllegalArgumentException("A " + MODIFIED_FOLLOWING + " or " + FORWARD + " does not allow negative steps for moveByBusinessDays");
+ }
+ }
+
/**
* Allows DateCalculators to be combined into a new one, the startDate and
* currentBusinessDate will be the ones from the existing calendar (not the
@@ -347,10 +353,7 @@
return this;
}
- if (holidayHandler == null && calculator.getHolidayHandlerType() != null || holidayHandler != null
- && !holidayHandler.getType().equals(calculator.getHolidayHandlerType())) {
- throw new IllegalArgumentException("Combined Calendars cannot have different handler types");
- }
+ checkHolidayHandlerValidity(calculator);
final Set<E> newSet = new HashSet<E>();
if (holidayCalendar != null) {
@@ -358,16 +361,8 @@
}
final HolidayCalendar<E> calendarToCombine = calculator.getHolidayCalendar();
- if (calendarToCombine.getEarlyBoundary() != null && holidayCalendar.getEarlyBoundary() == null || calendarToCombine.getEarlyBoundary() == null
- && holidayCalendar.getEarlyBoundary() != null) {
- throw new IllegalArgumentException("Both Calendar to be combined must either have each Early boundaries or None.");
- }
+ checkBoundaries(calendarToCombine);
- if (calendarToCombine.getLateBoundary() != null && holidayCalendar.getLateBoundary() == null || calendarToCombine.getLateBoundary() == null
- && holidayCalendar.getLateBoundary() != null) {
- throw new IllegalArgumentException("Both Calendar to be combined must either have each Late boundaries or None.");
- }
-
if (calendarToCombine.getHolidays() != null) {
newSet.addAll(calendarToCombine.getHolidays());
}
@@ -380,6 +375,25 @@
return cal;
}
+ private void checkHolidayHandlerValidity(final DateCalculator<E> calculator) {
+ if (holidayHandler == null && calculator.getHolidayHandlerType() != null || holidayHandler != null
+ && !holidayHandler.getType().equals(calculator.getHolidayHandlerType())) {
+ throw new IllegalArgumentException("Combined Calendars cannot have different handler types");
+ }
+ }
+
+ private void checkBoundaries(final HolidayCalendar<E> calendarToCombine) {
+ if (calendarToCombine.getEarlyBoundary() != null && holidayCalendar.getEarlyBoundary() == null || calendarToCombine.getEarlyBoundary() == null
+ && holidayCalendar.getEarlyBoundary() != null) {
+ throw new IllegalArgumentException("Both Calendar to be combined must either have each Early boundaries or None.");
+ }
+
+ if (calendarToCombine.getLateBoundary() != null && holidayCalendar.getLateBoundary() == null || calendarToCombine.getLateBoundary() == null
+ && holidayCalendar.getLateBoundary() != null) {
+ throw new IllegalArgumentException("Both Calendar to be combined must either have each Late boundaries or None.");
+ }
+ }
+
protected abstract E getToday();
protected abstract E compareDate(E date1, E date2, boolean returnEarliest);
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java 2010-03-13 00:49:41 UTC (rev 298)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayDateCalculator.java 2010-03-13 10:14:05 UTC (rev 299)
@@ -136,7 +136,7 @@
}
@Override
- public void setStartDate(final YearMonthDay startDate) {
+ public final void setStartDate(final YearMonthDay startDate) {
if (delegate != null) {
delegate.setStartDate(startDate != null ? startDate.toLocalDate() : null);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-13 00:49:48
|
Revision: 298
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=298&view=rev
Author: benoitx
Date: 2010-03-13 00:49:41 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
A few changes following Sonar's discoveries of assigned parameters and use of static SDF.
Marcin, I have left the JDK package to you... :-)
Modified Paths:
--------------
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java
trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/DefaultHolidayCalendar.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -36,6 +36,7 @@
import static java.util.Calendar.MONTH;
import static java.util.Calendar.YEAR;
+import java.io.Serializable;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
@@ -54,32 +55,33 @@
*
*/
public class DefaultHolidayCalendar<E> implements HolidayCalendar<E> {
-
- private Comparator<Calendar> calCmp = new Comparator<Calendar>() {
- public int compare(Calendar cal1, Calendar cal2) {
- return
- (cal1.get(YEAR) - cal2.get(YEAR)) * 10000
- +
- (cal1.get(MONTH) - cal2.get(MONTH)) * 100
- +
- (cal1.get(DAY_OF_MONTH) - cal2.get(DAY_OF_MONTH));
- }
- };
-
- private Comparator<Date> dateCmp = new Comparator<Date>() {
- public int compare(Date date1, Date date2) {
-
- Calendar cal1 = Calendar.getInstance();
+ private static final long serialVersionUID = -8558686840806739645L;
+
+ private static final class DateComp implements Comparator<Date>, Serializable {
+ private static final long serialVersionUID = 9079672835911375957L;
+
+ public int compare(final Date date1, final Date date2) {
+
+ final Calendar cal1 = Calendar.getInstance();
cal1.setTime(date1);
- Calendar cal2 = Calendar.getInstance();
+ final Calendar cal2 = Calendar.getInstance();
cal2.setTime(date2);
-
- return calCmp.compare(cal1, cal2);
+
+ return CALENDAR_COMP.compare(cal1, cal2);
}
- };
-
- private static final long serialVersionUID = -8558686840806739645L;
+ }
+ private static final class CalendarComp implements Comparator<Calendar>, Serializable {
+ private static final long serialVersionUID = 4783236154150397685L;
+
+ public int compare(final Calendar cal1, final Calendar cal2) {
+ return (cal1.get(YEAR) - cal2.get(YEAR)) * 10000 + (cal1.get(MONTH) - cal2.get(MONTH)) * 100 + (cal1.get(DAY_OF_MONTH) - cal2.get(DAY_OF_MONTH));
+ }
+ }
+
+ private static final CalendarComp CALENDAR_COMP = new CalendarComp();
+ private static final DateComp DATE_COMP = new DateComp();
+
private Set<E> holidays;
private E earlyBoundary = null;
@@ -146,32 +148,32 @@
* @see net.objectlab.kit.datecalc.common.HolidayCalendar#setHolidays(java.util.Set)
*/
@SuppressWarnings("unchecked")
- public void setHolidays(final Set<E> holidays) {
-
+ public final void setHolidays(final Set<E> holidays) {
+
if (holidays == null) {
this.holidays = Collections.emptySet();
return;
}
-
+
Set<E> newSet = null;
// this 'hack' is for Date/Calendar objects to be
// 'equal' on the same day even if time fields differ
- Iterator<E> it = holidays.iterator();
+ final Iterator<E> it = holidays.iterator();
if (it.hasNext()) {
- E obj = it.next();
-
+ final E obj = it.next();
+
if (obj instanceof Date) {
- newSet = new TreeSet(dateCmp);
+ newSet = new TreeSet(DATE_COMP);
} else if (obj instanceof Calendar) {
- newSet = new TreeSet(calCmp);
- }
+ newSet = new TreeSet(CALENDAR_COMP);
+ }
}
-
+
if (newSet == null) {
newSet = new HashSet<E>();
}
-
+
newSet.addAll(holidays);
this.holidays = Collections.unmodifiableSet(newSet);
}
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Tenor.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -91,20 +91,8 @@
boolean invalid = false;
final int size = tenor.length();
- for (int i = 0; i < size && !invalid; i++) {
- final char c = tenor.charAt(i);
+ parseCode(tenor, unitsBuf, codeBuf, invalid, size);
- if (c >= '0' && c <= '9') {
- if (codeBuf.length() != 0) {
- throw new IllegalArgumentException("[" + tenor + "] is not a valid tenor");
- } else {
- unitsBuf.append(c);
- }
- } else {
- codeBuf.append(c);
- }
- }
-
int parsedUnits = 0;
if (unitsBuf.length() > 0) {
parsedUnits = Integer.parseInt(unitsBuf.toString());
@@ -125,6 +113,22 @@
return new Tenor(parsedUnits, parsedCode);
}
+ private static void parseCode(final String tenor, final StringBuffer unitsBuf, final StringBuffer codeBuf, boolean invalid, final int size) {
+ for (int i = 0; i < size && !invalid; i++) {
+ final char c = tenor.charAt(i);
+
+ if (c >= '0' && c <= '9') {
+ if (codeBuf.length() != 0) {
+ throw new IllegalArgumentException("[" + tenor + "] is not a valid tenor");
+ } else {
+ unitsBuf.append(c);
+ }
+ } else {
+ codeBuf.append(c);
+ }
+ }
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified: trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java
===================================================================
--- trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/Utils.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -50,11 +50,8 @@
*
*/
public final class Utils {
-
private static final String DATE_PATTERN = "yyyy-MM-dd";
- private static final SimpleDateFormat SDF = new SimpleDateFormat(DATE_PATTERN);
-
private Utils() {
}
@@ -116,11 +113,10 @@
public static Calendar getCal(final String dateStr) {
try {
- final Date date = SDF.parse(dateStr);
- final Calendar cal = getCal(date);
- return cal;
+ final Date date = new SimpleDateFormat(DATE_PATTERN).parse(dateStr);
+ return getCal(date);
} catch (final ParseException e) {
- throw new IllegalArgumentException("\"" + dateStr + "\"" + " is an invalid date, the pattern is : " + DATE_PATTERN);
+ throw new IllegalArgumentException("\"" + dateStr + "\"" + " is an invalid date, the pattern is : " + DATE_PATTERN, e);
}
}
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/JodaWorkingWeek.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -41,7 +41,8 @@
*
* @author Benoit Xhenseval
* @author $LastChangedBy$
- * @version $Revision$ $Date$
+ * @version $Revision$ $Date: 2006-10-11 13:53:07 +0100 (Wed, 11 Oct 2006)
+ * $
*
*/
public class JodaWorkingWeek extends WorkingWeek {
@@ -64,13 +65,13 @@
// -----------------------------------------------------------------------
//
- // ObjectLab, world leaders in the design and development of bespoke
- // applications for the securities financing markets.
- // www.ObjectLab.co.uk
+ // ObjectLab, world leaders in the design and development of bespoke
+ // applications for the securities financing markets.
+ // www.ObjectLab.co.uk
//
// -----------------------------------------------------------------------
- public boolean isWorkingDay(final LocalDate date) {
+ public boolean isWorkingDay(final LocalDate date) {
final int dayOfWeek = jodaToCalendarDayConstant(date.getDayOfWeek());
return isWorkingDayFromCalendar(dayOfWeek);
}
@@ -83,8 +84,8 @@
* @param dayOfWeek
* e.g. DateTimeConstants.MONDAY, DateTimeConstants.TUESDAY, etc
*/
- public JodaWorkingWeek withWorkingDayFromDateTimeConstant(final boolean working, int dayOfWeek) {
- dayOfWeek = jodaToCalendarDayConstant(dayOfWeek);
+ public JodaWorkingWeek withWorkingDayFromDateTimeConstant(final boolean working, int givenDayOfWeek) {
+ int dayOfWeek = jodaToCalendarDayConstant(givenDayOfWeek);
return new JodaWorkingWeek(super.withWorkingDayFromCalendar(working, dayOfWeek));
}
@@ -92,8 +93,8 @@
return isWorkingDayFromCalendar(jodaToCalendarDayConstant(dayOfWeek));
}
- public int jodaToCalendarDayConstant(int dayOfWeek) {
- dayOfWeek++;
+ public int jodaToCalendarDayConstant(final int givenDayOfWeek) {
+ int dayOfWeek = givenDayOfWeek + 1;
return (dayOfWeek <= MAX_WEEKDAY_INDEX ? dayOfWeek : dayOfWeek % MAX_WEEKDAY_INDEX);
}
}
@@ -101,16 +102,13 @@
/*
* ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
*
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
+ * Based in London, we are world leaders in the design and development of
+ * bespoke applications for the securities financing markets.
*
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about
+ * us</a> ___ _ _ _ _ _ / _ \| |__ (_) ___ ___| |_| | __ _| |__ | | | | '_ \| |/
+ * _ \/ __| __| | / _` | '_ \ | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/ |__/
+ *
+ * www.ObjectLab.co.uk
*/
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateIMMDateCalculator.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -44,7 +44,6 @@
import net.objectlab.kit.datecalc.common.AbstractIMMDateCalculator;
import net.objectlab.kit.datecalc.common.IMMPeriod;
-import org.joda.time.DateTimeConstants;
import org.joda.time.LocalDate;
/**
@@ -140,9 +139,9 @@
//
// -----------------------------------------------------------------------
- private LocalDate calculateIMMMonth(final boolean requestNextIMM, LocalDate date, final int month) {
+ private LocalDate calculateIMMMonth(final boolean requestNextIMM, final LocalDate startDate, final int month) {
int monthOffset = 0;
-
+ LocalDate date = startDate;
switch (month) {
case MARCH:
case JUNE:
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDateModifiedFollowingHandler.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -70,15 +70,16 @@
//
// -----------------------------------------------------------------------
- protected LocalDate move(final DateCalculator<LocalDate> calculator, int step) {
+ protected LocalDate move(final DateCalculator<LocalDate> calculator, final int step) {
LocalDate date = calculator.getCurrentBusinessDate();
final int month = date.getMonthOfYear();
+ int stepToUse = step;
while (calculator.isNonWorkingDay(date)) {
- date = date.plusDays(step);
+ date = date.plusDays(stepToUse);
if (date.getMonthOfYear() != month) {
// flick to backward
- step *= -1;
- date = date.plusDays(step);
+ stepToUse *= -1;
+ date = date.plusDays(stepToUse);
}
}
return date;
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/LocalDatePeriodCountCalculator.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -52,49 +52,20 @@
public int dayDiff(final LocalDate start, final LocalDate end, final PeriodCountBasis basis) {
int diff = 0;
- int dayStart;
- int dayEnd;
+ // int dayStart;
+ // int dayEnd;
switch (basis) {
case CONV_30_360:
- dayStart = start.getDayOfMonth();
- dayEnd = end.getDayOfMonth();
- if (dayEnd == MONTH_31_DAYS && dayStart >= MONTH_30_DAYS) {
- dayEnd = MONTH_30_DAYS;
- }
- if (dayStart == MONTH_31_DAYS) {
- dayStart = MONTH_30_DAYS;
- }
- diff = (end.getYear() - start.getYear()) * YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * MONTH_30_DAYS
- + dayEnd - dayStart;
+ diff = diffConv30v360(start, end);
break;
case CONV_360E_ISDA:
- dayStart = start.getDayOfMonth();
- dayEnd = end.getDayOfMonth();
- final int monthStart = start.getMonthOfYear();
- if ((monthStart == 2 && start.monthOfYear().getMaximumValue() == dayStart) || dayEnd == MONTH_31_DAYS) {
- dayEnd = MONTH_30_DAYS;
- }
- if (dayStart == MONTH_31_DAYS) {
- dayStart = MONTH_30_DAYS;
- }
-
- diff = (end.getYear() - start.getYear()) * YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * MONTH_30_DAYS
- + dayEnd - dayStart;
+ diff = diff360EIsda(start, end);
break;
case CONV_360E_ISMA:
- dayStart = start.getDayOfMonth();
- dayEnd = end.getDayOfMonth();
- if (dayEnd == MONTH_31_DAYS) {
- dayEnd = MONTH_30_DAYS;
- }
- if (dayStart == MONTH_31_DAYS) {
- dayStart = MONTH_30_DAYS;
- }
- diff = (end.getYear() - start.getYear()) * YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * MONTH_30_DAYS
- + dayEnd - dayStart;
+ diff = diff360EIsma(start, end);
break;
default:
final Period p = new Period(start, end, PeriodType.days());
@@ -104,6 +75,44 @@
return diff;
}
+ private int diff360EIsma(final LocalDate start, final LocalDate end) {
+ int dayStart = start.getDayOfMonth();
+ int dayEnd = end.getDayOfMonth();
+ if (dayEnd == MONTH_31_DAYS) {
+ dayEnd = MONTH_30_DAYS;
+ }
+ if (dayStart == MONTH_31_DAYS) {
+ dayStart = MONTH_30_DAYS;
+ }
+ return (end.getYear() - start.getYear()) * YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * MONTH_30_DAYS + dayEnd - dayStart;
+ }
+
+ private int diff360EIsda(final LocalDate start, final LocalDate end) {
+ int dayStart = start.getDayOfMonth();
+ int dayEnd = end.getDayOfMonth();
+ final int monthStart = start.getMonthOfYear();
+ if ((monthStart == 2 && start.monthOfYear().getMaximumValue() == dayStart) || dayEnd == MONTH_31_DAYS) {
+ dayEnd = MONTH_30_DAYS;
+ }
+ if (dayStart == MONTH_31_DAYS) {
+ dayStart = MONTH_30_DAYS;
+ }
+
+ return (end.getYear() - start.getYear()) * YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * MONTH_30_DAYS + dayEnd - dayStart;
+ }
+
+ private int diffConv30v360(final LocalDate start, final LocalDate end) {
+ int dayStart = start.getDayOfMonth();
+ int dayEnd = end.getDayOfMonth();
+ if (dayEnd == MONTH_31_DAYS && dayStart >= MONTH_30_DAYS) {
+ dayEnd = MONTH_30_DAYS;
+ }
+ if (dayStart == MONTH_31_DAYS) {
+ dayStart = MONTH_30_DAYS;
+ }
+ return (end.getYear() - start.getYear()) * YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * MONTH_30_DAYS + dayEnd - dayStart;
+ }
+
// -----------------------------------------------------------------------
//
// ObjectLab, world leaders in the design and development of bespoke
@@ -140,7 +149,7 @@
case ACT_360:
diff = (dayDiff(start, end, basis)) / YEAR_360_0;
break;
-
+
case ACT_365:
case END_365:
diff = (dayDiff(start, end, basis)) / YEAR_365_0;
Modified: trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java
===================================================================
--- trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java 2010-03-12 20:59:12 UTC (rev 297)
+++ trunk/datecalc-joda/src/main/java/net/objectlab/kit/datecalc/joda/YearMonthDayModifiedFollowingHandler.java 2010-03-13 00:49:41 UTC (rev 298)
@@ -79,15 +79,16 @@
//
// -----------------------------------------------------------------------
- protected YearMonthDay move(final DateCalculator<YearMonthDay> calculator, int step) {
+ protected YearMonthDay move(final DateCalculator<YearMonthDay> calculator, final int step) {
YearMonthDay date = calculator.getCurrentBusinessDate();
final int month = date.getMonthOfYear();
+ int stepToUse = step;
while (calculator.isNonWorkingDay(date)) {
- date = date.plusDays(step);
+ date = date.plusDays(stepToUse);
if (date.getMonthOfYear() != month) {
// flick to backward
- step *= -1;
- date = date.plusDays(step);
+ stepToUse *= -1;
+ date = date.plusDays(stepToUse);
}
}
return date;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <be...@us...> - 2010-03-12 20:59:19
|
Revision: 297
http://objectlabkit.svn.sourceforge.net/objectlabkit/?rev=297&view=rev
Author: benoitx
Date: 2010-03-12 20:59:12 +0000 (Fri, 12 Mar 2010)
Log Message:
-----------
Added a profile "perf-testing" for performance testing.
Can be launched by "mvn install -P perf-testing" which will run all tests, including performance.
Modified Paths:
--------------
trunk/datecalc-jdk/pom.xml
trunk/datecalc-joda/pom.xml
Added Paths:
-----------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkCalendarPerformanceCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkDatePerformanceCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/LocalDatePerformanceCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/YearMonthDayPerformanceCalculatorTest.java
Removed Paths:
-------------
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPerformanceCalculatorTest.java
trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePerformanceCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePerformanceCalculatorTest.java
trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPerformanceCalculatorTest.java
Modified: trunk/datecalc-jdk/pom.xml
===================================================================
--- trunk/datecalc-jdk/pom.xml 2010-03-11 19:40:51 UTC (rev 296)
+++ trunk/datecalc-jdk/pom.xml 2010-03-12 20:59:12 UTC (rev 297)
@@ -1,101 +1,169 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>datecalc-jdk</artifactId>
- <packaging>bundle</packaging>
+ <artifactId>datecalc-jdk</artifactId>
+ <packaging>bundle</packaging>
- <name>Date Calculator for JDK</name>
- <description>Date Calculator methods for JDK</description>
+ <name>Date Calculator for JDK</name>
+ <description>Date Calculator methods for JDK</description>
- <dependencies>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- </dependency>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin> <!-- (2) OSGi START -->
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
- <Private-Package />
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
+ <build>
+ <plugins>
+ <!-- UNIT tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/perf/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <!--<Private-Package>com.my.company.*</Private-Package>-->
- <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
- </instructions>
- </configuration>
- </plugin> <!-- (2) END -->
- </plugins>
- </build>
+ <plugin> <!-- (2) OSGi START -->
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
+ <Private-Package />
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>config/maven_checks.xml</configLocation>
- </configuration>
- </plugin>
+ <!--<Private-Package>com.my.company.*</Private-Package>-->
+ <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
+ </instructions>
+ </configuration>
+ </plugin> <!-- (2) END -->
+ </plugins>
+ </build>
- <!--
- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin> <plugin>
- <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> </configuration> </plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>1.5</targetJdk>
- <rulesets>
- <ruleset>/rulesets/basic.xml</ruleset>
- <ruleset>/rulesets/controversial.xml</ruleset>
- </rulesets>
- <linkXref>true</linkXref>
- <minimumTokens>100</minimumTokens>
- </configuration>
- </plugin>
- <!--
- <plugin> <artifactId>maven-changes-plugin</artifactId> <configuration>
- <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate> </configuration> </plugin> <plugin>
- <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin> <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
- </plugin>
- -->
- </plugins>
- </reporting>
+ <profiles>
+ <profile>
+ <id>perf-testing</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-perf</id>
+ <!-- use it mvn integration-test -P integration-test -->
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <argLine>-Xms256m -Xmx1024m</argLine>
+ <skip>false</skip>
+ <includes>
+ <include>**/perf/*Test.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ </configuration>
+ </plugin>
+
+ <!--
+ <plugin> <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
+ <plugin> <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration> <aggregate>true</aggregate> </configuration>
+ </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jxr-maven-plugin</artifactId> </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/controversial.xml</ruleset>
+ </rulesets>
+ <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens>
+ </configuration>
+ </plugin>
+ <!--
+ <plugin> <artifactId>maven-changes-plugin</artifactId>
+ <configuration>
+ <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate>
+ </configuration> </plugin> <plugin>
+ <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin>
+ <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
+ </plugin>
+ -->
+ </plugins>
+ </reporting>
</project>
\ No newline at end of file
Deleted: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPerformanceCalculatorTest.java 2010-03-11 19:40:51 UTC (rev 296)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkCalendarPerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -1,70 +0,0 @@
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- *
- * $Id: JdkCalendarForwardDateCalculatorTest.java 203 2006-10-11 12:53:07Z benoitx $
- *
- * Copyright 2006 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
- *
- * http://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.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Calendar;
-
-import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
-import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
-import net.objectlab.kit.datecalc.common.Utils;
-
-public class JdkCalendarPerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<Calendar> {
-
- @Override
- protected Calendar newDate(final String date) {
- return Utils.createCalendar(date);
- }
-
- @Override
- protected KitCalculatorsFactory<Calendar> getDateCalculatorFactory() {
- return CalendarKitCalculatorsFactory.getDefaultInstance();
- }
-
-}
-
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- */
Deleted: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePerformanceCalculatorTest.java 2010-03-11 19:40:51 UTC (rev 296)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/JdkDatePerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -1,69 +0,0 @@
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- *
- * $Id: JdkDateForwardDateCalculatorTest.java 224 2006-11-24 16:02:47Z marchy $
- *
- * Copyright 2006 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
- *
- * http://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.
- */
-package net.objectlab.kit.datecalc.jdk;
-
-import java.util.Date;
-
-import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
-import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
-import net.objectlab.kit.datecalc.common.Utils;
-
-public class JdkDatePerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<Date> {
-
- @Override
- protected Date newDate(final String date) {
- return Utils.createDate(date);
- }
-
- @Override
- protected KitCalculatorsFactory getDateCalculatorFactory() {
- return DateKitCalculatorsFactory.getDefaultInstance();
- }
-}
-
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- */
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkCalendarPerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkCalendarPerformanceCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkCalendarPerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -0,0 +1,71 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: JdkCalendarForwardDateCalculatorTest.java 203 2006-10-11 12:53:07Z benoitx $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
+package net.objectlab.kit.datecalc.jdk.perf;
+
+import java.util.Calendar;
+
+import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+import net.objectlab.kit.datecalc.jdk.CalendarKitCalculatorsFactory;
+
+public class JdkCalendarPerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<Calendar> {
+
+ @Override
+ protected Calendar newDate(final String date) {
+ return Utils.createCalendar(date);
+ }
+
+ @Override
+ protected KitCalculatorsFactory<Calendar> getDateCalculatorFactory() {
+ return CalendarKitCalculatorsFactory.getDefaultInstance();
+ }
+
+}
+
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ */
Added: trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkDatePerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkDatePerformanceCalculatorTest.java (rev 0)
+++ trunk/datecalc-jdk/src/test/java/net/objectlab/kit/datecalc/jdk/perf/JdkDatePerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -0,0 +1,70 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: JdkDateForwardDateCalculatorTest.java 224 2006-11-24 16:02:47Z marchy $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
+package net.objectlab.kit.datecalc.jdk.perf;
+
+import java.util.Date;
+
+import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
+import net.objectlab.kit.datecalc.common.Utils;
+import net.objectlab.kit.datecalc.jdk.DateKitCalculatorsFactory;
+
+public class JdkDatePerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<Date> {
+
+ @Override
+ protected Date newDate(final String date) {
+ return Utils.createDate(date);
+ }
+
+ @Override
+ protected KitCalculatorsFactory getDateCalculatorFactory() {
+ return DateKitCalculatorsFactory.getDefaultInstance();
+ }
+}
+
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ */
Modified: trunk/datecalc-joda/pom.xml
===================================================================
--- trunk/datecalc-joda/pom.xml 2010-03-11 19:40:51 UTC (rev 296)
+++ trunk/datecalc-joda/pom.xml 2010-03-12 20:59:12 UTC (rev 297)
@@ -1,106 +1,175 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>datecalc-joda</artifactId>
- <packaging>bundle</packaging>
+ <artifactId>datecalc-joda</artifactId>
+ <packaging>bundle</packaging>
- <name>Date Calculator for Joda</name>
- <description>Date Calculator methods for Joda</description>
+ <name>Date Calculator for Joda</name>
+ <description>Date Calculator methods for Joda</description>
- <dependencies>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>1.6</version>
- </dependency>
- <dependency>
- <groupId>net.objectlab.kit.datecalc</groupId>
- <artifactId>datecalc-common</artifactId>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>net.objectlab.kit.datecalc</groupId>
+ <artifactId>datecalc-common</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin> <!-- (2) OSGi START -->
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
- <Private-Package />
- <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
- <Bundle-Version>${pom.version}</Bundle-Version>
- <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
+ <build>
+ <plugins>
+ <!-- UNIT tests -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <excludes>
+ <exclude>**/perf/**</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <!--<Private-Package>com.my.company.*</Private-Package>-->
- <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
- </instructions>
- </configuration>
- </plugin> <!-- (2) END -->
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>config/maven_checks.xml</configLocation>
- </configuration>
- </plugin>
+ <plugin> <!-- (2) OSGi START -->
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>net.objectlab.kit.datecalc.*;version="${pom.version}"</Export-Package>
+ <Private-Package />
+ <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${pom.version}</Bundle-Version>
+ <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
- <!--
- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> </plugin> <plugin>
- <artifactId>maven-javadoc-plugin</artifactId> <configuration> <aggregate>true</aggregate> </configuration> </plugin> <plugin>
- <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> </plugin>
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <targetJdk>1.5</targetJdk>
- <rulesets>
- <ruleset>/rulesets/basic.xml</ruleset>
- <ruleset>/rulesets/controversial.xml</ruleset>
- </rulesets>
- <linkXref>true</linkXref>
- <minimumTokens>100</minimumTokens>
- </configuration>
- </plugin>
- <!--
- <plugin> <artifactId>maven-changes-plugin</artifactId> <configuration>
- <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate> </configuration> </plugin> <plugin>
- <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
- <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin> <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
- </plugin>
- -->
- </plugins>
- </reporting>
+ <!--<Private-Package>com.my.company.*</Private-Package>-->
+ <!--<Bundle-Activator>com.my.company.Activator</Bundle-Activator>-->
+ </instructions>
+ </configuration>
+ </plugin> <!-- (2) END -->
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>perf-testing</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-perf</id>
+ <!-- use it mvn integration-test -P integration-test -->
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <argLine>-Xms256m -Xmx1024m</argLine>
+ <skip>false</skip>
+ <includes>
+ <include>**/perf/*Test.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>config/maven_checks.xml</configLocation>
+ </configuration>
+ </plugin>
+
+ <!--
+ <plugin> <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId> </plugin>
+ <plugin> <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration> <aggregate>true</aggregate> </configuration>
+ </plugin> <plugin> <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jxr-maven-plugin</artifactId> </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clover-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <targetJdk>1.5</targetJdk>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/controversial.xml</ruleset>
+ </rulesets>
+ <linkXref>true</linkXref>
+ <minimumTokens>100</minimumTokens>
+ </configuration>
+ </plugin>
+ <!--
+ <plugin> <artifactId>maven-changes-plugin</artifactId>
+ <configuration>
+ <issueLinkTemplate>%URL%/?func=detail&group_id=175139&%ISSUE%</issueLinkTemplate>
+ </configuration> </plugin> <plugin>
+ <artifactId>maven-changelog-plugin</artifactId> </plugin> <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dashboard-maven-plugin</artifactId> </plugin> <plugin>
+ <groupId>net.sf</groupId> <artifactId>stat-scm</artifactId>
+ </plugin>
+ -->
+ </plugins>
+ </reporting>
+
</project>
\ No newline at end of file
Deleted: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePerformanceCalculatorTest.java 2010-03-11 19:40:51 UTC (rev 296)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/LocalDatePerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -1,82 +0,0 @@
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- *
- * $Id: LocalDateForwardDateCalculatorTest.java 203 2006-10-11 12:53:07Z benoitx $
- *
- * Copyright 2006 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
- *
- * http://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.
- */
-package net.objectlab.kit.datecalc.joda;
-
-import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
-import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
-import net.objectlab.kit.datecalc.common.WorkingWeek;
-
-import org.joda.time.LocalDate;
-
-public class LocalDatePerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<LocalDate> {
-
-// public LocalDateForwardDateCalculatorTest() {
-// super();
-// }
-//
-// public LocalDateForwardDateCalculatorTest(final java.lang.String name) {
-// super(name);
-// }
-
- @Override
- protected LocalDate newDate(final String date) {
- return new LocalDate(date);
- }
-
- @Override
- protected WorkingWeek getWorkingWeek(final WorkingWeek ww) {
- return new JodaWorkingWeek(ww);
- }
-
- @Override
- protected KitCalculatorsFactory<LocalDate> getDateCalculatorFactory() {
- return LocalDateKitCalculatorsFactory.getDefaultInstance();
- }
-}
-
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- */
Deleted: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPerformanceCalculatorTest.java 2010-03-11 19:40:51 UTC (rev 296)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/YearMonthDayPerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -1,80 +0,0 @@
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- *
- * $Id: YearMonthDayForwardDateCalculatorTest.java 235 2007-01-04 18:31:58Z benoitx $
- *
- * Copyright 2006 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
- *
- * http://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.
- */
-package net.objectlab.kit.datecalc.joda;
-
-import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
-import net.objectlab.kit.datecalc.common.HolidayCalendar;
-import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
-import net.objectlab.kit.datecalc.common.WorkingWeek;
-
-import org.joda.time.YearMonthDay;
-
-public class YearMonthDayPerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<YearMonthDay> {
-
- @Override
- protected YearMonthDay newDate(final String date) {
- return new YearMonthDay(date);
- }
-
- @Override
- protected void registerHolidays(final String name, final HolidayCalendar<YearMonthDay> holidays) {
- YearMonthDayKitCalculatorsFactory.getDefaultInstance().registerHolidays(name, holidays);
- }
-
- @Override
- protected WorkingWeek getWorkingWeek(final WorkingWeek ww) {
- return new JodaWorkingWeek(ww);
- }
-
- @Override
- protected KitCalculatorsFactory<YearMonthDay> getDateCalculatorFactory() {
- return YearMonthDayKitCalculatorsFactory.getDefaultInstance();
- }
-}
-
-/*
- * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
- *
- * Based in London, we are world leaders in the design and development
- * of bespoke applications for the securities financing markets.
- *
- * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
- * ___ _ _ _ _ _
- * / _ \| |__ (_) ___ ___| |_| | __ _| |__
- * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
- * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
- * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
- * |__/
- *
- * www.ObjectLab.co.uk
- */
Added: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/LocalDatePerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/LocalDatePerformanceCalculatorTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/LocalDatePerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -0,0 +1,76 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: LocalDateForwardDateCalculatorTest.java 203 2006-10-11 12:53:07Z benoitx $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
+package net.objectlab.kit.datecalc.joda.perf;
+
+import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
+import net.objectlab.kit.datecalc.common.WorkingWeek;
+import net.objectlab.kit.datecalc.joda.LocalDateKitCalculatorsFactory;
+import net.objectlab.kit.datecalc.joda.JodaWorkingWeek;
+
+import org.joda.time.LocalDate;
+
+public class LocalDatePerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<LocalDate> {
+
+ @Override
+ protected LocalDate newDate(final String date) {
+ return new LocalDate(date);
+ }
+
+ @Override
+ protected WorkingWeek getWorkingWeek(final WorkingWeek ww) {
+ return new JodaWorkingWeek(ww);
+ }
+
+ @Override
+ protected KitCalculatorsFactory<LocalDate> getDateCalculatorFactory() {
+ return LocalDateKitCalculatorsFactory.getDefaultInstance();
+ }
+}
+
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ */
Added: trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/YearMonthDayPerformanceCalculatorTest.java
===================================================================
--- trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/YearMonthDayPerformanceCalculatorTest.java (rev 0)
+++ trunk/datecalc-joda/src/test/java/net/objectlab/kit/datecalc/joda/perf/YearMonthDayPerformanceCalculatorTest.java 2010-03-12 20:59:12 UTC (rev 297)
@@ -0,0 +1,82 @@
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ *
+ * $Id: YearMonthDayForwardDateCalculatorTest.java 235 2007-01-04 18:31:58Z benoitx $
+ *
+ * Copyright 2006 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
+ *
+ * http://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.
+ */
+package net.objectlab.kit.datecalc.joda.perf;
+
+import net.objectlab.kit.datecalc.common.AbstractPerformanceDateCalculatorTest;
+import net.objectlab.kit.datecalc.common.HolidayCalendar;
+import net.objectlab.kit.datecalc.common.KitCalculatorsFactory;
+import net.objectlab.kit.datecalc.common.WorkingWeek;
+import net.objectlab.kit.datecalc.joda.JodaWorkingWeek;
+import net.objectlab.kit.datecalc.joda.YearMonthDayKitCalculatorsFactory;
+
+import org.joda.time.YearMonthDay;
+
+public class YearMonthDayPerformanceCalculatorTest extends AbstractPerformanceDateCalculatorTest<YearMonthDay> {
+
+ @Override
+ protected YearMonthDay newDate(final String date) {
+ return new YearMonthDay(date);
+ }
+
+ @Override
+ protected void registerHolidays(final String name, final HolidayCalendar<YearMonthDay> holidays) {
+ YearMonthDayKitCalculatorsFactory.getDefaultInstance().registerHolidays(name, holidays);
+ }
+
+ @Override
+ protected WorkingWeek getWorkingWeek(final WorkingWeek ww) {
+ return new JodaWorkingWeek(ww);
+ }
+
+ @Override
+ protected KitCalculatorsFactory<YearMonthDay> getDateCalculatorFactory() {
+ return YearMonthDayKitCalculatorsFactory.getDefaultInstance();
+ }
+}
+
+/*
+ * ObjectLab, http://www.objectlab.co.uk/open is sponsoring the ObjectLab Kit.
+ *
+ * Based in London, we are world leaders in the design and development
+ * of bespoke applications for the securities financing markets.
+ *
+ * <a href="http://www.objectlab.co.uk/open">Click here to learn more about us</a>
+ * ___ _ _ _ _ _
+ * / _ \| |__ (_) ___ ___| |_| | __ _| |__
+ * | | | | '_ \| |/ _ \/ __| __| | / _` | '_ \
+ * | |_| | |_) | | __/ (__| |_| |__| (_| | |_) |
+ * \___/|_.__// |\___|\___|\__|_____\__,_|_.__/
+ * |__/
+ *
+ * www.ObjectLab.co.uk
+ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|