comparison src/clojureDemo/VisionReader.clj @ 1:6d9bdaf919f7

added clojureDemo source
author Robert McIntyre <rlm@mit.edu>
date Fri, 20 Aug 2010 00:32:44 -0400
parents
children
comparison
equal deleted inserted replaced
0:163bf9b2fd13 1:6d9bdaf919f7
1 (ns clojureDemo.VisionReader
2 (:gen-class
3 :implements [connections.WiredBox]
4 :methods [ [process [Object] void] [setFile [Object] void] ]
5 :post-init register))
6
7 (import '(davidNackoul PlotUnitMatchAlgorithm StoryGraph PlotUnit))
8 (import '(bridge.reps.things Sequence Thing))
9
10
11 (defn -setFile
12 [this file]
13 (println "file is " file))
14
15 (defn -register
16 "equivalent to Connections.getPorts(this).addSignalProcessor(\"process\"); in Java"
17 [this]
18 (println "ClojureBox (register) : Register is run
19 only when the object is created, as if it were in every constructor.")
20 (. (connections.Connections/getPorts this) addSignalProcessor "process"))
21
22 (defn -process [ _ _ ]
23 (println "ClojureBox (process) : This is a LISP function,
24 being called through Java, through the wiredBox metaphor."))
25
26 (defn -getName
27 "the [_] means that the function gets an explicit 'this'
28 argument, just like python. In this case we don't care about it."
29 [_] "VisionReader")
30
31