Formatted all files to the same standard
This commit is contained in:
@ -1,20 +1,20 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Proxy (WizardTowerProxy) controls access to the actual object (WizardTower).
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main(String[] args) {
|
||||
|
||||
WizardTowerProxy tower = new WizardTowerProxy();
|
||||
tower.enter(new Wizard("Red wizard"));
|
||||
tower.enter(new Wizard("White wizard"));
|
||||
tower.enter(new Wizard("Black wizard"));
|
||||
tower.enter(new Wizard("Green wizard"));
|
||||
tower.enter(new Wizard("Brown wizard"));
|
||||
WizardTowerProxy tower = new WizardTowerProxy();
|
||||
tower.enter(new Wizard("Red wizard"));
|
||||
tower.enter(new Wizard("White wizard"));
|
||||
tower.enter(new Wizard("Black wizard"));
|
||||
tower.enter(new Wizard("Green wizard"));
|
||||
tower.enter(new Wizard("Brown wizard"));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ public class Wizard {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package com.iluwatar;
|
||||
/**
|
||||
*
|
||||
* The object to be proxyed.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WizardTower {
|
||||
|
||||
public void enter(Wizard wizard) {
|
||||
System.out.println(wizard + " enters the tower.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,14 @@ package com.iluwatar;
|
||||
/**
|
||||
*
|
||||
* The proxy controlling access to WizardTower.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class WizardTowerProxy extends WizardTower {
|
||||
|
||||
private static final int NUM_WIZARDS_ALLOWED = 3;
|
||||
|
||||
|
||||
private int numWizards;
|
||||
|
||||
|
||||
@Override
|
||||
public void enter(Wizard wizard) {
|
||||
if (numWizards < NUM_WIZARDS_ALLOWED) {
|
||||
|
Reference in New Issue
Block a user