예제 #1
0
 def __eq__(self, other):
     """
     @return: true if this C{CFGProduction} is equal to C{other}.
     @rtype: C{boolean}
     """
     return (_classeq(self, other) and
             self._lhs == other._lhs and
             self._rhs == other._rhs)
예제 #2
0
 def __eq__(self, other):
     """
     @return: True if this non-terminal is equal to C{other}.  In
         particular, return true iff C{other} is a C{Nonterminal}
         and this non-terminal's symbol is equal to C{other}'s
         symbol.
     @rtype: C{boolean}
     """
     return (self is other or _classeq(self, other) and
             self._symbol == other._symbol)
예제 #3
0
 def __eq__(self, other):
     return (_classeq(self, other) and
             self._lhs == other._lhs and
             self._rhs == other._rhs and
             self.prob() == other.prob())
예제 #4
0
 def __cmp__(self, other):
     if not _classeq(self, other): return -1
     return cmp((self._lhs, self._rhs), (other._lhs, other._rhs))