25 using namespace graphlab;
47 JNIEXPORT
void JNICALL
48 Java_org_graphlab_Updater_initNative
49 (JNIEnv *env, jclass clazz){
52 env->GetMethodID(clazz,
"update",
"(JLorg/graphlab/data/Vertex;)V");
55 env->GetMethodID(clazz,
"add",
"(Lorg/graphlab/Updater;)V");
58 env->GetMethodID(clazz,
"priority",
"()D");
61 env->GetMethodID(clazz,
"clone",
"()Lorg/graphlab/Updater;");
64 env->GetMethodID(clazz,
"isFactorizable",
"()Z");
67 env->GetMethodID(clazz,
"gatherEdges",
"()I");
70 env->GetMethodID(clazz,
"scatterEdges",
"()I");
73 env->GetMethodID(clazz,
"consistency",
"()I");
76 env->GetMethodID(clazz,
"gatherConsistency",
"()I");
79 env->GetMethodID(clazz,
"scatterConsistency",
"()I");
82 env->GetMethodID(clazz,
"initGather",
"()V");
85 env->GetMethodID(clazz,
"gather",
"(Ljava/lang/Object;)V");
88 env->GetMethodID(clazz,
"merge",
"(Lorg/graphlab/Updater;)V");
91 env->GetMethodID(clazz,
"apply",
"(Lorg/graphlab/data/Vertex;)V");
94 env->GetMethodID(clazz,
"scatter",
95 "(JLjava/lang/Object;)V");
113 if (NULL == other.
obj()){
126 if (
this == &other)
return *
this;
138 void proxy_updater::operator()(icontext_type&
context){
140 jobject vertex = context.const_vertex_data().obj();
141 if (NULL == vertex)
return;
156 void proxy_updater::operator+=(
const proxy_updater& other)
const {
165 bool proxy_updater::is_factorizable()
const {
172 edge_set proxy_updater::gather_edges()
const {
184 edge_set proxy_updater::scatter_edges()
const {
196 consistency_model proxy_updater::consistency()
const {
201 case 0:
return NULL_CONSISTENCY;
202 case 1:
return VERTEX_CONSISTENCY;
203 case 2:
return EDGE_CONSISTENCY;
204 case 3:
return FULL_CONSISTENCY;
205 default:
return DEFAULT_CONSISTENCY;
209 consistency_model proxy_updater::gather_consistency()
const {
214 case 0:
return NULL_CONSISTENCY;
215 case 1:
return VERTEX_CONSISTENCY;
216 case 2:
return EDGE_CONSISTENCY;
217 case 3:
return FULL_CONSISTENCY;
218 default:
return DEFAULT_CONSISTENCY;
222 consistency_model proxy_updater::scatter_consistency()
const {
227 case 0:
return NULL_CONSISTENCY;
228 case 1:
return VERTEX_CONSISTENCY;
229 case 2:
return EDGE_CONSISTENCY;
230 case 3:
return FULL_CONSISTENCY;
231 default:
return DEFAULT_CONSISTENCY;
235 void proxy_updater::init_gather(icontext_type& context) {
241 void proxy_updater::gather(icontext_type& context,
const edge_type& edge){
243 env->CallVoidMethod(
obj(),
java_gather, context.const_edge_data(edge).obj());
247 void proxy_updater::merge(
const update_functor_type& other){
253 void proxy_updater::apply(icontext_type& context){
254 jobject vertex = context.const_vertex_data().obj();
255 if (NULL == vertex)
return;
261 void proxy_updater::scatter(icontext_type& context,
const edge_type& edge){
264 &context, context.const_edge_data(edge).obj());