/// <summary>
 /// Initializes a new instance of the <see cref="MathRubrics"/> class.
 /// </summary>
 /// <param name="data">The data<see cref="IFigures"/>.</param>
 public MathRubrics(IFigures data)
 {
     Rubrics        = data.Rubrics;
     FormulaRubrics = new MathRubrics(Rubrics);
     MathsetRubrics = new MathRubrics(Rubrics);
     Data           = data;
 }
예제 #2
0
 /// <summary>
 /// The Delete.
 /// </summary>
 /// <param name="SqlConnectString">The SqlConnectString<see cref="string"/>.</param>
 /// <param name="cards">The cards<see cref="IFigures"/>.</param>
 /// <returns>The <see cref="IDeck{IDeck{IFigure}}"/>.</returns>
 public IDeck <IDeck <IFigure> > Delete(string SqlConnectString, IFigures cards)
 {
     try
     {
         if (sqaf == null)
         {
             sqaf = new Sqlbase(SqlConnectString);
         }
         try
         {
             bool buildmap = true;
             if (cards.Count > 0)
             {
                 BulkPrepareType prepareType = BulkPrepareType.Drop;
                 return(sqaf.Delete(cards, true, buildmap, prepareType));
             }
             return(null);
         }
         catch (SqlException ex)
         {
             throw ex;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
        public static IFigures  Query(this IFigures figures, Func <IFigure, bool> evaluator)
        {
            IFigures view = figures.Exposition = (IFigures)figures.FiguresType.New();

            view.Add(figures.AsEnumerable().AsQueryable().Where(evaluator));
            return(view);
        }
        /// <summary>
        /// The Mathset_Figure_Helper_Test.
        /// </summary>
        /// <param name="str">The str<see cref="IFigures"/>.</param>
        /// <param name="fom">The fom<see cref="MathsetMockModel"/>.</param>
        /// <returns>The <see cref="IFigure"/>.</returns>
        private IFigure Mathset_Figure_Helper_Test(IFigures str, MathsetMockModel fom)
        {
            IFigure rts = str.NewFigure();

            for (int i = 1; i < str.Rubrics.Count; i++)
            {
                MemberInfo r = str.Rubrics[i].RubricInfo;
                if (r.MemberType == MemberTypes.Field)
                {
                    var fi = fom.GetType().GetField(((FieldInfo)r).Name);
                    if (fi != null)
                    {
                        rts[r.Name] = fi.GetValue(fom);
                    }
                }
                if (r.MemberType == MemberTypes.Property)
                {
                    var pi = fom.GetType().GetProperty(((PropertyInfo)r).Name);
                    if (pi != null)
                    {
                        rts[r.Name] = pi.GetValue(fom);
                    }
                }
            }

            return(rts);
        }
예제 #5
0
        /// <summary>
        /// The ResolveQuery.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="Filter">The Filter<see cref="FigureFilter"/>.</param>
        /// <param name="Sort">The Sort<see cref="FigureSort"/>.</param>
        /// <param name="stage">The stage<see cref="int"/>.</param>
        /// <param name="appendfigures">The appendfigures<see cref="IFigure[]"/>.</param>
        /// <returns>The <see cref="IFigures"/>.</returns>
        private static IFigures ResolveQuery(IFigures figures, FigureFilter Filter, FigureSort Sort, int stage = 1, IFigure[] appendfigures = null)
        {
            FilterStage filterStage = (FilterStage)Enum.ToObject(typeof(FilterStage), stage);
            int         filtercount = Filter.Terms.Where(f => f.Stage.Equals(filterStage)).ToArray().Length;
            int         sortcount   = Sort.Terms.Count;

            if (filtercount > 0)
            {
                if (sortcount > 0)
                {
                    return(ExecuteQuery(figures, Filter, Sort, stage, appendfigures));
                }
                else
                {
                    return(ExecuteQuery(figures, Filter, null, stage, appendfigures));
                }
            }
            else if (sortcount > 0)
            {
                return(ExecuteQuery(figures, null, Sort, stage, appendfigures));
            }
            else
            {
                return(ExecuteQuery(figures, null, null, stage, appendfigures));
            }
        }
예제 #6
0
파일: Fild.cs 프로젝트: Dblind/TETRISV1.0
 public void NewFigure()
 {
     Run.FlagFastFall = false;
     Run.StepFall     = 99;
     try //first call is null
     {
         Move.CheckRows(this);
     }
     catch { }
     Move.dotMove[0] = 0; Move.dotMove[1] = Move.startMovePoint;
     FigNow          = FigNext; numberFigNow = numberFigNext;
     numberFigNext   = rand.Next(1, 8);
     MakeNextFig();
     if (!SupportMethods.Intersection(FigNow.Form, this))
     {
         Console.CursorTop       = 3; Console.CursorLeft = 4;
         Console.BackgroundColor = ConsoleColor.DarkMagenta;
         Console.ForegroundColor = ConsoleColor.Yellow;
         System.Console.Write("< Game Over >");
         bool flag = true;
         do
         {
             if ('q' == Console.ReadKey(true).KeyChar)
             {
                 flag = false;
             }
         }while (flag);
         this.RunGame = Run.haveGame = false;
         Run.isSave   = true;
         Score        = 0;
         Console.ResetColor();
         Console.CursorVisible = true;
     }
 }
예제 #7
0
        /// <summary>
        /// The Query.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="appendfigures">The appendfigures<see cref="IFigure[]"/>.</param>
        /// <param name="stage">The stage<see cref="int"/>.</param>
        /// <returns>The <see cref="IFigures"/>.</returns>
        public static IFigures Query(this IFigures figures, IFigure[] appendfigures, int stage = 1)
        {
            FigureFilter Filter = figures.Filter;
            FigureSort   Sort   = figures.Sort;

            return(ResolveQuery(figures, Filter, Sort, stage, appendfigures));
        }
예제 #8
0
        public void InstantFigures_MutatorAndAccessorById_Test()
        {
            str = new InstantFigure(InstantFigureMocks.InstantFigure_MemberRubric_FieldsAndPropertiesModel(),
                                    "InstantFigure_MemberRubric_FieldsAndPropertiesModel");
            FieldsAndPropertiesModel fom = new FieldsAndPropertiesModel();

            iRts = InstantFigure_Compilation_Helper_Test(str, fom);

            rtsq = new InstantFigures(str, "InstantSequence_Compilation_Test");

            iRtseq = rtsq.New();

            iRtseq.Add(iRtseq.NewFigure());
            iRtseq[0, 4] = iRts[4];

            isel = new InstantSelection(iRtseq);

            IFigures ifsel = isel.New();

            IFigures isel2 = new InstantSelection(ifsel).New();

            isel2.Add(isel2.NewFigure());
            isel2[0, 4] = iRts[4];

            Assert.Equal(iRts[4], isel2[0, 4]);
        }
예제 #9
0
        /// <summary>
        /// The Query.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="filterList">The filterList<see cref="IList{FilterTerm}"/>.</param>
        /// <param name="sortList">The sortList<see cref="IList{SortTerm}"/>.</param>
        /// <param name="saveonly">The saveonly<see cref="bool"/>.</param>
        /// <param name="clearonend">The clearonend<see cref="bool"/>.</param>
        /// <param name="stage">The stage<see cref="int"/>.</param>
        /// <returns>The <see cref="IFigures"/>.</returns>
        public static IFigures Query(this IFigures figures, IList <FilterTerm> filterList, IList <SortTerm> sortList, bool saveonly = false, bool clearonend = false, int stage = 1)
        {
            FigureFilter Filter = figures.Filter;
            FigureSort   Sort   = figures.Sort;

            if (filterList != null)
            {
                Filter.Terms.Renew(filterList);
            }
            if (sortList != null)
            {
                Sort.Terms.Renew(sortList);
            }
            if (!saveonly)
            {
                IFigures result = ResolveQuery(figures, Filter, Sort, stage);
                if (clearonend)
                {
                    figures.Filter.Terms.Clear();
                    figures.Filter.Evaluator  = null;
                    figures.View.QueryFormula = null;
                }
                return(result);
            }
            return(null);
        }
예제 #10
0
        public static IFigures Query(this IFigures figures, int stage = 1, FilterTerms filter = null, SortTerms sort = null, bool saveonly = false, bool clearonend = false)
        {
            FigureFilter Filter = figures.Filter;
            FigureSort   Sort   = figures.Sort;

            if (filter != null)
            {
                Filter.Terms.AddNewRange(filter.AsEnumerable().ToArray());
            }
            if (sort != null)
            {
                Sort.Terms.AddNewRange(sort.AsEnumerable().ToArray());
            }
            if (!saveonly)
            {
                IFigures result = ResolveQuery(figures, Filter, Sort, stage);
                if (clearonend)
                {
                    figures.Filter.Terms.Clear();
                    figures.Filter.Evaluator = null;
                    figures.Exposition.Query = null;
                }
                return(result);
            }
            return(null);
        }
예제 #11
0
        /// <summary>
        /// The ExecuteUpdate.
        /// </summary>
        /// <param name="sqlqry">The sqlqry<see cref="string"/>.</param>
        /// <param name="cards">The cards<see cref="IFigures"/>.</param>
        /// <param name="disposeCmd">The disposeCmd<see cref="bool"/>.</param>
        /// <returns>The <see cref="IDeck{IDeck{IFigure}}"/>.</returns>
        public IDeck <IDeck <IFigure> > ExecuteUpdate(string sqlqry, IFigures cards, bool disposeCmd = false)
        {
            if (_cmd == null)
            {
                _cmd = _cn.CreateCommand();
            }
            SqlCommand cmd = _cmd;

            cmd.CommandText = sqlqry;
            cmd.Prepare();
            if (_cn.State == ConnectionState.Closed)
            {
                _cn.Open();
            }
            IDataReader          sdr = cmd.ExecuteReader();
            SqlReader <IFigures> dr  = new SqlReader <IFigures>(sdr);
            var _is = dr.UpdateRead(cards);

            sdr.Dispose();
            if (disposeCmd)
            {
                cmd.Dispose();
            }
            return(_is);
        }
        /// <summary>
        /// The Sleeve_Compilation_Helper_Test.
        /// </summary>
        /// <param name="str">The str<see cref="IFigures"/>.</param>
        /// <param name="fom">The fom<see cref="FieldsAndPropertiesModel"/>.</param>
        /// <returns>The <see cref="IFigure"/>.</returns>
        private IFigure Sleeve_Compilation_Helper_Test(IFigures str, FieldsAndPropertiesModel fom)
        {
            IFigure rts = str.NewFigure();

            for (int i = 1; i < str.Rubrics.Count; i++)
            {
                var r = str.Rubrics[i].RubricInfo;
                if (r.MemberType == MemberTypes.Field)
                {
                    var fi = fom.GetType().GetField(((FieldInfo)r).Name);
                    if (fi != null)
                    {
                        rts[r.Name] = fi.GetValue(fom);
                    }
                }
                if (r.MemberType == MemberTypes.Property)
                {
                    var pi = fom.GetType().GetProperty(((PropertyInfo)r).Name);
                    if (pi != null)
                    {
                        rts[r.Name] = pi.GetValue(fom);
                    }
                }
            }
            return(rts);
        }
        /// <summary>
        /// The UpdateRead.
        /// </summary>
        /// <param name="toUpdateCards">The toUpdateCards<see cref="IFigures"/>.</param>
        /// <returns>The <see cref="IDeck{IDeck{IFigure}}"/>.</returns>
        public IDeck <IDeck <IFigure> > UpdateRead(IFigures toUpdateCards)
        {
            IFigures        deck         = toUpdateCards;
            IDeck <IFigure> updatedList  = new Album <IFigure>();
            IDeck <IFigure> toInsertList = new Album <IFigure>();

            int i = 0;

            do
            {
                int columnsCount = deck.Rubrics != null ? deck.Rubrics.Count : 0;

                if (i == 0 && columnsCount == 0)
                {
                    IFigures tab = DeckFromSchema(dr.GetSchemaTable(), deck.Rubrics.KeyRubrics, true);
                    deck         = tab;
                    columnsCount = deck.Rubrics.Count;
                }
                object[] itemArray = new object[columnsCount];
                int[]    keyOrder  = deck.Rubrics.KeyRubrics.Ordinals;
                while (dr.Read())
                {
                    if ((columnsCount - 1) != (int)(dr.FieldCount / 2))
                    {
                        IFigures tab = DeckFromSchema(dr.GetSchemaTable(), deck.Rubrics.KeyRubrics, true);
                        deck         = tab;
                        columnsCount = deck.Rubrics.Count;
                        itemArray    = new object[columnsCount];
                        keyOrder     = deck.Rubrics.KeyRubrics.AsValues().Select(k => k.FieldId).ToArray();
                    }

                    dr.GetValues(itemArray);

                    IFigure row = deck.NewFigure();

                    row.ValueArray = itemArray.Select((a, y) => itemArray[y] = (a == DBNull.Value) ? a.GetType().Default() : a).ToArray();

                    //row.SerialCode = new Ussn(keyOrder.Select(ko => itemArray[ko]).ToArray());

                    updatedList.Add(row);
                }

                foreach (IFigure ir in toUpdateCards)
                {
                    if (!updatedList.ContainsKey(ir))
                    {
                        toInsertList.Add(ir);
                    }
                }
            } while (dr.NextResult());

            IDeck <IDeck <IFigure> > iSet = new Album <IDeck <IFigure> >();

            iSet.Add("Failed", toInsertList);

            iSet.Add("Updated", updatedList);

            return(iSet);
        }
        /// <summary>
        /// The DeleteRead.
        /// </summary>
        /// <param name="toDeleteCards">The toDeleteCards<see cref="IFigures"/>.</param>
        /// <returns>The <see cref="IDeck{IDeck{IFigure}}"/>.</returns>
        public IDeck <IDeck <IFigure> > DeleteRead(IFigures toDeleteCards)
        {
            IFigures        deck        = toDeleteCards;
            IDeck <IFigure> deletedList = new Album <IFigure>();
            IDeck <IFigure> brokenList  = new Album <IFigure>();

            int i = 0;

            do
            {
                int columnsCount = deck.Rubrics.Count;

                if (i == 0 && deck.Rubrics.Count == 0)
                {
                    IFigures tab = DeckFromSchema(dr.GetSchemaTable(), deck.Rubrics.KeyRubrics);
                    deck         = tab;
                    columnsCount = deck.Rubrics.Count;
                }
                object[] itemArray  = new object[columnsCount];
                int[]    keyIndexes = deck.Rubrics.KeyRubrics.Ordinals;
                while (dr.Read())
                {
                    if ((columnsCount - 1) != dr.FieldCount)
                    {
                        IFigures tab = DeckFromSchema(dr.GetSchemaTable(), deck.Rubrics.KeyRubrics);
                        deck         = tab;
                        columnsCount = deck.Rubrics.Count;
                        itemArray    = new object[columnsCount];
                        keyIndexes   = deck.Rubrics.KeyRubrics.Ordinals;
                    }

                    dr.GetValues(itemArray);

                    IFigure row = deck.NewFigure();

                    row.ValueArray = itemArray.Select((a, y) => itemArray[y] = (a == DBNull.Value) ? a.GetType().Default() : a).ToArray();

                    //row.SerialCode = new Ussn(keyIndexes.Select(ko => itemArray[ko]).ToArray());

                    deletedList.Add(row);
                }

                foreach (IFigure ir in toDeleteCards)
                {
                    if (!deletedList.ContainsKey(ir))
                    {
                        brokenList.Add(ir);
                    }
                }
            } while (dr.NextResult());

            IDeck <IDeck <IFigure> > iSet = new Album <IDeck <IFigure> >();

            iSet.Add("Failed", brokenList);

            iSet.Add("Deleted", deletedList);

            return(iSet);
        }
예제 #15
0
        /// <summary>
        /// The Query.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="queryFormula">The queryFormula<see cref="Func{IFigure, bool}"/>.</param>
        /// <returns>The <see cref="IFigures"/>.</returns>
        public static IFigures Query(this IFigures figures, Func <IFigure, bool> queryFormula)
        {
            IFigures view = figures.View;

            view.Flush();
            view.Add(figures.Where(queryFormula));
            return(view);
        }
        /// <summary>
        /// The SimpleUpdate.
        /// </summary>
        /// <param name="table">The table<see cref="IFigures"/>.</param>
        /// <param name="buildMapping">The buildMapping<see cref="bool"/>.</param>
        /// <param name="updateKeys">The updateKeys<see cref="bool"/>.</param>
        /// <param name="updateExcept">The updateExcept<see cref="string[]"/>.</param>
        /// <param name="batchSize">The batchSize<see cref="int"/>.</param>
        /// <returns>The <see cref="int"/>.</returns>
        public int SimpleUpdate(IFigures table, bool buildMapping = false, bool updateKeys = false, string[] updateExcept = null, int batchSize = 500)
        {
            try
            {
                IFigures             tab   = table;
                IList <FieldMapping> nMaps = new List <FieldMapping>();
                SqlAdapter           afad  = new SqlAdapter(_cn);
                StringBuilder        sb    = new StringBuilder();
                int intSqlset = 0;
                sb.AppendLine(@"  /* ----  SQL BANK START CMD ------ */  ");
                int count = 0;
                foreach (IFigure ir in table)
                {
                    if (ir.GetType().DeclaringType != tab.FigureType)
                    {
                        if (buildMapping)
                        {
                            SqlMapper imapper = new SqlMapper(tab);
                        }
                        nMaps = tab.Rubrics.Mappings;
                    }

                    foreach (FieldMapping nMap in nMaps)
                    {
                        IDeck <int>    co = nMap.ColumnOrdinal;
                        IDeck <int>    ko = nMap.KeyOrdinal;
                        MemberRubric[] ic = tab.Rubrics.AsValues().Where(c => nMap.ColumnOrdinal.Contains(c.FieldId)).ToArray();
                        MemberRubric[] ik = tab.Rubrics.AsValues().Where(c => nMap.KeyOrdinal.Contains(c.FieldId)).ToArray();
                        if (updateExcept != null)
                        {
                            ic = ic.Where(c => !updateExcept.Contains(c.RubricName)).ToArray();
                            ik = ik.Where(c => !updateExcept.Contains(c.RubricName)).ToArray();
                        }

                        string qry = BatchUpdateQuery(ir, nMap.DbTableName, ic, ik, updateKeys).ToString();
                        sb.Append(qry);
                        count++;
                    }
                    if (count >= batchSize)
                    {
                        sb.AppendLine(@"  /* ----  DATA BATCH EDataD CMD ------ */  ");
                        intSqlset += afad.ExecuteUpdate(sb.ToString());
                        sb.Clear();
                        sb.AppendLine(@"  /* ----  SQL BANK START CMD ------ */  ");
                        count = 0;
                    }
                }
                sb.AppendLine(@"  /* ----  DATA BANK END CMD ------ */  ");

                intSqlset += afad.ExecuteUpdate(sb.ToString());
                return(intSqlset);
            }
            catch (SqlException ex)
            {
                _cn.Close();
                throw new SqlUpdateException(ex.ToString());
            }
        }
예제 #17
0
        /// <summary>
        /// The Result.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="onlyView">The onlyView<see cref="bool"/>.</param>
        /// <returns>The <see cref="IFigure"/>.</returns>
        private static IFigure Result(IFigures figures, bool onlyView = true)
        {
            IRubrics summaryRubrics = figures.Treatment.SummaryRubrics;

            if (summaryRubrics.Count > 0)
            {
                object[] result = summaryRubrics.AsValues().AsParallel().SelectMany(s =>
                                                                                    new object[]
                {
                    (!string.IsNullOrEmpty(s.RubricName)) ?
                    (s.SummaryOperand == AggregateOperand.Sum) ?
                    Convert.ChangeType(figures

                                       .Sum

                                           (j => (j[s.SummaryOrdinal] is DateTime) ?
                                           ((DateTime)j[s.SummaryOrdinal]).ToOADate() :
                                           Convert.ToDouble(j[s.FieldId])), typeof(object)) :
                    (s.SummaryOperand == AggregateOperand.Min) ?
                    Convert.ChangeType(figures

                                       .Min

                                           (j => (j[s.SummaryOrdinal] is DateTime) ?
                                           ((DateTime)j[s.SummaryOrdinal]).ToOADate() :
                                           Convert.ToDouble(j[s.FieldId])), typeof(object)) :
                    (s.SummaryOperand == AggregateOperand.Max) ?
                    Convert.ChangeType(figures

                                       .Max

                                           (j => (j[s.SummaryOrdinal] is DateTime) ?
                                           ((DateTime)j[s.SummaryOrdinal]).ToOADate() :
                                           Convert.ToDouble(j[s.FieldId])), typeof(object)) :
                    (s.SummaryOperand == AggregateOperand.Avg) ?
                    Convert.ChangeType(figures

                                       .Average

                                           (j => (j[s.SummaryOrdinal] is DateTime) ?
                                           ((DateTime)j[s.SummaryOrdinal]).ToOADate() :
                                           Convert.ToDouble(j[s.FieldId])), typeof(object)) :
                    (s.SummaryOperand == AggregateOperand.Bis) ?
                    Convert.ChangeType(figures.Select(j => (j[s.FieldId] != DBNull.Value) ? j[s.FieldId].ToString() : "")

                                       .Aggregate((x, y) => x + " " + y), typeof(object)) : null : null
                }
                                                                                    ).ToArray();

                figures.Summary.ValueArray = result;

                return(figures.Summary);
            }
            else
            {
                return(null);
            }
        }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FigureFilter"/> class.
 /// </summary>
 /// <param name="figures">The figures<see cref="IFigures"/>.</param>
 public FigureFilter(IFigures figures)
 {
     this.figures = figures;
     expression   = new QueryExpression();
     Reducer      = new FilterTerms(figures);
     Terms        = new FilterTerms(figures);
     termsBuffer  = expression.Conditions;
     termsReducer = new FilterTerms(figures);
 }
예제 #19
0
 public DataReader(IFigures resultset)
 {
     m_resultset = resultset.Rubrics;
     x_size      = resultset.Rubrics.Count;
     m_values    = resultset.Select(p =>
                                    new object[] { p.SerialCode }
                                    .Concat(p.ValueArray).ToArray()).ToArray();
     y_size = m_values.Length;
 }
 public FigureFilter(IFigures collection)
 {
     Collection   = collection;
     expression   = new FilterExpression();
     Reducer      = new FilterTerms(collection);
     Terms        = new FilterTerms(collection);
     termsBuffer  = expression.Conditions;
     termsReducer = new FilterTerms(collection);
 }
예제 #21
0
        /// <summary>
        /// The Query.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="sorted">The sorted<see cref="bool"/>.</param>
        /// <param name="filtered">The filtered<see cref="bool"/>.</param>
        /// <param name="stage">The stage<see cref="int"/>.</param>
        /// <returns>The <see cref="IFigures"/>.</returns>
        public static IFigures Query(this IFigures figures, out bool sorted, out bool filtered, int stage = 1)
        {
            FigureFilter Filter = figures.Filter;
            FigureSort   Sort   = figures.Sort;

            filtered = (Filter.Terms.Count > 0) ? true : false;
            sorted   = (Sort.Terms.Count > 0) ? true : false;
            return(ResolveQuery(figures, Filter, Sort, stage));
        }
 public void Sqlset_Accessor_GetFigures_Test()
 {
     IFigures im = bank.Get("SELECT * From StockTradingActivity",
                            "StockTradingActivity",
                            new Deck <string>()
     {
         "permno", "market_name", "trading_date"
     });
     IFigures figures = im;
 }
예제 #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Link"/> class.
 /// </summary>
 /// <param name="origin">The origin<see cref="IFigures"/>.</param>
 /// <param name="target">The target<see cref="IFigures"/>.</param>
 public Link(IFigures origin, IFigures target)
 {
     Name      = origin.Type.Name + "_" + target.Type.Name;
     UniqueKey = Name.UniqueKey64();
     Origin    = new LinkMember(origin, this, LinkSite.Origin);
     Target    = new LinkMember(target, this, LinkSite.Target);
     origin.Linker.TargetLinks.Put(this);
     target.Linker.OriginLinks.Put(this);
     Linker.Map.Links.Put(this);
 }
        /// <summary>
        /// The Compute.
        /// </summary>
        /// <param name="figures">The figures<see cref="IFigures"/>.</param>
        /// <param name="rubric">The rubric<see cref="MemberRubric"/>.</param>
        /// <returns>The <see cref="IFigures"/>.</returns>
        public static IFigures Compute(this IFigures figures, MemberRubric rubric)
        {
            IComputation ic = figures.Computations.Where(c => ((Computation)c).ContainsFirst(rubric)).FirstOrDefault();

            if (ic != null)
            {
                ic.Compute();
            }
            return(figures);
        }
예제 #25
0
        public IFigures New()
        {
            IFigures tab = (IFigures)FiguresType.New();

            tab.Rubrics     = CloneRubrics();
            tab.FigureType  = Figure.FigureType;
            tab.FigureSize  = Figure.FigureSize;
            tab.FiguresType = FiguresType;
            return(tab);
        }
 public Computation(IFigures data)
 {
     computation          = new MathRubrics(data);
     serialcode.UniqueKey = (ulong)DateTime.Now.ToBinary();
     if (data.Computations == null)
     {
         data.Computations = new Deck <IComputation>();
     }
     data.Computations.Put(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LinkMember"/> class.
 /// </summary>
 /// <param name="figures">The figures<see cref="IFigures"/>.</param>
 /// <param name="link">The link<see cref="Link"/>.</param>
 /// <param name="site">The site<see cref="LinkSite"/>.</param>
 public LinkMember(IFigures figures, Link link, LinkSite site) : this()
 {
     Figures    = figures;
     Name       = figures.Type.Name;
     Site       = site;
     Rubrics    = figures.Rubrics;
     Link       = link;
     UniqueKey  = figures.GetUniqueBytes().UniqueKey(link.UniqueKey);
     UniqueSeed = link.UniqueKey;
 }
예제 #28
0
        /// <summary>
        /// The Add.
        /// </summary>
        /// <param name="v">The v<see cref="IFigures"/>.</param>
        /// <returns>The <see cref="int"/>.</returns>
        public int Add(IFigures v)
        {
            int index = GetIndexOf(v);

            if (index < 0)
            {
                paramTables[paramCount] = v;
                return(indexVariableCount + paramCount++);
            }
            return(index);
        }
예제 #29
0
 /// <summary>
 /// The GetIndexOf.
 /// </summary>
 /// <param name="v">The v<see cref="IFigures"/>.</param>
 /// <returns>The <see cref="int"/>.</returns>
 public int GetIndexOf(IFigures v)
 {
     for (int i = 0; i < ParametersCount; i++)
     {
         if (DataParameters[i] == v)
         {
             return(1 + i);
         }
     }
     return(-1);
 }
예제 #30
0
 /// <summary>
 /// The GetSubIndexOf.
 /// </summary>
 /// <param name="v">The v<see cref="IFigures"/>.</param>
 /// <returns>The <see cref="int"/>.</returns>
 public int GetSubIndexOf(IFigures v)
 {
     for (int i = 0; i < paramCount; i++)
     {
         if (paramTables[i] == v)
         {
             return(indexVariableCount + i + paramCount);
         }
     }
     return(-1);
 }