From a412475fa91b764a3b6e74601018623f0d3b65b3 Mon Sep 17 00:00:00 2001 From: ruiyun Date: Tue, 31 Jul 2012 09:43:34 +0800 Subject: [PATCH] Remove the unnecessary time and other tools. --- src/cljain/tools/predicate.clj | 47 ---------------------- src/cljain/tools/timer.clj | 72 ---------------------------------- 2 files changed, 119 deletions(-) delete mode 100644 src/cljain/tools/predicate.clj delete mode 100644 src/cljain/tools/timer.clj diff --git a/src/cljain/tools/predicate.clj b/src/cljain/tools/predicate.clj deleted file mode 100644 index de52136..0000000 --- a/src/cljain/tools/predicate.clj +++ /dev/null @@ -1,47 +0,0 @@ -(ns ^{:author "ruiyun" - :added "0.2.0" - :deprecated "0.4.0"} - cljain.tools.predicate) - -(defn in? - "Chekc whether v is in the coll or not." - {:added "0.2.0"} - [v coll] - (some #(= % v) coll)) - -(defmacro legal-option? - "place doc string here" - {:added "0.2.0"} - [required? & decl] - (let [options (first decl) - decl (next decl) - option-key (first decl) - decl (next decl) - modifier (if (= :by (first decl)) - (fnext decl) - identity) - decl (if (= :by (first decl)) - (nnext decl) - decl) - f (first decl) - args (next decl)] - `(let [popts# (partition-by (partial = ~option-key) ~options) - opt_exist?# (> (count popts#) 1)] - (if opt_exist?# - (let [opt# (~modifier (first (last popts#)))] - (~f opt# ~@args)) - (not ~required?))))) - -(defmacro check-required - "place doc string here" - {:arglists '([options option-key :by? option-modifier? f & args]) - :added "0.2.0"} - [& decl] - `(legal-option? true ~@decl)) - -(defmacro check-optional - "place doc string here" - {:arglists '([options option-key :by? option-modifier? f & args]) - :added "0.2.0"} - [& decl] - `(legal-option? false ~@decl)) diff --git a/src/cljain/tools/timer.clj b/src/cljain/tools/timer.clj deleted file mode 100644 index 04215b9..0000000 --- a/src/cljain/tools/timer.clj +++ /dev/null @@ -1,72 +0,0 @@ -(ns ^{:doc "place doc string here" - :author "ruiyun"} - cljain.tools.timer - (:use cljain.tools.predicate) - (:import [java.util Timer TimerTask Date])) - -(defn timer - "Create a new java.util.Timer object." - {:added "0.2.0"} - ([] (Timer.)) - ([name] (Timer. name))) - -(defn deamon-timer - "Create a new java.util.Timer object with deamon option." - {:added "0.2.0"} - [] - (Timer. true)) - -(defmacro task - "Create a java.util.TimerTask object with some code." - {:arglists '([body*]) - :added "0.2.0"} - [& body] - `(proxy [TimerTask] [] - (run [] - ~@body))) - -(defmulti run! - "Execute a timer task, then return the timer user passed or new created. - User must set one of the two options: - :at