Convert sweep module and class to algorithm
Since an algorithm can use more than one sweep, the sweep class doesn't fit very good as it is right now. For this reasen it got converted to a more general class named algorithm, that shall be used as parent for every individual algorithm. The exact behaviour of the algorithm is then defined in the child classes.
This commit is contained in:
@@ -8,20 +8,18 @@ import copy
|
||||
import linesegment
|
||||
import point
|
||||
|
||||
class Sweep():
|
||||
class Algorithm():
|
||||
|
||||
"The Sweep class is the base class for each individual sweep algorithm"
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
|
||||
def __init__(self):
|
||||
self._sss = None # The sweep status structure
|
||||
self._es = None # The event structure
|
||||
self._input = None # The input values
|
||||
self._result = None # The result of the sweep
|
||||
self._ready = False # If the sweep is reade to be executed
|
||||
self._running = False # If the sweep is currently running
|
||||
self._num_steps = {} # The number of steps that were needed to solve the problem
|
||||
self._result = None # The result of the sweep
|
||||
|
||||
def start(self):
|
||||
"""Start the performing the algorithm. Return True if it was successful"""
|
||||
@@ -30,8 +28,10 @@ class Sweep():
|
||||
return False
|
||||
self._running = True
|
||||
return True
|
||||
def get_result(self):
|
||||
return self._result
|
||||
|
||||
class SweepNearestNeighbors(Sweep):
|
||||
class NearestNeighborsSweep(Algorithm):
|
||||
|
||||
"""Calculate the pair of points inside a set, that have the minimal distance between each
|
||||
other inside this set"""
|
||||
Reference in New Issue
Block a user