public IFormType BuildForm(ITypeEnvironment env) { IFormType a = Expr1.BuildForm(env); IFormType b = Expr2.BuildForm(env); IFormType type = a.GetLeastUpperBound(b); return(type); }
public bool IsChildOf(IFormType other) { if (SuperType != null && (SuperType.Equals(other) || SuperType.IsChildOf(other))) { return true; } return false; }
public bool IsChildOf(IFormType other) { if (SuperType != null && (SuperType.Equals(other) || SuperType.IsChildOf(other))) { return(true); } return(false); }
public IFormType GetLeastUpperBound(IFormType other) { if (Equals(other) || other.IsChildOf(this)) { return this; } else if (IsChildOf(other)) { return other; } Debug.Assert(SuperType != null, "SuperType is null!"); return SuperType.GetLeastUpperBound(other); }
public IFormType GetLeastUpperBound(IFormType other) { if (Equals(other) || other.IsChildOf(this)) { return(this); } else if (IsChildOf(other)) { return(other); } Debug.Assert(SuperType != null, "SuperType is null!"); return(SuperType.GetLeastUpperBound(other)); }
static void Main(string[] args) { string count; do { Console.WriteLine("enter any of the below options"); Console.WriteLine("register"); Console.WriteLine("login"); Console.WriteLine("forgot password"); string option = Console.ReadLine(); // reads the input from the user. TypeFactory typeFactoryObj = new TypeFactory(); IFormType formType = typeFactoryObj.getType(option); // gets the type as per user request. Console.WriteLine(formType.GetDetails()); // gets the details of user. Console.WriteLine("Do you want to continue?(y/n)"); count = Console.ReadLine(); }while (count == "y"); }
public void FormType() { int input; do { // displaying the menu. Console.WriteLine("login : Press 1"); Console.WriteLine("Forgot password?: Press 2"); Console.WriteLine("Register: Press 3"); input = Convert.ToInt32(Console.ReadLine()); string username = string.Empty; string password = string.Empty; TypeFactory typeFactoryObj = new TypeFactory(); IFormType authObj = typeFactoryObj.getType(); switch (input) { // case for login. case 1: Console.WriteLine("Username:"******"Password:"******"Login successful"); } else { Console.WriteLine("Login Unsuccessful"); } break; case 2: // case for Forgot Password. Console.WriteLine("Username:"******"enter a new password"); password = Console.ReadLine(); authObj.ResetPassword(username, password); Console.WriteLine("Password updated successfully!"); break; case 3: // case for Registration. Console.WriteLine("Username:"******"Password"); password = Console.ReadLine(); authObj.Registration(username, password); Console.WriteLine("registration sucessful"); break; default: break; } } while (input <= 3); // Input invalid. if (input > 3) { Console.WriteLine("invalid option entry."); Console.ReadLine(); } }