Last active
December 23, 2015 20:59
-
-
Save kf4x/6692822 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Preliminary notes | |
| /** | |
| * | |
| * when referring to return type | |
| */ | |
| //public means who can see/call this method, | |
| //Dimension2D is the return type | |
| //getDimension is the method name. | |
| public Dimension2D getDimension(){ | |
| return new Dimension2D(2,2); | |
| } | |
| /** | |
| * | |
| * When we refer to objects we are refering to | |
| */ | |
| //typeofobject object classconstructor(parameters) | |
| Dimension2D demObject = new Dimension2D(2,2); | |
| /** | |
| * | |
| * When we are refering to a method | |
| */ | |
| //first create a object | |
| EllShape s = new EllShape(b); | |
| //then use a method | |
| s.rotate(); | |
| //1. I am wondering what Dimension2D getDimension(); returns. What do the object's dimensions mean? 2D? | |
| @Override | |
| public Dimension2D getDimension() { | |
| // the main objective is to find the the longest line of consecutive | |
| // blocks(in both x[left & right] and y[up & down] directions) within your shape array | |
| // **this will vary amoung everyones program** | |
| // but one way of doing it is to loop through your 2d array finding Block objects that are next to eachother | |
| // after you have your x and y | |
| // y = height, x width | |
| Dimension2D demObject = new Dimension2D(y,x); | |
| return demObject; | |
| } | |
| //2. What does getBlockAt(int row, int col) mean? | |
| @Override | |
| public Block getBlockAt(int row, int col) { | |
| //from what I understand it checks to see if the block exists | |
| // if row and col are valid points within the shape return the block | |
| //if not return null | |
| return new Block(); | |
| } | |
| //3. I initial a Block[][] to store the shape like Block[][] block = new Block[5][5];. If I want to use variants, not a fixed value, to control rows and columns. How can I do that? | |
| //well this is a little complex you may have to elabortate on what you mean. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment