datarecordbuffer.java

来自「A Java Framework for connecting to and e」· Java 代码 · 共 48 行

JAVA
48
字号
package com.libGPS4j2me.devices.StdGPS;

import com.libGPS4j2me.devices.StdGPS.DataRecord;
import com.libGPS4j2me.devices.StdGPS.exceptions.EmptyBufferException;


/**
 * Stores a single record (GPS data).
 * 
 * @author  Loreto Parisi
 */
public class DataRecordBuffer {
    private DataRecord record;
    private static final long WAIT = 1000;
    
    /**
     * 
     * Creates a new instance of DataRecordBuffer
     */
    public DataRecordBuffer() {
         record = null;
    }
    
    /**
     * Gets stored record.
     * 
     * @return Stored record
     * @throws EmptyBufferException If buffer is empty
     */
    public synchronized DataRecord getRecord() throws EmptyBufferException {
        if(record == null)
            throw new EmptyBufferException("Record buffer is empty.");

        return record;
    }
    
    /**
     * Puts record in buffer.
     * 
     * 
     * @param record DataRecord to be stored
     */
    public synchronized void putRecord(DataRecord record) {        
        this.record = record;
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?