public static bool RemoveAttribute(ICarriesAttributes obj, Func<QKeyValue, bool> cond) { QKeyValue curr = obj.Attributes; bool removed = false; while (curr != null && cond(curr)) { curr = curr.Next; removed = true; } obj.Attributes = curr; while (curr != null) { QKeyValue next = curr.Next; while (next != null && cond(next)) { next = next.Next; removed = true; } curr.Next = next; curr = next; } return removed; }
public static bool RemoveAttribute(ICarriesAttributes obj, Func <QKeyValue, bool> cond) { QKeyValue curr = obj.Attributes; bool removed = false; while (curr != null && cond(curr)) { curr = curr.Next; removed = true; } obj.Attributes = curr; while (curr != null) { QKeyValue next = curr.Next; while (next != null && cond(next)) { next = next.Next; removed = true; } curr.Next = next; curr = next; } return(removed); }
public static bool HasCivlAttribute(this ICarriesAttributes obj) { for (var kv = obj.Attributes; kv != null; kv = kv.Next) { if (CIVL_ATTRIBUTES.Contains(kv.Key) || LINEAR_ATTRIBUTES.Contains(kv.Key)) { return(true); } } return(false); }
public static List <QKeyValue> FindAllAttributes(this ICarriesAttributes obj, string name) { var attributes = new List <QKeyValue>(); for (var kv = obj.Attributes; kv != null; kv = kv.Next) { if (kv.Key == name) { attributes.Add(kv); } } return(attributes); }
public static HashSet <string> FindInstantiationHints(ICarriesAttributes o) { var labels = new HashSet <string>(); var iter = o.Attributes; while (iter != null) { if (iter.Key == "pool") { iter.Params.OfType <string>().Iter(x => labels.Add(x)); } iter = iter.Next; } return(labels); }
private void FindInstantiationSources(ICarriesAttributes o, string attrName) { var iter = o.Attributes; while (iter != null) { if (iter.Key == attrName) { var label = iter.Params[0] as string; var instance = iter.Params[1] as Expr; if (label != null && instance != null) { hasInstances = true; } } iter = iter.Next; } }
public static void RemoveLayerAttribute(ICarriesAttributes obj) { RemoveAttribute(obj, kv => kv.Key == LAYER); }
public static void RemoveLinearAttribute(ICarriesAttributes obj) { RemoveAttribute(obj, kv => kv.Key == LINEAR || kv.Key == LINEAR_IN || kv.Key == LINEAR_OUT); }
public static void RemoveYieldsAttribute(ICarriesAttributes obj) { RemoveAttribute(obj, kv => kv.Key == YIELDS); }
public static void RemoveMoverAttribute(ICarriesAttributes obj) { RemoveAttribute(obj, kv => kv.Key == ATOMIC || kv.Key == LEFT || kv.Key == RIGHT || kv.Key == BOTH); }
public static void RemoveLinearAttributes(ICarriesAttributes obj) { RemoveAttributes(obj, LINEAR_ATTRIBUTES); }
public static void RemoveAttributes(ICarriesAttributes obj, ICollection <string> keys) { RemoveAttributes(obj, kv => keys.Contains(kv.Key)); }
public static void RemoveCivlAttributes(ICarriesAttributes obj) { RemoveAttributes(obj, CIVL_ATTRIBUTES); }
public static void RemoveRefinesAttribute(ICarriesAttributes obj) { RemoveAttribute(obj, kv => kv.Key == REFINES); }
public static Dictionary <string, HashSet <VCExpr> > FindInstantiationSources(ICarriesAttributes o, string attrName, Boogie2VCExprTranslator exprTranslator) { var freshInstances = new Dictionary <string, HashSet <VCExpr> >(); var iter = o.Attributes; while (iter != null) { if (iter.Key == attrName) { var label = iter.Params[0] as string; var instance = iter.Params[1] as Expr; if (label != null && instance != null) { if (!freshInstances.ContainsKey(label)) { freshInstances[label] = new HashSet <VCExpr>(); } freshInstances[label].Add(exprTranslator.Translate(instance)); } } iter = iter.Next; } return(freshInstances); }
public static void RemoveWitnessAttribute(ICarriesAttributes obj) { RemoveAttribute(obj, kv => kv.Key == WITNESS); }
public static bool HasAttribute(this ICarriesAttributes obj, string attribute) { return(QKeyValue.FindBoolAttribute(obj.Attributes, attribute)); }