Package org.apache.commons.collections15.bag

Examples of org.apache.commons.collections15.bag.HashBag


        assertEquals(0, CollectionUtils.cardinality("B", set));
        assertEquals(1, CollectionUtils.cardinality("C", set));
        assertEquals(0, CollectionUtils.cardinality("D", set));
        assertEquals(1, CollectionUtils.cardinality("E", set));

        Bag bag = new HashBag();
        bag.add("A", 3);
        bag.add("C");
        bag.add("E");
        bag.add("E");
        assertEquals(3, CollectionUtils.cardinality("A", bag));
        assertEquals(0, CollectionUtils.cardinality("B", bag));
        assertEquals(1, CollectionUtils.cardinality("C", bag));
        assertEquals(0, CollectionUtils.cardinality("D", bag));
        assertEquals(2, CollectionUtils.cardinality("E", bag));
View Full Code Here


        // Enumeration, non-existent entry -- "dead" enumerator returned
        test = CollectionUtils.index(enumeration, 3);
        assertTrue(test.equals(enumeration) && !enumeration.hasMoreElements());
       
        // Collection, entry exists
        Bag bag = new HashBag();
        bag.add("element", 1);
        test = CollectionUtils.index(bag, 0);
        assertTrue(test.equals("element"));
       
        // Collection, non-existent entry -- "dead" iterator returned
        test = CollectionUtils.index(bag, 2);
View Full Code Here

            assertTrue(!enumeration.hasMoreElements());
        }

        {
            // Collection, entry exists
            Bag bag = new HashBag();
            bag.add("element", 1);
            assertEquals("element", CollectionUtils.get(bag, 0));
       
            // Collection, non-existent entry
            try {
                CollectionUtils.get(bag, 1);
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

        final ImageIcon icon = mapIcon;

        Dimension layoutSize = new Dimension(2000,1000);
       
        Layout<String,Number> layout = new StaticLayout<String,Number>(graph,
            new ChainedTransformer(new Transformer[]{
                new CityTransformer(map),
                new LatLonPixelTransformer(new Dimension(2000,1000))
            }));
         
        layout.setSize(layoutSize);
View Full Code Here

public class TestModelAnalysisUtils extends TestCase{

 
  public void testCreateStateGraph() throws Exception
  {
     ChainedTransformer transformer = new ChainedTransformer( new Transformer[]{ExceptionTransformer.getInstance(), new ChainedTransformer(new Transformer[]{}), new ConstantTransformer("hallo") });
    
     Graph stateGraph = ModelAnalysisBoostUtils.createStateGraph(transformer);
    
     Window display = JungGraphBoostUtils.displayGraph(stateGraph, JFrame.DISPOSE_ON_CLOSE);
    
View Full Code Here

TOP

Related Classes of org.apache.commons.collections15.bag.HashBag

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.