package applet;

public class CyclicEFile extends LinearEFile {
    private byte currRecordIdx;

    public CyclicEFile(short fileID, byte[] FCP, byte maxRecords, short recordLength) {
        super(fileID, FCP, maxRecords, recordLength);
        this.currRecordIdx = 0;
    }

    public void addRecord(byte[] record) {
        if(record.length == super.getRecordLength()) {
            records[currRecordIdx] = new Record(record);
            currRecordIdx = (byte)((currRecordIdx + (byte) 1) % (byte) records.length);
            if (currRecordNum != (byte) records.length ){
                currRecordNum++;
            }
        }
    }
}