File: jser2_classes.py

package info (click to toggle)
jython 2.5.3-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 43,304 kB
  • sloc: python: 351,314; java: 216,338; xml: 1,547; sh: 330; perl: 124; ansic: 102; makefile: 101
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)