Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 83   Methods: 7
NCLOC: 43   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
ObjectStack.java 50% 68.8% 42.9% 59.3%
coverage coverage
 1    /*
 2    * Licensed to the Apache Software Foundation (ASF) under one or more
 3    * contributor license agreements. See the NOTICE file distributed with
 4    * this work for additional information regarding copyright ownership.
 5    * The ASF licenses this file to You under the Apache License, Version 2.0
 6    * (the "License"); you may not use this file except in compliance with
 7    * the License. You may obtain a copy of the License at
 8    *
 9    * http://www.apache.org/licenses/LICENSE-2.0
 10    *
 11    * Unless required by applicable law or agreed to in writing, software
 12    * distributed under the License is distributed on an "AS IS" BASIS,
 13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14    * See the License for the specific language governing permissions and
 15    * limitations under the License.
 16    *
 17    * $Id: ObjectStack.java 541508 2007-05-25 01:54:12Z vgritsenko $
 18    */
 19   
 20    package org.apache.xindice.util;
 21   
 22    import java.io.Serializable;
 23   
 24    /**
 25    * ObjectQueue is a simple linked list implemention that can be used
 26    * for LIFO stacking
 27    *
 28    * @version $Revision: 541508 $, $Date: 2007-05-24 18:54:12 -0700 (Thu, 24 May 2007) $
 29    */
 30    public final class ObjectStack implements Serializable {
 31    static final long serialVersionUID = -7896992305408562521L;
 32   
 33    private ObjectStackItem last = null;
 34    private int size = 0;
 35   
 36  170230 public synchronized void push(Object value) {
 37  170231 size++;
 38  170231 ObjectStackItem q = new ObjectStackItem(value, last);
 39  170231 last = q;
 40    }
 41   
 42  181329 public synchronized Object pop() {
 43  181328 ObjectStackItem q = last;
 44  181329 if (q != null) {
 45  170229 size--;
 46  170229 last = q.prev;
 47  170229 return q.value;
 48    }
 49  11100 return null;
 50    }
 51   
 52  0 public boolean isEmpty() {
 53  0 return (size == 0);
 54    }
 55   
 56  0 public int size() {
 57  0 return size;
 58    }
 59   
 60  0 public synchronized Object peek() {
 61  0 return last != null ? last.value
 62    : null;
 63    }
 64   
 65  0 public synchronized void clear() {
 66  0 size = 0;
 67  0 last = null;
 68    }
 69   
 70    /**
 71    * ObjectStackItem
 72    */
 73   
 74    private class ObjectStackItem implements Serializable {
 75    public Object value;
 76    public ObjectStackItem prev;
 77   
 78  170231 public ObjectStackItem(Object value, ObjectStackItem prev) {
 79  170231 this.value = value;
 80  170231 this.prev = prev;
 81    }
 82    }
 83    }