|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
verinec.netsim.util.tables.SlidingWindowBuffer
public class SlidingWindowBuffer
A sliding window buffer
| Field Summary | |
|---|---|
private int |
capacity
|
private int |
lastAcked
|
| Constructor Summary | |
|---|---|
SlidingWindowBuffer(int initialCapacity)
Creates a new sliding window buffer. |
|
| Method Summary | |
|---|---|
byte |
get()
gets the first part of data (a byte) from the contiguous part of the window and removes it from the buffer |
byte |
get(int key)
gets data (a byte) from the contiguous part of the window and removes it from the buffer |
int |
getAck()
gets the address of the last part of the buffer that can be acknowledged |
private Integer |
getSmallestKey()
|
int |
put(int key,
byte data)
writes a byte of data |
private void |
updateLastAcked()
|
int |
windowsize()
gets the remaining window size |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int capacity
private int lastAcked
| Constructor Detail |
|---|
public SlidingWindowBuffer(int initialCapacity)
initialCapacity - the window size (capacity of the buffer)| Method Detail |
|---|
public int put(int key,
byte data)
throws NetSimException
key - a keydata - the data
NetSimException - if there if no more spave left in buffer or the address is out of window rangepublic int getAck()
private void updateLastAcked()
public byte get(int key)
throws NetSimException
key - the address of the byte
NetSimException - if requested element not in buffer or separated by missing partprivate Integer getSmallestKey()
public byte get()
throws NetSimException
NetSimException - if requested element not in buffer or separated by missing partpublic int windowsize()
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||