Example #1
0
        private object method_0(CellExt cellExt_0, int int_3, int int_4)
        {
            CellExt current = base.cs.Current;

            if ((current.Col == 10) && (current.Row == 18))
            {
                Console.Out.WriteLine("current row: " + current.Row.ToString().ToString());
            }
            CellExt source = cellExt_0.getCommonLeftHead(current.Source);
            CellExt ext2   = current.getLeftHead(source);

            if (ext2 == current)
            {
                ext2 = current.getLeftHead();
            }
            CellExt ext4 = cellExt_0.getCommonTopHead(current.Source);
            CellExt ext3 = current.getTopHead(ext4);

            if (ext3 == current)
            {
                ext3 = current.getTopHead();
            }
            try
            {
                if (int_3 != 0)
                {
                    ext2 = this.method_1(ext2, ext2.Source, int_3);
                    if (ext2 == null)
                    {
                        return(null);
                    }
                }
                if (int_4 != 0)
                {
                    ext3 = this.method_4(ext3, ext3.Source, int_4);
                    if (ext3 == null)
                    {
                        return(null);
                    }
                }
            }
            catch (StackOverflowException exception)
            {
                Console.Out.WriteLine(new StringBuilder("current: ").Append(current.Row).Append(", ").Append(current.Col).ToString().ToString());
                throw exception;
            }
            ext2.testValue();
            ext3.testValue();
            return(new CSVar(cellExt_0, ext2, ext3));
        }
Example #2
0
        private CellExt method_5(CellExt cellExt_0, int int_3)
        {
            int num2 = (int_3 > 0) ? 1 : -1;

            cellExt_0 = cellExt_0.getTopHead();
            while (cellExt_0 != null)
            {
                CellExt[] extCells = cellExt_0.ExtCells;
                if (extCells != null)
                {
                    int index = cellExt_0.Position + num2;
                    if ((index >= 0) && (index < extCells.Length))
                    {
                        return(extCells[index]);
                    }
                }
                cellExt_0 = cellExt_0.getTopHead();
            }
            return(null);
        }
Example #3
0
File: ColNo.cs Project: ikvm/test
        public override object calculate()
        {
            if (base.paramList.Count > 0)
            {
                throw new ReportError("col函数参数列表应该为空");
            }
            CellExt   current  = base.cs.Current;
            ArrayList subCells = current.getTopHead().SubCells;

            for (int i = 0; i < subCells.Count; i++)
            {
                CellExt ext = (CellExt)subCells[i];
                if (ext != current)
                {
                    ext.testValue();
                }
            }
            return(ConvertData.getInteger(base.cs.Current.Col));
        }
Example #4
0
 public Head(ICalcFlash enclosingInstance, object catValue, object catCell, object seriesValue, object seriesCell)
 {
     this.InitBlock(enclosingInstance);
     this.leftHead = null;
     this.topHead  = null;
     if (catValue is CSVar)
     {
         CellExt ext        = (CellExt)catCell;
         int     extensible = ((CSVar)catValue).getCell().Extensible;
         if (PropertyDefine.CEX_VERTICAL.Equals(extensible))
         {
             this.leftHead = ext;
         }
         else if (PropertyDefine.CEX_HORIZONTAL.Equals(extensible))
         {
             this.topHead = ext;
         }
         else
         {
             this.leftHead = ext.getLeftHead();
             this.topHead  = ext.getTopHead();
         }
     }
     if (seriesValue is CSVar)
     {
         CellExt ext2 = (CellExt)seriesCell;
         int     num2 = ((CSVar)seriesValue).getCell().Extensible;
         if (PropertyDefine.CEX_VERTICAL.Equals(num2))
         {
             this.leftHead = (CellExt)seriesCell;
         }
         else if (PropertyDefine.CEX_HORIZONTAL.Equals(num2))
         {
             this.topHead = (CellExt)seriesCell;
         }
         else
         {
             this.leftHead = ext2.getLeftHead();
             this.topHead  = ext2.getTopHead();
         }
     }
 }
Example #5
0
        private object method_0(CellExt cellExt_0)
        {
            CellExt current = base.cs.Current;
            CellExt source  = cellExt_0.Source;
            CellExt sub     = current.Source;

            if (!source.isLeftHeadOf(sub))
            {
                if (source.isTopHeadOf(sub))
                {
                    CellExt[] extCells = current.getTopHead(source).ExtCells;
                    if (extCells == null)
                    {
                        return(null);
                    }
                    for (int i = 0; i < extCells.Length; i++)
                    {
                        if (extCells[i].isTopHeadOf(current))
                        {
                            return(ConvertData.getInteger(i + 1));
                        }
                    }
                }
            }
            else
            {
                CellExt[] extArray2 = current.getLeftHead(source).ExtCells;
                if (extArray2 == null)
                {
                    return(null);
                }
                for (int j = 0; j < extArray2.Length; j++)
                {
                    if (extArray2[j].isLeftHeadOf(current))
                    {
                        return(ConvertData.getInteger(j + 1));
                    }
                }
            }
            throw new ReportError(new StringBuilder(source.SourceId.ToString().ToString()).Append("不是").Append(current.SourceId).Append("的主格").ToString().ToString());
        }
Example #6
0
        public override object calculate()
        {
            if (base.unit_0 == null)
            {
                throw new ReportError("位移函数[]左操作数为空");
            }
            object obj3 = base.unit_0.calculate();

            if (!(obj3 is CSVar))
            {
                throw new ReportError("位移函数[]左操作数应为单元格");
            }
            CSVar   var    = (CSVar)obj3;
            CellExt source = var.Source;

            if (!this.bool_0)
            {
                int     num6     = this.arrayList_0.Count;
                int     num2     = this.arrayList_1.Count;
                CellExt current  = base.cs.Current;
                CellExt leftHead = current.getLeftHead();
                CellExt topHead  = current.getTopHead();
                for (int i = 0; i < num6; i++)
                {
                    GClass1 class3 = (GClass1)this.arrayList_0[i];
                    int     index  = 0;
                    if (class3.source == null)
                    {
                        if (source.ExtCells != null)
                        {
                            class3.source = source;
                        }
                        else
                        {
                            class3.source = source.getLeftHead();
                        }
                    }
                    CellExt ext6 = current.getLeftHead(class3.source);
                    switch (class3.type)
                    {
                    case 0:
                        index = class3.position;
                        break;

                    case 1:
                        if (ext6 == null)
                        {
                            throw new ReportError("位移对象超出范围");
                        }
                        index = ext6.Position + class3.position;
                        break;

                    case 2:
                        if (ext6 == null)
                        {
                            throw new ReportError("位移对象超出范围");
                        }
                        index = ext6.Position;
                        break;
                    }
                    if (class3.source.isLeftHeadOf(leftHead.Source))
                    {
                        leftHead = leftHead.getLeftHead(class3.source);
                    }
                    else
                    {
                        leftHead = leftHead.getSubCell(class3.source);
                    }
                    if (leftHead == null)
                    {
                        return(null);
                    }
                    leftHead.testValue();
                    leftHead = leftHead.getExtCell(index);
                    if (leftHead == null)
                    {
                        return(null);
                    }
                }
                for (int j = 0; j < num2; j++)
                {
                    GClass1 class2   = (GClass1)this.arrayList_1[j];
                    int     position = 0;
                    if (class2.source == null)
                    {
                        if (source.ExtCells == null)
                        {
                            class2.source = source.getTopHead();
                        }
                        else
                        {
                            class2.source = source;
                        }
                    }
                    CellExt ext4 = current.getTopHead(class2.source);
                    switch (class2.type)
                    {
                    case 0:
                        position = class2.position;
                        break;

                    case 1:
                        if (ext4 == null)
                        {
                            throw new ReportError("位移对象超出范围");
                        }
                        position = ext4.Position + class2.position;
                        break;

                    case 2:
                        if (ext4 == null)
                        {
                            throw new ReportError("位移对象超出范围");
                        }
                        position = ext4.Position;
                        break;
                    }
                    if (class2.source.isTopHeadOf(topHead.Source))
                    {
                        topHead = topHead.getTopHead(class2.source);
                    }
                    else
                    {
                        topHead = topHead.getSubCell(class2.source);
                    }
                    if (topHead == null)
                    {
                        return(null);
                    }
                    topHead.testValue();
                    topHead = topHead.getExtCell(position);
                    if (topHead == null)
                    {
                        return(null);
                    }
                }
                return(new CSVar(source, leftHead, topHead));
            }
            return(this.method_0(source, this.int_1, this.int_2));
        }