Example #1
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 #2
0
 private Label insertPolicy(Label lbl, MeetLabel meet)
 {
     if (lbl is PolicyLabel)
     {
         return(insertPolicy(meet, lbl as PolicyLabel) ?? new MeetLabel(lbl, meet));
     }
     else
     {
         return(new MeetLabel(lbl, meet));
     }
 }
Example #3
0
            private bool contains(MeetLabel meet, Label lbl)
            {
                if (meet == null)
                {
                    return(false);
                }

                if (meet.Label1.Equals(lbl))
                {
                    return(true);
                }
                if (meet.Label2.Equals(lbl))
                {
                    return(true);
                }

                if (contains(meet.Label1 as MeetLabel, lbl) || contains(meet.Label2 as MeetLabel, lbl))
                {
                    return(true);
                }

                return(false);
            }