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

File Int4SequenceSupplier.java

 

Coverage histogram

../../../../img/srcFileCovDistChart6.png
80% of files have more coverage

Code metrics

0
9
6
1
82
36
6
0.67
1.5
6
1

Classes

Class Line # Actions
Int4SequenceSupplier 12 9 0% 6 6
0.660%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package guru.mikelue.foxglove.functional;
2   
3    import java.util.function.IntSupplier;
4   
5    /**
6    * Provides consequent number with customizable start and steps.
7    *
8    * The type is {@link Integer}(4 bytes) based.
9    *
10    * @see Int8SequenceSupplier
11    */
 
12    public class Int4SequenceSupplier implements IntSupplier, SequenceSupplier<Integer> {
13    private int currentValue;
14    private final int step;
15   
16    /**
17    * Constructs the supplier with start value as 1 and step as 1.
18    *
19    * @see Int4SequenceSupplier(int, int)
20    */
 
21  0 toggle public Int4SequenceSupplier()
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 Int4SequenceSupplier(int, int)
32    */
 
33  0 toggle public Int4SequenceSupplier(int 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 Int4SequenceSupplier(int)
45    */
 
46  2 toggle public Int4SequenceSupplier(int startValue, int stepValue)
47    {
48  2 this.currentValue = startValue;
49  2 this.step = stepValue;
50    }
51   
52    /**
53    * Gets the next value in sequence.
54    *
55    * @return The next value
56    */
 
57  14 toggle @Override
58    public int getAsInt()
59    {
60  14 return nextValue();
61    }
62   
63    /**
64    * {@inheritDoc}
65    */
 
66  18 toggle @Override
67    public Integer nextValue()
68    {
69  18 var nextValue = currentValue;
70  18 currentValue += step;
71  18 return nextValue;
72    }
73   
74    /**
75    * {@inheritDoc}
76    */
 
77  0 toggle @Override
78    public Integer lastValue()
79    {
80  0 return currentValue;
81    }
82    }