commit fb86d14c8129448014fd142d43f35b0a1c4e16cc Author: Jim Infield Date: Fri Jul 31 16:31:59 2015 -0500 Initial commit diff --git a/benchmarkIt.groovy b/benchmarkIt.groovy new file mode 100644 index 0000000..e97e361 --- /dev/null +++ b/benchmarkIt.groovy @@ -0,0 +1,12 @@ +def benchmark(int count, Closure worker) { + def start = System.nanoTime() + count.times { worker(it) } + def stop = System.nanoTime() + return stop - start +} + +def intCast = benchmark(500000) { (int) it / 2 } +def intMeth = benchmark(500000) { it.intdiv(2) } + +println "Integer cast: ${intCast/intCast * 100}%" +println "Method call: ${(intMeth/intCast * 100).toFloat().round(1)}%" \ No newline at end of file diff --git a/domain_artifact.groovy b/domain_artifact.groovy new file mode 100644 index 0000000..f1fbd18 --- /dev/null +++ b/domain_artifact.groovy @@ -0,0 +1,33 @@ +@artifact.package@/** + * @artifact.name@ + * A domain class describes the data object and it's mapping to the database + */ +class @artifact.name@ { + + /* Default (injected) attributes of GORM */ +// Long id +// Long version + + /* Automatic timestamping of GORM */ +// Date dateCreated +// Date lastUpdated + +// static belongsTo = [] // tells GORM to cascade commands: e.g., delete this object if the "parent" is deleted. +// static hasOne = [] // tells GORM to associate another domain object as an owner in a 1-1 mapping +// static hasMany = [] // tells GORM to associate other domain objects for a 1-n or n-m mapping +// static mappedBy = [] // specifies which property should be used in a mapping + + static mapping = { + } + + static constraints = { + } + + /* + * Methods of the Domain Class + */ +// @Override // Override toString for a nicer / more descriptive UI +// public String toString() { +// return "${name}"; +// } +} diff --git a/testTimeCategory.groovy b/testTimeCategory.groovy new file mode 100644 index 0000000..610e40c --- /dev/null +++ b/testTimeCategory.groovy @@ -0,0 +1,9 @@ +import groovy.time.TimeCategory +use(TimeCategory) { + def now = new Date() + def then = now + 14.weeks + 6.days + def fmt = 'EEE MMM dd yyyy' + println now.clearTime() + println now.format(fmt) + println then.format(fmt) +}