/**
         * recursively write out a node of the instance
         * @param out
         * @param e
         * @param ref
         * @throws IOException
         */
        private void writeTreeElement(BinaryWriter out_, TreeElement e)
        {
            TreeElement templ   = instance.getTemplatePath(e.getRef());
            Boolean     isGroup = !templ.isLeaf();

            if (isGroup)
            {
                ArrayList childTypesHandled = new ArrayList();
                for (int i = 0; i < templ.getNumChildren(); i++)
                {
                    String childName = templ.getChildAt(i).getName();
                    if (!childTypesHandled.Contains(childName))
                    {
                        childTypesHandled.Add(childName);

                        int mult = e.getChildMultiplicity(childName);
                        if (mult > 0 && !e.getChild(childName, 0).isRelevant())
                        {
                            mult = 0;
                        }

                        ExtUtil.writeNumeric(out_, mult);
                        for (int j = 0; j < mult; j++)
                        {
                            writeTreeElement(out_, e.getChild(childName, j));
                        }
                    }
                }
            }
            else
            {
                ExtUtil.write(out_, new ExtWrapAnswerData(this, e.dataType, e.getValue()));
            }
        }
Example #2
0
 public void writeExternal(BinaryWriter out_)
 {
     ExtUtil.writeNumeric(out_, len);
     for (int i = 0; i < len; i++)
     {
         ExtUtil.writeDecimal(out_, gp[i]);
     }
 }
Example #3
0
        /* (non-Javadoc)
         * @see org.javarosa.core.services.storage.utilities.Externalizable#writeExternal(java.io.DataOutputStream)
         */
        public void writeExternal(BinaryWriter out_)
        {
            ExtUtil.write(out_, new ExtWrapNullable(ID));
            ExtUtil.writeNumeric(out_, DataType);
            ExtUtil.write(out_, new ExtWrapNullable(Preload));
            ExtUtil.write(out_, new ExtWrapNullable(PreloadParams));
            ExtUtil.write(out_, new ExtWrapTagged(ref_));

            //don't bother writing relevancy/required/readonly/constraint/calculate right now; they're only used during parse anyway
        }
Example #4
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.javarosa.core.services.storage.utilities.Externalizable#writeExternal
  * (java.io.DataOutputStream)
  */
 public void writeExternal(BinaryWriter out_)
 {
     ExtUtil.writeNumeric(out_, id);
     ExtUtil.writeNumeric(out_, formId);
     ExtUtil.write(out_, new ExtWrapNullable(name));
     ExtUtil.write(out_, new ExtWrapNullable(schema));
     ExtUtil.write(out_, new ExtWrapNullable(dateSaved));
     ExtUtil.write(out_, new ExtWrapMap(namespaces));
     ExtUtil.write(out_, getRoot());
 }
Example #5
0
        //UPGRADE_TODO: Class 'java.io.DataOutputStream' was converted to 'System.IO.BinaryWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataOutputStream'"
        public virtual void  writeExternal(System.IO.BinaryWriter out_Renamed)
        {
            ExtUtil.writeNumeric(out_Renamed, refLevel);
            ExtUtil.write(out_Renamed, new ExtWrapNullable(instanceName));
            ExtUtil.writeNumeric(out_Renamed, contextType);
            ExtUtil.writeNumeric(out_Renamed, size());

            for (TreeReferenceLevel l: data)
            {
                ExtUtil.write(out_Renamed, l);
            }
        }
        /**
         * serialize a compact instance
         */
        public void writeExternal(BinaryWriter out_renamed)
        {
            if (instance == null)
            {
                throw new SystemException("instance has not yet been set via setData()");
            }

            ExtUtil.writeNumeric(out_renamed, instance.getFormId());
            ExtUtil.writeNumeric(out_renamed, instance.ID);
            ExtUtil.write(out_renamed, new ExtWrapNullable(instance.getDateSaved()));

            writeTreeElement(out_renamed, instance.getRoot());
        }
Example #7
0
 public void writeExternal(BinaryWriter out_)
 {
     if (d == (int)d)
     {
         out_.Write(0x00);
         ExtUtil.writeNumeric(out_, (int)d);
     }
     else
     {
         out_.Write(0x01);
         ExtUtil.writeDecimal(out_, d);
     }
 }
Example #8
0
        public void writeExternal(BinaryWriter out_)
        {
            ExtUtil.writeNumeric(out_, init_context);
            if (init_context == INIT_CONTEXT_EXPR)
            {
                ExtUtil.write(out_, filtExpr);
            }

            ArrayList v = new ArrayList();

            for (int i = 0; i < steps.Length; i++)
            {
                v.Add(steps[i]);
            }
            ExtUtil.write(out_, new ExtWrapList(v));
        }
Example #9
0
        /*
         * (non-Javadoc)
         * @see org.javarosa.core.util.Externalizable#writeExternal(java.io.DataOutputStream)
         */
        public void writeExternal(System.IO.BinaryWriter dos)
        {
            ExtUtil.writeNumeric(dos, ID);
            ExtUtil.write(dos, new ExtWrapNullable(binding == null ? null : new ExtWrapTagged(binding)));
            ExtUtil.write(dos, new ExtWrapNullable(AppearanceAttr));
            ExtUtil.write(dos, new ExtWrapNullable(TextID));
            ExtUtil.write(dos, new ExtWrapNullable(LabelInnerText));
            ExtUtil.write(dos, new ExtWrapNullable(HelpText));
            ExtUtil.write(dos, new ExtWrapNullable(HelpTextID));
            ExtUtil.write(dos, new ExtWrapNullable(HelpInnerText));

            ExtUtil.writeNumeric(dos, ControlType);

            ExtUtil.write(dos, new ExtWrapList(ExtUtil.emptyIfNull(choices)));
            ExtUtil.write(dos, new ExtWrapNullable(dynamicChoices));
        }
Example #10
0
        public void writeExternal(BinaryWriter out_)
        {
            ExtUtil.writeNumeric(out_, axis);
            ExtUtil.writeNumeric(out_, test);

            switch (test)
            {
            case TEST_NAME: ExtUtil.write(out_, name); break;

            case TEST_NAMESPACE_WILDCARD: ExtUtil.writeString(out_, namespace_); break;

            case TEST_TYPE_PROCESSING_INSTRUCTION: ExtUtil.write(out_, new ExtWrapNullable(literal)); break;
            }

            ArrayList v = new ArrayList();

            for (int i = 0; i < predicates.Length; i++)
            {
                v.Add(predicates[i]);
            }
            ExtUtil.write(out_, new ExtWrapListPoly(v));
        }
Example #11
0
        /** Write the group definition object to the supplied stream. */
        public void writeExternal(BinaryWriter dos)
        {
            ExtUtil.writeNumeric(dos, ID);
            ExtUtil.write(dos, new ExtWrapNullable(AppearanceAttr));
            ExtUtil.write(dos, new ExtWrapTagged(Bind));
            ExtUtil.write(dos, new ExtWrapNullable(TextID));
            ExtUtil.write(dos, new ExtWrapNullable(LabelInnerText));
            ExtUtil.writeBool(dos, Repeat);
            ExtUtil.write(dos, new ExtWrapListPoly(Children));

            ExtUtil.writeBool(dos, noAddRemove);
            ExtUtil.write(dos, new ExtWrapNullable(count != null ? new ExtWrapTagged(count) : null));

            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(chooseCaption));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(addCaption));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(delCaption));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(doneCaption));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(addEmptyCaption));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(doneEmptyCaption));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(entryHeader));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(delHeader));
            ExtUtil.writeString(dos, ExtUtil.emptyIfNull(mainHeader));
        }
Example #12
0
 public void writeExternal(BinaryWriter out_)
 {
     ExtUtil.writeNumeric(out_, op);
     base.writeExternal(out_);
 }
Example #13
0
 /* (non-Javadoc)
  * @see org.javarosa.core.services.storage.utilities.Externalizable#writeExternal(java.io.DataOutputStream)
  */
 public void writeExternal(BinaryWriter out_)
 {
     ExtUtil.writeNumeric(out_, n);
 }
Example #14
0
 public void writeExternal(BinaryWriter out_renamed)
 {
     ExtUtil.writeNumeric(out_renamed, refLevel);
     ExtUtil.write(out_renamed, new ExtWrapList(names));
     ExtUtil.write(out_renamed, new ExtWrapList(multiplicity));
 }
Example #15
0
        /*
         * (non-Javadoc)
         *
         * @see
         * org.javarosa.core.services.storage.utilities.Externalizable#writeExternal
         * (java.io.DataOutputStream)
         */
        public void writeExternal(BinaryWriter out_renamed)
        {
            ExtUtil.writeString(out_renamed, ExtUtil.emptyIfNull(name));
            ExtUtil.writeNumeric(out_renamed, multiplicity);
            ExtUtil.writeBool(out_renamed, repeatable);
            ExtUtil.write(out_renamed, new ExtWrapNullable(value == null ? null : new ExtWrapTagged(value)));

            // Jan 22, 2009 - [email protected]
            // old line: ExtUtil.write(out, new
            // ExtWrapList(ExtUtil.emptyIfNull(children)));
            // New Child serialization
            // 1. write null status as boolean
            // 2. write number of children
            // 3. for all child in children
            // 3.1 if child type == TreeElement write boolean true , then serialize
            // directly.
            // 3.2 if child type != TreeElement, write boolean false, then tagged
            // child
            if (children == null)
            {
                // 1.
                ExtUtil.writeBool(out_renamed, false);
            }
            else
            {
                // 1.
                ExtUtil.writeBool(out_renamed, true);
                // 2.
                ExtUtil.writeNumeric(out_renamed, children.Count);
                // 3.
                IEnumerator en = children.GetEnumerator();
                while (en.MoveNext())
                {
                    TreeElement child = (TreeElement)en.Current;
                    if (child.GetType() == typeof(TreeElement))
                    {
                        // 3.1
                        ExtUtil.writeBool(out_renamed, true);
                        child.writeExternal(out_renamed);
                    }
                    else
                    {
                        // 3.2
                        ExtUtil.writeBool(out_renamed, false);
                        ExtUtil.write(out_renamed, new ExtWrapTagged(child));
                    }
                }
            }

            // end Jan 22, 2009

            ExtUtil.writeNumeric(out_renamed, dataType);
            ExtUtil.writeBool(out_renamed, relevant);
            ExtUtil.writeBool(out_renamed, required);
            ExtUtil.writeBool(out_renamed, enabled);
            ExtUtil.writeBool(out_renamed, relevantInherited);
            ExtUtil.writeBool(out_renamed, enabledInherited);
            ExtUtil.write(out_renamed, new ExtWrapNullable(constraint)); // TODO: inefficient for repeats
            ExtUtil.writeString(out_renamed, ExtUtil.emptyIfNull(preloadHandler));
            ExtUtil.writeString(out_renamed, ExtUtil.emptyIfNull(preloadParams));

            ArrayList attStrings = getSingleStringAttributeVector();
            ArrayList al         = ExtUtil.emptyIfNull(attStrings);

            ExtUtil.write(out_renamed, new ExtWrapList(al));
        }
Example #16
0
 public void writeExternal(BinaryWriter out_)
 {
     base.writeExternal(out_);
     ExtUtil.writeNumeric(out_, trueAction);
     ExtUtil.writeNumeric(out_, falseAction);
 }