Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / src / bindings / java / jmsg_as.cpp
index d921d3e..5d9b460 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings of the NetZones.                                           */
 
-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -56,7 +56,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_As_nativeInit(JNIEnv* env, jclass cl
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) {
   simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
-  return env->NewStringUTF(as->getCname());
+  return env->NewStringUTF(as->get_cname());
 }
 
 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) {
@@ -69,14 +69,14 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
   if (not cls)
     return nullptr;
 
-  jtable = env->NewObjectArray(static_cast<jsize>(self_as->getChildren()->size()), cls, nullptr);
+  jtable = env->NewObjectArray(static_cast<jsize>(self_as->get_children().size()), cls, nullptr);
 
   if (not jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return nullptr;
   }
 
-  for (auto const& tmp_as : *self_as->getChildren()) {
+  for (auto const& tmp_as : self_as->get_children()) {
     jobject tmp_jas = jnetzone_new_instance(env);
     if (not tmp_jas) {
       jxbt_throw_jni(env, "java As instantiation failed");
@@ -127,8 +127,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   if (not cls)
     return nullptr;
 
-  std::vector<sg_host_t> table;
-  as->getHosts(&table);
+  std::vector<simgrid::s4u::Host*> table = as->get_all_hosts();
 
   jtable = env->NewObjectArray(static_cast<jsize>(table.size()), cls, nullptr);
 
@@ -141,11 +140,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   for (auto const& host : table) {
     jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
     if (not jhost) {
-      jname = env->NewStringUTF(host->getCname());
+      jname = env->NewStringUTF(host->get_cname());
 
       jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname);
 
-      env->ReleaseStringUTFChars(static_cast<jstring>(jname), host->getCname());
+      env->ReleaseStringUTFChars(static_cast<jstring>(jname), host->get_cname());
     }
 
     env->SetObjectArrayElement(jtable, index, jhost);