1 from abc
import ABCMeta
5 """A collection of InputProgram and OptionDescriptor.
7 The subclasses have to implement start_async(Callback, List, List)
8 and start_sync(List, List) methods.
10 __metaclass__ = ABCMeta
17 """Add a new element inside _options dict.
19 The o parameter is the new OptionDescriptor instance. The method
20 return the id associated whit the added OptionDescriptor
24 current_value = last_index
29 """Add a new element inside _programs dict.
31 The program param is the InputProgram instance added to the
32 collection. The method return the id associated whit the added
33 InputProgram instance.
36 current_value = last_index
40 def _collect_options(self, option_index):
41 """Return a list of options in _options dict, according to set of
44 If option_index is empty, the method return a list of all
50 input_option.append(self.
_options.get(k))
52 for index
in option_index:
53 input_option.append(self.
_options.get(index))
56 def _collect_programs(self, program_index):
57 """Return a list of programs in _programs dict, according to set of
60 If program_index is empty, the method return a list of all
63 input_programs = list()
66 input_programs.append(self.
_programs.get(k))
68 for index
in program_index:
69 input_programs.append(self.
_programs.get(index))
73 """Returns the specified InputProgram element.
75 The parameter key represents the id. The method return the
76 InputProgram element associated with the given key.
81 """Returns the specified OptionDescriptor element.
83 The parameter key represents the id. The method return the
84 OptionDescriptor element associated with the given key.
89 """Removes all the elements from _programs and _options.
91 Both the collections will be empty after this method returns.
97 """Removes the element associated with the given id from _options
100 option_id represents the id associated with an element.
105 """Removes every occurrence of a specified OptionDescriptor element
108 the parameter o represents the element to be removed.
109 The method return true if one or more elements are removed,
120 """Removes every occurrence of a specified InputProgram element from
123 The parameter p represents the element to be removed.
124 The method returns true if one or more elements are removed,
135 """Removes the element associated with the given id from _programs}
138 The parameter program_id represents the id associated with an
144 """This method have to be implemented by subclasses to execute solver
145 in an asynchronous way, if no parameters are given, the entire sets of
146 programs and option are used."""
150 """This method have to be implemented by subclasses to execute solver
151 in a synchronous way, if no parameters are given, the entire sets of
152 programs and option are used."""