Package org.omg.DynamicAny

Examples of org.omg.DynamicAny.DynSequence


            DynAny _dynAny = toDynAny(value);
            _length = _dynAny.component_count();
            break;

        case TCKind._tk_sequence:
            DynSequence _dynSequence = toDynSequence(value);
            _length = _dynSequence.get_length();
            break;

        default:
            throw new EvaluationException("Neither array nor sequence");
        }
View Full Code Here


    public EvaluationResult evaluateElementInSequence(EvaluationContext context,
            EvaluationResult element, Any sequence) throws EvaluationException
    {
        try
        {
            final DynSequence _dynSequence = DynSequenceHelper.narrow(toDynAny(sequence));

            _dynSequence.rewind();

            do
            {
                final DynAny _currentComponent = _dynSequence.current_component();

                final EvaluationResult _currentElement = EvaluationResult.fromAny(_currentComponent.to_any());

                if (element.compareTo(_currentElement) == 0)
                {
                    return EvaluationResult.BOOL_TRUE;
                }
            } while (_dynSequence.next());

            return EvaluationResult.BOOL_FALSE;
        } catch (TypeMismatch e)
        {
            throw newEvaluationException(e);
View Full Code Here

        dynFactory = org.omg.DynamicAny.DynAnyFactoryHelper.narrow(obj);
    }

    public void testInsertAnyObject() throws Exception
    {
        DynSequence dyn_seq = null;

        org.omg.CORBA.Object obj = orb.string_to_object(nameService);

        TypeCode tc = org.omg.CosNaming.NamingContextExtHelper.type();

        TypeCode seq_tc = orb.create_sequence_tc(2, tc);

        dyn_seq = (DynSequence) dynFactory.create_dyn_any_from_type_code(seq_tc);

        Any[] object_sequence = new Any[2];
        object_sequence[0] = orb.create_any();
        object_sequence[1] = orb.create_any();
        object_sequence[0].insert_Object(obj, tc);
        object_sequence[1].insert_Object(obj, tc);

        dyn_seq.set_elements(object_sequence);

        dyn_seq.to_any();

        dyn_seq.destroy();
    }
View Full Code Here

        dyn_seq.destroy();
    }

    public void testInsertDynAnyObject() throws Exception
    {
        DynSequence dyn_seq = null;

        TypeCode tc = org.omg.CosNaming.NamingContextExtHelper.type();

        TypeCode seq_tc = orb.create_sequence_tc(2, tc);

        dyn_seq = (DynSequence) dynFactory.create_dyn_any_from_type_code(seq_tc);

        DynAny[] object_sequence = new DynAny[2];

        object_sequence[0] = dynFactory.create_dyn_any_from_type_code(tc);
        object_sequence[1] = dynFactory.create_dyn_any_from_type_code(tc);

        dyn_seq.set_elements_as_dyn_any(object_sequence);

        dyn_seq.to_any();

        dyn_seq.destroy();
    }
View Full Code Here

      type = getIntSeq ();
      any = orb.create_any ();
      BoundedDataHelper.insert (any, type);

      DynSequence sequence = createDynAnyFromAny (any);

      assertEquals(Bound.value, sequence.get_length());

      sequence.set_length(5);
      assertEquals(5, sequence.get_length());

      sequence.set_length(0);
      assertEquals(0, sequence.get_length());
   }
View Full Code Here

    // get the type of the sequence data
    tc = tc.content_type();
    TCKind kind = tc.kind();

    org.omg.DynamicAny.DynAny da = DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory")).create_dyn_any(val);
    DynSequence ds = DynSequenceHelper.narrow(da);
    int len = ds.get_length();
    //**//
    result = new Value[len];

    switch (kind.value()) {
    case TCKind._tk_short: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createShort(ds.get_short());
    }
    break;

    case TCKind._tk_long: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createLong(ds.get_long());
    }
    break;

    case TCKind._tk_ushort: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createUShort(ds.get_ushort());
    }
    break;

    case TCKind._tk_ulong: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createULong(ds.get_ulong());
    }
    break;

    case TCKind._tk_float: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createFloat(ds.get_float());
    }
    break;

    case TCKind._tk_double: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createDouble(ds.get_double());
    }
    break;

    case TCKind._tk_boolean: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createBoolean(ds.get_boolean());
    }
    break;

    case TCKind._tk_char: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createChar(ds.get_char());
    }
    break;

    case TCKind._tk_string: {
        for (int i = 0; i < len; i++, ds.next())
      result[i] = ValueFactory.createString(ds.get_string());
    }
    break;
    }

    da.destroy();
View Full Code Here

            + "01C00000000000100010000000105010001000101090000000105010001";


    public void testInsertAnyObject() throws Exception
    {
        DynSequence dyn_seq = null;

        org.omg.CORBA.Object obj = orb.string_to_object(nameService);

        TypeCode tc = org.omg.CosNaming.NamingContextExtHelper.type();

        TypeCode seq_tc = orb.create_sequence_tc(2, tc);

        dyn_seq = (DynSequence) factory.create_dyn_any_from_type_code(seq_tc);

        Any[] object_sequence = new Any[2];
        object_sequence[0] = orb.create_any();
        object_sequence[1] = orb.create_any();
        object_sequence[0].insert_Object(obj, tc);
        object_sequence[1].insert_Object(obj, tc);

        dyn_seq.set_elements(object_sequence);

        dyn_seq.to_any();

        dyn_seq.destroy();
    }
View Full Code Here

        dyn_seq.destroy();
    }

    public void testInsertDynAnyObject() throws Exception
    {
        DynSequence dyn_seq = null;

        TypeCode tc = org.omg.CosNaming.NamingContextExtHelper.type();

        TypeCode seq_tc = orb.create_sequence_tc(2, tc);

        dyn_seq = (DynSequence) factory.create_dyn_any_from_type_code(seq_tc);

        DynAny[] object_sequence = new DynAny[2];

        object_sequence[0] = factory.create_dyn_any_from_type_code(tc);
        object_sequence[1] = factory.create_dyn_any_from_type_code(tc);

        dyn_seq.set_elements_as_dyn_any(object_sequence);

        dyn_seq.to_any();

        dyn_seq.destroy();
    }
View Full Code Here

            DynAny _dynAny = toDynAny(value);
            _length = _dynAny.component_count();
            break;

        case TCKind._tk_sequence:
            DynSequence _dynSequence = toDynSequence(value);
            _length = _dynSequence.get_length();
            break;

        default:
            throw new EvaluationException("Neither array nor sequence");
        }
View Full Code Here

    public EvaluationResult evaluateElementInSequence(EvaluationContext context,
            EvaluationResult element, Any sequence) throws EvaluationException
    {
        try
        {
            final DynSequence _dynSequence = DynSequenceHelper.narrow(toDynAny(sequence));

            _dynSequence.rewind();

            do
            {
                final DynAny _currentComponent = _dynSequence.current_component();

                final EvaluationResult _currentElement = EvaluationResult.fromAny(_currentComponent.to_any());

                if (element.compareTo(_currentElement) == 0)
                {
                    return EvaluationResult.BOOL_TRUE;
                }
            } while (_dynSequence.next());

            return EvaluationResult.BOOL_FALSE;
        } catch (TypeMismatch e)
        {
            throw newEvaluationException(e);
View Full Code Here

TOP

Related Classes of org.omg.DynamicAny.DynSequence

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.