Пример #1
0
        public void doSymbolic(Token t)
        {
            //TODO: url encoding
            StackElem elem = Pop();

            accumulator.Add(new Triple(NS(elem.id.TokenText), Peek().guid, NS(Token.CamelCase(t.TokenText.ToLower())), true));
        }
Пример #2
0
        public void doValueProperty(Token t, Token iprop)
        {
            StackElem elem = Pop();

            elem.guid = NewGuid();
            accumulator.Add(new Triple(NS(elem.id.TokenText), Peek().guid, elem.guid, true));

            if (iprop != null)
            {
                string tag   = NS(Token.CamelCase(iprop.TokenText.ToLower()));
                string lprop = Token.CamelCase(iprop.TokenText.ToLower());
                string lobj;
                if (lprop == "date")
                {
                    lobj = Token.ParseDate(t.TokenText);
                }
                else
                {
                    lobj = Token.CamelCase(t.TokenText.ToLower());
                }
                accumulator.Add(new Triple(tag, elem.guid, lobj, false));
            }
            else
            {
                accumulator.Add(new Triple(NS("dateTime"), elem.guid, Token.ParseDateTime(t.TokenText), false));
            }
            Push(elem);
        }
Пример #3
0
        public void doID(Token t)
        {
            //accumulator.Append( "<" + t.TokenText );
            StackElem elem = new StackElem(t, null, false);  // the rest of the methods will fill in this properly

            Push(elem);
        }
Пример #4
0
        public void doValueProperty(Token t, Token iprop)
        {
            //accumulator.Append( " rdf:parseType='Resource'>\n" );
            StackElem elem = Pop();

            elem.guid = NewGuid();
            accumulator.Append("{{[" + context + "] [" + NS(elem.id.TokenText) + "] [" + Peek().guid + "] [" + elem.guid + "]}}\n");

            if (iprop != null)
            {
                //accumulator.Append( "<" + Token.CamelCase( iprop.TokenText.ToLower()) + ">" + t.TokenText + "</" + Token.CamelCase( iprop.TokenText.ToLower()) + ">\n" );
                string tag   = NS(Token.CamelCase(iprop.TokenText.ToLower()));
                string lprop = Token.CamelCase(iprop.TokenText.ToLower());
                string lobj;
                if (lprop == "date")
                {
                    lobj = Token.ParseDate(t.TokenText);
                }
                else
                {
                    lobj = Token.CamelCase(t.TokenText.ToLower());
                }
                accumulator.Append("{{[" + context + "] [" + tag + "] [" + elem.guid + "] '" + lobj + "'}}\n");
            }
            else
            {
                //accumulator.Append( "<dateTime>" + Token.ParseDate( t.TokenText ) + "</dateTime>\n" );
                accumulator.Append("{{[" + context + "] [ical:dateTime] [" + elem.guid + "] '" + Token.ParseDateTime(t.TokenText) + "'}}\n");
            }
            Push(elem);
            Inc();
        }
Пример #5
0
        public void doRest(Token t, Token id)
        {
            //accumulator.Append( ">" + t.TokenText + "</" + id.TokenText + ">\n" );
            StackElem elem = Pop();

            accumulator.Append("{{[" + context + "] [" + NS(elem.id.TokenText) + "] [" + Peek().guid + "] '" + t.TokenText + "'}}\n");
            Inc();
        }
Пример #6
0
        public void doURIResource(Token t)
        {
            //accumulator.Append( " rdf:resource='" + t.TokenText + "'/>\n" );
            StackElem elem = Pop();

            accumulator.Append("{{[" + context + "] [" + NS(elem.id.TokenText) + "] [" + Peek().guid + "] [" + NS(t.TokenText) + "]}}\n");
            Inc();
        }
Пример #7
0
        public void doIprop(Token t, Token iprop)
        {
            //accumulator.Append( " ical:" + iprop.TokenText + "='" + t.TokenText + "'/>\n" );
            StackElem elem = Pop();

            accumulator.Append("{{[" + context + "] [" + NS(elem.id.TokenText) + "] [" + Peek().guid + "] [" + NS(iprop.TokenText) + "]}}\n");
            Inc();
        }
Пример #8
0
        public void doMailto(Token t)
        {
            StackElem elem = Pop();

            elem.guid = NewGuid();
            accumulator.Add(new Triple(NS(elem.id.TokenText), Peek().guid, elem.guid, true));
            accumulator.Add(new Triple(NS("calAddress"), elem.guid, NS(t.TokenText), true));
            Push(elem);
        }
Пример #9
0
        public void doSymbolic(Token t)
        {
            //TODO: url encoding
            //accumulator.Append( " rdf:resource='" + ical + Token.CamelCase( t.TokenText.ToLower() ) + "'/>\n" );
            StackElem elem = Pop();

            accumulator.Append("{{[" + context + "] [" + NS(elem.id.TokenText) + "] [" + Peek().guid + "] [" + NS(Token.CamelCase(t.TokenText.ToLower())) + "]}}\n");
            Inc();
        }
Пример #10
0
        public void doMailto(Token t)
        {
            //accumulator.Append( " rdf:parseType='Resource'>\n<calAddress rdf:resource='" + t.TokenText + "'/>\n" );
            StackElem elem = Pop();

            elem.guid = NewGuid();
            accumulator.Append("{{[" + context + "] [" + NS(elem.id.TokenText) + "] [" + Peek().guid + "] [" + elem.guid + "]}}\n");
            accumulator.Append("{{[" + context + "] [ical:calAddress] [" + elem.guid + "] [" + NS(t.TokenText) + "]}}\n");
            Push(elem);
            Inc();
        }
Пример #11
0
        public void doComponentBegin(Token t)
        {
            // beginning of a rdfType for this stmt - ie. it's a new resource
            string    guid = NewGuid();
            StackElem elem = new StackElem(t, guid, false);

            if (Count > 0 && Peek().predFlag)
            {
                StackElem top = Peek();
                top.guid = guid;
            }
            Push(elem);

            accumulator.Add(new Triple(RDF("type"), guid, NS(t.TokenText), true));
        }
Пример #12
0
            public void Reset()
            {
                currItem = null;
                nextItem = null;
                stack.Clear();
                HashPage pg = hash.root;

                if (pg != null)
                {
                    int start = 0;
                    int sp    = 0;
DepthFirst:
                    while (true)
                    {
                        for (int i = start; i < pg.items.Count; i++)
                        {
                            object child = pg.items[i];
                            if (child != null)
                            {
                                stack.Add(new StackElem(pg, i));
                                sp += 1;
                                if (child is HashPage)
                                {
                                    pg    = (HashPage)child;
                                    start = 0;
                                    goto DepthFirst;
                                }
                                else
                                {
                                    nextItem = (CollisionItem)child;
                                    return;
                                }
                            }
                        }
                        if (sp != 0)
                        {
                            StackElem top = (StackElem)stack[--sp];
                            stack.RemoveAt(sp);
                            pg    = top.page;
                            start = top.pos + 1;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
Пример #13
0
        public void doEnd(Token t)
        {
            StackElem pred = Pop();

            if (pred.predFlag)
            {
                if (Count > 0)
                {
                    accumulator.Add(new Triple(NS(pred.id.TokenText), Peek().guid, pred.guid, true));
                }
                else
                {
                    throw new Exception("Problem parsing: expecting overriding resource for: " + t.TokenText);
                }
            }
        }
Пример #14
0
        public void doComponentBegin(Token t)
        {
            //accumulator.Append( "<" + t.TokenText + ">\n" );
            // beginning of a rdfType for this stmt - ie. it's a new resource
            string    guid = NewGuid();
            StackElem elem = new StackElem(t, guid, false);

            if (Count > 0 && Peek().predFlag)
            {
                StackElem top = Peek();
                top.guid = guid;
            }
            Push(elem);

            accumulator.Append("{{[" + context + "] [rdf:type] [" + guid + "] [" + NS(t.TokenText) + "]}}\n");
            Inc();
        }
Пример #15
0
            public bool MoveNext()
            {
                if (nextItem != null)
                {
                    currItem = nextItem;
                    if ((nextItem = nextItem.next) == null)
                    {
                        int sp = stack.Count;
                        do
                        {
                            StackElem top = (StackElem)stack[--sp];
                            stack.RemoveAt(sp);
                            HashPage pg    = top.page;
                            int      start = top.pos + 1;

DepthFirst:
                            while (true)
                            {
                                for (int i = start; i < pg.items.Count; i++)
                                {
                                    object child = pg.items[i];
                                    if (child != null)
                                    {
                                        stack.Add(new StackElem(pg, i));
                                        sp += 1;
                                        if (child is HashPage)
                                        {
                                            pg    = (HashPage)child;
                                            start = 0;
                                            goto DepthFirst;
                                        }
                                        else
                                        {
                                            nextItem = (CollisionItem)child;
                                            return(true);
                                        }
                                    }
                                }
                                break;
                            }
                        } while (sp != 0);
                    }
                    return(true);
                }
                return(false);
            }
Пример #16
0
        public void doEnd(Token t)
        {
            //accumulator.Append( "</" + t.TokenText + ">\n" );
            StackElem pred = Pop();

            if (pred.predFlag)
            {
                if (Count > 0)
                {
                    accumulator.Append("{{[" + context + "] [" + NS(pred.id.TokenText) + "] [" + Peek().guid + "] [" + pred.guid + "]}}\n");
                    Inc();
                }
                else
                {
                    throw new Exception("Problem parsing: expecting overriding resource for: " + t.TokenText);
                }
            }
        }
Пример #17
0
        public void doID(Token t)
        {
            StackElem elem = new StackElem(t, null, false);              // the rest of the methods will fill in this properly

            Push(elem);
        }
Пример #18
0
 private void Push(StackElem elem)
 {
     guids.Push(elem);
 }
Пример #19
0
 private void QSort3(int loSt, int hiSt, int dSt)
 {
     StackElem[] elemArray = new StackElem[QSORT_STACK_SIZE];
     for (int i = 0; i < QSORT_STACK_SIZE; i++)
     {
         elemArray[i] = new StackElem();
     }
     int index = 0;
     elemArray[index].ll = loSt;
     elemArray[index].hh = hiSt;
     elemArray[index].dd = dSt;
     index++;
     while (index > 0)
     {
         int num3;
         int num4;
         int num6;
         if (index >= QSORT_STACK_SIZE)
         {
             Panic();
         }
         index--;
         int ll = elemArray[index].ll;
         int hh = elemArray[index].hh;
         int dd = elemArray[index].dd;
         if (((hh - ll) < SMALL_THRESH) || (dd > DEPTH_THRESH))
         {
             this.SimpleSort(ll, hh, dd);
             if ((this.workDone <= this.workLimit) || !this.firstAttempt)
             {
                 continue;
             }
             break;
         }
         int num5 = this.Med3(this.block[(this.zptr[ll] + dd) + 1], this.block[(this.zptr[hh] + dd) + 1], this.block[(this.zptr[(ll + hh) >> 1] + dd) + 1]);
         int num = num3 = ll;
         int num2 = num4 = hh;
     Label_012F:
         if (num <= num2)
         {
             num6 = this.block[(this.zptr[num] + dd) + 1] - num5;
             if (num6 == 0)
             {
                 int num13 = 0;
                 num13 = this.zptr[num];
                 this.zptr[num] = this.zptr[num3];
                 this.zptr[num3] = num13;
                 num3++;
                 num++;
                 goto Label_012F;
             }
             if (num6 <= 0)
             {
                 num++;
                 goto Label_012F;
             }
         }
     Label_0192:
         if (num <= num2)
         {
             num6 = this.block[(this.zptr[num2] + dd) + 1] - num5;
             if (num6 == 0)
             {
                 int num14 = 0;
                 num14 = this.zptr[num2];
                 this.zptr[num2] = this.zptr[num4];
                 this.zptr[num4] = num14;
                 num4--;
                 num2--;
                 goto Label_0192;
             }
             if (num6 >= 0)
             {
                 num2--;
                 goto Label_0192;
             }
         }
         if (num <= num2)
         {
             int num15 = this.zptr[num];
             this.zptr[num] = this.zptr[num2];
             this.zptr[num2] = num15;
             num++;
             num2--;
             goto Label_012F;
         }
         if (num4 < num3)
         {
             elemArray[index].ll = ll;
             elemArray[index].hh = hh;
             elemArray[index].dd = dd + 1;
             index++;
         }
         else
         {
             num6 = ((num3 - ll) < (num - num3)) ? (num3 - ll) : (num - num3);
             this.Vswap(ll, num - num6, num6);
             int n = ((hh - num4) < (num4 - num2)) ? (hh - num4) : (num4 - num2);
             this.Vswap(num, (hh - n) + 1, n);
             num6 = ((ll + num) - num3) - 1;
             n = (hh - (num4 - num2)) + 1;
             elemArray[index].ll = ll;
             elemArray[index].hh = num6;
             elemArray[index].dd = dd;
             index++;
             elemArray[index].ll = num6 + 1;
             elemArray[index].hh = n - 1;
             elemArray[index].dd = dd + 1;
             index++;
             elemArray[index].ll = n;
             elemArray[index].hh = hh;
             elemArray[index].dd = dd;
             index++;
         }
     }
 }
Пример #20
0
 private void Push(StackElem elem)
 {
     guids.Push(elem);
 }
Пример #21
0
 public void doID(Token t)
 {
     StackElem elem = new StackElem(t, null, false);  // the rest of the methods will fill in this properly
     Push(elem);
 }
Пример #22
0
 public void doID(Token t)
 {
     //accumulator.Append( "<" + t.TokenText );
     StackElem elem = new StackElem(t, null, false);  // the rest of the methods will fill in this properly
     Push(elem);
 }
Пример #23
0
        public void doURIResource(Token t)
        {
            StackElem elem = Pop();

            accumulator.Add(new Triple(NS(elem.id.TokenText), Peek().guid, NS(t.TokenText), true));
        }
Пример #24
0
        public void doIprop(Token t, Token iprop)
        {
            StackElem elem = Pop();

            accumulator.Add(new Triple(NS(elem.id.TokenText), Peek().guid, NS(iprop.TokenText), true));
        }
Пример #25
0
 private void QSort3(int loSt, int hiSt, int dSt)
 {
     StackElem[] elemArray = new StackElem[0x3e8];
     for (int i = 0; i < 0x3e8; i++)
     {
         elemArray[i] = new StackElem();
     }
     int index = 0;
     elemArray[index].ll = loSt;
     elemArray[index].hh = hiSt;
     elemArray[index].dd = dSt;
     index++;
     while (index > 0)
     {
         int num3;
         int num4;
         int num13;
         bool flag;
         if (index >= 0x3e8)
         {
             Panic();
         }
         index--;
         int ll = elemArray[index].ll;
         int hh = elemArray[index].hh;
         int dd = elemArray[index].dd;
         if (((hh - ll) < 20) || (dd > 10))
         {
             this.SimpleSort(ll, hh, dd);
             if ((this.workDone <= this.workLimit) || !this.firstAttempt)
             {
                 continue;
             }
             break;
         }
         int num5 = this.Med3(this.block[(this.zptr[ll] + dd) + 1], this.block[(this.zptr[hh] + dd) + 1], this.block[(this.zptr[(ll + hh) >> 1] + dd) + 1]);
         int num = num3 = ll;
         int num2 = num4 = hh;
         goto Label_02AD;
     Label_015B:
         if (num > num2)
         {
             goto Label_0268;
         }
         int n = this.block[(this.zptr[num] + dd) + 1] - num5;
         if (n == 0)
         {
             num13 = 0;
             num13 = this.zptr[num];
             this.zptr[num] = this.zptr[num3];
             this.zptr[num3] = num13;
             num3++;
             num++;
         }
         else
         {
             if (n > 0)
             {
                 goto Label_0268;
             }
             num++;
         }
     Label_01DB:
         flag = true;
         goto Label_015B;
     Label_01E8:
         if (num > num2)
         {
             goto Label_0270;
         }
         n = this.block[(this.zptr[num2] + dd) + 1] - num5;
         if (n == 0)
         {
             num13 = 0;
             num13 = this.zptr[num2];
             this.zptr[num2] = this.zptr[num4];
             this.zptr[num4] = num13;
             num4--;
             num2--;
         }
         else
         {
             if (n < 0)
             {
                 goto Label_0270;
             }
             num2--;
         }
     Label_0268:
         flag = true;
         goto Label_01E8;
     Label_0270:
         if (num > num2)
         {
             goto Label_02B5;
         }
         int num14 = this.zptr[num];
         this.zptr[num] = this.zptr[num2];
         this.zptr[num2] = num14;
         num++;
         num2--;
     Label_02AD:
         flag = true;
         goto Label_01DB;
     Label_02B5:
         if (num4 < num3)
         {
             elemArray[index].ll = ll;
             elemArray[index].hh = hh;
             elemArray[index].dd = dd + 1;
             index++;
         }
         else
         {
             n = ((num3 - ll) < (num - num3)) ? (num3 - ll) : (num - num3);
             this.Vswap(ll, num - n, n);
             int num7 = ((hh - num4) < (num4 - num2)) ? (hh - num4) : (num4 - num2);
             this.Vswap(num, (hh - num7) + 1, num7);
             n = ((ll + num) - num3) - 1;
             num7 = (hh - (num4 - num2)) + 1;
             elemArray[index].ll = ll;
             elemArray[index].hh = n;
             elemArray[index].dd = dd;
             index++;
             elemArray[index].ll = n + 1;
             elemArray[index].hh = num7 - 1;
             elemArray[index].dd = dd + 1;
             index++;
             elemArray[index].ll = num7;
             elemArray[index].hh = hh;
             elemArray[index].dd = dd;
             index++;
         }
     }
 }
Пример #26
0
        /// <summary>
        /// Compute a pre order (ignoring back edges) of the CFG reachable from the entry node
        ///
        /// As a side effect, assigns each block its DF finishing number.
        /// </summary>
        public static FList /*<BasicBlocks>*/ Compute(ControlFlowGraph cfg)
        {
            // depth-first search

            bool[] markBit = new bool[cfg.BlockCount];

            FList result = null;
            int   DFTime = 0;

            // Use a stack to represent the state of the search.
            // Each stack element consists of a basic block and the
            // the index of the next successor of that block to process.

            Stack stack = new Stack();

            CfgBlock[] blocks = cfg.Blocks();

            CfgBlock start = cfg.Entry;

            // invariant: all blocks pushed on the stack are marked.
            markBit[start.Index] = true;
            stack.Push(new StackElem(start));
            while (stack.Count > 0)
            {
                StackElem  elem             = (StackElem)stack.Peek();
                CfgBlock   b                = elem.node;
                int        nextChild        = elem.nextChild;
                CfgBlock[] normalNodes      = cfg.NormalSucc(b);
                CfgBlock[] exnNodes         = cfg.ExcpSucc(b);
                int        normalNodesCount = normalNodes.Length;
                int        exnNodesCount    = exnNodes.Length;
                // Is there another child to process?
                if (nextChild < normalNodesCount + exnNodesCount)
                {
                    // Figure out the actual block.
                    CfgBlock child;
                    if (nextChild < normalNodesCount)
                    {
                        child = normalNodes[nextChild];
                    }
                    else
                    {
                        child = exnNodes[nextChild - normalNodesCount];
                    }
                    elem.nextChild = nextChild + 1;
                    // push the child block on to the stack.
                    if (!markBit[child.Index])
                    {
                        markBit[child.Index] = true;
                        stack.Push(new StackElem(child));
                    }
                }
                else
                {
                    // After all children are processed, place the block
                    // on the result.
                    stack.Pop();
                    b.priority = ++DFTime;
                    result     = FList.Cons(b, result);
                }
            }
            return(result);
        }
Пример #27
0
        public void doRest(Token t, Token id)
        {
            StackElem elem = Pop();

            accumulator.Add(new Triple(NS(elem.id.TokenText), Peek().guid, t.TokenText, false));
        }
    private void QSort3(int loSt, int hiSt, int dSt)
    {
        StackElem[] array = new StackElem[1000];
        for (int i = 0; i < 1000; i++)
        {
            array[i] = new StackElem();
        }
        int num = 0;

        array[num].ll = loSt;
        array[num].hh = hiSt;
        array[num].dd = dSt;
        num++;
        while (num > 0)
        {
            if (num >= 1000)
            {
                Panic();
            }
            num--;
            int ll = array[num].ll;
            int hh = array[num].hh;
            int dd = array[num].dd;
            if (hh - ll < 20 || dd > 10)
            {
                SimpleSort(ll, hh, dd);
                if (workDone > workLimit && firstAttempt)
                {
                    break;
                }
                continue;
            }
            int num2 = Med3(block[zptr[ll] + dd + 1], block[zptr[hh] + dd + 1], block[zptr[ll + hh >> 1] + dd + 1]);
            int num3;
            int num4 = num3 = ll;
            int num5;
            int num6 = num5 = hh;
            int num7;
            while (true)
            {
                if (num4 <= num6)
                {
                    num7 = block[zptr[num4] + dd + 1] - num2;
                    if (num7 == 0)
                    {
                        int num8 = 0;
                        num8       = zptr[num4];
                        zptr[num4] = zptr[num3];
                        zptr[num3] = num8;
                        num3++;
                        num4++;
                        continue;
                    }
                    if (num7 <= 0)
                    {
                        num4++;
                        continue;
                    }
                }
                while (num4 <= num6)
                {
                    num7 = block[zptr[num6] + dd + 1] - num2;
                    if (num7 == 0)
                    {
                        int num9 = 0;
                        num9       = zptr[num6];
                        zptr[num6] = zptr[num5];
                        zptr[num5] = num9;
                        num5--;
                        num6--;
                    }
                    else
                    {
                        if (num7 < 0)
                        {
                            break;
                        }
                        num6--;
                    }
                }
                if (num4 > num6)
                {
                    break;
                }
                int num10 = zptr[num4];
                zptr[num4] = zptr[num6];
                zptr[num6] = num10;
                num4++;
                num6--;
            }
            if (num5 < num3)
            {
                array[num].ll = ll;
                array[num].hh = hh;
                array[num].dd = dd + 1;
                num++;
                continue;
            }
            num7 = ((num3 - ll < num4 - num3) ? (num3 - ll) : (num4 - num3));
            Vswap(ll, num4 - num7, num7);
            int num11 = (hh - num5 < num5 - num6) ? (hh - num5) : (num5 - num6);
            Vswap(num4, hh - num11 + 1, num11);
            num7          = ll + num4 - num3 - 1;
            num11         = hh - (num5 - num6) + 1;
            array[num].ll = ll;
            array[num].hh = num7;
            array[num].dd = dd;
            num++;
            array[num].ll = num7 + 1;
            array[num].hh = num11 - 1;
            array[num].dd = dd + 1;
            num++;
            array[num].ll = num11;
            array[num].hh = hh;
            array[num].dd = dd;
            num++;
        }
    }
Пример #29
0
        public void doComponentBegin(Token t)
        {
            // beginning of a rdfType for this stmt - ie. it's a new resource
            string guid = NewGuid();
            StackElem elem = new StackElem(t, guid, false);

            if (Count > 0 && Peek().predFlag)
            {
                StackElem top = Peek();
                top.guid = guid;
            }
            Push(elem);

            accumulator.Add(new Triple(RDF("type"), guid, NS(t.TokenText), true));
        }
        private void QSort3(int loSt, int hiSt, int dSt)
        {
            int unLo, unHi, ltLo, gtHi, med, n, m;
            int sp, lo, hi, d;
            StackElem[] stack = new StackElem[QSORT_STACK_SIZE];
            for (int count = 0; count < QSORT_STACK_SIZE; count++)
            {
                stack[count] = new StackElem();
            }

            sp = 0;

            stack[sp].ll = loSt;
            stack[sp].hh = hiSt;
            stack[sp].dd = dSt;
            sp++;

            while (sp > 0)
            {
                if (sp >= QSORT_STACK_SIZE)
                {
                    Panic();
                }

                sp--;
                lo = stack[sp].ll;
                hi = stack[sp].hh;
                d = stack[sp].dd;

                if (hi - lo < SMALL_THRESH || d > DEPTH_THRESH)
                {
                    SimpleSort(lo, hi, d);
                    if (workDone > workLimit && firstAttempt)
                    {
                        return;
                    }
                    continue;
                }

                med = Med3(block[zptr[lo] + d + 1],
                        block[zptr[hi] + d + 1],
                        block[zptr[(lo + hi) >> 1] + d + 1]);

                unLo = ltLo = lo;
                unHi = gtHi = hi;

                while (true)
                {
                    while (true)
                    {
                        if (unLo > unHi)
                        {
                            break;
                        }
                        n = ((int)block[zptr[unLo] + d + 1]) - med;
                        if (n == 0)
                        {
                            int temp = 0;
                            temp = zptr[unLo];
                            zptr[unLo] = zptr[ltLo];
                            zptr[ltLo] = temp;
                            ltLo++;
                            unLo++;
                            continue;
                        };
                        if (n > 0)
                        {
                            break;
                        }
                        unLo++;
                    }
                    while (true)
                    {
                        if (unLo > unHi)
                        {
                            break;
                        }
                        n = ((int)block[zptr[unHi] + d + 1]) - med;
                        if (n == 0)
                        {
                            int temp = 0;
                            temp = zptr[unHi];
                            zptr[unHi] = zptr[gtHi];
                            zptr[gtHi] = temp;
                            gtHi--;
                            unHi--;
                            continue;
                        };
                        if (n < 0)
                        {
                            break;
                        }
                        unHi--;
                    }
                    if (unLo > unHi)
                    {
                        break;
                    }
                    int tempx = zptr[unLo];
                    zptr[unLo] = zptr[unHi];
                    zptr[unHi] = tempx;
                    unLo++;
                    unHi--;
                }

                if (gtHi < ltLo)
                {
                    stack[sp].ll = lo;
                    stack[sp].hh = hi;
                    stack[sp].dd = d + 1;
                    sp++;
                    continue;
                }

                n = ((ltLo - lo) < (unLo - ltLo)) ? (ltLo - lo) : (unLo - ltLo);
                Vswap(lo, unLo - n, n);
                m = ((hi - gtHi) < (gtHi - unHi)) ? (hi - gtHi) : (gtHi - unHi);
                Vswap(unLo, hi - m + 1, m);

                n = lo + unLo - ltLo - 1;
                m = hi - (gtHi - unHi) + 1;

                stack[sp].ll = lo;
                stack[sp].hh = n;
                stack[sp].dd = d;
                sp++;

                stack[sp].ll = n + 1;
                stack[sp].hh = m - 1;
                stack[sp].dd = d + 1;
                sp++;

                stack[sp].ll = m;
                stack[sp].hh = hi;
                stack[sp].dd = d;
                sp++;
            }
        }
Пример #31
0
        public void doComponentBegin(Token t)
        {
            //accumulator.Append( "<" + t.TokenText + ">\n" );
            // beginning of a rdfType for this stmt - ie. it's a new resource
            string guid = NewGuid();
            StackElem elem = new StackElem(t, guid, false);

            if (Count > 0 && Peek().predFlag)
            {
                StackElem top = Peek();
                top.guid = guid;
            }
            Push(elem);

            accumulator.Append("{{[" + context + "] [rdf:type] [" + guid + "] [" + NS(t.TokenText) + "]}}\n");
            Inc();
        }