001/**
002 * SimpleAccumulator.java
003 * 
004 * Copyright (c) 2004-2012, Nicole C. Tedesco. All rights reserved.
005 * 
006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
007 * use this file except in compliance with the License. You may obtain a copy of
008 * the License at:
009 * 
010 * http://www.apache.org/licenses/LICENSE-2.0
011 * 
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015 * License for the specific language governing permissions and limitations under
016 * the License.
017 */
018
019package net.sf.jaccumulator;
020
021import java.math.BigDecimal;
022import java.math.BigInteger;
023
024import net.sf.jaccumulator.primitives.Constant;
025import net.sf.jaccumulator.primitives.Primitive;
026import net.sf.jaccumulator.scalars.NumericPrecision;
027import net.sf.jupperware.association.AssociativeList;
028
029/**
030 * An Accumulator with a read-only {@link Primitive} {@link #getTarget() target}
031 * and a read-only {@link #members() relationship} collection
032 * 
033 * @since JAccumulator 4.0
034 * @author Nicole Tedesco (<a
035 *         href="mailto:nicole@tedesco.name">nicole@tedesco.name</a>)
036 */
037public final class ConstantAccumulator
038    extends
039        AbstractConstantAccumulator<ConstantAccumulator>
040{
041    private static final long serialVersionUID = -1461241452234266081L;
042
043    /**
044     * Napier's (Euler's) constant
045     * 
046     * @see <a href="http://www.research.att.com/~njas/sequences/">The On-Line
047     *      Encyclopedia of Integer Sequences</a> (AT&T)
048     */
049    public static final Accumulator<?> E = new ConstantAccumulator(Constant.E);
050
051    /**
052     * An empty string ("")
053     */
054    public static final Accumulator<?> EMPTY = new ConstantAccumulator(
055        Constant.EMPTY);
056
057    /**
058     * Boolean {@link Boolean#FALSE FALSE}
059     */
060    public static final Accumulator<?> FALSE = new ConstantAccumulator(
061        Constant.FALSE);
062
063    /**
064     * IEEE Not-a-Number
065     * 
066     * @see Double#NaN
067     * @see Float#NaN
068     */
069    public static final Accumulator<?> INVALID = new ConstantAccumulator(
070        Constant.INVALID);
071
072    /**
073     * Maximum values
074     */
075    public static final Accumulator<?> MAXIMUM = new ConstantAccumulator(
076        Constant.MAXIMUM);
077
078    /**
079     * Minimum values
080     */
081    public static final Accumulator<?> MINIMUM = new ConstantAccumulator(
082        Constant.MINIMUM);
083
084    /**
085     * Negative infinity
086     * 
087     * @see Double#NEGATIVE_INFINITY
088     * @see Float#NEGATIVE_INFINITY
089     */
090    public static final Accumulator<?> NEGATIVE_INFINITY = new ConstantAccumulator(
091        Constant.NEGATIVE_INFINITY);
092
093    /**
094     * Negative one (-1)
095     */
096    public static final Accumulator<?> NEGATIVE_ONE = new ConstantAccumulator(
097        Constant.NEGATIVE_ONE);
098
099    /**
100     * {@link NumericPrecision#NULL Null}, the empty set, or {@code void}
101     */
102    public static final Accumulator<?> NULL = new ConstantAccumulator(
103        Constant.NULL);
104
105    /**
106     * One (1)
107     */
108    public static final Accumulator<?> ONE = new ConstantAccumulator(
109        Constant.ONE);
110
111    /**
112     * Pi
113     * 
114     * @see <a href="http://www.research.att.com/~njas/sequences/">The On-Line
115     *      Encyclopedia of Integer Sequences</a> (AT&T)
116     */
117    public static final Accumulator<?> PI = new ConstantAccumulator(Constant.PI);
118
119    /**
120     * Positive infinity
121     * 
122     * @see Double#POSITIVE_INFINITY
123     * @see Float#POSITIVE_INFINITY
124     */
125    public static final Accumulator<?> POSITIVE_INFINITY = new ConstantAccumulator(
126        Constant.POSITIVE_INFINITY);
127
128    /**
129     * Boolean {@link Boolean#TRUE TRUE}
130     */
131    public static final Accumulator<?> TRUE = new ConstantAccumulator(
132        Constant.TRUE);
133
134    /**
135     * Unknown constant
136     */
137    public static final Accumulator<?> UNKNOWN = new ConstantAccumulator(
138        Constant.UNKNOWN);
139
140    /**
141     * Zero (0)
142     */
143    public static final Accumulator<?> ZERO = new ConstantAccumulator(
144        Constant.ZERO);
145
146    public ConstantAccumulator()
147    {
148        super();
149    }
150
151    public ConstantAccumulator( final Accumulator<?> anAccumulator )
152    {
153        super(anAccumulator);
154    }
155
156    public ConstantAccumulator( final BigDecimal aTarget )
157    {
158        super(aTarget);
159    }
160
161    public ConstantAccumulator( final BigInteger aTarget )
162    {
163        super(aTarget);
164    }
165
166    public ConstantAccumulator( final boolean aTarget )
167    {
168        super(aTarget);
169    }
170
171    public ConstantAccumulator( final byte aTarget )
172    {
173        super(aTarget);
174    }
175
176    public ConstantAccumulator( final char aTarget )
177    {
178        super(aTarget);
179    }
180
181    public ConstantAccumulator( final double aTarget )
182    {
183        super(aTarget);
184    }
185
186    public ConstantAccumulator( final Enum<?> aTarget )
187    {
188        super(aTarget);
189    }
190
191    public ConstantAccumulator( final float aTarget )
192    {
193        super(aTarget);
194    }
195
196    public ConstantAccumulator( final int aTarget )
197    {
198        super(aTarget);
199    }
200
201    public ConstantAccumulator( final long aTarget )
202    {
203        super(aTarget);
204    }
205
206    public ConstantAccumulator( final Primitive<?> aTarget )
207    {
208        super(aTarget);
209    }
210
211    public ConstantAccumulator(
212        final Primitive<?> aTarget,
213        final AssociativeList<Accumulator<?>,Accumulator<?>> members )
214    {
215        super(aTarget, members);
216    }
217
218    public ConstantAccumulator( final short aTarget )
219    {
220        super(aTarget);
221    }
222
223    public ConstantAccumulator( final String aTarget )
224    {
225        this(Constant.valueOfText(aTarget));
226    }
227}