Codota Logo
BooleanArrays.ensureOffsetLength
Code IndexAdd Codota to your IDE (free)

How to use
ensureOffsetLength
method
in
it.unimi.dsi.fastutil.booleans.BooleanArrays

Best Java code snippets using it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: it.unimi.dsi/fastutil

/** Stores an array fragment to a given print stream.
  *
  * @param array an array whose elements will be written to {@code stream}.
  * @param offset the index of the first element of {@code array} to be written.
  * @param length the number of elements of {@code array} to be written.
  * @param stream a print stream.
  */
public static void storeBooleans(final boolean array[], final int offset, final int length, final PrintStream stream) {
  it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength(array, offset, length);
  for(int i = 0; i < length; i++) stream.println(array[offset + i]);
}
/** Stores an array to a given print stream.
origin: it.unimi.dsi/fastutil

/** Stores an array fragment to a given data output.
  *
  * @param array an array whose elements will be written to {@code dataOutput}.
  * @param offset the index of the first element of {@code array} to be written.
  * @param length the number of elements of {@code array} to be written.
  * @param dataOutput a data output.
  */
public static void storeBooleans(final boolean array[], final int offset, final int length, final DataOutput dataOutput) throws IOException {
  it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength(array, offset, length);
  for(int i = 0; i < length; i++) dataOutput.writeBoolean(array[offset + i]);
}
/** Stores an array to a given data output.
origin: it.unimi.dsi/fastutil

/** Loads elements from a given data input, storing them in a given array fragment.
  *
  * @param dataInput a data input.
  * @param array an array which will be filled with data from {@code dataInput}.
  * @param offset the index of the first element of {@code array} to be filled.
  * @param length the number of elements of {@code array} to be filled.
  * @return the number of elements actually read from {@code dataInput} (it might be less than {@code length} if {@code dataInput} ends).
  */
public static int loadBooleans(final DataInput dataInput, final boolean[] array, final int offset, final int length) throws IOException {
  it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength(array, offset, length);
  int i = 0;
  try {
   for(i = 0; i < length; i++) array[i + offset] = dataInput.readBoolean();
  }
  catch(EOFException itsOk) {}
  return i;
}
/** Loads elements from a given data input, storing them in a given array.
origin: AliView/AliView

/** Returns a copy of a portion of an array.
  *
  * @param array an array.
  * @param offset the first element to copy.
  * @param length the number of elements to copy.
  * @return a new array containing <code>length</code> elements of <code>array</code> starting at <code>offset</code>.
  */
public static boolean[] copy( final boolean[] array, final int offset, final int length ) {
ensureOffsetLength( array, offset, length );
final boolean[] a =
 length == 0 ? EMPTY_ARRAY : new boolean[ length ];
System.arraycopy( array, offset, a, 0, length );
return a;
}
/** Returns a copy of an array.
origin: it.unimi.dsi/fastutil

/**
 * Copies element of this type-specific list into the given array using
 * optimized system calls.
 *
 * @param from
 *            the start index (inclusive).
 * @param a
 *            the destination array.
 * @param offset
 *            the offset into the destination array where to store the first
 *            element copied.
 * @param length
 *            the number of elements to be copied.
 */
@Override
public void getElements(final int from, final boolean[] a, final int offset, final int length) {
  BooleanArrays.ensureOffsetLength(a, offset, length);
  System.arraycopy(this.a, from, a, offset, length);
}
/**
origin: it.unimi.dsi/fastutil

/**
 * Returns a copy of a portion of an array.
 *
 * @param array
 *            an array.
 * @param offset
 *            the first element to copy.
 * @param length
 *            the number of elements to copy.
 * @return a new array containing {@code length} elements of {@code array}
 *         starting at {@code offset}.
 */
public static boolean[] copy(final boolean[] array, final int offset, final int length) {
  ensureOffsetLength(array, offset, length);
  final boolean[] a = length == 0 ? EMPTY_ARRAY : new boolean[length];
  System.arraycopy(array, offset, a, 0, length);
  return a;
}
/**
origin: it.unimi.dsi/fastutil

/** Loads elements from a given fast buffered reader, storing them in a given array fragment.
  *
  * @param reader a buffered reader.
  * @param array an array which will be filled with data from {@code reader}.
  * @param offset the index of the first element of {@code array} to be filled.
  * @param length the number of elements of {@code array} to be filled.
  * @return the number of elements actually read from {@code reader} (it might be less than {@code length} if {@code reader} ends).
  */
public static int loadBooleans(final BufferedReader reader, final boolean[] array, final int offset, final int length) throws IOException {
  it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength(array, offset, length);
  int i = 0;
  String s;
  try {
   for(i = 0; i < length; i++)
   if ((s = reader.readLine()) != null) array[i + offset] = Boolean.parseBoolean(s.trim());
   else break;
  }
  catch(EOFException itsOk) {}
  return i;
}
/** Loads elements from a given buffered reader, storing them in a given array.
origin: it.unimi.dsi/fastutil

/** Stores an array fragment to a file given by a {@link File} object.
  *
  * @param array an array whose elements will be written to {@code filename}.
  * @param offset the index of the first element of {@code array} to be written.
  * @param length the number of elements of {@code array} to be written.
  * @param file a file.
  */
public static void storeBooleans(final boolean array[], final int offset, final int length, final File file) throws IOException {
  it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength(array, offset, length);
  final DataOutputStream dos = new DataOutputStream(new FastBufferedOutputStream(new FileOutputStream(file)));
  for(int i = 0; i < length; i++) dos.writeBoolean(array[offset + i]);
  dos.close();
}
/** Stores an array fragment to a file given by a pathname.
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash set and fills it with the elements of a given array.
 *
 * @param a
 *            an array whose elements will be used to fill the set.
 * @param offset
 *            the first element to use.
 * @param length
 *            the number of elements to use.
 * @param f
 *            the load factor.
 */
public BooleanOpenHashSet(final boolean[] a, final int offset, final int length, final float f) {
  this(length < 0 ? 0 : length, f);
  BooleanArrays.ensureOffsetLength(a, offset, length);
  for (int i = 0; i < length; i++)
    add(a[offset + i]);
}
/**
origin: it.unimi.dsi/fastutil

/**
 * Wraps the given part of an array into a type-specific list iterator.
 *
 * <p>
 * The type-specific list iterator returned by this method will iterate
 * {@code length} times, returning consecutive elements of the given array
 * starting from the one with index {@code offset}.
 *
 * @param array
 *            an array to wrap into a type-specific list iterator.
 * @param offset
 *            the first element of the array to be returned.
 * @param length
 *            the number of elements to return.
 * @return an iterator that will return {@code length} elements of {@code array}
 *         starting at position {@code offset}.
 */
public static BooleanListIterator wrap(final boolean[] array, final int offset, final int length) {
  BooleanArrays.ensureOffsetLength(array, offset, length);
  return new ArrayIterator(array, offset, length);
}
/**
origin: it.unimi.dsi/fastutil

/** Loads elements from a file given by a {@link File} object, storing them in a given array fragment.
  *
  * @param file a file.
  * @param array an array which will be filled with data from the specified file.
  * @param offset the index of the first element of {@code array} to be filled.
  * @param length the number of elements of {@code array} to be filled.
  * @return the number of elements actually read from the given file (it might be less than {@code length} if the file is too short).
  */
public static int loadBooleans(final File file, final boolean[] array, final int offset, final int length) throws IOException {
  it.unimi.dsi.fastutil.booleans.BooleanArrays.ensureOffsetLength(array, offset, length);
  final FileInputStream fis = new FileInputStream(file);
  final DataInputStream dis = new DataInputStream(new FastBufferedInputStream(fis));
  int i = 0;
  try {
   for(i = 0; i < length; i++) array[i + offset] = dis.readBoolean();
  }
  catch(EOFException itsOk) {}
  dis.close();
  return i;
}
/** Loads elements from a file given by a pathname, storing them in a given array fragment.
origin: it.unimi.dsi/fastutil

/**
 * Adds elements to this type-specific list using optimized system calls.
 *
 * @param index
 *            the index at which to add elements.
 * @param a
 *            the array containing the elements.
 * @param offset
 *            the offset of the first element to add.
 * @param length
 *            the number of elements to add.
 */
@Override
public void addElements(final int index, final boolean a[], final int offset, final int length) {
  ensureIndex(index);
  BooleanArrays.ensureOffsetLength(a, offset, length);
  grow(size + length);
  System.arraycopy(this.a, index, this.a, index + length, size - index);
  System.arraycopy(a, offset, this.a, index, length);
  size += length;
}
@Override
it.unimi.dsi.fastutil.booleansBooleanArraysensureOffsetLength

Javadoc

Ensures that a range given by an offset and a length fits an array.

This method may be used whenever an array range check is needed.

Popular methods of BooleanArrays

  • quickSort
    Sorts the specified range of elements of two arrays according to the natural lexicographical ascendi
  • ensureCapacity
    Ensures that an array can contain the given number of entries, preserving just a part of the array.
  • ensureFromTo
    Ensures that a range given by its first (inclusive) and last (exclusive) elements fits an array. Thi
  • fill
    Fills the given array with the given value.
  • insertionSort
  • med3
  • mergeSort
    Sorts an array according to the order induced by the specified comparator using mergesort. This sort
  • selectionSort
  • swap
  • trim
    Trims the given array to the given length.
  • ensureSameLength
    Ensures that two arrays are of the same length.
  • equals
    Returns true if the two arrays are elementwise equal.
  • ensureSameLength,
  • equals,
  • forceCapacity,
  • grow,
  • insertionSortIndirect,
  • med3Indirect,
  • parallelQuickSort,
  • parallelQuickSortIndirect,
  • quickSortIndirect

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (Timer)
  • orElseThrow (Optional)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Kernel (java.awt.image)
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now