OLD | NEW |
| (Empty) |
1 /* | |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
3 * Copyright (C) 2006-2016 Eyeo GmbH | |
4 * | |
5 * Adblock Plus is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License version 3 as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 package org.adblockplus.libadblockplus; | |
19 | |
20 public final class Subscription extends JsValue | |
21 { | |
22 static | |
23 { | |
24 System.loadLibrary("adblockplus-jni"); | |
25 registerNatives(); | |
26 } | |
27 | |
28 public Subscription(final JsValue jsValue) | |
29 { | |
30 super(ctor(jsValue.ptr)); | |
31 } | |
32 | |
33 private Subscription(final long ptr) | |
34 { | |
35 super(ptr); | |
36 } | |
37 | |
38 public boolean isListed() | |
39 { | |
40 return isListed(this.ptr); | |
41 } | |
42 | |
43 public void addToList() | |
44 { | |
45 addToList(this.ptr); | |
46 } | |
47 | |
48 public void removeFromList() | |
49 { | |
50 removeFromList(this.ptr); | |
51 } | |
52 | |
53 public void updateFilters() | |
54 { | |
55 updateFilters(this.ptr); | |
56 } | |
57 | |
58 public boolean isUpdating() | |
59 { | |
60 return isUpdating(this.ptr); | |
61 } | |
62 | |
63 @Override | |
64 public int hashCode() | |
65 { | |
66 return (int)(this.ptr >> 32) * (int)this.ptr; | |
67 } | |
68 | |
69 @Override | |
70 public boolean equals(final Object o) | |
71 { | |
72 if (!(o instanceof Subscription)) | |
73 { | |
74 return false; | |
75 } | |
76 | |
77 return operatorEquals(this.ptr, ((Subscription)o).ptr); | |
78 } | |
79 | |
80 private final static native void registerNatives(); | |
81 | |
82 private final static native long ctor(long jsValuePtr); | |
83 | |
84 private final static native boolean isListed(long ptr); | |
85 | |
86 private final static native void addToList(long ptr); | |
87 | |
88 private final static native void removeFromList(long ptr); | |
89 | |
90 private final static native void updateFilters(long ptr); | |
91 | |
92 private final static native boolean isUpdating(long ptr); | |
93 | |
94 private final static native boolean operatorEquals(long ptr, long other); | |
95 } | |
OLD | NEW |