X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=datamodel%2Fcompbio%2Fmetadata%2FChunkHolder.java;h=39ec86d4b35c569730e89def70a80234030c0a7c;hb=140e024c6b00451dd933a9c25feac2d170d5f9f6;hp=c27a4e738e3dccdca38692ff854efb996ef24b31;hpb=535359a3d592ee41bda72e7356f0181f6cee9d07;p=jabaws.git diff --git a/datamodel/compbio/metadata/ChunkHolder.java b/datamodel/compbio/metadata/ChunkHolder.java index c27a4e7..39ec86d 100644 --- a/datamodel/compbio/metadata/ChunkHolder.java +++ b/datamodel/compbio/metadata/ChunkHolder.java @@ -22,73 +22,73 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; /** - * Represents a chunk of string data together with the position in a file from - * where corresponding to of the data. + * Represents a chunk of a string data together with the position in a file for + * the next read operation. * * @author pvtroshin * - * Date December 2009 + * @version 1.0 December 2009 */ @XmlAccessorType(XmlAccessType.FIELD) public class ChunkHolder { - String chunk; - long position; + String chunk; + long position; - private ChunkHolder() { - // JaxB default constructor - // should not be used otherwise - } - - public ChunkHolder(String chunk, long position) { - if (position < 0) { - throw new IndexOutOfBoundsException( - "Position in a file could not be negative! Given value: " - + position); - } - if (chunk == null) { - throw new NullPointerException("Chunk must not be NULL!"); + private ChunkHolder() { + // JaxB default constructor + // should not be used otherwise } - this.chunk = chunk; - this.position = position; - } - - public String getChunk() { - return chunk; - } - public long getNextPosition() { - return position; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; + public ChunkHolder(String chunk, long position) { + if (position < 0) { + throw new IndexOutOfBoundsException( + "Position in a file could not be negative! Given value: " + + position); + } + if (chunk == null) { + throw new NullPointerException("Chunk must not be NULL!"); + } + this.chunk = chunk; + this.position = position; } - ChunkHolder ch = null; - if (!(obj instanceof ChunkHolder)) { - ch = (ChunkHolder) obj; + + public String getChunk() { + return chunk; } - if (this.position != ch.position) { - return false; + + public long getNextPosition() { + return position; } - if (!this.chunk.equals(ch.chunk)) { - return false; + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + ChunkHolder ch = null; + if (!(obj instanceof ChunkHolder)) { + ch = (ChunkHolder) obj; + } + if (this.position != ch.position) { + return false; + } + if (!this.chunk.equals(ch.chunk)) { + return false; + } + return true; } - return true; - } - @Override - public String toString() { - String value = "Position: " + position + "\n"; - value += "Chunk size: " + chunk.length() + "\n"; - value += "Chunk: " + chunk + "\n"; - return value; - } + @Override + public String toString() { + String value = "Position: " + position + "\n"; + value += "Chunk size: " + chunk.length() + "\n"; + value += "Chunk: " + chunk + "\n"; + return value; + } - @Override - public int hashCode() { - return new Long(position + chunk.hashCode()).intValue(); - } + @Override + public int hashCode() { + return new Long(position + chunk.hashCode()).intValue(); + } }