Package org.apache.commons.collections15.buffer

Examples of org.apache.commons.collections15.buffer.TestCircularFifoBuffer


            // success
        }
    }

    private void verifyElementsInPredicate(final String[] elements) {
        Predicate pred = new Predicate() {
            public boolean evaluate(Object x) {
                for (int i = 0; i < elements.length; i++)
                    if (elements[i].equals(x))
                        return true;
                return false;
View Full Code Here


     *
     * @param i the Iterator to "filter"
     * @return "filtered" iterator
     */
    protected FilterIterator makePassThroughFilter(Iterator i) {
        Predicate pred = new Predicate() {
            public boolean evaluate(Object x) {
                return true;
            }
        };
        return new FilterIterator(i, pred);
View Full Code Here

     *
     * @param i the Iterator to "filter"
     * @return "filtered" iterator
     */
    protected FilterIterator makeBlockAllFilter(Iterator i) {
        Predicate pred = new Predicate() {
            public boolean evaluate(Object x) {
                return false;
            }
        };
        return new FilterIterator(i, pred);
View Full Code Here

            assertTrue("NoSuchElementException must be thrown", e.getClass().equals((new NoSuchElementException()).getClass()));
        }
    }

    public void testReset() {
        ResettableListIterator it = (ResettableListIterator) makeObject();

        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();

        assertEquals(true, it.hasNext());
        assertEquals(false, it.hasPrevious());
        assertEquals(testValue, it.next());
        assertEquals(false, it.hasNext());
        assertEquals(true, it.hasPrevious());

        it.reset();
        it.reset();

        assertEquals(true, it.hasNext());
    }
View Full Code Here

            }

            vv.setBackground(Color.WHITE);


            Transformer labelTransformer = new ChainedTransformer<String, String>(new Transformer[]{
                        new ToStringLabeller<Node>() {

                            public String transform(Node v) {
                                return v.getLabel();
                                //return ((primitives.graph.Node)(v.getVertex())).getLabel();
View Full Code Here

     * their natural ordering.
     */
    @SuppressWarnings("unchecked")
    public SortedSparseMultigraph()
    {
        this(new ComparableComparator(), new ComparableComparator());
    }
View Full Code Here

        } catch (BufferUnderflowException ex) {
        }
    }

    public void testBasicComparatorOps() {
        PriorityBuffer heap = new PriorityBuffer(new ReverseComparator(new ComparableComparator()));

        assertTrue("heap should be empty after create", heap.isEmpty());

        try {
            heap.get();
View Full Code Here

     * OrderedMap uses TreeMap as its known comparison.
     *
     * @return a map that is known to be valid
     */
    public Map makeConfirmedMap() {
        return new TreeMap(new NullComparator(ComparableComparator.getInstance()));
    }
View Full Code Here

     * The only confirmed collection we have that is ordered is the sorted one.
     * Thus, sort the keys.
     */
    public Object[] getSampleKeys() {
        List list = new ArrayList(Arrays.asList(super.getSampleKeys()));
        Collections.sort(list, new NullComparator(ComparableComparator.getInstance()));
        return list.toArray();
    }
View Full Code Here

        } catch (BufferUnderflowException ex) {
        }
    }

    public void testBasicComparatorOps() {
        PriorityBuffer heap = new PriorityBuffer(new ReverseComparator(new ComparableComparator()));

        assertTrue("heap should be empty after create", heap.isEmpty());

        try {
            heap.get();
View Full Code Here

TOP

Related Classes of org.apache.commons.collections15.buffer.TestCircularFifoBuffer

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.