示例#1
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 override void  writeExternal(System.IO.BinaryWriter out_Renamed)
        {
            //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
            System.Collections.Hashtable h = (System.Collections.Hashtable)val;

            ExtUtil.writeNumeric(out_Renamed, h.Count);

            for (Object key: h.keySet())
            {
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                System.Object elem = h[key];

                ExtUtil.write(out_Renamed, keyType == null?key:keyType.clone(key));
                ExtUtil.write(out_Renamed, new ExtWrapTagged(elem));
            }
        }
示例#2
0
        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        public static bool hashMapEquals(System.Collections.Hashtable a, System.Collections.Hashtable b)
        {
            if (a.Count != b.Count)
            {
                return(false);
            }
            else if (a is OrderedMap != b is OrderedMap)
            {
                return(false);
            }
            else
            {
                for (Object keyA: a.keySet())
                {
                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                    if (!equals(a[keyA], b[keyA]))
                    {
                        return(false);
                    }
                }

                if (a is OrderedMap && b is OrderedMap)
                {
                    //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'"
                    System.Collections.IEnumerator ea = new SupportClass.HashSetSupport(a.Keys).GetEnumerator();
                    //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'"
                    System.Collections.IEnumerator eb = new SupportClass.HashSetSupport(b.Keys).GetEnumerator();

                    //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
                    while (ea.MoveNext())
                    {
                        //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                        System.Object keyA = ea.Current;
                        //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                        System.Object keyB = eb.Current;

                        if (!keyA.Equals(keyB))
                        {
                            //must use built-in equals for keys, as that's what HashMap uses
                            return(false);
                        }
                    }
                }

                return(true);
            }
        }
示例#3
0
        private void  InitBlock()
        {
            this(base_Renamed, context);
            this.formInstances = formInstances;
            this(base_Renamed);
            this.formInstances = formInstances;
            this.instance      = instance;
            this.formInstances = formInstances;
            this.instance      = instance;
            this.contextNode   = TreeReference.rootRef();

            functionHandlers = new HashMap <String, IFunctionHandler>();
            //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
            variables = new System.Collections.Hashtable();

            for (String var: variables.keySet())
            {
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                setVariable(var, variables[var]);
            }
            return(expandReference(ref_Renamed, false));

            if (!ref_Renamed.isAbsolute())
            {
                return(null);
            }

            FormInstance baseInstance;

            if (ref_Renamed.getInstanceName() != null)
            {
                baseInstance = getInstance(ref_Renamed.getInstanceName());
            }
            else
            {
                baseInstance = instance;
            }

            if (baseInstance == null)
            {
                throw new System.SystemException("Unable to expand reference " + ref_Renamed.toString(true) + ", no appropriate instance in evaluation context");
            }


            List <TreeReference> v = new List <TreeReference>();

            expandReference(ref_Renamed, baseInstance, baseInstance.getRoot().Ref, v, includeTemplates);
            return(v);

            int depth = workingRef.size();


            //check to see if we've matched fully
            if (depth == sourceRef.size())
            {
                //TODO: Do we need to clone these references?
                refs.addElement(workingRef);
            }
            else
            {
                //Otherwise, need to get the next set of matching references

                System.String name = sourceRef.getName(depth);
                predicates = sourceRef.getPredicate(depth);

                //Copy predicates for batch fetch
                if (predicates != null)
                {
                    List <XPathExpression> predCopy = new List <XPathExpression>();

                    for (XPathExpression xpe: predicates)
                    {
                        predCopy.addElement(xpe);
                    }
                    predicates = predCopy;
                }
                //ETHERTON: Is this where we should test for predicates?
                int mult = sourceRef.getMultiplicity(depth);

                List <TreeReference> set = new List <TreeReference>();

                TreeElement node = instance.resolveReference(workingRef);

                List <TreeReference> passingSet = new List <TreeReference>();

                {
                    if (node.NumChildren > 0)
                    {
                        if (mult == TreeReference.INDEX_UNBOUND)
                        {
                            int count = node.getChildMultiplicity(name);
                            for (int i = 0; i < count; i++)
                            {
                                TreeElement child = node.getChild(name, i);
                                if (child != null)
                                {
                                    set_Renamed.addElement(child.Ref);
                                }
                                else
                                {
                                    throw new System.SystemException("Missing or non-sequntial nodes expanding a reference");                                     // missing/non-sequential
                                    // nodes
                                }
                            }
                            if (includeTemplates)
                            {
                                TreeElement template = node.getChild(name, TreeReference.INDEX_TEMPLATE);
                                if (template != null)
                                {
                                    set_Renamed.addElement(template.Ref);
                                }
                            }
                        }
                        else if (mult != TreeReference.INDEX_ATTRIBUTE)
                        {
                            //TODO: Make this test mult >= 0?
                            //If the multiplicity is a simple integer, just get
                            //the appropriate child
                            TreeElement child = node.getChild(name, mult);
                            if (child != null)
                            {
                                set_Renamed.addElement(child.Ref);
                            }
                        }
                    }

                    if (mult == TreeReference.INDEX_ATTRIBUTE)
                    {
                        TreeElement attribute = node.getAttribute(null, name);
                        if (attribute != null)
                        {
                            set_Renamed.addElement(attribute.Ref);
                        }
                    }
                }

                if (predicates != null && predicateEvaluationProgress != null)
                {
                    predicateEvaluationProgress[1] += set_Renamed.size();
                }

                if (predicates != null)
                {
                    bool firstTime = true;

                    List <TreeReference> passed = new List <TreeReference>();

                    for (XPathExpression xpe: predicates)
                    {
                        for (int i = 0; i < set_Renamed.size(); ++i)
                        {
                            //if there are predicates then we need to see if e.nextElement meets the standard of the predicate
                            TreeReference treeRef = set_Renamed.elementAt(i);

                            //test the predicate on the treeElement
                            EvaluationContext evalContext = rescope(treeRef, (firstTime?treeRef.MultLast:i));
                            System.Object     o           = xpe.eval(instance, evalContext);
                            if (o is System.Boolean)
                            {
                                bool testOutcome = ((System.Boolean)o);
                                if (testOutcome)
                                {
                                    passed.addElement(treeRef);
                                }
                            }
                        }
                        firstTime = false;
                        set_Renamed.clear();
                        set_Renamed.addAll(passed);
                        passed.clear();

                        if (predicateEvaluationProgress != null)
                        {
                            predicateEvaluationProgress[0]++;
                        }
                    }
                }

                for (int i = 0; i < set_Renamed.size(); ++i)
                {
                    TreeReference treeRef = set_Renamed.elementAt(i);
                    expandReference(sourceRef, instance, treeRef, refs, includeTemplates);
                }
            }
        }