Пример #1
0
        float GetVectorValueWithValueFrom(Vector3 vector, ValueFrom from)
        {
            switch (from)
            {
            case ValueFrom.X:
                return(vector.x);

            case ValueFrom.Y:
                return(vector.y);

            case ValueFrom.Z:
                return(vector.z);

            case ValueFrom.MinusX:
                return(-vector.x);

            case ValueFrom.MinusY:
                return(-vector.y);

            case ValueFrom.MinusZ:
                return(-vector.z);

            default:
                return(0);
            }
        }
Пример #2
0
        private string CreateWhereOld(string strW)
        {
            // using wildcard
            if (usingWildCard())
            {
                // eliminate wildcard signature
                string _wildCard = ValueFrom.Trim();
                if (_wildCard.Length >= 2 && _wildCard.Substring(0, 2) == "*>")
                {
                    if (string.IsNullOrEmpty(ValueTo))
                    {
                        strW = String.Format("({0} = {1})", _node.FormatMe(), _node.FormatMyParameter(ValueFrom.Replace("*>", "")));
                    }
                }
                else
                {
                    bool flag_not = false;
                    if (Regex.IsMatch(_wildCard, @"^(\^)"))
                    {
                        flag_not  = true;
                        _wildCard = _wildCard.Replace(_wildCard[0], ' ').Trim();
                    }
                    //if (_node.FType == string.Empty)
                    //{
                    if (flag_not == false)
                    {
                        strW = GetWhereClause(_wildCard);
                    }
                    else
                    {
                        strW = do_not(GetWhereClause(_wildCard));
                    }
                }

                //}
                //else// if (_node.FType[0] == 'N')
                //{
                //    _wildCard = Regex.Replace(_wildCard, @"\*|\s", string.Empty);
                //    return "(" + _node.FormatMe() + _node.FormatMyParameter(_wildCard) + " )";
                //}
                //return "()";
            }
            // no input in filterTo
            else
            if (string.IsNullOrEmpty(ValueTo))
            {
                strW = String.Format("({0} = {1})", _node.FormatMe(), _node.FormatMyParameter(ValueFrom));
            }
            else
            {
                strW = String.Format("({0} BETWEEN {1} AND {2} )", _node.FormatMe(), _node.FormatMyParameter(ValueFrom), _node.FormatMyParameter(ValueTo));
            }


            return(strW);
        }
 public override RandomValue GetRandomValue(int randomCount)
 {
     if (HasTargetValue())
     {
         if (HasRangeValue())
         {
             return(new RandomValueFromDoubleRangeWithTarget(ValueFrom.GetValueOrDefault(), ValueTo.GetValueOrDefault(), ValueDecimals, TargetValue.GetValueOrDefault(), TargetValueMinPercent.GetValueOrDefault(), randomCount));
         }
         return(new RandomValueFromListWithTarget <double>(ValueList, TargetValue.GetValueOrDefault(), TargetValueMinPercent.GetValueOrDefault(), randomCount));
     }
     if (HasRangeValue())
     {
         return(new RandomValueFromDoubleRange(ValueFrom.GetValueOrDefault(), ValueTo.GetValueOrDefault(), ValueDecimals));
     }
     return(new RandomValueFromList <double>(ValueList));
 }
Пример #4
0
        private string CreateWhereNew(string strW)
        {
            string kq  = "";
            string tmp = "";

            switch (Operate)
            {
            case "=":
                strW = NormalFilter(strW);
                break;

            case "BEGIN":
                tmp = _node.FormatMyParameter(ValueFrom);
                if (_node.FType == "")
                {
                    tmp = tmp.Substring(0, tmp.Length - 1) + "%'";
                    kq  = String.Format("( UPPER({0}) LIKE {1} )", _node.FormatMe(), tmp.ToUpper());
                }
                break;

            case "END":
                tmp = _node.FormatMyParameter(ValueFrom);
                if (_node.FType == "")
                {
                    int tmpIndex = tmp.IndexOf("'");
                    if (tmpIndex >= 0)
                    {
                        tmp = String.Format("{0}%{1}", tmp.Substring(0, tmpIndex + 1), tmp.Substring(tmpIndex + 1));
                        kq  = String.Format("( UPPER({0}) LIKE {1} )", _node.FormatMe(), tmp.ToUpper());
                    }
                }
                break;

            case "CONTAIN":

                string[] arrVal = ValueFrom.Split(' ');
                for (int i = 0; i < arrVal.Length; i++)
                {
                    tmp = _node.FormatMyParameter(String.Format("%{0}%", arrVal[i]));
                    if (_node.FType == "")
                    {
                        kq += String.Format("AND UPPER({0}) LIKE {1} ", _node.FormatMe(), tmp.ToUpper());
                    }
                }
                if (kq.Length > 3)
                {
                    kq = String.Format("({0})", kq.Substring(3));
                }
                break;

            case "BETWEEN":
                if (_node.FType == "")
                {
                    kq = String.Format("( UPPER({0}) BETWEEN {1} AND {2} )", _node.FormatMe(), _node.FormatMyParameter(ValueFrom).ToUpper(), _node.FormatMyParameter(ValueTo).ToUpper());
                }
                else
                {
                    kq = String.Format("({0} BETWEEN {1} AND {2})", _node.FormatMe(), _node.FormatMyParameter(ValueFrom), _node.FormatMyParameter(ValueTo));
                }

                break;

            case "<":
            case ">":
            case "<=":
            case ">=":
            case "<>":
                if (_node.FType == "")
                {
                    kq = String.Format("( UPPER({0}) {1} {2} )", _node.FormatMe(), Operate, _node.FormatMyParameter(ValueFrom).ToUpper());
                }
                else
                {
                    kq = String.Format("({0} {1} {2})", _node.FormatMe(), Operate, _node.FormatMyParameter(ValueFrom));
                }
                break;

            case "in":
                if (_node.FType == "")
                {
                    kq = String.Format("( UPPER({0}) in {1})", _node.FormatMe(), _node.FormatMyArrayParameter(ValueFrom).ToUpper());
                }
                else
                {
                    kq = String.Format("({0} in {1})", _node.FormatMe(), _node.FormatMyArrayParameter(ValueFrom));
                }
                break;

            case "SPACE":
                if (_node.FType == "")
                {
                    kq = String.Format("({0} = '' OR  {0} is null )", _node.FormatMe());
                }
                else
                {
                    kq = String.Format("({0} is null )", _node.FormatMe());
                }
                break;

            case "EXISTS":
                if (_node.FType == "")
                {
                    kq = String.Format("({0} <> '' AND  {0} is not null )", _node.FormatMe());
                }
                else
                {
                    kq = String.Format("({0} is not null )", _node.FormatMe());
                }
                break;

            default:
                kq = NormalFilter(strW);
                break;
            }
            if (kq == "")
            {
                kq = NormalFilter(strW);
            }
            if (IsNot == "Y")
            {
                return(do_not(kq));
            }

            return(kq);
        }
Пример #5
0
 public VectorsUseAs(ValueFrom _x, ValueFrom _y, ValueFrom _z)
 {
     x = _x;
     y = _y;
     z = _z;
 }
Пример #6
0
 public VectorsUseAs()
 {
     x = 0;
     y = 0;
     z = 0;
 }