/Users/lyon/j4p/src/graphics/graph/GraphFactory.java

1    package graphics.graph; 
2     
3    public class GraphFactory 
4            /** 
5             *  The responsibility of the GraphFactory 
6             *  is to return instances of objects that 
7             *  are current for the test instance. 
8             *  In other words, it provides a handle to 
9             *  the instance of objects needed for the 
10            *  current test without having to make them 
11            *  singleton design pattern objects. 
12            */ { 
13       private static Nodes nodes = new Nodes(); 
14       private static ColorPanel cp = new ColorPanel(); 
15       private static EdgesManager em = new EdgesManager(); 
16       private static NodeDrawer nd = new NodeDrawer(); 
17       private static ImageUtil iu = new ImageUtil(); 
18    
19       public static EdgesManager getEdgesManager() { 
20           return em; 
21       } 
22    
23       public static ColorPanel getColorPanel() { 
24           return cp; 
25       } 
26    
27       public static Nodes getNodes() { 
28           return nodes; 
29       } 
30    
31       public static NodeDrawer getNodeDrawer() { 
32           return nd; 
33       } 
34    
35       public static ImageUtil getImageUtil() { 
36           return iu; 
37       } 
38   }