View Javadoc

1   /**********************************************
2    * Copyright (C) 2010 Lukas Laag
3    * This file is part of lib-gwt-svg-edu.
4    * 
5    * libgwtsvg-edu is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    * 
10   * libgwtsvg-edu is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   * 
15   * You should have received a copy of the GNU General Public License
16   * along with libgwtsvg-edu.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  package org.vectomatic.svg.edu.client.maze;
19  
20  public class Boundary {
21  	protected boolean hasWall;
22  	protected Cell cell1;
23  	protected Cell cell2;
24  	public Boundary(Cell cell1, Cell cell2) {
25  		this.cell1 = cell1;
26  		this.cell2 = cell2;
27  		cell1.boundaries.put(cell2, this);
28  		cell2.boundaries.put(cell1, this);
29  		hasWall = true;
30  	}
31  	public void setHasWall(boolean hasWall) {
32  		this.hasWall = hasWall;
33  	}
34  	public boolean hasWall() {
35  		return hasWall;
36  	}
37  	public Cell getCell1() {
38  		return cell1;
39  	}
40  	public Cell getCell2() {
41  		return cell2;
42  	}
43  	@Override
44  	public String toString() {
45  		StringBuilder builder = new StringBuilder("(");
46  		builder.append(cell1.getId());
47  		builder.append("-");
48  		builder.append(cell2.getId());
49  		builder.append(" : ");
50  		builder.append(hasWall);
51  		builder.append(")");
52  		return builder.toString();
53  	}
54  }