text:
using UnityEngine;
using System.Collections.Generic;

namespace IntelliMedia.Utilities
{
    public class AspectUtility : UniqueMonoBehaviour<AspectUtility> {

        public static readonly Rect NativeScreenSize = new Rect(0, 0, 1920.0f, 1200.0f);
        public float wantedAspectRatio = 1.6f;
        public float guiNativeWidth = 1920.0f;
        public float guiNativeHeight = 1200.0f;

    	public Texture2D blackSwab;

        private Rect aspectAdjustedRect;

        public Rect AspectAdjustedRect
        {
            get
            {
                return aspectAdjustedRect;
            }
        }

        public Rect ScreenPixelRect
        {
            get
            {
                return m_screenRect;
            }
        }

    	private Camera m_backgroundCam;
    	private Rect m_screenRect;
        private Rect m_originalCameraRect = new Rect(0, 0, 1, 1);
    	private int currentWidth = 0;
    	private int currentHeight = 0;

        /// <summary>
        /// Container of observers that wish to receive quest update information
        /// </summary>
        private List<GameObject> observers = new List<GameObject>();

        /// <summary>
        /// Matrix used to transform from screen space to constrained aspect sized screen
        /// </summary>
        private Matrix4x4 matrix;

        public Matrix4x4 Matrix
        {
            get
            {
                return matrix;
            }
        }

        public void RotateAroundPivot(float angle, Vector2 pivot)
        {
            Vector3 transformed = GUI.matrix.MultiplyPoint(new Vector3(pivot.x, pivot.y, 0));
            GUIUtility.RotateAroundPivot(angle, new Vector2(
                transformed.x,
                transformed.y));
        }

        public void Start()
    	{
    		m_screenRect = new Rect(0.0f, 0.0f, Screen.width, Screen.height);

            // Make a new camera behind the normal camera which displays black; otherwise the unused space is undefined
            m_backgroundCam = new GameObject("BackgroundCam", typeof(Camera)).GetComponent<Camera>();
    		m_backgroundCam.clearFlags = CameraClearFlags.SolidColor;
    		m_backgroundCam.cullingMask = 0;
            m_backgroundCam.depth = -10;//m_Camera.depth-10;
            m_backgroundCam.backgroundColor = Color.black;

    		matrix = Matrix4x4.TRS(
                		new Vector3(offsetX, offsetY, 0),
                		Quaternion.identity,
                		new Vector3(adjustedWidth / guiNativeWidth, adjustedHeight / guiNativeHeight, 1));
    	}

        public void OnLevelWasLoaded()
        {
    		currentWidth = 0;
    		currentHeight = 0;

            // Make a new camera behind the normal camera which displays black; otherwise the unused space is undefined
            m_backgroundCam = new GameObject("BackgroundCam", typeof(Camera)).GetComponent<Camera>();
            m_backgroundCam.clearFlags = CameraClearFlags.SolidColor;
            m_backgroundCam.cullingMask = 0;
            m_backgroundCam.depth = -10;// m_Camera.depth - 10;
            m_backgroundCam.backgroundColor = Color.black;
        }

    	public void OnResolutionChanged()
    	{
            int screenWidth = Screen.width;
            int screenHeight = Screen.height;

            float currentAspectRatio = (float)screenWidth / (float)screenHeight;
    		// TODO rtaylor 2011-04-04 Determine if there is a more efficient way to detect
            // resolution change so we don't have to call this every tick.
            //Debug.Log("AspectUtility.OnResolutionChanged: "+screenWidth+", "+screenHeight);
                // Pillarbox
                if (currentAspectRatio > wantedAspectRatio)
                {
                    float inset = 1.0f - wantedAspectRatio / currentAspectRatio;
                    aspectAdjustedRect = new Rect(inset / 2 + m_originalCameraRect.x * (1.0f - inset),
                        m_originalCameraRect.y,
                        m_originalCameraRect.width * (1.0f - inset),
                        m_originalCameraRect.height);

                    m_screenRect.x = Mathf.Floor(screenWidth * (inset / 2));
                    m_screenRect.y = 0.0f;
                    m_screenRect.width = Mathf.Ceil(screenWidth * (1.0f - inset));
                    m_screenRect.height = screenHeight;
                }
                // Letterbox
                else
                {
                    float inset = 1.0f - currentAspectRatio / wantedAspectRatio;
                    aspectAdjustedRect = new Rect(m_originalCameraRect.x,
                        inset / 2 + m_originalCameraRect.y * (1.0f - inset),
                        m_originalCameraRect.width,
                        m_originalCameraRect.height * (1.0f - inset));

                    m_screenRect.x = 0.0f;
                    m_screenRect.y = Mathf.Floor(screenHeight * (inset / 2));
                    m_screenRect.width = screenWidth;
                    m_screenRect.height = Mathf.Ceil(screenHeight * (1.0f - inset));
                }

    		currentWidth = screenWidth;
    		currentHeight = screenHeight;

            matrix = Matrix4x4.TRS(
                new Vector3(offsetX, offsetY, 0),
                Quaternion.identity,
                new Vector3(adjustedWidth / guiNativeWidth, adjustedHeight / guiNativeHeight, 1));
        }

    	public void Update()
    	{
    		if (Screen.width != currentWidth || Screen.height != currentHeight)
    		{
    			OnResolutionChanged();
                SendMessageToAllObservers("OnResolutionChanged", null);
    		}
    	}

        public int adjustedHeight {
            get {
                return (int)m_screenRect.height;
            }
        }

        public int adjustedWidth {
            get {
                return (int)m_screenRect.width;
            }
        }

        public int offsetX {
            get {
                return (int)m_screenRect.x;
            }
        }

        public int offsetY {
            get {
                return (int)m_screenRect.y;
            }
        }

        /// <summary>
        /// This method converts a rect in GUI pixel coordinates to a viewport pixel rect
        /// compatible with the Unity camera's pixelRect property.
        /// </summary>
        /// <param name="pixelRect">
        /// Position and size of camera as if it was a normal UI control <see cref="Rect"/>
        /// </param>
        /// <returns>
        /// Viewport in pixels scaled for the current screen size <see cref="Rect"/>
        /// </returns>
        public Rect GetPixelViewport(Rect pixelRect)
        {
            // The camera viewports (pixel rects) have their origin at the bottom left of the
            // screen. Thus, we need to flip the y.
            // The GUI is designed to be 1900x1200
            pixelRect.y = 1200 - (pixelRect.y + pixelRect.height);

            // Position the corner of the rect
            Vector3 position = matrix.MultiplyPoint(new Vector3(pixelRect.x, pixelRect.y, 0f));
            // Scale the size of the rect
            Vector3 size = new Vector3(pixelRect.width * matrix[0,0], pixelRect.height * matrix[1,1], 0f);

            return new Rect(position.x, position.y, size.x, size.y);
        }

        /// <summary>
        /// Register a GameObject that wishes to receive quest-related messages
        /// </summary>
        /// <param name="gameObject">
        /// Object to receive messages <see cref="GameObject"/>
        /// </param>
        public void AddObserver(GameObject gameObject)
        {
            observers.Add(gameObject);
        }

        /// <summary>
        /// Send a message to all registered listeners
        /// </summary>
        /// <param name="methodName">
        /// Name of method to call <see cref="System.String"/>
        /// </param>
        /// <param name="arg">
        /// Optional argument <see cref="System.Object"/>
        /// </param>
        private void SendMessageToAllObservers(string methodName, object arg)
        {
            GameObject obj;
            for (int i = 0; i < observers.Count; i++)
            {
                obj = observers[i];
                if (obj)
                {
                    obj.SendMessage(methodName, arg, SendMessageOptions.DontRequireReceiver);
                }
                else
                {
                    RemoveObserver(obj);
                }
            }
        }

        /// <summary>
        /// Unregister an observer
        /// </summary>
        /// <param name="gameObject">
        /// Object that no longer wishes to receive messages<see cref="GameObject"/>
        /// </param>
        public void RemoveObserver(GameObject gameObject)
        {
            observers.Remove(gameObject);
        }

    	// Draw black border to hide GUIs drawn outside of viewport but on top of background camera
    	void OnGUI()
    	{
    		GUI.depth = -100;

    		// Draw Left Border
    		float borderWidth = offsetX;
    		GUI.DrawTexture(new Rect(0, 0, borderWidth, Screen.height), blackSwab);

    		// Draw Right Border
    		GUI.DrawTexture(new Rect(offsetX + adjustedWidth, 0,
    		                         borderWidth, Screen.height), blackSwab);

    		// Draw Top Border
    		float borderHeight = (Screen.height - adjustedHeight) / 2;
    		GUI.DrawTexture(new Rect(0, 0, borderHeight, Screen.width), blackSwab);

    		// Draw Bottom Border
    		GUI.DrawTexture(new Rect(0, borderHeight + adjustedHeight, Screen.width, borderHeight),
    		                blackSwab);
    	}
    }
}


text:
package fi.nls.oskari.csw.domain;

import com.vividsolutions.jts.geom.GeometryCollection;
import fi.nls.oskari.util.JSONHelper;
import org.json.JSONArray;
import org.json.JSONObject;

import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;

/**
 * Created by TMIKKOLAINEN on 2.9.2014.
 */
public class CSWIsoRecord {
    private String fileIdentifier;
    private String metadataLanguage;
    private String metadataCharacterSet;
    private List<String> scopeCodes = new ArrayList<String>();
    private List<ResponsibleParty> metadataResponsibleParties = new ArrayList<ResponsibleParty>();
    private Date metadataDateStamp;
    private String metadataStandardName;
    private String metadataStandardVersion;
    private List<Identification> identifications = new ArrayList<Identification>();
    private List<DistributionFormat> distributionFormats = new ArrayList<DistributionFormat>();
    private List<OnlineResource> onlineResources = new ArrayList<OnlineResource>();
    private List<DataQuality> dataQualities = new ArrayList<DataQuality>();
    private URL metadataURL;

    public String getFileIdentifier() {
        return fileIdentifier;
    }

    public void setFileIdentifier(String fileIdentifier) {
        this.fileIdentifier = fileIdentifier;
    }

    public String getMetadataLanguage() {
        return metadataLanguage;
    }

    public void setMetadataLanguage(String metadataLanguage) {
        this.metadataLanguage = metadataLanguage;
    }

    public String getMetadataCharacterSet() {
        return metadataCharacterSet;
    }

    public void setMetadataCharacterSet(String metadataCharacterSet) {
        this.metadataCharacterSet = metadataCharacterSet;
    }

    public List<String> getScopeCodes() {
        return scopeCodes;
    }

    public void setScopeCodes(List<String> scopeCodes) {
        this.scopeCodes = scopeCodes;
    }

    public List<ResponsibleParty> getMetadataResponsibleParties() {
        return metadataResponsibleParties;
    }

    public void setMetadataResponsibleParties(List<ResponsibleParty> metadataResponsibleParties) {
        this.metadataResponsibleParties = metadataResponsibleParties;
    }

    public Date getMetadataDateStamp() {
        return metadataDateStamp;
    }

    public void setMetadataDateStamp(Date metadataDateStamp) {
        this.metadataDateStamp = metadataDateStamp;
    }

    public String getMetadataStandardName() {
        return metadataStandardName;
    }

    public void setMetadataStandardName(String metadataStandardName) {
        this.metadataStandardName = metadataStandardName;
    }

    public String getMetadataStandardVersion() {
        return metadataStandardVersion;
    }

    public void setMetadataStandardVersion(String metadataStandardVersion) {
        this.metadataStandardVersion = metadataStandardVersion;
    }

    public List<Identification> getIdentifications() {
        return identifications;
    }

    public void setIdentifications(List<Identification> identifications) {
        this.identifications = identifications;
    }

    public List<DistributionFormat> getDistributionFormats() {
        return distributionFormats;
    }

    public void setDistributionFormats(List<DistributionFormat> distributionFormats) {
        this.distributionFormats = distributionFormats;
    }

    public List<OnlineResource> getOnlineResources() {
        return onlineResources;
    }

    public void setOnlineResources(List<OnlineResource> onlineResources) {
        this.onlineResources = onlineResources;
    }

    public List<DataQuality> getDataQualities() {
        return dataQualities;
    }

    public void setDataQualities(List<DataQuality> dataQualities) {
        this.dataQualities = dataQualities;
    }

    public URL getMetadataURL() {
        return metadataURL;
    }

    public void setMetadataURL(URL metadataURL) {
        this.metadataURL = metadataURL;
    }

    public JSONObject toJSON() {
        JSONObject ret = new JSONObject();
        JSONHelper.putValue(ret, "fileIdentifier", fileIdentifier);
        JSONHelper.putValue(ret, "metadataLanguage", metadataLanguage);
        JSONHelper.putValue(ret, "metadataCharacterSet", metadataCharacterSet);
        JSONHelper.putValue(ret, "scopeCodes", scopeCodes);
        JSONArray arr = new JSONArray();
        for (ResponsibleParty responsibleParty : metadataResponsibleParties) {
            arr.put(responsibleParty.toJSON());
        }
        JSONHelper.putValue(ret, "metadataResponsibleParties", arr);
        JSONHelper.putValue(ret, "metadataDateStamp", metadataDateStamp);
        JSONHelper.putValue(ret, "metadataStandardName", metadataStandardName);
        JSONHelper.putValue(ret, "metadataStandardVersion", metadataStandardVersion);
        JSONHelper.putValue(ret, "metadataURL", metadataURL);
        arr = new JSONArray();
        for (Identification identification : identifications) {
            arr.put(identification.toJSON());
        }
        JSONHelper.putValue(ret, "identifications", arr);

        arr = new JSONArray();
        for (DistributionFormat distributionFormat : distributionFormats) {
            arr.put(distributionFormat.toJSON());
        }
        JSONHelper.putValue(ret, "distributionFormats", arr);

        arr = new JSONArray();
        for (OnlineResource onlineResource : onlineResources) {
            arr.put(onlineResource.toJSON());
        }
        JSONHelper.putValue(ret, "onlineResources", arr);

        arr = new JSONArray();
        for (DataQuality dataQuality : dataQualities) {
            arr.put(dataQuality.toJSON());
        }
        JSONHelper.putValue(ret, "dataQualities", arr);
        return ret;
    }

    public static class DataQuality {
        private List<String> reportConformances = new ArrayList<String>();
        private String lineageStatement;

        public List<String> getReportConformances() {
            return reportConformances;
        }

        public void setReportConformances(List<String> reportConformances) {
            this.reportConformances = reportConformances;
        }

        public String getLineageStatement() {
            return lineageStatement;
        }

        public void setLineageStatement(String lineageStatement) {
            this.lineageStatement = lineageStatement;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "reportConformances", reportConformances);
            JSONHelper.putValue(ret, "lineageStatement", lineageStatement);
            return ret;
        }
    }

    public static class DistributionFormat {
        private String name;
        private String version;

        public DistributionFormat() {

        }

        public DistributionFormat(String name, String version) {
            this.name = name;
            this.version = version;
        }

        public String getName() {
            return name;
        }

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

        public String getVersion() {
            return version;
        }

        public void setVersion(String version) {
            this.version = version;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "name", name);
            JSONHelper.putValue(ret, "version", version);
            return ret;
        }
    }

    public static class OnlineResource {
        private String name;
        private String url;

        public OnlineResource() {

        }

        public OnlineResource(String name, String url) {
            this.name = name;
            this.url = url;
        }

        public String getName() {
            return name;
        }

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

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "name", name);
            JSONHelper.putValue(ret, "url", url);
            return ret;
        }
    }

    public static class ResponsibleParty {
        private String organisationName;
        private List<String> electronicMailAddresses = new ArrayList<String>();

        public String getOrganisationName() {
            return organisationName;
        }

        public void setOrganisationName(String organisationName) {
            this.organisationName = organisationName;
        }

        public List<String> getElectronicMailAddresses() {
            return electronicMailAddresses;
        }

        public void setElectronicMailAddresses(List<String> electronicMailAddresses) {
            this.electronicMailAddresses = electronicMailAddresses;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "organisationName", organisationName);
            JSONHelper.putValue(ret, "electronicMailAddresses", electronicMailAddresses);
            return ret;
        }
    }

    public static abstract class Identification {
        private Citation citation;
        private String abstractText;
        private List<ResponsibleParty> responsibleParties = new ArrayList<ResponsibleParty>();
        private List<BrowseGraphic> browseGraphics = new ArrayList<BrowseGraphic>();
        private List<String> descriptiveKeywords = new ArrayList<String>();
        private List<String> accessConstraints = new ArrayList<String>();
        private List<String> otherConstraints = new ArrayList<String>();
        private List<String> classifications = new ArrayList<String>();
        private List<String> useLimitations = new ArrayList<String>();
        private List<TemporalExtent> temporalExtents = new ArrayList<TemporalExtent>();
        private GeometryCollection extents;
        private List<Envelope> envelopes = new ArrayList<Envelope>();

        public Citation getCitation() {
            return citation;
        }

        public void setCitation(Citation citation) {
            this.citation = citation;
        }

        public String getAbstractText() {
            return abstractText;
        }

        public void setAbstractText(String abstractText) {
            this.abstractText = abstractText;
        }

        public List<ResponsibleParty> getResponsibleParties() {
            return responsibleParties;
        }

        public void setResponsibleParties(List<ResponsibleParty> responsibleParties) {
            this.responsibleParties = responsibleParties;
        }

        public List<BrowseGraphic> getBrowseGraphics() {
            return browseGraphics;
        }

        public void setBrowseGraphics(List<BrowseGraphic> browseGraphics) {
            this.browseGraphics = browseGraphics;
        }

        public List<String> getDescriptiveKeywords() {
            return descriptiveKeywords;
        }

        public void setDescriptiveKeywords(List<String> descriptiveKeywords) {
            this.descriptiveKeywords = descriptiveKeywords;
        }

        public List<String> getAccessConstraints() {
            return accessConstraints;
        }

        public void setAccessConstraints(List<String> accessConstraints) {
            this.accessConstraints = accessConstraints;
        }

        public List<String> getOtherConstraints() {
            return otherConstraints;
        }

        public void setOtherConstraints(List<String> otherConstraints) {
            this.otherConstraints = otherConstraints;
        }

        public List<String> getClassifications() {
            return classifications;
        }

        public void setClassifications(List<String> classifications) {
            this.classifications = classifications;
        }

        public List<String> getUseLimitations() {
            return useLimitations;
        }

        public void setUseLimitations(List<String> useLimitations) {
            this.useLimitations = useLimitations;
        }

        public List<TemporalExtent> getTemporalExtents() {
            return temporalExtents;
        }

        public void setTemporalExtents(List<TemporalExtent> temporalExtents) {
            this.temporalExtents = temporalExtents;
        }

        public GeometryCollection getExtents() {
            return extents;
        }

        public void setExtents(GeometryCollection extents) {
            this.extents = extents;
        }

        public List<Envelope> getEnvelopes() {
            return envelopes;
        }

        public void setEnvelopes(List<Envelope> envelopes) {
            this.envelopes = envelopes;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "citation", citation == null ? null : citation.toJSON());
            JSONHelper.putValue(ret, "abstractText", abstractText);

            JSONArray arr = new JSONArray();
            for (ResponsibleParty responsibleParty : responsibleParties) {
                arr.put(responsibleParty.toJSON());
            }
            JSONHelper.putValue(ret, "responsibleParties", arr);
            arr = new JSONArray();
            for (BrowseGraphic browseGraphic : browseGraphics) {
                arr.put(browseGraphic.toJSON());
            }
            JSONHelper.putValue(ret, "browseGraphics", arr);

            JSONHelper.putValue(ret, "descriptiveKeywords", descriptiveKeywords);
            JSONHelper.putValue(ret, "accessConstraints", accessConstraints);
            JSONHelper.putValue(ret, "otherConstraints", otherConstraints);
            JSONHelper.putValue(ret, "classifications", classifications);
            JSONHelper.putValue(ret, "useLimitations", useLimitations);
            arr = new JSONArray();
            for (TemporalExtent temporalExtent : temporalExtents) {
                arr.put(temporalExtent.toJSON());
            }
            JSONHelper.putValue(ret, "temporalExtents", arr);
            // TODO magic up JSON from extents
            arr = new JSONArray();
            for (Envelope envelope : envelopes) {
                arr.put(envelope.toJSON());
            }
            JSONHelper.putValue(ret, "envelopes", arr);
            return ret;
        }

        public static class Citation {
            private String title;
            private String alternateTitle;
            private DateWithType date;
            private List<ResourceIdentifier> resourceIdentifiers = new ArrayList<ResourceIdentifier>();

            public String getTitle() {
                return title;
            }

            public void setTitle(String title) {
                this.title = title;
            }

            public String getAlternateTitle() {
                return alternateTitle;
            }

            public void setAlternateTitle(String alternateTitle) {
                this.alternateTitle = alternateTitle;
            }

            public DateWithType getDate() {
                return date;
            }

            public void setDate(DateWithType date) {
                this.date = date;
            }

            public List<ResourceIdentifier> getResourceIdentifiers() {
                return resourceIdentifiers;
            }

            public void setResourceIdentifiers(List<ResourceIdentifier> resourceIdentifiers) {
                this.resourceIdentifiers = resourceIdentifiers;
            }

            public static class ResourceIdentifier {
                private String code;
                private String codeSpace;

                public String getCodeSpace() {
                    return codeSpace;
                }

                public void setCodeSpace(String codeSpace) {
                    this.codeSpace = codeSpace;
                }

                public String getCode() {
                    return code;
                }

                public void setCode(String code) {
                    this.code = code;
                }

                public JSONObject toJSON() {
                    JSONObject ret = new JSONObject();
                    JSONHelper.putValue(ret, "code", code);
                    JSONHelper.putValue(ret, "codeSpace", codeSpace);
                    return ret;
                }
            }

            public JSONObject toJSON() {
                JSONObject ret = new JSONObject();
                JSONHelper.putValue(ret, "title", title);
                JSONHelper.putValue(ret, "alternateTitle", alternateTitle);
                JSONHelper.putValue(ret, "date", date == null ? null : date.toJSON());
                JSONArray arr = new JSONArray();
                for (ResourceIdentifier resourceIdentifier : resourceIdentifiers) {
                    arr.put(resourceIdentifier.toJSON());
                }
                JSONHelper.putValue(ret, "resourceIdentifiers", arr);
                return ret;
            }
        }

        public static class DateWithType {
            private Date date;
            private String dateType;

            public Date getDate() {
                return date;
            }

            public void setDate(Date date) {
                this.date = date;
            }

            public String getDateType() {
                return dateType;
            }

            public void setDateType(String dateType) {
                this.dateType = dateType;
            }

            public JSONObject toJSON() {
                JSONObject ret = new JSONObject();
                // TODO fix format
                final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
                JSONHelper.putValue(ret, "date", sdf.format(date));
                JSONHelper.putValue(ret, "dateType", dateType);
                return ret;
            }
        }

        public static class TemporalExtent {
            private String begin, end;

            public TemporalExtent() {

            }

            public TemporalExtent (String begin, String end) {
                this.begin = begin;
                this.end = end;
            }

            public String getBegin() {
                return begin;
            }

            public void setBegin(String begin) {
                this.begin = begin;
            }

            public String getEnd() {
                return end;
            }

            public void setEnd(String end) {
                this.end = end;
            }

            public JSONObject toJSON() {
                JSONObject ret = new JSONObject();
                JSONHelper.putValue(ret, "begin", begin);
                JSONHelper.putValue(ret, "end", end);
                return ret;
            }
        }
    }

    public static class DataIdentification extends Identification {
        private List<String> characterSets = new ArrayList<String>();
        private List<String> languages = new ArrayList<String>();
        private List<String> topicCategories = new ArrayList<String>();
        private List<Integer> spatialResolutions = new ArrayList<Integer>();
        private List<String> spatialRepresentationTypes = new ArrayList<String>();

        public List<String> getCharacterSets() {
            return characterSets;
        }

        public void setCharacterSets(List<String> characterSets) {
            this.characterSets = characterSets;
        }

        public List<String> getLanguages() {
            return languages;
        }

        public void setLanguages(List<String> languages) {
            this.languages = languages;
        }

        public List<String> getTopicCategories() {
            return topicCategories;
        }

        public void setTopicCategories(List<String> topicCategories) {
            this.topicCategories = topicCategories;
        }

        public List<Integer> getSpatialResolutions() {
            return spatialResolutions;
        }

        public void setSpatialResolutions(List<Integer> spatialResolutions) {
            this.spatialResolutions = spatialResolutions;
        }

        public List<String> getSpatialRepresentationTypes() {
            return spatialRepresentationTypes;
        }

        public void setSpatialRepresentationTypes(List<String> spatialRepresentationTypes) {
            this.spatialRepresentationTypes = spatialRepresentationTypes;
        }

        public JSONObject toJSON() {
            JSONObject ret = super.toJSON();
            JSONHelper.putValue(ret, "characterSets", characterSets);
            JSONHelper.putValue(ret, "languages", languages);
            JSONHelper.putValue(ret, "topicCategories", topicCategories);
            JSONHelper.putValue(ret, "spatialResolutions", spatialResolutions);
            JSONHelper.putValue(ret, "spatialRepresentationTypes", spatialRepresentationTypes);
            JSONHelper.putValue(ret, "type", "data");
            return ret;
        }
    }

    public static class ServiceIdentification extends Identification {
        private String serviceType;
        private String serviceTypeVersion;
        private List<String> operatesOn = new ArrayList<String>();

        public String getServiceType() {
            return serviceType;
        }

        public void setServiceType(String serviceType) {
            this.serviceType = serviceType;
        }

        public String getServiceTypeVersion() {
            return serviceTypeVersion;
        }

        public void setServiceTypeVersion(String serviceTypeVersion) {
            this.serviceTypeVersion = serviceTypeVersion;
        }

        public List<String> getOperatesOn() {
            return operatesOn;
        }

        public void setOperatesOn(List<String> operatesOn) {
            this.operatesOn = operatesOn;
        }

        public JSONObject toJSON() {
            JSONObject ret = super.toJSON();
            JSONHelper.putValue(ret, "type", "service");
            JSONHelper.putValue(ret, "serviceType", serviceType);
            JSONHelper.putValue(ret, "serviceTypeVersion", serviceTypeVersion);
            JSONHelper.putValue(ret, "operatesOn", operatesOn);
            return ret;
        }
    }

    public static class BrowseGraphic {
        private String fileName;
        private String fileDescription;
        private String fileType;

        public String getFileName() {
            return fileName;
        }

        public void setFileName(String fileName) {
            this.fileName = fileName;
        }

        public String getFileDescription() {
            return fileDescription;
        }

        public void setFileDescription(String fileDescription) {
            this.fileDescription = fileDescription;
        }

        public String getFileType() {
            return fileType;
        }

        public void setFileType(String fileType) {
            this.fileType = fileType;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "fileName", fileName);
            JSONHelper.putValue(ret, "fileDescription", fileDescription);
            JSONHelper.putValue(ret, "fileType", fileType);
            return ret;
        }
    }

    public static class Envelope {
        Double westBoundLongitude;
        Double eastBoundLongitude;
        Double southBoundLatitude;
        Double northBoundLatitude;

        public Double getEastBoundLongitude() {
            return eastBoundLongitude;
        }

        public void setEastBoundLongitude(Double eastBoundLongitude) {
            this.eastBoundLongitude = eastBoundLongitude;
        }

        public Double getNorthBoundLatitude() {
            return northBoundLatitude;
        }

        public void setNorthBoundLatitude(Double northBoundLatitude) {
            this.northBoundLatitude = northBoundLatitude;
        }

        public Double getSouthBoundLatitude() {
            return southBoundLatitude;
        }

        public void setSouthBoundLatitude(Double southBoundLatitude) {
            this.southBoundLatitude = southBoundLatitude;
        }

        public Double getWestBoundLongitude() {
            return westBoundLongitude;
        }

        public void setWestBoundLongitude(Double westBoundLongitude) {
            this.westBoundLongitude = westBoundLongitude;
        }

        public JSONObject toJSON() {
            JSONObject ret = new JSONObject();
            JSONHelper.putValue(ret, "westBoundLongitude", westBoundLongitude);
            JSONHelper.putValue(ret, "eastBoundLongitude", eastBoundLongitude);
            JSONHelper.putValue(ret, "southBoundLatitude", southBoundLatitude);
            JSONHelper.putValue(ret, "northBoundLatitude", northBoundLatitude);
            return ret;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package nz.co.thebteam.AutomationLibrary.Utilities;

import org.apache.commons.io.FileUtils;
import org.jsoup.nodes.Document;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

public class FileHandler {
    public static void writeOutFileAsHTML(Document resource, String fileName) throws IOException {
        File file = new File(fileName);
        FileUtils.writeStringToFile(file, resource.outerHtml(), "UTF-8");
    }

    public static void writeOutFile(String resource, String fileName) throws IOException {
        File file = new File(fileName);
        FileUtils.writeStringToFile(file, resource, "UTF-8");
    }

    public static String readFileAsString(String fileName) {
        File file = new File(fileName);
        try {
            return FileUtils.readFileToString(file);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static InputStream readFileAsInputStream(String fileName) {
        File file = new File(fileName);
        try {
            return  FileUtils.openInputStream(file);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

}


text:
import {Directive, ElementRef, Host, Input, OnDestroy, Optional, Renderer2, StaticProvider, forwardRef, ɵlooseIdentical as looseIdentical} from '@angular/core';

import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor';

export const SELECT_MULTIPLE_VALUE_ACCESSOR: StaticProvider = {
  provide: NG_VALUE_ACCESSOR,
  useExisting: forwardRef(() => SelectMultipleControlValueAccessor),
  multi: true
};

function _buildValueString(id: string, value: any): string {
  if (id == null) return `${value}`;
  if (typeof value === 'string') value = `'${value}'`;
  if (value && typeof value === 'object') value = 'Object';
  return `${id}: ${value}`.slice(0, 50);
}

function _extractId(valueString: string): string {
  return valueString.split(':')[0];
}

/** Mock interface for HTML Options */
interface HTMLOption {
  value: string;
  selected: boolean;
}

/** Mock interface for HTMLCollection */
abstract class HTMLCollection {
  // TODO(issue/24571): remove '!'.
  length !: number;
  abstract item(_: number): HTMLOption;
}

/**
 * The accessor for writing a value and listening to changes on a select element.
 *
 * @usageNotes
 * ### Caveat: Options selection
 *
 * Angular uses object identity to select options. It's possible for the identities of items
 * to change while the data does not. This can happen, for example, if the items are produced
 * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
 * second response will produce objects with different identities.
 *
 * To customize the default option comparison algorithm, `<select multiple>` supports `compareWith`
 * input. `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
 * If `compareWith` is given, Angular selects options by the return value of the function.
 *
 * ### Syntax
 *
 * ```
 * <select multiple [compareWith]="compareFn"  [(ngModel)]="selectedCountries">
 *     <option *ngFor="let country of countries" [ngValue]="country">
 *         {{country.name}}
 *     </option>
 * </select>
 *
 * compareFn(c1: Country, c2: Country): boolean {
 *     return c1 && c2 ? c1.id === c2.id : c1 === c2;
 * }
 * ```
 *
 * @ngModule ReactiveFormsModule
 * @ngModule FormsModule
 */
@Directive({
  selector:
      'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]',
  host: {'(change)': 'onChange($event.target)', '(blur)': 'onTouched()'},
  providers: [SELECT_MULTIPLE_VALUE_ACCESSOR]
})
export class SelectMultipleControlValueAccessor implements ControlValueAccessor {
  value: any;
  /** @internal */
  _optionMap: Map<string, NgSelectMultipleOption> = new Map<string, NgSelectMultipleOption>();
  /** @internal */
  _idCounter: number = 0;

  onChange = (_: any) => {};
  onTouched = () => {};

  @Input()
  set compareWith(fn: (o1: any, o2: any) => boolean) {
    if (typeof fn !== 'function') {
      throw new Error(`compareWith must be a function, but received ${JSON.stringify(fn)}`);
    }
    this._compareWith = fn;
  }

  private _compareWith: (o1: any, o2: any) => boolean = looseIdentical;

  constructor(private _renderer: Renderer2, private _elementRef: ElementRef) {}

  writeValue(value: any): void {
    this.value = value;
    let optionSelectedStateSetter: (opt: NgSelectMultipleOption, o: any) => void;
    if (Array.isArray(value)) {
      // convert values to ids
      const ids = value.map((v) => this._getOptionId(v));
      optionSelectedStateSetter = (opt, o) => { opt._setSelected(ids.indexOf(o.toString()) > -1); };
    } else {
      optionSelectedStateSetter = (opt, o) => { opt._setSelected(false); };
    }
    this._optionMap.forEach(optionSelectedStateSetter);
  }

  registerOnChange(fn: (value: any) => any): void {
    this.onChange = (_: any) => {
      const selected: Array<any> = [];
      if (_.hasOwnProperty('selectedOptions')) {
        const options: HTMLCollection = _.selectedOptions;
        for (let i = 0; i < options.length; i++) {
          const opt: any = options.item(i);
          const val: any = this._getOptionValue(opt.value);
          selected.push(val);
        }
      }
      // Degrade on IE
      else {
        const options: HTMLCollection = <HTMLCollection>_.options;
        for (let i = 0; i < options.length; i++) {
          const opt: HTMLOption = options.item(i);
          if (opt.selected) {
            const val: any = this._getOptionValue(opt.value);
            selected.push(val);
          }
        }
      }
      this.value = selected;
      fn(selected);
    };
  }
  registerOnTouched(fn: () => any): void { this.onTouched = fn; }

  setDisabledState(isDisabled: boolean): void {
    this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  }

  /** @internal */
  _registerOption(value: NgSelectMultipleOption): string {
    const id: string = (this._idCounter++).toString();
    this._optionMap.set(id, value);
    return id;
  }

  /** @internal */
  _getOptionId(value: any): string|null {
    for (const id of Array.from(this._optionMap.keys())) {
      if (this._compareWith(this._optionMap.get(id) !._value, value)) return id;
    }
    return null;
  }

  /** @internal */
  _getOptionValue(valueString: string): any {
    const id: string = _extractId(valueString);
    return this._optionMap.has(id) ? this._optionMap.get(id) !._value : valueString;
  }
}

/**
 * Marks `<option>` as dynamic, so Angular can be notified when options change.
 *
 * @usageNotes
 * ### Example
 *
 * ```
 * <select multiple name="city" ngModel>
 *   <option *ngFor="let c of cities" [value]="c"></option>
 * </select>
 * ```
 * @ngModule FormsModule
 * @ngModule ReactiveFormsModule
 */
@Directive({selector: 'option'})
export class NgSelectMultipleOption implements OnDestroy {
  // TODO(issue/24571): remove '!'.
  id !: string;
  /** @internal */
  _value: any;

  constructor(
      private _element: ElementRef, private _renderer: Renderer2,
      @Optional() @Host() private _select: SelectMultipleControlValueAccessor) {
    if (this._select) {
      this.id = this._select._registerOption(this);
    }
  }

  @Input('ngValue')
  set ngValue(value: any) {
    if (this._select == null) return;
    this._value = value;
    this._setElementValue(_buildValueString(this.id, value));
    this._select.writeValue(this._select.value);
  }

  @Input('value')
  set value(value: any) {
    if (this._select) {
      this._value = value;
      this._setElementValue(_buildValueString(this.id, value));
      this._select.writeValue(this._select.value);
    } else {
      this._setElementValue(value);
    }
  }

  /** @internal */
  _setElementValue(value: string): void {
    this._renderer.setProperty(this._element.nativeElement, 'value', value);
  }

  /** @internal */
  _setSelected(selected: boolean) {
    this._renderer.setProperty(this._element.nativeElement, 'selected', selected);
  }

  ngOnDestroy(): void {
    if (this._select) {
      this._select._optionMap.delete(this.id);
      this._select.writeValue(this._select.value);
    }
  }
}


text:
/*****************************************************************************/
/**
 *  @file   LineObject.cpp
 *  @author Naohisa Sakamoto
 */
/*****************************************************************************/
#include "LineObject.h"
#include <string>
#include <kvs/KVSMLLineObject>
#include <kvs/PolygonObject>
#include <kvs/Assert>
#include <kvs/Type>
#include <map>

namespace
{

/*===========================================================================*/
/**
 *  @brief  Returns the name of line type as string.
 *  @param  type [in] line type
 *  @return name of line type as string
 */
/*===========================================================================*/
const std::string GetLineTypeName( const kvs::LineObject::LineType type )
{
    switch ( type )
    {
    case kvs::LineObject::Strip: return "strip";
    case kvs::LineObject::Uniline: return "uniline";
    case kvs::LineObject::Polyline: return "polyline";
    case kvs::LineObject::Segment: return "segment";
    default: return "unknown";
    }
}

/*===========================================================================*/
/**
 *  @brief  Returns the name of color type as string.
 *  @param  type [in] color type
 *  @return name of color type as string
 */
/*===========================================================================*/
const std::string GetColorTypeName( const kvs::LineObject::ColorType type )
{
    switch ( type )
    {
    case kvs::LineObject::VertexColor: return "vertex";
    case kvs::LineObject::LineColor: return "line";
    default: return "unknown";
    }
}

/*==========================================================================*/
/**
 *  @brief  Returns the line type from the given string.
 *  @param  line_type [in] line type string
 *  @return line type
 */
/*==========================================================================*/
kvs::LineObject::LineType GetLineType( const std::string& line_type )
{
    if (      line_type == "strip"    ) { return kvs::LineObject::Strip; }
    else if ( line_type == "uniline"  ) { return kvs::LineObject::Uniline; }
    else if ( line_type == "polyline" ) { return kvs::LineObject::Polyline; }
    else if ( line_type == "segment"  ) { return kvs::LineObject::Segment; }
    else
    {
        kvsMessageError( "Unknown line type '%s'.", line_type.c_str() );
        return kvs::LineObject::UnknownLineType;
    }
}

/*==========================================================================*/
/**
 *  @brief  Returns the line color type from the given string.
 *  @param  color_type [in] line color type string
 *  @return line color type
 */
/*==========================================================================*/
kvs::LineObject::ColorType GetColorType( const std::string& color_type )
{
    if (      color_type == "vertex" ) { return kvs::LineObject::VertexColor; }
    else if ( color_type == "line"   ) { return kvs::LineObject::LineColor; }
    else
    {
        kvsMessageError( "Unknown line color type '%s'.", color_type.c_str() );
        return kvs::LineObject::UnknownColorType;
    }
}

/*===========================================================================*/
/**
 *  @brief  Returns a writing data type.
 *  @param  ascii [in] ascii (true = default) or binary (true)
 *  @param  external [in] external (true) or internal (false = default)
 *  @return writing data type
 */
/*===========================================================================*/
kvs::KVSMLLineObject::WritingDataType GetWritingDataType( const bool ascii, const bool external )
{
    if ( ascii )
    {
        if ( external ) { return kvs::KVSMLLineObject::ExternalAscii; }
        else { return kvs::KVSMLLineObject::Ascii; }
    }
    else
    {
        return kvs::KVSMLLineObject::ExternalBinary;
    }
}

/*===========================================================================*/
/**
 *  @brief  Edge map class (hash map table for the edge data).
 */
/*===========================================================================*/
class EdgeMap
{
public:

    typedef kvs::UInt32 Key;
    typedef std::pair<kvs::UInt32,kvs::UInt32> Value;
    typedef std::multimap<Key,Value> Bucket;

private:

    size_t m_nvertices; ///< number of vertices of the original data
    Bucket m_bucket; ///< bucket for the edge data

public:

    EdgeMap( const size_t nvertices ):
        m_nvertices( nvertices ) {}

    void insert( const kvs::UInt32 v0, const kvs::UInt32 v1 )
    {
        const Key key = ( v0 + v1 ) % kvs::UInt32( m_nvertices );

        Bucket::iterator e = m_bucket.find( key );
        Bucket::const_iterator last = m_bucket.end();
        if ( e != last )
        {
            Bucket::const_iterator upper = m_bucket.upper_bound( key );
            while ( e != upper )
            {
                if ( ( e->second.first == v0 && e->second.second == v1 ) ||
                     ( e->second.first == v1 && e->second.second == v0 ) )
                {
                    // The edge has been already inserted in the bucket.
                    return;
                }
                e++;
            }
        }

        m_bucket.insert( std::make_pair( key, std::make_pair( v0, v1 ) ) );
    }

    const kvs::ValueArray<kvs::UInt32> serialize()
    {
        kvs::ValueArray<kvs::UInt32> connections( 2 * m_bucket.size() );

        Bucket::const_iterator e = m_bucket.begin();
        Bucket::const_iterator last = m_bucket.end();
        size_t connection_index = 0;
        while ( e != last )
        {
            connections[ connection_index++ ] = e->second.first;
            connections[ connection_index++ ] = e->second.second;
            e++;
        }

        return connections;
    }
};

kvs::ValueArray<kvs::UInt32> GetConnections( const kvs::PolygonObject& polygon )
{
    const size_t nconnections = polygon.numberOfConnections();
    const size_t ncorners = size_t( polygon.polygonType() );
    const size_t npolygons = ( nconnections == 0 ) ?
        polygon.numberOfVertices() / ncorners : nconnections;

    EdgeMap edge_map( polygon.numberOfVertices() );
    if ( nconnections > 0 )
    {
        if ( polygon.polygonType() == kvs::PolygonObject::Triangle )
        {
            for ( size_t i = 0; i < npolygons; i++ )
            {
                const kvs::UInt32 v0 =  polygon.connections().at( 3 * i );
                const kvs::UInt32 v1 =  polygon.connections().at( 3 * i + 1 );
                const kvs::UInt32 v2 =  polygon.connections().at( 3 * i + 2 );
                edge_map.insert( v0, v1 );
                edge_map.insert( v1, v2 );
                edge_map.insert( v2, v0 );
            }
        }
        else if ( polygon.polygonType() == kvs::PolygonObject::Quadrangle )
        {
            for ( size_t i = 0; i < npolygons; i++ )
            {
                const kvs::UInt32 v0 =  polygon.connections().at( 4 * i );
                const kvs::UInt32 v1 =  polygon.connections().at( 4 * i + 1 );
                const kvs::UInt32 v2 =  polygon.connections().at( 4 * i + 2 );
                const kvs::UInt32 v3 =  polygon.connections().at( 4 * i + 3 );
                edge_map.insert( v0, v1 );
                edge_map.insert( v1, v2 );
                edge_map.insert( v2, v3 );
                edge_map.insert( v3, v0 );
            }
        }
    }
    else
    {
        if ( polygon.polygonType() == kvs::PolygonObject::Triangle )
        {
            for ( size_t i = 0; i < npolygons; i++ )
            {
                const kvs::UInt32 v0 =  3 * i;
                const kvs::UInt32 v1 =  3 * i + 1;
                const kvs::UInt32 v2 =  3 * i + 2;
                edge_map.insert( v0, v1 );
                edge_map.insert( v1, v2 );
                edge_map.insert( v2, v0 );
            }
        }
        else if ( polygon.polygonType() == kvs::PolygonObject::Quadrangle )
        {
            for ( size_t i = 0; i < npolygons; i++ )
            {
                const kvs::UInt32 v0 =  4 * i;
                const kvs::UInt32 v1 =  4 * i + 1;
                const kvs::UInt32 v2 =  4 * i + 2;
                const kvs::UInt32 v3 =  4 * i + 3;
                edge_map.insert( v0, v1 );
                edge_map.insert( v1, v2 );
                edge_map.insert( v2, v3 );
                edge_map.insert( v3, v0 );
            }
        }
    }

    return edge_map.serialize();
}

} // end of namespace

namespace kvs
{

/*===========================================================================*/
/**
 *  @brief  Constructs a new LineObject class.
 */
/*===========================================================================*/
LineObject::LineObject()
{
    BaseClass::setGeometryType( Line );
    this->setSize( 1 );
}

/*===========================================================================*/
/**
 *  @brief  Constructs a new LineObject class.
 *  @param  polygon [in] polygon object
 */
/*===========================================================================*/
LineObject::LineObject( const kvs::PolygonObject& polygon )
{
    BaseClass::setGeometryType( Line );
    BaseClass::setCoords( polygon.coords() );

    if( polygon.colorType() == kvs::PolygonObject::VertexColor )
    {
        this->setColorType( LineObject::VertexColor );
        BaseClass::setColors( polygon.colors() );
    }
    else
    {
        this->setColorType( LineObject::LineColor );
        BaseClass::setColor( polygon.color() );
    }

    this->setSize( 1.0f );
    this->setLineType( LineObject::Segment );
    this->setConnections( ::GetConnections( polygon ) );

    BaseClass::setMinMaxObjectCoords(
        polygon.minObjectCoord(),
        polygon.maxObjectCoord() );

    BaseClass::setMinMaxExternalCoords(
        polygon.minExternalCoord(),
        polygon.maxExternalCoord() );
}

/*===========================================================================*/
/**
 *  @brief  Shallow copys.
 *  @param  object [in] line object
 */
/*===========================================================================*/
void LineObject::shallowCopy( const LineObject& object )
{
    BaseClass::shallowCopy( object );
    m_line_type = object.lineType();
    m_color_type = object.colorType();
    m_connections = object.connections();
    m_sizes = object.sizes();
}

/*===========================================================================*/
/**
 *  @brief  Deep copys.
 *  @param  object [in] line object
 */
/*===========================================================================*/
void LineObject::deepCopy( const LineObject& object )
{
    BaseClass::deepCopy( object );
    m_line_type = object.lineType();
    m_color_type = object.colorType();
    m_connections = object.connections().clone();
    m_sizes = object.sizes().clone();
}

/*===========================================================================*/
/**
 *  @brief  Clears the data of the line object.
 */
/*===========================================================================*/
void LineObject::clear()
{
    BaseClass::clear();
    m_connections.release();
    m_sizes.release();
}

/*===========================================================================*/
/**
 *  @brief  Prints the information of the line object.
 *  @param  os [in] output stream
 *  @param  indent [in] indent
 */
/*===========================================================================*/
void LineObject::print( std::ostream& os, const kvs::Indent& indent ) const
{
    os << indent << "Object type : " << "line object" << std::endl;
    BaseClass::print( os, indent );
    os << indent << "Number of connections : " << this->numberOfConnections() << std::endl;
    os << indent << "Number of sizes : " << this->numberOfSizes() << std::endl;
    os << indent << "Line type : " << ::GetLineTypeName( this->lineType() ) << std::endl;
    os << indent << "Color type : " << ::GetColorTypeName( this->colorType() ) << std::endl;
}

/*===========================================================================*/
/**
 *  @brief  Read a line object from the specified file in KVSML.
 *  @param  filename [in] input filename
 *  @return true, if the reading process is done successfully
 */
/*===========================================================================*/
bool LineObject::read( const std::string& filename )
{
    if ( !kvs::KVSMLLineObject::CheckExtension( filename ) )
    {
        kvsMessageError("%s is not a line object file in KVSML.", filename.c_str());
        return false;
    }

    kvs::KVSMLLineObject kvsml;
    if ( !kvsml.read( filename ) ) { return false; }

    this->setLineType( ::GetLineType( kvsml.lineType() ) );
    this->setColorType( ::GetColorType( kvsml.colorType() ) );
    this->setCoords( kvsml.coords() );
    this->setColors( kvsml.colors() );
    this->setSizes( kvsml.sizes() );
    this->setConnections( kvsml.connections() );

    if ( kvsml.hasExternalCoord() )
    {
        const kvs::Vec3 min_coord( kvsml.minExternalCoord() );
        const kvs::Vec3 max_coord( kvsml.maxExternalCoord() );
        this->setMinMaxExternalCoords( min_coord, max_coord );
    }

    if ( kvsml.hasObjectCoord() )
    {
        const kvs::Vec3 min_coord( kvsml.minObjectCoord() );
        const kvs::Vec3 max_coord( kvsml.maxObjectCoord() );
        this->setMinMaxObjectCoords( min_coord, max_coord );
    }
    else
    {
        this->updateMinMaxCoords();
    }

    return true;
}

/*===========================================================================*/
/**
 *  @brief  Write the line object to the specfied file in KVSML.
 *  @param  filename [in] output filename
 *  @param  ascii [in] ascii (true = default) or binary (true)
 *  @param  external [in] external (true) or internal (false = default)
 *  @return true, if the writing process is done successfully
 */
/*===========================================================================*/
bool LineObject::write( const std::string& filename, const bool ascii, const bool external ) const
{
    kvs::KVSMLLineObject kvsml;
    kvsml.setWritingDataType( ::GetWritingDataType( ascii, external ) );
    kvsml.setLineType( ::GetLineTypeName( this->lineType() ) );
    kvsml.setColorType( ::GetColorTypeName( this->colorType() ) );
    kvsml.setCoords( this->coords() );
    kvsml.setColors( this->colors() );
    kvsml.setConnections( this->connections() );
    kvsml.setSizes( this->sizes() );

    if ( this->hasMinMaxObjectCoords() )
    {
        kvsml.setMinMaxObjectCoords( this->minObjectCoord(), this->maxObjectCoord() );
    }

    if ( this->hasMinMaxExternalCoords() )
    {
        kvsml.setMinMaxExternalCoords( this->minExternalCoord(), this->maxExternalCoord() );
    }

    return kvsml.write( filename );
}

/*===========================================================================*/
/**
 *  @brief  Sets a color value.
 *  @param  color [in] color value
 */
/*===========================================================================*/
void LineObject::setColor( const kvs::RGBColor& color )
{
    BaseClass::setColor( color );
    m_color_type = LineObject::LineColor;
}

/*===========================================================================*/
/**
 *  @brief  Sets a size value.
 *  @param  size [in] size value
 */
/*===========================================================================*/
void LineObject::setSize( const kvs::Real32 size )
{
    m_sizes.allocate( 1 );
    m_sizes[0] = size;
}

/*===========================================================================*/
/**
 *  @brief  Returns the number of connections.
 *  @return number of connections
 */
/*===========================================================================*/
size_t LineObject::numberOfConnections() const
{
    return
        m_line_type == LineObject::Uniline ?
        m_connections.size() :
        m_connections.size() / 2;
}

/*===========================================================================*/
/**
 *  @brief  Returns the number of sizes.
 *  @return number of sizes
 */
/*===========================================================================*/
size_t LineObject::numberOfSizes() const
{
    return m_sizes.size();
}

/*===========================================================================*/
/**
 *  @brief  Returns the connection specified by the index.
 *  @param  index [in] index of connection array
 *  @return connection
 */
/*===========================================================================*/
const kvs::Vec2ui LineObject::connection( const size_t index ) const
{
    return kvs::Vec2ui( (unsigned int*)m_connections.data() + 2 * index );
}

/*===========================================================================*/
/**
 *  @brief  Returns the size.
 *  @param  index [in] index of size array
 *  @return size
 */
/*===========================================================================*/
kvs::Real32 LineObject::size( const size_t index ) const
{
    return m_sizes[index];
}

std::ostream& operator << ( std::ostream& os, const LineObject& object )
{
    os << "Object type:  " << "line object" << std::endl;
#ifdef KVS_COMPILER_VC
#if KVS_COMPILER_VERSION_LESS_OR_EQUAL( 8, 0 )
    // @TODO Cannot instance the object that is a abstract class here (error:C2259).
#endif
#else
//    os << static_cast<const kvs::GeometryObjectBase&>( object ) << std::endl;
    static_cast<const kvs::GeometryObjectBase&>( object ).print( os );
#endif
    os << "Number of connections:  " << object.numberOfConnections() << std::endl;
    os << "Number of sizes:  " << object.numberOfSizes() << std::endl;
    os << "Line type:  " << ::GetLineTypeName( object.lineType() ) << std::endl;
    os << "Color type:  " << ::GetColorTypeName( object.colorType() );

    return os;
}

} // end of namespace kvs


text:
module egret.native {
    if (DEBUG) {
        function setLogLevel(logType:string):void {
            egret_native.loglevel(logType);
        }

        Object.defineProperty(Logger, "logLevel", {
            set: setLogLevel,
            enumerable: true,
            configurable: true
        });
    }
}


text:
package com.outworkers.phantom.builder.query

import java.nio.ByteBuffer
import java.util.{Collections, Map => JMap}

import scala.collection.JavaConverters._
import com.datastax.driver.core._
import com.datastax.driver.core.policies.TokenAwarePolicy
import com.outworkers.phantom.Manager
import com.outworkers.phantom.builder.ops.TokenizerKey
import com.outworkers.phantom.builder.primitives.Primitive
import shapeless.{::, Generic, HList, HNil, Lazy}

import scala.annotation.implicitNotFound

trait Modifier extends (Statement => Statement)

case class Payload(underlying: JMap[String, ByteBuffer]) {
  def isEmpty: Boolean = underlying.isEmpty

  def add(other: (String, ByteBuffer)): Payload = {
    val (key, value) = other
    underlying.put(key, value)
    Payload(underlying)
  }

  def add[T](other: (String, T))(
    implicit ev: Primitive[T],
    pv: ProtocolVersion
  ): Payload = {
    val (key, value) = other
    underlying.put(key, ev.serialize(value, pv))
    Payload(underlying)
  }
}

@implicitNotFound("Payloads are a sequence of (key, value) tuples where the key is always String, and the value is a primitive.")
trait PayloadSerializer[HL <: HList] {
  def apply(input: HL): Seq[(String, ByteBuffer)]
}

object PayloadSerializer {

  def apply[HL <: HList](implicit ev: PayloadSerializer[HL]): PayloadSerializer[HL] = ev

  implicit val hNilSerializer: PayloadSerializer[HNil] = new PayloadSerializer[HNil] {
    override def apply(input: HNil): Seq[(String, ByteBuffer)] = Seq.empty
  }

  implicit def hconsSerializer[H, HL <: HList, A, B](
    implicit tpEv: H <:< (String, B),
    ev: Primitive[B],
    pv: ProtocolVersion,
    ps: Lazy[PayloadSerializer[HL]]
  ): PayloadSerializer[H :: HL] = new PayloadSerializer[::[H, HL]] {
    override def apply(input: ::[H, HL]): Seq[(String, ByteBuffer)] = {
      val (key, value): (String, B) = input.head
      Seq(key -> ev.serialize(value, pv)) ++ ps.value(input.tail)
    }
  }
}

object Payload {
  def empty: Payload = new Payload(Collections.emptyMap())

  def apply(map: Map[String, ByteBuffer]): Payload = new Payload(map.asJava)

  def apply(tp: (String, ByteBuffer)): Payload = apply(Seq(tp).toMap)

  def seq(tp: (String, ByteBuffer)*): Payload = apply(tp.toMap)

  def apply[T](tp: (String, T))(implicit ev: Primitive[T], pv: ProtocolVersion): Payload = {
    val (key, value) = tp
    apply(Seq(key -> ev.serialize(value, pv)).toMap)
  }

  def apply[V1, HL <: HList](tp: V1)(
    implicit gen: Generic.Aux[V1, HL],
    pv: ProtocolVersion,
    ps: PayloadSerializer[HL]
  ): Payload = {
    seq(ps(gen to tp): _*)
  }
}

case class RoutingKeyModifier(
  tokens: List[TokenizerKey]
)(
  implicit session: Session
) extends (SimpleStatement => SimpleStatement) {
  override def apply(st: SimpleStatement): SimpleStatement = {

    val policy = session.getCluster.getConfiguration.getPolicies.getLoadBalancingPolicy

    if (policy.isInstanceOf[TokenAwarePolicy] && tokens.nonEmpty) {

      val routingKeys = tokens.map(_.apply(session))

      Manager.logger.debug(s"Routing key tokens found. Settings routing key to ${routingKeys.map(_.cql).mkString("(", ",", ")")}")

      st
        .setRoutingKey(routingKeys.map(_.bytes):_*)
        .setKeyspace(session.getLoggedKeyspace)
    } else {
      st
    }
  }
}

class ConsistencyLevelModifier(level: Option[ConsistencyLevel]) extends Modifier {
  override def apply(v1: Statement): Statement = {
    (level map v1.setConsistencyLevel).getOrElse(v1)
  }
}

class SerialConsistencyLevelModifier(level: Option[ConsistencyLevel]) extends Modifier {
  override def apply(v1: Statement): Statement = {
    (level map v1.setSerialConsistencyLevel).getOrElse(v1)
  }
}

class PayloadModifier(payload: Payload) extends Modifier {
  override def apply(v1: Statement): Statement = {
    if (payload.isEmpty) {
      v1
    } else {
      v1.setOutgoingPayload(payload.underlying)
    }
  }
}

class PagingStateModifier(level: Option[PagingState]) extends Modifier {
  override def apply(v1: Statement): Statement = {
    (level map v1.setPagingState).getOrElse(v1)
  }
}

class EnableTracingModifier(level: Option[Boolean]) extends Modifier {
  override def apply(v1: Statement): Statement = {
    level match {
      case Some(true) => v1.enableTracing()
      case Some(false) => v1.disableTracing()
      case None => v1
    }
  }
}

class FetchSizeModifier(level: Option[Int]) extends Modifier {
  override def apply(v1: Statement): Statement = {
    (level map v1.setFetchSize).getOrElse(v1)
  }
}

case class QueryOptions(
  consistencyLevel: Option[ConsistencyLevel],
  serialConsistencyLevel: Option[ConsistencyLevel],
  pagingState: Option[PagingState] = None,
  enableTracing: Option[Boolean] = None,
  fetchSize: Option[Int] = None,
  outgoingPayload: Payload = Payload.empty
) {

  def apply(st: Statement): Statement = {
    val applier = List[Statement => Statement](
      new ConsistencyLevelModifier(consistencyLevel),
      new SerialConsistencyLevelModifier(serialConsistencyLevel),
      new PagingStateModifier(pagingState),
      new EnableTracingModifier(enableTracing),
      new FetchSizeModifier(fetchSize),
      new PayloadModifier(outgoingPayload)
    ) reduce(_ andThen _)

    applier(st)
  }

  def options: com.datastax.driver.core.QueryOptions = {
    val opt = new com.datastax.driver.core.QueryOptions()

    consistencyLevel map opt.setConsistencyLevel
    serialConsistencyLevel map opt.setSerialConsistencyLevel
    fetchSize map opt.setFetchSize

    opt
  }

  def outgoingPayload_=(payload: Payload): QueryOptions = {
    this.copy(outgoingPayload = payload)
  }

  def consistencyLevel_=(level: ConsistencyLevel): QueryOptions = {
    this.copy(consistencyLevel = Some(level))
  }

  def serialConsistencyLevel_=(level: ConsistencyLevel): QueryOptions = {
    this.copy(serialConsistencyLevel = Some(level))
  }

  def enableTracing_=(flag: Boolean): QueryOptions = {
    this.copy(enableTracing = Some(flag))
  }

  def fetchSize_=(size: Int): QueryOptions = {
    this.copy(fetchSize = Some(size))
  }
}

object QueryOptions {
  def empty: QueryOptions = {
    new QueryOptions(
      consistencyLevel = None,
      serialConsistencyLevel = None,
      pagingState = None,
      enableTracing = None,
      fetchSize = None
    )
  }
}


text:
<TITLE>Review for Thirteen Days (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Thirteen Days (2000)

reviewed by
Steve Rhodes

THIRTEEN DAYS
A film review by Steve Rhodes
Copyright 2001 Steve Rhodes
RATING (0 TO ****):  ***

During the Cuban missile crisis, John F. Kennedy faced a real-life
Armageddon as the world came as close as it ever has to global nuclear
war.  THIRTEEN DAYS, starring and produced by Kevin Costner, depicts
this famous period.  As a history lesson, it is absolutely engrossing,
but, as a movie, it falls short of what it should have been able to
achieve.  Although the film is well worth seeing and clearly gets a hit,
with this material it should have gotten a home run.

Directed by Roger Donaldson, whose dubious credentials include his most
recent films, DANTE'S PEAK and SPECIES, and scripted by David Self,
whose only credit is the laughably bad THE HAUNTING, THIRTEEN DAYS is
perhaps as good as could be expected.

With a gratingly exaggerated accent, Costner, playing Kennedy's special
assistant and personal friend, Kenny O'Donnell, manages to upstage his
boss in most of their scenes.   Bruce Greenwood plays John Kennedy as a
brooding, withdrawn type whose real genius was to pick the best advice
from conflicting advisors.  Greenwood's bland performance is emblematic
of what is wrong with the movie, namely that it gets itself bogged down
in long, slowly paced interior scenes in which the strategy is planned.
But when the movie cuts back and forth between the politics on the
ground and the excitement of the ships at sea and the planes in the air,
the film really comes alive.

The story happens in October of 1962.  In the midst of the mid-term
election in the United States, a U2 spy plane, high over Cuba, takes a
picture of Russian missiles, not yet armed, being put into place.
Pointed at the United States, these missiles could reach almost as far
as Seattle and could kill most American citizens within minutes.  This
would give the Russians a first-strike capability and forever upset the
world's balance of power.

We had to force the Russians to back down, but how?  Gen. Maxwell Taylor
(Bill Smitrovich), Gen. Curtis LeMay (Kevin Conway) and the rest of the
military brass counsel the president to strike before the missiles are
operational and be prepared to wage nuclear war when, and if, the
Russians retaliate.  LeMay, for one, figures that the Russians will not
strike back because they will be afraid of starting a nuclear holocaust.

Kenny O'Donnell and Robert Kennedy (Steven Culp), on the other hand,
believe that a more peaceful solution must exist.  With much difficulty,
Robert Kennedy forces the Pentagon to reveal the blockade strategy which
they had been holding back.  This is the approach that the president,
after much agonizing, finally adopts.  It is only partially successful.
As we now know, the blockade, combined with some skillful negotiation
and some fortuitous incidents, eventually caused the Russians to
dismantle their missiles.

Trevor Jones's music for the picture is the old-fashioned melodramatic
type.  The big black limos used by the government officials are mainly
1959 Cadillacs, probably because they featured the biggest and most
ridiculous tailfins ever.  But the acting is generally too reserved.
When the director allows emotions to come to the surface, the movie has
the impact that it should.  After all, these guys were debating nuclear
war, not some military procurement bill.  After his Bay of Pigs fiasco,
one can reasonably expect President Kennedy to have gotten quite
emotionally involved in his Cuban missile crisis.

THIRTEEN DAYS is definitely a movie with an explicit message.  The
military boys with their toys cannot be trusted.  The politicians, on
both sides, are the self-proclaimed "good men," who are ready and
willing to save us from the military's proclivity to go to war.  Besides
the fantastic history lesson, the movie leaves us to ponder the veracity
of its anti-military message and to wonder how much revisionist history
is taking place.

THIRTEEN DAYS runs a long 2:25.  It is rated PG-13 for brief strong
language and would be acceptable for any kid old enough to be interested
in this period in history.

Email: Steve.Rhodes@InternetReviews.com
Web: http://www.InternetReviews.com

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
brackets-display-shortcuts
==========================

Brackets Extension to Display Shortcuts in bottom panel

## Overview

This is an Extension for [Brackets](https://github.com/adobe/brackets).

## Features

This extension is accessed in Brackets using menu `Help > Show Shortcuts` or with the keyboard shortcut `Ctrl-Alt-/` on Windows and `Control-Alt-/` on Mac.

This extension displays all shortcuts defined for:
* Brackets
* CodeMirror (which not overridden by Brackets)
* Extensions which are currently installed

All columns are sortable in both ascending and descending order.

Display of "Extension" in Origin column is dependent on command using proper naming convention.

Button to "Copy to Current Document" inserts Table HTML markup at the current selection. It only works for full editor.

Type the name of the command you're looking for in the filter field to find the shortcut faster.

## License

MIT-licensed -- see _main.js_ for details.