text:
//  Copyright (c) 2016 by .
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//
//
//  This file was automatically generated at 03-May-22 4:53:35 PM
//
//  Changes to this file may be overwritten without warning
//
//  Generator:  protogen version 3.0.0.877
//      Goedel Script Version : 0.1   Generated
//      Goedel Schema Version : 0.1   Generated
//
//      Copyright : © 2015-2021
//
//  Build Platform: Win32NT 10.0.19042.0
//
//
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using Goedel.Protocol;

#pragma warning disable IDE0079
#pragma warning disable IDE1006
#pragma warning disable CA2255 // The 'ModuleInitializer' attribute should not be used in libraries

using Goedel.Cryptography.Jose;

namespace Goedel.Cryptography.Dare;

	/// <summary>
	///
	/// Classes that describe the DARE Sequence Format.
	/// </summary>
public abstract partial class SequenceData : global::Goedel.Protocol.JsonObject {

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public override string _Tag =>__Tag;

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public new const string __Tag = "SequenceData";

	/// <summary>
    /// Dictionary mapping tags to factory methods
    /// </summary>
	public static Dictionary<string, JsonFactoryDelegate> _TagDictionary=> _tagDictionary;
	static Dictionary<string, JsonFactoryDelegate> _tagDictionary =
			new () {

	    {"SequenceInfo", SequenceInfo._Factory},
	    {"SequenceIndex", SequenceIndex._Factory},
	    {"IndexPosition", IndexPosition._Factory},
	    {"KeyValue", KeyValue._Factory}
		};

    [ModuleInitializer]

    internal static void _Initialize() => AddDictionary(ref _tagDictionary);

	/// <summary>
    /// Construct an instance from the specified tagged JsonReader stream.
    /// </summary>
    /// <param name="jsonReader">Input stream</param>
    /// <param name="result">The created object</param>
    public static void Deserialize(JsonReader jsonReader, out JsonObject result) =>
		result = jsonReader.ReadTaggedObject(_TagDictionary);

	}

// Service Dispatch Classes

	// Transaction Classes
	/// <summary>
	///
	/// Information that describes the relationship of the envelope to its
	/// enclosing sequence.
	/// </summary>
public partial class SequenceInfo : SequenceData {
        /// <summary>
        ///Specifies the data encoding for the header section of for the following frames.
        ///This value is ONLY valid in Frame 0 which MUST have a header encoded in JSON.
        /// </summary>

	public virtual string						DataEncoding  {get; set;}
        /// <summary>
        ///Specifies the container type for the following records.
        ///This value is ONLY valid in Frame 0 which MUST have a header encoded in JSON.
        /// </summary>

	public virtual string						ContainerType  {get; set;}
	bool								__Index = false;
	private int						_Index;
        /// <summary>
        ///The record index within the file. This MUST be unique and
        ///satisfy any additional requirements determined by the ContainerType.
        /// </summary>

	public virtual int						Index {
		get => _Index;
		set {_Index = value; __Index = true; }
		}
	bool								__IsMeta = false;
	private bool						_IsMeta;
        /// <summary>
        ///If true, the current frame is a meta frame and does not contain a payload.
        ///Note: Meta frames MAY be present in any container. Applications MUST
        ///accept containers that contain meta frames at any position in the file.
        ///Applications MUST NOT interpret a meta frame as a data frame with an enpty payload.
        /// </summary>

	public virtual bool						IsMeta {
		get => _IsMeta;
		set {_IsMeta = value; __IsMeta = true; }
		}
	bool								__Default = false;
	private bool						_Default;
        /// <summary>
        ///If set true in a persistent container, specifies that this record contains
        ///the default object for the container.
        /// </summary>

	public virtual bool						Default {
		get => _Default;
		set {_Default = value; __Default = true; }
		}
	bool								__TreePosition = false;
	private int						_TreePosition;
        /// <summary>
        ///Position of the frame containing the apex of the preceding sub-tree.
        /// </summary>

	public virtual int						TreePosition {
		get => _TreePosition;
		set {_TreePosition = value; __TreePosition = true; }
		}
	bool								__IndexPosition = false;
	private int						_IndexPosition;
        /// <summary>
        ///Specifies the position in the file at which the last index entry is
        ///to be found
        /// </summary>

	public virtual int						IndexPosition {
		get => _IndexPosition;
		set {_IndexPosition = value; __IndexPosition = true; }
		}
	bool								__ExchangePosition = false;
	private int						_ExchangePosition;
        /// <summary>
        ///Specifies the position in the file at which the key exchange data is
        ///to be found
        /// </summary>

	public virtual int						ExchangePosition {
		get => _ExchangePosition;
		set {_ExchangePosition = value; __ExchangePosition = true; }
		}

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public override string _Tag => __Tag;

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public new const string __Tag = "SequenceInfo";

	/// <summary>
    /// Factory method
    /// </summary>
    /// <returns>Object of this type</returns>
	public static new JsonObject _Factory () => new SequenceInfo();

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// </summary>
    /// <param name="writer">Output stream</param>
    /// <param name="wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="first">If true, item is the first entry in a list.</param>
	public override void Serialize (Writer writer, bool wrap, ref bool first) =>
		SerializeX (writer, wrap, ref first);

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// Unlike the Serlialize() method, this method is not inherited from the
    /// parent class allowing a specific version of the method to be called.
    /// </summary>
    /// <param name="_writer">Output stream</param>
    /// <param name="_wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="_first">If true, item is the first entry in a list.</param>
	public new void SerializeX (Writer _writer, bool _wrap, ref bool _first) {
		PreEncode();
		if (_wrap) {
			_writer.WriteObjectStart ();
			}
		if (DataEncoding != null) {
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("DataEncoding", 1);
				_writer.WriteString (DataEncoding);
			}
		if (ContainerType != null) {
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("ContainerType", 1);
				_writer.WriteString (ContainerType);
			}
		if (__Index){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Index", 1);
				_writer.WriteInteger32 (Index);
			}
		if (__IsMeta){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("IsMeta", 1);
				_writer.WriteBoolean (IsMeta);
			}
		if (__Default){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Default", 1);
				_writer.WriteBoolean (Default);
			}
		if (__TreePosition){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("TreePosition", 1);
				_writer.WriteInteger32 (TreePosition);
			}
		if (__IndexPosition){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("IndexPosition", 1);
				_writer.WriteInteger32 (IndexPosition);
			}
		if (__ExchangePosition){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("ExchangePosition", 1);
				_writer.WriteInteger32 (ExchangePosition);
			}
		if (_wrap) {
			_writer.WriteObjectEnd ();
			}
		}

    /// <summary>
    /// Deserialize a tagged stream
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
	/// <param name="tagged">If true, the input is wrapped in a tag specifying the type</param>
    /// <returns>The created object.</returns>
    public static new SequenceInfo FromJson (JsonReader jsonReader, bool tagged=true) {
		if (jsonReader == null) {
			return null;
			}
		if (tagged) {
			var Out = jsonReader.ReadTaggedObject (_TagDictionary);
			return Out as SequenceInfo;
			}
		var Result = new SequenceInfo ();
		Result.Deserialize (jsonReader);
		Result.PostDecode();
		return Result;
		}

    /// <summary>
    /// Having read a tag, process the corresponding value data.
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
    /// <param name="tag">The tag</param>
	public override void DeserializeToken (JsonReader jsonReader, string tag) {

		switch (tag) {
			case "DataEncoding" : {
				DataEncoding = jsonReader.ReadString ();
				break;
				}
			case "ContainerType" : {
				ContainerType = jsonReader.ReadString ();
				break;
				}
			case "Index" : {
				Index = jsonReader.ReadInteger32 ();
				break;
				}
			case "IsMeta" : {
				IsMeta = jsonReader.ReadBoolean ();
				break;
				}
			case "Default" : {
				Default = jsonReader.ReadBoolean ();
				break;
				}
			case "TreePosition" : {
				TreePosition = jsonReader.ReadInteger32 ();
				break;
				}
			case "IndexPosition" : {
				IndexPosition = jsonReader.ReadInteger32 ();
				break;
				}
			case "ExchangePosition" : {
				ExchangePosition = jsonReader.ReadInteger32 ();
				break;
				}
			default : {
				break;
				}
			}
		// check up that all the required elements are present
		}

	}

	/// <summary>
	///
	/// A record providing an index to the sequence.
	/// </summary>
public partial class SequenceIndex : SequenceData {
	bool								__Full = false;
	private bool						_Full;
        /// <summary>
        ///If true, the index is complete and contains position entries for all the
        ///frames in the file. If absent or false, the index is incremental and only
        ///contains position entries for records added since the last
        ///frame containing a ContainerIndex.
        /// </summary>

	public virtual bool						Full {
		get => _Full;
		set {_Full = value; __Full = true; }
		}
        /// <summary>
        ///List of container position entries
        /// </summary>

	public virtual List<IndexPosition>				Positions  {get; set;}

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public override string _Tag => __Tag;

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public new const string __Tag = "SequenceIndex";

	/// <summary>
    /// Factory method
    /// </summary>
    /// <returns>Object of this type</returns>
	public static new JsonObject _Factory () => new SequenceIndex();

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// </summary>
    /// <param name="writer">Output stream</param>
    /// <param name="wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="first">If true, item is the first entry in a list.</param>
	public override void Serialize (Writer writer, bool wrap, ref bool first) =>
		SerializeX (writer, wrap, ref first);

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// Unlike the Serlialize() method, this method is not inherited from the
    /// parent class allowing a specific version of the method to be called.
    /// </summary>
    /// <param name="_writer">Output stream</param>
    /// <param name="_wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="_first">If true, item is the first entry in a list.</param>
	public new void SerializeX (Writer _writer, bool _wrap, ref bool _first) {
		PreEncode();
		if (_wrap) {
			_writer.WriteObjectStart ();
			}
		if (__Full){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Full", 1);
				_writer.WriteBoolean (Full);
			}
		if (Positions != null) {
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Positions", 1);
			_writer.WriteArrayStart ();
			bool _firstarray = true;
			foreach (var _index in Positions) {
				_writer.WriteArraySeparator (ref _firstarray);
				// This is an untagged structure. Cannot inherit.
                //_writer.WriteObjectStart();
                //_writer.WriteToken(_index._Tag, 1);
				bool firstinner = true;
				_index.Serialize (_writer, true, ref firstinner);
                //_writer.WriteObjectEnd();
				}
			_writer.WriteArrayEnd ();
			}

		if (_wrap) {
			_writer.WriteObjectEnd ();
			}
		}

    /// <summary>
    /// Deserialize a tagged stream
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
	/// <param name="tagged">If true, the input is wrapped in a tag specifying the type</param>
    /// <returns>The created object.</returns>
    public static new SequenceIndex FromJson (JsonReader jsonReader, bool tagged=true) {
		if (jsonReader == null) {
			return null;
			}
		if (tagged) {
			var Out = jsonReader.ReadTaggedObject (_TagDictionary);
			return Out as SequenceIndex;
			}
		var Result = new SequenceIndex ();
		Result.Deserialize (jsonReader);
		Result.PostDecode();
		return Result;
		}

    /// <summary>
    /// Having read a tag, process the corresponding value data.
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
    /// <param name="tag">The tag</param>
	public override void DeserializeToken (JsonReader jsonReader, string tag) {

		switch (tag) {
			case "Full" : {
				Full = jsonReader.ReadBoolean ();
				break;
				}
			case "Positions" : {
				// Have a sequence of values
				bool _Going = jsonReader.StartArray ();
				Positions = new List <IndexPosition> ();
				while (_Going) {
					// an untagged structure.
					var _Item = new  IndexPosition ();
					_Item.Deserialize (jsonReader);
					// var _Item = new IndexPosition (jsonReader);
					Positions.Add (_Item);
					_Going = jsonReader.NextArray ();
					}
				break;
				}
			default : {
				break;
				}
			}
		// check up that all the required elements are present
		}

	}

	/// <summary>
	///
	/// Specifies the position in a file at which a specified record index is found
	/// </summary>
public partial class IndexPosition : SequenceData {
	bool								__Index = false;
	private int						_Index;
        /// <summary>
        ///The record index within the file.
        /// </summary>

	public virtual int						Index {
		get => _Index;
		set {_Index = value; __Index = true; }
		}
	bool								__Position = false;
	private int						_Position;
        /// <summary>
        ///The record position within the file relative to the index base.
        /// </summary>

	public virtual int						Position {
		get => _Position;
		set {_Position = value; __Position = true; }
		}
        /// <summary>
        ///Unique object identifier
        /// </summary>

	public virtual string						UniqueId  {get; set;}

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public override string _Tag => __Tag;

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public new const string __Tag = "IndexPosition";

	/// <summary>
    /// Factory method
    /// </summary>
    /// <returns>Object of this type</returns>
	public static new JsonObject _Factory () => new IndexPosition();

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// </summary>
    /// <param name="writer">Output stream</param>
    /// <param name="wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="first">If true, item is the first entry in a list.</param>
	public override void Serialize (Writer writer, bool wrap, ref bool first) =>
		SerializeX (writer, wrap, ref first);

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// Unlike the Serlialize() method, this method is not inherited from the
    /// parent class allowing a specific version of the method to be called.
    /// </summary>
    /// <param name="_writer">Output stream</param>
    /// <param name="_wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="_first">If true, item is the first entry in a list.</param>
	public new void SerializeX (Writer _writer, bool _wrap, ref bool _first) {
		PreEncode();
		if (_wrap) {
			_writer.WriteObjectStart ();
			}
		if (__Index){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Index", 1);
				_writer.WriteInteger32 (Index);
			}
		if (__Position){
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Position", 1);
				_writer.WriteInteger32 (Position);
			}
		if (UniqueId != null) {
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("UniqueId", 1);
				_writer.WriteString (UniqueId);
			}
		if (_wrap) {
			_writer.WriteObjectEnd ();
			}
		}

    /// <summary>
    /// Deserialize a tagged stream
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
	/// <param name="tagged">If true, the input is wrapped in a tag specifying the type</param>
    /// <returns>The created object.</returns>
    public static new IndexPosition FromJson (JsonReader jsonReader, bool tagged=true) {
		if (jsonReader == null) {
			return null;
			}
		if (tagged) {
			var Out = jsonReader.ReadTaggedObject (_TagDictionary);
			return Out as IndexPosition;
			}
		var Result = new IndexPosition ();
		Result.Deserialize (jsonReader);
		Result.PostDecode();
		return Result;
		}

    /// <summary>
    /// Having read a tag, process the corresponding value data.
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
    /// <param name="tag">The tag</param>
	public override void DeserializeToken (JsonReader jsonReader, string tag) {

		switch (tag) {
			case "Index" : {
				Index = jsonReader.ReadInteger32 ();
				break;
				}
			case "Position" : {
				Position = jsonReader.ReadInteger32 ();
				break;
				}
			case "UniqueId" : {
				UniqueId = jsonReader.ReadString ();
				break;
				}
			default : {
				break;
				}
			}
		// check up that all the required elements are present
		}

	}

	/// <summary>
	///
	/// Specifies a key/value entry
	/// </summary>
public partial class KeyValue : SequenceData {
        /// <summary>
        ///The key
        /// </summary>

	public virtual string						Key  {get; set;}
        /// <summary>
        ///The value corresponding to the key
        /// </summary>

	public virtual string						Value  {get; set;}

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public override string _Tag => __Tag;

	/// <summary>
    /// Tag identifying this class
    /// </summary>
	public new const string __Tag = "KeyValue";

	/// <summary>
    /// Factory method
    /// </summary>
    /// <returns>Object of this type</returns>
	public static new JsonObject _Factory () => new KeyValue();

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// </summary>
    /// <param name="writer">Output stream</param>
    /// <param name="wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="first">If true, item is the first entry in a list.</param>
	public override void Serialize (Writer writer, bool wrap, ref bool first) =>
		SerializeX (writer, wrap, ref first);

    /// <summary>
    /// Serialize this object to the specified output stream.
    /// Unlike the Serlialize() method, this method is not inherited from the
    /// parent class allowing a specific version of the method to be called.
    /// </summary>
    /// <param name="_writer">Output stream</param>
    /// <param name="_wrap">If true, output is wrapped with object
    /// start and end sequences '{ ... }'.</param>
    /// <param name="_first">If true, item is the first entry in a list.</param>
	public new void SerializeX (Writer _writer, bool _wrap, ref bool _first) {
		PreEncode();
		if (_wrap) {
			_writer.WriteObjectStart ();
			}
		if (Key != null) {
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Key", 1);
				_writer.WriteString (Key);
			}
		if (Value != null) {
			_writer.WriteObjectSeparator (ref _first);
			_writer.WriteToken ("Value", 1);
				_writer.WriteString (Value);
			}
		if (_wrap) {
			_writer.WriteObjectEnd ();
			}
		}

    /// <summary>
    /// Deserialize a tagged stream
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
	/// <param name="tagged">If true, the input is wrapped in a tag specifying the type</param>
    /// <returns>The created object.</returns>
    public static new KeyValue FromJson (JsonReader jsonReader, bool tagged=true) {
		if (jsonReader == null) {
			return null;
			}
		if (tagged) {
			var Out = jsonReader.ReadTaggedObject (_TagDictionary);
			return Out as KeyValue;
			}
		var Result = new KeyValue ();
		Result.Deserialize (jsonReader);
		Result.PostDecode();
		return Result;
		}

    /// <summary>
    /// Having read a tag, process the corresponding value data.
    /// </summary>
    /// <param name="jsonReader">The input stream</param>
    /// <param name="tag">The tag</param>
	public override void DeserializeToken (JsonReader jsonReader, string tag) {

		switch (tag) {
			case "Key" : {
				Key = jsonReader.ReadString ();
				break;
				}
			case "Value" : {
				Value = jsonReader.ReadString ();
				break;
				}
			default : {
				break;
				}
			}
		// check up that all the required elements are present
		}

	}


text:
Engine =
{
	// *************************************************************************************
	// External dependencies
	// *************************************************************************************
	Dependencies :
	[
		"enginejs/css/engine.css",
		"enginejs/script/third_party/hashCode-v1.0.0.js",
		"enginejs/script/third_party/webtoolkit.md5.js",
		"enginejs/script/third_party/gl-matrix-min.js",
		"enginejs/script/third_party/jquery-ui.min.js",
		"enginejs/css/third_party/jquery-ui/jquery-ui.css",
	],

	// *************************************************************************************
	// EngineJS Modules
	// *************************************************************************************
	Modules :
	[
		{ name : "EngineJS-Util",      js : "enginejs/modules/enginejs-util.js"        },
		{ name : "EngineJS-Time",      js : "enginejs/modules/enginejs-time.js"        },
		{ name : "EngineJS-Colour",    js : "enginejs/modules/enginejs-colour.js"      },
		{ name : "EngineJS-Debug",     js : "enginejs/modules/enginejs-debug.js"       },
		{ name : "EngineJS-Array",     js : "enginejs/modules/enginejs-array.js"       },
		{ name : "EngineJS-Math",      js : "enginejs/modules/enginejs-math.js"        },
		{ name : "EngineJS-Intersect", js : "enginejs/modules/enginejs-intersect.js"   },
		{ name : "EngineJS-Easing",    js : "enginejs/modules/enginejs-easing.js"      },
		{ name : "EngineJS-Vec2",      js : "enginejs/modules/enginejs-vec2.js"        },
		{ name : "EngineJS-Vec3",      js : "enginejs/modules/enginejs-vec3.js"        },
		{ name : "EngineJS-Spatial",   js : "enginejs/modules/enginejs-spatial.js"     },
		{ name : "EngineJS-Camera",    js : "enginejs/modules/enginejs-camera.js"      },
		{ name : "EngineJS-Net",       js : "enginejs/modules/enginejs-net.js"         },
		{ name : "EngineJS-Resource",  js : "enginejs/modules/enginejs-resource.js"    },
		{ name : "EngineJS-Keyboard",  js : "enginejs/modules/enginejs-keyboard.js"    },
		{ name : "EngineJS-Mouse",     js : "enginejs/modules/enginejs-mouse.js"       },
		{ name : "EngineJS-Gamepad",   js : "enginejs/modules/enginejs-gamepad.js"     },
		{ name : "EngineJS-Touch",     js : "enginejs/modules/enginejs-touch.js"       },
		{ name : "EngineJS-Gfx",       js : "enginejs/modules/enginejs-gfx.js"         },
		{ name : "EngineJS-Geometry",  js : "enginejs/modules/enginejs-geometry.js"    },
		{ name : "EngineJS-Model",     js : "enginejs/modules/enginejs-model.js"       },
		{ name : "EngineJS-Game-2D",   js : "enginejs/modules/enginejs-game-2d.js"     },
		{ name : "EngineJS-Audio",     js : "enginejs/modules/enginejs-audio.js"       },
		{ name : "EngineJS-Editor",    js : "enginejs/modules/enginejs-editor.js"      },
		{ name : "EngineJS-Device",    js : "enginejs/modules/enginejs-device.js"      },
		{ name : "EngineJS-Text2D",    js : "enginejs/modules/enginejs-text-2d.js"     },
	],

	// *************************************************************************************
	// Resources
	// *************************************************************************************
	Resources :
	{
		// Vertex shaders
		vs_basic                  : { file: "enginejs/shaders/basic.vs" },
		vs_basic_transformed      : { file: "enginejs/shaders/basic-transformed.vs" },
		vs_basic_transformed_nouv : { file: "enginejs/shaders/basic-transformed-nouv.vs" },

		// Fragment shaders
		fs_basic             : { file: "enginejs/shaders/basic.fs" },
		fs_basic_colour      : { file: "enginejs/shaders/basic-colour.fs" },
		fs_basic_textured    : { file: "enginejs/shaders/basic-textured.fs" },
		fs_grid              : { file: "enginejs/shaders/grid.fs" },
		fs_grid_3d           : { file: "enginejs/shaders/grid-3d.fs" },
		fs_grid_3d_fog       : { file: "enginejs/shaders/grid-3d-fog.fs" },

		// Game-2D shaders
		fs_2d_background     : { file: "enginejs/shaders/2d/background.fs" },
		fs_2d_sprite         : { file: "enginejs/shaders/2d/sprite.fs" },

		// Models
		ml_quad              : { file: "enginejs/models/quad.model"       },
		ml_floor_tile        : { file: "enginejs/models/floor_tile.model" },
		ml_tri               : { file: "enginejs/models/tri.model"        },
		ml_cube              : { file: "enginejs/models/cube.model"       },

		// Misc
		tx_white             : { file: "enginejs/img/white.png"   },
		sfx_blank            : { file: "enginejs/audio/blank.mp3" }
	},

	// *************************************************************************************
	// Main initialisation
	Init : function(on_user_init, user_resources, canvas)
	{
		// First load in JS dependencies...
		Engine.LoadDependencies(function()
		{
			// Carry out asynchronous jobs
			ExecuteAsyncJobQueue(
			{
				jobs :
				[
					{
						first : function(cb) // 1. Initialise canvas & WebGL
						{
							Engine.LogSection("Initialising WebGL");
							Engine.InitWebGL(canvas, cb)
						}
					},
					{
						first : function(cb) // 2. Load internal modules
						{
							Engine.LogSection("Loading internal modules");
							Engine.LoadModules(Engine.Modules, cb);
						}
					},
					{
						first : function(cb) // 3. Load internal resources
						{
							Engine.LogSection("Loading internal resources");
							Engine.Resource.LoadBatch(Engine.Resources, cb);
						}
					},
					{
						first : function(cb) // 4. Load user resources
						{
							Engine.LogSection("Loading user resources");
							Engine.Resource.LoadBatch(user_resources, cb);
						}
					}
				],
				finally: function(ok)
				{
					Engine.Log(ok? "Initialised successfully" : "Initialised failed");
					if(!on_user_init) { return; }

					// Run any pre-game initialisation routines
					Engine.PreGameLoopInit();

					// User init handler returns the user render function
					var on_user_render = on_user_init(ok? Engine.GL : null);
					if(on_user_render)
					{
						Engine.LogSection("Starting game loop");
						Engine.RunGameLoop(on_user_render);
					}
				}
			});
		});
	},

	InitWebGL : function(canvas, callback)
	{
		Engine.Log("Initialising WebGL context");
		try
		{
			// Try to grab the standard context. If it fails, fallback to experimental
			Engine.Canvas = canvas || document.getElementsByTagName("canvas")[0];
			var webgl_init_config = { alpha: false };
			Engine.GL = Engine.Canvas.getContext("webgl", webgl_init_config) ||
			            Engine.Canvas.getContext("experimental-webgl", webgl_init_config);
			Engine.Canvas.is_fullscreen = false;

			// Canvas helper methods
			Engine.Canvas.Show      = function()       { $(this).show(); };
			Engine.Canvas.Hide      = function()       { $(this).hide(); };
			Engine.Canvas.GetSize   = function()       { return [this.width, this.height] };
			Engine.Canvas.GetWidth  = function()       { return this.width; };
			Engine.Canvas.GetHeight = function()       { return this.height; };
			Engine.Canvas.GetCentre = function()       { return [this.width / 2, this.height / 2, 0] };
			Engine.Canvas.GetCenter = function()       { return Engine.Canvas.GetCentre(); };
			Engine.Canvas.GetAspectRatio = function()  { return this.width / this.height; };
			Engine.Canvas.GetMaxDimension = function() { return this.width > this.height? this.width  : this.height; };
			Engine.Canvas.GetMinDimension = function() { return this.width > this.height? this.height : this.width;  };
			Engine.Canvas.Resize = function(width, height)
			{
				this.width = width; this.height = height;

				// Other modules can hook-in here for now
				if(Engine.Gfx) { Engine.Gfx.ResizeViewport(); }
			};
			Engine.Canvas.EnableContextMenu = function(do_enable)
			{
				// Suppress canvas right-click context menu?
				Engine.Canvas.oncontextmenu = do_enable? null : function(e)
				{
					e.preventDefault();
				};
			};

			// WebGL initialised successfully
			Engine.Log("WebGL context created");
			callback(true);
		}
		catch(e)
		{
			$(canvas).html("EngineJS initialisation failed");
			Engine.Log("Failed initialising WebGL context");
			callback(false);
		}
	},

	SetRenderCallback : function(callback)
	{
		var request_func = window.requestAnimationFrame       ||
		                   window.webkitRequestAnimationFrame ||
		                   window.mozRequestAnimationFrame    ||
		                   function(callback) { window.setTimeout(callback, 1000 / 60); };
		request_func(callback, this.canvas);
	},

	PreGameLoopInit : function()
	{
		Engine.Debug.PreGameLoopInit();
	},

	// *************************************************************************************
	// Main Game Loop
	// *************************************************************************************
	RunGameLoop : function(on_user_render)
	{
		var on_render_internal = function()
		{
			// Generate frame stats
			var elapsed_ms = Engine.Time.Now() - first_frame_time;
			var delta_ms   = Engine.Time.Now() - last_frame_time;

			// Request next render frame
			Engine.SetRenderCallback(on_render_internal);

			// Flip input buffers
			Engine.Mouse.Update();
			Engine.Keyboard.Update();
			Engine.Gamepad.Update();
			Engine.Gfx.Update();

			// Flush debug draw
			Engine.Debug.Update();

			// Update text elements
			Engine.Text2D.Update();

			// Setup per-frame info for client
			var info =
			{
				elapsed_s    : elapsed_ms / 1000,
				elapsed_ms   : elapsed_ms,
				delta_s      : delta_ms / 1000,
				delta_ms     : delta_ms,
				frame_number : frame_number
			};

			// Call user render function
			last_frame_time = Engine.Time.Now();
			on_user_render(info);

			// Debug draw
			Engine.Debug.Render();

			// Kick touch input
			Engine.Touch.Update();
			Engine.Gfx.first_frame = false;
			++frame_number;
		};

		// Request first render frame
		var frame_number = 0;
		var first_frame_time = Engine.Time.Now();
		var last_frame_time  = Engine.Time.Now();
		Engine.SetRenderCallback(on_render_internal);
	},

	// *************************************************************************************
	// Logging
	// *************************************************************************************
	LogSection : function(msg)
	{
		console.log("[engine] *****************************************");
		console.log("[engine]  " + msg);
		console.log("[engine] *****************************************");
	},

	Log : function(msg)
	{
		console.log("[engine]  INFO: " + msg);
	},

	LogObject : function(obj)
	{
		console.log("[engine]  INFO: " + JSON.stringify(obj));
	},

	LogError : function(msg)
	{
		console.error("[engine] ERROR: " + msg);
	},

	// *************************************************************************************
	// Misc
	// *************************************************************************************
	LoadModules : function(modules, on_complete)
	{
		ExecuteAsyncLoop(modules, function(_module, carry_on)
		{
			Engine.Log("Loading module: " + _module.name);
			Engine.LoadJS(_module.js, function()
			{
				carry_on(true); // Load next module
			});
		}, on_complete);
	},

	LoadDependencies : function(on_complete)
	{
		// *************************************************************************************
		// Runtime javascript dependency load & init
		var dependency_load_functions =
		{
			js  : function(url, callback) { Engine.LoadJS(url, callback);  },
			css : function(url, callback) { Engine.LoadCSS(url, callback); },
		};

		// 1. Load ajq for better async jobs/loops
		Engine.LogSection("Loading Dependencies");
		$.getScript("enginejs/script/third_party/ajq/ajq.js", function(script)
		{
			eval(script); // Hotload ajq.js

			// 2. Use ajq to dynamically load remaining dependencies
			ExecuteAsyncLoop(Engine.Dependencies, function(entry, carry_on)
			{
				Engine.Log("Loading dependency: " + entry);
				var extension = entry.split('.').pop();
				if(extension in dependency_load_functions)
				{
					dependency_load_functions[extension](entry, function()
					{
						carry_on(true);
					});
				}
				else
				{
					Engine.LogError("Dependency type with extension '" + extension + "' not supported");
					on_complete(null);
				}
			}, on_complete);
		});
	},

	LoadJS : function(url, callback)
	{
		$.getScript(url, function(script)
		{
			callback(script);
		}).fail(function(jqxhr, settings, exception)
		{
			Engine.LogError("Failed to load " + url);
			Engine.LogError(exception);
		});
	},

	LoadCSS : function(url, callback)
	{
		$("<link/>", { rel: "stylesheet", type: "text/css", href: url }).appendTo("head");
		callback();
	}
};

redpajama_set_name: RedPajamaGithub


text:
import CSSModel from './CSSModel';
import HTMLModel from './HTMLModel';
import { MSImageData, CGRect } from '../types';
import { tags } from '../html-support/tags';
import { globalIncludesMap } from '../fileSupport';
import { saveImageToFile, saveTextToFile } from '../fileSupport';
import { px } from '../css-support/units';
import { colorTheme } from '../layer-support/color';
import { borderStyleValues, displayValues, alignItemsValues } from '../css-support/cssPropertyValues';

export default class ComponentModel {
   constructor(cssModel: CSSModel) {
     this._cssModel = cssModel;
     this._children = [];
     this._assets = [];
     this._isHorizontalLayout = false;
     this._hasBackground = false;
   }

   set isHorizontalLayout(value: boolean) {
     this._isHorizontalLayout = value;
   }

   get isHorizontalLayout() {
     return this._isHorizontalLayout;
   }

   set hasBackground(value: boolean) {
     this._hasBackground = value;
   }

   set frame(value: CGRect) {
     this._frame = value;
   }

   get frame(): CGRect {
     return this._frame;
   }

   set name(name: string) {
     this._name = name;
   }

   get name(): string {
     return this._name;
   }

   set htmlModel(htmlModel: HTMLModel) {
     this._htmlModel = htmlModel;
   }

   get childern(): Array<ComponentModel> {
     return this._children;
   }

   get htmlModel(): HTMLModel {
     return this._htmlModel;
   }

   get cssModel(): CSSModel {
     return this._cssModel;
   }

   addChild(component: ComponentModel) {
     this._children.push(component);
   }

   addAsset(asset: any) {
     this._assets.push(asset);
   }

   reactTemplate(name: string, content: string, cssPath: string, additionalFilePaths: Array<string>): string {
     // Build file imports
     let otherImports: string = '';
     if (additionalFilePaths && additionalFilePaths.length > 0) {
       const first = `import '${additionalFilePaths[0]}';`;
       otherImports = additionalFilePaths.reduce((first, second) => first + `import ${second.replace('./', '')} from '${second}';`, '');
     }

     otherImports += `import '${cssPath}';`;

     return `
     import React from 'react';
     ${otherImports}

     class ${name} extends React.Component {
       render() {
         return (
           ${content}
         );
       }
     }

     module.exports = ${name};
     `;
   }

   childReactTemplate(name: string): string {
     return `
      <${name} />
     `;
   }

   generate(fromParent: bool = false): string {
     // Check if we should handle primitive tags. ul and li are treated differently here
     let htmlModelTag: string;
     if (this._htmlModel) {
       htmlModelTag = this._htmlModel.htmlTag;
       if (htmlModelTag != tags.ul) {
          this.checkAssets();
          return this._htmlModel.generate();
       }
     }

     // This needs to be called before child.generate
     this.registerComponentFilePaths();

     // Generate the react compnent and CSS
     let cssContent = this._cssModel.generate();
     let reactChildContent: string = "";
     const additionalFilePaths: Array<string> = [];
     for (const child of this._children) {
       if (child.name) {
         const childFilePath = globalIncludesMap[child.name];
         additionalFilePaths.push(childFilePath);
       }

       // If this is a list(ul), then all the child should be wrapped inside a list item(li)
       if (htmlModelTag === tags.ul) {
         let listItemModel = new HTMLModel(tags.li, [this.listItemName()], child.generate(true));
         reactChildContent += listItemModel.generate();
       } else {
         reactChildContent += child.generate(true);
       }
       cssContent += child.cssModel.generate();
     }

     // Generate the list(ul)
     if (this._htmlModel && (htmlModelTag === tags.ul)) {
       // Create a border around each list item
       const listItemCssModel = new CSSModel([this.listItemName()])
       listItemCssModel.borderColor = colorTheme.black;
       listItemCssModel.borderWidth = px(1);
       listItemCssModel.borderStyle = borderStyleValues.solid;
       listItemCssModel.display = displayValues.flex;
       listItemCssModel.alignItems = alignItemsValues.center;
       listItemCssModel.size = {
         height: this._frame.size.height / this._children.length,
       }
       cssContent += listItemCssModel.generate();

       this._htmlModel.htmlContent = reactChildContent;
       reactChildContent = this._htmlModel.generate();
     } else if (this._children.length > 1 || this._hasBackground) { // Wrap content in a div if there is more than one child
       let htmlModel = new HTMLModel(tags.div, [this._name], reactChildContent);
       reactChildContent = htmlModel.generate();
     }

     // CSS file path
     const relativeStyleDirectory = globalIncludesMap['relativeStyleDirectory'];
     const cssFilePath = `${relativeStyleDirectory}/${this._name}.css`;

     const reactContent = this.reactTemplate(this._name, reactChildContent, cssFilePath, additionalFilePaths);

     console.log(reactContent);
     console.log(cssContent);

     this.saveCSS(cssContent);
     this.saveJSX(reactContent);

     // If we are inside a parent component, then render just the component tag
     if (fromParent) {
       return this.childReactTemplate(this._name);
     } else {
       return reactContent;
     }
   }

   listItemName(): string {
     return `${this._name}-item`;
   }

   registerComponentFilePaths() {
     // Breath traverse through all the child components and get their names.
     // This makes the child available deeper down the view hierarchy.
     const relativeDirPath = globalIncludesMap['relativeComponentDirectory'];
     for (const child of this._children) {
       if (child.name && !globalIncludesMap[child.name]) {
         globalIncludesMap[child.name] = `${relativeDirPath}/${child.name}`;
       }
     }

     globalIncludesMap[this._name] = `${relativeDirPath}/${this._name}`;
   }

   checkAssets() {
     if (this._assets.length) {
       const filename = new Date().getTime();
       if (this._htmlModel.htmlTag === tags.img) {
        this._htmlModel.attributes.src = `${globalIncludesMap.serverAssetDirectory}/${filename}.png`;
       } else {
        this._cssModel.background = `url('${globalIncludesMap.serverAssetDirectory}/${filename}.png')`;
       }
       this._assets.forEach(asset => this.saveAsset(asset, filename));
     }
   }

   saveAsset(content: MSImageData, filename: string) {
    const {assetDirectory} = globalIncludesMap;
    saveImageToFile(`${assetDirectory}/${filename}.png`, content);
   }

   saveCSS(content: string) {
     const {styleDirectory, debugDirectory} = globalIncludesMap;
     saveTextToFile(`${styleDirectory}/${this._name}.css`, content);
     saveTextToFile(`${debugDirectory}/${this._name}CSS.json`, JSON.stringify(content));
   }

   saveJSX(content: string) {
     const {projectDirectory, debugDirectory} = globalIncludesMap;
     saveTextToFile(`${projectDirectory}/${this._name}.jsx`, content);
     saveTextToFile(`${debugDirectory}/${this._name}.json`, JSON.stringify(content));
   }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Uredo caraganae Thüm.

### Remarks
null


text:
/* global module, require */

var Entity = require('./Entity');

module.exports = (function() {
  'use strict';

  function Player(x, y, speed) {
    Entity.call(this,
      x,
      y,
      Player.width,
      Player.height,
      'public/images/sprites/heroes.png',
      [[105, 142]],
      0,
      speed || 150
    );

    this.level = 1;
  }

  Player.width = 32;
  Player.height = 48;

  Player.prototype = new Entity();
  Player.prototype.constructor = Player;

  return Player;
}());


text:
Ext.define('controller.ReportController', {
	extend : 'Ext.app.Controller',
	alias: 'controller.reportController',
	views : [ 'view.ReportView' ],
	requires:[ 'MyDesktop.ServerModel' ],
	alertTitle:'Info',
	serverError:'Server error.',
	selectFile:'Please select file.',
	deleteSuccess:'Delete success.',
	deleteFailure:'Delete failure.',
	confirmDelete:'Confirm delete?',
	server:'',
	init : function() {
		var me = this;
		server = new MyDesktop.ServerModel();
		this.control({
			'window button[action=del]' : {
				removeclick : function(collection,rollback) {
					me.delFile(collection,rollback);
				}
			},
			'actioncolumn#fileGridActionEdit': {
				viewclick : function(store,row) {
					me.doView(store.getAt(row).getData().uuid);
				}
			}
		});
	},
	delFile : function(collection,rollback) {
		var me = this;
		if (0 >= collection.getCount()) {
			Ext.Msg.alert(me.alertTitle, me.selectFile);
		}
		else{
			Ext.Msg.confirm(me.alertTitle, Ext.String.format(me.confirmDelete,collection.getCount()), function(button) {
				if (button == 'yes') {
					me.doDelete(collection.keys,rollback);
				}
			});
		}
	},
	doDelete : function(file,rollback) {
		var me = this;
		Ext.Ajax.request({
			url : server.location+'/fileScanRecord/moveFile.do',
			method : 'POST',
			cors:true,
			jsonData : {files:file},
			success : function(response) {
				var rJson = Ext.decode(response.responseText);
				if (rJson.success) {
					Ext.Msg.alert(me.alertTitle, me.deleteSuccess, function() {
						rollback();
					});
				} else {
					Ext.Msg.alert(me.alertTitle, me.deleteFailure);
				}
			},
			failure : function() {
				Ext.Msg.alert(me.alertTitle, me.serverError);
			}
		});
	},
	doView : function(fileUuid) {
		var me = this;
        try{
        	document.getElementById('downloadURL').src=server.location+'/fileScanRecord/download.do?fileUuid='+fileUuid;
        }catch(e){
        	Ext.Msg.alert(me.alertTitle, me.serverError);
        }
	}
});


text:
//---------------------------------------------------------------------------------------------------------------------
// Copyright (C) 2015-2020, Joseph M. G. Tsai
// under the terms of the Apache License, Version 2.0 (ALv2),
// found at http://www.apache.org/licenses/LICENSE-2.0
//---------------------------------------------------------------------------------------------------------------------
package promises;
//---------------------------------------------------------------------------------------------------------------------
/**
 * Defines promise states.
 */
public enum PromiseState
{
    //-----------------------------------------------------------------------------------------------------------------
    /**
     * The state of target promise is {@code PENDING}, which would transit to {@code FULFILLED} or {@code REJECTED}
     * later.
     */
    PENDING,
    //-----------------------------------------------------------------------------------------------------------------
    /**
     * The state of target promise is {@code FULFILLED}, and would not transit to another state.
     */
    FULFILLED,
    //-----------------------------------------------------------------------------------------------------------------
    /**
     * The state of target promise is {@code REJECTED}, and would not transit to another state.
     */
    REJECTED
    //-----------------------------------------------------------------------------------------------------------------
}
//---------------------------------------------------------------------------------------------------------------------


text:
package org.apache.sis.io;

import java.util.Map;
import java.util.IdentityHashMap;
import java.util.Locale;
import java.util.TimeZone;
import java.util.Date;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.text.Format;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.measure.Quantity;
import javax.measure.Unit;

import org.opengis.referencing.IdentifiedObject;
import org.opengis.geometry.DirectPosition;
import org.apache.sis.measure.Angle;
import org.apache.sis.measure.AngleFormat;
import org.apache.sis.measure.Range;
import org.apache.sis.measure.RangeFormat;
import org.apache.sis.measure.UnitFormat;
import org.apache.sis.measure.QuantityFormat;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.Classes;
import org.apache.sis.util.Localized;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.internal.util.MetadataServices;
import org.apache.sis.internal.util.LocalizedParseException;

import static org.apache.sis.internal.util.StandardDateFormat.UTC;

/**
 * Base class of {@link Format} implementations which delegate part of their work to other
 * {@code Format} instances. {@code CompoundFormat} subclasses typically work on relatively
 * large blocks of data, for example a metadata tree or a Well Known Text (WKT).
 * Those blocks of data usually contain smaller elements like numbers and dates, whose parsing
 * and formatting can be delegated to {@link NumberFormat} and {@link DateFormat} respectively.
 * Subclasses can obtain instances of those formats by call to {@link #getFormat(Class)} where
 * the argument is the type of the value to parse or format.
 * {@code CompoundFormat} supports at least the following value types, but subclasses may add more types:
 *
 *

 *
Supported value types

 *
Value type	              Format type	                                      Remarks

 *
{@link DirectPosition}	  {@link org.apache.sis.geometry.CoordinateFormat}	 Requires {@code sis-referencing} module.

 *
{@link Angle}	           {@link AngleFormat}

 *
{@link Date}	            {@link DateFormat}	                               Timezone specified by {@link #getTimeZone()}.

 *
{@link Number}	          {@link NumberFormat}

 *
{@link Unit}	            {@link UnitFormat}

 *
{@link Range}	           {@link RangeFormat}

 *
{@link Class}	           (internal)

 *

 *
 *
Sources and destinations

 * Since {@code CompoundFormat} may work on larger texts than the usual {@code Format} classes,
 * it defines {@code parse} and {@code format} methods working with arbitrary {@link CharSequence}
 * and {@link Appendable} instances. The standard {@code Format} methods redirect to the above-cited
 * methods.
 *
 *
Sub-classing

 * The abstract methods to be defined by subclasses are:
 *

 *
{@link #getValueType()}

 *
{@link #format(Object, Appendable)}

 *
{@link #parse(CharSequence, ParsePosition)}

 *

 *
 *
API note:
 * in the standard {@link Format} class, the {@code parse} methods either accept a {@link ParsePosition} argument
 * and returns {@code null} on error, or does not take position argument and throws a {@link ParseException} on error.
 * In this {@code CompoundFormat} class, the {@code parse} method both takes a {@code ParsePosition} argument and
 * throws a {@code ParseException} on error. This allows both substring parsing and more accurate exception message
 * in case of error.

 *
 * @author  Martin Desruisseaux (Geomatys)
 * @version 1.1
 *
 * @param <T>  the base type of objects parsed and formatted by this class.
 *
 * @since 0.3
 * @module
 */
public abstract class CompoundFormat<T> extends Format implements Localized {
    /**
     * For cross-version compatibility.
     */
    private static final long serialVersionUID = -689151528653024968L;

    /**
     * The locale given at construction time, or {@link Locale#ROOT} (never {@code null}) for
     * unlocalized format. See {@link #getLocale()} for more information on {@code ROOT} locale.
     *
     * @see #getLocale()
     */
    private final Locale locale;

    /**
     * The timezone given at construction time, or {@code null} for UTC.
     *
     * @see #getTimeZone()
     */
    private final TimeZone timezone;

    /**
     * The formats for smaller unit of information, created when first needed.
     * {@code null} is used as a sentinel value meaning "no format".
     */
    private transient Map<Class<?>, Format> formats;

    /**
     * Creates a new format for the given locale. The given locale can be {@code null} or
     * {@link Locale#ROOT} if this format shall parse and format "unlocalized" strings.
     * See {@link #getLocale()} for more information about the {@code ROOT} locale.
     *
     * @param  locale    the locale for the new {@code Format}, or {@code null} for {@code Locale.ROOT}.
     * @param  timezone  the timezone, or {@code null} for UTC.
     */
    protected CompoundFormat(final Locale locale, final TimeZone timezone) {
        this.locale   = (locale != null) ? locale : Locale.ROOT;
        this.timezone = timezone;
    }

    /**
     * Returns the locale used by this format. The returned value may be {@link Locale#ROOT}
     * if this format does not apply any localization. The definition of "unlocalized string"
     * is implementation-dependent, but some typical examples are:
     *
     *

     *
Format {@link Number} instances using {@code toString()} instead of {@code NumberFormat}.

     *
Format {@link Date} instances using the ISO pattern instead of the English one.

     *

     *
     * @return the locale of this {@code Format}, or {@code Locale.ROOT} for unlocalized format.
     */
    @Override
    public Locale getLocale() {
        return locale;
    }

    /**
     * Returns the locale for the given category. Subclasses may override this method in order to assign
     * different roles to the different locale categories. A typical (but not mandatory) mapping is:
     *
     *

     *
{@link java.util.Locale.Category#FORMAT} specifies the locale to use for numbers, dates and angles formatting.

     *
{@link java.util.Locale.Category#DISPLAY} specifies the locale to use for {@link org.opengis.util.CodeList} labels
     *       and {@link org.opengis.util.InternationalString} contents.

     *

     *
     *
Example:
     * The ISO 19162 (Well Known Text) standard requires a number format similar to the one defined by
     * {@code Locale.ROOT} while it allows informative texts (remarks, etc.) to be formatted according the
     * user's locale. Consequently, {@code WKTFormat} fixes (usually) the locale for {@code Category.FORMAT} to
     * {@code Locale.ROOT} and let {@code Category.DISPLAY} be any locale.

     *
     * For subclasses that do not override this method, the default implementation returns {@link #getLocale()}.
     *
     * @param  category  the category for which a locale is desired.
     * @return the locale for the given category (never {@code null}).
     *
     * @since 0.4
     */
    public Locale getLocale(final Locale.Category category) {
        ArgumentChecks.ensureNonNull("category", category);
        return getLocale();
    }

    /**
     * Returns the timezone used by this format.
     *
     * @return the timezone used for this format, or UTC for unlocalized format.
     */
    public TimeZone getTimeZone() {
        return (timezone != null) ? (TimeZone) timezone.clone() : TimeZone.getTimeZone(UTC);
    }

    /**
     * Returns the base type of values parsed and formatted by this {@code Format} instance.
     * The returned type may be a subclass of {@code <T>} if the format is configured in a way
     * that restrict the kind value to be parsed.
     *
     *
Example:
     *

     *
{@code StatisticsFormat} unconditionally returns {@code Statistics.class}.

     *
{@code TreeTableFormat} unconditionally returns {@code TreeTable.class}.

     *

     *

     *
     * @return the base type of values parsed and formatted by this {@code Format} instance.
     */
    public abstract Class<? extends T> getValueType();

    /**
     * Creates an object from the given character sequence.
     * The parsing begins at the index given by the {@code pos} argument.
     * If parsing succeeds, then:
     *
     *

     *
The {@code pos} {@linkplain ParsePosition#getIndex() index} is updated to the index
     *       after the last successfully parsed character.

     *
The parsed object is returned.

     *

     *
     * If parsing fails, then:
     *
     *

     *
The {@code pos} index is left unchanged

     *
The {@code pos} {@linkplain ParsePosition#getErrorIndex() error index}
     *       is set to the beginning of the unparsable character sequence.

     *
One of the following actions is taken (at implementation choice):
     *

     *
this method returns {@code null}, or

     *
a {@code ParseException} is thrown with an {@linkplain ParseException#getErrorOffset() error offset}
     *           set to the index of the first unparsable character.

     *

     *

     *

     *
     *
Note:
     * if a {@code ParseException} is thrown, its error offset is usually the same than the {@code ParsePosition}
     * error index, but implementations are free to adopt a slightly different policy. For example
     * if parsing of the {@code "30.0 40,0"} coordinate fails on the coma in the last number, then the {@code pos}
     * {@linkplain ParsePosition#getErrorIndex() error index} may be set to 5 (the beginning of the {@code "40.0"}
     * character sequence) or to 7 (the coma position), depending on the implementation.

     *
     * Most implementations never return {@code null}. However, some implementations may choose to return {@code null}
     * if they can determine that the given text is not a supported format and reserve {@code ParseException} for the
     * cases where the text seems to be the expected format but contains a malformed element.
     *
     * @param  text  the character sequence for the object to parse.
     * @param  pos   the position where to start the parsing.
     *               On return, the position where the parsing stopped or where an error occurred.
     * @return the parsed object, or {@code null} if the text is not recognized.
     * @throws ParseException if an error occurred while parsing the object.
     */
    public abstract T parse(CharSequence text, ParsePosition pos) throws ParseException;

    /**
     * Creates an object from the given string representation, or returns {@code null} if an error
     * occurred while parsing. The parsing begins at the index given by the {@code pos} argument.
     * If parsing succeeds, then:
     *
     *

     *
The {@code pos} {@linkplain ParsePosition#getIndex() index} is updated to the index
     *       after the last successfully parsed character.

     *
The parsed object is returned.

     *

     *
     * If parsing fails, then:
     *
     *

     *
The {@code pos} index is left unchanged

     *
The {@code pos} {@linkplain ParsePosition#getErrorIndex() error index}
     *       is set to the index of the character where the error occurred.

     *
{@code null} is returned.

     *

     *
     * The default implementation delegates to {@link #parse(CharSequence, ParsePosition)}.
     *
     * @param  text  the string representation of the object to parse.
     * @param  pos   the position where to start the parsing.
     * @return the parsed object, or {@code null} if the given string cannot be parsed.
     */
    @Override
    public T parseObject(final String text, final ParsePosition pos) {
        try {
            return parse(text, pos);
        } catch (ParseException e) {
            if (pos.getErrorIndex() < 0) {
                pos.setErrorIndex(e.getErrorOffset());
            }
            return null;
        }
    }

    /**
     * Creates an object from the given string representation.
     * The default implementation delegates to {@link #parse(CharSequence, ParsePosition)}
     * and ensures that the given string has been fully used, ignoring trailing
     * {@linkplain Character#isSpaceChar(int) spaces} and
     * {@linkplain Character#isISOControl(int) ISO control characters}.
     *
     *
Note:
     * The usual SIS policy, as documented in the {@link org.apache.sis.util.CharSequences} class, is to test for
     * whitespaces using the {@code Character.isWhitespace(…)} method. The combination of {@code isSpaceChar(…)}
     * and {@code isISOControl(…)} done in this {@code parseObject(…)} method is more permissive since it encompasses
     * all whitespace characters, plus non-breaking spaces and non-white ISO controls.

     *
     * @param  text  the string representation of the object to parse.
     * @return the parsed object.
     * @throws ParseException if an error occurred while parsing the object.
     */
    @Override
    public T parseObject(final String text) throws ParseException {
        final ParsePosition pos = new ParsePosition(0);
        final T value = parse(text, pos);
        if (value != null) {
            final int length = text.length();
            int c, n=0, i=pos.getIndex();
            do {
                if ((i += n) >= length) {
                    return value;
                }
                c = text.codePointAt(i);
                n = Character.charCount(c);
            } while (Character.isSpaceChar(c) || Character.isISOControl(c));
            pos.setErrorIndex(i);
        }
        throw new LocalizedParseException(getLocale(Locale.Category.DISPLAY), getValueType(), text, pos);
    }

    /**
     * Writes a textual representation of the given object in the given stream or buffer.
     *
     * @param  object      the object to format.
     * @param  toAppendTo  where to format the object.
     * @throws IOException if an error occurred while writing to the given appendable.
     */
    public abstract void format(T object, Appendable toAppendTo) throws IOException;

    /**
     * Writes a textual representation of the specified object in the given buffer.
     * This method delegates its work to {@link #format(Object, Appendable)}, but
     * without propagating {@link IOException}. The I/O exception should never
     * occur since we are writing in a {@link StringBuffer}.
     *
     *
Note:
     * Strictly speaking, an {@link IOException} could still occur if a subclass overrides the above {@code format}
     * method and performs some I/O operation outside the given {@link StringBuffer}. However, this is not the intended
     * usage of this class and implementers should avoid such unexpected I/O operation.

     *
     * @param  object      the object to format.
     * @param  toAppendTo  where to format the object.
     * @param  pos         ignored in current implementation.
     * @return the given buffer, returned for convenience.
     */
    @Override
    public StringBuffer format(final Object object, final StringBuffer toAppendTo, final FieldPosition pos) {
        final Class<? extends T> valueType = getValueType();
        ArgumentChecks.ensureCanCast("object", valueType, object);
        try {
            format(valueType.cast(object), toAppendTo);
        } catch (IOException e) {
            /*
             * Should never happen when writing into a StringBuffer, unless the user
             * override the format(Object, Appendable) method.  We do not rethrow an
             * AssertionError because of this possibility.
             */
            throw new UncheckedIOException(e);
        }
        return toAppendTo;
    }

    /**
     * Returns the format to use for parsing and formatting values of the given type.
     * This method applies the following algorithm:
     *
     *

     *
If a format is cached for the given type, return that format.

     *
Otherwise if a format can be {@linkplain #createFormat(Class) created}
     *       for the given type, cache the newly created format and return it.

     *
Otherwise do again the same checks for the {@linkplain Class#getSuperclass() super class}.

     *
If no format is found for a concrete class, search again for
     *       {@linkplain Classes#getAllInterfaces(Class) all implemented interfaces}.

     *
If no format can be created, return {@code null}.

     *

     *
     * See {@link #createFormat(Class)} for the list of value types recognized by the default
     * {@code CompoundFormat} implementation.
     *
     * @param  valueType  the base type of values to parse or format, or {@code null} if unknown.
     * @return the format to use for parsing and formatting values of the given type or any parent type,
     *         or {@code null} if none.
     */
    protected Format getFormat(final Class<?> valueType) {
        if (formats == null) {
            formats = new IdentityHashMap<>(4);
        }
        Format format = formats.get(valueType);
        if (format == null && !formats.containsKey(valueType)) {
            format = createFormat(valueType);
            if (format == null) {
                /*
                 * We tried the given class directly. If it didn't worked, try the interfaces before
                 * to try the parent class. The reason is that we may have for example:
                 *
                 *     interface Length extends Quantity;                   // From JSR-363.
                 *
                 *     class MyLength extends Number implements Length;
                 *
                 * If we were looking for parent classes first, we would get a formatter for Number.
                 * But instead we want a formatter for Quantity, which is a (Number + Unit) tuple.
                 * Note that looking for directly declared interfaces first is not sufficient;
                 * we need to look for parent of Length so we can find Quantity before Number.
                 */
                final Class<?>[] interfaces = Classes.getAllInterfaces(valueType);
                Class<?> type = null;
                for (int i=0; ; i++) {
                    if (i < interfaces.length) {
                        type = interfaces[i];               // Try interfaces first.
                    } else {
                        if (i == interfaces.length) {       // Try parent classes after we tried all interfaces.
                            type = valueType;
                        }
                        type = type.getSuperclass();
                        if (type == null) break;            // No format found - stop the search with format = null.
                    }
                    format = formats.get(type);
                    if (format != null) break;              // Intentionally no formats.containsKey(type) check here.
                    format = createFormat(type);
                    if (format != null) {
                        formats.put(type, format);
                        break;
                    }
                }
            }
            formats.put(valueType, format);                 // Store result even null.
        }
        return format;
    }

    /**
     * Creates a new format to use for parsing and formatting values of the given type.
     * This method is invoked by {@link #getFormat(Class)} the first time that a format
     * is needed for the given type.
     * The class given in argument can be any of the classes listed in the "Value type" column below:
     *
     *

     *
Supported value types

     *
Value type	              Format type

     *
{@link DirectPosition}	  {@link org.apache.sis.geometry.CoordinateFormat}

     *
{@link Angle}	           {@link AngleFormat}

     *
{@link Date}	            {@link DateFormat}

     *
{@link Number}	          {@link NumberFormat}

     *
{@link Unit}	            {@link UnitFormat}

     *
{@link Quantity}	        {@link QuantityFormat}

     *
{@link Range}	           {@link RangeFormat}

     *
{@link Class}	           (internal)

     *

     *
     * Subclasses can override this method for adding more types, or for configuring the
     * newly created {@link Format} instances. Note that implementations shall check the
     * type using the {@code expected == type} comparator, not
     * expected.{@linkplain Class#isAssignableFrom(Class) isAssignableFrom}(type),
     * because the check for parent types is done by the {@link #getFormat(Class)} method.
     * This approach allows subclasses to create specialized formats for different value
     * sub-types. For example, a subclass may choose to format {@link Double} values differently
     * than other types of number.
     *
     * @param  valueType  the base type of values to parse or format.
     * @return the format to use for parsing of formatting values of the given type, or {@code null} if none.
     */
    protected Format createFormat(final Class<?> valueType) {
        /*
         * The first case below is an apparent exception to the 'expected == type' rule
         * documented in this method javadoc. But actually it is not, since the call to
         * DefaultFormat.getInstance(…) will indirectly perform this kind of comparison.
         */
        final Locale locale = getLocale(Locale.Category.FORMAT);
        if (Number.class.isAssignableFrom(valueType)) {
            if (Locale.ROOT.equals(locale)) {
                return DefaultFormat.getInstance(valueType);
            } else if (valueType == Number.class) {
                return NumberFormat.getInstance(locale);
            } else if (Numbers.isInteger(valueType)) {
                return NumberFormat.getIntegerInstance(locale);
            }
        } else if (valueType == Date.class) {
            final DateFormat format;
            if (!Locale.ROOT.equals(locale)) {
                format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale);
            } else {
                format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
            }
            format.setTimeZone(getTimeZone());
            return format;
        } else if (valueType == Angle.class) {
            return AngleFormat.getInstance(locale);
        } else if (valueType == Unit.class) {
            return new UnitFormat(locale);
        } else if (valueType == Quantity.class) {
            return new QuantityFormat(locale);
        } else if (valueType == Range.class) {
            return new RangeFormat(locale);
        } else if (valueType == DirectPosition.class) {
            return MetadataServices.getInstance().createCoordinateFormat(locale, getTimeZone());
        } else if (valueType == Class.class) {
            return ClassFormat.INSTANCE;
        } else {
            final Class<?>[] interfaces = valueType.getInterfaces();
            if (ArraysExt.contains(interfaces, IdentifiedObject.class)) {
                return new IdentifiedObjectFormat(locale);
            }
        }
        return null;
    }

    /**
     * Returns a clone of this format.
     *
     * @return a clone of this format.
     */
    @Override
    public CompoundFormat<T> clone() {
        @SuppressWarnings("unchecked")
        final CompoundFormat<T> clone = (CompoundFormat<T>) super.clone();
        if (clone.formats != null) {
            clone.formats = new IdentityHashMap<>(clone.formats);
            for (final Map.Entry<Class<?>,Format> entry : clone.formats.entrySet()) {
                entry.setValue((Format) entry.getValue().clone());
            }
        }
        return clone;
    }

    /*
     * Do not override equals(Object) and hashCode(). They are unlikely to be needed since we
     * do not expect CompoundFormats to be used as keys in HashMap, especially since they are
     * mutable. Furthermore, it is difficult to check for equality since the values in the
     * 'formats' map are created only when needed and we don't know how subclasses will
     * configure them.
     */
}


text:
require 'optparse'
require 'google/ads/google_ads'
require 'date'
require 'digest'

def add_custom_audience(customer_id)
  # GoogleAdsClient will read a config file from
  # ENV['HOME']/google_ads_config.rb when called without parameters
  client = Google::Ads::GoogleAds::GoogleAdsClient.new

  # Creates a custom audience operation.
  operation = client.operation.create_resource.custom_audience do |ca|
    ca.name = "Example Custom Audience ##{(Time.new.to_f * 1000).to_i}"
    ca.description = "Custom audiences who have searched specific terms on Google Search"
    # Match customers by what they searched on Google Search.
    # Note: "INTEREST" OR "PURCHASE_INTENT" is not allowed for the type field
    # of newly created custom audience. Use "AUTO" instead of these 2 options
    # when creating a new custom audience.
    ca.type = :SEARCH
    ca.status = :ENABLED
    # List of members that this custom audience is composed of. Customers that
    # meet any of the membership conditions will be reached.
    ca.members += [
      # Keywords or keyword phrases, which describe the customers' interests
      # or search terms.
      create_custom_audience_member(client, :KEYWORD, "Mars Cruise"),
      create_custom_audience_member(client, :KEYWORD, "Jupiter Cruise"),
      # Website URLs that your customers might visit.
      create_custom_audience_member(client, :URL, "http://www.example.com/locations/mars"),
      create_custom_audience_member(client, :URL, "http://www.example.com/locations/jupiter"),
      # Package names of Android apps which customers might install.
      create_custom_audience_member(client, :APP, "com.google.android.apps.adwords"),
    ]
  end

  # Issues a mutate request to add the custom audience.
  response = client.service.custom_audience.mutate_custom_audiences(
    customer_id: customer_id,
    operations: [operation],
  )
  puts "New custom audience added with resource name: " \
    "'#{response.results.first.resource_name}'."
end

# Creates a custom audience member.
def create_custom_audience_member(client, member_type, member_value)
  client.resource.custom_audience_member do |m|
    m.member_type = member_type
    case member_type
    when :KEYWORD
      m.keyword = member_value
    when :URL
      m.url = member_value
    when :APP
      m.app = member_value
    else
      raise "Invalid audience member type."
    end
  end
end

if __FILE__ == $0
  options = {}
  # The following parameter(s) should be provided to run the example. You can
  # either specify these by changing the INSERT_XXX_ID_HERE values below, or on
  # the command line.
  #
  # Parameters passed on the command line will override any parameters set in
  # code.
  #
  # Running the example with -h will print the command line usage.
  options[:customer_id] = 'INSERT_CUSTOMER_ID_HERE'

  OptionParser.new do |opts|
    opts.banner = sprintf('Usage: %s [options]', File.basename(__FILE__))

    opts.separator ''
    opts.separator 'Options:'

    opts.on('-C', '--customer-id CUSTOMER-ID', String, 'Customer ID') do |v|
      options[:customer_id] = v
    end

    opts.separator ''
    opts.separator 'Help:'

    opts.on_tail('-h', '--help', 'Show this message') do
      puts opts
      exit
    end
  end.parse!

  begin
    add_custom_audience(options.fetch(:customer_id).tr("-", ""))
  rescue Google::Ads::GoogleAds::Errors::GoogleAdsError => e
    e.failure.errors.each do |error|
      STDERR.printf("Error with message: %s\n", error.message)
      if error.location
        error.location.field_path_elements.each do |field_path_element|
          STDERR.printf("\tOn field: %s\n", field_path_element.field_name)
        end
      end
      error.error_code.to_h.each do |k, v|
        next if v == :UNSPECIFIED
        STDERR.printf("\tType: %s\n\tCode: %s\n", k, v)
      end
    end
    raise
  end
end


text:
<?php

namespace Gedmo\Timestampable;

use Doctrine\Common\EventManager;
use Tool\BaseTestCaseORM;
use Doctrine\Common\Util\Debug,
    Timestampable\Fixture\TitledArticle,
    Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM,
    Gedmo\Timestampable\Mapping\Event\TimestampableAdapter,
    Doctrine\Common\EventArgs;

/**
 * These are tests for Timestampable behavior
 *
 * @author Ivan Borzenkov <ivan.borzenkov@gmail.com>
 * @package Gedmo.Timestampable
 * @link http://www.gediminasm.org
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
class ChangeTest extends BaseTestCaseORM
{
    const FIXTURE = "Timestampable\\Fixture\\TitledArticle";

    protected $listener;

    protected function setUp()
    {
        parent::setUp();

        $this->listener = new TimestampableListenerStub();
        $this->listener->eventAdapter = new EventAdapterORMStub();

        $evm = new EventManager;
        $evm->addEventSubscriber($this->listener);

        $this->getMockSqliteEntityManager($evm);
    }

    public function testChange()
    {
        $test = new TitledArticle();
        $test->setTitle('Test');
        $test->setText('Test');

        $currentDate = new \DateTime('now');
        $this->listener->eventAdapter->setDateValue($currentDate);

        $this->em->persist($test);
        $this->em->flush();
        $this->em->clear();

        $test = $this->em->getRepository(self::FIXTURE)->findOneByTitle('Test');
        $test->setTitle('New Title');
        $this->em->persist($test);
        $this->em->flush();
        $this->em->clear();
        //Changed
        $this->assertEquals(
            $currentDate->format('Y-m-d H:i:s'),
            $test->getChtitle()->format('Y-m-d H:i:s')
        );

        $this->listener->eventAdapter->setDateValue(\DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 00:00:00'));

        $test = $this->em->getRepository(self::FIXTURE)->findOneByTitle('New Title');
        $test->setText('New Text');
        $this->em->persist($test);
        $this->em->flush();
        $this->em->clear();
        //Not Changed
        $this->assertEquals(
            $currentDate->format('Y-m-d H:i:s'),
            $test->getChtitle()->format('Y-m-d H:i:s')
        );
    }

    protected function getUsedEntityFixtures()
    {
        return array(
            self::FIXTURE,
        );
    }
}

class EventAdapterORMStub extends BaseAdapterORM implements TimestampableAdapter
{
    protected $dateTime;

    public function setDateValue(\DateTime $dateTime)
    {
        $this->dateTime = $dateTime;
    }

    public function getDateValue($meta, $field)
    {
        return $this->dateTime;
    }
}

class TimestampableListenerStub extends TimestampableListener
{
    public $eventAdapter;

    protected function getEventAdapter(EventArgs $args)
    {
        $this->eventAdapter->setEventArgs($args);

        return $this->eventAdapter;
    }
}


text:
using JetBrains.Annotations;
using JsonApiDotNetCore.Resources;

// ReSharper disable UnusedTypeParameter

namespace JsonApiDotNetCore.AtomicOperations.Processors
{
    /// <summary>
    /// Processes a single operation to remove resources from a to-many relationship.
    /// </summary>
    /// <typeparam name="TResource"></typeparam>
    /// <typeparam name="TId"></typeparam>
    [PublicAPI]
    public interface IRemoveFromRelationshipProcessor<TResource, TId> : IOperationProcessor
        where TResource : class, IIdentifiable<TId>
    {
    }
}


text:
ALTER TABLE KRIM_PERSON_DOCUMENT_T
MODIFY TAX_ID VARCHAR2(100)
/


text:
namespace content {

class WebContents;

}  // namespace content

namespace arc {

class ArcPipBridge;

// Implementation of PictureInPictureWindowController for ARC. This does nothing
// for most of the methods, as most of it is managed on the Android side.
class ArcPictureInPictureWindowControllerImpl
    : public content::PictureInPictureWindowController {
 public:
  explicit ArcPictureInPictureWindowControllerImpl(
      arc::ArcPipBridge* arc_pip_bridge);

  ArcPictureInPictureWindowControllerImpl(
      const ArcPictureInPictureWindowControllerImpl&) = delete;
  ArcPictureInPictureWindowControllerImpl& operator=(
      const ArcPictureInPictureWindowControllerImpl&) = delete;

  ~ArcPictureInPictureWindowControllerImpl() override;

  // PictureInPictureWindowController:
  void Show() override;
  void FocusInitiator() override;
  void Close(bool should_pause_video) override;
  void CloseAndFocusInitiator() override;
  void OnWindowDestroyed(bool should_pause_video) override;
  content::WebContents* GetWebContents() override;

 private:
  arc::ArcPipBridge* const arc_pip_bridge_;
};

}  // namespace arc

#endif  // CHROME_BROWSER_ASH_ARC_PIP_ARC_PICTURE_IN_PICTURE_WINDOW_CONTROLLER_IMPL_H_


text:
package main

import (
	"guthib.com/toto" // pkg name is actually titi
)

func main() {
	println("Hello", titi.Quux())
}

// GOPATH:testdata/redeclaration-global7
// Output:
// Hello bar


text:
layout: post
title:      "Looking Back, Looking Ahead..."
date:       2018-09-16 07:04:55 +0000
permalink:  looking_back_looking_ahead
---

Whew! After 13 months, it is hard to believe my time at Flatiron School is winding down. I just submitted my React final project and passing the assessment, I will be finished with the course. Looking back, I am amazed at the journey and how far I've come.

As I finished the final project I became aware of how my confidence in my coding abilities has grown over the course of the program. As I finish, I eagerly await the job search and look forward to continuing to build my skillset. In addition to the job search activities, some of the major things I plan on working on after graduation include:
* Building out functionality on my React project and deploying it via Heroku.
* Refining my other four Flatiron School projects.
* Practicing algorithms and data structures in preparation for technical job interviews.

Can't wait to get started!


text:
package org.apache.olingo.server.core.uri.queryoption.apply;

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

import org.apache.olingo.server.api.uri.queryoption.ApplyOption;
import org.apache.olingo.server.api.uri.queryoption.apply.GroupBy;
import org.apache.olingo.server.api.uri.queryoption.apply.GroupByItem;

/**
 * Represents the grouping transformation.
 */
public class GroupByImpl implements GroupBy {

  private ApplyOption applyOption;
  private List<GroupByItem> groupByItems = new ArrayList<>();

  @Override
  public Kind getKind() {
    return Kind.GROUP_BY;
  }

  @Override
  public ApplyOption getApplyOption() {
    return applyOption;
  }

  public GroupByImpl setApplyOption(final ApplyOption applyOption) {
    this.applyOption = applyOption;
    return this;
  }

  @Override
  public List<GroupByItem> getGroupByItems() {
    return groupByItems;
  }

  public GroupByImpl addGroupByItem(final GroupByItem groupByItem) {
    groupByItems.add(groupByItem);
    return this;
  }
}


text:
package org.apache.drill.exec.store.kafka;

/**
 * MetaData fields provide additional information about each message.
 * It is expected that one should not modify the fieldName of each constant as it breaks the compatibility.
 */
public enum MetaDataField {

  KAFKA_TOPIC("kafkaTopic"),
  KAFKA_PARTITION_ID("kafkaPartitionId"),
  KAFKA_OFFSET("kafkaMsgOffset"),
  KAFKA_TIMESTAMP("kafkaMsgTimestamp"),
  KAFKA_MSG_KEY("kafkaMsgKey");

  private final String fieldName;

  MetaDataField(final String fieldName) {
    this.fieldName = fieldName;
  }

  public String getFieldName() {
    return fieldName;
  }
}


text:
class MessageQueue::Adapters::Memory::Connection::Consumer < MessageQueue::Consumer
  attr_reader :queue, :block

  def initialize(*args)
    super
    @queue = []
  end

  def subscribe(options = {}, &block)
    producer = options.fetch(:producer)
    producer.add_observer(self)
    @block = block
  end

  def unsubscribe(options = {})
    producer = options.fetch(:producer)
    producer.delete_observer(self)
    @block = nil
  end

  def update(object, options)
    object = load_object(object)
    message = MessageQueue::Message.new(:message_id => options[:message_id],
                                        :type => options[:type],
                                        :timestamp => options[:timestamp],
                                        :routing_key => options[:routing_key],
                                        :payload => load_object(object))
    if block
      block.call(message)
    else
      queue << message
    end
  end
end


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="app.mobile_una_sarapiqui.InfoSeccionRegional.InfoSeccionRegionalActivity$PlaceholderFragment">

</RelativeLayout>


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

namespace nGratis.Cop.Gaia.Client.Wpf
{
    using System.ComponentModel.Composition;
    using System.Windows;
    using nGratis.Cop.Core.Contract;
    using nGratis.Cop.Gaia.Engine;
    using nGratis.Cop.Gaia.Engine.Core;

    [Export(typeof(IWorldMapRenderer))]
    public class WorldMapRenderer : TileMapRenderer, IWorldMapRenderer
    {
        private readonly ITileShader elevationShader;

        [ImportingConstructor]
        public WorldMapRenderer()
            : this(new TileMapViewport(), new Size(10.0, 10.0), System.Windows.Media.Colors.CornflowerBlue.ToCopColor())
        {
        }

        public WorldMapRenderer(ITileMapViewport tileMapViewport, Size tileSize, IColor accentColor)
            : base(tileMapViewport, tileSize, accentColor)
        {
            this.elevationShader = new GrayscaleTileShader(1 << 14);
        }

        public override void RenderLayer(IDrawingCanvas drawingCanvas, TileMap tileMap)
        {
            Guard.AgainstNullArgument(() => drawingCanvas);
            Guard.AgainstNullArgument(() => tileMap);

            var world = tileMap as WorldMap;

            if (world == null)
            {
                base.RenderLayer(drawingCanvas, tileMap);
            }
            else
            {
                var rectangle = new nGratis.Cop.Gaia.Engine.Data.Rectangle((float)this.TileSize.Width, (float)this.TileSize.Height);

                for (var row = 0; row < this.TileMapViewport.NumRows; row++)
                {
                    for (var column = 0; column < this.TileMapViewport.NumColumns; column++)
                    {
                        var value = world[column + this.TileMapViewport.Column, row + this.TileMapViewport.Row].Elevation;

                        rectangle.X = (float)(column * this.TileSize.Width);
                        rectangle.Y = (float)(row * this.TileSize.Height);

                        var brush = new Brush(this.elevationShader.FindColor(value));

                        drawingCanvas.DrawRectangle(Pen.Null, brush, rectangle);
                    }
                }
            }
        }
    }
}


text:
namespace SpriterEngine
{

	SpriteObjectInfo::SpriteObjectInfo() :
		scale(1, 1),
		alpha(1)
	{
	}

	point SpriteObjectInfo::getPosition()
	{
		return position;
	}

	real SpriteObjectInfo::getAngle()
	{
		return angle.angle;
	}

	point SpriteObjectInfo::getScale()
	{
		return scale;
	}

	real SpriteObjectInfo::getAlpha()
	{
		return alpha;
	}

	point SpriteObjectInfo::getPivot()
	{
		return pivot;
	}

	ImageFile *SpriteObjectInfo::getImage()
	{
		return imageFile;
	}

	void SpriteObjectInfo::setPosition(const point &newPosition)
	{
		position = newPosition;
	}

	void SpriteObjectInfo::setAngle(real newAngle)
	{
		angle.angle = newAngle;
	}

	void SpriteObjectInfo::setScale(const point &newScale)
	{
		scale = newScale;
	}

	void SpriteObjectInfo::setAlpha(real newAlpha)
	{
		alpha = newAlpha;
	}

	void SpriteObjectInfo::setPivot(const point &newPivot)
	{
		pivot = newPivot;
	}

	void SpriteObjectInfo::setImage(ImageFile *newImageFile)
	{
		imageFile = newImageFile;
	}

	void SpriteObjectInfo::setSpin(int newSpin)
	{
		angle.spinDirection = newSpin;
	}

	void SpriteObjectInfo::setToBlendedLinear(UniversalObjectInterface *aObject, UniversalObjectInterface *bObject, real t, real blendRatio, ObjectRefInstance *blendedRefInstance)
	{
		real tempAngle = angle.angle;
		point tempPosition = position;
		point tempScale = scale;
		real tempAlpha = alpha;
		point tempPivot = pivot;
		ImageFile *tempImageFile = imageFile;

		blendedRefInstance->preProcess();

		aObject->setObjectToLinear(bObject, t, this);

		setAngle(shortestAngleLinear(tempAngle, angle.angle, blendRatio));
		setPosition(linear(tempPosition, position, blendRatio));
		setScale(linear(tempScale, scale, blendRatio));
		setAlpha(linear(tempAlpha, alpha, blendRatio));

		if (blendRatio < 0.5)
		{
			setPivot(tempPivot);
			setImage(tempImageFile);
		}
	}

	void SpriteObjectInfo::render()
	{
		if (imageFile)
		{
			imageFile->renderSprite(this);
		}
	}

}


text:
====================
This repository is a PHP wrapper for the DoctorSender API.

This library is a set of functions to deal with the API of DoctorSender.
We found the proper API of DoctorSender to be poorly documentated compared to other email service providers so we decided to make our own library.

We also wanted to have a better PSR format.

Installation instruction
------------------------
1. Add the repository to your composer.json
```json
 "repositories": [
   {
     "type": "git",
     "url": "git@github.com:encreinformatique/doctorsender-api-php.git"
   }
 ],
```

2. Add the package to your dependencies by running
`composer require encreinformatique/doctorsender-api-php`

Summary
-------
* [Installation](installation.md)
* [Endpoints](endpoints.md)
* [Example](example.md)

Requisites
----------
You will obviously need a DoctorSender account, a user and an API token.
We are not affiliate in any way to DoctorSender. Please refer to DoctorSender for more information.

More information about the [DoctorSender API](http://soapwebservice.doctorsender.com/doxy/html/).

About
-----

This bundle is developped by [TLH](https://www.encreinformatique.com/)


text:
<?php

/**
 * @file
 * Definition of Drupal\Component\Gettext\PoReaderInterface.
 */

namespace Drupal\Component\Gettext;

use Drupal\Component\Gettext\PoMetadataInterface;

/**
 * Shared interface definition for all Gettext PO Readers.
 */
interface PoReaderInterface extends PoMetadataInterface {

  /**
   * Reads and returns a PoItem (source/translation pair).
   *
   * @return \Drupal\Component\Gettext\PoItem
   *   Wrapper for item data instance.
   */
  public function readItem();

}


text:
package org.asn1s.api;

import org.asn1s.api.util.RefUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public abstract class AbstractName<T extends AbstractName<T>> implements Comparable<T>
{
	protected AbstractName( @NotNull String name, @Nullable String moduleName )
	{
		if( moduleName != null )
			RefUtils.assertTypeRef( moduleName );

		this.name = name;
		this.moduleName = moduleName;
	}

	private final String name;
	private final String moduleName;

	public String getName()
	{
		return name;
	}

	public String getModuleName()
	{
		return moduleName;
	}

	@Override
	public int compareTo( @NotNull T o )
	{
		return toString().compareTo( o.toString() );
	}

	@Override
	public final boolean equals( Object obj )
	{
		if( this == obj ) return true;
		if( !( obj instanceof AbstractName ) ) return false;

		AbstractName<?> typeName = (AbstractName<?>)obj;

		//noinspection SimplifiableIfStatement
		if( !getName().equals( typeName.getName() ) ) return false;
		return getModuleName() != null ? getModuleName().equals( typeName.getModuleName() ) : typeName.getModuleName() == null;
	}

	@Override
	public final int hashCode()
	{
		int result = getName().hashCode();
		result = 31 * result + ( getModuleName() != null ? getModuleName().hashCode() : 0 );
		return result;
	}

	@Override
	public final String toString()
	{
		if( moduleName == null )
			return name;

		return moduleName + '.' + name;
	}
}


text:
'label' and 'account' APIs for wallet
-------------------------------------

A new 'label' API has been introduced for the wallet. This is intended as a
replacement for the deprecated 'account' API. The 'account' can continue to
be used in V0.17 by starting verged with the '-deprecatedrpc=accounts'
argument, and will be fully removed in V0.18.

The label RPC methods mirror the account functionality, with the following functional differences:

- Labels can be set on any address, not just receiving addresses. This functionality was previously only available through the GUI.
- Labels can be deleted by reassigning all addresses using the `setlabel` RPC method.
- There isn't support for sending transactions _from_ a label, or for determining which label a transaction was sent from.
- Labels do not have a balance.

Here are the changes to RPC methods:

| Deprecated Method       | New Method            | Notes       |
| :---------------------- | :-------------------- | :-----------|
| `getaccount`            | `getaddressinfo`      | `getaddressinfo` returns a json object with address information instead of just the name of the account as a string. |
| `getaccountaddress`     | n/a                   | There is no replacement for `getaccountaddress` since labels do not have an associated receive address. |
| `getaddressesbyaccount` | `getaddressesbylabel` | `getaddressesbylabel` returns a json object with the addresses as keys, instead of a list of strings. |
| `getreceivedbyaccount`  | `getreceivedbylabel`  | _no change in behavior_ |
| `listaccounts`          | `listlabels`          | `listlabels` does not return a balance or accept `minconf` and `watchonly` arguments. |
| `listreceivedbyaccount` | `listreceivedbylabel` | Both methods return new `label` fields, along with `account` fields for backward compatibility. |
| `move`                  | n/a                   | _no replacement_ |
| `sendfrom`              | n/a                   | _no replacement_ |
| `setaccount`            | `setlabel`            | Both methods now:

allow assigning labels to any address, instead of raising an error if the address is not receiving address.
delete the previous label associated with an address when the final address using that label is reassigned to a different label, instead of making an implicit `getaccountaddress` call to ensure the previous label still has a receiving address. |

| Changed Method         | Notes   |
| :--------------------- | :------ |
| `addmultisigaddress`   | Renamed `account` named parameter to `label`. Still accepts `account` for backward compatibility if running with '-deprecatedrpc=accounts'. |
| `getnewaddress`        | Renamed `account` named parameter to `label`. Still accepts `account` for backward compatibility. if running with '-deprecatedrpc=accounts' |
| `listunspent`          | Returns new `label` fields. `account` field will be returned for backward compatibility if running with '-deprecatedrpc=accounts' |
| `sendmany`             | The `account` named parameter has been renamed to `dummy`. If provided, the `dummy` parameter must be set to the empty string, unless running with the `-deprecatedrpc=accounts` argument (in which case functionality is unchanged). |
| `listtransactions`     | The `account` named parameter has been renamed to `dummy`. If provided, the `dummy` parameter must be set to the string `*`, unless running with the `-deprecatedrpc=accounts` argument (in which case functionality is unchanged). |
| `getbalance`           | `account`, `minconf` and `include_watchonly` parameters are deprecated, and can only be used if running with '-deprecatedrpc=accounts' |


text:
<?php

namespace Sebdesign\SM\Callback;

use Illuminate\Contracts\Auth\Access\Gate;
use Illuminate\Contracts\Container\Container as ContainerInterface;
use SM\Callback\CallbackFactory;
use SM\Callback\CallbackInterface;
use SM\SMException;

class ContainerAwareCallbackFactory extends CallbackFactory
{
    /**
     * @var \Illuminate\Contracts\Container\Container
     */
    protected $container;

    /**
     * @param  string  $class  The CallbackFactory
     * @param  \Illuminate\Contracts\Container\Container  $container  The service container that will be used to resolve the callable
     *
     * @throws \SM\SMException if the CallbackFactory class does not exist
     */
    public function __construct($class, ContainerInterface $container)
    {
        parent::__construct($class);

        $this->container = $container;
    }

    /**
     * {@inheritdoc}
     */
    public function get(array $specs): CallbackInterface
    {
        if (isset($specs['can'])) {
            return new GateCallback($specs, $this->container->make(Gate::class));
        }

        if (! isset($specs['do'])) {
            throw new SMException(sprintf(
               'CallbackFactory::get needs the index "do" to be able to build a callback, array %s given.',
                json_encode($specs)
            ));
        }

        $class = $this->class;

        return new $class($specs, $specs['do'], $this->container);
    }
}


text:
package com.os.entity.fileupload;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
public class FileUpLoad implements Serializable {
	/**
	 *
	 */
	private static final long serialVersionUID = -6849058590636336328L;
	private Long id;// 主键 id
	private String name;//用户名
	private Date createTime;//上传时间
	private String url;//访问路径
}


text:
module RequiresWhitelistedMonitoringClient
  extend ActiveSupport::Concern

  included do
    before_action :validate_ip_whitelisted_or_valid_token!
  end

  private

  def validate_ip_whitelisted_or_valid_token!
    render_404 unless client_ip_whitelisted? || valid_token?
  end

  def client_ip_whitelisted?
    # Always allow developers to access http://localhost:3000/-/metrics for
    # debugging purposes
    return true if Rails.env.development? && request.local?

    ip_whitelist.any? { |e| e.include?(Gitlab::RequestContext.client_ip) }
  end

  def ip_whitelist
    @ip_whitelist ||= Settings.monitoring.ip_whitelist.map(&IPAddr.method(:new))
  end

  def valid_token?
    token = params[:token].presence || request.headers['TOKEN']
    token.present? &&
      ActiveSupport::SecurityUtils.secure_compare(
        token,
        Gitlab::CurrentSettings.health_check_access_token
      )
  end

  def render_404
    render file: Rails.root.join('public', '404'), layout: false, status: '404'
  end
end