64-bit array functionality implemented via libraries?

Mark Thornton mthornton at optrak.co.uk
Thu May 28 13:35:13 PDT 2009


Joe Darcy wrote:
> Hello.
>
> As another point in the design space, assuming indexing access syntax is 
> available for user-defined types and the existence of collection 
> literals, I'd like to see what implementing 64-bit array functionality 
> via libraries would look like.
>   
Not quite sure what you are looking for here as the public interface 
seems fairly obvious apart from minor details.

public abstract class LargeArray<T extends LargeArray> implements 
Cloneable, Serializable {
    public final long length;
    protected LargeArray(long length) {...}
    public T clone();
}

public class LargeObjectArray<E> extends LargeArray<LargeObjectArray<E>> {
    public LargeObjectArray(long length) {...}
    public E get(long index) {...}
    public void set(long index, E value) {...}
}

public class LargeIntArray extends LargeArray<LargeIntArray> {
    public LargeIntArray(long length) {...}
    public int get(long index) {...}
    public void set(long index, int value) {...}
}

// etc for the other primitives

However this can only be used with the proposed [] access, if that is 
not based on the existing List/Collection interfaces as they have 
integer rather than long size and index types.

Mark Thornton




More information about the coin-dev mailing list