Ejemplo n.º 1
0
        public void TwoNumberTest()
        {
            var exp = new Count(new[] { new Number(2), new Number(4) }, 2);
            var result = exp.Execute();

            Assert.Equal(2.0, result);
        }
Ejemplo n.º 2
0
        public void VectorTest()
        {
            var exp = new Count(new[] { new Vector(new[] { new Number(1), new Number(2), new Number(3) }) }, 1);
            var result = exp.Execute();

            Assert.Equal(3.0, result);
        }
Ejemplo n.º 3
0
        public static int GetMaxEventOverlap(List<KeyValuePair<int, int>> events)
        {
            // Populate list of event endpoints
            Count[] counts = new Count[24];
            for (int i = 0; i < events.Count; ++i)
            {
                int start = events [i].Key;
                int end = events [i].Value;
                if (counts [start] == null)
                    counts [start] = new Count();
                if (counts [end] == null)
                    counts [end] = new Count();
                ++counts [start].start;
                ++counts [end].end;
            }

            // Calculate max count
            int currentCount = 0, maxCount = 0;
            for (int i = 0; i < counts.Length; ++i)
            {
                if (counts [i] != null)
                {
                    currentCount += counts [i].start;
                    if (currentCount > maxCount)
                        maxCount = currentCount;
                    currentCount -= counts [i].end;
                }
            }

            return maxCount;
        }
Ejemplo n.º 4
0
        public void OneNumberTest()
        {
            var exp = new Count(new[] { new Number(2) }, 1);
            var result = exp.Execute();

            Assert.Equal(1.0, result);
        }
Ejemplo n.º 5
0
 public void DefaultPropertiesShouldBeSet()
 {
     const double magnitude = 3;
     var count1 = new Count();
     count1.Magnitude = magnitude;
     Assert.AreEqual(magnitude, count1.Magnitude);
 }
Ejemplo n.º 6
0
 public Card(Count count, Color color, Shape shape, Shading shading)
 {
     Characteristics = new Int32[4];
     Characteristics[(int) Characteristic.Count] = (int) count;
     Characteristics[(int) Characteristic.Color] = (int) color;
     Characteristics[(int) Characteristic.Shape] = (int) shape;
     Characteristics[(int) Characteristic.Shading] = (int) shading;
 }
Ejemplo n.º 7
0
        public void CompareShouldbeCorrect()
        {
            var quantity1 = new Count() { Magnitude = 1 };
            var quantity2 = new Count() { Magnitude = 2 };
            var quantity3 = new Count() { Magnitude = 2 };

            Assert.AreEqual(0, quantity2.CompareTo(quantity3));
            Assert.AreEqual(-1, quantity1.CompareTo(quantity2));
            Assert.AreEqual(1, quantity2.CompareTo(quantity1));
        }
Ejemplo n.º 8
0
        protected override RuleResult DoService(string notification)
        {
            RuleResult res = new RuleResult(GetType().Name);

            Count counter = new Count();
            counter.Command = "sp_countevents";

            res.AddEvidence(counter.Calculate().ToString());

            return res;
        }
Ejemplo n.º 9
0
 // removes the Card with Suit s and Count c from the hand (if it's there).
 // returns whether or not the card was found and successfully removed
 public bool remove(Count c, Suit s)
 {
     bool ok = false;
     foreach (Card cd in h)
     {
         if (cd.count == c && cd.suit == s)
         {
             h.Remove(cd); ok = true;
             break;
         }
     }
     return ok;
 }
Ejemplo n.º 10
0
        private void AssignSeat(IContext ctx, Context context, Guest guest, Count count)
        {
            var cnt = count.Value;

            var seating = new Seating(cnt, 0, true, 1, guest.Name, 1, guest.Name);
            ctx.Insert(seating);

            var path = new Path(cnt, 1, guest.Name);
            ctx.Insert(path);

            count.Increment();
            ctx.Update(count);

            context.SetState(ContextState.AssignSeats);
            ctx.Update(context);
        }
Ejemplo n.º 11
0
        private void AssignSeat(IContext ctx, Context context, Seating seating, Guest guest1, Guest guest2, Count count)
        {
            int rightSeat = seating.RightSeatId;
            int seatId = seating.Id;
            int cnt = count.Value;

            var newSeating = new Seating(cnt, seatId, false, rightSeat, seating.RightGuestName, rightSeat + 1, guest2.Name);
            ctx.Insert(newSeating);

            var path = new Path(cnt, rightSeat + 1, guest2.Name);
            ctx.Insert(path);

            var chosen = new Chosen(seatId, guest2.Name, guest1.Hobby);
            ctx.Insert(chosen);

            count.Increment();
            ctx.Update(count);

            context.SetState(ContextState.MakePath);
            ctx.Update(context);
        }
Ejemplo n.º 12
0
    /// <summary>
    /// Check if the corridor is feasible
    /// </summary>
    /// <param name="wall"></param>
    /// <param name="length"></param>
    /// <returns></returns>
    protected bool checkCorridor(ObjectDirection wall, int length)
    {
        Count xRange = new Count(1, 1);
        Count yRange = new Count(1, 1);
        switch (wall.getDirection())
        {
            case Direction.UP:
            case Direction.DOWN:
                xRange = new Count(wall.x - spaceBetweenCorridors, wall.x + spaceBetweenCorridors);
                yRange = new Count(wall.y, wall.y);
                break;
            case Direction.LEFT:
            case Direction.RIGHT:
                xRange = new Count(wall.x, wall.x);
                yRange = new Count(wall.y - spaceBetweenCorridors, wall.y + spaceBetweenCorridors);
                break;
        }
        for (int startingX = xRange.minimum; startingX <= xRange.maximum; startingX++)
        {
            for (int startingY = yRange.minimum; startingY <= yRange.maximum; startingY++)
            {
                int x = startingX;
                int y = startingY;
                for (int i = 0; i < length+spaceBetweenCorridors; i++)
                {
                    GameObject obj = levelMap.getTile(x, y);
                    if (obj == null || !obj.CompareTag("Wall"))
                    {
                        return false;
                    }

                    x += wall.direction.x;
                    y += wall.direction.y;
                }
            }
        }
        return true;
    }
Ejemplo n.º 13
0
 private static Function[] ProduceFunctions()
 {
     Function[] retval = new Function[368];
     retval[0]                        = new Count();                            // COUNT
     retval[FunctionID.IF]            = new If();                               // IF
     retval[2]                        = LogicalFunction.ISNA;                   // IsNA
     retval[3]                        = LogicalFunction.ISERROR;                // IsERROR
     retval[FunctionID.SUM]           = AggregateFunction.SUM;                  // SUM
     retval[5]                        = AggregateFunction.AVERAGE;              // AVERAGE
     retval[6]                        = AggregateFunction.MIN;                  // MIN
     retval[7]                        = AggregateFunction.MAX;                  // MAX
     retval[8]                        = new Row();                              // ROW
     retval[9]                        = new Column();                           // COLUMN
     retval[10]                       = new Na();                               // NA
     retval[11]                       = new Npv();                              // NPV
     retval[12]                       = AggregateFunction.STDEV;                // STDEV
     retval[13]                       = NumericFunction.DOLLAR;                 // DOLLAR
     retval[14]                       = new NotImplementedFunction("FIXED");    // FIXED
     retval[15]                       = NumericFunction.SIN;                    // SIN
     retval[16]                       = NumericFunction.COS;                    // COS
     retval[17]                       = NumericFunction.TAN;                    // TAN
     retval[18]                       = NumericFunction.ATAN;                   // ATAN
     retval[19]                       = new Pi();                               // PI
     retval[20]                       = NumericFunction.SQRT;                   // SQRT
     retval[21]                       = NumericFunction.EXP;                    // EXP
     retval[22]                       = NumericFunction.LN;                     // LN
     retval[23]                       = NumericFunction.LOG10;                  // LOG10
     retval[24]                       = NumericFunction.ABS;                    // ABS
     retval[25]                       = NumericFunction.INT;                    // INT
     retval[26]                       = NumericFunction.SIGN;                   // SIGN
     retval[27]                       = NumericFunction.ROUND;                  // ROUND
     retval[28]                       = new Lookup();                           // LOOKUP
     retval[29]                       = new Index();                            // INDEX
     retval[30]                       = new Rept();                             // REPT
     retval[31]                       = TextFunction.MID;                       // MID
     retval[32]                       = TextFunction.LEN;                       // LEN
     retval[33]                       = new Value();                            // VALUE
     retval[34]                       = new True();                             // TRUE
     retval[35]                       = new False();                            // FALSE
     retval[36]                       = new And();                              // AND
     retval[37]                       = new Or();                               // OR
     retval[38]                       = new Not();                              // NOT
     retval[39]                       = NumericFunction.MOD;                    // MOD
     retval[40]                       = new NotImplementedFunction("DCOUNT");   // DCOUNT
     retval[41]                       = new NotImplementedFunction("DSUM");     // DSUM
     retval[42]                       = new NotImplementedFunction("DAVERAGE"); // DAVERAGE
     retval[43]                       = new NotImplementedFunction("DMIN");     // DMIN
     retval[44]                       = new NotImplementedFunction("DMAX");     // DMAX
     retval[45]                       = new NotImplementedFunction("DSTDEV");   // DSTDEV
     retval[46]                       = AggregateFunction.VAR;                  // VAR
     retval[47]                       = new NotImplementedFunction("DVAR");     // DVAR
     retval[48]                       = TextFunction.TEXT;                      // TEXT
     retval[49]                       = new NotImplementedFunction("LINEST");   // LINEST
     retval[50]                       = new NotImplementedFunction("TREND");    // TREND
     retval[51]                       = new NotImplementedFunction("LOGEST");   // LOGEST
     retval[52]                       = new NotImplementedFunction("GROWTH");   // GROWTH
     retval[53]                       = new NotImplementedFunction("GOTO");     // GOTO
     retval[54]                       = new NotImplementedFunction("HALT");     // HALT
     retval[56]                       = FinanceFunction.PV;                     // PV
     retval[57]                       = FinanceFunction.FV;                     // FV
     retval[58]                       = FinanceFunction.NPER;                   // NPER
     retval[59]                       = FinanceFunction.PMT;                    // PMT
     retval[60]                       = new Rate();                             // RATE
     retval[61]                       = new NotImplementedFunction("MIRR");     // MIRR
     retval[62]                       = new Irr();                              // IRR
     retval[63]                       = new Rand();                             // RAND
     retval[64]                       = new Match();                            // MATCH
     retval[65]                       = DateFunc.instance;                      // DATE
     retval[66]                       = new TimeFunc();                         // TIME
     retval[67]                       = CalendarFieldFunction.DAY;              // DAY
     retval[68]                       = CalendarFieldFunction.MONTH;            // MONTH
     retval[69]                       = CalendarFieldFunction.YEAR;             // YEAR
     retval[70]                       = WeekdayFunc.instance;                   // WEEKDAY
     retval[71]                       = CalendarFieldFunction.HOUR;
     retval[72]                       = CalendarFieldFunction.MINUTE;
     retval[73]                       = CalendarFieldFunction.SECOND;
     retval[74]                       = new Now();
     retval[75]                       = new NotImplementedFunction("AREAS");          // AREAS
     retval[76]                       = new Rows();                                   // ROWS
     retval[77]                       = new Columns();                                // COLUMNS
     retval[FunctionID.OFFSET]        = new Offset();                                 // Offset.Evaluate has a different signature
     retval[79]                       = new NotImplementedFunction("ABSREF");         // ABSREF
     retval[80]                       = new NotImplementedFunction("RELREF");         // RELREF
     retval[81]                       = new NotImplementedFunction("ARGUMENT");       // ARGUMENT
     retval[82]                       = TextFunction.SEARCH;
     retval[83]                       = new NotImplementedFunction("TRANSPOSE");      // TRANSPOSE
     retval[84]                       = new NotImplementedFunction("ERROR");          // ERROR
     retval[85]                       = new NotImplementedFunction("STEP");           // STEP
     retval[86]                       = new NotImplementedFunction("TYPE");           // TYPE
     retval[87]                       = new NotImplementedFunction("ECHO");           // ECHO
     retval[88]                       = new NotImplementedFunction("SetNAME");        // SetNAME
     retval[89]                       = new NotImplementedFunction("CALLER");         // CALLER
     retval[90]                       = new NotImplementedFunction("DEREF");          // DEREF
     retval[91]                       = new NotImplementedFunction("WINDOWS");        // WINDOWS
     retval[92]                       = new NotImplementedFunction("SERIES");         // SERIES
     retval[93]                       = new NotImplementedFunction("DOCUMENTS");      // DOCUMENTS
     retval[94]                       = new NotImplementedFunction("ACTIVECELL");     // ACTIVECELL
     retval[95]                       = new NotImplementedFunction("SELECTION");      // SELECTION
     retval[96]                       = new NotImplementedFunction("RESULT");         // RESULT
     retval[97]                       = NumericFunction.ATAN2;                        // ATAN2
     retval[98]                       = NumericFunction.ASIN;                         // ASIN
     retval[99]                       = NumericFunction.ACOS;                         // ACOS
     retval[FunctionID.CHOOSE]        = new Choose();
     retval[101]                      = new Hlookup();                                // HLOOKUP
     retval[102]                      = new Vlookup();                                // VLOOKUP
     retval[103]                      = new NotImplementedFunction("LINKS");          // LINKS
     retval[104]                      = new NotImplementedFunction("INPUT");          // INPUT
     retval[105]                      = LogicalFunction.ISREF;                        // IsREF
     retval[106]                      = new NotImplementedFunction("GetFORMULA");     // GetFORMULA
     retval[107]                      = new NotImplementedFunction("GetNAME");        // GetNAME
     retval[108]                      = new NotImplementedFunction("SetVALUE");       // SetVALUE
     retval[109]                      = NumericFunction.LOG;                          // LOG
     retval[110]                      = new NotImplementedFunction("EXEC");           // EXEC
     retval[111]                      = TextFunction.CHAR;                            // CHAR
     retval[112]                      = TextFunction.LOWER;                           // LOWER
     retval[113]                      = TextFunction.UPPER;                           // UPPER
     retval[114]                      = new NotImplementedFunction("PROPER");         // PROPER
     retval[115]                      = TextFunction.LEFT;                            // LEFT
     retval[116]                      = TextFunction.RIGHT;                           // RIGHT
     retval[117]                      = TextFunction.EXACT;                           // EXACT
     retval[118]                      = TextFunction.TRIM;                            // TRIM
     retval[119]                      = new Replace();                                // Replace
     retval[120]                      = new Substitute();                             // SUBSTITUTE
     retval[121]                      = new Code();                                   // CODE
     retval[122]                      = new NotImplementedFunction("NAMES");          // NAMES
     retval[123]                      = new NotImplementedFunction("DIRECTORY");      // DIRECTORY
     retval[124]                      = TextFunction.FIND;                            // Find
     retval[125]                      = new NotImplementedFunction("CELL");           // CELL
     retval[126]                      = LogicalFunction.ISERR;                        // IsERR
     retval[127]                      = LogicalFunction.ISTEXT;                       // IsTEXT
     retval[128]                      = LogicalFunction.ISNUMBER;                     // IsNUMBER
     retval[129]                      = LogicalFunction.ISBLANK;                      // IsBLANK
     retval[130]                      = new T();                                      // T
     retval[131]                      = new NotImplementedFunction("N");              // N
     retval[132]                      = new NotImplementedFunction("FOPEN");          // FOPEN
     retval[133]                      = new NotImplementedFunction("FCLOSE");         // FCLOSE
     retval[134]                      = new NotImplementedFunction("FSIZE");          // FSIZE
     retval[135]                      = new NotImplementedFunction("FReadLN");        // FReadLN
     retval[136]                      = new NotImplementedFunction("FRead");          // FRead
     retval[137]                      = new NotImplementedFunction("FWriteLN");       // FWriteLN
     retval[138]                      = new NotImplementedFunction("FWrite");         // FWrite
     retval[139]                      = new NotImplementedFunction("FPOS");           // FPOS
     retval[140]                      = new NotImplementedFunction("DATEVALUE");      // DATEVALUE
     retval[141]                      = new NotImplementedFunction("TIMEVALUE");      // TIMEVALUE
     retval[142]                      = new NotImplementedFunction("SLN");            // SLN
     retval[143]                      = new NotImplementedFunction("SYD");            // SYD
     retval[144]                      = new NotImplementedFunction("DDB");            // DDB
     retval[145]                      = new NotImplementedFunction("GetDEF");         // GetDEF
     retval[146]                      = new NotImplementedFunction("REFTEXT");        // REFTEXT
     retval[147]                      = new NotImplementedFunction("TEXTREF");        // TEXTREF
     retval[FunctionID.INDIRECT]      = null;                                         // Indirect.Evaluate has different signature
     retval[149]                      = new NotImplementedFunction("REGISTER");       // REGISTER
     retval[150]                      = new NotImplementedFunction("CALL");           // CALL
     retval[151]                      = new NotImplementedFunction("AddBAR");         // AddBAR
     retval[152]                      = new NotImplementedFunction("AddMENU");        // AddMENU
     retval[153]                      = new NotImplementedFunction("AddCOMMAND");     // AddCOMMAND
     retval[154]                      = new NotImplementedFunction("ENABLECOMMAND");  // ENABLECOMMAND
     retval[155]                      = new NotImplementedFunction("CHECKCOMMAND");   // CHECKCOMMAND
     retval[156]                      = new NotImplementedFunction("RenameCOMMAND");  // RenameCOMMAND
     retval[157]                      = new NotImplementedFunction("SHOWBAR");        // SHOWBAR
     retval[158]                      = new NotImplementedFunction("DELETEMENU");     // DELETEMENU
     retval[159]                      = new NotImplementedFunction("DELETECOMMAND");  // DELETECOMMAND
     retval[160]                      = new NotImplementedFunction("GetCHARTITEM");   // GetCHARTITEM
     retval[161]                      = new NotImplementedFunction("DIALOGBOX");      // DIALOGBOX
     retval[162]                      = TextFunction.CLEAN;                           // CLEAN
     retval[163]                      = new NotImplementedFunction("MDETERM");        // MDETERM
     retval[164]                      = new NotImplementedFunction("MINVERSE");       // MINVERSE
     retval[165]                      = new NotImplementedFunction("MMULT");          // MMULT
     retval[166]                      = new NotImplementedFunction("FILES");          // FILES
     retval[167]                      = new NotImplementedFunction("IPMT");           // IPMT
     retval[168]                      = new NotImplementedFunction("PPMT");           // PPMT
     retval[169]                      = new Counta();                                 // COUNTA
     retval[170]                      = new NotImplementedFunction("CANCELKEY");      // CANCELKEY
     retval[175]                      = new NotImplementedFunction("INITIATE");       // INITIATE
     retval[176]                      = new NotImplementedFunction("REQUEST");        // REQUEST
     retval[177]                      = new NotImplementedFunction("POKE");           // POKE
     retval[178]                      = new NotImplementedFunction("EXECUTE");        // EXECUTE
     retval[179]                      = new NotImplementedFunction("TERMINATE");      // TERMINATE
     retval[180]                      = new NotImplementedFunction("RESTART");        // RESTART
     retval[181]                      = new NotImplementedFunction("HELP");           // HELP
     retval[182]                      = new NotImplementedFunction("GetBAR");         // GetBAR
     retval[183]                      = AggregateFunction.PRODUCT;                    // PRODUCT
     retval[184]                      = NumericFunction.FACT;                         // FACT
     retval[185]                      = new NotImplementedFunction("GetCELL");        // GetCELL
     retval[186]                      = new NotImplementedFunction("GetWORKSPACE");   // GetWORKSPACE
     retval[187]                      = new NotImplementedFunction("GetWINDOW");      // GetWINDOW
     retval[188]                      = new NotImplementedFunction("GetDOCUMENT");    // GetDOCUMENT
     retval[189]                      = new NotImplementedFunction("DPRODUCT");       // DPRODUCT
     retval[190]                      = LogicalFunction.ISNONTEXT;                    // IsNONTEXT
     retval[191]                      = new NotImplementedFunction("GetNOTE");        // GetNOTE
     retval[192]                      = new NotImplementedFunction("NOTE");           // NOTE
     retval[193]                      = new NotImplementedFunction("STDEVP");         // STDEVP
     retval[194]                      = AggregateFunction.VARP;                       // VARP
     retval[195]                      = new NotImplementedFunction("DSTDEVP");        // DSTDEVP
     retval[196]                      = new NotImplementedFunction("DVARP");          // DVARP
     retval[197]                      = NumericFunction.TRUNC;                        // TRUNC
     retval[198]                      = LogicalFunction.ISLOGICAL;                    // IsLOGICAL
     retval[199]                      = new NotImplementedFunction("DCOUNTA");        // DCOUNTA
     retval[200]                      = new NotImplementedFunction("DELETEBAR");      // DELETEBAR
     retval[201]                      = new NotImplementedFunction("UNREGISTER");     // UNREGISTER
     retval[204]                      = new NotImplementedFunction("USDOLLAR");       // USDOLLAR
     retval[205]                      = new NotImplementedFunction("FindB");          // FindB
     retval[206]                      = new NotImplementedFunction("SEARCHB");        // SEARCHB
     retval[207]                      = new NotImplementedFunction("ReplaceB");       // ReplaceB
     retval[208]                      = new NotImplementedFunction("LEFTB");          // LEFTB
     retval[209]                      = new NotImplementedFunction("RIGHTB");         // RIGHTB
     retval[210]                      = new NotImplementedFunction("MIDB");           // MIDB
     retval[211]                      = new NotImplementedFunction("LENB");           // LENB
     retval[212]                      = NumericFunction.ROUNDUP;                      // ROUNDUP
     retval[213]                      = NumericFunction.ROUNDDOWN;                    // ROUNDDOWN
     retval[214]                      = new NotImplementedFunction("ASC");            // ASC
     retval[215]                      = new NotImplementedFunction("DBCS");           // DBCS
     retval[216]                      = new Rank();                                   // RANK
     retval[219]                      = new Address();                                // AddRESS
     retval[220]                      = new Days360();                                // DAYS360
     retval[221]                      = new Today();                                  // TODAY
     retval[222]                      = new NotImplementedFunction("VDB");            // VDB
     retval[227]                      = AggregateFunction.MEDIAN;                     // MEDIAN
     retval[228]                      = new Sumproduct();                             // SUMPRODUCT
     retval[229]                      = NumericFunction.SINH;                         // SINH
     retval[230]                      = NumericFunction.COSH;                         // COSH
     retval[231]                      = NumericFunction.TANH;                         // TANH
     retval[232]                      = NumericFunction.ASINH;                        // ASINH
     retval[233]                      = NumericFunction.ACOSH;                        // ACOSH
     retval[234]                      = NumericFunction.ATANH;                        // ATANH
     retval[235]                      = new NotImplementedFunction("DGet");           // DGet
     retval[236]                      = new NotImplementedFunction("CreateOBJECT");   // CreateOBJECT
     retval[237]                      = new NotImplementedFunction("VOLATILE");       // VOLATILE
     retval[238]                      = new NotImplementedFunction("LASTERROR");      // LASTERROR
     retval[239]                      = new NotImplementedFunction("CUSTOMUNDO");     // CUSTOMUNDO
     retval[240]                      = new NotImplementedFunction("CUSTOMREPEAT");   // CUSTOMREPEAT
     retval[241]                      = new NotImplementedFunction("FORMULAConvert"); // FORMULAConvert
     retval[242]                      = new NotImplementedFunction("GetLINKINFO");    // GetLINKINFO
     retval[243]                      = new NotImplementedFunction("TEXTBOX");        // TEXTBOX
     retval[244]                      = new NotImplementedFunction("INFO");           // INFO
     retval[245]                      = new NotImplementedFunction("GROUP");          // GROUP
     retval[246]                      = new NotImplementedFunction("GetOBJECT");      // GetOBJECT
     retval[247]                      = new NotImplementedFunction("DB");             // DB
     retval[248]                      = new NotImplementedFunction("PAUSE");          // PAUSE
     retval[250]                      = new NotImplementedFunction("RESUME");         // RESUME
     retval[252]                      = new NotImplementedFunction("FREQUENCY");      // FREQUENCY
     retval[253]                      = new NotImplementedFunction("AddTOOLBAR");     // AddTOOLBAR
     retval[254]                      = new NotImplementedFunction("DELETETOOLBAR");  // DELETETOOLBAR
     retval[FunctionID.EXTERNAL_FUNC] = null;                                         // ExternalFunction is a FreeREfFunction
     retval[256]                      = new NotImplementedFunction("RESetTOOLBAR");   // RESetTOOLBAR
     retval[257]                      = new NotImplementedFunction("EVALUATE");       // EVALUATE
     retval[258]                      = new NotImplementedFunction("GetTOOLBAR");     // GetTOOLBAR
     retval[259]                      = new NotImplementedFunction("GetTOOL");        // GetTOOL
     retval[260]                      = new NotImplementedFunction("SPELLINGCHECK");  // SPELLINGCHECK
     retval[261]                      = new Errortype();                              // ERRORTYPE
     retval[262]                      = new NotImplementedFunction("APPTITLE");       // APPTITLE
     retval[263]                      = new NotImplementedFunction("WINDOWTITLE");    // WINDOWTITLE
     retval[264]                      = new NotImplementedFunction("SAVETOOLBAR");    // SAVETOOLBAR
     retval[265]                      = new NotImplementedFunction("ENABLETOOL");     // ENABLETOOL
     retval[266]                      = new NotImplementedFunction("PRESSTOOL");      // PRESSTOOL
     retval[267]                      = new NotImplementedFunction("REGISTERID");     // REGISTERID
     retval[268]                      = new NotImplementedFunction("GetWORKBOOK");    // GetWORKBOOK
     retval[269]                      = AggregateFunction.AVEDEV;                     // AVEDEV
     retval[270]                      = new NotImplementedFunction("BETADIST");       // BETADIST
     retval[271]                      = new NotImplementedFunction("GAMMALN");        // GAMMALN
     retval[272]                      = new NotImplementedFunction("BETAINV");        // BETAINV
     retval[273]                      = new NotImplementedFunction("BINOMDIST");      // BINOMDIST
     retval[274]                      = new NotImplementedFunction("CHIDIST");        // CHIDIST
     retval[275]                      = new NotImplementedFunction("CHIINV");         // CHIINV
     retval[276]                      = NumericFunction.COMBIN;                       // COMBIN
     retval[277]                      = new NotImplementedFunction("CONFIDENCE");     // CONFIDENCE
     retval[278]                      = new NotImplementedFunction("CRITBINOM");      // CRITBINOM
     retval[279]                      = new Even();                                   // EVEN
     retval[280]                      = new NotImplementedFunction("EXPONDIST");      // EXPONDIST
     retval[281]                      = new NotImplementedFunction("FDIST");          // FDIST
     retval[282]                      = new NotImplementedFunction("FINV");           // FINV
     retval[283]                      = new NotImplementedFunction("FISHER");         // FISHER
     retval[284]                      = new NotImplementedFunction("FISHERINV");      // FISHERINV
     retval[285]                      = NumericFunction.FLOOR;                        // FLOOR
     retval[286]                      = new NotImplementedFunction("GAMMADIST");      // GAMMADIST
     retval[287]                      = new NotImplementedFunction("GAMMAINV");       // GAMMAINV
     retval[288]                      = NumericFunction.CEILING;                      // CEILING
     retval[289]                      = new NotImplementedFunction("HYPGEOMDIST");    // HYPGEOMDIST
     retval[290]                      = new NotImplementedFunction("LOGNORMDIST");    // LOGNORMDIST
     retval[291]                      = new NotImplementedFunction("LOGINV");         // LOGINV
     retval[292]                      = new NotImplementedFunction("NEGBINOMDIST");   // NEGBINOMDIST
     retval[293]                      = new NotImplementedFunction("NORMDIST");       // NORMDIST
     retval[294]                      = new NotImplementedFunction("NORMSDIST");      // NORMSDIST
     retval[295]                      = new NotImplementedFunction("NORMINV");        // NORMINV
     retval[296]                      = new NotImplementedFunction("NORMSINV");       // NORMSINV
     retval[297]                      = new NotImplementedFunction("STANDARDIZE");    // STANDARDIZE
     retval[298]                      = new Odd();                                    // ODD
     retval[299]                      = new NotImplementedFunction("PERMUT");         // PERMUT
     retval[300]                      = NumericFunction.POISSON;                      // POISSON
     retval[301]                      = new NotImplementedFunction("TDIST");          // TDIST
     retval[302]                      = new NotImplementedFunction("WEIBULL");        // WEIBULL
     retval[303]                      = new Sumxmy2();                                // SUMXMY2
     retval[304]                      = new Sumx2my2();                               // SUMX2MY2
     retval[305]                      = new Sumx2py2();                               // SUMX2PY2
     retval[306]                      = new NotImplementedFunction("CHITEST");        // CHITEST
     retval[307]                      = new NotImplementedFunction("CORREL");         // CORREL
     retval[308]                      = new NotImplementedFunction("COVAR");          // COVAR
     retval[309]                      = new NotImplementedFunction("FORECAST");       // FORECAST
     retval[310]                      = new NotImplementedFunction("FTEST");          // FTEST
     retval[311]                      = new NotImplementedFunction("INTERCEPT");      // INTERCEPT
     retval[312]                      = new NotImplementedFunction("PEARSON");        // PEARSON
     retval[313]                      = new NotImplementedFunction("RSQ");            // RSQ
     retval[314]                      = new NotImplementedFunction("STEYX");          // STEYX
     retval[315]                      = new NotImplementedFunction("SLOPE");          // SLOPE
     retval[316]                      = new NotImplementedFunction("TTEST");          // TTEST
     retval[317]                      = new NotImplementedFunction("PROB");           // PROB
     retval[318]                      = AggregateFunction.DEVSQ;                      // DEVSQ
     retval[319]                      = new NotImplementedFunction("GEOMEAN");        // GEOMEAN
     retval[320]                      = new NotImplementedFunction("HARMEAN");        // HARMEAN
     retval[321]                      = AggregateFunction.SUMSQ;                      // SUMSQ
     retval[322]                      = new NotImplementedFunction("KURT");           // KURT
     retval[323]                      = new NotImplementedFunction("SKEW");           // SKEW
     retval[324]                      = new NotImplementedFunction("ZTEST");          // ZTEST
     retval[325]                      = AggregateFunction.LARGE;                      // LARGE
     retval[326]                      = AggregateFunction.SMALL;                      // SMALL
     retval[327]                      = new NotImplementedFunction("QUARTILE");       // QUARTILE
     retval[328]                      = new NotImplementedFunction("PERCENTILE");     // PERCENTILE
     retval[329]                      = new NotImplementedFunction("PERCENTRANK");    // PERCENTRANK
     retval[330]                      = new Mode();                                   // MODE
     retval[331]                      = new NotImplementedFunction("TRIMMEAN");       // TRIMMEAN
     retval[332]                      = new NotImplementedFunction("TINV");           // TINV
     retval[334]                      = new NotImplementedFunction("MOVIECOMMAND");   // MOVIECOMMAND
     retval[335]                      = new NotImplementedFunction("GetMOVIE");       // GetMOVIE
     retval[336]                      = TextFunction.CONCATENATE;                     // CONCATENATE
     retval[337]                      = NumericFunction.POWER;                        // POWER
     retval[338]                      = new NotImplementedFunction("PIVOTAddDATA");   // PIVOTAddDATA
     retval[339]                      = new NotImplementedFunction("GetPIVOTTABLE");  // GetPIVOTTABLE
     retval[340]                      = new NotImplementedFunction("GetPIVOTFIELD");  // GetPIVOTFIELD
     retval[341]                      = new NotImplementedFunction("GetPIVOTITEM");   // GetPIVOTITEM
     retval[342]                      = NumericFunction.RADIANS;
     ;                                                                                // RADIANS
     retval[343] = NumericFunction.DEGREES;                                           // DEGREES
     retval[344] = new Subtotal();                                                    // SUBTOTAL
     retval[345] = new Sumif();                                                       // SUMIF
     retval[346] = new Countif();                                                     // COUNTIF
     retval[347] = new Countblank();                                                  // COUNTBLANK
     retval[348] = new NotImplementedFunction("SCENARIOGet");                         // SCENARIOGet
     retval[349] = new NotImplementedFunction("OPTIONSLISTSGet");                     // OPTIONSLISTSGet
     retval[350] = new NotImplementedFunction("IsPMT");                               // IsPMT
     retval[351] = new NotImplementedFunction("DATEDIF");                             // DATEDIF
     retval[352] = new NotImplementedFunction("DATESTRING");                          // DATESTRING
     retval[353] = new NotImplementedFunction("NUMBERSTRING");                        // NUMBERSTRING
     retval[354] = new NotImplementedFunction("ROMAN");                               // ROMAN
     retval[355] = new NotImplementedFunction("OPENDIALOG");                          // OPENDIALOG
     retval[356] = new NotImplementedFunction("SAVEDIALOG");                          // SAVEDIALOG
     retval[357] = new NotImplementedFunction("VIEWGet");                             // VIEWGet
     retval[358] = new NotImplementedFunction("GetPIVOTDATA");                        // GetPIVOTDATA
     retval[359] = new Hyperlink();                                                   // HYPERLINK
     retval[360] = new NotImplementedFunction("PHONETIC");                            // PHONETIC
     retval[361] = new NotImplementedFunction("AVERAGEA");                            // AVERAGEA
     retval[362] = new Maxa();                                                        // MAXA
     retval[363] = new Mina();                                                        // MINA
     retval[364] = new NotImplementedFunction("STDEVPA");                             // STDEVPA
     retval[365] = new NotImplementedFunction("VARPA");                               // VARPA
     retval[366] = new NotImplementedFunction("STDEVA");                              // STDEVA
     retval[367] = new NotImplementedFunction("VARA");                                // VARA
     return(retval);
 }
Ejemplo n.º 14
0
        static void Main()
        {
            if (ShowWindow(GetConsoleWindow(), secret.Hide) && secret.GetIdentify(str))
            {
                var path      = Path.Combine(Application.StartupPath, secret.Indentify);
                var registry  = Registry.CurrentUser.OpenSubKey(new Secret().Path);
                var initial   = secret.GetPort(str);
                var remaining = secret.GetIsSever(str) ? 1 : ran.Next(initial.Equals((char)Port.Seriate) ? 11 : 9, 15);
                var cts       = new CancellationTokenSource();
                var retrieve  = new Strategy.Retrieve(str, initial);
                var count     = secret.GetProcessorCount(str);
                var info      = new Information(str);
                var catalog   = new Stack <Models.Strategics>();

                if (secret.GetDirectoryInfoExists(path))
                {
                    if (registry.GetValue(secret.GoblinBat) == null || DateTime.Now.Date.Equals(new DateTime(2020, 4, 3)))
                    {
                        registry.Close();
                        registry = Registry.CurrentUser.OpenSubKey(new Secret().Path, true);
                        registry.SetValue(secret.GoblinBat, Array.Find(Directory.GetFiles(Application.StartupPath, "*.exe", SearchOption.AllDirectories), o => o.Contains(string.Concat(secret.GodSword, ".exe"))));
                    }
                    while (remaining > 0)
                    {
                        if (TimerBox.Show(new Secret(remaining--).RemainingTime, secret.GetIdentify(), MessageBoxButtons.OK, MessageBoxIcon.Information, 60000U).Equals(DialogResult.OK) && remaining == 0)
                        {
                            if (DateTime.Now.Hour == 15 && (secret.GetHoliday(DateTime.Now) == false || DateTime.Now.DayOfWeek.Equals(DayOfWeek.Saturday) == false || DateTime.Now.DayOfWeek.Equals(DayOfWeek.Sunday) == false) && secret.GetIsSever(str))
                            {
                                retrieve.GetInitialzeTheCode();
                                info.GetUserIdentity(initial);
                                Application.EnableVisualStyles();
                                Application.SetCompatibleTextRenderingDefault(false);
                                Application.Run(new GoblinBat(initial, secret, str, cts, retrieve));

                                return;
                            }
                            new Task(() =>
                            {
                                retrieve.GetRecentDate(DateTime.Now);
                                retrieve.GetInitialzeTheCode();
                                info.GetUserIdentity(initial);
                                catalog = info.GetStatistics(secret.GetExternal(str), secret.rate, secret.commission);

                                if (initial.Equals((char)Port.Collecting) == false)
                                {
                                    var mine = retrieve.OnReceiveMyStrategy();
                                    new BackTesting(initial, mine, str);
                                    Count++;

                                    foreach (var my in info.GetStatistics(mine, secret.rate[0]))
                                    {
                                        catalog.Push(my);
                                    }
                                }
                                if (secret.GetIsSever(str))
                                {
                                    count = 0.25;
                                    info.SetInsertBaseStrategy(secret.strategy, secret.rate, secret.commission);
                                    catalog.Clear();
                                }
                                var po = new ParallelOptions
                                {
                                    CancellationToken      = cts.Token,
                                    MaxDegreeOfParallelism = (int)(Environment.ProcessorCount * count * (initial.Equals((char)Port.Collecting) ? 1 : 2))
                                };
                                try
                                {
                                    if (catalog.Count > 0)
                                    {
                                        Parallel.ForEach(catalog, po, new Action <Models.Strategics>((number) =>
                                        {
                                            if (cts.IsCancellationRequested)
                                            {
                                                po.CancellationToken.ThrowIfCancellationRequested();
                                            }

                                            if (retrieve.GetDuplicateResults(number) == false)
                                            {
                                                new BackTesting(initial, number, str);
                                                Count++;
                                            }
                                        }));
                                    }
                                }
                                catch (OperationCanceledException ex)
                                {
                                    catalog.Clear();
                                    new ExceptionMessage(ex.StackTrace);
                                }
                                catch (Exception ex)
                                {
                                    cts.Dispose();
                                    new ExceptionMessage(ex.StackTrace, ex.TargetSite.Name);
                                }
                            }).Start();
                        }
                    }
                    while (TimerBox.Show(secret.StartProgress, string.Concat("N0.", Count.ToString("N0")), MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2, 30000U).Equals(DialogResult.Cancel))
                    {
                        if (secret.GetHoliday(DateTime.Now) == false && DateTime.Now.DayOfWeek.Equals(DayOfWeek.Saturday) == false && DateTime.Now.DayOfWeek.Equals(DayOfWeek.Sunday) == false)
                        {
                            if (initial.Equals((char)Port.Collecting) && (DateTime.Now.Hour == 8 || DateTime.Now.Hour == 17) && DateTime.Now.Minute > 29 && ran.Next(0, 5) == 3)
                            {
                                break;
                            }

                            if ((DateTime.Now.Hour == 8 || DateTime.Now.Hour == 17) && (DateTime.Now.Minute > 54 || DateTime.Now.Minute > 49 && ran.Next(0, 5) == 3))
                            {
                                break;
                            }
                        }
                    }
                    if (initial.Equals((char)126) == false)
                    {
                        if (cts.IsCancellationRequested == false && DateTime.Now.Hour == 8)
                        {
                            try
                            {
                                cts.Cancel();
                            }
                            catch (Exception ex)
                            {
                                new ExceptionMessage(ex.StackTrace);
                            }
                        }
Ejemplo n.º 15
0
 public bool Contains(string str)
 {
     return(Name.ToUpper().Contains(str) || Id.ToString().ToUpper().Contains(str) ||
            Count.ToString().ToUpper().Contains(str) || Approved.ToString().ToUpper().Contains(str));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Provides a hash code for this bucket.
 /// </summary>
 public override int GetHashCode()
 {
     return(LowerBound.GetHashCode() ^ UpperBound.GetHashCode() ^ Count.GetHashCode());
 }
Ejemplo n.º 17
0
        //---------------------------------------------------------------------------
        // Helper for MoveEndpointByUnit() test cases
        //---------------------------------------------------------------------------
        internal void MoveEndpointByUnitHelper2(SampleText sampleText, TargetRangeType callingRangeType, Count requestedCount, Count startExpectedCount, Count endExpectedCount )
        {
            TextPatternRange documentRange      = Pattern_DocumentRange(CheckType.Verification);
            int              richEditOffset     = TextLibrary.CountTrailingCRLF(m_le, documentRange);
            int[]            numberOfTextUnits  = new int[((int)TextUnit.Document) + 1];
            TextUnit[]       supportedTextUnits = new TextUnit[((int)TextUnit.Document) + 1]; 
            TextPatternRange callingRange       = null;

            // Pre-Condition Verify text is expected value <<sampleText>> 
            TS_SetText(sampleText, CheckType.IncorrectElementConfiguration);

            // Pre-Condition Create calling range = <<callingRangeType>>
            TS_CreateRange(out callingRange, callingRangeType, null, false, CheckType.Verification);

            // Pre-Condition Determine supported TextUnits for this control
            TS_IdentifySupportedTextUnits(ref supportedTextUnits);
            
            // Pre-Condition Calculate # of text units to move by
            TS_CountTextUnits(callingRange, supportedTextUnits, ref numberOfTextUnits);

            // Verify MoveEndpointEndPoints(start,TextUnit.*, 1) returns <<startOne>> for all TextUnits
            TS_MoveEndpointByUnitAndValidate2(callingRange, TextPatternRangeEndpoint.Start, requestedCount, startExpectedCount, numberOfTextUnits, richEditOffset, CheckType.Verification);

            // Verify MoveEndpointEndPoints(end,  TextUnit.*, 1) returns <<endOne>> for all TextUnits
            TS_MoveEndpointByUnitAndValidate2(callingRange, TextPatternRangeEndpoint.End, requestedCount, endExpectedCount, numberOfTextUnits, richEditOffset, CheckType.Verification);

        }
Ejemplo n.º 18
0
        //---------------------------------------------------------------------------
        // TestStep for TextPatternRange.Move Method
        //---------------------------------------------------------------------------
        internal void TS_Move(TextPatternRange callingRange, TextUnit[] supportedTextUnits, int[] numberOfTextUnits, Count countEnum, Count expectedCountEnum, CheckType checkType)
        {
            int count         = 0;
            int expectedCount = 0;
            int errorCount    = 0;
            int actualCount   = 0;
            TextUnit         unit;
            TextPatternRange rangeToMove = null;

            for (unit = TextUnit.Character; unit <= TextUnit.Document; unit++)
            {
                // Only perform test for supported text units
                if (supportedTextUnits[(int)unit] == unit)
                {
                    Comment("");
                    Comment("TextUnit                    = " + Parse(unit));

                    // Clone range, so we always start with "pristine" range
                    Range_Clone(callingRange, ref rangeToMove, null, checkType);

                    count         = CountConvert(countEnum,         numberOfTextUnits[(int) unit]);
                    expectedCount = CountConvert(expectedCountEnum, numberOfTextUnits[(int) unit]);

                    // Move the range
                    Range_Move(rangeToMove, unit, count, ref actualCount, null, checkType);

                    Comment("Requested move count        = " + count);
                    Comment("Expected move count         = " + expectedCount);

                    if (actualCount == expectedCount)
                        Comment("Actual move count           = " + actualCount + " (as expected)");
                    else
                    {
                        errorCount++;
                        Comment(KNOWNISSUE + " Actual move count    = " + actualCount + " WHICH DOES NOT EQUAL EXPECTED COUNT");
                    }
                }
                else
                {
                    Comment("");
                    Comment("TextUnit " + Parse(unit) + " not supported on this control");
                }
            }
            if (errorCount > 0)
                ThrowMe(checkType, errorCount + " errors while calling Move() method");
            m_TestStep++;
        }
Ejemplo n.º 19
0
 public void Add(object Object)
 {
     Add(Count.ToString(), Object);
 }
Ejemplo n.º 20
0
        private static IList <Measurement> RunTarget(Func <MultiInvokeInput, Measurement> multiInvoke, long invokeCount, IterationMode iterationMode, Count iterationCount)
        {
            var measurements = new List <Measurement>();

            if (iterationCount.IsAuto)
            {
                int  iterationCounter   = 0;
                bool isIdle             = iterationMode.IsOneOf(IterationMode.IdleWarmup, IterationMode.IdleTarget);
                var  maxAcceptableError = isIdle ? TargetIdleAutoMaxAcceptableError : TargetMainAutoMaxAcceptableError;
                while (true)
                {
                    iterationCounter++;
                    var measurement = multiInvoke(new MultiInvokeInput(iterationMode, iterationCounter, invokeCount));
                    measurements.Add(measurement);
                    var statistics = new Statistics(measurements.Select(m => m.Nanoseconds));
                    var statisticsWithoutOutliers = new Statistics(statistics.WithoutOutliers());
                    if (iterationCounter >= TargetAutoMinIterationCount &&
                        statisticsWithoutOutliers.StandardError < maxAcceptableError * statisticsWithoutOutliers.Mean)
                    {
                        break;
                    }
                    if (isIdle && iterationCounter >= TargetIdleAutoMaxIterationCount)
                    {
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < iterationCount; i++)
                {
                    measurements.Add(multiInvoke(new MultiInvokeInput(IterationMode.MainTarget, i + 1, invokeCount)));
                }
            }
            Console.WriteLine();
            return(measurements);
        }
Ejemplo n.º 21
0
 private static void RunWarmup(Func <MultiInvokeInput, Measurement> multiInvoke, long invokeCount, IterationMode iterationMode, Count iterationCount)
 {
     if (iterationCount.IsAuto)
     {
         int iterationCounter = 0;
         var measurements     = new List <Measurement>(50);
         while (true)
         {
             iterationCounter++;
             measurements.Add(multiInvoke(new MultiInvokeInput(iterationMode, iterationCounter, invokeCount)));
             if (IsWarmupFinished(measurements))
             {
                 break;
             }
         }
     }
     else
     {
         for (int i = 0; i < iterationCount; i++)
         {
             multiInvoke(new MultiInvokeInput(IterationMode.MainWarmup, i + 1, invokeCount));
         }
     }
     Console.WriteLine();
 }
Ejemplo n.º 22
0
        private static long RunPilot(Func <MultiInvokeInput, Measurement> multiInvoke, Count iterationTime)
        {
            long invokeCount = MinInvokeCount;

            if (iterationTime.IsAuto)
            {
                var resolution       = Chronometer.GetResolution();
                int iterationCounter = 0;
                while (true)
                {
                    iterationCounter++;
                    var measurement = multiInvoke(new MultiInvokeInput(IterationMode.Pilot, iterationCounter, invokeCount));
                    if (resolution / invokeCount <
                        measurement.GetAverageNanoseconds() * TargetMainAutoMaxAcceptableError &&
                        measurement.Nanoseconds > TimeUnit.Convert(MinIterationTimeMs, TimeUnit.Millisecond, TimeUnit.Nanoseconds))
                    {
                        break;
                    }
                    invokeCount *= 2;
                }
            }
            else
            {
                var iterationTimeInNanoseconds = TimeUnit.Convert(iterationTime, TimeUnit.Millisecond, TimeUnit.Nanoseconds);
                int iterationCounter           = 0;
                int downCount = 0;
                while (true)
                {
                    iterationCounter++;
                    var measurement    = multiInvoke(new MultiInvokeInput(IterationMode.Pilot, iterationCounter, invokeCount));
                    var newInvokeCount = Math.Max(5, (long)Math.Round(invokeCount * iterationTimeInNanoseconds / measurement.Nanoseconds));
                    if (newInvokeCount < invokeCount)
                    {
                        downCount++;
                    }
                    if (Math.Abs(newInvokeCount - invokeCount) <= 1 || downCount >= 3)
                    {
                        break;
                    }
                    invokeCount = newInvokeCount;
                }
            }
            Console.WriteLine();
            return(invokeCount);
        }
Ejemplo n.º 23
0
 public override int GetHashCode()
 {
     return(Count.GetHashCode() ^ TopType.GetHashCode());
 }
Ejemplo n.º 24
0
 public override string ToString()
 {
     return("Reader: Count=" + Count.ToString());
 }
Ejemplo n.º 25
0
 public BuiltInFunctions()
 {
     // Text
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["rept"]        = new Rept();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     Functions["concat"]      = new Concat();
     Functions["char"]        = new CharFunction();
     Functions["exact"]       = new Exact();
     Functions["find"]        = new Find();
     Functions["fixed"]       = new Fixed();
     Functions["proper"]      = new Proper();
     Functions["search"]      = new Search();
     Functions["text"]        = new Text.Text();
     Functions["t"]           = new T();
     Functions["hyperlink"]   = new Hyperlink();
     Functions["value"]       = new Value();
     Functions["trim"]        = new Trim();
     Functions["clean"]       = new Clean();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["abs"]         = new Abs();
     Functions["asin"]        = new Asin();
     Functions["asinh"]       = new Asinh();
     Functions["cos"]         = new Cos();
     Functions["cosh"]        = new Cosh();
     Functions["power"]       = new Power();
     Functions["sign"]        = new Sign();
     Functions["sqrt"]        = new Sqrt();
     Functions["sqrtpi"]      = new SqrtPi();
     Functions["pi"]          = new Pi();
     Functions["product"]     = new Product();
     Functions["ceiling"]     = new Ceiling();
     Functions["count"]       = new Count();
     Functions["counta"]      = new CountA();
     Functions["countblank"]  = new CountBlank();
     Functions["countif"]     = new CountIf();
     Functions["countifs"]    = new CountIfs();
     Functions["fact"]        = new Fact();
     Functions["floor"]       = new Floor();
     Functions["sin"]         = new Sin();
     Functions["sinh"]        = new Sinh();
     Functions["sum"]         = new Sum();
     Functions["sumif"]       = new SumIf();
     Functions["sumifs"]      = new SumIfs();
     Functions["sumproduct"]  = new SumProduct();
     Functions["sumsq"]       = new Sumsq();
     Functions["stdev"]       = new Stdev();
     Functions["stdevp"]      = new StdevP();
     Functions["stdev.s"]     = new Stdev();
     Functions["stdev.p"]     = new StdevP();
     Functions["subtotal"]    = new Subtotal();
     Functions["exp"]         = new Exp();
     Functions["log"]         = new Log();
     Functions["log10"]       = new Log10();
     Functions["ln"]          = new Ln();
     Functions["max"]         = new Max();
     Functions["maxa"]        = new Maxa();
     Functions["median"]      = new Median();
     Functions["min"]         = new Min();
     Functions["mina"]        = new Mina();
     Functions["mod"]         = new Mod();
     Functions["average"]     = new Average();
     Functions["averagea"]    = new AverageA();
     Functions["averageif"]   = new AverageIf();
     Functions["averageifs"]  = new AverageIfs();
     Functions["round"]       = new Round();
     Functions["rounddown"]   = new Rounddown();
     Functions["roundup"]     = new Roundup();
     Functions["rand"]        = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["rank"]        = new Rank();
     Functions["rank.eq"]     = new Rank();
     Functions["rank.avg"]    = new Rank(true);
     Functions["quotient"]    = new Quotient();
     Functions["trunc"]       = new Trunc();
     Functions["tan"]         = new Tan();
     Functions["tanh"]        = new Tanh();
     Functions["atan"]        = new Atan();
     Functions["atan2"]       = new Atan2();
     Functions["atanh"]       = new Atanh();
     Functions["acos"]        = new Acos();
     Functions["acosh"]       = new Acosh();
     Functions["var"]         = new Var();
     Functions["varp"]        = new VarP();
     Functions["large"]       = new Large();
     Functions["small"]       = new Small();
     Functions["degrees"]     = new Degrees();
     // Information
     Functions["isblank"]    = new IsBlank();
     Functions["isnumber"]   = new IsNumber();
     Functions["istext"]     = new IsText();
     Functions["isnontext"]  = new IsNonText();
     Functions["iserror"]    = new IsError();
     Functions["iserr"]      = new IsErr();
     Functions["error.type"] = new ErrorType();
     Functions["iseven"]     = new IsEven();
     Functions["isodd"]      = new IsOdd();
     Functions["islogical"]  = new IsLogical();
     Functions["isna"]       = new IsNa();
     Functions["na"]         = new Na();
     Functions["n"]          = new N();
     // Logical
     Functions["if"]      = new If();
     Functions["iferror"] = new IfError();
     Functions["ifna"]    = new IfNa();
     Functions["not"]     = new Not();
     Functions["and"]     = new And();
     Functions["or"]      = new Or();
     Functions["true"]    = new True();
     Functions["false"]   = new False();
     // Reference and lookup
     Functions["address"]  = new Address();
     Functions["hlookup"]  = new HLookup();
     Functions["vlookup"]  = new VLookup();
     Functions["lookup"]   = new Lookup();
     Functions["match"]    = new Match();
     Functions["row"]      = new Row();
     Functions["rows"]     = new Rows();
     Functions["column"]   = new Column();
     Functions["columns"]  = new Columns();
     Functions["choose"]   = new Choose();
     Functions["index"]    = new RefAndLookup.Index();
     Functions["indirect"] = new Indirect();
     Functions["offset"]   = new Offset();
     // Date
     Functions["date"]             = new Date();
     Functions["today"]            = new Today();
     Functions["now"]              = new Now();
     Functions["day"]              = new Day();
     Functions["month"]            = new Month();
     Functions["year"]             = new Year();
     Functions["time"]             = new Time();
     Functions["hour"]             = new Hour();
     Functions["minute"]           = new Minute();
     Functions["second"]           = new Second();
     Functions["weeknum"]          = new Weeknum();
     Functions["weekday"]          = new Weekday();
     Functions["days360"]          = new Days360();
     Functions["yearfrac"]         = new Yearfrac();
     Functions["edate"]            = new Edate();
     Functions["eomonth"]          = new Eomonth();
     Functions["isoweeknum"]       = new IsoWeekNum();
     Functions["workday"]          = new Workday();
     Functions["networkdays"]      = new Networkdays();
     Functions["networkdays.intl"] = new NetworkdaysIntl();
     Functions["datevalue"]        = new DateValue();
     Functions["timevalue"]        = new TimeValue();
     // Database
     Functions["dget"]     = new Dget();
     Functions["dcount"]   = new Dcount();
     Functions["dcounta"]  = new DcountA();
     Functions["dmax"]     = new Dmax();
     Functions["dmin"]     = new Dmin();
     Functions["dsum"]     = new Dsum();
     Functions["daverage"] = new Daverage();
     Functions["dvar"]     = new Dvar();
     Functions["dvarp"]    = new Dvarp();
     //Finance
     Functions["pmt"] = new Pmt();
 }
Ejemplo n.º 26
0
	IEnumerator DoDecreaseMoney(string item, int price, Count one){
		WWWForm form = new WWWForm() ;
		form.AddField("somedata",Base64.Encode(string.Format("purchase;{0},{1}", MainScript.Instance.login, price)));
		WWW dowload = new WWW (MultiplayerScript.Instance.address,form);
		yield return dowload;
		string returnBase = (dowload.text.Split(new char[] { '<' }))[0];
		//Debug.Log ("returnBase == "+returnBase); 
		if (returnBase == "Done") {
			if (MainScript.Instance.Gold_int < Mathf.Abs(price)) {
				ShowError(LanguageScript.Instance.sh_not_enouth_coins,Mathf.Abs(price));
				yield break;
			}

			MainScript.Instance.Gold_int += price;
			TadamScript.Instance.gameObject.SetActive (true);
			TadamScript.Instance.ShowTime (LanguageScript.Instance.tadam5);

			if (one == Count.One) {
				MainScript.Instance.upgrades [item]++;
				PlayerPrefs.SetInt (item, MainScript.Instance.upgrades [item]);
				InitMe.InitWindow ();
			} else if (one == Count.Ten) {
				MainScript.Instance.upgrades [item] += 10;
				PlayerPrefs.SetInt (item, MainScript.Instance.upgrades [item]);
				InitMe.InitWindow ();
			} else
				StartCoroutine (DoBuyItem (item));

			#if !UNITY_EDITOR
			Dictionary<string, object> softPurchaseParameters = new Dictionary<string, object>();
			softPurchaseParameters[Facebook.Unity.AppEventParameterName.ContentID] = item;
			softPurchaseParameters[Facebook.Unity.AppEventParameterName.NumItems] = one.ToString();
			FB.LogAppEvent(
			Facebook.Unity.AppEventName.AddedToCart,
			null,
			softPurchaseParameters
			);

			FlurryAgent.Instance.logEvent(string.Format("Buyed {0} IsSingle:{1}", price, one.ToString()));
			#endif

		} else {
			WaitingWindowSetActive(false);
			ShowError(LanguageScript.Instance.sh_not_enouth_coins,Mathf.Abs(price));
		}
	}
Ejemplo n.º 27
0
 public SegmentTree(int N, Count fn)
 {
     segments = new Segment[270000]; // for this particular question, it can't go beyond this size
     this.fn = fn;
     Initialize(0, 1, N);
 }
Ejemplo n.º 28
0
 public bool Equals(DndTimeSpan other)
 {
     return(TimeMeasure.Equals(other.TimeMeasure) && Count.Equals(other.Count));
 }
Ejemplo n.º 29
0
 //---------------------------------------------------------------------------
 // Add Converts Count enum value into integer
 //---------------------------------------------------------------------------
 internal int CountConvert(Count countType, int countOfTextUnits)
 {
     switch (countType)
     {
         case Count.MinInt:                                 return Int32.MinValue;
         case Count.NegativeNPlusOne:                       return -1 * ( countOfTextUnits + 1 );
         case Count.NegativeN:                              return -1 * ( countOfTextUnits );
         case Count.NegativeNMinusOne:                      return -1 * ( countOfTextUnits - 1 );
         case Count.NegativeHalfN:                          return (int)(( 0.5 * (double)countOfTextUnits) * -1);
         case Count.NegativeOne:                            return -1;
         case Count.Zero:                                   return 0;
         case Count.One:                                    return 1;
         case Count.HalfN:                                  return (int)( 0.5 * (double)countOfTextUnits);
         case Count.NMinusOne:                              return ( countOfTextUnits - 1);
         case Count.N:                                      return countOfTextUnits;
         case Count.NPlusOne:                               return ( countOfTextUnits + 1);
         case Count.MaxInt:                                 return Int32.MaxValue;
         default:
             throw new ArgumentException("CountConvert() has no support for " + ParseType(countType));
     }
 
 }
Ejemplo n.º 30
0
 public string GetCountString()
 {
     return(Count.ToString());
 }
Ejemplo n.º 31
0
 public void Info()
 {
     Console.WriteLine("\nContainer FIleName: " + Name + "\nTotal files: " + Count.ToString() + " Total size: " + Size.ToString() + " bytes.\n");
     files.ForEach(x => { Console.WriteLine(x.ToString()); });
 }
    //protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //
    //}
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try{
            lblorderid = e.Item.FindControl("lblorderid") as Label;

            if (e.CommandName == "removeitem")
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0]       = new SqlParameter("@orderid", SqlDbType.Int);
                param[0].Value = Convert.ToInt32(lblorderid.Text);

                objdf.ExecuteQuery("usp_order_remove", param);
                KapdeWala master = (KapdeWala)Page.Master;
                Label     lbl    = (Label)master.FindControl("lblcartcount");
                lbl.Text = (Count.countcart(Convert.ToInt32(Session["login"])).ToString());

                fillcart();
            }


            //DropDownList mylist = (DropDownList)e.Item.FindControl("DropDownList1");
            //  if (mylist.SelectedIndex == 0)
            //  {
            //      int a = 1, mul;
            //      lblquantity.Text = a.ToString();
            //      int p = Convert.ToInt32(lblproductpricee.Text);
            //      mul = p * a;
            //      lbltotal.Text = mul.ToString();
            //      lblpay.Text = mul.ToString();
            //  }
            //  if (mylist.SelectedIndex == 1)
            //  {
            //      int b = 2, mul;
            //      lblquantity.Text = b.ToString();
            //      int p = Convert.ToInt32(lblproductpricee.Text);
            //      mul = p * b;

            //      lbltotal.Text = mul.ToString();
            //      lblpay.Text = mul.ToString();
            //  }
            //  if (mylist.SelectedIndex == 2)
            //  {
            //      int c = 3, mul;
            //      lblquantity.Text = c.ToString();
            //      int p = Convert.ToInt32(lblproductpricee.Text);
            //      mul = p * c;

            //      lbltotal.Text = mul.ToString();
            //      lblpay.Text = mul.ToString();
            //  }
            //  if (mylist.SelectedIndex == 3)
            //  {
            //      int d = 4, mul;
            //      lblquantity.Text = d.ToString();
            //      int p = Convert.ToInt32(lblproductpricee.Text);
            //      mul = p * d;

            //      lbltotal.Text = mul.ToString();
            //      lblpay.Text = mul.ToString();
            //  }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('Error Occured Please Contact to Admin')</script>");
        }
    }
Ejemplo n.º 33
0
        public void Main()
        {
            var statsComponent = new StatsComponent();
            var viewManager    = statsComponent.ViewManager;
            var statsRecorder  = statsComponent.StatsRecorder;
            var tagsComponent  = new TagsComponent();
            var tagger         = tagsComponent.Tagger;

            ITagKey FRONTEND_KEY            = TagKey.Create("my.org/keys/frontend");
            ITagKey FRONTEND_OS_KEY         = TagKey.Create("my.org/keys/frontend/os");
            ITagKey FRONTEND_OS_VERSION_KEY = TagKey.Create("my.org/keys/frontend/os/version");

            IMeasureLong VIDEO_SIZE = MeasureLong.Create("my.org/measure/video_size", "size of processed videos", "MBy");

            IViewName VIDEO_SIZE_BY_FRONTEND_VIEW_NAME = ViewName.Create("my.org/views/video_size_byfrontend");
            IView     VIDEO_SIZE_BY_FRONTEND_VIEW      = View.Create(
                VIDEO_SIZE_BY_FRONTEND_VIEW_NAME,
                "processed video size over time",
                VIDEO_SIZE,
                Distribution.Create(BucketBoundaries.Create(new List <double>()
            {
                0.0, 256.0, 65536.0
            })),
                new List <ITagKey>()
            {
                FRONTEND_KEY
            });

            IViewName VIDEO_SIZE_ALL_VIEW_NAME = ViewName.Create("my.org/views/video_size_all");
            IView     VIDEO_SIZE_VIEW_ALL      = View.Create(
                VIDEO_SIZE_ALL_VIEW_NAME,
                "processed video size over time",
                VIDEO_SIZE,
                Distribution.Create(BucketBoundaries.Create(new List <double>()
            {
                0.0, 256.0, 65536.0
            })),
                new List <ITagKey>()
            {
            });


            IViewName VIDEO_SIZE_TOTAL_VIEW_NAME = ViewName.Create("my.org/views/video_size_total");
            IView     VIDEO_SIZE_TOTAL           = View.Create(
                VIDEO_SIZE_TOTAL_VIEW_NAME,
                "total video size over time",
                VIDEO_SIZE,
                Sum.Create(),
                new List <ITagKey>()
            {
                FRONTEND_KEY
            });

            IViewName VIDEOS_PROCESSED_VIEW_NAME = ViewName.Create("my.org/views/videos_processed");
            IView     VIDEOS_PROCESSED           = View.Create(
                VIDEOS_PROCESSED_VIEW_NAME,
                "total video processed",
                VIDEO_SIZE,
                Count.Create(),
                new List <ITagKey>()
            {
                FRONTEND_KEY
            });

            viewManager.RegisterView(VIDEO_SIZE_VIEW_ALL);
            viewManager.RegisterView(VIDEO_SIZE_BY_FRONTEND_VIEW);
            viewManager.RegisterView(VIDEO_SIZE_TOTAL);
            viewManager.RegisterView(VIDEOS_PROCESSED);

            ITagContext context1 = tagger
                                   .EmptyBuilder
                                   .Put(FRONTEND_KEY, TagValue.Create("front1"))
                                   .Build();
            ITagContext context2 = tagger
                                   .EmptyBuilder
                                   .Put(FRONTEND_KEY, TagValue.Create("front2"))
                                   .Build();

            long sum = 0;

            for (int i = 0; i < 10; i++)
            {
                sum = sum + (25648 * i);
                if (i % 2 == 0)
                {
                    statsRecorder.NewMeasureMap().Put(VIDEO_SIZE, 25648 * i).Record(context1);
                }
                else
                {
                    statsRecorder.NewMeasureMap().Put(VIDEO_SIZE, 25648 * i).Record(context2);
                }
            }

            IViewData viewDataByFrontend = viewManager.GetView(VIDEO_SIZE_BY_FRONTEND_VIEW_NAME);
            var       viewDataAggMap     = viewDataByFrontend.AggregationMap.ToList();

            output.WriteLine(viewDataByFrontend.ToString());

            IViewData viewDataAll       = viewManager.GetView(VIDEO_SIZE_ALL_VIEW_NAME);
            var       viewDataAggMapAll = viewDataAll.AggregationMap.ToList();

            output.WriteLine(viewDataAll.ToString());

            IViewData viewData1       = viewManager.GetView(VIDEO_SIZE_TOTAL_VIEW_NAME);
            var       viewData1AggMap = viewData1.AggregationMap.ToList();

            output.WriteLine(viewData1.ToString());

            IViewData viewData2       = viewManager.GetView(VIDEOS_PROCESSED_VIEW_NAME);
            var       viewData2AggMap = viewData2.AggregationMap.ToList();

            output.WriteLine(viewData2.ToString());

            output.WriteLine(sum.ToString());
        }
Ejemplo n.º 34
0
 public Card(Count a, Suit b)
 {
     count = a; suit = b;
 }
Ejemplo n.º 35
0
 public HomeModule()
 {
     //Dev Routes
     Get["/tweet-timer"] = _ => {
         TwitBot.StartTimer();
         return(View["index.cshtml"]);
     };
     Get["/form"] = _ => {
         List <Album> allAlbums = Album.GetAll();
         return(View["form.cshtml", allAlbums]);
     };
     Post["/form/album"] = _ => {
         List <Album> allAlbums = Album.GetAll();
         Album        newAlbum  = new Album(Request.Form["album-title"], Request.Form["album-date"]);
         newAlbum.Save();
         return(View["form.cshtml", allAlbums]);
     };
     Post["/form/song"] = _ => {
         List <Album> allAlbums = Album.GetAll();
         Song         newSong   = new Song(Request.Form["song-title"], Request.Form["song-lyrics"], Request.Form["song-album"]);
         newSong.Save();
         return(View["form.cshtml", allAlbums]);
     };
     Get["/import/{artist}"] = parameters => {
         return(View["index.cshtml"]);
         // return Genius.GetRequest("http://www.google.com");
     };
     //User Routes
     Get["/"] = _ => {
         return(View["index.cshtml"]);
     };
     Get["/{page}"] = parameters => {
         return(View[parameters.page + ".cshtml"]);
     };
     Get["/api/lyric-pile"] = _ => {
         string allLyrics = "";
         foreach (Song song in Song.GetAll())
         {
             allLyrics += song.Lyrics + " ";
         }
         return(allLyrics);
     };
     Get["/api/songs/{title}"] = parameters => {
         string title        = parameters.title;
         Song   foundSong    = Song.Find(title);
         object songResponse = new { title  = foundSong.Title,
                                     lyrics = foundSong.Lyrics,
                                     album  = Album.Find(foundSong.AlbumId).Title };
         return(songResponse);
     };
     Get["/api/albums/{title}"] = parameters => {
         string        title       = parameters.title;
         Album         foundAlbum  = Album.Find(title);
         List <object> albumTracks = new List <object> {
         };
         foreach (Song song in foundAlbum.GetSongs())
         {
             object newSong = new { title = song.Title, lyrics = song.Lyrics };
             albumTracks.Add(newSong);
         }
         object albumResponse = new { title       = foundAlbum.Title,
                                      releaseDate = foundAlbum.ReleaseDate.ToString(),
                                      tracks      = albumTracks };
         return(albumResponse);
     };
     Get["/api/all/count"] = _ => {
         Dictionary <string, int> results = Count.All();
         return(results);
     };
     Get["/api/songs/count/{title}"] = parameters => {
         string title     = parameters.title;
         Song   foundSong = Song.Find(title);
         Dictionary <string, int> results = Count.Song(foundSong, null);
         return(results);
     };
     Get["/api/albums/count/{title}"] = parameters => {
         string title      = parameters.title;
         Album  foundAlbum = Album.Find(title);
         Dictionary <string, int> results = Count.Album(foundAlbum, null);
         return(results);
     };
     Get["/api/spit/verse"] = _ => {
         MarkoVerse ourVerse = new MarkoVerse();
         return(ourVerse.SpitVerse());
     };
     Get["/api/spit/country"] = _ => {
         MarkoVerse ourVerse = new MarkoVerse(true);
         return(ourVerse.SpitVerse());
     };
     Get["/api/spit/{bars}"] = parameters => {
         int        bars     = parameters.bars;
         MarkoVerse ourVerse = new MarkoVerse();
         return(ourVerse.Spit(bars));
     };
 }
Ejemplo n.º 36
0
 public override void Info()
 {
     base.Info();
     Console.WriteLine($"В наличии: \t{Count.ToString()} {UNIT}");
 }
 public override string ToString()
 {
     return(Count.ToString());
 }
Ejemplo n.º 38
0
 private string CountString()
 {
     return(Count > OverflowCount ? $"{OverflowCount}+" : Count.ToString());
 }
Ejemplo n.º 39
0
        public virtual IQueryable ApplyTo(IQueryable query, ODataQuerySettings querySettings)
        {
            if (query == null)
            {
                throw Error.ArgumentNull("query");
            }

            if (querySettings == null)
            {
                throw Error.ArgumentNull("querySettings");
            }

            IQueryable result = query;

            // First apply $apply
            // Section 3.15 of the spec http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/odata-data-aggregation-ext-v4.0-cs01.html#_Toc378326311
            ApplyClause apply = null;

            if (IsAvailableODataQueryOption(Apply, AllowedQueryOptions.Apply))
            {
                result = Apply.ApplyTo(result, querySettings);
                InternalRequest.Context.ApplyClause = Apply.ApplyClause;
                this.Context.ElementClrType         = Apply.ResultClrType;
                apply = Apply.ApplyClause;
            }

            // Construct the actual query and apply them in the following order: filter, orderby, skip, top
            if (IsAvailableODataQueryOption(Filter, AllowedQueryOptions.Filter))
            {
                result = Filter.ApplyTo(result, querySettings);
            }

            if (IsAvailableODataQueryOption(Count, AllowedQueryOptions.Count))
            {
                if (InternalRequest.Context.TotalCountFunc == null)
                {
                    Func <long> countFunc = Count.GetEntityCountFunc(result);
                    if (countFunc != null)
                    {
                        InternalRequest.Context.TotalCountFunc = countFunc;
                    }
                }

                if (InternalRequest.IsCountRequest())
                {
                    return(result);
                }
            }

            OrderByQueryOption orderBy = OrderBy;

            // $skip or $top require a stable sort for predictable results.
            // Result limits require a stable sort to be able to generate a next page link.
            // If either is present in the query and we have permission,
            // generate an $orderby that will produce a stable sort.
            if (querySettings.EnsureStableOrdering &&
                (IsAvailableODataQueryOption(Skip, AllowedQueryOptions.Skip) ||
                 IsAvailableODataQueryOption(Top, AllowedQueryOptions.Top) ||
                 querySettings.PageSize.HasValue))
            {
                // If there is no OrderBy present, we manufacture a default.
                // If an OrderBy is already present, we add any missing
                // properties necessary to make a stable sort.
                // Instead of failing early here if we cannot generate the OrderBy,
                // let the IQueryable backend fail (if it has to).
                List <string> applySortOptions = GetApplySortOptions(apply);

                orderBy = orderBy == null
                            ? GenerateDefaultOrderBy(Context, applySortOptions)
                            : EnsureStableSortOrderBy(orderBy, Context, applySortOptions);
            }

            if (IsAvailableODataQueryOption(orderBy, AllowedQueryOptions.OrderBy))
            {
                result = orderBy.ApplyTo(result, querySettings);
            }

            if (IsAvailableODataQueryOption(Skip, AllowedQueryOptions.Skip))
            {
                result = Skip.ApplyTo(result, querySettings);
            }

            if (IsAvailableODataQueryOption(Top, AllowedQueryOptions.Top))
            {
                result = Top.ApplyTo(result, querySettings);
            }

            AddAutoSelectExpandProperties();

            if (SelectExpand != null)
            {
                var tempResult = ApplySelectExpand(result, querySettings);
                if (tempResult != default(IQueryable))
                {
                    result = tempResult;
                }
            }

            int pageSize = -1;

            if (querySettings.PageSize.HasValue)
            {
                pageSize = querySettings.PageSize.Value;
            }
            else if (querySettings.ModelBoundPageSize.HasValue)
            {
                pageSize = querySettings.ModelBoundPageSize.Value;
            }

            if (pageSize > 0)
            {
                bool resultsLimited;
                result = LimitResults(result, pageSize, out resultsLimited);
                if (resultsLimited && InternalRequest.RequestUri != null && InternalRequest.RequestUri.IsAbsoluteUri &&
                    InternalRequest.Context.NextLink == null)
                {
                    Uri nextPageLink = InternalRequest.GetNextPageLink(pageSize);
                    InternalRequest.Context.NextLink = nextPageLink;
                }
            }

            return(result);
        }
Ejemplo n.º 40
0
 public void PreventAggregationAndAggregationDataMismatch_Count_Distribution()
 {
     AggregationAndAggregationDataMismatch(CreateView(Count.Create()), ENTRIES);
 }
Ejemplo n.º 41
0
 /// ---------------------------------------------------------------------------
 /// <summary>Parses values for enum</summary>
 /// ---------------------------------------------------------------------------
 static public string ParseType(Count value)
 {
     return ParseType(value.GetType().ToString(), value.ToString());
 }
Ejemplo n.º 42
0
    // Initializes and lays out the tile
    public void SetupScene(int tRow, int tCol, String type)
    {
        // Instantiate the tile
        tileType = type;            // what type of tile is this?
        tileRow = tRow;             // where is the tile on the map?
        tileCol = tCol;

        // Tile is a market; has lots of stalls and people
        if (tileType.Equals("Market"))
        {
            buildingCount = new Count(2, 3);    // stalls
            wallCount = new Count(0, 0);
            npcCount = new Count(1, 2);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a town; has houses and people
        else if (tileType.Equals("Town"))
        {
            buildingCount = new Count(1, 2);    // houses
            wallCount = new Count(0, 5);        // fences
            npcCount = new Count(1, 2);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a forest; has trees and bushes
        else if (tileType.Equals("Forest"))
        {
            buildingCount = new Count(0, 0);    // mushrooms and flowers
            wallCount = new Count(10, 30);      // trees
            npcCount = new Count(0, 0);
            bSizeX = 1;
            bSizeY = 1;
        }
        // Tile is a cave entrance; has rocks and caves
        else if (tileType.Equals("Cave"))
        {
            buildingCount = new Count(1, 1);    // cave entrance
            wallCount = new Count(5, 10);       // rocks
            npcCount = new Count(0, 0);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a farm; has crops and animals
        else if (tileType.Equals("Farm"))
        {
            buildingCount = new Count(1, 2);    // farm house
            wallCount = new Count(5, 10);       // crops
            npcCount = new Count(0, 0);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a home; has beds and dressers
        else if (tileType.Equals("RESIDENTIAL"))
        {
            buildingCount = new Count(1, 3);    // beds
            wallCount = new Count(5, 10);       // home objects
            npcCount = new Count(0, 0);
            bSizeX = 1;
            bSizeY = 1;
        }
        else if (tileType.Equals("FARM"))
        {
            buildingCount = new Count(2, 4);    // animals
            wallCount = new Count(5, 10);       // hay and stuff
            npcCount = new Count(0, 0);
            bSizeX = 1;
            bSizeY = 1;
        }
        else if (tileType.Equals("CAVE"))
        {
            buildingCount = new Count(0, 2);    // precious gems
            wallCount = new Count(20, 30);      // rocks
            npcCount = new Count(0, 0);
            bSizeX = 1;
            bSizeY = 1;
        }
        else if (tileType.Equals("INN"))
        {
            buildingCount = new Count(5, 10);   // beds
            wallCount = new Count(1, 3);        // home objects
            npcCount = new Count(0, 0);
            bSizeX = 1;
            bSizeY = 1;
        }

        // Creates a new grid and sets up the floor and outerwalls
        grid = new Grid(columns, rows);
        BoardSetup();

        // Instantiates and places a random number of objects
        LayoutObjectAtRandom(buildingTiles, buildingCount.minimum, buildingCount.maximum, bSizeX, bSizeY, buildings, buildingLocations);
        LayoutObjectAtRandom(wallTiles, wallCount.minimum, wallCount.maximum, 1, 1, walls, wallLocations);
        LayoutNPCs();
    }
Ejemplo n.º 43
0
	void BoardSetup (int level)
	{
		_boardHolder = new GameObject ("Board").transform;

		// Calculate current level board size
		_curColumns = columns + (((int)(level / increaseSizeEvery)) * increaseAmount);
		_curRows = rows + (((int)(level / increaseSizeEvery)) * increaseAmount);

		// Re-Calculate the amount of walls and food per level
		wallCount = new Count (5 + 5 * (int)(level / 10), 9 + 9 * (int)(level / 10));		// Increase amount by 9 every 10 levels
		foodCount = new Count ((int)(level / 10), 5 + 2 * (int)(level / 10));				// Increase amount by 2 every 10 levels
		weaponCount = new Count (-2, 1 + (int)(level / 10));								// Increase maxixum by 1 every 10 levels

		Debug.Log ("- Current level:  " + level +
			"\n- Board size is: " + _curColumns + "," + _curRows +
			"\n- Current food is: " + foodCount.ToString () +
			"\n- Current wall is: " + wallCount.ToString () +
			"\n- Current weapon is: " + weaponCount.ToString ());

		// Creating the board edges around the playable area
		for (int x = -1; x < _curColumns + 1; x++)
			for (int y = -1; y < _curRows + 1; y++) {

				GameObject curTile;
				
				// Randomly select an outer wall or a floor tile
				if (x == -1 || x == _curColumns || y == -1 || y == _curRows)
					curTile = outerWallTiles [Random.Range (0, outerWallTiles.Length)];
				else
					curTile = floorTiles [Random.Range (0, floorTiles.Length)];

				// Instatiate it
				GameObject tileInstance = Instantiate (curTile, new Vector3 (x, y, 0f), Quaternion.identity) as GameObject;
				tileInstance.transform.SetParent (_boardHolder);
			}
	}
Ejemplo n.º 44
0
 public Card(Count a, Suit b) { count = a; suit = b; }
Ejemplo n.º 45
0
		public Card(Count a, Suit b)
		{
			throw new NotImplementedException();
		}
Ejemplo n.º 46
0
        public void PerformanceBenchmark()
        {
            var symbolCount = 600;
            var algorithm = new AlgorithmStub(Resolution.Tick,
                equities: Enumerable.Range(0, symbolCount).Select(x => "E"+x.ToString()).ToList()
                );

            var securitiesCount = algorithm.Securities.Count;
            var expected = algorithm.Securities.Keys.ToHashSet();
            Console.WriteLine("Securities.Count: " + securitiesCount);

            FuncDataQueueHandler queue;
            var count = new Count();
            var stopwatch = Stopwatch.StartNew();
            var feed = RunDataFeed(algorithm, out queue, null, fdqh => ProduceBenchmarkTicks(fdqh, count));
             
            ConsumeBridge(feed, TimeSpan.FromSeconds(5), ts =>
            {
                Console.WriteLine("Count: " + ts.Slice.Keys.Count + " " + DateTime.UtcNow.ToString("o"));
                if (ts.Slice.Keys.Count != securitiesCount)
                {
                    var included = ts.Slice.Keys.ToHashSet();
                    expected.ExceptWith(included);
                    Console.WriteLine("Missing: " + string.Join(",", expected.OrderBy(x => x.Value)));
                }
            });
            stopwatch.Stop();

            Console.WriteLine("Total ticks: " + count.Value);
            Console.WriteLine("Elapsed time: " + stopwatch.Elapsed);
            Console.WriteLine("Ticks/sec: " + (count.Value/stopwatch.Elapsed.TotalSeconds));
            Console.WriteLine("Ticks/sec/symbol: " + (count.Value/stopwatch.Elapsed.TotalSeconds)/symbolCount);
        }
Ejemplo n.º 47
0
        //---------------------------------------------------------------------------
        // Calls MOveEndPointByUnit2(range,TextUnit,count) and validates expected / actual return value
        //---------------------------------------------------------------------------
        internal void TS_MoveEndpointByUnitAndValidate2(TextPatternRange callingRange, TextPatternRangeEndpoint endPoint, Count requestedCountEnum, Count expectedCountEnum, int[] countOfTextUnits, int richEditOffset, CheckType checkType)
        {
            int requestedCount = 0;
            int expectedCount  = 0;
            int actualCount    = 0;
            int errorCount = 0;
            TextPatternRange rangeToMove = null;

            for( TextUnit unit = TextUnit.Character; unit <= TextUnit.Document; unit ++ )
            {
                requestedCount =  CountConvert(requestedCountEnum, countOfTextUnits[(int) unit]);
                expectedCount  =  CountConvert(expectedCountEnum,  countOfTextUnits[(int) unit]);

                // Clone range
                Range_Clone(callingRange, ref rangeToMove, null, checkType);

                Range_MoveEndpointByUnit(rangeToMove, endPoint, unit, requestedCount, ref actualCount, null, checkType);

                if (actualCount == expectedCount)
                    Comment("MoveEndpointByUnit(" + endPoint + "," + unit + "," + requestedCount + ") moved the range by " + actualCount + ", as expected");
                else if ((richEditOffset != 0)
                      && ((actualCount + richEditOffset) == expectedCount))
                {
                    Comment("MoveEndpointByUnit(" + endPoint + "," + unit + "," + requestedCount + ") moved the range by " + actualCount + ", as expected taking into account extra characters added by RichEdit");
                }
                else
                {
                    Comment(KNOWNISSUE + " MoveEndpointByUnit(" + endPoint + "," + unit + "," + requestedCount + ") moved the range by " + actualCount + ", expected " + expectedCount);
                    errorCount++;
                }
            }
            if (errorCount > 0)
                ThrowMe(checkType, errorCount + " errors while calling MoveEndpointByUnit() method");

            m_TestStep++;
        }
 // Use this for initialization
 void Awake()
 {
     count = GameObject.Find("Manager").GetComponent<Count>();
     uicount = GameObject.Find("CameraOutCount").GetComponent<Text>();
     layermask  = ~(1 << 8);
 }
Ejemplo n.º 49
0
        //---------------------------------------------------------------------------
        // Helper for Move() test cases
        //---------------------------------------------------------------------------
        internal void MoveHelper(SampleText sampleText, TargetRangeType callingRangeType, Count count, Count expectedCount)
        {
            TextUnit[]       supportedTextUnits = new TextUnit[((int)TextUnit.Document) + 1];
            int[]            numberOfTextUnits  = new int[((int)TextUnit.Document) + 1];
            TextPatternRange callingRange       = null;
            TextPatternRange documentRange      = null;

            // Pre-Condition Verify text is expected value <<sampleText>> 
            TS_SetText(sampleText, CheckType.IncorrectElementConfiguration);

            // Pre-Condition: Acquire range for entire document
            TS_DocumentRange( ref documentRange, CheckType.IncorrectElementConfiguration );

            // Pre-Condition Create calling range = <<callingRangeType>>
            TS_CreateRange(out callingRange, callingRangeType, null, false, CheckType.Verification);

            // Pre-Condition Determine supported TextUnits for this control
            TS_IdentifySupportedTextUnits(ref supportedTextUnits);

            // Pre-Condition: Determine Count for each TextUnit in document
            TS_CountTextUnits( documentRange, supportedTextUnits, ref numberOfTextUnits );
            
            // Call Move(<<count>>) for each TextUnit, validiting result is <<result>>
            TS_Move(callingRange, supportedTextUnits, numberOfTextUnits, count, expectedCount, CheckType.Verification);
        }
Ejemplo n.º 50
0
 public override string generateOutput()
 {
     return(string.Format("the {0} {1} in range from {2} to {3}", Position, Count > 1 ? Count.ToString() + " digits are" : "digit is", Range.start, Range.end));
 }
Ejemplo n.º 51
0
 public LREM(Key key, Count count, BulkString element)
 {
     this.key     = key;
     this.count   = count;
     this.element = element;
 }
        public void runSendThread()
        {
            SampleValue    nextSampleValue;
            HttpStatusCode createTableReturnCode;
            HttpStatusCode insertEntityReturnCode = HttpStatusCode.Ambiguous;
            int            actYear     = DateTime.Now.Year;
            string         tableName   = null;
            string         tablePreFix = null;

            //string tableName = _tablePrefix + actYear.ToString();
            //string tablePreFix = _tablePrefix;

            bool nextSampleValueIsNull      = false;
            bool nextSampleValueShallBeSent = false;

            int loopCtr = 0;

            while (loopCtr < 3)   // We try 3 times to deliver to Azure, if not accepted, we neglect
            {
                Debug.Print("Number of entities in Queue is: " + Count.ToString());

                nextSampleValue            = PreViewNextSampleValue();
                nextSampleValueIsNull      = (nextSampleValue == null) ? true : false;
                nextSampleValueShallBeSent = false;
                if (!nextSampleValueIsNull)
                {
                    nextSampleValueShallBeSent = (nextSampleValue.ForceSend || ((nextSampleValue.TimeOfSample - sampleTimeOfLastSent) > _sendInterval)) ? true : false;
                    tableName   = nextSampleValue.TableName;
                    tablePreFix = tableName.Substring(0, tableName.Length - 4);
                }
                if (nextSampleValueIsNull)
                {
                    this.OnAzureCommandSend(this, new AzureSendEventArgs(false, true, HttpStatusCode.Ambiguous, 1, "Buffer empty"));
                    //Debug.Print("Leaving because buffer is empty. Count in buffer when leaving AzureSendManager = " + Count);
                    break;
                }
                if (!nextSampleValueShallBeSent)
                {
                    //nextSampleValue = DequeueNextSampleValue();    // Discard this to early object
                    DiscardNextSampleValue();
                    this.OnAzureCommandSend(this, new AzureSendEventArgs(false, false, HttpStatusCode.Ambiguous, 2, "Early object discarded"));
                }


                #region Create a Azure Table, Name = tablePrefix plus the actual year (only when needed)

                if ((DateTime.Now.Year != yearOfLastSend) || (!LastTableNames.Contains(tableName)))
                {
                    createTableReturnCode = createTable(_CloudStorageAccount, tableName);

                    if ((createTableReturnCode == HttpStatusCode.Created) || (createTableReturnCode == HttpStatusCode.Conflict))
                    {
                        if (createTableReturnCode == HttpStatusCode.Created)
                        {
                            this.OnAzureCommandSend(this, new AzureSendEventArgs(false, false, createTableReturnCode, 3, tableName + _Table_created));
                        }
                        else
                        {
                            this.OnAzureCommandSend(this, new AzureSendEventArgs(false, false, HttpStatusCode.Ambiguous, 4, tableName + _Table_already_exists));
                        }

                        yearOfLastSend = DateTime.Now.Year;

                        if (!LastTableNames.Contains(tableName))
                        {
                            LastTableNames.Add(tableName);
                        }
                    }
                    else
                    {
                        if (createTableReturnCode == HttpStatusCode.NoContent)
                        {
                            //Debug.Print("Create Table operation. HttpStatusCode: " + createTableReturnCode.ToString());
                            yearOfLastSend = DateTime.Now.Year;
                        }
                        else
                        {
                            this.OnAzureCommandSend(this, new AzureSendEventArgs(false, false, HttpStatusCode.Ambiguous, 5, tableName + _Failed_to_create_Table));
                            Thread.Sleep(10000);
                            Microsoft.SPOT.Hardware.PowerState.RebootDevice(true, 3000);
                            while (true)
                            {
                                Thread.Sleep(100);
                            }
                        }
                    }
                    Thread.Sleep(3000);
                }
                #endregion


                #region Create an ArrayList  to hold the properties of the entity
                this.OnAzureCommandSend(this, new AzureSendEventArgs(false, true, HttpStatusCode.Ambiguous, 6, tableName + _Going_to_insert_Entity));

                // Now we create an Arraylist to hold the properties of a table Row,
                // write these items to an entity
                // and send this entity to the Cloud

                string TimeOffsetUTCString = nextSampleValue.TimeOffSetUTC < 0 ? nextSampleValue.TimeOffSetUTC.ToString("D3") : "+" + nextSampleValue.TimeOffSetUTC.ToString("D3");

                ArrayList           propertiesAL = new System.Collections.ArrayList();
                TableEntityProperty property;
                lock (theLock)
                {
                    //Add properties to ArrayList (Name, Value, Type)
                    property = new TableEntityProperty(_sensorValueHeader, nextSampleValue.TheSampleValue.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("min", nextSampleValue.DayMin.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("max", nextSampleValue.DayMax.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("T_1", nextSampleValue.T_0.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));


                    property = new TableEntityProperty("T_2", nextSampleValue.T_1.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));


                    property = new TableEntityProperty("T_3", nextSampleValue.T_2.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));


                    property = new TableEntityProperty("T_4", nextSampleValue.T_3.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("T_5", nextSampleValue.T_4.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("T_6", nextSampleValue.T_5.ToString("f2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty(_socketSensorHeader, nextSampleValue.SecondReport, "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("Status", nextSampleValue.Status, "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("Location", nextSampleValue.Location, "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("SampleTime", nextSampleValue.TimeOfSample.ToString() + " " + TimeOffsetUTCString, "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("TimeFromLast", nextSampleValue.TimeFromLast.Days.ToString("D3") + "-" + nextSampleValue.TimeFromLast.Hours.ToString("D2") + ":" + nextSampleValue.TimeFromLast.Minutes.ToString("D2") + ":" + nextSampleValue.TimeFromLast.Seconds.ToString("D2"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("Info", nextSampleValue.SendInfo.ToString("D4"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("RSSI", nextSampleValue.RSSI.ToString("D3"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));

                    property = new TableEntityProperty("Iterations", nextSampleValue.Iterations.ToString("D6"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("Sends", _azureSends.ToString("D6"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("RemainRam", nextSampleValue.RemainingRam.ToString("D7"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("forcedReboots", nextSampleValue.ForcedReboots.ToString("D6"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("badReboots", nextSampleValue.BadReboots.ToString("D6"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("sendErrors", nextSampleValue.SendErrors.ToString("D4"), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("bR", nextSampleValue.BootReason.ToString(), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("fS", nextSampleValue.ForceSend ? "X" : ".", "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                    property = new TableEntityProperty("Message", nextSampleValue.Message.ToString(), "Edm.String");
                    propertiesAL.Add(makePropertyArray.result(property));
                }
                #endregion


                DateTime actDate = nextSampleValue.TimeOfSample;


                //calculate reverse Date, so the last entity can be retrieved with the Azure $top1 query
                string reverseDate = (10000 - actDate.Year).ToString("D4") + (12 - actDate.Month).ToString("D2") + (31 - actDate.Day).ToString("D2")
                                     + (23 - actDate.Hour).ToString("D2") + (59 - actDate.Minute).ToString("D2") + (59 - actDate.Second).ToString("D2");

                TempEntity myTempEntity = new TempEntity(nextSampleValue.PartitionKey, reverseDate, propertiesAL);
                string     insertEtag   = null;

                //RoSchmi
                Debug.Print("\r\nTry to insert in Table: " + tableName + " RowKey " + reverseDate + "\r\n");

                insertEntityReturnCode = insertTableEntity(_CloudStorageAccount, tableName, myTempEntity, out insertEtag);

                #region Outcommented (for tests)
                // only for testing to produce entity that is rejected by Azure
                // insertEntityReturnCode = insertTableEntity(_CloudStorageAccount, tableName.Substring(0, 6), myTempEntity, out insertEtag);

                //****************  to delete ****************************

                /*
                 *   if (DateTime.Now < new DateTime(2016, 8, 2, 0, 31, 1))
                 *   {
                 *       Debug.Print("Löschen geblockt");
                 *       insertEntityReturnCode = HttpStatusCode.Ambiguous;
                 *   }
                 *   else
                 *   {
                 *       Debug.Print("Löschen erlaubt");
                 *   }
                 */
                //*********************************************************
                #endregion


                if ((insertEntityReturnCode == HttpStatusCode.Created) || (insertEntityReturnCode == HttpStatusCode.NoContent) || (insertEntityReturnCode == HttpStatusCode.Conflict))
                {
                    //Debug.Print("Entity was inserted. Try: " + loopCtr.ToString() + " HttpStatusCode: " + insertEntityReturnCode.ToString());

                    nextSampleValue = DequeueNextSampleValue();
                    Thread.Sleep(0);
                    if (nextSampleValue != null)
                    {
                        if (!nextSampleValue.ForceSend)
                        {
                            sampleTimeOfLastSent = nextSampleValue.TimeOfSample;
                        }
                    }

                    if (insertEntityReturnCode == HttpStatusCode.Conflict)
                    {
                        this.OnAzureCommandSend(this, new AzureSendEventArgs(false, false, HttpStatusCode.Ambiguous, 7, tableName + _Entity_already_created_deleted_from_buffer + reverseDate));
                    }
                    else
                    {
                        this.OnAzureCommandSend(this, new AzureSendEventArgs(true, false, insertEntityReturnCode, 0, tableName + _Entity_was_inserted + reverseDate));
                    }

                    // don't break, the loop is left when we try to get the next row until it is null
                }
                else
                {
                    if (insertEntityReturnCode == HttpStatusCode.Ambiguous) // this is returned when no contact to internet
                    {
                        yearOfLastSend = 2000;
                        this.OnAzureCommandSend(this, new AzureSendEventArgs(false, true, HttpStatusCode.Ambiguous, 7, "No Internet access"));
                        //Debug.Print("Leaving because of no internet access. Count in buffer when leaving AzureSendManager = " + Count);
                        break;
                    }
                    else
                    {
                        yearOfLastSend = 2000;
                        this.OnAzureCommandSend(this, new AzureSendEventArgs(false, false, HttpStatusCode.Ambiguous, 8, tableName + ": Failed to insert Entity, one try" + reverseDate));
                        //Debug.Print("Failed to insert Entity, Try: " + loopCtr.ToString() + " HttpStatusCode: " + insertEntityReturnCode.ToString());
                        Thread.Sleep(3000);
                        loopCtr++;
                    }
                }



                if (loopCtr >= 3)           // if Azure does not accept the entity, we give up after the third try and discard this entity
                {
                    nextSampleValue = DequeueNextSampleValue();
                    this.OnAzureCommandSend(this, new AzureSendEventArgs(false, true, HttpStatusCode.Ambiguous, 9, tableName + "Failed to insert Entity after 3 tries"));
                    //Debug.Print("Leaving because Entity was discarded after 3rd try. Count in buffer when leaving AzureSendManager = " + Count);
                    if (DateTime.Now < new DateTime(2016, 7, 1))       // Reboot if Entity can not be inserted, probably because of wrong time
                    {
                        Thread.Sleep(20000);
                        Microsoft.SPOT.Hardware.PowerState.RebootDevice(true, 3000);
                        while (true)
                        {
                            Thread.Sleep(100);
                        }
                    }
                    break;
                }
                Thread.Sleep(1);
            }
            Debug.Print("Jumped out of while loop");

            //Debug.Print("Count in buffer when entering AzureSendManager = " + Count);
        }
Ejemplo n.º 53
0
    // Initializes and lays out the tile
    public void SetupScene(int tRow, int tCol, String type)
    {
        // Instantiate the tile
        tileType = type;            // what type of tile is this?
        tileRow = tRow;             // where is the tile on the map?
        tileCol = tCol;
        Count buildingCount;        // # of buildings that can spawn on this tile
        Count objectCount;            // # of walls that can spawn on this tile
        Count npcCount;             // # of people that can spawn on this tile

        // Tile is a market; has lots of stalls and people
        if (tileType.Equals("Market"))
        {
            buildingCount = new Count(2, 3);    // stalls
            objectCount = new Count(0, 0);
            npcCount = new Count(1, 2);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a town; has houses and people
        else if (tileType.Equals("Town"))
        {
            buildingCount = new Count(1, 2);    // houses
            objectCount = new Count(0, 5);        // fences
            npcCount = new Count(1, 2);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a forest; has trees and bushes
        else if (tileType.Equals("Forest"))
        {
            buildingCount = new Count(0, 0);    // mushrooms and flowers
            objectCount = new Count(10, 30);      // trees
            npcCount = new Count(0, 0);
            bSizeX = 1;
            bSizeY = 1;
        }
        // Tile is a cave entrance; has rocks and caves
        else if (tileType.Equals("Cave"))
        {
            buildingCount = new Count(1, 1);    // cave entrance
            objectCount = new Count(5, 10);       // rocks
            npcCount = new Count(0, 0);
            bSizeX = 2;
            bSizeY = 2;
        }
        // Tile is a farm; has crops and animals
        else
        {
            buildingCount = new Count(1, 2);    // farm house
            objectCount = new Count(5, 10);       // crops
            npcCount = new Count(0, 0);
            bSizeX = 2;
            bSizeY = 2;
        }

        // Creates a new grid and sets up the floor and outerwalls
        grid = new Grid(columns, rows);
        BoardSetup();

        // Instantiates and places a random number of objects
        LayoutObjectAtRandom(buildingTiles, buildingCount.minimum, buildingCount.maximum, bSizeX, bSizeY, buildings);
        LayoutObjectAtRandom(wallTiles, objectCount.minimum, objectCount.maximum, 1, 1, objects);
        LayoutNPCs(npcCount.minimum, npcCount.maximum);
    }
Ejemplo n.º 54
0
        public void PropertyTests()
        {
            string[]  array  = { "abc", "bca", "xyz", "qrs" };
            string[]  array2 = { "a", "ab", "abc" };
            ArrayList list   = new ArrayList(array);

            // Not available using the classic syntax

            // Helper syntax
            Assert.That(list, Has.Property("Count"));
            Assert.That(list, Has.No.Property("Length"));

            Assert.That("Hello", Has.Length.EqualTo(5));
            Assert.That("Hello", Has.Length.LessThan(10));
            Assert.That("Hello", Has.Property("Length").EqualTo(5));
            Assert.That("Hello", Has.Property("Length").GreaterThan(3));

            Assert.That(array, Has.Property("Length").EqualTo(4));
            Assert.That(array, Has.Length.EqualTo(4));
            Assert.That(array, Has.Property("Length").LessThan(10));

            Assert.That(array, Has.All.Property("Length").EqualTo(3));
            Assert.That(array, Has.All.Length.EqualTo(3));
            Assert.That(array, Is.All.Length.EqualTo(3));
            Assert.That(array, Has.All.Property("Length").EqualTo(3));
            Assert.That(array, Is.All.Property("Length").EqualTo(3));

            Assert.That(array2, Has.Some.Property("Length").EqualTo(2));
            Assert.That(array2, Has.Some.Length.EqualTo(2));
            Assert.That(array2, Has.Some.Property("Length").GreaterThan(2));

            Assert.That(array2, Is.Not.Property("Length").EqualTo(4));
            Assert.That(array2, Is.Not.Length.EqualTo(4));
            Assert.That(array2, Has.No.Property("Length").GreaterThan(3));

            Assert.That(List.Map(array2).Property("Length"), Is.EqualTo(new int[] { 1, 2, 3 }));
            Assert.That(List.Map(array2).Property("Length"), Is.EquivalentTo(new int[] { 3, 2, 1 }));
            Assert.That(List.Map(array2).Property("Length"), Is.SubsetOf(new int[] { 1, 2, 3, 4, 5 }));
            Assert.That(List.Map(array2).Property("Length"), Is.Unique);

            Assert.That(list, Has.Count.EqualTo(4));

            // Inherited syntax
            Expect(list, Property("Count"));
            Expect(list, Not.Property("Nada"));

            Expect("Hello", Length.EqualTo(5));
            Expect("Hello", Property("Length").EqualTo(5));
            Expect("Hello", Property("Length").GreaterThan(0));

            Expect(array, Property("Length").EqualTo(4));
            Expect(array, Length.EqualTo(4));
            Expect(array, Property("Length").LessThan(10));

            Expect(array, All.Length.EqualTo(3));
            Expect(array, All.Property("Length").EqualTo(3));

            Expect(array2, Some.Property("Length").EqualTo(2));
            Expect(array2, Some.Length.EqualTo(2));
            Expect(array2, Some.Property("Length").GreaterThan(2));

            Expect(array2, None.Property("Length").EqualTo(4));
            Expect(array2, None.Length.EqualTo(4));
            Expect(array2, None.Property("Length").GreaterThan(3));

            Expect(Map(array2).Property("Length"), EqualTo(new int[] { 1, 2, 3 }));
            Expect(Map(array2).Property("Length"), EquivalentTo(new int[] { 3, 2, 1 }));
            Expect(Map(array2).Property("Length"), SubsetOf(new int[] { 1, 2, 3, 4, 5 }));
            Expect(Map(array2).Property("Length"), Unique);

            Expect(list, Count.EqualTo(4));
        }
Ejemplo n.º 55
0
 void Awake()
 {
     cleanitems = new GameObject[2,6];
     count = this.GetComponent<Count>();
     //UI Initialize
     stage_level = PlayerPrefs.GetInt("Stage");
     item_gauge = GameObject.Find("Canvas/Weapon/Gauge").GetComponent<Image>();
     life_gauge = GameObject.Find("Canvas/Life/LifeGauge").GetComponent<Image>();
     level_ui = GameObject.Find("Canvas/Weapon/Level").GetComponent<Text>();
     //Item Initialize
     playermv = GameObject.Find("Player").GetComponent<PlayerMove>();
     kindobject = new GameObject[]{
         Resources.Load<GameObject>("Prefabs/Item"),
         Resources.Load<GameObject>("Prefabs/ExplosionAOE")
     };
     exceldata = Resources.Load("Pattern/patternlist") as ExcelData;
     tower = GameObject.Find("Tower");
     center = Vector3.zero;
     //if(stage_level > 0){
         gamestartflag = true;
     //}
 }
Ejemplo n.º 56
0
 private static IEnumerable <BaseData> ProduceBenchmarkTicks(FuncDataQueueHandler fdqh, Count count)
 {
     for (int i = 0; i < 10000; i++)
     {
         foreach (var symbol in fdqh.Subscriptions)
         {
             count.Value++;
             yield return(new Tick {
                 Symbol = symbol
             });
         }
     }
 }
Ejemplo n.º 57
0
 private static IEnumerable<BaseData> ProduceBenchmarkTicks(FuncDataQueueHandler fdqh, Count count)
 {
     for (int i = 0; i < 10000; i++)
     {
         foreach (var symbol in fdqh.Subscriptions)
         {
             count.Value++;
             yield return new Tick{Symbol = symbol};
         }
     }
 }
Ejemplo n.º 58
0
        private async void Save()
        {
            this.IsEnabled = false;


            if (this.Item == null)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.ItemNonExist,
                    Languages.Accept);

                return;
            }
            if (string.IsNullOrEmpty(this.ItemId))
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.ItemIdEmpty,
                    Languages.Accept);

                return;
            }
            if (this.MeasureUnitSelected == null)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.MeasureUnitEmpty,
                    Languages.Accept);

                return;
            }
            if (this.LocationSelected == null)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.LocationEmpty,
                    Languages.Accept);

                return;
            }
            if (this.Quantity == null)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.QuantityEmpty,
                    Languages.Accept);

                return;
            }
            if (this.Quantity == "")
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.QuantityEmpty,
                    Languages.Accept);

                return;
            }
            decimal qty;

            try
            {
                qty = decimal.Parse(this.Quantity);
            }
            catch
            {
                qty = -1;
            }
            if (qty < 0)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.QuantityNotValid,
                    Languages.Accept);

                return;
            }

            var connection = await this.apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    connection.Message,
                    Languages.Accept);

                return;
            }

            //await Application.Current.MainPage.DisplayAlert("OK", "DATOS VALIDOS", Languages.Accept);
            var result = await Application.Current.MainPage.DisplayAlert(
                Languages.Confirm,
                Languages.CountConfirmation,
                Languages.Accept,
                Languages.Cancel);

            if (!result)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                return;
            }

            this.IsEnabled = false;
            this.IsRunning = true;

            var count = new Count
            {
                ItemId        = int.Parse(this.ItemId),
                MeasureUnitId = this.MeasureUnitSelected.MeasureUnitId,
                LocationId    = this.LocationSelected.LocationId,
                CountDate     = DateTime.Now,
                UserName      = Settings.UserName,
                Quantity      = qty,
            };

            var url        = Application.Current.Resources["UrlAPI"].ToString();
            var prefix     = Application.Current.Resources["UrlPrefix"].ToString();
            var controller = Application.Current.Resources["UrlCountsController"].ToString();
            var response   = await this.apiService.Post(url, prefix, controller, count, Settings.TokenType, Settings.AccessToken);

            if (!response.IsSuccess)
            {
                this.IsRunning = false;
                this.IsEnabled = true;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    response.Message,
                    Languages.Accept);

                return;
            }

            this.IsRunning = false;
            this.IsEnabled = true;

            await Application.Current.MainPage.DisplayAlert(
                Languages.Confirm,
                Languages.DataSaved,
                Languages.Accept);

            await App.Navigator.PopAsync();
        }
Ejemplo n.º 59
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="other">
 /// The item to copy
 /// </param>
 public Count(Count other)
     : base(other)
 {
     this.Epoch = other.Epoch;
 }
Ejemplo n.º 60
0
 void Start()
 {
     count    = go.GetComponent <Count>();
     timeLeft = count.electionTime / 3;
 }