public static void main(String[] args)
	{
		//Creating abstract factory,
		//then creating two factories with it,
		//and then creating four ships with this factories

		AbstractFactory abstract_factory = new AbstractFactory();\

		Dock trade = abstract_factory.create_dock("TradeShipDock");
		Dock battle = abstract_factory.create_dock("BattleShipDock");

		Ship cleeper = trade.create_ship("Cleeper");
		Ship cutter = trade.create_ship("Cutter");
		Ship fregate = battle.create_ship("Fregate");
		Ship galeon = battle.create_ship("Galeon");

		cleeper.act();
		cutter.act();
		fregate.act();
		galeon.act();	
	}
  public static void main(String[] args) {

    // get class factory
    AbstractFactory classFactory = FactoryProducer.getFactory("CLASSNAME");

    // get an object of Class Software Development
    Class class1 = classFactory.getClass("SOFTWARE DEVELOPMENT");

    // call checkSchedule method of Class Software Development
    class1.checkSchedule();

    // get an object of Class HCI Usability
    Class class2 = classFactory.getClass("HCI USABILITY");

    // call checkSchedule method of Class HCI Usability
    class2.checkSchedule();

    // get an object of Class Capstone
    Class class3 = classFactory.getClass("CAPSTONE");

    // call checkSchedule method of Class Capstone
    class3.checkSchedule();

    // get class time factory
    AbstractFactory classTimeFactory = FactoryProducer.getFactory("CLASSTIME");

    // get an object of Class Time Morning
    ClassTime classTime1 = classTimeFactory.getClassTime("MORNING");

    // call time method of Morning
    classTime1.time();

    // get an object of Class Time Afternoon
    ClassTime classTime2 = classTimeFactory.getClassTime("AFTERNOON");

    // call time method of Afternoon
    classTime2.time();

    // get an object of Class Time Evening
    ClassTime classTime3 = classTimeFactory.getClassTime("EVENING");

    // call time method of Evening
    classTime3.time();
  }
  public static void main(String[] args) {
    // get shape factory
    AbstractFactory shapeFactory = FactoryProducer.getFactory("SHAPE");

    // get an object of Shape Circle
    Shape shape1 = shapeFactory.getShape("CIRCLE");

    // call draw method of Shape Circle
    shape1.draw();

    // get an object of Shape Rectangle
    Shape shape2 = shapeFactory.getShape("RECTANGLE");

    // call draw method of Shape Rectangle
    shape2.draw();

    // get an object of Shape Square
    Shape shape3 = shapeFactory.getShape("SQUARE");

    // call draw method of Shape Square
    shape3.draw();

    // get color factory
    AbstractFactory colorFactory = FactoryProducer.getFactory("COLOR");

    // get an object of Color Red
    Color color1 = colorFactory.getColor("RED");

    // call fill method of Red
    color1.fill();

    // get an object of Color Green
    Color color2 = colorFactory.getColor("Green");

    // call fill method of Green
    color2.fill();

    // get an object of Color Blue
    Color color3 = colorFactory.getColor("BLUE");

    // call fill method of Color Blue
    color3.fill();
  }
 public void addHardDrive() {
   helper.decorate((Composite) _computer, Decoratable.HARDDRIVE);
 }
 public void addGraphicsCard() {
   helper.decorate((Composite) _computer, Decoratable.GRAPHICSCARD);
 }
 public void addRam() {
   helper.decorate((Composite) _computer, Decoratable.RAM);
 }
Example #7
0
  /** @see fabric.registry.System#setAttributesMap(java.util.Map) */
  @Override
  public void setAttributesMap(Map<String, String> attributes) {

    this.attributes = AbstractFactory.convertMapToNVPString(attributes);
  }
Example #8
0
  /** @see fabric.registry.System#getAttributesMap() */
  @Override
  public Map<String, String> getAttributesMap() {

    return AbstractFactory.buildAttributesMap(attributes);
  }
Example #9
0
 public static void main(String args[]) {
   AbstractFactory pf = FactoryMaker.getFactory("a");
   AbstractProductA product = pf.createProductA();
   // more function calls on product
   product.operationA1();
 }
Example #10
0
 public AbstractPeer getMulticastPeer() throws Exception {
   AbstractResourceManager arm = AbstractFactory.getFactory().getResourceManager();
   return new WebPeer(arm.getMulticastAddress() + ":" + arm.getMulticastPort());
 }