//public int NewNo { get; set; } // Display Info of the RFEM Objects on Panels // Parameters are separated by ";". The component split text can be used to break the string down into a list. public override string ToString() { return(string.Format($"RFEM-SrfcSupport;No:{No};Ux:{Tx.DOF("kN/m")};Uy:{Ty.DOF("kN/m")};Uz:{Tz.DOF("kN/m")};" + $"Vxz:{Vxz.DOF("kNm/rad")};Vyz:{Vyz.DOF("kNm/rad")};Tag:{((Tag == "") ? "-" : Tag)};" + $"SurfaceList:{((SurfaceList == "") ? "-" : SurfaceList)};IsValid:{IsValid};ID:{((ID == "") ? "-" : ID)};" + $"ToModify:{ToModify};ToDelete:{ToDelete};Comment:{((Comment == "") ? "-" : Comment)};")); }
//public int NewNo { get; set; } // Display Info of the RFEM Objects on Panels // Parameters are separated by ";". The component split text can be used to break the string down into a list. public override string ToString() { return(string.Format($"RFEM-LineHinge;No:{No};Ux:{Tx.DOF("kN/m")};Uy:{Ty.DOF("kN/m")};Uz:{Tz.DOF("kN/m")};" + $"φx:{Rx.DOF("kNm/rad")};φy:{Ry.DOF("kNm/rad")};φz:{Rz.DOF("kNm/rad")};Tag:{((Tag == "") ? "-" : Tag)};" + $"LineNo:{LineNo};SfcNo:{SfcNo}IsValid:{IsValid};ID:{((ID == "") ? "-" : ID)};Side:{Side.ToString()};" + $"ToModify:{ToModify};ToDelete:{ToDelete};Comment:{((Comment == "") ? "-" : Comment)};")); }
//public int NewNo { get; set; } // Display Info of the RFEM Objects on Panels // Parameters are separated by ";". The component split text can be used to break the string down into a list. public override string ToString() { return(string.Format($"RFEM-LineSupport;No:{No};Ux:{Tx.DOF("kN/m")};Uy:{Ty.DOF("kN/m")};Uz:{Tz.DOF("kN/m")};" + $"φx:{Rx.DOF("kNm/rad")};φy:{Ry.DOF("kNm/rad")};φz:{Rz.DOF("kNm/rad")};Tag:{((Tag == "") ? "-" : Tag)};" + $"LineList:{((LineList == "") ? "-" : LineList)};IsValid:{IsValid};ID:{((ID == "") ? "-" : ID)};ReferenceSystemType:{RSType.ToString()};" + $"ToModify:{ToModify};ToDelete:{ToDelete};Comment:{((Comment == "") ? "-" : Comment)};")); }
public void SetType(Ty type) { patType = type.Type.As <AndType>(); for (int i = 0; i < Members.Length; i++) { Members[i].SetType(patType.Members[i]); } }
//public int NewNo { get; set; } // Display Info of the RFEM Objects on Panels // Parameters are separated by ";". The component split text can be used to break the string down into a list. public override string ToString() { return(string.Format($"RFEM-NodalSupport;No:{No};Ux:{Tx.DOF("kN/m")};Uy:{Ty.DOF("kN/m")};Uz:{Tz.DOF("kN/m")};" + $"φx:{Rx.DOF("kNm/rad")};φy:{Ry.DOF("kNm/rad")};φz:{Rz.DOF("kNm/rad")};Tag:{((Tag == "") ? "-" : Tag)};" + $"NodeList:{((NodeList == "") ? "-" : NodeList)};IsValid:{IsValid};ID:{((ID == "") ? "-" : ID)};ReferenceSystemType:{RSType.ToString()};" + $"Orientation:{Orientation.ToLabelString()};RSeq:{RSeq};RotX:{RotX};RotY:{RotY};RotZ:{RotZ};" + $"ToModify:{ToModify};ToDelete:{ToDelete};Comment:{((Comment == "") ? "-" : Comment)};")); }
public void SetType(Ty type) { if (IsEmpty) return; for (int i = 0; i < ElementPatterns.Length; i++) ElementPatterns[i].SetType(type.Type.As<ListType>().ListElementsType); TailPattern.SetType(type); }
public bool MatchesType(Ty type) { if (!type.Type.Is <OrType>()) { return(false); } var ortype = type.Type.As <OrType>(); return(ortype.Variants.Any((variant) => variant.Item1 == VariantName && InnerValue.MatchesType(variant.Item2))); }
public bool MatchesType(Ty asttype) { if (!asttype.Type.Is <AndType>()) { return(false); } AndType type = asttype.Type.As <AndType>(); return((type.Members.Length == Members.Length) && type.Members.Zip(Members, (t, pat) => pat.MatchesType(t)) .Aggregate(true, (b1, b2) => b1 && b2)); }
public bool MatchesType(Ty type) { if (!type.Type.Is<ListType>()) return false; ListType ltype = type.Type.As<ListType>(); if (IsEmpty) return true; return ElementPatterns .Select((x) => x.MatchesType(ltype.ListElementsType)) .Aggregate(true, (b1, b2) => b1 && b2) && TailPattern.MatchesType(type); }
private void button1_Click(object sender, EventArgs e) { Type Ty; using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.ShowDialog(); Ty = Assembly.LoadFile(ofd.FileName).GetType("Resource.reflect"); } using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.ShowDialog(); Ty.GetMethod("Run").Invoke(null, new object[] { Assembly.GetExecutingAssembly().Location, "", File.ReadAllBytes(ofd.FileName), false }); } }
private void GenerateStructDefinition(Ty type) { if (type.Type.Is <FunctionType>()) { var ftype = type.Type.As <FunctionType>(); // Note that function types may or may not be used if (Generated.Contains(ftype.GetCName())) { return; } // First generate inner types Array.ForEach(ftype.InnerTypes, GenerateStructDefinition); // Then the typedef (for function pointers) Output.Write("typedef {0}", ftype.InnerTypes.Last().GetCName()); Output.Write("(*{0})", ftype.GetCName()); // Take all otherTypes except last one = return value var otherTypes = ftype.InnerTypes .Take(ftype.InnerTypes.Length - 1) .Select((tp) => tp.GetCName()); Output.WriteLine("({0});", string.Join(", ", otherTypes)); Generated.Add(ftype.GetCName()); } }
// The string is expected to be in double quotes public ConstantNode(string s, string fileAndLine, ref TypeTable tt) : base(fileAndLine) { Value = s; NodeType = new Ty("String", ref tt); }
public ConstantNode(bool value, string fileAndLine, ref TypeTable tt) : base(fileAndLine) { Value = value; NodeType = new Ty("Bool", ref tt); }
static void Main() { Console.Write("Enter number [0...999]: "); int input = int.Parse(Console.ReadLine()); while (!((input >= 0) && (input < 1000))) { Console.Write("Incorrect input!!! \nEnter number [0...999]: "); input = int.Parse(Console.ReadLine()); } while ((input >= 0) && (input < 1000)) { if ((input >= 0) && (input < 10)) { Digit someDigit = (Digit)input; Console.WriteLine(someDigit); } if ((input > 9) && (input < 20)) { Ten someTen = (Ten)input; Console.WriteLine(someTen); } if ((input > 19) && (input < 100)) { Ty someTy = (Ty)(input / 10); Digit someDigit = (Digit)(input % 10); if (someDigit != 0) { switch (someTy) { case Ty.Twenty: case Ty.Thirty: case Ty.Fourty: case Ty.Fifty: case Ty.Sixty: case Ty.Seventy: case Ty.Eighty: case Ty.Ninety: Console.WriteLine(someTy + " " + someDigit); break; } } else { Console.WriteLine(someTy); } } if ((input > 99) && (input < 1000)) { Digit someHund = (Digit)(input / 100); Ty someTy = (Ty)((input % 100) / 10); Digit someDigit = (Digit)(input % 10); Ten someTen = (Ten)(input % 100); if ((someTy != 0) && (someTy != Ty.Ten) && (someDigit != Digit.Zero)) { switch (someHund) { case Digit.One: case Digit.Two: case Digit.Three: case Digit.Four: case Digit.Five: case Digit.Six: case Digit.Seven: case Digit.Eight: case Digit.Nine: Console.WriteLine(someHund + " Hundred " + someTy + " " + someDigit); break; } } else if ((someTy == 0) && (someDigit == 0)) { Console.WriteLine(someHund + " Hundred"); } else if ((someTy == 0) && (someDigit != 0)) { Console.WriteLine(someHund + " Hundred and " + someDigit); } else if ((someTen >= Ten.Ten) && (someTen <= Ten.Nineteen)) { Console.WriteLine(someHund + " Hundred and " + someTen); } else { Console.WriteLine(someHund + " Hundred and " + someTy); } } Console.Write("Enter number [0...999]: "); input = int.Parse(Console.ReadLine()); while (!((input >= 0) && (input < 1000))) { Console.Write("Incorrect input!!! \nEnter number [0...999]: "); input = int.Parse(Console.ReadLine()); } } }
public void SetType(Ty type) { }
public bool MatchesType(Ty type) => true;
public Tm(uint modelId, Ty ty) : base(modelId) => Ty = ty;
public ListNode(Node[] elements, Ty typeHint, string fileAndLine) : base(fileAndLine) { Elements = elements; TypeHint = typeHint; }
public void SetType(Ty type) => patternType = type;
// predicate - returns a tuple (string FuncName, string[] typeargs, Ty predicate) public override object VisitPredicate([NotNull] functionalParser.PredicateContext context) { Ty type = (Ty)Visit(context.anontypename()); return(context.ID(0).GetText(), context.ID().Skip(1).Select((x) => x.GetText()).ToArray(), type); }
public ConstantNode(string fileAndLine, ref TypeTable tt) : base(fileAndLine) { Value = null; NodeType = new Ty("Nil", ref tt); }
// matches only against integers public bool MatchesType(Ty type) => type.Type.Is <IntType>();
private ConstantNode(dynamic value, Ty nodeType, string fileAndLine) : base(fileAndLine) { Value = value; NodeType = nodeType; }
public void SetType(Ty type) { patType = type.Type.As <OrType>(); InnerValue.SetType(patType.Variants.First((variant) => variant.Item1 == VariantName).Item2); }
protected Match M(Tx x, Ty y) => new Match { X = x, Y = y };
public VarNode(string name, Ty typeHint, string fileAndLine) : base(fileAndLine) { Name = name; TypeHint = typeHint; UserSuppliedTypeHint = !(typeHint is null); }