Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
openmole
openmole
Commits
ab08e21d
Unverified
Commit
ab08e21d
authored
Feb 26, 2017
by
Romain Reuillon
Browse files
[Plugin] enh: integrate netlogo 6.
parent
208b15ef
Changes
7
Hide whitespace changes
Inline
Side-by-side
libraries/build.sbt
View file @
ab08e21d
...
...
@@ -109,11 +109,30 @@ lazy val netlogo5 = OsgiProject(
"ccl.northwestern.edu.netlogo5"
,
exports
=
Seq
(
"org.nlogo.*"
),
privatePackages
=
Seq
(
"**"
),
imports
=
Seq
(
"!*"
))
settings
(
libraryDependencies
++=
Seq
(
"ccl.northwestern.edu"
%
"netlogo"
%
netLogo5Version
%
"provided"
from
s
"https://github.com/NetLogo/NetLogo/releases/download/$netLogo5Version/NetLogo.jar"
,
"org.scala-lang"
%
"scala-library"
%
"2.9.2"
%
"provided"
,
"asm"
%
"asm-all"
%
"3.3.1"
%
"provided"
,
"org.picocontainer"
%
"picocontainer"
%
"2.13.6"
%
"provided"
),
version
:=
netLogo5Version
,
scalaVersion
:=
"2.9.2"
,
crossPaths
:=
false
)
settings
(
settings
:
_
*
)
imports
=
Seq
(
"!*"
))
settings
(
libraryDependencies
++=
Seq
(
"ccl.northwestern.edu"
%
"netlogo"
%
netLogo5Version
%
"provided"
from
s
"https://github.com/NetLogo/NetLogo/releases/download/$netLogo5Version/NetLogo.jar"
,
"org.scala-lang"
%
"scala-library"
%
"2.9.2"
%
"provided"
,
"asm"
%
"asm-all"
%
"3.3.1"
%
"provided"
,
"org.picocontainer"
%
"picocontainer"
%
"2.13.6"
%
"provided"
),
version
:=
netLogo5Version
,
scalaVersion
:=
"2.9.2"
,
crossPaths
:=
false
)
settings
(
settings
:
_
*
)
lazy
val
netLogo6Version
=
"6.0.0"
lazy
val
netlogo6
=
OsgiProject
(
dir
,
"ccl.northwestern.edu.netlogo6"
,
exports
=
Seq
(
"org.nlogo.*"
),
privatePackages
=
Seq
(
"**"
),
imports
=
Seq
(
"!*"
))
settings
(
//resolvers += Resolver.bintrayRepo("netlogo", "NetLogo-JVM"),
libraryDependencies
++=
Seq
(
"org.nlogo"
%
"netlogo"
%
netLogo6Version
%
"provided"
from
s
"https://dl.bintray.com/netlogo/NetLogo-JVM/org/nlogo/netlogo/$netLogo6Version/netlogo-$netLogo6Version.jar"
,
"org.scala-lang"
%
"scala-library"
%
"2.12.1"
%
"provided"
,
"org.scala-lang.modules"
%%
"scala-parser-combinators"
%
"1.0.4"
%
"provided"
,
"org.ow2.asm"
%
"asm-all"
%
"5.0.4"
%
"provided"
,
"org.picocontainer"
%
"picocontainer"
%
"2.13.6"
%
"provided"
,
"org.parboiled"
%%
"parboiled"
%
"2.1.3"
%
"provided"
),
version
:=
netLogo6Version
,
scalaVersion
:=
"2.12.1"
,
crossPaths
:=
false
)
settings
(
settings
:
_
*
)
lazy
val
scalaTagsVersion
=
"0.6.2"
lazy
val
scalaRxVersion
=
"0.3.1"
...
...
openmole/build.sbt
View file @
ab08e21d
...
...
@@ -223,7 +223,7 @@ def corePlugins =
allDomain
++
allTools
def
allTools
=
Seq
(
netLogoAPI
,
netLogo5API
,
csv
,
pattern
,
sftpserver
)
def
allTools
=
Seq
(
netLogoAPI
,
netLogo5API
,
netLogo6API
,
csv
,
pattern
,
sftpserver
)
lazy
val
defaultActivator
=
OsgiKeys
.
bundleActivator
:=
Some
(
name
.
value
+
".Activator"
)
...
...
@@ -254,6 +254,14 @@ lazy val netLogo5API = OsgiProject(pluginDir, "org.openmole.plugin.tool.netlogo5
libraryDependencies
-=
Libraries
.
scalatest
)
settings
(
toolsSettings
:
_
*
)
lazy
val
netLogo6API
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.tool.netlogo6"
,
imports
=
Seq
(
"*"
))
dependsOn
(
netLogoAPI
)
settings
(
crossPaths
:=
false
,
autoScalaLibrary
:=
false
,
libraryDependencies
+=
Libraries
.
netlogo6
intransitive
(),
libraryDependencies
-=
Libraries
.
scalatest
)
settings
(
toolsSettings
:
_
*
)
lazy
val
csv
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.tool.csv"
,
imports
=
Seq
(
"*"
))
dependsOn
(
exception
,
openmoleDSL
)
settings
(
libraryDependencies
+=
Libraries
.
opencsv
,
defaultActivator
...
...
@@ -397,17 +405,18 @@ lazy val fileSource = OsgiProject(pluginDir, "org.openmole.plugin.source.file",
/* Task */
def
allTask
=
Seq
(
toolsTask
,
external
,
netLogo
,
netLogo5
,
jvm
,
scala
,
template
,
systemexec
,
care
,
udocker
)
def
allTask
=
Seq
(
toolsTask
,
external
,
netLogo
,
netLogo5
,
netLogo6
,
jvm
,
scala
,
template
,
systemexec
,
care
,
udocker
)
lazy
val
toolsTask
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.tools"
,
imports
=
Seq
(
"*"
))
dependsOn
(
openmoleDSL
)
settings
(
pluginSettings
:
_
*
)
lazy
val
external
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.external"
,
imports
=
Seq
(
"*"
))
dependsOn
(
openmoleDSL
,
workspace
)
settings
(
pluginSettings
:
_
*
)
lazy
val
netLogo
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.netlogo"
,
imports
=
Seq
(
"*"
))
dependsOn
(
openmoleDSL
,
external
,
netLogoAPI
)
settings
(
pluginSettings
:
_
*
)
lazy
val
netLogo5
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.netlogo5"
)
dependsOn
(
netLogo
,
openmoleDSL
,
external
,
netLogo5API
)
settings
(
pluginSettings
:
_
*
)
lazy
val
netLogo6
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.netlogo6"
)
dependsOn
(
netLogo
,
openmoleDSL
,
external
,
netLogo6API
)
settings
(
pluginSettings
:
_
*
)
lazy
val
jvm
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.jvm"
,
imports
=
Seq
(
"*"
))
dependsOn
(
openmoleDSL
,
external
,
workspace
)
settings
(
pluginSettings
:
_
*
)
lazy
val
scala
=
OsgiProject
(
pluginDir
,
"org.openmole.plugin.task.scala"
,
imports
=
Seq
(
"*"
))
dependsOn
(
openmoleDSL
,
jvm
,
console
)
settings
(
pluginSettings
:
_
*
)
...
...
openmole/plugins/org.openmole.plugin.task.netlogo6/src/main/scala/org/openmole/plugin/task/netlogo6/Activator.scala
0 → 100644
View file @
ab08e21d
/*
* Copyright (C) 2015 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.openmole.plugin.task.netlogo6
import
org.openmole.core.pluginmanager.PluginInfoActivator
class
Activator
extends
PluginInfoActivator
openmole/plugins/org.openmole.plugin.task.netlogo6/src/main/scala/org/openmole/plugin/task/netlogo6/NetLogo6Task.scala
0 → 100644
View file @
ab08e21d
/*
* Copyright (C) 2012 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.openmole.plugin.task.netlogo6
import
java.io.File
import
monocle.macros.Lenses
import
org.openmole.core.context.Val
import
org.openmole.core.workflow.builder._
import
org.openmole.core.workflow.dsl._
import
org.openmole.plugin.task.external._
import
org.openmole.plugin.task.netlogo.NetLogoTask.Workspace
import
org.openmole.plugin.task.netlogo._
import
org.openmole.plugin.tool.netlogo6._
object
NetLogo6Task
{
def
factory
=
new
NetLogoFactory
{
def
apply
=
new
NetLogo6
}
implicit
def
isTask
:
InputOutputBuilder
[
NetLogo6Task
]
=
InputOutputBuilder
(
NetLogo6Task
.
config
)
implicit
def
isExternal
:
ExternalBuilder
[
NetLogo6Task
]
=
ExternalBuilder
(
NetLogo6Task
.
external
)
implicit
def
isBuilder
=
new
NetLogoTaskBuilder
[
NetLogo6Task
]
{
override
def
netLogoInputs
=
NetLogo6Task
.
netLogoInputs
override
def
netLogoArrayOutputs
=
NetLogo6Task
.
netLogoArrayOutputs
override
def
netLogoOutputs
=
NetLogo6Task
.
netLogoOutputs
}
def
workspace
(
workspace
:
File
,
script
:
String
,
launchingCommands
:
Seq
[
String
],
seed
:
OptionalArgument
[
Val
[
Int
]]
=
None
)(
implicit
name
:
sourcecode.Name
)
:
NetLogo6Task
=
withDefaultArgs
(
workspace
=
Workspace
(
script
=
script
,
workspace
=
workspace
.
getName
),
launchingCommands
=
launchingCommands
,
seed
=
seed
)
set
(
inputs
+=
(
seed
.
option
.
toSeq
:
_
*
),
resources
+=
workspace
)
def
file
(
script
:
File
,
launchingCommands
:
Seq
[
String
],
seed
:
OptionalArgument
[
Val
[
Int
]]
=
None
)(
implicit
name
:
sourcecode.Name
)
:
NetLogo6Task
=
withDefaultArgs
(
workspace
=
Workspace
(
script
=
script
.
getName
),
launchingCommands
=
launchingCommands
,
seed
=
seed
)
set
(
inputs
+=
(
seed
.
option
.
toSeq
:
_
*
),
resources
+=
script
)
def
apply
(
script
:
File
,
launchingCommands
:
Seq
[
String
],
embedWorkspace
:
Boolean
=
false
,
seed
:
OptionalArgument
[
Val
[
Int
]]
=
None
)(
implicit
name
:
sourcecode.Name
)
:
NetLogo6Task
=
if
(
embedWorkspace
)
workspace
(
script
.
getCanonicalFile
.
getParentFile
,
script
.
getName
,
launchingCommands
,
seed
)
else
file
(
script
,
launchingCommands
,
seed
)
private
def
withDefaultArgs
(
workspace
:
NetLogoTask.Workspace
,
launchingCommands
:
Seq
[
String
],
seed
:
Option
[
Val
[
Int
]]
)(
implicit
name
:
sourcecode.Name
)
=
NetLogo6Task
(
config
=
InputOutputConfig
(),
external
=
External
(),
netLogoInputs
=
Vector
.
empty
,
netLogoOutputs
=
Vector
.
empty
,
netLogoArrayOutputs
=
Vector
.
empty
,
workspace
=
workspace
,
launchingCommands
=
launchingCommands
,
seed
=
seed
)
}
@Lenses
case
class
NetLogo6Task
(
config
:
InputOutputConfig
,
external
:
External
,
netLogoInputs
:
Vector
[(
Val
[
_
]
,
String
)],
netLogoOutputs
:
Vector
[(
String
,
Val
[
_
])],
netLogoArrayOutputs
:
Vector
[(
String
,
Int
,
Val
[
_
])],
workspace
:
NetLogoTask.Workspace
,
launchingCommands
:
Seq
[
String
],
seed
:
Option
[
Val
[
Int
]]
)
extends
NetLogoTask
{
override
def
netLogoFactory
:
NetLogoFactory
=
NetLogo6Task
.
factory
}
openmole/plugins/org.openmole.plugin.task.netlogo6/src/main/scala/org/openmole/plugin/task/netlogo6/package.scala
0 → 100644
View file @
ab08e21d
/*
* Copyright (C) 2014 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.openmole.plugin.task
package
object
netlogo6
extends
netlogo
.
NetLogoPackage
openmole/plugins/org.openmole.plugin.tool.netlogo6/src/main/java/org/openmole/plugin/tool/netlogo6/NetLogo6.java
0 → 100644
View file @
ab08e21d
/*
* Copyright (C) 2011 Romain Reuillon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package
org.openmole.plugin.tool.netlogo6
;
import
org.nlogo.agent.Observer
;
import
org.nlogo.agent.World
;
import
org.nlogo.headless.HeadlessWorkspace
;
import
org.nlogo.nvm.Procedure
;
import
org.openmole.plugin.tool.netlogo.NetLogo
;
import
scala.collection.JavaConverters
;
import
java.util.LinkedList
;
import
java.util.Map
;
/**
* @author Romain Reuillon
*/
public
class
NetLogo6
implements
NetLogo
{
protected
HeadlessWorkspace
workspace
=
HeadlessWorkspace
.
newInstance
();
@Override
public
void
open
(
String
script
)
throws
Exception
{
workspace
.
open
(
script
);
}
@Override
public
void
command
(
String
cmd
)
throws
Exception
{
workspace
.
command
(
cmd
);
}
@Override
public
Object
report
(
String
variable
)
throws
Exception
{
return
workspace
.
report
(
variable
);
}
@Override
public
void
dispose
()
throws
Exception
{
workspace
.
dispose
();
}
@Override
public
String
[]
globals
()
{
World
world
=
workspace
.
world
();
Observer
observer
=
world
.
observer
();
String
nlGlobalList
[]
=
new
String
[
world
.
getVariablesArraySize
(
observer
)];
for
(
int
i
=
0
;
i
<
nlGlobalList
.
length
;
i
++)
{
nlGlobalList
[
i
]
=
world
.
observerOwnsNameAt
(
i
);
}
return
nlGlobalList
;
}
public
String
[]
reporters
()
{
LinkedList
<
String
>
reporters
=
new
LinkedList
<
String
>();
for
(
scala
.
Tuple2
<
java
.
lang
.
String
,
org
.
nlogo
.
nvm
.
Procedure
>
e
:
JavaConverters
.
asJavaCollectionConverter
(
workspace
.
procedures
()).
asJavaCollection
())
{
if
(
e
.
_2
().
isReporter
())
reporters
.
add
(
e
.
_1
());
}
return
reporters
.
toArray
(
new
String
[
0
]);
}
@Override
public
ClassLoader
getNetLogoClassLoader
()
{
return
HeadlessWorkspace
.
class
.
getClassLoader
();
}
}
openmole/project/Libraries.scala
View file @
ab08e21d
...
...
@@ -10,6 +10,7 @@ object Libraries {
lazy
val
d3Version
=
"3.5.12"
lazy
val
tooltipserVersion
=
"3.3.0"
lazy
val
netLogo5Version
=
"5.3.1"
lazy
val
netLogo6Version
=
"6.0.0"
lazy
val
scalaTagsVersion
=
"0.6.2"
lazy
val
scalaJSDomVersion
=
"0.9.1"
lazy
val
rxVersion
=
"0.3.1"
...
...
@@ -77,6 +78,7 @@ object Libraries {
lazy
val
scalaTags
=
"org.openmole.library"
%%
"com-scalatags"
%
scalaTagsVersion
lazy
val
rx
=
"org.openmole.library"
%%
"rx"
%
rxVersion
lazy
val
netlogo5
=
"org.openmole.library"
%
"ccl-northwestern-edu-netlogo5"
%
netLogo5Version
lazy
val
netlogo6
=
"org.openmole.library"
%
"ccl-northwestern-edu-netlogo6"
%
netLogo6Version
lazy
val
sourceCode
=
"org.openmole.library"
%%
"sourcecode"
%
"0.1.2"
lazy
val
toolxitBibtex
=
"org.openmole"
%%
"toolxit-bibtex"
%
"0.2"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment