File: jser2_classes.py

package info (click to toggle)
jython 2.5.3-16%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 43,772 kB
  • ctags: 106,434
  • sloc: python: 351,322; java: 216,349; xml: 1,584; sh: 330; perl: 114; ansic: 102; makefile: 45
file content (47 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from java.io import Serializable
from java.lang import Object

class A:
    def __init__(self, a):
        self.a = a
    def __eq__(self, other):
        return self.__class__ == other.__class__ and self.__dict__ == other.__dict__
    def __ne__(self, other):
        return not (self == other)

class AJ(Object, Serializable):
    def __init__(self, a):
        self.a = a
    def __eq__(self, other):
        return self.__class__ == other.__class__ and self.__dict__ == other.__dict__
    def __ne__(self, other):
        return not (self == other)

class N(object):
    def __init__(self, a):
        self.a = a
    def __eq__(self, other):
        return self.__class__ == other.__class__ and self.__dict__ == other.__dict__
    def __ne__(self, other):
        return not (self == other)

class NL(list):
    def __init__(self, a, *x):
        list.__init__(self, x)
        self.a = a
    def __eq__(self, other):
        return (self.__class__ == other.__class__ and list.__eq__(self, other) and
                self.__dict__ == other.__dict__)
    def __ne__(self, other):
        return not (self == other)

class NT(tuple):
    def __new__(typ, a, *x):
        nt = tuple.__new__(typ, x)
        nt.a = a
        return nt
    def __eq__(self, other):
        return (self.__class__ == other.__class__ and tuple.__eq__(self, other) and
                self.__dict__ == other.__dict__)
    def __ne__(self, other):
        return not (self == other)