Package cds.moc

Class Array

java.lang.Object
cds.moc.Array
All Implemented Interfaces:
Cloneable, Iterable<Long>
Direct Known Subclasses:
IntArray, LongArray, ShortArray

public abstract class Array extends Object implements Iterable<Long>, Cloneable
Fast array : see ShortArray, IntArray and LongArray classes
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
     
    protected int
     
    protected int
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    add(long v, boolean testUnicity)
    Add a value, with or without checking unicity
    abstract Object
     
    abstract boolean
    delete(long v)
    Delete value v from the array
    abstract boolean
    delete(long v1, long v2)
    Delete range of values
    abstract boolean
    deleteBrothers(long me)
    Delete 3 others brothers if all present
    abstract boolean
    Equality test
    abstract int
    find(long v)
    Find index of value v, or return negative value (bsearch result) if it is not present in the array
    abstract long
    get(int i)
    Provide the element i
    abstract long
    Size of the array in bytes
    int
    Size of the array
    abstract int
    Return the size of the array in compressed mode
    abstract boolean
    intersectRange(long vStart, long vEnd)
    Return false if no value in the range [vStart..vEnd] is present in the array
    boolean
    Return true if the array is ascending sorted
    Provide an iterator on the array
    abstract void
    set(int i, long v)
    set the element i
    int
    setSize(int size)
    set the size of the array
    abstract void
    Sort the array (if required)
    abstract void
    Trim the array in order to free the not required memory

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

    • DEFAULTBLOC

      protected static final int DEFAULTBLOC
      See Also:
    • size

      protected int size
    • sorted

      protected boolean sorted
    • sizeBloc

      protected int sizeBloc
  • Constructor Details

    • Array

      public Array()
  • Method Details

    • isSorted

      public boolean isSorted()
      Return true if the array is ascending sorted
    • getSize

      public int getSize()
      Size of the array
    • setSize

      public int setSize(int size)
      set the size of the array
    • clone

      public abstract Object clone()
      Overrides:
      clone in class Object
    • get

      public abstract long get(int i)
      Provide the element i
    • set

      public abstract void set(int i, long v)
      set the element i
    • add

      public abstract boolean add(long v, boolean testUnicity)
      Add a value, with or without checking unicity
    • delete

      public abstract boolean delete(long v)
      Delete value v from the array
    • delete

      public abstract boolean delete(long v1, long v2)
      Delete range of values
    • deleteBrothers

      public abstract boolean deleteBrothers(long me)
      Delete 3 others brothers if all present
    • sort

      public abstract void sort()
      Sort the array (if required)
    • find

      public abstract int find(long v)
      Find index of value v, or return negative value (bsearch result) if it is not present in the array
    • intersectRange

      public abstract boolean intersectRange(long vStart, long vEnd)
      Return false if no value in the range [vStart..vEnd] is present in the array
    • getMem

      public abstract long getMem()
      Size of the array in bytes
    • getSizeCompressed

      public abstract int getSizeCompressed()
      Return the size of the array in compressed mode
    • trim

      public abstract void trim()
      Trim the array in order to free the not required memory
    • equals

      public abstract boolean equals(Array a)
      Equality test
    • iterator

      public Iterator<Long> iterator()
      Provide an iterator on the array
      Specified by:
      iterator in interface Iterable<Long>