Example #1
0
def main():
    director = Director()

    for i in range(2000):
        economic_computer = director.build(EconomicComputerBuilder())
        office_computer = director.build(OfficeComputerBuilder())
        game_computer = director.build(GameComputerBuilder())
Example #2
0
 def __init__(self):
     self.joints = []
     self._pwm =  PCA9685()
     director = Director(Servo_Builder(self._pwm))
     for pin in range(0,12):
         director.build()
         self.joints.append(director.get_build())
         if (pin in set([1,4,7,10])):
             self.joints[pin].set_deg_max(120)
             self.joints[pin].set_deg_min(60)
     self._pwm.set_pwm_freq(60)
Example #3
0
def main():
    director = Director()

    print("")

    economic_computer = director.build(EconomicComputerBuilder())
    economic_computer.print_info()

    print("")

    office_computer = director.build(OfficeComputerBuilder())
    office_computer.print_info()

    print("")

    game_computer = director.build(GameComputerBuilder())
    game_computer.print_info()
Example #4
0
def main():
    director = Director()

    for i in range(2000):
        builder = EconomicComputerBuilder()
        director.build(builder)
        economic_computer = builder.get_computer()

        builder = OfficeComputerBuilder()
        director.build(builder)
        office_computer = builder.get_computer()

        builder = GameComputerBuilder()
        director.build(builder)
        game_computer = builder.get_computer()
Example #5
0
def main():
    director = Director()

    print("")

    builder = EconomicComputerBuilder()
    director.build(builder)
    economic_computer = builder.get_computer()
    economic_computer.show()

    print("")

    builder = OfficeComputerBuilder()
    director.build(builder)
    office_computer = builder.get_computer()
    office_computer.show()

    print("")

    builder = GameComputerBuilder()
    director.build(builder)
    game_computer = builder.get_computer()
    game_computer.show()
Example #6
0
def main():
    director = Director()

    print("Economic devices:\n")

    economic_device = director.build(EconomicComputerBuilder())
    economic_device.print_info()
    economic_device = director.build(EconomicLaptopBuilder())
    economic_device.print_info()
    economic_device = director.build(EconomicMobilePhoneBuilder())
    economic_device.print_info()
    economic_device = director.build(EconomicTabletBuilder())
    economic_device.print_info()

    print("Office devices:\n")

    office_device = director.build(OfficeComputerBuilder())
    office_device.print_info()
    office_device = director.build(OfficeLaptopBuilder())
    office_device.print_info()
    office_device = director.build(OfficeMobilePhoneBuilder())
    office_device.print_info()
    office_device = director.build(OfficeTabletBuilder())
    office_device.print_info()

    print("Devices for gaming:\n")

    game_device = director.build(GameComputerBuilder())
    game_device.print_info()
    game_device = director.build(GameLaptopBuilder())
    game_device.print_info()
    game_device = director.build(GameMobilePhoneBuilder())
    game_device.print_info()
    game_device = director.build(GameTabletBuilder())
    game_device.print_info()
Example #7
0
import sys
import datetime
import time

# Extract Params
if len(sys.argv) < 2:
    print "Usage: python %s [Linkage|Mark|Type] [$date_delta]" % (__file__,)
    sys.exit()
else:
    name = sys.argv[1]
    date_delta = int(sys.argv[2]) if len(sys.argv) >= 3 else 0
    current_time = datetime.datetime.fromtimestamp(int(time.time())) - datetime.timedelta(days = date_delta)
    print name, date_delta, str(current_time)

factory_name = "Compdeal%sFactory" % name
exec "from abstract_factory import %s" % factory_name
exec "factory = %s(current_time)" % factory_name

import logging
import logging.config
logging.config.fileConfig('serverLog.config')

logging.info("Start to Invoke %s Cleaner..." % factory_name)
from director import Director
director = Director()
director.register(factory)
director.build()
logging.info("Invoke DONE")


def main():
    director = Director()

    for i in range(2000):
        economic_device = director.build(EconomicComputerBuilder())
        economic_device = director.build(EconomicLaptopBuilder())
        economic_device = director.build(EconomicMobilePhoneBuilder())
        economic_device = director.build(EconomicTabletBuilder())
        office_device = director.build(OfficeComputerBuilder())
        office_device = director.build(OfficeLaptopBuilder())
        office_device = director.build(OfficeMobilePhoneBuilder())
        office_device = director.build(OfficeTabletBuilder())
        game_device = director.build(GameComputerBuilder())
        game_device = director.build(GameLaptopBuilder())
        game_device = director.build(GameMobilePhoneBuilder())
        game_device = director.build(GameTabletBuilder())