text:
#include "config.h"
#include "ScrollbarThemeQStyle.h"

#include "GraphicsContext.h"
#include "PlatformMouseEvent.h"
#include "RenderThemeQStyle.h"
#include "ScrollView.h"
#include "Scrollbar.h"

namespace WebCore {

ScrollbarThemeQStyle::ScrollbarThemeQStyle()
{
    m_qStyle = adoptPtr(RenderThemeQStyle::styleFactory()(/*page*/ 0));
}

ScrollbarThemeQStyle::~ScrollbarThemeQStyle()
{
}

static QStyleFacade::SubControl scPart(const ScrollbarPart& part)
{
    switch (part) {
    case NoPart:
        return QStyleFacade::SC_None;
    case BackButtonStartPart:
    case BackButtonEndPart:
        return QStyleFacade::SC_ScrollBarSubLine;
    case BackTrackPart:
        return QStyleFacade::SC_ScrollBarSubPage;
    case ThumbPart:
        return QStyleFacade::SC_ScrollBarSlider;
    case ForwardTrackPart:
        return QStyleFacade::SC_ScrollBarAddPage;
    case ForwardButtonStartPart:
    case ForwardButtonEndPart:
        return QStyleFacade::SC_ScrollBarAddLine;
    }

    return QStyleFacade::SC_None;
}

static ScrollbarPart scrollbarPart(const QStyleFacade::SubControl& sc)
{
    switch (sc) {
    case QStyleFacade::SC_None:
        return NoPart;
    case QStyleFacade::SC_ScrollBarSubLine:
        return BackButtonStartPart;
    case QStyleFacade::SC_ScrollBarSubPage:
        return BackTrackPart;
    case QStyleFacade::SC_ScrollBarSlider:
        return ThumbPart;
    case QStyleFacade::SC_ScrollBarAddPage:
        return ForwardTrackPart;
    case QStyleFacade::SC_ScrollBarAddLine:
        return ForwardButtonStartPart;
    }
    return NoPart;
}

static QStyleFacadeOption initSliderStyleOption(ScrollbarThemeClient* scrollbar, QObject* widget = 0)
{
    QStyleFacadeOption opt;
    if (widget) {
        opt.palette = widget->property("palette").value<QPalette>();
        opt.rect = widget->property("rect").value<QRect>();
        opt.direction = static_cast<Qt::LayoutDirection>(widget->property("layoutDirection").toInt());
    } else
        opt.state |= QStyleFacade::State_Active;

    opt.state &= ~QStyleFacade::State_HasFocus;

    opt.rect = scrollbar->frameRect();
    if (scrollbar->enabled())
        opt.state |= QStyleFacade::State_Enabled;
    if (scrollbar->controlSize() != RegularScrollbar)
        opt.state |= QStyleFacade::State_Mini;
    opt.slider.orientation = (scrollbar->orientation() == VerticalScrollbar) ? Qt::Vertical : Qt::Horizontal;

    if (scrollbar->orientation() == HorizontalScrollbar)
        opt.state |= QStyleFacade::State_Horizontal;
    else
        opt.state &= ~QStyleFacade::State_Horizontal;

    opt.slider.value = scrollbar->value();
    opt.slider.position = opt.slider.value;
    opt.slider.pageStep = scrollbar->pageStep();
    opt.slider.singleStep = scrollbar->lineStep();
    opt.slider.minimum = 0;
    opt.slider.maximum = qMax(0, scrollbar->maximum());
    ScrollbarPart pressedPart = scrollbar->pressedPart();
    ScrollbarPart hoveredPart = scrollbar->hoveredPart();
    if (pressedPart != NoPart) {
        opt.slider.activeSubControls = scPart(scrollbar->pressedPart());
        if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart
            || pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart
            || pressedPart == ThumbPart)
            opt.state |= QStyleFacade::State_Sunken;
    } else
        opt.slider.activeSubControls = scPart(hoveredPart);
    if (hoveredPart != NoPart)
        opt.state |= QStyleFacade::State_MouseOver;
    return opt;
}

bool ScrollbarThemeQStyle::paint(ScrollbarThemeClient* scrollbar, GraphicsContext* graphicsContext, const IntRect& dirtyRect)
{
    if (graphicsContext->updatingControlTints()) {
        scrollbar->invalidateRect(dirtyRect);
        return false;
    }

    StylePainterQStyle p(this, graphicsContext);
    if (!p.isValid())
        return true;

    p.painter->save();
    p.styleOption = initSliderStyleOption(scrollbar, m_qStyle->widgetForPainter(p.painter));

    p.painter->setClipRect(p.styleOption.rect.intersected(dirtyRect), Qt::IntersectClip);
    p.paintScrollBar();
    p.painter->restore();
    return true;
}

ScrollbarPart ScrollbarThemeQStyle::hitTest(ScrollbarThemeClient* scrollbar, const IntPoint& position)
{
    QStyleFacadeOption opt = initSliderStyleOption(scrollbar);
    const QPoint pos = scrollbar->convertFromContainingWindow(position);
    opt.rect.moveTo(QPoint(0, 0));
    QStyleFacade::SubControl sc = m_qStyle->hitTestScrollBar(opt, pos);
    return scrollbarPart(sc);
}

bool ScrollbarThemeQStyle::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt)
{
    // Middle click centers slider thumb (if supported).
    return m_qStyle->scrollBarMiddleClickAbsolutePositionStyleHint() && evt.button() == MiddleButton;
}

void ScrollbarThemeQStyle::invalidatePart(ScrollbarThemeClient* scrollbar, ScrollbarPart)
{
    // FIXME: Do more precise invalidation.
    scrollbar->invalidate();
}

int ScrollbarThemeQStyle::scrollbarThickness(ScrollbarControlSize controlSize)
{
    const bool mini = controlSize != RegularScrollbar;
    return m_qStyle->scrollBarExtent(mini);
}

int ScrollbarThemeQStyle::thumbPosition(ScrollbarThemeClient* scrollbar)
{
    if (scrollbar->enabled()) {
        float pos = (float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum();
        return (pos < 1 && pos > 0) ? 1 : pos;
    }
    return 0;
}

int ScrollbarThemeQStyle::thumbLength(ScrollbarThemeClient* scrollbar)
{
    QStyleFacadeOption opt = initSliderStyleOption(scrollbar);
    QRect thumb = m_qStyle->scrollBarSubControlRect(opt, QStyleFacade::SC_ScrollBarSlider);
    return scrollbar->orientation() == HorizontalScrollbar ? thumb.width() : thumb.height();
}

int ScrollbarThemeQStyle::trackPosition(ScrollbarThemeClient* scrollbar)
{
    QStyleFacadeOption opt = initSliderStyleOption(scrollbar);
    QRect track = m_qStyle->scrollBarSubControlRect(opt, QStyleFacade::SC_ScrollBarGroove);
    return scrollbar->orientation() == HorizontalScrollbar ? track.x() - scrollbar->x() : track.y() - scrollbar->y();
}

int ScrollbarThemeQStyle::trackLength(ScrollbarThemeClient* scrollbar)
{
    QStyleFacadeOption opt = initSliderStyleOption(scrollbar);
    QRect track = m_qStyle->scrollBarSubControlRect(opt, QStyleFacade::SC_ScrollBarGroove);
    return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height();
}

void ScrollbarThemeQStyle::paintScrollCorner(ScrollView*, GraphicsContext* context, const IntRect& rect)
{
    StylePainterQStyle p(this, context);
    if (!p.isValid())
        return;

    p.paintScrollCorner(rect);
}

}


text:
layout: organization
category: local

title: Deborah Hospital Foundation - Bay Ridge
impact_area: Health
keywords:
location_services:
location_offices:
website: http://www.deborahfoundation.org/website-foundation/chapters-regions/nyregion.html

description:
mission: |
  Founded in 1922, and with over 275 chapters, The Deborah Hospital offers help and heal to desperatly ill patients without worrying about cost.

cash_grants:
grants:
service_opp:
services:

learn:
cont_relationship:

salutation:
first_name:
last_name:
title_contact_person:

city: Brooklyn
state: NY
address: |
  157 Bay 14th Street
  Brooklyn NY 11214
lat: 40.60606
lng: -74.00884
phone: 201-645-3157
ext:
fax:
email:
preferred_contact:
contact_person_intro:
---

redpajama_set_name: RedPajamaGithub


text:
using eth.Telegram.BotApi.Internal.Serialization;
using System;
using System.Collections.Generic;

namespace eth.Telegram.BotApi.Events
{
    public class RequestEventArgs
    {
        public object ApiOwner { get; }

        public ApiMethod Method { get; }
        public List<ApiArgument> Arguments { get; }

        public bool MultipartRequired { get; private set; }

        public bool ResponseIsForced { get; private set; }
        public object ForcedResponse { get; private set; }

        protected RequestEventArgs(ApiMethod method, List<ApiArgument> arguments, bool multipartRequired, object apiOwner)
        {
            ApiOwner = apiOwner;

            Method = method;
            Arguments = arguments;

            MultipartRequired = multipartRequired;
        }

        public void RequireMultipart()
        {
            MultipartRequired = true;
        }

        public virtual void ForceResponse(object response)
        {
            if (ResponseIsForced)
                throw new InvalidOperationException("response is already forced");

            ResponseIsForced = true;
            ForcedResponse = response;
        }
    }

    internal sealed class RequestEventArgs<TResponse> : RequestEventArgs
    {
        public new TResponse ForcedResponse { get; private set; }

        internal RequestEventArgs(ApiMethod method, ApiArgs args, bool multipartRequired, object apiOwner) : base(method, args, multipartRequired, apiOwner) { }

        public override void ForceResponse(object response)
        {
            if (!(response is TResponse))
                throw new ArgumentException($"forced response is not of type {typeof(TResponse)}");

            base.ForceResponse(response);

            ForcedResponse = (TResponse)response;
        }
    }
}


text:
using System;
using System.Runtime.Serialization;

namespace NStore.Persistence.Mongo
{
    [Serializable]
    public class MongoPersistenceException : Exception
    {
        public MongoPersistenceException()
        {
        }

        public MongoPersistenceException(string message) : base(message)
        {
        }

        public MongoPersistenceException(string message, Exception innerException) : base(message, innerException)
        {
        }

        protected MongoPersistenceException(SerializationInfo info, StreamingContext context) : base(info, context)
        {
        }
    }
}


text:
FROM debian:wheezy

MAINTAINER saksmlz <saksmlz@gmail.com>

ENV RUBY_MAJOR 2.2
ENV RUBY_VERSION 2.2.3
ENV LIBMAXMIND_VERSION 1.0.4

COPY install-ruby.sh /install-ruby.sh
COPY install-libmaxminddb.sh /install-libmaxminddb.sh

# some of ruby's build scripts are written in ruby
# we purge this later to make sure our final image uses what we just built
RUN apt-get update \
  && apt-get upgrade -y \
  && apt-get install -y curl wget procps make bison ruby bzip2 autoconf gcc build-essential zlib1g-dev \
    libssl-dev libffi-dev libreadline-dev ca-certificates git\
  && /install-ruby.sh \
  && /install-libmaxminddb.sh \
  && apt-get purge -y --auto-remove curl wget bison ruby bzip2 autoconf build-essential \
    libffi-dev libreadline-dev \
  && rm -rf /var/lib/apt/lists/*

# skip installing gem documentation
RUN echo 'gem: --no-rdoc --no-ri' >> "$HOME/.gemrc"

# install things globally, for great justice
ENV GEM_HOME /usr/local/bundle
ENV PATH $GEM_HOME/bin:$PATH

RUN gem install bundler \
  && bundle config --global path "$GEM_HOME" \
  && bundle config --global bin "$GEM_HOME/bin"

# don't create ".bundle" in all our apps
ENV BUNDLE_APP_CONFIG $GEM_HOME

RUN rm /install-ruby.sh
RUN rm /install-libmaxminddb.sh

CMD [ "irb" ]


text:
import byline from "byline";

TabSeperatedFile = function (options) {
  FileHandler.call(this, options);
};

TabSeperatedFile.prototype = Object.create(FileHandler.prototype);
TabSeperatedFile.prototype.constructor = TabSeperatedFile;

TabSeperatedFile.prototype.parse = function () {
  var self = this;
  return new Q.Promise(function (resolve, reject) {
    // lineBufferMax chosen based on crude yet effective testing:
    // https://docs.google.com/spreadsheets/d/1wA4KPXEhE4eroZaiKUL92dP0Gi1uFG8qCGSDjCaMcwo/edit?usp=sharing
    // "Show me the data!" - Ted

    // The parser parses line-by-line for the first headerLineCount lines
    // and then runs lineBufferMax lines simultaneously to speed it up.
    // This is so that any variables in the header are set for future
    // lines if needed.
    // ex. this.sample_label requires a mongodb lookup for UUID mapping
    var lineBufferMax = 1;
    var headerLineCount = 10;

    var lineBufferPromises = [];
    var allLinePromises = [];
    var lineNumber = 0; // starts at one (no really, I promise!)

    function rejectThenCleanup(reason) {
      reject(reason);

      // NOTE: not in Meteor environment
      self.cleanupAfterError.call(self);
    }

    // store stream in a variable so it can be paused
    var bylineStream = byline(self.blob.createReadStream("blobs"));
    bylineStream.on('data', Meteor.bindEnvironment(function (lineObject) {
      var deferred = Q.defer();
      lineBufferPromises.push(deferred.promise);
      allLinePromises.push(deferred.promise);

      var line = lineObject.toString();
      var brokenTabs = line.split("\t");

      lineNumber++;
      var thisLineNumber = lineNumber; // so that it has function scope

      // This reads up to lineBufferMax lines and then waits for those lines
      // to finish completely before moving on.
      // NOTE: the rest of the function will still run even after the
      //       stream has been paused
      if (lineBufferPromises.length >= lineBufferMax ||
          thisLineNumber < headerLineCount) {
        bylineStream.pause();
        Q.allSettled(lineBufferPromises)
          .then(Meteor.bindEnvironment(function (values) {
            lineBufferPromises = [];
            bylineStream.resume();
          }, rejectThenCleanup));
      }

      // I guess we should parse the line eventually...
      Q.resolve(self.parseLine.call(self, brokenTabs, thisLineNumber, line))
        .then(deferred.resolve)
        .catch(deferred.rejectThenCleanup);
    }, rejectThenCleanup));

    bylineStream.on('end', Meteor.bindEnvironment(function () {
      // console.log("allLinePromises.slice(0, 5:)", allLinePromises.slice(0, 5));
      Q.all(allLinePromises)
        .then(Meteor.bindEnvironment(function () {
          Q.resolve(self.endOfFile.call(self))
            .then(resolve)
            .catch(rejectThenCleanup);
        }, rejectThenCleanup))
        .catch(rejectThenCleanup);
    }, rejectThenCleanup));
  });
};

TabSeperatedFile.prototype.parseLine = function (brokenTabs, lineNumber, line) {
  throw "parseLine function not overridden";
};

TabSeperatedFile.prototype.endOfFile = function () {
  console.log("endOfFile not overridden");
};

TabSeperatedFile.prototype.ensureRectangular = function (brokenTabs, lineNumber) {
  if (!lineNumber) { // TODO: should just have a test for this?
    throw new Error("lineNumber not defined");
  }

  if (this.tabCount === undefined) {
    this.tabCount = brokenTabs.length;
  } else {
    if (this.tabCount !== brokenTabs.length) {
      throw "File not rectangular. " +
          "Line " + lineNumber + " has " + brokenTabs.length +
          " columns, not " + this.tabCount;
    }
  }
};

TabSeperatedFile.prototype.cleanupAfterError = function () {}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<title>Boost.Hana: MonadPlus</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Boost.Hana
    1.7.1

Your standard library for metaprogramming

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Variables

MonadPlus
Concepts

Description

The MonadPlus concept represents Monads with a monoidal structure.

Intuitively, whereas a Monad can be seen as some kind of container or context, a MonadPlus can be seen as a container or a context that can be concatenated with other containers or contexts. There must also be an identity element for this combining operation. For example, a tuple is a MonadPlus, because tuples can be concatenated and the empty tuple would act as an identity for concatenation. How is this different from a Monad which is also a Monoid? The answer is that the monoidal structure on a MonadPlus must not depend of the contents of the structure; it must not require the contents to be a Monoid in order to work.

While sequences are not the only possible model for MonadPlus, the method names used here refer to the MonadPlus of sequences under concatenation. Several useful functions generalizing operations on sequences are included with this concept, like append, prepend and filter.

Note

This documentation does not go into much details about the nature of the MonadPlus concept. However, there is a nice Haskell-oriented WikiBook going into further details.

Minimal complete definition

concat and empty

Laws

First, a MonadPlus is required to have a monoidal structure. Hence, it is no surprise that for any MonadPlus M, we require M(T) to be a valid monoid. However, we do not enforce that M(T) actually models the Monoid concept provided by Hana. Further, for all objects a, b, c of data type M(T),

// identity

concat(empty<M(T)>(), a) == a

concat(a, empty<M(T)>()) == a

// associativity

concat(a, concat(b, c)) == concat(concat(a, b), c)

boost::hana::concat

constexpr auto concat

Combine two monadic structures together.

Definition: concat.hpp:47

boost::hana::empty

constexpr auto empty

Identity of the monadic combination concat.

Definition: empty.hpp:36

Secondly, a MonadPlus is also required to obey the following laws, which represent the fact that empty<M(T)>() must be some kind of absorbing element for the chain operation. For all objects a of data type M(T) and functions \( f : T \to M(U) \),

chain(empty<M(T)>(), f)         == empty<M(U)>()

chain(a, always(empty<M(T)>())) == empty<M(U)>()

boost::hana::always

constexpr auto always

Return a constant function returning x regardless of the argument(s) it is invoked with.

Definition: always.hpp:37

Refined concepts

Functor, Applicative and Monad

Concrete models

hana::optional, hana::tuple

Variables

constexpr auto 	boost::hana::append

 	Append an element to a monadic structure.  More...

constexpr auto 	boost::hana::concat

 	Combine two monadic structures together.  More...

constexpr auto 	boost::hana::cycle

 	Combine a monadic structure with itself n times.  More...

template<typename M >

constexpr auto 	boost::hana::empty

 	Identity of the monadic combination concat.  More...

constexpr auto 	boost::hana::filter

 	Filter a monadic structure using a custom predicate.  More...

constexpr auto 	boost::hana::prefix

 	Inserts a value before each element of a monadic structure.  More...

constexpr auto 	boost::hana::prepend

 	Prepend an element to a monadic structure.  More...

 	boost::hana::mathrm

 	Remove all the elements of a monadic structure that are equal to some value.  More...

template<typename M >

constexpr auto 	boost::hana::replicate

 	Create a monadic structure by combining a lifted value with itself n times.  More...

constexpr auto 	boost::hana::suffix

 	Inserts a value after each element of a monadic structure.  More...

Variable Documentation

◆ append

          constexpr auto boost::hana::append

constexpr

#include <boost/hana/fwd/append.hpp>

Initial value:

= [](auto&& xs, auto&& x) {

        return tag-dispatched;

    }

Append an element to a monadic structure.

Given an element x and a monadic structure xs, append returns a new monadic structure which is the result of lifting x into the monadic structure and then combining that (to the right) with xs. In other words,

append(xs, x) == concat(xs, lift<Xs>(x))

boost::hana::append

constexpr auto append

Append an element to a monadic structure.

Definition: append.hpp:52

 where Xs is the tag of xs. For sequences, this has the intuitive behavior of simply appending an element to the end of the sequence, hence the name.

#### Rationale for not calling this push_back See the rationale for using prepend instead of push_front.

Signature

Given a MonadPlus M, the signature is \( \mathtt{append} : M(T) \times T \to M(T) \).

Parameters

xs	A monadic structure that will be combined to the left of the element.

x	An element to combine to the right of the monadic structure.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/append.hpp>

#include <boost/hana/equal.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

static_assert(hana::append(hana::make_tuple(), 1) == hana::make_tuple(1), "");

static_assert(hana::append(hana::make_tuple(1, '2'), 3.3) == hana::make_tuple(1, '2', 3.3), "");

static_assert(hana::append(hana::append(hana::append(hana::make_tuple(), 1), '2'), 3.3) == hana::make_tuple(1, '2', 3.3), "");

int main() { }

append.hpp

Defines boost::hana::append.

equal.hpp

Defines boost::hana::equal.

boost::hana

Namespace containing everything in the library.

Definition: accessors.hpp:20

tuple.hpp

Defines boost::hana::tuple.

◆ concat

          constexpr auto boost::hana::concat

constexpr

#include <boost/hana/fwd/concat.hpp>

Initial value:

= [](auto&& xs, auto&& ys) {

        return tag-dispatched;

    }

Combine two monadic structures together.

Given two monadic structures, concat combines them together and returns a new monadic structure. The exact definition of concat will depend on the exact model of MonadPlus at hand, but for sequences it corresponds intuitively to simple concatenation.

Also note that combination is not required to be commutative. In other words, there is no requirement that

concat(xs, ys) == concat(ys, xs)

 and indeed it does not hold in general.

Signature

Given a MonadPlus M, the signature of concat is \( \mathtt{concat} : M(T) \times M(T) \to M(T) \).

Parameters

xs,ys	Two monadic structures to combine together.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/concat.hpp>

#include <boost/hana/equal.hpp>

#include <boost/hana/integral_constant.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

using namespace hana::literals;

static_assert(

    hana::concat(hana::make_tuple(1, '2'), hana::make_tuple(3.3, 4_c))

        ==

    hana::make_tuple(1, '2', 3.3, 4_c)

, "");

int main() { }

concat.hpp

Defines boost::hana::concat.

integral_constant.hpp

Defines boost::hana::integral_constant.

◆ cycle

          constexpr auto boost::hana::cycle

constexpr

#include <boost/hana/fwd/cycle.hpp>

Initial value:

= [](auto&& xs, auto const& n) {

        return tag-dispatched;

    }

Combine a monadic structure with itself n times.

Given a monadic structure xs and a non-negative number n, cycle returns a new monadic structure which is the result of combining xs with itself n times using the concat operation. In other words,

cycle(xs, n) == concat(xs, concat(xs, ... concat(xs, xs)))

                                  // ^^^^^ n times total

boost::hana::cycle

constexpr auto cycle

Combine a monadic structure with itself n times.

Definition: cycle.hpp:60

Also note that since concat is required to be associative, we could also have written

cycle(xs, n) == concat(concat(... concat(xs, xs), xs), xs)

                          // ^^^^^ n times total

If n is zero, then the identity of concat, empty, is returned. In the case of sequences, this boils down to returning a sequence containing n copies of itself; for other models it might differ.

Signature

Given an IntegralConstant C and a MonadPlus M, the signature is \( \mathrm{cycle} : M(T) \times C \to M(T) \).

Parameters

xs	A monadic structure to combine with itself a certain number of times.

n	A non-negative IntegralConstant representing the number of times to combine the monadic structure with itself. If n is zero, cycle returns empty.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/cycle.hpp>

#include <boost/hana/equal.hpp>

#include <boost/hana/integral_constant.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

static_assert(hana::cycle(hana::make_tuple('x', 'y'), hana::size_c<2>) == hana::make_tuple('x', 'y', 'x', 'y'), "");

int main() { }

cycle.hpp

Defines boost::hana::cycle.

◆ empty

template<typename M >

          constexpr auto boost::hana::empty

constexpr

#include <boost/hana/fwd/empty.hpp>

Initial value:

= []() {

        return tag-dispatched;

    }

Identity of the monadic combination concat.

Signature

Given a MonadPlus M, the signature is \( \mathtt{empty}_M : \emptyset \to M(T) \).

Template Parameters

M	The tag of the monadic structure to return. This must be a model of the MonadPlus concept.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/assert.hpp>

#include <boost/hana/empty.hpp>

#include <boost/hana/equal.hpp>

#include <boost/hana/optional.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

BOOST_HANA_CONSTANT_CHECK(hana::empty<hana::tuple_tag>() == hana::make_tuple());

BOOST_HANA_CONSTANT_CHECK(hana::empty<hana::optional_tag>() == hana::nothing);

int main() { }

assert.hpp

Defines macros to perform different kinds of assertions.

empty.hpp

Defines boost::hana::empty.

BOOST_HANA_CONSTANT_CHECK

#define BOOST_HANA_CONSTANT_CHECK(...)

Equivalent to BOOST_HANA_CONSTANT_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTI...

Definition: assert.hpp:239

optional.hpp

Defines boost::hana::optional.

◆ filter

          constexpr auto boost::hana::filter

constexpr

#include <boost/hana/fwd/filter.hpp>

Initial value:

= [](auto&& xs, auto&& pred) {

        return tag-dispatched;

    }

Filter a monadic structure using a custom predicate.

Given a monadic structure and a predicate, filter returns a new monadic structure containing only those elements that satisfy the predicate. This is a generalization of the usual filter function for sequences; it works for any MonadPlus. Intuitively, filter is somewhat equivalent to:

filter(xs, pred) == flatten(transform(xs, [](auto x) {

    return pred(x) ? lift<Xs>(x) : empty<Xs>();

})

boost::hana::filter

constexpr auto filter

Filter a monadic structure using a custom predicate.

Definition: filter.hpp:65

 In other words, we basically turn a monadic structure containing [x1, ..., xn] into a monadic structure containing

[

    pred(x1) ? [x1] : [],

    pred(x2) ? [x2] : [],

    ...

    pred(xn) ? [xn] : []

]

 and we then flatten that.

Signature

Given a MonadPlus M and an IntegralConstant Bool holding a value of type bool, the signature is \( \mathtt{filter} : M(T) \times (T \to \mathtt{Bool}) \to M(T) \).

Parameters

xs	The monadic structure to filter.

pred	A function called as pred(x) for each element x in the monadic structure and returning whether that element should be kept in the resulting structure. In the current version of the library, the predicate has to return an IntegralConstant holding a value convertible to a bool.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/assert.hpp>

#include <boost/hana/equal.hpp>

#include <boost/hana/ext/std/integral_constant.hpp>

#include <boost/hana/filter.hpp>

#include <boost/hana/functional/compose.hpp>

#include <boost/hana/optional.hpp>

#include <boost/hana/tuple.hpp>

#include <boost/hana/type.hpp>

#include <type_traits>

namespace hana = boost::hana;

// First take the type of an object, and then tell whether it's integral

constexpr auto is_integral = hana::compose(hana::trait<std::is_integral>, hana::typeid_);

static_assert(hana::filter(hana::make_tuple(1, 2.0, 3, 4.0), is_integral) == hana::make_tuple(1, 3), "");

static_assert(hana::filter(hana::just(3), is_integral) == hana::just(3), "");

BOOST_HANA_CONSTANT_CHECK(hana::filter(hana::just(3.0), is_integral) == hana::nothing);

int main() { }

compose.hpp

Defines boost::hana::compose.

integral_constant.hpp

Adapts std::integral_constant for use with Hana.

filter.hpp

Defines boost::hana::filter.

boost::hana::compose

constexpr auto compose

Return the composition of two functions or more.

Definition: compose.hpp:52

type.hpp

Defines boost::hana::type and related utilities.

◆ prefix

          constexpr auto boost::hana::prefix

constexpr

#include <boost/hana/fwd/prefix.hpp>

Initial value:

= [](auto&& xs, auto&& pref) {

        return tag-dispatched;

    }

Inserts a value before each element of a monadic structure.

Given a monadic structure xs and a value z called the prefix, prefix returns a new monadic structure. prefix satisfies

prefix(xs, z) == flatten(transform(xs, [](auto x) {

    return concat(lift<M>(z), lift<M>(x));

}))

boost::hana::prefix

constexpr auto prefix

Inserts a value before each element of a monadic structure.

Definition: prefix.hpp:56

For sequences, this simply corresponds to inserting the prefix before each element of the sequence. For example, given a sequence [x1, ..., xn], prefix will return

[z, x1, z, x2, ..., z, xn]

 As explained above, this can be generalized to other MonadPlus models, with various levels of interest.

Signature

Given a MonadPlus M, the signature is \( \mathrm{prefix} : M(T) \times T \to M(T) \).

Parameters

xs	A monadic structure.

pref	A value (the prefix) to insert before each element of a monadic structure.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/assert.hpp>

#include <boost/hana/equal.hpp>

#include <boost/hana/prefix.hpp>

#include <boost/hana/tuple.hpp>

#include <string>

namespace hana = boost::hana;

using namespace std::literals;

int main() {

    BOOST_HANA_RUNTIME_CHECK(

        hana::prefix(hana::make_tuple("dog"s, "car"s, "house"s), "my"s)

            ==

        hana::make_tuple("my", "dog", "my", "car", "my", "house")

    );

}

BOOST_HANA_RUNTIME_CHECK

#define BOOST_HANA_RUNTIME_CHECK(...)

Equivalent to BOOST_HANA_RUNTIME_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTIO...

Definition: assert.hpp:209

prefix.hpp

Defines boost::hana::prefix.

◆ prepend

          constexpr auto boost::hana::prepend

constexpr

#include <boost/hana/fwd/prepend.hpp>

Initial value:

= [](auto&& xs, auto&& x) {

        return tag-dispatched;

    }

Prepend an element to a monadic structure.

Given a monadic structure xs and an element x, prepend returns a new monadic structure which is the result of lifting x into the monadic structure and then combining that (to the left) with xs. In other words,

prepend(xs, x) == concat(lift<Xs>(x), xs)

boost::hana::prepend

constexpr auto prepend

Prepend an element to a monadic structure.

Definition: prepend.hpp:57

For sequences, this has the intuitive behavior of simply prepending an element to the beginning of the sequence, hence the name.

#### Rationale for not calling this push_front While push_front is the de-facto name used in the standard library, it also strongly suggests mutation of the underlying sequence, which is not the case here. The author also finds that push_front suggests too strongly the sole interpretation of putting an element to the front of a sequence, whereas prepend is slightly more nuanced and bears its name better for e.g. hana::optional.

Signature

Given a MonadPlus M, the signature is \( \mathtt{prepend} : M(T) \times T \to M(T) \).

Parameters

xs	A monadic structure that will be combined to the right of the element.

x	An element to combine to the left of the monadic structure.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/equal.hpp>

#include <boost/hana/prepend.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

static_assert(hana::prepend(hana::make_tuple(), 1) == hana::make_tuple(1), "");

static_assert(hana::prepend(hana::make_tuple('2', 3.3), 1) == hana::make_tuple(1, '2', 3.3), "");

int main() { }

prepend.hpp

Defines boost::hana::prepend.

◆ mathrm

          boost::hana::mathrm

#include <boost/hana/fwd/remove.hpp>

Initial value:

{remove} : M(T) \times T \to M(T)

        \f$

    constexpr auto remove = [](auto&& xs, auto&& value) {

        return tag-dispatched;

    }

boost::hana::value

constexpr auto value

Return the compile-time value associated to a constant.

Definition: value.hpp:54

boost::hana::to

constexpr auto to

Converts an object from one data type to another.

Definition: to.hpp:97

Remove all the elements of a monadic structure that are equal to some value.

Remove all the elements of a monadic structure that satisfy some predicate.

Given a monadic structure xs and a value, remove returns a new monadic structure equal to xs without all its elements that are equal to the given value. remove is equivalent to remove_if with the equal.to(value) predicate, i.e.

remove(xs, value) == remove_if(xs, equal.to(value))

boost::hana::equal

constexpr auto equal

Returns a Logical representing whether x is equal to y.

Definition: equal.hpp:64

Signature

Given a MonadPlus M and a value of type T, the signature is

Given a monadic structure xs and a unary predicate, remove_if returns a new monadic structure equal to xs without all its elements that satisfy the predicate. This is equivalent to filter with a negated predicate, i.e.

remove_if(xs, predicate) == filter(xs, negated predicated)

Signature

Given a MonadPlus M and a predicate of type \( T \to Bool \) for some compile-time Logical Bool, the signature is

◆ replicate

template<typename M >

          constexpr auto boost::hana::replicate

constexpr

#include <boost/hana/fwd/replicate.hpp>

Initial value:

= [](auto&& x, auto const& n) {

        return tag-dispatched;

    }

Create a monadic structure by combining a lifted value with itself n times.

Given a value x, a non-negative IntegralConstant n and the tag of a monadic structure M, replicate creates a new monadic structure which is the result of combining x with itself n times inside the monadic structure. In other words, replicate simply lifts x into the monadic structure, and then combines that with itself n times:

replicate<M>(x, n) == cycle(lift<M>(x), n)

If n is zero, then the identity of the concat operation is returned. In the case of sequences, this corresponds to creating a new sequence holding n copies of x.

Signature

Given an IntegralConstant C and MonadPlus M, the signature is \( \mathtt{replicate}_M : T \times C \to M(T) \).

Template Parameters

M	The tag of the returned monadic structure. It must be a model of the MonadPlus concept.

Parameters

x	The value to lift into a monadic structure and then combine with itself.

n	A non-negative IntegralConstant representing the number of times to combine lift<M>(x) with itself. If n == 0, replicate returns empty<M>().

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/equal.hpp>

#include <boost/hana/integral_constant.hpp>

#include <boost/hana/optional.hpp>

#include <boost/hana/replicate.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

static_assert(hana::replicate<hana::tuple_tag>('x', hana::size_c<2>) == hana::make_tuple('x', 'x'), "");

// Of course, there can't be more than one element in an `optional`.

static_assert(hana::replicate<hana::optional_tag>('x', hana::size_c<2>) == hana::just('x'), "");

int main() { }

replicate.hpp

Defines boost::hana::replicate.

◆ suffix

          constexpr auto boost::hana::suffix

constexpr

#include <boost/hana/fwd/suffix.hpp>

Initial value:

= [](auto&& xs, auto&& sfx) {

        return tag-dispatched;

    }

Inserts a value after each element of a monadic structure.

Given a monadic structure xs and a value z (called the suffix), suffix returns a new monadic structure such that

suffix(xs, z) == flatten(transform(xs, [](auto x) {

    return concat(lift<M>(x), lift<M>(z));

}))

boost::hana::suffix

constexpr auto suffix

Inserts a value after each element of a monadic structure.

Definition: suffix.hpp:56

For sequences, this simply corresponds to inserting the suffix after each element of the sequence. For example, given a sequence [x1, ..., xn], suffix will return

[x1, z, x2, z, ..., xn, z]

 As explained above, this can be generalized to other MonadPlus models, with various levels of interest.

Signature

Given a MonadPlus M, the signature is \( \mathtt{suffix} : M(T) \times T \to M(T) \).

Parameters

xs	A monadic structure.

sfx	A value (the suffix) to insert after each element of a monadic structure.

Example

// Copyright Louis Dionne 2013-2017

// Distributed under the Boost Software License, Version 1.0.

// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)

#include <boost/hana/equal.hpp>

#include <boost/hana/suffix.hpp>

#include <boost/hana/tuple.hpp>

namespace hana = boost::hana;

static_assert(

    hana::suffix(hana::make_tuple(1, 2, 3, 4), 0) == hana::make_tuple(1, 0, 2, 0, 3, 0, 4, 0)

, "");

int main() { }

suffix.hpp

Defines boost::hana::suffix.


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="concept" name="DC.Type" />
<meta name="DC.Title" content="How this guide is organized" />
<meta scheme="URI" name="DC.Relation" content="crefmpref1002477.html" />
<meta scheme="URI" name="DC.Relation" content="crefmpref11181.html" />
<meta scheme="URI" name="DC.Relation" content="crefmpref23223.html" />
<meta scheme="URI" name="DC.Relation" content="crefmprefsyntax.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="crefmpref23947" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>How this guide is organized</title>

How this guide is organized

This guide includes the following sections:

SQL language reference
Reference information
about Derby's SQL language,
including manual pages for statements, functions, and other syntax elements.

SQL reserved words

SQL keywords beyond the standard SQL-92 keywords.

Derby support for SQL-92 features
A list of
SQL-92 features that Derby does
and does not support.

Derby system tables
Reference
information about the Derby system
catalogs.

Derby exception messages and SQL states
Information
about Derby exception messages.

JDBC reference
Information
about Derby's implementation
of the Java Database Connectivity (JDBC) API.

Setting attributes for the database connection URL
Information
about the supported attributes to Derby's
JDBC database connection URL.

Derby property reference

Information about Derby
properties.

Java EE Compliance: Java Transaction API and javax.sql Interfaces
Information
about Derby's support for the
Java EE platform, in particular support for the Java Transaction API and the
JDBC API.

Derby API
Notes
about proprietary APIs for Derby.

Supported locales
Locales
supported by Derby.

Derby limitations
Limitations
of Derby.

Parent topic: About this guide

Related concepts

Purpose of this document

Audience

SQL syntax used in this manual


text:
require "minitest/autorun"
require "open3"

class IntegrationSpec < MiniTest::Spec
  describe 'without a task' do
    it 'explains how to use the executable' do
      assert_stdout /Usage: duty <task> \[<args>\]\s{1}/ do
        exec(duty)
      end
    end

    it 'lists all available tasks' do
      assert_stdout /Tasks:/ do
        exec(duty)
      end

      assert_stdout /test\s*TODO: Describe your task by overwriting `self\.description`/ do
        exec(duty)
      end
    end
  end

  describe 'with unknown task' do
    it 'explains that the given task is invalid' do
      assert_stdout /duty: `foo bar` is not a duty task/ do
        exec("#{duty} foo bar")
      end
    end
  end

  describe 'with --cmplt for shell completion' do
    it 'returns all tasks without input' do
      assert_stdout /test/ do
        exec("#{duty} --cmplt")
      end
    end

    it 'returns matching tasks with input' do
      assert_stdout /test/ do
        exec("#{duty} --cmplt t")
      end
    end
  end

  describe 'with known task' do
    describe 'test' do
      describe 'invalid usage' do
        it 'describes the task' do
          assert_stdout /TODO: Describe your task by overwriting `self.description`/ do
            exec("#{duty} test")
          end
        end

        it 'explains how to use the task' do
          assert_stdout /TODO: Explain your task by overwriting `self.usage`/ do
            exec("#{duty} test")
          end
        end
      end

      describe 'valid usage' do
        describe 'sequential' do
          describe 'with shell commands' do
            it 'runs commands in isolation' do
              assert_stdout /#{check_mark} Unknown shell command/ do
                exec("#{duty} test parallel")
              end

              assert_stdout /#{check_mark} First parallel shell command/ do
                exec("#{duty} test parallel")
              end

              assert_stderr /#{cross_mark} Second parallel shell command/ do
                exec("#{duty} test parallel")
              end

              assert_stderr /#{cross_mark} Test task aborted/ do
                exec("#{duty} test parallel")
              end

              refute_stdout /Third parallel shell command/ do
                exec("#{duty} test parallel")
              end

              refute_stderr /Third parallel shell command/ do
                exec("#{duty} test parallel")
              end

              assert_stdout /#{check_mark} Unknown ruby command/ do
                exec("#{duty} test parallel")
              end

              assert_stdout /#{check_mark} First parallel ruby command/ do
                exec("#{duty} test parallel")
              end

              assert_stderr /#{cross_mark} Second parallel ruby command/ do
                exec("#{duty} test parallel")
              end

              assert_stderr /#{cross_mark} Test task aborted/ do
                exec("#{duty} test parallel")
              end

              refute_stdout /Third parallel ruby command/ do
                exec("#{duty} test parallel")
              end

              refute_stderr /Third parallel ruby command/ do
                exec("#{duty} test parallel")
              end
            end
          end
        end

        describe 'sequential' do
          describe 'with shell commands' do
            it 'stops execution as soon as one task fails' do
              assert_stdout /#{check_mark} Unknown shell command/ do
                exec("#{duty} test sequential shell")
              end

              assert_stdout /#{check_mark} First sequential shell command/ do
                exec("#{duty} test sequential shell")
              end

              assert_stderr /#{cross_mark} Second sequential shell command/ do
                exec("#{duty} test sequential shell")
              end

              assert_stderr /#{cross_mark} Test task aborted/ do
                exec("#{duty} test sequential shell")
              end

              refute_stdout /Third sequential shell command/ do
                exec("#{duty} test sequential shell")
              end

              refute_stderr /Third sequential shell command/ do
                exec("#{duty} test sequential shell")
              end
            end
          end

          describe 'with ruby commands' do
            it 'stops execution as soon as one task fails' do
              assert_stdout /#{check_mark} Unknown ruby command/ do
                exec("#{duty} test sequential ruby")
              end

              assert_stdout /#{check_mark} First sequential ruby command/ do
                exec("#{duty} test sequential ruby")
              end

              assert_stderr /#{cross_mark} Second sequential ruby command/ do
                exec("#{duty} test sequential ruby")
              end

              assert_stderr /#{cross_mark} Test task aborted/ do
                exec("#{duty} test sequential ruby")
              end

              refute_stdout /Third sequential ruby command/ do
                exec("#{duty} test sequential ruby")
              end

              refute_stderr /Third sequential ruby command/ do
                exec("#{duty} test sequential ruby")
              end
            end
          end
        end
      end
    end
  end

  private

  def duty
    File.expand_path("../../bin/duty", __FILE__)
  end

  def duty_file
    '.duty.yml'
  end

  def check_mark
    "\u2713".encode('utf-8')
  end

  def cross_mark
    "\u2715".encode('utf-8')
  end

  def assert_stdout(expected, &task)
    stdout, stderr, status = yield task
    unless status.success?
      assert_equal 0, status.exitstatus, stderr
    end
    assert_match expected, stdout, "Expected stdout to be #{expected} but got #{stdout}"
  end

  def refute_stdout(expected, &task)
    stdout, _, _ = yield task
    refute_match expected, stdout, "Expected stdout to be #{expected} but got #{stdout}"
  end

  def assert_stderr(expected, &task)
    stdout, stderr, status = yield task
    unless status.success?
      assert_equal 0, status.exitstatus, stderr
    end
    assert_match expected, stderr, "Expected stdout to be #{expected} but got #{stderr}"
  end

  def refute_stderr(expected, &task)
    _, stderr, _ = yield task
    refute_match expected, stderr, "Expected stdout to be #{expected} but got #{stderr}"
  end

  def exec(*tasks)
    duty_config = "tasks:\n  - #{__dir__}/support/integration_test_plugin.rb"
    Dir.mktmpdir do |dir|
      tasks.each do |task|
        @last_task = capture(task, :chdir => dir, :duty_config => duty_config)
      end
      @last_task
    end
  end

  def capture(task, options = {})
    if duty_config = options.delete(:duty_config)
      Open3.capture3("echo '#{duty_config}' > #{duty_file}", options)
    end

    stdout, stderr, status = Open3.capture3(task, options)
  end
end


text:
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<project name="org.apache.easyant.plugins;ivy-publication-test" xmlns:au="antlib:org.apache.ant.antunit"
    xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:ea="antlib:org.apache.easyant">

    <!-- Import your plugin -->
    <property name="target" value="${basedir}/target/test-antunit" />

    <!-- configure easyant in current project -->
    <ea:configure-easyant-ivy-instance />
    <!-- import our local plugin -->
    <ea:import-test-module moduleIvy="../../../module.ivy" sourceDirectory="../../main/resources" />

    <!-- Defines a setUp / tearDown (before each test) that cleans the environnement -->
    <target name="clean" description="remove stale build artifacts before / after each test">
        <delete dir="${basedir}" includeemptydirs="true">
            <include name="**/target/**" />
            <include name="**/lib/**" />
        </delete>
    </target>

    <target name="setUp" depends="clean">
        <property name="ivy.local.default.root" value="${target}/local-repo" />
        <property name="ivy.shared.default.root" value="${target}/shared-repo" />
        <property name="project.ivy.file" value="sample-module.ivy" />
        <property name="project.ivy.instance" value="test.ivy.instance" />
        <ivy:configure settingsId="${project.ivy.instance}" url="${ivy.default.settings.dir}/ivysettings.xml"/>
        <ivy:resolve file="${project.ivy.file}" settingsRef="${project.ivy.instance}"  />
        <mkdir dir="${target}/artifacts" />
        <echo file="${target}/artifacts/standard-java-app.jar" />
    </target>
    <target name="tearDown" depends="clean" />

    <target name="test-ivy-publication:init" depends="-ivy-publication:init">
        <au:assertPropertyEquals name="release.resolver" value="shared" />
        <au:assertPropertyEquals name="shared.resolver" value="shared" />
        <au:assertPropertyEquals name="local.resolver" value="local" />
        <au:assertPropertyEquals name="publish.overwrite" value="false" />
        <au:assertPropertyEquals name="ivy.haltonmissing" value="true" />
        <au:assertPropertyEquals name="target.artifacts" value="${target}/artifacts" />
        <au:assertPropertyEquals name="publish.artifacts.pattern" value="${target.artifacts}/[artifact](-[classifier]).[ext]"/>
        <au:assertPropertyEquals name="is.project.ivy.settings.configured" value="true" />
    </target>

    <target name="common-publish-assert">
        <au:assertLogContains text=":: publishing :: org.apache.easyant#standard-java-app" />
        <au:assertLogContains text=":: publishing :: org.apache.easyant#standard-java-app" />
        <au:assertLogContains text="published standard-java-app to" />
        <au:assertLogContains text="published ivy to" />
        <au:assertPropertyEquals name="module.name" value="standard-java-app" />
    </target>

    <target name="test-ivy-publication:release" depends="ivy-publication:release,common-publish-assert">
        <au:assertLogContains text="project standard-java-app released with version 0.1 on shared" />
    </target>

    <target name="test-ivy-publication:publish-shared" depends="ivy-publication:publish-shared,common-publish-assert">
        <au:assertLogContains text="project standard-java-app published with version 0.1 on shared" />
    </target>

    <target name="test-ivy-publication:publish-local" depends="ivy-publication:publish-local,common-publish-assert">
        <au:assertLogContains text="project standard-java-app published locally with version 0.1" />
    </target>

    <target name="test-ivy-publication:clean-local" depends="ivy-publication:clean-local">
        <au:assertFileDoesntExist file="${ivy.local.default.root}" />
    </target>
</project>


text:
static Logging logger;

void TheaRenderer::defineSettings()
{
	MFnDependencyNode depFn(getRenderGlobalsNode());
	std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr;
	std::shared_ptr<TheaRenderer> renderer = std::static_pointer_cast<TheaRenderer>(MayaTo::getWorldPtr()->worldRendererPtr);
	std::shared_ptr<MayaScene> scene = MayaTo::getWorldPtr()->worldScenePtr;

	if (renderGlobals->exportSceneFile)
	{
		this->sceneXML.getRenderOptions().engine = (TheaSDK::Engine) getEnumInt("engine", depFn);
		this->sceneXML.getRenderOptions().threads = getIntAttr("threads", depFn, 4);
		this->sceneXML.getRenderOptions().maxRenderSeconds = getIntAttr("maxRenderSeconds", depFn, 100);
		this->sceneXML.getRenderOptions().supersampling = (TheaSDK::Supersampling)getEnumInt("supersampling", depFn);
		this->sceneXML.getRenderOptions().progressiveRayTracingDepth = getIntAttr("progressiveRayTracingDepth", depFn, 10);
		this->sceneXML.getRenderOptions().progressiveDiffuseTracingDepth = getIntAttr("progressiveDiffuseTracingDepth", depFn, 10);
		this->sceneXML.getRenderOptions().progressiveGlossyTracingDepth = getIntAttr("progressiveGlossyTracingDepth", depFn, 10);
		this->sceneXML.getRenderOptions().progressiveAmbientOcclusion = getBoolAttr("progressiveAmbientOcclusion", depFn, false);
		this->sceneXML.getRenderOptions().progressiveAmbientDistance = getFloatAttr("progressiveAmbientDistance", depFn, 10.0);
		this->sceneXML.getRenderOptions().progressiveAmbientIntensity = getFloatAttr("progressiveAmbientIntensity", depFn, 10.0);

		//this->sceneXML.getRenderOptions().biasedRayTracingDepth = (TheaSDK::Supersampling)this->mtth_renderGlobals->supersampling;

	}
}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#EDEFF1"
    android:orientation="vertical"
    android:paddingBottom="16dp"
    android:paddingTop="16dp"
    tools:context=".AFLogin" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:gravity="center_vertical"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/anfan_recharge_shouji_2"
            android:textColor="#000000" />

        <Spinner
            android:id="@+id/anfan_recharge_shouji_spinner"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp" />
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="10dp"
        android:lineSpacingExtra="3dp"
        android:text="@string/anfan_recharge_shouji_3"
        android:textColor="#666666" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <com.anfeng.pay.widget.MyGridView
                android:id="@+id/anfan_recharge_shouji__gv"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="20dp"
                android:background="#EDEFF1"
                android:gravity="center"
                android:horizontalSpacing="5dip"
                android:listSelector="#EDEFF1"
                android:numColumns="3"
                android:stretchMode="columnWidth"
                android:verticalSpacing="20dp" />

            <com.anfeng.pay.widget.ClearEditText
                android:id="@+id/anfan_recharge_shouji_num"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="20dp"
                android:background="#ffffff"
                android:digits="@string/anfan_input_digits"
                android:ems="10"
                android:hint="充值卡卡号"
                android:maxLength="50"
                android:paddingLeft="20dp"
                android:singleLine="true"
                android:textColor="#000000"
                android:textColorHint="#CCCCCC"
                android:textCursorDrawable="@null" />

            <com.anfeng.pay.widget.SeePWDEditText
                android:id="@+id/anfan_recharge_shouji_pass"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:background="#ffffff"
                android:digits="@string/anfan_input_digits"
                android:ems="10"
                android:hint="密码"
                android:inputType="textPassword"
                android:maxLength="50"
                android:paddingLeft="20dp"
                android:singleLine="true"
                android:textColor="#000000"
                android:textColorHint="#CCCCCC"
                android:textCursorDrawable="@null" />

            <Button
                android:id="@+id/anfan_recharge_shouji_paybtn"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="16dp"
                android:background="@drawable/anfan_button_bg_blue"
                android:text="@string/anfan_recharge_shouji_4"
                android:textColor="#ffffff"
                android:textSize="18dp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="15dp"
                android:layout_marginTop="10dp"
                android:lineSpacingExtra="5dp"
                android:text="@string/anfan_pay_card_hint"
                android:textColor="#999999" />
        </LinearLayout>
    </ScrollView>

</LinearLayout>


text:
#import "CTAssetsPickerDefines.h"
#import "CTAssetsPickerController.h"
#import "CTAssetsPickerAccessDeniedView.h"
#import "CTAssetsPickerNoAssetsView.h"
#import "CTAssetCollectionViewController.h"
#import "CTAssetsGridViewController.h"
#import "CTAssetScrollView.h"
#import "CTAssetsPageViewController.h"
#import "CTAssetsViewControllerTransition.h"
#import "NSBundle+CTAssetsPickerController.h"
#import "UIImage+CTAssetsPickerController.h"
#import "NSNumberFormatter+CTAssetsPickerController.h"

NSString * const CTAssetsPickerSelectedAssetsDidChangeNotification = @"CTAssetsPickerSelectedAssetsDidChangeNotification";
NSString * const CTAssetsPickerDidSelectAssetNotification = @"CTAssetsPickerDidSelectAssetNotification";
NSString * const CTAssetsPickerDidDeselectAssetNotification = @"CTAssetsPickerDidDeselectAssetNotification";

@interface CTAssetsPickerController ()
<UISplitViewControllerDelegate, UINavigationControllerDelegate>

@property (nonatomic, assign) BOOL shouldCollapseDetailViewController;

@property (nonatomic, assign) CGSize assetCollectionThumbnailSize;
@property (nonatomic, assign) CGSize assetThumbnailSize;

@property (nonatomic, strong) PHImageRequestOptions *thumbnailRequestOptions;

@end

@implementation CTAssetsPickerController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
    {
        _shouldCollapseDetailViewController = YES;
        _assetCollectionThumbnailSize       = CTAssetCollectionThumbnailSize;
        _assetCollectionFetchOptions        = nil;
        _assetsFetchOptions                 = nil;
        _selectedAssets                     = [NSMutableArray new];
        _showsCancelButton                  = YES;
        _showsEmptyAlbums                   = YES;
        _showsNumberOfAssets                = YES;
        _alwaysEnableDoneButton             = NO;
        _defaultAssetCollection             = PHAssetCollectionSubtypeAny;

        [self initAssetCollectionSubtypes];
        [self initThumbnailRequestOptions];
        self.preferredContentSize           = CTAssetsPickerPopoverContentSize;
    }

    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setupViews];
    [self setupEmptyViewController];
    [self checkAuthorizationStatus];
    [self addKeyValueObserver];
}

- (void)dealloc
{
    [self removeKeyValueObserver];
}

- (UIViewController *)childViewControllerForStatusBarStyle
{
    return self.childSplitViewController.viewControllers.firstObject;
}

- (UIViewController *)childViewControllerForStatusBarHidden
{
    UIViewController *vc = self.childSplitViewController.viewControllers.lastObject;

    if ([vc isMemberOfClass:[UINavigationController class]])
        return ((UINavigationController *)vc).topViewController;
    else
        return nil;
}

#pragma mark - Init properties

- (void)initAssetCollectionSubtypes
{
    _assetCollectionSubtypes =
    @[[NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumUserLibrary],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumMyPhotoStream],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumRecentlyAdded],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumFavorites],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumPanoramas],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumVideos],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumSlomoVideos],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumTimelapses],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumBursts],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumAllHidden],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeSmartAlbumGeneric],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumRegular],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumSyncedAlbum],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumSyncedEvent],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumSyncedFaces],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumImported],
      [NSNumber numberWithInt:PHAssetCollectionSubtypeAlbumCloudShared]];
}

- (void)initThumbnailRequestOptions
{
    PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
    options.resizeMode = PHImageRequestOptionsResizeModeExact;
    options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;

    _thumbnailRequestOptions = options;
}

#pragma mark - Check authorization status

- (void)checkAuthorizationStatus
{
    PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];

    switch (status)
    {
        case PHAuthorizationStatusNotDetermined:
            [self requestAuthorizationStatus];
            break;
        case PHAuthorizationStatusRestricted:
        case PHAuthorizationStatusDenied:
        {
            [self showAccessDenied];
            break;
        }
        case PHAuthorizationStatusAuthorized:
        default:
        {
            [self checkAssetsCount];
            break;
        }
    }
}

#pragma mark - Request authorization status

- (void)requestAuthorizationStatus
{
    [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status){
        switch (status) {
            case PHAuthorizationStatusAuthorized:
            {
                dispatch_async(dispatch_get_main_queue(), ^{
                    [self checkAssetsCount];
                });
                break;
            }
            default:
            {
                dispatch_async(dispatch_get_main_queue(), ^{
                    [self showAccessDenied];
                });
                break;
            }
        }
    }];
}

#pragma mark - Check assets count

- (void)checkAssetsCount
{
    PHFetchResult *fetchResult = [PHAsset fetchAssetsWithOptions:self.assetsFetchOptions];

    if (fetchResult.count > 0) {
        [self showAssetCollectionViewController];
    } else {
        [self showNoAssets];
    }
}

#pragma mark - Setup views

- (void)setupViews
{
    self.view.backgroundColor = [UIColor whiteColor];
}

#pragma mark - Setup view controllers

- (void)setupEmptyViewController
{
    UINavigationController *nav = [self emptyNavigationController];
    [self setupChildViewController:nav];
}

- (void)setupSplitViewController
{
    CTAssetCollectionViewController *vc = [CTAssetCollectionViewController new];
    UINavigationController *master = [[UINavigationController alloc] initWithRootViewController:vc];
    UINavigationController *detail = [self emptyNavigationController];
    UISplitViewController *svc  = [UISplitViewController new];

    master.interactivePopGestureRecognizer.enabled  = YES;
    master.interactivePopGestureRecognizer.delegate = nil;

    svc.delegate = self;
    svc.viewControllers = @[master, detail];
    svc.presentsWithGesture = NO;
    svc.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;

    [svc willMoveToParentViewController:self];
    [svc setViewControllers:@[master, detail]];
    [svc.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:svc.view];
    [self addChildViewController:svc];
    [svc didMoveToParentViewController:self];

    [vc reloadUserInterface];
}

- (void)setupChildViewController:(UIViewController *)vc
{
    [vc willMoveToParentViewController:self];
    [vc.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    [self.view addSubview:vc.view];
    [self addChildViewController:vc];
    [vc didMoveToParentViewController:self];
}

- (void)removeChildViewController
{
    UIViewController *vc = self.childViewControllers.firstObject;
    [vc.view removeFromSuperview];
    [vc removeFromParentViewController];
}

#pragma mark - Setup view controllers

- (UINavigationController *)emptyNavigationController
{
    UIViewController *vc = [self emptyViewController];
    return [[UINavigationController alloc] initWithRootViewController:vc];
}

- (UIViewController *)emptyViewController
{
    UIViewController *vc                = [UIViewController new];
    vc.view.backgroundColor             = [UIColor whiteColor];
    vc.navigationItem.hidesBackButton   = YES;

    return vc;
}

#pragma mark - Show asset collection view controller

- (void)showAssetCollectionViewController
{
    [self removeChildViewController];
    [self setupSplitViewController];
}

#pragma mark - Show auxiliary view

- (void)showAuxiliaryView:(UIView *)view
{
    [self removeChildViewController];

    UIViewController *vc = [self emptyViewController];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];

    [vc.view addSubview:view];
    [view setNeedsUpdateConstraints];
    [view updateConstraintsIfNeeded];

    [self setupButtonInViewController:vc];
    [self setupChildViewController:nav];
}

#pragma mark - Access denied

- (void)showAccessDenied
{
    [self showAuxiliaryView:[CTAssetsPickerAccessDeniedView new]];
}

#pragma mark - No Assets

- (void)showNoAssets
{
    [self showAuxiliaryView:[CTAssetsPickerNoAssetsView new]];
}

#pragma mark - Cancel button

- (void)setupButtonInViewController:(UIViewController *)viewController
{
    if (self.showsCancelButton)
    {
        viewController.navigationItem.leftBarButtonItem =
        [[UIBarButtonItem alloc] initWithTitle:CTAssetsPickerLocalizedString(@"Cancel", nil)
                                         style:UIBarButtonItemStylePlain
                                        target:self
                                        action:@selector(dismiss:)];
    }
}

#pragma mark - Key-Value observer

- (void)addKeyValueObserver
{
    [self addObserver:self
           forKeyPath:@"selectedAssets"
              options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld
              context:nil];
}

- (void)removeKeyValueObserver
{
    [self removeObserver:self forKeyPath:@"selectedAssets"];
}

#pragma mark - Key-Value changed

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    if ([keyPath isEqual:@"selectedAssets"])
    {
        [self toggleDoneButton];
        [self postSelectedAssetsDidChangeNotification:[object valueForKey:keyPath]];
    }
}

#pragma mark - Toggle button

- (void)toggleDoneButton
{
    UIViewController *vc = self.childSplitViewController.viewControllers.firstObject;

    if ([vc isMemberOfClass:[UINavigationController class]])
    {
        BOOL enabled = (self.alwaysEnableDoneButton) ? YES : (self.selectedAssets.count > 0);

        for (UIViewController *viewController in ((UINavigationController *)vc).viewControllers)
            viewController.navigationItem.rightBarButtonItem.enabled = enabled;
    }
}

#pragma mark - Post notifications

- (void)postSelectedAssetsDidChangeNotification:(id)sender
{
    [[NSNotificationCenter defaultCenter] postNotificationName:CTAssetsPickerSelectedAssetsDidChangeNotification
                                                        object:sender];
}

- (void)postDidSelectAssetNotification:(id)sender
{
    [[NSNotificationCenter defaultCenter] postNotificationName:CTAssetsPickerDidSelectAssetNotification
                                                        object:sender];
}

- (void)postDidDeselectAssetNotification:(id)sender
{
    [[NSNotificationCenter defaultCenter] postNotificationName:CTAssetsPickerDidDeselectAssetNotification
                                                        object:sender];
}

#pragma mark - Accessors

- (UISplitViewController *)childSplitViewController
{
    return (UISplitViewController *)self.childViewControllers.firstObject;
}

#pragma mark - Indexed accessors

- (NSUInteger)countOfSelectedAssets
{
    return self.selectedAssets.count;
}

- (instancetype)objectInSelectedAssetsAtIndex:(NSUInteger)index
{
    return [self.selectedAssets objectAtIndex:index];
}

- (void)insertObject:(id)object inSelectedAssetsAtIndex:(NSUInteger)index
{
    [self.selectedAssets insertObject:object atIndex:index];
}

- (void)removeObjectFromSelectedAssetsAtIndex:(NSUInteger)index
{
    [self.selectedAssets removeObjectAtIndex:index];
}

- (void)replaceObjectInSelectedAssetsAtIndex:(NSUInteger)index withObject:(PHAsset *)object
{
    [self.selectedAssets replaceObjectAtIndex:index withObject:object];
}

#pragma mark - De/Select asset

- (void)selectAsset:(PHAsset *)asset
{
    [self insertObject:asset inSelectedAssetsAtIndex:self.countOfSelectedAssets];
    [self postDidSelectAssetNotification:asset];
}

- (void)deselectAsset:(PHAsset *)asset
{
    [self removeObjectFromSelectedAssetsAtIndex:[self.selectedAssets indexOfObject:asset]];
    [self postDidDeselectAssetNotification:asset];
}

#pragma mark - Selected assets string

- (NSPredicate *)predicateOfMediaType:(PHAssetMediaType)type
{
    return [NSPredicate predicateWithBlock:^BOOL(PHAsset *asset, NSDictionary *bindings) {
        return (asset.mediaType == type);
    }];
}

- (NSString *)selectedAssetsString
{
    if (self.selectedAssets.count == 0)
        return nil;

    NSPredicate *photoPredicate = [self predicateOfMediaType:PHAssetMediaTypeImage];
    NSPredicate *videoPredicate = [self predicateOfMediaType:PHAssetMediaTypeVideo];

    BOOL photoSelected = ([self.selectedAssets filteredArrayUsingPredicate:photoPredicate].count > 0);
    BOOL videoSelected = ([self.selectedAssets filteredArrayUsingPredicate:videoPredicate].count > 0);

    NSString *format;

    if (photoSelected && videoSelected)
        format = CTAssetsPickerLocalizedString(@"%@ Items Selected", nil);

    else if (photoSelected)
        format = (self.selectedAssets.count > 1) ?
        CTAssetsPickerLocalizedString(@"%@ Photos Selected", nil) :
        CTAssetsPickerLocalizedString(@"%@ Photo Selected", nil);

    else if (videoSelected)
        format = (self.selectedAssets.count > 1) ?
        CTAssetsPickerLocalizedString(@"%@ Videos Selected", nil) :
        CTAssetsPickerLocalizedString(@"%@ Video Selected", nil);

    NSNumberFormatter *nf = [NSNumberFormatter new];

    return [NSString stringWithFormat:format, [nf ctassetsPickerStringFromAssetsCount:self.selectedAssets.count]];
}

#pragma mark - Image target size

- (CGSize)imageSizeForContainerSize:(CGSize)size
{
    CGFloat scale = UIScreen.mainScreen.scale;
    return CGSizeMake(size.width * scale, size.height * scale);
}

#pragma mark - Split view controller delegate

- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController
{
    return self.shouldCollapseDetailViewController;
}

#pragma mark - Navigation controller delegate

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                  animationControllerForOperation:(UINavigationControllerOperation)operation
                                               fromViewController:(UIViewController *)fromVC
                                                 toViewController:(UIViewController *)toVC
{
    if ((operation == UINavigationControllerOperationPush && [toVC isKindOfClass:[CTAssetsPageViewController class]]) ||
        (operation == UINavigationControllerOperationPop && [fromVC isKindOfClass:[CTAssetsPageViewController class]]))
    {
        CTAssetsViewControllerTransition *transition = [[CTAssetsViewControllerTransition alloc] init];
        transition.operation = operation;

        return transition;
    }
    else
    {
        return nil;
    }
}

#pragma mark - Actions

- (void)dismiss:(id)sender
{
    if ([self.delegate respondsToSelector:@selector(assetsPickerControllerDidCancel:)])
        [self.delegate assetsPickerControllerDidCancel:self];
    else
        [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}

- (void)finishPickingAssets:(id)sender
{
    if ([self.delegate respondsToSelector:@selector(assetsPickerController:didFinishPickingAssets:)])
        [self.delegate assetsPickerController:self didFinishPickingAssets:self.selectedAssets];
}

@end


text:
namespace py = pybind11;

//! Convert numpy.ndarray to OpenCV Mat.
cv::Mat np2mat(const py::array_t<float> &arr);

//! Convert OpenCV Mat to numpy.ndarray.
py::array_t<float> mat2np(const cv::Mat &mat);

#endif  // _PYTHON_PYLIME_H_


text:
<Record>
<Term>Non-Steroidal Estrogens</Term>
<SemanticType>Pharmacologic Substance</SemanticType>
<ParentTerm>Estrogens</ParentTerm>
<ClassificationPath>Chemical Actions and Uses/Pharmacologic Actions/Physiological Effects of Drugs/Hormones, Hormone Substitutes, and Hormone Antagonists/Hormones/Estrogens/Estrogens, Non-Steroidal</ClassificationPath>
<BroaderTerm>Hormones</BroaderTerm>
<BroaderTerm>Pharmacologic Actions</BroaderTerm>
<BroaderTerm>Estrogens</BroaderTerm>
<BroaderTerm>Estrogens, Non-Steroidal</BroaderTerm>
<BroaderTerm>Chemical Actions and Uses</BroaderTerm>
<BroaderTerm>Hormones, Hormone Substitutes, and Hormone Antagonists</BroaderTerm>
<BroaderTerm>Physiological Effects of Drugs</BroaderTerm>
<ChildTerm>Phytoestrogens</ChildTerm>
<Synonym>Non-Steroidal Estrogens</Synonym>
<Synonym>Nonsteroidal Estrogens</Synonym>
<Description>Non-steroidal compounds with estrogenic activity.</Description>
<Source>MeSH</Source>
</Record>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Coq bench</title>
    <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
    <link href="../../../../../bootstrap.min.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
              Toggle navigation

            </button>
             Coq bench

Unstable

8.5.dev / contrib:projective-geometry dev

2015-02-03 00:28:27

About

            « Up

              contrib:projective-geometry

                dev
                3 m 19 s

 (2015-02-03 00:28:27 UTC)

Lint

Command

ruby lint.rb unstable ../unstable/packages/coq:contrib:projective-geometry/coq:contrib:projective-geometry.dev

Return code

0

Duration

0 s

Dry install

Dry install with the current Coq version:

Command

opam install -y --dry-run coq:contrib:projective-geometry.dev coq.8.5.dev

Return code

0

Duration

2 s

Dry install without Coq, to test if the problem was incompatibility with the current Coq version:

Command

true

Return code

0

Duration

0 s

Install dependencies

Command

ulimit -Sv 2000000; timeout 5m opam install -y --deps-only coq:contrib:projective-geometry.dev

Return code

0

Duration

2 s

Install

Command

ulimit -Sv 2000000; timeout 5m opam install -y --verbose coq:contrib:projective-geometry.dev

Return code

0

Duration

3 m 19 s

Installation size

Total: 47,578 K

7,463 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desarguesxD.vo

5,499 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dmore.vo

5,238 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2D.vo

3,429 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas3.vo

2,105 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3Dspecial.vo

2,032 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3D.vo

1,958 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas.vo

1,957 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3Dlemmas.vo

1,907 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas2.vo

1,846 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_rank_to_projective_space.vo

1,801 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/rank_properties.vo

1,435 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/pg25.vo

1,271 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroid_to_matroid_p.vo

933 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroids_properties.vo

852 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/fano_plane_desargues.vo

590 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/homogeneous.vo

582 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroids_axioms.vo

396 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/hexamys.vo

360 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/sets_of_points.vo

350 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/hexamys_desargues.vo

350 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_rank_axioms.vo

330 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/moulton.vo

299 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3Dspecial.glob

278 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas2.glob

238 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3D.glob

231 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/rank_properties.glob

200 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/forth.vo

195 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas.glob

186 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/moulton.glob

166 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_rank_to_projective_space.glob

143 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/forth.glob

142 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3Dlemmas.glob

141 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2D.glob

133 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/homogeneous.glob

131 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/hexamys.glob

96 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/fano_plane_desargues.glob

90 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/pg25.glob

89 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/fano_plane.vo

83 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/basic_facts.vo

83 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P14_pseudo_midpoint.vo

73 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_axioms.glob

66 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas3.glob

64 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_axioms.vo

62 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P08_cevian_lines_2.vo

61 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dmore.glob

60 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/back.glob

56 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P09_complete_quadrilateral.vo

55 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P07_cevian_lines.vo

54 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P10_complete_quadrilateral_2.vo

51 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P11_chasles.vo

50 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/fano_plane.glob

47 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P05_almost_pappus.vo

47 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_axioms.glob

46 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/field_variable_isolation_tactic.vo

45 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P06_angle_line.vo

45 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/sets_of_points.glob

44 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P12_aeolian.vo

43 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/back.vo

38 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desarguesxD.glob

37 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/flat.vo

36 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/hexamys_desargues.glob

35 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/basic_facts.glob

31 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_duality.vo

31 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/decidability.vo

30 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/moulton.v

29 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/hexamys.v

27 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/decidability.glob

26 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroid_to_matroid_p.glob

25 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_to_Heyting_projective_plane.vo

25 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroids_properties.glob

24 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/homogeneous.v

23 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_to_Heyting_projective_plane.glob

23 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/rank_properties.v

21 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas.v

20 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/flat.glob

18 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_axioms.vo

18 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/bij.vo

17 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/field_variable_isolation_tactic.glob

17 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_duality.glob

16 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3D.v

16 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/examples.vo

16 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3Dlemmas.v

16 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues3Dspecial.v

14 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas2.v

14 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/fano_plane_desargues.v

14 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/forth.v

14 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/Heyting_projective_plane_axioms.glob

14 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_rank_to_projective_space.v

12 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_inst.glob

12 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/back.v

10 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P12_aeolian.glob

9 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/examples.glob

9 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2D.v

8 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_rank_axioms.glob

8 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/basic_facts_plane.glob

8 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/bij.glob

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/basic_facts.v

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_axioms.v

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/sets_of_points.v

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroids_axioms.glob

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P14_pseudo_midpoint.glob

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/Heyting_projective_plane_axioms.vo

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/decidability.v

7 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dlemmas3.v

6 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_inst.vo

6 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/field_variable_isolation_tactic.v

6 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/general_tactics.vo

6 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/basic_facts_plane.vo

6 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P07_cevian_lines.glob

6 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/pg25.v

5 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P11_chasles.glob

5 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/general_tactics.glob

5 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/flat.v

5 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P09_complete_quadrilateral.glob

4 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_axioms.v

4 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desargues2Dmore.v

4 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P10_complete_quadrilateral_2.glob

4 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P08_cevian_lines_2.glob

3 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P05_almost_pappus.glob

3 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_duality.v

3 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/fano_plane.v

3 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P06_angle_line.glob

3 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/hexamys_desargues.v

3 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroids_properties.v

2 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_to_Heyting_projective_plane.v

2 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/desarguesxD.v

2 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroid_to_matroid_p.v

2 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/bij.v

2 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/examples.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/basic_facts_plane.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/general_tactics.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/Heyting_projective_plane_axioms.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/projective_plane_inst.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/matroids_axioms.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Space/projective_space_rank_axioms.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P12_aeolian.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P14_pseudo_midpoint.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P09_complete_quadrilateral.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P07_cevian_lines.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P11_chasles.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P08_cevian_lines_2.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P10_complete_quadrilateral_2.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P06_angle_line.v

1 K /home/bench/.opam/system/lib/coq/user-contrib/ProjectiveGeometry/Plane/P05_almost_pappus.v

1 K /home/bench/.opam/system/lib/coq:contrib:projective-geometry/opam.config

1 K /home/bench/.opam/system/install/coq:contrib:projective-geometry.install

Uninstall

Command

opam remove -y coq:contrib:projective-geometry.dev

Return code

0

Duration

2 s

Missing removes

                none

Wrong removes

                none

          Sources are on GitHub. © Guillaume Claret.


text:
#import "RTCAudioSessionConfiguration.h"
#import "RTCAudioSession.h"

#import "helpers/RTCDispatcher.h"
#import "helpers/UIDevice+RTCDevice.h"

// Try to use mono to save resources. Also avoids channel format conversion
// in the I/O audio unit. Initial tests have shown that it is possible to use
// mono natively for built-in microphones and for BT headsets but not for
// wired headsets. Wired headsets only support stereo as native channel format
// but it is a low cost operation to do a format conversion to mono in the
// audio unit. Hence, we will not hit a RTC_CHECK in
// VerifyAudioParametersForActiveAudioSession() for a mismatch between the
// preferred number of channels and the actual number of channels.
const int kRTCAudioSessionPreferredNumberOfChannels = 1;

// Preferred hardware sample rate (unit is in Hertz). The client sample rate
// will be set to this value as well to avoid resampling the the audio unit's
// format converter. Note that, some devices, e.g. BT headsets, only supports
// 8000Hz as native sample rate.
const double kRTCAudioSessionHighPerformanceSampleRate = 48000.0;

// A lower sample rate will be used for devices with only one core
// (e.g. iPhone 4). The goal is to reduce the CPU load of the application.
const double kRTCAudioSessionLowComplexitySampleRate = 16000.0;

// Use a hardware I/O buffer size (unit is in seconds) that matches the 10ms
// size used by WebRTC. The exact actual size will differ between devices.
// Example: using 48kHz on iPhone 6 results in a native buffer size of
// ~10.6667ms or 512 audio frames per buffer. The FineAudioBuffer instance will
// take care of any buffering required to convert between native buffers and
// buffers used by WebRTC. It is beneficial for the performance if the native
// size is as an even multiple of 10ms as possible since it results in "clean"
// callback sequence without bursts of callbacks back to back.
const double kRTCAudioSessionHighPerformanceIOBufferDuration = 0.02;

// Use a larger buffer size on devices with only one core (e.g. iPhone 4).
// It will result in a lower CPU consumption at the cost of a larger latency.
// The size of 60ms is based on instrumentation that shows a significant
// reduction in CPU load compared with 10ms on low-end devices.
// TODO(henrika): monitor this size and determine if it should be modified.
const double kRTCAudioSessionLowComplexityIOBufferDuration = 0.06;

static RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *gWebRTCConfiguration = nil;

@implementation RTC_OBJC_TYPE (RTCAudioSessionConfiguration)

@synthesize category = _category;
@synthesize categoryOptions = _categoryOptions;
@synthesize mode = _mode;
@synthesize sampleRate = _sampleRate;
@synthesize ioBufferDuration = _ioBufferDuration;
@synthesize inputNumberOfChannels = _inputNumberOfChannels;
@synthesize outputNumberOfChannels = _outputNumberOfChannels;

- (instancetype)init {
  if (self = [super init]) {
    // Use a category which supports simultaneous recording and playback.
    // By default, using this category implies that our app's audio is
    // nonmixable, hence activating the session will interrupt any other
    // audio sessions which are also nonmixable.
    _category = AVAudioSessionCategoryPlayAndRecord;
    _categoryOptions = AVAudioSessionCategoryOptionAllowBluetooth;

    // Specify mode for two-way voice communication (e.g. VoIP).
    _mode = AVAudioSessionModeVoiceChat;

    // Set the session's sample rate or the hardware sample rate.
    // It is essential that we use the same sample rate as stream format
    // to ensure that the I/O unit does not have to do sample rate conversion.
    // Set the preferred audio I/O buffer duration, in seconds.
    NSUInteger processorCount = [NSProcessInfo processInfo].processorCount;
    // Use best sample rate and buffer duration if the CPU has more than one
    // core.
    if (processorCount > 1 && [UIDevice deviceType] != RTCDeviceTypeIPhone4S) {
      _sampleRate = kRTCAudioSessionHighPerformanceSampleRate;
      _ioBufferDuration = kRTCAudioSessionHighPerformanceIOBufferDuration;
    } else {
      _sampleRate = kRTCAudioSessionLowComplexitySampleRate;
      _ioBufferDuration = kRTCAudioSessionLowComplexityIOBufferDuration;
    }

    // We try to use mono in both directions to save resources and format
    // conversions in the audio unit. Some devices does only support stereo;
    // e.g. wired headset on iPhone 6.
    // TODO(henrika): add support for stereo if needed.
    _inputNumberOfChannels = kRTCAudioSessionPreferredNumberOfChannels;
    _outputNumberOfChannels = kRTCAudioSessionPreferredNumberOfChannels;
  }
  return self;
}

+ (void)initialize {
  gWebRTCConfiguration = [[self alloc] init];
}

+ (instancetype)currentConfiguration {
  RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance];
  RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *config =
      [[RTC_OBJC_TYPE(RTCAudioSessionConfiguration) alloc] init];
  config.category = session.category;
  config.categoryOptions = session.categoryOptions;
  config.mode = session.mode;
  config.sampleRate = session.sampleRate;
  config.ioBufferDuration = session.IOBufferDuration;
  config.inputNumberOfChannels = session.inputNumberOfChannels;
  config.outputNumberOfChannels = session.outputNumberOfChannels;
  return config;
}

+ (instancetype)webRTCConfiguration {
  @synchronized(self) {
    return (RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)gWebRTCConfiguration;
  }
}

+ (void)setWebRTCConfiguration:(RTC_OBJC_TYPE(RTCAudioSessionConfiguration) *)configuration {
  @synchronized(self) {
    gWebRTCConfiguration = configuration;
  }
}

@end