text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Castle.Windsor.Installer;
using Quilt4Net.Core;
using Quilt4Net.Core.Interfaces;

namespace Quilt4Net.Sample.CastleWindsor
{
    static class Program
    {
        private static void Main(string[] args)
        {
            var container = new WindsorContainer();

            container.Install(FromAssembly.This());

            var client = container.Resolve<IQuilt4NetClient>();
            client.WebApiClient.WebApiRequestEvent += WebApiClientWebApiRequestEvent;
            client.WebApiClient.WebApiResponseEvent += WebApiClient_WebApiResponseEvent;
            client.WebApiClient.AuthorizationChangedEvent += WebApiClient_AuthorizationChangedEvent;

            var business1 = container.Resolve<ISomeBusiness1>();
            var business2 = container.Resolve<ISomeBusiness2>();

            try
            {
                business1.Execute();
                business2.Execute();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception: " + exception.Message);
            }

            //business1.Dispose();
            container.Dispose();

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }

        private static void WebApiClient_AuthorizationChangedEvent(object sender, Core.Events.AuthorizationChangedEventArgs e)
        {
            Console.WriteLine("WebApiClient_AuthorizationChangedEvent: " + e.UserName);
        }

        private static void WebApiClientWebApiRequestEvent(object sender, WebApiRequestEventArgs e)
        {
            Console.WriteLine("REQUEST: (" + e.Path + ")" + e.ContentData);
        }

        private static void WebApiClient_WebApiResponseEvent(object sender, WebApiResponseEventArgs e)
        {
            if (!e.IsSuccess)
            {
                Console.WriteLine("> " + e.Request.OperationType + ": " + e.Request.Path + " --> " + (e.IsSuccess ? "Success" : "Fail: " + e.Exception.Message));
            }
            else
            {
                Console.WriteLine("RESPONSE (" + e.Request.Path + "): " + e.ContentData);
            }
        }
    }

    public class RepositoriesInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(Classes.FromThisAssembly()
                .Where(Component.IsInSameNamespaceAs<SomeBusiness1>())
                .WithService.DefaultInterfaces()
                .LifestyleTransient());

            //container.Register(Component.For<IConfiguration>().ImplementedBy(typeof(Quilt4Net.Configuration)).LifestyleSingleton());
            //container.Register(Component.For<IQuilt4NetClient>().ImplementedBy(typeof(Quilt4Net.Quilt4NetClient)).LifestyleSingleton());
            //container.Register(Component.For<ISessionHandler>().ImplementedBy(typeof(Quilt4Net.SessionHandler)).LifestyleSingleton());
            //container.Register(Component.For<IIssueHandler>().ImplementedBy(typeof(Quilt4Net.IssueHandler)).LifestyleSingleton());

            //container.Register(Classes.FromAssemblyContaining(typeof(Quilt4NetClient))
            //    .Where(Component.IsInSameNamespaceAs<IssueHandler>())
            //    .WithService.FromInterface(typeof(IIssueHandler))
            //    .LifestyleTransient());

            //TODO: Using this should fail the execution (since two clients are created in the same runner)
            container.Register(Classes.FromAssemblyContaining(typeof(Quilt4NetClient))
                .Where(Component.IsInSameNamespaceAs<IssueHandler>())
                .WithService.DefaultInterfaces()
                //.LifestyleTransient());
                .LifestyleSingleton());
        }
    }

    public class SomeBusiness2 : ISomeBusiness2
    {
        private readonly IIssueHandler _issueHandler;

        public SomeBusiness2(IIssueHandler issueHandler)
        {
            _issueHandler = issueHandler;
        }

        public void Execute()
        {
            _issueHandler.Register("Mimimal message");
            //_issueHandler.Register("Maximal message", MessageIssueLevel.Information, "Bob Loblaw", new Dictionary<string, string> { { "A", "1" } });

            Console.WriteLine("Executing some more stuff...");
        }
    }

    public class SomeBusiness1 : ISomeBusiness1
    {
        private readonly ISessionHandler _sessionHandler;
        private readonly IIssueHandler _issueHandler;

        public SomeBusiness1(ISessionHandler sessionHandler, IIssueHandler issueHandler)
        {
            _sessionHandler = sessionHandler;
            _sessionHandler.SessionRegistrationStartedEvent += _sessionHandler_SessionRegistrationStartedEvent;
            _sessionHandler.SessionRegistrationCompletedEvent += _sessionHandler_SessionRegistrationCompletedEvent;
            _sessionHandler.SessionEndStartedEvent += _sessionHandler_SessionEndStartedEvent;
            _sessionHandler.SessionEndCompletedEvent += _sessionHandler_SessionEndCompletedEvent;
            _issueHandler = issueHandler;
            _issueHandler.IssueRegistrationStartedEvent += _issueHandler_IssueRegistrationStartedEvent;
            _issueHandler.IssueRegistrationCompletedEvent += _issueHandler_IssueRegistrationCompletedEvent;
        }

        private void _sessionHandler_SessionEndCompletedEvent(object sender, Core.Events.SessionEndCompletedEventArgs e)
        {
            Console.WriteLine(">");
        }

        private void _sessionHandler_SessionEndStartedEvent(object sender, Core.Events.SessionEndStartedEventArgs e)
        {
            Console.WriteLine("|");
        }

        private void _sessionHandler_SessionRegistrationCompletedEvent(object sender, Core.Events.SessionRegistrationCompletedEventArgs e)
        {
            Console.WriteLine("|");
        }

        private void _sessionHandler_SessionRegistrationStartedEvent(object sender, Core.Events.SessionRegistrationStartedEventArgs e)
        {
            Console.WriteLine("<");
        }

        private void _issueHandler_IssueRegistrationCompletedEvent(object sender, Core.Events.IssueRegistrationCompletedEventArgs e)
        {
            Console.WriteLine("z");
        }

        private void _issueHandler_IssueRegistrationStartedEvent(object sender, Core.Events.IssueRegistrationStartedEventArgs e)
        {
            Console.WriteLine("a");
        }

        public void Execute()
        {
            _sessionHandler.Register();

            try
            {
                try
                {
                    try
                    {
                        var task1 = Task.Run(() =>
                            {
                                System.Threading.Thread.Sleep(500);
                                throw new InvalidOperationException("First");
                            });
                        var task2 = Task.Run(() =>
                            {
                                System.Threading.Thread.Sleep(500);
                                throw new InvalidOperationException("Second");
                            });

                        Task.WaitAll(task1, task2);
                    }
                    catch (Exception exception)
                    {
                        throw new InvalidOperationException("Some inner exception.", exception);
                    }
                }
                catch (Exception exception)
                {
                    exception.AddData("A", "1").AddData("B", "2");
                    throw new InvalidOperationException("Some exception", exception);
                }
            }
            catch (Exception exception)
            {
                exception.AddData("B", "22").AddData("C", "3");
                _issueHandler.Register(exception, ExceptionIssueLevel.Error, "Bob Loblaw");
            }

            Console.WriteLine("Executing some stuff...");
        }
    }

    public interface ISomeBusiness1
    {
        void Execute();
    }

    public interface ISomeBusiness2
    {
        void Execute();
    }
}


text:
namespace Kvasir {
//AXI Matrix
    namespace AximxRemap{    ///<Remap Register
        using Addr = Register::Address<0x00800000,0xfffffffc,0x00000000,unsigned>;
        ///Remap State 0
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> remap0{};
        ///Remap State 1
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> remap1{};
    }
    namespace AximxPeriphId4{    ///<Peripheral ID Register 4
        using Addr = Register::Address<0x00801fd0,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId5{    ///<Peripheral ID Register 5
        using Addr = Register::Address<0x00801fd4,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId6{    ///<Peripheral ID Register 6
        using Addr = Register::Address<0x00801fd8,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId7{    ///<Peripheral ID Register 7
        using Addr = Register::Address<0x00801fdc,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId0{    ///<Peripheral ID Register 0
        using Addr = Register::Address<0x00801fe0,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId1{    ///<Peripheral ID Register 1
        using Addr = Register::Address<0x00801fe4,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId2{    ///<Peripheral ID Register 2
        using Addr = Register::Address<0x00801fe8,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxPeriphId3{    ///<Peripheral ID Register 3
        using Addr = Register::Address<0x00801fec,0xffffff00,0x00000000,unsigned>;
        ///Peripheral ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxAmib3FnModBmIss{    ///<AMIB3 Bus Matrix Functionality Modification Register
        using Addr = Register::Address<0x00805008,0xfffffffc,0x00000000,unsigned>;
        ///Read Issuing
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> rdIss{};
        ///Write Issuing
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> wrIss{};
    }
    namespace AximxAmib3FnMod2{    ///<AMIB3 Bypass Merge
        using Addr = Register::Address<0x00805024,0xfffffffe,0x00000000,unsigned>;
        ///Bypass Merge
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> bpMrg{};
    }
    namespace AximxAsib0ReadQos{    ///<ASIB0 Read Channel QoS Register
        using Addr = Register::Address<0x00842100,0xfffffff0,0x00000000,unsigned>;
        ///Read QoS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> rdQos{};
    }
    namespace AximxAsib0WriteQos{    ///<ASIB0 Write Channel QoS Register
        using Addr = Register::Address<0x00842104,0xfffffff0,0x00000000,unsigned>;
        ///Write QoS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> wrQos{};
    }
    namespace AximxAsib1FnModAhb{    ///<ASIB1 AHB Functionality Modification Register
        using Addr = Register::Address<0x00843028,0xfffffff8,0x00000000,unsigned>;
        ///Read INCR Override
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> rdIncrOvr{};
        ///Write INCR override
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> wrIncrOvr{};
        ///Lock Override
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> lockOvr{};
    }
    namespace AximxAsib1ReadQos{    ///<ASIB1 Read Channel QoS Register
        using Addr = Register::Address<0x00843100,0xfffffff0,0x00000000,unsigned>;
        ///Read QoS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> rdQos{};
    }
    namespace AximxAsib1WriteQos{    ///<ASIB1 Write Channel QoS Register
        using Addr = Register::Address<0x00843104,0xfffffff0,0x00000000,unsigned>;
        ///Write QoS
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,unsigned> wrQos{};
    }
    namespace AximxAsib1FnMod{    ///<ASIB1 Issuing Functionality Modification Register
        using Addr = Register::Address<0x00843108,0xfffffffc,0x00000000,unsigned>;
        ///Read Issuing
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> rdIss{};
        ///Write Issuing
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> wrIss{};
    }
    namespace AximxCompId0{    ///<Component ID Register
        using Addr = Register::Address<0x00801ff0,0xffffff00,0x00000000,unsigned>;
        ///Component ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxCompId1{    ///<Component ID Register
        using Addr = Register::Address<0x00801ff4,0xffffff00,0x00000000,unsigned>;
        ///Component ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxCompId2{    ///<Component ID Register
        using Addr = Register::Address<0x00801ff8,0xffffff00,0x00000000,unsigned>;
        ///Component ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
    namespace AximxCompId3{    ///<Component ID Register
        using Addr = Register::Address<0x00801ffc,0xffffff00,0x00000000,unsigned>;
        ///Component ID
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> id{};
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace pip
{
  class type_error : public cc::diagnosable_error
  {
  public:
    type_error(cc::location loc, const std::string& msg)
      : cc::diagnosable_error(cc::dk_error, "type", loc, msg)
    { }
  };

  class syntax_error : public cc::diagnosable_error
  {
  public:
    syntax_error(cc::location loc, const std::string& msg)
      : cc::diagnosable_error(cc::dk_error, "syntax", loc, msg)
    { }
  };

  translator::translator(context& cxt)
    : cxt(cxt), field_decoder(cxt)
  {
  }

  /// program ::= (pip <decl-seq>)
  decl*
  translator::trans_program(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      decl_seq decls;
      match_list(list, "pip", &decls);

      return new program_decl(std::move(decls));
    }
    sexpr::throw_unexpected_term(e);
  }

  /// decl-seq ::= (<decl*>)
  decl_seq
  translator::trans_decls(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      decl_seq decls;

      decl* d = trans_decl(list);
      decls.push_back(d);

      return decls;
    }
    sexpr::throw_unexpected_term(e);
  }

  /// decl ::= table-decl | meter-decl
  decl*
  translator::trans_decl(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      symbol* sym;
      match_list(list, &sym);
      if (*sym == "table")
	return trans_table(list);
      sexpr::throw_unexpected_id(cast<sexpr::id_expr>(list->exprs[0]));
    }
    sexpr::throw_unexpected_term(e);
  }

  /// table-decl ::= (table id <match-kind> <action-seq> <rule-seq>)
  ///
  /// rule-kind ::= exact | prefix | wildcard | range
  decl*
  translator::trans_table(const sexpr::list_expr* e)
  {
    symbol* id;
    symbol* kind;
    action_seq actions;
    rule_seq rules;
    match_list(e, "table", &id, &kind, &actions, &rules);

    auto it = match_kinds.find(kind);
    if(it == match_kinds.end()) {
      std::stringstream ss;
      ss << "Invalid table rule: " << *(kind);
      throw syntax_error(cc::get_location(e), ss.str());
    }

    match_kind = it->second;

    return new table_decl(id, match_kind, std::move(actions), std::move(rules));
  }

  /// rule_seq ::= (<rule*>)
  rule_seq
  translator::trans_rules(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      match_list(list, "rules");
      rule_seq rules;

      // Match each element in turn.
      for(const sexpr::expr* el : list->exprs) {
        // We are only interested in the entire sublists contained within list,
        // not its individual expressions.
	if(const sexpr::list_expr* r = as<sexpr::list_expr>(el)) {
	  rule* r1 = trans_rule(r);
	  rules.push_back(r1);
	}
      }
      return rules;
    }
    sexpr::throw_unexpected_term(e);
  }

  rule*
  translator::trans_rule(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      expr_seq exprs;
      expr* key;
      action_seq actions;

      match_list(list, &key, &actions);

      auto r = new rule(match_kind, key, std::move(actions));
      return r;
    }

    sexpr::throw_unexpected_term(e);
  }

  rule*
  translator::trans_rule(const sexpr::list_expr* e)
  {
    expr_seq exprs;
    expr* key;
    action_seq actions;

    match_list(e, "rule", &key, &actions);

    auto r = new rule(match_kind, key, std::move(actions));

    return r;
  }

  action_seq
  translator::trans_actions(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      match_list(list, "actions");
      action_seq actions;
      for(const sexpr::expr* el : list->exprs) {
	// We are only interested in the entire sublists contained within list,
	// not its individual expressions.
	if(const sexpr::list_expr* a = as<sexpr::list_expr>(el)) {
	  action* a1 = trans_action(a);
	  actions.push_back(a1);
	}
      }

      return actions;
    }
    sexpr::throw_unexpected_term(e);
  }

  action*
  translator::trans_action(const sexpr::list_expr* e)
  {
    symbol* action_name;
    expr_seq exprs;
    int i;

    match_list(e, &action_name);

    if(*action_name == "advance") {
      expr* amount;
      match_list(e, "advance", &amount);
      return cxt.make_advance_action(amount);
    }

    if(*action_name == "copy") {
      expr* src;
      expr* dst;
      expr* n;
      match_list(e, "copy", &src, &dst, &n);

      if(!dynamic_cast<bitfield_expr*>(src)) {
	std::stringstream ss;
	ss << "Source in copy action does not have location type. Currently of type: "
	   << get_node_name(src->ty) << '\n';
	throw type_error(cc::get_location(e), ss.str());
      }

      if(!dynamic_cast<bitfield_expr*>(dst)) {
	std::stringstream ss;
	ss << "Destination of copy must be of type location. Currently of type: "
	   << get_node_name(dst->ty) << '\n';
	throw type_error(cc::get_location(e), ss.str());
      }

      if(!(dynamic_cast<int_expr*>(n))) {
	std::stringstream ss;
	ss << "Length of copy must be of type int. Currently of type: "
	   << get_node_name(n->ty) << '\n';
	throw type_error(cc::get_location(e), ss.str());
      }

      return cxt.make_copy_action(src, dst, n);
    }

    if(*action_name == "set") {
      expr* f;
      expr* v;
      match_list(e, "set", &f, &v);
      return cxt.make_set_action(f, v);
    }

    if(*action_name == "write") {
      action* a;
      match_list(e, "write", &a);

      return cxt.make_write_action(a);
    }

    if(*action_name == "clear") {
      return cxt.make_clear_action();
    }

    if(*action_name == "drop") {
      return cxt.make_drop_action();
    }

    if(*action_name == "match") {
      return cxt.make_match_action();
    }

    if(*action_name == "goto") {
      expr* dst;
      match_list(e, "goto", &dst);

      return cxt.make_goto_action(dst);
    }

    if(*action_name == "output") {
      expr* dst;
      match_list(e, "output", &dst);

      return cxt.make_output_action(dst);
    }

    sexpr::throw_unexpected_term(e);
  }

  expr*
  translator::trans_expr(const sexpr::expr* e)
  {
    // Match phrases.
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      symbol* sym;
      match_list(list, &sym);

      auto it = expression_symbols.find(sym);

      if(it == expression_symbols.end()) {
	std::stringstream ss;
	ss << "Invalid expression kind: " << *(sym);
	throw syntax_error(cc::get_location(e), ss.str());
      }

      switch(it->second) {
      case es_int:
	return trans_int_expr(list);

      case es_wildcard:
	return trans_wild_expr(list);
      case es_range:
	return trans_range_expr(list);
      case es_port:
	return trans_port_expr(list);
      case es_reserved_port:
	return trans_reserved_port_expr(list);
      case es_bitfield:
	return trans_bitfield_expr(list);
      case es_miss:
	return trans_miss_expr();
      case es_named_field:
	return trans_named_field_expr(list);
      case es_ref:
	return trans_ref_expr(list);
      }
    }
  }

  expr_seq
  translator::trans_exprs(const sexpr::expr* e)
  {
    if (const sexpr::list_expr* list = as<sexpr::list_expr>(e)) {
      expr_seq exprs;
      for (const sexpr::expr* elem : list->exprs) {
	expr* e = trans_expr(elem);
	exprs.push_back(e);
      }
      return exprs;
    }
    sexpr::throw_unexpected_term(e);
  }

  expr*
  translator::trans_range_expr(const sexpr::list_expr* e)
  {
    expr* lo;
    expr* hi;
    match_list(e, "range", &lo, &hi);

    auto lo_expr = as<int_expr>(lo);
    if(!lo_expr) {
      std::stringstream ss;
      ss << "Expression 1 in range not of int type. Currently of type: " << get_node_name(lo->ty);
      throw type_error(cc::get_location(e), ss.str());
    }

    auto hi_expr = as<int_expr>(hi);
    if(!hi_expr) {
      std::stringstream ss;
      ss << "Expression 2 in range not of int type. Currently of type: " << get_node_name(hi->ty);
      throw type_error(cc::get_location(e), ss.str());
    }

    auto lo_val = lo_expr->val;
    auto hi_val = hi_expr->val;

    auto lo_ty = static_cast<int_type*>(lo_expr->ty);
    auto hi_ty = static_cast<int_type*>(hi_expr->ty);

    if(lo_ty->width == hi_ty->width)
      return cxt.make_range_expr(new range_type(
				   new int_type(lo_ty->width)), lo_val, hi_val);
    std::stringstream ss;
    ss << "Width of range arguments not equal: " << lo_ty->width << ", and "
       << hi_ty->width << "\n";
    throw type_error(cc::get_location(e), ss.str());
  }

  expr*
  translator::trans_wild_expr(const sexpr::list_expr* e)
  {
  }

  expr*
  translator::trans_miss_expr()
  {
    // FIXME: this should correspond to the match kind of the table.
    return cxt.make_miss_expr(new int_type(64));
  }

  expr*
  translator::trans_ref_expr(const sexpr::list_expr* e)
  {
    symbol* ref;
    match_list(e, "ref", &ref);

    return cxt.make_ref_expr(new ref_type, ref);
  }

  expr*
  translator::trans_named_field_expr(const sexpr::list_expr* e)
  {
    symbol* field;
    match_list(e, "named_field", &field);

    // TODO: move decoding to resolver
    return field_decoder.decode_named_field(
      static_cast<named_field_expr*>(cxt.make_named_field_expr(new loc_type, field)));
  }

  expr*
  translator::trans_port_expr(const sexpr::list_expr* e)
  {
    expr* port;
    match_list(e, "port", &port);

    if(get_kind(port) != ek_int) {
      std::stringstream ss;
      ss << "Port value must be of type int. Currently of type: " << get_node_name(port->ty);
      throw type_error(cc::get_location(e), ss.str());
    }

    return cxt.make_port_expr(new port_type, port);
  }

  expr*
  translator::trans_reserved_port_expr(const sexpr::list_expr* e)
  {
    symbol* port_name;
    match_list(e, "reserved_port", &port_name);

    auto find = port_names.find(*port_name);
    if(find == port_names.end()) {
      std::stringstream ss;
      ss << "Invalid reserved port: \"" << *port_name << "\"";
      throw syntax_error(cc::get_location(e), ss.str());
    }

    return cxt.make_port_expr(new port_type, port_name);
  }

  expr*
  translator::trans_bitfield_expr(const sexpr::list_expr* e)
  {
    symbol* space;
    expr* pos;
    expr* len;

    match_list(e, "bitfield", &space, &pos, &len);

    address_space as;
    auto it = address_spaces.find(space);
    if(it != address_spaces.end())
      as = it->second;
    else {
      std::stringstream ss;
      ss << "Invalid address space: " << *(space);
      throw syntax_error(cc::get_location(e), ss.str());
    }

    int_type* pos_ty = dynamic_cast<int_type*>(pos->ty);
    if(!pos_ty) {
      std::stringstream ss;
      ss << "Position in bitfield expression must be of type int. Currently of type: " <<
	get_node_name(pos->ty);
      throw type_error(cc::get_location(e), ss.str());
    }

    int_type* len_ty = dynamic_cast<int_type*>(len->ty);
    if(!len_ty) {
      std::stringstream ss;
      ss << "Length in bitfield expression must be of type int. Currently of type: " <<
	get_node_name(len->ty);
      throw type_error(cc::get_location(e), ss.str());
    }

    return cxt.make_bitfield_expr(as, pos, len);
  }

  // When given an integer width specifier, such as i32,
  // return the integer after the i. In this case, 32.
  static int
  deduce_int_type_width(const sexpr::list_expr* e, const symbol* ty)
  {
    std::string spec = *ty;

    if(spec.front() == 'i') {
      spec.erase(0, 1);

      std::size_t size;
      auto width = std::stoi(spec.c_str(), &size);

      if(width > 64 || width < 1) {
	std::stringstream ss;
	ss << "Integer width specifier must be between 1 and 64."
	   << " Currently of value: " << width;
	throw syntax_error(cc::get_location(e), ss.str());
      }

      if(spec.size() == size)
	return width;
    }

    std::stringstream ss;
    ss << "Invalid integer width specifier: " << *ty <<
      ". Specifier should be of form i[integer].\n";
    throw syntax_error(cc::get_location(e), ss.str());
  }

  expr*
  translator::trans_int_expr(const sexpr::list_expr* e)
  {
    symbol* width_specifier;
    int value;
    match_list(e, "int", &width_specifier, &value);

    int w = deduce_int_type_width(e, width_specifier);

    return cxt.make_int_expr(new int_type(w), value);
  }

  // -------------------------------------------------------------------------- //
  // Matching

  void
  translator::match(const sexpr::list_expr* list, int n, decl_seq* decls)
  {
    *decls = trans_decls(get(list, n));
  }

  void
  translator::match(const sexpr::list_expr* list, int n, rule_seq* rules)
  {
    *rules = trans_rules(get(list, n));
  }

  void
  translator::match(const sexpr::list_expr* list, int n, expr_seq* exprs)
  {
    *exprs = trans_exprs(get(list, n));
  }

  void
  translator::match(const sexpr::list_expr* list, int n, expr** out)
  {
    *out = trans_expr(get(list, n));
  }

  void
  translator::match(const sexpr::list_expr* list, int n, action_seq* actions)
  {
    *actions = trans_actions(get(list, n));
  }

  void
  translator::match(const sexpr::list_expr* list, int n, action** a)
  {
    *a = trans_action(list);
  }
} // namespace pip


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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"
    tools:context="com.github.slashrootv200.exofragmentdemo.DemoActivity"
>
  <FrameLayout
      android:id="@+id/main_container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@android:color/black"
  />
</RelativeLayout>


text:
@echo off

:: Path of the cURL executable
set CURL="curl.exe"

:: Source PDF file to split
set SOURCE_FILE_URL=https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf
:: Comma-separated list of page numbers (or ranges) to process. Example: '1,3-5,7-'.
set PAGES=1-2,3-
:: Result PDF file name
set RESULT_FILE_NAME=result.pdf

:: Please NOTE: In this sample we're assuming Cloud Api Server is hosted at "https://localhost".
:: If it's not then please replace this with with your hosting url.

:: Prepare URL for `Split PDF` API call
set QUERY="https://localhost/pdf/split?name=%RESULT_FILE_NAME%&pages=%PAGES%&url=%SOURCE_FILE_URL%"

:: Perform request and save response to a file
%CURL% -# -X GET %QUERY% >response.json

:: Display the response
type response.json

:: Use any convenient way to parse JSON response and get URL of generated file(s)

echo.
pause


text:
      <button type="button" class="close" data-dismiss="modal">x</button>

Change displayed fields

Per Variant

Per Alternate

Per Sample

Per Variant

Per Alternate

Per Sample

      <button id="gd-filter-key-modal-apply-btn" class="btn btn-success">Apply changes</button>
      <button id="gd-filter-key-modal-dismiss-btn" class="btn btn-default" data-dismiss="modal">Cancel</button>


text:
package cluedo.model.cards;

import java.awt.image.BufferedImage;

import cluedo.model.Player;
import cluedo.model.gameObjects.GameObject;

/**
 * Interface that represents the cards in the game, every game object is
 * represented by a single card.
 *
 *
 * @author Cameron Bryers, Hannah Craighead
 *
 */
public interface Card {

	public abstract GameObject getObject();

	/**
	 * Returns the image of the card as an ImageIcon
	 * @return
	 */
	public abstract BufferedImage getImage();
}


text:
require 'spec_helper'

describe Lego::Value::Base do
  let(:opts) { {} }

  subject { Lego::Value::Base.new(opts) }

  describe '#parse' do
    context 'nil is missing' do
      context 'with default handler' do
        let(:opts) { { default: ->{ 'default' } } }
        specify { subject.parse(nil).should be_just('default') }
      end

      context 'without default handler' do
        specify { subject.parse(nil).should be_error('missing value') }
      end
    end

  end

end


text:
namespace arangodb::tests::quick {

// TODO generators should pass a random state around, to get deterministic
//      results per seed
template<typename T>
auto generate() -> T;
template<typename T>
auto generate(std::int32_t max) -> T;

struct AlphaNumeric {
  char c;
};

}  // namespace arangodb::tests::quick


text:
package authoring.abstractfeatures;

import javafx.scene.layout.BorderPane;

public class CreatorPane extends BorderPane{

}


text:
package com.intellij.util.text;

import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.NotNull;
import sun.reflect.ConstructorAccessor;

import java.lang.reflect.Constructor;

public class StringFactory {
  // String(char[], boolean). Works since JDK1.7, earlier JDKs have too slow reflection anyway
  private static final ConstructorAccessor ourConstructorAccessor;

  static {
    ConstructorAccessor constructorAccessor = null;
    try {
      Constructor<String> newC = String.class.getDeclaredConstructor(char[].class, boolean.class);
      constructorAccessor = ReflectionUtil.getConstructorAccessor(newC);
    }
    catch (Exception ignored) {
    }
    ourConstructorAccessor = constructorAccessor;
  }

  /**
   * @return new instance of String which backed by 'chars' array.
   *
   * CAUTION. EXTREMELY DANGEROUS.
   * DO NOT USE THIS METHOD UNLESS YOU ARE TOO DESPERATE
   */
  @NotNull
  public static String createShared(@NotNull char[] chars) {
    if (ourConstructorAccessor != null) {
      return ReflectionUtil.createInstanceViaConstructorAccessor(ourConstructorAccessor, chars, Boolean.TRUE);
    }
    return new String(chars);
  }
}


text:
package com.orientechnologies.orient.core.db;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import com.orientechnologies.common.concur.lock.OLockException;
import com.orientechnologies.common.concur.resource.OResourcePool;
import com.orientechnologies.common.concur.resource.OResourcePoolListener;
import com.orientechnologies.common.log.OLogManager;

public abstract class ODatabasePoolAbstract<DB extends ODatabase> implements OResourcePoolListener<String, DB> {

	private static final int															DEF_WAIT_TIMEOUT	= 5000;
	private final Map<String, OResourcePool<String, DB>>	pools							= new HashMap<String, OResourcePool<String, DB>>();
	private int																						maxSize;
	private int																						timeout						= DEF_WAIT_TIMEOUT;
	protected Object																			owner;

	public ODatabasePoolAbstract(final Object iOwner, final int iMinSize, final int iMaxSize) {
		this(iOwner, iMinSize, iMaxSize, DEF_WAIT_TIMEOUT);
	}

	public ODatabasePoolAbstract(final Object iOwner, final int iMinSize, final int iMaxSize, final int iTimeout) {
		maxSize = iMaxSize;
		timeout = iTimeout;
		owner = iOwner;
	}

	public DB acquire(final String iURL, final String iUserName, final String iUserPassword) throws OLockException {
		return acquire(iURL, iUserName, iUserPassword, null);
	}

	public DB acquire(final String iURL, final String iUserName, final String iUserPassword, final Map<String, Object> iOptionalParams)
			throws OLockException {
		int separatorPos = iURL.lastIndexOf('/');

		final String name;
		if (separatorPos > -1)
			name = iURL.substring(separatorPos + 1);
		else {
			separatorPos = iURL.lastIndexOf(':');
			if (separatorPos > -1)
				name = iURL.substring(separatorPos + 1);
			else
				name = iURL;
		}

		final String dbPooledName = iUserName + "@" + name;

		OResourcePool<String, DB> pool = pools.get(dbPooledName);
		if (pool == null) {
			synchronized (pools) {
				pool = pools.get(dbPooledName);
				if (pool == null) {
					pool = new OResourcePool<String, DB>(maxSize, this);
					pools.put(dbPooledName, pool);
				}
			}
		}

		return pool.getResource(iURL, timeout, iUserName, iUserPassword, iOptionalParams);
	}

	public void release(final DB iDatabase) {
		final String dbPooledName = iDatabase instanceof ODatabaseComplex ? ((ODatabaseComplex<?>) iDatabase).getUser().getName() + "@"
				+ iDatabase.getName() : iDatabase.getName();

		final OResourcePool<String, DB> pool = pools.get(dbPooledName);
		if (pool == null)
			throw new OLockException("Can't release a database URL not acquired before. URL: " + iDatabase.getName());

		pool.returnResource(iDatabase);
	}

	public DB reuseResource(final String iKey, final DB iValue) {
		return iValue;
	}

	public Map<String, OResourcePool<String, DB>> getPools() {
		return pools;
	}

	/**
	 * Closes all the databases.
	 */
	public void close() {
		for (Entry<String, OResourcePool<String, DB>> pool : pools.entrySet()) {
			for (DB db : pool.getValue().getResources()) {
				pool.getValue().close();
				try {
					OLogManager.instance().debug(this, "Closing pooled database '%s'...", db.getName());
					((ODatabasePooled) db).forceClose();
					OLogManager.instance().debug(this, "OK", db.getName());
				} catch (Exception e) {
					OLogManager.instance().debug(this, "Error: %d", e.toString());
				}
			}
		}
	}

	public void remove(String iName, String iUser) {
		final String dbPooledName = iUser + "@" + iName;

		final OResourcePool<String, DB> pool = pools.get(dbPooledName);

		if (pool != null)
			for (DB db : pool.getResources()) {
				pool.close();
				try {
					OLogManager.instance().debug(this, "Closing pooled database '%s'...", db.getName());
					((ODatabasePooled) db).forceClose();
					OLogManager.instance().debug(this, "OK", db.getName());
				} catch (Exception e) {
					OLogManager.instance().debug(this, "Error: %d", e.toString());
				}

			}
	}

	public int getMaxSize() {
		return maxSize;
	}
}


text:
'use strict';

var FS = require('fs');
var OSP = require('..');

describe.skip('test Identical', function () {
    it('should be tested', function () {

    var options= {
        smooth: 8,
        normalize: true
    }

    var data=FS.readFileSync('./data/expNearlyIdentical.txt', 'utf8');
    var spectra=OSP.parse(data, options);
    var annotations=OSP.getAnnotations(spectra.R);
    var chart=OSP.getChart(spectra);

    var spectraArray=OSP.Util.toArray(spectra);

    console.log(spectra.T);

        throw new Error('no test!');
    });
});


text:
require 'lib_spec_helper'

describe DVT::LPI::Converters do

  describe DVT::LGA::Converters::WHITESPACE_STRIP do

    subject { DVT::LGA::Converters::WHITESPACE_STRIP }

    let(:field) { '  foo  ' }
    let(:field_info)  { double('field_info') }

    it 'strips trailing and leading whitespace from fields' do
      subject.call(field, field_info).should == 'foo'
    end

    it 'leaves non string fields unmodified' do
      subject.call(42, field_info).should == 42
    end
  end
end


text:
For some use functional cases, you may want to use a custom sort on a column. To make it, you have to follow theses steps :

1.  create the sort function

The function you have to create must be a curry function in order to get the "sortBy" parameter, this parameter is required because the a & b values are filled with a row each. As we want to sort on only a column, we have to know on what column the current sort is asked.

```javascript
function sortByLength(sortBy) {
	return function sort(a, b) {
		return a.get(sortBy).length - b.get(sortBy).length;
	};
}
```

2.  Register the function in the cmf registry

Next, we have to register the function, here, there is no prefix required, but it could be easier if you want next to look in the registry to see one

```javascript
api.registry.addToRegistry('_list_sort:sortByLength', sortByLength);
```

3.  Reference the custom sort in the list's columns

The we have to give to the column the sort function we want to apply.

```javascript
{ key: 'label', label: 'Name', sortFunction: '_list_sort:sortByLength' },
```

It's all done. The list would apply the custom sort.

## Custom action support for filterBar and sorting

1. custom action for filterBar

The custom actions for filterBar allows to override default actions onToggle or onFilter (ex: for a server side filter).
Following sagas are dispatched to perform server side operations onToggle or onFilter,
```
	LIST_TOGGLE_FILTER: 'LIST_TOGGLE_FILTER',
	LIST_FILTER_CHANGE: 'LIST_FILTER_CHANGE'
```
Setting the following attributes in cmf settings will disable the default filter and paging,
```
	"toolbar": {
              "filter": {
                "defaultFiltering": false
              }
              "pagination": {
                "defaultPaging": false
              }
            }
```

2. custom action for sorting

The custom actions on sort allows to override default action onSorting (ex: for a server side sorting).
Following sagas are dispatched to perform server side operations onSorting,

```
	LIST_CHANGE_SORT_ORDER: 'LIST_CHANGE_SORT_ORDER'
```
Setting the following attributes in cmf settings will disable the default sorting,
```
	"sort": {
               "defaultSorting": false
            }
```


text:
using System.Collections.Generic;
using UnityEngine;

namespace Plantain {

    /// <summary>
    /// The base Trigger type. All Triggers should inherit from this class.
    /// </summary>
    [HideInInspector]
    public abstract class Trigger : MonoBehaviour {

        /// <summary>
        /// Does this start on?
        /// </summary>
        public bool initiallyActive = false;

        /// <summary>
        /// Can this produce triggers?
        /// </summary>
        public bool isActive = false;

        /// <summary>
        /// What will a performer do when this trigger triggers?
        /// </summary>
        public TriggerOption triggerOption = TriggerOption.toggle;

        /// <summary>
        /// The location of the triggers' gizmo.
        /// </summary>
        [HideInInspector]
        public Vector3 gizmoPosition {
            get { return _gizmoPosition; }
        }
        protected Vector3 _gizmoPosition;

        /// <summary>
        /// Director for Trigger Gizmos
        /// </summary>
        protected string gizmoPath = "Plantain\\Trigger\\";

        /*
        *	Plantain Functions
        */

        /// <summary>
        /// Alert performers of what state to change to based on the current <see cref="TriggerOption"/>.
        /// </summary>
        protected virtual void Fire() {
            SendMessage("PerformTrigger", triggerOption, SendMessageOptions.DontRequireReceiver);
        }

        /// <summary>
        /// Called when a Performer or the game object it is on turns on.
        /// </summary>
        /// <param name="p"></param>
        public virtual void OnPerformerActivate(Performer p) { }

        /// <summary>
        /// Called when a Performer or the game object it is on turns off
        /// </summary>
        /// <param name="p"></param>
        public virtual void OnPerformerDeactivate(Performer p) { }

        /*
        *	Gizmo Drawing Functions
        */

        /// <summary>
        /// Draw ALL the icons
        /// </summary>
        /// <param name="gizmoName">The icon name</param>
        protected void TriggerGizmos(string gizmoName) {
            Trigger[] ms = GetComponents<Trigger>();
            var i = 0;
            foreach(Trigger m in ms) {
                if(m.Equals(this)) {
                    break;
                }
                if(m != null) {
                    i++;
                }
            }

            _gizmoPosition = transform.position + Vector3.down + Camera.current.transform.TransformDirection(Vector3.right) * i;

            string state = (isActive) ? "Trigger_On" : "Trigger_NotOn";
            Gizmos.DrawIcon(_gizmoPosition, gizmoPath + state);
            state = (isActive) ? "Trigger_Active" : "Trigger_NotActive";
            Gizmos.DrawIcon(_gizmoPosition, gizmoPath + state);

            if(gizmoName != null) {
                Gizmos.DrawIcon(_gizmoPosition, gizmoPath + gizmoName);
            }
        }

        /// <summary>
        /// Helper function to shoot a debug line at any targets of this list.
        /// </summary>
        /// <param name="gameObjList"></param>
        protected void GizmoTargetedObjects(List<GameObject> gameObjList) {
            if(gameObjList != null && gameObjList.Count > 0) {
                foreach(GameObject gameObj in gameObjList) {
                    if(!gameObject.Equals(gameObj) && gameObj != null) {
                        Gizmos.DrawLine(_gizmoPosition, gameObj.transform.position);
                    }
                }
            }
        }
    }

}


text:
APT-MESOS

{{error}}

			<form name="form" ng-submit="login()" role="form">

Username

					<input type="text" name="username" id="username" class="login-input form-control" ng-model="username" required />
					Username is required

Password

					<input type="password" name="password" id="password" class="login-input form-control" ng-model="password" required />
					Password is required

					<button type="submit" ng-disabled="form.$invalid || dataLoading" class="btn btn-primary btn-block">Login</button>

			</form>

		Github
		 ·
		Contact Author

		© 2016 Institute of Computer Software, Nanjing University


text:
package com.hazelcast.collection.impl.set;

import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import com.hazelcast.collection.LocalSetStats;
import com.hazelcast.collection.impl.collection.CollectionContainer;
import com.hazelcast.collection.impl.collection.CollectionService;
import com.hazelcast.collection.impl.set.operations.SetReplicationOperation;
import com.hazelcast.collection.impl.txnset.TransactionalSetProxy;
import com.hazelcast.config.SetConfig;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.internal.metrics.DynamicMetricsProvider;
import com.hazelcast.internal.metrics.MetricDescriptor;
import com.hazelcast.internal.metrics.MetricDescriptorConstants;
import com.hazelcast.internal.metrics.MetricsCollectionContext;
import com.hazelcast.internal.metrics.impl.ProviderHelper;
import com.hazelcast.internal.monitor.impl.LocalSetStatsImpl;
import com.hazelcast.internal.partition.PartitionReplicationEvent;
import com.hazelcast.internal.services.StatisticsAwareService;
import com.hazelcast.internal.util.ConcurrencyUtil;
import com.hazelcast.internal.util.ConstructorFunction;
import com.hazelcast.internal.util.ContextMutexFactory;
import com.hazelcast.internal.util.MapUtil;
import com.hazelcast.spi.impl.NodeEngine;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.spi.impl.operationservice.Operation;
import com.hazelcast.spi.properties.ClusterProperty;
import com.hazelcast.transaction.impl.Transaction;

import static com.hazelcast.internal.util.ConcurrencyUtil.getOrPutSynchronized;

public class SetService extends CollectionService implements DynamicMetricsProvider , StatisticsAwareService<LocalSetStats> {

    public static final String SERVICE_NAME = "hz:impl:setService";

    private static final Object NULL_OBJECT = new Object();

    private final ConcurrentMap<String, SetContainer> containerMap = new ConcurrentHashMap<String, SetContainer>();

    private final ConcurrentMap<String, Object> splitBrainProtectionConfigCache = new ConcurrentHashMap<String, Object>();
    private final ContextMutexFactory splitBrainProtectionConfigCacheMutexFactory = new ContextMutexFactory();
    private final ConstructorFunction<String, Object> splitBrainProtectionConfigConstructor
            = new ConstructorFunction<String, Object>() {
        @Override
        public Object createNew(String name) {
            SetConfig lockConfig = nodeEngine.getConfig().findSetConfig(name);
            String splitBrainProtectionName = lockConfig.getSplitBrainProtectionName();
            return splitBrainProtectionName == null ? NULL_OBJECT : splitBrainProtectionName;
        }
    };
    private final ConcurrentMap<String, LocalSetStatsImpl> statsMap = new ConcurrentHashMap<>();
    private final ConstructorFunction<String, LocalSetStatsImpl> localCollectionStatsConstructorFunction =
            key -> new LocalSetStatsImpl();

    public SetService(NodeEngine nodeEngine) {
        super(nodeEngine);
    }

    @Override
    public void init(NodeEngine nodeEngine, Properties properties) {
        boolean dsMetricsEnabled = nodeEngine.getProperties().getBoolean(ClusterProperty.METRICS_DATASTRUCTURES);
        if (dsMetricsEnabled) {
            ((NodeEngineImpl) nodeEngine).getMetricsRegistry().registerDynamicMetricsProvider(this);
        }
        super.init(nodeEngine, properties);
    }

    @Override
    public SetContainer getOrCreateContainer(String name, boolean backup) {
        SetContainer container = containerMap.get(name);
        if (container == null) {
            container = new SetContainer(name, nodeEngine);
            final SetContainer current = containerMap.putIfAbsent(name, container);
            if (current != null) {
                container = current;
            }
        }
        return container;
    }

    @Override
    public ConcurrentMap<String, ? extends CollectionContainer> getContainerMap() {
        return containerMap;
    }

    @Override
    public String getServiceName() {
        return SERVICE_NAME;
    }

    @Override
    public DistributedObject createDistributedObject(String objectId, UUID source, boolean local) {
        return new SetProxyImpl(objectId, nodeEngine, this);
    }

    @Override
    public void destroyDistributedObject(String name, boolean local) {
        super.destroyDistributedObject(name, local);
        splitBrainProtectionConfigCache.remove(name);
    }

    @Override
    public TransactionalSetProxy createTransactionalObject(String name, Transaction transaction) {
        return new TransactionalSetProxy(name, transaction, nodeEngine, this);
    }

    @Override
    public Operation prepareReplicationOperation(PartitionReplicationEvent event) {
        final Map<String, CollectionContainer> migrationData = getMigrationData(event);
        return migrationData.isEmpty()
                ? null
                : new SetReplicationOperation(migrationData, event.getPartitionId(), event.getReplicaIndex());
    }

    @Override
    public String getSplitBrainProtectionName(final String name) {
        Object splitBrainProtectionName = getOrPutSynchronized(splitBrainProtectionConfigCache, name,
                splitBrainProtectionConfigCacheMutexFactory, splitBrainProtectionConfigConstructor);
        return splitBrainProtectionName == NULL_OBJECT ? null : (String) splitBrainProtectionName;
    }

    @Override
    public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
        ProviderHelper.provide(descriptor, context, MetricDescriptorConstants.SET_PREFIX, getStats());
    }

    @Override
    public Map<String, LocalSetStats> getStats() {
        Map<String, LocalSetStats> setStats = MapUtil.createHashMap(containerMap.size());
        for (Map.Entry<String, SetContainer> entry : containerMap.entrySet()) {
            String name = entry.getKey();
            SetContainer setContainer = entry.getValue();
            if (setContainer.getConfig().isStatisticsEnabled()) {
                LocalSetStats setStat = getLocalCollectionStats(name);
                setStats.put(name, setStat);
            }
        }
        return setStats;
    }

    @Override
    public LocalSetStatsImpl getLocalCollectionStats(String name) {
        return ConcurrencyUtil.getOrPutIfAbsent(statsMap, name, localCollectionStatsConstructorFunction);
    }
}


text:
import glyphMap
  from './vendor/react-native-vector-icons/glyphmaps/SimpleLineIcons.json';
import createIconSet from './createIconSet';

export default createIconSet(
  glyphMap,
  'simple-line-icons',
  require('./fonts/SimpleLineIcons.ttf')
);


text:
Gulp Run

``` php
<?php
// simple execution
$this->taskGulpRun()->run();

// run task 'clean' with --silent option
$this->taskGulpRun('clean')
     ->silent()
     ->run();
?>
```

* `silent()`  adds `silent` option to gulp
* `noColor()`  adds `--no-color` option to gulp
* `color()`  adds `--color` option to gulp
* `simple()`  adds `--tasks-simple` option to gulp
* `setLogger($logger)`  Sets a logger.
* `setContainer($container)`  Set a container.
* `getContainer()`  Get the container.
* `logger()`
* `addToCollection($collection, $taskName = null, $rollbackTask = null)`
* `addAsRollback($collection)`
* `addAsCompletion($collection)`
* `addToCollectionAndIgnoreErrors($collection, $taskName = null)`
* `dir($dir)`  changes working directory of command
* `printed($arg)`  Should command output be printed
* `arg($arg)`  Pass argument to executable
* `args($args)`  Pass methods parameters as arguments to executable
* `option($option, $value = null)`  Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter.
* `optionList($option, $value = null)`  Pass multiple options to executable. Value can be a string or array.


text:
// .NAME vtkGenericGeometryFilter - extract geometry from data (or convert data to polygonal type)
// .SECTION Description
// vtkGenericGeometryFilter is a general-purpose filter to extract geometry (and
// associated data) from any type of dataset. Geometry is obtained as
// follows: all 0D, 1D, and 2D cells are extracted. All 2D faces that are
// used by only one 3D cell (i.e., boundary faces) are extracted. It also is
// possible to specify conditions on point ids, cell ids, and on
// bounding box (referred to as "Extent") to control the extraction process.
//
// This filter also may be used to convert any type of data to polygonal
// type. The conversion process may be less than satisfactory for some 3D
// datasets. For example, this filter will extract the outer surface of a
// volume or structured grid dataset. (For structured data you may want to
// use vtkImageDataGeometryFilter, vtkStructuredGridGeometryFilter,
// vtkExtractUnstructuredGrid, vtkRectilinearGridGeometryFilter, or
// vtkExtractVOI.)

// .SECTION Caveats
// When vtkGenericGeometryFilter extracts cells (or boundaries of cells) it
// will (by default) merge duplicate vertices. This may cause problems
// in some cases. For example, if you've run vtkPolyDataNormals to
// generate normals, which may split meshes and create duplicate
// vertices, vtkGenericGeometryFilter will merge these points back
// together. Turn merging off to prevent this from occurring.

// .SECTION See Also
// vtkImageDataGeometryFilter vtkStructuredGridGeometryFilter
// vtkExtractGeometry vtkExtractVOI

#ifndef vtkGenericGeometryFilter_h
#define vtkGenericGeometryFilter_h

#include "vtkFiltersGenericModule.h" // For export macro
#include "vtkPolyDataAlgorithm.h"

class vtkIncrementalPointLocator;
class vtkPointData;

class VTKFILTERSGENERIC_EXPORT vtkGenericGeometryFilter : public vtkPolyDataAlgorithm
{
public:
  static vtkGenericGeometryFilter *New();
  vtkTypeMacro(vtkGenericGeometryFilter,vtkPolyDataAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Turn on/off selection of geometry by point id.
  vtkSetMacro(PointClipping,int);
  vtkGetMacro(PointClipping,int);
  vtkBooleanMacro(PointClipping,int);

  // Description:
  // Turn on/off selection of geometry by cell id.
  vtkSetMacro(CellClipping,int);
  vtkGetMacro(CellClipping,int);
  vtkBooleanMacro(CellClipping,int);

  // Description:
  // Turn on/off selection of geometry via bounding box.
  vtkSetMacro(ExtentClipping,int);
  vtkGetMacro(ExtentClipping,int);
  vtkBooleanMacro(ExtentClipping,int);

  // Description:
  // Specify the minimum point id for point id selection.
  vtkSetClampMacro(PointMinimum,vtkIdType,0,VTK_ID_MAX);
  vtkGetMacro(PointMinimum,vtkIdType);

  // Description:
  // Specify the maximum point id for point id selection.
  vtkSetClampMacro(PointMaximum,vtkIdType,0,VTK_ID_MAX);
  vtkGetMacro(PointMaximum,vtkIdType);

  // Description:
  // Specify the minimum cell id for point id selection.
  vtkSetClampMacro(CellMinimum,vtkIdType,0,VTK_ID_MAX);
  vtkGetMacro(CellMinimum,vtkIdType);

  // Description:
  // Specify the maximum cell id for point id selection.
  vtkSetClampMacro(CellMaximum,vtkIdType,0,VTK_ID_MAX);
  vtkGetMacro(CellMaximum,vtkIdType);

  // Description:
  // Specify a (xmin,xmax, ymin,ymax, zmin,zmax) bounding box to clip data.
  void SetExtent(double xMin, double xMax, double yMin, double yMax,
                 double zMin, double zMax);

  // Description:
  // Set / get a (xmin,xmax, ymin,ymax, zmin,zmax) bounding box to clip data.
  void SetExtent(double extent[6]);
  double *GetExtent() { return this->Extent;};

  // Description:
  // Turn on/off merging of coincident points. Note that is merging is
  // on, points with different point attributes (e.g., normals) are merged,
  // which may cause rendering artifacts.
  vtkSetMacro(Merging,int);
  vtkGetMacro(Merging,int);
  vtkBooleanMacro(Merging,int);

  // Description:
  // Set / get a spatial locator for merging points. By
  // default an instance of vtkMergePoints is used.
  void SetLocator(vtkIncrementalPointLocator *locator);
  vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);

  // Description:
  // Create default locator. Used to create one when none is specified.
  void CreateDefaultLocator();

  // Description:
  // Return the MTime also considering the locator.
  unsigned long GetMTime();

  // Description:
  // If on, the output polygonal dataset will have a celldata array that
  // holds the cell index of the original 3D cell that produced each output
  // cell. This is useful for cell picking. The default is off to conserve
  // memory.
  vtkSetMacro(PassThroughCellIds,int);
  vtkGetMacro(PassThroughCellIds,int);
  vtkBooleanMacro(PassThroughCellIds,int);

protected:
  vtkGenericGeometryFilter();
  ~vtkGenericGeometryFilter();

  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
  void PolyDataExecute(); //special cases for performance
  void UnstructuredGridExecute();
  void StructuredGridExecute();
  int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
  int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);

  int FillInputPortInformation(int, vtkInformation*);

  vtkIdType PointMaximum;
  vtkIdType PointMinimum;
  vtkIdType CellMinimum;
  vtkIdType CellMaximum;
  double Extent[6];
  int PointClipping;
  int CellClipping;
  int ExtentClipping;

  int Merging;
  vtkIncrementalPointLocator *Locator;

  // Used internal by vtkGenericAdaptorCell::Tessellate()
  vtkPointData *InternalPD;

  int PassThroughCellIds;

private:
  vtkGenericGeometryFilter(const vtkGenericGeometryFilter&);  // Not implemented.
  void operator=(const vtkGenericGeometryFilter&);  // Not implemented.
};

#endif


text:
from functionaltests.common.models import BaseModel
from functionaltests.common.models import CollectionModel
from functionaltests.common.models import EntityModel

class TransferAcceptsData(BaseModel):
    pass

class TransferAcceptsModel(EntityModel):
    ENTITY_NAME = 'transfer_accept'
    MODEL_TYPE = TransferAcceptsData

class TransferAcceptsListModel(CollectionModel):
    COLLECTION_NAME = 'transfer_accepts'
    MODEL_TYPE = TransferAcceptsData


text:
import unittest
import locale
import datetime
from time import gmtime, strftime
from rfeed import *

class BaseTestCase(unittest.TestCase):

	def _element(self, element, value, attributes = {}):
		return '<' + element + '>' + value + '</' + element + '>'

class SerializableTestCase(BaseTestCase):

	def test_date(self):
		self.assertTrue(self._element('pubDate', 'Thu, 13 Nov 2014 08:00:00 GMT') in Feed('', '', '', pubDate = datetime.datetime(2014, 11, 13, 8, 0, 0)).rss())
		self.assertTrue(self._element('pubDate', 'Mon, 01 Dec 2014 10:22:15 GMT') in Feed('', '', '', pubDate = datetime.datetime(2014, 12, 1, 10, 22, 15)).rss())

class HostTestCase(BaseTestCase):

	def test_add_extension(self):
		host = Host()
		self.assertEquals(0, len(host.extensions))
		host.add_extension(MockExtension1())
		self.assertEquals(1, len(host.extensions))

	def test_add_extension_raises_error_if_extension_is_not_serializable(self):
		host = Host()
		with self.assertRaises(TypeError) as cm:
			host.add_extension(Fake())

class FeedTestCase(BaseTestCase):

	def test_rss_element(self):
		rss = Feed('', '', '').rss()
		self.assertTrue('<rss' in rss)
		self.assertTrue('version="2.0"' in rss)
		self.assertTrue('</rss>' in rss)

	def test_channel_element(self):
		rss = Feed('', '', '').rss()
		self.assertTrue('<channel>' in rss)
		self.assertTrue('</channel>' in rss)

	def test_required_elements(self):
		self.assertTrue(self._element('title', 'This is a sample title') in Feed('This is a sample title', '', '').rss())
		self.assertTrue(self._element('link', 'https://www.google.com') in Feed('', 'https://www.google.com', '').rss())
		self.assertTrue(self._element('description', 'This is a sample description') in Feed('', '', 'This is a sample description').rss())

	def test_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Feed(title = None, link = '', description = '')
		self.assertTrue('title' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Feed(title = '', link = None, description = '')
		self.assertTrue('link' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Feed(title = '', link = '', description = None)
		self.assertTrue('description' in str(cm.exception))

	def test_optional_elements(self):
		self.assertTrue(self._element('language', 'en-us') in Feed('', '', '', language = 'en-us').rss())
		self.assertTrue(self._element('copyright', 'Copyright 2014') in Feed('', '', '', copyright = 'Copyright 2014').rss())
		self.assertTrue(self._element('managingEditor', 'John Doe') in Feed('', '', '', managingEditor = 'John Doe').rss())
		self.assertTrue(self._element('webMaster', 'john@doe.com') in Feed('', '', '', webMaster = 'john@doe.com').rss())
		self.assertTrue(self._element('pubDate', 'Thu, 13 Nov 2014 08:00:00 GMT') in Feed('', '', '', pubDate = datetime.datetime(2014, 11, 13, 8, 0, 0)).rss())
		self.assertTrue(self._element('lastBuildDate', 'Mon, 01 Dec 2014 10:22:15 GMT') in Feed('', '', '', lastBuildDate = datetime.datetime(2014, 12, 1, 10, 22, 15)).rss())
		self.assertTrue(self._element('generator', 'Generator goes here') in Feed('', '', '', generator = 'Generator goes here').rss())
		self.assertTrue(self._element('docs', 'Docs goes here') in Feed('', '', '', docs = 'Docs goes here').rss())
		self.assertTrue(self._element('ttl', '123') in Feed('', '', '', ttl = 123).rss())
		self.assertTrue(self._element('rating', 'abc') in Feed('', '', '', rating = 'abc').rss())

	def test_if_generator_not_specified_use_default_value(self):
		# I'm partially checking for the element because the value includes the version number and
		# changing it will break the test. By just doing a partial match, I make sure the test keeps
		# working in future versions as well.
		self.assertTrue(self._element('docs', 'https://github.com/svpino/rfeed/blob/master/README.md') in Feed('', '', '').rss())

	def test_if_docs_not_specified_use_default_value(self):
		self.assertTrue('<generator>rfeed v' in Feed('', '', '').rss())

	def test_cloud_element(self):
		rss = Feed('', '', '', cloud = Cloud('1', 2, '3', '4', '5')).rss()
		self.assertTrue('<cloud ' in rss)
		self.assertTrue('domain="1"' in rss)
		self.assertTrue('port="2"' in rss)
		self.assertTrue('path="3"' in rss)
		self.assertTrue('registerProcedure="4"' in rss)
		self.assertTrue('protocol="5"' in rss)
		self.assertTrue('</cloud>' in rss)

	def test_image_element(self):
		rss = Feed('', '', '', image = Image('1', '2', '3', 4, 5, '6')).rss()
		self.assertTrue('<image>' in rss)
		self.assertTrue(self._element('url', '1') in rss)
		self.assertTrue(self._element('title', '2') in rss)
		self.assertTrue(self._element('link', '3') in rss)
		self.assertTrue(self._element('width', '4') in rss)
		self.assertTrue(self._element('height', '5') in rss)
		self.assertTrue(self._element('description', '6') in rss)
		self.assertTrue('</image>' in rss)

	def test_textinput_element(self):
		rss = Feed('', '', '', textInput = TextInput('1', '2', '3', '4')).rss()
		self.assertTrue('<textInput>' in rss)
		self.assertTrue(self._element('title', '1') in rss)
		self.assertTrue(self._element('description', '2') in rss)
		self.assertTrue(self._element('name', '3') in rss)
		self.assertTrue(self._element('link', '4') in rss)
		self.assertTrue('</textInput>' in rss)

	def test_skiphours_element(self):
		rss = Feed('', '', '', skipHours = SkipHours([0, 2, 4, 6, 8, 10])).rss()
		self.assertTrue('<skipHours>' in rss)
		self.assertTrue(self._element('hour', '0') in rss)
		self.assertTrue(self._element('hour', '2') in rss)
		self.assertTrue(self._element('hour', '4') in rss)
		self.assertTrue(self._element('hour', '6') in rss)
		self.assertTrue(self._element('hour', '8') in rss)
		self.assertTrue(self._element('hour', '10') in rss)
		self.assertTrue('</skipHours>' in rss)

	def test_skipdays_element(self):
		rss = Feed('', '', '', skipDays = SkipDays(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Friday'])).rss()
		self.assertTrue('<skipDays>' in rss)
		self.assertTrue(self._element('day', 'Monday') in rss)
		self.assertTrue(self._element('day', 'Tuesday') in rss)
		self.assertTrue(self._element('day', 'Wednesday') in rss)
		self.assertTrue(self._element('day', 'Thursday') in rss)
		self.assertTrue(self._element('day', 'Friday') in rss)
		self.assertTrue(self._element('day', 'Saturday') in rss)
		self.assertTrue(self._element('day', 'Friday') in rss)
		self.assertTrue('</skipDays>' in rss)

	def test_categories_as_single_category_element(self):
		rss = Feed('', '', '', categories = Category(category = '123', domain = '234')).rss()
		self.assertTrue('<category' in rss)
		self.assertTrue('domain="234"' in rss)
		self.assertTrue('>123</category>' in rss)

	def test_categories_as_single_string_element(self):
		rss = Feed('', '', '', categories = '123').rss()
		self.assertTrue(self._element('category', '123') in rss)

	def test_categories_as_category_array_element(self):
		rss = Feed('', '', '', categories = [Category('123'), Category('234'), Category('345')]).rss()
		self.assertTrue(self._element('category', '123') in rss)
		self.assertTrue(self._element('category', '234') in rss)
		self.assertTrue(self._element('category', '345') in rss)

	def test_categories_as_string_array_element(self):
		rss = Feed('', '', '', categories = ['123', '234', '345']).rss()
		self.assertTrue(self._element('category', '123') in rss)
		self.assertTrue(self._element('category', '234') in rss)
		self.assertTrue(self._element('category', '345') in rss)

	def test_image_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Image(url = None, title = '', link = '')
		self.assertTrue('url' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Image(url = '', title = None, link = '')
		self.assertTrue('title' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Image(url = '', title = '', link = None)
		self.assertTrue('link' in str(cm.exception))

	def test_textinput_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			TextInput(title = None, description = '', name = '', link = '')
		self.assertTrue('title' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			TextInput(title = '', description = None, name = '', link = '')
		self.assertTrue('description' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			TextInput(title = '', description = '', name = None, link = '')
		self.assertTrue('name' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			TextInput(title = '', description = '', name = '', link = None)
		self.assertTrue('link' in str(cm.exception))

	def test_skiphours_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			SkipHours(hours = None)
		self.assertTrue('hours' in str(cm.exception))

	def test_skipdays_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			SkipDays(days = None)
		self.assertTrue('days' in str(cm.exception))

	def test_enclosure_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Enclosure(url = None, length = 123, type = '')
		self.assertTrue('url' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Enclosure(url = '', length = None, type = '')
		self.assertTrue('length' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Enclosure(url = '', length = 123, type = None)
		self.assertTrue('type' in str(cm.exception))

	def test_cloud_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Cloud(domain = None, port = '', path = '', registerProcedure = '', protocol = '')
		self.assertTrue('domain' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Cloud(domain = '', port = None, path = '', registerProcedure = '', protocol = '')
		self.assertTrue('port' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Cloud(domain = '', port = '', path = None, registerProcedure = '', protocol = '')
		self.assertTrue('path' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Cloud(domain = '', port = '', path = '', registerProcedure = None, protocol = '')
		self.assertTrue('registerProcedure' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Cloud(domain = '', port = '', path = '', registerProcedure = '', protocol = None)
		self.assertTrue('protocol' in str(cm.exception))

	def test_category_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Category(category = None)
		self.assertTrue('category' in str(cm.exception))

	def test_get_attributes_should_include_namespaces(self):
		self.assertTrue('name="value"' in Feed('', '', '', extensions = [MockExtension1()]).rss())

	def test_get_attributes_should_work_fine_with_no_namespaces(self):
		self.assertTrue('version="2.0"' in Feed('', '', '', extensions = [MockExtension2()]).rss())

class ItemTestCase(BaseTestCase):

	def test_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Item()
		self.assertTrue('title' in str(cm.exception))
		self.assertTrue('description' in str(cm.exception))

	def test_optional_elements(self):
		self.assertTrue(self._element('title', '123') in Feed('', '', '', items = [Item(title='123')]).rss())
		self.assertTrue(self._element('link', '123') in Feed('', '', '', items = [Item(title = '', link='123')]).rss())
		self.assertTrue(self._element('description', '123') in Feed('', '', '', items = [Item(description='123')]).rss())
		self.assertTrue(self._element('author', '123') in Feed('', '', '', items = [Item(title = '', author='123')]).rss())
		self.assertTrue(self._element('comments', '123') in Feed('', '', '', items = [Item(title = '', comments='123')]).rss())
		self.assertTrue(self._element('pubDate', 'Thu, 13 Nov 2014 08:00:00 GMT') in Feed('', '', '', items = [Item(title = '', pubDate = datetime.datetime(2014, 11, 13, 8, 0, 0))]).rss())

	def test_categories_as_single_category_element(self):
		rss = Feed('', '', '', items = [Item(title='abc', categories = Category('123', domain = '234'))]).rss()
		self.assertTrue('<category' in rss)
		self.assertTrue('domain="234"' in rss)
		self.assertTrue('>123</category>' in rss)

	def test_categories_as_single_string_element(self):
		rss = Feed('', '', '', items = [Item(title='abc', categories = '123')]).rss()
		self.assertTrue(self._element('category', '123') in rss)

	def test_categories_as_category_array_element(self):
		rss = Feed('', '', '', items = [Item(title='abc', categories = [Category('123'), Category('234'), Category('345')])]).rss()
		self.assertTrue(self._element('category', '123') in rss)
		self.assertTrue(self._element('category', '234') in rss)
		self.assertTrue(self._element('category', '345') in rss)

	def test_categories_as_string_array_element(self):
		rss = Feed('', '', '', items = [Item(title='abc', categories = ['123', '234', '345'])]).rss()
		self.assertTrue(self._element('category', '123') in rss)
		self.assertTrue(self._element('category', '234') in rss)
		self.assertTrue(self._element('category', '345') in rss)

	def test_enclosure_element(self):
		rss = Feed('', '', '', items = [Item(title = '', enclosure = Enclosure(url = '123', length = 234, type = '345'))]).rss()
		self.assertTrue('<enclosure ' in rss)
		self.assertTrue('url="123"' in rss)
		self.assertTrue('length="234"' in rss)
		self.assertTrue('type="345"' in rss)
		self.assertTrue('</enclosure>' in rss)

	def test_guid_element(self):
		rss = Feed('', '', '', items = [Item(title = '', guid = Guid(guid = '123', isPermaLink = False))]).rss()
		self.assertTrue('<guid ' in rss)
		self.assertTrue('isPermaLink="false"' in rss)
		self.assertTrue('123</guid>' in rss)

	def test_source_element(self):
		rss = Feed('', '', '', items = [Item(title = '', source = Source(name = '123', url = '234'))]).rss()
		self.assertTrue('<source ' in rss)
		self.assertTrue('url="234"' in rss)
		self.assertTrue('123</source>' in rss)

	def test_guid_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Guid(guid = None)
		self.assertTrue('guid' in str(cm.exception))

	def test_source_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			Source(name = None, url = '123')
		self.assertTrue('name' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			Source(name = '123', url = None)
		self.assertTrue('url' in str(cm.exception))

	def test_guid_ispermalink_should_be_true_by_default(self):
		guid = Guid(guid = '123')
		self.assertTrue(guid.isPermaLink)

	def test_guid_ispermalink_should_be_true_if_none_is_provided(self):
		guid = Guid(guid = '123', isPermaLink = None)
		self.assertTrue(guid.isPermaLink)

class iTunesTestCase(BaseTestCase):

	def test_namespace_is_added_to_the_feed(self):
		self.assertTrue('xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"' in Feed('', '', '', extensions = [iTunes()]).rss())

	def test_optional_elements(self):
		self.assertTrue(self._element('itunes:author', 'svpino') in Feed('', '', '', extensions = [iTunes(author = 'svpino')]).rss())
		self.assertTrue(self._element('itunes:subtitle', '123') in Feed('', '', '', extensions = [iTunes(subtitle = '123')]).rss())
		self.assertTrue(self._element('itunes:summary', '123') in Feed('', '', '', extensions = [iTunes(summary = '123')]).rss())
		self.assertTrue(self._element('itunes:new-feed-url', '123') in Feed('', '', '', extensions = [iTunes(new_feed_url = '123')]).rss())

	def test_block_can_be_specified_as_boolean(self):
		self.assertTrue(self._element('itunes:block', 'yes') in Feed('', '', '', extensions = [iTunes(block = True)]).rss())
		self.assertTrue(self._element('itunes:block', 'no') in Feed('', '', '', extensions = [iTunes(block = False)]).rss())

	def test_block_can_be_specified_as_string(self):
		self.assertTrue(self._element('itunes:block', 'yes') in Feed('', '', '', extensions = [iTunes(block = 'yes')]).rss())
		self.assertTrue(self._element('itunes:block', 'yes') in Feed('', '', '', extensions = [iTunes(block = 'YES')]).rss())
		self.assertTrue(self._element('itunes:block', 'no') in Feed('', '', '', extensions = [iTunes(block = 'xyz')]).rss())

	def test_block_should_not_be_included_if_not_specified(self):
		self.assertFalse(self._element('itunes:block', 'yes') in Feed('', '', '', extensions = [iTunes()]).rss())
		self.assertFalse(self._element('itunes:block', 'no') in Feed('', '', '', extensions = [iTunes()]).rss())

	def test_image_element(self):
		self.assertTrue('<itunes:image href="123"></itunes:image>' in Feed('', '', '', extensions = [iTunes(image = '123')]).rss())

	def test_complete_can_be_specified_as_boolean(self):
		self.assertTrue(self._element('itunes:complete', 'yes') in Feed('', '', '', extensions = [iTunes(complete = True)]).rss())
		self.assertTrue(self._element('itunes:complete', 'no') in Feed('', '', '', extensions = [iTunes(complete = False)]).rss())

	def test_complete_can_be_specified_as_string(self):
		self.assertTrue(self._element('itunes:complete', 'yes') in Feed('', '', '', extensions = [iTunes(complete = 'yes')]).rss())
		self.assertTrue(self._element('itunes:complete', 'yes') in Feed('', '', '', extensions = [iTunes(complete = 'YES')]).rss())
		self.assertTrue(self._element('itunes:complete', 'no') in Feed('', '', '', extensions = [iTunes(complete = 'xyz')]).rss())

	def test_complete_should_not_be_included_if_not_specified(self):
		self.assertFalse(self._element('itunes:complete', 'yes') in Feed('', '', '', extensions = [iTunes()]).rss())
		self.assertFalse(self._element('itunes:complete', 'no') in Feed('', '', '', extensions = [iTunes()]).rss())

	def test_explicit_can_be_specified_as_boolean(self):
		self.assertTrue(self._element('itunes:explicit', 'yes') in Feed('', '', '', extensions = [iTunes(explicit = True)]).rss())
		self.assertTrue(self._element('itunes:explicit', 'clean') in Feed('', '', '', extensions = [iTunes(explicit = False)]).rss())

	def test_explicit_can_be_specified_as_string(self):
		self.assertTrue(self._element('itunes:explicit', 'yes') in Feed('', '', '', extensions = [iTunes(explicit = 'yes')]).rss())
		self.assertTrue(self._element('itunes:explicit', 'yes') in Feed('', '', '', extensions = [iTunes(explicit = 'YES')]).rss())
		self.assertTrue(self._element('itunes:explicit', 'clean') in Feed('', '', '', extensions = [iTunes(explicit = 'xyz')]).rss())

	def test_explicit_should_not_be_included_if_not_specified(self):
		self.assertFalse(self._element('itunes:explicit', 'yes') in Feed('', '', '', extensions = [iTunes()]).rss())
		self.assertFalse(self._element('itunes:explicit', 'clean') in Feed('', '', '', extensions = [iTunes()]).rss())

	def test_owner_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			iTunesOwner(name = None, email = '')
		self.assertTrue('name' in str(cm.exception))

		with self.assertRaises(ElementRequiredError) as cm:
			iTunesOwner(name = '', email = None)
		self.assertTrue('email' in str(cm.exception))

	def test_owner_element(self):
		rss = Feed('', '', '', extensions = [iTunes(owner = iTunesOwner('123', '234'))]).rss()
		self.assertTrue('<itunes:owner>' in rss)
		self.assertTrue(self._element('itunes:name', '123') in rss)
		self.assertTrue(self._element('itunes:email', '234') in rss)
		self.assertTrue('</itunes:owner>' in rss)

	def test_category_required_elements_validation(self):
		with self.assertRaises(ElementRequiredError) as cm:
			iTunesCategory(name = None)
		self.assertTrue('name' in str(cm.exception))

	def test_categories_as_single_category_element(self):
		rss = Feed('', '', '', extensions = [iTunes(categories = iTunesCategory('123'))]).rss()
		self.assertTrue('<itunes:category text="123"></itunes:category>' in rss)

	def test_categories_as_single_string_element(self):
		rss = Feed('', '', '', extensions = [iTunes(categories = '123')]).rss()
		self.assertTrue('<itunes:category text="123"></itunes:category>' in rss)

	def test_categories_as_category_array_element(self):
		rss = Feed('', '', '', extensions = [iTunes(categories = [iTunesCategory('123'), iTunesCategory('234'), iTunesCategory('345')])]).rss()
		self.assertTrue('<itunes:category text="123"></itunes:category>' in rss)
		self.assertTrue('<itunes:category text="234"></itunes:category>' in rss)
		self.assertTrue('<itunes:category text="345"></itunes:category>' in rss)

	def test_categories_as_string_array_element(self):
		rss = Feed('', '', '', extensions = [iTunes(categories = ['123', '234', '345'])]).rss()
		self.assertTrue('<itunes:category text="123"></itunes:category>' in rss)
		self.assertTrue('<itunes:category text="234"></itunes:category>' in rss)
		self.assertTrue('<itunes:category text="345"></itunes:category>' in rss)

	def test_categories_single_category_with_subcategory(self):
		rss = Feed('', '', '', extensions = [iTunes(categories = iTunesCategory('123', '234'))]).rss()
		self.assertTrue('<itunes:category text="123"><itunes:category text="234"></itunes:category></itunes:category>' in rss)

	def test_categories_multiple_categories_with_subcategories(self):
		rss = Feed('', '', '', extensions = [iTunes(categories = [iTunesCategory('123', '234'), iTunesCategory('345', '456')])]).rss()
		self.assertTrue('<itunes:category text="123"><itunes:category text="234"></itunes:category></itunes:category><itunes:category text="345"><itunes:category text="456"></itunes:category></itunes:category>' in rss)

class iTunesItemTestCase(BaseTestCase):

	def test_optional_elements(self):
		self.assertTrue(self._element('itunes:author', 'svpino') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(author = 'svpino')])]).rss())
		self.assertTrue(self._element('itunes:duration', '10:11:12') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(duration = '10:11:12')])]).rss())
		self.assertTrue(self._element('itunes:order', '1') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(order = 1)])]).rss())
		self.assertTrue(self._element('itunes:subtitle', '123') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(subtitle = '123')])]).rss())
		self.assertTrue(self._element('itunes:summary', '123') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(summary = '123')])]).rss())

	def test_block_can_be_specified_as_boolean(self):
		self.assertTrue(self._element('itunes:block', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(block = True)])]).rss())
		self.assertTrue(self._element('itunes:block', 'no') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(block = False)])]).rss())

	def test_block_can_be_specified_as_string(self):
		self.assertTrue(self._element('itunes:block', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(block = 'yes')])]).rss())
		self.assertTrue(self._element('itunes:block', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(block = 'YES')])]).rss())
		self.assertTrue(self._element('itunes:block', 'no') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(block = 'xyz')])]).rss())

	def test_block_should_not_be_included_if_not_specified(self):
		self.assertFalse(self._element('itunes:block', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem()])]).rss())
		self.assertFalse(self._element('itunes:block', 'no') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem()])]).rss())

	def test_image_element(self):
		self.assertTrue('<itunes:image href="123"></itunes:image>' in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(image = '123')])]).rss())

	def test_explicit_can_be_specified_as_boolean(self):
		self.assertTrue(self._element('itunes:explicit', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(explicit = True)])]).rss())
		self.assertTrue(self._element('itunes:explicit', 'clean') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(explicit = False)])]).rss())

	def test_explicit_can_be_specified_as_string(self):
		self.assertTrue(self._element('itunes:explicit', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(explicit = 'yes')])]).rss())
		self.assertTrue(self._element('itunes:explicit', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(explicit = 'YES')])]).rss())
		self.assertTrue(self._element('itunes:explicit', 'clean') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(explicit = 'clean')])]).rss())
		self.assertTrue(self._element('itunes:explicit', 'clean') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(explicit = 'xyz')])]).rss())

	def test_explicit_should_not_be_included_if_not_specified(self):
		self.assertFalse(self._element('itunes:explicit', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem()])]).rss())
		self.assertFalse(self._element('itunes:explicit', 'clean') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem()])]).rss())

	def test_is_closed_captioned_can_be_specified_as_boolean(self):
		self.assertTrue(self._element('itunes:is_closed_captioned', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(is_closed_captioned = True)])]).rss())
		self.assertTrue(self._element('itunes:is_closed_captioned', 'no') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(is_closed_captioned = False)])]).rss())

	def test_is_closed_captioned_can_be_specified_as_string(self):
		self.assertTrue(self._element('itunes:is_closed_captioned', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(is_closed_captioned = 'yes')])]).rss())
		self.assertTrue(self._element('itunes:is_closed_captioned', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(is_closed_captioned = 'YES')])]).rss())
		self.assertTrue(self._element('itunes:is_closed_captioned', 'no') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem(is_closed_captioned = 'xyz')])]).rss())

	def test_is_closed_captioned_should_not_be_included_if_not_specified(self):
		self.assertFalse(self._element('itunes:is_closed_captioned', 'yes') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem()])]).rss())
		self.assertFalse(self._element('itunes:is_closed_captioned', 'no') in Feed('', '', '', items = [Item(title = '', extensions = [iTunesItem()])]).rss())

class MockExtension1(Extension):
	def __init__(self):
		Extension.__init__(self)

	def get_namespace(self):
		return {"name": "value"}

	def publish(self, handler):
		Extension.publish(self, handler)

class MockExtension2(Serializable):
	def __init__(self):
		Serializable.__init__(self)

	def publish(self, handler):
		Serializable.publish(self, handler)

class Fake:
	pass

if __name__ == '__main__':
    unittest.main()


text:
esp_err_t esp_ble_gap_register_callback(esp_gap_ble_cb_t callback)
{
    if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) {
        return ESP_ERR_INVALID_STATE;
    }
    return (btc_profile_cb_set(BTC_PID_GAP_BLE, callback) == 0 ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_config_adv_data(esp_ble_adv_data_t *adv_data)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    if (adv_data == NULL) {
        return ESP_ERR_INVALID_ARG;
    }

    if (adv_data->service_uuid_len & 0xf) { //not 16*n
        return ESP_ERR_INVALID_ARG;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_CFG_ADV_DATA;
    memcpy(&arg.cfg_adv_data.adv_data, adv_data, sizeof(esp_ble_adv_data_t));

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);

}

esp_err_t esp_ble_gap_set_scan_params(esp_ble_scan_params_t *scan_params)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    if (scan_params == NULL) {
        return ESP_ERR_INVALID_ARG;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_SET_SCAN_PARAM;
    memcpy(&arg.set_scan_param.scan_params, scan_params, sizeof(esp_ble_scan_params_t));

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_start_scanning(uint32_t duration)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_START_SCAN;
    arg.start_scan.duration = duration;

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_stop_scanning(void)
{
    btc_msg_t msg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_STOP_SCAN;
    return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_START_ADV;
    memcpy(&arg.start_adv.adv_params, adv_params, sizeof(esp_ble_adv_params_t));

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_stop_advertising(void)
{
    btc_msg_t msg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_STOP_ADV;

    return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_update_conn_params(esp_ble_conn_update_params_t *params)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM;
    memcpy(&arg.conn_update_params.conn_params, params, sizeof(esp_ble_conn_update_params_t));

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_data_length)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN;
    arg.set_pkt_data_len.tx_data_length = tx_data_length;
    memcpy(arg.set_pkt_data_len.remote_device, remote_device, ESP_BD_ADDR_LEN);

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_SET_RAND_ADDRESS;
    memcpy(arg.set_rand_addr.rand_addr, rand_addr, ESP_BD_ADDR_LEN);

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY;
    arg.cfg_local_privacy.privacy_enable = privacy_enable;

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_set_device_name(const char *name)
{
    return esp_bt_dev_set_device_name(name);
}

uint8_t *esp_ble_resolve_adv_data( uint8_t *adv_data, uint8_t type, uint8_t *length)
{
    if (((type < ESP_BLE_AD_TYPE_FLAG) || (type > ESP_BLE_AD_TYPE_128SERVICE_DATA)) &&
            (type != ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE)) {
        LOG_ERROR("the eir type not define, type = %x\n", type);
        return NULL;
    }

    if (adv_data == NULL) {
        LOG_ERROR("Invalid p_eir data.\n");
        return NULL;
    }

    return (BTM_CheckAdvData( adv_data, type, length));
}

esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    if (raw_data == NULL
            || (raw_data_len <= 0 || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX)) {
        return ESP_ERR_INVALID_ARG;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW;
    arg.cfg_adv_data_raw.raw_adv = raw_data;
    arg.cfg_adv_data_raw.raw_adv_len = raw_data_len;

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);

}

esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
        return ESP_ERR_INVALID_STATE;
    }

    if (raw_data == NULL
            || (raw_data_len <= 0 || raw_data_len > ESP_BLE_SCAN_RSP_DATA_LEN_MAX)) {
        return ESP_ERR_INVALID_ARG;
    }

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_ACT_CFG_SCAN_RSP_DATA_RAW;
    arg.cfg_scan_rsp_data_raw.raw_scan_rsp = raw_data;
    arg.cfg_scan_rsp_data_raw.raw_scan_rsp_len = raw_data_len;

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);

}

esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
        void *value, uint8_t len)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_SET_SECURITY_PARAM_EVT;
    arg.set_security_param.param_type = param_type;
    arg.set_security_param.len = len;
    arg.set_security_param.value = value;

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy)
            == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_act)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_SET_ENCRYPTION_EVT;
    arg.set_encryption.sec_act = sec_act;
    memcpy(arg.set_encryption.bd_addr, bd_addr, ESP_BD_ADDR_LEN);

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
            == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;
    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_SECURITY_RSP_EVT;
    arg.sec_rsp.accept = accept;
    memcpy(arg.sec_rsp.bd_addr, bd_addr, ESP_BD_ADDR_LEN);

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
            == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);

}

esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t passkey)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_PASSKEY_REPLY_EVT;
    arg.enc_passkey_replay.accept = accept;
    arg.enc_passkey_replay.passkey = passkey;
    memcpy(arg.enc_passkey_replay.bd_addr, bd_addr, ESP_BD_ADDR_LEN);

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
            == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept)
{
    btc_msg_t msg;
    btc_ble_gap_args_t arg;

    msg.sig = BTC_SIG_API_CALL;
    msg.pid = BTC_PID_GAP_BLE;
    msg.act = BTC_GAP_BLE_CONFIRM_REPLY_EVT;
    arg.enc_comfirm_replay.accept = accept;
    memcpy(arg.enc_comfirm_replay.bd_addr, bd_addr, ESP_BD_ADDR_LEN);

    return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
            == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}


text:
package io.jenkins.blueocean.service.embedded.rest;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.model.Job;
import io.jenkins.blueocean.rest.hal.Link;
import io.jenkins.blueocean.rest.model.BlueQueueContainer;
import io.jenkins.blueocean.rest.model.BlueQueueItem;

import java.util.Iterator;

/**
 * @author Ivan Meredith
 */
public class QueueContainerImpl extends BlueQueueContainer {
    private AbstractPipelineImpl pipeline;
    private Job job;

    public QueueContainerImpl(AbstractPipelineImpl pipeline) {
        this.pipeline = pipeline;
        this.job = pipeline.getJob();
    }

    @Override
    public BlueQueueItem get(String name) {
        for (BlueQueueItem blueQueueItem : QueueUtil.getQueuedItems(pipeline.organization, job)) {
            if(name.equals(blueQueueItem.getId())){
                return blueQueueItem;
            }
        }
        return null;
    }

    @Override
    @NonNull
    public Iterator<BlueQueueItem> iterator() {
        return QueueUtil.getQueuedItems(pipeline.organization, job).iterator();
    }

    @Override
    public Link getLink() {
        return pipeline.getLink().rel("queue");
    }
}


text:
<?php

namespace Portal\UserBundle\Form\Type;

use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;

class RegistrationFormType extends BaseType
{
    /**
     * @var
     */
    protected $translator;

    /**
     * @param string $userClass
     * @param $translator
     */
    public function __construct($userClass, $translator) {
        parent::__construct($userClass);
        $this->translator = $translator;
    }

    /**
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', null, array('label' => $this->translator->trans('form.realname')));
        $builder->add('email', null, array('label' => $this->translator->trans('form.email')));
        parent::buildForm($builder, $options);
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'portal_user_registration';
    }
}