public bool Remove(GridNodeAsset node) { bool found; GridNodeAsset[] newNodes; found = false; newNodes = new GridNodeAsset[nodes.Length - 1]; for (int i = 0; i < newNodes.Length; i++) { if (nodes[i] == node) { found = true; } newNodes[i] = nodes[i + ((found) ? 1 : 0)]; } found = (nodes[newNodes.Length] == node) ? true : found; if (!found) { return(false); } nodes = newNodes; return(true); }
public GridNodeAsset(GridNodeAsset original, NetworkAsset network) : base(network, original.Collection) { this.Name = original.Name; target = original.Target; this.Tags = new int[original.Tags.Length]; for (int i = 0; i < original.Tags.Length; i++) // Copy the tag indexes { this.Tags[i] = original.Tags[i]; } }
public GridNodeAsset( GridNodeAsset original, NetworkAsset network ) : base( network, original.Collection ) { this.Name = original.Name; target = original.Target; this.Tags = new int[ original.Tags.Length ]; for( int i = 0; i < original.Tags.Length; i++ ) // Copy the tag indexes { this.Tags[ i ] = original.Tags[ i ]; } }
public GridNodeAsset Add(GridNodeAsset node) { GridNodeAsset[] newNodes; newNodes = new GridNodeAsset[nodes.Length + 1]; for (int i = 0; i < nodes.Length; i++) { if (nodes[i].Name == node.Name) { return(null); } newNodes[i] = nodes[i]; } newNodes[nodes.Length] = node; nodes = newNodes; return(node); }
public bool Remove( GridNodeAsset node ) { bool found; GridNodeAsset[] newNodes; found = false; newNodes = new GridNodeAsset[ nodes.Length - 1 ]; for( int i = 0; i < newNodes.Length; i++ ) { if( nodes[ i ] == node ) { found = true; } newNodes[ i ] = nodes[ i + ( ( found ) ? 1 : 0 ) ]; } found = ( nodes[ newNodes.Length ] == node ) ? true : found; if( !found ) { return false; } nodes = newNodes; return true; }
public GridNodeAsset Add( GridNodeAsset node ) { GridNodeAsset[] newNodes; newNodes = new GridNodeAsset[ nodes.Length + 1 ]; for( int i = 0; i < nodes.Length; i++ ) { if( nodes[ i ].Name == node.Name ) { return null; } newNodes[ i ] = nodes[ i ]; } newNodes[ nodes.Length ] = node; nodes = newNodes; return node; }