/// <summary> /// Sets a property value /// </summary> /// <param name="vertexId">Id of <see cref="Vertex"/> for which to set property value</param> /// <param name="propertyType">The type of property to set</param> /// <param name="v">the value to set the property to</param> public void SetPropertyValue(VertexId vertexId, PropertyType propertyType, IComparable v) { propertyType.SetPropertyValue(vertexId, m_typeId, v); }
int CalculateTotalTo(Vertex supplier, EdgeType supplierWarehouseEdgeType, EdgeType moveToEdgeType, PropertyType howManyProperty, Vertex toVertex) { int total = 0; HashSet<Vertex> excludeSet = new HashSet<Vertex>(); HashSet<EdgeType> edgeTypesToTraverse = new HashSet<EdgeType>(); edgeTypesToTraverse.Add(moveToEdgeType); foreach (IEdge wareHouseEdge in supplier.GetEdges(supplierWarehouseEdgeType, Direction.Out)) { Vertex supplierWareHouse = (Vertex)wareHouseEdge.GetVertex(Direction.In); var allPaths = supplierWareHouse.Traverse(10, true, Direction.Out, toVertex, edgeTypesToTraverse, null, null, null, excludeSet); foreach (List<Edge> path in allPaths) { if (path.Count > 0) total += (int)path.Last().GetProperty(howManyProperty); // last because that is all we care about in this simplified sample foreach (Edge edge in path) { excludeSet.Add(edge.Tail); } } } return total; }
/// <summary> /// Get the property value for a <see cref="Vertex"/> /// </summary> /// <param name="vertexId">Id of <see cref="Vertex"/></param> /// <param name="propertyType">Type of property</param> /// <returns></returns> public object GetPropertyValue(VertexId vertexId, PropertyType propertyType) { return propertyType.GetPropertyValue(vertexId); }