Public Member Functions | Private Attributes | List of all members
generic.models.Organizational.PlotSet Class Reference
Inheritance diagram for generic.models.Organizational.PlotSet:

Public Member Functions

def __init__ (self)
 
def __contains__ (self, obj)
 
def __iter__ (self)
 
def __len__ (self)
 
def __repr__ (self)
 
def add (self, obj)
 
def discard (self, obj)
 
def iter_plot_collections (self)
 addons More...
 

Private Attributes

 _cache
 

Detailed Description

Collection of unique plot keys. 

Definition at line 255 of file Organizational.py.

Constructor & Destructor Documentation

def generic.models.Organizational.PlotSet.__init__ (   self)

Definition at line 257 of file Organizational.py.

Member Function Documentation

def generic.models.Organizational.PlotSet.__contains__ (   self,
  obj 
)

Definition at line 264 of file Organizational.py.

References generic.models.Organizational.PlotSet._cache.

264  def __contains__(self, obj):
265  if not isinstance(obj, PlotCollectionKey):
266  raise TypeError("%s items must be of type %s, not %s" % (self.__class__.__name__, PlotCollectionKey, type(obj)))
267  return obj in self._cache
268 
def generic.models.Organizational.PlotSet.__iter__ (   self)
def generic.models.Organizational.PlotSet.__len__ (   self)
def generic.models.Organizational.PlotSet.__repr__ (   self)
def generic.models.Organizational.PlotSet.add (   self,
  obj 
)

Definition at line 278 of file Organizational.py.

278  def add(self, obj):
279  if not isinstance(obj, PlotCollectionKey):
280  raise TypeError("%s items must be of type %s, not %s" % (self.__class__.__name__, PlotCollectionKey, type(obj)))
281 
282  self._cache.add(obj)
283 
def generic.models.Organizational.PlotSet.discard (   self,
  obj 
)

Definition at line 284 of file Organizational.py.

284  def discard(self, obj):
285  self._cache.discard(obj)
286 
def generic.models.Organizational.PlotSet.iter_plot_collections (   self)

addons

Iterate over the collections of plots with unique names 

Definition at line 289 of file Organizational.py.

References generic.models.Organizational.PlotSet._cache, parse_dependency_file_t.list, and PandAna.Demos.demo1.range.

290  """ Iterate over the collections of plots with unique names """
291 
292  work = list(self._cache) # make a copy
293 
294  while len(work) > 0:
295  collection = PlotSet()
296  plot_name = work[0].plot_id.name
297  collection.add([work.pop(0)])
298 
299  # iterate backwards because we're going to be removing stuff
300  # and we don't want the indices of unchecked stuff jumping under us
301  for plot_idx in range(len(work)-1, 0, -1):
302  if work[plot_idx].plot_id.name == plot_name:
303  collection.add(work.pop(plot_idx))
304 
305  yield collection
306 

Member Data Documentation

generic.models.Organizational.PlotSet._cache
private

The documentation for this class was generated from the following file: