public void When_Document_Exists_Replace_Succeeds() { const string key = "Replace.When_Document_Exists_Replace_Succeeds"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); var result = IOService.Execute(delete); Console.WriteLine(result.Message); //add the new doc var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); var result1 = IOService.Execute(add); Assert.IsTrue(result1.Success); //replace it the old doc with a new one var replace = new Replace<dynamic>(key, new { bar = "bar" }, GetVBucket(), Transcoder, OperationLifespanTimeout); var result2 = IOService.Execute(replace); Assert.IsTrue(result2.Success); //check that doc has been updated var get = new Get<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); var result3 = IOService.Execute(get); Assert.IsTrue(result3.Success); Assert.AreEqual(result3.Value.bar.Value, "bar"); }
public void FactoryTypeMock() { Dx.Test("My test") .Arrange(bag => { bag.entityNumber = 2; bag.commandId = 55; bag.factory .GetRepo(true) .GetEntity(Dx.Args<int>(a => a == bag.commandId)) .DxReturns(new Add.Entity { Number = bag.entityNumber }); }) .UseParentAct() .Act(bag => { bag.add = 55; var subject = new Add(bag.factory.DxAs<RepoFactory>()); return subject.Execute2(bag.commandId, bag.add); }) .SkipParentAssert() .Assert((bag, result) => { if (result != 110) throw new InvalidOperationException(); }) .Run(); }
public void When_Key_Exists_Exist_Operation_Fails() { var operation = new Add<dynamic>("keythatdoesntexist", new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); var result = IOService.Execute(operation); Assert.IsFalse(result.Success); Assert.AreEqual(ResponseStatus.KeyExists, result.Status); }
public void When_Key_Exists_Exist_Operation_Fails() { var operation = new Add<dynamic>("keythatdoesntexist", new { foo = "foo" }, GetVBucket(), new ManualByteConverter(), new TypeSerializer(new ManualByteConverter())); var result = IOStrategy.Execute(operation); Assert.IsFalse(result.Success); Assert.AreEqual(ResponseStatus.KeyExists, result.Status); }
private static void Check(DelegGetAll action) { var temp = action().Where(a => a.ToString().Length > 12); if (temp.Count() != 0) { if (MessageBox.Show( "Некоторые элементы будут отображться маленьким шрифтом, вы будете редактировать эти значения?", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (var info in temp) { var type = info.GetType(); var a = new Add(info.ToString(), type, null); string strAdd = null; if (a.ShowDialog() == DialogResult.OK) { strAdd = a.strNew; } if (type == typeof(FacultyInfo)) Model.Edit.Faculty(((FacultyInfo)info), strAdd); else if (type == typeof(TeacherInfo)) Model.Edit.Teacher(((TeacherInfo)info), strAdd); else if (type == typeof(DisciplineInfo)) Model.Edit.Discipline(((DisciplineInfo)info), strAdd); } } } }
public ActionResult Add(string id) { var organisation = (Organisation)this.AllorsSession.Instantiate(id); var model = new Add(); this.Map(model, organisation); return this.View(model); }
public void Add_AddLiteralToRegisterWithOverflow_OverflowAndRegisterHaveCorrectValues() { var prev = new MutableState().Set(Register.A, 0xFFFE); var next = new Add(new Reg(Register.A), new Literal(0x5)).Apply(prev); Assert.AreEqual(1, next.Get(Register.O)); Assert.AreEqual(0x3, next.Get(Register.A)); }
public void Generate() { // Create the module network ModuleBase moduleBase; switch(noise) { case NoiseType.Billow: moduleBase = new Billow(); break; case NoiseType.RiggedMultifractal: moduleBase = new RiggedMultifractal(); break; case NoiseType.Voronoi: moduleBase = new Voronoi(); break; case NoiseType.Mix: Perlin perlin = new Perlin(); RiggedMultifractal rigged = new RiggedMultifractal(); moduleBase = new Add(perlin, rigged); break; default: moduleBase = new Perlin(); break; } // Initialize the noise map this.m_noiseMap = new Noise2D(resolution, resolution, moduleBase); this.m_noiseMap.GeneratePlanar( offset + -1 * 1/zoom, offset + offset + 1 * 1/zoom, offset + -1 * 1/zoom, offset + 1 * 1/zoom); Debug.Log (moduleBase.GetValue (0, 0, UnityEngine.Random.value)); // Generate the textures this.m_textures[0] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Grayscale); this.m_textures[0].Apply(); this.m_textures[1] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Terrain); this.m_textures[1].Apply(); this.m_textures[2] = this.m_noiseMap.GetNormalMap(3.0f); this.m_textures[2].Apply(); //display on plane GetComponent<Renderer>().material.mainTexture = m_textures[0]; //write images to disk File.WriteAllBytes(Application.dataPath + "/../Gray.png", m_textures[0].EncodeToPNG() ); File.WriteAllBytes(Application.dataPath + "/../Terrain.png", m_textures[1].EncodeToPNG() ); File.WriteAllBytes(Application.dataPath + "/../Normal.png", m_textures[2].EncodeToPNG() ); Debug.Log("Wrote Textures out to "+Application.dataPath + "/../"); }
/// <summary> /// Creates an Add command if one has not been allocated. /// </summary> /// <returns> /// Returns an allocated Add command. /// </returns> public override Add createAddCommand() { if (add == null) { add = new Add(); }// end if return add; }
public void GivenAComplexExpression_WhenInspectIsCalled_ThenTheRepresentationIsReturnedInQuotes() { var expression = new Add( new Multiply(new Number(1), new Number(2)), new Multiply(new Number(3), new Number(4))); expression.Inspect().Should().Be("«1 * 2 + 3 * 4»"); }
public void Eval_ShouldAddTwoInteger() { var a = new Lit(7); var b = new Lit(8); var add = new Add(a, b); Assert.That(add.Accept(new IntegerEval()), Is.EqualTo(15)); }
public void Print_ShouldPrintAddExpression() { var a = new Lit(7); var b = new Lit(8); var add = new Add(a, b); Assert.That(add.Accept(new Print()), Is.EqualTo("7+8")); }
public void Test_Clone() { var operation = new Add<dynamic>("keythatdoesntexist", new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); var cloned = operation.Clone(); Assert.AreEqual(operation.CreationTime, cloned.CreationTime); Assert.AreEqual(operation.Cas, cloned.Cas); Assert.AreEqual(operation.VBucket.Index, cloned.VBucket.Index); Assert.AreEqual(operation.Key, cloned.Key); Assert.AreEqual(operation.Opaque, cloned.Opaque); Assert.AreEqual(operation.RawValue, ((OperationBase<dynamic>) cloned).RawValue); }
public Context(string flag) { switch (flag) { case "+": oper=new Add(); break; case "-": oper=new Subtract(); break; } }
public void When_MutationSeqno_Is_Not_Set_MutationToken_Is_The_Same_For_All_Instances() { var key = "bar"; var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); var deleteResult = IOService.Execute(delete); var add = new Add<string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout); var addResult = IOService.Execute(add); Assert.IsNotNull(addResult.Token); Assert.AreEqual(deleteResult.Token, addResult.Token); }
public void When_Key_Doesnt_Exist_Operation_Succeeds() { const string key = "keythatdoesntexist"; //delete the value if it exists var deleteOperation = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); var result1 = IOService.Execute(deleteOperation); Console.WriteLine(result1.Message); var operation = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); var result = IOService.Execute(operation); Assert.IsTrue(result.Success); }
public void When_Key_Doesnt_Exist_Operation_Succeeds() { const string key = "keythatdoesntexist"; //delete the value if it exists var deleteOperation = new Delete(key, GetVBucket(), new AutoByteConverter(), new TypeSerializer(new ManualByteConverter())); var result1 = IOStrategy.Execute(deleteOperation); Console.WriteLine(result1.Message); var operation = new Add<dynamic>(key, new {foo = "foo"}, GetVBucket(), new AutoByteConverter(), new TypeSerializer(new ManualByteConverter())); var result = IOStrategy.Execute(operation); Assert.IsTrue(result.Success); }
// Use this for initialization void Start() { IModule primaryGranite = new Billow(); ((Billow)primaryGranite).Seed = 0; ((Billow)primaryGranite).Frequency = 8.0; ((Billow)primaryGranite).Persistence = 0.625; ((Billow)primaryGranite).Lacunarity = 2.18359375; ((Billow)primaryGranite).OctaveCount = 6; ((Billow)primaryGranite).NoiseQuality = NoiseQuality.Standard; IModule baseGrains = new Voronoi(); ((Voronoi)baseGrains).Seed = 1; ((Voronoi)baseGrains).Frequency = 16.0; ((Voronoi)baseGrains).EnableDistance = true; IModule scaledGrains = new ScaleBias(baseGrains); ((ScaleBias)scaledGrains).Scale = -0.5; ((ScaleBias)scaledGrains).Bias = 0.0; IModule combinedGranite = new Add(primaryGranite, scaledGrains); IModule finalGranite = new Turbulence(combinedGranite); ((Turbulence)finalGranite).Seed = 2; ((Turbulence)finalGranite).Frequency = 4.0; ((Turbulence)finalGranite).Power = 1.0 / 8.0; ((Turbulence)finalGranite).Roughness = 6; NoiseMapBuilderPlane plane = new NoiseMapBuilderPlane(256, 256); plane.SetBounds(-1.0, 1.0, -1.0, 1.0); plane.Build(finalGranite); RendererImage render = new RendererImage(); render.SourceNoiseMap = plane.Map; render.ClearGradient (); render.AddGradientPoint (-1.0000, new Color32( 0, 0, 0, 255)); render.AddGradientPoint (-0.9375, new Color32( 0, 0, 0, 255)); render.AddGradientPoint (-0.8750, new Color32(216, 216, 242, 255)); render.AddGradientPoint ( 0.0000, new Color32(191, 191, 191, 255)); render.AddGradientPoint ( 0.5000, new Color32(210, 116, 125, 255)); render.AddGradientPoint ( 0.7500, new Color32(210, 113, 98, 255)); render.AddGradientPoint ( 1.0000, new Color32(255, 176, 192, 255)); render.IsLightEnabled = true; render.LightAzimuth = 135.0; render.LightElev = 60.0; render.LightContrast = 2.0; render.LightColor = new Color32(255, 255, 255, 0); render.Render(); tex = render.GetTexture(); }
public void When_Key_Exists_Set_Succeeds() { const string key = "Replace.When_Document_Exists_Replace_Succeeds"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); var add = new Add<string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var set = new Set<string>(key, "boo", GetVBucket(), Transcoder, OperationLifespanTimeout); var result = IOStrategy.Execute(set); Assert.IsTrue(result.Success); }
public void DelegatesCanBeAssignedToDelegateTypedVariable() { var add = new Add((left, right) => left + right); var sum = new Sum((left, right) => left + right); add += (left, right) => left + right; int[] a; int[] b; add.Invoke(1,1); Delegate dAdd = add; Delegate dSum = sum; }
static void Main(string[] args) { var env = new System.Collections.Generic.Dictionary<string, int>(); env.Add("z",5); env.Add("x",2); Expr e1 = new Add(new CstI(17), new Var("z")).Simplify(); Expr e2 = new Mul(new Var("x"), new Var("z")).Simplify(); Expr e3 = new Sub(new Mul(new CstI(17), new CstI(5)), new Var("z")).Simplify(); Expr e4 = new Add(new CstI(17), new CstI(0)).Simplify(); System.Console.Out.WriteLine(e1.ToString() + " = " + e1.Eval(env)); System.Console.Out.WriteLine(e2.ToString() + " = " + e2.Eval(env)); System.Console.Out.WriteLine(e3.ToString() + " = " + e3.Eval(env)); System.Console.Out.WriteLine(e4.ToString() + " = " + e4.Eval(env)); System.Console.ReadLine(); }
public void Test_Hello_With_Feature_MutationSeqno_Set() { var features = new List<short>(); features.Add((short)ServerFeatures.MutationSeqno); var hello = new Hello("couchbase-net-sdk/2.1.4", features.ToArray(), Transcoder, 0, 0); var result = IOService.Execute(hello); Assert.IsTrue(result.Success); var key = "bar"; var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); var deleteResult = IOService.Execute(delete); var add = new Add<string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout); var result2 =IOService.Execute(add); Assert.IsNotNull(result2.Token); }
public void PassiveChainTest() { //Nested Adds var add3 = new Add().And(new Add().And(new Add())); Assert.AreEqual(3, add3.Execute(0)); var sub5 = new Sub().And(new Sub().And(new Sub().And(new Sub().And(new Sub())))); Assert.AreEqual(10, sub5.Execute(15)); //Continous adds to Root var sub2 = new Add().And(new Sub()).And(new Sub()).And(new Sub()); Assert.AreEqual(3, sub2.Execute(5)); var add5 = new Add(); for (int i = 0; i < 4; i++) add5.And(new Add()); Assert.AreEqual(5, add5.Execute(0)); }
private void Add_Click(object sender, EventArgs e) { string strAdd = null; if (_type == typeof(AuditoriumInfo)) { var add = new AddAuditorium(null, 0, "", 0, "", false); if (add.ShowDialog() == DialogResult.OK) { EditBase = true; Model.Add.Auditorium(add.number, add.Capacity, add.NumbComp, add.QualityComp, add.AvailabilityProjector, (LocationInfo)_added); } } else { var a = new Add(null, _type, null); EducationInfo edu = null; if (a.ShowDialog() == DialogResult.OK) { strAdd = a.strNew; edu = a.Edu; } if (strAdd != null) { EditBase = true; if (_type == typeof(FacultyInfo)) Model.Add.Faculty(strAdd); else if (_type == typeof(TeacherInfo)) Model.Add.Teacher(strAdd); else if (_type == typeof(LocationInfo)) Model.Add.Location(strAdd); else if (_type == typeof(EducationInfo)) Model.Add.Education(strAdd); else if (_type == typeof(GroupInfo)) Model.Add.Group(strAdd, (FacultyInfo)_added, edu); else if (_type == typeof(DisciplineInfo)) Model.Add.Discipline(strAdd, (TeacherInfo)_added); } } LoadListBox(); }
public void When_Key_Exists_Get_Returns_Value() { var key = "When_Key_Exists_Get_Returns_Value"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); //Add the key var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var get = new Get<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); var result = IOStrategy.Execute(get); Assert.IsTrue(result.Success); var expected = new {foo = "foo"}; Assert.AreEqual(result.Value.foo.Value, expected.foo); }
public RandomIsland(SceneNode node, Vector2 size, Biome islandBiome, API.Geo.World currentWorld) : base(node, size, currentWorld) { this.mBiome = islandBiome; ELEVATION.setFrequency(0.2); ELEVATION.setLacunarity(1); ELEVATION.setNoiseQuality(NoiseQuality.STANDARD); ELEVATION.setPersistence(0.7); ELEVATION.setOctaveCount(1); DETAIL.setFrequency(0.7); DETAIL.setLacunarity(1); DETAIL.setNoiseQuality(NoiseQuality.STANDARD); DETAIL.setPersistence(0.7); DETAIL.setOctaveCount(1); Multiply multiply = new Multiply(); multiply.SetSourceModule(0, ROUGHNESS); multiply.SetSourceModule(1, DETAIL); Add add = new Add(); add.SetSourceModule(0, multiply); add.SetSourceModule(1, ELEVATION); SCALE.SetSourceModule(0, add); SCALE.setxScale(0.03); SCALE.setyScale(0.06); SCALE.setzScale(0.03); TURBULENCE.SetSourceModule(0, SCALE); TURBULENCE.setFrequency(0.01); TURBULENCE.setPower(6); TURBULENCE.setRoughness(1); FINAL.SetSourceModule(0, SCALE); FINAL.setLowerBound(-1); FINAL.setUpperBound(1); this.generate(42); }
public void When_Key_Exists_Touch_Returns_Success() { var key = "When_Key_Exists_Touch_Returns_Success"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOService.Execute(delete); //Add the key var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOService.Execute(add).Success); var touch = new Touch(key, GetVBucket(), Transcoder, OperationLifespanTimeout) { Expires = new TimeSpan(0, 0, 0, 3).ToTtl() }; var result = IOService.Execute(touch); Console.WriteLine(result.Message); Assert.IsTrue(result.Success); }
public void When_Key_Exists_Get_Returns_Value() { var key = "When_Key_Exists_Get_Returns_Value"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), new AutoByteConverter(), new TypeSerializer(new ManualByteConverter())); IOStrategy.Execute(delete); //Add the key var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), new AutoByteConverter(), new TypeSerializer(new ManualByteConverter())); Assert.IsTrue(IOStrategy.Execute(add).Success); var get = new Get<dynamic>(key, GetVBucket(), new AutoByteConverter(), new TypeSerializer(new AutoByteConverter())); var result = IOStrategy.Execute(get); Assert.IsTrue(result.Success); var expected = new {foo = "foo"}; Assert.AreEqual(result.Value.foo.Value, expected.foo); }
public ActionResult Add(Add model, Command? command) { if (command == Command.Cancel) { return this.RedirectToRoute("Default", new { controller = "Organisation", action = "Index" }); } var organisation = (Organisation)this.AllorsSession.Instantiate(model.Id); if (command == Command.Save) { if (this.ModelState.IsValid) { if (organisation == null) { organisation = new OrganisationBuilder(this.AllorsSession).Build(); } organisation.Name = model.Name; var derivationLog = this.AllorsSession.Derive(); if (derivationLog.HasErrors) { foreach (var error in derivationLog.Errors) { this.ModelState.AddModelError(string.Empty, error.Message); } } else { this.AllorsSession.Commit(); this.ModelState.Clear(); return this.RedirectToAction("Index"); } } } this.Map(model, organisation); return this.View(model); }
public void When_Type_Is_Object_DataFormat_Json_Is_Used() { var key = "When_Type_Is_Object_DataFormat_Json_Is_Used"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); //Add the key var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var get = new Get<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); get.CreateExtras(); Assert.AreEqual(DataFormat.Json, get.Format); var result = IOStrategy.Execute(get); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.Json, get.Format); }
public void DelegateCanBeAssignedToObject() { Add add = (left, right) => left + right; object obj = new Add(Total); }
public void ComplexNumberBinaryToStringTest() { var exp = new Add(new ComplexNumber(3, 2), new ComplexNumber(3, 2)); Assert.Equal("3+2i + 3+2i", exp.ToString(commoonFormatter)); }
public void EntryAdded(EntryEvent <int?, string> @event) { Add.Signal(); }
public static InstructionCollection Parse(Stream input, long instructionsPosition) { var instructions = new SortedList <int, InstructionBase>(); using (var helper = new InstructionParseHelper(input, instructionsPosition)) { var reader = helper.GetReader(); while (helper.CanParse(instructions)) { //now reader the instructions var instructionPosition = helper.CurrentPosition; var type = reader.ReadByteAsEnum <InstructionType>(); var requireAlignment = InstructionAlignment.IsAligned(type); if (requireAlignment) { reader.Align(4); } InstructionBase instruction = null; var parameters = new List <Value>(); switch (type) { case InstructionType.ToNumber: instruction = new ToNumber(); break; case InstructionType.NextFrame: instruction = new NextFrame(); break; case InstructionType.Play: instruction = new Play(); break; case InstructionType.Stop: instruction = new Stop(); break; case InstructionType.Add: instruction = new Add(); break; case InstructionType.Subtract: instruction = new Subtract(); break; case InstructionType.Multiply: instruction = new Multiply(); break; case InstructionType.Divide: instruction = new Divide(); break; case InstructionType.Not: instruction = new Not(); break; case InstructionType.StringEquals: instruction = new StringEquals(); break; case InstructionType.Pop: instruction = new Pop(); break; case InstructionType.ToInteger: instruction = new ToInteger(); break; case InstructionType.GetVariable: instruction = new GetVariable(); break; case InstructionType.SetVariable: instruction = new SetVariable(); break; case InstructionType.StringConcat: instruction = new StringConcat(); break; case InstructionType.GetProperty: instruction = new GetProperty(); break; case InstructionType.SetProperty: instruction = new SetProperty(); break; case InstructionType.Trace: instruction = new Trace(); break; case InstructionType.Random: instruction = new RandomNumber(); break; case InstructionType.Delete: instruction = new Delete(); break; case InstructionType.Delete2: instruction = new Delete2(); break; case InstructionType.DefineLocal: instruction = new DefineLocal(); break; case InstructionType.CallFunction: instruction = new CallFunction(); break; case InstructionType.Return: instruction = new Return(); break; case InstructionType.Modulo: instruction = new Modulo(); break; case InstructionType.NewObject: instruction = new NewObject(); break; case InstructionType.InitArray: instruction = new InitArray(); break; case InstructionType.InitObject: instruction = new InitObject(); break; case InstructionType.TypeOf: instruction = new TypeOf(); break; case InstructionType.Add2: instruction = new Add2(); break; case InstructionType.LessThan2: instruction = new LessThan2(); break; case InstructionType.Equals2: instruction = new Equals2(); break; case InstructionType.ToString: instruction = new ToString(); break; case InstructionType.PushDuplicate: instruction = new PushDuplicate(); break; case InstructionType.GetMember: instruction = new GetMember(); break; case InstructionType.SetMember: instruction = new SetMember(); break; case InstructionType.Increment: instruction = new Increment(); break; case InstructionType.Decrement: instruction = new Decrement(); break; case InstructionType.CallMethod: instruction = new CallMethod(); break; case InstructionType.Enumerate2: instruction = new Enumerate2(); break; case InstructionType.EA_PushThis: instruction = new PushThis(); break; case InstructionType.EA_PushZero: instruction = new PushZero(); break; case InstructionType.EA_PushOne: instruction = new PushOne(); break; case InstructionType.EA_CallFunc: instruction = new CallFunc(); break; case InstructionType.EA_CallMethodPop: instruction = new CallMethodPop(); break; case InstructionType.BitwiseXOr: instruction = new BitwiseXOr(); break; case InstructionType.Greater: instruction = new Greater(); break; case InstructionType.EA_PushThisVar: instruction = new PushThisVar(); break; case InstructionType.EA_PushGlobalVar: instruction = new PushGlobalVar(); break; case InstructionType.EA_ZeroVar: instruction = new ZeroVar(); break; case InstructionType.EA_PushTrue: instruction = new PushTrue(); break; case InstructionType.EA_PushFalse: instruction = new PushFalse(); break; case InstructionType.EA_PushNull: instruction = new PushNull(); break; case InstructionType.EA_PushUndefined: instruction = new PushUndefined(); break; case InstructionType.GotoFrame: instruction = new GotoFrame(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.GetURL: instruction = new GetUrl(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.SetRegister: instruction = new SetRegister(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.ConstantPool: { instruction = new ConstantPool(); var count = reader.ReadUInt32(); var constants = reader.ReadFixedSizeArrayAtOffset <uint>(() => reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.GotoLabel: instruction = new GotoLabel(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.DefineFunction2: { instruction = new DefineFunction2(); var name = reader.ReadStringAtOffset(); var nParams = reader.ReadUInt32(); var nRegisters = reader.ReadByte(); var flags = reader.ReadUInt24(); //list of parameter strings var paramList = reader.ReadFixedSizeListAtOffset <FunctionArgument>(() => new FunctionArgument() { Register = reader.ReadInt32(), Parameter = reader.ReadStringAtOffset(), }, nParams); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger((int)nParams)); parameters.Add(Value.FromInteger((int)nRegisters)); parameters.Add(Value.FromInteger((int)flags)); foreach (var param in paramList) { parameters.Add(Value.FromInteger(param.Register)); parameters.Add(Value.FromString(param.Parameter)); } //body size of the function parameters.Add(Value.FromInteger(reader.ReadInt32())); //skip 8 bytes reader.ReadUInt64(); } break; case InstructionType.PushData: { instruction = new PushData(); var count = reader.ReadUInt32(); var constants = reader.ReadFixedSizeArrayAtOffset <uint>(() => reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.BranchAlways: { instruction = new BranchAlways(); var offset = reader.ReadInt32(); parameters.Add(Value.FromInteger(offset)); helper.ReportBranchOffset(offset); } break; case InstructionType.GetURL2: instruction = new GetUrl2(); break; case InstructionType.DefineFunction: { instruction = new DefineFunction(); var name = reader.ReadStringAtOffset(); //list of parameter strings var paramList = reader.ReadListAtOffset <string>(() => reader.ReadStringAtOffset()); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger(paramList.Count)); foreach (var param in paramList) { parameters.Add(Value.FromString(param)); } //body size of the function parameters.Add(Value.FromInteger(reader.ReadInt32())); //skip 8 bytes reader.ReadUInt64(); } break; case InstructionType.BranchIfTrue: { instruction = new BranchIfTrue(); var offset = reader.ReadInt32(); parameters.Add(Value.FromInteger(offset)); helper.ReportBranchOffset(offset); } break; case InstructionType.GotoFrame2: instruction = new GotoFrame2(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.EA_PushString: instruction = new PushString(); //the constant id that should be pushed parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_PushConstantByte: instruction = new PushConstantByte(); //the constant id that should be pushed parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_GetStringVar: instruction = new GetStringVar(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringVar: instruction = new SetStringVar(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_GetStringMember: instruction = new GetStringMember(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringMember: instruction = new SetStringMember(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_PushValueOfVar: instruction = new PushValueOfVar(); //the constant id that should be pushed parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_GetNamedMember: instruction = new GetNamedMember(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedFuncPop: instruction = new CallNamedFuncPop(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedFunc: instruction = new CallNamedFunc(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedMethodPop: instruction = new CallNamedMethodPop(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_PushFloat: instruction = new PushFloat(); parameters.Add(Value.FromFloat(reader.ReadSingle())); break; case InstructionType.EA_PushByte: instruction = new PushByte(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushShort: instruction = new PushShort(); parameters.Add(Value.FromInteger(reader.ReadUInt16())); break; case InstructionType.End: instruction = new End(); break; case InstructionType.EA_CallNamedMethod: instruction = new CallNamedMethod(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.Var: instruction = new Var(); break; case InstructionType.EA_PushRegister: instruction = new PushRegister(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushConstantWord: instruction = new PushConstantWord(); parameters.Add(Value.FromConstant(reader.ReadUInt16())); break; case InstructionType.EA_CallFuncPop: instruction = new CallFunctionPop(); break; case InstructionType.StrictEqual: instruction = new StrictEquals(); break; default: throw new InvalidDataException("Unimplemented bytecode instruction:" + type.ToString()); } if (instruction != null) { instruction.Parameters = parameters; instructions.Add(instructionPosition, instruction); } } } return(new InstructionCollection(instructions)); }
public void PowToStringAddTest() { var exp = new Add(Variable.X, new Pow(new Number(5), new Number(0))); Assert.Equal("x + 5 ^ 0", exp.ToString(commoonFormatter)); }
protected abstract TReturn Eval(Add <T> expr);
public static EasFolderType GetEasFolderType(this Add add) { return((EasFolderType)add.Type); }
protected override Dual Eval(Add <double> expr) => Eval(expr.Left) + Eval(expr.Right);
public void Parse() { var current = _reader.BaseStream.Position; _reader.BaseStream.Seek(_offset, SeekOrigin.Begin); bool parsing = true; bool branched = false; int branchBytes = 0; while (parsing) { //now reader the instructions var type = _reader.ReadByteAsEnum <InstructionType>(); var aligned = InstructionAlignment.IsAligned(type); if (aligned) { var padding = _reader.Align(4); if (padding > 0) { Items.Add(new Padding(padding)); if (branched) { branchBytes -= (int)padding; if (branchBytes <= 0) { branched = false; branchBytes = 0; } } } } InstructionBase instruction = null; List <Value> parameters = new List <Value>(); switch (type) { case InstructionType.ToNumber: instruction = new ToNumber(); break; case InstructionType.NextFrame: instruction = new NextFrame(); break; case InstructionType.Play: instruction = new Play(); break; case InstructionType.Stop: instruction = new Stop(); break; case InstructionType.Add: instruction = new Add(); break; case InstructionType.Subtract: instruction = new Subtract(); break; case InstructionType.Multiply: instruction = new Multiply(); break; case InstructionType.Divide: instruction = new Divide(); break; case InstructionType.Not: instruction = new Not(); break; case InstructionType.StringEquals: instruction = new StringEquals(); break; case InstructionType.Pop: instruction = new Pop(); break; case InstructionType.ToInteger: instruction = new ToInteger(); break; case InstructionType.GetVariable: instruction = new GetVariable(); break; case InstructionType.SetVariable: instruction = new SetVariable(); break; case InstructionType.StringConcat: instruction = new StringConcat(); break; case InstructionType.GetProperty: instruction = new GetProperty(); break; case InstructionType.SetProperty: instruction = new SetProperty(); break; case InstructionType.Trace: instruction = new Trace(); break; case InstructionType.Delete: instruction = new Delete(); break; case InstructionType.Delete2: instruction = new Delete2(); break; case InstructionType.DefineLocal: instruction = new DefineLocal(); break; case InstructionType.CallFunction: instruction = new CallFunction(); break; case InstructionType.Return: instruction = new Return(); break; case InstructionType.NewObject: instruction = new NewObject(); break; case InstructionType.InitArray: instruction = new InitArray(); break; case InstructionType.InitObject: instruction = new InitObject(); break; case InstructionType.TypeOf: instruction = new InitObject(); break; case InstructionType.Add2: instruction = new Add2(); break; case InstructionType.LessThan2: instruction = new LessThan2(); break; case InstructionType.Equals2: instruction = new Equals2(); break; case InstructionType.ToString: instruction = new ToString(); break; case InstructionType.PushDuplicate: instruction = new PushDuplicate(); break; case InstructionType.GetMember: instruction = new GetMember(); break; case InstructionType.SetMember: instruction = new SetMember(); break; case InstructionType.Increment: instruction = new Increment(); break; case InstructionType.Decrement: instruction = new Decrement(); break; case InstructionType.CallMethod: instruction = new CallMethod(); break; case InstructionType.Enumerate2: instruction = new Enumerate2(); break; case InstructionType.EA_PushThis: instruction = new PushThis(); break; case InstructionType.EA_PushZero: instruction = new PushZero(); break; case InstructionType.EA_PushOne: instruction = new PushOne(); break; case InstructionType.EA_CallFunc: instruction = new CallFunc(); break; case InstructionType.EA_CallMethodPop: instruction = new CallMethodPop(); break; case InstructionType.BitwiseXOr: instruction = new BitwiseXOr(); break; case InstructionType.Greater: instruction = new Greater(); break; case InstructionType.EA_PushThisVar: instruction = new PushThisVar(); break; case InstructionType.EA_PushGlobalVar: instruction = new PushGlobalVar(); break; case InstructionType.EA_ZeroVar: instruction = new ZeroVar(); break; case InstructionType.EA_PushTrue: instruction = new PushTrue(); break; case InstructionType.EA_PushFalse: instruction = new PushFalse(); break; case InstructionType.EA_PushNull: instruction = new PushNull(); break; case InstructionType.EA_PushUndefined: instruction = new PushUndefined(); break; case InstructionType.GotoFrame: instruction = new GotoFrame(); parameters.Add(Value.FromInteger(_reader.ReadInt32())); break; case InstructionType.GetURL: instruction = new GetUrl(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.SetRegister: instruction = new SetRegister(); parameters.Add(Value.FromInteger(_reader.ReadInt32())); break; case InstructionType.ConstantPool: { instruction = new ConstantPool(); var count = _reader.ReadUInt32(); var constants = _reader.ReadFixedSizeArrayAtOffset <uint>(() => _reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.GotoLabel: instruction = new GotoLabel(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.DefineFunction2: { instruction = new DefineFunction2(); var name = _reader.ReadStringAtOffset(); var nParams = _reader.ReadUInt32(); var nRegisters = _reader.ReadByte(); var flags = _reader.ReadUInt24(); //list of parameter strings var paramList = _reader.ReadFixedSizeListAtOffset <FunctionArgument>(() => new FunctionArgument() { Register = _reader.ReadInt32(), Parameter = _reader.ReadStringAtOffset(), }, nParams); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger((int)nParams)); parameters.Add(Value.FromInteger((int)nRegisters)); parameters.Add(Value.FromInteger((int)flags)); foreach (var param in paramList) { parameters.Add(Value.FromInteger(param.Register)); parameters.Add(Value.FromString(param.Parameter)); } //body size of the function parameters.Add(Value.FromInteger(_reader.ReadInt32())); //skip 8 bytes _reader.ReadUInt64(); } break; case InstructionType.PushData: { instruction = new PushData(); var count = _reader.ReadUInt32(); var constants = _reader.ReadFixedSizeArrayAtOffset <uint>(() => _reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.BranchAlways: instruction = new BranchAlways(); if (!branched) { branchBytes = _reader.ReadInt32(); parameters.Add(Value.FromInteger(branchBytes)); if (branchBytes > 0) { branchBytes += (int)instruction.Size + 1; branched = true; } } else { parameters.Add(Value.FromInteger(_reader.ReadInt32())); } break; case InstructionType.GetURL2: instruction = new GetUrl2(); break; case InstructionType.DefineFunction: { instruction = new DefineFunction(); var name = _reader.ReadStringAtOffset(); //list of parameter strings var paramList = _reader.ReadListAtOffset <string>(() => _reader.ReadStringAtOffset()); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger(paramList.Count)); foreach (var param in paramList) { parameters.Add(Value.FromString(param)); } //body size of the function parameters.Add(Value.FromInteger(_reader.ReadInt32())); //skip 8 bytes _reader.ReadUInt64(); } break; case InstructionType.BranchIfTrue: instruction = new BranchIfTrue(); if (!branched) { branchBytes = _reader.ReadInt32(); parameters.Add(Value.FromInteger(branchBytes)); if (branchBytes > 0) { branchBytes += (int)instruction.Size + 1; branched = true; } } else { parameters.Add(Value.FromInteger(_reader.ReadInt32())); } break; case InstructionType.GotoFrame2: instruction = new GotoFrame2(); parameters.Add(Value.FromInteger(_reader.ReadByte())); break; case InstructionType.EA_PushString: instruction = new PushString(); //the constant id that should be pushed parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_PushConstantByte: instruction = new PushConstantByte(); //the constant id that should be pushed parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_GetStringVar: instruction = new GetStringVar(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringVar: instruction = new SetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_GetStringMember: instruction = new GetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringMember: instruction = new SetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_PushValueOfVar: instruction = new PushValueOfVar(); //the constant id that should be pushed parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_GetNamedMember: instruction = new GetNamedMember(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedFuncPop: instruction = new CallNamedFuncPop(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedFunc: instruction = new CallNamedFunc(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedMethodPop: instruction = new CallNamedMethodPop(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_PushFloat: instruction = new PushFloat(); parameters.Add(Value.FromFloat(_reader.ReadSingle())); break; case InstructionType.EA_PushByte: instruction = new PushByte(); parameters.Add(Value.FromInteger(_reader.ReadByte())); break; case InstructionType.EA_PushShort: instruction = new PushShort(); parameters.Add(Value.FromInteger(_reader.ReadUInt16())); break; case InstructionType.End: instruction = new End(); if (!branched) { parsing = false; } break; case InstructionType.EA_CallNamedMethod: instruction = new CallNamedMethod(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.Var: instruction = new Var(); break; default: throw new InvalidDataException("Unimplemented bytecode instruction:" + type.ToString()); } if (instruction != null) { instruction.Parameters = parameters; Items.Add(instruction); } if (branched) { branchBytes -= (int)instruction.Size + 1; if (branchBytes <= 0) { branched = false; } } } _reader.BaseStream.Seek(current, SeekOrigin.Begin); }
protected override string Eval(Add <double> expr) => $"({Eval(expr.Left)} + {Eval(expr.Right)})";
public AdditionalInfoLeftPanel() { Title = Add.Label("", "Title"); Value = Add.Label("", "Value"); }
public void Visit(Add node) { Visit((dynamic)node[0]); Visit((dynamic)node[1]); }
private IEnumerable <PropertyInfo> GetKeyProperties <T>(Add addition) { var e = (IPrimaryKey <T>)addition.Entity; yield return(e.PrimaryKey.AsPropertyExpression()); }
public void InitO(int seed, int width, int height) { float delta = width / 3072.0f; delta *= ZoomMultiplier; DivNoise = delta; // Rand.SetSeed(seed); baseWaterTerrain.Frequency = 2.0; baseLandTerrain.Frequency = (2.0); ScaleBiasOutput flatTerrain = new ScaleBiasOutput(baseLandTerrain); flatTerrain.Scale = 0.005; flatTerrain.Bias = seaLevel;//SeaLevel; ScaleBiasOutput hillTerrain = new ScaleBiasOutput(baseLandTerrain); hillTerrain.Scale = 0.065; hillTerrain.Bias = seaLevel + 0.2;//SeaLevel; ScaleBiasOutput waterTerrain = new ScaleBiasOutput(baseWaterTerrain); waterTerrain.Bias = -0.73f;//SeaLevel; waterTerrain.Scale = 0.05; Perlin waterLandType = new Perlin(); waterLandType.Persistence = 0.45; waterLandType.Frequency = 0.5; //waterLandType.OctaveCount = 12; waterLandType.Seed = Rand.Next(1000000); Select waterLandSelector = new Select(waterLandType, waterTerrain, flatTerrain); waterLandSelector.EdgeFalloff = (0.045); waterLandSelector.SetBounds(-0.0, 1000);; Select landHillSelector = new Select(waterLandType, waterLandSelector, hillTerrain); landHillSelector.EdgeFalloff = (0.15); landHillSelector.SetBounds(0.4, 1000);; terrainType.Persistence = 0.3; terrainType.Frequency = 0.3; terrainType.Seed = Rand.Next(10000000); var clamp = new ClampOutput(terrainType); clamp.SetBounds(0, 1); // mountainTerrain.Frequency /= 1.5f; mountainTerrain.Lacunarity = 30; mountainTerrain.Frequency = 1.3; MultiplyPositive mul = new MultiplyPositive(waterLandType, waterLandType); ScaleOutput scaled = new ScaleOutput(mul, 0.00001); Add add = new Add(new BiasOutput(mountainTerrain, 1 + seaLevel), landHillSelector); MultiplyPositive mul2 = new MultiplyPositive(mul, mul); MultiplyPositive mul3 = new MultiplyPositive(clamp, mul); Select terrainSelector = new Select(mul3, landHillSelector, add); terrainSelector.EdgeFalloff = (0.425); terrainSelector.SetBounds(0.3, 1000); Turbulence finalTerrain = new Turbulence(terrainSelector); finalTerrain.Frequency = 4; finalTerrain.Power = 0.075; Width = width; Height = height; // ResultBitmap2 = new NoiseTexture(width, height, clamp); // System.Console.Out.WriteLine("Left: " + ResultBitmap2.minRange + " - " + ResultBitmap2.maxRange); ResultBitmap = new NoiseTexture(width, height, finalTerrain, DivNoise, 1.25f, -0.66f); System.Console.Out.WriteLine("Range: " + ResultBitmap.minRange + " - " + ResultBitmap.maxRange); }
/// <summary> /// Returns key of just added entity /// </summary> /// <param name="addCommand">Addition command</param> /// <param name="keyProperties">Key property</param> /// <returns></returns> protected abstract IEnumerable <object> GetKey(Add addCommand, IEnumerable <PropertyInfo> keyProperties);
public void Init(int seed, int width, int height) { if (LandBitmap != null && width != LandBitmap.Width) { LandBitmap.ResizeImage(width, height, false); } if (MountainBitmap != null && width != MountainBitmap.Width) { MountainBitmap.ResizeImage(width, height, false); } float delta = width / 3072.0f; delta *= ZoomMultiplier; DivNoise = delta; // Rand.SetSeed(seed); baseWaterTerrain.Frequency = 2.0; baseLandTerrain.Frequency = (2.0); ScaleBiasOutput flatTerrain = new ScaleBiasOutput(baseLandTerrain); flatTerrain.Scale = 0.005; flatTerrain.Bias = seaLevel;//SeaLevel; MinLandFreq = 0.2f; MaxLandFreq = 1f; if (LandBitmap != null) { MinLandFreq = 0.7f; } ScaleBiasOutput hillTerrain = new ScaleBiasOutput(baseLandTerrain); hillTerrain.Scale = 0.09; hillTerrain.Bias = seaLevel + 0.2;//SeaLevel; ScaleBiasOutput waterTerrain = new ScaleBiasOutput(baseWaterTerrain); waterTerrain.Bias = -0.33f;//SeaLevel; waterTerrain.Scale = 0.001; Perlin waterLandType = new Perlin(); float landFreq = Rand.Next((int)(MinLandFreq * 10000), (int)(MaxLandFreq * 10000)) / 10000.0f; waterLandType.Persistence = 0.45; waterLandType.Frequency = landFreq; //waterLandType.OctaveCount = 12; waterLandType.Seed = Rand.Next(1000000); Select waterLandSelector = new Select(waterLandType, waterTerrain, flatTerrain); if (LandBitmap != null) { waterLandSelector = new BitmapSelect(waterLandType, waterTerrain, flatTerrain, DivNoise, LandBitmap); } waterLandSelector.EdgeFalloff = (0.145); waterLandSelector.SetBounds(-0.0, 1000);; Select landHillSelector = new Select(waterLandType, waterLandSelector, hillTerrain); if (LandBitmap != null) { landHillSelector = new BitmapSelect(waterLandType, waterLandSelector, hillTerrain, DivNoise, LandBitmap); } landHillSelector.EdgeFalloff = (0.45); landHillSelector.SetBounds(0.25f, 1000);; terrainType.Persistence = 0.3; terrainType.Frequency = 0.3; terrainType.Seed = Rand.Next(10000000); var clamp = new ClampOutput(terrainType); clamp.SetBounds(0, 1); // mountainTerrain.Frequency /= 1.5f; mountainTerrain.Lacunarity = 35; mountainTerrain.Frequency = 3.2; mountainTerrain.Seed = Rand.Next(10000000); MultiplyPositive mul = new MultiplyPositive(waterLandType, waterLandType); ScaleOutput scaled = new ScaleOutput(mul, 0.00001); Add add = new Add(new BiasOutput(mountainTerrain, 0.8 + seaLevel), landHillSelector); MultiplyPositive mul2 = new MultiplyPositive(add, add); MultiplyPositive mul3 = new MultiplyPositive(clamp, mul); Select terrainSelector = new Select(mul3, landHillSelector, add); if (MountainBitmap != null) { terrainSelector = new BitmapSelect(mul3, landHillSelector, add, DivNoise, MountainBitmap); } terrainSelector.EdgeFalloff = (7.925); terrainSelector.SetBounds(0.3, 1000); Turbulence finalTerrain = new Turbulence(terrainSelector); finalTerrain.Frequency = 4; finalTerrain.Power = 0.075; Width = width; Height = height; // ResultBitmap2 = new NoiseTexture(width, height, clamp); // System.Console.Out.WriteLine("Left: " + ResultBitmap2.minRange + " - " + ResultBitmap2.maxRange); // ResultBitmap2 = new NoiseTexture(width, height, finalTerrain, DivNoise, 1.25f, -0.66f); // System.Console.Out.WriteLine("Left: " + ResultBitmap2.minRange + " - " + ResultBitmap2.maxRange); ResultBitmap = new NoiseTexture(width, height, finalTerrain, DivNoise, 1.25f, -0.66f); System.Console.Out.WriteLine("Right: " + ResultBitmap.minRange + " - " + ResultBitmap.maxRange); }
private void MouseHook_LeftButtonDown(MouseHook.MSLLHOOKSTRUCT mouseStruct) { Point point = new Point(mouseStruct.pt.x, mouseStruct.pt.y); Add add = new Add(AddList); IAsyncResult result = add.BeginInvoke(point, 1, null, null); }
public VoiceEntry() { Avatar = Add.Image("", "avatar"); Name = Add.Label("...", "name"); }
internal EasSourceFolder(Add add, UserSmtpAddress userSmtpAddress) : base(add, userSmtpAddress) { }
public void UnionSpecification() { var additionalContacts = With.Inputs(John, Tom, Jarryd); Specification.Title("Union()") .TestingOver <Contact>() .UsingBindableLinq(inputs => inputs.AsBindable().Union(additionalContacts.AsBindable())) .UsingStandardLinq(inputs => inputs.Union(additionalContacts)) .Scenario("Delayed evaluation", With.Inputs(Mike, Tom, Jack), step => Upon.Construction().ItWill.NotHaveEvaluated(), step => Upon.Evaluate().ItWill.HaveCount(6) ) .Scenario("Adding items", With.Inputs(Mike, Tom, Jack), step => Upon.Add(Rick, Mick).ItWill.NotRaiseAnything(), step => Upon.Evaluate().ItWill.NotRaiseAnything(), step => Upon.Add(Jarryd).ItWill.Raise(Add.With(Jarryd).At(8)), step => Upon.Add(Tom, Sally).ItWill.Raise(Add.With(Tom).At(9)).And.Raise(Add.With(Sally).At(10)), step => Upon.Insert(2, Simon).ItWill.Raise(Add.With(Simon).At(11)), step => Upon.Insert(3, Phil, Jake).ItWill.Raise(Add.With(Phil).At(12)).And.Raise(Add.With(Jake).At(13)), step => Upon.Evaluate().ItWill.NotRaiseAnything() ) .Verify(); }
public void AddToStringTest() { var exp = new Add(new Number(5), new Number(0)); Assert.Equal("5 + 0", exp.ToString(commoonFormatter)); }
public Ammo() { Weapon = Add.Label("100", "weapon"); Inventory = Add.Label("100", "inventory"); }
/// <summary> /// Inserts a document into the database for a given key, failing if it exists. /// </summary> /// <typeparam name="T">The Type of the value to be inserted.</typeparam> /// <param name="key">The unique key for indexing.</param> /// <param name="value">The value for the key.</param> /// <returns>An object implementing the <see cref="IOperationResult{T}"/>interface.</returns> public IOperationResult <T> Insert <T>(string key, T value) { var operation = new Add <T>(key, value, null, _converter, _transcoder); return(SendWithRetry(operation)); }
public static T add <T>(T x, T y) => Add <T> .Apply(x, y);
public static Action <int> AddAndPrintResult(int x) => y => PrintAddResult(x)(y)(Add(x)(y));
public SearchList() { InitializeComponent(); this.OneWayBind(ViewModel, x => x.IsRefreshing, x => x.ListView.IsRefreshing) .DisposeWith(PageBindings); this.Bind(ViewModel, x => x.SearchText, x => x.Search.Text) .DisposeWith(PageBindings); ListView .Events() .Refreshing .InvokeCommand(this, x => x.ViewModel.Refresh) .DisposeWith(PageBindings); ListView .Events() .ItemSelected .Subscribe(item => { ListView.SelectedItem = null; }) .DisposeWith(PageBindings); Add.Events() .Pressed .InvokeCommand(this, x => x.ViewModel.Add) .DisposeWith(PageBindings); this.WhenAnyValue(x => x.ViewModel.Items) .Where(x => x != null) .BindTo(this, x => x.ListView.ItemsSource) .DisposeWith(PageBindings); Interactions .AddItem .RegisterHandler(context => { // HACK: [rlittlesii: July 03, 2020] // This is why "service location is an anti-pattern". // Because it allows developers to implement bad patterns. // Service Location is a tool that can be abused, not a pattern! // HACK: [rlittlesii: July 03, 2020] ListView.NewItem confirmationPage = (ListView.NewItem)Locator.Current.GetService <IViewFor <NewItemViewModel> >(); PopupNavigation .Instance .PushAsync(confirmationPage) .ToObservable() .ObserveOn(RxApp.MainThreadScheduler) .ForkJoin( confirmationPage .Events() .Disappearing .Take(1) .Select(x => Unit.Default), (_, __) => __) .Subscribe(result => { context.SetOutput(Unit.Default); }); }) .DisposeWith(PageBindings); }
public static int Add5(int y) => Add(5)(y);
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns> /// The result of analysis. /// </returns> /// <exception cref="System.NotSupportedException">Always.</exception> public virtual TResult Analyze(Add exp) { throw new NotSupportedException(); }
private void AddHandler(AutoStartEntry e) { Logger.Trace("AddHandler called"); Add?.Invoke(e); }
private void addButton_Click(object sender, EventArgs e) { Add?.Invoke(); }