Added some error checking

This commit is contained in:
danielwilczak101
2020-10-22 00:03:51 -04:00
parent 8e2698fc0d
commit 74f6c8957b
2 changed files with 20 additions and 5 deletions

View File

@ -64,7 +64,7 @@ class attributes:
self.termination_impl = Termination_Methods.generation_based
# Example of how the setter error checking will look like
# Getter and setters for all varibles
@property
def chromosome_length(self):
return self._chromosome_length
@ -72,5 +72,20 @@ class attributes:
@chromosome_length.setter
def chromosome_length(self, value_input):
if(value_input == 0):
raise ValueError("Sorry your chromosome length must be greater then 0")
raise ValueError("Chromosome length must be greater then 0")
self._chromosome_length = value_input
@property
def population_size(self):
return self._population_size
@population_size.setter
def population_size(self, value_input):
if(value_input == 0):
raise ValueError("Population length must be greater then 0")
self._population_size = value_input
@property
def chromosome_impl(self):
return self._chromosome_impl