Beispiel #1
0
 def add_decoration(self, decoration_type):
     if decoration_type == 'Ornament':
         decoration = Ornament()
     elif decoration_type == 'Plant':
         decoration = Plant()
     else:
         return 'Invalid decoration type.'
     self.decorations_repository.add(decoration)
     return f'Successfully added {decoration_type}.'
Beispiel #2
0
 def add_decoration(self, decoration_type: str):
     if decoration_type != "Ornament" and decoration_type != "Plant":
         return "Invalid decoration type."
     else:
         if decoration_type == "Ornament":
             decoration = Ornament()
         else:
             decoration = Plant()
         self.decorations_repository.add(decoration)
         return f"Successfully added {decoration_type}."
Beispiel #3
0
 def add_decoration(self, decoration_type):
     valid_decorations = ["Ornament", "Plant"]
     if decoration_type not in valid_decorations:
         return "Invalid decoration type."
     if decoration_type == valid_decorations[0]:
         decoration = Ornament()
     else:
         decoration = Plant()
     self.decorations_repository.add(decoration)
     return f"Successfully added {decoration_type}."
Beispiel #4
0
    def add_decoration(self, decoration_type: str):
        valid_types = ["Ornament", "Plant"]
        if decoration_type not in valid_types:
            return "Invalid decoration type."

        if decoration_type == "Plant":
            self.decorations_repository.add(Plant())
            return f"Successfully added {decoration_type}"
        if decoration_type == "Ornament":
            self.decorations_repository.add(Ornament())
            return f"Successfully added {decoration_type}"
Beispiel #5
0
    def add_decoration(self, decoration_type: str):
        valid_types = ('Ornament', 'Plant')
        if decoration_type not in valid_types:
            return 'Invalid decoration type.'

        if decoration_type == valid_types[0]:
            new_decoration = Ornament()
        else:
            new_decoration = Plant()

        self.decorations_repository.add(new_decoration)
        return f'Successfully added {decoration_type}.'
Beispiel #6
0
    def add_decoration(self, decoration_type: str):
        valid_type = ('Ornament', 'Plant')

        if decoration_type not in valid_type:
            return "Invalid decoration type."

        if decoration_type == valid_type[0]:
            new_decoration = Ornament()
        elif decoration_type == valid_type[1]:
            new_decoration = Plant()

        self.decorations_repository.add(new_decoration)
        return f"Successfully added {decoration_type}."
Beispiel #7
0
from project.decoration.decoration_repository import DecorationRepository
from project.decoration.ornament import Ornament
from project.decoration.plant import Plant
from project.fish.freshwater_fish import FreshwaterFish
from project.fish.saltwater_fish import SaltwaterFish
from project.aquarium.freshwater_aquarium import FreshwaterAquarium
from project.aquarium.saltwater_aquarium import SaltwaterAquarium
from project.controller import Controller

orn = Ornament()
plant = Plant()
orn_2 = Ornament()
# print(orn.__dict__)
# print(plant.__dict__)

dec_rep = DecorationRepository()
dec_rep.add(orn)
dec_rep.add(orn_2)
dec_rep.add(plant)
print(dec_rep.find_by_type("Ornament"))
print(dec_rep.__dict__)
dec_rep.remove(orn_2)
dec_rep.remove(orn_2)

fresh_water_fish = FreshwaterFish("Sladka", "Freshwater", 5.5)
salt_water_fish = SaltwaterFish("Salty", "Saltwater", 8.4)
fresh_water_fish_2 = FreshwaterFish("Freshy2", "FreshFish2", 7)
salt_water_fish_2 = SaltwaterFish("Salty_2", "Saltwater", 4)
fresh_aquarium = FreshwaterAquarium("FreshShitAquarium")
salt_aquarium = SaltwaterAquarium("SaltwaterShitAquarium")
print(fresh_aquarium.add_fish(fresh_water_fish))
Beispiel #8
0
 def create_decoration(dec_type):
     if dec_type == "Ornament":
         return Ornament()
     if dec_type == "Plant":
         return Plant()
Beispiel #9
0
# Aquariums
from project.fish.freshwater_fish import FreshwaterFish
from project.fish.saltwater_fish import SaltwaterFish

b = BaseAquarium("Base", 10)
f = FreshwaterAquarium("FreshAQ")
s = SaltwaterAquarium("SaltAQ")

# Fish
fish1 = BaseFish("BaseF", "G", 10, 100)
fish2 = FreshwaterFish("FreshF", "FF", 200)
fish3 = SaltwaterFish("FreshF", "FF", 200)

# Decorations
decor1 = Ornament()
decor2 = Plant()

# Decor Repos
de = DecorationRepository()

# Controllers
co = Controller()

print(s.add_fish(fish2))
print(s.add_fish(fish2))
print(s.add_fish(fish3))
print(s.add_fish(fish3))
print(s.add_fish(fish3))
s.remove_fish(fish3)
print(len(s.fish))
 def add_decoration(self, decoration_type: str):
     if decoration_type not in ["Ornament", "Plant"]:
         return "Invalid decoration type."
     decoration = Ornament() if decoration_type == "Ornament" else Plant()
     self.decorations_repository.add(decoration)
     return "Successfully added {decoration_type}."