text:
@interface tabPage : NSObject {
	struct singleChildConstraints constraints;
	int margined;
	NSView *view;		// the NSTabViewItem view itself
	NSObject *pageID;
}
@property uiControl *c;
@property NSLayoutPriority oldHorzHuggingPri;
@property NSLayoutPriority oldVertHuggingPri;
- (id)initWithView:(NSView *)v pageID:(NSObject *)o;
- (NSView *)childView;
- (void)establishChildConstraints;
- (void)removeChildConstraints;
- (int)isMargined;
- (void)setMargined:(int)m;
@end

struct uiTab {
	uiDarwinControl c;
	NSTabView *tabview;
	NSMutableArray *pages;
	NSLayoutPriority horzHuggingPri;
	NSLayoutPriority vertHuggingPri;
};

@implementation tabPage

- (id)initWithView:(NSView *)v pageID:(NSObject *)o
{
	self = [super init];
	if (self != nil) {
		self->view = [v retain];
		self->pageID = [o retain];
	}
	return self;
}

- (void)dealloc
{
	[self removeChildConstraints];
	[self->view release];
	[self->pageID release];
	[super dealloc];
}

- (NSView *)childView
{
	return (NSView *) uiControlHandle(self.c);
}

- (void)establishChildConstraints
{
	[self removeChildConstraints];
	if (self.c == NULL)
		return;
	singleChildConstraintsEstablish(&(self->constraints),
		self->view, [self childView],
		uiDarwinControlHugsTrailingEdge(uiDarwinControl(self.c)),
		uiDarwinControlHugsBottom(uiDarwinControl(self.c)),
		self->margined,
		@"uiTab page");
}

- (void)removeChildConstraints
{
	singleChildConstraintsRemove(&(self->constraints), self->view);
}

- (int)isMargined
{
	return self->margined;
}

- (void)setMargined:(int)m
{
	self->margined = m;
	singleChildConstraintsSetMargined(&(self->constraints), self->margined);
}

@end

static void uiTabDestroy(uiControl *c)
{
	uiTab *t = uiTab(c);
	tabPage *page;

	// first remove all tab pages so we can destroy all the children
	while ([t->tabview numberOfTabViewItems] != 0)
		[t->tabview removeTabViewItem:[t->tabview tabViewItemAtIndex:0]];
	// then destroy all the children
	for (page in t->pages) {
		[page removeChildConstraints];
		uiControlSetParent(page.c, NULL);
		uiDarwinControlSetSuperview(uiDarwinControl(page.c), nil);
		uiControlDestroy(page.c);
	}
	// and finally destroy ourselves
	[t->pages release];
	[t->tabview release];
	uiFreeControl(uiControl(t));
}

uiDarwinControlDefaultHandle(uiTab, tabview)
uiDarwinControlDefaultParent(uiTab, tabview)
uiDarwinControlDefaultSetParent(uiTab, tabview)
uiDarwinControlDefaultToplevel(uiTab, tabview)
uiDarwinControlDefaultVisible(uiTab, tabview)
uiDarwinControlDefaultShow(uiTab, tabview)
uiDarwinControlDefaultHide(uiTab, tabview)
uiDarwinControlDefaultEnabled(uiTab, tabview)
uiDarwinControlDefaultEnable(uiTab, tabview)
uiDarwinControlDefaultDisable(uiTab, tabview)

static void uiTabSyncEnableState(uiDarwinControl *c, int enabled)
{
	uiTab *t = uiTab(c);
	tabPage *page;

	if (uiDarwinShouldStopSyncEnableState(uiDarwinControl(t), enabled))
		return;
	for (page in t->pages)
		uiDarwinControlSyncEnableState(uiDarwinControl(page.c), enabled);
}

uiDarwinControlDefaultSetSuperview(uiTab, tabview)

static void tabRelayout(uiTab *t)
{
	tabPage *page;

	for (page in t->pages)
		[page establishChildConstraints];
	// and this gets rid of some weird issues with regards to box alignment
	jiggleViewLayout(t->tabview);
}

BOOL uiTabHugsTrailingEdge(uiDarwinControl *c)
{
	uiTab *t = uiTab(c);

	return t->horzHuggingPri < NSLayoutPriorityWindowSizeStayPut;
}

BOOL uiTabHugsBottom(uiDarwinControl *c)
{
	uiTab *t = uiTab(c);

	return t->vertHuggingPri < NSLayoutPriorityWindowSizeStayPut;
}

static void uiTabChildEdgeHuggingChanged(uiDarwinControl *c)
{
	uiTab *t = uiTab(c);

	tabRelayout(t);
}

static NSLayoutPriority uiTabHuggingPriority(uiDarwinControl *c, NSLayoutConstraintOrientation orientation)
{
	uiTab *t = uiTab(c);

	if (orientation == NSLayoutConstraintOrientationHorizontal)
		return t->horzHuggingPri;
	return t->vertHuggingPri;
}

static void uiTabSetHuggingPriority(uiDarwinControl *c, NSLayoutPriority priority, NSLayoutConstraintOrientation orientation)
{
	uiTab *t = uiTab(c);

	if (orientation == NSLayoutConstraintOrientationHorizontal)
		t->horzHuggingPri = priority;
	else
		t->vertHuggingPri = priority;
	uiDarwinNotifyEdgeHuggingChanged(uiDarwinControl(t));
}

static void uiTabChildVisibilityChanged(uiDarwinControl *c)
{
	uiTab *t = uiTab(c);

	tabRelayout(t);
}

void uiTabAppend(uiTab *t, const char *name, uiControl *child)
{
	uiTabInsertAt(t, name, [t->pages count], child);
}

void uiTabInsertAt(uiTab *t, const char *name, int n, uiControl *child)
{
	tabPage *page;
	NSView *view;
	NSTabViewItem *i;
	NSObject *pageID;

	uiControlSetParent(child, uiControl(t));

	view = [[[NSView alloc] initWithFrame:NSZeroRect] autorelease];
	// note: if we turn off the autoresizing mask, nothing shows up
	uiDarwinControlSetSuperview(uiDarwinControl(child), view);
	uiDarwinControlSyncEnableState(uiDarwinControl(child), uiControlEnabledToUser(uiControl(t)));

	// the documentation says these can be nil but the headers say these must not be; let's be safe and make them non-nil anyway
	pageID = [NSObject new];
	page = [[[tabPage alloc] initWithView:view pageID:pageID] autorelease];
	page.c = child;

	// don't hug, just in case we're a stretchy tab
	page.oldHorzHuggingPri = uiDarwinControlHuggingPriority(uiDarwinControl(page.c), NSLayoutConstraintOrientationHorizontal);
	page.oldVertHuggingPri = uiDarwinControlHuggingPriority(uiDarwinControl(page.c), NSLayoutConstraintOrientationVertical);
	uiDarwinControlSetHuggingPriority(uiDarwinControl(page.c), NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationHorizontal);
	uiDarwinControlSetHuggingPriority(uiDarwinControl(page.c), NSLayoutPriorityDefaultLow, NSLayoutConstraintOrientationVertical);

	[t->pages insertObject:page atIndex:n];

	i = [[[NSTabViewItem alloc] initWithIdentifier:pageID] autorelease];
	[i setLabel:toNSString(name)];
	[i setView:view];
	[t->tabview insertTabViewItem:i atIndex:n];

	tabRelayout(t);
}

void uiTabDelete(uiTab *t, int n)
{
	tabPage *page;
	uiControl *child;
	NSTabViewItem *i;

	page = (tabPage *) [t->pages objectAtIndex:n];

	uiDarwinControlSetHuggingPriority(uiDarwinControl(page.c), page.oldHorzHuggingPri, NSLayoutConstraintOrientationHorizontal);
	uiDarwinControlSetHuggingPriority(uiDarwinControl(page.c), page.oldVertHuggingPri, NSLayoutConstraintOrientationVertical);

	child = page.c;
	[page removeChildConstraints];
	[t->pages removeObjectAtIndex:n];

	uiControlSetParent(child, NULL);
	uiDarwinControlSetSuperview(uiDarwinControl(child), nil);

	i = [t->tabview tabViewItemAtIndex:n];
	[t->tabview removeTabViewItem:i];

	tabRelayout(t);
}

int uiTabNumPages(uiTab *t)
{
	return [t->pages count];
}

int uiTabMargined(uiTab *t, int n)
{
	tabPage *page;

	page = (tabPage *) [t->pages objectAtIndex:n];
	return [page isMargined];
}

void uiTabSetMargined(uiTab *t, int n, int margined)
{
	tabPage *page;

	page = (tabPage *) [t->pages objectAtIndex:n];
	[page setMargined:margined];
}

uiTab *uiNewTab(void)
{
	uiTab *t;

	uiDarwinNewControl(uiTab, t);

	t->tabview = [[NSTabView alloc] initWithFrame:NSZeroRect];
	// also good for NSTabView (same selector and everything)
	uiDarwinSetControlFont((NSControl *) (t->tabview), NSRegularControlSize);

	t->pages = [NSMutableArray new];

	// default to low hugging to not hug edges
	t->horzHuggingPri = NSLayoutPriorityDefaultLow;
	t->vertHuggingPri = NSLayoutPriorityDefaultLow;

	return t;
}


text:
package org.destinationsol.assets.json;

import com.badlogic.gdx.files.FileHandle;
import org.destinationsol.assets.AssetDataFileHandle;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.terasology.gestalt.assets.format.AbstractAssetAlterationFileFormat;
import org.terasology.gestalt.assets.format.AssetDataFile;
import org.terasology.gestalt.assets.module.annotations.RegisterAssetDeltaFileFormat;

import javax.inject.Inject;
import java.io.IOException;

@RegisterAssetDeltaFileFormat
public class JsonDeltaFileFormat extends AbstractAssetAlterationFileFormat<JsonData> {
    @Inject
    public JsonDeltaFileFormat() {
        super("json");
    }

    /**
     * Applies an alteration to the given assetData
     *
     * @param input     The input corresponding to this asset
     * @param assetData An assetData to update
     * @throws IOException If there are any errors loading the alteration
     */
    @Override
    public void apply(AssetDataFile input, JsonData assetData) throws IOException {
        FileHandle handle = new AssetDataFileHandle(input);
        JSONObject deltaJsonValue = new JSONObject(handle.readString());

        JSONObject jsonValue = assetData.getJsonValue();
        mergeObjects(jsonValue, deltaJsonValue);
    }

    /**
     * This method merges the JSONObject input with its delta by recursively checking for differing values.
     *
     * If a value does not exist in the delta, then the original input value is preserved. Otherwise, if the value is
     * a primitive type (excluding array), then the delta value will override the input value. For JSONObject values,
     * this method is called recursively to merge the sub-objects together. In the case of arrays, all of the values
     * in the delta array are appended to the input array.
     *
     * @param input the JSONObject to merge into
     * @param delta the JSONObject to merge with
     */
    private void mergeObjects(JSONObject input, JSONObject delta) {
        for (String key : input.keySet()) {
            Object subObject = input.get(key);
            if (!delta.has(key)) {
                // Value is not modified
                continue;
            }

            if (subObject instanceof JSONObject) {
                Object deltaObject = delta.get(key);
                if (deltaObject instanceof JSONObject) {
                    mergeObjects((JSONObject) subObject, (JSONObject) deltaObject);
                } else {
                    throw new JSONException("Error when parsing delta: Type " + deltaObject.getClass().getSimpleName() + " does not equal JSONObject");
                }

                continue;
            }

            if (subObject instanceof JSONArray) {
                Object deltaObject = delta.get(key);
                if (deltaObject instanceof JSONArray) {
                    mergeArray((JSONArray) subObject, (JSONArray) deltaObject);
                } else {
                    throw new JSONException("Error when parsing delta: Type " + deltaObject.getClass().getSimpleName() + " does not equal JSONArray");
                }

                continue;
            }

            // Assume that a primitive type is used (primitive types cannot be merged, only overridden)
            input.put(key, delta.get(key));
        }
    }

    /**
     * Merges the input with its delta by adding all values from the delta to the input.
     */
    private void mergeArray(JSONArray input, JSONArray delta) {
        for (int index = 0; index < delta.length(); index++) {
            input.put(delta.get(index));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/* keepcomments */
/* end-keepcomments */


text:
/*
 * Traceur and Babel transpile hook for Loader
 */
(function(Loader) {
	var g = __global;

	var isNode = typeof self === "undefined" &&
		typeof process !== "undefined" &&
		{}.toString.call(process) === '[object process]';

	function getTranspilerModule(loader, globalName) {
		return loader.newModule({
			__useDefault: true,
			"default": g[globalName]
		});
	}

	function getTranspilerGlobalName(loadName) {
		return loadName === "babel" ? "Babel" : loadName;
	}

	// Use Babel by default
	Loader.prototype.transpiler = 'babel';

	Loader.prototype.transpile = function(load) {
		var self = this;

		// pick up Transpiler modules from existing globals on first run if set
		if (!self.transpilerHasRun) {
			if (g.traceur && !self.has('traceur')) {
				self.set('traceur', getTranspilerModule(self, 'traceur'));
			}
			if (g.Babel && !self.has("babel")) {
				self.set("babel", getTranspilerModule(self, "Babel"));
			}
			self.transpilerHasRun = true;
		}

		return self['import'](self.transpiler)
			.then(function(transpilerMod) {
				var transpiler = transpilerMod;
				if (transpiler.__useDefault) {
					transpiler = transpiler['default'];
				}

				return (transpiler.Compiler ? traceurTranspile : babelTranspile)
					.call(self, load, transpiler);
			})
			.then(function(code) {
				return 'var __moduleAddress = "' + load.address + '";' + code;
			});
	};

	Loader.prototype.instantiate = function(load) {
		var self = this;
		return Promise.resolve(self.normalize(self.transpiler))
			.then(function(transpilerNormalized) {
				// load transpiler as a global (avoiding System clobbering)
				if (load.name === transpilerNormalized) {
					return {
						deps: [],
						execute: function() {
							var curSystem = g.System;
							var curLoader = g.Reflect.Loader;
							// ensure not detected as CommonJS
							__eval('(function(require,exports,module){' + load.source + '})();', g, load);
							g.System = curSystem;
							g.Reflect.Loader = curLoader;
							return getTranspilerModule(self, getTranspilerGlobalName(load.name));
						}
					};
				}
			});
	};

	function traceurTranspile(load, traceur) {
		var options = this.traceurOptions || {};
		options.modules = 'instantiate';
		options.script = false;
		options.sourceMaps = 'inline';
		options.filename = load.address;
		options.inputSourceMap = load.metadata.sourceMap;
		options.moduleName = false;

		var compiler = new traceur.Compiler(options);
		var source = doTraceurCompile(load.source, compiler, options.filename);

		// add "!eval" to end of Traceur sourceURL
		// I believe this does something?
		source += '!eval';

		return source;
	}
	function doTraceurCompile(source, compiler, filename) {
		try {
			return compiler.compile(source, filename);
		}
		catch(e) {
			// traceur throws an error array
			throw e[0];
		}
	}

	/**
	 * Gets the babel environment name
	 * return {string} The babel environment name
	 */
	function getBabelEnv() {
		var loader = this;
		var defaultEnv = "development";
		var loaderEnv = typeof loader.getEnv === "function" && loader.getEnv();

		if (isNode) {
			return process.env.BABEL_ENV ||
				process.env.NODE_ENV ||
				loaderEnv ||
				defaultEnv;
		}
		else {
			return loaderEnv || defaultEnv;
		}
	}

	/**
	 * Gets the babel preset or plugin name
	 * @param {BabelPreset|BabelPlugin} presetOrPlugin A babel plugin or preset
	 * @return {?string} The preset/plugin name
	 */
	function getPresetOrPluginName(presetOrPlugin) {
		if (includesPresetOrPluginName(presetOrPlugin)) {
			return typeof presetOrPlugin === "string" ? presetOrPlugin : presetOrPlugin[0];
		}
		else {
			return null;
		}
	}

	/**
	 * Whether the babel plugin/preset name was provided
	 *
	 * @param {BabelPreset|BabelPlugin} presetOrPlugin
	 * @return {boolean}
	 */
	function includesPresetOrPluginName(presetOrPlugin) {
		return typeof presetOrPlugin === "string" ||
			presetOrPlugin.length && typeof presetOrPlugin[0] === "string";
	}

	/**
	 * A Babel plugins as defined in `babelOptions.plugins`
	 * @typedef {string|Function|<string, Object>[]|<Function, Object>[]} BabelPlugin
	 */

	var processBabelPlugins = (function() {
		/**
		 * Returns a list of babel plugins to be used during transpilation
		 *
		 * Collects the babel plugins defined in `babelOptions.plugins` plus
		 * the environment dependant plugins.
		 *
		 * @param {Object} babel The babel object exported by babel-standalone
		 * @param {babelOptions} babelOptions The babel configuration object
		 * @return {Promise.<BabelPlugin[]>} Promise that resolves to a list of babel plugins
		 */
		return function processBabelPlugins(babel, babelOptions) {
			var babelEnv = getBabelEnv.call(this);
			var babelEnvConfig = babelOptions.env || {};

			var pluginsPromises = [
				doProcessPlugins.call(this, babel, babelOptions.plugins)
			];

			for (var envName in babelEnvConfig) {
				// do not process plugins if the current environment does not match
				// the environment in which the plugins are set to be used
				if (babelEnv === envName) {
					var plugins = babelEnvConfig[envName].plugins || [];
					pluginsPromises.push(doProcessPlugins.call(this, babel, plugins));
				}
			}

			return Promise.all(pluginsPromises)
				.then(function(results) {
					var plugins = [];

					// results is an array of arrays, flatten it out!
					results.forEach(function(processedPlugins) {
						plugins = plugins.concat(processedPlugins);
					});

					return plugins;
				});
		}

		/**
		 * Collects builtin plugin names and non builtins functions
		 *
		 * @param {Object} babel The babel object exported by babel-standalone
		 * @param {BabelPlugin[]} babelPlugins A list of babel plugins
		 * @return {Promise.<BabelPlugin[]>} A promise that resolves to a list
		 *		of babel-standalone builtin plugin names and non-builtin plugin
		 *		functions
		 */
		function doProcessPlugins(babel, babelPlugins) {
			var promises = [];

			var plugins = babelPlugins || [];

			plugins.forEach(function(plugin) {
				var name = getPresetOrPluginName(plugin);

				if (!includesPresetOrPluginName(plugin) || isBuiltinPlugin(babel, name)) {
					promises.push(plugin);
				}
				else if (!isBuiltinPlugin(babel, name)) {
					var parent = this.configMain || "package.json!npm";
					var npmPluginNameOrPath = getNpmPluginNameOrPath(name);

					// import the plugin!
					promises.push(this["import"](npmPluginNameOrPath, { name: parent })
						.then(function(mod) {
							var exported = mod.__esModule ? mod["default"] : mod;

							if (typeof plugin === "string") {
								return exported;
							}
							// assume the array form was provided
							else {
								// [ pluginFunction, pluginOptions ]
								return [exported, plugin[1]];
							}
						}));
				}
			}, this);

			return Promise.all(promises);
		}

		/**
		 * Whether the plugin is built in babel-standalone
		 *
		 * @param {Object} babel The babel object exported by babel-standalone
		 * @param {string} pluginName The plugin name to be checked
		 * @return {boolean}
		 */
		function isBuiltinPlugin(babel, pluginName) {
			var isNpmPluginName = /^(?:babel-plugin-)/;
			var availablePlugins = babel.availablePlugins || {};

			// babel-standalone registers its bundled plugins using the shorthand name
			var shorthand = isNpmPluginName.test(pluginName) ?
				pluginName.replace("babel-plugin-", "") :
				pluginName;

			return !!availablePlugins[shorthand];
		}

		/**
		 * Returns babel full plugin name if shorthand was used or the path provided
		 *
		 * @param {string} name The entry in the plugin array
		 * @return {string} Relative/absolute path to plugin or babel npm plugin name
		 *
		 * If a babel plugin is on npm, it can be set in the `plugins` array using
		 * one of the following forms:
		 *
		 * 1) full plugin name, e.g `"plugins": ["babel-plugin-myPlugin"]`
		 * 2) relative/absolute path, e.g: `"plugins": ["./node_modules/asdf/plugin"]`
		 * 3) using a shorthand, e.g: `"plugins": ["myPlugin"]`
		 *
		 * Since plugins are loaded through steal, we need to make sure the full
		 * plugin name is passed to `steal.import` so the npm extension can locate
		 * the babel plugin. Relative/absolute paths should be loaded as any other
		 * module.
		 */
		function getNpmPluginNameOrPath(name) {
			var isPath = /\//;
			var isBabelPluginName = /^(?:babel-plugin-)/;

			return isPath.test(name) || isBabelPluginName.test(name) ?
				name : "babel-plugin-" + name;
		}
	}());

	function getBabelPlugins(current) {
		var plugins = current || [];
		var required = "transform-es2015-modules-systemjs";

		if (plugins.indexOf(required) === -1) {
			plugins.unshift(required);
		}

		return plugins;
	}

	var babelES2015Preset = "es2015-no-commonjs";

	function getBabelPresets(current, loader) {
		var presets = current || [];
		var forceES5 = loader.forceES5 !== false;
		var defaultPresets = forceES5
			? [babelES2015Preset, "react", "stage-0"]
			: ["react"];

		// if the user provided a list of presets to be used, treat the
		// BABEL_ES2015_PRESET as required if stealCondig.forceES5 is `true`
		if (presets.length) {
			if (forceES5) {
				if (presets.indexOf(babelES2015Preset) != -1) {
					presets.unshift(babelES2015Preset);
				}
			}
		}

		return presets.length ? presets : defaultPresets;
	}

	function getBabelOptionsFromLoad(load) {
		var pkg = load.metadata.npmPackage;
		if(pkg) {
			var steal = pkg.steal || pkg.system;
			if(steal && steal.babelOptions) {
				return steal.babelOptions;
			}
		}
		return this.babelOptions || {};
	}

	/**
	 * Returns the babel version
	 * @param {Object} babel The babel object
	 * @return {number} The babel version
	 */
	function getBabelVersion(babel) {
		var babelVersion = babel.version ? +babel.version.split(".")[0] : 6;

		return babelVersion || 6;
	}

	function getBabelOptions(load, babel) {
		var loader = this;
		var options = getBabelOptionsFromLoad.call(loader, load);

		options.sourceMap = 'inline';
		options.filename = load.address;
		options.code = true;
		options.ast = false;

		if (getBabelVersion(babel) >= 6) {
			// delete the old babel options if they are present in config
			delete options.optional;
			delete options.whitelist;
			delete options.blacklist;

			// make sure presents and plugins needed for Steal to work
			// correctly are set
			options.presets = getBabelPresets(options.presets, loader);
			options.plugins = getBabelPlugins(options.plugins);
		}
		else {
			options.modules = 'system';

			if (!options.blacklist) {
				options.blacklist = ['react'];
			}
		}

		return options;
	}

	/**presets
	 * A Babel preset as defined in `babelOptions.presets`
	 * @typedef {string|Function|Object|<string, Object>[]|<Function, Object>[]|<Object, Object>} BabelPreset
	 */

	var processBabelPresets = (function() {
		/**
		 * Returns a list of babel presets to be used during transpilation
		 *
		 * Collects the babel presets defined in `babelOptions.presets` plus
		 * the environment dependant presets.
		 *
		 * @param {Object} babel The babel object exported by babel-standalone
		 * @param {babelOptions} babelOptions The babel configuration object
		 * @return {Promise.<BabelPreset[]>} Promise that resolves to a list of babel presets
		 */
		return function processBabelPresets(babel, babelOptions) {
			var babelEnv = getBabelEnv.call(this);
			var babelEnvConfig = babelOptions.env || {};

			var presetsPromises = [
				doProcessPresets.call(this, babel, babelOptions.presets)
			];

			for (var envName in babelEnvConfig) {
				// do not process presets if the current environment does not match
				// the environment in which the presets are set to be used
				if (babelEnv === envName) {
					var presets = babelEnvConfig[envName].presets || [];
					presetsPromises.push(doProcessPresets.call(this, babel, presets));
				}
			}

			return Promise.all(presetsPromises)
				.then(function(results) {
					var presets = [];

					// results is an array of arrays, flatten it out!
					results.forEach(function(processedPresets) {
						presets = presets.concat(processedPresets);
					});

					return presets;
				});
		};

		/**
		 * Collects builtin presets names and non builtins objects/functions
		 *
		 * @param {Object} babel The babel object exported by babel-standalone
		 * @param {BabelPreset[]} babelPresets A list of babel presets
		 * @return {Promise.<BabelPreset[]>} A promise that resolves to a list
		 *		of babel-standalone builtin preset names and non-builtin preset
		 *		definitions (object or function).
		 */
		function doProcessPresets(babel, babelPresets) {
			var promises = [];
			var presets = babelPresets || [];

			presets.forEach(function(preset) {
				var name = getPresetOrPluginName(preset);

				if (!includesPresetOrPluginName(preset) || isBuiltinPreset(babel, name)) {
					promises.push(preset);
				}
				else if (!isBuiltinPreset(babel, name)) {
					var parent = this.configMain || "package.json!npm";
					var npmPresetNameOrPath = getNpmPresetNameOrPath(name);

					// import the preset!
					promises.push(this["import"](npmPresetNameOrPath, { name: parent })
						.then(function(mod) {
							var exported = mod.__esModule ? mod["default"] : mod;

							if (typeof preset === "string") {
								return exported;
							}
							// assume the array form was provided
							else {
								// [ presetDefinition, presetOptions ]
								return [exported, preset[1]];
							}
						}));
				}
			}, this);

			return Promise.all(promises);
		}

		/**
		 * Whether the preset is built in babel-standalone
		 * @param {Object} babel The babel object exported by babel-standalone
		 * @param {string} pluginName The plugin name to be checked
		 * @return {boolean}
		 */
		function isBuiltinPreset(babel, presetName) {
			var isNpmPresetName = /^(?:babel-preset-)/;
			var availablePresets = babel.availablePresets || {};

			// babel-standalone registers its builtin presets using the shorthand name
			var shorthand = isNpmPresetName.test(presetName) ?
				presetName.replace("babel-preset-", "") :
				presetName;

			return !!availablePresets[shorthand];
		}

		function getNpmPresetNameOrPath(name) {
			var isPath = /\//;
			var isNpmPresetName = /^(?:babel-preset-)/;

			if (!isPath.test(name) && !isNpmPresetName.test(name)) {
				return "babel-preset-" + name;
			}

			return name;
		}
	}());

	/**
	 * Babel plugin that sets `__esModule` to true
	 *
	 * This flag is needed to interop the SystemJS format used by steal on the
	 * browser in development with the CJS format used for built modules.
	 *
	 * With dev bundles is possible to load a part of the app already built while
	 * other modules are being transpiled on the fly, with this flag, transpiled
	 * amd modules will be able to load the modules transpiled on the browser.
	 */
	function addESModuleFlagPlugin(babel) {
		var t = babel.types;

		return {
			visitor: {
				Program: function(path, state) {
					path.unshiftContainer("body", [
						t.exportNamedDeclaration(null, [
							t.exportSpecifier(t.identifier("true"),
								t.identifier("__esModule"))
						])
					]);
				}
			}
		};
	}

	function getImportSpecifierPositionsPlugin(load) {
		load.metadata.importSpecifiers = Object.create(null);
		load.metadata.importNames = Object.create(null);
		load.metadata.exportNames = Object.create(null);

		return {
			visitor: {
				ImportDeclaration: function(path, state){
					var node = path.node;
					var specifier = node.source.value;
					var loc = node.source.loc;
					load.metadata.importSpecifiers[specifier] = loc;

					var specifiers = load.metadata.importNames[specifier];
					if(!specifiers) {
						specifiers = load.metadata.importNames[specifier] = [];
					}

					specifiers.push.apply(specifiers, (
						node.specifiers || []
					).map(function(spec) {
						if(spec.type === "ImportDefaultSpecifier") {
							return "default";
						}
						return spec.imported && spec.imported.name;
					}));
				},
				ExportDeclaration: function(path, state){
					var node = path.node;

					if(node.source) {
						var specifier = node.source.value;
						var specifiers = load.metadata.exportNames[specifier];

						if(node.type === "ExportNamedDeclaration") {
							if(!specifiers) {
								specifiers = load.metadata.exportNames[specifier] = new Map();
							}

							node.specifiers.forEach(function(node){
								specifiers.set(node.exported.name, node.local.name);
							});
						} else if(node.type === "ExportAllDeclaration") {
							// TODO Not sure what to do here.
							load.metadata.exportNames[specifier] = 1;
						}
					}
				}
			}
		};
	}

	Loader.prototype._getImportSpecifierPositionsPlugin = getImportSpecifierPositionsPlugin;

	function babelTranspile(load, babelMod) {
		var loader = this;
		var babel = babelMod.Babel || babelMod.babel || babelMod;

		var babelVersion = getBabelVersion(babel);
		var options = getBabelOptions.call(loader, load, babel);

		return Promise.all([
			processBabelPlugins.call(this, babel, options),
			processBabelPresets.call(this, babel, options)
		])
		.then(function(results) {
			// might be running on an old babel that throws if there is a
			// plugins array in the options object
			if (babelVersion >= 6) {
				options.plugins = [
					getImportSpecifierPositionsPlugin.bind(null, load),
					addESModuleFlagPlugin
				].concat(results[0]);
				options.presets = results[1];
			}

			try {
				var result = babel.transform(load.source, options);
				var source = result.code;

				// add "!eval" to end of Babel sourceURL
				// I believe this does something?
				return source + '\n//# sourceURL=' + load.address + '!eval';
			} catch(ex) {
				if(ex instanceof SyntaxError) {
					var newError = new SyntaxError(ex.message);
					var stack = new loader.StackTrace(ex.message, [
						loader.StackTrace.item("", load.address,
							ex.loc.line, ex.loc.column)
					]);
					newError.stack = stack.toString();
					return Promise.reject(newError);
				}
				return Promise.reject(ex);
			}
		});
	}

})(__global.LoaderPolyfill);


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GroovyCompilerProjectConfiguration">
    <option name="configScript" value="$USER_HOME$/bin/staticGroovyCompScript.groovy" />
  </component>
</project>


text:
[Grunt homepage](http://gruntjs.com/) | [Documentation table of contents](toc.md)

# [The grunt API](api.md) / grunt.fail

For when something goes horribly wrong.

See the [fail lib source](../lib/grunt/fail.js) for more information.

## The fail API

If something explodes (or is about to explode) inside a task, it can force grunt to abort. See the [exit codes documentation](exit_codes.md) for a list of all built-in grunt exit codes.

Note that any method marked with a ☃ (unicode snowman) is also available directly on the `grunt` object. Just so you know. See the [API main page](api.md) for more usage information.

### grunt.warn ☃
Display a warning and abort grunt immediately. Grunt will continue processing tasks if the `--force` command-line option was specified. The `error` argument can be a string message or an error object.

```javascript
grunt.fail.warn(error [, errorcode])
```

If `--debug 9` is specified on the command-line and an error object was specified, a stack trace will be logged.

_This method is also available as [grunt.warn](api.md)._

### grunt.fatal ☃
Display a warning and abort grunt immediately. The `error` argument can be a string message or an error object.

```javascript
grunt.fail.fatal(error [, errorcode])
```

If `--debug 9` is specified on the command-line and an error object was specified, a stack trace will be logged.

_This method is also available as [grunt.fatal](api.md)._


text:
import { GluegunToolbox } from '../domain/toolbox'
import { filesystem } from '../toolbox/filesystem-tools'

/**
 * Extensions to filesystem.  Brought to you by fs-jetpack.
 *
 * @param toolbox The running toolbox.
 */
export default function attach(toolbox: GluegunToolbox) {
  toolbox.filesystem = filesystem
}


text:
#region BSD License

#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/// <summary>
/// Provides streamlined creation of value pairs by avoiding
/// need to specify the type of the key and value.
/// </summary>
/// <nuget id="netfx-System.Collections.Generic.KeyValuePair" />
internal static class KeyValuePair
{
	/// <summary>
	/// Creates the specified pair with the given key and value.
	/// The generic types do not need to be specified, and are
	/// inferred by the compiler based on the types passed
	/// as arguments.
	/// </summary>
	public static KeyValuePair<TKey, TValue> Create<TKey, TValue>(TKey key, TValue value)
	{
		return new KeyValuePair<TKey, TValue>(key, value);
	}
}


text:
using System.Data.SQLite;
using System.Diagnostics.CodeAnalysis;
using Ninject.Activation;
using Twice.Models.Cache;

namespace Twice.Injections
{
	[ExcludeFromCodeCoverage]
	internal class CacheProvider : Provider<ICache>
	{
		/// <summary>
		///     Creates an instance within the specified context.
		/// </summary>
		/// <param name="context"> The context. </param>
		/// <returns> The created instance. </returns>
		protected override ICache CreateInstance( IContext context )
		{
			var sb = new SQLiteConnectionStringBuilder
			{
				DataSource = Constants.IO.CacheFileName,
				JournalMode = SQLiteJournalModeEnum.Wal,
				Enlist = true,

				// default size of a cluster in NTFS file system
				PageSize = 4096,

				// speed up cache operations by not waiting for file system flushs
				SyncMode = SynchronizationModes.Off
			};

			return new SqliteCache( sb.ToString() );
		}
	}
}


text:
class Association {
    allOddNum = [];
    allEvenNum = [];

    // Tracks what associations are possible for any integer
    possible = new Map();

    constructor(coinCount) {
        // Generate all odd and even number once and for all
        for (let index = 0; index < coinCount; index++) {
            this.allOddNum.push((2 * index) + 1);
            this.allEvenNum.push((2 * index + 2));
        }

		for (let num = 1; num <= (coinCount * 2); num++) {
			this.possible.set(num, new Set());
		}

		// Set all associations as possible
		for (const odd of this.allOddNum) {
			for (const even of this.allEvenNum) {
				this.possible.get(odd).add(even);
				this.possible.get(even).add(odd);
			}
		}
    }

	otherSide(side1) {
		return this.possible.get(side1).values().next().value;
	}

	remove(side1, side2) {
		const possibleSide2 = this.possible.get(side1);
		const modified = possibleSide2.delete(side2);
		if (modified && (possibleSide2.size == 1)) {
			this.cascade(side1);
		}
	}

	cascade(side1) {
		const side2 = this.otherSide(side1);
		this.possible.set(side2, new Set([side1]));
		for (const other_side1 of this.possible.keys()) {
			if (other_side1 != side1) {
				this.remove(other_side1, side2);
			}
		}
	}
}

const inputs1 = readline().split(' ');
const coinCount = parseInt(inputs1[0]);
const association = new Association(coinCount);

const tossCount = parseInt(inputs1[1]);
for (let tossIndex = 0; tossIndex < tossCount; tossIndex++) {
    const values = new Set();
    const inputs2 = readline().split(' ');
    for (let coinIndex = 0; coinIndex < coinCount; coinIndex++) {
		values.add(parseInt(inputs2[coinIndex]));
	}
	// Eliminate impossible associations
	for (const side1 of values) {
		for (const side2 of values) {
			association.remove(side1, side2);
		}
	}
}

const solutions = [];
for (const odd of association.allOddNum) {
    const even = association.otherSide(odd);
    solutions.push(even.toString());
}
console.log(solutions.join(" "));


text:
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
"use strict";
const ContextDependency = require("./ContextDependency");
const CriticalDependencyWarning = require("./CriticalDependencyWarning");
const ContextDependencyTemplateAsRequireCall = require("./ContextDependencyTemplateAsRequireCall");

class ImportContextDependency extends ContextDependency {
	constructor(request, recursive, regExp, range, valueRange) {
		super(request, recursive, regExp);
		this.range = range;
		this.valueRange = valueRange;
		this.async = true;
	}

	get type() {
		return "System.import context";
	}

	getWarnings() {
		if(!this.critical) {
			return;
		}

		return [
			new CriticalDependencyWarning(this.critical)
		];
	}
}

ImportContextDependency.Template = ContextDependencyTemplateAsRequireCall;

module.exports = ImportContextDependency;


text: ALTER TABLE `kwc_basic_table_data_trl` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace TCPServiceAtMessageLevel
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
    public class Service1 : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }
    }
}


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Provincias extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('provincias', function(Blueprint $table)
        {
            $table->increments('id');
            $table->string('cod_provincia', 100);
            $table->string('des_provincia', 100);
            $table->integer('estado_id')->unsigned();
            $table->foreign('estado_id')->references('id')->on('tbl_estados');
            $table->string('pais', 50);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}


text:
use std::cmp;
use std::io;
use std::io::prelude::*;

use stream::{Compress, CompressParams, Decompress, Status};

/// A compression stream which will have uncompressed data written to it and
/// will write compressed data to an output stream.
pub struct BrotliEncoder<W: Write> {
    data: Compress,
    obj: Option<W>,
    max: usize,
    cur: usize,
}

/// A compression stream which will have compressed data written to it and
/// will write uncompressed data to an output stream.
pub struct BrotliDecoder<W: Write> {
    data: Decompress,
    obj: Option<W>,
    buf: Vec<u8>,
}

impl<W: Write> BrotliEncoder<W> {
    /// Create a new compression stream which will compress at the given level
    /// to write compress output to the give output stream.
    pub fn new(obj: W, level: u32) -> BrotliEncoder<W> {
        let mut data = Compress::new();
        data.set_params(CompressParams::new().quality(level));
        BrotliEncoder {
            max: data.input_block_size(),
            cur: 0,
            data,
            obj: Some(obj),
        }
    }

    /// Creates a new encoder with a custom `CompressParams`.
    pub fn from_params(obj: W, params: &CompressParams) -> BrotliEncoder<W> {
        let mut data = Compress::new();
        data.set_params(params);
        BrotliEncoder {
            max: data.input_block_size(),
            cur: 0,
            data,
            obj: Some(obj),
        }
    }

    fn do_finish(&mut self) -> io::Result<()> {
        let data = self.data.compress(true, false)?;
        self.obj.as_mut().unwrap().write_all(data)
    }

    /// Consumes this encoder, flushing the output stream.
    ///
    /// This will flush the underlying data stream and then return the contained
    /// writer if the flush succeeded.
    pub fn finish(mut self) -> io::Result<W> {
        self.do_finish()?;
        Ok(self.obj.take().unwrap())
    }
}

impl<W: Write> Write for BrotliEncoder<W> {
    fn write(&mut self, data: &[u8]) -> io::Result<usize> {
        if self.cur > 0 {
            let data = self.data.compress(false, false)?;
            self.obj.as_mut().unwrap().write_all(data)?;
            self.cur = 0;
        }
        let amt = cmp::min(data.len(), self.max);
        self.data.copy_input(&data[..amt]);
        self.cur = amt;
        Ok(amt)
    }

    fn flush(&mut self) -> io::Result<()> {
        let data = self.data.compress(false, true)?;
        let obj = self.obj.as_mut().unwrap();
        obj.write_all(data).and_then(|_| obj.flush())
    }
}

impl<W: Write> Drop for BrotliEncoder<W> {
    fn drop(&mut self) {
        if self.obj.is_some() {
            let _ = self.do_finish();
        }
    }
}

impl<W: Write> BrotliDecoder<W> {
    /// Creates a new decoding stream which will decode all input written to it
    /// into `obj`.
    pub fn new(obj: W) -> BrotliDecoder<W> {
        BrotliDecoder {
            data: Decompress::new(),
            obj: Some(obj),
            buf: Vec::with_capacity(32 * 1024),
        }
    }

    fn dump(&mut self) -> io::Result<()> {
        if !self.buf.is_empty() {
            self.obj.as_mut().unwrap().write_all(&self.buf)?;
            self.buf.truncate(0);
        }
        Ok(())
    }

    fn do_finish(&mut self) -> io::Result<()> {
        loop {
            self.dump()?;
            let res = self.data.decompress_vec(&mut &[][..], &mut self.buf)?;
            if res == Status::Finished {
                break;
            }
        }
        self.dump()
    }

    /// Unwrap the underlying writer, finishing the compression stream.
    pub fn finish(&mut self) -> io::Result<W> {
        self.do_finish()?;
        Ok(self.obj.take().unwrap())
    }
}

impl<W: Write> Write for BrotliDecoder<W> {
    fn write(&mut self, mut data: &[u8]) -> io::Result<usize> {
        loop {
            self.dump()?;

            let data_len = data.len();
            let res = self.data.decompress_vec(&mut data, &mut self.buf)?;
            let written = data_len - data.len();

            if written > 0 || data.is_empty() || res == Status::Finished {
                return Ok(written);
            }
        }
    }

    fn flush(&mut self) -> io::Result<()> {
        self.dump()?;
        self.obj.as_mut().unwrap().flush()
    }
}

impl<W: Write> Drop for BrotliDecoder<W> {
    fn drop(&mut self) {
        if self.obj.is_some() {
            let _ = self.do_finish();
        }
    }
}

#[cfg(test)]
mod tests {
    use super::{BrotliDecoder, BrotliEncoder};
    use std::io::prelude::*;
    use std::iter::repeat;

    #[test]
    fn smoke() {
        let d = BrotliDecoder::new(Vec::new());
        let mut c = BrotliEncoder::new(d, 6);
        c.write_all(b"12834").unwrap();
        let s = repeat("12345").take(100000).collect::<String>();
        c.write_all(s.as_bytes()).unwrap();
        let data = c.finish().unwrap().finish().unwrap();
        assert_eq!(&data[0..5], b"12834");
        assert_eq!(data.len(), 500005);
        assert!(format!("12834{}", s).as_bytes() == &*data);
    }

    #[test]
    fn write_empty() {
        let d = BrotliDecoder::new(Vec::new());
        let mut c = BrotliEncoder::new(d, 6);
        c.write(b"").unwrap();
        let data = c.finish().unwrap().finish().unwrap();
        assert_eq!(&data[..], b"");
    }

    #[test]
    fn qc() {
        ::quickcheck::quickcheck(test as fn(_) -> _);

        fn test(v: Vec<u8>) -> bool {
            let w = BrotliDecoder::new(Vec::new());
            let mut w = BrotliEncoder::new(w, 6);
            w.write_all(&v).unwrap();
            v == w.finish().unwrap().finish().unwrap()
        }
    }
}


text:
package helpers

import (
	"os"
	"crypto/md5"
	"io"
	"encoding/hex"
)

// MD5 hash string of a provided valid file path
// http://www.mrwaggel.be/post/generate-md5-hash-of-a-file/
func Md5Hash(path string) (string, error) {
	//Initialize variable returnMD5String now in case an error has to be returned
	var returnMD5String string

	//Open the passed argument and check for any error
	file, err := os.Open(path)
	if err != nil {
		return returnMD5String, err
	}

	//Tell the program to call the following function when the current function returns
	defer file.Close()

	//Open a new hash interface to write to
	hash := md5.New()

	//Copy the file in the hash interface and check for any error
	if _, err := io.Copy(hash, file); err != nil {
		return returnMD5String, err
	}

	//Get the 16 bytes hash
	hashInBytes := hash.Sum(nil)[:16]

	//Convert the bytes to a string
	returnMD5String = hex.EncodeToString(hashInBytes)

	return returnMD5String, err
}

// FileExists verifies if a filepath exists
func FileExists(name string) bool {
	_, err := os.Stat(name)
	return !os.IsNotExist(err)
}


text:
package org.xlcloud.service;

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

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 * TODO Documentation
 *
 * @author Tomek Adamczewski, AMG.net
 */
@XmlAccessorType( XmlAccessType.FIELD )
@XmlType( name = "", propOrder = { "repository" } )
@XmlRootElement( name = "repositories" )
public class Repositories extends ListContext {

    @XmlElement( type = Repository.class )
    private List<Repository> repository;

    public List<Repository> getRepository() {
        if (repository == null) {
            repository = new ArrayList<Repository>();
        }
        return this.repository;
    }
}


text:
require 'spec_helper'

describe Moho::Lexer do
  it "tokenizes parentheses" do
    str = "((()))"
    tokens = [Moho::Lexer::LParen.new('(')] * 3 +
      [Moho::Lexer::RParen.new(')')] * 3

    expect(Moho::Lexer.tokenize(str)).to eq tokens
  end

  it "tokenizes numbers" do
    str = "123"
    tokens = [Moho::Lexer::Int.new("123")]

    expect(Moho::Lexer.tokenize(str)).to eq tokens
  end

  it "tokenizes strings" do
    str = "\"hello world\""
    tokens = [Moho::Lexer::String.new("\"hello world\"")]

    expect(Moho::Lexer.tokenize(str)).to eq tokens
  end

  it "tokenizes symbols" do
    symbols = ["hello", "+", "atan2", ">>="]

    symbols.each do |sym|
      expect(Moho::Lexer.tokenize(sym)).to eq [Moho::Lexer::Symbol.new(sym)]
    end
  end

  it "tokenizes booleans" do
    expect(Moho::Lexer.tokenize("#t")).to eq [Moho::Lexer::BoolTrue.new('#t')]
    expect(Moho::Lexer.tokenize("#f")).to eq [Moho::Lexer::BoolFalse.new('#f')]
  end

  it "puts it all together" do
    str = "(a 1 \"s\")"
    tokens = [
      Moho::Lexer::LParen.new('('),
      Moho::Lexer::Symbol.new('a'),
      Moho::Lexer::Int.new('1'),
      Moho::Lexer::String.new('"s"'),
      Moho::Lexer::RParen.new(')')
    ]

    expect(Moho::Lexer.tokenize(str)).to eq tokens
  end

  it "raises an error when nothing is recognized" do
    str = "\"unclosed quote"
    expect do
      Moho::Lexer.tokenize(str)
    end.to raise_error(Moho::Lexer::LexError)
  end
end


text:
<?php

namespace Gem\TestBundle\Controller\Security;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class SecurityController extends Controller
{
    public function controllerTestAction()
    {
        return new Response(json_encode(array("apikey"=>"ahaha")));
    }
}


text:
Before("@appsync") do
  @service = Aws::AppSync::Resource.new
  @client = @service.client
end

After("@appsync") do
  # shared cleanup logic
end


text:
package com.cognizant.devops.platformcommons.constants;

public final class ErrorMessage {
	 public static final String CATEGORY_AND_TOOL_NAME_NOT_SPECIFIED = "Category name and tool name is not specified";
	 public static final String DB_INSERTION_FAILED = "Failed to insert record in Databse";
	 public static final String UNEXPECTED_ERROR = "Unexpected error occured";
	 public static final String USERNAME_MISSING = "Missing Username";
	 public static final String ROLES_MISSING = "Missing Roles";
	 public static final String LAYOUT_SETTINGS_MISSING = "Layout settings are not specified";
	public static final String ERRORLOG="errorLog";
	public static final String PDFEXECUTION_ERROR="PDFExecutionSubscriber Completed with error ";
	public static final String WORKFLOW_ERROR="Worlflow Detail ==== Error setting PDF details in Email History table";
	public static final String FETCH_ERROR_MESSAGE="Error while fetching execution ids";

}


text:
<!DOCTYPE html>

        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Webpack Angular App</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <link href="/css/app.css" rel="stylesheet">

                    A&W

                            Home

                            About

                            News

                            Registration

                            Sign In

                <breadcrumbs list="main.breadcrumbs.list"></breadcrumbs>

            <alerts list="main.alerts.list" delete="main.alerts.remove"></alerts>


text:
import pytest
from datetime import date, time
from chronophore import controller
from chronophore.models import Entry

UNREGISTERED_ID = '000000000'

def test_signed_in_users(db_session, test_users):
    """List all signed in users. Don't list users
    who forgot to sign out on previous days."""
    sam_id = test_users['sam'].user_id

    db_session.add(
        Entry(
            uuid='781d8a2a-104b-480c-baba-98c55f11e80b',
            date=date(2016, 2, 10),
            forgot_sign_out=True,
            time_in=time(10, 25, 7),
            time_out=None,
            user_id=sam_id,
            user_type='student',
        )
    )
    db_session.commit()

    signed_in_users = [
        user for user in controller.signed_in_users(db_session, today=date(2016, 2, 17))
    ]

    assert [test_users['pippin'], test_users['merry']] == signed_in_users
    assert test_users['sam'] not in signed_in_users

def test_sign_starting(db_session, test_users):
    """Frodo, who is registered, signs in."""
    status = controller.sign(
        test_users['frodo'].user_id,
        user_type='student',
        today=date(2016, 2, 17),
        session=db_session,
    )

    assert status.valid
    assert status.in_or_out == 'in'
    assert status.user_name == 'Frodo Baggins'
    assert status.user_type == 'student'
    assert (
        db_session
        .query(Entry)
        .filter(Entry.user_id == test_users['frodo'].user_id)
        .filter(Entry.time_out.is_(None))
        .one()
    )

def test_sign_finishing(db_session, test_users):
    """Merry is done. He signs out."""
    merry_id = test_users['merry'].user_id

    status = controller.sign(merry_id, today=date(2016, 2, 17), session=db_session)

    assert status.valid
    assert status.in_or_out == 'out'
    assert status.user_name == 'Merry Brandybuck'
    assert status.user_type == 'tutor'
    assert (
        db_session
        .query(Entry)
        .filter(Entry.user_id == merry_id)
        .filter(Entry.time_out.is_(None))
        .one_or_none()
    ) is None

def test_sign_not_registered(db_session, test_users):
    """Someone tries to sign in with an unregistered
    ID. They are told to register at the front desk.
    The entry is not added to the database.
    """
    with pytest.raises(controller.UnregisteredUser):
        controller.sign(UNREGISTERED_ID, session=db_session)

    assert (
        db_session
        .query(Entry)
        .filter(Entry.user_id == UNREGISTERED_ID)
        .one_or_none()
    ) is None

def test_sign_duplicates(db_session, test_users):
    """Somehow, Sam has 2 signed in entries in the
    database. When he tries to sign in, a message is
    displayed and the duplicate entries are all signed
    out.
    """
    sam_id = test_users['sam'].user_id

    db_session.add_all([
        Entry(
            uuid='781d8a2a-104b-480c-baba-98c55f11e80b',
            date=date(2016, 2, 17),
            time_in=time(10, 25, 7),
            time_out=None,
            user_id=sam_id,
            user_type='student',
        ),
        Entry(
            uuid='621d98db-92e0-46d1-9cd5-55013777a7d9',
            date=date(2016, 2, 17),
            time_in=time(13, 55, 00),
            time_out=None,
            user_id=sam_id,
            user_type='student',
        ),
    ])
    db_session.commit()

    status = controller.sign(
        sam_id, today=date(2016, 2, 17), session=db_session
    )

    assert status.valid
    assert status.in_or_out == 'out'
    assert status.user_name == 'Sam Gamgee'
    assert status.user_type == 'student'
    assert (
        db_session
        .query(Entry)
        .filter(Entry.user_id == sam_id)
        .filter(Entry.time_out.is_(None))
        .one_or_none()
    ) is None

def test_sign_in_previously_forgot_sign_out(db_session, test_users):
    """Gandalf forgot to sign out on a previous day.
    When he enters his user id today, he is signed in.
    """
    gandalf_id = test_users['gandalf'].user_id

    db_session.add(
        Entry(
            uuid='781d8a2a-104b-480c-baba-98c55f11e80b',
            date=date(2016, 2, 10),
            forgot_sign_out=True,
            time_in=time(10, 25, 7),
            time_out=None,
            user_id=gandalf_id,
            user_type='tutor',
        )
    )
    db_session.commit()

    status = controller.sign(gandalf_id, session=db_session)

    assert status.valid
    assert status.in_or_out == 'in'
    assert status.user_name == 'Gandalf the Grey'
    assert status.user_type == 'tutor'
    assert (
        db_session
        .query(Entry)
        .filter(Entry.forgot_sign_out.is_(False))
        .filter(Entry.user_id == test_users['gandalf'].user_id)
        .filter(Entry.time_out.is_(None))
        .one()
    )

def test_flag_forgotten_entries(db_session, test_users):
    """Frodo and sam forgot to sign out yesterday. Their
    entries are flagged automatically.
    """
    today = date(2016, 2, 17)
    yesterday = date(2016, 2, 16)

    db_session.add_all([
        Entry(
            uuid='f0030733-b216-430b-be34-79fa26cbf87d',
            date=yesterday,
            forgot_sign_out=False,
            time_in=time(14, 5, 2),
            time_out=None,
            user_id=test_users['frodo'].user_id,
            user_type='tutor',
        ),
        Entry(
            uuid='ffac853d-12ac-4a85-8b6f-7c9793479633',
            date=yesterday,
            forgot_sign_out=False,
            time_in=time(10, 45, 3),
            time_out=None,
            user_id=test_users['sam'].user_id,
            user_type='student',
        ),
    ])
    db_session.commit()

    controller.flag_forgotten_entries(db_session, today)

    flagged = db_session.query(Entry).filter(Entry.date == yesterday)
    for entry in flagged:
        assert entry.time_out is None
        assert entry.forgot_sign_out

def test_sign_in_student(test_users):
    """Sam, who is just a student, signs in."""
    entry = controller.sign_in(test_users['sam'])
    assert entry.user_type == 'student'

def test_sign_in_tutor(test_users):
    """Gandalf, who is just a tutor, signs in."""
    entry = controller.sign_in(test_users['gandalf'])
    assert entry.user_type == 'tutor'

def test_sign_in_ambiguous(test_users):
    """Frodo, who is both a student and a tutor,
    signs in. An AmbiguousUserType exception is raised
    to be handled by the gui.
    """
    with pytest.raises(controller.AmbiguousUserType):
        controller.sign_in(test_users['frodo'])

def test_undo_sign_in(test_users, db_session):
    """Pippin signs in, but then presses 'cancel'.
    His entry is deleted.
    """
    signed_in_entry = Entry(
        uuid='781d8a2a-104b-480c-baba-98c55f11e80b',
        date=date(2016, 2, 10),
        forgot_sign_out=True,
        time_in=time(10, 25, 7),
        time_out=None,
        user_id=test_users['pippin'].user_id,
        user_type='student',
    )
    db_session.add(signed_in_entry)

    controller.undo_sign_in(signed_in_entry, db_session)

    deleted = (
        db_session
        .query(Entry)
        .filter(Entry.uuid == signed_in_entry.uuid)
        .one_or_none()
    )

    assert deleted is None

def test_undo_sign_out(test_users, db_session):
    """Pippin signs out, but then presses 'cancel'.
    He is signed back in.
    """
    signed_out_entry = Entry(
        uuid='781d8a2a-104b-480c-baba-98c55f11e80b',
        date=date(2016, 2, 10),
        forgot_sign_out=True,
        time_in=time(10, 25, 7),
        time_out=time(11, 30, 10),
        user_id=test_users['pippin'].user_id,
        user_type='student',
    )

    db_session.add(signed_out_entry)
    controller.undo_sign_out(signed_out_entry, db_session)

    signed_back_in = (
        db_session
        .query(Entry)
        .filter(Entry.uuid == signed_out_entry.uuid)
        .one()
    )

    assert signed_back_in.time_out is None

def test_get_user_name(test_users):
    """Look up Sam's name."""
    name = controller.get_user_name(test_users['sam'])
    assert name == 'Sam Gamgee'

def test_get_user_first_name(test_users):
    """Look up Sam's first name."""
    name = controller.get_user_name(test_users['sam'], full_name=False)
    assert name == 'Sam'

def test_get_multi_word_user_name(test_users):
    """Get Gandalf's full name, which has more than
    just 2 words.
    """
    name = controller.get_user_name(test_users['gandalf'])
    assert name == 'Gandalf the Grey'


text:
static char nodeInitialized_ = 0;
//pointer to the local node data
static struct nodeData nodeData_;
//all available request handles
static struct request_data requestPool[MCAPI_MAX_REQUESTS];
//iterator used to index above array
static unsigned int request_iter = 0;

struct nodeData* getNodeData()
{
    return &nodeData_;
}

void mcapi_initialize(MCAPI_IN mcapi_domain_t domain_id,
    MCAPI_IN mcapi_node_t node_id,
    MCAPI_IN mcapi_node_attributes_t* mcapi_node_attributes,
    MCAPI_IN mcapi_param_t* init_parameters,
    MCAPI_OUT mcapi_info_t* mcapi_info,
    MCAPI_OUT mcapi_status_t* mcapi_status)
{
    //iterator for endpoint initialization
    unsigned int x;
    //error code returned from some system calls
    unsigned int error_code;

    //must not be null
    if ( mcapi_info == NULL )
    {
        *mcapi_status = MCAPI_ERR_PARAMETER;
        return;
    }

    #ifdef ALLOW_THREAD_SAFETY
    //create mutex, may fail because it exists already
    error_code = pthread_mutex_init(&nodeData_.mutex, NULL);

    if ( error_code != EBUSY && error_code != 0 )
    {
        //something unexpected
        perror("When creating mutex for the node");
        *mcapi_status = MCAPI_ERR_GENERAL;
        return;
    }

    //lock mutex for initialization
    if ( pthread_mutex_lock(&nodeData_.mutex) != 0 )
    {
        //something unexpected
        perror("When locking node mutex for initialize");
        *mcapi_status = MCAPI_ERR_GENERAL;
        return;
    }
    #endif

    //must not be inited already
    if ( nodeInitialized_ == 1 )
    {
        *mcapi_status = MCAPI_ERR_NODE_INITIALIZED;

        goto ret;
    }

    //save the ids so that they may be checked later
    nodeData_.domain_id = domain_id;
    nodeData_.node_id = node_id;

    //mark endpoints initially non-initialized, since they are
    for ( x = 0; x < ENDPOINT_COUNT; ++x )
    {
        #ifdef ALLOW_THREAD_SAFETY
        //create mutex to use with the endpoint data
        if ( pthread_mutex_init(&nodeData_.endPoints[x].mutex, NULL) != 0 )
        {
            perror("When creating mutex for an endpoint");
        }

        //lock mutex for initialization
        if ( pthread_mutex_lock(&nodeData_.endPoints[x].mutex) != 0 )
        {
            //something unexpected
            perror("When locking  endpoint mutex for initialize");
            *mcapi_status = MCAPI_ERR_GENERAL;
            return;
        }
        #endif

        //mark non-init, but also non-open and non-pending
        nodeData_.endPoints[x].inited = -1;
        nodeData_.endPoints[x].open = -1;
        nodeData_.endPoints[x].pend_open = -1;
        nodeData_.endPoints[x].pend_close = -1;
        nodeData_.endPoints[x].synced = -1;

        //the default timeout is infinite
        nodeData_.endPoints[x].time_out = MCAPI_TIMEOUT_INFINITE;

        //pair with corresponding endpoint definition
        nodeData_.endPoints[x].defs = findDef( x );

        #ifdef ALLOW_THREAD_SAFETY
        //free to use
        if ( pthread_mutex_unlock(&nodeData_.endPoints[x].mutex) != 0 )
        {
            //something unexpected
            perror("When unlocking endpoint mutex from initialize");
        }
        #endif
    }

    //initialize requests
    for ( x = 0; x < MCAPI_MAX_REQUESTS; ++x )
    {
        mcapi_request_t request = &requestPool[x];

        //mark complete and null function and data
        request->complete = MCAPI_TRUE;
        request->function = MCAPI_NULL;
        request->data = MCAPI_NULL;
        request->reserved = MCAPI_FALSE;

        #ifdef ALLOW_THREAD_SAFETY
        //create mutex to use with the request
        error_code = pthread_mutex_init(&request->mutex, NULL);

        if ( error_code != EBUSY && error_code != 0 )
        {
            perror("When creating mutex for a request");
        }
        #endif
    }

    //clear buffers for packet channels
    bufClearAll();

    //have names constructed
    initMsgqNames();

    //fill in the info
    mcapi_info->mcapi_version = MCAPI_VERSION;
    mcapi_info->organization_id = MCAPI_ORG_ID;
    mcapi_info->implementation_version = MCAPI_IMPL_VERSION;
    mcapi_info->number_of_domains = MCAPI_MAX_DOMAIN;
    mcapi_info->number_of_nodes = MCAPI_MAX_NODE;
    mcapi_info->number_of_ports = MCAPI_MAX_PORT;

    //succée
    *mcapi_status = MCAPI_SUCCESS;

    //mark that we are inited!
    nodeInitialized_ = 1;

    ret:
        #ifdef ALLOW_THREAD_SAFETY
        //free to use
        if ( pthread_mutex_unlock(&nodeData_.mutex) != 0 )
        {
            //something unexpected
            perror("When unlocking node mutex from initialize");
        }
        #else
        return;
        #endif
}

void mcapi_finalize( MCAPI_OUT mcapi_status_t* mcapi_status)
{
    //iterators for endpoint finalization: domain, node, port
    unsigned int x;

    #ifdef ALLOW_THREAD_SAFETY
    if ( pthread_mutex_lock(&nodeData_.mutex) != 0 )
    {
        //something unexpected
        perror("When locking node mutex for finalize");
        *mcapi_status = MCAPI_ERR_GENERAL;
        return;
    }
    #endif

    //check for initialization
    if ( nodeInitialized_ != 1 )
    {
        //no init means failure
        *mcapi_status = MCAPI_ERR_NODE_NOTINIT;
        goto ret;
    }

    //unlink and close the message queues
    for ( x = 0; x < ENDPOINT_COUNT; ++x )
    {
        struct endPointData* epd = &nodeData_.endPoints[x];

        //skip if not inited to begin with
        if ( epd->inited != 1 )
            continue;

        //close, so that we are no longer reserving them
        pmq_delete_epd( epd );
        pmq_delete_chan( epd, MCAPI_TRUE );
    }

    //discard requests
    for ( x = 0; x < MCAPI_MAX_REQUESTS; ++x )
    {
        mcapi_request_t request = &requestPool[x];

        //mark complete and null function and data
        request->complete = MCAPI_TRUE;
        request->function = MCAPI_NULL;
        request->data = MCAPI_NULL;
        request->reserved = MCAPI_FALSE;
    }

    //mark that we are not inited!
    nodeInitialized_ = 0;

    //succée
    *mcapi_status = MCAPI_SUCCESS;

    ret:
        #ifdef ALLOW_THREAD_SAFETY
        if ( pthread_mutex_unlock(&nodeData_.mutex) != 0 )
        {
            //something unexpected
            perror("When unlocking node mutex after finalize");
        }
        #else
        return;
        #endif
}

mcapi_boolean_t mcapi_test(
    MCAPI_IN mcapi_request_t* request,
    MCAPI_OUT size_t* size,
    MCAPI_OUT mcapi_status_t* mcapi_status )
{
    //NOTICE: in principle, should not work correctly, but it does  since
    //non-blocking calls of this implementation are limited anyway.
    mcapi_boolean_t ret_val = mcapi_wait( request, size, 0, mcapi_status );

    //fix the status, as accordingly specification, should work that way
    if ( *mcapi_status == MCAPI_TIMEOUT )
        *mcapi_status = MCAPI_PENDING;

    return ret_val;
}

mcapi_boolean_t mcapi_wait(
    MCAPI_IN mcapi_request_t* request,
    MCAPI_OUT size_t* size,
    MCAPI_IN mcapi_timeout_t timeout,
    MCAPI_OUT mcapi_status_t* mcapi_status)
{
    //becomes true, if completed
    mcapi_boolean_t complete;
    //how close we are to timeout
    mcapi_timeout_t ticks = 0;

    //check for initialization
    if ( mcapi_trans_initialized() == MCAPI_FALSE )
    {
        //no init means failure
        *mcapi_status = MCAPI_ERR_NODE_NOTINIT;
        return MCAPI_FALSE;
    }

    //request must be ok, this includes existing function to call
    if ( !mcapi_trans_valid_request_handle(request) ||
    (*request) == MCAPI_NULL || (*request)->function == MCAPI_NULL )
    {
        *mcapi_status = MCAPI_ERR_REQUEST_INVALID;
        return MCAPI_FALSE;
    }

    //must be valid size as well
    if ( !mcapi_trans_valid_size_param(size) )
    {
        *mcapi_status = MCAPI_ERR_PARAMETER;
        return MCAPI_FALSE;
    }

    #ifdef ALLOW_THREAD_SAFETY
    {
        int error_code;

        //no two threads may wait the same request!
        error_code = pthread_mutex_trylock( &(*request)->mutex );

        if ( error_code == EBUSY )
        {
            //simultaenous access
            *mcapi_status = MCAPI_ERR_WAIT_PENDING;
            return MCAPI_FALSE;
        }
        else if ( error_code != 0 )
        {
            //something unexpected
            perror("When checking mutex for simultaenous wait");
            *mcapi_status = MCAPI_ERR_GENERAL;
            return MCAPI_FALSE;
        }
    }
    #endif

    //initial value of completeness is taken from request handle
    complete = (*request)->complete;

    while ( complete != MCAPI_TRUE && ( timeout == MCAPI_TIMEOUT_INFINITE ||
    ticks <= timeout ) )
    {
        //sleep a millisecond between iterations
        usleep(1000);
        //call the waited-for function
        complete = (*request)->function( (*request)->data );
        //closer to time out!
        ++ticks;
    }

    if ( complete != MCAPI_TRUE )
    {
        //not complete already -> timeout
        *mcapi_status = MCAPI_TIMEOUT;
    }
    else
    {
        //the operation is complete -> ready to return with success
        *mcapi_status = MCAPI_SUCCESS;
        (*request)->complete = MCAPI_TRUE;
        (*request)->reserved = MCAPI_FALSE;
    }

    #ifdef ALLOW_THREAD_SAFETY
    //we no longer need the mutex either way
    if ( pthread_mutex_unlock(&(*request)->mutex) != 0 )
    {
        perror("When unlocking request mutex");
    }
    #endif

    return complete;
}

mcapi_request_t reserve_request(
    mcapi_boolean_t (*function) (void*),
    void* data )
{
    unsigned int i;
    mcapi_request_t to_ret = MCAPI_NULL;

    #ifdef ALLOW_THREAD_SAFETY
    //needs node here
    if ( pthread_mutex_lock(&nodeData_.mutex) != 0 )
    {
        perror("When locking node mutex for request free");
    }
    #endif

    //terminated after the whole request pool is gone-through
    for ( i = 0; i < MCAPI_MAX_REQUESTS; ++i )
    {
        //take the next request
        mcapi_request_t request = &requestPool[request_iter];

        //time to increase iterator
        ++request_iter;

        //if through, zero it
        if ( request_iter >= MCAPI_MAX_REQUESTS )
            request_iter = 0;

        //if free, return
        if ( request->reserved == MCAPI_FALSE )
        {
            to_ret = request;
            //fill up details
            to_ret->function = function;
            to_ret->data = data;
            to_ret->complete = MCAPI_FALSE;
            //and mark it reserved
            to_ret->reserved = MCAPI_TRUE;

            //no need for further iteration
            break;
        }
    }

    #ifdef ALLOW_THREAD_SAFETY
    //free node mutex
    if ( pthread_mutex_unlock(&nodeData_.mutex) != 0 )
    {
        perror("When unlocking node mutex from request free");
    }
    #endif

    return to_ret;
}

//macro used to simplify the below code-to-text function
#define STATUS_CASE( status ) \
    case( status ): message = strcpy(status_message, #status); break;

char* mcapi_display_status(
    MCAPI_IN mcapi_status_t status,
    MCAPI_OUT char* status_message,
    MCAPI_IN size_t size)
{
    //pointer to the buffer
    char* message;

    //switch-casing shall be simplest way to branch between possibilities.
    //in case off unidentified code, a null is returned.
    switch (status) {
        STATUS_CASE (MCAPI_SUCCESS)
        STATUS_CASE (MCAPI_PENDING)
        STATUS_CASE (MCAPI_TIMEOUT)
        STATUS_CASE (MCAPI_ERR_PARAMETER)
        STATUS_CASE (MCAPI_ERR_DOMAIN_INVALID)
        STATUS_CASE (MCAPI_ERR_NODE_INVALID)
        STATUS_CASE (MCAPI_ERR_NODE_INITFAILED)
        STATUS_CASE (MCAPI_ERR_NODE_INITIALIZED)
        STATUS_CASE (MCAPI_ERR_NODE_NOTINIT)
        STATUS_CASE (MCAPI_ERR_NODE_FINALFAILED)
        STATUS_CASE (MCAPI_ERR_PORT_INVALID)
        STATUS_CASE (MCAPI_ERR_ENDP_INVALID)
        STATUS_CASE (MCAPI_ERR_ENDP_EXISTS)
        STATUS_CASE (MCAPI_ERR_ENDP_GET_LIMIT)
        STATUS_CASE (MCAPI_ERR_ENDP_NOTOWNER)
        STATUS_CASE (MCAPI_ERR_ENDP_REMOTE)
        STATUS_CASE (MCAPI_ERR_ATTR_INCOMPATIBLE)
        STATUS_CASE (MCAPI_ERR_ATTR_SIZE)
        STATUS_CASE (MCAPI_ERR_ATTR_NUM)
        STATUS_CASE (MCAPI_ERR_ATTR_VALUE)
        STATUS_CASE (MCAPI_ERR_ATTR_NOTSUPPORTED)
        STATUS_CASE (MCAPI_ERR_ATTR_READONLY)
        STATUS_CASE (MCAPI_ERR_MSG_SIZE)
        STATUS_CASE (MCAPI_ERR_MSG_TRUNCATED)
        STATUS_CASE (MCAPI_ERR_CHAN_OPEN)
        STATUS_CASE (MCAPI_ERR_CHAN_TYPE)
        STATUS_CASE (MCAPI_ERR_CHAN_DIRECTION)
        STATUS_CASE (MCAPI_ERR_CHAN_CONNECTED)
        STATUS_CASE (MCAPI_ERR_CHAN_OPENPENDING)
        STATUS_CASE (MCAPI_ERR_CHAN_CLOSEPENDING)
        STATUS_CASE (MCAPI_ERR_CHAN_NOTOPEN)
        STATUS_CASE (MCAPI_ERR_CHAN_INVALID)
        STATUS_CASE (MCAPI_ERR_PKT_SIZE)
        STATUS_CASE (MCAPI_ERR_TRANSMISSION)
        STATUS_CASE (MCAPI_ERR_PRIORITY)
        STATUS_CASE (MCAPI_ERR_BUF_INVALID)
        STATUS_CASE (MCAPI_ERR_MEM_LIMIT)
        STATUS_CASE (MCAPI_ERR_REQUEST_INVALID)
        STATUS_CASE (MCAPI_ERR_REQUEST_LIMIT)
        STATUS_CASE (MCAPI_ERR_REQUEST_CANCELLED)
        STATUS_CASE (MCAPI_ERR_WAIT_PENDING)
        STATUS_CASE (MCAPI_ERR_GENERAL)
        STATUS_CASE (MCAPI_STATUSCODE_END)
        default : return NULL;
    };

    //enforce policy of null-termination
    if ( size > 0 )
        message[size-1] = '\0';

    //return pointer to the buffer
    return message;
}

struct endPointData* findEpd( mcapi_domain_t domain_id, mcapi_node_t node_id,
unsigned int port_id)
{
    unsigned int i;

    for ( i = 0; i < ENDPOINT_COUNT; ++i )
    {
        struct endPointData* epd = &nodeData_.endPoints[i];
        struct endPointDef* e = epd->defs;

        //provided end point identifier match definition identifier -> is found
        if ( node_id == e->us.node_id && domain_id == e->us.domain_id &&
        port_id == e->us.port_id )
        {
            return epd;
        }
    }

    return MCAPI_NULL;
}

mcapi_domain_t mcapi_domain_id_get(
    MCAPI_OUT mcapi_status_t* mcapi_status )
{
    //check for initialization
    if ( mcapi_trans_initialized() == MCAPI_FALSE )
    {
        //no init means failure
        *mcapi_status = MCAPI_ERR_NODE_NOTINIT;
        return MCAPI_FALSE;
    }

    //return the set domain_id
    return nodeData_.domain_id;
}

mcapi_domain_t mcapi_node_id_get(
    MCAPI_OUT mcapi_status_t* mcapi_status )
{
    //check for initialization
    if ( mcapi_trans_initialized() == MCAPI_FALSE )
    {
        //no init means failure
        *mcapi_status = MCAPI_ERR_NODE_NOTINIT;
        return MCAPI_FALSE;
    }

    //return the set node_id
    return nodeData_.node_id;
}

//checks if size parameter is valid
mcapi_boolean_t mcapi_trans_valid_size_param (MCAPI_IN size_t* size)
{
    if ( size == NULL )
    {
        return MCAPI_FALSE;
    }

    return MCAPI_TRUE;
}

//checks if request parameter is valid
mcapi_boolean_t mcapi_trans_valid_request_handle
(MCAPI_IN mcapi_request_t* request)
{
    if ( request == MCAPI_NULL )
    {
        return MCAPI_FALSE;
    }

    return MCAPI_TRUE;
}

//returns true if the node is initialized, else return false
mcapi_boolean_t mcapi_trans_initialized ()
{
    #ifdef ALLOW_THREAD_SAFETY
    if ( pthread_mutex_lock(&nodeData_.mutex) != 0 )
    {
        //something unexpected
        perror("When locking node mutex to check init");
        return MCAPI_FALSE;
    }
    #endif

    //wacha we return
    mcapi_boolean_t retval = MCAPI_FALSE;

    //is true if inited
    if ( nodeInitialized_ == 1 )
    {
        retval = MCAPI_TRUE;
    }

    #ifdef ALLOW_THREAD_SAFETY
    if ( pthread_mutex_unlock(&nodeData_.mutex) != 0 )
    {
        //something unexpected
        perror("When unlocking node mutex from init check");
    }
    #endif

    return retval;
}

//checks if given priority is within the limits
mcapi_boolean_t mcapi_trans_valid_priority(mcapi_priority_t priority)
{
    if ( priority < 0 || priority > MCAPI_MAX_PRIORITY )
    {
        return MCAPI_FALSE;
    }

    return MCAPI_TRUE;
}

//checks if buffer parameter is valid
mcapi_boolean_t mcapi_trans_valid_buffer_param (MCAPI_IN void* buffer)
{
    if ( buffer == MCAPI_NULL )
    {
        return MCAPI_FALSE;
    }

    return MCAPI_TRUE;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Usnea moniliformis Motyka

### Remarks
null


text:
package com.netflix.hollow.tools.combine;

import com.netflix.hollow.core.index.HollowPrimaryKeyIndex;
import java.util.Map;

/**
 * Used by the {@link HollowCombiner} to deduplicate records in the output based on primary keys.  Not intended for external consumption.
 *
 * @author dkoszewnik
 *
 */
class HollowCombinerPrimaryKeyOrdinalRemapper implements OrdinalRemapper {

    private final Map<String, HollowPrimaryKeyIndex[]> primaryKeyIndexes;
    private final OrdinalRemapper baseRemappers[];
    private final int stateEngineIdx;

    public HollowCombinerPrimaryKeyOrdinalRemapper(OrdinalRemapper[] baseRemappers, Map<String, HollowPrimaryKeyIndex[]> primaryKeyIndexes, int stateEngineIdx) {
        this.primaryKeyIndexes = primaryKeyIndexes;
        this.baseRemappers = baseRemappers;
        this.stateEngineIdx = stateEngineIdx;
    }

    @Override
    public int getMappedOrdinal(String type, int originalOrdinal) {
        return baseRemappers[stateEngineIdx].getMappedOrdinal(type, originalOrdinal);
    }

    @Override
    public void remapOrdinal(String type, int originalOrdinal, int mappedOrdinal) {
        baseRemappers[stateEngineIdx].remapOrdinal(type, originalOrdinal, mappedOrdinal);

        HollowPrimaryKeyIndex[] typeKeyIndexes = this.primaryKeyIndexes.get(type);
        if(typeKeyIndexes != null) {
            Object primaryKey[] = typeKeyIndexes[stateEngineIdx].getRecordKey(originalOrdinal);

            for(int i=0;i<baseRemappers.length;i++) {
                if(i != stateEngineIdx) {
                    if(typeKeyIndexes[i] != null) {
                        int matchOrdinal = typeKeyIndexes[i].getMatchingOrdinal(primaryKey);
                        if(matchOrdinal != -1) {
                            baseRemappers[i].remapOrdinal(type, matchOrdinal, mappedOrdinal);
                        }
                    }
                }
            }
        }
    }

    @Override
    public boolean ordinalIsMapped(String type, int originalOrdinal) {
        return baseRemappers[stateEngineIdx].ordinalIsMapped(type, originalOrdinal);
    }

}


text:
class Game	{

private:
	const unsigned int ID;
	const bool prePost;

protected:
	const unsigned int nSeatsAtTable;

public:

	Game(unsigned int gameID, unsigned int nSeatsAtTable, bool prePost) : ID(gameID), prePost(prePost), nSeatsAtTable(nSeatsAtTable)
		{

		}
	unsigned int getID()
		{
			return this->ID;

		}
	// todo: make private?
	bool getPrePost()
		{
		return this->prePost;
		}
	unsigned int getNSeatsAtTable()
		{
		return this->nSeatsAtTable;
		}
	};


text:
package de.fct.companian.model.binding.bdl;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

import de.fct.fdmm.bindingdl.Descriptor;
import de.fct.fdmm.bindingdl.Task;

public class DefaultTask implements Task {

    private String name;
    private String selector;
    private String content;
    private Descriptor descriptor;

    @XmlAttribute
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlElement
    public String getSelector() {
        return selector;
    }

    public void setSelector(String selector) {
        this.selector = selector;
    }

    @XmlElement
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @XmlElement(type=DefaultDescriptor.class)
    public Descriptor getDescriptor() {
        return descriptor;
    }

    public void setDescriptor(Descriptor descriptor) {
        this.descriptor = descriptor;
    }

}


text:
//
//  Generated by the J2ObjC translator.  DO NOT EDIT!
//  source: android/libcore/luni/src/main/java/java/util/FormatterClosedException.java
//

#ifndef _JavaUtilFormatterClosedException_H_
#define _JavaUtilFormatterClosedException_H_

#include "J2ObjC_header.h"
#include "java/io/Serializable.h"
#include "java/lang/IllegalStateException.h"

/*!
 @brief A FormatterClosedException will be thrown if the formatter has been
 closed.
 */
@interface JavaUtilFormatterClosedException : JavaLangIllegalStateException < JavaIoSerializable >

#pragma mark Public

/*!
 @brief Constructs a new FormatterClosedException with the stack trace
 filled in.
 */
- (instancetype)init;

@end

J2OBJC_EMPTY_STATIC_INIT(JavaUtilFormatterClosedException)

FOUNDATION_EXPORT void JavaUtilFormatterClosedException_init(JavaUtilFormatterClosedException *self);

FOUNDATION_EXPORT JavaUtilFormatterClosedException *new_JavaUtilFormatterClosedException_init() NS_RETURNS_RETAINED;

J2OBJC_TYPE_LITERAL_HEADER(JavaUtilFormatterClosedException)

#endif // _JavaUtilFormatterClosedException_H_


text:
funny-mathematics
=================


text:
#ifndef BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP
#define BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include <boost/asio/detail/config.hpp>

#include <cstddef>
#include <boost/asio/detail/socket_types.hpp>

#include <boost/asio/detail/push_options.hpp>

namespace boost {
namespace asio {
namespace generic {
namespace detail {

// Helper class for implementing a generic socket endpoint.
class endpoint
{
public:
  // Default constructor.
  BOOST_ASIO_DECL endpoint();

  // Construct an endpoint from the specified raw bytes.
  BOOST_ASIO_DECL endpoint(const void* sock_addr,
      std::size_t sock_addr_size, int sock_protocol);

  // Copy constructor.
  endpoint(const endpoint& other)
    : data_(other.data_),
      size_(other.size_),
      protocol_(other.protocol_)
  {
  }

  // Assign from another endpoint.
  endpoint& operator=(const endpoint& other)
  {
    data_ = other.data_;
    size_ = other.size_;
    protocol_ = other.protocol_;
    return *this;
  }

  // Get the address family associated with the endpoint.
  int family() const
  {
    return data_.base.sa_family;
  }

  // Get the socket protocol associated with the endpoint.
  int protocol() const
  {
    return protocol_;
  }

  // Get the underlying endpoint in the native type.
  boost::asio::detail::socket_addr_type* data()
  {
    return &data_.base;
  }

  // Get the underlying endpoint in the native type.
  const boost::asio::detail::socket_addr_type* data() const
  {
    return &data_.base;
  }

  // Get the underlying size of the endpoint in the native type.
  std::size_t size() const
  {
    return size_;
  }

  // Set the underlying size of the endpoint in the native type.
  BOOST_ASIO_DECL void resize(std::size_t size);

  // Get the capacity of the endpoint in the native type.
  std::size_t capacity() const
  {
    return sizeof(boost::asio::detail::sockaddr_storage_type);
  }

  // Compare two endpoints for equality.
  BOOST_ASIO_DECL friend bool operator==(
      const endpoint& e1, const endpoint& e2);

  // Compare endpoints for ordering.
  BOOST_ASIO_DECL friend bool operator<(
      const endpoint& e1, const endpoint& e2);

private:
  // The underlying socket address.
  union data_union
  {
    boost::asio::detail::socket_addr_type base;
    boost::asio::detail::sockaddr_storage_type generic;
  } data_;

  // The length of the socket address stored in the endpoint.
  std::size_t size_;

  // The socket protocol associated with the endpoint.
  int protocol_;

  // Initialise with a specified memory.
  BOOST_ASIO_DECL void init(const void* sock_addr,
      std::size_t sock_addr_size, int sock_protocol);
};

} // namespace detail
} // namespace generic
} // namespace asio
} // namespace boost

#include <boost/asio/detail/pop_options.hpp>

#if defined(BOOST_ASIO_HEADER_ONLY)
# include <boost/asio/generic/detail/impl/endpoint.ipp>
#endif // defined(BOOST_ASIO_HEADER_ONLY)

#endif // BOOST_ASIO_GENERIC_DETAIL_ENDPOINT_HPP


text:
cask 'typora' do
  version '0.9.9.16.2'
  sha256 '38ebec7cf669c2366e0c890aebc90723e906e710e81c1e2e8a389aadb86938f8'

  url "https://www.typora.io/download/Typora-#{version}.dmg"
  appcast 'https://www.typora.io/download/dev_update.xml'
  name 'Typora'
  homepage 'https://typora.io/'

  auto_updates true
  depends_on macos: '>= :mavericks'

  app 'Typora.app'

  zap trash: [
               '~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/abnerworks.typora.sfl*',
               '~/Library/Application Support/Typora',
               '~/Library/Application Support/abnerworks.Typora',
               '~/Library/Caches/abnerworks.Typora',
               '~/Library/Cookies/abnerworks.Typora.binarycookies',
               '~/Library/Preferences/abnerworks.Typora.plist',
               '~/Library/Saved Application State/abnerworks.Typora.savedState',
               '~/Library/WebKit/abnerworks.Typora',
             ]
end


text:
package Battleships.Ships;

/*
 * Author: Michael
 * Created: 05 December 2004 18:57:44
 * Modified: 05 December 2004 18:57:44
 */
import java.io.Serializable;

import Battleships.Grid;

@SuppressWarnings("serial")
public class Minesweeper extends Ship implements Serializable {
	private int intactSegments = 2;

	public Minesweeper(Grid board, int i, int j, boolean isHorizontal) {
		super.placeShipOnGrid(board, i, j, isHorizontal, intactSegments);
	}

	public boolean isSunk() {
		return (intactSegments == 0);
	}

	/**
	 * Reduces the number of intact segments of the ship by one when called.
	 */

	public void scoreHit() {
		intactSegments--;

		if (intactSegments < 0)
			throw new IllegalArgumentException("Segments var is less than 0");
	}

}


text:
\hypertarget{class_ogre_bullet_draw}{\section{Ogre\-Bullet\-Draw Class Reference}
\label{class_ogre_bullet_draw}\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}}
}

Ogre bullet draw.

{\ttfamily \#include $<$Ogre\-Bullet\-Draw.\-h$>$}

Inheritance diagram for Ogre\-Bullet\-Draw\-:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{class_ogre_bullet_draw}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{class_ogre_bullet_draw_a9c4103fcc420fe9b69cb9d74f8e8e547}{Ogre\-Bullet\-Draw} ()
\begin{DoxyCompactList}\small\item\em Default constructor. \end{DoxyCompactList}\item
virtual \hyperlink{class_ogre_bullet_draw_acf45d6e54ea76ce26bca1cd8db4afb9f}{$\sim$\-Ogre\-Bullet\-Draw} ()
\begin{DoxyCompactList}\small\item\em Destructor. \end{DoxyCompactList}\item
virtual void \hyperlink{class_ogre_bullet_draw_a98ce833b82367cfa3233d47d9350995b}{draw\-Line} (const bt\-Vector3 \&from, const bt\-Vector3 \&to, const bt\-Vector3 \&from\-Color, const bt\-Vector3 \&to\-Color)
\begin{DoxyCompactList}\small\item\em Draw line. \end{DoxyCompactList}\item
virtual void \hyperlink{class_ogre_bullet_draw_ae4a737c479e71935dbd5483763adc299}{draw\-Line} (const bt\-Vector3 \&from, const bt\-Vector3 \&to, const bt\-Vector3 \&color)
\begin{DoxyCompactList}\small\item\em Draw line. \end{DoxyCompactList}\item
virtual void \hyperlink{class_ogre_bullet_draw_a9be5e64d3202665bb137bbc234457b82}{set\-Debug\-Mode} (int debug\-Mode)
\begin{DoxyCompactList}\small\item\em Sets debug mode. \end{DoxyCompactList}\item
virtual int \hyperlink{class_ogre_bullet_draw_a7929d3ac3b12030aef451c1c996069c4}{get\-Debug\-Mode} () const
\begin{DoxyCompactList}\small\item\em Gets debug mode. \end{DoxyCompactList}\item
virtual void \hyperlink{class_ogre_bullet_draw_add7c437d446cd65f00c600f70707deff}{draw\-Contact\-Point} (const bt\-Vector3 \&Point\-On\-B, const bt\-Vector3 \&normal\-On\-B, bt\-Scalar distance, int life\-Time, const bt\-Vector3 \&color)
\begin{DoxyCompactList}\small\item\em Draw contact point. \end{DoxyCompactList}\item
virtual void \hyperlink{class_ogre_bullet_draw_a1e0a1e7e892862f415aabcc0eb1b1baf}{report\-Error\-Warning} (const char $\ast$warning\-String)
\begin{DoxyCompactList}\small\item\em Reports error warning. \end{DoxyCompactList}\item
virtual void \hyperlink{class_ogre_bullet_draw_aeb7f2d2ccce27cb4374190dff6d37e61}{draw3d\-Text} (const bt\-Vector3 \&location, const char $\ast$text\-String)
\begin{DoxyCompactList}\small\item\em Draw 3\-D text. \end{DoxyCompactList}\end{DoxyCompactItemize}

\subsection{Detailed Description}
Ogre bullet draw.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_ogre_bullet_draw_a9c4103fcc420fe9b69cb9d74f8e8e547}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}}
\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{Ogre\-Bullet\-Draw}]{\setlength{\rightskip}{0pt plus 5cm}Ogre\-Bullet\-Draw\-::\-Ogre\-Bullet\-Draw (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_ogre_bullet_draw_a9c4103fcc420fe9b69cb9d74f8e8e547}

Default constructor.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}
\hypertarget{class_ogre_bullet_draw_acf45d6e54ea76ce26bca1cd8db4afb9f}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!$\sim$\-Ogre\-Bullet\-Draw@{$\sim$\-Ogre\-Bullet\-Draw}}
\index{$\sim$\-Ogre\-Bullet\-Draw@{$\sim$\-Ogre\-Bullet\-Draw}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{$\sim$\-Ogre\-Bullet\-Draw}]{\setlength{\rightskip}{0pt plus 5cm}Ogre\-Bullet\-Draw\-::$\sim$\-Ogre\-Bullet\-Draw (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_acf45d6e54ea76ce26bca1cd8db4afb9f}

Destructor.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\subsection{Member Function Documentation}
\hypertarget{class_ogre_bullet_draw_aeb7f2d2ccce27cb4374190dff6d37e61}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!draw3d\-Text@{draw3d\-Text}}
\index{draw3d\-Text@{draw3d\-Text}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{draw3d\-Text}]{\setlength{\rightskip}{0pt plus 5cm}void Ogre\-Bullet\-Draw\-::draw3d\-Text (
\begin{DoxyParamCaption}
\item[{const bt\-Vector3 \&}]{location, }
\item[{const char $\ast$}]{text\-String}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_aeb7f2d2ccce27cb4374190dff6d37e61}

Draw 3\-D text.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\begin{DoxyParams}{Parameters}
{\em location} & The location. \\
\hline
{\em text\-String} & The text string. \\
\hline
\end{DoxyParams}
\hypertarget{class_ogre_bullet_draw_add7c437d446cd65f00c600f70707deff}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!draw\-Contact\-Point@{draw\-Contact\-Point}}
\index{draw\-Contact\-Point@{draw\-Contact\-Point}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{draw\-Contact\-Point}]{\setlength{\rightskip}{0pt plus 5cm}void Ogre\-Bullet\-Draw\-::draw\-Contact\-Point (
\begin{DoxyParamCaption}
\item[{const bt\-Vector3 \&}]{Point\-On\-B, }
\item[{const bt\-Vector3 \&}]{normal\-On\-B, }
\item[{bt\-Scalar}]{distance, }
\item[{int}]{life\-Time, }
\item[{const bt\-Vector3 \&}]{color}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_add7c437d446cd65f00c600f70707deff}

Draw contact point.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\begin{DoxyParams}{Parameters}
{\em Point\-On\-B} & The point on b. \\
\hline
{\em normal\-On\-B} & The normal on b. \\
\hline
{\em distance} & The distance. \\
\hline
{\em life\-Time} & Time of the life. \\
\hline
{\em color} & The color. \\
\hline
\end{DoxyParams}
\hypertarget{class_ogre_bullet_draw_a98ce833b82367cfa3233d47d9350995b}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!draw\-Line@{draw\-Line}}
\index{draw\-Line@{draw\-Line}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{draw\-Line}]{\setlength{\rightskip}{0pt plus 5cm}void Ogre\-Bullet\-Draw\-::draw\-Line (
\begin{DoxyParamCaption}
\item[{const bt\-Vector3 \&}]{from, }
\item[{const bt\-Vector3 \&}]{to, }
\item[{const bt\-Vector3 \&}]{from\-Color, }
\item[{const bt\-Vector3 \&}]{to\-Color}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_a98ce833b82367cfa3233d47d9350995b}

Draw line.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\begin{DoxyParams}{Parameters}
{\em from} & Source for the. \\
\hline
{\em to} & to. \\
\hline
{\em from\-Color} & from color. \\
\hline
{\em to\-Color} & to color. \\
\hline
\end{DoxyParams}
\hypertarget{class_ogre_bullet_draw_ae4a737c479e71935dbd5483763adc299}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!draw\-Line@{draw\-Line}}
\index{draw\-Line@{draw\-Line}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{draw\-Line}]{\setlength{\rightskip}{0pt plus 5cm}void Ogre\-Bullet\-Draw\-::draw\-Line (
\begin{DoxyParamCaption}
\item[{const bt\-Vector3 \&}]{from, }
\item[{const bt\-Vector3 \&}]{to, }
\item[{const bt\-Vector3 \&}]{color}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_ae4a737c479e71935dbd5483763adc299}

Draw line.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\begin{DoxyParams}{Parameters}
{\em from} & Source for the. \\
\hline
{\em to} & to. \\
\hline
{\em color} & The color. \\
\hline
\end{DoxyParams}
\hypertarget{class_ogre_bullet_draw_a7929d3ac3b12030aef451c1c996069c4}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!get\-Debug\-Mode@{get\-Debug\-Mode}}
\index{get\-Debug\-Mode@{get\-Debug\-Mode}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{get\-Debug\-Mode}]{\setlength{\rightskip}{0pt plus 5cm}int Ogre\-Bullet\-Draw\-::get\-Debug\-Mode (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_a7929d3ac3b12030aef451c1c996069c4}

Gets debug mode.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}
\begin{DoxyReturn}{Returns}
The debug mode.
\end{DoxyReturn}
\hypertarget{class_ogre_bullet_draw_a1e0a1e7e892862f415aabcc0eb1b1baf}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!report\-Error\-Warning@{report\-Error\-Warning}}
\index{report\-Error\-Warning@{report\-Error\-Warning}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{report\-Error\-Warning}]{\setlength{\rightskip}{0pt plus 5cm}void Ogre\-Bullet\-Draw\-::report\-Error\-Warning (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{warning\-String}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_a1e0a1e7e892862f415aabcc0eb1b1baf}

Reports error warning.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\begin{DoxyParams}{Parameters}
{\em warning\-String} & The warning string. \\
\hline
\end{DoxyParams}
\hypertarget{class_ogre_bullet_draw_a9be5e64d3202665bb137bbc234457b82}{\index{Ogre\-Bullet\-Draw@{Ogre\-Bullet\-Draw}!set\-Debug\-Mode@{set\-Debug\-Mode}}
\index{set\-Debug\-Mode@{set\-Debug\-Mode}!OgreBulletDraw@{Ogre\-Bullet\-Draw}}
\subsubsection[{set\-Debug\-Mode}]{\setlength{\rightskip}{0pt plus 5cm}void Ogre\-Bullet\-Draw\-::set\-Debug\-Mode (
\begin{DoxyParamCaption}
\item[{int}]{debug\-Mode}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}}\label{class_ogre_bullet_draw_a9be5e64d3202665bb137bbc234457b82}

Sets debug mode.

\begin{DoxyAuthor}{Author}
Arran Ford
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
31/10/2013
\end{DoxyDate}

\begin{DoxyParams}{Parameters}
{\em debug\-Mode} & The debug mode. \\
\hline
\end{DoxyParams}

The documentation for this class was generated from the following files\-:\begin{DoxyCompactItemize}
\item
A\-:/\-I\-T/\-Git\-Hub/\-I\-C\-T312/source/ogregraphics/\hyperlink{_ogre_bullet_draw_8h}{Ogre\-Bullet\-Draw.\-h}\item
A\-:/\-I\-T/\-Git\-Hub/\-I\-C\-T312/source/ogregraphics/Ogre\-Bullet\-Draw.\-cpp\end{DoxyCompactItemize}


text:
<readable><title>3365198533_539073002b</title><content>
A black and brown dog wrestle , and a little dog watches .
Several dogs are playing in the grass near a boat .
Several dogs play outside near a boat .
three dogs wrestle for a toy .
Two dogs tussling over a stuffed toy on a yard , with a boat in its carrier the background .
</content></readable>


text:
name 'chef-php-ppa'
maintainer 'Robert Gunnar Johnson Jr.'
maintainer_email 'github@oakensoul.com'
license 'Apache 2.0'
description 'Chef Cookbook for setting up a PHP web server using a PPA.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.1.0'

depends 'apt'

supports 'ubuntu'


text:
<?php defined('SYSPATH') OR die('No direct script access.');

return array(

	'default' => array(
		/**
		 * The following options must be set:
		 *
		 * string   key     secret passphrase
		 * integer  mode    encryption mode, one of MCRYPT_MODE_*
		 * integer  cipher  encryption cipher, one of the Mcrpyt cipher constants
		 */
		'cipher' => MCRYPT_RIJNDAEL_128,
		'mode'   => MCRYPT_MODE_NOFB,
	),

);


text:
package net.avalara.avatax.rest.client.models;

import net.avalara.avatax.rest.client.enums.*;
import net.avalara.avatax.rest.client.serializer.JsonSerializer;

import java.lang.Override;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

/**
 *
 */
public class WorksheetDocument {

    private String docCode;

    /**
     * Getter for docCode
     *
     *
     */
    public String getDocCode() {
        return this.docCode;
    }

    /**
     * Setter for docCode
     *
     *
     */
    public void setDocCode(String value) {
        this.docCode = value;
    }

    private Date docDate;

    /**
     * Getter for docDate
     *
     *
     */
    public Date getDocDate() {
        return this.docDate;
    }

    /**
     * Setter for docDate
     *
     *
     */
    public void setDocDate(Date value) {
        this.docDate = value;
    }

    private BigDecimal totalExempt;

    /**
     * Getter for totalExempt
     *
     *
     */
    public BigDecimal getTotalExempt() {
        return this.totalExempt;
    }

    /**
     * Setter for totalExempt
     *
     *
     */
    public void setTotalExempt(BigDecimal value) {
        this.totalExempt = value;
    }

    private BigDecimal totalTaxable;

    /**
     * Getter for totalTaxable
     *
     *
     */
    public BigDecimal getTotalTaxable() {
        return this.totalTaxable;
    }

    /**
     * Setter for totalTaxable
     *
     *
     */
    public void setTotalTaxable(BigDecimal value) {
        this.totalTaxable = value;
    }

    private BigDecimal totalTax;

    /**
     * Getter for totalTax
     *
     *
     */
    public BigDecimal getTotalTax() {
        return this.totalTax;
    }

    /**
     * Setter for totalTax
     *
     *
     */
    public void setTotalTax(BigDecimal value) {
        this.totalTax = value;
    }

    private ArrayList<WorksheetDocumentLine> lines;

    /**
     * Getter for lines
     *
     *
     */
    public ArrayList<WorksheetDocumentLine> getLines() {
        return this.lines;
    }

    /**
     * Setter for lines
     *
     *
     */
    public void setLines(ArrayList<WorksheetDocumentLine> value) {
        this.lines = value;
    }

    private ArrayList<Message> messages;

    /**
     * Getter for messages
     *
     *
     */
    public ArrayList<Message> getMessages() {
        return this.messages;
    }

    /**
     * Setter for messages
     *
     *
     */
    public void setMessages(ArrayList<Message> value) {
        this.messages = value;
    }

    private String resultCode;

    /**
     * Getter for resultCode
     *
     *
     */
    public String getResultCode() {
        return this.resultCode;
    }

    /**
     * Setter for resultCode
     *
     *
     */
    public void setResultCode(String value) {
        this.resultCode = value;
    }

    private String transactionId;

    /**
     * Getter for transactionId
     *
     *
     */
    public String getTransactionId() {
        return this.transactionId;
    }

    /**
     * Setter for transactionId
     *
     *
     */
    public void setTransactionId(String value) {
        this.transactionId = value;
    }

    /**
     * Returns a JSON string representation of WorksheetDocument
     */
    @Override
    public String toString() {
        return JsonSerializer.SerializeObject(this);
    }
}


text:
package com.lzy.okrx.adapter;

import com.lzy.okgo.adapter.AdapterParam;
import com.lzy.okgo.adapter.Call;
import com.lzy.okgo.adapter.CallAdapter;
import com.lzy.okgo.model.Response;

import rx.Single;

/**
 * ================================================
 * 作    者:jeasonlzy(廖子尧)Github地址:https://github.com/jeasonlzy
 * 版    本:1.0
 * 创建日期:2017/5/26
 * 描    述:
 * 修订历史:
 * ================================================
 */
public class SingleResponse<T> implements CallAdapter<T, Single<Response<T>>> {
    @Override
    public Single<Response<T>> adapt(Call<T> call, AdapterParam param) {
        ObservableResponse<T> body = new ObservableResponse<>();
        return body.adapt(call, param).toSingle();
    }
}