text:
package com.conveyal.gtfs.api.graphql.types;

import com.conveyal.gtfs.api.graphql.fetchers.TripDataFetcher;
import graphql.schema.GraphQLObjectType;
import graphql.schema.GraphQLTypeReference;

import static com.conveyal.gtfs.api.util.GraphQLUtil.*;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;

/**
 * Created by landon on 10/3/16.
 */
public class StopTimeType {
    public static GraphQLObjectType build () {
        return newObject()
                .name("stopTime")
                .field(intt("arrival_time"))
                .field(intt("departure_time"))
                .field(intt("stop_sequence"))
                .field(string("stop_id"))
                .field(string("stop_headsign"))
                .field(doublee("shape_dist_traveled"))
                .field(feed())
                .field(newFieldDefinition()
                        .name("trip")
                        .type(new GraphQLTypeReference("trip"))
                        .dataFetcher(TripDataFetcher::fromStopTime)
                        .argument(stringArg("date"))
                        .argument(longArg("from"))
                        .argument(longArg("to"))
                        .build()
                )
                .build();
    }
}


text:
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 22.1.3.29
description: Array.prototype.values `name` property
info: >
    ES6 Section 17:

    Every built-in Function object, including constructors, that is not
    identified as an anonymous function has a name property whose value is a
    String. Unless otherwise specified, this value is the name that is given to
    the function in this specification.

    [...]

    Unless otherwise specified, the name property of a built-in Function
    object, if it exists, has the attributes { [[Writable]]: false,
    [[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
---*/

assert.sameValue(Array.prototype.values.name, 'values');

verifyNotEnumerable(Array.prototype.values, 'name');
verifyNotWritable(Array.prototype.values, 'name');
verifyConfigurable(Array.prototype.values, 'name');

redpajama_set_name: RedPajamaGithub


text:
security delete-keychain ios-build.keychain

# Remove provisioning profile
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/*

echo "*********************************"
echo "*       KeyChain Destroyed      *"
echo "*********************************"


text:
package com.navercorp.pinpoint.plugin.rxjava;

import com.navercorp.pinpoint.plugin.rxjava.runners.ConnectableObservableTestRunner;
import com.navercorp.pinpoint.plugin.rxjava.runners.GroupedObservableTestRunner;
import com.navercorp.pinpoint.plugin.rxjava.runners.ObservableTestRunner;
import com.navercorp.pinpoint.plugin.rxjava.runners.SingleTestRunner;
import com.navercorp.pinpoint.test.plugin.Dependency;
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * @author HyunGil Jeong
 */
@RunWith(PinpointPluginTestSuite.class)
// rxjava plugin enabled + custom trace method config
@PinpointConfig("rxjava/pinpoint-rxjava.config")
@Dependency({"io.reactivex:rxjava:[1.1.1,1.1.5]"})
public class RxJava_1_1_1_to_1_1_5_IT {

    private final ObservableTestRunner observableTestRunner = new ObservableTestRunner();
    private final ConnectableObservableTestRunner connectableObservableTestRunner = new ConnectableObservableTestRunner();
    private final GroupedObservableTestRunner groupedObservableTestRunner = new GroupedObservableTestRunner();

    private final SingleTestRunner singleTestRunner = new SingleTestRunner();

    @Test
    public void observable() throws Exception {
        observableTestRunner.observable();
    }

    @Test
    public void observableError() throws Exception {
        observableTestRunner.observableError();
    }

    @Test
    public void blockingObservable() throws Exception {
        observableTestRunner.blockingObservable();
    }

    @Test
    public void connectableObservable() throws Exception {
        connectableObservableTestRunner.connectableObservable();
    }

    @Test
    public void connectableObservableError() throws Exception {
        connectableObservableTestRunner.connectableObservableError();
    }

    @Test
    public void groupedObservable() throws Exception {
        groupedObservableTestRunner.groupedObservable();
    }

    @Test
    public void single() throws Exception {
        singleTestRunner.single();
    }

    @Test
    public void singleError() throws Exception {
        singleTestRunner.singleError();
    }

    @Test
    public void blockingSingle() throws Exception {
        singleTestRunner.blockingSingle();
    }
}


text:
<LinearLayout
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="name.xunicorn.iocipherbrowserext.activities.UpdateActivity"  >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:elevation="4dp"
            android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
            android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            />

        <TableLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="10dp">

            <TableRow
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

                <TextView
                    android:text="@string/txtCurrentVersion"
                    android:layout_column="1"
                    android:textSize="15dp"/>

                <TextView
                    android:id="@+id/tvCurrentVersion"
                    android:layout_column="2"
                    android:textSize="15dp"
                    android:layout_marginLeft="5dp"/>

            </TableRow>
            <TableRow
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

                <TextView
                    android:text="@string/txtLatestVersion"
                    android:layout_column="1"
                    android:textSize="15dp"/>

                <TextView
                    android:id="@+id/tvLatestVersion"
                    android:text="@string/txtLatestVersionUnknown"
                    android:layout_column="2"
                    android:textStyle="bold"
                    android:textSize="15dp"
                    android:layout_marginLeft="5dp"
                    />
            </TableRow>
        </TableLayout>

        <TextView
            android:id="@+id/tvUpdateHint"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="@string/txtUpdatingHint"
            android:textSize="20dp"
            android:padding="5dp"
            android:textAlignment="center"
            />

        <Button
            android:id="@+id/btnUpdate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/btnUpdate"
            android:layout_gravity="center_horizontal"
            android:visibility="gone"
            android:background="@drawable/red_button"
            android:textColor="#fff"
            />

        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/progressBar"
            android:layout_gravity="center_horizontal"/>

    <ProgressBar
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/progressBarDownload"
        android:layout_gravity="center_horizontal"
        android:padding="5dp"
        android:visibility="gone"/>

</LinearLayout>


text:
using System;
using System.Linq;

using Ninject;
using Ninject.Activation;
using Ninject.Extensions.Factory;
using Ninject.Modules;
using Ninject.Parameters;
using Ninject.Web.Common;

using RememBeer.Business.Logic.Common;
using RememBeer.Business.Logic.MvpPresenterFactory;
using RememBeer.Business.Services;
using RememBeer.Business.Services.Contracts;
using RememBeer.Business.Services.RankingStrategies;
using RememBeer.Business.Services.RankingStrategies.Contracts;
using RememBeer.Common.Configuration;
using RememBeer.Common.Services;
using RememBeer.Common.Services.Contracts;
using RememBeer.Models.Identity;
using RememBeer.Models.Identity.Contracts;

using WebFormsMvp;
using WebFormsMvp.Binder;

namespace RememBeer.CompositionRoot.NinjectModules
{
    public class BusinessNinjectModule : NinjectModule
    {
        /// <summary>Loads the module into the kernel.</summary>
        public override void Load()
        {
            this.Bind<IPresenterFactory>().To<MvpPresenterFactory>().InSingletonScope();

            this.Bind<IMvpPresenterFactory>().ToFactory().InSingletonScope();

            this.Bind<ICustomEventArgsFactory>().ToFactory().InSingletonScope();

            this.Bind<IPresenter>()
                .ToMethod(GetPresenter)
                .NamedLikeFactoryMethod(
                                        (IMvpPresenterFactory factory) => factory.GetPresenter(null, null)
                                       );

            this.Rebind<IIdentityHelper>().To<IdentityHelper>().InSingletonScope();
            this.Rebind<IConfigurationProvider>().To<ConfigurationProvider>().InSingletonScope();

            this.Bind<IRankCalculationStrategy>().To<DoubleOverallScoreStrategy>().InRequestScope();

            this.Bind<IImageUploadService>().To<CloudinaryImageUpload>();
            this.Rebind<IUserService>().To<UserService>().InRequestScope();
            this.Rebind<ITopBeersService>().To<TopBeersService>().InRequestScope();
            this.Rebind<IBeerReviewService>().To<BeerReviewService>().InRequestScope();
            this.Rebind<IBreweryService>().To<BreweryService>().InRequestScope();
        }

        private static IPresenter GetPresenter(IContext context)
        {
            var parameters = context.Parameters.ToList();

            var presenterType = (Type)parameters[0].GetValue(context, null);
            var viewInstance = (IView)parameters[1].GetValue(context, null);

            var ctorParamter = new ConstructorArgument("view", viewInstance);

            return (IPresenter)context.Kernel.Get(presenterType, ctorParamter);
        }
    }
}


text:
Go .DS_Store parser
==================

This is a quick and dirty Go parser for `.DS_Store` files. I focused on the extraction of file names and ignored other parameters.

It does not support the full set of structure formats, so it might break in some scenarios.

#Useful information:
The following descriptions and sourcecodes were quite helpful:
- <http://search.cpan.org/~wiml/Mac-Finder-DSStore/DSStoreFormat.pod>
- <https://wiki.mozilla.org/DS_Store_File_Format>

#Example code

```
package main

import (
	"fmt"
	"os"
	"flag"
	"github.com/gehaxelt/ds_store"
	"io/ioutil"
)

func main() {

	var fileName string

	flag.StringVar(&fileName, "i", "", "DS_Store input file")
	flag.Parse()

	if fileName == "" {
		panic("FileName (-i): Must be specified")
	} else if _, err := os.Stat(fileName); os.IsNotExist(err) {
		panic("FileName (-i): File does not exist:" + fileName)
	}

	dat, err := ioutil.ReadFile(fileName)

	if err != nil {
		panic(err)
	}

	a, err := ds_store.NewAllocator(dat)

	filenames, err := a.TraverseFromRootNode()
	if err != nil {
		panic(err)
	}

	for _,f := range filenames {
		fmt.Printf("File: %s \n", f)
	}
}
```

```
./ds_storeviewer -i samples/DS_Store-2
File: joomlatools-files
File: joomlatools-files
File: joomlatools-files
File: joomlatools-files
```

# License
See License.md


text:
static jboolean JNI_ContentCaptureFeatures_IsEnabled(JNIEnv* env) {
  return content_capture::features::IsContentCaptureEnabled();
}

static jboolean
JNI_ContentCaptureFeatures_ShouldTriggerContentCaptureForExperiment(
    JNIEnv* env) {
  return content_capture::features::ShouldTriggerContentCaptureForExperiment();
}


text:
export interface IGithubAPIResponse<T> {
  total_count: number;
  items: T[];
}

export type SearchUserResponse = IGithubAPIResponse<IServerUser>;

export type SearchRepositoriesResponse = IGithubAPIResponse<IServerRepository>;

export interface IServerUser {
  id: number;
  login: string;
  avatar_url: string;
  html_url: string;
}

export interface IDetailedServerUser extends IServerUser {
  followers: number;
  following: number;
  public_repos: number;
  name: string;
  location: null | string;
}

export interface IServerRepository {
  id: number;
  open_issues: number;
  forks: number;
  stargazers_count: number;
  description: string;
  updated_at: string;
  name: string;
  html_url: string;
  language: string;
  owner: IServerUser;
}


text:
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

namespace MatchGenerator.Core
{
	public class SettingImporter
	{
		/// <summary>
		/// コートの配置などの設定情報を読み込む.
		/// 設定情報が見つからなかったらデフォルトの設定となる.
		/// </summary>
		/// <param name="filePath"></param>
		/// <returns></returns>
		/// <exception cref="FileFormatException">設定ファイルの形式がおかしい.</exception>
		/// <exception cref="IOException">ファイルを開くときにエラー発生. なんかよく分からない.</exception>
		/// <exception cref="System.Security.SecurityException">プログラムにファイルアクセス許可がない.</exception>
		/// <exception cref="UnauthorizedAccessException">ファイルが読み込み専用やったり, ディレクトリやったり, いろいろ.</exception>
		public LayoutInformation Import(string filePath)
		{
			Dictionary<string, string> setting_str = ReadAsDictionary(filePath);

			LayoutInformation layout_info = new LayoutInformation();
			layout_info.Row = setting_str.ContainsKey("Row") ? int.Parse(setting_str["Row"]) : 1;
			layout_info.Column = setting_str.ContainsKey("Column") ? int.Parse(setting_str["Column"]) : 3;
			layout_info.CourtCount = setting_str.ContainsKey("CourtCount") ? int.Parse(setting_str["CourtCount"]) : 3;

			return layout_info;
		}

		/// <summary>
		/// ファイルから設定を読み込んで, Dictionaryで返す.
		/// </summary>
		/// <remarks>
		/// <paramref name="filePath"/>がnullだったり, ファイルが見つからなかったら, 空のDictionaryを返す.
		/// ファイルが見つかったけど何かしらのエラーが出たときは例外発生.
		/// </remarks>
		/// <param name="filename">読み込むファイル名</param>
		/// <returns>読み込んだDictionary. 読み込めんかったら空のDictionary.</returns>
		/// <exception cref="FileFormatException">設定ファイルの形式がおかしい.</exception>
		/// <exception cref="IOException">ファイルを開くときにエラー発生. なんかよく分からない.</exception>
		/// <exception cref="System.Security.SecurityException">プログラムにファイルアクセス許可がない.</exception>
		/// <exception cref="UnauthorizedAccessException">ファイルが読み込み専用やったり, ディレクトリやったり, いろいろ.</exception>
		private Dictionary<string, string> ReadAsDictionary(string filePath)
		{
			IEnumerable<string> lines;
			try
			{
				lines = File.ReadLines(filePath);
			}
			#region 指定されたfilePathによって, ファイルが見つからなかった場合は, 空のDictionaryを返す.
			catch (ArgumentNullException)
			{
				return new Dictionary<string, string>();
			}
			catch (DirectoryNotFoundException)
			{
				return new Dictionary<string, string>();
			}
			catch (FileNotFoundException)
			{
				return new Dictionary<string, string>();
			}
			catch (PathTooLongException)
			{
				return new Dictionary<string, string>();
			}
			catch (ArgumentException)
			{
				return new Dictionary<string, string>();
			}
			#endregion

			Dictionary<string, string> setting_str = new Dictionary<string, string>();
			foreach (string line in lines)
			{
				string[] line_elements = line.Split(':');
				if (line_elements.Length != 2)
				{
					throw new FileFormatException("設定ファイルの項目と値の読み込みに失敗しました.");
				}

				try
				{
					setting_str.Add(line_elements[0], line_elements[1]);
				}
				catch (ArgumentNullException)
				{
					throw;
				}
				catch (ArgumentException)
				{
					// キーが重複してる...
					// 先に登録されているものを採用する. というわけで何もしない.
				}
			}

			return setting_str;
		}

		/// <summary>
		/// コートの配置などの設定情報を読み込む.
		/// 設定ファイルが既にあったら上書き.
		/// </summary>
		/// <param name="filePath">ファイルパス</param>
		/// <param name="layout_info">保存するコート配置設定</param>
		/// <exception cref="ArgumentNullException">引数<see cref="filePath"/>または<see cref="layout_info"/>がnull</exception>
		/// <exception cref="ArgumentException"><see cref="filePath"/>が空文字やったり, 無効な文字が含まれている.</exception>
		/// <exception cref="DirectoryNotFoundException"><see cref="filePath"/>が有効でないパス.例えばマップされていないドライブにあるなど.</exception>
		/// <exception cref="PathTooLongException">パス長すぎ.</exception>
		/// <exception cref="NotSupportedException"><see cref="filePath"/>の形式が無効. どういうのが無効なのかはよく分からん.</exception>
		/// <exception cref="System.Security.SecurityException">プログラムにファイルアクセス許可がない.</exception>
		/// <exception cref="UnauthorizedAccessException">ファイルが読み込み専用やったり, ディレクトリやったり, いろいろ.</exception>
		/// <exception cref="IOException">ファイルを開くときにエラー発生. なんかよく分からない.</exception>
		public void Export(string filePath, LayoutInformation layout_info)
		{
			#region 引数チェック
			if (filePath == null)
			{
				throw new ArgumentNullException(nameof(filePath));
			}
			if (layout_info == null)
			{
				throw new ArgumentNullException(nameof(layout_info));
			}
			#endregion

			Dictionary<string, string> setting_str = new Dictionary<string, string>();

			setting_str["Row"] = layout_info.Row.ToString();
			setting_str["Column"] = layout_info.Column.ToString();
			setting_str["CourtCount"] = layout_info.CourtCount.ToString();

			File.WriteAllLines(filePath, setting_str.Select(pair => pair.Key + ":" + pair.Value));
		}
	}
}


text:
package org.odlabs.wiquery.utils;

import org.apache.wicket.protocol.http.WebApplication;
import org.odlabs.wiquery.core.commons.WiQueryInstantiationListener;

/**
 * $Id$
 *
 * <p>
 * No longer required
 * </p>
 *
 * @see WiQueryInstantiationListener
 * @author Lionel Armanet
 * @since 0.5
 * @deprecated - all that this once did is now handled in the WiQueryInitializer
 */
@Deprecated
public abstract class WiQueryWebApplication extends WebApplication  {

}


text:
package org.scalatest.words

import org.scalatest.matchers.{MatchPatternMacro, MatchResult, Matcher}
import org.scalactic.Prettifier

/**
 * This class is part of the ScalaTest matchers DSL. Please see the documentation for Matchers for an overview of
 * the matchers DSL.
 *
 * @author Bill Venners
 * @author Chee Seng
 */
final class MatchPatternWord {

  import scala.language.experimental.macros

  /**
   * This method enables the following syntax:
   *
   *

   * result should matchPattern { case Person("Bob", _) => }
   *               ^
   *

   */
  def apply(right: PartialFunction[Any, _]) = macro MatchPatternMacro.matchPatternMatcher

  /**
   * Overrides toString to return "matchPattern"
   */
  override def toString: String = "matchPattern"
}


text:
package com.amazonaws.services.clouddirectory.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * Represents the output of a batch add facet to object operation.
 *

 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BatchAddFacetToObject implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * Represents the facet being added to the object.
     *

     */
    private SchemaFacet schemaFacet;
    /**
     *

     * The attributes to set on the object.
     *

     */
    private java.util.List<AttributeKeyAndValue> objectAttributeList;
    /**
     *

     * A reference to the object being mutated.
     *

     */
    private ObjectReference objectReference;

    /**
     *

     * Represents the facet being added to the object.
     *

     *
     * @param schemaFacet
     *        Represents the facet being added to the object.
     */

    public void setSchemaFacet(SchemaFacet schemaFacet) {
        this.schemaFacet = schemaFacet;
    }

    /**
     *

     * Represents the facet being added to the object.
     *

     *
     * @return Represents the facet being added to the object.
     */

    public SchemaFacet getSchemaFacet() {
        return this.schemaFacet;
    }

    /**
     *

     * Represents the facet being added to the object.
     *

     *
     * @param schemaFacet
     *        Represents the facet being added to the object.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchAddFacetToObject withSchemaFacet(SchemaFacet schemaFacet) {
        setSchemaFacet(schemaFacet);
        return this;
    }

    /**
     *

     * The attributes to set on the object.
     *

     *
     * @return The attributes to set on the object.
     */

    public java.util.List<AttributeKeyAndValue> getObjectAttributeList() {
        return objectAttributeList;
    }

    /**
     *

     * The attributes to set on the object.
     *

     *
     * @param objectAttributeList
     *        The attributes to set on the object.
     */

    public void setObjectAttributeList(java.util.Collection<AttributeKeyAndValue> objectAttributeList) {
        if (objectAttributeList == null) {
            this.objectAttributeList = null;
            return;
        }

        this.objectAttributeList = new java.util.ArrayList<AttributeKeyAndValue>(objectAttributeList);
    }

    /**
     *

     * The attributes to set on the object.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setObjectAttributeList(java.util.Collection)} or {@link #withObjectAttributeList(java.util.Collection)}
     * if you want to override the existing values.
     *

     *
     * @param objectAttributeList
     *        The attributes to set on the object.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchAddFacetToObject withObjectAttributeList(AttributeKeyAndValue... objectAttributeList) {
        if (this.objectAttributeList == null) {
            setObjectAttributeList(new java.util.ArrayList<AttributeKeyAndValue>(objectAttributeList.length));
        }
        for (AttributeKeyAndValue ele : objectAttributeList) {
            this.objectAttributeList.add(ele);
        }
        return this;
    }

    /**
     *

     * The attributes to set on the object.
     *

     *
     * @param objectAttributeList
     *        The attributes to set on the object.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchAddFacetToObject withObjectAttributeList(java.util.Collection<AttributeKeyAndValue> objectAttributeList) {
        setObjectAttributeList(objectAttributeList);
        return this;
    }

    /**
     *

     * A reference to the object being mutated.
     *

     *
     * @param objectReference
     *        A reference to the object being mutated.
     */

    public void setObjectReference(ObjectReference objectReference) {
        this.objectReference = objectReference;
    }

    /**
     *

     * A reference to the object being mutated.
     *

     *
     * @return A reference to the object being mutated.
     */

    public ObjectReference getObjectReference() {
        return this.objectReference;
    }

    /**
     *

     * A reference to the object being mutated.
     *

     *
     * @param objectReference
     *        A reference to the object being mutated.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public BatchAddFacetToObject withObjectReference(ObjectReference objectReference) {
        setObjectReference(objectReference);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getSchemaFacet() != null)
            sb.append("SchemaFacet: ").append(getSchemaFacet()).append(",");
        if (getObjectAttributeList() != null)
            sb.append("ObjectAttributeList: ").append(getObjectAttributeList()).append(",");
        if (getObjectReference() != null)
            sb.append("ObjectReference: ").append(getObjectReference());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof BatchAddFacetToObject == false)
            return false;
        BatchAddFacetToObject other = (BatchAddFacetToObject) obj;
        if (other.getSchemaFacet() == null ^ this.getSchemaFacet() == null)
            return false;
        if (other.getSchemaFacet() != null && other.getSchemaFacet().equals(this.getSchemaFacet()) == false)
            return false;
        if (other.getObjectAttributeList() == null ^ this.getObjectAttributeList() == null)
            return false;
        if (other.getObjectAttributeList() != null && other.getObjectAttributeList().equals(this.getObjectAttributeList()) == false)
            return false;
        if (other.getObjectReference() == null ^ this.getObjectReference() == null)
            return false;
        if (other.getObjectReference() != null && other.getObjectReference().equals(this.getObjectReference()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getSchemaFacet() == null) ? 0 : getSchemaFacet().hashCode());
        hashCode = prime * hashCode + ((getObjectAttributeList() == null) ? 0 : getObjectAttributeList().hashCode());
        hashCode = prime * hashCode + ((getObjectReference() == null) ? 0 : getObjectReference().hashCode());
        return hashCode;
    }

    @Override
    public BatchAddFacetToObject clone() {
        try {
            return (BatchAddFacetToObject) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.clouddirectory.model.transform.BatchAddFacetToObjectMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) Patrick Plenefisch 2012. All Rights Reserved.			      */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
/*----------------------------------------------------------------------------*/

#ifndef LIVEWINDOWSENDABLE_H_
#define LIVEWINDOWSENDABLE_H_

#include "SmartDashboard/Sendable.h"

/**
 * Live Window Sendable is a special type of object sendable to the live window.
 *
 * @author Patrick Plenefisch
 */
class LiveWindowSendable: public Sendable
{
public:
    /**
     * Update the table for this sendable object with the latest
     * values.
     */
    virtual void UpdateTable() = 0;

    /**
     * Start having this sendable object automatically respond to
     * value changes reflect the value on the table.
     */
    virtual void StartLiveWindowMode() = 0;

    /**
     * Stop having this sendable object automatically respond to value
     * changes.
     */
    virtual void StopLiveWindowMode() = 0;
};

#endif /* LIVEWINDOWSENDABLE_H_ */


text:
package complex;

import complex.data.Constraint;

/**
 * Created by JanDennis on 04.06.2016.
 */
public class ConstraintChecker {
  public static boolean check(Constraint how, Integer value1, Integer value2) {

    switch (how) {
      case gleich:
        return value1.intValue() == value2.intValue();

      case ungleich:
        return (value1.intValue() != value2.intValue());

      case linksvon:
        return value1.intValue() < value2.intValue();

      case rechtsvon:
        return value1.intValue() > value2.intValue();

      case neben:
        return (Math.abs(value1.intValue() - value2.intValue()) == 1);

      case mittleresHaus:
        return value1.intValue() == 2;

      case erstesHaus:
        return value1.intValue() == 0;

      default:
        throw new RuntimeException("WRONG CHECK " + how);
    }
  }
}


text:
package io.amient.kafka.prism.projector;

abstract class HashFunction {

    /**
     * @param k 32-bit natural number key
     * @param m 32-bit hash table size
     * @return natural number p, 0 ≤ p < m
     */
    abstract int compute(int k, int m);

    static class ModuloMethod extends HashFunction {
        @Override
        public int compute(int k, int m) {
            return k % m;
        }
    }

    static class MutiplicationMethod extends HashFunction {
        @Override
        public int compute(int k, int m) {
            final double A = 0.6180339887;
            double f = (k * A) % 1;
            return (int) (m * f);
        }
    }

}


text:
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <boost/program_options/cmdline.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>

#include "Config.h"
#include "version.h"

using namespace boost::program_options;

namespace i2p {
namespace config {
  options_description m_OptionsDesc;
  variables_map       m_Options;

  /* list of renamed options */
  std::map<std::string, std::string> remapped_options = {
    { "tunnelscfg",          "tunconf" },
    { "v6",                  "ipv6" },
    { "httpaddress",         "http.address" },
    { "httpport",            "http.port"    },
    { "httpproxyaddress",    "httpproxy.address"  },
    { "httpproxyport",       "httpproxy.port"     },
    { "socksproxyaddress",   "socksproxy.address" },
    { "socksproxyport",      "socksproxy.port"    },
    { "samaddress",          "sam.address" },
    { "samport",             "sam.port"    },
    { "bobaddress",          "bob.address" },
    { "bobport",             "bob.port"    },
    { "i2pcontroladdress",   "i2pcontrol.address" },
    { "i2pcontroladdress",   "i2pcontrol.port"    },
    { "proxykeys",           "httpproxy.keys" },
  };
  /* list of options, that loose their argument and become simple switch */
  std::set<std::string> boolean_options = {
    "daemon", "floodfill", "notransit", "service", "ipv6"
  };

  /* this function is a solid piece of shit, remove it after 2.6.0 */
  std::pair<std::string, std::string> old_syntax_parser(const std::string& s) {
    std::string name  = "";
    std::string value = "";
    std::size_t pos = 0;
    /* shortcuts -- -h */
    if (s.length() == 2 && s.at(0) == '-' && s.at(1) != '-')
      return make_pair(s.substr(1), "");
    /* old-style -- -log, /log, etc */
    if (s.at(0) == '/' || (s.at(0) == '-' && s.at(1) != '-')) {
      if ((pos = s.find_first_of("= ")) != std::string::npos) {
        name  = s.substr(1, pos - 1);
        value = s.substr(pos + 1);
      } else {
        name  = s.substr(1, pos);
        value = "";
      }
      if (boolean_options.count(name) > 0 && value != "")
        std::cerr << "args: don't give an argument to switch option: " << s << std::endl;
      if (m_OptionsDesc.find_nothrow(name, false)) {
        std::cerr << "args: option " << s << " style is DEPRECATED, use --" << name << " instead" << std::endl;
        return std::make_pair(name, value);
      }
      if (remapped_options.count(name) > 0) {
        name = remapped_options[name];
        std::cerr << "args: option " << s << " is DEPRECATED, use --" << name << " instead" << std::endl;
        return std::make_pair(name, value);
      } /* else */
    }
    /* long options -- --help */
    if (s.substr(0, 2) == "--") {
      if ((pos = s.find_first_of("= ")) != std::string::npos) {
        name  = s.substr(2, pos - 2);
        value = s.substr(pos + 1);
      } else {
        name  = s.substr(2, pos);
        value = "";
      }
      if (boolean_options.count(name) > 0 && value != "") {
        std::cerr << "args: don't give an argument to switch option: " << s << std::endl;
        value = "";
      }
      if (m_OptionsDesc.find_nothrow(name, false))
        return std::make_pair(name, value);
      if (remapped_options.count(name) > 0) {
        name = remapped_options[name];
        std::cerr << "args: option " << s << " is DEPRECATED, use --" << name << " instead" << std::endl;
        return std::make_pair(name, value);
      } /* else */
    }
    std::cerr << "args: unknown option -- " << s << std::endl;
    return std::make_pair("", "");
  }

  void Init() {
    options_description general("General options");
    general.add_options()
      ("help",     "Show this message")
      ("conf",      value<std::string>()->default_value(""),     "Path to main i2pd config file (default: try ~/.i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf)")
      ("tunconf",   value<std::string>()->default_value(""),     "Path to config with tunnels list and options (default: try ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf)")
      ("pidfile",   value<std::string>()->default_value(""),     "Path to pidfile (default: ~/i2pd/i2pd.pid or /var/lib/i2pd/i2pd.pid)")
      ("log",       value<std::string>()->default_value(""),     "Logs destination: stdout, file, syslog (stdout if not set)")
      ("logfile",   value<std::string>()->default_value(""),     "Path to logfile (stdout if not set, autodetect if daemon)")
      ("loglevel",  value<std::string>()->default_value("info"), "Set the minimal level of log messages (debug, info, warn, error)")
	  ("family",    value<std::string>()->default_value(""),     "Specify a family, router belongs to")
	  ("datadir",   value<std::string>()->default_value(""),     "Path to storage of i2pd data (RI, keys, peer profiles, ...)")
      ("host",      value<std::string>()->default_value("0.0.0.0"),     "External IP")
      ("port",      value<uint16_t>()->default_value(0),                "Port to listen for incoming connections (default: auto)")
      ("ipv4",      value<bool>()->zero_tokens()->default_value(true),  "Enable communication through ipv4")
      ("ipv6",      value<bool>()->zero_tokens()->default_value(false), "Enable communication through ipv6")
      ("daemon",    value<bool>()->zero_tokens()->default_value(false), "Router will go to background after start")
      ("service",   value<bool>()->zero_tokens()->default_value(false), "Router will use system folders like '/var/lib/i2pd'")
      ("notransit", value<bool>()->zero_tokens()->default_value(false), "Router will not accept transit tunnels at startup")
      ("floodfill", value<bool>()->zero_tokens()->default_value(false), "Router will be floodfill")
      ("bandwidth", value<std::string>()->default_value(""), "Bandwidth limit: integer in kbps or letters: L (32), O (256), P (2048), X (>9000)")
#ifdef _WIN32
      ("svcctl",    value<std::string>()->default_value(""),     "Windows service management ('install' or 'remove')")
      ("insomnia", value<bool>()->zero_tokens()->default_value(false), "Prevent system from sleeping")
      ("close", value<std::string>()->default_value("ask"), "Action on close: minimize, exit, ask") // TODO: add custom validator or something
#endif
      ;

    options_description httpserver("HTTP Server options");
    httpserver.add_options()
      ("http.enabled",        value<bool>()->default_value(true),               "Enable or disable webconsole")
      ("http.address",        value<std::string>()->default_value("127.0.0.1"), "Webconsole listen address")
      ("http.port",           value<uint16_t>()->default_value(7070),           "Webconsole listen port")
      ;

    options_description httpproxy("HTTP Proxy options");
    httpproxy.add_options()
      ("httpproxy.enabled",   value<bool>()->default_value(true),                         "Enable or disable HTTP Proxy")
      ("httpproxy.address",   value<std::string>()->default_value("127.0.0.1"),           "HTTP Proxy listen address")
      ("httpproxy.port",      value<uint16_t>()->default_value(4444),                     "HTTP Proxy listen port")
      ("httpproxy.keys",      value<std::string>()->default_value(""),  "File to persist HTTP Proxy keys")
      ;

    options_description socksproxy("SOCKS Proxy options");
    socksproxy.add_options()
      ("socksproxy.enabled",  value<bool>()->default_value(true),                         "Enable or disable SOCKS Proxy")
      ("socksproxy.address",  value<std::string>()->default_value("127.0.0.1"),           "SOCKS Proxy listen address")
      ("socksproxy.port",     value<uint16_t>()->default_value(4447),                     "SOCKS Proxy listen port")
      ("socksproxy.keys",     value<std::string>()->default_value(""), "File to persist SOCKS Proxy keys")
      ("socksproxy.outproxy", value<std::string>()->default_value("127.0.0.1"), "Upstream outproxy address for SOCKS Proxy")
      ("socksproxy.outproxyport", value<uint16_t>()->default_value(9050), "Upstream outproxy port for SOCKS Proxy")
      ;

    options_description sam("SAM bridge options");
    sam.add_options()
      ("sam.enabled",         value<bool>()->default_value(false),                        "Enable or disable SAM Application bridge")
      ("sam.address",         value<std::string>()->default_value("127.0.0.1"),           "SAM listen address")
      ("sam.port",            value<uint16_t>()->default_value(7656),                     "SAM listen port")
      ;

    options_description bob("BOB options");
    bob.add_options()
      ("bob.enabled",         value<bool>()->default_value(false),                        "Enable or disable BOB command channel")
      ("bob.address",         value<std::string>()->default_value("127.0.0.1"),           "BOB listen address")
      ("bob.port",            value<uint16_t>()->default_value(2827),                     "BOB listen port")
      ;

    options_description i2pcontrol("I2PControl options");
    i2pcontrol.add_options()
      ("i2pcontrol.enabled",  value<bool>()->default_value(false),                        "Enable or disable I2P Control Protocol")
      ("i2pcontrol.address",  value<std::string>()->default_value("127.0.0.1"),           "I2PCP listen address")
      ("i2pcontrol.port",     value<uint16_t>()->default_value(7650),                     "I2PCP listen port")
      ("i2pcontrol.password", value<std::string>()->default_value("itoopie"),             "I2PCP access password")
      ("i2pcontrol.cert",     value<std::string>()->default_value("i2pcontrol.crt.pem"),  "I2PCP connection cerificate")
      ("i2pcontrol.key",      value<std::string>()->default_value("i2pcontrol.key.pem"),  "I2PCP connection cerificate key")
      ;

    m_OptionsDesc
      .add(general)
      .add(httpserver)
      .add(httpproxy)
      .add(socksproxy)
      .add(sam)
      .add(bob)
      .add(i2pcontrol)
      ;
  }

  void ParseCmdline(int argc, char* argv[]) {
    try {
      auto style = boost::program_options::command_line_style::unix_style
                 | boost::program_options::command_line_style::allow_long_disguise;
      style &=   ~ boost::program_options::command_line_style::allow_guessing;
      store(parse_command_line(argc, argv, m_OptionsDesc, style, old_syntax_parser), m_Options);
    } catch (boost::program_options::error& e) {
      std::cerr << "args: " << e.what() << std::endl;
      exit(EXIT_FAILURE);
    }

    if (m_Options.count("help") || m_Options.count("h")) {
      std::cout << "i2pd version " << I2PD_VERSION << " (" << I2P_VERSION << ")" << std::endl;
      std::cout << m_OptionsDesc;
      exit(EXIT_SUCCESS);
    }
  }

  void ParseConfig(const std::string& path) {
    if (path == "") return;

    std::ifstream config(path, std::ios::in);

    if (!config.is_open())
	{
      std::cerr << "missing/unreadable config file: " << path << std::endl;
      exit(EXIT_FAILURE);
    }

    try
	{
		store(boost::program_options::parse_config_file(config, m_OptionsDesc), m_Options);
    }
	catch (boost::program_options::error& e)
	{
      std::cerr << e.what() << std::endl;
      exit(EXIT_FAILURE);
    };
  }

  void Finalize() {
    notify(m_Options);
  }

  bool IsDefault(const char *name) {
    if (!m_Options.count(name))
      throw "try to check non-existent option";

    if (m_Options[name].defaulted())
      return true;
    return false;
  }
} // namespace config
} // namespace i2p


text:
package com.microsoft.azure.management.mediaservices.v2019_05_01_preview.implementation;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The Asset Storage container SAS URLs.
 */
public class AssetContainerSasInner {
    /**
     * The list of Asset container SAS URLs.
     */
    @JsonProperty(value = "assetContainerSasUrls")
    private List<String> assetContainerSasUrls;

    /**
     * Get the list of Asset container SAS URLs.
     *
     * @return the assetContainerSasUrls value
     */
    public List<String> assetContainerSasUrls() {
        return this.assetContainerSasUrls;
    }

    /**
     * Set the list of Asset container SAS URLs.
     *
     * @param assetContainerSasUrls the assetContainerSasUrls value to set
     * @return the AssetContainerSasInner object itself.
     */
    public AssetContainerSasInner withAssetContainerSasUrls(List<String> assetContainerSasUrls) {
        this.assetContainerSasUrls = assetContainerSasUrls;
        return this;
    }

}


text:
iotstartup add headless tempprovider
iotstartup add headless luxprovider
iotstartup add headless mqttbroker


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/services/multidevice_setup/public/cpp/first_run_field_trial.h"

#include "ash/constants/ash_features.h"
#include "base/containers/contains.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/field_trial.h"
#include "base/system/sys_info.h"

namespace ash {

namespace multidevice_setup {

namespace {

// Note: The trial name *must* match the study name in the server-side
// configuration.
const char kInstantTetheringTrialName[] = "Instant Tethering";
const char kInstantTetheringGroupName[] = "InstantTethering_FirstRunTrial";

constexpr const char* const kBoardsToEnableInstantTethering[] = {"eve",
                                                                 "nocturne"};

}  // namespace

void CreateFirstRunFieldTrial(base::FeatureList* feature_list) {
  // If the hardware name of the current device is not one of the board names in
  // |kBoardsToEnableInstantTethering|, nothing needs to be done.
  if (!base::Contains(kBoardsToEnableInstantTethering,
                      base::SysInfo::HardwareModelName())) {
    return;
  }

  // Instant Tethering is controlled by a flag which is off by default. The flag
  // is enabled via a server-side configuration for some devices, but these
  // configurations do not take effect on the first run. For those devices,
  // enable Instant Tethering for this first run; on subsequent runs, the
  // server-side configuration will be used instead.
  scoped_refptr<base::FieldTrial> trial(
      base::FieldTrialList::FactoryGetFieldTrial(
          kInstantTetheringTrialName, 100 /* total_probability */,
          kInstantTetheringGroupName, base::FieldTrial::ONE_TIME_RANDOMIZED,
          nullptr /* default_group_number */));
  feature_list->RegisterFieldTrialOverride(
      features::kInstantTethering.name,
      base::FeatureList::OVERRIDE_ENABLE_FEATURE, trial.get());
}

}  // namespace multidevice_setup

}  // namespace ash


text:
package org.apache.druid.query.groupby.epinephelinae.column;

import org.apache.druid.query.groupby.ResultRow;
import org.apache.druid.query.groupby.epinephelinae.Grouper;
import org.apache.druid.query.groupby.epinephelinae.GrouperBufferComparatorUtils;
import org.apache.druid.query.ordering.StringComparator;
import org.apache.druid.segment.ColumnValueSelector;
import org.apache.druid.segment.DimensionHandlerUtils;

import javax.annotation.Nullable;
import java.nio.ByteBuffer;

public class FloatGroupByColumnSelectorStrategy implements GroupByColumnSelectorStrategy
{

  @Override
  public int getGroupingKeySize()
  {
    return Float.BYTES;
  }

  @Override
  public void processValueFromGroupingKey(
      GroupByColumnSelectorPlus selectorPlus,
      ByteBuffer key,
      ResultRow resultRow,
      int keyBufferPosition
  )
  {
    final float val = key.getFloat(keyBufferPosition);
    resultRow.set(selectorPlus.getResultRowPosition(), val);
  }

  @Override
  public int initColumnValues(ColumnValueSelector selector, int columnIndex, Object[] valuess)
  {
    valuess[columnIndex] = selector.getFloat();
    return 0;
  }

  @Override
  public int writeToKeyBuffer(int keyBufferPosition, ColumnValueSelector selector, ByteBuffer keyBuffer)
  {
    keyBuffer.putFloat(keyBufferPosition, selector.getFloat());
    return 0;
  }

  @Override
  public Grouper.BufferComparator bufferComparator(
      int keyBufferPosition,
      @Nullable StringComparator stringComparator
  )
  {
    return GrouperBufferComparatorUtils.makeBufferComparatorForFloat(
        keyBufferPosition,
        true,
        stringComparator
    );
  }

  @Override
  public void initGroupingKeyColumnValue(
      int keyBufferPosition,
      int dimensionIndex,
      Object rowObj,
      ByteBuffer keyBuffer,
      int[] stack
  )
  {
    writeToKeyBuffer(keyBufferPosition, DimensionHandlerUtils.nullToZero((Float) rowObj), keyBuffer);
    stack[dimensionIndex] = 1;
  }

  @Override
  public boolean checkRowIndexAndAddValueToGroupingKey(
      int keyBufferPosition,
      Object rowObj,
      int rowValIdx,
      ByteBuffer keyBuffer
  )
  {
    // rows from a float column always have a single value, multi-value is not currently supported
    // this method handles row values after the first in a multivalued row, so just return false
    return false;
  }

  @Override
  public void reset()
  {
    // Nothing to do.
  }

  private void writeToKeyBuffer(int keyBufferPosition, float value, ByteBuffer keyBuffer)
  {
    keyBuffer.putFloat(keyBufferPosition, value);
  }
}


text:
package uk.ac.cam.cl.dtg.picky.client.binding;

import javafx.beans.binding.ObjectBinding;
import javafx.beans.binding.StringBinding;
import de.ecclesia.kipeto.engine.Plan;

public class PlanStringBinding extends StringBinding {

	private ObjectBinding<Plan> plan;
	private PlanToString planToString;

	public static interface PlanToString {
		public String compute(Plan plan);
	}

	public PlanStringBinding(ObjectBinding<Plan> plan, PlanToString planToString) {
		this.plan = plan;
		this.planToString = planToString;
		bind(plan);
	}

	@Override
	protected String computeValue() {
		return planToString.compute(plan.get());
	}

}


text:
using System.Collections.Generic;
using System.Threading.Tasks;
using SuperGlue.Configuration;
using SuperGlue.Configuration.Ioc;

namespace SuperGlue.EventStore.Subscribers
{
    public class ConfigureSubscribers : ISetupConfigurations
    {
        public IEnumerable<ConfigurationSetupResult> Setup(string applicationEnvironment)
        {
            yield return new ConfigurationSetupResult("superglue.EventStoreSubscribersSetup", environment =>
            {
                environment.AlterSettings<IocConfiguration>(x => x.Register(typeof(ISubscriberInstaller), typeof(DefaultSubscriberInstaller))
                    .Scan(typeof(ISubscribeTo<>)));

                environment.AlterSettings<SubscribersSettings>(x => x.FindPersistentSubscriptionNameUsing((serviceName, stream) => $"{serviceName}-{stream}"));

                return Task.CompletedTask;
            }, "superglue.ContainerSetup");
        }
    }
}


text:
package io.zhuliang.appchooser.data;

import java.util.List;

import androidx.annotation.NonNull;

import static io.zhuliang.appchooser.internal.Preconditions.checkNotNull;

/**
 * @author Zhu Liang
 * @version 1.0
 * @since 2017/4/15 下午1:59
 */
public class MediaTypesRepository implements MediaTypesDataSource {

    @NonNull
    private final MediaTypesDataSource mMediaTypesLocalDataSource;

    private List<MediaType> mCachedMediaTypes;

    public MediaTypesRepository(@NonNull MediaTypesDataSource mediaTypesLocalDataSource) {
        mMediaTypesLocalDataSource = checkNotNull(mediaTypesLocalDataSource);
    }

    @Override
    public List<MediaType> listMediaTypes() {
        if (mCachedMediaTypes == null) {
            mCachedMediaTypes = mMediaTypesLocalDataSource.listMediaTypes();
        }
        return mCachedMediaTypes;
    }
}


text:
'use strict';

import RunsClient from './runs/client';
import MembersClient from './members/client';
import MemberClient from './member/client';
import JobsClient from './jobs/client';
import JobClient from './job/client';

let apiClient;

class DrushIOProject {

  constructor(client, identifier, data = {}) {
    apiClient = client;
    this.identifier = identifier;
    this.data = data;
  }

  /**
   * Retrieves project details for this project.
   * @return {Promise}
   */
  get() {
    return new Promise((resolve, reject) => {
      apiClient.get(`/projects/${this.identifier}`).then((response) => {
        this.data = response.body;
        resolve(this)
      }).catch((err) => {
        reject(err);
      });
    });
  }

  /**
   * Updates this project's details.
   * @param {Object} details
   * @param {String} details.name
   * @param {String} details.label
   * @returns {Promise}
   */
  update(details) {
    return new Promise((resolve, reject) => {
      apiClient.patch(`/projects/${this.identifier}`, details).then((response) => {
        this.data = response.body;
        resolve(this);
      }).catch((err) => {
        reject(err);
      })
    });
  }

  jobs(identifier) {
    if (identifier) {
      return new JobClient(apiClient, this, identifier);
    }
    else {
      return new JobsClient(apiClient, this);
    }
  }

  members(identifier) {
    if (identifier) {
      return new MemberClient(apiClient, this, identifier);
    }
    else {
      return new MembersClient(apiClient, this);
    }
  }

  runs() {
    return new RunsClient(apiClient, this);
  }

}

export default DrushIOProject;


text:
<?php

/**
* We extend controller, which has the method model and view.
*/
class example extends Controller
{
  /**
  * init is the method called by default.
  * If there are not parameters, parameters will be 0 (false).
  */
  public function init($param = 0) {
    /**
    * Load the head view, with title parameter.
    */
    $this->view('head',['title' => 'Hello world!']);
    /**
    * load the exampleView, and pass all the parameters through to the view.
    */
    $this->view('exampleView',['parameters' => $param]);
  }
}


text:
package parser_test

import (
	"github.com/bytesparadise/libasciidoc/pkg/types"
	. "github.com/bytesparadise/libasciidoc/testsupport"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
)

var _ = Describe("sections", func() {

	Context("in final documents", func() {

		Context("valid sections", func() {

			It("header only", func() {
				source := "= a header"
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{
									Content: "a header",
								},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header with trailing spaces", func() {
				source := "= a header  "
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{
									Content: "a header",
								},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section with trailing spaces", func() {
				source := "== a section  "
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Level: 1,
							Attributes: types.Attributes{
								types.AttrID: "_a_section",
							},
							Title: []interface{}{
								&types.StringElement{
									Content: "a section",
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_a_section": []interface{}{
							&types.StringElement{
								Content: "a section",
							},
						},
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_a_section",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header and paragraph", func() {
				source := `= a header

and a paragraph`

				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Paragraph{
							Elements: []interface{}{
								&types.StringElement{Content: "and a paragraph"},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section with link in title", func() {
				source := `== link to https://foo.bar
`
				section1aTitle := []interface{}{
					&types.StringElement{Content: "link to "},
					&types.InlineLink{
						Location: &types.Location{
							Scheme: "https://",
							Path:   "foo.bar",
						},
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_link_to_httpsfoo_bar",
							},
							Level: 1,
							Title: section1aTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"_link_to_httpsfoo_bar": section1aTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_link_to_httpsfoo_bar",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header, section 1 and paragraph with bold quote", func() {
				source := `= a header

== section 1

a paragraph with *bold content*`

				section1Title := []interface{}{
					&types.StringElement{Content: "section 1"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Level: 1,
							Title: section1Title,
							Attributes: types.Attributes{
								types.AttrID: "_section_1",
							},
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph with "},
										&types.QuotedText{
											Kind: types.SingleQuoteBold,
											Elements: []interface{}{
												&types.StringElement{Content: "bold content"},
											},
										},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_1": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_1",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("two sections with level 0", func() {
				source := `= a first header

= a second header`
				otherDoctitle := []interface{}{
					&types.StringElement{Content: "a second header"},
				}

				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a first header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_a_second_header",
							},
							Level: 0,
							Title: otherDoctitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"_a_second_header": otherDoctitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_a_second_header",
								Level: 0,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 1 alone", func() {
				source := `== section 1`
				section1Title := []interface{}{
					&types.StringElement{Content: "section 1"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_1",
							},
							Level: 1,
							Title: section1Title,
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_1": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_1",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 1 with quoted text", func() {
				source := `==  *2 spaces and bold content*`
				sectionTitle := []interface{}{
					&types.QuotedText{
						Kind: types.SingleQuoteBold,
						Elements: []interface{}{
							&types.StringElement{Content: "2 spaces and bold content"},
						},
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_2_spaces_and_bold_content",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"_2_spaces_and_bold_content": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_2_spaces_and_bold_content",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 0 with nested section level 1", func() {
				source := `= a header

== section 1`
				section1Title := []interface{}{
					&types.StringElement{Content: "section 1"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_1",
							},
							Level: 1,
							Title: section1Title,
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_1": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_1",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 0 with nested section level 2", func() {
				source := `= a header

=== section 2`
				section2Title := []interface{}{
					&types.StringElement{Content: "section 2"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_2",
							},
							Level: 2,
							Title: section2Title,
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_2": section2Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_2",
								Level: 2,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 1 with immediate paragraph", func() {
				source := `== a title
and a paragraph`
				section1Title := []interface{}{
					&types.StringElement{Content: "a title"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_a_title",
							},
							Level: 1,
							Title: section1Title,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "and a paragraph"},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_a_title": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_a_title",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 1 with a paragraph separated by empty line", func() {
				source := `== a title

and a paragraph`
				section1Title := []interface{}{
					&types.StringElement{Content: "a title"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_a_title",
							},
							Level: 1,
							Title: section1Title,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "and a paragraph"},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_a_title": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_a_title",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 1 with a paragraph separated by non-empty line", func() {
				source := "== a title\n    \nand a paragraph"
				section1Title := []interface{}{
					&types.StringElement{Content: "a title"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_a_title",
							},
							Level: 1,
							Title: section1Title,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "and a paragraph"},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_a_title": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_a_title",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section levels 0, 1, 2, 1", func() {
				source := `= a header

== Section A
a paragraph

=== Section A.a
a paragraph

== Section B
a paragraph`
				sectionATitle := []interface{}{
					&types.StringElement{Content: "Section A"},
				}
				sectionAaTitle := []interface{}{
					&types.StringElement{Content: "Section A.a"},
				}
				sectionBTitle := []interface{}{
					&types.StringElement{Content: "Section B"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_a",
							},
							Level: 1,
							Title: sectionATitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
								&types.Section{
									Attributes: types.Attributes{
										types.AttrID: "_section_a_a",
									},
									Level: 2,
									Title: sectionAaTitle,
									Elements: []interface{}{
										&types.Paragraph{
											Elements: []interface{}{
												&types.StringElement{Content: "a paragraph"},
											},
										},
									},
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_b",
							},
							Level: 1,
							Title: sectionBTitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_a":   sectionATitle,
						"_section_a_a": sectionAaTitle,
						"_section_b":   sectionBTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_a",
								Level: 1,
								Children: []*types.ToCSection{
									{
										ID:    "_section_a_a",
										Level: 2,
									},
								},
							},
							{
								ID:    "_section_b",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section levels 0, 1, 2, 2", func() {
				source := `= a header

== Section A
a paragraph

=== Section A.a
a paragraph

=== Section A.b
a paragraph`
				sectionATitle := []interface{}{
					&types.StringElement{Content: "Section A"},
				}
				sectionAaTitle := []interface{}{
					&types.StringElement{Content: "Section A.a"},
				}
				sectionBTitle := []interface{}{
					&types.StringElement{Content: "Section A.b"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_a",
							},
							Level: 1,
							Title: sectionATitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
								&types.Section{
									Attributes: types.Attributes{
										types.AttrID: "_section_a_a",
									},
									Level: 2,
									Title: sectionAaTitle,
									Elements: []interface{}{
										&types.Paragraph{
											Elements: []interface{}{
												&types.StringElement{Content: "a paragraph"},
											},
										},
									},
								},
								&types.Section{
									Attributes: types.Attributes{
										types.AttrID: "_section_a_b",
									},
									Level: 2,
									Title: sectionBTitle,
									Elements: []interface{}{
										&types.Paragraph{
											Elements: []interface{}{
												&types.StringElement{Content: "a paragraph"},
											},
										},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_a":   sectionATitle,
						"_section_a_a": sectionAaTitle,
						"_section_a_b": sectionBTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_a",
								Level: 1,
								Children: []*types.ToCSection{
									{
										ID:    "_section_a_a",
										Level: 2,
									},
									{
										ID:    "_section_a_b",
										Level: 2,
									},
								},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section levels 0, 2, 3, 3", func() {
				source := `= a header

=== Section A
a paragraph

==== Section A.a
a paragraph

==== Section A.b
a paragraph`
				sectionATitle := []interface{}{
					&types.StringElement{Content: "Section A"},
				}
				sectionAaTitle := []interface{}{
					&types.StringElement{Content: "Section A.a"},
				}
				sectionAbTitle := []interface{}{
					&types.StringElement{Content: "Section A.b"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_a",
							},
							Level: 2,
							Title: sectionATitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
								&types.Section{
									Attributes: types.Attributes{
										types.AttrID: "_section_a_a",
									},
									Level: 3,
									Title: sectionAaTitle,
									Elements: []interface{}{
										&types.Paragraph{
											Elements: []interface{}{
												&types.StringElement{Content: "a paragraph"},
											},
										},
									},
								},
								&types.Section{
									Attributes: types.Attributes{
										types.AttrID: "_section_a_b",
									},
									Level: 3, // level is adjusted
									Title: sectionAbTitle,
									Elements: []interface{}{
										&types.Paragraph{
											Elements: []interface{}{
												&types.StringElement{Content: "a paragraph"},
											},
										},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_a":   sectionATitle,
						"_section_a_a": sectionAaTitle,
						"_section_a_b": sectionAbTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_a",
								Level: 2,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section levels 0, 2, 2, 2", func() {
				source := `= a header

=== Section A
a paragraph

=== Section B
a paragraph

=== Section C
a paragraph`
				sectionATitle := []interface{}{
					&types.StringElement{Content: "Section A"},
				}
				sectionBTitle := []interface{}{
					&types.StringElement{Content: "Section B"},
				}
				sectionCTitle := []interface{}{
					&types.StringElement{Content: "Section C"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_a",
							},
							Level: 2,
							Title: sectionATitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_b",
							},
							Level: 2,
							Title: sectionBTitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_c",
							},
							Level: 2,
							Title: sectionCTitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_a": sectionATitle,
						"_section_b": sectionBTitle,
						"_section_c": sectionCTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_a",
								Level: 2,
							},
							{
								ID:    "_section_b",
								Level: 2,
							},
							{
								ID:    "_section_c",
								Level: 2,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("single with custom block ID", func() {
				source := `[[custom_header]]
== a header`
				sectionTitle := []interface{}{
					&types.StringElement{Content: "a header"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom_header",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom_header": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom_header",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("single with custom inline ID", func() {
				source := `== a header [[custom_header]]`
				sectionTitle := []interface{}{
					&types.StringElement{
						Content: "a header",
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom_header",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom_header": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom_header",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("single with attached inline anchor", func() {
				source := `== a header[[bookmark]]`
				sectionTitle := []interface{}{
					&types.StringElement{Content: "a header"},
					&types.InlineLink{
						Attributes: types.Attributes{
							types.AttrID: "bookmark",
						},
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_a_header",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"_a_header": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_a_header",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("single with attached inline anchor and inline ID", func() {
				source := `== a header[[bookmark]] [[custom_header]]`
				sectionTitle := []interface{}{
					&types.StringElement{Content: "a header"},
					&types.InlineLink{
						Attributes: types.Attributes{
							types.AttrID: "bookmark",
						},
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom_header",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom_header": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom_header",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("single with detached inline anchor and inline ID", func() {
				source := `== a header [[bookmark]] [[custom_header]]`
				sectionTitle := []interface{}{
					&types.StringElement{Content: "a header "},
					&types.InlineLink{
						Attributes: types.Attributes{
							types.AttrID: "bookmark",
						},
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom_header",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom_header": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom_header",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("single line with apostrophe", func() {
				source := `== ...and we're back!`
				sectionTitle := []interface{}{
					&types.Symbol{
						Name: "...",
					},
					&types.StringElement{
						Content: "and we",
					},
					&types.Symbol{
						Name: "'",
					},
					&types.StringElement{
						Content: "re back!",
					},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_and_were_back",
							},
							Level: 1,
							Title: sectionTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"_and_were_back": sectionTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_and_were_back",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("multiple sections with multiple inline custom IDs", func() {
				source := `[[custom_header]]
= a header

== Section F [[ignored]] [[foo]]

[[bar]]
== Section B
a paragraph`
				fooTitle := []interface{}{
					&types.StringElement{Content: "Section F "},
					&types.InlineLink{
						Attributes: types.Attributes{
							types.AttrID: "ignored",
						},
					},
				}
				barTitle := []interface{}{
					&types.StringElement{Content: "Section B"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
							Attributes: types.Attributes{
								types.AttrID: "custom_header",
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "foo",
							},
							Level: 1,
							Title: fooTitle,
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "bar",
							},
							Level: 1,
							Title: barTitle,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a paragraph"},
									},
								},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"foo": fooTitle,
						"bar": barTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "foo",
								Level: 1,
							},
							{
								ID:    "bar",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("sections with same title", func() {
				source := `== section 1

== section 1`
				section1aTitle := []interface{}{
					&types.StringElement{Content: "section 1"},
				}
				section1bTitle := []interface{}{
					&types.StringElement{Content: "section 1"},
				}

				expected := &types.Document{
					Elements: []interface{}{
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_1",
							},
							Level: 1,
							Title: section1aTitle,
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_1_2",
							},
							Level: 1,
							Title: section1bTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_1":   section1aTitle,
						"_section_1_2": section1bTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_1",
								Level: 1,
							},
							{
								ID:    "_section_1_2",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 0 with nested section level 1 and custom ID prefix", func() {
				source := `= a header
:idprefix: custom_

== section 1`
				section1Title := []interface{}{
					&types.StringElement{Content: "section 1"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
							Elements: []interface{}{
								&types.AttributeDeclaration{
									Name:  types.AttrIDPrefix,
									Value: "custom_",
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom_section_1",
							},
							Level: 1,
							Title: section1Title,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom_section_1": section1Title,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom_section_1",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 0 with nested sections level 1 and custom ID prefixes - with idprefix as doc attribute", func() {
				source := `= a header
:idprefix: custom1a_

== section 1a

:idprefix: custom1b_

== section 1b`
				section1aTitle := []interface{}{
					&types.StringElement{Content: "section 1a"},
				}
				section1bTitle := []interface{}{
					&types.StringElement{Content: "section 1b"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
							Elements: []interface{}{
								&types.AttributeDeclaration{
									Name:  "idprefix",
									Value: "custom1a_",
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom1a_section_1a",
							},
							Level: 1,
							Title: section1aTitle,
							Elements: []interface{}{
								&types.AttributeDeclaration{
									Name:  "idprefix",
									Value: "custom1b_",
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom1b_section_1b",
							},
							Level: 1,
							Title: section1bTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom1a_section_1a": section1aTitle,
						"custom1b_section_1b": section1bTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom1a_section_1a",
								Level: 1,
							},
							{
								ID:    "custom1b_section_1b",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("section level 0 with nested sections level 1 and custom ID prefixes - without idprefix as doc attribute", func() {
				source := `= a header

:idprefix: custom1a_

== section 1a

:idprefix: custom1b_

== section 1b`
				section1aTitle := []interface{}{
					&types.StringElement{Content: "section 1a"},
				}
				section1bTitle := []interface{}{
					&types.StringElement{Content: "section 1b"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "a header"},
							},
						},
						&types.AttributeDeclaration{ // not in the DocumentHeader because of the blankline in-between
							Name:  "idprefix",
							Value: "custom1a_",
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom1a_section_1a",
							},
							Level: 1,
							Title: section1aTitle,
							Elements: []interface{}{
								&types.AttributeDeclaration{
									Name:  "idprefix",
									Value: "custom1b_",
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "custom1b_section_1b",
							},
							Level: 1,
							Title: section1bTitle,
						},
					},
					ElementReferences: types.ElementReferences{
						"custom1a_section_1a": section1aTitle,
						"custom1b_section_1b": section1bTitle,
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "custom1a_section_1a",
								Level: 1,
							},
							{
								ID:    "custom1b_section_1b",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header with preamble then section level 1", func() {
				source := `= A Title

a short preamble

== Section 1`
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "A Title"},
							},
						},
						&types.Preamble{
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a short preamble"},
									},
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_1",
							},
							Level: 1,
							Title: []interface{}{
								&types.StringElement{Content: "Section 1"},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_1": []interface{}{
							&types.StringElement{Content: "Section 1"},
						},
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_1",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("front-matter on top of header", func() {
				source := `---
draft: true
---

= A Title

a short preamble

== Section 1`
				expected := &types.Document{
					Elements: []interface{}{
						&types.FrontMatter{
							Attributes: map[string]interface{}{
								"draft": true,
							},
						},
						&types.DocumentHeader{
							Title: []interface{}{
								&types.StringElement{Content: "A Title"},
							},
						},
						&types.Preamble{
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{Content: "a short preamble"},
									},
								},
							},
						},
						&types.Section{
							Attributes: types.Attributes{
								types.AttrID: "_section_1",
							},
							Level: 1,
							Title: []interface{}{
								&types.StringElement{Content: "Section 1"},
							},
						},
					},
					ElementReferences: types.ElementReferences{
						"_section_1": []interface{}{
							&types.StringElement{Content: "Section 1"},
						},
					},
					TableOfContents: &types.TableOfContents{
						MaxDepth: 2,
						Sections: []*types.ToCSection{
							{
								ID:    "_section_1",
								Level: 1,
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

		})

		Context("invalid sections", func() {

			It("header invalid - too many spaces", func() {
				source := "======= a header"
				expected := &types.Document{
					Elements: []interface{}{
						&types.Paragraph{
							Elements: []interface{}{
								&types.StringElement{Content: "======= a header"},
							},
						},
					}}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header invalid - missing space", func() {
				source := "=a header"
				expected := &types.Document{
					Elements: []interface{}{
						&types.Paragraph{
							Elements: []interface{}{
								&types.StringElement{Content: "=a header"},
							},
						},
					}}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header invalid - header space", func() {
				source := " = a header with a prefix space"
				expected := &types.Document{
					Elements: []interface{}{
						&types.Paragraph{
							Attributes: types.Attributes{
								types.AttrStyle: types.LiteralParagraph,
							},
							Elements: []interface{}{
								&types.StringElement{
									Content: " = a header with a prefix space", // spaces on first line of literal paragraphs are NOT trimmed by parser
								},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

			It("header with invalid section1", func() {
				source := `= a header

 == section with prefix space`
				title := []interface{}{
					&types.StringElement{Content: "a header"},
				}
				expected := &types.Document{
					Elements: []interface{}{
						&types.DocumentHeader{
							Title: title,
						},
						&types.Paragraph{
							Attributes: types.Attributes{
								types.AttrStyle: types.LiteralParagraph,
							},
							Elements: []interface{}{
								&types.StringElement{
									Content: " == section with prefix space", // spaces on first line of literal paragraphs are NOT trimmed by parser
								},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})

		})

		Context("unsupported section syntax", func() {

			It("match unclosed example section", func() {
				source := `Document Title
==============
Doc Writer <thedoc@asciidoctor.org>`
				expected := &types.Document{
					Elements: []interface{}{
						&types.Paragraph{
							Elements: []interface{}{
								&types.StringElement{
									Content: "Document Title",
								},
							},
						},
						&types.DelimitedBlock{
							Kind: types.Example,
							Elements: []interface{}{
								&types.Paragraph{
									Elements: []interface{}{
										&types.StringElement{
											Content: "Doc Writer ",
										},
										&types.SpecialCharacter{
											Name: "<",
										},
										&types.InlineLink{
											Location: &types.Location{
												Scheme: "mailto:",
												Path:   "thedoc@asciidoctor.org",
											},
										},
										&types.SpecialCharacter{
											Name: ">",
										},
									},
								},
							},
						},
					},
				}
				Expect(ParseDocument(source)).To(MatchDocument(expected))
			})
		})
	})
})