Example #1
0
        public void SetArgView(int i, IBlockView v)
        {
            int         iContent = 0, iScript = 0;
            ArgViewType resultViewType = ArgViewType.Unknown;

            for (int j = 0; j < ArgPartitions.Count; ++j)
            {
                ArgumentPartition p = ArgPartitions[j];
                if (p.Type == ArgViewType.Content)
                {
                    if (i < p.N)
                    {
                        resultViewType = ArgViewType.Content;
                        break;
                    }
                    else
                    {
                        i -= p.N;
                        iContent++;
                    }
                }
                else if (p.Type == ArgViewType.Script)
                {
                    if (i < p.N)
                    {
                        resultViewType = ArgViewType.Script;
                        break;
                    }
                    else
                    {
                        i -= p.N;
                        iScript++;
                    }
                }
            }
            // Now we can use resultViewType and i to determine the arg
            if (resultViewType == ArgViewType.Content)
            {
                Contents[iContent].SetArgView(i, v);
            }
            else if (resultViewType == ArgViewType.Script)
            {
                SetScriptView(iScript, (IStackableBlockView)v);
            }
            else
            {
                throw new InvalidOperationException("Error in view search algorithm in CBlockView.SetArgView(...)");
            }
        }
Example #2
0
 public ArgumentPartition(int n, ArgViewType argViewType)
 {
     this.N = n;
     this.Type = argViewType;
 }
Example #3
0
 public ArgumentPartition(int n, ArgViewType argViewType)
 {
     this.N    = n;
     this.Type = argViewType;
 }