text:
package org.elasticsearch.index.fielddata;

import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.queries.TermFilter;
import org.apache.lucene.search.*;
import org.apache.lucene.search.join.FixedBitSetCachingWrapperFilter;
import org.apache.lucene.search.join.ScoreMode;
import org.apache.lucene.search.join.ToParentBlockJoinQuery;
import org.apache.lucene.util.*;
import org.elasticsearch.common.lucene.search.NotFilter;
import org.elasticsearch.common.lucene.search.XFilteredQuery;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.index.fielddata.IndexFieldData.XFieldComparatorSource;
import org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource;
import org.elasticsearch.index.fielddata.ordinals.GlobalOrdinalsIndexFieldData;
import org.elasticsearch.index.search.nested.NestedFieldComparatorSource;
import org.elasticsearch.search.MultiValueMode;
import org.junit.Test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static org.hamcrest.Matchers.*;

/**
 */
public abstract class AbstractStringFieldDataTests extends AbstractFieldDataImplTests {

    protected void fillSingleValueAllSet() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "2", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "1", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "3", Field.Store.NO));
        d.add(new StringField("value", "3", Field.Store.NO));
        writer.addDocument(d);
    }

    protected void add2SingleValuedDocumentsAndDeleteOneOfThem() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "2", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "2", Field.Store.NO));
        d.add(new StringField("value", "4", Field.Store.NO));
        writer.addDocument(d);

        writer.commit();

        writer.deleteDocuments(new Term("_id", "1"));
    }

    protected void fillSingleValueWithMissing() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "2", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "2", Field.Store.NO));
        //d.add(new StringField("value", one(), Field.Store.NO)); // MISSING....
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "3", Field.Store.NO));
        d.add(new StringField("value", "3", Field.Store.NO));
        writer.addDocument(d);
    }

    protected void fillMultiValueAllSet() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "2", Field.Store.NO));
        d.add(new StringField("value", "4", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "2", Field.Store.NO));
        d.add(new StringField("value", "1", Field.Store.NO));
        writer.addDocument(d);
        writer.commit(); // TODO: Have tests with more docs for sorting

        d = new Document();
        d.add(new StringField("_id", "3", Field.Store.NO));
        d.add(new StringField("value", "3", Field.Store.NO));
        writer.addDocument(d);
    }

    protected void fillMultiValueWithMissing() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "2", Field.Store.NO));
        d.add(new StringField("value", "4", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "2", Field.Store.NO));
        //d.add(new StringField("value", one(), Field.Store.NO)); // MISSING
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "3", Field.Store.NO));
        d.add(new StringField("value", "3", Field.Store.NO));
        writer.addDocument(d);
    }

    protected void fillAllMissing() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "2", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "3", Field.Store.NO));
        writer.addDocument(d);
    }

    protected void fillExtendedMvSet() throws Exception {
        Document d = new Document();
        d.add(new StringField("_id", "1", Field.Store.NO));
        d.add(new StringField("value", "02", Field.Store.NO));
        d.add(new StringField("value", "04", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "2", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "3", Field.Store.NO));
        d.add(new StringField("value", "03", Field.Store.NO));
        writer.addDocument(d);
        writer.commit();

        d = new Document();
        d.add(new StringField("_id", "4", Field.Store.NO));
        d.add(new StringField("value", "04", Field.Store.NO));
        d.add(new StringField("value", "05", Field.Store.NO));
        d.add(new StringField("value", "06", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "5", Field.Store.NO));
        d.add(new StringField("value", "06", Field.Store.NO));
        d.add(new StringField("value", "07", Field.Store.NO));
        d.add(new StringField("value", "08", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "6", Field.Store.NO));
        writer.addDocument(d);

        d = new Document();
        d.add(new StringField("_id", "7", Field.Store.NO));
        d.add(new StringField("value", "08", Field.Store.NO));
        d.add(new StringField("value", "09", Field.Store.NO));
        d.add(new StringField("value", "10", Field.Store.NO));
        writer.addDocument(d);
        writer.commit();

        d = new Document();
        d.add(new StringField("_id", "8", Field.Store.NO));
        d.add(new StringField("value", "!08", Field.Store.NO));
        d.add(new StringField("value", "!09", Field.Store.NO));
        d.add(new StringField("value", "!10", Field.Store.NO));
        writer.addDocument(d);
    }

    public void testActualMissingValue() throws IOException {
        testActualMissingValue(false);
    }

    public void testActualMissingValueReverse() throws IOException {
        testActualMissingValue(true);
    }

    public void testActualMissingValue(boolean reverse) throws IOException {
        // missing value is set to an actual value
        Document d = new Document();
        final StringField s = new StringField("value", "", Field.Store.YES);
        d.add(s);
        final String[] values = new String[randomIntBetween(2, 30)];
        for (int i = 1; i < values.length; ++i) {
            values[i] = TestUtil.randomUnicodeString(getRandom());
        }
        final int numDocs = scaledRandomIntBetween(10, 10000);
        for (int i = 0; i < numDocs; ++i) {
            final String value = RandomPicks.randomFrom(getRandom(), values);
            if (value == null) {
                writer.addDocument(new Document());
            } else {
                s.setStringValue(value);
                writer.addDocument(d);
            }
            if (randomInt(10) == 0) {
                writer.commit();
            }
        }

        final IndexFieldData indexFieldData = getForField("value");
        final String missingValue = values[1];
        IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(writer, true));
        XFieldComparatorSource comparator = indexFieldData.comparatorSource(missingValue, MultiValueMode.MIN);
        TopFieldDocs topDocs = searcher.search(new MatchAllDocsQuery(), randomBoolean() ? numDocs : randomIntBetween(10, numDocs), new Sort(new SortField("value", comparator, reverse)));
        assertEquals(numDocs, topDocs.totalHits);
        BytesRef previousValue = reverse ? UnicodeUtil.BIG_TERM : new BytesRef();
        for (int i = 0; i < topDocs.scoreDocs.length; ++i) {
            final String docValue = searcher.doc(topDocs.scoreDocs[i].doc).get("value");
            final BytesRef value = new BytesRef(docValue == null ? missingValue : docValue);
            if (reverse) {
                assertTrue(previousValue.compareTo(value) >= 0);
            } else {
                assertTrue(previousValue.compareTo(value) <= 0);
            }
            previousValue = value;
        }
        searcher.getIndexReader().close();
    }

    public void testSortMissingFirst() throws IOException {
        testSortMissing(true, false);
    }

    public void testSortMissingFirstReverse() throws IOException {
        testSortMissing(true, true);
    }

    public void testSortMissingLast() throws IOException {
        testSortMissing(false, false);
    }

    public void testSortMissingLastReverse() throws IOException {
        testSortMissing(false, true);
    }

    public void testSortMissing(boolean first, boolean reverse) throws IOException {
        Document d = new Document();
        final StringField s = new StringField("value", "", Field.Store.YES);
        d.add(s);
        final String[] values = new String[randomIntBetween(2, 10)];
        for (int i = 1; i < values.length; ++i) {
            values[i] = TestUtil.randomUnicodeString(getRandom());
        }
        final int numDocs = scaledRandomIntBetween(10, 10000);
        for (int i = 0; i < numDocs; ++i) {
            final String value = RandomPicks.randomFrom(getRandom(), values);
            if (value == null) {
                writer.addDocument(new Document());
            } else {
                s.setStringValue(value);
                writer.addDocument(d);
            }
            if (randomInt(10) == 0) {
                writer.commit();
            }
        }
        final IndexFieldData indexFieldData = getForField("value");
        IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(writer, true));
        XFieldComparatorSource comparator = indexFieldData.comparatorSource(first ? "_first" : "_last", MultiValueMode.MIN);
        TopFieldDocs topDocs = searcher.search(new MatchAllDocsQuery(), randomBoolean() ? numDocs : randomIntBetween(10, numDocs), new Sort(new SortField("value", comparator, reverse)));
        assertEquals(numDocs, topDocs.totalHits);
        BytesRef previousValue = first ? null : reverse ? UnicodeUtil.BIG_TERM : new BytesRef();
        for (int i = 0; i < topDocs.scoreDocs.length; ++i) {
            final String docValue = searcher.doc(topDocs.scoreDocs[i].doc).get("value");
            if (first && docValue == null) {
                assertNull(previousValue);
            } else if (!first && docValue != null) {
                assertNotNull(previousValue);
            }
            final BytesRef value = docValue == null ? null : new BytesRef(docValue);
            if (previousValue != null && value != null) {
                if (reverse) {
                    assertTrue(previousValue.compareTo(value) >= 0);
                } else {
                    assertTrue(previousValue.compareTo(value) <= 0);
                }
            }
            previousValue = value;
        }
        searcher.getIndexReader().close();
    }

    public void testNestedSortingMin() throws IOException {
        testNestedSorting(MultiValueMode.MIN);
    }

    public void testNestedSortingMax() throws IOException {
        testNestedSorting(MultiValueMode.MAX);
    }

    public void testNestedSorting(MultiValueMode sortMode) throws IOException {
        final String[] values = new String[randomIntBetween(2, 20)];
        for (int i = 0; i < values.length; ++i) {
            values[i] = TestUtil.randomSimpleString(getRandom());
        }
        final int numParents = scaledRandomIntBetween(10, 10000);
        List<Document> docs = new ArrayList<>();
        final OpenBitSet parents = new OpenBitSet();
        for (int i = 0; i < numParents; ++i) {
            docs.clear();
            final int numChildren = randomInt(4);
            for (int j = 0; j < numChildren; ++j) {
                final Document child = new Document();
                final int numValues = randomInt(3);
                for (int k = 0; k < numValues; ++k) {
                    final String value = RandomPicks.randomFrom(getRandom(), values);
                    child.add(new StringField("text", value, Store.YES));
                }
                docs.add(child);
            }
            final Document parent = new Document();
            parent.add(new StringField("type", "parent", Store.YES));
            final String value = RandomPicks.randomFrom(getRandom(), values);
            if (value != null) {
                parent.add(new StringField("text", value, Store.YES));
            }
            docs.add(parent);
            parents.set(parents.prevSetBit(parents.length() - 1) + docs.size());
            writer.addDocuments(docs);
            if (randomInt(10) == 0) {
                writer.commit();
            }
        }
        IndexSearcher searcher = new IndexSearcher(DirectoryReader.open(writer, true));
        IndexFieldData<?> fieldData = getForField("text");
        final BytesRef missingValue;
        switch (randomInt(4)) {
        case 0:
            missingValue = new BytesRef();
            break;
        case 1:
            missingValue = BytesRefFieldComparatorSource.MAX_TERM;
            break;
        case 2:
            missingValue = new BytesRef(RandomPicks.randomFrom(getRandom(), values));
            break;
        default:
            missingValue = new BytesRef(TestUtil.randomSimpleString(getRandom()));
            break;
        }
        BytesRefFieldComparatorSource innerSource = new BytesRefFieldComparatorSource(fieldData, missingValue, sortMode);
        Filter parentFilter = new TermFilter(new Term("type", "parent"));
        Filter childFilter = new NotFilter(parentFilter);
        NestedFieldComparatorSource nestedComparatorSource = new NestedFieldComparatorSource(sortMode, innerSource, parentFilter, childFilter);
        ToParentBlockJoinQuery query = new ToParentBlockJoinQuery(new XFilteredQuery(new MatchAllDocsQuery(), childFilter), new FixedBitSetCachingWrapperFilter(parentFilter), ScoreMode.None);
        Sort sort = new Sort(new SortField("text", nestedComparatorSource));
        TopFieldDocs topDocs = searcher.search(query, randomIntBetween(1, numParents), sort);
        assertTrue(topDocs.scoreDocs.length > 0);
        BytesRef previous = null;
        for (int i = 0; i < topDocs.scoreDocs.length; ++i) {
            final int docID = topDocs.scoreDocs[i].doc;
            assertTrue("expected " + docID + " to be a parent", parents.get(docID));
            BytesRef cmpValue = null;
            for (int child = parents.prevSetBit(docID - 1) + 1; child < docID; ++child) {
                String[] vals = searcher.doc(child).getValues("text");
                if (vals.length == 0) {
                    vals = new String[] {missingValue.utf8ToString()};
                }
                for (String value : vals) {
                    final BytesRef bytesValue = new BytesRef(value);
                    if (cmpValue == null) {
                        cmpValue = bytesValue;
                    } else if (sortMode == MultiValueMode.MIN && bytesValue.compareTo(cmpValue) < 0) {
                        cmpValue = bytesValue;
                    } else if (sortMode == MultiValueMode.MAX && bytesValue.compareTo(cmpValue) > 0) {
                        cmpValue = bytesValue;
                    }
                }
            }
            if (cmpValue == null) {
                cmpValue = missingValue;
            }
            if (previous != null) {
                assertNotNull(cmpValue);
                assertTrue(previous.utf8ToString() + "   /   " + cmpValue.utf8ToString(), previous.compareTo(cmpValue) <= 0);
            }
            previous = cmpValue;
        }
        searcher.getIndexReader().close();
    }

    @Test
    public void testGlobalOrdinals() throws Exception {
        fillExtendedMvSet();
        refreshReader();
        FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("global_values", "fixed"));
        IndexFieldData.WithOrdinals ifd = getForField(fieldDataType, "value");
        IndexFieldData.WithOrdinals globalOrdinals = ifd.loadGlobal(topLevelReader);
        assertThat(topLevelReader.leaves().size(), equalTo(3));

        // First segment
        assertThat(globalOrdinals, instanceOf(GlobalOrdinalsIndexFieldData.class));
        AtomicFieldData.WithOrdinals afd = globalOrdinals.load(topLevelReader.leaves().get(0));
        BytesValues.WithOrdinals values = afd.getBytesValues();
        assertThat(values.setDocument(0), equalTo(2));
        long ord = values.nextOrd();
        assertThat(ord, equalTo(3l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("02"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(5l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("04"));
        assertThat(values.setDocument(1), equalTo(0));
        assertThat(values.setDocument(2), equalTo(1));
        ord = values.nextOrd();
        assertThat(ord, equalTo(4l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("03"));

        // Second segment
        afd = globalOrdinals.load(topLevelReader.leaves().get(1));
        values = afd.getBytesValues();
        assertThat(values.setDocument(0), equalTo(3));
        ord = values.nextOrd();
        assertThat(ord, equalTo(5l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("04"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(6l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("05"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(7l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("06"));
        assertThat(values.setDocument(1), equalTo(3));
        ord = values.nextOrd();
        assertThat(ord, equalTo(7l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("06"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(8l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("07"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(9l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("08"));
        assertThat(values.setDocument(2), equalTo(0));
        assertThat(values.setDocument(3), equalTo(3));
        ord = values.nextOrd();
        assertThat(ord, equalTo(9l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("08"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(10l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("09"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(11l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("10"));

        // Third segment
        afd = globalOrdinals.load(topLevelReader.leaves().get(2));
        values = afd.getBytesValues();
        assertThat(values.setDocument(0), equalTo(3));
        ord = values.nextOrd();
        assertThat(ord, equalTo(0l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("!08"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(1l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("!09"));
        ord = values.nextOrd();
        assertThat(ord, equalTo(2l));
        assertThat(values.getValueByOrd(ord).utf8ToString(), equalTo("!10"));
    }

    @Test
    public void testTermsEnum() throws Exception {
        fillExtendedMvSet();
        AtomicReaderContext atomicReaderContext = refreshReader();

        IndexFieldData.WithOrdinals ifd = getForField("value");
        AtomicFieldData.WithOrdinals afd = ifd.load(atomicReaderContext);

        TermsEnum termsEnum = afd.getBytesValues().getTermsEnum();
        int size = 0;
        while (termsEnum.next() != null) {
            size++;
        }
        assertThat(size, equalTo(12));

        assertThat(termsEnum.seekExact(new BytesRef("10")), is(true));
        assertThat(termsEnum.term().utf8ToString(), equalTo("10"));
        assertThat(termsEnum.next(), nullValue());

        assertThat(termsEnum.seekExact(new BytesRef("08")), is(true));
        assertThat(termsEnum.term().utf8ToString(), equalTo("08"));
        size = 0;
        while (termsEnum.next() != null) {
            size++;
        }
        assertThat(size, equalTo(2));

        termsEnum.seekExact(8);
        assertThat(termsEnum.term().utf8ToString(), equalTo("07"));
        size = 0;
        while (termsEnum.next() != null) {
            size++;
        }
        assertThat(size, equalTo(3));
    }

    @Test
    public void testGlobalOrdinalsGetRemovedOnceIndexReaderCloses() throws Exception {
        fillExtendedMvSet();
        refreshReader();
        FieldDataType fieldDataType = new FieldDataType("string", ImmutableSettings.builder().put("global_values", "fixed").put("cache", "node"));
        IndexFieldData.WithOrdinals ifd = getForField(fieldDataType, "value");
        IndexFieldData.WithOrdinals globalOrdinals = ifd.loadGlobal(topLevelReader);
        assertThat(ifd.loadGlobal(topLevelReader), sameInstance(globalOrdinals));
        // 3 b/c 1 segment level caches and 1 top level cache
        assertThat(indicesFieldDataCache.getCache().size(), equalTo(4l));

        IndexFieldData.WithOrdinals cachedInstace = null;
        for (Accountable ramUsage : indicesFieldDataCache.getCache().asMap().values()) {
            if (ramUsage instanceof IndexFieldData.WithOrdinals) {
                cachedInstace = (IndexFieldData.WithOrdinals) ramUsage;
                break;
            }
        }
        assertThat(cachedInstace, sameInstance(globalOrdinals));
        topLevelReader.close();
        // Now only 3 segment level entries, only the toplevel reader has been closed, but the segment readers are still used by IW
        assertThat(indicesFieldDataCache.getCache().size(), equalTo(3l));

        refreshReader();
        assertThat(ifd.loadGlobal(topLevelReader), not(sameInstance(globalOrdinals)));

        ifdService.clear();
        assertThat(indicesFieldDataCache.getCache().size(), equalTo(0l));
    }
}


text:
using System;
using System.IO;
using Trinity.IO;
using Trinity.IO.Json;

namespace Trinity.Core
{
	public abstract class StateBase : IInteropInterface, ISerializable
	{
		public const byte StateVersion = 0;

		public virtual int Size => sizeof(byte);

		public virtual void Deserialize(BinaryReader reader)
		{
			if (reader.ReadByte() != StateVersion)
			{
				throw new FormatException();
			}
		}

		public virtual void Serialize(BinaryWriter writer)
		{
			writer.Write(StateVersion);
		}

		public virtual JObject ToJson()
		{
			var json = new JObject();
			json["version"] = StateVersion;
			return json;
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

angular.module('profile')
.controller('UserGamesController', ['$scope', 'gameService', 'games', 'gmGames', function($scope, gameService, games, gmGames) {
    var i,
        theGame,
        variantName,
        key;

    $scope.selectedIndex = 0;

    $scope.variants = { };
    $scope.moves = { };

    $scope.playing = games;
    $scope.GMing = gmGames;

    for (i = 0; i < games.length; i++) {
        theGame = games[i];

        // Identify what variants need fetching.
        variantName = theGame.variant;
        if (!$scope.variants[variantName])
            $scope.variants[variantName] = { };

        /*
         * Identify the extent of each game's move data to get, given these rules:
         *     1) Old phases are fully exposed: old positions, moves, resolution.
         *     2) Current phases expose old positions.
         *     3) Players see their own orders in current phases.
         *     4) GMs see everything in current phases.
        if (theGame.isAdmin)
            $scope.moves[theGame.id] = gameService.getMoveData(theGame.id);//.then(movesToScopeCallback);
        else
            $scope.moves[theGame.id] = gameService.getMoveDataForCurrentUser(theGame.id, theGame.year, theGame.phase);//.then(movesToScopeCallback);
            */
    }

    // Populate keys.
    for (key in $scope.variants)
        $scope.variants[key] = gameService.getVariant(key);
}]);


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.PythonTools;
using Microsoft.PythonTools.Parsing;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudioTools.MockVsTests;
using TestUtilities;

namespace PythonToolsMockTests {
    [TestClass]
    public class EditorTests {
        [ClassInitialize]
        public static void Initialize(TestContext context) {
            AssertListener.Initialize();
        }

        [TestMethod, Priority(1)]
        public void BuiltinFunctionSigHelp() {
            using (var view = new PythonEditor()) {
                view.Type("min(");

                for (int retries = 10; retries > 0; --retries) {
                    using (var sh = view.View.WaitForSession<ISignatureHelpSession>()) {
                        var doc = sh.Session.Signatures[0].Documentation;
                        if (doc.Contains("still being calculated")) {
                            view.VS.Sleep(100);
                            continue;
                        }
                        AssertUtil.AreEqual(new Regex(@"^min\(x\: object\).+?"), doc);
                        break;
                    }
                }
            }
        }

        [TestMethod, Priority(1)]
        public void SigHelpInClass() {
            using (var view = new PythonEditor()) {
                view.Type("class C(): pass");
                view.View.MoveCaret(1, 9);

                view.View.ParamInfo();

                view.View.AssertNoIntellisenseSession();
            }
        }

        [TestMethod, Priority(1)]
        public void BuiltinFunctionCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");
                }
            }
        }

        [TestMethod, Priority(1)]
        public void FilterCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");

                    view.Type("class");

                    AssertUtil.DoesntContain(sh.Session.Completions(), "__call__");
                }
            }
        }

        [TestMethod, Priority(1)]
        public void DotCompletes() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");

                    view.Type("class.");

                    Assert.AreEqual("min.__class__.", view.Text);
                }
            }
        }

        [TestMethod, Priority(1)]
        public void NonIdentifierDismisses() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");

                    view.Type("#");

                    Assert.IsTrue(sh.Session.IsDismissed);
                }
                view.View.AssertNoIntellisenseSession();
                Assert.AreEqual("min.#", view.Text);
            }
        }

        [TestMethod, Priority(1)]
        public void EnterCommits() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");
                    view.Type("class\r");
                }

                Assert.AreEqual("min.__class__", view.Text);
            }
        }

        [TestMethod, Priority(1)]
        public void EnterDismisses() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.EnterCommitsIntellisense = false;
                view.AdvancedOptions.AutoListMembers = true;

                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");

                    view.Type("class\r");
                }
                Assert.AreEqual("min.class\r\n", view.Text);
            }
        }

        [TestMethod, Priority(1)]
        public void EnterCommitsCompleteNoNewLine() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.AddNewLineAtEndOfFullyTypedWord = true;
                view.AdvancedOptions.AutoListMembers = true;
                view.AdvancedOptions.AutoListIdentifiers = false;
                view.AdvancedOptions.HideAdvancedMembers = false;

                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");

                    view.Type("__class__\r");
                }
                Assert.AreEqual("min.__class__\r\n", view.Text);
            }
        }

        [TestMethod, Priority(1)]
        public void TabCommits() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.EnterCommitsIntellisense = false;
                view.AdvancedOptions.AutoListMembers = true;
                view.AdvancedOptions.AutoListIdentifiers = false;
                view.AdvancedOptions.HideAdvancedMembers = false;

                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");

                    view.Type("class\t");
                }

                Assert.AreEqual("min.__class__", view.Text);
            }
        }

        [TestMethod, Priority(1)]
        public void DecoratorCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("@");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "property", "staticmethod");
                }
            }
        }

        [TestMethod, Priority(1)]
        public void DecoratorNonCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("a = b @");

                view.View.AssertNoIntellisenseSession();
            }
        }

        [TestMethod, Priority(1)]
        public void AutoListIdentifierCompletions() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.AutoListIdentifiers = true;

                view.Type("a = ");

                foreach (var c in "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
                    // x<space> should bring up a completion session
                    Console.WriteLine("Typing {0}", c);
                    view.Type(c.ToString());

                    using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                        sh.Session.Dismiss();
                    }

                    view.View.Backspace();
                }

                view.View.AssertNoIntellisenseSession();

                // x<space> should not bring up a completion session
                // Don't check too many items, since asserting that no session
                // starts is slow.
                foreach (var c in "1234567890([{") {
                    Console.WriteLine("Typing {0}", c);
                    view.Type(c.ToString());

                    view.View.AssertNoIntellisenseSession();

                    view.View.Backspace();
                }
            }
        }

        private void AutoListTest(string code, params int[] triggerAtIndex) {
            AutoListTest(code, PythonLanguageVersion.V33, triggerAtIndex);
        }

        private void AutoListTest(string code, PythonLanguageVersion version, params int[] triggerAtIndex) {
            using (var view = new PythonEditor(version: version)) {
                view.AdvancedOptions.AutoListIdentifiers = true;
                view.AdvancedOptions.AutoListMembers = true;

                int lastStart = 0;
                string text;
                foreach (var _i in triggerAtIndex) {
                    bool expectCompletions = _i >= 0;
                    int expected = _i > 0 ? _i : -_i;

                    text = code.Substring(lastStart, expected - lastStart);
                    Console.WriteLine("Typing '{0}' [{1}, {2})", text, lastStart, expected);
                    view.Type(text);

                    view.View.AssertNoIntellisenseSession();
                    lastStart = expected;

                    if (expectCompletions) {
                        text = code.Substring(expected, 1);
                        Console.WriteLine("Typing '{0}' [{1}, {2}) and expect completions", text, expected, expected + 1);
                        view.Type(text);

                        using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                            sh.Session.Dismiss();
                        }

                        lastStart = expected + 1;
                    }
                }
                text = code.Substring(lastStart);
                if (!string.IsNullOrEmpty(text)) {
                    Console.WriteLine("Typing '{0}' [{1}, {2})", text, lastStart, code.Length);
                    view.Type(text);

                    view.View.AssertNoIntellisenseSession();
                }
            }
        }

        [TestMethod, Priority(1)]
        public void AutoListInDef() {
            AutoListTest("def fn(p:a, q=b) -> x", 9, 14, 20);
        }

        [TestMethod, Priority(1)]
        public void AutoListInAssignment() {
            AutoListTest("a, b, c = a, b, c", 10, 13, 16);
        }

        [TestMethod, Priority(1)]
        public void AutoListInClass() {
            AutoListTest("class F(o, p):", 8, 11);
        }

        [TestMethod, Priority(1)]
        public void AutoListInLambda() {
            AutoListTest("a = lambda x, y: p", 4, 17);
        }

        [TestMethod, Priority(1)]
        public void AutoListInWith() {
            AutoListTest("with a as b, c(x) as d:", 5, 13, -22);
        }

        [TestMethod, Priority(1)]
        public void AutoListInLiterals() {
            AutoListTest("[a, b, c]", 1, 4, 7);
            AutoListTest("{a, b, c}", 1, 4, 7);
            AutoListTest("(a, b, c)", 1, 4, 7);
            AutoListTest("{a: b, c: d, e: f}", 1, 4, 7, 10, 13, 16);
        }

        [TestMethod, Priority(1)]
        public void AutoListInComprehensions() {
            // TODO: Make completions trigger after spaces
            // eg: AutoListTest("[a for a in b]", 1, 3, 9, 12);

            AutoListTest("[a for a in b for c in d if x]", 1, -7, 12, -18, 23, 28);
            AutoListTest("{a for a in b for c in d if x}", 1, -7, 12, -18, 23, 28);
            AutoListTest("(a for a in b for c in d if x)", 1, -7, 12, -18, 23, 28);
            AutoListTest("{a: b for a, b in b for c, d in e if x}", 1, 4, -10, -13, 18, 32, 37);
            AutoListTest("x = [a for a in b for c in d if x]", -1, 5, -11, 16, -22, 27, 32);
        }

        [TestMethod, Priority(1)]
        public void AutoListInStatements() {
            AutoListTest("assert a", -6, 7);
            AutoListTest("a += b", 5);
            AutoListTest("del a", -3, 4);
            AutoListTest("exec a", PythonLanguageVersion.V27, -4, 5);
            AutoListTest("for a in b", -3, -5, 9);
            AutoListTest("if a", -2, 3);
            AutoListTest("global a", -6, 7);
            AutoListTest("nonlocal a", PythonLanguageVersion.V33, -8, 9);
            AutoListTest("print a", PythonLanguageVersion.V27, -5, 6);
            AutoListTest("return a", -6, 7);
            AutoListTest("while a", -5, 6);
            AutoListTest("yield a", -5, 6);
        }

        [TestMethod, Priority(1)]
        public void DisableAutoCompletions() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.AutoListMembers = false;
                view.AdvancedOptions.AutoListIdentifiers = false;

                foreach (var t in new[] { "a", "a.", "import " }) {
                    Console.WriteLine("Typed " + t);
                    view.Type(t);

                    view.View.AssertNoIntellisenseSession();

                    view.View.Clear();
                }
            }
        }

        [TestMethod, Priority(1)]
        public void CompletionsAtEndOfLastChildScope() {
            using (var view = new PythonEditor(@"class A:
    def f(param1, param2):
        y = 234

class B:
    pass
")) {
                view.View.MoveCaret(5, 9);
                view.Type("p");
                view.View.MemberList();
                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "param1", "param2");
                }
            }
        }
    }

    static class IntellisenseTestExtensions {
        public static IEnumerable<string> Completions(this ICompletionSession session) {
            Assert.IsNotNull(session);
            Assert.AreEqual(1, session.CompletionSets.Count);

            return session.CompletionSets[0].Completions.Select(x => x.InsertionText);
        }

        public static void Clear(this MockVsTextView view) {
            var snapshot = view.View.TextSnapshot;
            using (var edit = snapshot.TextBuffer.CreateEdit()) {
                edit.Delete(new Microsoft.VisualStudio.Text.Span(0, snapshot.Length));
                edit.Apply();
            }
        }

        public static PythonToolsService GetPyService(this MockVs session) {
            var service = session.ServiceProvider.GetPythonToolsService();
            Assert.IsNotNull(service, "PythonToolsService is unavailable");
            return service;
        }
    }
}


text:
using System;
using System.Linq;

namespace MickeySmithTestbed
{
    public static partial class StringExtensions
    {
        public static bool IsRoughly(this string input, params string[] matches)
        {
            return matches.Any(match => input.Trim().Equals(match.Trim(), StringComparison.InvariantCultureIgnoreCase));
        }

        public static bool RoughlyStartsWith(this string input, string startsWith)
        {
            return input.StartsWith(startsWith, StringComparison.InvariantCultureIgnoreCase);
        }
    }
}


text:
(function(fps) {
    var inputs = {
        onKeyDown: function(event) {
            this.keys[event.keyCode] = true;
        },
        onKeyUp: function(event) {
            this.keys[event.keyCode] = false;
        },
        onMouseDown: function(event) {
            if(event.which == 1)
                this.mouse.left = true;
            else if(event.which == 2)
                this.mouse.middle = true;
            else if(event.which == 3)
                this.mouse.right = true;
        },
        onMouseUp: function(event) {
            if(event.which == 1)
                this.mouse.left = false;
            else if(event.which == 2)
                this.mouse.middle = false;
            else if(event.which == 3)
                this.mouse.right = false;
        },
        keys: {},
        mouse: {
            left: false,
            middle: false,
            right: false
        },
        mousePosition: {x:0,y:0}
    };

    window.addEventListener("keydown", inputs.onKeyDown.bind(inputs));
    window.addEventListener("keyup", inputs.onKeyUp.bind(inputs));
    window.addEventListener("mousedown", inputs.onMouseDown.bind(inputs));
    window.addEventListener("mouseup", inputs.onMouseUp.bind(inputs));

    fps.inputs = {
        getKey: function(keyCode) {
            return inputs.keys[keyCode];
        },
        anyRegisteredKey: function() {
            var keys = fps.options.current.keys;
            for(var key in inputs.keys) {
                if(inputs.keys.hasOwnProperty(key) && inputs.keys[key]) {
                    for(var registeredKey in keys) {
                        if(keys.hasOwnProperty(registeredKey) && keys[registeredKey] == key)
                            return true;
                    }
                }
            }
            return false;
        },
        anyKey: function() {
            for(var key in inputs.keys) {
                if(inputs.keys.hasOwnProperty(key) && inputs.keys[key])
                    return true;
            }
            return false;
        },
        leftMouseDown: function() {
            return inputs.mouse.left;
        },
        middleMouseDown: function() {
            return inputs.mouse.middle;
        },
        rightMouseDown: function() {
            return inputs.mouse.right;
        },
        anyMouse: function() {
            return inputs.mouse.left || inputs.mouse.middle || inputs.mouse.right;
        },
        reset: function() {
            window.removeEventListener("keydown", inputs.onKeyDown.bind(inputs));
            window.removeEventListener("keyup", inputs.onKeyUp.bind(inputs));
            window.removeEventListener("mousedown", inputs.onMouseDown.bind(inputs));
            window.removeEventListener("mouseup", inputs.onMouseUp.bind(inputs));
        }
    };
})(fps);


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="jp.clockup.myradiobutton.MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="City"
        android:textSize="24sp" />

    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <RadioButton
            android:id="@+id/radio0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:onClick="checkMethod1"
            android:text="Tokyo" />

        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="checkMethod1"
            android:text="New York" />

        <RadioButton
            android:id="@+id/radio2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="checkMethod1"
            android:text="London" />

    </RadioGroup>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Language"
        android:textSize="24sp" />

    <RadioGroup
        android:id="@+id/radioGroup2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <RadioButton
            android:id="@+id/radio2_0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:onClick="checkMethod2"
            android:text="Japanese" />

        <RadioButton
            android:id="@+id/radio2_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="checkMethod2"
            android:text="English" />

        <RadioButton
            android:id="@+id/radio2_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="checkMethod2"
            android:text="Chinese" />

    </RadioGroup>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="buttonMethod"
        android:text="Get all states" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:textSize="24sp" />

</LinearLayout>


text:
package io.github.polysantiago.spring.rest;

import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@RequiredArgsConstructor
class Foo {

    private final String bar;

}


text:
namespace LibUtil
{
    template<class T> void clearPtrVector(std::vector<T*>* vec_)
    {
        for(typename std::vector<T*>::iterator it = vec_->begin(); it != vec_->end(); ++it)
        {
            T* temp_T = (*it);
            delete temp_T;
        }
        vec_->clear();
        return;
    }

    template<class T> void deletePtrVector(std::vector<T*>* vec_)
    {
        clearPtrVector<T>(vec_);
        delete vec_;
        return;
    }

} // namespace LibUtil

#endif // __LIBUTIL_H__


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="641c0fdb-890d-4ac5-ab99-8f9fd8e5a40a" name="Default" comment="">
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/src/users/UserController.js" afterPath="$PROJECT_DIR$/app/src/users/UserController.js" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/src/users/UserService.js" afterPath="$PROJECT_DIR$/app/src/users/UserService.js" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/clock.js" afterPath="$PROJECT_DIR$/clock.js" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/index.html" afterPath="$PROJECT_DIR$/app/index.html" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/server.js" afterPath="$PROJECT_DIR$/server.js" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
    </list>
    <ignored path="FunAnalitycs.iws" />
    <ignored path=".idea/workspace.xml" />
    <ignored path=".idea/dataSources.local.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="DaemonCodeAnalyzer">
    <disable_hints />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="FunAnalitycs" />
  </component>
  <component name="FileEditorManager">
    <leaf>
      <file leaf-file-name="index.html" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/app/index.html">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-10.0" vertical-offset="510" max-vertical-offset="1770">
              <caret line="50" column="56" selection-start-line="50" selection-start-column="56" selection-end-line="50" selection-end-column="56" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="clock.js" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/clock.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-0.36196318" vertical-offset="1045" max-vertical-offset="1860">
              <caret line="52" column="3" selection-start-line="52" selection-start-column="3" selection-end-line="52" selection-end-column="3" />
              <folding>
                <element signature="e#0#50#0" expanded="false" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="Users.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/app/src/users/Users.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="210">
              <caret line="4" column="47" selection-start-line="4" selection-start-column="47" selection-end-line="4" selection-end-column="47" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="UserController.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/app/src/users/UserController.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="2895">
              <caret line="49" column="53" selection-start-line="49" selection-start-column="53" selection-end-line="49" selection-end-column="53" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="server.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/server.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-14.363636" vertical-offset="1280" max-vertical-offset="2340">
              <caret line="138" column="18" selection-start-line="138" selection-start-column="18" selection-end-line="138" selection-end-column="18" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="users.json" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/users.json">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="-1.25" vertical-offset="0" max-vertical-offset="180">
              <caret line="2" column="24" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="24" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="UserService.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/app/src/users/UserService.js">
          <provider selected="true" editor-type-id="text-editor">
            <state vertical-scroll-proportion="0.0" vertical-offset="255" max-vertical-offset="1635">
              <caret line="47" column="30" selection-start-line="47" selection-start-column="30" selection-end-line="47" selection-end-column="30" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FindManager">
    <FindUsagesManager>
      <setting name="OPEN_NEW_TAB" value="true" />
    </FindUsagesManager>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="changedFiles">
      <list>
        <option value="$PROJECT_DIR$/dist/js/dashboard.min.js" />
        <option value="$PROJECT_DIR$/gulpfile.js" />
        <option value="$PROJECT_DIR$/dist/index.html" />
        <option value="$PROJECT_DIR$/app/index.jade" />
        <option value="$PROJECT_DIR$/Procfile" />
        <option value="$PROJECT_DIR$/app/src/users/Users.js" />
        <option value="$PROJECT_DIR$/package.json" />
        <option value="$PROJECT_DIR$/DB.sql" />
        <option value="$PROJECT_DIR$/users.json" />
        <option value="$PROJECT_DIR$/clock.js" />
        <option value="$PROJECT_DIR$/app/src/users/UserService.js" />
        <option value="$PROJECT_DIR$/app/index.html" />
        <option value="$PROJECT_DIR$/server.js" />
        <option value="$PROJECT_DIR$/app/src/users/UserController.js" />
      </list>
    </option>
  </component>
  <component name="JsGulpfileManager">
    <initial>false</initial>
  </component>
  <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
  <component name="ProjectFrameBounds">
    <option name="y" value="23" />
    <option name="width" value="1680" />
    <option name="height" value="959" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectReloadState">
    <option name="STATE" value="0" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="FunAnalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="FunAnalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="fanalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="FunAnalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="fanalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="node_modules" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="FunAnalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="fanalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="app" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="FunAnalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="fanalitycs" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="app" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="src" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="Scope" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="options.lastSelected" value="preferences.pluginManager" />
    <property name="options.splitter.main.proportions" value="0.3" />
    <property name="options.splitter.details.proportions" value="0.2" />
    <property name="WebServerToolWindowFactoryState" value="true" />
    <property name="LayoutCode.rearrangeEntriesJavaScript" value="false" />
    <property name="DefaultHtmlFileTemplate" value="Html5" />
    <property name="FullScreen" value="false" />
    <property name="HbShouldOpenHtmlAsHb" value="" />
    <property name="LayoutCode.rearrangeEntriesJSON" value="false" />
  </component>
  <component name="RecentsManager">
    <key name="CopyFile.RECENT_KEYS">
      <recent name="$PROJECT_DIR$/app" />
    </key>
  </component>
  <component name="RunManager">
    <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
      <TestRunner />
      <method />
    </configuration>
    <configuration default="true" type="PhpLocalRunConfigurationType" factoryName="PHP Console">
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="PhpBehatConfigurationType" factoryName="Behat">
      <BehatRunner />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <node-options />
      <gulpfile />
      <tasks />
      <pass-parent-env-vars>false</pass-parent-env-vars>
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="PhpUnitRemoteRunConfigurationType" factoryName="PHPUnit on Server">
      <method />
    </configuration>
    <list size="0" />
  </component>
  <component name="ShelveChangesManager" show_recycled="false" />
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="641c0fdb-890d-4ac5-ab99-8f9fd8e5a40a" name="Default" comment="" />
      <created>1426238729026</created>
      <option name="number" value="Default" />
      <updated>1426238729026</updated>
    </task>
    <servers />
  </component>
  <component name="ToolWindowManager">
    <frame x="0" y="23" width="1680" height="959" extended-state="6" />
    <editor active="true" />
    <layout>
      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25946277" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Gulp" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
    </layout>
    <layout-to-restore>
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="true" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
      <window_info id="Gulp" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25946277" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
    </layout-to-restore>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="VcsManagerConfiguration">
    <option name="myTodoPanelSettings">
      <TodoPanelSettings />
    </option>
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager>
      <option name="time" value="1" />
    </breakpoint-manager>
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/app/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="439" max-vertical-offset="1770">
          <caret line="64" column="27" selection-start-line="64" selection-start-column="27" selection-end-line="64" selection-end-column="27" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/clock.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1065">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="e#0#50#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/package.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="150" max-vertical-offset="570">
          <caret line="10" column="24" selection-start-line="10" selection-start-column="4" selection-end-line="10" selection-end-column="5" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/DB.sql">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="195" max-vertical-offset="360">
          <caret line="13" column="31" selection-start-line="13" selection-start-column="31" selection-end-line="13" selection-end-column="31" />
          <folding />
        </state>
      </provider>
      <provider editor-type-id="com.intellij.database.editor.CsvTableFileEditorProvider">
        <state />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/Users.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="60" max-vertical-offset="210">
          <caret line="4" column="47" selection-start-line="4" selection-start-column="47" selection-end-line="4" selection-end-column="47" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/UserController.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="355" max-vertical-offset="2910">
          <caret line="41" column="41" selection-start-line="41" selection-start-column="38" selection-end-line="41" selection-end-column="41" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/UserService.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="1020" max-vertical-offset="1305">
          <caret line="68" column="147" selection-start-line="68" selection-start-column="147" selection-end-line="68" selection-end-column="147" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1575">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/Users.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="210">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/UserController.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="135" max-vertical-offset="1770">
          <caret line="27" column="15" selection-start-line="27" selection-start-column="15" selection-end-line="27" selection-end-column="15" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/UserService.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="369" max-vertical-offset="1035">
          <caret line="50" column="42" selection-start-line="50" selection-start-column="42" selection-end-line="50" selection-end-column="42" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/package.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="210" max-vertical-offset="495">
          <caret line="14" column="22" selection-start-line="14" selection-start-column="22" selection-end-line="14" selection-end-column="22" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="60" max-vertical-offset="1335">
          <caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/README.md">
      <provider editor-type-id="MarkdownPreviewEditor">
        <state />
      </provider>
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="2730">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/server.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="90">
          <caret line="0" column="51" selection-start-line="0" selection-start-column="51" selection-end-line="0" selection-end-column="51" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/Procfile">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="90">
          <caret line="0" column="19" selection-start-line="0" selection-start-column="19" selection-end-line="0" selection-end-column="19" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/README.md">
      <provider editor-type-id="MarkdownPreviewEditor">
        <state />
      </provider>
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="2730">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/bower_components/angular/index.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="666">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/Procfile">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.022522522" vertical-offset="0" max-vertical-offset="666">
          <caret line="1" column="20" selection-start-line="1" selection-start-column="20" selection-end-line="1" selection-end-column="20" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/bower_components/angular-material/demos/icon/demoSvgIconSets/assets/core-icons.svg">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="666">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/DB.sql">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.17763157" vertical-offset="0" max-vertical-offset="760">
          <caret line="9" column="12" selection-start-line="9" selection-start-column="3" selection-end-line="9" selection-end-column="12" />
          <folding />
        </state>
      </provider>
      <provider editor-type-id="com.intellij.database.editor.CsvTableFileEditorProvider">
        <state />
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/package.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.5689001" vertical-offset="0" max-vertical-offset="791">
          <caret line="30" column="28" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/Users.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="210">
          <caret line="4" column="47" selection-start-line="4" selection-start-column="47" selection-end-line="4" selection-end-column="47" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/users.json">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-1.25" vertical-offset="0" max-vertical-offset="180">
          <caret line="2" column="24" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="24" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/UserService.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="255" max-vertical-offset="1635">
          <caret line="47" column="30" selection-start-line="47" selection-start-column="30" selection-end-line="47" selection-end-column="30" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/index.html">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-10.0" vertical-offset="510" max-vertical-offset="1770">
          <caret line="50" column="56" selection-start-line="50" selection-start-column="56" selection-end-line="50" selection-end-column="56" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/server.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-14.363636" vertical-offset="1280" max-vertical-offset="2340">
          <caret line="138" column="18" selection-start-line="138" selection-start-column="18" selection-end-line="138" selection-end-column="18" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/app/src/users/UserController.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="2895">
          <caret line="49" column="53" selection-start-line="49" selection-start-column="53" selection-end-line="49" selection-end-column="53" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/clock.js">
      <provider selected="true" editor-type-id="text-editor">
        <state vertical-scroll-proportion="-0.36196318" vertical-offset="1045" max-vertical-offset="1860">
          <caret line="52" column="3" selection-start-line="52" selection-start-column="3" selection-end-line="52" selection-end-column="3" />
          <folding>
            <element signature="e#0#50#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
package org.jenkinsci.plugins.gitchangelog;

import static com.google.common.base.Strings.isNullOrEmpty;
import static org.jenkinsci.plugins.gitchangelog.config.GitChangelogConfigHelper.createNewConfig;
import hudson.model.AbstractProject;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Publisher;

import java.util.ArrayList;

import net.sf.json.JSONObject;

import org.jenkinsci.plugins.gitchangelog.config.CustomIssue;
import org.jenkinsci.plugins.gitchangelog.config.GitChangelogConfig;
import org.kohsuke.stapler.StaplerRequest;

public final class GitChangelogDescriptor extends BuildStepDescriptor<Publisher> {
 private GitChangelogConfig config;

 public GitChangelogDescriptor() {
  super(GitChangelogRecorder.class);
  load();
  if (this.config == null) {
   this.config = createNewConfig();
  }
 }

 @Override
 public String getDisplayName() {
  return "Git Changelog";
 }

 @Override
 public String getHelpFile() {
  return super.getHelpFile();
 }

 /**
  * Create new blank configuration. Used when job is created.
  */
 public GitChangelogConfig getNewConfig() {
  return createNewConfig();
 }

 @Override
 public boolean isApplicable(@SuppressWarnings("rawtypes") final Class<? extends AbstractProject> jobType) {
  return true;
 }

 @Override
 public Publisher newInstance(StaplerRequest req, JSONObject formData) throws hudson.model.Descriptor.FormException {
  GitChangelogConfig c = new GitChangelogConfig();
  c.setUseConfigFile(formData.getBoolean("useConfigFile"));
  c.setConfigFile(formData.getString("configFile"));
  c.setFromType(formData.getString("fromType"));
  c.setFromReference(formData.getString("fromReference"));
  c.setToType(formData.getString("toType"));
  c.setUseSubDirectory(formData.getBoolean("useSubDirectory"));
  c.setSubDirectory(formData.getString("subDirectory"));
  c.setToReference(formData.getString("toReference"));
  c.setDateFormat(formData.getString("dateFormat"));
  c.setTimeZone(formData.getString("timeZone"));
  c.setIgnoreCommitsIfMessageMatches(formData.getString("ignoreCommitsIfMessageMatches"));
  c.setUseIgnoreTagsIfNameMatches(formData.getBoolean("useIgnoreTagsIfNameMatches"));
  c.setIgnoreTagsIfNameMatches(formData.getString("ignoreTagsIfNameMatches"));

  c.setUseJira(formData.getBoolean("useJira"));
  c.setJiraServer(formData.getString("jiraServer"));
  c.setJiraIssuePattern(formData.getString("jiraIssuePattern"));
  c.setJiraUsername(formData.getString("jiraUsername"));
  c.setJiraPassword(formData.getString("jiraPassword"));

  c.setUseGitHub(formData.getBoolean("useGitHub"));
  c.setGitHubApi(formData.getString("gitHubApi"));
  c.setGitHubIssuePattern(formData.getString("gitHubIssuePattern"));
  c.setGitHubToken(formData.getString("gitHubToken"));

  c.setNoIssueName(formData.getString("noIssueName"));
  c.setIgnoreCommitsWithoutIssue(formData.getBoolean("ignoreCommitsWithoutIssue"));
  c.setUntaggedName(formData.getString("untaggedName"));
  c.setUseReadableTagName(formData.getBoolean("useReadableTagName"));
  c.setReadableTagName(formData.getString("readableTagName"));
  c.setUseMediaWiki(formData.getBoolean("useMediaWiki"));
  c.setMediaWikiUsername(formData.getString("mediaWikiUsername"));
  c.setMediaWikiPassword(formData.getString("mediaWikiPassword"));
  c.setMediaWikiTitle(formData.getString("mediaWikiTitle"));
  c.setMediaWikiUrl(formData.getString("mediaWikiUrl"));
  c.setUseFile(formData.getBoolean("useFile"));
  c.setFile(formData.getString("file"));
  c.setShowSummary(formData.getBoolean("showSummary"));

  c.setMediaWikiUseTemplateFile(formData.getBoolean("mediaWikiUseTemplateFile"));
  c.setMediaWikiTemplateFile(formData.getString("mediaWikiTemplateFile"));
  c.setMediaWikiUseTemplateContent(formData.getBoolean("mediaWikiUseTemplateContent"));
  c.setMediaWikiTemplateContent(formData.getString("mediaWikiTemplateContent"));

  c.setCreateFileUseTemplateFile(formData.getBoolean("createFileUseTemplateFile"));
  c.setCreateFileTemplateFile(formData.getString("createFileTemplateFile"));
  c.setCreateFileUseTemplateContent(formData.getBoolean("createFileUseTemplateContent"));
  c.setCreateFileTemplateContent(formData.getString("createFileTemplateContent"));

  c.setShowSummaryUseTemplateFile(formData.getBoolean("showSummaryUseTemplateFile"));
  c.setShowSummaryTemplateFile(formData.getString("showSummaryTemplateFile"));
  c.setShowSummaryUseTemplateContent(formData.getBoolean("showSummaryUseTemplateContent"));
  c.setShowSummaryTemplateContent(formData.getString("showSummaryTemplateContent"));

  c.setCustomIssues(new ArrayList<CustomIssue>());
  for (int i = 0; i < formData.getJSONArray("name").size(); i++) {
   String name = (String) formData.getJSONArray("name").get(i);
   String pattern = (String) formData.getJSONArray("pattern").get(i);
   String link = (String) formData.getJSONArray("link").get(i);
   String title = (String) formData.getJSONArray("title").get(i);
   if (!isNullOrEmpty(name) && !isNullOrEmpty(pattern)) {
    c.getCustomIssues().add(new CustomIssue(name, pattern, link, title));
   }
  }
  c.getCustomIssues().add(new CustomIssue("", "", "", ""));
  c.getCustomIssues().add(new CustomIssue("", "", "", ""));

  GitChangelogRecorder publisher = new GitChangelogRecorder();
  publisher.setConfig(c);
  return publisher;
 }
}


text:
package org.apache.kylin.cube.inmemcubing;

import java.io.IOException;

import org.apache.kylin.gridtable.GTRecord;
import org.apache.kylin.gridtable.GridTable;

/**
 */
public class CompoundCuboidWriter implements ICuboidWriter {

    private Iterable<ICuboidWriter> cuboidWriters;

    public CompoundCuboidWriter(Iterable<ICuboidWriter> cuboidWriters) {
        this.cuboidWriters = cuboidWriters;

    }

    @Override
    public void write(long cuboidId, GTRecord record) throws IOException {
        for (ICuboidWriter writer : cuboidWriters) {
            writer.write(cuboidId, record);
        }
    }

    @Override
    public void write(long cuboidId, GridTable table) throws IOException {
        for (ICuboidWriter writer : cuboidWriters) {
            writer.write(cuboidId, table);
        }
    }

    @Override
    public void flush() throws IOException {
        for (ICuboidWriter writer : cuboidWriters) {
            writer.flush();
        }

    }

    @Override
    public void close() throws IOException {
        for (ICuboidWriter writer : cuboidWriters) {
            writer.close();
        }

    }
}