Exemple #1
0
    def __repr__(self):
        '''
        Get a string representation of the node range.
        
        Example output:
        <garlicsim.data_structures.NodeRange, from node with clock 2 to block
        that ends at clock 102, containing 101 nodes total, at 0x291c550>
        '''
        return '<%s, from %s %s to %s %s, containing %s nodes total, at %s>' \
               % (

                   address_tools.describe(type(self), shorten=True),

                   'block that starts at clock' if isinstance(self.head, Block)
                   else 'node with clock',

                   self.head[0].state.clock if isinstance(self.head, Block)
                   else self.head.state.clock,

                   'block that ends at clock' if \
                   isinstance(self.tail, Block) else 'node with clock',

                   self.tail[-1].state.clock if isinstance(self.tail, Block) \
                   else self.tail.state.clock,

                   cute_iter_tools.get_length(self),

                   hex(id(self))
               )
Exemple #2
0
 def __repr__(self):
     '''
     Get a string representation of the node range.
     
     Example output:
     <garlicsim.data_structures.NodeRange, from node with clock 2 to block
     that ends at clock 102, containing 101 nodes total, at 0x291c550>
     '''
     return '<%s, from %s %s to %s %s, containing %s nodes total, at %s>' \
            % (
                
                misc_tools.shorten_class_address(
                    self.__class__.__module__,
                    self.__class__.__name__
                    ),
                
                'block that starts at clock' if isinstance(self.start, Block) \
                else 'node with clock',
                
                self.start[0].state.clock if isinstance(self.start, Block) \
                else self.start.state.clock,
                
                'block that ends at clock' if \
                isinstance(self.end, Block) else 'node with clock',
                
                self.end[-1].state.clock if isinstance(self.end, Block) \
                else self.end.state.clock,
                
             cute_iter_tools.get_length(self),
             
             hex(id(self))
            )
Exemple #3
0
 def __repr__(self):
     """
     Get a string representation of the node range.
     
     Example output:
     <garlicsim.data_structures.NodeRange, from node with clock 2 to block
     that ends at clock 102, containing 101 nodes total, at 0x291c550>
     """
     return "<%s, from %s %s to %s %s, containing %s nodes total, at %s>" % (
         address_tools.describe(type(self), shorten=True),
         "block that starts at clock" if isinstance(self.head, Block) else "node with clock",
         self.head[0].state.clock if isinstance(self.head, Block) else self.head.state.clock,
         "block that ends at clock" if isinstance(self.tail, Block) else "node with clock",
         self.tail[-1].state.clock if isinstance(self.tail, Block) else self.tail.state.clock,
         cute_iter_tools.get_length(self),
         hex(id(self)),
     )