MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / randomFactory

Method randomFactory

serialization/AStoreCADState.java:28–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26 "] dim[" + dimension + "]\n";
27 }
28 public static Shape randomFactory() {
29 int xVal = rand.nextInt(100);
30 int yVal = rand.nextInt(100);
31 int dim = rand.nextInt(100);
32 switch(counter++ % 3) {
33 default:
34 case 0: return new Circle(xVal, yVal, dim);
35 case 1: return new Square(xVal, yVal, dim);
36 case 2: return new Line(xVal, yVal, dim);
37 }
38 }
39}
40
41class Circle extends Shape {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected