Ejemplo n.º 1
0
            private bool needsEmptyVersion(ContextPair contextPair)
            {
                UnitContext leftContext = contextPair.getLeftContext();

                Unit[] units = leftContext.getUnits();
                return(units.Length > 0 && this.getRightContextSize(units[0]) < this.getRightContextSize());
            }
Ejemplo n.º 2
0
            public virtual void expand()
            {
                Iterator iterator = this.leftContexts.iterator();

                while (iterator.hasNext())
                {
                    UnitContext unitContext = (UnitContext)iterator.next();
                    Iterator    iterator2   = this.getStartingContexts().iterator();
                    while (iterator2.hasNext())
                    {
                        UnitContext unitContext2 = (UnitContext)iterator2.next();
                        ContextPair contextPair  = ContextPair.get(unitContext, unitContext2);
                        this.entryPoints.put(contextPair, new ArrayList());
                    }
                }
                if (this.node.isFinalNode())
                {
                    GrammarState grammarState = new GrammarState(this.node);
                    Iterator     iterator3    = this.entryPoints.values().iterator();
                    while (iterator3.hasNext())
                    {
                        List list = (List)iterator3.next();
                        list.add(grammarState);
                    }
                }
                else if (!this.node.isEmpty())
                {
                    iterator = this.leftContexts.iterator();
                    while (iterator.hasNext())
                    {
                        UnitContext unitContext = (UnitContext)iterator.next();
                        this.expandWord(unitContext);
                    }
                }
                else
                {
                    iterator = this.entryPoints.entrySet().iterator();
                    while (iterator.hasNext())
                    {
                        Map.Entry   entry        = (Map.Entry)iterator.next();
                        ContextPair contextPair2 = (ContextPair)entry.getKey();
                        List        list2        = (List)entry.getValue();
                        BranchState branchState  = new BranchState(contextPair2.getLeftContext().toString(), contextPair2.getRightContext().toString(), this.node.getID());
                        list2.add(branchState);
                        this.addExitPoint(contextPair2, branchState);
                    }
                }
                this.addEmptyEntryPoints();
            }
Ejemplo n.º 3
0
            private void addEmptyEntryPoints()
            {
                HashMap  hashMap  = new HashMap();
                Iterator iterator = this.entryPoints.entrySet().iterator();

                while (iterator.hasNext())
                {
                    Map.Entry   entry       = (Map.Entry)iterator.next();
                    ContextPair contextPair = (ContextPair)entry.getKey();
                    if (this.needsEmptyVersion(contextPair))
                    {
                        ContextPair contextPair2 = ContextPair.get(contextPair.getLeftContext(), UnitContext.EMPTY);
                        object      obj          = (List)hashMap.get(contextPair2);
                        if ((List)obj == null)
                        {
                            obj = new ArrayList();
                            hashMap.put(contextPair2, (ArrayList)obj);
                        }
                        object     obj2       = obj;
                        Collection collection = (Collection)entry.getValue();
                        List       list;
                        if (obj2 != null)
                        {
                            if ((list = (obj2 as List)) == null)
                            {
                                throw new IncompatibleClassChangeError();
                            }
                        }
                        else
                        {
                            list = null;
                        }
                        list.addAll(collection);
                    }
                }
                this.entryPoints.putAll(hashMap);
            }