public bool Remove(IEntity entity) { entity = entity.MustNotBeNull(nameof(entity)); switch (entity) { case Node node: if (node.Equals(HomeNode)) { HomeNode = null; } return(Nodes.Remove(node)); case Reflector reflector: return(Reflectors.Remove(reflector)); case Obstacle obstacle: return(Obstacles.Remove(obstacle)); case StorageRow storageRow: return(StorageRows.Remove(storageRow)); case StorageLocation storageLocation: return(StorageLocations.Remove(storageLocation)); case VirtualPoint virtualPoint: return(VirtualPoints.Remove(virtualPoint)); case NodeLink nodeLink: return(NodeLinks.Remove(nodeLink)); default: return(false); } }
public Task SaveLinks(int nodeId, IEnumerable<NodeLink> links) { var nodeLinks = new NodeLinks(nodeId, links); var updateOptions = new UpdateOptions { IsUpsert = true }; return _collection.ReplaceOneAsync(x => x.Id == nodeId, nodeLinks, updateOptions); }
public Task SaveLinks(int nodeId, IEnumerable <NodeLink> links) { var nodeLinks = new NodeLinks(nodeId, links); var updateOptions = new UpdateOptions { IsUpsert = true }; return(_collection.ReplaceOneAsync(x => x.Id == nodeId, nodeLinks, updateOptions)); }
public IList <NodeLink> GetLinks(int nodeId) { NodeLinks links = _collection.Find(x => x.Id == nodeId).SingleOrDefaultAsync().Result; if (links == null) { return(new NodeLink[0]); } return(links.Links); }
/** * Initializes platform height for easy reference, ensures singleton integrity. */ private void Awake() { if (instance != null) { DestroyImmediate(this); } instance = this; platformHeight = platformPrefab.GetComponent <SpriteRenderer>().size.y; }
public async Task <ActionResult <NetworkGraph> > Post([FromBody] NodeLinks NodeLinks) { if (NodeLinks.nodes != null) { JsonSerializerOptions options = new JsonSerializerOptions(); options.WriteIndented = true; var newNetworkGraph = new NetworkGraph { schema = JsonSerializer.Serialize(NodeLinks, options), shortId = Guid.NewGuid().ToString().Substring(0, 8) }; await _db.NetworkGraph.AddAsync(newNetworkGraph); await _db.SaveChangesAsync(); return(CreatedAtAction(nameof(Get), new NetworkGraph { Id = newNetworkGraph.Id, shortId = newNetworkGraph.shortId, schema = newNetworkGraph.schema, updateCount = newNetworkGraph.updateCount })); } return(BadRequest("Node Object was null")); }
public void AddLink(NodeLink _link) { _link.SetParentNode(this); NodeLinks.Add(_link); }
public void ClearLinks() { NodeLinks.Clear(); }
/// <summary> /// Returns whether or not the node contains at least 1 of the given link type. /// </summary> /// <param name="_type"></param> /// <returns></returns> public bool HasLinkOfType(NodeLinkType _type) { return(NodeLinks.Any(link => link.LinkType == _type)); }
public static bool GetOrSetIsVisible <T>(this NodeLinks links, T data, Func <NodeLinks, T, bool> factory) { return((links.IsVisible ?? (links.IsVisible = factory(links, data))).Value); }
public static ISignature GetOrSetResolvedSignature <T>(this NodeLinks links, T data, Func <NodeLinks, T, ISignature> factory) { return(links.ResolvedSignature ?? (links.ResolvedSignature = factory(links, data))); }
public static IType GetOrSetResolvedType <T>(this NodeLinks links, T data, Func <NodeLinks, T, IType> factory) { return(links.ResolvedType ?? (links.ResolvedType = factory(links, data))); }