Skip to content

Commit b00ab06

Browse files
committed
Update extension for NetLogo 6.1 support (documentation, POM for 6.1).
1 parent 3b6ccfe commit b00ab06

5 files changed

Lines changed: 160 additions & 6 deletions

File tree

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let ctr 1
4646
set ctr (ctr + 1) ])
4747
```
4848

49-
The same example in NetLogo 6 (due to syntax changes in NetLogo):
49+
The same example in NetLogo 6 or higher (due to syntax changes in NetLogo 6):
5050

5151
```
5252
; Colour and label the agents by cluster
@@ -91,26 +91,34 @@ For more comprehensive examples for both reporters, try out the demo that corres
9191

9292
* For NetLogo 5, use `demo/dbscan-clustering-demo-v5.nlogo`
9393

94-
* For NetLogo 6, use `demo/dbscan-clustering-demo-v6.nlogo`
94+
* For NetLogo 6 (and higher), use `demo/dbscan-clustering-demo-v6.nlogo`
9595

9696
Clustering agents by location should produce the following output (irrespective of NetLogo version).
9797

9898
![Location-based clustering demo output](https://github.com/chrfrantz/NetLogo-Extension-DBSCAN/raw/master/doc/ExampleLocationBasedClusteringOutput.png)
9999

100100
## Deployment
101101

102-
### Variant 1: Downloading jar files
102+
The preferred deployment variant is to use the Extension Manager provided by NetLogo 6.1 and higher (see Variant 1). For older versions of NetLogo (i.e., 6.0 or lower) you can download the corresponding jar files directly (Variant 2). Alternatively, for all supported versions of NetLogo you can build the extension from source (Variant 3).
103103

104-
To install the extension, download the zip file containing the latest version from the [releases page](https://github.com/chrfrantz/NetLogo-Extension-DBSCAN/releases) for your NetLogo version (5 or 6). It contains a folder `dbscan` that contains all relevant jar files. Unzip it to the `extensions` folder of your NetLogo installation (the final structure should correspond to `NetLogo x.x.x/app/extensions/dbscan/<jar files>`, with `x.x.x` being the installed NetLogo version).
104+
### Variant 1 (requires NetLogo 6.1.0 or higher): Installation using NetLogo Extension Manager
105105

106-
### Variant 2: Building from source
106+
Use the Extension Manager provided by NetLogo by selecting `Tools` in the menu bar, followed by `Extensions ...`. In the dialog, scroll down to the extension `DBSCAN` and click `Install`. For more details about the Extension Manager, see its official [documentation](http://ccl.northwestern.edu/netlogo/docs/extension-manager.html).
107+
108+
### Variant 2: Downloading jar files and placing in extensions folder
109+
110+
To install the extension, download the zip file containing the latest version from the [releases page](https://github.com/chrfrantz/NetLogo-Extension-DBSCAN/releases) for your NetLogo version (5, 6, or 6.1). It contains a folder `dbscan` that contains all relevant jar files. Unzip it to the `extensions` folder of your NetLogo installation (the final structure should correspond to `NetLogo x.x.x/app/extensions/dbscan/<jar files>`, with `x.x.x` being the installed NetLogo version).
111+
112+
### Variant 3: Building from source
107113

108114
You can build the extension from scratch using maven after cloning the repository.
109115

110116
* For NetLogo version 5, run `mvn clean package -f pom-v5.xml`
111117

112118
* For NetLogo version 6, run `mvn clean package -f pom-v6.xml`
113119

114-
In addition, you will need to build the [DBSCAN repository](https://github.com/chrfrantz/DBSCAN.git) (Command: `mvn package`) which contains the underlying DBSCAN algorithm. Place both jar files in the extensions subfolder `dbscan` (following the structure described under Variant 1).
120+
* For NetLogo version 6.1, run `mvn clean package -f pom-v6.1.xml`
121+
122+
In addition, you will need to build the [DBSCAN repository](https://github.com/chrfrantz/DBSCAN.git) (Command: `mvn package`) which contains the underlying DBSCAN algorithm. Place both jar files in the extensions subfolder `dbscan` (following the structure described under Variant 2).
115123

116124

demo/dbscan-clustering-demo-v5.nlogo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
;
2+
; Demonstration Model for DBSCAN extension for NetLogo (version 5).
3+
; For the use with NetLogo version 6 onwards, check dbscan-clustering-demo-v6.nlogo.
4+
;
5+
; Author: Christopher Frantz ([email protected])
6+
;
7+
; Last update: 25/05/2019
8+
;
9+
; For documentation and details about supported NetLogo versions refer to
10+
; https://github.com/chrfrantz/NetLogo-Extension-DBSCAN#readme
11+
;
12+
113
extensions [dbscan]
214

315
globals [

demo/dbscan-clustering-demo-v6.nlogo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
;
2+
; Demonstration Model for DBSCAN extension for NetLogo (version 6 onwards)
3+
; For the use with NetLogo version 5, check dbscan-clustering-demo-v5.nlogo.
4+
;
5+
; Author: Christopher Frantz ([email protected])
6+
;
7+
; Last update: 25/05/2019
8+
;
9+
; For documentation and details about supported NetLogo versions refer to
10+
; https://github.com/chrfrantz/NetLogo-Extension-DBSCAN#readme
11+
;
12+
113
extensions [dbscan]
214

315
globals [
11 MB
Binary file not shown.

pom-v6.1.xml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>org.nlogo.extensions.dbscan</groupId>
7+
<artifactId>dbscan</artifactId>
8+
<version>0.2</version>
9+
<relativePath>pom-root.xml</relativePath>
10+
</parent>
11+
12+
<groupId>org.nlogo.extensions.dbscan</groupId>
13+
<artifactId>dbscan-NetLogo6</artifactId>
14+
<version>0.2</version>
15+
<packaging>jar</packaging>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>NetLogo</groupId>
20+
<artifactId>NetLogo</artifactId>
21+
<version>6.1.0</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.scala-lang</groupId>
25+
<artifactId>scala-library</artifactId>
26+
<version>2.12.0</version>
27+
</dependency>
28+
</dependencies>
29+
30+
<build>
31+
<plugins>
32+
<!-- Make copy of source files (and recovery afterwards) before applying syntax changes to accommodate NetLogo Extensions API v6 -->
33+
<plugin>
34+
<artifactId>maven-antrun-plugin</artifactId>
35+
<version>1.4</version>
36+
<executions>
37+
<execution>
38+
<id>replace-source-file</id>
39+
<phase>generate-sources</phase>
40+
<configuration>
41+
<tasks>
42+
<copy file="src/main/java/org/nlogo/extensions/dbscan/DBSCANExtension.java" tofile="tmp/DBSCANExtension.bak"/>
43+
<copy file="src/test/java/org/nlogo/extensions/dbscan/TestNetLogoDBSCAN.java" tofile="tmp/TestNetLogoDBSCAN.bak"/>
44+
<copy file="src/main/resources/manifest.txt" tofile="tmp/manifest.bak"/>
45+
</tasks>
46+
</configuration>
47+
<goals>
48+
<goal>run</goal>
49+
</goals>
50+
</execution>
51+
<execution>
52+
<id>restore-source-file</id>
53+
<phase>package</phase>
54+
<configuration>
55+
<tasks>
56+
<move file="tmp/DBSCANExtension.bak" tofile="src/main/java/org/nlogo/extensions/dbscan/DBSCANExtension.java"/>
57+
<move file="tmp/TestNetLogoDBSCAN.bak" tofile="src/test/java/org/nlogo/extensions/dbscan/TestNetLogoDBSCAN.java"/>
58+
<move file="tmp/manifest.bak" tofile="src/main/resources/manifest.txt"/>
59+
</tasks>
60+
</configuration>
61+
<goals>
62+
<goal>run</goal>
63+
</goals>
64+
</execution>
65+
</executions>
66+
</plugin>
67+
<!-- Replacing syntax to accommodate NetLogo Extensions API v6 -->
68+
<plugin>
69+
<groupId>com.google.code.maven-replacer-plugin</groupId>
70+
<artifactId>replacer</artifactId>
71+
<version>1.5.3</version>
72+
<executions>
73+
<execution>
74+
<phase>process-sources</phase>
75+
<goals>
76+
<goal>replace</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
<configuration>
81+
<includes>
82+
<include>${basedir}/src/main/java/org/nlogo/extensions/dbscan/DBSCANExtension.java</include>
83+
<include>${basedir}/src/test/java/org/nlogo/extensions/dbscan/TestNetLogoDBSCAN.java</include>
84+
<include>${basedir}/src/main/resources/manifest.txt</include>
85+
</includes>
86+
<replacements>
87+
<replacement>
88+
<token>import org.nlogo.core.LogoList;</token>
89+
<value>import org.nlogo.api.LogoList;</value>
90+
</replacement>
91+
<replacement>
92+
<token>NetLogo-Extension-API-Version: 5.0</token>
93+
<value>NetLogo-Extension-API-Version: 6.1</value>
94+
</replacement>
95+
<replacement>
96+
<token>import org.nlogo.api.DefaultReporter;</token>
97+
<value>import org.nlogo.api.Reporter;</value>
98+
</replacement>
99+
<replacement>
100+
<token>import org.nlogo.api.Syntax;</token>
101+
<value>import org.nlogo.core.Syntax;
102+
import org.nlogo.core.SyntaxJ;</value>
103+
</replacement>
104+
<replacement>
105+
<token>Syntax.reporterSyntax</token>
106+
<value>SyntaxJ.reporterSyntax</value>
107+
</replacement>
108+
<replacement>
109+
<token>extends DefaultReporter</token>
110+
<value>implements Reporter</value>
111+
</replacement>
112+
<replacement>
113+
<token>java-netlogo-clustering-test-v5.nlogo</token>
114+
<value>java-netlogo-clustering-test-v6.nlogo</value>
115+
</replacement>
116+
</replacements>
117+
</configuration>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
122+
</project>

0 commit comments

Comments
 (0)