public Relation(Relation r,Element e1,int x,int y) { this.e1 = e1; this.r1 = r; this.coordinate.X = x; this.coordinate.Y = y; }
public void SetRelationParametrs(int number, Relation r) { ms.SetRelationParametrs(number, r); }
public void AddRelation(Relation r) { ms.AddRelation(r); }
public void AddRelation(Relation r) { relations.Add(r); // клонировать? }
public string getOut(Element[] input) { this.input = input; List <Element> agentsLayerOut = new List <Element>(); for (int i = 0; i < input.Length; i++) { for (int j = 0; j < agents.Count; j++) { if (agents[j].getOut(input[i])) { agentsLayerOut.Add(agents[j].getSpecializationElement()); break; } } } if (agentsLayerOut.Count != input.Length) { return(CheckResult(input)); } Relation relation_buffer = null; int elements_counter = 0; char result = '-'; int k = 0; // вообще не уверен в этом алгоритме while (result == '-' && k < relations.Count) { if (relation_buffer == null) { try { if (relations[k].checkElement(agentsLayerOut[elements_counter], agentsLayerOut[elements_counter + 1])) { relation_buffer = relations[k]; // клонировать? elements_counter += 2; if ((result = relations[k].checkChar()) == '-') { k = 0; } } } catch (Exception e) { if (relations[k].checkElement(agentsLayerOut[elements_counter], null)) { relation_buffer = relations[k]; // клонировать? elements_counter += 2; if ((result = relations[k].checkChar()) == '-') { k = 0; } } } } else { if (relations[k].checkRelation(relation_buffer, agentsLayerOut[elements_counter])) { relation_buffer = relations[k]; // клонировать? elements_counter++; if ((result = relations[k].checkChar()) == '-') { k = 0; } } } k++; } return(result.ToString()); }
public void SetRelationParametrs(int number, Relation r) { relations[number].Specialization_Char = r.Specialization_Char; relations[number].setFinal(r.isFinal()); }
public bool checkRelation(Relation r, Element e) { if (this.r1 == null || this.e1 == null) return false; if (this.r1.Equals(r)) if (this.e1.Equals(e)) { end_flag = true; return true; } return false; }
private char FindRelations(Relation rel, List<Element> el) { char result = '-'; List<Relation> possibleRelations = new List<Relation>(); for (int j = 0; j < el.Count; j++) { for (int k = 0; k < relations.Count; k++) { if (relations[k].itRel()) { if (relations[k].checkRelation(rel, el[j])) { if ((result = relations[k].checkChar()) == '-') result = FindRelations(relations[k], el); } } } } return result; }