Debian Codegraph @

native/jpype_module/src/main/java/org/jpype/ref/JPypeReference.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package org.jpype.ref;
17
18 import java.lang.ref.PhantomReference;
19 import java.lang.ref.ReferenceQueue;
20
21 /**
22 * (internal) Reference to a PyObject*.
23 */
24 class JPypeReference extends PhantomReference
25 {
26
27 long hostReference;
28 long cleanup;
29 int pool;
30 int index;
31
32 public JPypeReference(ReferenceQueue arg1, Object javaObject, long host, long cleanup)
33 {
34 super(javaObject, arg1);
35 this.hostReference = host;
36 this.cleanup = cleanup;
37 }
38
39 @Override
40 public int hashCode()
41 {
42 return (int) hostReference;
43 }
44
45 @Override
46 public boolean equals(Object arg0)
47 {
48 if (!(arg0 instanceof JPypeReference))
49 {
50 return false;
51 }
52
53 return ((JPypeReference) arg0).hostReference == hostReference;
54 }
55 }