Exemplo n.º 1
0
        public override CompileResult Compile()
        {
            var prevIsAddress = Prev.GetType() == typeof(ExcelAddressExpression);
            var prevIsOffset  = Prev.GetType() == typeof(FunctionExpression) && ((FunctionExpression)Prev).ExpressionString.ToLower() == "offset";
            var nextIsAddress = Next.GetType() == typeof(ExcelAddressExpression);
            var nextIsOffset  = Next.GetType() == typeof(FunctionExpression) && ((FunctionExpression)Next).ExpressionString.ToLower() == "offset";

            if (!prevIsAddress && !prevIsOffset)
            {
                return(new CompileResult(eErrorType.Value));
            }
            if (!nextIsAddress && !nextIsOffset)
            {
                return(new CompileResult(eErrorType.Value));
            }

            if (prevIsAddress && nextIsOffset)
            {
                return(InternalCompile(Prev.Compile().Result.ToString(), Next.Compile().Result as ExcelDataProvider.IRangeInfo));
            }
            else if (prevIsOffset && nextIsAddress)
            {
                return(InternalCompile(Prev.Compile().Result as ExcelDataProvider.IRangeInfo, Next.Compile().Result.ToString()));
            }
            else if (prevIsOffset && nextIsOffset)
            {
                return(InternalCompile(Prev.Compile().Result as ExcelDataProvider.IRangeInfo, Next.Compile().Result as ExcelDataProvider.IRangeInfo));
            }

            return(new CompileResult(eErrorType.Value));
        }
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                if (__isset.count)
                {
                    hashcode = (hashcode * 397) + Count.GetHashCode();
                }
                if (__isset.midItem)
                {
                    hashcode = (hashcode * 397) + MidItem.GetHashCode();
                }
                if (__isset.countFromMid)
                {
                    hashcode = (hashcode * 397) + CountFromMid.GetHashCode();
                }
                if (__isset.prev)
                {
                    hashcode = (hashcode * 397) + Prev.GetHashCode();
                }
                if (__isset.nxt)
                {
                    hashcode = (hashcode * 397) + Nxt.GetHashCode();
                }
            }
            return(hashcode);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Self != null)
         {
             hashCode = hashCode * 59 + Self.GetHashCode();
         }
         if (First != null)
         {
             hashCode = hashCode * 59 + First.GetHashCode();
         }
         if (Prev != null)
         {
             hashCode = hashCode * 59 + Prev.GetHashCode();
         }
         if (Next != null)
         {
             hashCode = hashCode * 59 + Next.GetHashCode();
         }
         if (Last != null)
         {
             hashCode = hashCode * 59 + Last.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 4
0
        //float rise = 0;
        public override Pose Calculate()
        {
            Col.Calculate();
            Prev.Calculate();

            if (controller != null && controller.executor != null)
            {
                Pose pose = Prev.value;

                float      maxy = pose.nearClip / Mathf.Cos(pose.fov * 0.5f * Mathf.Deg2Rad) + 0.01f;
                RaycastHit rch;
                if (Physics.Raycast(new Ray(pose.position, Vector3.down), out rch, maxy, 1 << Pathea.Layer.Water))
                {
                    float rise = maxy - rch.distance;
                    pose.position += Vector3.up * rise;
                }
                if (Physics.Raycast(new Ray(pose.position + Vector3.up * maxy, Vector3.down), out rch, maxy, 1 << Pathea.Layer.Water))
                {
                    float rise = -rch.distance;
                    pose.position += Vector3.up * rise;
                }

                return(pose);
            }

            return(Pose.Default);
        }
Exemplo n.º 5
0
        public unsafe void XOR()
        {
            try
            {
                if ((Current.Width == Prev.Width) && (Current.Height == Prev.Height))
                {
                    int avg = 0;
                    Data1 = Prev.LockBits(new Rectangle(0, 0, Prev.Width, Prev.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                    Data2 = Current.LockBits(new Rectangle(0, 0, Current.Width, Current.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                    //BitmapData data3 = result.LockBits(new Rectangle(0, 0, result.Width, result.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

                    int offset = Data2.Stride - Data2.Width * 4;

                    byte *ptr1 = (byte *)Data1.Scan0;
                    byte *ptr2 = (byte *)Data2.Scan0;
                    //byte* ptr3 = (byte*)data3.Scan0;

                    for (int y = 0; y < Current.Height; y++)
                    {
                        for (int x = 0; x < Current.Width * 4; x++)
                        {
                            //http://www.codeproject.com/KB/graphics/quickgrayscale.aspx
                            //convert pixels to greyscale by averaging the colour components
                            //Array index 0 is blue, index 1 is green, index 2 is red
                            avg     = (ptr1[0] + ptr1[1] + ptr1[2]) / 3;
                            ptr1[0] = (byte)avg;
                            ptr1[1] = (byte)avg;
                            ptr1[2] = (byte)avg;

                            avg     = (ptr2[0] + ptr2[1] + ptr2[2]) / 3;
                            ptr2[0] = (byte)avg;
                            ptr2[1] = (byte)avg;
                            ptr2[2] = (byte)avg;

                            //ptr3[0] = (byte)XORCalc(ptr1[0], ptr2[0]);
                            XORCalc(ptr1[0], ptr2[0]);
                            ptr1++;
                            ptr2++;
                            //ptr3++;
                        }

                        ptr1 += offset;
                        ptr2 += offset;
                        //ptr3 += offset;
                    }

                    Prev.UnlockBits(Data1);
                    Current.UnlockBits(Data2);
                    //result.UnlockBits(data3);
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.Out.WriteLine("XOR Image Processing Error: " + ex.Message);
#endif
                Prev.UnlockBits(Data1);
                Current.UnlockBits(Data2);
            }
        }
        /// <summary>
        /// Returns true if ProgramListLinks instances are equal
        /// </summary>
        /// <param name="other">Instance of ProgramListLinks to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProgramListLinks other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Next == other.Next ||
                     Next != null &&
                     Next.Equals(other.Next)
                     ) &&
                 (
                     Prev == other.Prev ||
                     Prev != null &&
                     Prev.Equals(other.Prev)
                 ) &&
                 (
                     Self == other.Self ||
                     Self != null &&
                     Self.Equals(other.Self)
                 ));
        }
Exemplo n.º 7
0
        public void Update(String title, String url)
        {
            Prev.Push(new Item(Title, Url));

            Title = title;
            Url   = url;
        }
        /// <summary>
        /// Returns true if PipelineExecutionListRepresentationLinks instances are equal
        /// </summary>
        /// <param name="other">Instance of PipelineExecutionListRepresentationLinks to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PipelineExecutionListRepresentationLinks other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Next == other.Next ||
                     Next != null &&
                     Next.Equals(other.Next)
                     ) &&
                 (
                     Page == other.Page ||
                     Page != null &&
                     Page.Equals(other.Page)
                 ) &&
                 (
                     Prev == other.Prev ||
                     Prev != null &&
                     Prev.Equals(other.Prev)
                 ) &&
                 (
                     Self == other.Self ||
                     Self != null &&
                     Self.Equals(other.Self)
                 ));
        }
        private void Initialize(NonSelectColumnArgument column, DataType dataTypeDef)
        {
            IsNullable = null;
            CheckNullAndThrow(Arg(() => column, column));
            TryThrow(dataTypeDef.Exception);
            Prev.GetPrev <BeginTableChainer>().SetHasColumns();

            Build = (buildContext, buildArgs) =>
            {
                var sql = Text.GenerateSql(300);
                sql.AppendLine();
                sql.Append(Text.TwoSpaces);

                if (!(Prev is BeginTableChainer && !((BeginTableChainer)Prev).IsDesignedByType))
                {
                    sql.Append(Text.Comma);
                }

                sql.Append(column.Build(buildContext, buildArgs)).S()
                .Append(dataTypeDef.Build());

                TryThrow(column.Exception);

                if (Identity != null)
                {
                    sql.S().Append(Text.Identity)
                    .EncloseLeft()
                    .Append(Identity.Seed)
                    .AppendComma()
                    .Append(Identity.Increment)
                    .EncloseRight();
                }

                if (IsNullable == true)
                {
                    sql.S().Append(Text.Null);
                }
                else if (IsNullable == false)
                {
                    sql.S().Append(Text.NotNull);
                }

                if (Check != null)
                {
                    sql.S().Append(Text.Check)
                    .EncloseLeft().Append(Check.Build(buildContext, buildArgs)).EncloseRight();
                    TryThrow(buildContext);
                }

                if (Default != null)
                {
                    sql.S().Append(Text.Default)
                    .EncloseLeft().Append(Default.Build(buildContext, buildArgs)).EncloseRight();
                    TryThrow(buildContext);
                }

                return(sql.ToString());
            };
        }
Exemplo n.º 10
0
 public Preview(string mail)
 {
     InitializeComponent();
     if (!string.IsNullOrEmpty(mail))
     {
         Prev.NavigateToString(mail);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes the basic extended node copying another one.
        /// </summary>
        public virtual TNode Clone()
        {
            var clone = new TNode();

            Next.CopyTo(clone.Next, 0);
            Prev.CopyTo(clone.Prev, 0);
            return(clone);
        }
Exemplo n.º 12
0
 public void InsertDate()
 {
     DatepickerInput.Click();
     for (int i = 1; i <= 5; i++)
     {
         Prev.Click();
     }
     SelectFirstDay.Click();
 }
Exemplo n.º 13
0
 public string ToPrettyString()
 {
     return("ModuleItemSequenceNode {" +
            ($"\n{nameof(Prev)}: {Prev?.ToPrettyString()}," +
             $"\n{nameof(Current)}: {Current?.ToPrettyString()}," +
             $"\n{nameof(Next)}: {Next?.ToPrettyString()}," +
             $"\n{nameof(MasteryPath)}: {MasteryPath?.ToString(Formatting.Indented)}").Indent(4) +
            "\n}");
 }
Exemplo n.º 14
0
        internal UpdateChainer(Chainer prev, string alias)
            : base(prev)
        {
            Query.SetUpdate(this);
            alias = base.TryGetTableAlias(alias);
            var aliasDelimited = Filter.Delimit(alias);

            Build = (buildContext, buildArgs) =>
            {
                var sql    = Text.GenerateSql(200);
                var select = GetPrev <SelectChainer>();
                TakeTop(select);
                select.SkipBuild = true;

                sql.NewLine(BuildTop(buildContext, buildArgs))
                .Append(aliasDelimited).S();

                var columnsObject = Prev.GetPrev <ColumnsChainer>();
                columnsObject.Build(buildContext, buildArgs);
                columnsObject.SkipBuild = true;

                var values = ProcessValueArrayInliner(buildContext, buildArgs, select.Columns);
                if (values == null)
                {
                    values = select.Columns;
                }

                var columns = ProcessValueArrayInliner(buildContext, buildArgs, Columns);
                if (columns == null)
                {
                    columns = Columns;
                }

                sql.NewLine(Text.Set).S();
                var i = 0;
                foreach (var column in columns)
                {
                    if (i > 0)
                    {
                        sql.NewLineIndent(Text.Comma).S();
                    }

                    sql.Append(aliasDelimited)
                    .Append(Text.Dot)
                    .Append(column.Build(buildContext, buildArgs))
                    .Append(Text._Equal_)
                    .Append(values[i].Build(buildContext, buildArgs)).S();

                    ++i;
                }

                OutputChainer.TryAppendOutput(this, sql, buildContext, buildArgs);

                return(sql.ToString());
            };
        }
Exemplo n.º 15
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Length;
         hashCode = (hashCode * 397) ^ (Current != null ? Current.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Prev != null ? Prev.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 16
0
        public override Pose Calculate()
        {
            Name.Calculate();
            Life.Calculate();
            Col.Calculate();
            Prev.Calculate();

            // TODO: Other Media

            return(output.Output());
        }
Exemplo n.º 17
0
        public void forward()
        {
            if (hasNext())
            {
                Prev.Push(new Item(Title, Url));

                Item current = Next.Pop();
                Title = current.Title;
                Url   = current.Url;
            }
        }
Exemplo n.º 18
0
        public override Pose Calculate()
        {
            Col.Calculate();
            Prev.Calculate();
            Enabled.Calculate();
            if (!Enabled.value.value_b)
            {
                return(Prev.value);
            }
            YPRScale.Calculate();
            YPROmega.Calculate();
            YPRPhi.Calculate();
            OffsetScale.Calculate();
            OffsetOmega.Calculate();
            OffsetPhi.Calculate();
            Tick.Calculate();
            Duration.Calculate();
            Falloff.Calculate();

            if (controller != null && controller.executor != null)
            {
                Pose pose = Prev.value;

                float t = Tick.value.value_f;
                float d = Mathf.Max(0.001f, Duration.value.value_f);
                float f = Mathf.Max(0.001f, Falloff.value.value_f);
                if (t < d && t >= 0)
                {
                    float scale = Mathf.Pow(1f - t / d, f);
                    pose.yaw   += Mathf.Sin((YPROmega.value.value_v.x * t + YPRPhi.value.value_v.x) * 2.0f * Mathf.PI) * YPRScale.value.value_v.x * scale;
                    pose.pitch += Mathf.Sin((YPROmega.value.value_v.y * t + YPRPhi.value.value_v.y) * 2.0f * Mathf.PI) * YPRScale.value.value_v.y * scale;
                    pose.roll  += Mathf.Sin((YPROmega.value.value_v.z * t + YPRPhi.value.value_v.z) * 2.0f * Mathf.PI) * YPRScale.value.value_v.z * scale;

                    Vector3 right   = pose.rotation * Vector3.right;
                    Vector3 up      = pose.rotation * Vector3.up;
                    Vector3 forward = pose.rotation * Vector3.forward;

                    Vector3 ofs = Vector3.zero;
                    ofs += right * Mathf.Sin((OffsetOmega.value.value_v.x * t + OffsetPhi.value.value_v.x) * 2.0f * Mathf.PI) * OffsetScale.value.value_v.x * scale;
                    ofs += up * Mathf.Sin((OffsetOmega.value.value_v.y * t + OffsetPhi.value.value_v.y) * 2.0f * Mathf.PI) * OffsetScale.value.value_v.y * scale;
                    ofs += forward * Mathf.Sin((OffsetOmega.value.value_v.z * t + OffsetPhi.value.value_v.z) * 2.0f * Mathf.PI) * OffsetScale.value.value_v.z * scale;

                    pose.position += ofs;

                    return(pose);
                }
                else
                {
                    return(pose);
                }
            }

            return(Pose.Default);
        }
 public void removeEvents(INavigationEvents ievents)
 {
     EventFirst  -= new First(ievents.moveFirst);
     EventLast   -= new Last(ievents.moveLast);
     EventNext   -= new Next(ievents.moveNext);
     EventPrev   -= new Prev(ievents.movePrev);
     EventOK     -= new OK(ievents.OK);
     EventDelete -= new Delete(ievents.delete);
     EventAdd    -= new Add(ievents.add);
     EventCancel -= new Cancel(ievents.cancel);
 }
Exemplo n.º 20
0
        public void back()
        {
            if (hasPrev())
            {
                Next.Push(new Item(Title, Url));

                Item current = Prev.Pop();
                Title = current.Title;
                Url   = current.Url;
            }
        }
 public void addEvents(INavigationEvents ievents)
 {
     EventFirst  += new First(ievents.moveFirst);
     EventLast   += new Last(ievents.moveLast);
     EventNext   += new Next(ievents.moveNext);
     EventPrev   += new Prev(ievents.movePrev);
     EventOK     += new OK(ievents.OK);
     EventDelete += new Delete(ievents.delete);
     EventAdd    += new Add(ievents.add);
     EventCancel += new Cancel(ievents.cancel);
 }
Exemplo n.º 22
0
 internal TopChainer(ISemantic prev, Nullable <long> top, bool isWithTies, int overloader)
     : base(((ISelect)prev.Translate(new SemqContext(((DbNode)prev).Root), null)).Select())
 {
     if (top != null)
     {
         Prev.SetTop((long)top, isWithTies);
     }
     else
     {
         SkipBuild = true;
     }
 }
Exemplo n.º 23
0
 /// <summary>
 /// Prepends the given <see cref="ChainedSerializer"/> to this serializer.
 /// </summary>
 /// <param name="previousSerializer">The serializer to prepend.</param>
 public void Prepend([CanBeNull] ChainedSerializer previousSerializer)
 {
     // Update current Prev if non-null to target the first of the chain we're prepending
     Prev?.SetNext(previousSerializer?.First);
     previousSerializer?.First.SetPrev(Prev);
     // Set the current Prev to the given serializer
     Prev = previousSerializer;
     // Make sure that the link with the old Next of the given serializer is cleared
     previousSerializer?.Next?.SetPrev(null);
     // And set the Next of the given serializer to be this one.
     previousSerializer?.SetNext(this);
 }
        /// <summary>
        /// Returns true if PaginationHeaderResponse instances are equal
        /// </summary>
        /// <param name="other">Instance of PaginationHeaderResponse to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PaginationHeaderResponse other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Total == other.Total ||

                     Total.Equals(other.Total)
                     ) &&
                 (
                     Count == other.Count ||

                     Count.Equals(other.Count)
                 ) &&
                 (
                     Size == other.Size ||

                     Size.Equals(other.Size)
                 ) &&
                 (
                     Current == other.Current ||

                     Current.Equals(other.Current)
                 ) &&
                 (
                     First == other.First ||
                     First != null &&
                     First.Equals(other.First)
                 ) &&
                 (
                     Last == other.Last ||
                     Last != null &&
                     Last.Equals(other.Last)
                 ) &&
                 (
                     Prev == other.Prev ||
                     Prev != null &&
                     Prev.Equals(other.Prev)
                 ) &&
                 (
                     Next == other.Next ||
                     Next != null &&
                     Next.Equals(other.Next)
                 ));
        }
Exemplo n.º 25
0
 public void LinkRemove()
 {
     if (Prev != null)
     {
         Prev.SetNext(Next);
     }
     if (Next != null)
     {
         Next.SetPrev(Prev);
     }
     SetNext(null);
     SetPrev(null);
 }
Exemplo n.º 26
0
 /// <summary>
 /// Add the ability for any node in a list to get the head node of the list.
 /// </summary>
 /// <returns>The head.</returns>
 public BaseNode GetHead()
 {
     //If there is a previous node, recurse into it to get the head node.
     if (null != Prev)
     {
         return(Prev.GetHead());
     }
     else
     {
         //If there is no prev node, this dude is the head
         return(this);
     }
 }
Exemplo n.º 27
0
Arquivo: IHandler.cs Projeto: an1ju/Qi
        /// <summary>写入数据,返回结果作为下一个处理器消息</summary>
        /// <param name="context">上下文</param>
        /// <param name="message">消息</param>
        public virtual Object Write(IHandlerContext context, Object message)
        {
            if (Prev != null)
            {
                return(Prev.Write(context, message));
            }

            // 最后一个处理器,截断
            if (context != null)
            {
                return(context.FireWrite(message));
            }

            return(message);
        }
Exemplo n.º 28
0
        public void DBFiles_Guid_Test_03_Generate1000000()
        {
            Guid Prev, Next;
            int  i;

            Prev = gen.CreateGuid();

            for (i = 1; i < 1000000; i++)
            {
                Next = gen.CreateGuid();
                AssertEx.Less(Prev, Next);
                AssertEx.Less(Prev.ToString(), Next.ToString());
                Prev = Next;
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public KeyBind(ImageOperation imgope)
        {
            // TODO:仮のキーバインド
            dictionary.Add(KeyList.MouseLeftClick, ActionList.None);
            dictionary.Add(KeyList.MouseRightClick, ActionList.None);
            dictionary.Add(KeyList.MouseLeftDoubleClick, ActionList.NextFile);
            dictionary.Add(KeyList.MouseRightDoubleClick, ActionList.PrevFile);
            dictionary.Add(KeyList.MouseScrollUp, ActionList.Prev);
            dictionary.Add(KeyList.MouseScrollDown, ActionList.Next);

            next     = new Next(imgope.Next);
            prev     = new Prev(imgope.Prev);
            nextfile = new NextFile(imgope.NextFile);
            prevfile = new PrevFile(imgope.PrevFile);
        }
Exemplo n.º 30
0
 internal OperatorNode(TopologyManager mgr, OperatorNode previous, Type t, int parallelism, int outputStreamCount, PartitionPolicy partitionPolicy)
 {
     for (int i = 0; i < parallelism; i++)
     {
         OperatorGUIDs.Add(Guid.NewGuid());
     }
     Prev.Add(previous);
     OperatorType = t;
     StreamGUID   = Guid.NewGuid();
     Parallelism  = parallelism;
     SetPartitioner(partitionPolicy);
     OutputStreamCount = outputStreamCount;
     _mgr = mgr;
     mgr.Operators.Add(this);
 }