Package org.simoes.lpd.util

Examples of org.simoes.lpd.util.Queue


   
    /** constructor.
     * @param name - name of the print queue.
     */
    public PrintQueue(String name) {
    queue = new Queue(name);
    lock = new Lock(name);
    }
View Full Code Here


   * @return number of jobs removed, or -1 if this failed
   */
  public int removeAll() {
    int rval = -1;
    rval = size();
    queue = new Queue(queue.getName());
    return rval;
  }
View Full Code Here

   * @return number of jobs removed, or -1 if this failed
   */
  public int removeAll() {
    int rval = -1;
    rval = size();
    queue = new Queue(queue.getName());
    printJobTableModel.fireTableDataChanged();
    return rval;
  }
View Full Code Here

    // tests
    public void testQueue0() {
        final String METHOD = "testQueue0";
        try {
            // 0. create queue
            Queue testQueue = new Queue("test queue");
      assertTrue("initial size of queue is 0", testQueue.size() == 0);
           
            // 1. create some objects
            Integer i0 = new Integer(0);
            Integer i1 = new Integer(1);
            Integer i2 = new Integer(2);
           
            // 2. add to the queue
            long id0 = testQueue.add(i0);
      assertTrue("size of queue after first add is 1", testQueue.size() == 1);
            long id1 = testQueue.add(i1);
      assertTrue("size of queue is second add is 2", testQueue.size() == 2);
            long id2 = testQueue.add(i2);
      assertTrue("size of queue is third add is 3", testQueue.size() == 3);
           
            // 3. remove objects
            Object o0 = testQueue.remove(id0);
      assertTrue("size of queue after first remove is 2", testQueue.size() == 2);
            Object o1 = testQueue.remove(id1);
      assertTrue("size of queue after second remove is 1", testQueue.size() == 1);
            Object o2 = testQueue.remove(id2);
      assertTrue("size of queue after third remove is 0", testQueue.size() == 0);
           
            // 4. compare objects
      assertTrue("comparing objects before and after adding/removing from the queue",
           o0.equals(i0) && o1.equals(i1) && o2.equals(i2));
           
View Full Code Here

TOP

Related Classes of org.simoes.lpd.util.Queue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.