package twinfeats.pilot.pdb;/** * Class to represent a PDB record * @version     1.0 Dec 17 1997 * @author      Kent L. Smotherman */public class PDBRecord {    /**     * Construct a new PDB record     * @param id        id for this record     * @param data      data for this record     * @param copy      flag to determine if the supplied data should be     *                  copied or the reference simply stored     */    public PDBRecord(int id, byte[] data, boolean copy) {        this(data,copy);        mID = id;    }    /**     * Construct a new PDB record with the record ID being generated from     * the PDB files Base ID.     * @param data      data for this record     * @param copy      flag to determine if the supplied data should be     *                  copied or the reference simply stored     */    public PDBRecord(byte[] data, boolean copy) {        mID = mBaseID++;        if (copy) {            mData = new byte[data.length];				System.arraycopy(data,0,mData,0,data.length);        }        else            mData = data;    }    public PDBRecord(byte[] data, int len, boolean copy) {        mID = mBaseID++;        if (copy) {            mData = new byte[len];			System.arraycopy(data,0,mData,0,len);        }        else            mData = data;    }    /**     * Construct a new PDB record with no copy     * @param id        id for this record     * @param data      data for this record     */    public PDBRecord(int id, String data) {        this(data);        mID = id;    }    /**     * Construct a new PDB record with no copy and using an ID generated     * from the PDB file's Base ID.     * @param data      data for this record     */    public PDBRecord(String data) {        mID = mBaseID++;        mData = new byte[data.length()];        data.getBytes(0,data.length(),mData,0);    }    /**     * Retrieve the record's data length     * @returns         length     */    public int getLength() {        if (mData != null)            return mData.length;        return 0;    }    /**     * Retrieve the record's data     * @returns         data     */    public byte[] getData() {        return mData;    }    /**     * Retrieve the record's ID     * @returns         id     */    public int getID() {        return mID;    }    /**     * Set the PDB file's Base ID for auto-generated ID's     * @param id        new base id     */    public static void setBaseID(int id) {        mBaseID = id & 0x00ffffff;    }    int     mID;    byte[]  mData;    static  int mBaseID=0;}
