-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-2 Bytes
(100%)
bin/br/padroes/composite/transparente/ArquivoComponent.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
bin/br/padroes/composite/transparente/ArquivoComposite.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
bin/br/padroes/iteratorExterno/IteradorMatrizDeCanais.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package br.padroes.builder; | ||
|
||
public abstract class CarroBuilder { | ||
protected CarroProduct carro = new CarroProduct(); | ||
public abstract void buildPreco(); | ||
public abstract void buildDscMotor(); | ||
public abstract void buildAnoDeFabricacao(); | ||
public abstract void buildModelo(); | ||
public abstract void buildMontadora(); | ||
public CarroProduct getCarro(){ | ||
return carro; | ||
}; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package br.padroes.builder; | ||
|
||
public class CarroProduct { | ||
public double preco; | ||
public String dscMotor; | ||
public int anoDeFabricacao; | ||
public String modelo; | ||
public String montadora; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package br.padroes.builder; | ||
|
||
public class Cliente { | ||
public static void main(String[] args) { | ||
ConcessionariaDirector concessionaria = new ConcessionariaDirector( | ||
new FiatBuilder()); | ||
|
||
concessionaria.construirCarro(); | ||
CarroProduct carro = concessionaria.getCarro(); | ||
System.out.println("Carro: " + carro.modelo + "/" + carro.montadora | ||
+ "\nAno: " + carro.anoDeFabricacao + "\nMotor: " | ||
+ carro.dscMotor + "\nValor: " + carro.preco); | ||
|
||
System.out.println(); | ||
|
||
concessionaria = new ConcessionariaDirector(new VolksBuilder()); | ||
concessionaria.construirCarro(); | ||
carro = concessionaria.getCarro(); | ||
System.out.println("Carro: " + carro.modelo + "/" + carro.montadora | ||
+ "\nAno: " + carro.anoDeFabricacao + "\nMotor: " | ||
+ carro.dscMotor + "\nValor: " + carro.preco); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package br.padroes.builder; | ||
|
||
public class ConcessionariaDirector { | ||
protected CarroBuilder montadora; | ||
|
||
public ConcessionariaDirector(CarroBuilder montadora) { | ||
this.montadora = montadora; | ||
} | ||
|
||
public void construirCarro() { | ||
montadora.buildPreco(); | ||
montadora.buildAnoDeFabricacao(); | ||
montadora.buildDscMotor(); | ||
montadora.buildModelo(); | ||
montadora.buildMontadora(); | ||
} | ||
|
||
public CarroProduct getCarro() { | ||
return montadora.getCarro(); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package br.padroes.builder; | ||
|
||
public class FiatBuilder extends CarroBuilder { | ||
|
||
@Override | ||
public void buildPreco() { | ||
carro.preco = 1000.00; | ||
} | ||
|
||
@Override | ||
public void buildDscMotor() { | ||
carro.dscMotor = "1.0 Flex"; | ||
} | ||
|
||
@Override | ||
public void buildAnoDeFabricacao() { | ||
carro.anoDeFabricacao = 2010; | ||
} | ||
|
||
@Override | ||
public void buildModelo() { | ||
carro.modelo = "Palio"; | ||
} | ||
|
||
@Override | ||
public void buildMontadora() { | ||
carro.montadora = "Fiat"; | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package br.padroes.builder; | ||
|
||
public class VolksBuilder extends CarroBuilder { | ||
@Override | ||
public void buildPreco() { | ||
carro.preco = 1000.00; | ||
} | ||
|
||
@Override | ||
public void buildDscMotor() { | ||
carro.dscMotor = "1.0 Flex"; | ||
} | ||
|
||
@Override | ||
public void buildAnoDeFabricacao() { | ||
carro.anoDeFabricacao = 2010; | ||
} | ||
|
||
@Override | ||
public void buildModelo() { | ||
carro.modelo = "Gol"; | ||
} | ||
|
||
@Override | ||
public void buildMontadora() { | ||
carro.montadora = "VolskWagem"; | ||
} | ||
|
||
} |