def process_data(self, line):
     form = line.split()[0]
     value = Decimal(line.split()[1])
     self.obj = {}
     self.obj["form"] = form
     if form == "s":
         self.form = Square()
     elif form == "c":
         self.form = Circle()
     area = self.form.calc_area(value)
     self.obj["area"] = area
     self.output.append(self.obj)
Esempio n. 2
0
 def __init__(self):
     self.circle = Circle()
     self.testdata = [
         {
             "size": "0",
             "area": "0"
         },
         {
             "size": "1",
             "area": "0.7853981633974483"
         },
         {
             "size": "2",
             "area": "3.141592653589793"
         },
         {
             "size": "3",
             "area": "7.0685834705770345"
         },
         {
             "size": "4",
             "area": "12.566370614359172"
         },
     ]
Esempio n. 3
0
 def update_circle(self, circle_id, new_abscissa, new_ordinate, new_radius):
     circle = Circle(circle_id, new_abscissa, new_ordinate, new_radius)
     self.__circle_validator.validate_circle(circle)
     self.__circle_repository.update(circle)
Esempio n. 4
0
 def add_circle(self, circle_id, abscissa, ordinate, radius):
     circle = Circle(circle_id, abscissa, ordinate, radius)
     self.__circle_validator.validate_circle(circle)
     self.__circle_repository.create(circle)