Skip to content

Instantly share code, notes, and snippets.

View edefazio's full-sized avatar
🙂
Focusing

edefazio

🙂
Focusing
View GitHub Profile
@edefazio
edefazio / codestyle.GoogleSpacing_No_Comments.java
Last active February 29, 2016 02:31
Baseline Code Style Using Googles code conventions
package codestyle;
public class GoogleSpacing_No_Comments {
public static int a = 0;
public static int b = 0;
public static int c = 0;
public static int d = 0;
public static int e = 0;
public static int s = 0;
public static int n = 0;
@edefazio
edefazio / ex.codestyle.WhyThisFormatVersesThat.java
Last active March 8, 2016 17:33
Examples of Alternative Styles... why Eric's Style is superior with examples with rationale
package ex.codestyle;
public class WhyThisFormatVersesThat
{
/**
* Style Rule: There is NO SPACE between a method name, catch, for, if, statements
* and it's opening parenthesis
*/
public static class OpenParen
{
@edefazio
edefazio / ex.varcode._1.java
Last active June 28, 2016 15:04
VARCODE Self-Tailoring Java Code
package ex.varcode;
/*{-*/
import io.varcode.tailor.java.JavaCase;
/*-}*/
public class /*{+className*/_1/*+}*/
{
public /*{+className*/_1/*+}*/()
{
@edefazio
edefazio / ex.javapoet.JavaPoetHelloWorldMeta.java
Created September 1, 2016 22:08
Java metaprogramming using JavaPoet to generate .java source and the varcode InMemoryJavacCompiler
package ex.javapoet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.lang.model.element.Modifier;
import com.squareup.javapoet.JavaFile;
@edefazio
edefazio / ex.varcode.bindml.BindMLHelloWorldMeta.java
Created September 1, 2016 22:13
varcode Metaprogramming using BindML
package ex.varcode.bindml;
import varcode.dom.Dom;
import varcode.java.Java;
import varcode.java.JavaCase;
import varcode.markup.bindml.BindML;
/**<PRE>
* *1* Compiles a Dom from BindML source
* *2* Authors (.java) code by binding data to the Dom
@edefazio
edefazio / ex.varcode.codeml.CodeMLHelloWorld.java
Created September 1, 2016 22:17
varcode metaprogramming using CodeML (generating .java code and running at runtime)
package ex.varcode.codeml;
import varcode.java.Java;
/*{$$condenseBlankLines$$}*/
/*{-*/import varcode.java.JavaCase;/*-}*/
public class /*{+className*/CodeMLHelloWorld/*+}*/ {
public static void main( String[] args ) {
System.out.println( "{+message+}" );
}
@edefazio
edefazio / ex.varcode.java.model.JavaModelHelloWorld.java
Created September 1, 2016 22:20
varcode metaprogramming with the JavaModel Api (generating .java code and running at runtime)
package ex.varcode.java.model;
import varcode.java.Java;
import varcode.java.JavaCase;
import varcode.java.model._class;
/**<PRE>
* *1* build a _class model
* *2* print out the model (.java) source
* *3* (javac) compile the (.java) source to a .class
@edefazio
edefazio / swar.subword.SWARPacked_v_ListLambda_Perf.java
Last active September 7, 2016 19:49
SWAR Data Locality and Java Lambdas (Query performance of Lambdas verses SWAR binary packed rows)
package swar.subword;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@edefazio
edefazio / ex.varcode.KitchenSink.java
Created September 26, 2016 01:04
varcode Java Model Kitchen Sink example (authors a Class and interface utilizing much of the Java model API)
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import varcode.java.code._class;
import varcode.java.code._code;
import varcode.java.code._interface;
import varcode.java.code._methods._method;
package quickstart.java;
import junit.framework.TestCase;
import varcode.java._Java;
import varcode.java.langmodel._class;
/**
* varcode makes generating Java source code easy with the langmodel API.
*
* Models like {@code _class, _enum, and _interface} can also be compiled