Mercurial > hg > Applications > TightVNC_orginal
comparison src/main/java/jp/ac/u_ryukyu/treevnc/MostRecentMultiCast.java @ 12:12c3a73be47f
rename package
author | one |
---|---|
date | Tue, 21 Aug 2012 14:24:38 +0900 |
parents | src/main/java/ac/ryukyu/treevnc/MostRecentMultiCast.java@e7ce2b2ffed8 |
children |
comparison
equal
deleted
inserted
replaced
11:57ae9fbb1245 | 12:12c3a73be47f |
---|---|
1 package jp.ac.u_ryukyu.treevnc; | |
2 | |
3 import java.util.LinkedList; | |
4 | |
5 | |
6 public class MostRecentMultiCast<T> extends MulticastQueue<T> { | |
7 | |
8 LinkedList<Node<T>> alive; | |
9 int count = 0; | |
10 MostRecentMultiCast(int limit) { | |
11 count = limit; | |
12 this.alive = new LinkedList<Node<T>>(); | |
13 } | |
14 | |
15 @Override | |
16 public synchronized void put(T item) | |
17 { | |
18 Node<T> next = new Node<T>(item); | |
19 tail.set(next); | |
20 tail = next; | |
21 alive.addLast(next); | |
22 if (alive.size()>count) { | |
23 Node<T> old = alive.getFirst(); | |
24 old.clear(); | |
25 } | |
26 } | |
27 } |