irlapsendqueue.java

来自「JRed is a 100% Java implementation of th」· Java 代码 · 共 89 行

JAVA
89
字号
/*
**************************************************************************
** $Header: /cvsroot/jred/jred/src/com/synchrona/jred/irlap/IrLAPSendQueue.java,v 1.1.1.1 2000/07/05 04:41:52 mpatters Exp $
**
** Copyright (C) 2000 Synchrona, Inc. All rights reserved.
**
** This file is part of JRed, a 100% Java implementation of the IrDA
** infrared communications protocols.
**
** This file may be distributed under the terms of the Synchrona Public
** License as defined by Synchrona, Inc. and appearing in the file
** LICENSE included in the packaging of this file. The Synchrona Public
** License is based on the Q Public License as defined by Troll Tech AS
** of Norway; it differs only in its use of the courts of Florida, USA
** rather than those of Oslo, Norway.
**************************************************************************
*/
package com.synchrona.jred.irlap;

import java.util.LinkedList;

class IrLAPSendQueue {
	private LinkedList m_list;

	public IrLAPSendQueue() {
		m_list = new LinkedList();
	}

	public void addFrame(IrLAPFrame frame) {
		m_list.addLast(frame);
	}

	/**
	 * Returns the nIndex'th frame in the queue without removing it,
	 * because IrLAP frames have to be acknowledged or resent.
	 */
	public IrLAPFrame get(int nIndex) {
		return (IrLAPFrame) m_list.get(nIndex);
	}

	/**
	 * Returns the first frame in the queue without removing it,
	 * because IrLAP data-carrying frames have to be acknowledged
	 * or resent.
	 */
	public IrLAPFrame getNext() {
		return (IrLAPFrame) m_list.getFirst();
	}

	/**
	 * Returns true if the list is nonempty, implying there are
	 * outstanding send requests.
	 */
	public boolean pendingDataRequests() {
		return m_list.size() != 0;
	}

	/**
	 * Remove a frame from the queue. Unnumbered and supervisory
	 * frames should always be removed from the queue upon being sent.
	 * Information frames should remain in the queue until they are
	 * acknowledged.
	 */
	public void remove(int nIndex) {
		m_list.remove(nIndex);
	}

	public void remove(IrLAPFrame frame) {
		m_list.remove(frame);
	}

	/**
	 * Remove the first frame from the queue. Unnumbered and supervisory
	 * frames should always be removed from the queue upon being sent.
	 * Information frames should remain in the queue until they are
	 * acknowledged.
	 */
	public void removeFirst() {
		m_list.removeFirst();
	}

	/**
	 * Returns the number of frames in the send queue.
	 */
	public int size() {
		return m_list.size();
	}
}

⌨️ 快捷键说明

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