Dierk König Dierk

View GroovyDelegatingTrait
1 2 3 4 5 6 7 8 9
// has all methods of List
trait ListLike {
@Delegate List linkedList = new LinkedList()
}
 
// stores anything but exposes only Strings
class StringList implements ListLike {
String get(int index) { linkedList.get(index).toString() }
}
View ModularGroovyTraits
1 2 3 4 5 6 7 8 9 10
trait HasId {
long id
}
trait HasVersion {
long version
}
trait Persistent {
boolean save() { println "saving ${this.dump()}" }
}
trait Entity implements Persistent, HasId, HasVersion {
View CallJSR223.groovy
1 2 3 4 5 6 7 8 9
package com.canoo
 
import javax.script.*
 
//Get the Frege Script Engine
final frege = new ScriptEngineManager().getEngineByName("frege")
 
//Evaluate an expression
println frege.eval('show $ take 10 [2,4..]')
View build.gradle
1 2 3 4 5 6 7 8 9 10
/**
Making the Frege language available. Compiler and Runtime is all in one jar.
To be completed.
@author Dierk Koenig
*/
apply plugin:'java'
 
def frege_version = '3.21.190'
def qualifier = 'g714a7cc'
def frege_jar = file(System.properties.'user.home'+"/.frege/home/frege-${frege_version}.jar")
View AntMoves.groovy
1 2 3 4 5 6 7 8 9
import groovy.transform.Immutable
import groovyx.gpars.dataflow.KanbanFlow
import groovyx.gpars.dataflow.KanbanLink
import groovyx.gpars.dataflow.KanbanTray
import groovyx.gpars.dataflow.ProcessingNode
import static groovyx.gpars.dataflow.ProcessingNode.node
 
/*
For a general introduction see https://gist.github.com/Dierk/6365780.
View StatelessKanbanFlowGOLmassive.groovy
1 2 3 4 5 6 7 8 9 10
import groovyx.gpars.dataflow.KanbanFlow
import groovyx.gpars.dataflow.KanbanLink
import groovyx.gpars.dataflow.KanbanTray
import groovyx.gpars.dataflow.ProcessingNode
import static groovyx.gpars.dataflow.ProcessingNode.node
 
/*
A massively parallel game of life with KanbanFlow.
Every cell signals to all neighbors when it has a new value.
Every cell waits for signals from all its neighbors.
View SynchronousInMemoryClientConnector.groovy
1 2 3 4 5 6 7 8 9 10
/*
* Copyright 2012-2013 Canoo Engineering AG.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View pre-receive.groovy
1 2 3 4 5 6 7 8 9 10
// a git pre-receive hook
// that automatically merges all pushes to feature branches
// into a dedicated continuous-integration (ci) branch.
// Since we cannot merge in a bare repo, we work on a temporary clone.
// Dierk Koenig
 
def ciBranch = 'master'
def mergeName = 'merge'
 
def hereDirPath = new File('.').canonicalPath
View build.gradle
1 2 3 4 5 6 7 8 9 10
apply plugin:'groovy'
apply plugin:'idea'
 
repositories { mavenCentral() }
 
dependencies {
groovy 'org.codehaus.groovy:groovy-all:1.8.2'
}
 
task makeDirs(description:'make all dirs for project setup') << {
View KanbanDemo.groovy
1 2 3 4 5 6 7 8 9 10
import groovyx.gpars.dataflow.DataFlowQueue
import groovyx.gpars.dataflow.operator.DataFlowPoisson
import static groovyx.gpars.dataflow.DataFlow.operator
import java.util.concurrent.atomic.AtomicInteger
 
def upstream = new DataFlowQueue() // empty trays travel back upstream to the producer
def downstream = new DataFlowQueue() // trays with products travel to the consumer downstream
 
def prodWiring = [inputs: [upstream], outputs: [downstream], maxForks: 3 ] // maxForks is optional
def consWiring = [inputs: [downstream], outputs: [upstream], maxForks: 3 ] // maxForks is optional
Something went wrong with that request. Please try again.