Example #1
0
            private Label insertPolicy(JoinLabel join, PolicyLabel lbl)
            {
                if (join.Label2 is PolicyLabel)
                {
                    return(new JoinLabel(join.Label1, join.Label2 as PolicyLabel + lbl));
                }
                if (join.Label1 is PolicyLabel)
                {
                    return(new JoinLabel(join.Label1 as PolicyLabel + lbl, join.Label2));
                }

                Label l1 = null, l2 = null;

                if (join.Label2 is JoinLabel)
                {
                    l2 = insertPolicy(join.Label2 as JoinLabel, lbl);
                }
                if (l2 == null && join.Label1 is JoinLabel)
                {
                    l1 = insertPolicy(join.Label1 as JoinLabel, lbl);
                }

                if (l1 == null && l2 == null)
                {
                    return(null);
                }
                else if (l1 == null)
                {
                    return(new JoinLabel(join.Label1, l2));
                }
                else
                {
                    return(new JoinLabel(l1, join.Label2));
                }
            }
Example #2
0
            private Label insertPolicy(MeetLabel meet, PolicyLabel lbl)
            {
                if (meet.Label2 is PolicyLabel)
                {
                    return(new MeetLabel(meet.Label1, meet.Label2 as PolicyLabel + lbl));
                }
                if (meet.Label1 is PolicyLabel)
                {
                    return(new MeetLabel(meet.Label1 as PolicyLabel + lbl, meet.Label2));
                }

                Label l1 = null, l2 = null;

                if (meet.Label2 is MeetLabel)
                {
                    l2 = insertPolicy(meet.Label2 as MeetLabel, lbl);
                }
                if (l2 == null && meet.Label1 is MeetLabel)
                {
                    l1 = insertPolicy(meet.Label1 as MeetLabel, lbl);
                }

                if (l1 == null && l2 == null)
                {
                    return(null);
                }
                else if (l1 == null)
                {
                    return(new MeetLabel(meet.Label1, l2));
                }
                else
                {
                    return(new MeetLabel(l1, meet.Label2));
                }
            }
Example #3
0
            private bool policies(PolicyLabel l1, PolicyLabel l2)
            {
                foreach (var o in l1.Owners())
                {
                    if (!l2.Owners().Contains(o))
                    {
                        return(false);
                    }

                    foreach (var r in l2.Readers(o))
                    {
                        if (!l1.Readers(o).Contains(r))
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }