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

Delta Between Two Patch Sets: src/org/adblockplus/libadblockplus/Filter.java

Issue 6606493159784448: New JNI bindings (Closed)
Left Patch Set: Style review fixes Created March 28, 2014, 11 a.m.
Right Patch Set: Removed TODO from AppInfo. Created April 11, 2014, 1:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
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
18 package org.adblockplus.libadblockplus;
19
20 public class Filter extends JsValue
21 {
22 static
23 {
24 System.loadLibrary("adblockplus-jni");
25 registerNatives();
26 }
27
28 public Filter(final JsValue jsValue)
29 {
30 super(ctor(jsValue.ptr));
31 }
32
33 private Filter(final long pointer)
34 {
35 super(pointer);
36 }
37
38 public Type getType()
39 {
40 return getType(this.ptr);
41 }
42
43 public boolean isListed()
44 {
45 return isListed(this.ptr);
46 }
47
48 public void addToList()
49 {
50 addToList(this.ptr);
51 }
52
53 public void removeFromList()
54 {
55 removeFromList(this.ptr);
56 }
57
58 @Override
59 public int hashCode()
60 {
61 return (int)(this.ptr >> 32) * (int)this.ptr;
62 }
63
64 @Override
65 public boolean equals(final Object o)
66 {
67 if (!(o instanceof Filter))
68 {
69 return false;
70 }
71
72 return operatorEquals(this.ptr, ((Filter)o).ptr);
73 }
74
75 public static enum Type
76 {
77 BLOCKING, EXCEPTION, ELEMHIDE, ELEMHIDE_EXCEPTION, COMMENT, INVALID;
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 Type getType(long ptr);
85
86 private final static native boolean isListed(long ptr);
87
88 private final static native void addToList(long ptr);
89
90 private final static native void removeFromList(long ptr);
91
92 private final static native boolean operatorEquals(long ptr, long other);
93 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld