public static bool SpecificCompare(hloc_constraint a, hloc_constraint b) { if ((a.constraint == c_.Specific) && (b.constraint == c_.Specific)) { return(a.specific.Equals(b.specific)); } return(false); }
public static bool IsAssignableTo(hloc_constraint dest, hloc_constraint src) { if (dest.constraint == c_.Any) { return(true); } if ((dest.constraint == c_.None) && (src.constraint == c_.None)) { return(true); } if ((dest.constraint == c_.Immediate) && (src.constraint == c_.Immediate)) { return(true); } if ((dest.constraint == c_.Specific) && (src.constraint == c_.Specific)) { if (SpecificCompare(src, dest)) { return(true); } return(false); } if (dest.constraint == c_.List) { foreach (hloc_constraint d_item in dest.specific_list) { if (IsAssignableTo(d_item, src)) { return(true); } } return(false); } if (dest.constraint == c_.AnyOfType) { if (src.specific.GetType() == dest.specific.GetType()) { return(true); } return(false); } if (dest.constraint != src.constraint) { return(false); } throw new NotImplementedException(); }