Skip to content

Instantly share code, notes, and snippets.

View szarnekow's full-sized avatar

Sebastian Zarnekow szarnekow

View GitHub Profile
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: /development/java/maven-3.5.2
Java version: 1.8.0_144, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /development/java/maven-3.5.2/conf/settings.xml
[DEBUG] Reading user settings from /Users/zarnekow/.m2/settings.xml
[DEBUG] Using local repository at /Users/zarnekow/.m2/repository
package qn.interned;
import cfg.Config;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
module org.eclipse.xtext.example.arithmetics.GenerateArithmetics
import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*
var rootPath = ".."
var sublimePath
/*
* Some more stuff in between
package org.xtext.example.mydsl
import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.AbstractElement
import org.eclipse.xtext.Alternatives
import org.eclipse.xtext.CharacterRange
import org.eclipse.xtext.EOF
import org.eclipse.xtext.GrammarUtil
import org.eclipse.xtext.Group
import org.eclipse.xtext.Keyword
@szarnekow
szarnekow / MultiLangInjectorProvider.xtend
Last active August 29, 2015 14:07
Small example to show how to test multiple DSLs with Xtext
class MultiLangInjectorProvider extends MyDslInjectorProvider {
override protected internalCreateInjector() {
// trigger injector creation of other language
new SecondDslInjectorProvider().getInjector
return super.internalCreateInjector()
}
}
@szarnekow
szarnekow / gist:ea256af86126b9718627
Created June 26, 2014 06:39
Multiple inheritance in Xtext
A: // not necessarily called anywhere
SomeA | AB
;
B: // not necessarily called anywhere
SomeB | AB
;
AB:
a='a' b='b'
;
import java.util.Arrays;
import java.util.stream.IntStream;
public class C {
public int parallelSumJava8(int reps) {
int result = 0;
for (int i = 0; i < reps; i++) {
final int i_ = i;
result += Arrays.stream(array).parallel().map(e -> e * 5 * i_).sum();
import com.google.caliper.Benchmark;
import com.google.caliper.Param;
import com.google.caliper.api.Macrobenchmark;
import com.google.caliper.runner.CaliperMain;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.List;
public class IntArraySumBenchmark extends Benchmark {
package annotations
import java.lang.annotation.Documented
import java.lang.annotation.ElementType
import java.lang.annotation.Target
import java.util.List
import java.util.Set
import org.eclipse.xtend.lib.macro.Active
import org.eclipse.xtend.lib.macro.RegisterGlobalsContext
import org.eclipse.xtend.lib.macro.RegisterGlobalsParticipant
@szarnekow
szarnekow / CarElement.xtend
Last active December 15, 2015 06:09
Illustration of the visitor pattern with Active Annotations.
@Visitable
abstract class CarElement {
// placeholder
def void accept(CarElementVisitor visitor)
}
@Data
class Wheel extends CarElement {
String name;
}
class Engine extends CarElement {}