All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tfw.immutable.ila.longila.LongIlaFill Maven / Gradle / Ivy

Go to download

The FrameWork for building highly scalable and maintainable applications

The newest version!
package tfw.immutable.ila.longila;

import tfw.check.Argument;

public final class LongIlaFill {
    private LongIlaFill() {
        // non-instantiable class
    }

    public static LongIla create(long value, long length) {
        Argument.assertNotLessThan(length, 0, "length");

        return new LongIlaImpl(value, length);
    }

    private static class LongIlaImpl extends AbstractLongIla {
        private final long value;
        private final long length;

        private LongIlaImpl(long value, long length) {
            this.value = value;
            this.length = length;
        }

        @Override
        protected long lengthImpl() {
            return length;
        }

        @Override
        protected void getImpl(long[] array, int offset, long start, int length) {
            final int startPlusLength = (int) (start + length);
            for (int startInt = (int) start; startInt != startPlusLength; ++startInt, offset++) {
                array[offset] = value;
            }
        }
    }
}
// AUTO GENERATED FROM TEMPLATE




© 2015 - 2024 Weber Informatics LLC | Privacy Policy