public void TwoSymetricGroupsAreIsomorphic() { IGroup group1 = new GeneratedGroup(Element.CreateSwap(4), Element.CreateRotation(4)); IGroup group2 = new GeneratedGroup(Element.CreateSwap(4, 2), Element.CreateRotation(4)); Assert.IsTrue(GroupUtilities.AreIsomorphic(group1, group2)); }
protected void Page_Load(object sender, EventArgs e) { GroupUtilities groupUtilities = new GroupUtilities(); ShowGroups(groupUtilities.GetGroups()); if (Request.HttpMethod == "POST") { string groupName = groupname.Value; if (!string.IsNullOrEmpty(groupName)) { if (!groupUtilities.VerifyGroupExists(groupName)) { string result = groupUtilities.InsertGroup(groupName); if (result == "Success") { toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("success", $"{groupName} Successfully Added.")); } } else { toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", $"{groupName} Already Exists!")); } } else { toastrUtilities.SessionPush("toast", new KeyValuePair <string, string>("error", "Please Enter Group Name.")); } } }
public ActionResult Edit(int id) { var context = new Context(); if (!Request.IsAjaxRequest()) { var log = new SysLogModel(context: context); var html = GroupUtilities.Editor( context: context, ss: SiteSettingsUtilities.GroupsSiteSettings(context: context), groupId: id, clearSessions: true); ViewBag.HtmlBody = html; log.Finish(context: context, responseSize: html.Length); return(View()); } else { var log = new SysLogModel(context: context); var json = GroupUtilities.EditorJson( context: context, ss: SiteSettingsUtilities.GroupsSiteSettings(context: context), groupId: id); log.Finish(context: context, responseSize: json.Length); return(Content(json)); } }
public void TwoGroupsGeneratedByTwoNonOverlappingSwapsAreIsomorphic() { IGroup group1 = new GeneratedGroup(Element.CreateSwap(4), Element.CreateSwap(4, 2)); IGroup group2 = new GeneratedGroup(Element.CreateSwap(6, 2), Element.CreateSwap(6, 4)); Assert.IsTrue(GroupUtilities.AreIsomorphic(group1, group2)); }
public void GetGroupsOfOrderFour() { NamedElement identity = new NamedElement('e'); NamedElement aelement = new NamedElement('a'); NamedElement belement = new NamedElement('b'); NamedElement celement = new NamedElement('c'); OperationTable table = new OperationTable(new List <IElement>() { identity, aelement, belement, celement }, true); IList <OperationTable> solutions = table.GetSolutions().ToList(); Assert.IsNotNull(solutions); Assert.AreEqual(4, solutions.Count); foreach (OperationTable solution in solutions) { Assert.IsTrue(solution.IsClosed); Assert.IsTrue(solution.IsCommutative); } IList <IGroup> groups = new List <IGroup>(); foreach (OperationTable ot in solutions) { groups.Add(new TableGroup(ot)); } IList <IGroup> dgroups = GroupUtilities.GetNonIsomorphic(groups); Assert.IsNotNull(dgroups); Assert.AreEqual(2, dgroups.Count); }
private static IList <IGroup> GetGroupsOfOrder(int order) { IList <IElement> elements = new List <IElement>(); for (int k = 0; k < order; k++) { elements.Add(new NamedElement(k)); } OperationTable table = new OperationTable(elements, true); IList <OperationTable> solutions = table.GetSolutions().ToList(); foreach (OperationTable solution in solutions) { Assert.IsTrue(solution.HasIdentity); Assert.IsTrue(solution.IsAssociative); Assert.IsTrue(solution.IsClosed); } IList <IGroup> groups = new List <IGroup>(); foreach (OperationTable ot in solutions) { groups.Add(new TableGroup(ot)); } IList <IGroup> dgroups = GroupUtilities.GetNonIsomorphic(groups); return(dgroups); }
public string SelectableMembers(int id) { var log = new SysLogModel(); var json = GroupUtilities.SelectableMembersJson(); return(json); }
public string SelectableMembers(Context context, int id) { var log = new SysLogModel(context: context); var json = GroupUtilities.SelectableMembersJson(context: context); return(json); }
public void GetSubnormalGroups() { IGroup group = new SymmetricGroup(3); IEnumerable <IGroup> normalsg = GroupUtilities.GetNormalSubgroups(group); Assert.IsTrue(normalsg.Count() >= 2); }
public void GroupsGeneratedByDiffSizedSwapsAreIsomorphic() { IGroup group1 = new GeneratedGroup(Element.CreateSwap(3)); IGroup group2 = new GeneratedGroup(Element.CreateSwap(4)); Assert.IsTrue(GroupUtilities.AreIsomorphic(group1, group2)); }
public void IdentityIsNormalSubgroup() { IGroup group = new SymmetricGroup(3); IGroup id = new GeneratedGroup(Element.CreateIdentity(3)); Assert.IsTrue(GroupUtilities.IsNormalSubgroup(id, group)); }
public static View GetBySession(Context context, SiteSettings ss, bool setSession = true) { var useUsersView = ss.SaveViewType == SiteSettings.SaveViewTypes.User; setSession = setSession && ss.SaveViewType != SiteSettings.SaveViewTypes.None; var view = !context.Ajax ? context.QueryStrings.Data("View")?.Deserialize <View>() : null; if (view != null) { SetSession( context: context, ss: ss, view: view, setSession: setSession, useUsersView: useUsersView); return(view); } if (context.Forms.ControlId() == "ViewSelector") { view = ss.Views ?.Where(o => o.Accessable(context: context)) .FirstOrDefault(o => o.Id == context.Forms.Int("ViewSelector")) ?? new View( context: context, ss: ss); SetSession( context: context, ss: ss, view: view, setSession: setSession, useUsersView: useUsersView); return(view); } var sessionData = useUsersView ? context.UserSessionData : context.SessionData; view = sessionData.Get("View")?.Deserialize <View>() ?? ss.Views?.Get(ss.GridView) ?? new View(); view.SetByForm( context: context, ss: ss); SetSession( context: context, ss: ss, view: view, setSession: setSession, useUsersView: useUsersView); switch (ss.ReferenceType) { case "Groups": view.AdditionalWhere = GroupUtilities.AdditionalWhere( context: context, view: view); break; } return(view); }
public string GridRows(Context context) { var log = new SysLogModel(context: context); var json = GroupUtilities.GridRows(context: context); log.Finish(context: context, responseSize: json.Length); return(json); }
public string GridRows() { var log = new SysLogModel(); var json = GroupUtilities.GridRows(); log.Finish(json.Length); return(json); }
public void MultiplyBeIdempotent() { IGroup group = new SymmetricGroup(3); IGroup group2 = GroupUtilities.Multiply(group, group); Assert.AreEqual(group.Order, group2.Order); }
public void GroupAndIdentityAreSubnormalGroups() { IGroup group = new SymmetricGroup(3); IGroup id = new GeneratedGroup(Element.CreateIdentity(3)); GroupUtilities.IsNormalSubgroup(group, group); GroupUtilities.IsNormalSubgroup(id, group); }
public void SwapsAreCyclic() { for (int k = 2; k <= 10; k++) { IGroup group = new GeneratedGroup(Element.CreateSwap(k)); Assert.IsTrue(GroupUtilities.IsCyclic(group)); } }
public void SymmetricAreNotCyclic() { for (int k = 3; k <= 5; k++) { IGroup group = new SymmetricGroup(k); Assert.IsFalse(GroupUtilities.IsCyclic(group)); } }
public void RotationsAreCyclic() { for (int k = 1; k <= 7; k++) { IGroup group = new GeneratedGroup(Element.CreateRotation(k)); Assert.IsTrue(GroupUtilities.IsCyclic(group)); } }
public bool ContainsDept(ServerScriptModelDeptModel dept) { return(GroupUtilities.Contains( context: Context, groupId: GroupId, dept: SiteInfo.Dept( tenantId: Context.TenantId, deptId: dept?.DeptId ?? 0))); }
public bool ContainsUser(ServerScriptModelUserModel user) { return(GroupUtilities.Contains( context: Context, groupId: GroupId, user: SiteInfo.User( context: Context, userId: user?.UserId ?? 0))); }
public void GroupsGeneratedByDiffPositionSwapsAreIsomorphic() { IElement swap1 = Element.CreateSwap(3); IElement swap2 = Element.CreateSwap(3, 1); IGroup group1 = new GeneratedGroup(swap1); IGroup group2 = new GeneratedGroup(swap2); Assert.IsTrue(GroupUtilities.AreIsomorphic(group1, group2)); }
public void GroupsGeneratedByDiffPositionSwapsAreNotEqual() { IElement swap1 = Element.CreateSwap(3); IElement swap2 = Element.CreateRotation(4).Multiply(Element.CreateSwap(4)); IGroup group1 = new GeneratedGroup(swap1); IGroup group2 = new GeneratedGroup(swap2); Assert.IsFalse(GroupUtilities.AreEqual(group1, group2)); }
public void GetSubgroupsOfCyclicGroupSeven() { IGroup group = new GeneratedGroup(Element.CreateRotation(7)); IEnumerable <IGroup> subgroups = GroupUtilities.GetSubgroups(group); Assert.IsNotNull(subgroups); Assert.AreEqual(2, subgroups.Count()); }
public void GetSubgroupsOfSymetricGroupFour() { IGroup group = new SymmetricGroup(4); IEnumerable <IGroup> subgroups = GroupUtilities.GetSubgroups(group); Assert.IsNotNull(subgroups); Assert.AreEqual(30, subgroups.Count()); }
public void GetSubgroupsOfMinimalGroup() { IGroup group = new SymmetricGroup(2); IEnumerable <IGroup> subgroups = GroupUtilities.GetSubgroups(group); Assert.IsNotNull(subgroups); Assert.AreEqual(2, subgroups.Count()); }
public string Create() { var log = new SysLogModel(); var json = GroupUtilities.Create( ss: SiteSettingsUtilities.GroupsSiteSettings()); log.Finish(json.Length); return(json); }
public bool ContainsDept(int deptId) { return(GroupUtilities.Contains( context: Context, groupId: GroupId, dept: SiteInfo.Dept( tenantId: Context.TenantId, deptId: deptId))); }
public bool ContainsUser(int userId) { return(GroupUtilities.Contains( context: Context, groupId: GroupId, user: SiteInfo.User( context: Context, userId: userId.ToInt()))); }
public void PrimeRotationGroupsAreEqual() { IElement elementrot = Element.CreateRotation(5); IElement elementrot2 = elementrot.Multiply(elementrot); IGroup group1 = new GeneratedGroup(elementrot); IGroup group2 = new GeneratedGroup(elementrot2); Assert.IsTrue(GroupUtilities.AreEqual(group1, group2)); }