EMMA Coverage Report (generated Tue Jun 29 21:21:09 CEST 2010)
[all classes][org.jomc.sequences]

COVERAGE SUMMARY FOR SOURCE FILE [Sequence.java]

nameclass, %method, %block, %line, %
Sequence.java100% (1/1)37%  (7/19)10%  (21/215)18%  (7/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Sequence100% (1/1)37%  (7/19)10%  (21/215)18%  (7/39)
Sequence (): void 0%   (0/1)0%   (0/3)0%   (0/2)
clone (): Sequence 0%   (0/1)0%   (0/10)0%   (0/3)
compareTo (Sequence): int 0%   (0/1)0%   (0/32)0%   (0/6)
equals (Object): boolean 0%   (0/1)0%   (0/40)0%   (0/5)
hashCode (): int 0%   (0/1)0%   (0/30)0%   (0/4)
internalString (): String 0%   (0/1)0%   (0/48)0%   (0/1)
setIncrement (long): void 0%   (0/1)0%   (0/4)0%   (0/2)
setMaximum (long): void 0%   (0/1)0%   (0/4)0%   (0/2)
setMinimum (long): void 0%   (0/1)0%   (0/4)0%   (0/2)
setName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setValue (long): void 0%   (0/1)0%   (0/4)0%   (0/2)
toString (): String 0%   (0/1)0%   (0/11)0%   (0/1)
getDate (): long 100% (1/1)100% (3/3)100% (1/1)
getIncrement (): long 100% (1/1)100% (3/3)100% (1/1)
getMaximum (): long 100% (1/1)100% (3/3)100% (1/1)
getMinimum (): long 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getRevision (): long 100% (1/1)100% (3/3)100% (1/1)
getValue (): long 100% (1/1)100% (3/3)100% (1/1)

1// SECTION-START[License Header]
2// <editor-fold defaultstate="collapsed" desc=" Generated License ">
3/*
4 *   Copyright (c) 2010 The JOMC Project
5 *   Copyright (c) 2005 Christian Schulte <schulte2005@users.sourceforge.net>
6 *   All rights reserved.
7 *
8 *   Redistribution and use in source and binary forms, with or without
9 *   modification, are permitted provided that the following conditions
10 *   are met:
11 *
12 *     o Redistributions of source code must retain the above copyright
13 *       notice, this list of conditions and the following disclaimer.
14 *
15 *     o Redistributions in binary form must reproduce the above copyright
16 *       notice, this list of conditions and the following disclaimer in
17 *       the documentation and/or other materials provided with the
18 *       distribution.
19 *
20 *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
21 *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
24 *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *   $Id: Sequence.java 2244 2010-06-29 07:58:09Z schulte2005 $
33 *
34 */
35// </editor-fold>
36// SECTION-END
37package org.jomc.sequences;
38 
39import java.io.Serializable;
40import java.util.Date;
41 
42// SECTION-START[Documentation]
43// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
44/**
45 * Sequence of numbers.
46 *
47 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0
48 * @version $Id: Sequence.java 2244 2010-06-29 07:58:09Z schulte2005 $
49 */
50// </editor-fold>
51// SECTION-END
52// SECTION-START[Annotations]
53// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
54@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
55// </editor-fold>
56// SECTION-END
57public class Sequence implements Comparable<Sequence>, Cloneable, Serializable
58{
59    // SECTION-START[Sequence]
60 
61    /** Constant for the name of property {@code name}. */
62    public static final String PROP_NAME = "org.jomc.sequences.Sequence.PROP_NAME";
63 
64    /** Constant for the name of property {@code minimum}. */
65    public static final String PROP_MINIMUM = "org.jomc.sequences.Sequence.PROP_MINIMUM";
66 
67    /** Constant for the name of property {@code maximum}. */
68    public static final String PROP_MAXIMUM = "org.jomc.sequences.Sequence.PROP_MAXIMUM";
69 
70    /** Constant for the name of property {@code increment}. */
71    public static final String PROP_INCREMENT = "org.jomc.sequences.Sequence.PROP_INCREMENT";
72 
73    /** Constant for the name of property {@code value}. */
74    public static final String PROP_VALUE = "org.jomc.sequences.Sequence.PROP_VALUE";
75 
76    /** Serial version UID for backwards compatibility with 1.0.x classes. */
77    private static final long serialVersionUID = 4782576402999874315L;
78 
79    /**
80     * Revision of the sequence.
81     * @serial
82     */
83    private long revision;
84 
85    /**
86     * Date of the revision.
87     * @serial
88     */
89    private long date;
90 
91    /**
92     * Logical name of the sequence.
93     * @serial
94     */
95    private String name;
96 
97    /**
98     * Minimum value of property {@code value}.
99     * @serial
100     */
101    private long minimum;
102 
103    /**
104     * Maximum value of property {@code value}.
105     * @serial
106     */
107    private long maximum;
108 
109    /**
110     * Delta to add to the value of property {@code value} for the next value in the sequence.
111     * @serial
112     */
113    private long increment;
114 
115    /**
116     * Current value of the sequence.
117     * @serial
118     */
119    private long value;
120 
121    /**
122     * Gets the revision of the entity.
123     *
124     * @return The revision of the entity.
125     */
126    public long getRevision()
127    {
128        return this.revision;
129    }
130 
131    /**
132     * Gets the date of the revision of the entity.
133     *
134     * @return The date of the revision of the entity.
135     */
136    public long getDate()
137    {
138        return this.date;
139    }
140 
141    /**
142     * Gets the logical name of the sequence.
143     *
144     * @return The logical name of the sequence.
145     */
146    public String getName()
147    {
148        return this.name;
149    }
150 
151    /**
152     * Sets the logical name of the sequence.
153     *
154     * @param value The new logical name of the sequence.
155     */
156    public void setName( final String value )
157    {
158        this.name = value;
159    }
160 
161    /**
162     * Gets the minimum value of property {@code value}.
163     *
164     * @return The minimum value of property {@code value}.
165     */
166    public long getMinimum()
167    {
168        return this.minimum;
169    }
170 
171    /**
172     * Sets the minimum value of property {@code value}.
173     *
174     * @param value The new minimum value of property {@code value}.
175     */
176    public void setMinimum( final long value )
177    {
178        this.minimum = value;
179    }
180 
181    /**
182     * Gets the maximum value of property {@code value}.
183     *
184     * @return The maximum value of property {@code value}.
185     */
186    public long getMaximum()
187    {
188        return this.maximum;
189    }
190 
191    /**
192     * Sets the maximum value of property {@code value}.
193     *
194     * @param value The new maximum value of property {@code value}.
195     */
196    public void setMaximum( final long value )
197    {
198        this.maximum = value;
199    }
200 
201    /**
202     * Gets the delta to add to the value of property {@code value} for the next value in the sequence.
203     *
204     * @return The the delta to add to the value of property {@code value} for the next value in the sequence.
205     */
206    public long getIncrement()
207    {
208        return this.increment;
209    }
210 
211    /**
212     * Sets the delta to add to the value of property {@code value} for the next value in the sequence.
213     *
214     * @param value The new delta to add to the value of property {@code value} for the next value in the sequence.
215     */
216    public void setIncrement( final long value )
217    {
218        this.increment = value;
219    }
220 
221    /**
222     * Gets the current value of the sequence.
223     *
224     * @return The current value of the sequence.
225     */
226    public long getValue()
227    {
228        return this.value;
229    }
230 
231    /**
232     * Sets the current value of the sequence.
233     *
234     * @param value The current value of the sequence.
235     */
236    public void setValue( final long value )
237    {
238        this.value = value;
239    }
240 
241    /**
242     * Creates a string representing the properties of the instance.
243     *
244     * @return A string representing the properties of the instance.
245     */
246    private String internalString()
247    {
248        return new StringBuffer( 150 ).append( '{' ).
249            append( "revision=" ).append( this.revision ).
250            append( ", date=" ).append( new Date( this.date ) ).
251            append( ", name=" ).append( this.name ).
252            append( ", minimum=" ).append( this.minimum ).
253            append( ", maximum=" ).append( this.maximum ).
254            append( ", increment=" ).append( this.increment ).
255            append( ", value=" ).append( this.value ).
256            append( '}' ).toString();
257 
258    }
259 
260    /**
261     * Compares this sequence with the specified sequence for order.
262     * <p>Returns a negative integer, zero, or a positive integer as this sequence is less than, equal to, or greater
263     * than the specified sequence.</p>
264     * <p><b>Note:</b><br/>This class has a natural ordering that is inconsistent with equals.</p>
265     *
266     * @param s The sequence to be compared.
267     *
268     * @return A negative integer, zero, or a positive integer as this sequence is less than, equal to, or greater than
269     * the specified sequence.
270     */
271    public int compareTo( final Sequence s )
272    {
273        int result = s == null ? 1 : 0;
274 
275        if ( result == 0 )
276        {
277            if ( this.getName() == null )
278            {
279                result = s.getName() == null ? 0 : -1;
280            }
281            else
282            {
283                result = s.getName() == null ? 1 : this.getName().compareTo( s.getName() );
284            }
285        }
286 
287        return result;
288    }
289 
290    /**
291     * Creates and returns a copy of this object.
292     *
293     * @return A clone of this instance.
294     */
295    @Override
296    public Sequence clone()
297    {
298        try
299        {
300            return (Sequence) super.clone();
301        }
302        catch ( final CloneNotSupportedException e )
303        {
304            throw new AssertionError( e );
305        }
306    }
307 
308    /**
309     * Indicates whether some other object is equal to this one by comparing the values of properties {@code name} and
310     * {@code revision}.
311     *
312     * @param o The reference object with which to compare.
313     *
314     * @return {@code true} if this object is the same as {@code o}; {@code false} otherwise.
315     */
316    @Override
317    public boolean equals( final Object o )
318    {
319        boolean ret = o == this;
320 
321        if ( !ret && o instanceof Sequence )
322        {
323            final Sequence that = (Sequence) o;
324            ret = ( this.getName() == null ? that.getName() == null : this.getName().equals( that.getName() ) ) &&
325                  ( this.getRevision() == that.getRevision() );
326 
327        }
328 
329        return ret;
330    }
331 
332    /**
333     * Returns a hash code value for this object.
334     *
335     * @return A hash code value for this object.
336     */
337    @Override
338    public int hashCode()
339    {
340        int hc = 23;
341        hc = 37 * hc + ( this.getName() == null ? 0 : this.getName().hashCode() );
342        hc = 37 * hc + (int) ( this.getRevision() ^ ( this.getRevision() >>> 32 ) );
343        return hc;
344    }
345 
346    /**
347     * Returns a string representation of the object.
348     *
349     * @return A string representation of the object.
350     */
351    @Override
352    public String toString()
353    {
354        return super.toString() + this.internalString();
355    }
356 
357    // SECTION-END
358    // SECTION-START[Constructors]
359    // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
360 
361    /** Creates a new {@code Sequence} instance. */
362    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" )
363    public Sequence()
364    {
365        // SECTION-START[Default Constructor]
366        super();
367        // SECTION-END
368    }
369    // </editor-fold>
370    // SECTION-END
371    // SECTION-START[Dependencies]
372    // SECTION-END
373    // SECTION-START[Properties]
374    // SECTION-END
375    // SECTION-START[Messages]
376    // SECTION-END
377}

[all classes][org.jomc.sequences]
EMMA 2.0.5312 (C) Vladimir Roubtsov