Skip to content

Package: PapierFactory

PapierFactory

nameinstructionbranchcomplexitylinemethod
parse(String)
M: 0 C: 33
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: package material.papier;
2:
3: import material.DirectMaterialFactory;
4: import material.auspraegungen.Farbe;
5: import material.auspraegungen.Papierformat;
6: import material.auspraegungen.Papiertyp;
7: import material.farbstoff.FarbFactory;
8: import tec.uom.se.quantity.Quantities;
9:
10: import javax.measure.Quantity;
11: import javax.measure.quantity.Mass;
12:
13: /**
14: * DirectMaterialFactory zur Erstellung von Papier.
15: */
16: public enum PapierFactory implements DirectMaterialFactory<Papier> {
17:         INSTANCE;
18:         
19:         /**
20:          * verarbeitet eine texttuelle Ausprägung vom Muster Papierformat, Gewicht, Farbe.
21:          */
22:         @Override
23:         public Papier parse(final String s) {
24:                 final String[] einzelneAuspraegungen = s.split(",");
25:                 
26:                 final Papierformat papierformat = Papierformat.valueOf(einzelneAuspraegungen[0].trim());
27:                 final Quantity<Mass> gewicht = Quantities.getQuantity(einzelneAuspraegungen[1]).asType(Mass.class);
28:                 final Farbe farbe = FarbFactory.INSTANCE.parse(einzelneAuspraegungen[2]);
29:                 
30:                 return new Papier(new Papiertyp(papierformat, gewicht, farbe));
31:         }
32: }