text:
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using NuPattern.Modeling;

namespace NuPattern.Runtime.Schema.UnitTests
{
    [TestClass]
    public class ExtensionPointSchemaSpec
    {
        internal static readonly IAssertion Assert = new Assertion();

        [TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenAnAuthoredView
        {
            private ViewSchema view;
            private ExtensionPointSchema extensionPoint;

            [TestInitialize]
            public void InitializeContext()
            {
                var store = new DslTestStore<PatternModelDomainModel>();
                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                        p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                this.view = patternSchema.Create<ViewSchema>();
                this.view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                    {
                        this.extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");
                        this.view.ExtensionPoints.Add(this.extensionPoint);
                    });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.view.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.ExtensionPoint1",
                    this.extensionPoint.RequiredExtensionPointId);
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenSchemaPathIsValid()
            {
                var expected = string.Concat(this.view.SchemaPath, NamedElementSchema.SchemaPathDelimiter, this.extensionPoint.Name);
                Assert.Equal(expected, this.extensionPoint.SchemaPath);
            }

            [TestMethod, TestCategory("Unit")]
            public void WhenChangingName_ThenExtensionPointIdReturnsNewValue()
            {
                this.extensionPoint.WithTransaction(extension => extension.Name = "ExtensionPoint2");

                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.ExtensionPoint2",
                    this.extensionPoint.RequiredExtensionPointId);
            }
        }

        [TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenATailoredView
        {
            private ViewSchema view;
            private ExtensionPointSchema authoredExtensionPoint;
            private ExtensionPointSchema tailoredExtensionPoint;

            [TestInitialize]
            public void InitializeContext()
            {
                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema authoredPatternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    authoredPatternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                        p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var patternSchema = authoredPatternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                this.view = patternSchema.Create<ViewSchema>();
                this.view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    this.authoredExtensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");
                    this.view.ExtensionPoints.Add(this.authoredExtensionPoint);

                });

                // Customize Toolkit
                var tailoredUriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                        p.ToolkitInfo.Identifier == "TailoredToolkit"));

                var tailoredPatternModel = PatternModelSpec.TailorPatternModel(authoredPatternModel, new Version("1.0.0.0"), "AuthoredToolkit");

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    tailoredPatternModel.Pattern.UriService = tailoredUriService;
                    tailoredPatternModel.BaseId = "AuthoredToolkit";
                });

                this.tailoredExtensionPoint = tailoredPatternModel.Pattern.Views[0].ExtensionPoints[0];
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsBaseExtensionPointIdValue()
            {
                Assert.NotNull(this.tailoredExtensionPoint);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.ExtensionPoint1",
                    this.tailoredExtensionPoint.RequiredExtensionPointId);
            }

            [TestMethod, TestCategory("Unit")]
            public void WhenAddingANewProperty_ThenRequiredExtensionPointIdReturnsTailoredExtensionPointIdValue()
            {
                this.tailoredExtensionPoint.WithTransaction(extension => extension.CreatePropertySchema());

                Assert.NotNull(this.tailoredExtensionPoint);
                Assert.Equal(
                    "TailoredToolkit.FooPattern.View1.ExtensionPoint1",
                    this.tailoredExtensionPoint.RequiredExtensionPointId);
            }

            [TestMethod, TestCategory("Unit")]
            public void WhenRemovingAProperty_ThenRequiredExtensionPointIdReturnsBaseExtensionPointIdValue()
            {
                this.tailoredExtensionPoint.WithTransaction(extension => extension.CreatePropertySchema());

                Assert.NotNull(this.tailoredExtensionPoint);
                Assert.Equal(
                    "TailoredToolkit.FooPattern.View1.ExtensionPoint1",
                    this.tailoredExtensionPoint.RequiredExtensionPointId);

                this.tailoredExtensionPoint.WithTransaction(extension => extension.Properties.RemoveAt(0));

                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.ExtensionPoint1",
                    this.tailoredExtensionPoint.RequiredExtensionPointId);
            }

            [TestMethod, TestCategory("Unit")]
            public void WhenChangingName_ThenExtensionPointIdReturnsAuthoredValue()
            {
                this.tailoredExtensionPoint.WithTransaction(extension => extension.Name = "ExtensionPoint2");

                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.ExtensionPoint2",
                    this.tailoredExtensionPoint.RequiredExtensionPointId);
            }
        }

        [TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenAnElement
        {
            private ElementSchema element;
            private ExtensionPointSchema extensionPoint;

            [TestInitialize]
            public void InitializeContext()
            {
                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                    p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                var view = patternSchema.Create<ViewSchema>();
                view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                    {
                        this.element = store.ElementFactory.CreateElement<ElementSchema>("Element1");
                        this.extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");
                        this.element.ExtensionPoints.Add(this.extensionPoint);
                        view.Elements.Add(element);
                    });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.element.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Element1.ExtensionPoint1",
                    this.element.ExtensionPoints[0].RequiredExtensionPointId);
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenSchemaPathIsValid()
            {
                var expected = string.Concat(this.element.SchemaPath, NamedElementSchema.SchemaPathDelimiter, this.extensionPoint.Name);
                Assert.Equal(expected, this.extensionPoint.SchemaPath);
            }

            [TestMethod, TestCategory("Unit")]
            public void WhenChangingName_TheExtensionPointIdReturnsNewValue()
            {
                this.extensionPoint.WithTransaction(extension => extension.Name = "ExtensionPoint2");

                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Element1.ExtensionPoint2",
                    this.extensionPoint.RequiredExtensionPointId);
            }
        }

        [TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenAnElementWithinAnElement
        {
            private ElementSchema element;
            private ExtensionPointSchema extensionPoint;

            [TestInitialize]
            public void InitializeContext()
            {
                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                    p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                var view = patternSchema.Create<ViewSchema>();
                view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    var parentElement = store.ElementFactory.CreateElement<ElementSchema>("Element1");
                    this.element = store.ElementFactory.CreateElement<ElementSchema>("Element1");
                    this.extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");
                    this.element.ExtensionPoints.Add(this.extensionPoint);
                    parentElement.Elements.Add(element);
                    view.Elements.Add(parentElement);
                });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.element.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Element1.Element1.ExtensionPoint1",
                    this.extensionPoint.RequiredExtensionPointId);
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenSchemaPathIsValid()
            {
                var expected = string.Concat(this.element.SchemaPath, NamedElementSchema.SchemaPathDelimiter, this.extensionPoint.Name);
                Assert.Equal(expected, this.extensionPoint.SchemaPath);
            }
        }

        [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Test Code"), TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenACollection
        {
            private CollectionSchema collection;

            [TestInitialize]
            public void InitializeContext()
            {
                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                    p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                var view = patternSchema.Create<ViewSchema>();
                view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    this.collection = store.ElementFactory.CreateElement<CollectionSchema>("Collection1");

                    var extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");

                    this.collection.ExtensionPoints.Add(extensionPoint);
                    view.Elements.Add(collection);
                });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.collection.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Collection1.ExtensionPoint1",
                    this.collection.ExtensionPoints[0].RequiredExtensionPointId);
            }
        }

        [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Test Code"), TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenACollectionWithinACollection
        {
            private CollectionSchema collection;

            [TestInitialize]
            public void InitializeContext()
            {
                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                    p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                var view = patternSchema.Create<ViewSchema>();
                view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    var parentCollection = store.ElementFactory.CreateElement<CollectionSchema>("Collection1");
                    this.collection = store.ElementFactory.CreateElement<CollectionSchema>("Collection1");

                    var extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");

                    this.collection.ExtensionPoints.Add(extensionPoint);

                    parentCollection.Elements.Add(collection);
                    view.Elements.Add(parentCollection);
                });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.collection.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Collection1.Collection1.ExtensionPoint1",
                    this.collection.ExtensionPoints[0].RequiredExtensionPointId);
            }
        }

        [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Test Code"), TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenAnElementWithinACollection
        {
            private ElementSchema element;

            [TestInitialize]
            public void InitializeContext()
            {
                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                    p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                var view = patternSchema.Create<ViewSchema>();
                view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    var parentCollection = store.ElementFactory.CreateElement<CollectionSchema>("Collection1");
                    this.element = store.ElementFactory.CreateElement<ElementSchema>("Element1");

                    var extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");

                    this.element.ExtensionPoints.Add(extensionPoint);

                    parentCollection.Elements.Add(element);
                    view.Elements.Add(parentCollection);
                });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.element.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Collection1.Element1.ExtensionPoint1",
                    this.element.ExtensionPoints[0].RequiredExtensionPointId);
            }
        }

        [TestClass]
        [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Test code")]
        public class GivenAnCollectionWithinAnElement
        {
            private CollectionSchema collection;

            [TestInitialize]
            public void InitializeContext()
            {
                var uriService = Mock.Of<IUriReferenceService>(
                    u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p =>
                    p.ToolkitInfo.Identifier == "AuthoredToolkit"));

                var store = new DslTestStore<PatternModelDomainModel>();

                var serviceProvider = Mock.Get(store.ServiceProvider);
                serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns(
                    Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>()));

                PatternModelSchema patternModel = null;

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    patternModel = store.ElementFactory.CreateElement<PatternModelSchema>();
                });

                var patternSchema = patternModel.Create<PatternSchema>();
                patternSchema.Name = "FooPattern";
                patternSchema.PatternLink = "patternmanager://foo";
                patternSchema.UriService = uriService;

                var view = patternSchema.Create<ViewSchema>();
                view.Name = "View1";

                store.TransactionManager.DoWithinTransaction(() =>
                {
                    var parentElement = store.ElementFactory.CreateElement<ElementSchema>("Element1");
                    this.collection = store.ElementFactory.CreateElement<CollectionSchema>("Collection1");

                    var extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1");

                    this.collection.ExtensionPoints.Add(extensionPoint);

                    parentElement.Elements.Add(collection);
                    view.Elements.Add(parentElement);
                });
            }

            [TestMethod, TestCategory("Unit")]
            public void ThenRequiredExtensionPointIdReturnsValue()
            {
                Assert.NotNull(this.collection.ExtensionPoints[0]);
                Assert.Equal(
                    "AuthoredToolkit.FooPattern.View1.Element1.Collection1.ExtensionPoint1",
                    this.collection.ExtensionPoints[0].RequiredExtensionPointId);
            }
        }
    }
}


text:
<readable><title>3204081508_0e7f408097</title><content>
A group of people are lounging at a beach .
A group of sunbathers gather near some kayaks at the beach .
People sun on the beach next to boats .
Several beachgoers are reclining near upside-down boats .
Several people play and relax on the beach .
</content></readable>

redpajama_set_name: RedPajamaGithub


text:
import { default as Message, MessageProvider } from '../index'

test('Message is exported', () => {
  expect(Message).toBeTruthy()
})

test('Provider is exported', () => {
  expect(MessageProvider).toBeTruthy()
})


text:
package com.datamountaineer.streamreactor.connect.jms.sink.converters

import com.datamountaineer.streamreactor.connect.jms.config.JMSSetting
import org.apache.kafka.connect.sink.SinkRecord

import javax.jms.{Message, Session}

trait JMSMessageConverter {
  def convert(record:SinkRecord, session:Session, setting: JMSSetting): (String, Message)
}


text:
package gwt.material.design.client.data;

import gwt.material.design.jquery.client.api.JQueryElement;

/**
 * Row expansion block.
 *
 * @author Ben Dol
 */
public class RowExpansion<T> {
    final T model;
    final JQueryElement row, overlay, content;

    public RowExpansion(T model, JQueryElement row) {
        this.model = model;
        this.row = row;
        this.overlay = row.find("section.overlay");
        this.content = row.find(".content");
    }

    public T getModel() {
        return model;
    }

    public JQueryElement getRow() {
        return row;
    }

    public JQueryElement getOverlay() {
        return overlay;
    }

    public JQueryElement getContent() {
        return content;
    }

    public void setHeight(String height) {
        row.find(".content").height(height);
    }
}


text:
<?php
namespace Demagog\WebBundle\Entity;

use Doctrine\ORM\Mapping AS ORM;

/**
 * @ORM\Entity
 */
class ArticleHasSegment
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="Article", inversedBy="hasSegments")
     */
    private $article;

    /**
     * @ORM\ManyToOne(targetEntity="Segment", inversedBy="hasArticles")
     */
    private $segment;

    /**
     * @ORM\Column(type="integer", name="`order`")
     */
    private $order;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set order
     *
     * @param integer $order
     * @return ArticleHasSegment
     */
    public function setOrder($order)
    {
        $this->order = $order;

        return $this;
    }

    /**
     * Get order
     *
     * @return integer
     */
    public function getOrder()
    {
        return $this->order;
    }

    /**
     * Set article
     *
     * @param \Demagog\WebBundle\Entity\Article $article
     * @return ArticleHasSegment
     */
    public function setArticle(\Demagog\WebBundle\Entity\Article $article = null)
    {
        $this->article = $article;

        return $this;
    }

    /**
     * Get article
     *
     * @return \Demagog\WebBundle\Entity\Article
     */
    public function getArticle()
    {
        return $this->article;
    }

    /**
     * Set segment
     *
     * @param \Demagog\WebBundle\Entity\Segment $segment
     * @return ArticleHasSegment
     */
    public function setSegment(\Demagog\WebBundle\Entity\Segment $segment = null)
    {
        $this->segment = $segment;

        return $this;
    }

    /**
     * Get segment
     *
     * @return \Demagog\WebBundle\Entity\Segment
     */
    public function getSegment()
    {
        return $this->segment;
    }
}


text:
      RideShare

Planning a big adventure? Perhaps you and your friends want to drive across the country but everyone's schedules are all over the place?

RideShare is a tool to help you organize such an adventure.

    Sign Up

      RideShare

Hi {{user.name}}!

Invitations

            A list of Events invited to

Events

{{event.name}}

Attributions

Car icon by Mani Amini from The Noun Project.

Photo
    of planes at LAX by /u/kolnidur

Built with MEAN.io


text:
/*
 * zlog.h
 *
 *  Created on: 2014年9月30日
 *      Author: Fifi Lyu
 *        Desc: 无任何非系统库依赖,功能简单的日志系统
 */

#ifndef INCLUDE_ZPSOE_ZLOG_H_
#define INCLUDE_ZPSOE_ZLOG_H_

#include "config_compiler.h"
#include <string>

using namespace std;

namespace zpsoe {

namespace zlog {

typedef enum {
  LOGOUTPUTSTREAM_FILE,
  LOGOUTPUTSTREAM_STDOUT,
  LOGOUTPUTSTREAM_STDERR
} LogOutputStream_t;

typedef enum {
  LOG_TRACE,
  LOG_DEBUG,
  LOG_INFO,
  LOG_WARN,
  LOG_ERROR,
  LOG_FATAL,
  LOG_OFF
} LogLevel_t;

typedef struct {
  LogLevel_t level;
  LogOutputStream_t output_to;
  size_t max_byte;
  string path;
} LogConfig_t;

extern ZPSOE_SHARED_LIB_API LogConfig_t G_LogConfig;

#define print_log(level, ...) \
  _print_log(level, __FILE__, __LINE__, __VA_ARGS__)

ZPSOE_SHARED_LIB_API void _print_log(LogLevel_t level, const char *file, int line, const char *fmt, ...);

} /* namespace zlog */

} /* namespace zpsoe */

#endif /* INCLUDE_ZPSOE_ZLOG_H_ */


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.wwarn.mapssurveyor</groupId>
        <artifactId>maps-surveyor-parent</artifactId>
        <version>1.4.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.wwarn.mapssurveyor</groupId>
    <artifactId>MapCore</artifactId>
    <packaging>jar</packaging>
    <name>MapCore</name>
    <version>1.4.1-SNAPSHOT</version>

    <inceptionYear>2013</inceptionYear>

    <organization>
        <name>WorldWide Antimalarial Resistance Network (WWARN)</name>
        <url>http://www.wwarn.org/about-us</url>
    </organization>

    <licenses>
        <license>
            <name>The BSD 3-Clause License</name>
            <url>http://opensource.org/licenses/BSD-3-Clause</url>
        </license>
    </licenses>

    <!--<repositories>-->
        <!--<!– Note this must be repeated here, despite being in parent pom –>-->
        <!--<repository>-->
            <!--<id>central</id>-->
            <!--<url>http://central.maven.org/maven2/</url>-->
        <!--</repository>-->

    <!--</repositories>-->

    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <!-- This is a bit of a hack:
   we need this to perform a gwt-compile
   but we do not want to include in war -->
            <!--<scope>provided</scope>-->
        </dependency>

        <!-- needed for gwt integration tests-->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwtVersion}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- http://google.github.io/gwtmockito/ -->
            <groupId>com.google.gwt.gwtmockito</groupId>
            <artifactId>gwtmockito</artifactId>
            <version>1.1.3</version>
            <scope>test</scope>
        </dependency>

        <!-- GWT Maps API V3 -->
        <dependency>
            <groupId>com.github.branflake2267</groupId>
            <artifactId>gwt-maps-api</artifactId>
            <version>3.10.0-alpha-6</version>
        </dependency>

        <dependency>
            <groupId>net.sf.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>2.0</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt.google-apis</groupId>
            <artifactId>gwt-visualization</artifactId>
            <version>1.1.2</version>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>org/wwarn/mapcore/**/*.xml</include>
                    <include>org/wwarn/mapcore/**/*.java</include>
                    <include>org/wwarn/mapcore/**/*.properties</include>
                </includes>
                <excludes>
                    <exclude>**/*Test.java</exclude>
                    <exclude>**/GwtTest*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>*.css</include>
                    <include>**/*.*</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <!-- GWT -->
            <!-- 'mvn gwt:run' - runs development mode -->
            <!-- 'mvn gwt:debug' - runs debug mode -->
            <!-- 'mvn gwt:compile' - compiles gwt -->
            <!-- 'mvn integration-test' - runs the gwt test suite (**/Gwt*Suite.java) -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.maven.plugin.version}</version>
                <configuration>
                    <!--
                     See http://code.google.com/support/bin/answer.py?hl=en&answer=71442
                    Does not seem to be necessary #superstitiousCode
                    -->
                    <!--<gwtVersion>${gwtVersion}</gwtVersion>-->
                    <extraJvmArgs>-Xmx1024m -Xss1024k</extraJvmArgs>
                    <module>org.wwarn.mapcore.Map</module>
                    <strict>true</strict>
                    <includes>**/Gwt*Suite.java</includes>
                    <mode>htmlunit</mode>
                </configuration>
                <executions>
                    <execution>
                        <id>gwt-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>gwt-tests</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>integration-test</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>${javaVersion}</source>
                    <target>${javaVersion}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.3.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <packaging>jar</packaging>
                            <artifactId>${project.artifactId}</artifactId>
                            <groupId>${project.groupId}</groupId>
                            <version>${project.version}</version>
                            <file>
                                ${project.build.directory}/${project.artifactId}-${project.version}.jar
                            </file>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
                <executions>
                    <execution>
                        <id>ExecuteTests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/GwtTest*.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Custom license headers for all files -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>Add License Headers</id>
                        <configuration>
                            <licenseName>bsd_3</licenseName>
                            <organizationName>University of Oxford</organizationName>
                            <copyrightOwners>University of Oxford</copyrightOwners>
                            <roots>
                                <root>src</root>
                                <root>target/generated-sources</root>
                                <root>target/processed-sources</root>
                                <!-- Included because HTML/CSS/KML files are here -->
                                <root>war</root>
                            </roots>

                            <excludes>
                                <!-- Don't touch these compiler generated files -->
                                <exclude>**/*.cache.html</exclude>
                                <exclude>**/*.nocache.html</exclude>
                                <exclude>**/*.properties</exclude>
                                <!-- other files that one should ignore-->
                                <exclude>**/*.json</exclude>
                            </excludes>
                        </configuration>

                        <!-- Bound to run at last phase before compile -->
                        <phase>process-resources</phase>
                        <goals>
                            <goal>update-file-header</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
package vkaretko;

import java.util.Calendar;

/**
 * Model User for creating Users.
 * @author Karetko Victor
 * @version 1.00
 * @since 24.12.2016
 */
public class User {
    /**
     * Name of user.
     */
    private final String name;
     /**
     * Amount of children.
     */
    private final int children;
    /**
     * Birthday of User.
     */
    private final Calendar birthday;

    /**
     * Constructor of User class.
     * @param name name of user.
     * @param children amount of children.
     * @param birthday birthday of user.
     */
    public User(String name, int children, Calendar birthday) {
        this.name = name;
        this.children = children;
        this.birthday = birthday;
    }
    /**
     * Getter for name.
     * @return name.
     */
    public String getName() {
        return name;
    }
    /**
     * Getter for childre.
     * @return children.
     */
    public int getChildren() {
        return children;
    }
    /**
     * Getter for birthday.
     * @return birthday.
     */
    public Calendar getBirthday() {
        return birthday;
    }
}


text:
package org.drools.camel.component;

import org.drools.grid.GridNode;
import org.drools.runtime.CommandExecutor;

public class ExecutionNodePipelineContextImpl {
    private GridNode    node;
    CommandExecutor     exec;
    private ClassLoader localClassLoadel;

    public ExecutionNodePipelineContextImpl(GridNode node,
                                            ClassLoader localClassLoader) {
        this.node = node;
        this.localClassLoadel = localClassLoader;
    }

    public CommandExecutor getCommandExecutor() {
        return this.exec;
    }

    public void setCommandExecutor(CommandExecutor exec) {
        this.exec = exec;
    }

    public void setExecutionNode(GridNode node) {
        this.node = node;
    }

    public GridNode getExecutionNode() {
        return this.node;
    }

    public ClassLoader getLocalClassLoadel() {
        return localClassLoadel;
    }

    public void setLocalClassLoadel(ClassLoader localClassLoadel) {
        this.localClassLoadel = localClassLoadel;
    }

}


text:
@interface ColorCell : NSActionCell {}

@end


text:
This example demonstrates how you can enable SSO with Optimize and Keycloak.

The most important part from the Optimize perspective of this example is the custom Optimize SSO Plugin in:
[./optimize/sso-keycloak-example-plugin/](./optimize/sso-keycloak-example-plugin/)
To find out more about the Optimize SSO Plugin mechanism, find the docs [here](https://docs.camunda.org/optimize/latest/technical-guide/plugins/single-sign-on/)

It includes a docker-compose with:
1. Camunda Optimize
2. ElasticSearch
3. Camunda BPM
2. Keycloak Authentication Server
3. Keycloak Proxy Server

The Keycloak Server has one user:

```
demo:notdemo
```

# How to run?

## Clone the Repo

## Download and Configure Optimize

1. Download [Camunda Optimize](https://camunda.org/enterprise-release/optimize/2.3.0/camunda-optimize-2.3.0-standalone.zip) to folder `./optimize/`
2. Rename to `camunda-optimize.zip`
3. Place Optimize license in OptimizeLicense.txt
4. Run `mvn package` in `./optimize/sso-keycloak-example-plugin`

## Run docker-compose

1. Build all images with `docker-compose build`
1. Login to private Camunda Docker EE Registry with `docker login registry.camunda.cloud` Use your EE LDAP credentials to log in.
1. Start all images `docker-compose up -d`

## Open Optimize

1. Open WebBrowser
2. Open `localhost:8095`
3. Login with: `demo:notdemo`

# Some more background

Keycloak is responsible for Authentication, so the users are stored in Keycloak and the Keycloak Proxy makes sure that only authenticated users can see Optimize.

In the Optimize Plugin we only read the authenticated user from the request header. If the user is in the request, we authenticate the user directly in Optimize.

# Show me some some code

```java
package com.camunda.optimize.plugin.sso;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.camunda.optimize.plugin.security.authentication.AuthenticationExtractor;
import org.camunda.optimize.plugin.security.authentication.AuthenticationResult;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class KeycloakAuthenticationProvider implements AuthenticationExtractor {

	private Logger logger = LoggerFactory.getLogger(getClass());

	public AuthenticationResult extractAuthenticatedUser(HttpServletRequest request) {
		AuthenticationResult result = new AuthenticationResult();
		String user = request.getHeader("KEYCLOAK_USERNAME");

		if (user == null || user.isEmpty()) {
			logger.info("Did not find user.");
			result.setAuthenticated(false);
			return result;
		} else {
			logger.info("User logged info", user);
			result.setAuthenticatedUser(user);
			result.setAuthenticated(true);
			return result;
		}
	}
}
```


text:
package com.dongbat.jbump;

import static com.dongbat.jbump.Extra.DELTA;
import static com.dongbat.jbump.Extra.sign;
import static com.dongbat.jbump.Rect.rect_containsPoint;
import static com.dongbat.jbump.Rect.rect_getDiff;
import static com.dongbat.jbump.Rect.rect_getNearestCorner;
import static com.dongbat.jbump.Rect.rect_getSegmentIntersectionIndices;
import static java.lang.Math.abs;
import static java.lang.Math.min;

/**
 *
 * @author tao
 */
public class RectHelper {

  private final Rect rect_detectCollision_diff = new Rect();
  private final Point rect_detectCollision_nearestCorner = new Point();
  private final Point rect_detectCollision_getSegmentIntersectionIndices_ti = new Point();
  private final IntPoint rect_detectCollision_getSegmentIntersectionIndices_n1 = new IntPoint();
  private final IntPoint rect_detectCollision_getSegmentIntersectionIndices_n2 = new IntPoint();
  private final Collision rect_detectCollision_getSegmentIntersectionIndices_col = new Collision();

  public Collision rect_detectCollision(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2,
    float goalX, float goalY) {
    Collision col = rect_detectCollision_getSegmentIntersectionIndices_col;
    float dx = goalX - x1;
    float dy = goalY - y1;

    rect_getDiff(x1, y1, w1, h1, x2, y2, w2, h2, rect_detectCollision_diff);
    float x = rect_detectCollision_diff.x;
    float y = rect_detectCollision_diff.y;
    float w = rect_detectCollision_diff.w;
    float h = rect_detectCollision_diff.h;

    boolean overlaps = false;
    Float ti = null;
    int nx = 0, ny = 0;

    if (rect_containsPoint(x, y, w, h, 0, 0)) {
      //item was intersecting other
      rect_getNearestCorner(x, y, w, h, 0, 0, rect_detectCollision_nearestCorner);
      float px = rect_detectCollision_nearestCorner.x;
      float py = rect_detectCollision_nearestCorner.y;

      //area of intersection
      float wi = min(w1, abs(px));
      float hi = min(h1, abs(py));
      ti = -wi * hi; //ti is the negative area of intersection
      overlaps = true;
    } else {
      boolean intersect = rect_getSegmentIntersectionIndices(x, y, w, h, 0, 0, dx, dy, -Float.MAX_VALUE, Float.MAX_VALUE, rect_detectCollision_getSegmentIntersectionIndices_ti, rect_detectCollision_getSegmentIntersectionIndices_n1, rect_detectCollision_getSegmentIntersectionIndices_n2);
      float ti1 = rect_detectCollision_getSegmentIntersectionIndices_ti.x;
      float ti2 = rect_detectCollision_getSegmentIntersectionIndices_ti.y;
      int nx1 = rect_detectCollision_getSegmentIntersectionIndices_n1.x;
      int ny1 = rect_detectCollision_getSegmentIntersectionIndices_n1.y;

      //item tunnels into other
      if (intersect && ti1 < 1 && abs(ti1 - ti2) >= DELTA //special case for rect going through another rect's corner
        && (0 < ti1 + DELTA || 0 == ti1 && ti2 > 0)) {
        ti = ti1;
        nx = nx1;
        ny = ny1;
        overlaps = false;
      }
    }
    if (ti == null) {
      return null;
    }
    float tx, ty;

    if (overlaps) {
      if (dx == 0 && dy == 0) {
        //intersecting and not moving - use minimum displacement vector
        rect_getNearestCorner(x, y, w, h, 0, 0, rect_detectCollision_nearestCorner);
        float px = rect_detectCollision_nearestCorner.x;
        float py = rect_detectCollision_nearestCorner.y;
        if (abs(px) < abs(py)) {
          py = 0;
        } else {
          px = 0;
        }
        nx = sign(px);
        ny = sign(py);
        tx = x1 + px;
        ty = y1 + py;
      } else {
        //intersecting and moving - move in the opposite direction
        boolean intersect = rect_getSegmentIntersectionIndices(x, y, w, h, 0, 0, dx, dy, -Float.MAX_VALUE, 1, rect_detectCollision_getSegmentIntersectionIndices_ti, rect_detectCollision_getSegmentIntersectionIndices_n1, rect_detectCollision_getSegmentIntersectionIndices_n2);
        float ti1 = rect_detectCollision_getSegmentIntersectionIndices_ti.x;
        nx = rect_detectCollision_getSegmentIntersectionIndices_n1.x;
        ny = rect_detectCollision_getSegmentIntersectionIndices_n1.y;
        if (!intersect) {
          return null;
        }
        tx = x1 + dx * ti1;
        ty = y1 + dy * ti1;
      }
    } else {
      //tunnel
      tx = x1 + dx * ti;
      ty = y1 + dy * ti;
    }
    col.set(overlaps, ti, dx, dy, nx, ny, tx, ty, x1, y1, w1, h1, x2, y2, w2, h2);
    return col;
  }

}


text:
using System.Collections.Immutable;
using Orleans.Runtime;

namespace Orleans.Metadata
{
    /// <summary>
    /// Responsible for resolving <see cref="GrainProperties"/> for <see cref="GrainType"/> values.
    /// </summary>
    public class GrainPropertiesResolver
    {
        private readonly IClusterManifestProvider _clusterManifestProvider;

        /// <summary>
        /// Creates a <see cref="GrainPropertiesResolver"/> instance.
        /// </summary>
        public GrainPropertiesResolver(IClusterManifestProvider clusterManifestProvider)
        {
            _clusterManifestProvider = clusterManifestProvider;
        }

        /// <summary>
        /// Gets the grain properties for the provided type.
        /// </summary>
        public GrainProperties GetGrainProperties(GrainType grainType)
        {
            if (!TryGetGrainProperties(grainType, out var result))
            {
                //ThrowNotFoundException(grainType);
                result = new GrainProperties(ImmutableDictionary<string, string>.Empty);
            }

            return result;
        }

        /// <summary>
        /// Gets the grain properties for the provided type.
        /// </summary>
        public bool TryGetGrainProperties(GrainType grainType, out GrainProperties properties)
        {
            var clusterManifest = _clusterManifestProvider.Current;
            if (clusterManifest is null)
            {
                properties = default;
                return false;
            }

            GrainType lookupKey;
            if (GenericGrainType.TryParse(grainType, out var generic))
            {
                lookupKey = generic.GetUnconstructedGrainType().GrainType;
            }
            else
            {
                lookupKey = grainType;
            }

            foreach (var manifest in clusterManifest.AllGrainManifests)
            {
                if (manifest.Grains.TryGetValue(lookupKey, out properties))
                {
                    return true;
                }
            }

            properties = default;
            return false;
        }
    }
}


text:
package de.cosmocode.palava.maven.ipcstub;

import de.cosmocode.palava.ipc.IpcCommand;

/**
 * A wrapper around an {@link IpcCommand} class.
 *
 * @author Tobias Sarnowski
 */
public class GenCommand {

    private final Class<? extends IpcCommand> command;

    protected GenCommand(Class<? extends IpcCommand> command) {
        this.command = command;
    }

    public String getName() {
        return command.getSimpleName();
    }

    public String getFullName() {
        return command.getName();
    }

    public InspectedCommand getMeta() {
        return InspectedCommand.inspectCommand(command);
    }

}


text:
<?php

use Flarum\Forum\Controller;
use Flarum\Http\RouteCollection;
use Flarum\Http\RouteHandlerFactory;

return function (RouteCollection $map, RouteHandlerFactory $route) {
    $map->get(
        '/all',
        'index',
        $route->toController(Controller\IndexController::class)
    );

    $map->get(
        '/d/{id:\d+(?:-[^/]*)?}[/{near:[^/]*}]',
        'discussion',
        $route->toController(Controller\DiscussionController::class)
    );

    $map->get(
        '/u/{username}[/{filter:[^/]*}]',
        'user',
        $route->toController(Controller\FrontendController::class)
    );

    $map->get(
        '/settings',
        'settings',
        $route->toController(Controller\AuthorizedWebAppController::class)
    );

    $map->get(
        '/notifications',
        'notifications',
        $route->toController(Controller\AuthorizedWebAppController::class)
    );

    $map->get(
        '/logout',
        'logout',
        $route->toController(Controller\LogOutController::class)
    );

    $map->post(
        '/login',
        'login',
        $route->toController(Controller\LogInController::class)
    );

    $map->post(
        '/register',
        'register',
        $route->toController(Controller\RegisterController::class)
    );

    $map->get(
        '/confirm/{token}',
        'confirmEmail',
        $route->toController(Controller\ConfirmEmailController::class)
    );

    $map->get(
        '/reset/{token}',
        'resetPassword',
        $route->toController(Controller\ResetPasswordController::class)
    );

    $map->post(
        '/reset',
        'savePassword',
        $route->toController(Controller\SavePasswordController::class)
    );
};


text:
namespace ash {

// This class implements org.chromium.DisplayService for chrome.
class DisplayServiceProvider
    : public chromeos::CrosDBusService::ServiceProviderInterface {
 public:
  // The caller must ensure that |delegate| outlives this object.
  DisplayServiceProvider();

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

  ~DisplayServiceProvider() override;

  // CrosDBusService::ServiceProviderInterface overrides:
  void Start(scoped_refptr<dbus::ExportedObject> exported_object) override;

 private:
  class Impl;

  // Forwards DBus calls to DisplayConfigurator::SetDisplayPower.
  void SetDisplayPower(dbus::MethodCall* method_call,
                       dbus::ExportedObject::ResponseSender response_sender);

  // Forwards DBus calls to ScreenDimmer::SetDimming.
  void SetDisplaySoftwareDimming(
      dbus::MethodCall* method_call,
      dbus::ExportedObject::ResponseSender response_sender);

  // Called when a external process no longer needs control of the display and
  // Chrome can take ownership. Forwarded to mojom::AshDisplayController.
  void TakeDisplayOwnership(
      dbus::MethodCall* method_call,
      dbus::ExportedObject::ResponseSender response_sender);

  // Called when a external process needs control of the display and needs
  // Chrome to release ownership. Forwarded to mojom::AshDisplayController.
  void ReleaseDisplayOwnership(
      dbus::MethodCall* method_call,
      dbus::ExportedObject::ResponseSender response_sender);

  void OnExported(const std::string& interface_name,
                  const std::string& method_name,
                  bool success);

  std::unique_ptr<Impl> impl_;
  base::WeakPtrFactory<DisplayServiceProvider> weak_ptr_factory_{this};
};

}  // namespace ash

#endif  // ASH_DBUS_DISPLAY_SERVICE_PROVIDER_H_


text:
#ifndef SKY_ENGINE_PLATFORM_GEOMETRY_TRANSFORMSTATE_H_
#define SKY_ENGINE_PLATFORM_GEOMETRY_TRANSFORMSTATE_H_

#include "flutter/sky/engine/platform/geometry/FloatPoint.h"
#include "flutter/sky/engine/platform/geometry/FloatQuad.h"
#include "flutter/sky/engine/platform/geometry/IntSize.h"
#include "flutter/sky/engine/platform/geometry/LayoutSize.h"
#include "flutter/sky/engine/platform/transforms/AffineTransform.h"
#include "flutter/sky/engine/platform/transforms/TransformationMatrix.h"
#include "flutter/sky/engine/wtf/OwnPtr.h"

namespace blink {

class PLATFORM_EXPORT TransformState {
public:
    enum TransformDirection { ApplyTransformDirection, UnapplyInverseTransformDirection };
    enum TransformAccumulation { FlattenTransform, AccumulateTransform };

    TransformState(TransformDirection mappingDirection, const FloatPoint& p, const FloatQuad& quad)
        : m_lastPlanarPoint(p)
        , m_lastPlanarQuad(quad)
        , m_accumulatingTransform(false)
        , m_mapPoint(true)
        , m_mapQuad(true)
        , m_direction(mappingDirection)
    {
    }

    TransformState(TransformDirection mappingDirection, const FloatPoint& p)
        : m_lastPlanarPoint(p)
        , m_accumulatingTransform(false)
        , m_mapPoint(true)
        , m_mapQuad(false)
        , m_direction(mappingDirection)
    {
    }

    TransformState(TransformDirection mappingDirection, const FloatQuad& quad)
        : m_lastPlanarQuad(quad)
        , m_accumulatingTransform(false)
        , m_mapPoint(false)
        , m_mapQuad(true)
        , m_direction(mappingDirection)
    {
    }

    TransformState(const TransformState& other) { *this = other; }

    TransformState& operator=(const TransformState&);

    void setQuad(const FloatQuad& quad)
    {
        // FIXME: this assumes that the quad being added is in the coordinate system of the current state.
        // This breaks if we're simultaneously mapping a point. https://bugs.webkit.org/show_bug.cgi?id=106680
        ASSERT(!m_mapPoint);
        m_accumulatedOffset = LayoutSize();
        m_lastPlanarQuad = quad;
    }

    void move(LayoutUnit x, LayoutUnit y, TransformAccumulation accumulate = FlattenTransform)
    {
        move(LayoutSize(x, y), accumulate);
    }

    void move(const LayoutSize&, TransformAccumulation = FlattenTransform);
    void applyTransform(const AffineTransform& transformFromContainer, TransformAccumulation = FlattenTransform, bool* wasClamped = 0);
    void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation = FlattenTransform, bool* wasClamped = 0);
    void flatten(bool* wasClamped = 0);

    // Return the coords of the point or quad in the last flattened layer
    FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; }
    FloatQuad lastPlanarQuad() const { return m_lastPlanarQuad; }

    // Return the point or quad mapped through the current transform
    FloatPoint mappedPoint(bool* wasClamped = 0) const;
    FloatQuad mappedQuad(bool* wasClamped = 0) const;

private:
    void translateTransform(const LayoutSize&);
    void translateMappedCoordinates(const LayoutSize&);
    void flattenWithTransform(const TransformationMatrix&, bool* wasClamped);
    void applyAccumulatedOffset();

    FloatPoint m_lastPlanarPoint;
    FloatQuad m_lastPlanarQuad;

    // We only allocate the transform if we need to
    OwnPtr<TransformationMatrix> m_accumulatedTransform;
    LayoutSize m_accumulatedOffset;
    bool m_accumulatingTransform;
    bool m_mapPoint, m_mapQuad;
    TransformDirection m_direction;
};

} // namespace blink

#endif  // SKY_ENGINE_PLATFORM_GEOMETRY_TRANSFORMSTATE_H_


text:
package org.terasology.module.filesystem;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import org.terasology.module.ModuleEnvironment;
import org.terasology.util.Varargs;

import java.io.IOException;
import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.WatchService;
import java.nio.file.attribute.UserPrincipalLookupService;
import java.nio.file.spi.FileSystemProvider;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
 * A file system providing access to the contents of a Module environment.
 * <p>
 * A ModuleFileSystem has a root for each module ('/moduleName'), and separates each directory and file with '/'.
 * Modification and write operations are not supported. WatchService is supported though, for detecting external changes - this is only
 * supported to changes happening on the default filesystem (so directories, not in archives).
 *
 * @author Immortius
 */
class ModuleFileSystem extends FileSystem {

    private static final Set<String> SUPPORTED_FILE_ATTRIBUTE_VIEWS = ImmutableSet.of("basic");

    private final ModuleFileSystemProvider provider;
    private final ModuleEnvironment environment;
    private Map<Path, FileSystem> openedFileSystems = Maps.newConcurrentMap();
    private boolean open = true;

    ModuleFileSystem(ModuleFileSystemProvider provider, ModuleEnvironment environment) {
        this.provider = provider;
        this.environment = environment;
    }

    public ModuleEnvironment getEnvironment() {
        return environment;
    }

    @Override
    public FileSystemProvider provider() {
        return provider;
    }

    @Override
    public void close() throws IOException {
        open = false;
        provider.removeFileSystem(this);
        for (FileSystem openedFileSystem : openedFileSystems.values()) {
            openedFileSystem.close();
        }
    }

    @Override
    public boolean isOpen() {
        return open;
    }

    @Override
    public boolean isReadOnly() {
        return true;
    }

    @Override
    public String getSeparator() {
        return ModuleFileSystemProvider.SEPARATOR;
    }

    @Override
    public Iterable<Path> getRootDirectories() {
        return environment.getModulesOrderedByDependencies().stream()
                .<Path>map(module -> getPath("/", module.getId().toString())).collect(Collectors.toList());
    }

    @Override
    public Iterable<FileStore> getFileStores() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Set<String> supportedFileAttributeViews() {
        return SUPPORTED_FILE_ATTRIBUTE_VIEWS;
    }

    @Override
    public ModulePath getPath(String first, String... more) {
        List<String> parts = Varargs.combineToList(first, more);
        StringBuilder builder = new StringBuilder();

        for (String part : parts) {
            String trimmedPart = part.trim();
            if (!trimmedPart.isEmpty()) {
                if (trimmedPart.charAt(0) == ModuleFileSystemProvider.SEPARATOR.charAt(0)) {
                    builder.append(ModuleFileSystemProvider.SEPARATOR);
                }
                break;
            }
        }

        for (String part : parts) {
            for (String subPart : part.split(ModuleFileSystemProvider.SEPARATOR, 0)) {
                if (!subPart.isEmpty()) {
                    if (builder.length() > 0 && builder.charAt(builder.length() - 1) != ModuleFileSystemProvider.SEPARATOR.charAt(0)) {
                        builder.append(ModuleFileSystemProvider.SEPARATOR);
                    }
                    builder.append(subPart);
                }
            }
        }
        return new ModulePath(builder.toString(), this);
    }

    @Override
    public PathMatcher getPathMatcher(String syntaxAndPattern) {
        String[] parts = syntaxAndPattern.split(":", 2);
        if (parts.length == 2) {
            switch (parts[0]) {
                case "regex": {
                    final Pattern pattern = Pattern.compile(parts[1]);
                    return path -> pattern.matcher(path.toString()).matches();
                }
                case "glob": {
                    final Pattern pattern = Pattern.compile(GlobSupport.globToRegex(parts[1]));
                    return path -> pattern.matcher(path.toString()).matches();
                }
                default:
                    throw new UnsupportedOperationException("Syntax '" + parts[0] + "' not recognized");
            }
        } else {
            throw new IllegalArgumentException("Invalid format: '" + syntaxAndPattern + "'");
        }
    }

    @Override
    public UserPrincipalLookupService getUserPrincipalLookupService() {
        throw new UnsupportedOperationException();
    }

    @Override
    public WatchService newWatchService() throws IOException {
        return new ModuleWatchService(this);
    }

    FileSystem getRealFileSystem(Path moduleLocation) throws IOException {
        FileSystem containedFileSystem = openedFileSystems.get(moduleLocation);
        if (containedFileSystem == null) {
            containedFileSystem = FileSystems.newFileSystem(moduleLocation, null);
            openedFileSystems.put(moduleLocation, containedFileSystem);
        }
        return containedFileSystem;
    }
}


text:
package com.example.demo;

import java.util.Map;

public class LastOperationWrapper {
	private Map<String, Double> categories;
	private Goal goal;
	public Map<String, Double> getCategories() {
		return categories;
	}
	public void setCategories(Map<String, Double> categories) {
		this.categories = categories;
	}
	public Goal getGoal() {
		return goal;
	}
	public void setGoal(Goal goal) {
		this.goal = goal;
	}

}


text:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading.Tasks;
#if __UNIFIED__
using Foundation;
using UIKit;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif

namespace Microsoft.WindowsAzure.MobileServices
{
    /// <summary>
    /// Extension methods for UI-based login.
    /// </summary>
    public static partial class MobileServiceClientExtensions
    {
        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="viewController" type="MonoTouch.UIKit.UIViewController">
        /// UIViewController used to display modal login UI on iPhone/iPods.
        /// </param>
        /// <param name="provider" type="MobileServiceAuthenticationProvider">
        /// Authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIViewController viewController, MobileServiceAuthenticationProvider provider, string uriScheme)
        {
            return LoginAsync(client, viewController, provider, uriScheme, parameters: null);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="viewController" type="MonoTouch.UIKit.UIViewController">
        /// UIViewController used to display modal login UI on iPhone/iPods.
        /// </param>
        /// <param name="provider" type="MobileServiceAuthenticationProvider">
        /// Authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <param name="parameters">
        /// Provider specific extra parameters that are sent as query string parameters to login endpoint.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIViewController viewController, MobileServiceAuthenticationProvider provider, string uriScheme, IDictionary<string, string> parameters)
        {
            return LoginAsync(client, default(RectangleF), viewController, provider.ToString(), uriScheme, parameters);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="viewController" type="MonoTouch.UIKit.UIViewController">
        /// UIViewController used to display modal login UI on iPhone/iPods.
        /// </param>
        /// <param name="provider" type="string">
        /// The name of the authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIViewController viewController, string provider, string uriScheme)
        {
            return LoginAsync(client, viewController, provider, uriScheme, parameters: null);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="viewController" type="MonoTouch.UIKit.UIViewController">
        /// UIViewController used to display modal login UI on iPhone/iPods.
        /// </param>
        /// <param name="provider" type="string">
        /// The name of the authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <param name="parameters">
        /// Provider specific extra parameters that are sent as query string parameters to login endpoint.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIViewController viewController, string provider, string uriScheme, IDictionary<string, string> parameters)
        {
            return LoginAsync(client, default(RectangleF), viewController, provider, uriScheme, parameters);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="rectangle" type="System.Drawing.RectangleF">
        /// The area in <paramref name="view"/> to anchor to.
        /// </param>
        /// <param name="view" type="MonoTouch.UIKit.UIView">
        /// UIView used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="MobileServiceAuthenticationProvider">
        /// Authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, RectangleF rectangle, UIView view, MobileServiceAuthenticationProvider provider, string uriScheme)
        {
            return LoginAsync(client, rectangle, view, provider, uriScheme, parameters: null);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="rectangle" type="System.Drawing.RectangleF">
        /// The area in <paramref name="view"/> to anchor to.
        /// </param>
        /// <param name="view" type="MonoTouch.UIKit.UIView">
        /// UIView used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="MobileServiceAuthenticationProvider">
        /// Authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <param name="parameters">
        /// Provider specific extra parameters that are sent as query string parameters to login endpoint.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, RectangleF rectangle, UIView view, MobileServiceAuthenticationProvider provider, string uriScheme, IDictionary<string, string> parameters)
        {
            return LoginAsync(client, rectangle, (object)view, provider.ToString(), uriScheme, parameters);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="rectangle" type="System.Drawing.RectangleF">
        /// The area in <paramref name="view"/> to anchor to.
        /// </param>
        /// <param name="view" type="MonoTouch.UIKit.UIView">
        /// UIView used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="string">
        /// The name of the authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, RectangleF rectangle, UIView view, string provider, string uriScheme)
        {
            return LoginAsync(client, rectangle, view, provider, uriScheme, parameters: null);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="rectangle" type="System.Drawing.RectangleF">
        /// The area in <paramref name="view"/> to anchor to.
        /// </param>
        /// <param name="view" type="MonoTouch.UIKit.UIView">
        /// UIView used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="string">
        /// The name of the authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <param name="parameters">
        /// Provider specific extra parameters that are sent as query string parameters to login endpoint.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, RectangleF rectangle, UIView view, string provider, string uriScheme, IDictionary<string, string> parameters)
        {
            return LoginAsync(client, rectangle, (object)view, provider, uriScheme, parameters);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="barButtonItem" type="MonoTouch.UIKit.UIBarButtonItem">
        /// UIBarButtonItem used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="MobileServiceAuthenticationProvider">
        /// Authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIBarButtonItem barButtonItem, MobileServiceAuthenticationProvider provider, string uriScheme)
        {
            return LoginAsync(client, barButtonItem, provider, uriScheme, parameters: null);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="barButtonItem" type="MonoTouch.UIKit.UIBarButtonItem">
        /// UIBarButtonItem used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="MobileServiceAuthenticationProvider">
        /// Authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <param name="parameters">
        /// Provider specific extra parameters that are sent as query string parameters to login endpoint.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIBarButtonItem barButtonItem, MobileServiceAuthenticationProvider provider, string uriScheme, IDictionary<string, string> parameters)
        {
            return LoginAsync(client, default(RectangleF), barButtonItem, provider.ToString(), uriScheme, parameters);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="barButtonItem" type="MonoTouch.UIKit.UIBarButtonItem">
        /// UIBarButtonItem used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="string">
        /// The name of the authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIBarButtonItem barButtonItem, string provider, string uriScheme)
        {
            return LoginAsync(client, barButtonItem, provider, uriScheme, parameters: null);
        }

        /// <summary>
        /// Log a user into a Mobile Services application given a provider name.
        /// </summary>
        /// <param name="client" type="Microsoft.WindowsAzure.MobileServices.MobileServiceClient">
        /// The MobileServiceClient instance to login with
        /// </param>
        /// <param name="barButtonItem" type="MonoTouch.UIKit.UIBarButtonItem">
        /// UIBarButtonItem used to display a popover from on iPad.
        /// </param>
        /// <param name="provider" type="string">
        /// The name of the authentication provider to use.
        /// </param>
        /// <param name="uriScheme">
        /// The URL scheme of the application.
        /// </param>
        /// <param name="parameters">
        /// Provider specific extra parameters that are sent as query string parameters to login endpoint.
        /// </param>
        /// <returns>
        /// Task that will complete when the user has finished authentication.
        /// </returns>
        public static Task<MobileServiceUser> LoginAsync(this MobileServiceClient client, UIBarButtonItem barButtonItem, string provider, string uriScheme, IDictionary<string, string> parameters)
        {
            return LoginAsync(client, default(RectangleF), barButtonItem, provider, uriScheme, parameters);
        }

        internal static Task<MobileServiceUser> LoginAsync(MobileServiceClient client, RectangleF rect, object view, string provider, string uriScheme, IDictionary<string, string> parameters)
        {
            var auth = new MobileServiceUIAuthentication(rect, view, client, provider, uriScheme, parameters);
            return auth.LoginAsync();
        }

        /// <summary>
        /// Resume login process with the specified URL.
        /// </summary>
        public static bool ResumeWithURL(this MobileServiceClient client, NSUrl url)
        {
            // Convert iOS NSUrl to C#/netxf/BCL System.Uri - common API
            Uri uri_netfx = new Uri(url.AbsoluteString);

            MobileServiceUIAuthentication.CurrentAuthenticator?.OnPageLoading(uri_netfx);

            return true;
        }

        /// <summary>
        /// Extension method to get a <see cref="Push"/> object made from an existing <see cref="MobileServiceClient"/>.
        /// </summary>
        /// <param name="client">
        /// The <see cref="MobileServiceClient"/> to create with.
        /// </param>
        /// <returns>
        /// The <see cref="Push"/> object used for registering for notifications.
        /// </returns>
        public static Push GetPush(this IMobileServiceClient client)
        {
            return new Push(client);
        }
    }
}


text:
package main

import "fmt"

// Query holds Timescale SQL query, typically decoded from the program's
// input.
type Query struct {
	HumanLabel       []byte
	HumanDescription []byte
	QuerySQL         []byte
	ID               int64
}

// String produces a debug-ready description of a Query.
func (q *Query) String() string {
	return fmt.Sprintf("ID: %d, HumanLabel: %s, HumanDescription: %s, Query: %s", q.ID, q.HumanLabel, q.HumanDescription, q.QuerySQL)
}


text:
<?php

namespace perf\Vc\Routing;

use perf\Vc\Request;

/**
 * MVC router.
 *
 */
class Router implements RouterInterface
{

    /**
     * MVC routing rules.
     *
     * @var RoutingRule[]
     */
    private $rules = array();

    /**
     * Constructor.
     *
     * @param RoutingRule[] $rules
     * @return void
     * @throws \InvalidArgumentException
     */
    public function __construct(array $rules = array())
    {
        foreach ($rules as $rule) {
            $this->addRule($rule);
        }
    }

    /**
     * Adds a MVC routing rule.
     *
     * @param RoutingRule $rule MVC routing rule.
     * @return void
     */
    public function addRule(RoutingRule $rule)
    {
        $this->rules[] = $rule;
    }

    /**
     * Attempts to match provided request against routing rules.
     *
     * @param Request $request Request.
     * @return null|Route
     */
    public function tryGetRoute(Request $request)
    {
        foreach ($this->rules as $rule) {
            $route = $rule->tryMatch($request);

            if ($route) {
                return $route;
            }
        }

        return null;
    }
}


text:
// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.bard.webservice.data.dimension;

import com.yahoo.bard.webservice.util.EnumUtils;

import java.util.Iterator;
import java.util.LinkedHashMap;

/**
 * A dimension field used in bard test configuration.
 */
public enum BardDimensionField implements DimensionField {
    ID("Dimension ID"),
    DESC("Dimension Description"),
    FIELD1("Dimension field 1"),
    FIELD2("Dimension field 2");

    private String description;
    private String camelName;

    /**
     * Constructor.
     *
     * @param description  Human-consumable description of the field
     */
    BardDimensionField(String description) {
        this.description = description;
        camelName = EnumUtils.camelCase(name());
    }

    @Override
    public String getName() {
        return camelName;
    }

    @Override
    public String getDescription() {
        return this.description;
    }

    @Override
    public String toString() {
        return camelName;
    }

    /**
     * Make test DimensionRow using ID and DESC fields from provided Dimension.
     *
     * @param dimension  provided dimension
     * @param values  Values for dimension fields
     *
     * @return test DimensionRow
     */
    public static DimensionRow makeDimensionRow(Dimension dimension, String...values) {
        LinkedHashMap<DimensionField, String> map = new LinkedHashMap<>(values.length);
        Iterator<DimensionField> fields = dimension.getDimensionFields().iterator();
        for (String value : values) {
            DimensionField field = fields.next();
            map.put(field, value);
        }
        return new DimensionRow(dimension.getKey(), map);
    }
}


text:
FROM debian:wheezy

MAINTAINER Alexey Kovrizhkin <lekovr+docker@gmail.com>

ENV CONSUP_UBUNTU_CODENAME wheezy

ENV DOCKERFILE_VERSION  160320

# -------------------------------------------------------------------------------
# **** base ****
# -------------------------------------------------------------------------------

ENV DEBIAN_FRONTEND noninteractive
ENV INITRD No

# -------------------------------------------------------------------------------
# Run custom setup scripts

ADD setup_*.sh /tmp/

# Loop does not cache every step
#RUN for f in /tmp/setup_*.sh ; do >&2 echo ">>>> $f" ; . $f ; rm $f ; done

RUN bash /tmp/setup_0backports.sh
RUN bash /tmp/setup_1pkg.sh
RUN bash /tmp/setup_2pgdg.sh
RUN bash /tmp/setup_consul.sh
RUN bash /tmp/setup_consul-tmpl.sh
RUN bash /tmp/setup_dbinit.sh
RUN bash /tmp/setup_gosu.sh
RUN bash /tmp/setup_lang.sh
RUN bash /tmp/setup_nginx.sh
RUN bash /tmp/setup_perl.sh
RUN bash /tmp/setup_perllib_debian.sh
RUN bash /tmp/setup_pg_client.sh

# -------------------------------------------------------------------------------
# Run init.d.sh on boot before supervisor

COPY init.d /init.d
COPY init.d.sh /
CMD ["/init.d.sh", "supervisord", "-c", "/etc/supervisor/supervisord.conf", "-n" ]

# -------------------------------------------------------------------------------
# supervisor staff

COPY supervisord.conf /etc/supervisor/
VOLUME ["/var/run/supervisor", "/var/log/supervisor"]

# -------------------------------------------------------------------------------
# Setup primary lang
ENV LANG en_US.UTF-8

# Default timezone
ENV TZ Europe/Moscow

# -------------------------------------------------------------------------------
# **** baseapp
# -------------------------------------------------------------------------------
COPY supervisor.d   /etc/supervisor/conf.d
COPY consul         /etc/consul

# consul server's ip or hostname
ENV CONSUL_MASTER consul

# consul resolver
ENV DNS_MASTER    8.8.8.8

# -------------------------------------------------------------------------------
# **** nginx ****
# -------------------------------------------------------------------------------
VOLUME ["/var/cache/nginx"]

EXPOSE 80 443

ADD fastcgi_params /etc/nginx/
ADD proxy_params /etc/nginx/
# ADD ssl.conf /etc/nginx/

# ------------------------------------------------------------
# Frontend server config

# Consul upstreams domain for service named "web"
ENV CONSUL_DOMAIN web.service.consul

# Used in /etc/consul/src/nginx-redir.conf
ENV NGINX_REDIR "http://www.localhost"

# Use frontend config in this MODE
# (see init.d/setup_nginx.sh)
ENV FRONT_MODE common

# Use redirect config in this MODE
# (see init.d/setup_nginx.sh)
ENV REDIR_MODE redir

# Use proxy config in this MODE
# (see init.d/setup_nginx.sh)
ENV PROXY_MODE proxy

# Register this service in consul
ENV SERVICE web

# ------------------------------------------------------------
# Backend server config (FRONT_MODE != common, SERVICE == web)

# nginx server name
ENV NODENAME demo.consul

# Document root = $HTML_ROOT/$HTML_DIR
ENV HTML_ROOT /home/app
ENV HTML_DIR html

# -------------------------------------------------------------------------------
# **** pgws ****
# -------------------------------------------------------------------------------

WORKDIR /home/app

# -------------------------------------------------------------------------------
# **** modperl ****
# -------------------------------------------------------------------------------
# Install apache-1.3.42 & mod_perl-1.31

COPY asset-apache/*.deb /opt/apache/
RUN cd /opt/apache && dpkg -i *.deb


text:
package scala.tools.nsc.interpreter

import scala.tools.nsc.Settings

object ImportContextPreamble {
  def empty = ImportContextPreamble(Set.empty, Set.empty, "")
}
case class ImportContextPreamble(exclude: Set[String], include: Set[String], preamble: String)

// TODO: `importContextPreamble` breaks the separation between the repl's core and the frontend
// because it's a callback in the wrong direction (the frontend is only supposed to call us, we shouldn't know about the frontend)
class ScriptedInterpreter(initialSettings: Settings, reporter: ReplReporter, importContextPreamble: Set[String] => ImportContextPreamble)
  extends IMain(initialSettings, None, initialSettings, reporter) with ScriptedRepl {

  import global.{Name, TermName}

  /* Modify the template to snag definitions from dynamic context.
   * So object $iw { x + 42 } becomes object $iw { def x = $ctx.x ; x + 42 }
   */
  override protected def importsCode(wanted: Set[Name], request: Request, generousImports: Boolean) = {
    val ImportContextPreamble(exclude, include, scriptedPreamble) =
      importContextPreamble(wanted.filter(_.isTermName).map(_.decodedName.toString))

    if (exclude.nonEmpty) {
      val scriptedWanted = (wanted &~ exclude.map(TermName.apply)) ++ include.map(TermName.apply)

      val ComputedImports(header, preamble, trailer, path) =
        super.importsCode(scriptedWanted, request, generousImports)

      ComputedImports(header, preamble + scriptedPreamble, trailer, path)
    }
    else super.importsCode(wanted, request, generousImports)
  }

  def addBackReferences(req: Request): Either[String, Request] = {
    val defines = req.definesTermNames
    if (defines.isEmpty) {
      recordRequest(new Request(req.line, req.trees))
      Left(s"new ${req.lineRep.readPath}")
    } else {
      val newReq = requestFromLine(
        (s"val $$INSTANCE = new ${req.lineRep.readPath}" :: (defines map (d =>
            s"val `$d` = $$INSTANCE${req.accessPath}.`$d`"))).mkString(";")
      ).toOption.get
      newReq.compile
      Right(newReq)
    }
  }

  private object scriptContextRep extends ReadEvalPrint
  def call(name: String, args: Any*): Either[Throwable, AnyRef] = scriptContextRep.callEither(name, args: _*)
  def compile(code: String): Boolean = scriptContextRep.compile(code)
  def evalName: String = scriptContextRep.evalName
  def evalPath: String = scriptContextRep.evalPath
}


text:
<?php

use Phal\LeafTag;
use Phal\Text;

class MyTag1 extends LeafTag {

    function __construct() {
        parent::__construct("my_tag1");
    }

}

class MyTag2 extends LeafTag {

    function __construct() {
        parent::__construct("my_tag2");
        parent::addAttribute("attr", new Text("val"));
    }

}

class MyTag3 extends LeafTag {

    function __construct() {
        parent::__construct("my_tag3");
        parent::addAttribute("attr2", new Text("val2"));
        parent::addProperty("prop");
    }

}

class MyTag4WithErrorInAttributeName extends LeafTag {

    function __construct() {
        parent::__construct("my_tag4");
        parent::addAttribute("attr3", new Text("val3"));
        parent::addProperty("prop");
    }

}

class MyTag5WithErrorInPropertyName extends LeafTag {

    function __construct() {
        parent::__construct("my_tag5");
        parent::addAttribute("attr4", new Text("val4"));
        parent::addProperty("pr op");
    }

}

class LeafTagTest extends PHPUnit_Framework_TestCase {

    function testLeafTestTag1() {
        $t = new MyTag1();

        $this->assertEquals('<my_tag1/>', $t);
    }

    function testLeafTestTag2() {
        $t = new MyTag2();

        $this->assertEquals('<my_tag2 attr="val"/>', $t);
    }

    function testLeafTestTag3() {
        $t = new MyTag3();

        $this->assertEquals('<my_tag3 attr2="val2" prop/>', $t);
    }

    function testLeafTestTag4WithErrorInAttributeName() {
        try {
            $t = new MyTag4WithErrorInAttributeName();
            $this->fail();
        } catch (Exception $ex) {

        }
    }

    function testLeafTestTag5WithErrorInPropertyName() {
        try {
            $t = new MyTag5WithErrorInPropertyName();
            $this->fail();
        } catch (Exception $ex) {

        }
    }

}


text:
package com.expedia.echox3.visible.trellis;

import java.io.Serializable;

/**
 * Interface to be implemented by the User object stored in the object cache (on the server).
 * These objects are created by the User's IObjectFactory.
 * The IObjectFactory is responsible to give the object the configuration at construction time.
 * After construction, the object's updateConfiguration() will be called if the configuration has changed.
 */
public interface ICacheObject extends Serializable
{
	/**
	 * Called when the configuration has changed (aka hot configuration).
	 *
	 * @param configuration		The newly (probably) changed configuration object
	 */
	void			updateConfiguration(ObjectCacheConfiguration configuration);

	/**
	 * Client request to modify the object.
	 * This call is executed on all copies of the object.
	 *
	 * @param request	As per User contract, this is the request from the client's call
	 */
	void			writeOnly(Serializable request);

	/**
	 * Client request to extract data from the object; this call should NOT modify the object.
	 * This call is executed only on one copy object.
	 *
	 * @param request	As per User contract, this is the request from the client's call
	 */
	Serializable	readOnly(Serializable request);

	/**
	 * Request the size of the object, in the same units as SizeUnits and SizeMax in the cache configuration file.
	 *
	 * @return		The size, in the appropriate units (e.g. bytes, entries).
	 */
	long			getSize();

	/**
	 * Called periodically at interval MaintenancePeriod (see configuration).
	 * This call is where the object does its housekeeping.
	 * For example, an object could free memory pointing to items no longer required (expired).
	 * Upon completion, canDelete() will be called to see if the object is still required.
	 *
	 * When the system is under stress, the parameter memoryLevelPercent will be below 100.
	 * This is an attempt by the system to protect itself gracefully by using eviction.
	 * Eviction is the act of removing items from the "cache" earlier than it would normally.
	 *
	 * Under these circumstances, the object should attempt to reduce its memory usage proportionally.
	 * For example, if the data in an object is distributed fairly evenly over time such as prices by date
	 * for 1 day from now, 2 days from now ... up to 100 days from now, with the closer times being more important...
	 * The application could choose to keep only the memoryLevelPercent days.
	 * At memoryLevelPercent = 85, it would keep 85.
	 *
	 * In another example, if the application was a simple cache, with a TTL (time to live) of 90 minutes
	 * and memoryLevelPercent was at 85, the application could artificially modify the TTL to 90 * 85% = 76.5 minutes.
	 *
	 * Of course, an application can choose to ignore the parameter memoryLevelPercent. However, bear in mind
	 * that EchoX3 will protect itself and, when memory utilization on the storage servers reaches a threshold
	 * (approximately 87% heap utilization), all write requests will result in an OOM response.
	 *
	 * @param timeNowMS				The current time, to avoid each object having to check for the time.
	 *                              Note that EchoX3 manages the time synchronized to an external master source,
	 *                              maintaining an offset to the local clock.
	 *                              This helps ensure that all servers in a farm have their clock in sync.
	 * @param memoryLevelPercent	100 for normal or lower to indicate the system is under memory pressure
	 */
	void			doMaintenance(long timeNowMS, int memoryLevelPercent);

	/**
	 * Called frequently (e.g. after doMaintenance, writeOnly) to ask the object if it can be deleted from the cache.
	 * As this call is frequent, it should be very fast.
	 *
	 * @return		True indicates the object can be deleted; false indicates the object is still live.
	 */
	boolean			canDelete();

	/**
	 * On the surface, flush is simple, delete everything. However, EchoX3 is more powerful...
	 * EchoX3 supports a soft flush. This is a flush that is spread over some period of time...
	 * to avoid a burst of load on the backend.
	 * The client issuing the flush specifies a duration for the flush (e.g. 5 minutes) and
	 * EchoX3 will uniformly distribute the flush of each item over the duration.
	 * For example, if the flush duration is 5 minutes (300,000 ms) and there are 3,000,000 items,
	 * the flush will be distributed as approximately 10 items per millisecond.
	 *
	 * Within a EchoX3 server, the flush executes immediately
	 * and each object is told the time at which it should flush.
	 * It is up to the implementation to determine the best approach to achieve the goal,
	 * depending on the particulars of the object.
	 *
	 * @param timeNowMS			The time where the flush begins (i.e. now)
	 * @param timeFlushMS		The time at which the object should flush itself
	 */
	void			flush(long timeNowMS, long timeFlushMS);

	/**
	 * Called in response to a call to IAdminClient.upgradeClass().
	 * The newly created object (this object) is asked to populate itself from the data
	 * in the object it is replacing. The object it is replacing is the parameter.
	 * This is happening under lock.
	 * Upon completion, this object will replace the object passed as a parameter
	 * which itself will be deleted.
	 *
	 * @param cacheObject	The previous (older) cache object presumably containing the data to be stolen.
	 */
	void			upgradeFrom(ICacheObject cacheObject);
}


text:
from solution import Solution

path = "/a/./b/../../c/"
sol = Solution()
res = sol.simplifyPath(path)
print(res)