Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copyright (c) 2012 Blizzardo1, All rights reserved.
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using System.Text;
- namespace Derpina
- {
- class Program
- {
- class StringMatrix
- {
- public int XMax
- {
- get;
- private set;
- }
- public int YMax
- {
- get;
- private set;
- }
- public int ZMax
- {
- get;
- private set;
- }
- string[,,] matrix;
- /// <summary>
- /// A New String Matrix on a Zero-Based Index
- /// </summary>
- public StringMatrix(int xLen, int yLen, int zLen)
- {
- XMax = xLen;
- YMax = yLen;
- ZMax = zLen;
- matrix = new string[xLen, yLen, zLen];
- }
- /// <summary>
- /// Gets Data from a specific point in the Matrix
- /// </summary>
- /// <param name="x">X Position</param>
- /// <param name="y">Y Position</param>
- /// <param name="z">Z Position</param>
- /// <returns>Data from the specified Coordinates</returns>
- public string GetData(int x, int y, int z)
- {
- return matrix[x, y, z];
- }
- /// <summary>
- /// Deletes the Data from the specified coordinates
- /// </summary>
- /// <param name="x">X Position</param>
- /// <param name="y">Y Position</param>
- /// <param name="z">Z Position</param>
- public void DeleteData(int x, int y, int z)
- {
- matrix[x, y, z] = null;
- }
- /// <summary>
- /// Copies the Data from one set of coordinates to another
- /// </summary>
- /// <param name="x">X Position</param>
- /// <param name="y">Y Position</param>
- /// <param name="z">Z Position</param>
- /// <param name="tx">Destination X</param>
- /// <param name="ty">Destination Y</param>
- /// <param name="tz">Destination Z</param>
- public void CopyData(int x, int y, int z, int tx, int ty, int tz)
- {
- matrix[tx, ty, tz] = matrix[x, y, z];
- }
- /// <summary>
- /// Sets the Data in the coordinates specified
- /// </summary>
- /// <param name="x">X Position</param>
- /// <param name="y">Y Position</param>
- /// <param name="z">Z Position</param>
- /// <param name="Data">The Data to be set</param>
- public void SetData(int x, int y, int z, string Data)
- {
- matrix[x, y, z] = Data;
- }
- }
- static void Main(string[] args)
- {
- int TotalData = 0;
- Random r = new Random();
- StringMatrix m = new StringMatrix(6, 4, 2);
- for (int z = 0; z < m.ZMax; z++)
- {
- for (int y = 0; y < m.YMax; y++)
- {
- for (int x = 0; x < m.XMax; x++)
- {
- printReturnFeed("Setting X={0:000} Y={1:000} Z={2:000}\r\nTotal Data Entered={3}", x, y, z, TotalData++);
- m.SetData(x, y, z, Guid.NewGuid().ToString());
- }
- }
- }
- Console.WriteLine("\r\n\r\n");
- for (int z = 0; z < m.ZMax; z++)
- {
- for (int y = 0; y < m.YMax; y++)
- {
- for (int x = 0; x < m.XMax; x++)
- {
- Console.WriteLine("[{0:000}, {1:000}, {2:000}] {3}", x, y, z, m.GetData(x, y, z));
- }
- }
- }
- for (int z = 0; z < m.ZMax; z++)
- {
- for (int y = 0; y < m.YMax; y++)
- {
- for (int x = 0; x < m.XMax; x++)
- {
- m.DeleteData(x, y, z);
- Console.WriteLine("[{0:000}, {1:000}, {2:000}] Data Deleted", x, y, z);
- }
- }
- }
- for (; ; ) ;
- }
- static void printReturnFeed(string Text, params object[] parameters)
- {
- Console.Write(Text, parameters);
- Console.SetCursorPosition(0, 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement