Mercurial > hg > Applications > TreeVNC
view src/main/java/ac/ryukyu/treevnc/MostRecentMultiCast.java @ 3:e7ce2b2ffed8
add and modify files
author | Yu Taninari <you@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Jul 2012 15:46:36 +0900 |
parents | |
children |
line wrap: on
line source
package ac.ryukyu.treevnc; import java.util.LinkedList; public class MostRecentMultiCast<T> extends MulticastQueue<T> { LinkedList<Node<T>> alive; int count = 0; MostRecentMultiCast(int limit) { count = limit; this.alive = new LinkedList<Node<T>>(); } @Override public synchronized void put(T item) { Node<T> next = new Node<T>(item); tail.set(next); tail = next; alive.addLast(next); if (alive.size()>count) { Node<T> old = alive.getFirst(); old.clear(); } } }