Examples of XEnumerableMap


Examples of com.sun.star.container.XEnumerableMap

    public void testEnumerations() throws com.sun.star.uno.Exception
    {
        // fill a map
        final String[] keys = new String[] { "This", "is", "an", "enumeration", "test" };
        final String[] values = new String[] { "for", "the", "map", "implementation", "." };
        XEnumerableMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(), new Type( String.class ), new Type( String.class ) );
        impl_putAll( map, keys, values );

        final Pair< ?, ? >[] paired = new Pair< ?, ? >[ keys.length ];
        for ( int i=0; i<keys.length; ++i )
            paired[i] = new Pair< Object, Object >( keys[i], values[i] );

        // create non-isolated enumerators, and check their content
        XEnumeration enumerateKeys = map.createKeyEnumeration( false );
        XEnumeration enumerateValues = map.createValueEnumeration( false );
        XEnumeration enumerateAll = map.createElementEnumeration( false );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );

        // all enumerators above have been created as non-isolated iterators, so they're expected to die when
        // the underlying map changes
        map.remove( keys[0] );
        assureException( enumerateKeys, "hasMoreElements", new Object[] {}, DisposedException.class );
        assureException( enumerateValues, "hasMoreElements", new Object[] {}, DisposedException.class );
        assureException( enumerateAll, "hasMoreElements", new Object[] {}, DisposedException.class );

        // now try with isolated iterators
        map.put( keys[0], values[0] );
        enumerateKeys = map.createKeyEnumeration( true );
        enumerateValues = map.createValueEnumeration( true );
        enumerateAll = map.createElementEnumeration( true );
        map.put( "additional", "value" );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );
    }
View Full Code Here

Examples of com.sun.star.container.XEnumerableMap

    public void testSpecialValues() throws com.sun.star.uno.Exception
    {
        final Double[] keys = new Double[] { new Double( 0 ), Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY };
        final Double[] values = new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, new Double( 0 ) };

        XEnumerableMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(), new Type( Double.class ), new Type( Double.class ) );
        impl_putAll( map, keys, values );

        assure( "containsKey( Double.+INF failed", map.containsKey( Double.POSITIVE_INFINITY ) );
        assure( "containsKey( Double.-INF failed", map.containsKey( Double.NEGATIVE_INFINITY ) );
        assure( "containsKey( 0 ) failed", map.containsKey( new Double( 0 ) ) );

        assure( "containsValue( Double.+INF ) failed", map.containsValue( Double.POSITIVE_INFINITY ) );
        assure( "containsValue( Double.-INF ) failed", map.containsValue( Double.NEGATIVE_INFINITY ) );
        assure( "containsValue( 0 ) failed", map.containsValue( new Double( 0 ) ) );

        // put and containsKey should reject Double.NaN as key
        assureException( "Double.NaN should not be allowed as key in a call to 'put'", map, "put",
            new Class[] { Object.class, Object.class }, new Object[] { Double.NaN, new Double( 0 ) },
            com.sun.star.lang.IllegalArgumentException.class );
View Full Code Here

Examples of com.sun.star.container.XEnumerableMap

    @Test public void testEnumerations() throws com.sun.star.uno.Exception
    {
        // fill a map
        final String[] keys = new String[] { "This", "is", "an", "enumeration", "test" };
        final String[] values = new String[] { "for", "the", "map", "implementation", "." };
        XEnumerableMap map = com.sun.star.container.EnumerableMap.create( connection.getComponentContext(), new Type( String.class ), new Type( String.class ) );
        impl_putAll( map, keys, values );

        final Pair< ?, ? >[] paired = new Pair< ?, ? >[ keys.length ];
        for ( int i=0; i<keys.length; ++i )
        {
            paired[i] = new Pair< Object, Object >( keys[i], values[i] );
        }

        // create non-isolated enumerators, and check their content
        XEnumeration enumerateKeys = map.createKeyEnumeration( false );
        XEnumeration enumerateValues = map.createValueEnumeration( false );
        XEnumeration enumerateAll = map.createElementEnumeration( false );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );

        // all enumerators above have been created as non-isolated iterators, so they're expected to die when
        // the underlying map changes
        map.remove( keys[0] );
//?        assureException( enumerateKeys, "hasMoreElements", new Object[] {}, DisposedException.class );
//?        assureException( enumerateValues, "hasMoreElements", new Object[] {}, DisposedException.class );
//?        assureException( enumerateAll, "hasMoreElements", new Object[] {}, DisposedException.class );

        // now try with isolated iterators
        map.put( keys[0], values[0] );
        enumerateKeys = map.createKeyEnumeration( true );
        enumerateValues = map.createValueEnumeration( true );
        enumerateAll = map.createElementEnumeration( true );
        map.put( "additional", "value" );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );
    }
View Full Code Here

Examples of com.sun.star.container.XEnumerableMap

    @Test public void testSpecialValues() throws com.sun.star.uno.Exception
    {
        final Double[] keys = new Double[] { new Double( 0 ), Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY };
        final Double[] values = new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, new Double( 0 ) };

        XEnumerableMap map = com.sun.star.container.EnumerableMap.create( connection.getComponentContext(), new Type( Double.class ), new Type( Double.class ) );
        impl_putAll( map, keys, values );

        assertTrue( "containsKey( Double.+INF failed", map.containsKey( Double.POSITIVE_INFINITY ) );
        assertTrue( "containsKey( Double.-INF failed", map.containsKey( Double.NEGATIVE_INFINITY ) );
        assertTrue( "containsKey( 0 ) failed", map.containsKey( new Double( 0 ) ) );

        assertTrue( "containsValue( Double.+INF ) failed", map.containsValue( Double.POSITIVE_INFINITY ) );
        assertTrue( "containsValue( Double.-INF ) failed", map.containsValue( Double.NEGATIVE_INFINITY ) );
        assertTrue( "containsValue( 0 ) failed", map.containsValue( new Double( 0 ) ) );

        // put and containsKey should reject Double.NaN as key
//?        assureException( "Double.NaN should not be allowed as key in a call to 'put'", map, "put",
//?            new Class[] { Object.class, Object.class }, new Object[] { Double.NaN, new Double( 0 ) },
//?            com.sun.star.lang.IllegalArgumentException.class );
View Full Code Here

Examples of com.sun.star.container.XEnumerableMap

    public void testEnumerations() throws com.sun.star.uno.Exception
    {
        // fill a map
        final String[] keys = new String[] { "This", "is", "an", "enumeration", "test" };
        final String[] values = new String[] { "for", "the", "map", "implementation", "." };
        XEnumerableMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(), new Type( String.class ), new Type( String.class ) );
        impl_putAll( map, keys, values );

        final Pair< ?, ? >[] paired = new Pair< ?, ? >[ keys.length ];
        for ( int i=0; i<keys.length; ++i )
            paired[i] = new Pair< Object, Object >( keys[i], values[i] );

        // create non-isolated enumerators, and check their content
        XEnumeration enumerateKeys = map.createKeyEnumeration( false );
        XEnumeration enumerateValues = map.createValueEnumeration( false );
        XEnumeration enumerateAll = map.createElementEnumeration( false );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );

        // all enumerators above have been created as non-isolated iterators, so they're expected to die when
        // the underlying map changes
        map.remove( keys[0] );
        assureException( enumerateKeys, "hasMoreElements", new Object[] {}, DisposedException.class );
        assureException( enumerateValues, "hasMoreElements", new Object[] {}, DisposedException.class );
        assureException( enumerateAll, "hasMoreElements", new Object[] {}, DisposedException.class );

        // now try with isolated iterators
        map.put( keys[0], values[0] );
        enumerateKeys = map.createKeyEnumeration( true );
        enumerateValues = map.createValueEnumeration( true );
        enumerateAll = map.createElementEnumeration( true );
        map.put( "additional", "value" );
        impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
        impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
        impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );
    }
View Full Code Here

Examples of com.sun.star.container.XEnumerableMap

    public void testSpecialValues() throws com.sun.star.uno.Exception
    {
        final Double[] keys = new Double[] { new Double( 0 ), Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY };
        final Double[] values = new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, new Double( 0 ) };

        XEnumerableMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(), new Type( Double.class ), new Type( Double.class ) );
        impl_putAll( map, keys, values );

        assure( "containsKey( Double.+INF failed", map.containsKey( Double.POSITIVE_INFINITY ) );
        assure( "containsKey( Double.-INF failed", map.containsKey( Double.NEGATIVE_INFINITY ) );
        assure( "containsKey( 0 ) failed", map.containsKey( new Double( 0 ) ) );

        assure( "containsValue( Double.+INF ) failed", map.containsValue( Double.POSITIVE_INFINITY ) );
        assure( "containsValue( Double.-INF ) failed", map.containsValue( Double.NEGATIVE_INFINITY ) );
        assure( "containsValue( 0 ) failed", map.containsValue( new Double( 0 ) ) );

        // put and containsKey should reject Double.NaN as key
        assureException( "Double.NaN should not be allowed as key in a call to 'put'", map, "put",
            new Class[] { Object.class, Object.class }, new Object[] { Double.NaN, new Double( 0 ) },
            com.sun.star.lang.IllegalArgumentException.class );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.