/// <summary> /// Relation Input Pattern Match /// </summary> /// <param name="expr"></param> /// <param name="dict"></param> /// <param name="output"></param> /// <returns></returns> private bool EvalExprPatterns(Expr expr, Dictionary <PatternEnum, object> dict, out object output) { output = null; if (dict.Values.Count == 0) { return(false); } List <object> objs = dict.Values.ToList(); //convert shapesymbol to shape var lst = new List <object>(); foreach (object obj in objs) { var shapeSymbol = obj as ShapeSymbol; var eqGoal = obj as EqGoal; bool relExist; if (shapeSymbol != null) { relExist = RelationGraph.RelationExist(shapeSymbol); if (relExist) { lst.Add(obj); } } if (eqGoal != null) { relExist = RelationGraph.RelationExist(eqGoal); if (relExist) { lst.Add(obj); } } } if (lst.Count == 0) { output = dict.Values.ToList()[0]; return(true); } if (lst.Count == 1) { output = lst[0]; return(true); } if (lst.Count != 0) { //TODO Non-deterministic selection output = lst[0]; } return(true); }
private void InternalValidate(Expr expr, ShapeSymbol ss, out object output) { output = false; foreach (var gn in RelationGraph.Nodes) { var sn = gn as ShapeNode; if (sn == null) { continue; } bool result = sn.ShapeSymbol.ApproximateMatch(ss); if (result) { output = true; return; } } output = RelationGraph.RelationExist(ss); }