public HashSet <string> InstanceNames(INamedTypeDefinition type) { Contract.Requires(type != null); Contract.Ensures(Contract.Result <HashSet <string> >() != null); Contract.Ensures((!InstanceExpressions.ContainsKey(type)).Implies(Contract.Result <HashSet <string> >().Count == 0)); Contract.Ensures(Contract.ForAll(Contract.Result <HashSet <string> >(), n => NameTable.ContainsValue(n))); return(InstanceExpressions.ContainsKey(type) ? new HashSet <string>(InstanceExpressions[type].Select(x => NameTable[x])) : new HashSet <string>()); }
public HashSet <string> InstanceNames() { Contract.Ensures(Contract.Result <HashSet <string> >() != null); Contract.Ensures(Contract.ForAll(Contract.Result <HashSet <string> >(), n => NameTable.ContainsValue(n))); HashSet <string> result = new HashSet <string>(); foreach (var typeRef in InstanceExpressions.Keys) { if (typeRef is INamedTypeDefinition) { result.UnionWith(InstanceNames((INamedTypeDefinition)typeRef)); } } return(result); }
public HashSet <string> NamesForType(ITypeReference type, HashSet <IExpression> exprs) { Contract.Requires(type != null); Contract.Requires(exprs != null); Contract.Requires(InstanceExpressions.ContainsKey(type)); Contract.Ensures(Contract.ForAll(Contract.Result <HashSet <string> >(), n => NameTable.ContainsValue(n))); return(new HashSet <string>(Names(InstanceExpressions[type].Intersect(exprs)))); }
public HashSet <string> ThisNames() { Contract.Ensures(Contract.Result <HashSet <string> >() != null); Contract.Ensures(Contract.ForAll(Contract.Result <HashSet <string> >(), n => NameTable.ContainsValue(n))); return(InstanceNames(Type)); }
public IEnumerable <string> Names(IEnumerable <IExpression> exprs) { Contract.Requires(exprs != null); Contract.Ensures(Contract.ForAll(Contract.Result <IEnumerable <string> >(), n => NameTable.ContainsValue(n))); foreach (var e in exprs) { if (NameTable.ContainsKey(e)) { yield return(NameTable[e]); } } }