diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/clojureDemo/VisionReader.clj	Fri Aug 20 00:32:44 2010 -0400
     1.3 @@ -0,0 +1,31 @@
     1.4 +(ns clojureDemo.VisionReader
     1.5 +  (:gen-class
     1.6 +   :implements [connections.WiredBox]
     1.7 +   :methods [ [process [Object] void] [setFile [Object] void] ]
     1.8 +   :post-init register))
     1.9 +
    1.10 +(import '(davidNackoul PlotUnitMatchAlgorithm StoryGraph PlotUnit))
    1.11 +(import '(bridge.reps.things Sequence Thing))
    1.12 +
    1.13 +
    1.14 +(defn -setFile
    1.15 +  [this file]
    1.16 +  (println "file is " file))
    1.17 +
    1.18 +(defn -register
    1.19 +   "equivalent to Connections.getPorts(this).addSignalProcessor(\"process\"); in Java"
    1.20 +   [this]
    1.21 +   (println "ClojureBox  (register) : Register is run 
    1.22 +    only when the object is created, as if it were in every constructor.")
    1.23 +   (. (connections.Connections/getPorts this) addSignalProcessor "process"))
    1.24 +
    1.25 +(defn -process [ _ _ ]
    1.26 +  (println "ClojureBox (process) :  This is a LISP function, 
    1.27 +   being called through Java, through the wiredBox metaphor."))
    1.28 +
    1.29 +(defn -getName
    1.30 +  "the [_] means that  the function gets an explicit 'this'
    1.31 +    argument, just like python. In this case we don't care about it."
    1.32 +  [_]  "VisionReader")
    1.33 +
    1.34 +