NUMBERS-51: "Fraction" field.
Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/15b7b2f1 Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/15b7b2f1 Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/15b7b2f1 Branch: refs/heads/master Commit: 15b7b2f10c20c2d95396643ab46d4052e874e802 Parents: ec18080 Author: Gilles Sadowski <gil...@harfang.homelinux.org> Authored: Tue Dec 26 02:45:28 2017 +0100 Committer: Gilles Sadowski <gil...@harfang.homelinux.org> Committed: Tue Dec 26 02:45:28 2017 +0100 ---------------------------------------------------------------------- commons-numbers-field/pom.xml | 4 +++ .../commons/numbers/field/FractionField.java | 34 ++++++++++++++++++++ pom.xml | 5 +++ 3 files changed, 43 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/15b7b2f1/commons-numbers-field/pom.xml ---------------------------------------------------------------------- diff --git a/commons-numbers-field/pom.xml b/commons-numbers-field/pom.xml index 061351d..cd78011 100644 --- a/commons-numbers-field/pom.xml +++ b/commons-numbers-field/pom.xml @@ -47,6 +47,10 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-numbers-core</artifactId> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-numbers-fraction</artifactId> + </dependency> <dependency> <groupId>org.apache.commons</groupId> http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/15b7b2f1/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java ---------------------------------------------------------------------- diff --git a/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java new file mode 100644 index 0000000..b383e30 --- /dev/null +++ b/commons-numbers-field/src/main/java/org/apache/commons/numbers/field/FractionField.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.commons.numbers.field; + +import org.apache.commons.numbers.fraction.Fraction; + +/** + * {@link Fraction} field. + */ +public class FractionField extends AbstractField<Fraction> { + /** {@inheritDoc} */ + public Fraction one() { + return Fraction.ONE; + } + + /** {@inheritDoc} */ + public Fraction zero() { + return Fraction.ZERO; + } +} http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/15b7b2f1/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index aceccb0..06f76f8 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,11 @@ <artifactId>commons-numbers-core</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-numbers-fraction</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.apache.commons</groupId>