Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
|
a1eee7427f | 3 years ago |
|
f33e0b52d6 | 3 years ago |
|
84e1120105 | 3 years ago |
|
6ad8fb6d0a | 3 years ago |
|
33989e28ee | 3 years ago |
@ -0,0 +1,14 @@
|
||||
package com.example.tankbattle;
|
||||
|
||||
public class DefaultFireStrategy implements FireStrategy {
|
||||
|
||||
@Override
|
||||
public void fire(Tank t) {
|
||||
int bX = t.x + Tank.WIDTH/2 - Bullet.WIDTH/2;
|
||||
int bY = t.y + Tank.HEIGHT/2 - Bullet.HEIGHT/2;
|
||||
|
||||
new Bullet(bX, bY, t.dir, t.group, t.tf);
|
||||
|
||||
if(t.group == Group.GOOD) new Thread(()->new Audio("audio/tank_fire.wav").play()).start();
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.example.tankbattle;
|
||||
|
||||
public interface FireStrategy {
|
||||
void fire(Tank Tank);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.example.tankbattle;
|
||||
|
||||
public class FourDirFireStrategy implements FireStrategy {
|
||||
|
||||
@Override
|
||||
public void fire(Tank t) {
|
||||
int bX = t.x + Tank.WIDTH/2 - Bullet.WIDTH/2;
|
||||
int bY = t.y + Tank.HEIGHT/2 - Bullet.HEIGHT/2;
|
||||
|
||||
Dir[] dirs = Dir.values();
|
||||
for(Dir dir : dirs) {
|
||||
t.tf.gf.createBullet(bX, bY, dir, t.group, t.tf);
|
||||
}
|
||||
|
||||
if(t.group == Group.GOOD) new Thread(()->new Audio("audio/tank_fire.wav").play()).start();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public abstract class BaseBullet {
|
||||
public abstract void paint(Graphics g);
|
||||
|
||||
public abstract void collideWith(BaseTank tank);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public abstract class BaseExplode {
|
||||
public abstract void paint(Graphics g);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Group;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
public abstract class BaseTank {
|
||||
public Group group = Group.BAD;
|
||||
public Rectangle rect = new Rectangle();
|
||||
|
||||
public abstract void paint(Graphics g);
|
||||
|
||||
public Group getGroup() {
|
||||
return this.group;
|
||||
}
|
||||
|
||||
public abstract void die();
|
||||
|
||||
public abstract int getX();
|
||||
|
||||
public abstract int getY();
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Bullet;
|
||||
import com.example.tankbattle.Dir;
|
||||
import com.example.tankbattle.Explode;
|
||||
import com.example.tankbattle.Group;
|
||||
import com.example.tankbattle.Tank;
|
||||
import com.example.tankbattle.TankFrame;
|
||||
|
||||
public class DefaultFactory extends GameFactory {
|
||||
@Override
|
||||
public BaseTank createTank(int x, int y, Dir dir, Group group, TankFrame tf) {
|
||||
return new Tank(x, y, dir, group, tf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseExplode createExplode(int x, int y, TankFrame tf) {
|
||||
return new Explode(x, y, tf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBullet createBullet(int x, int y, Dir dir, Group group, TankFrame tf) {
|
||||
return new Bullet(x, y, dir, group, tf);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Dir;
|
||||
import com.example.tankbattle.Group;
|
||||
import com.example.tankbattle.TankFrame;
|
||||
|
||||
public abstract class GameFactory {
|
||||
public abstract BaseTank createTank(int x, int y, Dir dir, Group group, TankFrame tf);
|
||||
|
||||
public abstract BaseExplode createExplode(int x, int y, TankFrame tf);
|
||||
|
||||
public abstract BaseBullet createBullet(int x, int y, Dir dir, Group group, TankFrame tf);
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Dir;
|
||||
import com.example.tankbattle.Explode;
|
||||
import com.example.tankbattle.Group;
|
||||
import com.example.tankbattle.ResourceMgr;
|
||||
import com.example.tankbattle.Tank;
|
||||
import com.example.tankbattle.TankFrame;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
public class RectBullet extends BaseBullet {
|
||||
|
||||
private static final int SPEED = 6;
|
||||
public static int WIDTH = ResourceMgr.bulletD.getWidth();
|
||||
public static int HEIGHT = ResourceMgr.bulletD.getHeight();
|
||||
|
||||
Rectangle rect = new Rectangle();
|
||||
|
||||
private int x, y;
|
||||
private Dir dir;
|
||||
|
||||
private boolean living = true;
|
||||
TankFrame tf = null;
|
||||
private Group group = Group.BAD;
|
||||
|
||||
public RectBullet(int x, int y, Dir dir, Group group, TankFrame tf) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.dir = dir;
|
||||
this.group = group;
|
||||
this.tf = tf;
|
||||
|
||||
rect.x = this.x;
|
||||
rect.y = this.y;
|
||||
rect.width = WIDTH;
|
||||
rect.height = HEIGHT;
|
||||
|
||||
tf.bullets.add(this);
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(Group group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
if (!living) {
|
||||
tf.bullets.remove(this);
|
||||
}
|
||||
Color c = g.getColor();
|
||||
g.setColor(Color.YELLOW);
|
||||
g.fillRect(x, y, 20, 20);
|
||||
g.setColor(c);
|
||||
|
||||
move();
|
||||
}
|
||||
|
||||
private void move() {
|
||||
switch (dir) {
|
||||
case LEFT:
|
||||
x -= SPEED;
|
||||
break;
|
||||
case UP:
|
||||
y -= SPEED;
|
||||
break;
|
||||
case RIGHT:
|
||||
x += SPEED;
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
y += SPEED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
rect.x = this.x;
|
||||
rect.y = this.y;
|
||||
|
||||
if (x < 0 || y < 0 || x > TankFrame.GAME_WIDTH || y > TankFrame.GAME_HEIGHT) living = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collideWith(BaseTank tank) {
|
||||
if (this.group == tank.getGroup()) return;
|
||||
if (this.rect.intersects(tank.rect)) {
|
||||
tank.die();
|
||||
this.die();
|
||||
int eX = tank.getX() + Tank.WIDTH / 2 - Explode.WIDTH / 2;
|
||||
int eY = tank.getY() + Tank.HEIGHT / 2 - Explode.HEIGHT / 2;
|
||||
tf.explodes.add(tf.gf.createExplode(eX, eY, tf));
|
||||
}
|
||||
}
|
||||
|
||||
private void die() {
|
||||
this.living = false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Audio;
|
||||
import com.example.tankbattle.ResourceMgr;
|
||||
import com.example.tankbattle.TankFrame;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
|
||||
public class RectExplode extends BaseExplode {
|
||||
|
||||
public static int WIDTH = ResourceMgr.explodes[0].getWidth();
|
||||
public static int HEIGHT = ResourceMgr.explodes[0].getHeight();
|
||||
|
||||
private int x, y;
|
||||
|
||||
TankFrame tf = null;
|
||||
|
||||
private int step = 0;
|
||||
|
||||
public RectExplode(int x, int y, TankFrame tf) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.tf = tf;
|
||||
|
||||
new Thread(() -> new Audio("audio/explode.wav").play()).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
|
||||
// g.drawImage(ResourceMgr.explodes[step++], x, y, null);
|
||||
Color c = g.getColor();
|
||||
g.setColor(Color.RED);
|
||||
g.fillRect(x, y, 10*step, 10*step);
|
||||
step++;
|
||||
if (step >= 15) {
|
||||
tf.explodes.remove(this);
|
||||
}
|
||||
g.setColor(c);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Dir;
|
||||
import com.example.tankbattle.Group;
|
||||
import com.example.tankbattle.TankFrame;
|
||||
|
||||
public class RectFactory extends GameFactory {
|
||||
|
||||
@Override
|
||||
public BaseTank createTank(int x, int y, Dir dir, Group group, TankFrame tf) {
|
||||
return new RectTank(x, y, dir, group, tf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseExplode createExplode(int x, int y, TankFrame tf) {
|
||||
return new RectExplode(x, y, tf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBullet createBullet(int x, int y, Dir dir, Group group, TankFrame tf) {
|
||||
return new RectBullet(x, y, dir, group, tf);
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
package com.example.tankbattle.abstractfactory;
|
||||
|
||||
import com.example.tankbattle.Audio;
|
||||
import com.example.tankbattle.Bullet;
|
||||
import com.example.tankbattle.DefaultFireStrategy;
|
||||
import com.example.tankbattle.Dir;
|
||||
import com.example.tankbattle.FireStrategy;
|
||||
import com.example.tankbattle.Group;
|
||||
import com.example.tankbattle.PropertyMgr;
|
||||
import com.example.tankbattle.ResourceMgr;
|
||||
import com.example.tankbattle.TankFrame;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Random;
|
||||
|
||||
public class RectTank extends BaseTank{
|
||||
|
||||
private static final int SPEED = 2;
|
||||
|
||||
public static int WIDTH = ResourceMgr.goodTankU.getWidth();
|
||||
public static int HEIGHT = ResourceMgr.goodTankU.getHeight();
|
||||
|
||||
public Rectangle rect = new Rectangle();
|
||||
|
||||
private Random random = new Random();
|
||||
|
||||
int x, y;
|
||||
|
||||
Dir dir = Dir.DOWN;
|
||||
|
||||
private boolean moving = true;
|
||||
|
||||
TankFrame tf = null;
|
||||
|
||||
private boolean living = true;
|
||||
|
||||
Group group = Group.BAD;
|
||||
|
||||
FireStrategy fs;
|
||||
|
||||
public RectTank(int x, int y, Dir dir, Group group, TankFrame tf) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.dir = dir;
|
||||
this.group = group;
|
||||
this.tf = tf;
|
||||
|
||||
rect.x = this.x;
|
||||
rect.y = this.y;
|
||||
rect.width = WIDTH;
|
||||
rect.height = HEIGHT;
|
||||
|
||||
if(group == Group.GOOD) {
|
||||
String goodFSName = PropertyMgr.get("goodFS");
|
||||
|
||||
try {
|
||||
fs = (FireStrategy)Class.forName(goodFSName).getDeclaredConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
fs = new DefaultFireStrategy();
|
||||
}
|
||||
}
|
||||
|
||||
public void fire(){
|
||||
// fs.fire(this);
|
||||
|
||||
int bX = this.x + RectTank.WIDTH / 2 - Bullet.WIDTH / 2;
|
||||
int bY = this.y + RectTank.HEIGHT / 2 - Bullet.HEIGHT / 2;
|
||||
|
||||
Dir[] dirs = Dir.values();
|
||||
for (Dir dir : dirs) {
|
||||
tf.gf.createBullet(bX, bY, dir, group, tf);
|
||||
}
|
||||
|
||||
if (group == Group.GOOD)
|
||||
new Thread(() -> new Audio("audio/tank_fire.wav").play()).start();
|
||||
}
|
||||
|
||||
public Dir getDir() {
|
||||
return dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(Group group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
public boolean isMoving() {
|
||||
return moving;
|
||||
}
|
||||
|
||||
private void move() {
|
||||
if (!moving) return;
|
||||
switch (dir) {
|
||||
case LEFT:
|
||||
x -= SPEED;
|
||||
break;
|
||||
case UP:
|
||||
y -= SPEED;
|
||||
break;
|
||||
case RIGHT:
|
||||
x += SPEED;
|
||||
break;
|
||||
case DOWN:
|
||||
y += SPEED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.group == Group.BAD && random.nextInt(100) > 95)
|
||||
this.fire();
|
||||
|
||||
if (this.group == Group.GOOD && random.nextInt(100) > 95)
|
||||
randomDir();
|
||||
|
||||
boundsCheck();
|
||||
// update rect
|
||||
rect.x = this.x;
|
||||
rect.y = this.y;
|
||||
}
|
||||
|
||||
private void boundsCheck() {
|
||||
if (this.x < 2)
|
||||
x = 2;
|
||||
if (this.y < 28)
|
||||
y = 28;
|
||||
|
||||
if (this.x > TankFrame.GAME_WIDTH - RectTank.WIDTH-2)
|
||||
x = TankFrame.GAME_WIDTH - RectTank.WIDTH;
|
||||
if (this.y > TankFrame.GAME_HEIGHT - RectTank.HEIGHT-2)
|
||||
y = TankFrame.GAME_HEIGHT - RectTank.HEIGHT;
|
||||
}
|
||||
|
||||
private void randomDir() {
|
||||
this.dir = Dir.values()[random.nextInt(4)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
if (!living) tf.tanks.remove(this);
|
||||
|
||||
Color c = g.getColor();
|
||||
g.setColor(group == Group.GOOD ? Color.RED : Color.BLUE);
|
||||
g.fillRect(x, y, 40, 40);
|
||||
g.setColor(c);
|
||||
move();
|
||||
}
|
||||
|
||||
public void setDir(Dir dir) {
|
||||
this.dir = dir;
|
||||
}
|
||||
|
||||
public void setMoving(boolean moving) {
|
||||
this.moving = moving;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die() {
|
||||
this.living = false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class AK47 extends Weapon {
|
||||
|
||||
@Override
|
||||
public void shoot() {
|
||||
System.out.println("tutututututuututtu");
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public abstract class AbstractFactory {
|
||||
abstract Food createFood();
|
||||
abstract Vehicle createVehicle();
|
||||
abstract Weapon createWeapon();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class Bread extends Food {
|
||||
|
||||
@Override
|
||||
public void printName() {
|
||||
System.out.println("breadbreadbreadbreadbreadbread");
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class Broom extends Vehicle {
|
||||
|
||||
@Override
|
||||
public void go() {
|
||||
System.out.println("broom flybroom flybroom flybroom flybroom flybroom fly");
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class Car extends Vehicle {
|
||||
|
||||
@Override
|
||||
public void go() {
|
||||
System.out.println("car move xxxxx");
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public abstract class Food {
|
||||
public abstract void printName();
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class MagicFactory extends AbstractFactory{
|
||||
|
||||
@Override
|
||||
Food createFood() {
|
||||
return new MushRoom();
|
||||
}
|
||||
|
||||
@Override
|
||||
Vehicle createVehicle() {
|
||||
return new Broom();
|
||||
}
|
||||
|
||||
@Override
|
||||
Weapon createWeapon() {
|
||||
return new MagicStick();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class MagicStick extends Weapon {
|
||||
|
||||
@Override
|
||||
public void shoot() {
|
||||
System.out.println("magic stickmagic stickmagic stickmagic stickmagic stick");
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Car car = new Car();
|
||||
car.go();
|
||||
AK47 aK47 = new AK47();
|
||||
aK47.shoot();
|
||||
Bread bread = new Bread();
|
||||
bread.printName();
|
||||
|
||||
AbstractFactory factory = new ModernFactory();
|
||||
Vehicle vehicle = factory.createVehicle();
|
||||
vehicle.go();
|
||||
Weapon weapon = factory.createWeapon();
|
||||
weapon.shoot();
|
||||
Food food = factory.createFood();
|
||||
food.printName();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class ModernFactory extends AbstractFactory{
|
||||
@Override
|
||||
Food createFood() {
|
||||
return new Bread();
|
||||
}
|
||||
|
||||
@Override
|
||||
Vehicle createVehicle() {
|
||||
return new Car();
|
||||
}
|
||||
|
||||
@Override
|
||||
Weapon createWeapon() {
|
||||
return new AK47();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public class MushRoom extends Food {
|
||||
|
||||
@Override
|
||||
public void printName() {
|
||||
System.out.println("mushRoommushRoommushRoommushRoommushRoommushRoom");
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public abstract class Vehicle {
|
||||
public abstract void go();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
import com.example.tankbattle.factorymethod.Broom;
|
||||
import com.example.tankbattle.factorymethod.Car;
|
||||
|
||||
public abstract class VehicleFactory {
|
||||
|
||||
public Car createCar(){
|
||||
// pre-process
|
||||
return new Car();
|
||||
}
|
||||
|
||||
public Broom createBroom(){
|
||||
// pre-process
|
||||
return new Broom();
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.example.tankbattle.abstractfactory.demo;
|
||||
|
||||
public abstract class Weapon {
|
||||
public abstract void shoot();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public class Broom implements Moveable{
|
||||
|
||||
@Override
|
||||
public void go() {
|
||||
System.out.println("broom fly xxxxxxxx");
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public class Car implements Moveable {
|
||||
|
||||
@Override
|
||||
public void go() {
|
||||
System.out.println("car move xxxxx");
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public class CarFactory {
|
||||
public Car create() {
|
||||
// log
|
||||
System.out.println("xxxxxxxxxxx");
|
||||
return new Car();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Moveable moveable = new CarFactory().create();
|
||||
moveable.go();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public interface Moveable {
|
||||
void go();
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public class Plane implements Moveable {
|
||||
|
||||
@Override
|
||||
public void go() {
|
||||
System.out.println("plane go xxxx");
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.example.tankbattle.factorymethod;
|
||||
|
||||
public class SimpleVehicleFactory {
|
||||
|
||||
public Car createCar() {
|
||||
// pre-process
|
||||
return new Car();
|
||||
}
|
||||
|
||||
public Broom createBroom() {
|
||||
// pre-process
|
||||
return new Broom();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue