public void getOrder(String factoryType) { if (factoryType.ToLower() == "waffle") { Console.WriteLine(waffleType + " order received."); WaffleFactory factory = new WaffleFactory(); waffle = factory.makeWaffle(waffleType); waffle.prepareDough(waffleType); waffle.cookDough(waffleType); waffle.dishUp(waffleType); waffle = decorate(chocoList, fruitList, condimentList); Console.WriteLine(waffle.getDescription() + " order completed."); Console.WriteLine("Cost: $" + waffle.cost()); } else if (factoryType.ToLower() == "beverage") { Console.WriteLine(beverageType + " order received."); BeverageFactory factory = new BeverageFactory(); beverage = factory.makeBeverage(beverageType); beverage.prepareBeverage(); Console.WriteLine(beverage.getDescription() + " order completed."); Console.WriteLine("Cost: $" + beverage.cost()); } Console.WriteLine(""); }
// <-- asynchronous code --> static async Task WeekendToDoAsync() { Task <Waffle> waffleTask = MakeWaffleAsync(); ReplyMum(); Waffle waffle = await waffleTask; }
public void WaffleExplode() { if (waffle != null && item != null & (item.IsCookie() || item.IsBreaker(item.type) || item.type == ITEM_TYPE.RAINBOW)) { AudioManager.instance.WaffleExplodeAudio(); board.CollectWaffle(waffle); GameObject prefab = null; if (waffle.type == WAFFLE_TYPE.WAFFLE_3) { prefab = Resources.Load(Configure.Waffle2()) as GameObject; waffle.gameObject.GetComponent <SpriteRenderer>().sprite = prefab.GetComponent <SpriteRenderer>().sprite; waffle.type = WAFFLE_TYPE.WAFFLE_2; } else if (waffle.type == WAFFLE_TYPE.WAFFLE_2) { prefab = Resources.Load(Configure.Waffle1()) as GameObject; waffle.gameObject.GetComponent <SpriteRenderer>().sprite = prefab.GetComponent <SpriteRenderer>().sprite; waffle.type = WAFFLE_TYPE.WAFFLE_1; } else if (waffle.type == WAFFLE_TYPE.WAFFLE_1) { Destroy(waffle.gameObject); waffle = null; } } }
public static string Description(this Waffle property) { if (property == null) { return("null property"); } return($"Waffle DepthX: {property.TotalDepthX:G3} DepthY: {property.TotalDepthY:G3} " + $"SpacingX: {property.SpacingX:G3} SpacingY: {property.SpacingY:G3} " + $"sWidthX: {property.StemWidthX:G3} sWidthY: {property.StemWidthY:G3} - {CheckGetMaterialName(property.Material)}"); }
/***************************************************/ private bool CreateObject(ISurfaceProperty property2d) { bool success = true; int retA = 0; string propertyName = property2d.Name;// property2d.CustomData[AdapterId].ToString(); ETABS2016.eShellType shellType = property2d.EtabsShellType(); if (property2d.GetType() == typeof(Waffle)) { Waffle waffleProperty = (Waffle)property2d; m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Waffle, shellType, property2d.Material.Name, waffleProperty.Thickness); retA = m_model.PropArea.SetSlabWaffle(propertyName, waffleProperty.TotalDepthX, waffleProperty.Thickness, waffleProperty.StemWidthX, waffleProperty.StemWidthX, waffleProperty.SpacingX, waffleProperty.SpacingY); } else if (property2d.GetType() == typeof(Ribbed)) { Ribbed ribbedProperty = (Ribbed)property2d; m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Ribbed, shellType, property2d.Material.Name, ribbedProperty.Thickness); retA = m_model.PropArea.SetSlabRibbed(propertyName, ribbedProperty.TotalDepth, ribbedProperty.Thickness, ribbedProperty.StemWidth, ribbedProperty.StemWidth, ribbedProperty.Spacing, (int)ribbedProperty.Direction); } else if (property2d.GetType() == typeof(LoadingPanelProperty)) { retA = m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Slab, shellType, property2d.Material.Name, 0); } else if (property2d.GetType() == typeof(ConstantThickness)) { ConstantThickness constantThickness = (ConstantThickness)property2d; if (constantThickness.PanelType == PanelType.Wall) { retA = m_model.PropArea.SetWall(propertyName, ETABS2016.eWallPropType.Specified, shellType, property2d.Material.Name, constantThickness.Thickness); } else { retA = m_model.PropArea.SetSlab(propertyName, ETABS2016.eSlabType.Slab, shellType, property2d.Material.Name, constantThickness.Thickness); } } if (property2d.HasModifiers()) { double[] modifier = property2d.Modifiers();//(double[])property2d.CustomData["Modifiers"]; m_model.PropArea.SetModifiers(propertyName, ref modifier); } if (retA != 0) { success = false; } return(success); }
public void IngredientDecoratorTest1() { Dessert aDessert = new Waffle(); Dessert copyOfADessert = aDessert; aDessert = new Chocolat(aDessert); Dessert bDessert = (aDessert as IngredientDecorator).RemoveIngredient(typeof(Chocolat)); Assert.AreEqual(copyOfADessert, bDessert); }
public void IngredientDecoratorTest2() { Dessert aDessert = new Waffle(); Dessert bDessert = new Chocolat(aDessert); Dessert cDessert = new Chantilly(bDessert); Dessert dessertWithoutChocolatIngredient = (cDessert as IngredientDecorator).RemoveIngredient(typeof(Chocolat)); //Assert.AreEqual(dessertWithoutChocolatIngredient, copyADessert); Assert.AreEqual((cDessert as IngredientDecorator).Component, aDessert); }
public void IngredientDecoratorTest3() { Dessert aDessert = new Waffle(); aDessert = new Chocolat(aDessert); Dessert cDessert = aDessert; aDessert = new Chantilly(aDessert); Dessert bDessert = (aDessert as IngredientDecorator).RemoveIngredient(typeof(Chantilly)); Assert.AreEqual(bDessert, cDessert); }
public Waffle decorate(String[] chocoList, String[] fruitList, String[] condimentList) { for (int i = 0; i < chocoList.Length; i++) { String choco = chocoList[i]; if (choco == "White") { waffle = new WhiteChocolate(waffle); } else if (choco == "Normal") { waffle = new MilkChocolate(waffle); } } for (int i = 0; i < fruitList.Length; i++) { String fruit = fruitList[i]; if (fruit == "Banana") { waffle = new Banana(waffle); } else if (fruit == "Strawberry") { waffle = new Strawberry(waffle); } else if (fruit == "Kiwi") { waffle = new Kiwi(waffle); } } for (int i = 0; i < condimentList.Length; i++) { String condiment = condimentList[i]; if (condiment == "Almond") { waffle = new Almond(waffle); } else if (condiment == "Coconut") { waffle = new Coconut(waffle); } else if (condiment == "Ice Cream") { waffle = new IceCream(waffle); } } return(waffle); }
public List <Product> Get_all_Products() { List <Product> result = new List <Product>(); List <Product> retrn = new List <Product>(); using (var context = new ShopReviewsdb()) { result = context.Products.Include(s => s.Shop).Include(r => r.Reviews).Include(a => a.Shop.Address).ToList <Product>(); } foreach (Product p in result) { var field = p.GetType().GetField("_entityWrapper"); if (field == null) { retrn.Add(p); } var wrapper = field.GetValue(p); var property = wrapper.GetType().GetProperty("IdentityType").GetValue(wrapper); var name = property.GetType().GetProperty("Name").GetValue(property); Product prod = null; if (name.ToString() == "IceCream") { prod = new IceCream(p); } if (name.ToString() == "FrozenYogurt") { prod = new FrozenYogurt(p); } if (name.ToString() == "Waffle") { prod = new Waffle(p); } if (name.ToString() == "FrenchCrape") { prod = new FrenchCrape(p); } if (name.ToString() == "Smoothie") { prod = new Smoothie(p); } prod.NutritinosValuesDictonary = new GetNutritions().GetProductNutritions(prod.NutritionalValues); retrn.Add(prod); } return(retrn); }
static void Main(string[] args) { IceCream iceCreamWithWaffle = new Waffle(); Console.WriteLine(iceCreamWithWaffle.GetDescription() + " " + iceCreamWithWaffle.CalcAmount() + " "); IceCream iceCreamWithCup = new Cup(); iceCreamWithCup = new Vanille(iceCreamWithCup); iceCreamWithCup = new HoneySauce(iceCreamWithCup); Console.WriteLine(iceCreamWithCup.GetDescription() + " " + iceCreamWithCup.CalcAmount() + " "); IceCream IceCreamOnPlate = new Chocolate(new BerrySauce(new HoneySauce(new Cup()))); Console.WriteLine(IceCreamOnPlate.GetDescription() + " " + IceCreamOnPlate.CalcAmount() + " "); Console.ReadKey(); }
public static double AverageThickness(Waffle property) { if (property.StemWidthX == 0 || property.SpacingX < property.StemWidthX || property.StemWidthY == 0 || property.SpacingY < property.StemWidthY || property.TotalDepthX < property.Thickness || property.TotalDepthY < property.Thickness) { Reflection.Compute.RecordError("Invalid Waffle slab, returning null."); return(double.NaN); } double avrageThicknessLowerX = (property.TotalDepthX - property.Thickness) * (property.StemWidthX / property.SpacingX); double avrageThicknessLowerY = (property.TotalDepthY - property.Thickness) * (property.StemWidthY / property.SpacingY); double theExtraVolume = Math.Min(property.TotalDepthX - property.Thickness, property.TotalDepthY - property.Thickness) * (property.StemWidthX * property.StemWidthY) / (property.SpacingX * property.SpacingY); return(property.Thickness + avrageThicknessLowerX + avrageThicknessLowerY - theExtraVolume); }
public void MakeMeAWaffle_WithFish_Retries() { //Arrange Mock <ICookingService> mock = new(); mock.SetupSequence(cookingService => cookingService.Create()) .Returns("Tuna Fish") .Returns("Cheese"); var cook = new WaffleCook(mock.Object); //Act Waffle waffle = cook.MakeMeAWaffle("Maple Syrup"); //Assert Assert.IsNotNull(waffle); Assert.AreEqual("Cheese", waffle.Stuff); mock.Verify(cookingService => cookingService.Create(), Times.Exactly(2)); }
public void MakeMeAWaffle2_WithValidTopping_CreatesWaffle() { //Arrange Mock <ICookingService> mock = new(); var returnValue = Guid.NewGuid().ToString(); mock.Setup(cookingService => cookingService.Create()) .Returns(returnValue); var cook = new WaffleCook(mock.Object); //Act Waffle waffle = cook.MakeMeAWaffle("Maple Syrup"); //Assert mock.VerifyAll(); Assert.IsNotNull(waffle); Assert.AreEqual(returnValue, waffle.Stuff); }
protected override void SolveInstance(IGH_DataAccess DA) { // --- Input var mesh = default(Mesh); var countX = default(int); var countY = default(int); var thickness = default(double); var plane = default(Plane); var deeper = default(double); var project = default(bool); var projectDistance = default(double); DA.GetData(0, ref mesh); DA.GetData(1, ref countX); DA.GetData(2, ref countY); DA.GetData(3, ref thickness); DA.GetData(4, ref plane); DA.GetData(5, ref deeper); DA.GetData(6, ref project); DA.GetData(7, ref projectDistance); // --- Execute var unit = DocumentTolerance(); var result = Waffle.Create(mesh, plane, thickness, deeper, countX, countY, unit, project, projectDistance); // --- Output DA.SetEnum2D(0, result.CurvesX); DA.SetEnum2D(1, result.CurvesY); DA.SetEnum1D(2, result.PlanesX); DA.SetEnum1D(3, result.PlanesY); }
public IceCream(Waffle waffle) { this.waffle = waffle; }
/***************************************************/ /*** Read Methods ***/ /***************************************************/ private List <ISurfaceProperty> ReadSurfaceProperty(List <string> ids = null) { List <ISurfaceProperty> propertyList = new List <ISurfaceProperty>(); Dictionary <string, IMaterialFragment> bhomMaterials = ReadMaterial().ToDictionary(x => GetAdapterId <string>(x)); int nameCount = 0; string[] nameArr = { }; m_model.PropArea.GetNameList(ref nameCount, ref nameArr); ids = FilterIds(ids, nameArr); foreach (string id in ids) { eSlabType slabType = eSlabType.Slab; eShellType shellType = eShellType.ShellThin; eWallPropType wallType = eWallPropType.Specified; string material = ""; double thickness = 0; int colour = 0; string notes = ""; string guid = null; double depth = 0; double stemWidthTop = 0; double stemWidthBottom = 0;//not used double ribSpacing = 0; double ribSpacing2nd = 0; int direction = 0; double[] modifiers = new double[] { }; int ret = m_model.PropArea.GetSlab(id, ref slabType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); if (ret != 0) { m_model.PropArea.GetWall(id, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); } SurfacePropertyModifier modifier = null; if (m_model.PropArea.GetModifiers(id, ref modifiers) == 0 && modifiers != null && modifiers.Length == 10 && modifiers.Any(x => x != 1)) { modifier = new SurfacePropertyModifier { FXX = modifiers[0], FYY = modifiers[1], FXY = modifiers[2], MXX = modifiers[3], MYY = modifiers[4], MXY = modifiers[5], VXZ = modifiers[6], VYZ = modifiers[7], Mass = modifiers[8], Weight = modifiers[9] }; } IMaterialFragment bhMaterial = null; try { bhMaterial = bhomMaterials[material]; } catch (Exception) { Engine.Base.Compute.RecordNote("Could not get material from ETABS. Material for surface property " + id + " will be null"); } if (wallType == eWallPropType.AutoSelectList) { string[] propList = null; string currentProperty = ""; m_model.PropArea.GetWallAutoSelectList(id, ref propList, ref currentProperty); m_model.PropArea.GetWall(currentProperty, ref wallType, ref shellType, ref material, ref thickness, ref colour, ref notes, ref guid); ConstantThickness panelConstant = new ConstantThickness(); panelConstant.Name = currentProperty; panelConstant.Material = bhMaterial; panelConstant.Thickness = thickness; panelConstant.PanelType = PanelType.Wall; SetShellType(panelConstant, shellType); if (modifier != null) { panelConstant.Fragments.Add(modifier); } SetAdapterId(panelConstant, id); propertyList.Add(panelConstant); } else { switch (slabType) { case eSlabType.Ribbed: Ribbed panelRibbed = new Ribbed(); m_model.PropArea.GetSlabRibbed(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref direction); panelRibbed.Name = id; panelRibbed.Material = bhMaterial; panelRibbed.Thickness = thickness; panelRibbed.PanelType = PanelType.Slab; panelRibbed.Direction = (PanelDirection)direction; panelRibbed.Spacing = ribSpacing; panelRibbed.StemWidth = stemWidthTop; panelRibbed.TotalDepth = depth; SetShellType(panelRibbed, shellType); if (modifier != null) { panelRibbed.Fragments.Add(modifier); } SetAdapterId(panelRibbed, id); propertyList.Add(panelRibbed); break; case eSlabType.Waffle: Waffle panelWaffle = new Waffle(); m_model.PropArea.GetSlabWaffle(id, ref depth, ref thickness, ref stemWidthTop, ref stemWidthBottom, ref ribSpacing, ref ribSpacing2nd); panelWaffle.Name = id; panelWaffle.Material = bhMaterial; panelWaffle.SpacingX = ribSpacing; panelWaffle.SpacingY = ribSpacing2nd; panelWaffle.StemWidthX = stemWidthTop; panelWaffle.StemWidthY = stemWidthTop; //ETABS does not appear to support direction dependent stem width panelWaffle.Thickness = thickness; panelWaffle.TotalDepthX = depth; panelWaffle.TotalDepthY = depth; // ETABS does not appear to to support direction dependent depth panelWaffle.PanelType = PanelType.Slab; SetShellType(panelWaffle, shellType); if (modifier != null) { panelWaffle.Fragments.Add(modifier); } SetAdapterId(panelWaffle, id); propertyList.Add(panelWaffle); break; case eSlabType.Slab: case eSlabType.Drop: case eSlabType.Stiff_DO_NOT_USE: default: ConstantThickness panelConstant = new ConstantThickness(); panelConstant.Name = id; panelConstant.Material = bhMaterial; panelConstant.Thickness = thickness; panelConstant.Name = id; panelConstant.PanelType = PanelType.Slab; SetShellType(panelConstant, shellType); if (modifier != null) { panelConstant.Fragments.Add(modifier); } SetAdapterId(panelConstant, id); propertyList.Add(panelConstant); break; } } } return(propertyList); }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static ISurfaceProperty FromRFEM(this rf.SurfaceStiffness rfStiffness, IMaterialFragment material) { ISurfaceProperty surfaceProperty = null; switch (rfStiffness.Type) { case rf.OrthotropyType.ConstantThickness: surfaceProperty = new ConstantThickness { Thickness = rfStiffness.Thickness, Material = material }; break; case rf.OrthotropyType.UnidirectionalRibbedPlate: surfaceProperty = new Ribbed { Thickness = rfStiffness.Thickness, TotalDepth = rfStiffness.GeometricProperties.Height, Spacing = rfStiffness.GeometricProperties.Spacing, StemWidth = rfStiffness.GeometricProperties.Width, Material = material }; break; case rf.OrthotropyType.BidirectionalRibbedPlate: surfaceProperty = new Waffle { Thickness = rfStiffness.Thickness, TotalDepthX = rfStiffness.GeometricProperties.HeightX, TotalDepthY = rfStiffness.GeometricProperties.HeightY, SpacingX = rfStiffness.GeometricProperties.SpacingX, SpacingY = rfStiffness.GeometricProperties.SpacingY, StemWidthX = rfStiffness.GeometricProperties.WidthX, StemWidthY = rfStiffness.GeometricProperties.WidthY }; break; case rf.OrthotropyType.UnknownOrthotropyType: case rf.OrthotropyType.EffectiveThickness: case rf.OrthotropyType.DefinedByStiffnessMatrix: case rf.OrthotropyType.Coupling: case rf.OrthotropyType.TrapezoidalSheet: case rf.OrthotropyType.HollowCoreSlab: case rf.OrthotropyType.Grillage: case rf.OrthotropyType.UnidirectionalBoxFloor: case rf.OrthotropyType.Glass: case rf.OrthotropyType.Laminate: surfaceProperty = new ConstantThickness { Thickness = rfStiffness.Thickness, Material = material }; Engine.Base.Compute.RecordError("could not create surface property for " + rfStiffness.ID); break; default: surfaceProperty = new ConstantThickness { Thickness = rfStiffness.Thickness, Material = material }; Engine.Base.Compute.RecordError("could not create surface property for " + rfStiffness.ID); break; } surfaceProperty.SetAdapterId(typeof(RFEMId), rfStiffness.No); return(surfaceProperty); }
public Kiwi(Waffle waffle) { this.waffle = waffle; }
/***************************************************/ public static string Description(this Waffle property) { return("Waffle DepthX: " + property.TotalDepthX + " DepthY: " + property.TotalDepthY + " SpacingX: " + property.SpacingX + " SpacingY: " + property.SpacingY + " sWidthX: " + property.StemWidthX + " sWidthY: " + property.StemWidthY + " - " + CheckGetMaterialName(property.Material)); }
public WhiteChocolate(Waffle waffle) { this.waffle = waffle; }
public Almond(Waffle waffle) { this.waffle = waffle; }
/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static rf.SurfaceStiffness ToRFEM(this ISurfaceProperty surfaceProperty) { rf.SurfaceStiffness stiffness = new rf.SurfaceStiffness(); if (surfaceProperty is LoadingPanelProperty) { Engine.Base.Compute.RecordWarning("sorry, Can't do loding panels"); } else { if (surfaceProperty is ConstantThickness) { ConstantThickness constantThickness = surfaceProperty as ConstantThickness; stiffness.Type = rf.OrthotropyType.ConstantThickness; stiffness.Thickness = constantThickness.Thickness; stiffness.MultiplicationFactors.K = 1.0; stiffness.MultiplicationFactors.K33 = 1.0; stiffness.MultiplicationFactors.K44 = 1.0; stiffness.MultiplicationFactors.K55 = 1.0; stiffness.MultiplicationFactors.Kb = 1.0; stiffness.MultiplicationFactors.Ke = 1.0; stiffness.MultiplicationFactors.Km = 1.0; stiffness.MultiplicationFactors.Ks = 1.0; } else if (surfaceProperty is Ribbed) { Ribbed prop = surfaceProperty as Ribbed; stiffness.Type = rf.OrthotropyType.UnidirectionalRibbedPlate; stiffness.Thickness = prop.Thickness; stiffness.GeometricProperties.Height = prop.TotalDepth; stiffness.GeometricProperties.Spacing = prop.Spacing; stiffness.GeometricProperties.Width = prop.StemWidth; stiffness.GeometricProperties.Thickness = prop.Thickness; stiffness.MultiplicationFactors.K = 1.0; stiffness.MultiplicationFactors.K33 = 1.0; stiffness.MultiplicationFactors.K44 = 1.0; stiffness.MultiplicationFactors.K55 = 1.0; stiffness.MultiplicationFactors.Kb = 1.0; stiffness.MultiplicationFactors.Ke = 1.0; stiffness.MultiplicationFactors.Km = 1.0; stiffness.MultiplicationFactors.Ks = 1.0; } else if (surfaceProperty is Waffle) { Waffle prop = surfaceProperty as Waffle; stiffness.Type = rf.OrthotropyType.BidirectionalRibbedPlate; stiffness.Thickness = prop.Thickness; stiffness.GeometricProperties.HeightX = prop.TotalDepthX; stiffness.GeometricProperties.HeightY = prop.TotalDepthY; stiffness.GeometricProperties.SpacingX = prop.SpacingX; stiffness.GeometricProperties.SpacingY = prop.SpacingY; stiffness.GeometricProperties.WidthX = prop.StemWidthX; stiffness.GeometricProperties.WidthY = prop.StemWidthY; stiffness.GeometricProperties.Thickness = prop.Thickness; stiffness.MultiplicationFactors.K = 1.0; stiffness.MultiplicationFactors.K33 = 1.0; stiffness.MultiplicationFactors.K44 = 1.0; stiffness.MultiplicationFactors.K55 = 1.0; stiffness.MultiplicationFactors.Kb = 1.0; stiffness.MultiplicationFactors.Ke = 1.0; stiffness.MultiplicationFactors.Km = 1.0; stiffness.MultiplicationFactors.Ks = 1.0; } else { Engine.Base.Compute.RecordWarning("my responses are limited. I don't know: " + surfaceProperty.Name); } } return(stiffness); }
/***************************************************/ private IFGeometricSurface CreateSurfraceProfile(Waffle waffle, string lusasName) { Engine.Base.Compute.RecordError("Waffle not supported in Lusas_Toolkit"); return(null); }
public static double MassPerArea(this Waffle ribbedProperty) { throw new NotImplementedException(); }
public Coconut(Waffle waffle) { this.waffle = waffle; }
// <-- synchronous code --> static void WeekendToDo() { Waffle waffle = MakeWaffle(); ReplyMum(); }
public Banana(Waffle waffle) { this.waffle = waffle; }
public Strawberry(Waffle waffle) { this.waffle = waffle; }
public MilkChocolate(Waffle waffle) { this.waffle = waffle; }