1 32 33 package com.knowgate.scheduler; 34 35 36 import java.util.LinkedList ; 37 38 43 public class AtomQueue extends LinkedList { 44 private int iMaxAtoms; 45 46 49 public AtomQueue() { 50 iMaxAtoms = 1000; 51 } 52 53 57 public AtomQueue(int iMaxSize) { 58 iMaxAtoms = iMaxSize; 59 } 60 61 63 66 public int maxsize() { 67 return iMaxAtoms; 68 } 69 70 72 76 77 public synchronized void push(Atom oAtm) { 78 addLast(oAtm); 79 } 80 81 83 86 87 public synchronized Atom pop() { 88 Atom oAtm; 89 if (this.size()>0) { 90 oAtm = (Atom) getFirst(); 91 removeFirst(); 92 } else { 93 oAtm = null; 94 } 95 return oAtm; 96 } 98 } | Popular Tags |