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)); } }
private Label insertPolicy(Label lbl, JoinLabel join) { if (lbl is PolicyLabel) { return(insertPolicy(join, lbl as PolicyLabel) ?? new JoinLabel(lbl, join)); } else { return(new JoinLabel(lbl, join)); } }
private bool contains(JoinLabel join, Label lbl) { if (join == null) { return(false); } if (join.Label1.Equals(lbl)) { return(true); } if (join.Label2.Equals(lbl)) { return(true); } if (contains(join.Label1 as JoinLabel, lbl) || contains(join.Label2 as JoinLabel, lbl)) { return(true); } return(false); }
public bool Equals(JoinLabel label) => ArrayEquatable.Equals(flatten(), label.flatten());