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. |