/// <summary> /// Obtains a key path that exists at the same level, but has it's final index in the path decremented. /// </summary> /// <returns>Returns a key path that exists at the same level, but has it's final index in the path decremented.</returns> public KeyPath Previous() { // Verify we have indices if (Indices.Length == 0) { throw new ArgumentException("Failed to decrement key path because the current key path has no indices."); } // We'll want to copy our indices, and decrement the last index. uint[] clonedIndices = (uint[])Indices.Clone(); // Verify our index isn't 0 (without hardened bit) uint baseIndex = (clonedIndices[clonedIndices.Length - 1] & ~HARDENED_MASK); if (baseIndex == 0) { throw new ArgumentException("Failed to decrement key path because the current key path's last index is zero, and decrementing it would underflow and invert the hardened flag."); } // Increment our final index clonedIndices[clonedIndices.Length - 1]--; // Return a new key path with our copied indices return(new KeyPath(clonedIndices)); }
public override Expression Clone() { return(new ArrayIndexerExpression(Target.Clone(), instructions) { Indices = Indices.Clone(), IsSimpleStore = this.IsSimpleStore }); }
/// <summary> /// Obtains a key path that exists at the same level, but has it's final index in the path incremented. /// </summary> /// <returns>Returns a key path that exists at the same level, but has it's final index in the path incremented.</returns> public KeyPath Next() { // Verify we have indices if (Indices.Length == 0) { throw new ArgumentException("Failed to increment key path because the current key path has no indices."); } // We'll want to copy our indices, and increment the last index. uint[] clonedIndices = (uint[])Indices.Clone(); // Increment our final index clonedIndices[clonedIndices.Length]++; // Return a new key path with our copied indices return(new KeyPath(clonedIndices)); }
/// <summary> /// Gets a new mesh instance with vertices and indices clone. /// </summary> /// <returns></returns> public Mesh <V> Clone() { V[] newVertices = Vertices.Clone() as V[]; int[] newIndices = Indices.Clone() as int[]; return(new Mesh <V>(newVertices, newIndices, this.Topology, Slices)); }
public override Expression Clone() { DynamicIndexerExpression result = new DynamicIndexerExpression(Target.Clone(), Indices.Clone(), ExpressionType, this.instructions); return(result); }