text:
package general;

import java.util.ArrayList;

public class Compatibility {

	/**
	 * Checks whether the target course is found in the tutor's course list
	 *
	 * @param course
	 *            - The target course
	 * @param tutor
	 *            - The target tutor
	 * @return true if the target course is found, false if not
	 */
	public boolean checkCourses(String course, Tutor tutor) {
		for (int i = 0; i < tutor.coursesSize(); i++) {
			if (tutor.getCourse(i).equals(course))
				return true;
		}
		return false;
	}

	/**
	 * Finds tutoring sessions between a tutee and all the tutors
	 *
	 * @param tutee
	 *            - The target tutee
	 * @param tutors
	 *            - The Array of all tutors
	 * @return tutee with all possible tutoring sessions added
	 */
	public Tutee checkCompatible(Tutee tutee, Tutor[] tutors) {
		for (int i = 0; i < tutors.length; i++)
			if (tutors[i].getCurSessions() != tutors[i].getMaxSessions())
				if (checkCourses(tutee.getCourse(0), tutors[i]))
					for (int j = 0; j < tutors[i].timesSize(); j++)
						for (int k = 0; k < tutee.timesSize(); k++)
							if (tutors[i].getTime(j) == tutee.getTime(k)) {
								tutee.addPossibleTutor(i);
								tutee.addPossibleTime(tutors[i].getTime(j));
							}
		return tutee;
	}

	/**
	 * Attempts to form a group of tutees for the same assignment
	 *
	 * @param target
	 *            - The index of the original tutee
	 * @param time
	 *            - The time of the assignment
	 * @param maxSize
	 *            - The maximum size of the group
	 * @param tutees
	 *            - The array of tutees
	 * @return a list of the indices of the other tutees in the group
	 */
	public ArrayList<Integer> formGroup(int target, int time, int maxSize, Tutee[] tutees) {
		ArrayList<Integer> group = new ArrayList<Integer>();
		int curSize = 1;

		boolean run = false;
		if (maxSize > curSize)
			run = true;

		int index = 0;
		while (run) {
			// If the current index is not the same as the target index
			if (index != target)
				// For each course requested by the tutee
				for (int i = 0; i < tutees[index].coursesSize(); i++)
					// If the current course is the same as the target course
					if (tutees[index].getCourse(i).equals(tutees[target].getCourse(0)))
						// If the tutee's group size is more than the current size of the group
						if (tutees[index].getGroupSize(i) > curSize)
							// For each time slot requested by the tutee
							for (int j = 0; j < tutees[index].timesSize(); j++)
								// If the current time slot is the same as the target time slot
								if (tutees[index].getTime(j) == time) {
									// Add the tutee's name to the group
									group.add(i);
									// Increment current group size
									curSize++;
									// If the tutee's group size is less than the maximum group size
									if (tutees[index].getGroupSize(i) < maxSize)
										// Make the tutee's group size the maximum group size
										maxSize = tutees[index].getGroupSize(i);
								}

			index++;

			if (!(maxSize > curSize))
				run = false;
			if (index == tutees.length)
				run = false;
		}

		return group;
	}

}


text:
#ifdef USE_TI_UICOVERFLOWVIEW

#import "TiViewProxy.h"

@interface TiUICoverFlowViewProxy : TiViewProxy
{
}

@end

#endif

redpajama_set_name: RedPajamaGithub


text:
package v2alpha

import (
	"bytes"
	"errors"
	"fmt"
	"net"
	"net/mail"
	"net/url"
	"regexp"
	"sort"
	"strings"
	"time"
	"unicode/utf8"

	"google.golang.org/protobuf/types/known/anypb"
)

// ensure the imports are used
var (
	_ = bytes.MinRead
	_ = errors.New("")
	_ = fmt.Print
	_ = utf8.UTFMax
	_ = (*regexp.Regexp)(nil)
	_ = (*strings.Reader)(nil)
	_ = net.IPv4len
	_ = time.Duration(0)
	_ = (*url.URL)(nil)
	_ = (*mail.Address)(nil)
	_ = anypb.Any{}
	_ = sort.Sort
)

// Validate checks the field values on StreamTapsRequest with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *StreamTapsRequest) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on StreamTapsRequest with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// StreamTapsRequestMultiError, or nil if none found.
func (m *StreamTapsRequest) ValidateAll() error {
	return m.validate(true)
}

func (m *StreamTapsRequest) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if all {
		switch v := interface{}(m.GetIdentifier()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, StreamTapsRequestValidationError{
					field:  "Identifier",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, StreamTapsRequestValidationError{
					field:  "Identifier",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return StreamTapsRequestValidationError{
				field:  "Identifier",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for TraceId

	if all {
		switch v := interface{}(m.GetTrace()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, StreamTapsRequestValidationError{
					field:  "Trace",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, StreamTapsRequestValidationError{
					field:  "Trace",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetTrace()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return StreamTapsRequestValidationError{
				field:  "Trace",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	if len(errors) > 0 {
		return StreamTapsRequestMultiError(errors)
	}

	return nil
}

// StreamTapsRequestMultiError is an error wrapping multiple validation errors
// returned by StreamTapsRequest.ValidateAll() if the designated constraints
// aren't met.
type StreamTapsRequestMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m StreamTapsRequestMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m StreamTapsRequestMultiError) AllErrors() []error { return m }

// StreamTapsRequestValidationError is the validation error returned by
// StreamTapsRequest.Validate if the designated constraints aren't met.
type StreamTapsRequestValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e StreamTapsRequestValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e StreamTapsRequestValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e StreamTapsRequestValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e StreamTapsRequestValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e StreamTapsRequestValidationError) ErrorName() string {
	return "StreamTapsRequestValidationError"
}

// Error satisfies the builtin error interface
func (e StreamTapsRequestValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sStreamTapsRequest.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = StreamTapsRequestValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = StreamTapsRequestValidationError{}

// Validate checks the field values on StreamTapsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *StreamTapsResponse) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on StreamTapsResponse with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// StreamTapsResponseMultiError, or nil if none found.
func (m *StreamTapsResponse) ValidateAll() error {
	return m.validate(true)
}

func (m *StreamTapsResponse) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if len(errors) > 0 {
		return StreamTapsResponseMultiError(errors)
	}

	return nil
}

// StreamTapsResponseMultiError is an error wrapping multiple validation errors
// returned by StreamTapsResponse.ValidateAll() if the designated constraints
// aren't met.
type StreamTapsResponseMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m StreamTapsResponseMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m StreamTapsResponseMultiError) AllErrors() []error { return m }

// StreamTapsResponseValidationError is the validation error returned by
// StreamTapsResponse.Validate if the designated constraints aren't met.
type StreamTapsResponseValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e StreamTapsResponseValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e StreamTapsResponseValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e StreamTapsResponseValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e StreamTapsResponseValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e StreamTapsResponseValidationError) ErrorName() string {
	return "StreamTapsResponseValidationError"
}

// Error satisfies the builtin error interface
func (e StreamTapsResponseValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sStreamTapsResponse.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = StreamTapsResponseValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = StreamTapsResponseValidationError{}

// Validate checks the field values on StreamTapsRequest_Identifier with the
// rules defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *StreamTapsRequest_Identifier) Validate() error {
	return m.validate(false)
}

// ValidateAll checks the field values on StreamTapsRequest_Identifier with the
// rules defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// StreamTapsRequest_IdentifierMultiError, or nil if none found.
func (m *StreamTapsRequest_Identifier) ValidateAll() error {
	return m.validate(true)
}

func (m *StreamTapsRequest_Identifier) validate(all bool) error {
	if m == nil {
		return nil
	}

	var errors []error

	if m.GetNode() == nil {
		err := StreamTapsRequest_IdentifierValidationError{
			field:  "Node",
			reason: "value is required",
		}
		if !all {
			return err
		}
		errors = append(errors, err)
	}

	if all {
		switch v := interface{}(m.GetNode()).(type) {
		case interface{ ValidateAll() error }:
			if err := v.ValidateAll(); err != nil {
				errors = append(errors, StreamTapsRequest_IdentifierValidationError{
					field:  "Node",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		case interface{ Validate() error }:
			if err := v.Validate(); err != nil {
				errors = append(errors, StreamTapsRequest_IdentifierValidationError{
					field:  "Node",
					reason: "embedded message failed validation",
					cause:  err,
				})
			}
		}
	} else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
		if err := v.Validate(); err != nil {
			return StreamTapsRequest_IdentifierValidationError{
				field:  "Node",
				reason: "embedded message failed validation",
				cause:  err,
			}
		}
	}

	// no validation rules for TapId

	if len(errors) > 0 {
		return StreamTapsRequest_IdentifierMultiError(errors)
	}

	return nil
}

// StreamTapsRequest_IdentifierMultiError is an error wrapping multiple
// validation errors returned by StreamTapsRequest_Identifier.ValidateAll() if
// the designated constraints aren't met.
type StreamTapsRequest_IdentifierMultiError []error

// Error returns a concatenation of all the error messages it wraps.
func (m StreamTapsRequest_IdentifierMultiError) Error() string {
	var msgs []string
	for _, err := range m {
		msgs = append(msgs, err.Error())
	}
	return strings.Join(msgs, "; ")
}

// AllErrors returns a list of validation violation errors.
func (m StreamTapsRequest_IdentifierMultiError) AllErrors() []error { return m }

// StreamTapsRequest_IdentifierValidationError is the validation error returned
// by StreamTapsRequest_Identifier.Validate if the designated constraints
// aren't met.
type StreamTapsRequest_IdentifierValidationError struct {
	field  string
	reason string
	cause  error
	key    bool
}

// Field function returns field value.
func (e StreamTapsRequest_IdentifierValidationError) Field() string { return e.field }

// Reason function returns reason value.
func (e StreamTapsRequest_IdentifierValidationError) Reason() string { return e.reason }

// Cause function returns cause value.
func (e StreamTapsRequest_IdentifierValidationError) Cause() error { return e.cause }

// Key function returns key value.
func (e StreamTapsRequest_IdentifierValidationError) Key() bool { return e.key }

// ErrorName returns error name.
func (e StreamTapsRequest_IdentifierValidationError) ErrorName() string {
	return "StreamTapsRequest_IdentifierValidationError"
}

// Error satisfies the builtin error interface
func (e StreamTapsRequest_IdentifierValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sStreamTapsRequest_Identifier.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}

var _ error = StreamTapsRequest_IdentifierValidationError{}

var _ interface {
	Field() string
	Reason() string
	Key() bool
	Cause() error
	ErrorName() string
} = StreamTapsRequest_IdentifierValidationError{}


text:
namespace Zu.ChromeDevTools.Schema
{
    using Newtonsoft.Json;

    ///
    /// Description of the protocol domain.
    ///
    public sealed class Domain
    {
        ///
        /// Domain name.
        ///
        [JsonProperty("name")]
        public string Name
        {
            get;
            set;
        }
        ///
        /// Domain version.
        ///
        [JsonProperty("version")]
        public string Version
        {
            get;
            set;
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         colors="true"
         cacheResult="false"
>
    <testsuites>
        <testsuite name="Test">
            <directory suffix="Test.php">./tests</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
</phpunit>


text:
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'special_random.views.home', name='home'),
    # url(r'^special_random/', include('special_random.foo.urls')),

    url(r'^$', 'special_random.main.views.index', name="index"),
    url(r'^qualifying/$', 'special_random.main.views.qualifying', name="qualifying"),
    url(r'^qualifying/(?P<diff>.*)/$', 'special_random.main.views.qualifying_d', name="qualifying_d"),
    url(r'^qualifying_q/(?P<diff>.*)/(?P<pk>.*)/$', 'special_random.main.views.qualifying_q', name="qualifying_q"),
    url(r'^qualifying_q/(?P<diff>.*)/$', 'special_random.main.views.qualifying_q', name="qualifying_q"),

    url(r'^main_q/(?P<pk>.*)/$', 'special_random.main.views.main_q', name="main_q"),
    url(r'^main_q/$', 'special_random.main.views.main_q', name="main_q"),

    url(r'^main/$', 'special_random.main.views.main', name="main"),
    url(r'^main/(?P<pk>.*)/$', 'special_random.main.views.main', name="main"),
    url(r'^main/(?P<pk>.*)/(?P<take_pk>.*)$', 'special_random.main.views.main', name="main"),
    url(r'^main_play/(?P<pk>.*)$', 'special_random.main.views.main_play', name="main_play"),

    url(r'^third/$', 'special_random.main.views.third', name="third"),
    url(r'^third/(?P<pk>.*)/$', 'special_random.main.views.third', name="third"),
    url(r'^third/(?P<pk>.*)/(?P<take_pk>.*)$', 'special_random.main.views.third', name="third"),

    url(r'^final/$', 'special_random.main.views.final', name="final"),
    url(r'^final/(?P<pk>.*)/$', 'special_random.main.views.final', name="final"),
    url(r'^final/(?P<pk>.*)/(?P<take_pk>.*)$', 'special_random.main.views.final', name="final"),
    # url(r'^set/(?P<set_pk>.*)/$', 'special_random.main.views.set', name="set"),
    # url(r'^random/(?P<set_pk>.*)/(?P<group_pk>.*)/$', 'special_random.main.views.random', name="random"),
    # url(r'^real_random/(?P<take_pk>.*)/(?P<ban_pk>.*)/(?P<player_pk>.*)/$', 'special_random.main.views.real_random', name="real_random"),

    # Uncomment the admin/doc line below to enable admin documentation:
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)


text:
using NBitcoin;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.ComponentModel;
using System.Net;
using WalletWasabi.Bases;
using WalletWasabi.Exceptions;
using WalletWasabi.Helpers;
using WalletWasabi.JsonConverters;
using WalletWasabi.Logging;
using WalletWasabi.Models;
using WalletWasabi.Tor;
using WalletWasabi.Userfacing;

namespace WalletWasabi.Gui
{
	[JsonObject(MemberSerialization.OptIn)]
	public class Config : ConfigBase
	{
		public const int DefaultPrivacyLevelSome = 2;
		public const int DefaultPrivacyLevelFine = 21;
		public const int DefaultPrivacyLevelStrong = 50;
		public const int DefaultTorSock5Port = 9050;
		public const int DefaultJsonRpcServerPort = 37128;
		public static readonly Money DefaultDustThreshold = Money.Coins(Constants.DefaultDustThreshold);

		private Uri _backendUri = null;
		private Uri _fallbackBackendUri;

		private string _mixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString();
		private int _privacyLevelSome;
		private int _privacyLevelFine;
		private int _privacyLevelStrong;

		public Config() : base()
		{
		}

		public Config(string filePath) : base(filePath)
		{
			ServiceConfiguration = new ServiceConfiguration(MixUntilAnonymitySet, PrivacyLevelSome, PrivacyLevelFine, PrivacyLevelStrong, GetBitcoinP2pEndPoint(), DustThreshold);
		}

		[JsonProperty(PropertyName = "Network")]
		[JsonConverter(typeof(NetworkJsonConverter))]
		public Network Network { get; internal set; } = Network.Main;

		[DefaultValue("http://wasabiukrxmkdgve5kynjztuovbg43uxcbcxn6y2okcrsg7gb6jdmbad.onion/")]
		[JsonProperty(PropertyName = "MainNetBackendUriV3", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string MainNetBackendUriV3 { get; private set; }

		[DefaultValue("http://testwnp3fugjln6vh5vpj7mvq3lkqqwjj3c2aafyu7laxz42kgwh2rad.onion/")]
		[JsonProperty(PropertyName = "TestNetBackendUriV3", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string TestNetBackendUriV3 { get; private set; }

		[DefaultValue("https://wasabiwallet.io/")]
		[JsonProperty(PropertyName = "MainNetFallbackBackendUri", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string MainNetFallbackBackendUri { get; private set; }

		[DefaultValue("https://wasabiwallet.co/")]
		[JsonProperty(PropertyName = "TestNetFallbackBackendUri", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string TestNetFallbackBackendUri { get; private set; }

		[DefaultValue("http://localhost:37127/")]
		[JsonProperty(PropertyName = "RegTestBackendUriV3", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string RegTestBackendUriV3 { get; private set; }

		[DefaultValue(true)]
		[JsonProperty(PropertyName = "UseTor", DefaultValueHandling = DefaultValueHandling.Populate)]
		public bool UseTor { get; internal set; }

		[DefaultValue(false)]
		[JsonProperty(PropertyName = "TerminateTorOnExit", DefaultValueHandling = DefaultValueHandling.Populate)]
		public bool TerminateTorOnExit { get; internal set; }

		[DefaultValue(false)]
		[JsonProperty(PropertyName = "StartLocalBitcoinCoreOnStartup", DefaultValueHandling = DefaultValueHandling.Populate)]
		public bool StartLocalBitcoinCoreOnStartup { get; internal set; }

		[DefaultValue(true)]
		[JsonProperty(PropertyName = "StopLocalBitcoinCoreOnShutdown", DefaultValueHandling = DefaultValueHandling.Populate)]
		public bool StopLocalBitcoinCoreOnShutdown { get; internal set; }

		[JsonProperty(PropertyName = "LocalBitcoinCoreDataDir")]
		public string LocalBitcoinCoreDataDir { get; internal set; } = EnvironmentHelpers.GetDefaultBitcoinCoreDataDirOrEmptyString();

		[JsonProperty(PropertyName = "TorSocks5EndPoint")]
		[JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultTorSocksPort)]
		public EndPoint TorSocks5EndPoint { get; internal set; } = new IPEndPoint(IPAddress.Loopback, Constants.DefaultTorSocksPort);

		[JsonProperty(PropertyName = "MainNetBitcoinP2pEndPoint")]
		[JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultMainNetBitcoinP2pPort)]
		public EndPoint MainNetBitcoinP2pEndPoint { get; internal set; } = new IPEndPoint(IPAddress.Loopback, Constants.DefaultMainNetBitcoinP2pPort);

		[JsonProperty(PropertyName = "TestNetBitcoinP2pEndPoint")]
		[JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultTestNetBitcoinP2pPort)]
		public EndPoint TestNetBitcoinP2pEndPoint { get; internal set; } = new IPEndPoint(IPAddress.Loopback, Constants.DefaultTestNetBitcoinP2pPort);

		[JsonProperty(PropertyName = "RegTestBitcoinP2pEndPoint")]
		[JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultRegTestBitcoinP2pPort)]
		public EndPoint RegTestBitcoinP2pEndPoint { get; internal set; } = new IPEndPoint(IPAddress.Loopback, Constants.DefaultRegTestBitcoinP2pPort);

		[DefaultValue(false)]
		[JsonProperty(PropertyName = "JsonRpcServerEnabled", DefaultValueHandling = DefaultValueHandling.Populate)]
		public bool JsonRpcServerEnabled { get; internal set; }

		[DefaultValue("")]
		[JsonProperty(PropertyName = "JsonRpcUser", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string JsonRpcUser { get; internal set; }

		[DefaultValue("")]
		[JsonProperty(PropertyName = "JsonRpcPassword", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string JsonRpcPassword { get; internal set; }

		[JsonProperty(PropertyName = "JsonRpcServerPrefixes")]
		public string[] JsonRpcServerPrefixes { get; internal set; } = new[]
		{
			"http://127.0.0.1:37128/",
			"http://localhost:37128/"
		};

		[DefaultValue(nameof(WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong))]
		[JsonProperty(PropertyName = "MixUntilAnonymitySet", DefaultValueHandling = DefaultValueHandling.Populate)]
		public string MixUntilAnonymitySet
		{
			get => _mixUntilAnonymitySet;
			internal set
			{
				if (RaiseAndSetIfChanged(ref _mixUntilAnonymitySet, value))
				{
					if (ServiceConfiguration is { })
					{
						ServiceConfiguration.MixUntilAnonymitySet = value;
					}
				}
			}
		}

		public int MixUntilAnonymitySetValue => GetAnonymitySet(MixUntilAnonymitySet);

		[DefaultValue(DefaultPrivacyLevelSome)]
		[JsonProperty(PropertyName = "PrivacyLevelSome", DefaultValueHandling = DefaultValueHandling.Populate)]
		public int PrivacyLevelSome
		{
			get => _privacyLevelSome;
			internal set
			{
				if (_privacyLevelSome != value)
				{
					_privacyLevelSome = value;
					if (ServiceConfiguration is { })
					{
						ServiceConfiguration.PrivacyLevelSome = value;
					}
				}
			}
		}

		[DefaultValue(DefaultPrivacyLevelFine)]
		[JsonProperty(PropertyName = "PrivacyLevelFine", DefaultValueHandling = DefaultValueHandling.Populate)]
		public int PrivacyLevelFine
		{
			get => _privacyLevelFine;
			internal set
			{
				if (_privacyLevelFine != value)
				{
					_privacyLevelFine = value;
					if (ServiceConfiguration is { })
					{
						ServiceConfiguration.PrivacyLevelFine = value;
					}
				}
			}
		}

		[DefaultValue(DefaultPrivacyLevelStrong)]
		[JsonProperty(PropertyName = "PrivacyLevelStrong", DefaultValueHandling = DefaultValueHandling.Populate)]
		public int PrivacyLevelStrong
		{
			get => _privacyLevelStrong;
			internal set
			{
				if (_privacyLevelStrong != value)
				{
					_privacyLevelStrong = value;
					if (ServiceConfiguration is { })
					{
						ServiceConfiguration.PrivacyLevelStrong = value;
					}
				}
			}
		}

		[JsonProperty(PropertyName = "DustThreshold")]
		[JsonConverter(typeof(MoneyBtcJsonConverter))]
		public Money DustThreshold { get; internal set; } = DefaultDustThreshold;

		public ServiceConfiguration ServiceConfiguration { get; private set; }

		public Uri GetCurrentBackendUri()
		{
			if (TorMonitor.RequestFallbackAddressUsage)
			{
				return GetFallbackBackendUri();
			}

			if (_backendUri is { })
			{
				return _backendUri;
			}

			if (Network == Network.Main)
			{
				_backendUri = new Uri(MainNetBackendUriV3);
			}
			else if (Network == Network.TestNet)
			{
				_backendUri = new Uri(TestNetBackendUriV3);
			}
			else if (Network == Network.RegTest)
			{
				_backendUri = new Uri(RegTestBackendUriV3);
			}
			else
			{
				throw new NotSupportedNetworkException(Network);
			}

			return _backendUri;
		}

		public Uri GetFallbackBackendUri()
		{
			if (_fallbackBackendUri is { })
			{
				return _fallbackBackendUri;
			}

			if (Network == Network.Main)
			{
				_fallbackBackendUri = new Uri(MainNetFallbackBackendUri);
			}
			else if (Network == Network.TestNet)
			{
				_fallbackBackendUri = new Uri(TestNetFallbackBackendUri);
			}
			else if (Network == Network.RegTest)
			{
				_fallbackBackendUri = new Uri(RegTestBackendUriV3);
			}
			else
			{
				throw new NotSupportedNetworkException(Network);
			}

			return _fallbackBackendUri;
		}

		public EndPoint GetBitcoinP2pEndPoint()
		{
			if (Network == Network.Main)
			{
				return MainNetBitcoinP2pEndPoint;
			}
			else if (Network == Network.TestNet)
			{
				return TestNetBitcoinP2pEndPoint;
			}
			else if (Network == Network.RegTest)
			{
				return RegTestBitcoinP2pEndPoint;
			}
			else
			{
				throw new NotSupportedNetworkException(Network);
			}
		}

		/// <inheritdoc />
		public override void LoadFile()
		{
			base.LoadFile();

			ServiceConfiguration = new ServiceConfiguration(MixUntilAnonymitySet, PrivacyLevelSome, PrivacyLevelFine, PrivacyLevelStrong, GetBitcoinP2pEndPoint(), DustThreshold);

			// Just debug convenience.
			_backendUri = GetCurrentBackendUri();
		}

		public void SetP2PEndpoint(EndPoint endPoint)
		{
			if (Network == Network.Main)
			{
				MainNetBitcoinP2pEndPoint = endPoint;
			}
			else if (Network == Network.TestNet)
			{
				TestNetBitcoinP2pEndPoint = endPoint;
			}
			else if (Network == Network.RegTest)
			{
				RegTestBitcoinP2pEndPoint = endPoint;
			}
			else
			{
				throw new NotSupportedNetworkException(Network);
			}
		}

		public EndPoint GetP2PEndpoint()
		{
			if (Network == Network.Main)
			{
				return MainNetBitcoinP2pEndPoint;
			}
			else if (Network == Network.TestNet)
			{
				return TestNetBitcoinP2pEndPoint;
			}
			else if (Network == Network.RegTest)
			{
				return RegTestBitcoinP2pEndPoint;
			}
			else
			{
				throw new NotSupportedNetworkException(Network);
			}
		}

		private int CorrectMixUntilAnonymitySetValue()
		{
			try
			{
				if (int.TryParse(MixUntilAnonymitySet, out int mixUntilAnonymitySetValue))
				{
					if (mixUntilAnonymitySetValue <= PrivacyLevelSome)
					{
						MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelSome.ToString();
						return PrivacyLevelSome;
					}
					else if (mixUntilAnonymitySetValue <= PrivacyLevelFine)
					{
						MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelFine.ToString();
						return PrivacyLevelFine;
					}
					else
					{
						MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString();
						return PrivacyLevelStrong;
					}
				}
				else
				{
					MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString();
					return PrivacyLevelStrong;
				}
			}
			finally
			{
				ToFile();
			}
		}

		public void CorrectMixUntilAnonymitySet()
		{
			GetAnonymitySet(MixUntilAnonymitySet);
		}

		public int GetAnonymitySet(string mixUntilAnonymitySet)
		{
			if (mixUntilAnonymitySet == WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelSome.ToString())
			{
				return PrivacyLevelSome;
			}
			else if (mixUntilAnonymitySet == WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelFine.ToString())
			{
				return PrivacyLevelFine;
			}
			else if (mixUntilAnonymitySet == WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString())
			{
				return PrivacyLevelStrong;
			}
			else
			{
				return CorrectMixUntilAnonymitySetValue();
			}
		}

		protected override bool TryEnsureBackwardsCompatibility(string jsonString)
		{
			try
			{
				var jsObject = JsonConvert.DeserializeObject<JObject>(jsonString);
				bool saveIt = false;

				var torHost = jsObject.Value<string>("TorHost");
				var torSocks5Port = jsObject.Value<int?>("TorSocks5Port");
				var mainNetBitcoinCoreHost = jsObject.Value<string>("MainNetBitcoinCoreHost");
				var mainNetBitcoinCorePort = jsObject.Value<int?>("MainNetBitcoinCorePort");
				var testNetBitcoinCoreHost = jsObject.Value<string>("TestNetBitcoinCoreHost");
				var testNetBitcoinCorePort = jsObject.Value<int?>("TestNetBitcoinCorePort");
				var regTestBitcoinCoreHost = jsObject.Value<string>("RegTestBitcoinCoreHost");
				var regTestBitcoinCorePort = jsObject.Value<int?>("RegTestBitcoinCorePort");

				if (torHost is { })
				{
					int port = torSocks5Port ?? Constants.DefaultTorSocksPort;

					if (EndPointParser.TryParse(torHost, port, out EndPoint? ep))
					{
						TorSocks5EndPoint = ep;
						saveIt = true;
					}
				}

				if (mainNetBitcoinCoreHost is { })
				{
					int port = mainNetBitcoinCorePort ?? Constants.DefaultMainNetBitcoinP2pPort;

					if (EndPointParser.TryParse(mainNetBitcoinCoreHost, port, out EndPoint? ep))
					{
						MainNetBitcoinP2pEndPoint = ep;
						saveIt = true;
					}
				}

				if (testNetBitcoinCoreHost is { })
				{
					int port = testNetBitcoinCorePort ?? Constants.DefaultTestNetBitcoinP2pPort;

					if (EndPointParser.TryParse(testNetBitcoinCoreHost, port, out EndPoint? ep))
					{
						TestNetBitcoinP2pEndPoint = ep;
						saveIt = true;
					}
				}

				if (regTestBitcoinCoreHost is { })
				{
					int port = regTestBitcoinCorePort ?? Constants.DefaultRegTestBitcoinP2pPort;

					if (EndPointParser.TryParse(regTestBitcoinCoreHost, port, out EndPoint? ep))
					{
						RegTestBitcoinP2pEndPoint = ep;
						saveIt = true;
					}
				}

				return saveIt;
			}
			catch (Exception ex)
			{
				Logger.LogWarning("Backwards compatibility couldn't be ensured.");
				Logger.LogInfo(ex);
				return false;
			}
		}
	}
}


text:
# code_note
This repository belongs to my personal guidance note to download & install "things" that i needed in Ubuntu 16.04

# npm & node.js (Ubuntu)
Source :
[https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)

Node.js v6 :
`curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs`

OR

Node.js v7 :
`curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs`

Install build tools :
`sudo apt-get install -y build-essential`

# zsh

Source :
[https://github.com/mhaidarh/super-zsh-kit-basic](https://github.com/mhaidarh/super-zsh-kit-basic)

# git kit basic

Source : [https://github.com/mhaidarh/super-git-kit-basic](https://github.com/mhaidarh/super-git-kit-basic)

# MongoDB (Ubuntu 16.04)

Source :
[https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/?_ga=1.34925153.1562600274.1484908965](https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/?_ga=1.34925153.1562600274.1484908965)

1. `sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6`

2. `echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list`

3. `sudo apt update`

4. `sudo apt-get install -y mongodb-org`

### Start
`sudo service mongod start`

### Check Log
`/var/log/mongodb/mongod.log`

### Stop
`sudo service mongod stop`

### Restart
`sudo service mongod restart`

## Query mongodb
`COMING SOON`

# XAMPP
Download : [https://www.apachefriends.org/download.html](https://www.apachefriends.org/download.html)

Install : [https://www.apachefriends.org/faq_linux.html](https://www.apachefriends.org/faq_linux.html)

### Start
`sudo /opt/lampp/lampp start`

### Stop
`sudo /opt/lampp/lampp stop`

# Tree
### Install
`sudo apt install tree`

### How to use
`tree`

2 Depths
`tree -L 2`

Only folders/directories
`tree -d`

Ignore file or folder
`tree -I <file name || folder name >`

Show hidden files
`tree -a`

Run how to use tree
`man tree`

# Express.js
Source :
[http://expressjs.com/](http://expressjs.com/)

How to
#### 1. Create & go to new folder
`mkdir new_folder`
`cd new_folder`

#### 2. Npm init
`npm init`
or
`npm init -y`

#### 3. Install express
##### Generator :
`sudo npm i -g express-generator`

then

`express`
(Only if you want to install in that directory with jade template engine (default))

OR

`express --view=<name_template_engine>`

```
name_template_engine :
- ejs
- pug
- hbs
- hogan
```

then

`npm install`

then

`npm start`

check in browser :
`localhost:3000`

OR

##### Scratch :
`npm i -S express`

then

create new file name server.js or app.js and do magic there

# PostgreSQL
Source :
[https://www.postgresql.org/download/linux/ubuntu/](https://www.postgresql.org/download/linux/ubuntu/)

Install :
`sudo apt install postgresql`

## PgAdmin 4.1.1

```
sudo apt-get install virtualenv python-pip libpq-dev python-dev

cd
virtualenv pgadmin4
cd pgadmin4
source bin/activate

wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/pip/pgadmin4-1.1-py2-none-any.whl

pip install pgadmin4-1.1-py2-none-any.whl

gedit lib/python2.7/site-packages/pgadmin4/config_local.py

Configure

Write the following in lib/python2.7/site-packages/pgadmin4/config_local.py to configure to run in single-user mode:

SERVER_MODE = False

Create the configuration database

python lib/python2.7/site-packages/pgadmin4/setup.py

Run

python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Access at http://localhost:5050

setting password :
http://stackoverflow.com/questions/24917832/how-connect-postgres-to-localhost-server-using-pgadmin-on-ubuntu
```

## pg

`sudo npm i -g pg`

## ORM : Sequelize
`sudo npm i -g sequelize-cli`

`sudo npm i -g sequelize`

go to your project's directory

`sequelize init`

go to pgadmin, create new database

edit config/config.json, username, password, database, dialect

example :
```
{
  "development": {
    "username": "postgres",
    "password": "postgres",
    "database": "db_user_skills",
    "host": "127.0.0.1",
    "dialect": "postgres"
  },
  "test": {
    "username": "postgres",
    "password": "postgres",
    "database": "db_user_skills",
    "host": "127.0.0.1",
    "dialect": "postgres"
  },
  "production": {
    "username": "postgres",
    "password": "postgres",
    "database": "db_user_skills",
    "host": "127.0.0.1",
    "dialect": "postgres"
  }
}

```

create new table, run in terminal

`sequelize model:create --name <table_name> --attributes "<field>:<data_type>,<field>:<data_type>,etc"`

migrate

`sequelize db:migrate`

seeders
`sequelize seed:create --name <file_seeder_name>`

edit seeder's file

example:
```javascript
'use strict';

module.exports = {
  up: function (queryInterface, Sequelize) {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.bulkInsert('Person', [{
        name: 'John Doe',
        isBetaMember: false
      }], {});
    */
    return queryInterface.bulkInsert('Users', [{
      username  : 'admin',
      password  : 'admin',
      email     : 'admin@admin.com',
      createdAt : new Date(),
      updatedAt : new Date()
    }])
  },

  down: function (queryInterface, Sequelize) {
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.bulkDelete('Person', null, {});
    */
    return queryInterface.bulkDelete('Users', null)
  }
};

```

execute the seeder
`sequelize db:seed --seed seeders/<file_seeder_name>.js`

add new field into existing table
`sequelize migration:create --name <file_new_field_name>`

edit the file_new_field_name :

example:
```javascript
'use strict';

module.exports = {
  up: function (queryInterface, Sequelize) {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.createTable('users', { id: Sequelize.INTEGER });
    */
    return queryInterface.addColumn('Skills', 'name', {
      type : Sequelize.STRING
    })
  },

  down: function (queryInterface, Sequelize) {
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.dropTable('users');
    */
    return queryInterface.removeColumn('Skills', 'name')
  }
};

```
migrate:
`sequelize db:migrate`

add FK
`sequelize migration:create --name <file_add_FK_name>`

edit file_add_FK_name
example:
```javascript
'use strict';

module.exports = {
  up: function (queryInterface, Sequelize) {
    /*
      Add altering commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.createTable('users', { id: Sequelize.INTEGER });
    */
    return queryInterface.addColumn(
      'Skills',
      'UserId',
      {
        type: Sequelize.INTEGER,
        references :{
            model : 'Users',
            key: 'id'
        },
        onDelete: 'SET NULL',
        onUpdate: 'CASCADE'
      }
    )
  },

  down: function (queryInterface, Sequelize) {
    /*
      Add reverting commands here.
      Return a promise to correctly handle asynchronicity.

      Example:
      return queryInterface.dropTable('users');
    */
    return queryInterface.removeColumn('Skills','UserId')
  }
};

```

migrate:

`sequelize db:migrate`

## Docker

### How To Install
[https://docs.docker.com/engine/installation/linux/ubuntu/](https://docs.docker.com/engine/installation/linux/ubuntu/)

[http://stackoverflow.com/questions/39645118/docker-unable-to-locate-package-docker-engine](http://stackoverflow.com/questions/39645118/docker-unable-to-locate-package-docker-engine)

### Docker Compose
[https://docs.docker.com/compose/](https://docs.docker.com/compose/)
[https://docs.docker.com/engine/installation/linux/ubuntu/](https://docs.docker.com/engine/installation/linux/ubuntu/)
[https://github.com/docker/compose/releases](https://github.com/docker/compose/releases)

### Laradock
[https://github.com/laradock/laradock](https://github.com/laradock/laradock)

## Laravel
[https://www.rosehosting.com/blog/install-laravel-on-ubuntu-16-04/](https://www.rosehosting.com/blog/install-laravel-on-ubuntu-16-04/)

## phpmyadmin
`Include /etc/phpmyadmin/apache.conf` in /etc/apache2/apache2.conf

## Mongoose
`Soon`
## Sequelize
`Soon`
## golang
`Soon`


text:
//
// Copyright (C) 2014, 2015 Ableton AG, Berlin. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//

/*!
 * @file
 */

#pragma once

#include <atria/xform/state_traits.hpp>
#include <tuple>

namespace atria {
namespace xform {

/*!
 * Default tag for `state_wrapper`.
 * @see state_wrapper
 */
struct no_tag {};

/*!
 * A decorator for the accumulator of a reduction.
 *
 * A transducer must not make any assumptions about the accumulator of
 * the process it is helping to reduce.  However, a *stateful
 * transducer* may use a `state_wrapper` to attach extra data to the
 * accumulator such that the reducing function object itself can be state-less.
 *
 * A state wrapper has the following template arguments:
 *
 * @tparam TagT is as tag type used to identify the transducer that is
 *        attaching the state.  This can useful to specialize the
 *        `state_traits` for a concrete state wrapper.
 *
 * @tparam StateT is the accumulator that is to be wrapped and of which
 *        we shall make no assumptions.
 *
 * @tparam DataT is the additional data that the transducer wants to
 *        attach to represent its own state.
 *
 * For an example of a stateful reducing function, @see take
 *
 * @see wrap_state
 * @see state_traits
 */
template <typename TagT   = no_tag,
          typename StateT = void,
          typename DataT  = void>
struct state_wrapper : std::tuple<StateT, DataT>
{
  using tag = TagT;
  using base_t = std::tuple<StateT, DataT>;

  state_wrapper(const state_wrapper&) = default;
  state_wrapper(state_wrapper&&) = default;
  state_wrapper& operator=(const state_wrapper&) = default;
  state_wrapper& operator=(state_wrapper&&) = default;

  template <typename T, typename U>
  state_wrapper(T&& st, U&& data)
    : base_t(std::forward<T>(st), std::forward<U>(data))
  {}
};

/*!
 * Metafunction returning whether `StateT` is a, or reference to, a
 * `state_wrapper` instantiation.
 */
template <typename StateT, typename DecayedT = estd::decay_t<StateT> >
struct is_state_wrapper
  : std::false_type {};

template <typename _, typename T, typename S, typename D>
struct is_state_wrapper<_, state_wrapper<T, S, D> >
  : std::true_type {};

/*!
 * Given a tag `TagT` and a state `next` and associated `data`,
 * returns a `state_wrapper` instance.
 *
 * @see state_wrapper
 */
template <typename TagT=no_tag, typename StateT, typename DataT=TagT>
auto wrap_state(StateT&& next, DataT&& data=DataT{})
  -> state_wrapper<TagT,
                   estd::decay_t<StateT>,
                   estd::decay_t<DataT> >
{
  return state_wrapper<TagT, estd::decay_t<StateT>, estd::decay_t<DataT> > {
    std::forward<StateT>(next),
    std::forward<DataT>(data)
  };
}

/*!
 * Utility function for easy overloading of `state_traits::complete`
 * for state wrappers with a specific tag.
 *
 * @see state_wrapper
 * @see state_traits::complete
 */
template <typename TagT, typename T>
auto state_wrapper_complete(TagT, T&& s)
  -> ABL_DECLTYPE_RETURN(
    state_complete(state_unwrap(std::forward<T>(s))))

/*!
 * Utility function for easy overloading of `state_traits::unwrap`
 * for state wrappers with a specific tag.
 *
 * @see state_wrapper
 * @see state_traits::unwrap
 */
template <typename TagT, typename T>
auto state_wrapper_unwrap(TagT, T&& s)
  -> ABL_DECLTYPE_RETURN(
    std::get<0>(std::forward<T>(s)))

/*!
 * Utility function for easy overloading of `state_traits::unwrap_all`
 * for state wrappers with a specific tag.
 *
 * @see state_wrapper
 * @see state_traits::unwrap_all
 */
template <typename TagT, typename T>
auto state_wrapper_unwrap_all(TagT, T&& s)
  -> ABL_DECLTYPE_RETURN(
    state_unwrap_all(state_unwrap(std::forward<T>(s))))

/*!
 * Utility function for easy overloading of `state_traits::rewrap`
 * for state wrappers with a specific tag.
 *
 * @see state_wrapper
 * @see state_traits::rewrap
 */
  template <typename TagT, typename T, typename U>
  auto state_wrapper_rewrap(TagT, T&& s, U&& x)
  -> ABL_DECLTYPE_RETURN(
    wrap_state<TagT>(
      state_rewrap(state_unwrap(std::forward<T>(s)), x),
      state_wrapper_data(std::forward<T>(s))))

/*!
 * Utility function for easy overloading of `state_traits::data`
 * for state wrappers with a specific tag.
 *
 * @see state_wrapper
 * @see state_traits::data
 */
template <typename TagT, typename T, typename D>
auto state_wrapper_data(TagT tag, T&& s, D&&)
  -> ABL_DECLTYPE_RETURN(
    state_wrapper_data(tag, std::forward<T>(s)))

template <typename T>
auto state_wrapper_data(T&& s)
  -> ABL_DECLTYPE_RETURN(
    state_wrapper_data(typename estd::decay_t<T>::tag{}, std::forward<T>(s)))

template <typename TagT, typename T>
auto state_wrapper_data(TagT, T&& s)
  -> ABL_DECLTYPE_RETURN(
    std::get<1>(std::forward<T>(s)))

/*!
 * Utility function that returns whether the `DataT` associated with a
 * state wrapper with tag `TagT` is reduced -- i.e. idempotent.
 * Can be overloaded custom tags.
 *
 * @see state_traits::reduced
 */
template <typename TagT, typename DataT>
bool state_wrapper_data_is_reduced(TagT, DataT&&)
{
  return false;
}

/*!
 * Utility function for easy overloading of `state_traits::is_reduced`
 * for state wrappers with a specific tag.  Most of the time you may
 * want to overload `state_wrapper_is_reduced` instead.
 *
 * @see state_wrapper_data_is_reduced
 * @see state_wrapper
 * @see state_traits::is_reduced
 */
template <typename TagT, typename T>
bool state_wrapper_is_reduced(TagT tag, T&& s)
{
  return state_wrapper_data_is_reduced(
           tag, state_wrapper_data(tag, std::forward<T>(s)))
      || state_is_reduced(state_unwrap(std::forward<T>(s)));
}

/*!
 * State traits specialization for `state_wrapper`.  Just forwards to
 * the `state_wrapper_*` methods, that are easier to specialize for a
 * given tag.
 *
 * @see state_wrapper_complete
 * @see state_wrapper_is_reduced
 * @see state_wrapper_unwrap
 * @see state_wrapper_data
 * @see state_wrapper_unwrap_all
 * @see state_wrapper_rewrap
 * @see state_wrapper
 */
template <typename TagT, typename StateT, typename DataT>
struct state_traits<state_wrapper<TagT, StateT, DataT> >
{
  template <typename T>
  static auto complete(T&& s)
    -> ABL_DECLTYPE_RETURN(
      state_wrapper_complete(TagT{}, std::forward<T>(s)))

  template <typename T>
  static auto is_reduced(T&& s)
    -> ABL_DECLTYPE_RETURN(
      state_wrapper_is_reduced(TagT{}, std::forward<T>(s)))

  template <typename T, typename D>
  static auto data(T&& s, D&& d)
    -> ABL_DECLTYPE_RETURN(
      state_wrapper_data(TagT{}, std::forward<T>(s), std::forward<D>(d)))

  template <typename T>
  static auto unwrap(T&& s)
    -> ABL_DECLTYPE_RETURN(
      state_wrapper_unwrap(TagT{}, std::forward<T>(s)))

  template <typename T>
  static auto unwrap_all(T&& s)
    -> ABL_DECLTYPE_RETURN(
      state_wrapper_unwrap_all(TagT{}, std::forward<T>(s)))

  template <typename T, typename U>
  static auto rewrap(T&& s, U&& x)
    -> ABL_DECLTYPE_RETURN(
      state_wrapper_rewrap(TagT{}, std::forward<T>(s), std::forward<U>(x)))
};

} // namespace xform
} // namespace atria


text:
package com.wenld.app_multitypeadapter.customLayoutManager.layoutManager;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by wenld on 2017/6/25.
 */

public class CardLayoutManager extends RecyclerView.LayoutManager {
    public static final int DEFAULT_GROUP_SIZE = 5;

    private int mGroupSize;
    private int mHorizontalOffset;
    private int mVerticalOffset;
    private int mTotalWidth;
    private int mTotalHeight;
    private int mGravityOffset;
    private boolean isGravityCenter;

    private Pool<Rect> mItemFrames;

    public CardLayoutManager(boolean center) {
        this(DEFAULT_GROUP_SIZE, center);
    }

    public CardLayoutManager(int groupSize, boolean center) {
        mGroupSize = groupSize;
        isGravityCenter = center;
        mItemFrames = new Pool<>(new Pool.New<Rect>() {
            @Override
            public Rect get() { return new Rect();}
        });
    }

    @Override
    public RecyclerView.LayoutParams generateDefaultLayoutParams() {
        return new RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    @Override
    public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
        if (getItemCount() <= 0 || state.isPreLayout()) { return;}

        detachAndScrapAttachedViews(recycler);
        View first = recycler.getViewForPosition(0);
        measureChildWithMargins(first, 0, 0);
        int itemWidth = getDecoratedMeasuredWidth(first);
        int itemHeight = getDecoratedMeasuredHeight(first);

        int firstLineSize = mGroupSize / 2 + 1;
        int secondLineSize = firstLineSize + mGroupSize / 2;
        if (isGravityCenter && firstLineSize * itemWidth < getHorizontalSpace()) {
            mGravityOffset = (getHorizontalSpace() - firstLineSize * itemWidth) / 2;
        } else {
            mGravityOffset = 0;
        }

        for (int i = 0; i < getItemCount(); i++) {
            Rect item = mItemFrames.get(i);
            float coefficient = isFirstGroup(i) ? 1.5f : 1.f;
            int offsetHeight = (int) ((i / mGroupSize) * itemHeight * coefficient);

            // 每一组的第一行
            if (isItemInFirstLine(i)) {
                int offsetInLine = i < firstLineSize ? i : i % mGroupSize;
                item.set(mGravityOffset + offsetInLine * itemWidth, offsetHeight, mGravityOffset + offsetInLine * itemWidth + itemWidth,
                        itemHeight + offsetHeight);
            }else {
                int lineOffset = itemHeight / 2;
                int offsetInLine = (i < secondLineSize ? i : i % mGroupSize) - firstLineSize;
                item.set(mGravityOffset + offsetInLine * itemWidth + itemWidth / 2,
                        offsetHeight + lineOffset, mGravityOffset + offsetInLine * itemWidth + itemWidth  + itemWidth / 2,
                        itemHeight + offsetHeight + lineOffset);
            }
        }

        mTotalWidth = Math.max(firstLineSize * itemWidth, getHorizontalSpace());
        int totalHeight = getGroupSize() * itemHeight;
        if (!isItemInFirstLine(getItemCount() - 1)) { totalHeight += itemHeight / 2;}
        mTotalHeight = Math.max(totalHeight, getVerticalSpace());
        fill(recycler, state);
    }

    private void fill(RecyclerView.Recycler recycler, RecyclerView.State state) {
        if (getItemCount() <= 0 || state.isPreLayout()) { return;}
        Rect displayRect = new Rect(mHorizontalOffset, mVerticalOffset,
                getHorizontalSpace() + mHorizontalOffset,
                getVerticalSpace() + mVerticalOffset);

        // Rect rect = new Rect();
        // for (int i = 0; i < getChildCount(); i++) {
        // View item = getChildAt(i);
        // rect.left = getDecoratedLeft(item);
        // rect.top = getDecoratedTop(item);
        // rect.right = getDecoratedRight(item);
        // rect.bottom = getDecoratedBottom(item);
        // if (!Rect.intersects(displayRect, rect)) {
        // removeAndRecycleView(item, recycler);
        // }
        // }

        for (int i = 0; i < getItemCount(); i++) {
            Rect frame = mItemFrames.get(i);
            if (Rect.intersects(displayRect, frame)) {
                View scrap = recycler.getViewForPosition(i);
                addView(scrap);
                measureChildWithMargins(scrap, 0, 0);
                layoutDecorated(scrap, frame.left - mHorizontalOffset, frame.top - mVerticalOffset,
                        frame.right - mHorizontalOffset, frame.bottom - mVerticalOffset);
            }
        }
    }

    @Override
    public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
        detachAndScrapAttachedViews(recycler);
        if (mVerticalOffset + dy < 0) {
            dy = -mVerticalOffset;
        } else if (mVerticalOffset + dy > mTotalHeight - getVerticalSpace()) {
            dy = mTotalHeight - getVerticalSpace() - mVerticalOffset;
        }

        offsetChildrenVertical(-dy);
        fill(recycler, state);
        mVerticalOffset += dy;
        return dy;
    }

    @Override
    public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
        detachAndScrapAttachedViews(recycler);
        if (mHorizontalOffset + dx < 0) {
            dx = -mHorizontalOffset;
        } else if (mHorizontalOffset + dx > mTotalWidth - getHorizontalSpace()) {
            dx = mTotalWidth - getHorizontalSpace() - mHorizontalOffset;
        }

        offsetChildrenHorizontal(-dx);
        fill(recycler, state);
        mHorizontalOffset += dx;
        return dx;
    }

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

    @Override
    public boolean canScrollHorizontally() {
        return false;
    }

    private boolean isItemInFirstLine(int index) {
        int firstLineSize = mGroupSize / 2 + 1;
        return index < firstLineSize || (index >= mGroupSize && index % mGroupSize < firstLineSize);
    }

    private int getGroupSize() {
        return (int) Math.ceil(getItemCount() / (float)mGroupSize);
    }

    private boolean isFirstGroup(int index) {
        return index < mGroupSize;
    }

    private int getHorizontalSpace() {
        return getWidth() - getPaddingLeft() - getPaddingRight();
    }

    private int getVerticalSpace() {
        return getHeight() - getPaddingTop() - getPaddingBottom();
    }

}


text:
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';

import { ApiService } from '../../shared/services/api.service';
import { Api } from '../../shared/interfaces/api.interface';

/**
 * Service that provides access to the api for logging user in and out.
 */
@Injectable()
export class Authentication {
  constructor(private api: ApiService) { }

  public create(user: Object): Observable<any> {
    return this.api.post(Api.Identities, 'login', { body: user });
  }

  public destroy(): Observable<any> {
    return this.api.post(Api.Identities, 'invalidate');
  }
}


text:
describe('POST /collections/:collectionId/_move', function() {
  beforeEach(function *() {
    yield fixtures.load();
    this.writer = fixtures.users[1];
    this.reader = fixtures.users[2];
    yield this.writer.addTeam(fixtures.teams[0]);
    yield this.reader.addTeam(fixtures.teams[1]);
    yield fixtures.teams[0].addProject(fixtures.projects[0], { permission: 'write' });
    yield fixtures.teams[1].addProject(fixtures.projects[0], { permission: 'read' });
    yield fixtures.projects[0].addCollection(fixtures.collections);
  });

  it('should return Unauthorized when user is unauthorized', function *() {
    try {
      yield route.post(`/collections/${fixtures.collections[0].id}/_move`);
      throw new Error('should reject');
    } catch (err) {
      expect(err).to.be.an.error(HTTP_ERROR.Unauthorized);
    }
  });

  it('should return NotFound when collection is not found', function *() {
    try {
      yield route.post('/collections/1993/_move', null, {
        auth: [this.writer.email, this.writer.password]
      });
      throw new Error('should reject');
    } catch (err) {
      expect(err).to.be.an.error(HTTP_ERROR.NotFound);
    }
  });

  it('should return NoPermission when the user don\'t have write permission', function *() {
    var collection = fixtures.collections[0];
    try {
      yield route.post(`/collections/${collection.id}/_move`, null, {
        auth: [this.reader.email, this.reader.password]
      });
      throw new Error('should reject');
    } catch (err) {
      expect(err).to.be.an.error(HTTP_ERROR.NoPermission);
    }
  });

  it('should move the collections', function *() {
    var project = fixtures.projects[0];
    var collections = fixtures.collections;
    var result = yield route.post(`/collections/${collections[1].id}/_move`, {
      order: 0
    }, {
      auth: [this.writer.email, this.writer.password]
    });
    expect(result).to.eql('ok');
    expect(yield collections[1].reload()).to.have.property('order', 0);
  });
});


text:
package proto

import proto1 "github.com/gogo/protobuf/proto"
import math "math"

// discarding unused import gogoproto "gogoproto"

import io "io"
import fmt "fmt"

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto1.Marshal
var _ = math.Inf

// TimeSeriesQueryAggregator describes a set of aggregation functions which are
// applied to data points before returning them as part of a query.
//
// Cockroach does not store data points at full fidelity, instead "downsampling"
// data points into fixed-length sample periods. The value returned for each
// sample period is equivalent to applying the supplied aggregator function to
// the original data points that fell within the sample period.
type TimeSeriesQueryAggregator int32

const (
	// AVG returns the average value of points within the sample period.
	TimeSeriesQueryAggregator_AVG TimeSeriesQueryAggregator = 1
	// AVG_RATE returns the rate of change of the average over the sample period's
	// duration.  This is computed via linear regression with the previous sample
	// period's average value.
	TimeSeriesQueryAggregator_AVG_RATE TimeSeriesQueryAggregator = 2
)

var TimeSeriesQueryAggregator_name = map[int32]string{
	1: "AVG",
	2: "AVG_RATE",
}
var TimeSeriesQueryAggregator_value = map[string]int32{
	"AVG":      1,
	"AVG_RATE": 2,
}

func (x TimeSeriesQueryAggregator) Enum() *TimeSeriesQueryAggregator {
	p := new(TimeSeriesQueryAggregator)
	*p = x
	return p
}
func (x TimeSeriesQueryAggregator) String() string {
	return proto1.EnumName(TimeSeriesQueryAggregator_name, int32(x))
}
func (x *TimeSeriesQueryAggregator) UnmarshalJSON(data []byte) error {
	value, err := proto1.UnmarshalJSONEnum(TimeSeriesQueryAggregator_value, data, "TimeSeriesQueryAggregator")
	if err != nil {
		return err
	}
	*x = TimeSeriesQueryAggregator(value)
	return nil
}

// TimeSeriesDatapoint is a single point of time series data; a value associated
// with a timestamp.
type TimeSeriesDatapoint struct {
	// The timestamp when this datapoint is located, expressed in nanoseconds
	// since the unix epoch.
	TimestampNanos int64 `protobuf:"varint,1,opt,name=timestamp_nanos" json:"timestamp_nanos"`
	// A floating point representation of the value of this datapoint.
	Value float64 `protobuf:"fixed64,2,opt,name=value" json:"value"`
}

func (m *TimeSeriesDatapoint) Reset()         { *m = TimeSeriesDatapoint{} }
func (m *TimeSeriesDatapoint) String() string { return proto1.CompactTextString(m) }
func (*TimeSeriesDatapoint) ProtoMessage()    {}

func (m *TimeSeriesDatapoint) GetTimestampNanos() int64 {
	if m != nil {
		return m.TimestampNanos
	}
	return 0
}

func (m *TimeSeriesDatapoint) GetValue() float64 {
	if m != nil {
		return m.Value
	}
	return 0
}

// TimeSeriesData is a set of measurements of a single named variable at
// multiple points in time. This message contains a name and a source which, in
// combination, uniquely identify the time series being measured. Measurement
// data is represented as a repeated set of TimeSeriesDatapoint messages.
type TimeSeriesData struct {
	// A string which uniquely identifies the variable from which this data was
	// measured.
	Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
	// A string which identifies the unique source from which the variable was measured.
	Source string `protobuf:"bytes,2,opt,name=source" json:"source"`
	// Datapoints representing one or more measurements taken from the variable.
	Datapoints []*TimeSeriesDatapoint `protobuf:"bytes,3,rep,name=datapoints" json:"datapoints,omitempty"`
}

func (m *TimeSeriesData) Reset()         { *m = TimeSeriesData{} }
func (m *TimeSeriesData) String() string { return proto1.CompactTextString(m) }
func (*TimeSeriesData) ProtoMessage()    {}

func (m *TimeSeriesData) GetName() string {
	if m != nil {
		return m.Name
	}
	return ""
}

func (m *TimeSeriesData) GetSource() string {
	if m != nil {
		return m.Source
	}
	return ""
}

func (m *TimeSeriesData) GetDatapoints() []*TimeSeriesDatapoint {
	if m != nil {
		return m.Datapoints
	}
	return nil
}

// TimeSeriesQueryRequest is the standard incoming time series query request
// accepted from cockroach clients.
type TimeSeriesQueryRequest struct {
	// A timestamp in nanoseconds which defines the early bound of the time span
	// for this query.
	StartNanos int64 `protobuf:"varint,1,opt,name=start_nanos" json:"start_nanos"`
	// A timestamp in nanoseconds which defines the late bound of the time span
	// for this query. Must be greater than start_nanos.
	EndNanos int64 `protobuf:"varint,2,opt,name=end_nanos" json:"end_nanos"`
	// A set of Queries for this request. A request must have at least one
	// Query.
	Queries []TimeSeriesQueryRequest_Query `protobuf:"bytes,3,rep,name=queries" json:"queries"`
}

func (m *TimeSeriesQueryRequest) Reset()         { *m = TimeSeriesQueryRequest{} }
func (m *TimeSeriesQueryRequest) String() string { return proto1.CompactTextString(m) }
func (*TimeSeriesQueryRequest) ProtoMessage()    {}

func (m *TimeSeriesQueryRequest) GetStartNanos() int64 {
	if m != nil {
		return m.StartNanos
	}
	return 0
}

func (m *TimeSeriesQueryRequest) GetEndNanos() int64 {
	if m != nil {
		return m.EndNanos
	}
	return 0
}

func (m *TimeSeriesQueryRequest) GetQueries() []TimeSeriesQueryRequest_Query {
	if m != nil {
		return m.Queries
	}
	return nil
}

// Each Query defines a specific metric to query over the time span of
// this request.
type TimeSeriesQueryRequest_Query struct {
	// The name of the time series to query.
	Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
	// The aggregation function to apply to points in the result.
	Aggregator *TimeSeriesQueryAggregator `protobuf:"varint,2,opt,name=aggregator,enum=cockroach.proto.TimeSeriesQueryAggregator,def=1" json:"aggregator,omitempty"`
}

func (m *TimeSeriesQueryRequest_Query) Reset()         { *m = TimeSeriesQueryRequest_Query{} }
func (m *TimeSeriesQueryRequest_Query) String() string { return proto1.CompactTextString(m) }
func (*TimeSeriesQueryRequest_Query) ProtoMessage()    {}

const Default_TimeSeriesQueryRequest_Query_Aggregator TimeSeriesQueryAggregator = TimeSeriesQueryAggregator_AVG

func (m *TimeSeriesQueryRequest_Query) GetName() string {
	if m != nil {
		return m.Name
	}
	return ""
}

func (m *TimeSeriesQueryRequest_Query) GetAggregator() TimeSeriesQueryAggregator {
	if m != nil && m.Aggregator != nil {
		return *m.Aggregator
	}
	return Default_TimeSeriesQueryRequest_Query_Aggregator
}

// TimeSeriesQueryResponse is the standard response for time series queries
// returned to cockroach clients.
type TimeSeriesQueryResponse struct {
	// A set of Results; there will be one result for each Query in the matching
	// TimeSeriesQueryRequest, in the same order. A Result will be present for
	// each Query even if there are zero datapoints to return.
	Results []*TimeSeriesQueryResponse_Result `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
}

func (m *TimeSeriesQueryResponse) Reset()         { *m = TimeSeriesQueryResponse{} }
func (m *TimeSeriesQueryResponse) String() string { return proto1.CompactTextString(m) }
func (*TimeSeriesQueryResponse) ProtoMessage()    {}

func (m *TimeSeriesQueryResponse) GetResults() []*TimeSeriesQueryResponse_Result {
	if m != nil {
		return m.Results
	}
	return nil
}

// Result is the data returned from a single metric query over a time span.
type TimeSeriesQueryResponse_Result struct {
	// A string which uniquely identifies the variable from which this data was
	// measured.
	Name string `protobuf:"bytes,1,opt,name=name" json:"name"`
	// A list of sources from which the data was aggregated.
	Sources []string `protobuf:"bytes,2,rep,name=sources" json:"sources,omitempty"`
	// The aggregation function applied to points in the result.
	Aggregator *TimeSeriesQueryAggregator `protobuf:"varint,3,opt,name=aggregator,enum=cockroach.proto.TimeSeriesQueryAggregator,def=1" json:"aggregator,omitempty"`
	// Datapoints describing the queried data.
	Datapoints []*TimeSeriesDatapoint `protobuf:"bytes,4,rep,name=datapoints" json:"datapoints,omitempty"`
}

func (m *TimeSeriesQueryResponse_Result) Reset()         { *m = TimeSeriesQueryResponse_Result{} }
func (m *TimeSeriesQueryResponse_Result) String() string { return proto1.CompactTextString(m) }
func (*TimeSeriesQueryResponse_Result) ProtoMessage()    {}

const Default_TimeSeriesQueryResponse_Result_Aggregator TimeSeriesQueryAggregator = TimeSeriesQueryAggregator_AVG

func (m *TimeSeriesQueryResponse_Result) GetName() string {
	if m != nil {
		return m.Name
	}
	return ""
}

func (m *TimeSeriesQueryResponse_Result) GetSources() []string {
	if m != nil {
		return m.Sources
	}
	return nil
}

func (m *TimeSeriesQueryResponse_Result) GetAggregator() TimeSeriesQueryAggregator {
	if m != nil && m.Aggregator != nil {
		return *m.Aggregator
	}
	return Default_TimeSeriesQueryResponse_Result_Aggregator
}

func (m *TimeSeriesQueryResponse_Result) GetDatapoints() []*TimeSeriesDatapoint {
	if m != nil {
		return m.Datapoints
	}
	return nil
}

func init() {
	proto1.RegisterEnum("cockroach.proto.TimeSeriesQueryAggregator", TimeSeriesQueryAggregator_name, TimeSeriesQueryAggregator_value)
}
func (m *TimeSeriesDatapoint) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *TimeSeriesDatapoint) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	data[i] = 0x8
	i++
	i = encodeVarintTimeseries(data, i, uint64(m.TimestampNanos))
	data[i] = 0x11
	i++
	i = encodeFixed64Timeseries(data, i, uint64(math.Float64bits(m.Value)))
	return i, nil
}

func (m *TimeSeriesData) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *TimeSeriesData) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	data[i] = 0xa
	i++
	i = encodeVarintTimeseries(data, i, uint64(len(m.Name)))
	i += copy(data[i:], m.Name)
	data[i] = 0x12
	i++
	i = encodeVarintTimeseries(data, i, uint64(len(m.Source)))
	i += copy(data[i:], m.Source)
	if len(m.Datapoints) > 0 {
		for _, msg := range m.Datapoints {
			data[i] = 0x1a
			i++
			i = encodeVarintTimeseries(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	return i, nil
}

func (m *TimeSeriesQueryRequest) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *TimeSeriesQueryRequest) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	data[i] = 0x8
	i++
	i = encodeVarintTimeseries(data, i, uint64(m.StartNanos))
	data[i] = 0x10
	i++
	i = encodeVarintTimeseries(data, i, uint64(m.EndNanos))
	if len(m.Queries) > 0 {
		for _, msg := range m.Queries {
			data[i] = 0x1a
			i++
			i = encodeVarintTimeseries(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	return i, nil
}

func (m *TimeSeriesQueryRequest_Query) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *TimeSeriesQueryRequest_Query) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	data[i] = 0xa
	i++
	i = encodeVarintTimeseries(data, i, uint64(len(m.Name)))
	i += copy(data[i:], m.Name)
	if m.Aggregator != nil {
		data[i] = 0x10
		i++
		i = encodeVarintTimeseries(data, i, uint64(*m.Aggregator))
	}
	return i, nil
}

func (m *TimeSeriesQueryResponse) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *TimeSeriesQueryResponse) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Results) > 0 {
		for _, msg := range m.Results {
			data[i] = 0xa
			i++
			i = encodeVarintTimeseries(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	return i, nil
}

func (m *TimeSeriesQueryResponse_Result) Marshal() (data []byte, err error) {
	size := m.Size()
	data = make([]byte, size)
	n, err := m.MarshalTo(data)
	if err != nil {
		return nil, err
	}
	return data[:n], nil
}

func (m *TimeSeriesQueryResponse_Result) MarshalTo(data []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	data[i] = 0xa
	i++
	i = encodeVarintTimeseries(data, i, uint64(len(m.Name)))
	i += copy(data[i:], m.Name)
	if len(m.Sources) > 0 {
		for _, s := range m.Sources {
			data[i] = 0x12
			i++
			l = len(s)
			for l >= 1<<7 {
				data[i] = uint8(uint64(l)&0x7f | 0x80)
				l >>= 7
				i++
			}
			data[i] = uint8(l)
			i++
			i += copy(data[i:], s)
		}
	}
	if m.Aggregator != nil {
		data[i] = 0x18
		i++
		i = encodeVarintTimeseries(data, i, uint64(*m.Aggregator))
	}
	if len(m.Datapoints) > 0 {
		for _, msg := range m.Datapoints {
			data[i] = 0x22
			i++
			i = encodeVarintTimeseries(data, i, uint64(msg.Size()))
			n, err := msg.MarshalTo(data[i:])
			if err != nil {
				return 0, err
			}
			i += n
		}
	}
	return i, nil
}

func encodeFixed64Timeseries(data []byte, offset int, v uint64) int {
	data[offset] = uint8(v)
	data[offset+1] = uint8(v >> 8)
	data[offset+2] = uint8(v >> 16)
	data[offset+3] = uint8(v >> 24)
	data[offset+4] = uint8(v >> 32)
	data[offset+5] = uint8(v >> 40)
	data[offset+6] = uint8(v >> 48)
	data[offset+7] = uint8(v >> 56)
	return offset + 8
}
func encodeFixed32Timeseries(data []byte, offset int, v uint32) int {
	data[offset] = uint8(v)
	data[offset+1] = uint8(v >> 8)
	data[offset+2] = uint8(v >> 16)
	data[offset+3] = uint8(v >> 24)
	return offset + 4
}
func encodeVarintTimeseries(data []byte, offset int, v uint64) int {
	for v >= 1<<7 {
		data[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	data[offset] = uint8(v)
	return offset + 1
}
func (m *TimeSeriesDatapoint) Size() (n int) {
	var l int
	_ = l
	n += 1 + sovTimeseries(uint64(m.TimestampNanos))
	n += 9
	return n
}

func (m *TimeSeriesData) Size() (n int) {
	var l int
	_ = l
	l = len(m.Name)
	n += 1 + l + sovTimeseries(uint64(l))
	l = len(m.Source)
	n += 1 + l + sovTimeseries(uint64(l))
	if len(m.Datapoints) > 0 {
		for _, e := range m.Datapoints {
			l = e.Size()
			n += 1 + l + sovTimeseries(uint64(l))
		}
	}
	return n
}

func (m *TimeSeriesQueryRequest) Size() (n int) {
	var l int
	_ = l
	n += 1 + sovTimeseries(uint64(m.StartNanos))
	n += 1 + sovTimeseries(uint64(m.EndNanos))
	if len(m.Queries) > 0 {
		for _, e := range m.Queries {
			l = e.Size()
			n += 1 + l + sovTimeseries(uint64(l))
		}
	}
	return n
}

func (m *TimeSeriesQueryRequest_Query) Size() (n int) {
	var l int
	_ = l
	l = len(m.Name)
	n += 1 + l + sovTimeseries(uint64(l))
	if m.Aggregator != nil {
		n += 1 + sovTimeseries(uint64(*m.Aggregator))
	}
	return n
}

func (m *TimeSeriesQueryResponse) Size() (n int) {
	var l int
	_ = l
	if len(m.Results) > 0 {
		for _, e := range m.Results {
			l = e.Size()
			n += 1 + l + sovTimeseries(uint64(l))
		}
	}
	return n
}

func (m *TimeSeriesQueryResponse_Result) Size() (n int) {
	var l int
	_ = l
	l = len(m.Name)
	n += 1 + l + sovTimeseries(uint64(l))
	if len(m.Sources) > 0 {
		for _, s := range m.Sources {
			l = len(s)
			n += 1 + l + sovTimeseries(uint64(l))
		}
	}
	if m.Aggregator != nil {
		n += 1 + sovTimeseries(uint64(*m.Aggregator))
	}
	if len(m.Datapoints) > 0 {
		for _, e := range m.Datapoints {
			l = e.Size()
			n += 1 + l + sovTimeseries(uint64(l))
		}
	}
	return n
}

func sovTimeseries(x uint64) (n int) {
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}
func sozTimeseries(x uint64) (n int) {
	return sovTimeseries(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *TimeSeriesDatapoint) Unmarshal(data []byte) error {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field TimestampNanos", wireType)
			}
			m.TimestampNanos = 0
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				m.TimestampNanos |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 2:
			if wireType != 1 {
				return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
			}
			var v uint64
			if (iNdEx + 8) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += 8
			v = uint64(data[iNdEx-8])
			v |= uint64(data[iNdEx-7]) << 8
			v |= uint64(data[iNdEx-6]) << 16
			v |= uint64(data[iNdEx-5]) << 24
			v |= uint64(data[iNdEx-4]) << 32
			v |= uint64(data[iNdEx-3]) << 40
			v |= uint64(data[iNdEx-2]) << 48
			v |= uint64(data[iNdEx-1]) << 56
			m.Value = float64(math.Float64frombits(v))
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			iNdEx -= sizeOfWire
			skippy, err := skipTimeseries(data[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthTimeseries
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	return nil
}
func (m *TimeSeriesData) Unmarshal(data []byte) error {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + int(stringLen)
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Name = string(data[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + int(stringLen)
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Source = string(data[iNdEx:postIndex])
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Datapoints", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + msglen
			if msglen < 0 {
				return ErrInvalidLengthTimeseries
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Datapoints = append(m.Datapoints, &TimeSeriesDatapoint{})
			if err := m.Datapoints[len(m.Datapoints)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			iNdEx -= sizeOfWire
			skippy, err := skipTimeseries(data[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthTimeseries
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	return nil
}
func (m *TimeSeriesQueryRequest) Unmarshal(data []byte) error {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field StartNanos", wireType)
			}
			m.StartNanos = 0
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				m.StartNanos |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field EndNanos", wireType)
			}
			m.EndNanos = 0
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				m.EndNanos |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Queries", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + msglen
			if msglen < 0 {
				return ErrInvalidLengthTimeseries
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Queries = append(m.Queries, TimeSeriesQueryRequest_Query{})
			if err := m.Queries[len(m.Queries)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			iNdEx -= sizeOfWire
			skippy, err := skipTimeseries(data[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthTimeseries
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	return nil
}
func (m *TimeSeriesQueryRequest_Query) Unmarshal(data []byte) error {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + int(stringLen)
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Name = string(data[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Aggregator", wireType)
			}
			var v TimeSeriesQueryAggregator
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				v |= (TimeSeriesQueryAggregator(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Aggregator = &v
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			iNdEx -= sizeOfWire
			skippy, err := skipTimeseries(data[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthTimeseries
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	return nil
}
func (m *TimeSeriesQueryResponse) Unmarshal(data []byte) error {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + msglen
			if msglen < 0 {
				return ErrInvalidLengthTimeseries
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Results = append(m.Results, &TimeSeriesQueryResponse_Result{})
			if err := m.Results[len(m.Results)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			iNdEx -= sizeOfWire
			skippy, err := skipTimeseries(data[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthTimeseries
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	return nil
}
func (m *TimeSeriesQueryResponse_Result) Unmarshal(data []byte) error {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + int(stringLen)
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Name = string(data[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Sources", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + int(stringLen)
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Sources = append(m.Sources, string(data[iNdEx:postIndex]))
			iNdEx = postIndex
		case 3:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Aggregator", wireType)
			}
			var v TimeSeriesQueryAggregator
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				v |= (TimeSeriesQueryAggregator(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Aggregator = &v
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Datapoints", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			postIndex := iNdEx + msglen
			if msglen < 0 {
				return ErrInvalidLengthTimeseries
			}
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Datapoints = append(m.Datapoints, &TimeSeriesDatapoint{})
			if err := m.Datapoints[len(m.Datapoints)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			var sizeOfWire int
			for {
				sizeOfWire++
				wire >>= 7
				if wire == 0 {
					break
				}
			}
			iNdEx -= sizeOfWire
			skippy, err := skipTimeseries(data[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthTimeseries
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	return nil
}
func skipTimeseries(data []byte) (n int, err error) {
	l := len(data)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := data[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for {
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if data[iNdEx-1] < 0x80 {
					break
				}
			}
			return iNdEx, nil
		case 1:
			iNdEx += 8
			return iNdEx, nil
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := data[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			iNdEx += length
			if length < 0 {
				return 0, ErrInvalidLengthTimeseries
			}
			return iNdEx, nil
		case 3:
			for {
				var innerWire uint64
				var start int = iNdEx
				for shift := uint(0); ; shift += 7 {
					if iNdEx >= l {
						return 0, io.ErrUnexpectedEOF
					}
					b := data[iNdEx]
					iNdEx++
					innerWire |= (uint64(b) & 0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				innerWireType := int(innerWire & 0x7)
				if innerWireType == 4 {
					break
				}
				next, err := skipTimeseries(data[start:])
				if err != nil {
					return 0, err
				}
				iNdEx = start + next
			}
			return iNdEx, nil
		case 4:
			return iNdEx, nil
		case 5:
			iNdEx += 4
			return iNdEx, nil
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
	}
	panic("unreachable")
}

var (
	ErrInvalidLengthTimeseries = fmt.Errorf("proto: negative length found during unmarshaling")
)


text:
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Theme information
 *
 * @package    PhpMyAdmin-theme
 * @subpackage PMAHomme
 */

/**
 * If you have problems or questions about this theme email
 * mikehomme@users.sourceforge.net
 */

/**
 * Icon set used by this theme: http://famfamfam.com/lab/icons/silk/
 */

$theme_name = 'Canyon';
$theme_full_version = '0.1';
?>


text:
package fixtures.requiredoptional;

import com.microsoft.rest.ServiceCall;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceResponse;
import fixtures.requiredoptional.models.Error;
import fixtures.requiredoptional.models.ErrorException;
import java.io.IOException;

/**
 * An instance of this class provides access to all the operations defined
 * in Implicits.
 */
public interface Implicits {
    /**
     * Test implicitly required path parameter.
     *
     * @param pathParameter the String value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the Error object wrapped in {@link ServiceResponse} if successful.
     */
    ServiceResponse<Error> getRequiredPath(String pathParameter) throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Test implicitly required path parameter.
     *
     * @param pathParameter the String value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall getRequiredPathAsync(String pathParameter, final ServiceCallback<Error> serviceCallback) throws IllegalArgumentException;

    /**
     * Test implicitly optional query parameter.
     *
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> putOptionalQuery() throws ErrorException, IOException;

    /**
     * Test implicitly optional query parameter.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall putOptionalQueryAsync(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
    /**
     * Test implicitly optional query parameter.
     *
     * @param queryParameter the String value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> putOptionalQuery(String queryParameter) throws ErrorException, IOException;

    /**
     * Test implicitly optional query parameter.
     *
     * @param queryParameter the String value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall putOptionalQueryAsync(String queryParameter, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;

    /**
     * Test implicitly optional header parameter.
     *
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> putOptionalHeader() throws ErrorException, IOException;

    /**
     * Test implicitly optional header parameter.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall putOptionalHeaderAsync(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
    /**
     * Test implicitly optional header parameter.
     *
     * @param queryParameter the String value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> putOptionalHeader(String queryParameter) throws ErrorException, IOException;

    /**
     * Test implicitly optional header parameter.
     *
     * @param queryParameter the String value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall putOptionalHeaderAsync(String queryParameter, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;

    /**
     * Test implicitly optional body parameter.
     *
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> putOptionalBody() throws ErrorException, IOException;

    /**
     * Test implicitly optional body parameter.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall putOptionalBodyAsync(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
    /**
     * Test implicitly optional body parameter.
     *
     * @param bodyParameter the String value
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the {@link ServiceResponse} object if successful.
     */
    ServiceResponse<Void> putOptionalBody(String bodyParameter) throws ErrorException, IOException;

    /**
     * Test implicitly optional body parameter.
     *
     * @param bodyParameter the String value
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall putOptionalBodyAsync(String bodyParameter, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;

    /**
     * Test implicitly required path parameter.
     *
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the Error object wrapped in {@link ServiceResponse} if successful.
     */
    ServiceResponse<Error> getRequiredGlobalPath() throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Test implicitly required path parameter.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall getRequiredGlobalPathAsync(final ServiceCallback<Error> serviceCallback) throws IllegalArgumentException;

    /**
     * Test implicitly required query parameter.
     *
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @throws IllegalArgumentException exception thrown from invalid parameters
     * @return the Error object wrapped in {@link ServiceResponse} if successful.
     */
    ServiceResponse<Error> getRequiredGlobalQuery() throws ErrorException, IOException, IllegalArgumentException;

    /**
     * Test implicitly required query parameter.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall getRequiredGlobalQueryAsync(final ServiceCallback<Error> serviceCallback) throws IllegalArgumentException;

    /**
     * Test implicitly optional query parameter.
     *
     * @throws ErrorException exception thrown from REST call
     * @throws IOException exception thrown from serialization/deserialization
     * @return the Error object wrapped in {@link ServiceResponse} if successful.
     */
    ServiceResponse<Error> getOptionalGlobalQuery() throws ErrorException, IOException;

    /**
     * Test implicitly optional query parameter.
     *
     * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
     * @throws IllegalArgumentException thrown if callback is null
     * @return the {@link ServiceCall} object
     */
    ServiceCall getOptionalGlobalQueryAsync(final ServiceCallback<Error> serviceCallback) throws IllegalArgumentException;

}