text:
QUnit.diff = ( function() {
	function DiffMatchPatch() {
	}

	//  DIFF FUNCTIONS

	/**
	 * The data structure representing a diff is an array of tuples:
	 * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
	 * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
	 */
	var DIFF_DELETE = -1,
		DIFF_INSERT = 1,
		DIFF_EQUAL = 0;

	/**
	 * Find the differences between two texts.  Simplifies the problem by stripping
	 * any common prefix or suffix off the texts before diffing.
	 * @param {string} text1 Old string to be diffed.
	 * @param {string} text2 New string to be diffed.
	 * @param {boolean=} optChecklines Optional speedup flag. If present and false,
	 *     then don't run a line-level diff first to identify the changed areas.
	 *     Defaults to true, which does a faster, slightly less optimal diff.
	 * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
	 */
	DiffMatchPatch.prototype.DiffMain = function( text1, text2, optChecklines ) {
		var deadline, checklines, commonlength,
			commonprefix, commonsuffix, diffs;

		// The diff must be complete in up to 1 second.
		deadline = ( new Date() ).getTime() + 1000;

		// Check for null inputs.
		if ( text1 === null || text2 === null ) {
			throw new Error( "Null input. (DiffMain)" );
		}

		// Check for equality (speedup).
		if ( text1 === text2 ) {
			if ( text1 ) {
				return [
					[ DIFF_EQUAL, text1 ]
				];
			}
			return [];
		}

		if ( typeof optChecklines === "undefined" ) {
			optChecklines = true;
		}

		checklines = optChecklines;

		// Trim off common prefix (speedup).
		commonlength = this.diffCommonPrefix( text1, text2 );
		commonprefix = text1.substring( 0, commonlength );
		text1 = text1.substring( commonlength );
		text2 = text2.substring( commonlength );

		// Trim off common suffix (speedup).
		commonlength = this.diffCommonSuffix( text1, text2 );
		commonsuffix = text1.substring( text1.length - commonlength );
		text1 = text1.substring( 0, text1.length - commonlength );
		text2 = text2.substring( 0, text2.length - commonlength );

		// Compute the diff on the middle block.
		diffs = this.diffCompute( text1, text2, checklines, deadline );

		// Restore the prefix and suffix.
		if ( commonprefix ) {
			diffs.unshift( [ DIFF_EQUAL, commonprefix ] );
		}
		if ( commonsuffix ) {
			diffs.push( [ DIFF_EQUAL, commonsuffix ] );
		}
		this.diffCleanupMerge( diffs );
		return diffs;
	};

	/**
	 * Reduce the number of edits by eliminating operationally trivial equalities.
	 * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
	 */
	DiffMatchPatch.prototype.diffCleanupEfficiency = function( diffs ) {
		var changes, equalities, equalitiesLength, lastequality,
			pointer, preIns, preDel, postIns, postDel;
		changes = false;
		equalities = []; // Stack of indices where equalities are found.
		equalitiesLength = 0; // Keeping our own length var is faster in JS.
		/** @type {?string} */
		lastequality = null;

		// Always equal to diffs[equalities[equalitiesLength - 1]][1]
		pointer = 0; // Index of current position.

		// Is there an insertion operation before the last equality.
		preIns = false;

		// Is there a deletion operation before the last equality.
		preDel = false;

		// Is there an insertion operation after the last equality.
		postIns = false;

		// Is there a deletion operation after the last equality.
		postDel = false;
		while ( pointer < diffs.length ) {

			// Equality found.
			if ( diffs[ pointer ][ 0 ] === DIFF_EQUAL ) {
				if ( diffs[ pointer ][ 1 ].length < 4 && ( postIns || postDel ) ) {

					// Candidate found.
					equalities[ equalitiesLength++ ] = pointer;
					preIns = postIns;
					preDel = postDel;
					lastequality = diffs[ pointer ][ 1 ];
				} else {

					// Not a candidate, and can never become one.
					equalitiesLength = 0;
					lastequality = null;
				}
				postIns = postDel = false;

			// An insertion or deletion.
			} else {

				if ( diffs[ pointer ][ 0 ] === DIFF_DELETE ) {
					postDel = true;
				} else {
					postIns = true;
				}

				/*
				 * Five types to be split:
				 * ABXYCD
				 * AXCD
				 * ABXC
				 * AXCD
				 * ABXC
				 */
				if ( lastequality && ( ( preIns && preDel && postIns && postDel ) ||
						( ( lastequality.length < 2 ) &&
						( preIns + preDel + postIns + postDel ) === 3 ) ) ) {

					// Duplicate record.
					diffs.splice(
						equalities[ equalitiesLength - 1 ],
						0,
						[ DIFF_DELETE, lastequality ]
					);

					// Change second copy to insert.
					diffs[ equalities[ equalitiesLength - 1 ] + 1 ][ 0 ] = DIFF_INSERT;
					equalitiesLength--; // Throw away the equality we just deleted;
					lastequality = null;
					if ( preIns && preDel ) {

						// No changes made which could affect previous entry, keep going.
						postIns = postDel = true;
						equalitiesLength = 0;
					} else {
						equalitiesLength--; // Throw away the previous equality.
						pointer = equalitiesLength > 0 ? equalities[ equalitiesLength - 1 ] : -1;
						postIns = postDel = false;
					}
					changes = true;
				}
			}
			pointer++;
		}

		if ( changes ) {
			this.diffCleanupMerge( diffs );
		}
	};

	/**
	 * Convert a diff array into a pretty HTML report.
	 * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
	 * @param {integer} string to be beautified.
	 * @return {string} HTML representation.
	 */
	DiffMatchPatch.prototype.diffPrettyHtml = function( diffs ) {
		var op, data, x,
			html = [];
		for ( x = 0; x < diffs.length; x++ ) {
			op = diffs[ x ][ 0 ]; // Operation (insert, delete, equal)
			data = diffs[ x ][ 1 ]; // Text of change.
			switch ( op ) {
			case DIFF_INSERT:
				html[ x ] = "" + escapeText( data ) + "";
				break;
			case DIFF_DELETE:
				html[ x ] = "" + escapeText( data ) + "";
				break;
			case DIFF_EQUAL:
				html[ x ] = "" + escapeText( data ) + "";
				break;
			}
		}
		return html.join( "" );
	};

	/**
	 * Determine the common prefix of two strings.
	 * @param {string} text1 First string.
	 * @param {string} text2 Second string.
	 * @return {number} The number of characters common to the start of each
	 *     string.
	 */
	DiffMatchPatch.prototype.diffCommonPrefix = function( text1, text2 ) {
		var pointermid, pointermax, pointermin, pointerstart;

		// Quick check for common null cases.
		if ( !text1 || !text2 || text1.charAt( 0 ) !== text2.charAt( 0 ) ) {
			return 0;
		}

		// Binary search.
		// Performance analysis: https://neil.fraser.name/news/2007/10/09/
		pointermin = 0;
		pointermax = Math.min( text1.length, text2.length );
		pointermid = pointermax;
		pointerstart = 0;
		while ( pointermin < pointermid ) {
			if ( text1.substring( pointerstart, pointermid ) ===
					text2.substring( pointerstart, pointermid ) ) {
				pointermin = pointermid;
				pointerstart = pointermin;
			} else {
				pointermax = pointermid;
			}
			pointermid = Math.floor( ( pointermax - pointermin ) / 2 + pointermin );
		}
		return pointermid;
	};

	/**
	 * Determine the common suffix of two strings.
	 * @param {string} text1 First string.
	 * @param {string} text2 Second string.
	 * @return {number} The number of characters common to the end of each string.
	 */
	DiffMatchPatch.prototype.diffCommonSuffix = function( text1, text2 ) {
		var pointermid, pointermax, pointermin, pointerend;

		// Quick check for common null cases.
		if ( !text1 ||
				!text2 ||
				text1.charAt( text1.length - 1 ) !== text2.charAt( text2.length - 1 ) ) {
			return 0;
		}

		// Binary search.
		// Performance analysis: https://neil.fraser.name/news/2007/10/09/
		pointermin = 0;
		pointermax = Math.min( text1.length, text2.length );
		pointermid = pointermax;
		pointerend = 0;
		while ( pointermin < pointermid ) {
			if ( text1.substring( text1.length - pointermid, text1.length - pointerend ) ===
					text2.substring( text2.length - pointermid, text2.length - pointerend ) ) {
				pointermin = pointermid;
				pointerend = pointermin;
			} else {
				pointermax = pointermid;
			}
			pointermid = Math.floor( ( pointermax - pointermin ) / 2 + pointermin );
		}
		return pointermid;
	};

	/**
	 * Find the differences between two texts.  Assumes that the texts do not
	 * have any common prefix or suffix.
	 * @param {string} text1 Old string to be diffed.
	 * @param {string} text2 New string to be diffed.
	 * @param {boolean} checklines Speedup flag.  If false, then don't run a
	 *     line-level diff first to identify the changed areas.
	 *     If true, then run a faster, slightly less optimal diff.
	 * @param {number} deadline Time when the diff should be complete by.
	 * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
	 * @private
	 */
	DiffMatchPatch.prototype.diffCompute = function( text1, text2, checklines, deadline ) {
		var diffs, longtext, shorttext, i, hm,
			text1A, text2A, text1B, text2B,
			midCommon, diffsA, diffsB;

		if ( !text1 ) {

			// Just add some text (speedup).
			return [
				[ DIFF_INSERT, text2 ]
			];
		}

		if ( !text2 ) {

			// Just delete some text (speedup).
			return [
				[ DIFF_DELETE, text1 ]
			];
		}

		longtext = text1.length > text2.length ? text1 : text2;
		shorttext = text1.length > text2.length ? text2 : text1;
		i = longtext.indexOf( shorttext );
		if ( i !== -1 ) {

			// Shorter text is inside the longer text (speedup).
			diffs = [
				[ DIFF_INSERT, longtext.substring( 0, i ) ],
				[ DIFF_EQUAL, shorttext ],
				[ DIFF_INSERT, longtext.substring( i + shorttext.length ) ]
			];

			// Swap insertions for deletions if diff is reversed.
			if ( text1.length > text2.length ) {
				diffs[ 0 ][ 0 ] = diffs[ 2 ][ 0 ] = DIFF_DELETE;
			}
			return diffs;
		}

		if ( shorttext.length === 1 ) {

			// Single character string.
			// After the previous speedup, the character can't be an equality.
			return [
				[ DIFF_DELETE, text1 ],
				[ DIFF_INSERT, text2 ]
			];
		}

		// Check to see if the problem can be split in two.
		hm = this.diffHalfMatch( text1, text2 );
		if ( hm ) {

			// A half-match was found, sort out the return data.
			text1A = hm[ 0 ];
			text1B = hm[ 1 ];
			text2A = hm[ 2 ];
			text2B = hm[ 3 ];
			midCommon = hm[ 4 ];

			// Send both pairs off for separate processing.
			diffsA = this.DiffMain( text1A, text2A, checklines, deadline );
			diffsB = this.DiffMain( text1B, text2B, checklines, deadline );

			// Merge the results.
			return diffsA.concat( [
				[ DIFF_EQUAL, midCommon ]
			], diffsB );
		}

		if ( checklines && text1.length > 100 && text2.length > 100 ) {
			return this.diffLineMode( text1, text2, deadline );
		}

		return this.diffBisect( text1, text2, deadline );
	};

	/**
	 * Do the two texts share a substring which is at least half the length of the
	 * longer text?
	 * This speedup can produce non-minimal diffs.
	 * @param {string} text1 First string.
	 * @param {string} text2 Second string.
	 * @return {Array.<string>} Five element Array, containing the prefix of
	 *     text1, the suffix of text1, the prefix of text2, the suffix of
	 *     text2 and the common middle.  Or null if there was no match.
	 * @private
	 */
	DiffMatchPatch.prototype.diffHalfMatch = function( text1, text2 ) {
		var longtext, shorttext, dmp,
			text1A, text2B, text2A, text1B, midCommon,
			hm1, hm2, hm;

		longtext = text1.length > text2.length ? text1 : text2;
		shorttext = text1.length > text2.length ? text2 : text1;
		if ( longtext.length < 4 || shorttext.length * 2 < longtext.length ) {
			return null; // Pointless.
		}
		dmp = this; // 'this' becomes 'window' in a closure.

		/**
		 * Does a substring of shorttext exist within longtext such that the substring
		 * is at least half the length of longtext?
		 * Closure, but does not reference any external variables.
		 * @param {string} longtext Longer string.
		 * @param {string} shorttext Shorter string.
		 * @param {number} i Start index of quarter length substring within longtext.
		 * @return {Array.<string>} Five element Array, containing the prefix of
		 *     longtext, the suffix of longtext, the prefix of shorttext, the suffix
		 *     of shorttext and the common middle.  Or null if there was no match.
		 * @private
		 */
		function diffHalfMatchI( longtext, shorttext, i ) {
			var seed, j, bestCommon, prefixLength, suffixLength,
				bestLongtextA, bestLongtextB, bestShorttextA, bestShorttextB;

			// Start with a 1/4 length substring at position i as a seed.
			seed = longtext.substring( i, i + Math.floor( longtext.length / 4 ) );
			j = -1;
			bestCommon = "";
			while ( ( j = shorttext.indexOf( seed, j + 1 ) ) !== -1 ) {
				prefixLength = dmp.diffCommonPrefix( longtext.substring( i ),
					shorttext.substring( j ) );
				suffixLength = dmp.diffCommonSuffix( longtext.substring( 0, i ),
					shorttext.substring( 0, j ) );
				if ( bestCommon.length < suffixLength + prefixLength ) {
					bestCommon = shorttext.substring( j - suffixLength, j ) +
						shorttext.substring( j, j + prefixLength );
					bestLongtextA = longtext.substring( 0, i - suffixLength );
					bestLongtextB = longtext.substring( i + prefixLength );
					bestShorttextA = shorttext.substring( 0, j - suffixLength );
					bestShorttextB = shorttext.substring( j + prefixLength );
				}
			}
			if ( bestCommon.length * 2 >= longtext.length ) {
				return [ bestLongtextA, bestLongtextB,
					bestShorttextA, bestShorttextB, bestCommon
				];
			} else {
				return null;
			}
		}

		// First check if the second quarter is the seed for a half-match.
		hm1 = diffHalfMatchI( longtext, shorttext,
			Math.ceil( longtext.length / 4 ) );

		// Check again based on the third quarter.
		hm2 = diffHalfMatchI( longtext, shorttext,
			Math.ceil( longtext.length / 2 ) );
		if ( !hm1 && !hm2 ) {
			return null;
		} else if ( !hm2 ) {
			hm = hm1;
		} else if ( !hm1 ) {
			hm = hm2;
		} else {

			// Both matched.  Select the longest.
			hm = hm1[ 4 ].length > hm2[ 4 ].length ? hm1 : hm2;
		}

		// A half-match was found, sort out the return data.
		text1A, text1B, text2A, text2B;
		if ( text1.length > text2.length ) {
			text1A = hm[ 0 ];
			text1B = hm[ 1 ];
			text2A = hm[ 2 ];
			text2B = hm[ 3 ];
		} else {
			text2A = hm[ 0 ];
			text2B = hm[ 1 ];
			text1A = hm[ 2 ];
			text1B = hm[ 3 ];
		}
		midCommon = hm[ 4 ];
		return [ text1A, text1B, text2A, text2B, midCommon ];
	};

	/**
	 * Do a quick line-level diff on both strings, then rediff the parts for
	 * greater accuracy.
	 * This speedup can produce non-minimal diffs.
	 * @param {string} text1 Old string to be diffed.
	 * @param {string} text2 New string to be diffed.
	 * @param {number} deadline Time when the diff should be complete by.
	 * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
	 * @private
	 */
	DiffMatchPatch.prototype.diffLineMode = function( text1, text2, deadline ) {
		var a, diffs, linearray, pointer, countInsert,
			countDelete, textInsert, textDelete, j;

		// Scan the text on a line-by-line basis first.
		a = this.diffLinesToChars( text1, text2 );
		text1 = a.chars1;
		text2 = a.chars2;
		linearray = a.lineArray;

		diffs = this.DiffMain( text1, text2, false, deadline );

		// Convert the diff back to original text.
		this.diffCharsToLines( diffs, linearray );

		// Eliminate freak matches (e.g. blank lines)
		this.diffCleanupSemantic( diffs );

		// Rediff any replacement blocks, this time character-by-character.
		// Add a dummy entry at the end.
		diffs.push( [ DIFF_EQUAL, "" ] );
		pointer = 0;
		countDelete = 0;
		countInsert = 0;
		textDelete = "";
		textInsert = "";
		while ( pointer < diffs.length ) {
			switch ( diffs[ pointer ][ 0 ] ) {
			case DIFF_INSERT:
				countInsert++;
				textInsert += diffs[ pointer ][ 1 ];
				break;
			case DIFF_DELETE:
				countDelete++;
				textDelete += diffs[ pointer ][ 1 ];
				break;
			case DIFF_EQUAL:

				// Upon reaching an equality, check for prior redundancies.
				if ( countDelete >= 1 && countInsert >= 1 ) {

					// Delete the offending records and add the merged ones.
					diffs.splice( pointer - countDelete - countInsert,
						countDelete + countInsert );
					pointer = pointer - countDelete - countInsert;
					a = this.DiffMain( textDelete, textInsert, false, deadline );
					for ( j = a.length - 1; j >= 0; j-- ) {
						diffs.splice( pointer, 0, a[ j ] );
					}
					pointer = pointer + a.length;
				}
				countInsert = 0;
				countDelete = 0;
				textDelete = "";
				textInsert = "";
				break;
			}
			pointer++;
		}
		diffs.pop(); // Remove the dummy entry at the end.

		return diffs;
	};

	/**
	 * Find the 'middle snake' of a diff, split the problem in two
	 * and return the recursively constructed diff.
	 * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
	 * @param {string} text1 Old string to be diffed.
	 * @param {string} text2 New string to be diffed.
	 * @param {number} deadline Time at which to bail if not yet complete.
	 * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
	 * @private
	 */
	DiffMatchPatch.prototype.diffBisect = function( text1, text2, deadline ) {
		var text1Length, text2Length, maxD, vOffset, vLength,
			v1, v2, x, delta, front, k1start, k1end, k2start,
			k2end, k2Offset, k1Offset, x1, x2, y1, y2, d, k1, k2;

		// Cache the text lengths to prevent multiple calls.
		text1Length = text1.length;
		text2Length = text2.length;
		maxD = Math.ceil( ( text1Length + text2Length ) / 2 );
		vOffset = maxD;
		vLength = 2 * maxD;
		v1 = new Array( vLength );
		v2 = new Array( vLength );

		// Setting all elements to -1 is faster in Chrome & Firefox than mixing
		// integers and undefined.
		for ( x = 0; x < vLength; x++ ) {
			v1[ x ] = -1;
			v2[ x ] = -1;
		}
		v1[ vOffset + 1 ] = 0;
		v2[ vOffset + 1 ] = 0;
		delta = text1Length - text2Length;

		// If the total number of characters is odd, then the front path will collide
		// with the reverse path.
		front = ( delta % 2 !== 0 );

		// Offsets for start and end of k loop.
		// Prevents mapping of space beyond the grid.
		k1start = 0;
		k1end = 0;
		k2start = 0;
		k2end = 0;
		for ( d = 0; d < maxD; d++ ) {

			// Bail out if deadline is reached.
			if ( ( new Date() ).getTime() > deadline ) {
				break;
			}

			// Walk the front path one step.
			for ( k1 = -d + k1start; k1 <= d - k1end; k1 += 2 ) {
				k1Offset = vOffset + k1;
				if ( k1 === -d || ( k1 !== d && v1[ k1Offset - 1 ] < v1[ k1Offset + 1 ] ) ) {
					x1 = v1[ k1Offset + 1 ];
				} else {
					x1 = v1[ k1Offset - 1 ] + 1;
				}
				y1 = x1 - k1;
				while ( x1 < text1Length && y1 < text2Length &&
					text1.charAt( x1 ) === text2.charAt( y1 ) ) {
					x1++;
					y1++;
				}
				v1[ k1Offset ] = x1;
				if ( x1 > text1Length ) {

					// Ran off the right of the graph.
					k1end += 2;
				} else if ( y1 > text2Length ) {

					// Ran off the bottom of the graph.
					k1start += 2;
				} else if ( front ) {
					k2Offset = vOffset + delta - k1;
					if ( k2Offset >= 0 && k2Offset < vLength && v2[ k2Offset ] !== -1 ) {

						// Mirror x2 onto top-left coordinate system.
						x2 = text1Length - v2[ k2Offset ];
						if ( x1 >= x2 ) {

							// Overlap detected.
							return this.diffBisectSplit( text1, text2, x1, y1, deadline );
						}
					}
				}
			}

			// Walk the reverse path one step.
			for ( k2 = -d + k2start; k2 <= d - k2end; k2 += 2 ) {
				k2Offset = vOffset + k2;
				if ( k2 === -d || ( k2 !== d && v2[ k2Offset - 1 ] < v2[ k2Offset + 1 ] ) ) {
					x2 = v2[ k2Offset + 1 ];
				} else {
					x2 = v2[ k2Offset - 1 ] + 1;
				}
				y2 = x2 - k2;
				while ( x2 < text1Length && y2 < text2Length &&
					text1.charAt( text1Length - x2 - 1 ) ===
					text2.charAt( text2Length - y2 - 1 ) ) {
					x2++;
					y2++;
				}
				v2[ k2Offset ] = x2;
				if ( x2 > text1Length ) {

					// Ran off the left of the graph.
					k2end += 2;
				} else if ( y2 > text2Length ) {

					// Ran off the top of the graph.
					k2start += 2;
				} else if ( !front ) {
					k1Offset = vOffset + delta - k2;
					if ( k1Offset >= 0 && k1Offset < vLength && v1[ k1Offset ] !== -1 ) {
						x1 = v1[ k1Offset ];
						y1 = vOffset + x1 - k1Offset;

						// Mirror x2 onto top-left coordinate system.
						x2 = text1Length - x2;
						if ( x1 >= x2 ) {

							// Overlap detected.
							return this.diffBisectSplit( text1, text2, x1, y1, deadline );
						}
					}
				}
			}
		}

		// Diff took too long and hit the deadline or
		// number of diffs equals number of characters, no commonality at all.
		return [
			[ DIFF_DELETE, text1 ],
			[ DIFF_INSERT, text2 ]
		];
	};

	/**
	 * Given the location of the 'middle snake', split the diff in two parts
	 * and recurse.
	 * @param {string} text1 Old string to be diffed.
	 * @param {string} text2 New string to be diffed.
	 * @param {number} x Index of split point in text1.
	 * @param {number} y Index of split point in text2.
	 * @param {number} deadline Time at which to bail if not yet complete.
	 * @return {!Array.<!DiffMatchPatch.Diff>} Array of diff tuples.
	 * @private
	 */
	DiffMatchPatch.prototype.diffBisectSplit = function( text1, text2, x, y, deadline ) {
		var text1a, text1b, text2a, text2b, diffs, diffsb;
		text1a = text1.substring( 0, x );
		text2a = text2.substring( 0, y );
		text1b = text1.substring( x );
		text2b = text2.substring( y );

		// Compute both diffs serially.
		diffs = this.DiffMain( text1a, text2a, false, deadline );
		diffsb = this.DiffMain( text1b, text2b, false, deadline );

		return diffs.concat( diffsb );
	};

	/**
	 * Reduce the number of edits by eliminating semantically trivial equalities.
	 * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
	 */
	DiffMatchPatch.prototype.diffCleanupSemantic = function( diffs ) {
		var changes, equalities, equalitiesLength, lastequality,
			pointer, lengthInsertions2, lengthDeletions2, lengthInsertions1,
			lengthDeletions1, deletion, insertion, overlapLength1, overlapLength2;
		changes = false;
		equalities = []; // Stack of indices where equalities are found.
		equalitiesLength = 0; // Keeping our own length var is faster in JS.
		/** @type {?string} */
		lastequality = null;

		// Always equal to diffs[equalities[equalitiesLength - 1]][1]
		pointer = 0; // Index of current position.

		// Number of characters that changed prior to the equality.
		lengthInsertions1 = 0;
		lengthDeletions1 = 0;

		// Number of characters that changed after the equality.
		lengthInsertions2 = 0;
		lengthDeletions2 = 0;
		while ( pointer < diffs.length ) {
			if ( diffs[ pointer ][ 0 ] === DIFF_EQUAL ) { // Equality found.
				equalities[ equalitiesLength++ ] = pointer;
				lengthInsertions1 = lengthInsertions2;
				lengthDeletions1 = lengthDeletions2;
				lengthInsertions2 = 0;
				lengthDeletions2 = 0;
				lastequality = diffs[ pointer ][ 1 ];
			} else { // An insertion or deletion.
				if ( diffs[ pointer ][ 0 ] === DIFF_INSERT ) {
					lengthInsertions2 += diffs[ pointer ][ 1 ].length;
				} else {
					lengthDeletions2 += diffs[ pointer ][ 1 ].length;
				}

				// Eliminate an equality that is smaller or equal to the edits on both
				// sides of it.
				if ( lastequality && ( lastequality.length <=
						Math.max( lengthInsertions1, lengthDeletions1 ) ) &&
						( lastequality.length <= Math.max( lengthInsertions2,
							lengthDeletions2 ) ) ) {

					// Duplicate record.
					diffs.splice(
						equalities[ equalitiesLength - 1 ],
						0,
						[ DIFF_DELETE, lastequality ]
					);

					// Change second copy to insert.
					diffs[ equalities[ equalitiesLength - 1 ] + 1 ][ 0 ] = DIFF_INSERT;

					// Throw away the equality we just deleted.
					equalitiesLength--;

					// Throw away the previous equality (it needs to be reevaluated).
					equalitiesLength--;
					pointer = equalitiesLength > 0 ? equalities[ equalitiesLength - 1 ] : -1;

					// Reset the counters.
					lengthInsertions1 = 0;
					lengthDeletions1 = 0;
					lengthInsertions2 = 0;
					lengthDeletions2 = 0;
					lastequality = null;
					changes = true;
				}
			}
			pointer++;
		}

		// Normalize the diff.
		if ( changes ) {
			this.diffCleanupMerge( diffs );
		}

		// Find any overlaps between deletions and insertions.
		// e.g: abcxxxxxxdef
		//   -> abcxxxdef
		// e.g: xxxabcdefxxx
		//   -> defxxxabc
		// Only extract an overlap if it is as big as the edit ahead or behind it.
		pointer = 1;
		while ( pointer < diffs.length ) {
			if ( diffs[ pointer - 1 ][ 0 ] === DIFF_DELETE &&
					diffs[ pointer ][ 0 ] === DIFF_INSERT ) {
				deletion = diffs[ pointer - 1 ][ 1 ];
				insertion = diffs[ pointer ][ 1 ];
				overlapLength1 = this.diffCommonOverlap( deletion, insertion );
				overlapLength2 = this.diffCommonOverlap( insertion, deletion );
				if ( overlapLength1 >= overlapLength2 ) {
					if ( overlapLength1 >= deletion.length / 2 ||
							overlapLength1 >= insertion.length / 2 ) {

						// Overlap found.  Insert an equality and trim the surrounding edits.
						diffs.splice(
							pointer,
							0,
							[ DIFF_EQUAL, insertion.substring( 0, overlapLength1 ) ]
						);
						diffs[ pointer - 1 ][ 1 ] =
							deletion.substring( 0, deletion.length - overlapLength1 );
						diffs[ pointer + 1 ][ 1 ] = insertion.substring( overlapLength1 );
						pointer++;
					}
				} else {
					if ( overlapLength2 >= deletion.length / 2 ||
							overlapLength2 >= insertion.length / 2 ) {

						// Reverse overlap found.
						// Insert an equality and swap and trim the surrounding edits.
						diffs.splice(
							pointer,
							0,
							[ DIFF_EQUAL, deletion.substring( 0, overlapLength2 ) ]
						);

						diffs[ pointer - 1 ][ 0 ] = DIFF_INSERT;
						diffs[ pointer - 1 ][ 1 ] =
							insertion.substring( 0, insertion.length - overlapLength2 );
						diffs[ pointer + 1 ][ 0 ] = DIFF_DELETE;
						diffs[ pointer + 1 ][ 1 ] =
							deletion.substring( overlapLength2 );
						pointer++;
					}
				}
				pointer++;
			}
			pointer++;
		}
	};

	/**
	 * Determine if the suffix of one string is the prefix of another.
	 * @param {string} text1 First string.
	 * @param {string} text2 Second string.
	 * @return {number} The number of characters common to the end of the first
	 *     string and the start of the second string.
	 * @private
	 */
	DiffMatchPatch.prototype.diffCommonOverlap = function( text1, text2 ) {
		var text1Length, text2Length, textLength,
			best, length, pattern, found;

		// Cache the text lengths to prevent multiple calls.
		text1Length = text1.length;
		text2Length = text2.length;

		// Eliminate the null case.
		if ( text1Length === 0 || text2Length === 0 ) {
			return 0;
		}

		// Truncate the longer string.
		if ( text1Length > text2Length ) {
			text1 = text1.substring( text1Length - text2Length );
		} else if ( text1Length < text2Length ) {
			text2 = text2.substring( 0, text1Length );
		}
		textLength = Math.min( text1Length, text2Length );

		// Quick check for the worst case.
		if ( text1 === text2 ) {
			return textLength;
		}

		// Start by looking for a single character match
		// and increase length until no match is found.
		// Performance analysis: https://neil.fraser.name/news/2010/11/04/
		best = 0;
		length = 1;
		while ( true ) {
			pattern = text1.substring( textLength - length );
			found = text2.indexOf( pattern );
			if ( found === -1 ) {
				return best;
			}
			length += found;
			if ( found === 0 || text1.substring( textLength - length ) ===
					text2.substring( 0, length ) ) {
				best = length;
				length++;
			}
		}
	};

	/**
	 * Split two texts into an array of strings.  Reduce the texts to a string of
	 * hashes where each Unicode character represents one line.
	 * @param {string} text1 First string.
	 * @param {string} text2 Second string.
	 * @return {{chars1: string, chars2: string, lineArray: !Array.<string>}}
	 *     An object containing the encoded text1, the encoded text2 and
	 *     the array of unique strings.
	 *     The zeroth element of the array of unique strings is intentionally blank.
	 * @private
	 */
	DiffMatchPatch.prototype.diffLinesToChars = function( text1, text2 ) {
		var lineArray, lineHash, chars1, chars2;
		lineArray = []; // E.g. lineArray[4] === 'Hello\n'
		lineHash = {};  // E.g. lineHash['Hello\n'] === 4

		// '\x00' is a valid character, but various debuggers don't like it.
		// So we'll insert a junk entry to avoid generating a null character.
		lineArray[ 0 ] = "";

		/**
		 * Split a text into an array of strings.  Reduce the texts to a string of
		 * hashes where each Unicode character represents one line.
		 * Modifies linearray and linehash through being a closure.
		 * @param {string} text String to encode.
		 * @return {string} Encoded string.
		 * @private
		 */
		function diffLinesToCharsMunge( text ) {
			var chars, lineStart, lineEnd, lineArrayLength, line;
			chars = "";

			// Walk the text, pulling out a substring for each line.
			// text.split('\n') would would temporarily double our memory footprint.
			// Modifying text would create many large strings to garbage collect.
			lineStart = 0;
			lineEnd = -1;

			// Keeping our own length variable is faster than looking it up.
			lineArrayLength = lineArray.length;
			while ( lineEnd < text.length - 1 ) {
				lineEnd = text.indexOf( "\n", lineStart );
				if ( lineEnd === -1 ) {
					lineEnd = text.length - 1;
				}
				line = text.substring( lineStart, lineEnd + 1 );
				lineStart = lineEnd + 1;

				if ( lineHash.hasOwnProperty ? lineHash.hasOwnProperty( line ) :
							( lineHash[ line ] !== undefined ) ) {
					chars += String.fromCharCode( lineHash[ line ] );
				} else {
					chars += String.fromCharCode( lineArrayLength );
					lineHash[ line ] = lineArrayLength;
					lineArray[ lineArrayLength++ ] = line;
				}
			}
			return chars;
		}

		chars1 = diffLinesToCharsMunge( text1 );
		chars2 = diffLinesToCharsMunge( text2 );
		return {
			chars1: chars1,
			chars2: chars2,
			lineArray: lineArray
		};
	};

	/**
	 * Rehydrate the text in a diff from a string of line hashes to real lines of
	 * text.
	 * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
	 * @param {!Array.<string>} lineArray Array of unique strings.
	 * @private
	 */
	DiffMatchPatch.prototype.diffCharsToLines = function( diffs, lineArray ) {
		var x, chars, text, y;
		for ( x = 0; x < diffs.length; x++ ) {
			chars = diffs[ x ][ 1 ];
			text = [];
			for ( y = 0; y < chars.length; y++ ) {
				text[ y ] = lineArray[ chars.charCodeAt( y ) ];
			}
			diffs[ x ][ 1 ] = text.join( "" );
		}
	};

	/**
	 * Reorder and merge like edit sections.  Merge equalities.
	 * Any edit section can move as long as it doesn't cross an equality.
	 * @param {!Array.<!DiffMatchPatch.Diff>} diffs Array of diff tuples.
	 */
	DiffMatchPatch.prototype.diffCleanupMerge = function( diffs ) {
		var pointer, countDelete, countInsert, textInsert, textDelete,
			commonlength, changes, diffPointer, position;
		diffs.push( [ DIFF_EQUAL, "" ] ); // Add a dummy entry at the end.
		pointer = 0;
		countDelete = 0;
		countInsert = 0;
		textDelete = "";
		textInsert = "";
		commonlength;
		while ( pointer < diffs.length ) {
			switch ( diffs[ pointer ][ 0 ] ) {
			case DIFF_INSERT:
				countInsert++;
				textInsert += diffs[ pointer ][ 1 ];
				pointer++;
				break;
			case DIFF_DELETE:
				countDelete++;
				textDelete += diffs[ pointer ][ 1 ];
				pointer++;
				break;
			case DIFF_EQUAL:

				// Upon reaching an equality, check for prior redundancies.
				if ( countDelete + countInsert > 1 ) {
					if ( countDelete !== 0 && countInsert !== 0 ) {

						// Factor out any common prefixes.
						commonlength = this.diffCommonPrefix( textInsert, textDelete );
						if ( commonlength !== 0 ) {
							if ( ( pointer - countDelete - countInsert ) > 0 &&
									diffs[ pointer - countDelete - countInsert - 1 ][ 0 ] ===
									DIFF_EQUAL ) {
								diffs[ pointer - countDelete - countInsert - 1 ][ 1 ] +=
									textInsert.substring( 0, commonlength );
							} else {
								diffs.splice( 0, 0, [ DIFF_EQUAL,
									textInsert.substring( 0, commonlength )
								] );
								pointer++;
							}
							textInsert = textInsert.substring( commonlength );
							textDelete = textDelete.substring( commonlength );
						}

						// Factor out any common suffixies.
						commonlength = this.diffCommonSuffix( textInsert, textDelete );
						if ( commonlength !== 0 ) {
							diffs[ pointer ][ 1 ] = textInsert.substring( textInsert.length -
									commonlength ) + diffs[ pointer ][ 1 ];
							textInsert = textInsert.substring( 0, textInsert.length -
								commonlength );
							textDelete = textDelete.substring( 0, textDelete.length -
								commonlength );
						}
					}

					// Delete the offending records and add the merged ones.
					if ( countDelete === 0 ) {
						diffs.splice( pointer - countInsert,
							countDelete + countInsert, [ DIFF_INSERT, textInsert ] );
					} else if ( countInsert === 0 ) {
						diffs.splice( pointer - countDelete,
							countDelete + countInsert, [ DIFF_DELETE, textDelete ] );
					} else {
						diffs.splice(
							pointer - countDelete - countInsert,
							countDelete + countInsert,
							[ DIFF_DELETE, textDelete ], [ DIFF_INSERT, textInsert ]
						);
					}
					pointer = pointer - countDelete - countInsert +
						( countDelete ? 1 : 0 ) + ( countInsert ? 1 : 0 ) + 1;
				} else if ( pointer !== 0 && diffs[ pointer - 1 ][ 0 ] === DIFF_EQUAL ) {

					// Merge this equality with the previous one.
					diffs[ pointer - 1 ][ 1 ] += diffs[ pointer ][ 1 ];
					diffs.splice( pointer, 1 );
				} else {
					pointer++;
				}
				countInsert = 0;
				countDelete = 0;
				textDelete = "";
				textInsert = "";
				break;
			}
		}
		if ( diffs[ diffs.length - 1 ][ 1 ] === "" ) {
			diffs.pop(); // Remove the dummy entry at the end.
		}

		// Second pass: look for single edits surrounded on both sides by equalities
		// which can be shifted sideways to eliminate an equality.
		// e.g: ABAC -> ABAC
		changes = false;
		pointer = 1;

		// Intentionally ignore the first and last element (don't need checking).
		while ( pointer < diffs.length - 1 ) {
			if ( diffs[ pointer - 1 ][ 0 ] === DIFF_EQUAL &&
					diffs[ pointer + 1 ][ 0 ] === DIFF_EQUAL ) {

				diffPointer = diffs[ pointer ][ 1 ];
				position = diffPointer.substring(
					diffPointer.length - diffs[ pointer - 1 ][ 1 ].length
				);

				// This is a single edit surrounded by equalities.
				if ( position === diffs[ pointer - 1 ][ 1 ] ) {

					// Shift the edit over the previous equality.
					diffs[ pointer ][ 1 ] = diffs[ pointer - 1 ][ 1 ] +
						diffs[ pointer ][ 1 ].substring( 0, diffs[ pointer ][ 1 ].length -
							diffs[ pointer - 1 ][ 1 ].length );
					diffs[ pointer + 1 ][ 1 ] =
						diffs[ pointer - 1 ][ 1 ] + diffs[ pointer + 1 ][ 1 ];
					diffs.splice( pointer - 1, 1 );
					changes = true;
				} else if ( diffPointer.substring( 0, diffs[ pointer + 1 ][ 1 ].length ) ===
						diffs[ pointer + 1 ][ 1 ] ) {

					// Shift the edit over the next equality.
					diffs[ pointer - 1 ][ 1 ] += diffs[ pointer + 1 ][ 1 ];
					diffs[ pointer ][ 1 ] =
						diffs[ pointer ][ 1 ].substring( diffs[ pointer + 1 ][ 1 ].length ) +
						diffs[ pointer + 1 ][ 1 ];
					diffs.splice( pointer + 1, 1 );
					changes = true;
				}
			}
			pointer++;
		}

		// If shifts were made, the diff needs reordering and another shift sweep.
		if ( changes ) {
			this.diffCleanupMerge( diffs );
		}
	};

	return function( o, n ) {
		var diff, output, text;
		diff = new DiffMatchPatch();
		output = diff.DiffMain( o, n );
		diff.diffCleanupEfficiency( output );
		text = diff.diffPrettyHtml( output );

		return text;
	};
}() );


text:
package org.apache.asterix.metadata.entities;

import java.io.DataOutput;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import org.apache.asterix.builders.IARecordBuilder;
import org.apache.asterix.builders.OrderedListBuilder;
import org.apache.asterix.builders.RecordBuilder;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
import org.apache.asterix.metadata.IDatasetDetails;
import org.apache.asterix.metadata.bootstrap.MetadataRecordTypes;
import org.apache.asterix.om.base.ABoolean;
import org.apache.asterix.om.base.AInt8;
import org.apache.asterix.om.base.AMutableInt8;
import org.apache.asterix.om.base.AMutableString;
import org.apache.asterix.om.base.AString;
import org.apache.asterix.om.types.AOrderedListType;
import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;

public class InternalDatasetDetails implements IDatasetDetails {

    private static final long serialVersionUID = 1L;

    public enum FileStructure {
        BTREE
    }

    public enum PartitioningStrategy {
        HASH
    }

    private final FileStructure fileStructure;
    private final PartitioningStrategy partitioningStrategy;
    private final List<List<String>> partitioningKeys;
    private final List<List<String>> primaryKeys;
    private final List<IAType> primaryKeyTypes;
    private final boolean autogenerated;
    private final Integer filterSourceIndicator;
    private final List<String> filterField;
    private final List<Integer> keySourceIndicators;

    public static final String FILTER_FIELD_NAME = "FilterField";
    public static final String FILTER_SOURCE_INDICATOR_FIELD_NAME = "FilterSourceIndicator";
    public static final String KEY_FILD_SOURCE_INDICATOR_FIELD_NAME = "KeySourceIndicator";

    public InternalDatasetDetails(FileStructure fileStructure, PartitioningStrategy partitioningStrategy,
            List<List<String>> partitioningKey, List<List<String>> primaryKey, List<Integer> keyFieldIndicators,
            List<IAType> primaryKeyType, boolean autogenerated, Integer filterSourceIndicator,
            List<String> filterField) {
        this.fileStructure = fileStructure;
        this.partitioningStrategy = partitioningStrategy;
        this.partitioningKeys = partitioningKey;
        this.primaryKeys = primaryKey;
        if (keyFieldIndicators == null) {
            // Create a dummy list.
            keyFieldIndicators = new ArrayList<>();
            for (int index = 0; index < partitioningKey.size(); ++index) {
                keyFieldIndicators.add(0);
            }
        }
        this.keySourceIndicators = keyFieldIndicators;
        this.primaryKeyTypes = primaryKeyType;
        this.autogenerated = autogenerated;
        if (filterSourceIndicator != null) {
            // to make sure filter source indicator and filter field is consistent
            this.filterSourceIndicator = filterSourceIndicator;
            this.filterField = Objects.requireNonNull(filterField);
        } else {
            this.filterSourceIndicator = null;
            this.filterField = null;
        }
    }

    public List<List<String>> getPartitioningKey() {
        return partitioningKeys;
    }

    public boolean isAutogenerated() {
        return autogenerated;
    }

    public List<List<String>> getPrimaryKey() {
        return primaryKeys;
    }

    public List<Integer> getKeySourceIndicator() {
        return keySourceIndicators;
    }

    public List<IAType> getPrimaryKeyType() {
        return primaryKeyTypes;
    }

    public FileStructure getFileStructure() {
        return fileStructure;
    }

    public PartitioningStrategy getPartitioningStrategy() {
        return partitioningStrategy;
    }

    public List<String> getFilterField() {
        return filterField;
    }

    public Integer getFilterSourceIndicator() {
        return filterSourceIndicator;
    }

    @Override
    public DatasetType getDatasetType() {
        return DatasetType.INTERNAL;
    }

    @Override
    public void writeDatasetDetailsRecordType(DataOutput out) throws HyracksDataException {

        IARecordBuilder internalRecordBuilder = new RecordBuilder();
        OrderedListBuilder listBuilder = new OrderedListBuilder();
        ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
        ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
        OrderedListBuilder primaryKeyListBuilder = new OrderedListBuilder();
        AOrderedListType stringList = new AOrderedListType(BuiltinType.ASTRING, null);
        AOrderedListType int8List = new AOrderedListType(BuiltinType.AINT8, null);
        AOrderedListType heterogeneousList = new AOrderedListType(BuiltinType.ANY, null);
        internalRecordBuilder.reset(MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE);
        AMutableString aString = new AMutableString("");
        AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
        @SuppressWarnings("unchecked")
        ISerializerDeserializer<ABoolean> booleanSerde =
                SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ABOOLEAN);
        @SuppressWarnings("unchecked")
        ISerializerDeserializer<AString> stringSerde =
                SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ASTRING);
        @SuppressWarnings("unchecked")
        ISerializerDeserializer<AInt8> int8Serde =
                SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);

        // write field 0
        fieldValue.reset();
        aString.setValue(getFileStructure().toString());
        stringSerde.serialize(aString, fieldValue.getDataOutput());
        internalRecordBuilder.addField(MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_FILESTRUCTURE_FIELD_INDEX,
                fieldValue);

        // write field 1
        fieldValue.reset();
        aString.setValue(getPartitioningStrategy().toString());
        stringSerde.serialize(aString, fieldValue.getDataOutput());
        internalRecordBuilder.addField(MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PARTITIONSTRATEGY_FIELD_INDEX,
                fieldValue);

        // write field 2
        primaryKeyListBuilder.reset((AOrderedListType) MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE
                .getFieldTypes()[MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PARTITIONKEY_FIELD_INDEX]);
        for (List<String> field : partitioningKeys) {
            listBuilder.reset(stringList);
            for (String subField : field) {
                itemValue.reset();
                aString.setValue(subField);
                stringSerde.serialize(aString, itemValue.getDataOutput());
                listBuilder.addItem(itemValue);
            }
            itemValue.reset();
            listBuilder.write(itemValue.getDataOutput(), true);
            primaryKeyListBuilder.addItem(itemValue);
        }
        fieldValue.reset();
        primaryKeyListBuilder.write(fieldValue.getDataOutput(), true);
        internalRecordBuilder.addField(MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PARTITIONKEY_FIELD_INDEX,
                fieldValue);

        // write field 3
        primaryKeyListBuilder.reset((AOrderedListType) MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE
                .getFieldTypes()[MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PRIMARYKEY_FIELD_INDEX]);
        for (List<String> field : primaryKeys) {
            listBuilder.reset(stringList);
            for (String subField : field) {
                itemValue.reset();
                aString.setValue(subField);
                stringSerde.serialize(aString, itemValue.getDataOutput());
                listBuilder.addItem(itemValue);
            }
            itemValue.reset();
            listBuilder.write(itemValue.getDataOutput(), true);
            primaryKeyListBuilder.addItem(itemValue);
        }
        fieldValue.reset();
        primaryKeyListBuilder.write(fieldValue.getDataOutput(), true);
        internalRecordBuilder.addField(MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_PRIMARYKEY_FIELD_INDEX, fieldValue);

        // write field 4
        fieldValue.reset();
        ABoolean b = isAutogenerated() ? ABoolean.TRUE : ABoolean.FALSE;
        booleanSerde.serialize(b, fieldValue.getDataOutput());
        internalRecordBuilder.addField(MetadataRecordTypes.INTERNAL_DETAILS_ARECORD_AUTOGENERATED_FIELD_INDEX,
                fieldValue);

        // write filter fields if any
        Integer filterSourceIndicator = getFilterSourceIndicator();
        List<String> filterField = getFilterField();
        if (filterField != null) {
            ArrayBackedValueStorage nameValue = new ArrayBackedValueStorage();
            // write filter source indicator
            nameValue.reset();
            aString.setValue(FILTER_SOURCE_INDICATOR_FIELD_NAME);
            stringSerde.serialize(aString, nameValue.getDataOutput());
            fieldValue.reset();
            aInt8.setValue(filterSourceIndicator.byteValue());
            int8Serde.serialize(aInt8, fieldValue.getDataOutput());
            internalRecordBuilder.addField(nameValue, fieldValue);

            // write filter fields
            listBuilder.reset(heterogeneousList);
            nameValue.reset();
            aString.setValue(FILTER_FIELD_NAME);
            stringSerde.serialize(aString, nameValue.getDataOutput());
            for (String field : filterField) {
                itemValue.reset();
                aString.setValue(field);
                stringSerde.serialize(aString, itemValue.getDataOutput());
                listBuilder.addItem(itemValue);
            }
            fieldValue.reset();
            listBuilder.write(fieldValue.getDataOutput(), true);
            internalRecordBuilder.addField(nameValue, fieldValue);
        }

        // write key source indicators if any
        List<Integer> keySourceIndicator = getKeySourceIndicator();
        boolean needSerialization = false;
        if (keySourceIndicator != null) {
            for (int source : keySourceIndicator) {
                if (source != 0) {
                    needSerialization = true;
                    break;
                }
            }
        }
        if (needSerialization) {
            listBuilder.reset(int8List);
            ArrayBackedValueStorage nameValue = new ArrayBackedValueStorage();
            nameValue.reset();
            aString.setValue(KEY_FILD_SOURCE_INDICATOR_FIELD_NAME);
            stringSerde.serialize(aString, nameValue.getDataOutput());
            for (int source : keySourceIndicator) {
                itemValue.reset();
                aInt8.setValue((byte) source);
                int8Serde.serialize(aInt8, itemValue.getDataOutput());
                listBuilder.addItem(itemValue);
            }
            fieldValue.reset();
            listBuilder.write(fieldValue.getDataOutput(), true);
            internalRecordBuilder.addField(nameValue, fieldValue);
        }

        internalRecordBuilder.write(out, true);
    }

    protected void writePropertyTypeRecord(String name, String value, DataOutput out, ARecordType recordType)
            throws HyracksDataException {
        IARecordBuilder propertyRecordBuilder = new RecordBuilder();
        ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
        propertyRecordBuilder.reset(recordType);
        AMutableString aString = new AMutableString("");
        @SuppressWarnings("unchecked")
        ISerializerDeserializer<AString> stringSerde =
                SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ASTRING);

        // write field 0
        fieldValue.reset();
        aString.setValue(name);
        stringSerde.serialize(aString, fieldValue.getDataOutput());
        propertyRecordBuilder.addField(0, fieldValue);

        // write field 1
        fieldValue.reset();
        aString.setValue(value);
        stringSerde.serialize(aString, fieldValue.getDataOutput());
        propertyRecordBuilder.addField(1, fieldValue);

        propertyRecordBuilder.write(out, true);
    }

}

redpajama_set_name: RedPajamaGithub


text:
/**
 * @fileoverview
 * Registers a language handler for VHDL '93.
 *
 * Based on the lexical grammar and keywords at
 * http://www.iis.ee.ethz.ch/~zimmi/download/vhdl93_syntax.html
 *
 * @author benoit@ryder.fr
 */

SyntaxHighligher.register('vhdl vhd', [
	// Whitespace
	['plain', /^[\t\n\r \xA0]+/, '\t\n\r \xA0'],
	// String, character or bit string
	['string', /^(?:[BOX]?"(?:[^\"]|"")*"|'.')/i],
	// Comment, from two dashes until end of line.
	['comment', /^--[^\r\n]*/],
	['keyword', /^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i],
	// Type, predefined or standard
	['type', /^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i],
	// Predefined attributes
	['type', /^\'(?:ACTIVE|ASCENDING|BASE|DELAYED|DRIVING|DRIVING_VALUE|EVENT|HIGH|IMAGE|INSTANCE_NAME|LAST_ACTIVE|LAST_EVENT|LAST_VALUE|LEFT|LEFTOF|LENGTH|LOW|PATH_NAME|POS|PRED|QUIET|RANGE|REVERSE_RANGE|RIGHT|RIGHTOF|SIMPLE_NAME|STABLE|SUCC|TRANSACTION|VAL|VALUE)(?=[^\w-]|$)/i, null],
	// Number, decimal or based literal
	['literal', /^\d+(?:_\d+)*(?:#[\w\\.]+#(?:[+\-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:E[+\-]?\d+(?:_\d+)*)?)/i],
	// Identifier, basic or extended
	['plain', /^(?:[a-z]\w*|\\[^\\]*\\)/i],
	// Punctuation
	['punctuation', /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0\-\"\']*/]
]);


text:
package com.badlogic.gdx.graphics.g3d.loaders.g3d;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Mesh.VertexDataType;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.ModelLoaderHints;
import com.badlogic.gdx.graphics.g3d.loaders.KeyframedModelLoader;
import com.badlogic.gdx.graphics.g3d.loaders.StillModelLoader;
import com.badlogic.gdx.graphics.g3d.model.keyframe.Keyframe;
import com.badlogic.gdx.graphics.g3d.model.keyframe.KeyframedAnimation;
import com.badlogic.gdx.graphics.g3d.model.keyframe.KeyframedModel;
import com.badlogic.gdx.graphics.g3d.model.keyframe.KeyframedSubMesh;
import com.badlogic.gdx.graphics.g3d.model.still.StillModel;
import com.badlogic.gdx.graphics.g3d.model.still.StillSubMesh;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.FloatArray;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.IntArray;
import com.badlogic.gdx.utils.ObjectMap;

/** Class to import the G3D text format.
 * @author mzechner */
public class G3dtLoader {
	public static KeyframedModel loadKeyframedModel (FileHandle handle, boolean flipV) {
		return loadKeyframedModel(handle.read(), flipV);
	}

	public static StillModel loadStillModel (FileHandle handle, boolean flipV) {
		return loadStillModel(handle.read(), flipV);
	}

	static int lineNum = 0;
	static String line = null;

	public static StillModel loadStillModel (InputStream stream, boolean flipV) {
		BufferedReader in = new BufferedReader(new InputStreamReader(stream));

		lineNum = 1;
		try {
			String version = readString(in);
			if (!version.equals("g3dt-still-1.0")) throw new GdxRuntimeException("incorrect version");
			int numMeshes = readInt(in);
			StillSubMesh[] subMeshes = new StillSubMesh[numMeshes];
			for (int i = 0; i < numMeshes; i++) {
				subMeshes[i] = readStillSubMesh(in, flipV);
			}
			StillModel model = new StillModel(subMeshes);
			return model;
		} catch (Throwable e) {
			throw new GdxRuntimeException("Couldn't read keyframed model, error in line " + lineNum + ", '" + line + "' : "
				+ e.getMessage(), e);
		}
	}

	private static StillSubMesh readStillSubMesh (BufferedReader in, boolean flipV) throws IOException {
		String name = readString(in);
		IntArray indices = readFaces(in);
		int numVertices = readInt(in);
		int numAttributes = readInt(in);

		if (!readString(in).equals("position")) throw new GdxRuntimeException("first attribute must be position.");
		int numUvs = 0;
		boolean hasNormals = false;
		for (int i = 1; i < numAttributes; i++) {
			String attributeType = readString(in);

			if (!attributeType.equals("normal") && !attributeType.equals("uv"))
				throw new GdxRuntimeException("attribute name must be normal or uv");

			if (attributeType.equals("normal")) {
				if (i != 1) throw new GdxRuntimeException("attribute normal must be second attribute");
				hasNormals = true;
			}
			if (attributeType.equals("uv")) {
				numUvs++;
			}
		}
		VertexAttribute[] vertexAttributes = createVertexAttributes(hasNormals, numUvs);
		int vertexSize = new VertexAttributes(vertexAttributes).vertexSize / 4;
		float[] vertices = new float[numVertices * vertexSize];
		int idx = 0;
		int uvOffset = hasNormals ? 6 : 3;
		for (int i = 0; i < numVertices; i++) {
			readFloatArray(in, vertices, idx);
			if (flipV) {
				for (int j = idx + uvOffset + 1; j < idx + uvOffset + numUvs * 2; j += 2) {
					vertices[j] = 1 - vertices[j];
				}
			}
			idx += vertexSize;
		}

		Mesh mesh = new Mesh(true, numVertices, indices.size, vertexAttributes);
		mesh.setVertices(vertices);
		mesh.setIndices(convertToShortArray(indices));
		return new StillSubMesh(name, mesh, GL10.GL_TRIANGLES);
	}

	public static KeyframedModel loadKeyframedModel (InputStream stream, boolean flipV) {
		BufferedReader in = new BufferedReader(new InputStreamReader(stream));

		lineNum = 1;
		try {
			String version = readString(in);
			if (!version.equals("g3dt-keyframed-1.0")) throw new GdxRuntimeException("incorrect version");
			int numMeshes = readInt(in);
			KeyframedSubMesh[] subMeshes = new KeyframedSubMesh[numMeshes];
			for (int i = 0; i < numMeshes; i++) {
				subMeshes[i] = readMesh(in, flipV);
			}
			KeyframedModel model = new KeyframedModel(subMeshes);
			model.setAnimation(model.getAnimations()[0].name, 0, false);
			return model;
		} catch (Throwable e) {
			throw new GdxRuntimeException("Couldn't read keyframed model, error in line " + lineNum + ", '" + line + "' : "
				+ e.getMessage(), e);
		}
	}

	private static KeyframedSubMesh readMesh (BufferedReader in, boolean flipV) throws IOException {
		String name = readString(in);
		IntArray indices = readFaces(in);
		int numVertices = readInt(in);
		int numAttributes = readInt(in);

		if (!readString(in).equals("position")) throw new GdxRuntimeException("first attribute must be position.");
		Array<FloatArray> uvSets = new Array<FloatArray>();
		boolean hasNormals = false;
		for (int i = 1; i < numAttributes; i++) {
			String attributeType = readString(in);

			if (!attributeType.equals("normal") && !attributeType.equals("uv"))
				throw new GdxRuntimeException("attribute name must be normal or uv");

			if (attributeType.equals("normal")) {
				if (i != 1) throw new GdxRuntimeException("attribute normal must be second attribute");
				hasNormals = true;
			}
			if (attributeType.equals("uv")) {
				uvSets.add(readUVSet(in, numVertices, flipV));
			}
		}
		int animatedComponents = hasNormals ? 6 : 3;

		VertexAttribute[] vertexAttributes = createVertexAttributes(hasNormals, uvSets.size);

		int numAnimations = readInt(in);
		ObjectMap<String, KeyframedAnimation> animations = new ObjectMap<String, KeyframedAnimation>(numAnimations);
		for (int i = 0; i < numAnimations; i++) {
			String animationName = readString(in);
			int numKeyframes = readInt(in);
			float frameDuration = readFloat(in); // in seconds

			Keyframe[] keyframes = new Keyframe[numKeyframes];
			float time = 0;
			FloatArray vertex = new FloatArray(animatedComponents);
			for (int frame = 0; frame < numKeyframes; frame++) {
				float[] vertices = new float[numVertices * (animatedComponents)];
				int idx = 0;
				for (int j = 0; j < numVertices; j++) {
					idx = readFloatArray(in, vertices, idx);
				}
				Keyframe keyframe = new Keyframe(time, vertices);
				keyframes[frame] = keyframe;
				time += frameDuration;
			}

			KeyframedAnimation animation = new KeyframedAnimation(animationName, frameDuration, keyframes);
			animations.put(animationName, animation);
		}

		KeyframedSubMesh mesh = new KeyframedSubMesh(name, new Mesh(VertexDataType.VertexArray, false, numVertices, indices.size,
			createVertexAttributes(hasNormals, uvSets.size)), buildVertices(numVertices, hasNormals, uvSets), animations,
			animatedComponents, GL10.GL_TRIANGLES);
		mesh.mesh.setIndices(convertToShortArray(indices));
		mesh.mesh.setVertices(mesh.blendedVertices);
		return mesh;
	}

	private static float[] buildVertices (int numVertices, boolean hasNormals, Array<FloatArray> uvSets) {
		float[] vertices = new float[numVertices * (3 + (hasNormals ? 3 : 0) + uvSets.size * 2)];

		int idx = 0;
		int idxUv = 0;
		for (int i = 0; i < numVertices; i++) {
			vertices[idx++] = 0;
			vertices[idx++] = 0;
			vertices[idx++] = 0;
			if (hasNormals) {
				vertices[idx++] = 0;
				vertices[idx++] = 0;
				vertices[idx++] = 0;
			}
			for (int j = 0; j < uvSets.size; j++) {
				vertices[idx++] = uvSets.get(j).get(idxUv);
				vertices[idx++] = uvSets.get(j).get(idxUv + 1);
			}
			idxUv += 2;
		}
		return vertices;
	}

	private static VertexAttribute[] createVertexAttributes (boolean hasNormals, int uvs) {
		VertexAttribute[] attributes = new VertexAttribute[1 + (hasNormals ? 1 : 0) + uvs];
		int idx = 0;
		attributes[idx++] = new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE);
		if (hasNormals) attributes[idx++] = new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE);
		for (int i = 0; i < uvs; i++) {
			attributes[idx++] = new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + i);
		}
		return attributes;
	}

	private static FloatArray readUVSet (BufferedReader in, int numVertices, boolean flipV) throws IOException {
		FloatArray uvSet = new FloatArray(numVertices * 2);
		FloatArray uv = new FloatArray(2);
		for (int i = 0; i < numVertices; i++) {
			readFloatArray(in, uv);
			uvSet.add(uv.items[0]);
			uvSet.add(flipV ? 1 - uv.items[1] : uv.items[1]);
		}
		return uvSet;
	}

	private static IntArray readFaces (BufferedReader in) throws NumberFormatException, IOException {
		int numFaces = readInt(in);
		IntArray faceIndices = new IntArray();
		IntArray triangles = new IntArray();
		IntArray indices = new IntArray();

		for (int face = 0; face < numFaces; face++) {
			readIntArray(in, faceIndices);
			int numIndices = faceIndices.get(0);
			triangles.clear();
			int baseIndex = faceIndices.get(1);
			for (int i = 2; i < numIndices; i++) {
				triangles.add(baseIndex);
				triangles.add(faceIndices.items[i]);
				triangles.add(faceIndices.items[i + 1]);
			}
			indices.addAll(triangles);
		}

		indices.shrink();
		return indices;
	}

	private static short[] convertToShortArray (IntArray array) {
		short[] shortArray = new short[array.size];
		for (int i = 0; i < array.size; i++) {
			shortArray[i] = (short)array.items[i];
		}
		return shortArray;
	}

	private static float readFloat (BufferedReader in) throws NumberFormatException, IOException {
		lineNum++;
		return Float.parseFloat(read(in).trim());
	}

	private static int readInt (BufferedReader in) throws NumberFormatException, IOException {
		lineNum++;
		return (int)(Math.floor(Float.parseFloat(read(in).trim())));
	}

	private static String readString (BufferedReader in) throws IOException {
		lineNum++;
		return read(in);
	}

	private static void readFloatArray (BufferedReader in, FloatArray array) throws IOException {
		lineNum++;
		String[] tokens = read(in).split(",");
		int len = tokens.length;
		array.clear();
		for (int i = 0; i < len; i++) {
			array.add(Float.parseFloat(tokens[i].trim()));
		}
	}

	private static int readFloatArray (BufferedReader in, float[] array, int idx) throws IOException {
		lineNum++;
		String[] tokens = read(in).split(",");
		int len = tokens.length;
		for (int i = 0; i < len; i++) {
			array[idx++] = Float.parseFloat(tokens[i].trim());
		}
		return idx;
	}

	private static void readIntArray (BufferedReader in, IntArray array) throws IOException {
		String[] tokens = read(in).split(",");
		int len = tokens.length;
		array.clear();
		for (int i = 0; i < len; i++) {
			array.add(Integer.parseInt(tokens[i].trim()));
		}
	}

	private static String read (BufferedReader in) throws IOException {
		line = in.readLine();
		return line;
	}

	public static class G3dtStillModelLoader implements StillModelLoader {

		@Override
		public StillModel load (FileHandle handle, ModelLoaderHints hints) {
			return G3dtLoader.loadStillModel(handle, hints.flipV);
		}
	}

	public static class G3dtKeyframedModelLoader implements KeyframedModelLoader {
		@Override
		public KeyframedModel load (FileHandle handle, ModelLoaderHints hints) {
			return G3dtLoader.loadKeyframedModel(handle, hints.flipV);
		}
	}
}


text:
using UnityEngine;
using System.Collections;

public class Flashlight : Photon.MonoBehaviour {

	public Light l;
	public Camera cam;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
		if(Input.GetButtonDown("Flashlight")) {
			l.enabled = !l.enabled;
		}
		l.transform.rotation = cam.transform.rotation;
	}

	protected virtual void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
		if (stream.isWriting) {
			stream.SendNext (l.enabled);
		} else if (stream.isReading) {
			l.enabled = (bool)stream.ReceiveNext ();
		}
	}
}


text:
extern crate csv;

use super::determinant_values;
use super::enums;
use super::movedex;
use super::moves;
use super::natures;
use super::pokemon_model;
use super::stats;
use std::collections::HashMap;

/// Represents a single Token of a Pokemon with individual values for this token.
#[derive(Debug, Clone)]
pub struct PokemonToken {
    pokedex_id: usize,
    name: String,
    level: u16,
    height: u8,
    weight: u16,
    gender: enums::Gender,
    type_one: enums::Types,
    type_two: enums::Types,
    non_volatile_status: (enums::NonVolatile, u8),
    move_one: Option<(moves::Technique, u8)>,
    move_two: Option<(moves::Technique, u8)>,
    move_three: Option<(moves::Technique, u8)>,
    move_four: Option<(moves::Technique, u8)>,
    nature: natures::Nature,
    dv: determinant_values::Dv,
    base_stats: stats::Stats,
    current_stats: stats::Stats,
    choose_flags: HashMap<enums::Choose, u8>,
    resolve_flags: HashMap<enums::Resolve, u8>,
    fight_flags: HashMap<enums::Fighting, u8>,
    end_of_turn_flags: HashMap<enums::EndOfTurn, u8>,
    description: String,
    mega_evolution: Option<pokemon_model::PokemonModel>,
}

impl PokemonToken {
    /// Provides a Pokemon Token from a given model.
    pub fn from_model(model: pokemon_model::PokemonModel) -> PokemonToken {
        let level = 50;
        let dv = determinant_values::Dv::get_dvs();
        let nature = natures::Nature::get_random_nature();
        let stats = stats::Stats::calculate_stats(model.clone(), dv.clone(), nature.clone(), level);

        PokemonToken {
            pokedex_id: model.get_id(),
            name: model.get_name(),
            level: level,
            height: model.get_height(),
            weight: model.get_weight(),
            gender: enums::get_gender(model.clone().get_gender_rate()),
            type_one: model.get_types().0,
            type_two: model.get_types().1,
            non_volatile_status: (enums::NonVolatile::Undefined, 0),
            move_one: None,
            move_two: None,
            move_three: None,
            move_four: None,
            nature: nature,
            dv: dv,
            base_stats: stats.clone(),
            current_stats: stats,
            choose_flags: HashMap::new(),
            resolve_flags: HashMap::new(),
            fight_flags: HashMap::new(),
            end_of_turn_flags: HashMap::new(),
            description: model.get_description(),
            mega_evolution: model.get_mega(),
        }
    }
    // Getter methods
    //
    /// Gets all possible moves the pokemon can learn
    pub fn get_moves(&self, dex: movedex::Movedex) -> movedex::Movedex {
        dex.for_token(self.get_level(), self.pokedex_id)
    }
    /// Gets the pokedex id
    pub fn get_id(&self) -> usize {
        self.pokedex_id
    }
    /// Gets the name
    pub fn get_name(&self) -> String {
        self.name.clone()
    }
    /// Gets the current level
    pub fn get_level(&self) -> u16 {
        self.level
    }
    pub fn get_weight(&self) -> u16 {
        self.weight
    }
    /// Gets the current gender
    pub fn get_gender(&self) -> enums::Gender {
        self.gender.clone()
    }
    /// Gets the current types
    pub fn get_types(&self) -> (enums::Types, enums::Types) {
        (self.type_one.clone(), self.type_two.clone())
    }
    /// Gets the current nature
    pub fn get_nature(&self) -> natures::Nature {
        self.nature.clone()
    }
    /// Gets the actual non volatile status and the amount of rounds the pokemon is holding it
    pub fn get_non_volatile(&self) -> (enums::NonVolatile, u8) {
        self.non_volatile_status.clone()
    }
    /// Gets the list of the determinant values
    pub fn get_dv(&self) -> determinant_values::Dv {
        self.dv.clone()
    }
    /// Gets the current stats
    pub fn get_current(&mut self) -> &mut stats::Stats {
        &mut self.current_stats
    }
    /// Gets the base stats for the level and all other influeces
    pub fn get_base(&self) -> stats::Stats {
        self.base_stats.clone()
    }

    pub fn get_choose_flags(&mut self) -> &mut HashMap<enums::Choose, u8> {
        &mut self.choose_flags
    }

    pub fn get_resolve_flags(&mut self) -> &mut HashMap<enums::Resolve, u8> {
        &mut self.resolve_flags
    }

    pub fn get_fight_flags(&mut self) -> &mut HashMap<enums::Fighting, u8> {
        &mut self.fight_flags
    }

    /// Gets the list of end of turn flags
    pub fn get_end_of_turn_flags(&mut self) -> &mut HashMap<enums::EndOfTurn, u8> {
        &mut self.end_of_turn_flags
    }
    /// Gets the description of the pokemon which also can be read by the user of the program
    pub fn get_description(&self) -> String {
        self.description.clone()
    }
    /// Gets the mega evolution
    pub fn get_mega(&self) -> Option<PokemonToken> {
        if self.mega_evolution.is_some() {
            return Some(PokemonToken::from_model(self.mega_evolution.clone().unwrap()));
        }
        None
    }
    /// Getter function for move one. If the move is set, the function returns it, if not,
    /// it returns None
    pub fn get_move_one(self) -> Option<moves::Technique> {
        self.move_one.map(|x| x.0)
    }
    /// Getter function for move two. If the move is set, the function returns it, if not,
    /// it returns None
    pub fn get_move_two(self) -> Option<moves::Technique> {
        self.move_two.map(|x| x.0)
    }
    /// Getter function for move three. If the move is set, the function returns it, if not,
    /// it returns None
    pub fn get_move_three(self) -> Option<moves::Technique> {
        self.move_three.map(|x| x.0)
    }
    /// Getter function for move four. If the move is set, the function returns it, if not,
    /// it returns None
    pub fn get_move_four(self) -> Option<moves::Technique> {
        self.move_four.map(|x| x.0)
    }
    // Setter methods
    //
    /// Sets the non volatile status initial
    pub fn set_non_volatile(&mut self, status: enums::NonVolatile) {
        self.non_volatile_status = (status, 0);
    }

    /// Sets the moves to the pokemon
    pub fn set_moves(&mut self, moves: Vec<moves::Technique>) {
        if moves.len() > 0 {
            self.move_one = Some((moves[0].clone(), moves[0].get_power_points().unwrap()));
        }
        if moves.len() > 1 {
            self.move_two = Some((moves[1].clone(), moves[1].get_power_points().unwrap()));
        }
        if moves.len() > 2 {
            self.move_three = Some((moves[2].clone(), moves[2].get_power_points().unwrap()));
        }
        if moves.len() > 3 {
            self.move_four = Some((moves[3].clone(), moves[3].get_power_points().unwrap()));
        }
    }

    /// Sets the type of the pokemon
    pub fn set_type(&mut self, position: u8, change: enums::Types) {
        match position {
            0 => self.type_one = change,
            1 => self.type_two = change,
            _ => unreachable!(),
        }
    }
    // Other methods
    //
    /// Adds an end of turn flag
    pub fn add_end_flag(&mut self, flag: enums::EndOfTurn) {
        self.end_of_turn_flags.insert(flag, 0);
    }
    pub fn add_choose_flag(&mut self, flag: enums::Choose) {
        self.choose_flags.insert(flag, 0);
    }
    pub fn add_resolve_flag(&mut self, flag: enums::Resolve) {
        self.resolve_flags.insert(flag, 0);
    }
    pub fn add_fight_flag(&mut self, flag: enums::Fighting) {
        self.fight_flags.insert(flag, 0);
    }
    /// Checks if the pokemon is asleep
    pub fn is_asleep(&self) -> bool {
        self.non_volatile_status.0 == enums::NonVolatile::Sleep
    }
    /// Checks if the pokemon is alive
    pub fn is_alive(&mut self) -> bool {
        self.get_current().get_stat(&enums::Stats::Hp) > 0
    }
    /// Increments the Non Volatile Counter
    pub fn increment_non_volatile(&mut self) {
        self.non_volatile_status.1 += 1;
    }
    /// Decrements the AP
    pub fn decrement_ap(&mut self) {
        unimplemented!();
    }
}


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

export default class Like extends Component{
  static propTypes = {
    likeCount: PropTypes.number,
    isLike: PropTypes.bool,
    toggleLike: PropTypes.func.isRequired
  }
  render(){
    const {likeCount,isLike,toggleLike} = this.props
    return(

                喜欢

            {likeCount}

    )
  }
}


text:
package org.apache.commons.cli.bug;

import org.apache.commons.cli.*;
import org.junit.Test;

public class BugCLI252Test extends DefaultParserTest {

    @Test
    public void testExactOptionNameMatch() throws ParseException {
        new DefaultParser().parse(getOptions(), new String[]{"--prefix"});
    }

    @Test(expected = AmbiguousOptionException.class)
    public void testAmbiquousOptionName() throws ParseException {
        new DefaultParser().parse(getOptions(), new String[]{"--pref"});
    }

    private Options getOptions() {
        Options options = new Options();
        options.addOption(Option.builder().longOpt("prefix").build());
        options.addOption(Option.builder().longOpt("prefixplusplus").build());
        return options;
    }

}


text:
function y=f(x)       % declares that this M-file is a function with name f and argument x
y = x.^3;                  %   define the formula of the function f.


text:
using System.Net.Http;
using SFA.DAS.EmployerAccounts.Configuration;
using SFA.DAS.EmployerAccounts.Interfaces;
using SFA.DAS.EmployerAccounts.Services;
using SFA.DAS.Http;
using SFA.DAS.NLog.Logger.Web.MessageHandlers;
using StructureMap;

namespace SFA.DAS.EmployerAccounts.DependencyResolution
{
    public class ProviderRegistrationApiClientRegistry : Registry
    {
        public ProviderRegistrationApiClientRegistry()
        {
            For<ProviderRegistrationClientApiConfiguration>().Use(c => c.GetInstance<EmployerAccountsConfiguration>().ProviderRegistrationsApi);
            For<IProviderRegistrationClientApiConfiguration>().Use(c => c.GetInstance<ProviderRegistrationClientApiConfiguration>());
            For<IProviderRegistrationApiClient>().Use<ProviderRegistrationApiClient>()
                .Ctor<HttpClient>().Is(c => CreateClient(c));
        }

        private HttpClient CreateClient(IContext context)
        {
            HttpClient httpClient = new HttpClientBuilder()
                    .WithHandler(new RequestIdMessageRequestHandler())
                    .WithHandler(new SessionIdMessageRequestHandler())
                    .WithDefaultHeaders()
                    .Build();

            return httpClient;
        }
    }
}


text:
class CreateFeedbacks < ActiveRecord::Migration
  def change
    create_table :feedbacks do |t|
      t.text :text, null: false
      t.string :feedback_type, null: false
      t.integer :application_id, null: false
      t.string :email
      t.string :user_name

      t.timestamps null: false
    end
  end
end


text:
@implementation RCDataBaseManager

static NSString * const userTableName = @"USERTABLE";
static NSString * const groupTableName = @"GROUPTABLE";
static NSString * const friendTableName = @"FRIENDTABLE";

+ (RCDataBaseManager*)shareInstance
{
    static RCDataBaseManager* instance = nil;
    static dispatch_once_t predicate;
    dispatch_once(&predicate, ^{
        instance = [[[self class] alloc] init];
        [instance CreateUserTable];
    });
    return instance;
}

//创建用户存储表
-(void)CreateUserTable
{
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        if (![DBHelper isTableOK: userTableName withDB:db]) {
            NSString *createTableSQL = @"CREATE TABLE USERTABLE (id integer PRIMARY KEY autoincrement, userid text,name text, portraitUri text)";
            [db executeUpdate:createTableSQL];
            NSString *createIndexSQL=@"CREATE unique INDEX idx_userid ON USERTABLE(userid);";
            [db executeUpdate:createIndexSQL];
        }
        if (![DBHelper isTableOK: groupTableName withDB:db]) {
            NSString *createTableSQL = @"CREATE TABLE GROUPTABLE (id integer PRIMARY KEY autoincrement, userid text,name text, portraitUri text)";
            [db executeUpdate:createTableSQL];
            NSString *createIndexSQL=@"CREATE unique INDEX idx_userid ON GROUPTABLE(userid);";
            [db executeUpdate:createIndexSQL];
        }
        if (![DBHelper isTableOK: friendTableName withDB:db]) {
            NSString *createTableSQL = @"CREATE TABLE FRIENDTABLE (id integer PRIMARY KEY autoincrement, userid text,name text, portraitUri text)";
            [db executeUpdate:createTableSQL];
            NSString *createIndexSQL=@"CREATE unique INDEX idx_userid ON FRIENDTABLE(userid);";
            [db executeUpdate:createIndexSQL];
        }
    }];

}

//存储用户信息
-(void)insertUserToDB:(RCUserInfo*)user
{
    NSString *insertSql = @"REPLACE INTO USERTABLE (userid, name, portraitUri) VALUES (?, ?, ?)";
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:insertSql,user.userId,user.name,user.portraitUri];
    }];

}
//从表中获取用户信息
-(RCUserInfo*) getUserByUserId:(NSString*)userId
{
    __block RCUserInfo *model = nil;
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        FMResultSet *rs = [db executeQuery:@"SELECT * FROM USERTABLE where userid = ?",userId];
        while ([rs next]) {
            model = [[RCUserInfo alloc] init];
            model.userId = [rs stringForColumn:@"userid"];
            model.name = [rs stringForColumn:@"name"];
            model.portraitUri = [rs stringForColumn:@"portraitUri"];
        }
        [rs close];
    }];
    return model;
}

//从表中获取所有用户信息
-(NSArray *) getAllUserInfo
{
    NSMutableArray *allUsers = [NSMutableArray new];
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        FMResultSet *rs = [db executeQuery:@"SELECT * FROM USERTABLE"];
        while ([rs next]) {
            RCUserInfo *model;
            model = [[RCUserInfo alloc] init];
            model.userId = [rs stringForColumn:@"userid"];
            model.name = [rs stringForColumn:@"name"];
            model.portraitUri = [rs stringForColumn:@"portraitUri"];
            [allUsers addObject:model];
        }
        [rs close];
    }];
    return allUsers;
}
//存储群组信息
-(void)insertGroupToDB:(RCGroup *)group
{
    NSString *insertSql = @"REPLACE INTO GROUPTABLE (userid, name, portraitUri) VALUES (?, ?, ?)";
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:insertSql,group.groupId, group.groupName,group.portraitUri];
    }];

}
//从表中获取群组信息
-(RCGroup*) getGroupByGroupId:(NSString*)groupId
{
    __block RCGroup *model = nil;
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        FMResultSet *rs = [db executeQuery:@"SELECT * FROM GROUPTABLE where userid = ?",groupId];
        while ([rs next]) {
            model = [[RCGroup alloc] init];
            model.groupId = [rs stringForColumn:@"userid"];
            model.groupName = [rs stringForColumn:@"name"];
            model.portraitUri = [rs stringForColumn:@"portraitUri"];
        }
        [rs close];
    }];
    return model;
}

//从表中获取所有群组信息
-(NSArray *) getAllGroup
{
    NSMutableArray *allUsers = [NSMutableArray new];
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        FMResultSet *rs = [db executeQuery:@"SELECT * FROM GROUPTABLE"];
        while ([rs next]) {
            RCGroup *model;
            model = [[RCGroup alloc] init];
            model.groupId = [rs stringForColumn:@"userid"];
            model.groupName = [rs stringForColumn:@"name"];
            model.portraitUri = [rs stringForColumn:@"portraitUri"];
            [allUsers addObject:model];
        }
        [rs close];
    }];
    return allUsers;
}

-(BOOL)checkFriendExist:(NSString *)userID
{
    NSString *sql10 = [NSString stringWithFormat:
                       @"SELECT count(*) FROM FRIENDTABLE where ([userid] = '%@')",userID];
    __block BOOL flag = NO;

    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        FMResultSet *rs = [db executeQuery:sql10];
        while ([rs next]) {

            NSString *userid = [rs stringForColumn:@"userid"];
            if (userid && ![userid isEqualToString:@""]) {
                flag = YES;
            }
        }
        [rs close];
    }];

    return flag;

}

//存储好友信息
-(void)insertFriendToDB:(RCUserInfo *)friend
{
    NSString *insertSql = @"REPLACE INTO FRIENDTABLE (userid, name, portraitUri) VALUES (?, ?, ?)";
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:insertSql,friend.userId, friend.name, friend.portraitUri];
    }];
}

//从表中获取所有好友信息 //RCUserInfo
-(NSArray *) getAllFriends
{
    NSMutableArray *allUsers = [NSMutableArray new];
    FMDatabaseQueue *queue = [DBHelper getDatabaseQueue];
    [queue inDatabase:^(FMDatabase *db) {
        FMResultSet *rs = [db executeQuery:@"SELECT * FROM FRIENDTABLE"];
        while ([rs next]) {
            RCUserInfo *model;
            model = [[RCUserInfo alloc] init];
            model.userId = [rs stringForColumn:@"userid"];
            model.name = [rs stringForColumn:@"name"];
            model.portraitUri = [rs stringForColumn:@"portraitUri"];
            [allUsers addObject:model];
        }
        [rs close];
    }];
    return allUsers;
}
@end


text:
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Threading;
using LiteDB.Sync.Exceptions;
using Microsoft.Graph;
using Microsoft.Identity.Client;

namespace LiteDb.Sync.OneDrive
{
    using System;
    using System.Threading.Tasks;
    using LiteDB.Sync;

    public class OneDriveCloudProvider : ILiteSyncCloudProvider
    {
        private static readonly string[] Scopes = { "Files.ReadWrite.AppFolder" };

        private const string Authority = "https://login.microsoftonline.com/common/v2.0";
        private const string HeadFileName = "Sync.head";
        private const string PatchFileNameFormat = "Changes/{0:N}.patch";

        private string userToken;
        private DateTimeOffset userTokenExpiration;
        private GraphServiceClient graphClient;

        private readonly PublicClientApplication clientApp;

        public OneDriveCloudProvider(string clientId, string clientSecret)
        {

            //this.clientApp = new ConfidentialClientApplication(clientId, Authority, new ClientCredential(clientSecret), null, null);
            //}
            //else
            //{

            this.clientApp = new PublicClientApplication(clientId, Authority, new TokenCache());

            //}
        }

        public async Task<Stream> DownloadInitFile(CancellationToken ct)
        {
            this.EnsureClient();

            var driveItem = await this.graphClient.Me.Drive.Special.AppRoot
                .ItemWithPath(HeadFileName)
                .Request()
                .GetAsync(ct);

            return driveItem.Content;
        }

        public async Task UploadInitFile(Stream contents)
        {
            this.EnsureClient();

            var driveItem = new DriveItem();
            driveItem.Content = contents;

            await this.graphClient.Me.Drive.Special.AppRoot
                      .ItemWithPath(HeadFileName)
                      .Request()
                      .UpdateAsync(driveItem);
        }

        public async Task<Stream> DownloadPatchFile(string id, CancellationToken ct)
        {
            this.EnsureClient();

            var fileName = string.Format(PatchFileNameFormat, id);

            var driveItem = await this.graphClient.Me.Drive.Special.AppRoot
                                      .ItemWithPath(fileName)
                                      .Request()
                                      .GetAsync(ct);

            return driveItem.Content;
        }

        public async Task UploadPatchFile(string id, Stream contents)
        {
            this.EnsureClient();

            var fileName = string.Format(PatchFileNameFormat, id);

            var driveItem = new DriveItem();
            driveItem.Content = contents;

            await this.graphClient.Me.Drive.Special.AppRoot
                      .ItemWithPath(fileName)
                      .Request()
                      .UpdateAsync(driveItem);
        }

        public async Task ClearAppDirectory()
        {
            this.EnsureClient();

            var children = await this.graphClient.Drive.Special.AppRoot.Children.Request().GetAsync();

            foreach (var child in children)
            {
                if (!string.IsNullOrEmpty(child.Deleted.State))
                {
                    await this.graphClient.Drive.Items[child.Id].Request().DeleteAsync();
                }
            }
        }

        // TODO: Wrap exceptions in individual methods
        private void EnsureClient()
        {
            this.graphClient = new GraphServiceClient(
                "https://graph.microsoft.com/v1.0",
                new DelegateAuthenticationProvider(
                    async requestMessage =>
                    {
                        var token = await this.GetUserToken();
                        Console.WriteLine(token);
                        requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    }));
        }

        private async Task<string> GetUserToken()
        {
            try
            {
                if (this.userToken == null || this.userTokenExpiration <= DateTimeOffset.UtcNow.AddMinutes(5))
                {
                    try
                    {
                        var authResult =
                            await this.clientApp.AcquireTokenSilentAsync(Scopes, this.clientApp.Users.FirstOrDefault());

                        this.userToken = authResult.AccessToken;
                        this.userTokenExpiration = authResult.ExpiresOn;
                    }
                    catch (MsalUiRequiredException)
                    {
                        var authResult = await this.clientApp.AcquireTokenAsync(Scopes);

                        this.userToken = authResult.AccessToken;
                        this.userTokenExpiration = authResult.ExpiresOn;
                    }
                }

                return this.userToken;
            }
            catch (Exception ex)
            {
                throw new LiteSyncCloudAuthFailedException(this.GetType(), ex);
            }
        }
    }
}


text:
namespace ozonewayland {

SurfaceOzoneWayland::SurfaceOzoneWayland(unsigned handle)
    : handle_(handle) {
}

SurfaceOzoneWayland::~SurfaceOzoneWayland() {
  WaylandDisplay::GetInstance()->DestroyWindow(handle_);
  WaylandDisplay::GetInstance()->FlushDisplay();
}

intptr_t SurfaceOzoneWayland::GetNativeWindow() {
  return WaylandDisplay::GetInstance()->GetNativeWindow(handle_);
}

bool SurfaceOzoneWayland::ResizeNativeWindow(
    const gfx::Size& viewport_size) {
  WaylandWindow* window = WaylandDisplay::GetInstance()->GetWindow(handle_);
  DCHECK(window);
  window->Resize(viewport_size.width(), viewport_size.height());
  return true;
}

bool SurfaceOzoneWayland::OnSwapBuffers() {
  return true;
}

scoped_ptr<gfx::VSyncProvider> SurfaceOzoneWayland::CreateVSyncProvider() {
  return scoped_ptr<gfx::VSyncProvider>(new gfx::WaylandSyncProvider());
}

}  // namespace ozonewayland


text:
package org.pentaho.di.ui.repository.repositoryexplorer;

public class ControllerInitializationException extends Exception {
  private static final long serialVersionUID = -2151267602926525247L;

  public ControllerInitializationException() {
    super();
  }

  public ControllerInitializationException(final String message) {
    super(message);
  }

  public ControllerInitializationException(final String message, final Throwable reas) {
    super(message, reas);
  }

  public ControllerInitializationException(final Throwable reas) {
    super(reas);
  }
}


text:
package com.evolveum.midpoint.web.page.admin.users;

import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.web.application.AuthorizationAction;
import com.evolveum.midpoint.web.application.PageDescriptor;

/**
 * @author lazyman
 */
@PageDescriptor(url = "/admin/users/contacts", action = {
        @AuthorizationAction(actionUri = PageAdminUsers.AUTH_USERS_ALL,
                label = PageAdminUsers.AUTH_USERS_ALL_LABEL,
                description = PageAdminUsers.AUTH_USERS_ALL_DESCRIPTION),
        @AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_CONTACTS_URL,
                label = "PageContacts.auth.contacts.label",
                description = "PageContacts.auth.contacts.description")})
public class PageContacts extends PageAdminUsers {

    private static final String ID_TABLE = "table";
    private static final String ID_TREE = "tree";

    public PageContacts() {
        initLayout();
    }

    private void initLayout() {
//        ITreeProvider<ContactTreeDto> provider = new ContactDataProvider();
//
//        NestedTree tree = new NestedTree<ContactTreeDto>(ID_TREE, provider) {
//
//            @Override
//            protected Component newContentComponent(String id, IModel model) {
//                ContactTreeDto dto = (ContactTreeDto) model.getObject();
//                if (dto instanceof ContactUserDto) {
//                    return new ContactUserPanel(id, model);
//                }
//
//                return new ContactOrgUnitPanel(id, model);
//            }
//        };
//        add(tree);
    }

}


text:
expose = require('expose.js').Server({port: 8080});

expose.exports.update = function(html) {
  var that = this;
  expose.forEachClient(function(api){
    if (that.id!==this.id) api.update(html);
  });
};

expose.start();


text:
<?php

namespace App;

use App\User;
use App\Sports;
use Illuminate\Database\Eloquent\Model;

class ProfessionalType extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    public $timestamps = false;

    protected $table = 'professional_type';
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>X509v2AttributeCertificateBuilder (Bouncy Castle Library 1.54 API Specification)</title>
<meta name="date" content="2015-12-29">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Bouncy Castle Cryptography Library 1.54

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.bouncycastle.cert

Class X509v2AttributeCertificateBuilder

java.lang.Object

org.bouncycastle.cert.X509v2AttributeCertificateBuilder

public class X509v2AttributeCertificateBuilder
extends java.lang.Object

class to produce an X.509 Version 2 AttributeCertificate.

Constructor Summary

Constructors

Constructor and Description

X509v2AttributeCertificateBuilder(AttributeCertificateHolder holder,
                                 AttributeCertificateIssuer issuer,
                                 java.math.BigInteger serialNumber,
                                 java.util.Date notBefore,
                                 java.util.Date notAfter)

Base constructor.

X509v2AttributeCertificateBuilder(AttributeCertificateHolder holder,
                                 AttributeCertificateIssuer issuer,
                                 java.math.BigInteger serialNumber,
                                 java.util.Date notBefore,
                                 java.util.Date notAfter,
                                 java.util.Locale dateLocale)

Base constructor with locale for interpreting dates.

Method Summary

Methods

Modifier and Type
Method and Description

X509v2AttributeCertificateBuilder
addAttribute(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType,
            org.bouncycastle.asn1.ASN1Encodable attrValue)

Add an attribute to the certification request we are building.

X509v2AttributeCertificateBuilder
addAttribute(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType,
            org.bouncycastle.asn1.ASN1Encodable[] attrValues)

Add an attribute with multiple values to the certification request we are building.

X509v2AttributeCertificateBuilder
addExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid,
            boolean isCritical,
            org.bouncycastle.asn1.ASN1Encodable value)

Add a given extension field for the standard extensions tag made up of the passed in parameters.

X509v2AttributeCertificateBuilder
addExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid,
            boolean isCritical,
            byte[] encodedValue)

Add a given extension field for the standard extensions using a byte encoding of the
 extension value.

X509v2AttributeCertificateBuilder
addExtension(org.bouncycastle.asn1.x509.Extension extension)

Add a given extension field for the standard extensions.

X509AttributeCertificateHolder
build(ContentSigner signer)

Generate an X509 certificate, based on the current issuer and subject
 using the passed in signer.

void
setIssuerUniqueId(boolean[] iui)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

X509v2AttributeCertificateBuilder

public X509v2AttributeCertificateBuilder(AttributeCertificateHolder holder,
                                 AttributeCertificateIssuer issuer,
                                 java.math.BigInteger serialNumber,
                                 java.util.Date notBefore,
                                 java.util.Date notAfter)

Base constructor.

Parameters:

holder - holder certificate details

issuer - issuer of this attribute certificate.

serialNumber - serial number of this attribute certificate.

notBefore - the date before which the certificate is not valid.

notAfter - the date after which the certificate is not valid.

X509v2AttributeCertificateBuilder

public X509v2AttributeCertificateBuilder(AttributeCertificateHolder holder,
                                 AttributeCertificateIssuer issuer,
                                 java.math.BigInteger serialNumber,
                                 java.util.Date notBefore,
                                 java.util.Date notAfter,
                                 java.util.Locale dateLocale)

Base constructor with locale for interpreting dates. You may need to use this constructor if the default locale
 doesn't use a Gregorian calender so that the GeneralizedTime produced is compatible with other ASN.1 implementations.

Parameters:

holder - holder certificate details

issuer - issuer of this attribute certificate.

serialNumber - serial number of this attribute certificate.

notBefore - the date before which the certificate is not valid.

notAfter - the date after which the certificate is not valid.

dateLocale - locale to be used for date interpretation.

Method Detail

addAttribute

public X509v2AttributeCertificateBuilder addAttribute(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType,
                                             org.bouncycastle.asn1.ASN1Encodable attrValue)

Add an attribute to the certification request we are building.

Parameters:

attrType - the OID giving the type of the attribute.

attrValue - the ASN.1 structure that forms the value of the attribute.

Returns:

this builder object.

addAttribute

public X509v2AttributeCertificateBuilder addAttribute(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType,
                                             org.bouncycastle.asn1.ASN1Encodable[] attrValues)

Add an attribute with multiple values to the certification request we are building.

Parameters:

attrType - the OID giving the type of the attribute.

attrValues - an array of ASN.1 structures that form the value of the attribute.

Returns:

this builder object.

setIssuerUniqueId

public void setIssuerUniqueId(boolean[] iui)

addExtension

public X509v2AttributeCertificateBuilder addExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid,
                                             boolean isCritical,
                                             org.bouncycastle.asn1.ASN1Encodable value)
                                               throws CertIOException

Add a given extension field for the standard extensions tag made up of the passed in parameters.

Parameters:

oid - the OID defining the extension type.

isCritical - true if the extension is critical, false otherwise.

value - the ASN.1 structure that forms the extension's value.

Returns:

this builder object.

Throws:

CertIOException

addExtension

public X509v2AttributeCertificateBuilder addExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier oid,
                                             boolean isCritical,
                                             byte[] encodedValue)
                                               throws CertIOException

Add a given extension field for the standard extensions using a byte encoding of the
 extension value.

Parameters:

oid - the OID defining the extension type.

isCritical - true if the extension is critical, false otherwise.

encodedValue - a byte array representing the encoding of the extension value.

Returns:

this builder object.

Throws:

CertIOException

addExtension

public X509v2AttributeCertificateBuilder addExtension(org.bouncycastle.asn1.x509.Extension extension)
                                               throws CertIOException

Add a given extension field for the standard extensions.

Parameters:

extension - the full extension value.

Returns:

this builder object.

Throws:

CertIOException

build

public X509AttributeCertificateHolder build(ContentSigner signer)

Generate an X509 certificate, based on the current issuer and subject
 using the passed in signer.

Parameters:

signer - the content signer to be used to generate the signature validating the certificate.

Returns:

a holder containing the resulting signed certificate.

Overview

Package

Class

Tree

Deprecated

Index

Help

Bouncy Castle Cryptography Library 1.54

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method