text:
function addReturns (sequence) {
	sequence = sequence.replace(/(.{60})/g,
                    function (str, p1, offset, s) {
                      	return p1 + "\n";
                   }
        );
	return sequence;
}

function checkAlign (arrayOfTitles, arrayOfSequences)	{
	var lengthOfAlign = arrayOfSequences[0].length;
	if (arrayOfSequences.length < 2)	{
		alert ("Please enter an alignment consisting of at least two sequences.");
		return false;
	}
	for (var i = 0; i < arrayOfTitles.length; i++)	{
		if ((arrayOfTitles[i].search(/\S/) == -1) || (arrayOfSequences[i].search(/\S/) == -1) || (arrayOfSequences[i].length != lengthOfAlign))	{
			alert ("There is a problem with the alignment format.");
			return false;
		}
	}
	return true;
}

function checkCodonTable (codonTable)	{
	if ((codonTable.search(/AmAcid/) == -1) || (codonTable.search(/Codon/) == -1) || (codonTable.search(/Number/) == -1) || (codonTable.search(/\/1000/) == -1) || (codonTable.search(/Fraction\s*\.\./) == -1)) {
		alert ("The codon table has been entered incorrectly.");
		return false;
	}
	return true;
}

function checkFormElement (formElement)	{
    	if (formElement.value.search(/\S/) == -1)	{
		alert ("Please enter some text.");
 		return false;
    	}
    	return true;
}

function checkGeneticCode (arrayOfPatterns)	{
	var z = 0;
	var codon = "";
	var oneMatch = false;
	var testSequence = "gggggaggtggcgaggaagatgacgtggtagttgtcgcggcagctgccaggagaagtagcaagaaaaataacatgataattatcacgacaactacctggtgatgttgctagtaatattacttgttatttttctcgtcatcttcccggcgacgtcgccagcaacatcacctgctacttctcccgccacctccc";
	while (z < arrayOfPatterns.length)	{
		if (arrayOfPatterns[z].search(/^\s*\/[a-zA-Z\|\[\]]+\/=[a-zA-Z\*]/) == -1)	{
			alert ("Genetic code error: one or more patterns have been entered incorrectly.");
			return false;
		}
		if (moreExpressionCheck(arrayOfPatterns[z]) == false)	{
			alert ("Genetic code error: one or more patterns have been entered incorrectly.");
			return false;
		}
		z = z + 1;
	}
	var geneticCodeMatchResult = new Array (arrayOfPatterns.length);
	var geneticCodeMatchExp = new Array (arrayOfPatterns.length);
	for (var j = 0; j < arrayOfPatterns.length; j++)	{
			geneticCodeMatchExp[j] = eval(arrayOfPatterns[j].match(/\/.+\//) + "gi");
			geneticCodeMatchResult[j] = (arrayOfPatterns[j].match(/=[a-zA-Z\*]/)).toString();
			geneticCodeMatchResult[j] = geneticCodeMatchResult[j].replace(/=/g,"");
	}
	for (var i = 0; i <= testSequence.length - 3; i = i + 3)	{
		codon = testSequence.substring(i,(i+3));
		for (var j = 0; j < geneticCodeMatchExp.length; j++)	{
			if (codon.search(geneticCodeMatchExp[j]) != -1)	{
				if (oneMatch == true)	{
					alert('Genetic code error: more than one amino acid is coded by the codon: ' + codon + ".");
					return false;
				}
				oneMatch = true;
			}
		}
		if (oneMatch == false)	{
			alert('The genetic code expressions are missing a codon.');
			return false;
		}
		oneMatch = false;
	}
	return true;
}

function checkGroupInput (arrayOfPatterns)	{
	var z = 0;
	while (z < arrayOfPatterns.length)	{
		if (arrayOfPatterns[z].search(/[^acdefghiklmnpqrstvwyz]/i) != -1)	{
			alert ("One or more groups have been entered incorrectly.");
			return false;
		}
		z = z + 1;
	}
	for (var i = 0; i < arrayOfPatterns.length; i++)	{
		var re = new RegExp ("[" + arrayOfPatterns[i] + "]","gi");
		for (var j = i + 1; j < arrayOfPatterns.length; j++)	{
			if (arrayOfPatterns[j].search(re) != -1)	{
				alert('The same amino acid is in more than one similarity group.');
				return false;
			}
		}
	}
	return true;
}

function checkRestPatterns (arrayOfPatterns)	{
	var z = 0;
	while (z < arrayOfPatterns.length)	{
		if (arrayOfPatterns[z].search(/^\s*\/[acgturyswkmbdhvn\[\]]+\/\s+\([^\/]+\)\d+/i) == -1)	{
			alert ("One or more patterns have been entered incorrectly.");
			return false;
		}
		if (moreExpressionCheck(arrayOfPatterns[z]) == false)	{
			alert ("One or more patterns have been entered incorrectly.");
			return false;
		}
		z = z + 1;
	}
	return true;
}

function checkSequenceLength (text, maxInput) {
	if ( ((getSequenceFromFasta(text)).replace(/[^A-Za-z]/g, "")).length > maxInput) {
		alert ("Please enter a sequence consisting of less than or equal to " + maxInput + " characters.");
		return false;
	}
	else {
		return true;
	}
}

function checkTextLength (text, maxInput) {
	if (text.length > maxInput) {
		alert ("Please enter text consisting of less than or equal to " + maxInput + " characters.");
		return false;
	}
	else {
		return true;
	}
}

function complement (dnaSequence)	{
	//there is no tr operator
	//should write a tr method to replace this
	dnaSequence = dnaSequence.replace(/g/g,"1");
	dnaSequence = dnaSequence.replace(/c/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"c");
	dnaSequence = dnaSequence.replace(/2/g,"g");
	dnaSequence = dnaSequence.replace(/G/g,"1");
	dnaSequence = dnaSequence.replace(/C/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"C");
	dnaSequence = dnaSequence.replace(/2/g,"G");

	dnaSequence = dnaSequence.replace(/a/g,"1");
	dnaSequence = dnaSequence.replace(/t/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"t");
	dnaSequence = dnaSequence.replace(/2/g,"a");
	dnaSequence = dnaSequence.replace(/A/g,"1");
	dnaSequence = dnaSequence.replace(/T/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"T");
	dnaSequence = dnaSequence.replace(/2/g,"A");

	dnaSequence = dnaSequence.replace(/u/g,"a");
	dnaSequence = dnaSequence.replace(/U/g,"A");

	dnaSequence = dnaSequence.replace(/r/g,"1");
	dnaSequence = dnaSequence.replace(/y/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"y");
	dnaSequence = dnaSequence.replace(/2/g,"r");
	dnaSequence = dnaSequence.replace(/R/g,"1");
	dnaSequence = dnaSequence.replace(/Y/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"Y");
	dnaSequence = dnaSequence.replace(/2/g,"R");

	dnaSequence = dnaSequence.replace(/k/g,"1");
	dnaSequence = dnaSequence.replace(/m/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"m");
	dnaSequence = dnaSequence.replace(/2/g,"k");
	dnaSequence = dnaSequence.replace(/K/g,"1");
	dnaSequence = dnaSequence.replace(/M/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"M");
	dnaSequence = dnaSequence.replace(/2/g,"K");

	dnaSequence = dnaSequence.replace(/b/g,"1");
	dnaSequence = dnaSequence.replace(/v/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"v");
	dnaSequence = dnaSequence.replace(/2/g,"b");
	dnaSequence = dnaSequence.replace(/B/g,"1");
	dnaSequence = dnaSequence.replace(/V/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"V");
	dnaSequence = dnaSequence.replace(/2/g,"B");

	dnaSequence = dnaSequence.replace(/d/g,"1");
	dnaSequence = dnaSequence.replace(/h/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"h");
	dnaSequence = dnaSequence.replace(/2/g,"d");
	dnaSequence = dnaSequence.replace(/D/g,"1");
	dnaSequence = dnaSequence.replace(/H/g,"2");
	dnaSequence = dnaSequence.replace(/1/g,"H");
	dnaSequence = dnaSequence.replace(/2/g,"D");

	return dnaSequence;
}

function closeForm ()	{
	outputWindow.document.write ("</form>");
	return true;
}

function closePre () {
	//this is needed for Internet Explorer bug
	outputWindow.document.write ("
");
	outputWindow.document.write ('
\n');
}

function closeTextArea ()	{
	outputWindow.document.write ('</textarea>');
	return true;
}

function closeWindow ()	{
	outputWindow.document.write ("\n");
	outputWindow.document.write ("\n");
	outputWindow.document.write ("\n\n");
	outputWindow.status = 'Done.';
	outputWindow.document.close();
	return true;
}

function convertDegenerates (sequence) {
	sequence = sequence.toLowerCase();
	sequence = sequence.replace(/t/g, "[TU]");
	sequence = sequence.replace(/r/g, "[AGR]");
	sequence = sequence.replace(/y/g, "[CTUY]");
	sequence = sequence.replace(/s/g, "[GCS]");
	sequence = sequence.replace(/w/g, "[ATUW]");
	sequence = sequence.replace(/k/g, "[GTUK]");
	sequence = sequence.replace(/m/g, "[ACM]");
	sequence = sequence.replace(/b/g, "[CGTUBSKY]");
	sequence = sequence.replace(/d/g, "[AGTUDRKW]");
	sequence = sequence.replace(/h/g, "[ACTUHMYW]");
	sequence = sequence.replace(/v/g, "[ACGVSMR]");
	sequence = sequence.replace(/n/g, "[ACGTURYSWKMBDHVN]");
	return sequence;
}

function earlyCheckAlign (alignArray)	{
	if (alignArray.length < 3)	{
		alert ("There is a problem with the alignment format.");
		return false;
	}
	for (var i = 1; i < alignArray.length; i++)	{
		if (alignArray[i].search(/[^\s]+\s/) == -1)	{
			alert ("There is a problem with the alignment format.");
			return false;
		}
	}
	return true;
}

function filterAlignSeq (alignSeq)	{
	alignSeq = alignSeq.replace(/[^abcdefghiklmnpqrstvwxyz\.\-]/gi,"");
	return alignSeq;
}

function filterFastaTitle (sequenceTitle)	{
	sequenceTitle = sequenceTitle.replace(/\s{2,}/g," ");
	sequenceTitle = sequenceTitle.replace(/^\s*/g,"");
	sequenceTitle = sequenceTitle.replace(/[\f\n\r\t]+$/g,"\n");
	return sequenceTitle.replace (/[\<\>]\n/gi,"");
}

function getArrayOfFasta (sequenceData) {
	var arrayOfFasta = new Array();
	var matchArray;
	var re = /\>[^\>]+/g;
	if (sequenceData.search(/\>[^\f\n\r]+[\f\n\r]/) != -1)	{
		while (matchArray = re.exec(sequenceData)) {
			arrayOfFasta.push(matchArray[0]);
		}
	}
	else {
		arrayOfFasta[0] = sequenceData;
	}
	return arrayOfFasta;
}

function getFastaTitleFromTitleAndSequence (fastaSequenceTitle, sequence)	{
	var stringToReturn = '>results for ' + sequence.length + ' residue sequence ';
	if (fastaSequenceTitle.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitle + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequence.substring(0,10) + '"';
	return stringToReturn + '\n';
}

function getFuzzySearchTitle (fastaSequenceTitleOne, sequenceOne, fastaSequenceTitleTwo, sequenceTwo)	{
	var stringToReturn = 'Search results for ' + sequenceOne.length + ' residue sequence ';
	if (fastaSequenceTitleOne.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitleOne + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequenceOne.substring(0,10) + '"\n';
	stringToReturn = stringToReturn + 'and ' + sequenceTwo.length + ' residue sequence ';
	if (fastaSequenceTitleTwo.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitleTwo + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequenceTwo.substring(0,10) + '"';
	return '
' + stringToReturn + '
\n';
}

function getGeneticCodeMatchExp (arrayOfPatterns) {
	var geneticCodeMatchExp = [arrayOfPatterns.length];
	for (var j = 0; j < arrayOfPatterns.length; j++)	{
			geneticCodeMatchExp[j] = eval(arrayOfPatterns[j].match(/\/.+\//) + "gi");
	}
	return geneticCodeMatchExp;
}

function getGeneticCodeMatchResult (arrayOfPatterns) {
	var geneticCodeMatchResult = new Array (arrayOfPatterns.length);
	for (var j = 0; j < arrayOfPatterns.length; j++)	{
			geneticCodeMatchResult[j] = (arrayOfPatterns[j].match(/=[a-zA-Z\*]/)).toString();
			geneticCodeMatchResult[j] = geneticCodeMatchResult[j].replace(/=/g,"");
	}
	return geneticCodeMatchResult;
}

function getInfoFromTitleAndSequence (fastaSequenceTitle, sequence)	{
	var stringToReturn = 'Results for ' + sequence.length + ' residue sequence ';
	if (fastaSequenceTitle.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitle + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequence.substring(0,10) + '"';
	return '
' + stringToReturn + '
\n';
}

function getInfoFromTitleAndSequenceAndTopology (fastaSequenceTitle, sequence, topology)	{
	var stringToReturn = 'Results for ' + topology + ' ' + sequence.length + ' residue sequence ';
	if (fastaSequenceTitle.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitle + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequence.substring(0,10) + '"';
	return '
' + stringToReturn + '
\n';
}

function getPairwiseAlignTitle (fastaSequenceTitleOne, sequenceOne, fastaSequenceTitleTwo, sequenceTwo)	{
	var stringToReturn = 'Alignment results for ' + sequenceOne.length + ' residue sequence ';
	if (fastaSequenceTitleOne.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitleOne + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequenceOne.substring(0,10) + '"\n';
	stringToReturn = stringToReturn + 'and ' + sequenceTwo.length + ' residue sequence ';
	if (fastaSequenceTitleTwo.search(/[^\s]/) != -1)	{
		stringToReturn = stringToReturn + '"' + fastaSequenceTitleTwo + '"';
	}
	stringToReturn = stringToReturn + ' starting "' + sequenceTwo.substring(0,10) + '"';
	return '
' + stringToReturn + '
\n';
}

function getRandomSequence (components, lengthOut)	{
	var sequenceArray = new Array();
	var tempNum = 0;
	var tempChar = "";
	for (var j = 0; j < (lengthOut); j++)	{
		tempNum = Math.floor(Math.random() * components.length);
		tempChar = components[tempNum];
		sequenceArray.push(tempChar);
	}
	return sequenceArray.join("");
}

function getSequenceFromFasta (sequenceRecord) {
	if (sequenceRecord.search(/\>[^\f\n\r]+[\f\n\r]/) != -1)	{
		sequenceRecord = sequenceRecord.replace(/\>[^\f\n\r]+[\f\n\r]/,"");
	}
	return sequenceRecord;
}

function getTitleFromFasta (sequenceRecord) {
	var fastaTitle = "Untitled";
	if (sequenceRecord.search(/\>[^\f\n\r]+[\f\n\r]/) != -1)	{
		fastaTitle = (sequenceRecord.match(/\>[^\f\n\r]+[\f\n\r]/,"")).toString();
		fastaTitle = fastaTitle.replace(/\>|[\f\n\r]/g,"");
		fastaTitle = fastaTitle.replace(/\s{2,}/g," ");
	        fastaTitle = fastaTitle.replace(/[\<\>]/gi,"");
	}
	return fastaTitle;
}

function moreExpressionCheck (expressionToCheck)	{
	if ((expressionToCheck.search(/\[[A-Za-z\|]*\[/) != -1) || (expressionToCheck.search(/\][A-Za-z\|]*\]/) != -1) || (expressionToCheck.search(/\[\]/) != -1) || (expressionToCheck.search(/\/[A-Za-z\|]*\]/) != -1) || (expressionToCheck.search(/\[[A-Za-z\|]*\//) != -1) || (expressionToCheck.search(/\|\|/) != -1) || (expressionToCheck.search(/\/\|/) != -1) || (expressionToCheck.search(/\|\//) != -1) || (expressionToCheck.search(/\[.\]/) != -1) || (expressionToCheck.search(/\</) != -1) || (expressionToCheck.search(/\>/) != -1))	{
		return false;
	}
	return true;
}

function openForm ()	{
	outputWindow.document.write ('<form action="">\n');
	return true;
}

function openPre () {
	//this is needed for Internet Explorer bug
	outputWindow.document.write ('
');
	outputWindow.document.write ('
');
}

function openTextArea ()	{
	outputWindow.document.write ('
<textarea rows="6" cols="61">\n');
	return true;
}

function openWindow (title) {
    _openWindow (title, true);
}

function _openWindow (title, isColor) {

	outputWindow=window.open("","my_new_window","toolbar=no, location=no, directories=no, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=800, height=400");
	outputWindow.focus();
	outputWindow.document.write ("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
			             "\n" +
				     "\n" +
                                     "<title>Sequence Manipulation Suite</title>\n" +
                                     "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n");

	if (isColor) {
        outputWindow.document.write ("\n");
	}
	else {
        outputWindow.document.write ("\n");
	}
        outputWindow.document.write ("\n" +
                                     "\n" +
                                     "
" + title + " results
\n");
	outputWindow.status = 'Please Wait.';
	return true;
}

function openWindowAlign (title) {
        _openWindowAlign(title, true);
}

function _openWindowAlign (title, isBackground) {

	outputWindow=window.open("","my_new_window","toolbar=no, location=no, directories=no, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=800, height=400");
	outputWindow.focus();
	outputWindow.document.write ("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
			             "\n" +
				     "\n" +
                                     "<title>Sequence Manipulation Suite</title>\n" +
                                     "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n");
	if (isBackground) {
        outputWindow.document.write ("\n");
	}
	else {
        outputWindow.document.write ("\n");
	}
        outputWindow.document.write ("\n" +
                                     "\n" +
                                     "
" + title + " results
\n");
	outputWindow.status = 'Please Wait.';
	return true;
}

function removeFormatting (sequence) {
	return sequence.replace(/[\d\s]/g, "");
}

function removeNonDna (sequence) {
	return sequence.replace(/[^gatucryswkmbdhvnxGATUCRYSWKMBDHVNX]/g, "");
}

function removeNonDnaStrict (sequence) {
	return sequence.replace(/[^gatucGATUC]/g, "");
}

function removeNonProtein (sequence) {
	return sequence.replace(/[^ACDEFGHIKLMNPQRSTVWYZacdefghiklmnpqrstvwyz\*]/g, "");
}

function removeNonProteinStrict (sequence) {
	return sequence.replace(/[^ACDEFGHIKLMNPQRSTVWYZacdefghiklmnpqrstvwyz\*]/g, "");
}

function removeNonProteinAllowDegen (sequence) {
	return sequence.replace(/[^ABCDEFGHIKLMNPQRSTVWYXZabcdefghiklmnpqrstvwyxz\*]/g, "");
}

function removeWhiteSpace (text) {
	return text.replace(/\s/g, "");
}

function removeNonLetters (sequence) {
	return sequence.replace(/[^A-Z]/gi, "");
}

function reverse (dnaSequence)	{
	var tempDnaArray = new Array();
	if (dnaSequence.search(/./) != -1)	{
		tempDnaArray = dnaSequence.match(/./g);
		tempDnaArray = tempDnaArray.reverse();
		dnaSequence = tempDnaArray.join("");
	}
	return dnaSequence;
}

function rightNum (theNumber, sequenceToAppend, lengthOfColumn, tabIn)	{
	var j = 0;
	var tempString = "";
	theNumber = theNumber.toString();
	for (var j = theNumber.length; j < lengthOfColumn; j++)	{
		tempString = tempString + " ";
	}
	theNumber = tempString + theNumber + " ";
	sequenceToAppend = sequenceToAppend + theNumber + tabIn;
	return sequenceToAppend;
}

function testScript() {
	//test some javascript functions to see how the browser performs.
	//want to prevent non Javascript 1.5 browsers from attempting to run.
	//first test Array.push()
	var testArray = new Array();
	var testString = "1234567890";

	testArray.push(testString);
	if (testArray[0] != testString) {
		alert("Array object push method not supported. See browser compatibility page.");
		return false;
	}

	//now test the 'm' flag in a regular expression
	testString = "1\n2\n3";
	var re = /^2$/m;
	if (testString.search(re) == -1) {
		alert("Regular expression 'm' flag not supported. See browser compatibility page.");
		return false;
	}

	var caughtException = false;
	//now test exception handling
	try {
		re = eval("Exception handling not supported. Check browser compatibility page.");
	}
	catch(e) {
		caughtException = true;
	}

	if (!(caughtException)) {
		alert("Exception handling not supported. See browser compatibility page.");
	}

	//now test replace lambda function
	testString = "123";
	testString = testString.replace(/(\d)/g,
                    function (str, p1, offset, s) {
                      	return p1 + "X";
                   }
        );
	if (testString != "1X2X3X") {
		alert ("Nested function in String replace method not supported. See browser compatibility page.");
		return false;
	}

	//test number methods toFixed() and toPrecision()
	var testNum = 2489.8237;
	if (testNum.toFixed(3) != 2489.824) {
		alert ("Number toFixed() method not supported. See browser compatibility page.");
		return false;
	}

	if (testNum.toPrecision(5) != 2489.8) {
		alert ("Number toPrecision() method not supported. See browser compatibility page.");
		return false;
	}

	return true;
}

function verifyDigits (theNumber)	{
	if (theNumber.search(/\d/) == -1) {
		alert ("Please enter a number");
		return false;
	}
}

function verifyEmbl (emblFile) {
	if ((emblFile.search(/ID/) == -1) || (emblFile.search(/AC/) == -1) || (emblFile.search(/DE/) == -1) || (emblFile.search(/SQ/) == -1)) {
		alert ("Please enter the contents of an EMBL file.");
		return false;
	}
	return true;
}

function verifyMaxDigits (theNumber, maxInput)	{
	if (theNumber.search(/\d/) == -1) {
		alert ("Please enter a number.");
		return false;
	}
	if (theNumber > maxInput) {
	        alert ("Please enter a number less than or equal to " + maxInput + ".");
	        return false;
        }
}

function verifyDna (dnaSequence)	{
	if (dnaSequence.search(/[^gatucryswkmbdhvnx\s]/i) != -1) {
		alert ("The sequence contains non-DNA characters, which will be omitted.");
	}
	return true;
}

function verifyProtein (proteinSequence)	{
	if (proteinSequence.search(/[^acdefghiklmnpqrstvwyz\*\s]/i) != -1) {
		alert ("The sequence contains non-protein characters, which will be omitted.");
	}
	return true;
}

function verifyGenBank (genBankFile) {
	if ((genBankFile.search(/LOCUS/) == -1) || (genBankFile.search(/DEFINITION/) == -1) || (genBankFile.search(/ACCESSION/) == -1) || (genBankFile.search(/ORIGIN/) == -1)) {
		alert ("Please enter the contents of a GenBank file.");
		return false;
	}
	return true;
}

function verifyGenBankFeat (genBankFile) {
	if ((genBankFile.search(/LOCUS/) == -1) || (genBankFile.search(/DEFINITION/) == -1) || (genBankFile.search(/ACCESSION/) == -1) || (genBankFile.search(/ORIGIN/) == -1)) {
		alert ("Please enter the contents of a GenBank file.");
		return false;
	}
	if (genBankFile.search(/FEATURES {13}/) == -1)	{
		alert ("The file has no defined features.");
		return false;
	}
	return true;
}

function verifyEmblFeat (emblFile) {
	if ((emblFile.search(/ID/) == -1) || (emblFile.search(/AC/) == -1) || (emblFile.search(/DE/) == -1) || (emblFile.search(/SQ/) == -1)) {
		alert ("Please enter the contents of an EMBL file.");
		return false;
	}
	if (emblFile.search(/^FT/m) == -1)	{
		alert ("The file has no defined features.");
		return false;
	}
	return true;
}

//deprecated
function writeGroupNum (text, tabIn, groupSize, basePerLine, startBase, stopBase) {
	var i = parseInt(startBase);
	var k = 0;
	var lineOfText = "";
	var sepChar = " ";
	groupSize = parseInt(groupSize);
	basePerLine = parseInt(basePerLine);
	while (i < stopBase)	{
		lineOfText = rightNum(i + 1,lineOfText,8,tabIn);
		for (var j = 1; j <= (basePerLine/groupSize); j++)	{//makes a group each loop
			while (k < groupSize)	{
				lineOfText = lineOfText + text.charAt(k + i);
				k = k + 1;
			}
			i = i + groupSize;
			k = 0;
			lineOfText = lineOfText + sepChar;
		}
		outputWindow.document.write (lineOfText + "\n");
		lineOfText = "";
	}
	return true;
}

function writeGroupNumDna (text, tabIn, groupSize, basePerLine, startBase, stopBase, strands, numberPosition) {
	writeGroupNumDnaSetStart (text, tabIn, groupSize, basePerLine, startBase, stopBase, strands, numberPosition, 0)
	return true;
}

function writeGroupNumDnaSetStart (text, tabIn, groupSize, basePerLine, startBase, stopBase, strands, numberPosition, numberingAdjustment) {
	//strands can be 'one' or 'two'
	//numberPosition can be 'left', 'above', or 'right'
	var i = parseInt(startBase);
	var k = 0;
	var lineOfText = "";
	var lineNum = "";
	var sepChar = " ";
	var aboveNum = "";
	groupSize = parseInt(groupSize);
	basePerLine = parseInt(basePerLine);
	numberingAdjustment = parseInt(numberingAdjustment);
	while (i < stopBase)	{
		lineNum = i + 1;
		for (var j = 1; j <= (basePerLine/groupSize); j++)	{//makes a group each loop
			while (k < groupSize)	{
				if (i + k >= stopBase) {
					break;
				}
				lineOfText = lineOfText + text.charAt(k + i);
				k = k + 1;
			}
			lineOfText = lineOfText + sepChar;
			i = i + k;
			if (numberPosition == 'above') {
				aboveNum = aboveNum + rightNum(adjustNumbering(i, numberingAdjustment),"",groupSize,tabIn);
			}
			if (i >= stopBase) {
				break;
			}
			k = 0;
		}
		if (numberPosition == 'left') {
			outputWindow.document.write (rightNum(adjustNumbering(lineNum, numberingAdjustment),"",8,tabIn) + lineOfText + "\n");
			if (strands == 'two') {
				outputWindow.document.write (rightNum(adjustNumbering(lineNum, numberingAdjustment),"",8,tabIn) + complement(lineOfText) + "\n");
				outputWindow.document.write ("\n");
			}
		}
		else if (numberPosition == 'right') {
			outputWindow.document.write (lineOfText + adjustNumbering(i, numberingAdjustment) + "\n");
			if (strands == 'two') {
				outputWindow.document.write (complement(lineOfText) + adjustNumbering(i, numberingAdjustment) + "\n");
				outputWindow.document.write ("\n");
			}
		}
		else if (numberPosition == 'above') {
			outputWindow.document.write (aboveNum + "\n");
			outputWindow.document.write (lineOfText + "\n");
			if (strands == 'two') {
				outputWindow.document.write (complement(lineOfText) + "\n");
				outputWindow.document.write ("\n");
			}
		}
		aboveNum = "";
		lineOfText = "";
	}
	return true;

	//This function is used to change the numbering of base '0' to '1'
	function adjustNumbering (original, adjustment) {
		var adjusted = original + adjustment;
		if ((adjustment < 0) && (adjusted >= 0)) {
			adjusted++;
		}
		return adjusted;
	}
}

function writeGroupNumProtein (text, tabIn, groupSize, basePerLine, startBase, stopBase, numberPosition) {
	//numberPosition can be 'left', 'above', or 'right'
	var i = parseInt(startBase);
	var k = 0;
	var lineOfText = "";
	var lineNum = "";
	var sepChar = " ";
	var aboveNum = "";
	groupSize = parseInt(groupSize);
	basePerLine = parseInt(basePerLine);
	while (i < stopBase)	{
		lineNum = i + 1;
		for (var j = 1; j <= (basePerLine/groupSize); j++)	{//makes a group each loop
			while (k < groupSize)	{
				if (i + k >= stopBase) {
					break;
				}
				lineOfText = lineOfText + text.charAt(k + i);
				k = k + 1;
			}
			lineOfText = lineOfText + sepChar;
			i = i + k;
			if (numberPosition == 'above') {
				aboveNum = aboveNum + rightNum(i,"",groupSize,tabIn);
			}
			if (i >= stopBase) {
				break;
			}
			k = 0;
		}
		if (numberPosition == 'left') {
			outputWindow.document.write (rightNum(lineNum,"",8,tabIn) + lineOfText + "\n");
		}
		else if (numberPosition == 'right') {
			outputWindow.document.write (lineOfText + i + "\n");
		}
		else if (numberPosition == 'above') {
			outputWindow.document.write (aboveNum + "\n");
			outputWindow.document.write (lineOfText + "\n");
		}
		aboveNum = "";
		lineOfText = "";
	}
	return true;
}

function writeMutatedSequence (sequence, components, numMut, firstIndexToMutate, lastIndexToMutate)	{
	var currentChar = "";
	var randNum = 0;
	var maxNum = 0;
	var needNewChar = "";
	var componentsIndex = 0;

	numMut = parseInt(numMut);
	firstIndexToMutate = parseInt(firstIndexToMutate);
	lastIndexToMutate = parseInt(lastIndexToMutate);

	if ((sequence.length <= firstIndexToMutate) || (lastIndexToMutate < 0) || (lastIndexToMutate <= firstIndexToMutate)) {
		numMut = 0;
	}

	for (var i = 0; i < numMut; i++)	{
		maxNum = sequence.length;
		randNum = Math.floor(Math.random() * maxNum);

		if ((randNum < firstIndexToMutate) || (randNum > lastIndexToMutate)) {
			numMut++;
			continue;
		}

		currentChar = sequence.charAt(randNum);
		needNewChar = true;
		while (needNewChar) {
			componentsIndex = Math.round(Math.random() * components.length);
			if (componentsIndex == components.length)	{
				componentsIndex = 0;
			}
			if (components[componentsIndex] != currentChar) {
				needNewChar = false;
			}
		}
		sequence = sequence.substring(0,randNum) + components[componentsIndex] + sequence.substring((randNum + 1),sequence.length);

	}
	outputWindow.document.write(addReturns(sequence));
	return true;
}

function writeRandomSequence (components, lengthOut)	{
	var sequence = "";
	var tempNum = 0;
	var tempChar = "";
	for (var j = 0; j < (lengthOut); j++)	{
		tempNum = Math.floor(Math.random() * components.length);
		tempChar = components[tempNum];
		sequence = sequence + tempChar;
		if (sequence.length == 60)	{
			outputWindow.document.write(sequence +'\n');
			sequence = "";
		}
	}
	outputWindow.document.write(sequence + '\n');
	return true;
}

function writeRestrictionSites (sequence, arrayOfItems, dnaConformation)	{
	var resultArray = new Array();
	var lookAhead = 50;
	var lowerLimit = 0;
	var upperLimit = sequence.length;
	var shiftValue = 0;
	var cutDistance;
	var matchExp;
	var matchPosition;
	var tempString;
	var backGroundClass;
	var matchArray;
	var timesFound = 0;
	if (dnaConformation == "circular")	{
		shiftValue = (sequence.substring(0, lookAhead)).length;
		sequence = sequence.substring(sequence.length - lookAhead,sequence.length) + sequence + sequence.substring(0,lookAhead);
		lowerLimit = 0 + shiftValue;
		upperLimit = upperLimit + shiftValue;
	}
	outputWindow.document.write ('

\n');
	outputWindow.document.write ('
' + 'Site:' + '	' + 'Positions:' + '
\n');
	for (var i = 0; i < (arrayOfItems.length); i++)	{
		tempString = "none";
		backGroundClass = "many";
		matchExp = arrayOfItems[i].match(/\/.+\//) + "gi";
		matchPosition = 0;
		matchExp = eval(matchExp);
		cutDistance = parseFloat((arrayOfItems[i].match(/\)\D*\d+/)).toString().replace(/\)\D*/,""));

		while (matchArray = matchExp.exec(sequence)) {
			timesFound++;
			matchPosition = matchExp.lastIndex;
			matchPosition = matchPosition - cutDistance;
			if ((matchPosition >= lowerLimit) && (matchPosition < upperLimit))	{
				tempString = tempString + ', ' + (matchPosition - shiftValue + 1);
			}
		}

		if (tempString.search(/\d/) != -1)	{
			tempString = tempString.replace(/none,\s*/,"");
		}

		if (timesFound == 0) {
			backGroundClass = "none";
		}
		else if (timesFound == 1) {
			backGroundClass = "one";
		}
		else if (timesFound == 2) {
			backGroundClass = "two";
		}
		else if (timesFound == 3) {
			backGroundClass = "three";
		}
		else {
			backGroundClass = "many";
		}

		outputWindow.document.write ('
' + ((arrayOfItems[i].match(/\([^\(]+\)/)).toString()).replace(/\(|\)/g,"") + '	' + tempString + '
\n');

		timesFound = 0;
	}
	outputWindow.document.write('

\n');
	return true;
}

function writeSequenceStats (sequence, arrayOfItems)	{	//arrayOFItems are regular expressions. A number included with each regular expression serves as an adjustment for the percentage calculation. Any additional text will appear next to the pattern when the results are given.
	var originalLength = sequence.length;
	outputWindow.document.write ('

\n');
	outputWindow.document.write ('
' + 'Pattern:' + '	' + 'Times found:' + '	' + 'Percentage:' + '
\n');
	for (var i = 0; i < (arrayOfItems.length); i++)	{
		var tempNumber = 0;
		var matchExp = arrayOfItems[i].match(/\/[^\/]+\//) + "gi";
		matchExp = eval(matchExp);
		if (sequence.search(matchExp) != -1)	{
			tempNumber = ((sequence.match(matchExp)).length);
		}
		var percentage = 0;
		if ((originalLength + 1 - parseFloat(arrayOfItems[i].match(/\d+/))) > 0) {
			percentage = (100 * tempNumber/(originalLength + 1 - parseFloat(arrayOfItems[i].match(/\d+/))));
		}

		outputWindow.document.write ('
' + ((arrayOfItems[i].match(/\([^\(]+\)\b/)).toString()).replace(/\(|\)/g,"") + '	' + tempNumber + '	' + percentage.toFixed(2) + '
\n');
	}
	outputWindow.document.write('

\n');
	return true;
}

function writeShuffledSequence (sequence)	{
	var tempSeq = "";
	var tempChar = "";
	var tempString1 = "";
	var tempString2 = "";
	var randNum = 0;
	var maxNum = 0;
	while (sequence.length > 0)	{
		maxNum = sequence.length;
		randNum = Math.floor(Math.random() * maxNum);
		tempChar = sequence.charAt(randNum);
		tempSeq = tempSeq + tempChar;
		tempString1 = sequence.substring(0,randNum);
		tempString2 = sequence.substring((randNum + 1),sequence.length);
		sequence = tempString1 + tempString2;
		if (tempSeq.length == 60)	{
			outputWindow.document.write(tempSeq +'\n');
			tempSeq = "";
		}
	}
	outputWindow.document.write(tempSeq + '\n');
	return true;
}

redpajama_set_name: RedPajamaGithub


text:
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from scrapy.item import Item, Field
from scrapy.http import Request
import re
import os
import requests
import logging
log = logging.getLogger(__name__)

class Vote(Item):
    url = Field()
    congress = Field()
    name = Field()
    number = Field()
    time = Field()
    description = Field()
    yes_count = Field()
    no_count = Field()
    abstain_count = Field()
    session = Field()
    data = Field()

class SenateSpider(CrawlSpider):
    name = "senate"
    allowed_domains = ['www.senate.gov', 'senate.gov']
    start_urls = ["http://www.senate.gov/pagelayout/legislative/a_three_sections_with_teasers/votes.htm"]
    rules = [
        Rule(SgmlLinkExtractor(allow=["/legislative/LIS/roll_call_lists/vote_menu_\d+_\d+.htm"])),
        Rule(SgmlLinkExtractor(allow=["/legislative/LIS/roll_call_lists/roll_call_vote_cfm.cfm\?congress=\d+\&session=\d+\&vote=\d+"]), 'parse_senate')
    ]

    def parse_links(self, response):
        x = HtmlXPathSelector(response)
        urls = x.select('//td[@class="contenttext"]/a/@href').extract()
        requests = []
        for url in urls:
            requests.append(Request(url="http://www.senate.gov" + url))
        return requests

    def parse_senate(self, response):
        url = response.url
        x = HtmlXPathSelector(response)
        content = x.select('//tr/td[@class="contenttext"]/text()').extract()
        congress = re.findall("\d+",url)[0]
        session = re.findall("\d+",url)[1]
        name = content[3]
        number = re.findall("\d+",url)[2]
        time = content[5]
        description = content[9]
        yes_count = content[11]
        no_count = content[13]
        abstain_count = content[15]

        yes_nof = x.select('//tr/td[@class="contenttext"]/b/text()').extract()
        yes_no = []
        for i in xrange(8,len(yes_nof)):
            if yes_nof[i]=="YEAs ---":
                break
            yes_no.append(yes_nof[i])
        sens = []
        for i in xrange(16,len(content)):
            if content[i]=="\n            ":
                sens.append(content[i-1])

        syn = {sens[i] : yes_no[i] for i in xrange(0,len(yes_no))}

        vote = Vote()
        vote['congress'] = congress
        vote['name'] = name
        vote['number'] = number
        vote['time'] = time
        vote['description'] = description
        vote['yes_count'] = yes_count
        vote['no_count'] = no_count
        vote['abstain_count'] = abstain_count
        vote['data'] = syn
        vote['session'] = session

        return vote


text:
// The MIT License (MIT)

// Copyright (c) 2013 lailongwei<lailongwei@126.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifndef __LLBC_CORE_OS_OS_TIME_H__
#define __LLBC_CORE_OS_OS_TIME_H__

#include "llbc/common/Common.h"

__LLBC_NS_BEGIN

/**
 * The LLBC_RdTsc() support macro define.
 */
#if (LLBC_TARGET_PROCESSOR_X86_64 || LLBC_TARGET_PROCESSOR_X86)
 #define LLBC_SUPPORT_RDTSC 1
#else // Non x86 and x86_64
 #define LLBC_SUPPORT_RDTSC 0
#endif // x86 or x86_64

/**
 * Set timezone.
 */
LLBC_EXPORT void LLBC_TZSet();

/**
 * Get timezone value, the value is difference in seconds between coordinated universal
 * time and local time, if in +8, return -28800, if in -8, return 28800.
 * @return int - timezone value.
 */
LLBC_EXPORT int LLBC_GetTimezone();

/**
 * Makesure given year is leap year or not.
 * @param[in] year - the given year.
 * @return bool - return true if is leap year, otherwise return false.
 */
LLBC_EXPORT bool LLBC_IsLeapYear(int year);

/**
 * Get specific month max days.
 * @param[in] year  - the year.
 * @param[in] month - the month - [1, 12].
 * @return int - the specific month max days, if failed, return 0.
 */
LLBC_EXPORT int LLBC_GetMonthMaxDays(int year, int month);

/**
 * Get specific month span days.
 * @param[in] year  - the year.
 * @param[in] month - the month - [1, 12].
 * @return int - the month span days(not included giving month).
 */
int LLBC_GetMonthSpanDays(int year, int month);

/**
 * Get the current time.
 * @return sint64 - current time, in milli-seconds since midnight(0:0:0),
 *                  January 1, 1970, coordinated universal time(UTC).
 */
sint64 LLBC_GetMilliSeconds();

/**
 * Get the current time as micro-seconds.
 * @return sint64 - current time, in micro-seconds since midnight(0:0:0),
 *                  January 1, 1970, coordinated universal time(UTC).
 */
sint64 LLBC_GetMicroSeconds();

/**
 * Retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.
 * @return uint64 - the number of milliseconds that have elapsed since the system was started.
 */
LLBC_EXPORT uint64 LLBC_GetTickCount();

/**
 * Get struct timeval format time.
 * @param[in] tv - time value.
 * @param[in] tz - timezone value[WIN32 platform, not use].
 * @return int - return 0 if success, otherwise return -1.
 */
#if LLBC_TARGET_PLATFORM_NON_WIN32
 LLBC_EXPORT int LLBC_GetTimeOfDay(struct timeval *tv, struct timezone *tz);
#else
 LLBC_EXPORT int LLBC_GetTimeOfDay(struct timeval *tv, void *tz);
#endif

# if LLBC_TARGET_PLATFORM_WIN32
 /**
  * Convert filetime to timespec format.
  * @param[in] fileTime - the file time.
  * @param[out] ts      - the converted timespec structure.
  */
void LLBC_WinFileTime2TimeSpec(const FILETIME &fileTime, timespec &ts);

/**
 * Convert filetime to milliseconds.
 * @param[in] fileTime - the filetime.
 * @return sint64 - the converted time, in milliseconds.
 */
sint64 LLBC_WinFileTime2MilliSeconds(const FILETIME &fileTime);

/**
 * Convert filetime to microseconds.
 * @param[in] fileTime - the filetime.
 * @return sint64 - the converted time, in microseconds.
 */
sint64 LLBC_WinFileTime2MicroSeconds(const FILETIME &fileTime);

/**
 * Convert timespec to filetime.
 * @param[in] ts        - the timespec.
 * @param[out] fileTime - the filetime.
 */
void LLBC_WinTimeSpec2FileTime(const timespec &ts, FILETIME &fileTime);

/**
 * Convert milliseconds to filetime.
 * @param[in] milliSeconds - the milliseconds.
 * @param[out] fileTime    - the filetime.
 */
void LLBC_WinMilliSeconds2FileTime(sint64 milliSeconds, FILETIME &fileTime);

/**
 * Convert microseconds to filetime.
 * @param[in] microSeconds - the microseconds.
 * @param[out] fileTime    - the filetime.
 */
void LLBC_WinMicroSeconds2FileTime(sint64 microSeconds, FILETIME &fileTime);
#endif // LLBC_TARGET_PLATFORM_WIN32

/**
 * Get CpuCounter Frequency.
 * @return uint64 - cpucounter frequency(ticks per second).
 */
uint64 LLBC_GetCpuCounterFrequency();

/**
 * Get cpu timestamp counter value.
 * @return uint64 - current tsc ticks num.
 */
uint64 LLBC_RdTsc();

__LLBC_NS_END

/**
 * Get struct timeval format time[compatible for LINUX].
 * @param[in] tv - time value.
 * @param[in] tz - timezone value[WIN32 platform, not use].
 * @return int - return 0 if success, otherwise return -1.
 */
#if LLBC_TARGET_PLATFORM_WIN32
 #if LLBC_CFG_OS_IMPL_GETTIMEOFDAY
  LLBC_EXPORT int gettimeofday(struct timeval *tv, void *tz);
 #endif // LLBC_CFG_OS_IMPL_GETTIMEOFDAY
#endif // LLBC_TARGET_PLATFORM_WIN32

#include "llbc/core/os/OS_TimeInl.h"

#endif // !__LLBC_CORE_OS_OS_TIME_H__


text:
package pl.edu.agh.planner.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pl.edu.agh.planner.dao.DepartmentDao;
import pl.edu.agh.planner.domain.DepartmentEntity;

import java.util.List;

@Service("departmentService")
public class DepartmentService implements ServiceInterface<DepartmentEntity, Long>{

    private DepartmentDao departmentDao;

    @Autowired
    public void setDepartmentDao(DepartmentDao departmentDao) {
        this.departmentDao = departmentDao;
    }

    @Override
    public void add(DepartmentEntity departmentEntity) {
        departmentDao.add(departmentEntity);
    }

    @Override
    public void add(List<DepartmentEntity> departmentEntities) {
        departmentDao.add(departmentEntities);
    }

    @Override
    public void update(DepartmentEntity departmentEntity) {
        departmentDao.update(departmentEntity);
    }

    @Override
    public void delete(DepartmentEntity departmentEntity) {
        departmentDao.delete(departmentEntity);
    }

    @Override
    public DepartmentEntity getById(Long id) {
        return departmentDao.getById(id);
    }

    @Override
    public List<DepartmentEntity> getList() {
        return departmentDao.getList();
    }

    @Override
    public DepartmentEntity saveOrUpdate(DepartmentEntity entity) {
        return departmentDao.saveOrUpdate(entity);
    }
}


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Administrador extends Authenticatable
{
   protected $table = 'administradors';
   /**
    * The attributes that should be hidden for arrays.
    *
    * @var array
    */
   protected $hidden = [
       'password', 'remember_token',
   ];
}


text:
/* global require, module, process */
var funnel = require('broccoli-funnel');
var concat = require('broccoli-concat');
var mergeTrees = require('broccoli-merge-trees');
var esTranspiler = require('broccoli-babel-transpiler');
var env = process.env.ENV;
var pkg = require('./package.json');

var transpile = function (tree, opts) {
  return esTranspiler(tree, {
    stage: 0,
    moduleIds: true,
    modules: opts.modules,
    loose: ['es6.classes', 'es6.modules'],

    // Transforms /index.js files to use their containing directory name
    getModuleId: function (name) {
      name = pkg.name + '/' + name;
      return name.replace(/\/index$/, '');
    },

    // Fix relative imports inside /index's
    resolveModuleSource: function (source, filename) {
      var match = filename.match(/(.+)\/index\.\S+$/i);

      // is this an import inside an /index file?
      if (match) {
        var path = match[1];
        return source
          .replace(/^\.\//, path + '/')
          .replace(/^\.\.\//, '');
      } else {
        return source;
      }
    }
  });
};

var amd = concat(transpile('lib', { modules: 'amd' }), {
  inputFiles: [
    '**/*.js'
  ],
  outputFile: '/' + pkg.name + '.amd.js'
});

var trees = [amd];

if (env === 'test') {
  var test = concat(transpile('tests', { modules: 'amd' }), {
    inputFiles: [
      '**/*-test.js'
    ],
    outputFile: '/' + pkg.name + '-tests.js'
  });
  var qunit = funnel('bower_components/qunit/qunit', {
    destDir: 'assets'
  });
  var loader = mergeTrees([
    funnel('bower_components/loader.js', {
      destDir: 'assets',
      include: ['loader.js']
    }),
    funnel('tests', {
      destDir: 'assets',
      include: ['test-loader.js']
    })
  ]);
  var index = funnel('tests', {
    include: ['index.html']
  });
  trees.push(test, qunit, index, loader);
}

module.exports = mergeTrees(trees);


text:
namespace config {

ConfigSubscription::ConfigSubscription(const SubscriptionId & id, const ConfigKey & key,
                                       std::shared_ptr<IConfigHolder> holder, std::unique_ptr<Source> source)
    : _id(id),
      _key(key),
      _source(std::move(source)),
      _holder(std::move(holder)),
      _next(),
      _current(),
      _isChanged(false),
      _lastGenerationChanged(-1),
      _closed(false)
{
}

ConfigSubscription::~ConfigSubscription()
{
    close();
}

bool
ConfigSubscription::nextUpdate(int64_t generation, vespalib::steady_time deadline)
{
    if (_closed || !_holder->poll()) {
        return false;
    }
    auto old = std::move(_next);
    _next = _holder->provide();
    if (old) {
        _next->merge(*old);
    }
    if (isGenerationNewer(_next->getGeneration(), generation)) {
        return true;
    }
    return (!_closed && _holder->wait_until(deadline));
}

bool
ConfigSubscription::hasGenerationChanged() const
{
    return (!_closed && _next && ((_current && (_current->getGeneration() != _next->getGeneration())) || ! _current));
}

bool
ConfigSubscription::hasChanged() const
{
    return (!_closed && _next && ((_next->hasChanged() && _current && (_current->getValue() != _next->getValue())) || ! _current));
}

int64_t
ConfigSubscription::getGeneration() const
{
    return _next->getGeneration();
}

void
ConfigSubscription::close()
{
    if (!_closed.exchange(true)) {
        _holder->close();
        _source->close();
    }
}

void
ConfigSubscription::flip()
{
    bool change = hasChanged();
    if (change) {
        _current = std::move(_next);
        _lastGenerationChanged = _current->getGeneration();
    } else {
        _current = std::make_unique<ConfigUpdate>(_current->getValue(), false, _next->getGeneration());
    }
    _isChanged = change;
}

const ConfigValue &
ConfigSubscription::getConfig() const
{
    if (_closed) {
        throw ConfigRuntimeException("Subscription is closed, config no longer available");
    }
    if ( ! _current) {
        throw ConfigRuntimeException("No configuration available");
    }
    return _current->getValue();
}

void
ConfigSubscription::reload(int64_t generation)
{
    _source->reload(generation);
    _source->getConfig();
}

} // namespace config


text:
package dk.bobbyz.androidmasterref;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;
import com.squareup.otto.ThreadEnforcer;

import dk.bobbyz.androidmasterref.bus.AndroidBus;
import dk.bobbyz.androidmasterref.model.Comment;
import dk.bobbyz.androidmasterref.rest.RestApi;
import dk.bobbyz.androidmasterref.rest.impl.CommentPostedEvent;
import dk.bobbyz.androidmasterref.rest.impl.CommentsReceivedEvent;
import dk.bobbyz.androidmasterref.rest.impl.GetCommentsEvent;
import dk.bobbyz.androidmasterref.rest.impl.PostCommentEvent;
import dk.bobbyz.androidmasterref.rest.impl.RestApiImpl;

public class RestActivity extends ActionBarActivity {

    private AndroidBus mBus;
    private RestApi rest;

    private EditText txtComment;
    private EditText txtEmail;
    private Button btnPost;
    private Button btnGet;
    private ListView tvComments;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rest);

        rest = new RestApiImpl(getBus());
        getBus().register(rest);

        getBus().register(this);

        txtComment = (EditText) findViewById(R.id.txtComment);
        txtEmail = (EditText) findViewById(R.id.txtEmail);
        btnPost = (Button) findViewById(R.id.btnPost);
        btnGet = (Button) findViewById(R.id.btnGet);
        tvComments = (ListView) findViewById(R.id.tvComments);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_rest, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onPause() {
        super.onPause();

        getBus().unregister(this);
    }

    private AndroidBus getBus() {
        if (mBus == null) {
            mBus = new AndroidBus(ThreadEnforcer.ANY);
        }
        return mBus;
    }

    public void setBus(AndroidBus bus) {
        mBus = bus;
    }

    @Subscribe
    public void onCommentPosted(CommentPostedEvent event) {
        new AlertDialog.Builder(this)
                .setTitle("Posted")
                .setMessage("Comment posted")
                .setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        // do nothing
                    }
                })
                .setIcon(android.R.drawable.ic_dialog_alert)
                .show();
    }

    @Subscribe
    public void onCommentsReceived(CommentsReceivedEvent event) {
        // use the SimpleCursorAdapter to show the
        // elements in a ListView
        ArrayAdapter<Comment> adapter = new ArrayAdapter<Comment>(this,
                android.R.layout.simple_list_item_1, event.getComments());
        tvComments.setAdapter(adapter);
    }

    public void postComment(View view) {
        getBus().post(new PostCommentEvent(new Comment(txtComment.getText().toString(), txtEmail.getText().toString())));
    }

    public void getComments(View view) {
        getBus().post(new GetCommentsEvent());
    }
}


text:
package org.fedoraproject.xmvn.tools.resolve.xml;

import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.jupiter.api.Test;
import org.xmlunit.assertj3.XmlAssert;

import org.fedoraproject.xmvn.resolver.ResolutionResult;

/**
 * @author Marian Koncek
 */
public class ResolutionResultMarshallerListTest
{
    @Test
    public void testEmpty()
        throws Exception
    {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        new ResolutionResultListMarshaller( Arrays.asList( new ResolutionResult[] { null } ) ).marshal( bos );

        XmlAssert.assertThat( "<results></results>" ) //
                 .and( bos.toString() ) //
                 .ignoreComments() //
                 .ignoreWhitespace() //
                 .areIdentical();
    }

    @Test
    public void testMultiple()
        throws Exception
    {
        List<ResolutionResult> list = new ArrayList<>();

        ResolutionResultBean temp;
        temp = new ResolutionResultBean();
        temp.setArtifactPath( "/dev/null" );
        temp.setCompatVersion( "comp1" );
        temp.setNamespace( "namespace1" );
        temp.setProvider( "provider1" );
        list.add( new ResolutionResultBean.Adapter().unmarshal( temp ) );

        temp = new ResolutionResultBean();
        temp.setArtifactPath( "/dev/null" );
        temp.setCompatVersion( "comp2" );
        temp.setNamespace( "namespace2" );
        temp.setProvider( "provider2" );
        list.add( new ResolutionResultBean.Adapter().unmarshal( temp ) );

        list.add( null );

        temp = new ResolutionResultBean();
        temp.setArtifactPath( "/dev/null" );
        temp.setCompatVersion( "comp3" );
        temp.setNamespace( "namespace3" );
        temp.setProvider( "provider3" );
        list.add( new ResolutionResultBean.Adapter().unmarshal( temp ) );

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        new ResolutionResultListMarshaller( list ).marshal( bos );

        XmlAssert.assertThat( "" //
            + "<results>" //
            + "  <result>" //
            + "    <artifactPath>/dev/null</artifactPath>" //
            + "    <provider>provider1</provider>" //
            + "    <compatVersion>comp1</compatVersion>" //
            + "    <namespace>namespace1</namespace>" //
            + "  </result>" //
            + "  <result>" //
            + "    <artifactPath>/dev/null</artifactPath>" //
            + "    <provider>provider2</provider>" //
            + "    <compatVersion>comp2</compatVersion>" //
            + "    <namespace>namespace2</namespace>" //
            + "  </result>" //
            + "  <result>" //
            + "    <artifactPath>/dev/null</artifactPath>" //
            + "    <provider>provider3</provider>" //
            + "    <compatVersion>comp3</compatVersion>" //
            + "    <namespace>namespace3</namespace>" //
            + "  </result>" //
            + "</results>" ) //
                 .and( bos.toString() ) //
                 .ignoreComments() //
                 .ignoreWhitespace() //
                 .areIdentical();
    }

    @Test
    public void testSingle()
        throws Exception
    {
        ResolutionResult rr = new ResolutionResultBean.Adapter().unmarshal( new ResolutionResultBean() );
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        new ResolutionResultListMarshaller( Arrays.asList( new ResolutionResult[] { rr } ) ).marshal( bos );

        XmlAssert.assertThat( "<results><result/></results>" ) //
                 .and( bos.toString() ) //
                 .ignoreComments() //
                 .ignoreWhitespace() //
                 .areIdentical();
    }
}


text:
<?php

namespace Contentinum\View\Helper;

use Zend\View\Helper\AbstractHelper;
use ContentinumComponents\Html\HtmlAttribute;

abstract class AbstractContentHelper extends AbstractHelper
{
    const VIEW_LAYOUT_KEY = 'contribution';
    /**
     *
     * @var string
     */
    protected $layoutKey;

    /**
     *
     * @var array
     */
    protected $convertparams;

    /**
     *
     * @var array
     */
    protected $properties = array();

    protected function getLayoutKey()
    {
        if (null === $this->layoutKey){
            $this->layoutKey = $this->view->htmllayouts[$this->view->templateKey]->layoutkey;
        }
        return $this->layoutKey;
    }

    /**
     * @return the $convertparams
     */
    public function getConvertparams()
    {
        return $this->convertparams;
    }

	/**
     * @param multitype: $convertparams
     */
    public function setConvertparams($convertparams, $return = false)
    {
        if (strlen($convertparams) > 4) {
            $mcSerialize = new \ContentinumComponents\Tools\HandleSerializeDatabase();
            if (false === $return){
                $this->convertparams = $mcSerialize->execUnserialize($convertparams);
            } else {
                return $mcSerialize->execUnserialize($convertparams);
            }
        } else {
            if (false === $return){
                $this->convertparams = array();
            } else {
                return array();
            }
        }
    }

	/**
     *
     * @param unknown $prop
     * @return boolean
     */
    protected function getProperty($prop)
    {
        if ( isset($this->properties[$prop]) ){
            return $this->{$prop};
        } else {
            return false;
        }
    }

    /**
     *
     * @param unknown $prop
     * @param unknown $value
     * @return unknown|boolean
     */
    protected function setProperty($prop, $value)
    {
        if ( isset($this->properties[$prop]) ){
            return $this->{$prop} = $value;
        } else {
            return false;
        }
    }

    /**
     *
     */
    protected function unsetProperties()
    {
        foreach ($this->properties as $prop) {
            $this->{$prop} = null;
        }
    }

    /**
     *
     * @param unknown $prop
     * @param unknown $key
     * @param unknown $value
     * @return boolean
     */
    protected function setTemplateProperty($prop, $key, $value)
    {
        if (isset($this->{$prop}[$key])) {
            $this->{$prop}[$key] = $value;
        } else {
            return false;
        }
    }

    /**
     *
     * @param unknown $prop
     * @param unknown $key
     * @return boolean
     */
    protected function getTemplateProperty($prop, $key)
    {
        if (isset($this->{$prop}[$key])) {
            return $this->{$prop}[$key];
        } else {
            return false;
        }
    }

    /**
     *
     * @param unknown $template
     */
    protected function setTemplate($template)
    {
        if (null !== $template) {
            foreach ($template as $key => $values) {
                if (in_array($key, $this->properties)) {
                    $this->{$key} = $values;
                }
            }
        }
    }

    /**
     * Get template as array
     * @return multitype:NULL
     */
    protected function getTemplate()
    {
        $template = array();
        foreach ($this->properties as $key){
            $template['key'] = $this->{$key};
        }
        return $template;
    }

    /**
     * Format a content row
     * @param unknown $pattern
     * @param unknown $content
     * @param string $beforeGrid
     */
    /**
     * Format a content row
     * @param unknown $pattern
     * @param unknown $content
     * @param string $beforeGrid
     */
    protected function deployRow($pattern, $content, $beforeGrid = '')
    {
        $html = '';
        if (null !== $pattern){
            if (! is_array($pattern)){
                $pattern = $pattern->toArray();
            }
            $html .= $beforeGrid;
            if (isset($pattern['grid'])){
                if (isset($pattern['grid']['format'])){
                    $content = $this->formatContent($pattern['grid']['format'], $content);
                }

                $attr = array();

                if (isset($pattern['grid']['attr']) && !empty($pattern['grid']['attr'])){
                    $attr = $pattern['grid']['attr'];
                    if ( isset($pattern['grid']['label']) ){
                        if ('content' == $pattern['grid']['label']){
                            $href = '';
                        }
                    } else {
                        $href = $content;
                    }
                    $attr = $this->deployAttrHref($attr, $href);
                }
                $before = '';
                $after = '';
                if (isset($pattern['grid']['content:after'])){
                    $after = $pattern['grid']['content:after'];
                }
                if (isset($pattern['grid']['content:before'])){
                    $before = $pattern['grid']['content:before'];
                }
                $html .= $this->view->contentelement($pattern['grid']['element'],$before . $content . $after ,$attr);
                if (isset($pattern['grid']['content:before:outside'])){
                    $html = $pattern['grid']['content:before:outside'] . $html;
                }
                if (isset($pattern['grid']['content:after:outside'])){
                    $html .= $pattern['grid']['content:after:outside'];
                }

            }

            if (isset($pattern['row'])){
                $attr = array();
                if (isset($pattern['row']['attr']) && !empty($pattern['row']['attr'])){
                    $attr = $pattern['row']['attr'];
                }
                $before = '';
                $after = '';
                if (isset($pattern['row']['content:after'])){
                    $after = $pattern['row']['content:after'];
                }
                if (isset($pattern['row']['content:before'])){
                    $before = $pattern['row']['content:before'];
                }
                $html = $this->view->contentelement($pattern['row']['element'],$before . $html. $after,$attr);
                if (isset($pattern['row']['content:after:outside'])){
                    $html .= $pattern['row']['content:after:outside'];
                }
            }
        }
        return $html;
    }

    /**
     * Register javascript files
     * @param array $files
     */
    protected function deployFiles($files)
    {
        foreach ($files as $index => $file){
            $this->view->inlinescript()->offsetSetFile($index,$file);
        }
    }

    /**
     * Configure href attribute set link
     * @param array $attr
     * @param string $content
     * @return string
     */
    protected function deployAttrHref($attr, $content)
    {
        if (isset($attr['href'])){
            $attr['href'] = $attr['href'] . $content;
        }
        return $attr;
    }

    /**
     * format or filter content
     * @param unknown $format
     * @param unknown $content
     * @return unknown
     */
    protected function formatContent($format, $content)
    {
        if (isset($format['dateFormat'])) {
            switch ($format['dateFormat']['attr']) {
                case 'LONG':
                    $content = $this->view->datetimeformat($content,'LONG');
                    break;
                case 'MEDIUM':
                    $content = $this->view->datetimeformat($content,'MEDIUM');
                    break;
                case 'SHORT':
                    $content = $this->view->datetimeformat($content,'SHORT');
                    break;
                case 'LONGLONG':
                    $content = $this->view->datetimeformat($content,'LONG') . ', ' . $this->view->datetimeformat($content, false,'SHORT') . ' Uhr';
                    break;
                case 'MEDIUMLONG':
                    $content = $this->view->datetimeformat($content,'MEDIUM') . ', ' . $this->view->datetimeformat($content, false,'SHORT') . ' Uhr';
                    break;
                case 'SHORTLONG':
                    $content = $this->view->datetimeformat($content,'SHORT') . ', ' . $this->view->datetimeformat($content, false,'SHORT') . ' Uhr';
                    break;
                case 'FULLLONG':
                    $content = $this->view->datetimeformat($content,'FULL') . ', ' . $this->view->datetimeformat($content, false,'SHORT') . ' Uhr';
                    break;
                case 'FULL':
                default:
                    $content = $this->view->datetimeformat($content,'FULL');
                    break;
            }
        }

        return $content;
    }

    /**
     * Check if a value is contained
     * @param array $array
     * @param string|number $index
     * @return string|boolean
     */
    protected function hasValue($array, $index)
    {
        if (isset($array[$index]) && null != $array[$index]) {
            return $array[$index];
        } else {
            return false;
        }
    }

    /**
     * Format element attributes
     * @param string $attr
     * @return array|string
     */
    protected function elementAttribute($attr)
    {
        $params = '';
        if (strlen($attr) > 1) {
            $rows = explode(';', $attr);
            foreach ($rows as $row) {
                $row = trim($row);
                if (strlen($row) > 1) {
                    $parts = explode(':', $row);
                    $params[$parts[0]] = $parts[1];
                }
            }
        }

        return $params;
    }

    /**
     *
     * @param array $array
     * @param integer $id
     * @param integer
     */
    protected function countArrayById($array, $id, $key = 'webContentgroup')
    {
        $i = 0;
        foreach ($array as $row){
            if ($id == $row->{$key}){
                $i++;
            }
        }
        return $i;
    }

    /**
     *
     * @param unknown $html
     * @param unknown $content
     */
    protected function formatElement($html, $content)
    {
        if (strlen($content->element) > 0) {
            $attr = '';
            switch ($content->element){
                case 'panel' :
                case 'flexvideo' :
                case 'flexwide':
                case 'flexvimeo':
                case 'column2':
                    $element = 'div';
                    break;
                 default:
                     $element = $content->element;
                     break;
            }
            if (strlen($content->elementAttribute) > 0) {
                $attribute = $this->elementAttribute($content->elementAttribute);
                $attr = HtmlAttribute::attributeArray($attribute);
            }
            $elmContent = '';
            if (strlen($content->elementContent) > 0) {
                $elmContent = $content->elementContent;
            }
            switch ($content->element){
                case 'flexvideo':
                case 'flexwide':
                case 'flexvimeo':
                case 'column2':
                    $html .= '<' . $element . $attr . '>' . $elmContent . '</' . $element . '>';
                    break;
                default:
                    $html = '<' . $element . $attr . '>' . $html . $elmContent . '</' . $element . '>';
                    break;
            }
        }
        return $html;
    }

}


text:
package com.dyf.i18n.file;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import java.util.*;

/**
 * Created by yuiff on 2017/2/8.
 */
public class JsonFileHandler implements KeyValueFileHandler {
    JSONObject json;
    Map<String, JsonItemSaver> kvMap;

    public JsonFileHandler(String jsonString) {
        this.json = JSONObject.fromObject(jsonString);
        this.kvMap = new HashMap<>();
        dfsJson(json);
    }

    private void dfsJson(JSONObject json) {
        dfsJSONObject("", json);
    }

    private void dfsObject(String parent, Object data) {
        if (data instanceof JSONObject) {
            dfsJSONObject(parent, (JSONObject) data);
        } else if (data instanceof JSONArray) {
            dfsJSONArray(parent, (JSONArray) data);
        } else {
            System.out.println("Json Parse Error! " + parent + data);
        }
    }

    private void dfsJSONObject(String parent, JSONObject json) {
        Set<Map.Entry<String, Object>> entrySet = json.entrySet();
        for (Map.Entry<String, Object> entry : entrySet) {
            String key = entry.getKey();
            Object data = entry.getValue();
            if (data instanceof String) {
                String fullKey = parent + "." + key;
                kvMap.put(fullKey, new JsonObjectSaver(entry));
//                System.out.println(fullKey);
            } else {
                String childKey = parent.isEmpty() ? key : parent + "." + key;
                dfsObject(childKey, data);
            }
        }
    }

    private void dfsJSONArray(String parent, JSONArray json) {
        for (int i = 0; i < json.size(); i++) {
            Object data = json.get(i);
            if (data instanceof String) {
                String fullKey = parent + '[' + i + ']';
                kvMap.put(fullKey, new JsonArraySaver(json, i));
//                System.out.println(fullKey);
            } else {
                dfsObject(parent + '[' + i + ']', data);
            }
        }
    }

    @Override
    public List<String> getKeyList() {
        List<String> keyList = new ArrayList<>(kvMap.keySet());
        return keyList;
    }

    @Override
    public Map<String, String> getKeyValueMap() {
        Map<String, String> keyValueMap = new HashMap<>();
        for (Map.Entry<String, JsonItemSaver> entry : this.kvMap.entrySet()) {
            keyValueMap.put(entry.getKey(), entry.getValue().get());
        }
        return keyValueMap;
    }

    @Override
    public void put(String key, String value) {
        this.kvMap.get(key).set(value);
    }

    @Override
    public String getString() {
        return json.toString();
    }

    interface JsonItemSaver {
        String get();

        void set(String value);
    }

    class JsonObjectSaver implements JsonItemSaver {
        private Map.Entry<String, Object> inner;

        public JsonObjectSaver(Map.Entry<String, Object> entry) {
            this.inner = entry;
        }

        @Override
        public String get() {
            return (String) inner.getValue();
        }

        @Override
        public void set(String value) {
            inner.setValue(value);
        }
    }

    class JsonArraySaver implements JsonItemSaver {
        private int index;
        private JSONArray array;

        public JsonArraySaver(JSONArray array, int index) {
            this.array = array;
            this.index = index;
        }

        @Override
        public String get() {
            return (String) array.get(index);
        }

        @Override
        public void set(String value) {
            array.set(index, value);
        }
    }
}


text:
package com.codepath.apps.ibisapp.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.codepath.apps.ibisapp.R;
import com.codepath.apps.ibisapp.adapters.TweetsArrayAdapter;
import com.codepath.apps.ibisapp.models.Tweet;

import org.parceler.Parcels;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by ocarty on 11/1/2016.
 */

public class TweetsListFragment extends Fragment {
    TweetsArrayAdapter aTweets;
    ArrayList<Tweet> tweets;
    @BindView(R.id.lvTweets) ListView lvTweets;
    @BindView(R.id.fabComposeTweet) FloatingActionButton btnComposeTweet;
    @BindView(R.id.swipeContainer) SwipeRefreshLayout swipeContainer;
    private Unbinder unbinder;
    private static final int REQUEST_CODE = 10;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_tweets_list, parent, false);
        unbinder = ButterKnife.bind(this, v);
        return v;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tweets = new ArrayList<>();
        aTweets = new TweetsArrayAdapter(getActivity(), tweets);
    }

    public void addAll(List<Tweet> tweetList) {
        aTweets.addAll(tweetList);
        aTweets.notifyDataSetChanged();
    }

    public void postNewTweet(Tweet tweet) {
        aTweets.insert(tweet, 0);
        aTweets.notifyDataSetChanged();
    }
}


text:
<?php
namespace Lsv\TimeharvestTest\Task;

use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Response;
use Lsv\Timeharvest\Task\Document\Task;
use Lsv\Timeharvest\Task\GetTask;
use Lsv\TimeharvestTest\AbstractTimeHarvestTest;

class GetTaskTimeHarvestTest extends AbstractTimeHarvestTest
{

    protected function createRequest($taskId)
    {
        $mocks = new MockHandler([
            new Response(200, ['Content-Type' => 'application/json'], file_get_contents(__DIR__ . '/json/task.json')),
        ]);

        return new GetTask($this->getAuth(), [
            'httpclient' => $this->getHttpClient($mocks),
            'task' => $taskId
        ]);
    }

    public function test_get_tasks_from_id()
    {
        $action = $this->createRequest(123);
        $response = $action->getResponse();
        $this->assertInstanceOf(Task::class, $response);

        $request = $action->getRequest();
        $this->assertEquals('/tasks/123', $request->getUri()->getPath());
    }

    public function test_get_tasks_from_class()
    {
        $action = $this->createRequest((new Task())->setId(121212));
        $response = $action->getResponse();
        $this->assertInstanceOf(Task::class, $response);

        $request = $action->getRequest();
        $this->assertEquals('/tasks/121212', $request->getUri()->getPath());
    }

    public function dataProvider()
    {
        return [
            ['getId', 2086199],
            ['getName', "Admin"],
            ['isBillableByDefault', false],
            ['getCreatedAt', date_create("2013-04-30T20:28:12Z")],
            ['getUpdatedAt', date_create("2013-08-14T22:25:42Z")],
            ['isIsDefault', true],
            ['getDefaultHourlyRate', 0],
            ['isDeactivated', true],
        ];
    }

    /**
     * @dataProvider dataProvider
     * @param string $getter
     * @param mixed $value
     */
    public function test_project_details($getter, $value)
    {
        $action = $this->createRequest(123);
        $response = $action->getResponse();
        $this->assertEquals($value, $response->{$getter}());
    }

}


text:
/* FHEM tablet ui */
/**
* Just another dashboard for FHEM
*
* Version: 1.4.2
* Requires: jQuery v1.7+, font-awesome, jquery.gridster, jquery.toast
*
* Copyright (c) 2015 Mario Stephan <mstephan@shared-files.de>
* Under MIT License (http://www.opensource.org/licenses/mit-license.php)
*
*/
var deviceStates={};
var readings = {"STATE":true};
var devices = {};
var types = {};
var DEBUG = false;
var TOAST = true;
var doLongPoll = false
var timer;
var timeoutMenu;
var dir = '';
var filename = '';
var shortpollInterval = 30 * 1000; // 30 seconds
var devs=Array();
var pars=Array();
var gridster;
var styleCollection={};

var plugins = {
  modules: [],
  addModule: function (module) {
    this.modules.push(module);
  },
  load: function (name) {
  	loadplugin(name, function () {
		DEBUG && console.log('Loaded plugin: '+ name);
		var module = eval(name);
		plugins.addModule(module);
        module.init();
        //update all what we have until now
        for (var reading in readings) {
            for (var device in devices) {
                module.update(device,reading);
            }
        }
        //request missing readings
        for (var reading in readings) {
            if (pars.indexOf(reading)<0){
                pars.push(reading);
                requestFhem(reading);
            }
        }

    },null,true);
  },
  update: function (dev,par) {
    $.each(this.modules, function (index, module) {
      //Iterate each module and run update function
      module.update(dev,par);
    });
    DEBUG && console.log('update done for device:'+dev+' parameter:'+par);
  }
}

// event page is loaded
$(document).on('ready', function() {

    //add background for modal dialogs
    $("
").prependTo('body').hide();
    $("#shade").on('click',function() {
        $(document).trigger("shadeClicked");
    });

    loadStyleSchema();
    initPage();

    if ( doLongPoll ){
        setTimeout(function() {
                longPoll();
        }, 1000);
        shortpollInterval = 15 * 60 * 1000; // 15 minutes
    }

    $("*:not(select)").focus(function(){
        $(this).blur();
    });

    // refresh every x secs
    startPollInterval();
});

function initPage() {

    var deviceStates={};
    var readings = {"STATE":true};
    var devices = {};
    var types = {};
    var devs=new Array();
    var pars=new Array();

    wx = parseInt( $("meta[name='widget_base_width']").attr("content") );
    wy = parseInt( $("meta[name='widget_base_height']").attr("content") );
    if ( $("meta[name='widget_margin']").attr("content") )
      wm = parseInt( $("meta[name='widget_margin']").attr("content") );
    else
      wm = 5;
	doLongPoll = ($("meta[name='longpoll']").attr("content") == '1');
	DEBUG  = ($("meta[name='debug']").attr("content") == '1');
    TOAST  = ($("meta[name='toast']").attr("content") != '0');

	//self path
	dir = $('script[src$="fhem-tablet-ui.js"]').attr('src');
	var name = dir.split('/').pop();
	dir = dir.replace('/'+name,"");
	DEBUG && console.log('Plugin dir: '+dir);

    var url = window.location.pathname;
    filename = url.substring(url.lastIndexOf('/')+1);
    DEBUG && console.log('Filename: '+filename);

    //init gridster
    if (gridster)
        gridster.destroy();
    gridster = $(".gridster > ul").gridster({
      widget_base_dimensions: [wx, wy],
      widget_margins: [wm, wm],
      draggable: {
        handle: 'header'
      }
    }).data('gridster');
    if($("meta[name='gridster_disable']").attr("content") == '1') {
        gridster.disable();
    }
    if($("meta[name='gridster_starthidden']").attr("content") == '1') {
        $('div.gridster').hide();
    }

    //include extern html code
    var total = $('[data-template]').length;
    if (total>0){
        $('[data-template]').each(function(index) {
            $(this).load($(this).data('template'), function() {
                if (index === total - 1) {
                    //continue after loading the includes
                    initWidgets();
                }
            });
        });
    }
    else{
       //continue immediately with initWidgets
       initWidgets();
    }

}

function initReadingsArray(get) {
    if(! $.isArray(get)) {
        get = new Array(get);
    }
    for(var g=0; g<get.length; g++) {
        reading = get[g];
        // fully qualified readings => DEVICE:READING
        if(reading.match(/:/)) {
            var fqreading = reading.split(':');
            var device = fqreading[0]
            if(!devices[device]){
                devices[device] = true;
                devs.push(device);
            }
            reading = fqreading[1];
        }
        if(!readings[reading]){
            readings[reading] = true;
            pars.push(reading);
        }
    }
}

function initWidgets() {

    showDeprecationMsg();

    //collect required widgets types
    $('div[data-type]').each(function(index){
        var t = $(this).data("type");
        if(!types[t])
            types[t] = true;
    });

    //collect required devices
    $('div[data-device]').each(function(index){
        var device = $(this).data("device");
        if(!devices[device]){
            devices[device] = true;
            devs.push(device);
        }
    });

    //collect required readings
    DEBUG && console.log('Collecting required readings');
    $('[data-get]').each(function(index){
        initReadingsArray($(this).data("get"));
    });

    //init widgets
    for (var widget_type in types) {
        plugins.load('widget_'+widget_type);
    }

    //get current values of readings
    DEBUG && console.log('Request readings from FHEM');
    for (var reading in readings) {
        requestFhem(reading);
    }
}

function showDeprecationMsg() {

    //make it HTML conform (remove this after migration)
    $('div[type]').each(function() {
        $(this).attr({
            'data-type' : $(this).attr('type'),
        })
        .removeAttr('type');
        console.log('Please rename widget attribute "type" into "data-type" in ' + document.location + ($(this).attr('data-device')?' device: '+$(this).attr('data-device'):'') + ' - Details below:');
        console.log($(this));
    });
    $('div[device]').each(function() {
        $(this).attr({
            'data-device' : $(this).attr('device'),
        })
        .removeAttr('device');
        console.log('Please rename widget attribute "device" into "data-device" in ' + document.location + ($(this).attr('data-device')?' device: '+$(this).attr('data-device'):'') + ' - Details below:');
        console.log($(this));
    });
    $('div[data-type="contact"]').each(function() {
        $(this).attr({'data-type' : 'symbol',})
        console.log('Please rename widget "contact" into "symbol" in ' + document.location + ($(this).attr('data-device')?' device: '+$(this).attr('data-device'):'') + ' - Details below:');
        console.log($(this));
    });
    //end **** (remove this after migration)
}

function startPollInterval() {
     clearInterval(timer);
     timer = setInterval(function () {
		//get current values of readings every x seconds
		for (var reading in readings) {
			requestFhem(reading);
        }
     }, shortpollInterval);
 }

function setFhemStatus(cmdline) {
    startPollInterval();
    DEBUG && console.log('send to FHEM: '+cmdline);
	$.ajax({
		async: true,
		url: $("meta[name='fhemweb_url']").attr("content") || "/fhem/",
		data: {
			cmd: cmdline,
			XHR: "1"
		}
	})
	.fail (function(jqXHR, textStatus, errorThrown) {
    		$.toast("Error: " + textStatus + ": " + errorThrown);
	})
  	.done ( function( data ) {
  		if ( !doLongPoll ){
			setTimeout(function(){
				for (var reading in readings) {
					requestFhem(reading);
				}
			}, 4000);
		}
	});
}

var xhr;
var currLine=0;
function longPoll(roomName) {
/* try to avoid this terrible fmt=JSON output format
	- no separat node for parameter name
	- multiple nodes with the same data (2xdate)
*/
	DEBUG && console.log('start longpoll');

	if (xhr)
		xhr.abort();
	currLine=0;

	$.ajax({
		url: $("meta[name='fhemweb_url']").attr("content") || "/fhem/",
		cache: false,
		complete: function() {
			setTimeout(function() {
                longPoll();
			}, 100);
		},
        timeout: 60000,
		async: true,
		data: {
			XHR:1,
			inform: "type=raw;filter=.*"
		},
		xhr: function() {
			xhr = new window.XMLHttpRequest();
			xhr.addEventListener("readystatechange", function(e){
				var data = e.target.responseText;
		  		if ( e.target.readyState == 4) {
    				return;
  				}
				if ( e.target.readyState == 3 )
				{
					var lines = data.replace(/
/g,"").split(/\n/);
                    var regDevice = /\s[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\.?[0-9]{0,3}\s(\S*)\s(\S*)\s(.*)/;
                    var regDate = /^([0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-2][0-9]:[0-5][0-9]:[0-5][0-9])\.?[0-9]{0,3}\s/;
                    var regParaname = /^(\S{2,}):(?:\s(.*))?$/;
					lines.pop(); //remove last empty line

					for (var i=currLine; i < lines.length; i++) {
						var date;
                        //date = ..... new Date(); //do we need this?
						var line = $.trim( lines[i] );
                        //console.log('#'+line+'#');

						if ( regDate.test( line ))
							date = $.trim(line.match( regDate )[1]);
						if ( regDevice.test( line )) {
							//Bad parse hack, but the JSON is not well formed
							var room = $.trim( line.match( regDevice )[1] );
							var key = $.trim( line.match( regDevice )[2] );
							var parname_val = $.trim(line.match( regDevice )[3]);
							var params = deviceStates[key] || {};
							var paraname;
							var val;
							if ( regParaname.test(parname_val) ){
								var paraname = $.trim(parname_val.match( regParaname )[1]);
								var val = $.trim(parname_val.match( regParaname )[2]);
							}
							else {
								var paraname = 'STATE';
								var val = parname_val;
							}
//              console.log('TEST +key:' + key+ '+  para:'+paraname+'+   val:'+val+'+');
              // Special hack for readingsGroups (all params will be accepted)
              if ( ( ( room == 'readingsGroup' ) && (key in devices) ) ||
							     ( (paraname in readings) && (key in devices) ) ) {
								var value = {"date": date,
											  "room": room,
												"val": val
											};
								params[paraname]=value;
								deviceStates[key]=params;
								DEBUG && console.log(date + ' / ' + key+' / '+paraname+' / '+val);
                                plugins.update(key,paraname);
							}
							//console.log(date + ' / ' + key+' / '+paraname+' / '+val);
						}
					}
					currLine = lines.length;
				}

    		}, false);
			return xhr;
			}
	});
}

function requestFhem(paraname, devicename) {
    var devicelist;

    // paraname = DEVICE:READING; devicename is ignored
    if(paraname.match(/:/)) {
        var temp = paraname.split(':');
        devicename = temp[0];
        paraname = temp[1];
    }

    if(typeof devicename != 'undefined') {
        devicelist = devicename;
    } else {
        devicelist = $.map(devs, $.trim).join();
    }

/* 'list' is still the fastest cmd to get all important data
*/
    $.ajax({
        async: true,
        timeout: 15000,
		cache: false,
		context:{paraname: paraname},
		url: $("meta[name='fhemweb_url']").attr("content") || "/fhem/",
		data: {
            cmd: "list " + devicelist + " " + paraname,
			XHR: "1"
		}
	})
	.fail (function(jqXHR, textStatus, errorThrown) {
    		$.toast("Error: " + textStatus + ": " + errorThrown);
  	})
  	.done (function( data ) {
			var lines = data.replace(/\n\)/g,")\n").split(/\n/);
            var regCapture = /^(\S*)\s*([0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-2][0-9]:[0-5][0-9]:[0-5][0-9])?\.?[0-9]{0,3}\s+(.*)$/;
            for (var i=0; i < lines.length; i++) {
                var date,key,val;
                var line = $.trim( lines[i] );
                //console.log('line: '+line);
                if (regCapture.test(line) ) {
                    var groups = line.match( regCapture );
                    var paraname = this.paraname;
                    key = $.trim( line.match( regCapture )[1]);
                    if (groups.length>2){
                        date = $.trim( groups[2]);
                        val = $.trim( groups[3]);
                    }
                    //console.log('paraname',paraname,'date:',date,'val',val);
                    var params = deviceStates[key] || {};
                    var value = {"date": date, "val": val};
                    params[paraname]=value;
                    if (key in devices){
                        deviceStates[key]=params;
                        plugins.update(key,paraname);
                    }
                }
            }
    });

}

function loadplugin(plugin, success, error, async) {
    dynamicload('js/'+plugin+'.js', success, error, async);
}

function dynamicload(file, success, error, async) {
    var cache = (DEBUG) ? false : true;
    var dir = $('script[src$="fhem-tablet-ui.js"]').attr('src');
    var name = dir.split('/').pop();
    dir = dir.replace('/'+name,"");
    $.ajax({
        url: dir + '/../' + file,
        dataType: "script",
        cache: cache,
        async: async || false,
        context:{name: name},
        success: success||function(){ return true },
        error: error||function(){ return false },
    });
}

function loadStyleSchema(){
    $.each($('link[href$="-ui.css"]') , function (index, thisSheet) {
        var rules = thisSheet.sheet.cssRules;
        for (var r in rules){
            if (rules[r].style){
               var styles = rules[r].style.cssText.split(';');
               styles.pop();
               var elmName = rules[r].selectorText;
               var params = {};
               for (var s in styles){
                   var param = styles[s].split(':');
                   if (param[0].match(/color/)){
                      params[$.trim(param[0])]=$.trim(param[1]);
                   }
               }
               if (Object.keys(params).length>0)
                    styleCollection[elmName]=params;
            }
        }
    });
}

this.getPart = function (s,p) {
	if ($.isNumeric(p)){
		var c = (s && typeof s != "undefined") ? s.split(" ") : '';
		return (c.length >= p && p>0 ) ? c[p-1] : s;
	}
	else {
		if ((s && typeof s != "undefined") )
            var matches = s.match( new RegExp('^' + p + '$') );
		var ret='';
		if (matches) {
			for (var i=1;i<matches.length;i++) {
				ret+=matches[i];
			}
		}
		return ret;
	}
};

this.getDeviceValueByName = function (devname, paraname) {
    var param = getParameterByName(devname, paraname);
    return ( param ) ? param.val : null;
}
this.getDeviceValue = function (device, src) {
    var param = getParameter(device, src);
    return ( param ) ? param.val : null;
}

this.getReadingDateByName = function (devname, paraname) {
    var param = getParameterByName(devname, paraname);
    return ( param ) ? param.date : null;
}
this.getReadingDate = function (device, src) {
    var param = getParameter(device, src);
    return ( param ) ? param.date : null;
}

this.getParameterByName = function (devname, paraname) {
    // devname = DEVICE:READING; paraname is ignored
    if(devname.match(/:/)) {
        var temp = devname.split(':');
        devname = temp[0];
        paraname = temp[1];
    }
    paraname = paraname || Object.keys(readings)[0];
    if (devname && devname.length>0){
        var params = deviceStates[devname];
        return ( params && params[paraname] ) ? params[paraname] : null;
    }
    return null;
}
this.getParameter = function (device, src) {
    var devname	= device.data('device');
    var paraname =	(src && src != '') ? device.data(src) : Object.keys(readings)[0];
    if (devname && devname.length>0){
        var params = deviceStates[devname];
        return ( params && params[paraname] ) ? params[paraname] : null;
    }
    return null;
}

this.hasSubscription = function (device, paraname) {
    var get = device.data('get');
    if(! $.isArray(get)) {
        get = new Array(get);
    }

    var pars;
    if(paraname.match(/,/)) {
        pars = paraname.split(',');
    } else {
        pars = new Array(paraname);
    }

    for(var g=0; g<get.length; g++) {
        for(var p=0; p<pars.length; p++) {
            var reading;
            if(get[g] && get[g].match(/:/)) {
                reading = get[g].split(':')[1];
            } else {
                reading = get[g];
            }
            if(pars[p] == reading) {
                return true;
            }
        }
    }
    return false;
}

this.getStyle = function (selector, prop) {
    var props = styleCollection[selector];
    return ( props && props[prop] ) ? props[prop] : null;
}

this.getIconId = function(iconName){
    if (!iconName || iconName=='')
        return "?";
    var rules = $('link[href$="font-awesome.min.css"]')[0].sheet.cssRules;
    for (var rule in rules){
        if ( rules[rule].selectorText && rules[rule].selectorText.match(new RegExp(iconName+':') )){
            var id = rules[rule].style.content;
            return (id)?id.replace(/"/g,'').replace(/'/g,""):"?";
        }
    }
}

// global helper functions
this.showModal = function (modal) {
    if(modal)
        $("#shade").fadeIn();
    else
       $("#shade").fadeOut();
}

// global date format functions
this.dateFromString = function (str) {
 var m = str.match(/(\d+)-(\d+)-(\d+)_(\d+):(\d+):(\d+).*/);
 return (m)?new Date(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]):new Date();
}

this.diffMinutes = function(date1,date2){
       diff  = new Date(date2 - date1);
       return (diff/1000/60).toFixed(0);
}

Date.prototype.yyyymmdd = function() {
  var yyyy = this.getFullYear().toString();
  var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
  var dd  = this.getDate().toString();
  return yyyy+'-'+ (mm[1]?mm:"0"+mm[0])+'-'+(dd[1]?dd:"0"+dd[0]); // padding
 };

Date.prototype.hhmm = function() {
  var hh = this.getHours().toString();
  var mm = this.getMinutes().toString();
  return (hh[1]?hh:"0"+hh[0])+':'+ (mm[1]?mm:"0"+mm[0]); // padding
 };

Date.prototype.hhmmss = function() {
  var hh = this.getHours().toString();
  var mm = this.getMinutes().toString();
  var ss  = this.getSeconds().toString();
  return (hh[1]?hh:"0"+hh[0])+':'+ (mm[1]?mm:"0"+mm[0])+':'+(ss[1]?ss:"0"+ss[0]); // padding
 };

Date.prototype.ddmm = function() {
  var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
  var dd  = this.getDate().toString();
    return (dd[1]?dd:"0"+dd[0])+'.'+(mm[1]?mm:"0"+mm[0])+'.'; // padding
 };

//sadly it not possible to use Array.prototype. here
this.indexOfGeneric = function(array,find){
    if (!array) return -1;
  for (var i=0;i<array.length;i++) {
    if (!$.isNumeric(array[i]))
        return indexOfRegex(array,find);
  }
  return indexOfNumeric(array,find);
};

this.indexOfNumeric = function(array,val){
   var ret=-1;
   for (var i=0;i<array.length;i++) {
       if (Number(val)>=Number(array[i]))
           ret=i;
   }
   return ret;
};

this.indexOfRegex = function(array,find){
  for (var i=0;i<array.length;i++) {
      try {
        var match = find.match(new RegExp('^'+array[i]+'$'));
      	if (match)
            return i
      } catch(e) {}
  }
  return array.indexOf(find);
};


text:
package uk.co._4ng.enocean.eep.eep26.profiles.A5.A502;

import uk.co._4ng.enocean.eep.eep26.attributes.EEP26TemperatureInverseLinear;

/**
 * @author bonino
 */
public class A50207 extends A502 {
    // the used channel
    public static final int CHANNEL = 0;

    /**
     */
    public A50207() {

        // add attributes A50207 has operative range between 20.0 and 60.0
        // Celsius
        addChannelAttribute(CHANNEL, new EEP26TemperatureInverseLinear(20.0, 60.0));
    }
}


text:
FROM anduin/confluent-base:1.0
MAINTAINER ductamnguyen@anduintransact.com

ADD ./configs /opt/configs
RUN mkdir -p /etc/service/zookeeper
ADD ./services/run-zookeeper.sh /etc/service/zookeeper/run
RUN chmod +x /etc/service/zookeeper/run

RUN mkdir -p /etc/service/kafka
ADD ./services/run-kafka.sh /etc/service/kafka/run
RUN chmod +x /etc/service/kafka/run

VOLUME /data

CMD ["/sbin/my_init"]


text:
package org.lancegatlin

object Try1 {
  case class Person(id: Int, name: String, age: Int)

  trait Schema[C] {
    class Field[A](val unapply: C => A) {
      def name: String = {
        // org.lancegatlin.Try1$PersonSchema$id$
        val name = getClass.getName
        // Try1$PersonSchema$id
        val simpleName = name.substring(name.lastIndexOf('.') + 1).dropRight(1)
        // id
        simpleName.substring(simpleName.lastIndexOf('$') + 1)
      }
        // Note: bug in this call for objects
        //getClass.getSimpleName

      override def toString = s"Field($name)"
    }
    def fields: Seq[Field[_]]
  }

  implicit object PersonSchema extends Schema[Person] {
    object id extends Field(_.id)
    object name extends Field(_.name)
    object age extends Field(_.age)
    val fields = Seq(id,name,age)
  }

  sealed trait Ast[C,A]
  case class Equals[C,A](field: Schema[C]#Field[A], ast: Ast[C,A]) extends Ast[C,A]
  case class LessThan[C,A](field: Schema[C]#Field[A], ast: Ast[C,A]) extends Ast[C,A]
  case class Value[C,A](value: A) extends Ast[C,A]
  case class And[C,A,B](ast1: Ast[C,A],ast2:Ast[C,B]) extends Ast[C,(A,B)]
  implicit class PimpMyField[C,A](val self: Schema[C]#Field[A]) extends AnyVal {
    def ===(value: A) = Equals(self,Value[C,A](value))
    def <(value: A) = LessThan(self,Value[C,A](value))
  }

  implicit class PimpMyAst[C,A](val self: Ast[C,A]) extends AnyVal {
    def and[B](other: Ast[C,B]) = And(self, other)
  }

  val ast =
  {
    import PersonSchema._
    id === 1 and name === "asdf" and age < 30
  }

  def astToSql(ast: Ast[_,_]) : String = {
    val builder = new StringBuilder(256)
    def loop(ast: Ast[_,_]) : Unit = {
      ast match {
        case e@Equals(field,ast1) =>
          builder
            .append(field.name)
            .append(" = ")
          loop(ast1)
        case LessThan(field,ast1) =>
          builder
            .append(field.name)
            .append(" < ")
          loop(ast1)
        case Value(value) =>
          // Can't just convert to String here, each dialect needs to do this differently
          // This is best done using a serializer type-class for the dialect
          builder.append(value)
        case a@And(ast1,ast2) =>
          loop(ast1)
          builder.append(" AND ")
          loop(ast2)
      }
    }
    loop(ast)
    builder.result()
  }
}