Package commonj.sdo

Examples of commonj.sdo.Sequence


        }

        registerNamespace(realTypeName.getPrefix(), realTypeName.getNamespaceURI());

        if (obj.getType().isSequenced()) {
            Sequence sequence = obj.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                Property property = sequence.getProperty(i);
                Object value = sequence.getValue(i);
                if (property == null) {
                    elementList.add(new NameValuePair(ELEMENT_TEXT, value));
                } else {
                    addProperty(elementList, children, property, value, obj);
                }
View Full Code Here


        List<Property> properties = wrapperDO.getInstanceProperties();
        List<Object> elements = new ArrayList<Object>();
        Type type = wrapperDO.getType();
        if (type.isSequenced()) {
            // Add values in the sequence
            Sequence sequence = wrapperDO.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                // Skip mixed text
                if (sequence.getProperty(i) != null) {
                    elements.add(sequence.getValue(i));
                }
            }
        } else {
            for (Property p : properties) {
                Object child = wrapperDO.get(p);
View Full Code Here

        List<Property> properties = wrapperDO.getInstanceProperties();
        List<Object> elements = new ArrayList<Object>();
        Type type = wrapperDO.getType();
        if (type.isSequenced()) {
            // Add values in the sequence
            Sequence sequence = wrapperDO.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                // Skip mixed text
                if (sequence.getProperty(i) != null) {
                    elements.add(sequence.getValue(i));
                }
            }
        } else {
            for (Property p : properties) {
                Object child = wrapperDO.get(p);
View Full Code Here

        }

        registerNamespace(realTypeName.getPrefix(), realTypeName.getNamespaceURI());

        if (obj.getType().isSequenced()) {
            Sequence sequence = obj.getSequence();
            for (int i = 0; i < sequence.size(); i++) {
                Property property = sequence.getProperty(i);
                Object value = sequence.getValue(i);
                if (property == null) {
                    elementList.add(new NameValuePair(ELEMENT_TEXT, value));
                } else {
                    addProperty(elementList, children, property, value, obj);
                }
View Full Code Here

    {
      Property property = (Property)iterator.next();
      if (dataObject.isSet(property))
        if (isSequenceProperty(property))
        {
          Sequence sequence = (Sequence)dataObject.get(property);
          int size = sequence.size();
          if (index < size)
            return sequence.getProperty(index);
          index -= size;
        }
        else if (property.isMany())
        {
          int size = dataObject.getList(property).size();
View Full Code Here

    {
      Property property = (Property)iterator.next();
      if (dataObject.isSet(property))
        if (isSequenceProperty(property))
        {
          Sequence sequence = (Sequence)dataObject.get(property);
          int size = sequence.size();
          if (index < size)
            return sequence.getValue(index);
          index -= size;
        }
        else if (property.isMany())
        {
          List values = dataObject.getList(property);
View Full Code Here

    {
      Property property = (Property)iterator.next();
      if (dataObject.isSet(property))
        if (isSequenceProperty(property))
        {
          Sequence sequence = (Sequence)dataObject.get(property);
          int size = sequence.size();
          if (index < size)
            return sequence.setValue(index, value);
          index -= size;
        }
        else if (property.isMany())
        {
          List values = dataObject.getList(property);
View Full Code Here

    {
      Property property = (Property)iterator.next();
      if (dataObject.isSet(property))
        if (isSequenceProperty(property))
        {
          Sequence sequence = (Sequence)dataObject.get(property);
          int size = sequence.size();
          if (index < size)
          {
            sequence.add(index, p, value);
            return;
          }
          index -= size;
          if (index != 0)
            continue;
          if (insert(iterator, p, value) != 0)
            /*assert */sequence.add(p, value);
          return;
        } // sequence(property)
        else if (property.isMany())
        {
          List values = dataObject.getList(property);
View Full Code Here

    {
      Property property = (Property)iterator.next();
      if (dataObject.isSet(property))
        if (isSequenceProperty(property))
        {
          Sequence sequence = (Sequence)dataObject.get(property);
          int size = sequence.size();
          if (index < size)
          {
            sequence.remove(index);
            return;
          }
          index -= size;
        }
        else if (property.isMany())
View Full Code Here

    {
      Property property = (Property)iterator.next();
      if (dataObject.isSet(property))
        if (isSequenceProperty(property))
        {
          Sequence sequence = (Sequence)dataObject.get(property);
          int size = sequence.size();
          if (toIndex < size)
          {
            if (fromIndex < size)
            {
              sequence.move(toIndex, fromIndex);
              return;
            }
            while (iterator.hasNext())
            {
              property = (Property)iterator.next();
              if (!dataObject.isSet(property))
                continue;
              fromIndex -= size;
              if (isSequenceProperty(property))
              {
                Sequence fromSequence = (Sequence)dataObject.get(property);
                size = fromSequence.size();
                if (fromIndex >= size)
                  continue;
                move(fromSequence, fromIndex, sequence, toIndex);
                return;
              }
              if (property.isMany())
              {
                List list = dataObject.getList(property);
                size = list.size();
                if (fromIndex >= size)
                  continue;
                sequence.add(toIndex, property, list.remove(fromIndex)); // removes containment
                return;
              }
              if (fromIndex == 0)
              {
                sequence.add(toIndex, property, dataObject.get(property)); // removes containment
                dataObject.unset(property);
                return;
              }
              size = 1;
            } // iterator.hasNext()
            break;
          } // toIndex < size
          if (fromIndex < size)
          {
            while (iterator.hasNext())
            {
              property = (Property)iterator.next();
              if (!dataObject.isSet(property))
                continue;
              toIndex -= size;
              if (isSequenceProperty(property))
              {
                Sequence toSequence = (Sequence)dataObject.get(property);
                size = toSequence.size();
                if (toIndex >= size)
                  continue;
                if (++toIndex == size)
                  toSequence.add(sequence.getProperty(fromIndex), remove(sequence, fromIndex)); // Java pushes stack from left to right
                    // removes containment
                else
                  move(sequence, fromIndex, toSequence, toIndex);
                return;
              }
              if (property.isMany())
              {
                List list = dataObject.getList(property);
                size = list.size();
                if (toIndex >= size)
                  continue;
                if (sequence.getProperty(fromIndex) != property)
                  throw new IllegalArgumentException();
                add(remove(sequence, fromIndex), list, toIndex, size);
                return;
              }
              if (toIndex == 0)
              {
                while (iterator.hasNext())
                {
                  Property p = sequence.getProperty(fromIndex);
                  property = (Property)iterator.next();
                  EStructuralFeature feature = (EStructuralFeature)property;
                  if (dataObject.isSet(property))
                  {
                    if (FeatureMapUtil.isFeatureMap(feature))
                    {
                      /*if (!validate(feature, p))
                        throw new IllegalArgumentException(); */
                      move(sequence, fromIndex, (Sequence)dataObject.get(property), 0, p);
                      return;
                    }
                    if (property != p || !property.isMany())
                      throw new IllegalArgumentException();
                    insert(property, remove(sequence, fromIndex)); // removes containment
                    return;
                  }
                  if (FeatureMapUtil.isFeatureMap(feature))
                  {
                    if (validate(feature, p))
                    {
                      append(property, p, remove(sequence, fromIndex)); // removes containment
                      return;
                    }
                  }
                  else if (property == p)
                  {
                    set(property, remove(sequence, fromIndex));
                    return;
                  }
                } // iterator.hasNext()
                break;
              }
              size = 1;
            } // iterator.hasNext()
            break;
          } // fromIndex < size
          toIndex -= size;
          fromIndex -= size;
        } // sequence(property)
        else if (property.isMany())
        {
          List list = dataObject.getList(property);
          int size = list.size();
          if (toIndex < size)
          {
            if (fromIndex < size)
            {
              ((EList)list).move(toIndex, fromIndex);
              return;
            }
            while (iterator.hasNext())
            {
              Property p = (Property)iterator.next();
              if (!dataObject.isSet(p))
                continue;
              fromIndex -= size;
              if (isSequenceProperty(p))
              {
                Sequence fromSequence = (Sequence)dataObject.get(p);
                size = fromSequence.size();
                if (fromIndex >= size)
                  continue;
                if (fromSequence.getProperty(fromIndex) != property)
                  throw new IllegalArgumentException();
                list.add(toIndex, remove(fromSequence, fromIndex)); // removes containment
                return;
              }
              if (p.isMany())
              {
                List l = dataObject.getList(p);
                size = l.size();
                if (fromIndex >= size)
                  continue;
                /*if (p != property)
                  throw new IllegalArgumentException(); */
                list.add(toIndex, l.remove(fromIndex)); // removes containment
                return;
              }
              if (fromIndex == 0)
              {
                /*if (p != property)
                throw new IllegalArgumentException(); */
                list.add(toIndex, dataObject.get(p)); // removes containment
                dataObject.unset(p);
                return;
              }
              size = 1;
            } // iterator.hasNext()
            break;
          } // toIndex < size
          if (fromIndex < size)
          {
            while (iterator.hasNext())
            {
              Property p = (Property)iterator.next();
              if (!dataObject.isSet(p))
                continue;
              toIndex -= size;
              if (isSequenceProperty(p))
              {
                Sequence toSequence = (Sequence)dataObject.get(p);
                size = toSequence.size();
                if (toIndex >= size)
                  continue;
                add(property, list.remove(fromIndex), toSequence, toIndex, size);
                return;
              }
              if (p.isMany())
              {
                List l = dataObject.getList(p);
                size = l.size();
                if (toIndex >= size)
                  continue;
                /*if (property != p)
                  throw new IllegalArgumentException(); */
                add(list.remove(fromIndex), l, toIndex, size);
                return;
              }
              if (toIndex == 0)
              {
                while (iterator.hasNext())
                {
                  p = (Property)iterator.next();
                  EStructuralFeature feature = (EStructuralFeature)p;
                  if (dataObject.isSet(p))
                  {
                    if (FeatureMapUtil.isFeatureMap(feature))
                    {
                      /*if (!validate(feature, property))
                        throw new IllegalArgumentException(); */
                      insert(p, property, list.remove(fromIndex));
                      return;
                    }
                    if (/*p != property || */!p.isMany())
                      throw new IllegalArgumentException();
                    insert(p, list.remove(fromIndex)); // removes containment
                    return;
                  }
                  if (FeatureMapUtil.isFeatureMap(feature))
                  {
                    if (!validate(feature, property))
                      continue;
                    append(p, property, list.remove(fromIndex)); // removes containment
                    return;
                  }
                  else if (p == property)
                  {
                    set(p, list.remove(fromIndex));
                    return;
                  }
                } // iterator.hasNext()
                break;
              } // toIndex == 0
              size = 1;
            } // iterator.hasNext()
            break;
          } // fromIndex < size
          toIndex -= size;
          fromIndex -= size;
        } // property.isMany()
        else if (toIndex == 0)
          throw new IllegalArgumentException();
        else if (fromIndex == 0)
        {
          for (int size = 1; iterator.hasNext() ;)
          {
            Property p = (Property)iterator.next();
            if (!dataObject.isSet(p))
              continue;
            toIndex -= size;
            if (isSequenceProperty(p))
            {
              Sequence toSequence = (Sequence)dataObject.get(p);
              size = toSequence.size();
              if (toIndex >= size)
                continue;
              add(property, dataObject.get(property), toSequence, toIndex, size);
              dataObject.unset(property);
              return;
View Full Code Here

TOP

Related Classes of commonj.sdo.Sequence

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.