text:
var GENES = (function () {
    "use strict";

    function Context(registry) {
        this.registry = registry;
        this.chromosomes = [];
        this.symbolTable = [];
    }

    Context.prototype.addChromosome = function (chromosome) {
        this.chromosomes.push(chromosome);
    };

    Context.prototype.findMatching = function (type, allowTarget) {
        type = SLUR_TYPES.makeParametersUnique(type);
        var matching = this.registry.findMatch(type);
        for (var c = 0; c < (this.chromosomes.length - (allowTarget ? 0 : 1)); ++c) {
            var genes = this.chromosomes[c].namedGenes();
            for (var g = 0; g < genes.length; ++g) {
                var gene = genes[g];
                if (gene.gene.type.match(type).matches) {
                    matching.push(new SLUR.Symbol(gene.name));
                }
            }
        }
        for (var s = 0; s < this.symbolTable.length; ++s) {
            var entry = this.symbolTable[s];
            if (type.match(entry.type).matches) {
                matching.push(entry.symbol);
            }
        }
        return matching;
    };

    Context.prototype.pushSymbol = function (name, type) {
        this.symbolTable.push({symbol: new SLUR.Symbol(name), type: type});
    };

    Context.prototype.popSymbols = function (count) {
        this.symbolTable.splice(this.symbolTable.length - count, count);
    };

    Context.prototype.findFunctionReturning = function (returnType, allowTarget) {
        returnType = SLUR_TYPES.makeParametersUnique(returnType);
        var matching = this.registry.findFunctionReturning(returnType);
        for (var c = 0; c < (this.chromosomes.length - (allowTarget ? 0 : 1)); ++c) {
            var genes = this.chromosomes[c].namedGenes();
            for (var g = 0; g < genes.length; ++g) {
                var gene = genes[g];
                if (SLUR_TYPES.isFunctionType(gene.gene.type)) {
                    var match = returnType.match(gene.gene.type.returnType);
                    if(match.matches) {
                        matching.push({symbol: new SLUR.Symbol(gene.name), type: gene.gene.type.substitute(match.mappings)});
                    }
                }
            }
        }
        for (var s = 0; s < this.symbolTable.length; ++s) {
            var entry = this.symbolTable[s];
            if (SLUR_TYPES.isFunctionType(entry.type)) {
                var entryMatch = returnType.match(entry.type.returnType);
                if (entryMatch.matches) {
                    matching.push({symbol: entry.symbol, type: entry.type.substitute(entryMatch.mappings)});
                }
            }
        }
        return matching;
    };

    Context.prototype.findConcreteTypes = function() {
        var result = [];
        for (var s = 0; s < this.symbolTable.length; ++s) {
            var entry = this.symbolTable[s];
            entry.type.findConcrete(result);
        }
        return result;
    };

    var P = SLUR_TYPES.Primitives;

    function NullGene() {
        this.type = P.NULL;
    }

    NullGene.prototype.express = function (context) {
        return SLUR.NULL;
    };

    NullGene.prototype.mutate = function (mutation, context, entropy) {
        return this;
    };

    NullGene.prototype.copy = function () {
        return new NullGene();
    };

    function TrueGene() {
        this.type = P.BOOLEAN;
    }

    TrueGene.prototype.express = function (context) {
        return SLUR.TRUE;
    };

    TrueGene.prototype.mutate = function (mutation, context, entropy) {
        return this;
    };

    TrueGene.prototype.copy = function () {
        return new TrueGene();
    };

    function FixNumGenerator(seed, range) {
        this.type = P.FIX_NUM;
        this.seed = seed;
        this.range = range;
    }

    FixNumGenerator.prototype.express = function (context) {
        // This produces biased results, when the max seed is not a muliple of
        // the range size, but makes the mutation have nice properties.
        var min = this.range.min,
            max = this.range.max,
            value = max == min ? min : min + this.seed % (max - min + 1);
        return new SLUR.FixNum(value);
    };

    FixNumGenerator.prototype.mutate = function (mutation, context, entropy) {
        var seed = mutation.mutateSeed(this.seed, entropy);
        var range = null;
        if (mutation.mutateFixnumRange(entropy)) {
            range = mutation.newFixnumRange(this.range, entropy);
        }
        if (this.seed !== seed || range !== null) {
            return new FixNumGenerator(seed, range !== null ? range : this.range);
        }
        return this;
    };

    FixNumGenerator.prototype.copy = function () {
        return new FixNumGenerator(this.seed, this.range);
    };

    function RealGenerator(seed, range) {
        this.type = P.REAL;
        this.seed = seed;
        this.range = range;
    }

    RealGenerator.prototype.express = function (context) {
        var seedValue = this.seed / ENTROPY.MAX_SEED,
            min = this.range.min,
            max = this.range.max,
            value = min + seedValue * (max - min);
        return new SLUR.Real(value);
    };

    RealGenerator.prototype.mutate = function (mutation, context, entropy) {
        var seed = mutation.mutateSeed(this.seed, entropy);
        var range = null;
        if (mutation.mutateRealRange(entropy)) {
            range = mutation.newRealRange(this.range, entropy);
        }
        if (this.seed !== seed || range !== null) {
            return new RealGenerator(seed, range !== null ? range : this.range);
        }
        return this;
    };

    RealGenerator.prototype.copy = function () {
        return new RealGenerator(this.seed, this.range);
    };

    function SymbolGenerator(seed, length) {
        this.type = P.SYMBOL;
        this.seed = seed;
        this.length = length;
    }

    SymbolGenerator.prototype.express = function (context) {
        var entropy = new ENTROPY.Entropy(this.seed);
        return new SLUR.Symbol(entropy.alphaString(this.length));
    };

    SymbolGenerator.prototype.mutate = function (mutation, context, entropy) {
        var seed = mutation.mutateSeed(this.seed, entropy);
        var length = this.length;
        if (mutation.mutateSymbolLength(entropy)) {
            length = mutation.newSymbolLength(length, entropy);
        }
        if (this.seed !== seed || this.length !== length) {
            return new SymbolGenerator(seed, length);
        }
        return this;
    };

    StringGenerator.prototype.copy = function () {
        return new StringGenerator(this.seed, this.length);
    };

    function StringGenerator(seed, length) {
        this.type = P.STRING;
        this.seed = seed;
        this.length = length;
    }

    StringGenerator.prototype.express = function (context) {
        var entropy = new ENTROPY.Entropy(this.seed);
        return new SLUR.StringValue(entropy.alphaString(this.length));
    };

    StringGenerator.prototype.mutate = function (mutation, context, entropy) {
        var seed = mutation.mutateSeed(this.seed, entropy);
        var length = this.length;
        if (mutation.mutateStringLength(entropy)) {
            length = mutation.newStringLength(length, entropy);
        }
        if (this.seed !== seed || this.length !== length) {
            return new StringGenerator(seed, length);
        }
        return this;
    };

    StringGenerator.prototype.copy = function () {
        return new StringGenerator(this.seed, this.length);
    };

    function BoolGenerator(seed) {
        this.type = P.BOOL;
        this.seed = seed;
    }

    BoolGenerator.prototype.express = function (context) {
		return this.seed % 2 == 1 ? SLUR.TRUE : SLUR.NULL;
    };

    BoolGenerator.prototype.mutate = function (mutation, context, entropy) {
        var seed = mutation.mutateSeed(this.seed, entropy);
        if (this.seed !== seed) {
            return new BoolGenerator(seed);
        }
        return this;
    };

    BoolGenerator.prototype.copy = function () {
        return new BoolGenerator(this.seed);
    };

    function ConsGene(type, car, cdr) {
        this.type = type;
        this.carGene = car;
        this.cdrGene = cdr;
    }

    ConsGene.prototype.express = function (context) {
        var car = this.carGene.express(context),
            cdr = this.cdrGene.express(context);
        return SLUR.makeList([new SLUR.Symbol("cons"), car, cdr]);
    };

    ConsGene.prototype.mutate = function (mutation, context, entropy) {
        var mutantCar = mutation.mutateGene(this.type.carType, this.carGene, context, entropy),
            mutantCdr = mutation.mutateGene(this.type.cdrType, this.cdrGene, context, entropy);
        if (mutantCar != this.carGene || mutantCdr != this.cdrGene) {
            return new ConsGene(this.type, mutantCar, mutantCdr);
        }
        return this;
    };

    ConsGene.prototype.copy = function () {
        return new ConsGene(this.type, this.carGene.copy(), this.cdrGene.copy());
    };

    function ListGene(type, items) {
        this.type = type;
        this.items = items ? items : [];
    }

    ListGene.prototype.express = function  (context) {
		var list = SLUR.NULL;
		for (var i = this.items.length - 1; i >= 0; --i) {
			list = new SLUR.Cons(this.items[i].express(context), list);
		}
		return new SLUR.Cons(new SLUR.Symbol("list"), list);
	};

    ListGene.prototype.mutate = function (mutation, context, entropy) {
        function swap(list, a, b) {
            var atA = list[a];
            list[a] = list[b];
            list[b] = atA;
        }

        var mutatedItems = this.items,
            listLength = mutatedItems.length;

		if (mutation.reorderList(entropy)) {
            mutatedItems = mutatedItems.slice();
			for (var i = 0; i < mutatedItems.length; ++i ) {
				var j = i + entropy.randomInt(0, mutatedItems.length - i );
				swap(mutatedItems, i, j);
			}
		} else if ( mutatedItems.length > 0 && mutation.swapListItems(entropy)) {
            mutatedItems = mutatedItems.slice();
			var x = entropy.randomInt(0, mutatedItems.length),
                y = entropy.randomInt(0, mutatedItems.length);
			swap(mutatedItems, x, y);
		} else if (mutation.mutateListLength(entropy)) {
			listLength = mutation.randomizer.selectListLength(entropy);
            mutatedItems = mutatedItems.slice(0, Math.min(listLength, mutatedItems.length));
		}
        mutatedItems = this.mutateItems(mutation, context, entropy, mutatedItems);

        for (var n = mutatedItems.length; n < listLength; ++n ) {
            mutatedItems.push(mutation.createNewGene(this.type.elementType, context, entropy));
        }

		if (mutatedItems != this.items) {
			return new ListGene(this.type, mutatedItems);
		}
        return this;
    };

    ListGene.prototype.mutateItems = function (mutation, context, entropy, items) {
		var isMutated = false,
            mutated = [];
		for (var i = 0; i < items.length; ++i) {
			var item = items[i],
                mutatedItem = mutation.mutateGene(this.type.elementType, item, context, entropy);
			if (mutatedItem != item) {
				isMutated = true;
			}
			mutated.push(mutatedItem);
		}
		if (isMutated) {
			return mutated;
		}
        return items;
	};

	ListGene.prototype.copy = function () {
		var items = [];
		for (var i = 0; i < this.items.length; ++i) {
			items.push(this.items[i].copy());
		}
		return new ListGene(this.type, items);
	};

    function LookupGene(type, symbolName, seed) {
        this.type = type;
        this.symbolName = symbolName;
        this.seed = seed;
    }

    LookupGene.prototype.express = function (context) {
        var matching = context.findMatching(this.type),
            result = this.findSymbol(matching, this.symbolName, this.type);
        if (result !== null) {
            return result;
        }

        if (matching.length > 0) {
            result = matching[this.seed % matching.length];
            this.symbolName = result.name;
            return result;
        }
        throw "No symbol matching type.";
    };

    LookupGene.prototype.findSymbol = function (list, symbolName, type) {
        for (var i = 0; i < list.length; ++i) {
            var item = list[i];
            if (item.name === symbolName) {
                return item;
            }
        }
        return null;
    };

    LookupGene.prototype.mutate = function (mutation, context, entropy) {
        var seed = mutation.mutateSeed(this.seed, entropy);
        if (this.seed != seed) {
            return new LookupGene(this.type, null, seed);
        }
        return this;
    };

    LookupGene.prototype.copy = function () {
        return new LookupGene(this.type, this.symbolName, this.seed);
    };

    function IfGene(type, predicateGene, thenGene, elseGene) {
        this.type = type;
        this.predicateGene = predicateGene;
        this.thenGene = thenGene;
        this.elseGene = elseGene;
    }

    IfGene.prototype.express = function (context) {
        return new SLUR.IfExpression(
            this.predicateGene.express(context),
            this.thenGene.express(context),
            this.elseGene.express(context)
        );
    };

    IfGene.prototype.mutate = function (mutation, context, entropy) {
        var mutatedPredicate = mutation.mutateGene(P.BOOL, this.predicateGene, context, entropy),
            mutatedThen = mutation.mutateGene(this.type, this.thenGene, context, entropy),
            mutatedElse = mutation.mutateGene(this.type, this.elseGene, context, entropy);
        if (this.predicateGene != mutatedPredicate || this.thenGene != mutatedThen || this.elseGene != mutatedElse) {
            return new IfGene(this.type, mutatedPredicate, mutatedThen, mutatedElse);
        }
        return this;
    };

    IfGene.prototype.copy = function () {
        return new IfGene(this.type, this.predicateGene, this.thenGene, this.elseGene);
    };

    function ApplicationGene(functionGene, args) {
        this.functionType = functionGene.type;
        this.type = this.functionType.returnType;
        this.functionGene = functionGene;
        this.args = args;
    }

    ApplicationGene.prototype.express = function (context) {
        return new SLUR.Cons(
            this.functionGene.express(context),
            this.generateArguments(context, 0)
        );
    };

    ApplicationGene.prototype.generateArguments = function (context, offset) {
        if (offset >= this.args.length) {
            return SLUR.NULL;
        }
        return new SLUR.Cons(this.args[offset].express(context), this.generateArguments(context, offset + 1));
    };

    ApplicationGene.prototype.mutate = function (mutation, context, entropy) {
        var mutatedFunction = mutation.mutateGene(this.functionType, this.functionGene, context, entropy),
            mutated = mutatedFunction != this.functionGene,
            mutatedArgs = [];
        for (var i = 0; i < this.args.length; ++i) {
            var arg = this.args[i];
            mutatedArgs.push(mutation.mutateGene(this.functionType.argumentTypes[i], arg, context, entropy));
            if (mutatedArgs[i] != arg) {
                mutated = true;
            }
        }

        if (mutated) {
            return new ApplicationGene(mutatedFunction, mutatedArgs);
        }
        return this;
    };

    function DemaybeGene(maybeGene, concreteGene, varName) {
        this.maybeType = maybeGene.type;
        if (!this.maybeType.maybeType) {
            throw "Maybe expected.";
        }
		this.type = this.maybeType.maybeType;
		this.maybeGene = maybeGene;
		this.concreteGene = concreteGene;
		this.varName = varName;
    }

    DemaybeGene.prototype.express = function (context) {
		var maybeSym = new SLUR.Symbol("dm_" + this.varName),
            binding = SLUR.makeList([maybeSym, this.maybeGene.express(context)]),
            body = new SLUR.IfExpression(maybeSym, maybeSym, this.concreteGene.express(context));
		return SLUR.makeList([new SLUR.Symbol("let"), SLUR.makeList(binding), body]);
	};

    DemaybeGene.prototype.mutate = function (mutation, context, entropy) {
        var mutatedMaybe = null;
        do {
            mutatedMaybe = mutation.mutateGene(this.maybeType, this.maybeGene, context, entropy);
        } while(!SLUR_TYPES.isMaybe(mutatedMaybe.type));

        var mutatedConcrete = mutation.mutateGene(this.type, this.concreteGene, context, entropy);
        if (this.maybeGene != mutatedMaybe || this.concreteGene != mutatedConcrete) {
            return new DemaybeGene(mutatedMaybe, mutatedConcrete, this.varName);
        }
        return this;
    };

    DemaybeGene.prototype.copy = function() {
        return new DemaybeGene(this.maybeGene, this.concreteGene, this.varName);
    };

    function PassMaybeGene(type, functionGene, argGenes, varName) {
        this.type = type;
        this.functionType = functionGene.type;
        if (!this.type.match(this.functionType.returnType).matches) {
            throw "Mismatch between type and function type.";
        }
        this.functionGene = functionGene;
        this.argGenes = argGenes;
        this.varName = varName;
    }

    PassMaybeGene.prototype.express = function (context) {
        var bindings = this.buildBindings(context, 0),
            args = this.buildArguments(0),
            application = new SLUR.Cons(this.functionGene.express(context), args),
            predicate = this.buildPredicate(),
            body = null;
        if (SLUR.isNull(predicate)) {
            body = SLUR.makeList(application);
        } else {
            body = SLUR.makeList(new SLUR.IfExpression(predicate, application, SLUR.NULL));
        }
        return new SLUR.Cons(new SLUR.Symbol("let"), new SLUR.Cons(bindings, body));
    };

    PassMaybeGene.prototype.buildArguments = function (index) {
        if (index >= this.argGenes.length) {
            return SLUR.NULL;
        }
        return new SLUR.Cons(this.varSymbol(index), this.buildArguments(index + 1));
    };

    PassMaybeGene.prototype.varSymbol = function (index) {
		return new SLUR.Symbol("pm_" + this.varName + index);
    };

    PassMaybeGene.prototype.buildPredicate = function () {
		var checks = this.buildPredicateN(0);
		if ( SLUR.isCons(checks)) {
			return new SLUR.Cons(new SLUR.Symbol("and"), checks);
		}
		return checks;
    };

    PassMaybeGene.prototype.buildPredicateN = function (index) {
		if (index >= this.argGenes.length) {
			return SLUR.NULL;
		}
		var rest = this.buildPredicateN(index + 1);
		if (!this.check(index)) {
			return rest;
		}
		var symbol = this.varSymbol(index);
		if (SLUR.isNull(rest)) {
			return symbol;
		}
		if (!SLUR.isCons(rest)) {
			rest = SLUR.makeList(rest);
		}
		return new SLUR.Cons(symbol, rest);
    };

    PassMaybeGene.prototype.check = function (index) {
		return !(SLUR_TYPES.isMaybe(this.functionType.argumentTypes[index]));
	};

    PassMaybeGene.prototype.buildBindings = function (context, index) {
		if (index >= this.argGenes.length) {
			return SLUR.NULL;
		}
		return new SLUR.Cons(this.buildBinding(context, index), this.buildBindings(context, index + 1));
    };

    PassMaybeGene.prototype.buildBinding = function (context, index) {
		return SLUR.makeList([this.varSymbol(index), this.argGenes[index].express(context)]);
    };

    PassMaybeGene.prototype.mutate = function (mutation, context, entropy) {
		var mutatedFunction = mutation.mutateGene(this.functionType, this.functionGene, context, entropy),
            isMutated = mutatedFunction != this.functionGene,
            mutatedArgs = [];
		for (var i = 0; i < this.argGenes.length; ++i) {
			mutatedArgs[i] = mutation.mutateGene(this.functionType.argumentTypes[i], this.argGenes[i], context, entropy);
			if (mutatedArgs[i] != this.argGenes[i]) {
				isMutated = true;
			}
		}
		if (isMutated) {
			return new PassMaybeGene(this.type, mutatedFunction, mutatedArgs, this.varName);
		} else {
			return this;
		}
    };

    PassMaybeGene.prototype.copy = function () {
        return new PassMaybeGene(this.type, this.functionGene, this.argGenes, this.varName);
    };

    function FunctionGene(type, name, body, isLambda) {
        if (!body || !name || !type) {
            throw "Invalid parameters";
        }
        this.type = type;
        this.name = name;
        this.body = body;
        this.isLambda = isLambda ? true : false;
    }

    FunctionGene.prototype.express = function (context) {
		var args = this.argumentNames();
		this.pushArguments(context, args);
		var body = SLUR.makeList(this.body.express(context));
		this.popArguments(context);

		if (this.isLambda) {
			return this.expressLambda(this.argumentList(args), body);
		} else {
			return this.expressFunction(this.name, this.argumentList(args), body);
		}
    };

    FunctionGene.prototype.argumentList = function (args) {
		var list = SLUR.NULL;
		for (var i = args.length - 1; i >= 0; --i ) {
			list = new SLUR.Cons(new SLUR.Symbol(args[i]), list);
		}
		return list;
	};

    FunctionGene.prototype.expressFunction = function (name, args, body) {
		return new SLUR.Cons(new SLUR.Symbol("define"), new SLUR.Cons(new SLUR.Cons(new SLUR.Symbol(this.name), args), body));
	};

    FunctionGene.prototype.expressLambda = function (args, body) {
		return new SLUR.Cons(new SLUR.Symbol("lambda"), new SLUR.Cons(args, body));
	};

    FunctionGene.prototype.pushArguments = function (context, args) {
		for (var i = 0; i < args.length; ++i) {
			context.pushSymbol(args[i], this.type.argumentTypes[i]);
		}
	};

    FunctionGene.prototype.popArguments = function (context) {
		context.popSymbols(this.type.argumentTypes.length);
	};

    function functionArgumentNames(type, baseName) {
        baseName = baseName + "p";
		var names = [];
		for (var i = 0; i < type.argumentTypes.length; ++i) {
			names.push(baseName + i);
		}
		return names;
    }

    FunctionGene.prototype.argumentNames = function () {
        return functionArgumentNames(this.type, this.name);
	};

    FunctionGene.prototype.mutate = function (mutation, context, entropy) {
		this.pushArguments(context, this.argumentNames());
		var mutatedBody = mutation.mutateGene(this.type.returnType, this.body, context, entropy);
		this.popArguments(context);

		if (mutatedBody != this.body) {
			return new FunctionGene(this.type, this.name, mutatedBody, this.isLambda);
		}
        return this;
    };

    FunctionGene.prototype.copy = function () {
        return new FunctionGene(this.type, this.name, this.body, this.isLambda);
    };

    function testSuite() {
        var nullGeneTests = [
            function testType() {
                var gene = new NullGene();
                TEST.isTrue(gene.type.equals(P.NULL));
            },
            function testExpress() {
                var gene = new NullGene(),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.isTrue(SLUR.isNull(phene));
            }
        ];

        var trueGeneTests = [
            function testType() {
                var gene = new TrueGene();
                TEST.isTrue(gene.type.equals(P.BOOLEAN));
            },
            function testExpress() {
                var gene = new TrueGene(),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.isFalse(SLUR.isNull(phene));
                TEST.equals(phene.value, true);
            }
        ];

        var generatorTests = [
            function testFixnumType() {
                var gene = new FixNumGenerator(1, { min: 0, max: 100 });
                TEST.isTrue(gene.type.equals(P.FIX_NUM));
            },
            function testFixnumExpress() {
                var range = { min: 0, max: 100 },
                    gene = new FixNumGenerator(102, range),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.isTrue(SLUR.isInt(phene));
                TEST.equals(phene.value, 1);
            },
            function testRealType() {
                var gene = new RealGenerator(1, { min: 0, max: 100 });
                TEST.isTrue(gene.type.equals(P.REAL));
            },
            function testRealExpress() {
                var range = { min: 0, max: 100 },
                    gene = new RealGenerator(102, range),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.isTrue(SLUR.isReal(phene));
                TEST.isTrue(range.min <= phene.value);
                TEST.isTrue(phene.value <= range.max);
            },
            function testSymbolType() {
                var gene = new SymbolGenerator(1, 5);
                TEST.equals(gene.type, P.SYMBOL);
            },
            function testSymbolExpress() {
                var gene = new SymbolGenerator(1, 5),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.isTrue(SLUR.isSymbol(phene));
                TEST.equals(5, phene.name.length);
            },
            function testStringType() {
                var gene = new StringGenerator(1, 5);
                TEST.equals(gene.type, P.STRING);
            },
            function testStringExpress() {
                var gene = new StringGenerator(1, 5),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.isTrue(SLUR.isString(phene));
                TEST.equals(5, phene.value.length);
            },
            function testBoolType() {
                var gene = new BoolGenerator(1);
                TEST.isTrue(gene.type.equals(P.BOOL));
            },
            function testBoolExpress() {
                var gene = new BoolGenerator(1),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.value, true);
            }
        ];

        var containerTests = [
            function testConsType() {
                var gene = new ConsGene(new SLUR_TYPES.ConsType(P.NULL, P.NULL), new NullGene(), new NullGene());
                TEST.isTrue(gene.type.equals(new SLUR_TYPES.ConsType(P.NULL,P.NULL)));
            },
            function testConsExpress() {
                var gene = new ConsGene(new SLUR_TYPES.ConsType(P.NULL, P.NULL), new NullGene(), new NullGene()),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(),"(cons () ())");
            },
            function testListType() {
                var gene = new ListGene(new SLUR_TYPES.ListType(P.FIX_NUM));
                TEST.isTrue(gene.type.equals(new SLUR_TYPES.ListType(P.FIX_NUM)));
            },
            function testListExpress() {
                var gene = new ListGene(new SLUR_TYPES.ListType(P.FIX_NUM)),
                    c = new Context(new SLUR_TYPES.Registry()),
                    phene = gene.express(c);
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(list)");

                var items = [new FixNumGenerator(0, { min: 0, max: 2 })];
                gene = new ListGene(new SLUR_TYPES.ListType(P.FIX_NUM), items);
                phene = gene.express(c);
                TEST.notNull(phene);
                TEST.equals(phene.toString(),"(list 0)");

                items.push(new FixNumGenerator(1, { min: 0, max: 2 }));
                gene = new ListGene(new SLUR_TYPES.ListType(P.FIX_NUM), items);
                phene = gene.express(c);
                TEST.notNull(phene);
                TEST.equals(phene.toString(),"(list 0 1)");

                items.push(new FixNumGenerator(2, { min: 0, max: 2 }));
                gene = new ListGene(new SLUR_TYPES.ListType(P.FIX_NUM), items);
                phene = gene.express(c);
                TEST.notNull(phene);
                TEST.equals(phene.toString(),"(list 0 1 2)");
            },
            function testCopy() {
                var gene = new ListGene(new SLUR_TYPES.ListType(P.FIX_NUM), [
                        new FixNumGenerator(0, { min: 0, max: 2 }),
                        new FixNumGenerator(1, { min: 0, max: 2 }),
                        new FixNumGenerator(2, { min: 0, max: 2 })
                    ]),
                    copy = gene.copy();
                TEST.notSame(gene, copy);

                var c = new Context(new SLUR_TYPES.Registry()),
                    phene = gene.express(c),
                    copyPhene = copy.express(c);
                TEST.equals(phene.toString(), copyPhene.toString());
            }
        ];

        function buildContext() {
            var reg = new SLUR_TYPES.Registry();
            SLUR_TYPES.registerBuiltins(reg);
            return new Context(reg);
        }

        function buildLookupGene() {
            var p = new SLUR_TYPES.Parameter();
            return new LookupGene(new SLUR_TYPES.FunctionType(new SLUR_TYPES.ConsType(p, p), [p, p]), "cons", 0);
        }

        var lookupTests = [
            function testLookupType() {
                var gene = buildLookupGene(),
                    q = new SLUR_TYPES.Parameter();
                TEST.isTrue(gene.type.match(new SLUR_TYPES.FunctionType(new SLUR_TYPES.ConsType(q,q), [q, q])).matches);
            },
            function testExpress() {
                var gene = buildLookupGene(),
                    c = buildContext(),
                    phene = gene.express(c);
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "cons");
            }
        ];

        var fixZero = new FixNumGenerator(0, { min: 0, max: 1 }),
            fixOne = new FixNumGenerator(1, { min: 0, max: 1 });

        var ifTests = [
            function testIfType() {
                var ifGene = new IfGene(P.FIX_NUM, new NullGene(), fixZero, fixOne);
                TEST.isTrue(ifGene.type.equals(P.FIX_NUM));
            },
            function testIfExpress() {
                var c = new Context(new SLUR_TYPES.Registry());

                var gene = new IfGene(P.FIX_NUM, new NullGene(), fixZero, fixOne);

                var phene = gene.express(c);
                TEST.notNull(phene);
                TEST.equals("(if () 0 1)", phene.toString());
            }
        ];

        var FuncType = SLUR_TYPES.FunctionType;

        var functionTests = [
        	function testType() {
                var gene = new FunctionGene(new FuncType(P.FIX_NUM, [P.FIX_NUM]), "fn", fixOne);
                TEST.isTrue(gene.type.equals(new FuncType(P.FIX_NUM, [P.FIX_NUM])));
            },
            function testExpressNoArgs() {
                var gene = new FunctionGene(new FuncType(P.FIX_NUM, []), "fn", fixOne),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(define (fn) 1)");
            },
            function testExpressOneArg() {
                var gene = new FunctionGene(new FuncType(P.FIX_NUM, [P.FIX_NUM]), "fn", fixOne),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(define (fn fnp0) 1)");
            },
            function testExpressTwoArgs() {
                var gene = new FunctionGene(new FuncType(P.FIX_NUM, [P.FIX_NUM, P.BOOL]), "fn", new TrueGene()),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(define (fn fnp0 fnp1) #t)");
            },
            function testExpressLambda() {
                var gene = new FunctionGene(new FuncType(P.FIX_NUM, [P.FIX_NUM]), "fn", new BoolGenerator(1), true),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(lambda (fnp0) #t)");
            }
        ];

        var appTests = [
            function testType() {
                var type = new FuncType(P.FIX_NUM, [P.FIX_NUM]),
                    gene = new ApplicationGene(new FunctionGene(type, "l", fixOne, true), [fixZero]);
                TEST.isTrue(gene.type.equals(P.FIX_NUM));
            },
            function testExpress() {
                var type = new FuncType(P.FIX_NUM, [P.FIX_NUM]),
                    gene = new ApplicationGene(new FunctionGene(type, "l", fixOne, true), [fixZero]),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "((lambda (lp0) 1) 0)");
            }
        ];

        function buildPassMaybeGene() {
            var type = new FuncType(new SLUR_TYPES.Maybe(P.FIX_NUM), [P.FIX_NUM]),
                func = new FunctionGene(type, "l", fixOne, true),
                ifGene = new IfGene(new SLUR_TYPES.Maybe(P.FIX_NUM), new TrueGene(), fixZero, new NullGene()),
                gene = new PassMaybeGene(new SLUR_TYPES.Maybe(P.FIX_NUM), func, [ifGene], "a");
            return gene;
        }

        var maybeTests = [
        	function testDemaybeType() {
                var ifGene = new IfGene(new SLUR_TYPES.Maybe(P.FIX_NUM), new NullGene(), fixOne, new NullGene()),
                    gene = new DemaybeGene(ifGene, fixZero, "a");
                TEST.isTrue(gene.type.equals(P.FIX_NUM));
            },
            function testDemaybeExpress() {
                var ifGene = new IfGene(new SLUR_TYPES.Maybe(P.FIX_NUM), new NullGene(), fixOne, new NullGene()),
                    gene = new DemaybeGene(ifGene, fixZero, "a"),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(let ((dm_a (if () 1 ()))) (if dm_a dm_a 0))");
            },
            function testPassMaybeType() {
                var gene = buildPassMaybeGene();
                TEST.isTrue(gene.type.equals(new SLUR_TYPES.Maybe(P.FIX_NUM)));
            },
            function testPassMaybeExpress() {
                var gene = buildPassMaybeGene(),
                    phene = gene.express(new Context(new SLUR_TYPES.Registry()));
                TEST.notNull(phene);
                TEST.equals(phene.toString(), "(let ((pm_a0 (if #t 0 ()))) (if pm_a0 ((lambda (lp0) 1) pm_a0) ()))");
            }
        ];

        TEST.run("NullGene", nullGeneTests);
        TEST.run("TrueGene", trueGeneTests);
        TEST.run("Generator", generatorTests);
        TEST.run("ContainerGene", containerTests);
        TEST.run("LookupGene", lookupTests);
        TEST.run("IfGene", ifTests);
        TEST.run("FunctionGene", functionTests);
        TEST.run("ApplicationGene", appTests);
        TEST.run("MaybeGenes", maybeTests);
    }

    return {
        Context: Context,
        NullGene: NullGene,
        TrueGene: TrueGene,
        FixNumGenerator: FixNumGenerator,
        RealGenerator: RealGenerator,
        SymbolGenerator: SymbolGenerator,
        StringGenerator: StringGenerator,
        BoolGenerator: BoolGenerator,
        ConsGene: ConsGene,
        ListGene: ListGene,
        LookupGene: LookupGene,
        IfGene: IfGene,
        ApplicationGene: ApplicationGene,
        DemaybeGene: DemaybeGene,
        PassMaybeGene: PassMaybeGene,
        FunctionGene: FunctionGene,
        functionArgumentNames: functionArgumentNames,
        testSuite: testSuite
    };
}());


text:
	<title>Gareth Hale's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Gareth Hale's panel show appearances

Gareth Hale (born 1953-01-05[ref]) has appeared in 5 episodes between 1995-1999.  Gareth Hale on IMDB. Gareth Hale on Wikipedia.

1995

1996

1997

1998

1999

1999-11-05 / Call My Bluff

1999-10-12 / Call My Bluff

1999-09-24 / Call My Bluff

1999-09-15 / Call My Bluff

1995-10-20 / Shooting Stars

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/events/interfaith-week-program-2010" xmlns:sem="http://marklogic.com/semantics">
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/events/interfaith-week-program-2010</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
    <sem:object datatype="xsd:string" xml:lang="eng">Interfaith Week Program (2010)</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/events/interfaith-week-program-2010</sem:subject>
    <sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
    <sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
  </sem:triple>
  <sem:triple>
    <sem:subject>http://www.lds.org/vrl/events/interfaith-week-program-2010</sem:subject>
    <sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
    <sem:object datatype="sem:iri">http://www.schema.org/Event</sem:object>
  </sem:triple>
</sem:triples>


text:
package com.amazonaws.services.sagemaker.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * Defines the model configuration. Includes the specification name and environment parameters.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ModelConfiguration implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The inference specification name in the model package version.
     *

     */
    private String inferenceSpecificationName;
    /**
     *

     * Defines the environment parameters that includes key, value types, and values.
     *

     */
    private java.util.List<EnvironmentParameter> environmentParameters;

    /**
     *

     * The inference specification name in the model package version.
     *

     *
     * @param inferenceSpecificationName
     *        The inference specification name in the model package version.
     */

    public void setInferenceSpecificationName(String inferenceSpecificationName) {
        this.inferenceSpecificationName = inferenceSpecificationName;
    }

    /**
     *

     * The inference specification name in the model package version.
     *

     *
     * @return The inference specification name in the model package version.
     */

    public String getInferenceSpecificationName() {
        return this.inferenceSpecificationName;
    }

    /**
     *

     * The inference specification name in the model package version.
     *

     *
     * @param inferenceSpecificationName
     *        The inference specification name in the model package version.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ModelConfiguration withInferenceSpecificationName(String inferenceSpecificationName) {
        setInferenceSpecificationName(inferenceSpecificationName);
        return this;
    }

    /**
     *

     * Defines the environment parameters that includes key, value types, and values.
     *

     *
     * @return Defines the environment parameters that includes key, value types, and values.
     */

    public java.util.List<EnvironmentParameter> getEnvironmentParameters() {
        return environmentParameters;
    }

    /**
     *

     * Defines the environment parameters that includes key, value types, and values.
     *

     *
     * @param environmentParameters
     *        Defines the environment parameters that includes key, value types, and values.
     */

    public void setEnvironmentParameters(java.util.Collection<EnvironmentParameter> environmentParameters) {
        if (environmentParameters == null) {
            this.environmentParameters = null;
            return;
        }

        this.environmentParameters = new java.util.ArrayList<EnvironmentParameter>(environmentParameters);
    }

    /**
     *

     * Defines the environment parameters that includes key, value types, and values.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setEnvironmentParameters(java.util.Collection)} or
     * {@link #withEnvironmentParameters(java.util.Collection)} if you want to override the existing values.
     *

     *
     * @param environmentParameters
     *        Defines the environment parameters that includes key, value types, and values.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ModelConfiguration withEnvironmentParameters(EnvironmentParameter... environmentParameters) {
        if (this.environmentParameters == null) {
            setEnvironmentParameters(new java.util.ArrayList<EnvironmentParameter>(environmentParameters.length));
        }
        for (EnvironmentParameter ele : environmentParameters) {
            this.environmentParameters.add(ele);
        }
        return this;
    }

    /**
     *

     * Defines the environment parameters that includes key, value types, and values.
     *

     *
     * @param environmentParameters
     *        Defines the environment parameters that includes key, value types, and values.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ModelConfiguration withEnvironmentParameters(java.util.Collection<EnvironmentParameter> environmentParameters) {
        setEnvironmentParameters(environmentParameters);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getInferenceSpecificationName() != null)
            sb.append("InferenceSpecificationName: ").append(getInferenceSpecificationName()).append(",");
        if (getEnvironmentParameters() != null)
            sb.append("EnvironmentParameters: ").append(getEnvironmentParameters());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof ModelConfiguration == false)
            return false;
        ModelConfiguration other = (ModelConfiguration) obj;
        if (other.getInferenceSpecificationName() == null ^ this.getInferenceSpecificationName() == null)
            return false;
        if (other.getInferenceSpecificationName() != null && other.getInferenceSpecificationName().equals(this.getInferenceSpecificationName()) == false)
            return false;
        if (other.getEnvironmentParameters() == null ^ this.getEnvironmentParameters() == null)
            return false;
        if (other.getEnvironmentParameters() != null && other.getEnvironmentParameters().equals(this.getEnvironmentParameters()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getInferenceSpecificationName() == null) ? 0 : getInferenceSpecificationName().hashCode());
        hashCode = prime * hashCode + ((getEnvironmentParameters() == null) ? 0 : getEnvironmentParameters().hashCode());
        return hashCode;
    }

    @Override
    public ModelConfiguration clone() {
        try {
            return (ModelConfiguration) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.sagemaker.model.transform.ModelConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
Info

			<form name="form" class="float-con" method="post" ng-submit="submitdetail()" novalidate>

					Name
					<input type="text" class="form-control" ng-model="users.name" id="Name" placeholder="Name">

					Age
					<input type="text" class="form-control"  ng-model="users.age" id="Age">

					Birthday
					<input type="date" class="form-control" ng-model="users.birthday" id="Birthday">

					Job
					<select class="form-control" ng-model="users.job" id="job" ng-options="jobname.name for jobname in jobs.data.job">
						<option value=""></option>
					</select>

					Province
					<select class="form-control" ng-model="users.province" ng-options="prov.name for prov in provinces.data.province">
						<option value=""></option>
					</select>

					<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
				<button type="submit"  class="btn btn-primary">Finish</button>

			</form>


text:
package com.google.common.collect.testing.google;

import com.google.common.annotations.GwtCompatible;
import com.google.common.collect.BiMap;
import com.google.common.collect.testing.DerivedGenerator;
import com.google.common.collect.testing.Helpers;
import com.google.common.collect.testing.OneSizeTestContainerGenerator;
import com.google.common.collect.testing.SampleElements;
import com.google.common.collect.testing.TestMapGenerator;
import com.google.common.collect.testing.TestSetGenerator;
import com.google.common.collect.testing.TestSubjectGenerator;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

/**
 * Derived suite generators for Guava collection interfaces, split out of the suite builders so that
 * they are available to GWT.
 *
 * @author Louis Wasserman
 */
@GwtCompatible
public final class DerivedGoogleCollectionGenerators {
  public static class MapGenerator<K, V> implements TestMapGenerator<K, V>, DerivedGenerator {

    private final OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> generator;

    public MapGenerator(
        OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> oneSizeTestContainerGenerator) {
      this.generator = oneSizeTestContainerGenerator;
    }

    @Override
    public SampleElements<Map.Entry<K, V>> samples() {
      return generator.samples();
    }

    @Override
    public Map<K, V> create(Object... elements) {
      return generator.create(elements);
    }

    @Override
    public Map.Entry<K, V>[] createArray(int length) {
      return generator.createArray(length);
    }

    @Override
    public Iterable<Map.Entry<K, V>> order(List<Map.Entry<K, V>> insertionOrder) {
      return generator.order(insertionOrder);
    }

    @SuppressWarnings("unchecked")
    @Override
    public K[] createKeyArray(int length) {
      return (K[]) new Object[length];
    }

    @SuppressWarnings("unchecked")
    @Override
    public V[] createValueArray(int length) {
      return (V[]) new Object[length];
    }

    public TestSubjectGenerator<?> getInnerGenerator() {
      return generator;
    }
  }

  public static class InverseBiMapGenerator<K, V>
      implements TestBiMapGenerator<V, K>, DerivedGenerator {

    private final OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> generator;

    public InverseBiMapGenerator(
        OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> oneSizeTestContainerGenerator) {
      this.generator = oneSizeTestContainerGenerator;
    }

    @Override
    public SampleElements<Map.Entry<V, K>> samples() {
      SampleElements<Entry<K, V>> samples = generator.samples();
      return new SampleElements<Map.Entry<V, K>>(reverse(samples.e0), reverse(samples.e1),
          reverse(samples.e2), reverse(samples.e3), reverse(samples.e4));
    }

    private Map.Entry<V, K> reverse(Map.Entry<K, V> entry) {
      return Helpers.mapEntry(entry.getValue(), entry.getKey());
    }

    @SuppressWarnings("unchecked")
    @Override
    public BiMap<V, K> create(Object... elements) {
      Entry[] entries = new Entry[elements.length];
      for (int i = 0; i < elements.length; i++) {
        entries[i] = reverse((Entry<K, V>) elements[i]);
      }
      return generator.create((Object[]) entries).inverse();
    }

    @SuppressWarnings("unchecked")
    @Override
    public Map.Entry<V, K>[] createArray(int length) {
      return new Entry[length];
    }

    @Override
    public Iterable<Entry<V, K>> order(List<Entry<V, K>> insertionOrder) {
      return insertionOrder;
    }

    @SuppressWarnings("unchecked")
    @Override
    public V[] createKeyArray(int length) {
      return (V[]) new Object[length];
    }

    @SuppressWarnings("unchecked")
    @Override
    public K[] createValueArray(int length) {
      return (K[]) new Object[length];
    }

    public TestSubjectGenerator<?> getInnerGenerator() {
      return generator;
    }
  }

  public static class BiMapValueSetGenerator<K, V>
      implements TestSetGenerator<V>, DerivedGenerator {
    private final OneSizeTestContainerGenerator<BiMap<K, V>, Map.Entry<K, V>>
        mapGenerator;
    private final SampleElements<V> samples;

    public BiMapValueSetGenerator(
        OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> mapGenerator) {
      this.mapGenerator = mapGenerator;
      final SampleElements<Map.Entry<K, V>> mapSamples =
          this.mapGenerator.samples();
      this.samples = new SampleElements<V>(
          mapSamples.e0.getValue(),
          mapSamples.e1.getValue(),
          mapSamples.e2.getValue(),
          mapSamples.e3.getValue(),
          mapSamples.e4.getValue());
    }

    @Override
    public SampleElements<V> samples() {
      return samples;
    }

    @Override
    public Set<V> create(Object... elements) {
      @SuppressWarnings("unchecked")
      V[] valuesArray = (V[]) elements;

      // Start with a suitably shaped collection of entries
      Collection<Map.Entry<K, V>> originalEntries =
          mapGenerator.getSampleElements(elements.length);

      // Create a copy of that, with the desired value for each value
      Collection<Map.Entry<K, V>> entries =
          new ArrayList<Entry<K, V>>(elements.length);
      int i = 0;
      for (Map.Entry<K, V> entry : originalEntries) {
        entries.add(Helpers.mapEntry(entry.getKey(), valuesArray[i++]));
      }

      return mapGenerator.create(entries.toArray()).values();
    }

    @Override
    public V[] createArray(int length) {
      final V[] vs = ((TestBiMapGenerator<K, V>) mapGenerator.getInnerGenerator())
          .createValueArray(length);
      return vs;
    }

    @Override
    public Iterable<V> order(List<V> insertionOrder) {
      return insertionOrder;
    }

    public TestSubjectGenerator<?> getInnerGenerator() {
      return mapGenerator;
    }
  }

  private DerivedGoogleCollectionGenerators() {}
}


text:
#include "./mitkPhotoacousticMotionCorrectionFilter.h"
#include <mitkImageReadAccessor.h>

mitk::PhotoacousticMotionCorrectionFilter::
    PhotoacousticMotionCorrectionFilter() {
  // Set the defaults for the OpticalFlowFarneback algorithm
  // The values are taken directly out of Thomas's
  // US-CV-Based-Optical-Flow-Carotis.ipyn
  m_BatchSize = 5;
  m_PyrScale = 0.5;
  m_Levels = 1;
  m_WinSize = 40;
  m_Iterations = 2;
  m_PolyN = 7;
  m_PolySigma = 1.5;
  m_Flags = 0;

  m_MaxValue = 255.0;
  m_MinValue = 0.0;

  this->SetNumberOfIndexedInputs(2);
  this->SetNumberOfIndexedOutputs(2);
  this->SetNthOutput(0, mitk::Image::New());
  this->SetNthOutput(1, mitk::Image::New());
}

mitk::PhotoacousticMotionCorrectionFilter::
    ~PhotoacousticMotionCorrectionFilter() {}

void mitk::PhotoacousticMotionCorrectionFilter::SetPaInput(
    mitk::Image::Pointer input) {
  this->SetInput(0, input);
}

mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetPaInput() {
  return this->GetInput(0);
}

void mitk::PhotoacousticMotionCorrectionFilter::SetUsInput(
    mitk::Image::Pointer input) {
  this->SetInput(1, input);
}

mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetUsInput() {
  return this->GetInput(1);
}

mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetPaOutput() {
  return this->GetOutput(0);
}

mitk::Image::Pointer mitk::PhotoacousticMotionCorrectionFilter::GetUsOutput() {
  return this->GetOutput(1);
}

void mitk::PhotoacousticMotionCorrectionFilter::CheckInput(
    mitk::Image::Pointer paImage, mitk::Image::Pointer usImage) {
  // Check that we actually got some images
  if (!paImage || !usImage) {
    MITK_ERROR << "We did not get two images!";
    throw std::invalid_argument("One of the images was NULL.");
  }

  // Check that the image dimensions are the same
  if (paImage->GetDimension() != IMAGE_DIMENSION || usImage->GetDimension() != IMAGE_DIMENSION) {
    MITK_ERROR << "Mismatching image dimensions detected in the motion "
                 "compensation filter.";
    throw std::invalid_argument("Both images must have dimension 3.");
  }

  // Check that each dimension has the same size
  for (unsigned int i = 0; i < paImage->GetDimension(); ++i) {
    if (paImage->GetDimensions()[i] != usImage->GetDimensions()[i]) {
      MITK_ERROR << "Mismatching image dimensions detected in the motion "
                   "compensation filter.";
      throw std::invalid_argument(
          "Both images must have the same length in each dimension.");
    }
  }
}

void mitk::PhotoacousticMotionCorrectionFilter::InitializeOutputIfNecessary(
    mitk::Image::Pointer paInput, mitk::Image::Pointer usInput,
    mitk::Image::Pointer paOutput, mitk::Image::Pointer usOutput) {
  if (paOutput->GetDimension() != IMAGE_DIMENSION) {
    this->InitializeOutput(paInput, paOutput);
    this->InitializeOutput(usInput, usOutput);
  }

  for (unsigned int i = 0; i < usOutput->GetDimension(); ++i) {
    if (usOutput->GetDimensions()[i] != usInput->GetDimensions()[i]) {
      this->InitializeOutput(paInput, paOutput);
      this->InitializeOutput(usInput, usOutput);
      break;
    }
  }
}

void mitk::PhotoacousticMotionCorrectionFilter::InitializeOutput(
    mitk::Image::Pointer input, mitk::Image::Pointer output) {
  output->Initialize(input);
  mitk::ImageReadAccessor accessor(input);
  output->SetImportVolume(accessor.GetData());
}

void mitk::PhotoacousticMotionCorrectionFilter::PerformCorrection(
    mitk::Image::Pointer paInput, mitk::Image::Pointer usInput,
    mitk::Image::Pointer paOutput, mitk::Image::Pointer usOutput) {

  // If batch size was set to 0, use one single batch for the whole data set.
  unsigned int batch;
  if (m_BatchSize == 0) {
    batch = paInput->GetDimensions()[IMAGE_DIMENSION - 1];
  } else {
    batch = m_BatchSize;
  }

  for (unsigned int i = 0; i < paInput->GetDimensions()[IMAGE_DIMENSION - 1]; ++i) {

    // Get the 2d matrix from slice at i
    m_PaMat = this->GetMatrix(paInput, i);
    m_UsMat = this->GetMatrix(usInput, i);

    // At the beginning of a batch we set the new reference image and directly
    // write the result images
    if (i % batch == 0) {
      // Rescale reference to full char resolution
      m_UsRef = this->FitMatrixToChar(m_UsMat);
      m_UsRes = m_UsMat.clone();
      m_PaRes = m_PaMat.clone();
    } else {
      cv::Mat UsMatRescaled = this->FitMatrixToChar(m_UsMat);
      cv::calcOpticalFlowFarneback(m_UsRef, UsMatRescaled, m_Flow, m_PyrScale,
                                   m_Levels, m_WinSize, m_Iterations, m_PolyN,
                                   m_PolySigma, m_Flags);

      m_Map = this->ComputeFlowMap(m_Flow);

      // Apply the flow to the matrices
      cv::remap(m_PaMat, m_PaRes, m_Map, cv::noArray(), cv::INTER_LINEAR);
      cv::remap(m_UsMat, m_UsRes, m_Map, cv::noArray(), cv::INTER_LINEAR);
    }

    // Enter the matrix as a slice at position i into output
    this->InsertMatrixAsSlice(m_PaRes, paOutput, i);
    this->InsertMatrixAsSlice(m_UsRes, usOutput, i);
  }
}

// Copied from https://stackoverflow.com/questions/17459584/opencv-warping-image-based-on-calcopticalflowfarneback
cv::Mat mitk::PhotoacousticMotionCorrectionFilter::ComputeFlowMap(cv::Mat flow) {
  cv::Mat map(flow.size(), flow.type());

  for (int y = 0; y < map.rows; ++y) {
    for(int x = 0; x < map.cols; ++x) {
      cv::Point2f f = flow.at<cv::Point2f>(y,x);
      map.at<cv::Point2f>(y,x) = cv::Point2f(x + f.x, y + f.y);
    }
  }

  return map;
}

cv::Mat mitk::PhotoacousticMotionCorrectionFilter::FitMatrixToChar(cv::Mat mat) {

  if (m_MaxValue == m_MinValue) {

    return mat.clone();
  }

  return MAX_MATRIX*(mat.clone() - m_MinValue) / (m_MaxValue - m_MinValue);
}

cv::Mat mitk::PhotoacousticMotionCorrectionFilter::GetMatrix(
    const mitk::Image::Pointer input, unsigned int i) {

  // Access slice i of image input
  mitk::ImageReadAccessor accessor(input, input->GetSliceData(i));
  mitk::Image::Pointer slice = mitk::Image::New();
  slice->Initialize(input->GetPixelType(), IMAGE_DIMENSION - 1, input->GetDimensions());
  slice->SetVolume(accessor.GetData());

  // Transform the slice to matrix
  m_ImageToOpenCVFilter->SetImage(slice);
  return m_ImageToOpenCVFilter->GetOpenCVMat();
}

void mitk::PhotoacousticMotionCorrectionFilter::InsertMatrixAsSlice(
    cv::Mat mat, mitk::Image::Pointer output, unsigned int i) {

  m_OpenCVToImageFilter->SetOpenCVMat(mat);
  m_OpenCVToImageFilter->Update();
  mitk::Image::Pointer slice = m_OpenCVToImageFilter->GetOutput();

  mitk::ImageReadAccessor accessor(slice);
  output->SetSlice(accessor.GetData(), i);
}

// TODO: remove debug messages
void mitk::PhotoacousticMotionCorrectionFilter::GenerateData() {
  MITK_INFO << "Start motion compensation.";

  mitk::Image::Pointer paInput = this->GetInput(0);
  mitk::Image::Pointer usInput = this->GetInput(1);
  mitk::Image::Pointer paOutput = this->GetOutput(0);
  mitk::Image::Pointer usOutput = this->GetOutput(1);

  // Check that we have two input images with agreeing dimensions
  this->CheckInput(paInput, usInput);

  // Check the output images and (re-)initialize, if necessary.
  this->InitializeOutputIfNecessary(paInput, usInput, paOutput, usOutput);

  // Set Max and Min of ultrasonic image
  this->m_MaxValue = usInput->GetStatistics()->GetScalarValueMax();
  this->m_MinValue = usInput->GetStatistics()->GetScalarValueMin();

  // m_ImageToOpenCVFilter->SetImage(paInput);
  this->PerformCorrection(paInput, usInput, paOutput, usOutput);

  MITK_INFO << "Motion compensation accomplished.";
}


text:
package org.apache.syncope.client.console.wizards;

import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
import org.apache.syncope.common.lib.to.SAML2EntityTO;
import org.apache.wicket.PageReference;
import org.apache.wicket.extensions.wizard.WizardStep;
import org.apache.wicket.model.PropertyModel;

abstract class SAML2EntityWizardBuilder<T extends SAML2EntityTO> extends BaseAjaxWizardBuilder<T> {

    private static final long serialVersionUID = 1L;

    protected SAML2EntityWizardBuilder(final T defaultItem, final PageReference pageRef) {
        super(defaultItem, pageRef);
    }

    protected class Metadata extends WizardStep {

        private static final long serialVersionUID = -3043839139187792810L;

        Metadata(final T entity, final PageReference pageRef) {
            add(new XMLEditorPanel(null, new PropertyModel<>(entity, "metadata"), false, pageRef));
        }

        @Override
        public String getTitle() {
            return "Metadata";
        }
    }

    protected abstract class Pem extends WizardStep {

        private static final long serialVersionUID = -3043839139187792810L;

        protected final String property;

        Pem(final String property) {
            this.property = property;
        }

        @Override
        public String getTitle() {
            return StringUtils.capitalize(property);
        }
    }
}


text:
package org.pipservices.commons.data;

import java.time.*;
import java.util.*;

import org.pipservices.commons.convert.*;

public class AnyValueMap extends HashMap<String, Object> implements Cloneable {
	private static final long serialVersionUID = 5876557837753631885L;

	public AnyValueMap() { }

    public AnyValueMap(Map<?, ?> values) {
    	append(values);
    }

    public Object get(String key) {
        return super.get(key);
    }

    public void append(Map<?, ?> map) {
    	if (map == null || map.size() == 0) return;

    	for (Map.Entry<?, ?> entry : map.entrySet()) {
			String key = StringConverter.toString(entry.getKey());
			Object value = entry.getValue();
			super.put(key, value);
		}
    }

    public Object getAsObject() {
    	Map<String, Object> result = new HashMap<String, Object>();
    	for (Map.Entry<String, Object> entry : this.entrySet())
    		result.put(entry.getKey(), entry.getValue());
    	return result;
    }

    public void setAsObject(Object value) {
    	clear();
    	Map<String, Object> values = MapConverter.toMap(value);
    	append(values);
    }

    public Object getAsObject(String key) {
        return get(key);
    }

    public void setAsObject(String key, Object value) {
        put(key, value);
    }

    public String getAsNullableString(String key) {
        Object value = getAsObject(key);
        return StringConverter.toNullableString(value);
    }

    public String getAsString(String key) {
        return getAsStringWithDefault(key, null);
    }

    public String getAsStringWithDefault(String key, String defaultValue) {
        Object value = getAsObject(key);
        return StringConverter.toStringWithDefault(value, defaultValue);
    }

    public Boolean getAsNullableBoolean(String key) {
        Object value = getAsObject(key);
        return BooleanConverter.toNullableBoolean(value);
    }

    public boolean getAsBoolean(String key) {
        return getAsBooleanWithDefault(key, false);
    }

    public boolean getAsBooleanWithDefault(String key, boolean defaultValue) {
        Object value = getAsObject(key);
        return BooleanConverter.toBooleanWithDefault(value, defaultValue);
    }

    public Integer getAsNullableInteger(String key) {
        Object value = getAsObject(key);
        return IntegerConverter.toNullableInteger(value);
    }

    public int getAsInteger(String key) {
        return getAsIntegerWithDefault(key, 0);
    }

    public int getAsIntegerWithDefault(String key, int defaultValue) {
        Object value = getAsObject(key);
        return IntegerConverter.toIntegerWithDefault(value, defaultValue);
    }

    public Long getAsNullableLong(String key) {
        Object value = getAsObject(key);
        return LongConverter.toNullableLong(value);
    }

    public long getAsLong(String key) {
        return getAsLongWithDefault(key, 0);
    }

    public long getAsLongWithDefault(String key, long defaultValue) {
        Object value = getAsObject(key);
        return LongConverter.toLongWithDefault(value, defaultValue);
    }

    public Float getAsNullableFloat(String key) {
        Object value = getAsObject(key);
        return FloatConverter.toNullableFloat(value);
    }

    public float getAsFloat(String key) {
        return getAsFloatWithDefault(key, 0);
    }

    public float getAsFloatWithDefault(String key, float defaultValue) {
        Object value = getAsObject(key);
        return FloatConverter.toFloatWithDefault(value, defaultValue);
    }

    public Double getAsNullableDouble(String key) {
        Object value = getAsObject(key);
        return DoubleConverter.toNullableDouble(value);
    }

    public double getAsDouble(String key) {
        return getAsDoubleWithDefault(key, 0);
    }

    public double getAsDoubleWithDefault(String key, double defaultValue) {
        Object value = getAsObject(key);
        return DoubleConverter.toDoubleWithDefault(value, defaultValue);
    }

    public ZonedDateTime getAsNullableDateTime(String key) {
        Object value = getAsObject(key);
        return DateTimeConverter.toNullableDateTime(value);
    }

    public ZonedDateTime getAsDateTime(String key) {
        return getAsDateTimeWithDefault(key, null);
    }

    public ZonedDateTime getAsDateTimeWithDefault(String key, ZonedDateTime defaultValue) {
        Object value = getAsObject(key);
        return DateTimeConverter.toDateTimeWithDefault(value, defaultValue);
    }

    public Duration getAsNullableDuration(String key) {
        Object value = getAsObject(key);
        return DurationConverter.toNullableDuration(value);
    }

    public Duration getAsDuration(String key) {
        return getAsDurationWithDefault(key, null);
    }

    public Duration getAsDurationWithDefault(String key, Duration defaultValue) {
        Object value = getAsObject(key);
        return DurationConverter.toDurationWithDefault(value, defaultValue);
    }

    public <T extends Enum<T>> T getAsNullableEnum(Class<T> type, String key) {
        Object value = getAsObject(key);
        return EnumConverter.toNullableEnum(type, value);
    }

    public <T extends Enum<T>> T getAsEnum(Class<T> type, String key) {
        return getAsEnumWithDefault(type, key, null);
    }

    public <T extends Enum<T>> T getAsEnumWithDefault(Class<T> type, String key, T defaultValue) {
        Object value = getAsObject(key);
        return EnumConverter.toEnumWithDefault(type, value, defaultValue);
    }

    public <T> T getAsNullableType(Class<T> type, String key) {
        Object value = getAsObject(key);
        return TypeConverter.toNullableType(type, value);
    }

    public <T> T getAsType(Class<T> type, String key) {
        return getAsTypeWithDefault(type, key, null);
    }

    public <T> T getAsTypeWithDefault(Class<T> type, String key, T defaultValue) {
        Object value = getAsObject(key);
        return TypeConverter.toTypeWithDefault(type, value, defaultValue);
    }

    public AnyValue getAsValue(String key) {
        Object value = getAsObject(key);
    	return new AnyValue(value);
    }

    public AnyValueArray getAsNullableArray(String key) {
        Object value = getAsObject(key);
    	return value != null ? AnyValueArray.fromValue(value) : null;
    }

    public AnyValueArray getAsArray(String key) {
        Object value = getAsObject(key);
    	return AnyValueArray.fromValue(value);
    }

    public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) {
    	AnyValueArray result = getAsNullableArray(key);
    	return result != null ? result : defaultValue;
    }

    public AnyValueMap getAsNullableMap(String key) {
        Object value = getAsObject(key);
    	return value != null ? AnyValueMap.fromValue(value) : null;
    }

    public AnyValueMap getAsMap(String key) {
        Object value = getAsObject(key);
    	return AnyValueMap.fromValue(value);
    }

    public AnyValueMap getAsMapWithDefault(String key, AnyValueMap defaultValue) {
        AnyValueMap result = getAsNullableMap(key);
    	return result != null ? result: defaultValue;
    }

    public Object clone() {
    	return new AnyValueMap(this);
    }

    public static AnyValueMap fromValue(Object value) {
    	AnyValueMap result = new AnyValueMap();
		result.setAsObject(value);
		return result;
	}

    public static AnyValueMap fromTuples(Object... tuples) {
    	return AnyValueMap.fromTuplesArray(tuples);
    }

    public static AnyValueMap fromTuplesArray(Object[] tuples) {
    	AnyValueMap result = new AnyValueMap();
    	if (tuples == null || tuples.length == 0)
    		return result;

        for (int index = 0; index < tuples.length; index += 2) {
            if (index + 1 >= tuples.length) break;

            String name = StringConverter.toString(tuples[index]);
            Object value = tuples[index + 1];

            result.setAsObject(name, value);
        }

        return result;
    }

    public static AnyValueMap fromMaps(Map<?,?>... maps)
    {
    	AnyValueMap result = new AnyValueMap();
    	if (maps == null || maps.length == 0)
    		return result;

    	for (Map<?,?> map : maps) {
        	for (Map.Entry<?, ?> entry : map.entrySet()) {
    			String key = StringConverter.toString(entry.getKey());
    			Object value = entry.getValue();
    			result.put(key, value);
    		}
    	}

    	return result;
    }
}


text:
@section('pagecss')

@stop

@section('breadcrumb')

Job Prefix

Tambah Job Prefix

@stop

@section('content')

Tambah Job Prefix

            Silahkan lengkapi form berikut.

    {{ Form::open(array('url' => route('jobprefixes.store'), 'method' => 'post',
        'role' => 'form', 'class'=>'form-horizontal', 'parsley-validate', 'novalidate')) }}

            {{ Form::label('code', 'Kode Job Prefix', array('class'=>'col-sm-2 control-label')) }}

            {{ Form::text('code', null, array(
                'class' => 'form-control',
                'placeholder' => 'JPxx',
                'parsley-required' => 'true',
                'parsley-remote' => route('api.jobprefixesvalidatecode')
                )) }}

            {{ Form::label('title', 'Nama Job Prefix', array('class'=>'col-sm-2 control-label')) }}

            {{ Form::text('title', null, array(
                'class' => 'form-control',
                'placeholder' => '',
                'parsley-required' => 'true',
                'parsley-remote' => route('api.jobprefixesvalidatecode')
                )) }}

                {{ Form::submit('Simpan Job Prefix', array('class' => 'btn btn-primary m-r-sm')) }}
                Pembatalan

    {{ Form::close() }}

@stop

@section('pagejs')

@stop


text:
import React, { Component } from 'react';

class Blog extends Component {
  render() {
    return
Blog
;
  }
}

export default Blog;


text:
package com.intuit.karate.fatjar;

import com.intuit.karate.Main;
import org.junit.jupiter.api.Test;

/**
 *
 * @author pthomas3
 */
class MainRunner {

    @Test
    void testMain() {
        Main.main(new String[]{"-m", "src/test/java/com/intuit/karate/fatjar/server.feature", "-p", "8080"});
    }

}


text:
<?php

// change the following paths if necessary
$yii=dirname(__FILE__).'/../yii/framework/yii.php';

require_once($yii);

$local=require(dirname(__FILE__).'/protected/config/main-local.php');
$base=require(dirname(__FILE__).'/protected/config/main.php');
$config=CMap::mergeArray($base, $local);
//$config=dirname(__FILE__).'/protected/config/main.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

Yii::createWebApplication($config)->run();

?>


text:
from collections import defaultdict
import GeminiQuery
import sql_utils
from mendelianerror import mendelian_error
from gemini_constants import *
import gemini_subjects as subjects
import itertools as it
import re

def get_prob(family_gt_lls, row):
    e = {}
    for k in ('gt_phred_ll_homref', 'gt_phred_ll_het', 'gt_phred_ll_homalt'):
        e[k] = row[k]

    for k, li in family_gt_lls.iteritems():
        e[k] = [eval(item, e) for item in li]
        # order is father, mother, child
    father = [e[k][0] for k in ("homref", "het", "homalt")]
    mother = [e[k][1] for k in ("homref", "het", "homalt")]
    child = [e[k][2] for k in ("homref", "het", "homalt")]
    return mendelian_error(father, mother, child, pls=True)

class GeminiInheritanceModelFactory(object):

    # https://github.com/arq5x/gemini/pull/436
    required_columns = ("family_id", "family_members",
                        "family_genotypes", "samples", "family_count")

    def __init__(self, args, model):

        # default to all genotype columns and all columns

        self.args = args
        self.model = model
        self.gq = GeminiQuery.GeminiQuery(args.db, include_gt_cols=True)

        self.gt_cols = self.gq.gt_cols

        if not args.columns:
            args.columns = "*," + ", ".join(self.gt_cols)

    def get_candidates(self):
        """
        Report candidate variants that meet the requested inheritance model.
        """
        if self.model in ["auto_dom", "auto_rec"] \
           or (self.model == "de_novo" and self.args.min_kindreds is not None):
            self._get_gene_only_candidates()
        else:
            self._get_all_candidates()

    def report_candidates(self, candidates,
                          is_comp_het=False):
        """
        Print variants that meet the user's requirements
        If input is a tuple,
        """
        min_kindreds = self.args.min_kindreds
        family_count = len(candidates)

        if min_kindreds is not None and family_count < min_kindreds:
            return False

        candidate_keys = sorted(candidates.keys())
        fam_counts_by_variant = defaultdict(int)
        for (gene, family_id), li in candidates.items():
            for row in li:
                variant_id = row[3]
                fam_counts_by_variant[variant_id] += 1

        for (gene, family_id) in candidate_keys:
            for tup in candidates[(gene, family_id)]:

                # (row, family_gt_label, family_gt_cols) \
                violation = ""
                comp_het = ""
                if self.model == "mendel_violations":
                    (row, family_gt_label, family_gt_cols, variant_id,
                            family_gt_lls, violation) = tuple(tup)
                elif is_comp_het:
                    (row, family_gt_label, family_gt_cols, variant_id, comp_het,
                            subject) = tuple(tup)
                else:
                    (row, family_gt_label, family_gt_cols, family_id) = tuple(tup)

                e = {}
                for k in ('gt_types', 'gts', 'gt_depths'):
                    e[k] = row[k]

                if self.model == "mendel_violations" and \
                                 "gt_phred_ll_homref" in self.gt_cols:
                    prob = get_prob(family_gt_lls, row)
                    violation += ("\t%.3f" % prob)

                gt_cols = [str(eval(s, e)) for s in family_gt_cols]
                gt_lbls = family_gt_label

                if is_comp_het:
                    affected_samples = [subject]
                    for c in self.added:
                        if c in row.print_fields:
                            row.print_fields.pop(c)
                else:
                    affected_samples = self.get_samples(gt_cols, gt_lbls)

                print str(row) + "\t%s\t%s\t%s\t%s\t%i%s" % (
                    family_id,
                    ",".join(gt_lbls),
                    ",".join(gt_cols),
                    ",".join(affected_samples),
                    fam_counts_by_variant[variant_id],
                    ("\t" + violation + comp_het).rstrip())

    def get_samples(self, gts, lbls, splitter=re.compile("\/|\|"), model=None):
        """Hack..."""
        model = model or self.model
        if model == "auto_rec":
            # first will always be parent who must have ref
            ref = splitter.split(gts[0])[0]
            return [l.split("(", 1)[0] for gt, l in it.izip(gts, lbls)
                    if ref not in splitter.split(gt) and ";affected" in l]
        elif model == "auto_dom":
            # has to be the affected samples that are hets.
            return [l.split("(", 1)[0] for gt, l in it.izip(gts, lbls) if
                    ";affected" in l and len(set(splitter.split(gt))) > 1]
        elif model == "de_novo":
            # samples that have alleles that the parents do not.
            parents = set(splitter.split(gts[0]) + splitter.split(gts[1]))
            return [l.split("(", 1)[0] for gt, l in it.izip(gts[2:], lbls[2:]) if
                    set(splitter.split(gt)) - parents]
        elif model == "mendel_violations":
            mom, dad = set(splitter.split(gts[0])), set(splitter.split(gts[1]))
            # denovo
            samps = self.get_samples(gts, lbls, model="de_novo")
            # u disomy. kid didn't get one from each parent. and LOH
            samps += [l.split("(", 1)[0] for gt, l in it.izip(gts[2:], lbls[2:])
                      if not (set(splitter.split(gt)) - mom
                              and set(splitter.split(gt)) - dad)]
            return samps

    def _cull_families(self):
        """
        If the user has asked to restric the analysis to a specific set
        of families, then we need to prune the list of possible families
        to that specific subset.
        """
        pass

    def _get_family_info(self):
        """
        Extract the relevant genotype filters, as well all labels
        for each family in the database.
        """
        families = subjects.get_families(self.args.db, self.args.families)
        self.family_ids = []
        self.family_masks = []
        self.family_gt_labels = []
        self.family_gt_columns = []
        self.family_dp_columns = []
        self.family_gt_phred_lls = []
        for family in families:

            family_filter = None

            if self.model == "auto_rec":
                family_filter = family.get_auto_recessive_filter(gt_ll=self.args.gt_phred_ll)
            elif self.model == "auto_dom":
                family_filter = family.get_auto_dominant_filter(gt_ll=self.args.gt_phred_ll)
            elif self.model == "de_novo":
                family_filter = family.get_de_novo_filter(self.args.only_affected, gt_ll=self.args.gt_phred_ll)
            elif self.model == "mendel_violations":
                family_filter = family.get_mendelian_violation_filter(gt_ll=self.args.gt_phred_ll)

            if family_filter != "False" and family_filter is not None:
                self.family_masks.append(family_filter)
                self.family_gt_labels.append(family.get_genotype_labels())
                self.family_gt_columns.append(family.get_genotype_columns())
                self.family_dp_columns.append(family.get_genotype_depths())
                self.family_ids.append(family.family_id)
                if self.model == "mendel_violations": #and \
                    #self.args.gt_phred_ll is not None:
                    self.family_gt_phred_lls.append(family.get_genotype_lls())

    def _construct_query(self):
        """
        Construct the relevant query based on the user's requests.
        """
        if self.args.columns is not None:
            # the user only wants to report a subset of the columns
            self.query = "SELECT " + str(self.args.columns) + " FROM variants "
        else:
            # report the kitchen sink
            self.query = "SELECT chrom, start, end, * %s " \
                + "FROM variants" % ", ".join(self.gt_cols)

        # add any non-genotype column limits to the where clause
        if self.args.filter:
            self.query += " WHERE " + self.args.filter

        # auto_rec and auto_dom candidates should be limited to
        # variants affecting genes.
        if self.model in ("auto_rec", "auto_dom") or \
           (self.model == "de_novo" and self.args.min_kindreds is not None):

            # we require the "gene" column for the auto_* tools
            self.query = sql_utils.ensure_columns(self.query, ['gene'])
            if self.args.filter:
                self.query += " AND gene is not NULL ORDER BY chrom, gene"
            else:
                self.query += " WHERE gene is not NULL ORDER BY chrom, gene"
        self.query = sql_utils.ensure_columns(self.query, ['variant_id'])

    def get_header(self, gqh, is_comp_het=False):
        h = "\t".join(self.required_columns)

        header = gqh + "\t" + h
        if self.model == "mendel_violations":
            return header + "\tviolation\tviolation_prob"
        elif is_comp_het:
            gqh = "\t".join([hd.strip() for hd in gqh.split("\t") if not hd.strip() in self.added])
            return gqh + "\t" + h + "\tcomp_het_id"
        else:
            return header

    def _get_gene_only_candidates(self):
        """
        Identify candidates that meet the user's criteria AND affect genes.
        """
        # collect family info
        self._get_family_info()

        # run the query applying any genotype filters provided by the user.
        self._construct_query()
        self.gq.run(self.query, needs_genotypes=True)

        print self.get_header(self.gq.header)

        # yield the resulting variants for this familiy
        self.candidates = defaultdict(list)
        prev_gene = None
        for row in self.gq:

            curr_gene = row['gene']
            variant_id = row.row['variant_id']

            # report any candidates for the previous gene
            if curr_gene != prev_gene and prev_gene is not None:
                self.report_candidates(self.candidates)
                # reset for the next gene
                self.candidates = defaultdict(list)

            # test the variant for each family in the db
            for idx, family_id in enumerate(self.family_ids):
                family_genotype_mask = self.family_masks[idx]
                family_gt_labels = self.family_gt_labels[idx]
                family_gt_cols = self.family_gt_columns[idx]
                family_dp_cols = self.family_dp_columns[idx]

                # interrogate the genotypes present in each family member to
                # conforming to the genetic model being tested
                e = {}
                for c in (cc for cc in ('gt_types', 'gts', 'gt_depths', 'gt_phred_ll_homalt',
                          'gt_phred_ll_het', 'gt_phred_ll_homref')
                          if cc in self.gt_cols):
                    e[c] = row[c]

                # skip if the variant doesn't meet a recessive model
                # for this family
                violations = []
                if self.model == "mendel_violations":
                    family_gt_phred_lls = self.family_gt_phred_lls[idx]
                    for violation, mask in family_genotype_mask.items():
                        if eval(mask, e):
                            violations.append(violation)
                    if len(violations) == 0:
                        continue
                else:
                    if not eval(family_genotype_mask, e):
                        continue

                # make sure each sample's genotype had sufficient coverage.
                # otherwise, ignore
                insufficient_depth = False
                for col in family_dp_cols:
                    depth = int(eval(col, e))
                    if depth < self.args.min_sample_depth:
                        insufficient_depth = True
                        break
                if insufficient_depth is True:
                    continue

                # if it meets a recessive model, add it to the list
                # of candidates for this gene.
                key = (curr_gene, family_id)
                self.candidates[key].append([row,
                                             family_gt_labels,
                                             family_gt_cols,
                                             variant_id])
                if self.model == "mendel_violations":
                    self.candidates[key][-1].append(family_gt_phred_lls)
                    self.candidates[key][-1].append(",".join(violations))

            prev_gene = curr_gene

        # report any candidates for the last gene
        self.report_candidates(self.candidates)

    def _get_all_candidates(self):
        """
        Identify candidates that meet the user's criteria no matter where
        they occur in the genome.
        """
        """
        Identify candidates that meet the user's criteria AND affect genes.
        """
        # collect family info
        self._get_family_info()

        # run the query applying any genotype filters provided by the user.
        self._construct_query()
        self.gq.run(self.query, needs_genotypes=True)

        print self.get_header(self.gq.header)
        gene = None

        for row in self.gq:
            #variant_id = row.row.pop('variant_id')
            variant_id = row.row['variant_id']

            candidates = defaultdict(list)
            cols = {}
            for col in self.gt_cols:
                cols[col] = row[col]

            # test the variant for each family in the db
            for idx, family_id in enumerate(self.family_ids):
                family_genotype_mask = self.family_masks[idx]
                family_gt_labels = self.family_gt_labels[idx]
                family_gt_cols = self.family_gt_columns[idx]
                family_dp_cols = self.family_dp_columns[idx]

                # interrogate the genotypes present in each family member to
                # conforming to the genetic model being tested

                # skip if the variant doesn't meet a recessive model
                # for this family
                violations = []
                if self.model == "mendel_violations":
                    try:
                        family_gt_phred_lls = self.family_gt_phred_lls[idx]
                    except IndexError:
                        family_gt_phred_lls = {}
                    for violation, mask in family_genotype_mask.items():
                        if eval(mask, cols):
                            violations.append(violation)
                    if len(violations) == 0:
                        continue
                else:
                    if not eval(family_genotype_mask, cols):
                        continue

                # make sure each sample's genotype had sufficient coverage.
                # otherwise, ignore
                insufficient_depth = False
                for col in family_dp_cols:
                    depth = int(eval(col, cols))
                    if depth < self.args.min_sample_depth:
                        insufficient_depth = True
                        break
                if insufficient_depth is True:
                    continue

                # shoe-horn the variant so we can use report_candidates.
                key = (gene, family_id)
                candidates[key].append([row, family_gt_labels, family_gt_cols, variant_id])

                if self.model == "mendel_violations":
                    candidates[key][-1].append(family_gt_phred_lls)
                    candidates[key][-1].append(",".join(violations))
            self.report_candidates(candidates)


text:
package org.jclouds.location.suppliers;

import java.net.URI;
import java.util.Map;
import java.util.NoSuchElementException;

import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.suppliers.fromconfig.RegionIdToURIFromConfigurationOrDefaultToProvider;

import com.google.common.base.Supplier;
import com.google.inject.ImplementedBy;
import com.google.inject.assistedinject.Assisted;

@ImplementedBy(RegionIdToURIFromConfigurationOrDefaultToProvider.class)
public interface RegionIdToURISupplier extends Supplier<Map<String, Supplier<URI>>> {
   interface Factory {
      /**
       *
       * @param apiType
       *           type of the api, according to the provider. ex. {@code compute} {@code
       *           object-store}
       * @param apiVersion
       *           version of the api, or null if not available
       * @return regions mapped to default uri
       * @throws NoSuchElementException if the {@code apiType} is not present in the catalog
       */
      RegionIdToURISupplier createForApiTypeAndVersion(@Assisted("apiType") String apiType,
               @Nullable @Assisted("apiVersion") String apiVersion) throws NoSuchElementException;
   }

}


text:
#ifndef NETTY_UNIX_SOCKET_H_
#define NETTY_UNIX_SOCKET_H_

#include <sys/socket.h>
#include <jni.h>

// External C methods
int netty_unix_socket_initSockaddr(JNIEnv* env, jbyteArray address, jint scopeId, jint jport, const struct sockaddr_storage* addr);
int netty_unix_socket_getOption(JNIEnv* env, jint fd, int level, int optname, void* optval, socklen_t optlen);
int netty_unix_socket_setOption(JNIEnv* env, jint fd, int level, int optname, const void* optval, socklen_t len);

// JNI initialization hooks. Users of this file are responsible for calling these in the JNI_OnLoad and JNI_OnUnload methods.
jint netty_unix_socket_JNI_OnLoad(JNIEnv* env);
void netty_unix_socket_JNI_OnUnLoad(JNIEnv* env);

#endif /* NETTY_UNIX_SOCKET_H_ */


text:
package org.kuali.kra.timeandmoney.rules;

import org.kuali.kra.timeandmoney.rule.event.TimeAndMoneyAwardDateSaveEvent;
import org.kuali.rice.krad.rules.rule.BusinessRule;

/**
 * This class...
 */
public interface TimeAndMoneyAwardDateSaveRule extends BusinessRule {

    /**
     * This method processes must be implemented and enforces all add method business rules.
     * @param timeAndMoneyAwardAmountTransactionSaveEvent
     * @return
     */
    boolean processSaveAwardDatesBusinessRules(TimeAndMoneyAwardDateSaveEvent
            timeAndMoneyAwardDateSaveEvent);
}


text:
package org.apache.cassandra.io.compress;

import java.io.*;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;

import com.google.common.io.Files;
import org.apache.cassandra.io.compress.ICompressor.WrappedArray;

import org.junit.Assert;
import org.junit.Test;

import static org.junit.Assert.*;

public class CompressorTest
{
    ICompressor compressor;

    ICompressor[] compressors = new ICompressor[] {
            LZ4Compressor.create(Collections.<String, String>emptyMap()),
            DeflateCompressor.create(Collections.<String, String>emptyMap()),
            SnappyCompressor.create(Collections.<String, String>emptyMap())
    };

    @Test
    public void testAllCompressors() throws IOException
    {
        for (ICompressor compressor : compressors)
        {
            this.compressor = compressor;

            testEmptyArray();
            testLongArray();
            testShortArray();
            testMappedFile();
        }
    }

    public void test(byte[] data, int off, int len) throws IOException
    {
        final int outOffset = 3;
        final WrappedArray out = new WrappedArray(new byte[outOffset + compressor.initialCompressedBufferLength(len)]);
        new Random().nextBytes(out.buffer);
        final int compressedLength = compressor.compress(data, off, len, out, outOffset);
        final int restoredOffset = 5;
        final byte[] restored = new byte[restoredOffset + len];
        new Random().nextBytes(restored);
        final int decompressedLength = compressor.uncompress(out.buffer, outOffset, compressedLength, restored, restoredOffset);
        assertEquals(decompressedLength, len);
        assertArrayEquals(Arrays.copyOfRange(data, off, off + len),
                          Arrays.copyOfRange(restored, restoredOffset, restoredOffset + decompressedLength));
    }

    public void test(byte[] data) throws IOException
    {
        test(data, 0, data.length);
    }

    public void testEmptyArray() throws IOException
    {
        test(new byte[0]);
    }

    public void testShortArray() throws UnsupportedEncodingException, IOException
    {
        test("Cassandra".getBytes("UTF-8"), 1, 7);
    }

    public void testLongArray() throws UnsupportedEncodingException, IOException
    {
        byte[] data = new byte[1 << 20];
        test(data, 13, 1 << 19);
        new Random(0).nextBytes(data);
        test(data, 13, 1 << 19);
    }

    public void testMappedFile() throws IOException
    {
        byte[] data = new byte[1 << 20];
        new Random().nextBytes(data);

        //create a temp file
        File temp = File.createTempFile("tempfile", ".tmp");
        temp.deleteOnExit();

        //Prepend some random bytes to the output and compress
        final int outOffset = 3;
        final WrappedArray out = new WrappedArray(new byte[outOffset + compressor.initialCompressedBufferLength(data.length)]);
        new Random().nextBytes(out.buffer);
        final int compressedLength = compressor.compress(data, 0, data.length, out, outOffset);
        Files.write(out.buffer, temp);

        MappedByteBuffer mappedData = Files.map(temp);
        mappedData.position(outOffset);
        mappedData.limit(compressedLength+outOffset);

        ByteBuffer result = compressor.useDirectOutputByteBuffers()
                ? ByteBuffer.allocateDirect(data.length + 100)
                : ByteBuffer.allocate(data.length + 100);

        int length = compressor.uncompress(mappedData, result);

        Assert.assertEquals(data.length, length);
        for (int i = 0; i < length; i++)
        {
            Assert.assertEquals("Decompression mismatch at byte "+i, data[i], result.get());
        }
    }
}


text:
namespace OleksiiOnSoftware.Services.Blog.Api.Controllers
{
    using Dto;
    using Microsoft.AspNetCore.Mvc;
    using Services;
    using System.Threading.Tasks;

    [Produces("application/json")]
    [Route("api/blogs/{blogId}/links")]
    public class LinksController : Controller
    {
        private readonly IBlogsService _blogsService;

        public LinksController(IBlogsService blogsService)
        {
            _blogsService = blogsService;
        }

        [HttpPost]
        public async Task Post([FromBody] LinkDto link)
        {
            await _blogsService.CreateLinkAsync(link);
        }
    }
}