Пример #1
0
        public void Union(IPrimitiveConditionData value)
        {
            OnSameObject onObject = value as OnSameObject;

            if (this.Condition == true || onObject.Condition == true)
                this.Condition = true;
        }
Пример #2
0
        public void Union(IPrimitiveConditionData value)
        {
            EnclosedArea encArea = value as EnclosedArea;

            if (this.Min > encArea.Min)
                this.Min = encArea.Min;

            if (this.Max < encArea.Max)
                this.Max = encArea.Max;
        }
Пример #3
0
        public void Init(IPrimitiveConditionData ruleData)
        {
            _data = ruleData as TouchState;

            foreach (string touchState in _data.States)
            {
                requiredTouchStates.Add(
                        new TouchActionResult()
                        {
                            Action = GetTouchActionType(touchState)
                        });
            }
        }
Пример #4
0
        public bool Equals(IPrimitiveConditionData data)
        {
            bool result = false;
            if (data is TouchLimit)
            {
                var d1 = data as TouchLimit;
                if (d1.Type == this.Type &&
                    d1.Min == this.Min &&
                    d1.Max == this.Max)
                    result = true;
            }

            return result;
        }
Пример #5
0
        public bool Equals(IPrimitiveConditionData rule)
        {
            if (!(rule is TouchDirection))
            {
                throw new Exception("Wrong Type Exception");
            }
            if (rule == null)
            {
                throw new Exception("Null Input Exception");
            }
            TouchDirection directionRule = rule as TouchDirection;

            return directionRule.Values.Equals( this.Values );
        }
Пример #6
0
        public void Union(IPrimitiveConditionData value)
        {
            TouchTime touchTime = value as TouchTime;

            if (this.Unit == touchTime.Unit)
            {
                if (this.Value < touchTime.Value)
                    this.Value = touchTime.Value;
            }
            else if (this.Unit == string.Empty && touchTime.Unit != string.Empty)
            {
                this.Unit = touchTime.Unit;
                this.Value = touchTime.Value;
            }
            else
            {
                if ((this.Unit == "sec" || this.Unit == "secs") && (touchTime.Unit == "msec" || touchTime.Unit == "msecs"))
                {
                    if ((this.Value * 1000) < touchTime.Value)
                    {
                        this.Value = touchTime.Value / 1000;
                    }

                }
                else if ((this.Unit == "msec" || this.Unit == "msecs") && (touchTime.Unit == "sec" || touchTime.Unit == "secs"))
                {
                    if ((this.Value) < (touchTime.Value * 1000))
                    {
                        this.Value = touchTime.Value * 1000;
                    }
                }
                else if ((this.Unit == "msec" || this.Unit == "msecs") && (touchTime.Unit == "msec" || touchTime.Unit == "msecs"))
                {
                    if ((this.Value) < (touchTime.Value))
                    {
                        this.Value = touchTime.Value;
                    }
                }
                else
                {
                    if ((this.Value) < (touchTime.Value))
                    {
                        this.Value = touchTime.Value;
                    }
                }
            }
        }
Пример #7
0
        public void Union(IPrimitiveConditionData value)
        {
            if (value == null)
            {
                throw new Exception("Null Value Exception");
            }
            if (!(value is ClosedLoop))
            {
                throw new Exception("Invalid Type Exception");
            }
            ClosedLoop cLoop = value as ClosedLoop;

            if (this.State == "false" || cLoop.State == "false")
                this.State = "false";
            else
                this.State = "true";
        }
Пример #8
0
        public void Union(IPrimitiveConditionData value)
        {
            TouchState touchState = value as TouchState;

            bool matchFound = false;
            foreach (string newState in touchState.States)
            {
                foreach (string existingState in this.States)
                {
                    matchFound = string.Equals(newState, existingState);
                    if (matchFound)
                        break;
                }

                if (!matchFound)
                    this.States.Add(newState);
            }
        }
Пример #9
0
        public bool Equals(IPrimitiveConditionData rule)
        {
            DistanceBetweenPoints value = rule as DistanceBetweenPoints;

            if (value == null)
            {
                // Failed to cast to same time
                return false;
            }
            else
            {
                if (value.Behaviour == this.Behaviour &&
                    value.Max == this.Max &&
                    value.Min == this.Min)
                    return true;
                else
                    return false;
            }
        }
Пример #10
0
        public void Union(IPrimitiveConditionData value)
        {
            TouchStep touchStep = value as TouchStep;

            // TouchCount
            if (this.TouchCount < touchStep.TouchCount)
                this.TouchCount = touchStep.TouchCount;

            // TimeLimit
            if (this.Unit == touchStep.Unit)
            {
                if (this.TimeLimit < touchStep.TimeLimit)
                    this.TimeLimit = touchStep.TimeLimit;
            }
            else if (this.Unit == string.Empty && touchStep.Unit != string.Empty)
            {
                this.Unit = touchStep.Unit;
                this.TouchCount = touchStep.TouchCount;
                this.TimeLimit = touchStep.TimeLimit;
            }
            else
            {
                if (this.Unit == "sec" && touchStep.Unit == "msec")
                {
                    if ((this.TimeLimit * 1000) < touchStep.TimeLimit)
                    {
                        this.TimeLimit = touchStep.TimeLimit/1000;
                    }

                }
                else if (this.Unit == "msec" && touchStep.Unit == "sec")
                {
                    if ((this.TimeLimit) < (touchStep.TimeLimit*1000))
                    {
                        this.TimeLimit = touchStep.TimeLimit * 1000;
                    }
                }
            }
        }
Пример #11
0
 public void Union(IPrimitiveConditionData value)
 {
 }
Пример #12
0
 public bool Equals(IPrimitiveConditionData data)
 {
     return false;
 }
Пример #13
0
        public void Union(IPrimitiveConditionData value)
        {
            TouchLimit touchLimit = value as TouchLimit;

            if (this.Min > touchLimit.Min)
                this.Min = touchLimit.Min;

            if ((this.Max != 0 || touchLimit.Max != 0))
            {
                if (!string.Equals(this.Type, "Range", StringComparison.OrdinalIgnoreCase))
                    this.Type = "Range";

                if (this.Max < touchLimit.Max)
                    this.Max = touchLimit.Max;
            }
        }
Пример #14
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as AngleBetween;
 }
Пример #15
0
 public void Union(IPrimitiveConditionData value)
 {
     throw new NotImplementedException();
 }
Пример #16
0
        public void Union(IPrimitiveConditionData value)
        {
            if (value == null)
            {
                throw new Exception("Null value exception");
            }
            if (!(value is TouchArea))
            {
                throw new Exception("TouchArea union not TouchArea exception");
            }
            TouchArea tArea = value as TouchArea;
            int height, width;
            string NewValue = string.Empty;

            if (this.Height < tArea.Height)
                height = tArea.Height;
            else
                height = this.Height;

            if (this.Width < tArea.Width)
                width = tArea.Width;
            else
                width = this.Width;

            if (this.Type == "Ellipse" && tArea.Type == "Ellipse")
            {
                NewValue = string.Format("{0}x{1}", height, width);
            }
            else if (this.Type == "Rect" && tArea.Type == "Rect")
            {
                NewValue = string.Format("{0}x{1}", height, width);
            }
            else if (this.Type == "Circle" && tArea.Type == "Circle")
            {
                NewValue = string.Format("{0}", height);
            }
            else //Different types always union to be a rect
            {
                NewValue = string.Format("{0}x{1}", height, width);
                this.Type = "Rect";
            }

            Value = NewValue;
        }
Пример #17
0
        public void Union(IPrimitiveConditionData value)
        {
            DistanceBetweenPoints distanceBtwPoints = value as DistanceBetweenPoints;

            if (this.Behaviour != distanceBtwPoints.Behaviour)
            {

                if (this.Behaviour == BehaviourTypes.Increasing && distanceBtwPoints.Behaviour == BehaviourTypes.Decreasing)
                {
                    throw new Exception("Invalid Union Type");
                }
                else if (this.Behaviour == BehaviourTypes.Decreasing && distanceBtwPoints.Behaviour == BehaviourTypes.Increasing)
                {
                    throw new Exception("Invalid Union Type");
                }
                else if (this.Behaviour == BehaviourTypes.UnChanged && distanceBtwPoints.Behaviour == BehaviourTypes.Increasing)
                {
                    this.Max = distanceBtwPoints.Max;
                    this.Behaviour = BehaviourTypes.Increasing;
                }
                else if (this.Behaviour == BehaviourTypes.UnChanged && distanceBtwPoints.Behaviour == BehaviourTypes.Decreasing)
                {
                    this.Min = distanceBtwPoints.Min;
                    this.Behaviour = BehaviourTypes.Decreasing;
                }
            }
            else if (this.Behaviour == BehaviourTypes.Increasing && distanceBtwPoints.Behaviour == BehaviourTypes.Increasing)
            {
                this.Max = distanceBtwPoints.Max;
                this.Behaviour = BehaviourTypes.Increasing;
            }
            else if (this.Behaviour == BehaviourTypes.Decreasing && distanceBtwPoints.Behaviour == BehaviourTypes.Decreasing)
            {
                this.Min = distanceBtwPoints.Min;
                this.Behaviour = BehaviourTypes.Decreasing;
            }
        }
Пример #18
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as ClosedLoop;
 }
Пример #19
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as Tag;
 }
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as DistanceBetweenPoints;
 }
Пример #21
0
        public void Union(IPrimitiveConditionData value)
        {
            if (value == null)
            {
                throw new Exception("Null Value Exception");
            }
            if (!(value is TouchPathBoundingBox))
            {
                throw new Exception("Wrong Input Type Exception");
            }
            TouchPathBoundingBox touchPBox = value as TouchPathBoundingBox;

            if (this.MinHeight > touchPBox.MinHeight)
                this.MinHeight = touchPBox.MinHeight;

            if (this.MaxHeight < touchPBox.MaxHeight)
                this.MaxHeight = touchPBox.MaxHeight;

            if (this.MinWidth > touchPBox.MinWidth)
                this.MinWidth = touchPBox.MinWidth;

            if (this.MaxWidth < touchPBox.MaxWidth)
                this.MaxWidth = touchPBox.MaxWidth;
        }
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as TouchPathBoundingBox;
 }
Пример #23
0
        public bool Equals(IPrimitiveConditionData ruleData)
        {
            if (ruleData == null)
            {
                throw new Exception("Null value exception");
            }
            if (!(ruleData is TouchArea))
            {
                return false;
            }
            var data = ruleData as TouchArea;

            return (data.Type == this.Type && data.Value == this.Value);
        }
Пример #24
0
 public void Init(IPrimitiveConditionData ruleData)
 {
 }
Пример #25
0
 private static string getPrimitiveName(IPrimitiveConditionData primitive)
 {
     string fullname = primitive.ToGDL();
     int pos = fullname.LastIndexOf(":");
     if (pos == -1)
         return fullname;
     else
         return fullname.Remove(pos);
 }
Пример #26
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as EnclosedArea;
 }
Пример #27
0
 public bool Equals(IPrimitiveConditionData rule)
 {
     throw new NotImplementedException();
 }
Пример #28
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as TouchDirection;
 }
Пример #29
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as TouchTime;
 }
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as TouchRelativePosition;
 }