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