1. Project Clover database Wed Nov 12 2025 05:07:35 UTC
  2. Package guru.mikelue.foxglove.functional

File Int8SequenceSupplier.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
86% of files have more coverage

Code metrics

0
9
6
1
82
36
6
0.67
1.5
6
1

Classes

Class Line # Actions
Int8SequenceSupplier 12 9 0% 6 15
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package guru.mikelue.foxglove.functional;
2   
3    import java.util.function.LongSupplier;
4   
5    /**
6    * Provides consequent number with customizable start and steps.
7    *
8    * The type is {@link Long}(8 bytes) based.
9    *
10    * @see Int4SequenceSupplier
11    */
 
12    public class Int8SequenceSupplier implements LongSupplier, SequenceSupplier<Long> {
13    private long currentValue;
14    private final int step;
15   
16    /**
17    * Constructs the supplier with start value as 1 and step as 1.
18    *
19    * @see Int8SequenceSupplier(long, int)
20    */
 
21  0 toggle public Int8SequenceSupplier()
22    {
23  0 this(1, 1);
24    }
25   
26    /**
27    * Constructs the supplier with start value as 0 and step as 1.
28    *
29    * @param startValue The start value
30    *
31    * @see Int8SequenceSupplier(long, int)
32    */
 
33  0 toggle public Int8SequenceSupplier(long startValue)
34    {
35  0 this(startValue, 1);
36    }
37   
38    /**
39    * Constructs the supplier with customizable start value and step.
40    *
41    * @param startValue The start value
42    * @param stepValue The step value
43    *
44    * @see Int8SequenceSupplier(long)
45    */
 
46  0 toggle public Int8SequenceSupplier(long startValue, int stepValue)
47    {
48  0 this.currentValue = startValue;
49  0 this.step = stepValue;
50    }
51   
52    /**
53    * Gets the next value in sequence.
54    *
55    * @return The next value
56    */
 
57  0 toggle @Override
58    public long getAsLong()
59    {
60  0 return nextValue();
61    }
62   
63    /**
64    * {@inheritDoc}
65    */
 
66  0 toggle @Override
67    public Long nextValue()
68    {
69  0 var nextValue = currentValue;
70  0 currentValue += step;
71  0 return nextValue;
72    }
73   
74    /**
75    * {@inheritDoc}
76    */
 
77  0 toggle @Override
78    public Long lastValue()
79    {
80  0 return currentValue;
81    }
82    }