private static PathImpl.Builder ToBuilder(Node startNode, LinkedList <Relationship> rels) { PathImpl.Builder builder = new PathImpl.Builder(startNode); foreach (Relationship rel in rels) { builder = builder.Push(rel); } return(builder); }
// Syntax: makePathWithRelProperty( "weight", "a-4-b-2.3-c-3-d" ) public virtual Path MakePathWithRelProperty(string relPropertyName, string dashSeparatedNodeNamesAndRelationshipProperty) { string[] nodeNamesAndRelationshipProperties = dashSeparatedNodeNamesAndRelationshipProperty.Split("-", true); Node startNode = GetNode(nodeNamesAndRelationshipProperties[0], true); PathImpl.Builder builder = new PathImpl.Builder(startNode); if (nodeNamesAndRelationshipProperties.Length < 1) { return(builder.Build()); } for (int i = 0; i < nodeNamesAndRelationshipProperties.Length - 2; i += 2) { string from = nodeNamesAndRelationshipProperties[i]; string to = nodeNamesAndRelationshipProperties[i + 2]; string prop = nodeNamesAndRelationshipProperties[i + 1]; Relationship relationship = MakeEdge(from, to, relPropertyName, prop); builder = builder.Push(relationship); } return(builder.Build()); }