public class BytesRefArrayWritable extends java.lang.Object implements java.lang.Comparable<BytesRefArrayWritable>
Each BytesRefArrayWritable holds instance has a valid field, which is the desired valid number of BytesRefWritable it holds. resetValid can reset the valid, but it will not care the underlying BytesRefWritable.
Constructor and Description |
---|
BytesRefArrayWritable()
Constructs an empty array with a capacity of ten.
|
BytesRefArrayWritable(int capacity)
Constructs an empty array with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all elements.
|
int |
compareTo(BytesRefArrayWritable other) |
boolean |
contains(BytesRefWritable bytesRefWritable)
Returns true if this instance contains one or more the specified
BytesRefWritable.
|
protected void |
ensureCapacity(int newCapacity) |
boolean |
equals(java.lang.Object o) |
BytesRefWritable |
get(int index)
Gets the BytesRefWritable at the specified position.
|
void |
readFields(java.io.DataInput in) |
void |
resetValid(int newValidCapacity)
enlarge the capacity if necessary, to ensure that it can hold the number of
elements specified by newValidCapacity argument.
|
void |
set(int index,
BytesRefWritable bytesRefWritable)
Set the BytesRefWritable at the specified position with the specified
BytesRefWritable.
|
int |
size()
Returns the number of valid elements.
|
BytesRefWritable |
unCheckedGet(int index)
Gets the BytesRefWritable at the specified position without checking.
|
void |
write(java.io.DataOutput out) |
public BytesRefArrayWritable(int capacity)
capacity
- initial capacityjava.lang.IllegalArgumentException
- if the specified initial capacity is negativepublic BytesRefArrayWritable()
public int size()
public BytesRefWritable get(int index)
index
- the position index, starting from zerojava.lang.IndexOutOfBoundsException
public BytesRefWritable unCheckedGet(int index)
index
- the position index, starting from zerojava.lang.IndexOutOfBoundsException
public void set(int index, BytesRefWritable bytesRefWritable)
index
- index positionbytesRefWritable
- the new elementjava.lang.IllegalArgumentException
- if the specified new element is nullpublic int compareTo(BytesRefArrayWritable other)
compareTo
in interface java.lang.Comparable<BytesRefArrayWritable>
public boolean contains(BytesRefWritable bytesRefWritable)
bytesRefWritable
- BytesRefWritable element to be testedjava.lang.IllegalArgumentException
- if the specified element is nullpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void clear()
public void resetValid(int newValidCapacity)
newValidCapacity
- the desired capacityprotected void ensureCapacity(int newCapacity)
public void readFields(java.io.DataInput in) throws java.io.IOException
java.io.IOException
public void write(java.io.DataOutput out) throws java.io.IOException
java.io.IOException
Copyright © 2012 The Apache Software Foundation