Minor comments
[4DMemory.git] / 4DMemory / CardsGrid.cs
blobe0455dc0968c8a9b8ae7752b69cc46c66a2b97ea
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
5 namespace Memory
7 class CardsGrid
9 private IList<CardsPlane> m_cardsPlane;
10 public int m_dimension
12 get
14 return m_dimension;
16 private set
18 m_dimension = value;
22 // Summary:
23 // Constructs a CardsGrid with the specified dimension
25 // Parameters:
26 // dimension:
27 // The dimension of the CardsGrid
28 public CardsGrid(int dimension)
30 m_dimension = dimension;
31 m_cardsPlane = new List<CardsPlane>(dimension);
34 // Summary:
35 // Returns the card at the specified position
37 // Parameters:
38 // x:
39 // The x-coordinate of the card to be retreived
40 // y:
41 // The y-coordinate of the card to be retreived
42 // z:
43 // The z-coordinate of the card to be retreived
45 // Returns:
46 // The card at the specified position
47 public Card getCard(int x, int y, int z)
49 CardsPlane cardsplane = m_cardsPlane[z];
50 return cardsplane.getCard(x, y);
53 // Summary:
54 // Sets the card at the specified position
56 // Parameters:
57 // x:
58 // The x-coordinate of the card to be set
59 // y:
60 // The y-coordinate of the card to be set
61 // z:
62 // The z-coordinate of the card to be set
63 // card:
64 // The card to be set
65 public void setCard(int x, int y, int z, Card card)
67 CardsPlane cardsplane = m_cardsPlane[z];
68 cardsplane.setCard(x, y, card);
71 // Summary:
72 // Swaps the specified two planes, if equal nothing is done
74 // Parameters:
75 // firstpos:
76 // The position of the first plane
77 // secondpos:
78 // The position of the second plane
79 public void swap(int firstpos, int secondpos)
81 // Don't swap anything if they are equal
82 if (firstpos == secondpos)
83 return;
85 CardsPlane firstplane = m_cardsPlane[firstpos];
86 CardsPlane secondplane = m_cardsPlane[secondpos];
88 m_cardsPlane[firstpos] = secondplane;
89 m_cardsPlane[secondpos] = firstplane;