Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/org/adblockplus/libadblockplus/Filter.java

Issue 6606493159784448: New JNI bindings (Closed)
Patch Set: TRY, abpEngine, statics Created April 1, 2014, 11:40 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 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 package org.adblockplus.libadblockplus;
18
19 public class Filter extends JsValue
20 {
21 static
22 {
23 System.loadLibrary("adblockplus-jni");
24 registerNatives();
25 }
26
27 public Filter(final JsValue jsValue)
28 {
29 super(ctor(jsValue.ptr));
30 }
31
32 private Filter(final long pointer)
33 {
34 super(pointer);
35 }
36
37 public Type getType()
38 {
39 return getType(this.ptr);
40 }
41
42 public boolean isListed()
43 {
44 return isListed(this.ptr);
45 }
46
47 public void addToList()
48 {
49 addToList(this.ptr);
50 }
51
52 public void removeFromList()
53 {
54 removeFromList(this.ptr);
55 }
56
57 @Override
58 public int hashCode()
59 {
60 return (int)(this.ptr >> 32) * (int)this.ptr;
61 }
62
63 @Override
64 public boolean equals(final Object o)
65 {
66 if (!(o instanceof Filter))
67 {
68 return false;
69 }
70
71 return operatorEquals(this.ptr, ((Filter)o).ptr);
72 }
73
74 public static enum Type
75 {
76 BLOCKING, EXCEPTION, ELEMHIDE, ELEMHIDE_EXCEPTION, COMMENT, INVALID;
77 }
78
79 private final static native void registerNatives();
80
81 private final static native long ctor(long jsValuePtr);
82
83 private final static native Type getType(long ptr);
84
85 private final static native boolean isListed(long ptr);
86
87 private final static native void addToList(long ptr);
88
89 private final static native void removeFromList(long ptr);
90
91 private final static native boolean operatorEquals(long ptr, long other);
92 }
OLDNEW
« no previous file with comments | « src/org/adblockplus/libadblockplus/EventCallback.java ('k') | src/org/adblockplus/libadblockplus/FilterChangeCallback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld