Message from discussion
defaultreporter
Received: by 10.180.7.202 with SMTP id l10mr639874wia.4.1336116891854;
Fri, 04 May 2012 00:34:51 -0700 (PDT)
X-BeenThere: netlogo-devel@googlegroups.com
Received: by 10.216.216.207 with SMTP id g57ls2191800wep.0.gmail; Fri, 04 May
2012 00:34:51 -0700 (PDT)
Received: by 10.180.98.129 with SMTP id ei1mr639833wib.3.1336116891374;
Fri, 04 May 2012 00:34:51 -0700 (PDT)
Received: by 10.180.98.129 with SMTP id ei1mr639832wib.3.1336116891362;
Fri, 04 May 2012 00:34:51 -0700 (PDT)
Return-Path: <simone.gabbriell...@gmail.com>
Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169])
by gmr-mx.google.com with ESMTPS id w8si1370960wiv.3.2012.05.04.00.34.51
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 04 May 2012 00:34:51 -0700 (PDT)
Received-SPF: pass (google.com: domain of simone.gabbriell...@gmail.com designates 209.85.212.169 as permitted sender) client-ip=209.85.212.169;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of simone.gabbriell...@gmail.com designates 209.85.212.169 as permitted sender) smtp.mail=simone.gabbriell...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-wi0-f169.google.com with SMTP id hm17so1024095wib.2
for <netlogo-devel@googlegroups.com>; Fri, 04 May 2012 00:34:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to
:cc:content-type:content-transfer-encoding;
bh=Q7saUt4IAQE2HM8QAn6YEvJ+YG3Vesc9wWACPSRxX/4=;
b=039p3FkAqoPBR8ay+HRo/7lmDNSfXMImI6aNeRayprZsXneFHbEnwzL2dvWOH4qT0f
8TN8zwC8HRJVtCXWcmW1SykD8THrNdQ0zXOz+ZNU2pTT177oT2E9CqSIQaD40+KxxjoW
73+7HmRU/P2209jAGfUb+tAObHsjDlwIClynmxo8vHiomsTVDrwTz9AmMevcfGuEMsQV
yc2TgUst4cob1a453n0PeG2PQwre5HXK1TWgd78P+6/Q5GOt+8kVRXh6F/j/DRtNKlJ0
DluQdptT3tcm7LMNy9js4A7VyLnV4DCghrOh1M5J/lc12/ZC1LyCG0CJahYb2c+XYujl
NAUA==
Received: by 10.180.24.7 with SMTP id q7mr9768748wif.11.1336116891238; Fri, 04
May 2012 00:34:51 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.223.118.132 with HTTP; Fri, 4 May 2012 00:34:30 -0700 (PDT)
In-Reply-To: <55574.1336065...@sethp.local>
References: <CAEy8Jr3PqWZKXMVx3=ER6rzKM=AvsHf8cP6cpqDRpsFeiB8...@mail.gmail.com>
<55574.1336065...@sethp.local>
From: Simone Gabbriellini <simone.gabbriell...@gmail.com>
Date: Fri, 4 May 2012 09:34:30 +0200
Message-ID: <CAEy8Jr1g4v9_qe-YKnTXMF+F7iJfSDPQOyoOANXqa8fE8qK...@mail.gmail.com>
Subject: Re: [netlogo-devel] defaultreporter
To: Seth Tisue <s...@tisue.net>
Cc: netlogo-devel@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi Seth,
I followed your instructions, and everything's working, both turtles
and links are created in my extension (call it A) and correctly showed
in the netlogo world. I thus have a question, since another extension
of mine (call it B) is not working properly with turtles and links
from the world produced by extension A.
is this all the code I need to correctly create turtles:
int numberOfTurtles =3D af.keySet().size();
World world =3D (World) cntxt.getAgent().world();
world.clearAll();
if (numberOfTurtles > 0) {
AgentSet breed =3D world.turtles();
org.nlogo.util.MersenneTwisterFast random =3D cntxt.getRNG();
for (String s : af.keySet()) {
Turtle turtle =3D world.createTurtle(breed, 10,
random.nextInt(360));
turtle.shape("circle");
turtle.label(s);
}
}
or is there a step I am missing?
thanks,
Simone
2012/5/3 Seth Tisue <s...@tisue.net>:
>>>>>> "Simone" =3D=3D Simone Gabbriellini <simone.gabbriell...@gmail.com> =
writes:
>
> =A0Simone> Seth, I have omitted that part and it works perfectly, cause m=
y
> =A0Simone> primitive does not need that syntax... :)
>
> =A0Simone> a last thing, if I may... is there a java counterpart for:
> =A0Simone> let myturtle one-of turtles with [label =3D "mystring"]
>
> api.AgentSet provides an `agents` method for iterating over the agents.
> It returns a java.lang.Iterable<Agent>.
>
> If you want the agents in random order, and/or if you want to squeeze
> out every last drop of performance, then cast from api.AgentSet to
> agent.AgentSet and call the `iterator` or `shufflerator` methods. =A0For
> maximum performance, these methods return agent.AgentSet.Iterator rather
> than java.lang.Iterator<Agent>.
>
> --
> Seth Tisue | Northwestern University | http://tisue.net
> lead developer, NetLogo: http://ccl.northwestern.edu/netlogo/
--=20
Dr. Simone Gabbriellini
DigitalBrains srl
Amministratore
Head R&D
mobile: +39 3403975626
mail: simone.gabbriell...@gmail.com