EmbASP-Python
option_descriptor.py
1 class OptionDescriptor(object):
2  """Represents options for a generic ASP programs."""
3 
4  def __init__(self, initial_option=None):
5  self._options = initial_option # Where options are stored
6  self._separator = "" # Used as option separator
7 
8  def add_option(self, option):
9  """Concatenate a new option in a string format to the current _options.
10 
11  The parameter option is the string to be concatenated.
12  """
13  if self._options is None or self._options == "":
14  self.set_options(option)
15  else:
16  self._options += self._separator + option
17 
18  def clear(self):
19  """After using this method the _options variable will be empty."""
20  self._options = ""
21 
22  def get_options(self):
23  """Returns values stored in _options, in a string format."""
24  return self._options
25 
26  def get_separator(self):
27  """Get separator character."""
28  return self._separator
29 
30  def set_options(self, option):
31  """Set _option string with new string."""
32  self._options = option
33 
34  def set_separator(self, separator):
35  """Set _separator character with new separator."""
36  self._separator = separator
base.option_descriptor.OptionDescriptor.set_separator
def set_separator(self, separator)
Definition: option_descriptor.py:34
base.option_descriptor.OptionDescriptor.add_option
def add_option(self, option)
Definition: option_descriptor.py:8
base.option_descriptor.OptionDescriptor
Definition: option_descriptor.py:1
base.option_descriptor.OptionDescriptor._options
_options
Definition: option_descriptor.py:5
base.option_descriptor.OptionDescriptor.get_separator
def get_separator(self)
Definition: option_descriptor.py:26
base.option_descriptor.OptionDescriptor.set_options
def set_options(self, option)
Definition: option_descriptor.py:30
base.option_descriptor.OptionDescriptor._separator
_separator
Definition: option_descriptor.py:6
base.option_descriptor.OptionDescriptor.clear
def clear(self)
Definition: option_descriptor.py:18
base.option_descriptor.OptionDescriptor.get_options
def get_options(self)
Definition: option_descriptor.py:22