public void LowerPipe_InputOutput_VerifyNextInvoke() { var mock = new Mock <IPipeObject>(); var lower = new Lower(); // Set a mock object to the next pipe lower.NextPipe = mock.Object; string input = "HelLo"; // Do the work lower.Invoke(input); //Output string expected = input.ToLower(); // Check if the next pipe's invoke method is called with right parameter mock.Verify(i => i.Invoke(expected)); mock.VerifyNoOtherCalls(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Input != null) { hashCode = hashCode * 59 + Input.GetHashCode(); } if (Compare != null) { hashCode = hashCode * 59 + Compare.GetHashCode(); } hashCode = hashCode * 59 + Lower.GetHashCode(); hashCode = hashCode * 59 + Trim.GetHashCode(); return(hashCode); } }
public override string ToString() { string lower = "null"; string upper = "null"; string edit = "null"; if (Edit != null) { edit = Edit.ToString(); } if (Lower != null) { lower = Lower.ToString(); } if (Upper != null) { upper = Upper.ToString(); } return($"{lower} | {edit} | {upper}"); }
/// <summary> /// Gets the vertex buffer for the specified level. /// </summary> public VBO <ColorNormalVertex> GetLevel(int Level, Polarity Direction) { if (Direction == Polarity.Negative) { Level--; } VBO <ColorNormalVertex> c = this._Levels[Level, (int)Direction]; if (c == null) { IIterator <ColorNormalVertex, VBO <ColorNormalVertex> > vboc = VBO <ColorNormalVertex> .Create(); IBoundedPlaneSurface <Material> bps = Shape.Slice(this._StratifiedRenderer._Source, this._Axis, Level, delegate(T Lower, T Higher, Axis Axis) { if (Direction == Polarity.Positive && !Higher.Equals(this._StratifiedRenderer._Default)) { return(this._StratifiedRenderer._SurfacizeFunc(Lower, this._StratifiedRenderer._Default, Axis)); } if (Direction == Polarity.Negative && !Lower.Equals(this._StratifiedRenderer._Default)) { return(this._StratifiedRenderer._SurfacizeFunc(this._StratifiedRenderer._Default, Higher, Axis)); } return(Material.Default); }, Material.Default); QuadtreeSurface <Material> qs = bps.Extend <QuadtreeSurface <Material> >(); if (qs != null) { StaticRenderer.Send(qs, vboc, vboc); } else { StaticRenderer.Send(bps, vboc); } this._Levels[Level, (int)Direction] = c = vboc.End(); } return(c); }
public bool IPInRange(IPAddress candidate) { byte[] lowerBytes = Lower.GetAddressBytes(); byte[] upperBytes = Upper.GetAddressBytes(); byte[] addressBytes = candidate.GetAddressBytes(); bool lowerBoundary = true, upperBoundary = true; for (int i = 0; i < lowerBytes.Length && (lowerBoundary || upperBoundary); i++) { if ((lowerBoundary && addressBytes[i] < lowerBytes[i]) || (upperBoundary && addressBytes[i] > upperBytes[i])) { return(false); } lowerBoundary &= (addressBytes[i] == lowerBytes[i]); upperBoundary &= (addressBytes[i] == upperBytes[i]); } return(true); }
public void CollectionPointer() { ISession s = OpenSession(); Lower ls = new Lower(); IList list = new ArrayList(); ls.Bag = list; Top simple = new Top(); object id = s.Save(ls); s.Save(simple); s.Flush(); list.Add(simple); s.Flush(); s.Close(); s = OpenSession(); ls = (Lower)s.Load(typeof(Lower), id); Assert.AreEqual(1, ls.Bag.Count); s.Delete("from o in class System.Object"); s.Flush(); s.Close(); }
public async Task CollectionPointerAsync() { ISession s = OpenSession(); Lower ls = new Lower(); IList <Top> list = new List <Top>(); ls.Bag = list; Top simple = new Top(); object id = await(s.SaveAsync(ls)); await(s.SaveAsync(simple)); await(s.FlushAsync()); list.Add(simple); await(s.FlushAsync()); s.Close(); s = OpenSession(); ls = (Lower)await(s.LoadAsync(typeof(Lower), id)); Assert.AreEqual(1, ls.Bag.Count); await(s.DeleteAsync("from o in class System.Object")); await(s.FlushAsync()); s.Close(); }
private Block SearchThroughCompanionBuddies(long requestedCapacity) { if (Lower != null) { Block lowerResult = Lower.Allocate(requestedCapacity); if (lowerResult != null) { return(lowerResult); } } if (Higher != null) { Block higherResult = Higher.Allocate(requestedCapacity); if (higherResult != null) { return(higherResult); } } return(null); }
public override int GetHashCode() => 13 * 17 + Lower.GetHashCode() * 17 + Upper.GetHashCode();
public bool Equals(Bounds <T> other) => Lower.Equals(other.Lower) && Upper.Equals(other.Upper);
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["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(); // 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(); }
public PipePoint GetPipePoint() { Lower.CheckCanceledAndNoMoreData(); return(Lower); }
public void MultiTableManyToOne() { if (Dialect is MySQLDialect) { return; } ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual(0, s.CreateQuery("from s in class Top").List().Count); Multi multi = new Multi(); multi.ExtraProp = "extra"; multi.Name = "name"; Top simp = new Top(); simp.Date = DateTime.Now; simp.Name = "simp"; object mid; if (Dialect is MsSql2000Dialect) { mid = s.Save(multi); } else { mid = 123L; s.Save(multi, mid); } Lower ls = new Lower(); ls.Other = ls; ls.Another = multi; ls.YetAnother = ls; ls.Name = "Less Simple"; object id; if (Dialect is MsSql2000Dialect) { id = s.Save(ls); } else { id = 2L; s.Save(ls, id); } t.Commit(); s.Close(); Assert.AreSame(ls, ls.Other); Assert.AreSame(multi, ls.Another); Assert.AreSame(ls, ls.YetAnother); s = OpenSession(); t = s.BeginTransaction(); ls = (Lower)s.Load(typeof(Lower), id); Assert.AreSame(ls, ls.Other); Assert.AreSame(ls, ls.YetAnother); Assert.AreEqual("name", ls.Another.Name); Assert.IsTrue(ls.Another is Multi); s.Delete(ls); s.Delete(ls.Another); t.Commit(); s.Close(); }
private Z3Expr MkCoercion(Z3Expr t, AppFreeCanUnn unn, RealEmbedding te) { return(BoxingFun.Apply( ((Z3IntExpr)Context.MkSub(Context.MkReal2Int((Z3RealExpr)t), Context.MkInt(Lower.ToString()))).Int2BV(Context, bvSort.Size))); }
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["textjoin"] = new Textjoin(); 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(CultureInfo.CurrentCulture); Functions["trim"] = new Trim(); Functions["clean"] = new Clean(); Functions["unicode"] = new Unicode(); Functions["unichar"] = new Unichar(); Functions["numbervalue"] = new NumberValue(); Functions["dollar"] = new Dollar(); // Numbers Functions["int"] = new CInt(); // Math Functions["aggregate"] = new Aggregate(); Functions["abs"] = new Abs(); Functions["asin"] = new Asin(); Functions["asinh"] = new Asinh(); Functions["acot"] = new Acot(); Functions["acoth"] = new Acoth(); Functions["cos"] = new Cos(); Functions["cot"] = new Cot(); Functions["coth"] = new Coth(); Functions["cosh"] = new Cosh(); Functions["csc"] = new Csc(); Functions["csch"] = new Csch(); Functions["power"] = new Power(); Functions["gcd"] = new Gcd(); Functions["lcm"] = new Lcm(); Functions["sec"] = new Sec(); Functions["sech"] = new SecH(); 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["ceiling.precise"] = new CeilingPrecise(); Functions["ceiling.math"] = new CeilingMath(); Functions["iso.ceiling"] = new IsoCeiling(); Functions["combin"] = new Combin(); Functions["combina"] = new Combina(); Functions["permut"] = new Permut(); Functions["permutationa"] = new Permutationa(); 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["factdouble"] = new FactDouble(); Functions["floor"] = new Floor(); Functions["floor.precise"] = new FloorPrecise(); Functions["floor.math"] = new FloorMath(); Functions["radians"] = new Radians(); Functions["roman"] = new Roman(); 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["sumxmy2"] = new Sumxmy2(); Functions["sumx2my2"] = new SumX2mY2(); Functions["sumx2py2"] = new SumX2pY2(); Functions["seriessum"] = new Seriessum(); Functions["stdev"] = new Stdev(); Functions["stdeva"] = new Stdeva(); Functions["stdevp"] = new StdevP(); Functions["stdevpa"] = new Stdevpa(); Functions["stdev.s"] = new StdevDotS(); Functions["stdev.p"] = new StdevDotP(); 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["mode"] = new Mode(); Functions["mode.sngl"] = new ModeSngl(); Functions["mround"] = new Mround(); Functions["multinomial"] = new Multinomial(); 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 RankEq(); Functions["rank.avg"] = new RankAvg(); Functions["percentile"] = new Percentile(); Functions["percentile.inc"] = new PercentileInc(); Functions["percentile.exc"] = new PercentileExc(); Functions["quartile"] = new Quartile(); Functions["quartile.inc"] = new QuartileInc(); Functions["quartile.exc"] = new QuartileExc(); Functions["percentrank"] = new Percentrank(); Functions["percentrank.inc"] = new PercentrankInc(); Functions["percentrank.exc"] = new PercentrankExc(); 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["covar"] = new Covar(); Functions["covariance.p"] = new CovarianceP(); Functions["covariance.s"] = new CovarianceS(); Functions["var"] = new Var(); Functions["vara"] = new Vara(); Functions["var.s"] = new VarDotS(); Functions["varp"] = new VarP(); Functions["varpa"] = new Varpa(); Functions["var.p"] = new VarDotP(); Functions["large"] = new Large(); Functions["small"] = new Small(); Functions["degrees"] = new Degrees(); Functions["odd"] = new Odd(); Functions["even"] = new Even(); // 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(); Functions["type"] = new TypeFunction(); // Logical Functions["if"] = new If(); Functions["ifs"] = new Ifs(); Functions["maxifs"] = new MaxIfs(); Functions["minifs"] = new MinIfs(); 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(); Functions["switch"] = new Switch(); Functions["xor"] = new Xor(); // 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["datedif"] = new DateDif(); 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["days"] = new Days(); 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["workday.intl"] = new WorkdayIntl(); 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["cumipmt"] = new Cumipmt(); Functions["cumprinc"] = new Cumprinc(); Functions["dollarde"] = new DollarDe(); Functions["dollarfr"] = new DollarFr(); Functions["ddb"] = new Ddb(); Functions["effect"] = new Effect(); Functions["fvschedule"] = new FvSchedule(); Functions["pduration"] = new Pduration(); Functions["rri"] = new Rri(); Functions["pmt"] = new Pmt(); Functions["ppmt"] = new Ppmt(); Functions["ipmt"] = new Ipmt(); Functions["ispmt"] = new IsPmt(); Functions["pv"] = new Pv(); Functions["fv"] = new Fv(); Functions["npv"] = new Npv(); Functions["rate"] = new Rate(); Functions["nper"] = new Nper(); Functions["nominal"] = new Nominal(); Functions["irr"] = new Irr(); Functions["mirr"] = new Mirr(); Functions["xirr"] = new Xirr(); Functions["sln"] = new Sln(); Functions["syd"] = new Syd(); Functions["xnpv"] = new Xnpv(); Functions["coupdays"] = new Coupdays(); Functions["coupdaysnc"] = new Coupdaysnc(); Functions["coupdaybs"] = new Coupdaybs(); Functions["coupnum"] = new Coupnum(); Functions["coupncd"] = new Coupncd(); Functions["couppcd"] = new Couppcd(); Functions["price"] = new Price(); Functions["yield"] = new Yield(); Functions["yieldmat"] = new Yieldmat(); Functions["duration"] = new Duration(); Functions["disc"] = new Disc(); //Engineering Functions["bitand"] = new BitAnd(); Functions["bitor"] = new BitOr(); Functions["bitxor"] = new BitXor(); Functions["bitlshift"] = new BitLshift(); Functions["bitrshift"] = new BitRshift(); Functions["convert"] = new ConvertFunction(); Functions["bin2dec"] = new Bin2Dec(); Functions["bin2hex"] = new Bin2Hex(); Functions["bin2oct"] = new Bin2Oct(); Functions["dec2bin"] = new Dec2Bin(); Functions["dec2hex"] = new Dec2Hex(); Functions["dec2oct"] = new Dec2Oct(); Functions["hex2bin"] = new Hex2Bin(); Functions["hex2dec"] = new Hex2Dec(); Functions["hex2oct"] = new Hex2Oct(); Functions["oct2bin"] = new Oct2Bin(); Functions["oct2dec"] = new Oct2Dec(); Functions["oct2hex"] = new Oct2Hex(); Functions["delta"] = new Delta(); Functions["erf"] = new Erf(); Functions["erf.precise"] = new ErfPrecise(); Functions["erfc"] = new Erfc(); Functions["erfc.precise"] = new ErfcPrecise(); Functions["besseli"] = new BesselI(); Functions["besselj"] = new BesselJ(); Functions["besselk"] = new BesselK(); Functions["bessely"] = new BesselY(); }
/// <summary> /// Punch appropriate holes for the selected code charts. /// </summary> /// <param name="safeList">The safe list to punch through.</param> /// <param name="codeCharts">The code charts to punch.</param> private static void PunchCodeCharts(ref char[][] safeList, LowerCodeCharts codeCharts) { PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.BasicLatin), Lower.BasicLatin()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.C1ControlsAndLatin1Supplement), Lower.Latin1Supplement()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.LatinExtendedA), Lower.LatinExtendedA()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.LatinExtendedB), Lower.LatinExtendedB()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.IpaExtensions), Lower.IpaExtensions()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.SpacingModifierLetters), Lower.SpacingModifierLetters()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.CombiningDiacriticalMarks), Lower.CombiningDiacriticalMarks()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.GreekAndCoptic), Lower.GreekAndCoptic()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Cyrillic), Lower.Cyrillic()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.CyrillicSupplement), Lower.CyrillicSupplement()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Armenian), Lower.Armenian()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Hebrew), Lower.Hebrew()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Arabic), Lower.Arabic()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Syriac), Lower.Syriac()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.ArabicSupplement), Lower.ArabicSupplement()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Thaana), Lower.Thaana()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Nko), Lower.Nko()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Samaritan), Lower.Samaritan()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Devanagari), Lower.Devanagari()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Bengali), Lower.Bengali()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Gurmukhi), Lower.Gurmukhi()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Gujarati), Lower.Gujarati()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Oriya), Lower.Oriya()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Tamil), Lower.Tamil()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Telugu), Lower.Telugu()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Kannada), Lower.Kannada()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Malayalam), Lower.Malayalam()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Sinhala), Lower.Sinhala()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Thai), Lower.Thai()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Lao), Lower.Lao()); PunchHolesIfNeeded(ref safeList, Lower.IsFlagSet(codeCharts, LowerCodeCharts.Tibetan), Lower.Tibetan()); }
[PublicAPI] public string ToString(Encoding encoding) { var unit = TimeUnit.GetBestTimeUnit(Values); return($"[{Lower.ToTimeStr(unit, encoding)};{Upper.ToTimeStr(unit, encoding)}) {{{string.Join("; ", Values.Select(v => v.ToTimeStr(unit, encoding)))}}}"); }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { Value.Set((MAX(Close, Period)[0] + MIN(Close, Period)[0]) / 2); Upper.Set(MAX(Close, Period)[0]); Lower.Set(MIN(Close, Period)[0]); }
public override String Print(int depth) { return(" new " + Type.Print(depth) + "[" + Lower.Print(depth) + ".." + Upper.Print(depth) + "]"); }
public string ToTimeStr(TimeUnit unit = null, bool showLevel = true) => $"[{Lower.ToTimeStr(unit)}; {Upper.ToTimeStr(unit)}] (CI {Level.ToPercentStr()})";
public string ToStr(bool showLevel = true) => $"[{Lower.ToStr()}; {Upper.ToStr()}] (CI {Level.ToPercentStr()})";
public async Task MultiTableCollectionsAsync() { if (Dialect is MySQLDialect) { return; } ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual(0, (await(s.CreateQuery("from s in class Top").ListAsync())).Count); Multi multi = new Multi(); multi.ExtraProp = "extra"; multi.Name = "name"; Top simp = new Top(); simp.Date = DateTime.Now; simp.Name = "simp"; object mid; object sid; if (TestDialect.HasIdentityNativeGenerator) { mid = await(s.SaveAsync(multi)); sid = await(s.SaveAsync(simp)); } else { mid = 123L; sid = 1234L; await(s.SaveAsync(multi, mid)); await(s.SaveAsync(simp, sid)); } Lower ls = new Lower(); ls.Other = ls; ls.Another = ls; ls.YetAnother = ls; ls.Name = "Less Simple"; ls.Set = new HashSet <Top> { multi, simp }; object id; if (TestDialect.HasIdentityNativeGenerator) { id = await(s.SaveAsync(ls)); } else { id = 2L; await(s.SaveAsync(ls, id)); } await(t.CommitAsync()); s.Close(); Assert.AreSame(ls, ls.Other); Assert.AreSame(ls, ls.Another); Assert.AreSame(ls, ls.YetAnother); s = OpenSession(); t = s.BeginTransaction(); ls = (Lower)await(s.LoadAsync(typeof(Lower), id)); Assert.AreSame(ls, ls.Other); Assert.AreSame(ls, ls.Another); Assert.AreSame(ls, ls.YetAnother); Assert.AreEqual(2, ls.Set.Count); int foundMulti = 0; int foundSimple = 0; foreach (object obj in ls.Set) { if (obj is Top) { foundSimple++; } if (obj is Multi) { foundMulti++; } } Assert.AreEqual(2, foundSimple); Assert.AreEqual(1, foundMulti); Assert.AreEqual(3, await(s.DeleteAsync("from s in class Top"))); await(t.CommitAsync()); s.Close(); }
public async Task MultiTableManyToOneAsync() { if (Dialect is MySQLDialect) { return; } ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual(0, (await(s.CreateQuery("from s in class Top").ListAsync())).Count); Multi multi = new Multi(); multi.ExtraProp = "extra"; multi.Name = "name"; Top simp = new Top(); simp.Date = DateTime.Now; simp.Name = "simp"; object mid; if (TestDialect.HasIdentityNativeGenerator) { mid = await(s.SaveAsync(multi)); } else { mid = 123L; await(s.SaveAsync(multi, mid)); } Lower ls = new Lower(); ls.Other = ls; ls.Another = multi; ls.YetAnother = ls; ls.Name = "Less Simple"; object id; if (TestDialect.HasIdentityNativeGenerator) { id = await(s.SaveAsync(ls)); } else { id = 2L; await(s.SaveAsync(ls, id)); } await(t.CommitAsync()); s.Close(); Assert.AreSame(ls, ls.Other); Assert.AreSame(multi, ls.Another); Assert.AreSame(ls, ls.YetAnother); s = OpenSession(); t = s.BeginTransaction(); ls = (Lower)await(s.LoadAsync(typeof(Lower), id)); Assert.AreSame(ls, ls.Other); Assert.AreSame(ls, ls.YetAnother); Assert.AreEqual("name", ls.Another.Name); Assert.IsTrue(ls.Another is Multi); await(s.DeleteAsync(ls)); await(s.DeleteAsync(ls.Another)); await(t.CommitAsync()); s.Close(); }
public static void Handle(MessageEventArgs e) { try { ServerData S = ServerData.Servers[e.Server.Id]; if (S.Trivia.ContainsKey(e.Channel.Id) && S.Trivia[e.Channel.Id].Try(e)) { return; } List <Command> Cmds = S.GetCommands(e.Channel.Id); string Raw = e.Message.RawText; if (e.Message.Text.StartsWith("{") && e.Message.Text.EndsWith("}") && Db.HasPermission(e.User.Id, "anime")) { Search.AnimeInfo(Raw.TrimStart('{').TrimEnd('}'), e); } else if (e.Message.Text.StartsWith("<") && !e.Message.Text.StartsWith("<@") && e.Message.Text.EndsWith(">") && Db.HasPermission(e.User.Id, "manga")) { Search.MangaInfo(Raw.TrimStart('<').TrimEnd('>'), e); } string Key; string Lower; foreach (Command Cmd in Cmds) { string Prefix = CmdPrefix; Lower = Raw.ToLower(); if (Cmd.Prefix != Command.PrefixType.None) { if (Db.HasPermission(e.User.Id, Cmd.Keys[0])) { if (Cmd.Prefix == Command.PrefixType.Mention) { Prefix = Bot.Mention + " "; } foreach (string CmdKey in Cmd.Keys) { Key = Prefix + CmdKey; if (Lower.StartsWith(Key) && (Raw.Length == Key.Length || Raw.Substring(Key.Length, 1) == " " || Raw.Substring(Key.Length, 1) == "." || Raw.Substring(Key.Length, 1) == "?")) { Cmd.Handler(Raw.Substring(Key.Length).TrimStart(' '), e); Executed++; return; } } } } else if (Lower.Contains(Cmd.Keys[0])) { Executed++; Cmd.Handler(Raw, e); return; } } if (Raw.StartsWith(Bot.Mention) && Raw.EndsWith("?") && Db.HasPermission(e.User.Id, "ask") && Cmds.Any(x => x.Keys.Contains("ask"))) { Search.Ask(Raw, e); } } catch (Exception Ex) { $"CommandExeption: {Ex}".Log(); } }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { double averageValue = 0; if (Smoothed) { averageValue = smoothedAverage[0]; } else { averageValue = average[0]; } double offset = 0; if (Smoothed) { offset = NumStdDev * smoothedVolatility[0]; } else { offset = NumStdDev * volatility[0]; } if (showMidband) { Middle.Set(averageValue); } else { Middle.Reset(); } if (showChannels) { Upper.Set(averageValue + offset); Lower.Set(averageValue - offset); } else { Upper.Reset(); Lower.Reset(); } if (CurrentBar < Math.Max(Period, StdDevPeriod)) { return; } if (FirstTickOfBar) { neutralSlope = threshold * averageTrueRange[1] / 1000; priorBull = bullish; middle = Middle[1] + Middle[2]; upper = Upper[1] + Upper[2]; lower = Lower[1] + Lower[2]; } if (2 * averageValue > middle + 3 * neutralSlope) { PlotColors[1][0] = upColor; if (useCentralSlope) { PlotColors[0][0] = UpColor; PlotColors[2][0] = UpColor; } if (priorBull <= 0) { index = CurrentBar; } if (Opacity != 0) { DrawRegion("bollinger" + index, CurrentBar - index + 1, 0, Upper, Lower, Color.Transparent, UpColor, Opacity); } bullish = 1; } else if (2 * averageValue < middle - 3 * neutralSlope) { PlotColors[1][0] = DownColor; if (useCentralSlope) { PlotColors[0][0] = DownColor; PlotColors[2][0] = DownColor; } if (priorBull >= 0) { index = CurrentBar; } if (Opacity != 0) { DrawRegion("bollinger" + index, CurrentBar - index + 1, 0, Upper, Lower, Color.Transparent, DownColor, Opacity); } bullish = -1; } else { PlotColors[1][0] = NeutralColor; if (useCentralSlope) { PlotColors[0][0] = NeutralColor; PlotColors[2][0] = NeutralColor; } if (priorBull != 0) { index = CurrentBar; } if (Opacity != 0) { DrawRegion("bollinger" + index, CurrentBar - index + 1, 0, Upper, Lower, Color.Transparent, NeutralColor, Opacity); } bullish = 0; } if (!useCentralSlope) { if (2 * averageValue + 2 * offset >= upper + 3 * neutralSlope) { PlotColors[0][0] = UpColor; } else if (2 * averageValue + 2 * offset <= upper - 3 * neutralSlope) { PlotColors[0][0] = DownColor; } else { PlotColors[0][0] = NeutralColor; } if (2 * averageValue - 2 * offset >= lower + 3 * neutralSlope) { PlotColors[2][0] = UpColor; } else if (2 * averageValue - 2 * offset <= lower - 3 * neutralSlope) { PlotColors[2][0] = DownColor; } else { PlotColors[2][0] = NeutralColor; } } }
private void Update() { if (GameInput.GetKeyDown(player, ActionKey)) { MovementAction movement = GetComponent <MovementAction>(); Selecting = true; if (movement != null) { movement.enabled = false; } ((CombineSelection)selection).StartSelecting(this, player, "Combinable", Range); } if (GameInput.GetKeyUp(player, ActionKey)) { Selecting = false; GameObject g = selection.StopSelecting(); if (g != null) { if (Upper != null && g == Upper.gameObject) { UpperJoint.connectedBody = null; UpperJoint.enabled = false; Upper.Separated(true); Upper = null; } else if (Lower != null && g == Lower.gameObject) { LowerJoint.connectedBody = null; LowerJoint.enabled = false; Lower.Separated(false); Lower = null; } else { CombineAction comb = g.GetComponent <CombineAction>(); if (comb.part > part) { comb.transform.position = comb.transform.position + (UpperAttachPoint.position - comb.LowerAttachPoint.position); UpperJoint.enabled = true; UpperJoint.connectedBody = comb.GetComponent <Rigidbody2D>(); Upper = comb; comb.Combined(true, this); if (comb.GetMass() > SupportableMass) { Break(); } } else { transform.position = transform.position + (comb.UpperAttachPoint.position - LowerAttachPoint.position); LowerJoint.enabled = true; LowerJoint.connectedBody = comb.GetComponent <Rigidbody2D>(); Lower = comb; comb.Combined(false, this); } } UpdateMovement(); } if (Movement) { MovementAction movement = GetComponent <MovementAction>(); if (movement != null) { movement.enabled = true; } } } }
public void MultiTableCollections() { if (Dialect is MySQLDialect) { return; } ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Assert.AreEqual(0, s.CreateQuery("from s in class Top").List().Count); Multi multi = new Multi(); multi.ExtraProp = "extra"; multi.Name = "name"; Top simp = new Top(); simp.Date = DateTime.Now; simp.Name = "simp"; object mid; object sid; if (Dialect is MsSql2000Dialect) { mid = s.Save(multi); sid = s.Save(simp); } else { mid = 123L; sid = 1234L; s.Save(multi, mid); s.Save(simp, sid); } Lower ls = new Lower(); ls.Other = ls; ls.Another = ls; ls.YetAnother = ls; ls.Name = "Less Simple"; ls.Set = new HashSet <Top> { multi, simp }; object id; if (Dialect is MsSql2000Dialect) { id = s.Save(ls); } else { id = 2L; s.Save(ls, id); } t.Commit(); s.Close(); Assert.AreSame(ls, ls.Other); Assert.AreSame(ls, ls.Another); Assert.AreSame(ls, ls.YetAnother); s = OpenSession(); t = s.BeginTransaction(); ls = (Lower)s.Load(typeof(Lower), id); Assert.AreSame(ls, ls.Other); Assert.AreSame(ls, ls.Another); Assert.AreSame(ls, ls.YetAnother); Assert.AreEqual(2, ls.Set.Count); int foundMulti = 0; int foundSimple = 0; foreach (object obj in ls.Set) { if (obj is Top) { foundSimple++; } if (obj is Multi) { foundMulti++; } } Assert.AreEqual(2, foundSimple); Assert.AreEqual(1, foundMulti); Assert.AreEqual(3, s.Delete("from s in class Top")); t.Commit(); s.Close(); }
public override void MakeSchemaCompliant() { base.MakeSchemaCompliant(); Lower.MakeSchemaCompliant(); Upper.MakeSchemaCompliant(); }
private bool IsMinLessOrEqualsValue(T value) => Lower.CompareTo(value) <= 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["substitute"] = new Substitute(); Functions["concatenate"] = new Concatenate(); Functions["exact"] = new Exact(); Functions["find"] = new Find(); Functions["proper"] = new Proper(); Functions["text"] = new Text.Text(); Functions["t"] = new T(); // Numbers Functions["int"] = new CInt(); // Math Functions["abs"] = new Abs(); 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["countif"] = new CountIf(); 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["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["min"] = new Min(); Functions["mod"] = new Mod(); Functions["average"] = new Average(); Functions["averagea"] = new AverageA(); Functions["averageif"] = new AverageIf(); Functions["round"] = new Round(); Functions["rounddown"] = new Rounddown(); Functions["roundup"] = new Roundup(); Functions["rand"] = new Rand(); Functions["randbetween"] = new RandBetween(); 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["var"] = new Var(); Functions["varp"] = new VarP(); // Information Functions["isblank"] = new IsBlank(); Functions["isnumber"] = new IsNumber(); Functions["istext"] = new IsText(); Functions["iserror"] = new IsError(); Functions["iserr"] = new IsErr(); 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["not"] = new Not(); Functions["and"] = new And(); Functions["or"] = new Or(); Functions["true"] = new True(); // 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() { SkipArgumentEvaluation = true }; Functions["column"] = new Column(); Functions["columns"] = new Columns() { SkipArgumentEvaluation = true }; Functions["choose"] = new Choose(); Functions["index"] = new Index(); Functions["indirect"] = new Indirect(); // 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(); }