text:
// -----------------------------------------------------------------------
// <copyright file="ActivityPhonecallsController.cs" company="Nodine Legal, LLC">
// Licensed to Nodine Legal, LLC under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  Nodine Legal, LLC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
// </copyright>
// -----------------------------------------------------------------------

namespace OpenLawOffice.Web.Controllers
{
    using System;
    using System.Collections.Generic;
    using System.Web.Mvc;
    using AutoMapper;
    using System.Data;

    [HandleError(View = "Errors/Index", Order = 10)]
    public class ActivityPhonecallsController : BaseController
    {
        [Authorize(Roles = "Login, User")]
        public ActionResult Details(long id)
        {
            ViewModels.Activities.ActivityPhonecallViewModel viewModel = new ViewModels.Activities.ActivityPhonecallViewModel();

            using (IDbConnection conn = Data.Database.Instance.GetConnection())
            {
                Common.Models.Activities.ActivityPhonecall model = Data.Activities.ActivityPhonecall.Get(id, conn, false);
                model.Direction = Data.Activities.ActivityDirection.Get(model.Direction.Id.Value, conn, false);
                model.Owner = Data.Contacts.Contact.Get(model.Owner.Id.Value, conn, false);
                model.Sender = Data.Contacts.Contact.Get(model.Sender.Id.Value, conn, false);
                model.Recipient = Data.Contacts.Contact.Get(model.Recipient.Id.Value, conn, false);
                model.Priority = Data.Activities.ActivityPriority.Get(model.Priority.Id.Value, conn, false);
                model.StatusReason = Data.Activities.ActivityStatusReason.Get(model.StatusReason.Id.Value, conn, false);
                model.Type = Data.Activities.ActivityType.Get(model.Type.Id.Value, conn, false);

                viewModel = Mapper.Map<ViewModels.Activities.ActivityPhonecallViewModel>(model);
                viewModel.Direction = Mapper.Map<ViewModels.Activities.ActivityDirectionViewModel>(model.Direction);
                viewModel.Owner = Mapper.Map<ViewModels.Contacts.ContactViewModel>(model.Owner);
                viewModel.Sender = Mapper.Map<ViewModels.Contacts.ContactViewModel>(model.Sender);
                viewModel.Recipient = Mapper.Map<ViewModels.Contacts.ContactViewModel>(model.Recipient);
                viewModel.Priority = Mapper.Map<ViewModels.Activities.ActivityPriorityViewModel>(model.Priority);
                viewModel.StatusReason = Mapper.Map<ViewModels.Activities.ActivityStatusReasonViewModel>(model.StatusReason);
                viewModel.Type = Mapper.Map<ViewModels.Activities.ActivityTypeViewModel>(model.Type);

                Common.Models.Activities.ActivityRegardingType regtype = Data.Activities.ActivityRegardingType.GetFromActivityId(model.Id.Value, conn, false);

                if (regtype.Title == "Lead")
                {
                    Common.Models.Activities.ActivityRegardingLead ar = Data.Activities.ActivityRegardingLead.GetFromActivityId(model.Id.Value, conn, false);
                    ar.Lead = Data.Leads.Lead.Get(ar.Lead.Id.Value, conn, false);
                    ar.Lead.Contact = Data.Contacts.Contact.Get(ar.Lead.Contact.Id.Value, conn, false);
                    viewModel.RegardingLead = Mapper.Map<ViewModels.Activities.ActivityRegardingLeadViewModel>(ar);
                    viewModel.RegardingLead.Lead = Mapper.Map<ViewModels.Leads.LeadViewModel>(ar.Lead);
                    viewModel.RegardingLead.Lead.Contact = Mapper.Map<ViewModels.Contacts.ContactViewModel>(ar.Lead.Contact);
                    viewModel.RegardingLead.Type = Mapper.Map<ViewModels.Activities.ActivityRegardingTypeViewModel>(regtype);
                }
                else
                {
                    Common.Models.Activities.ActivityRegardingOpportunity ao = Data.Activities.ActivityRegardingOpportunity.GetFromActivityId(model.Id.Value, conn, false);
                    ao.Opportunity = Data.Opportunities.Opportunity.Get(ao.Opportunity.Id.Value, conn, false);
                    ao.Opportunity.Account = Data.Contacts.Contact.Get(ao.Opportunity.Account.Id.Value, conn, false);
                    viewModel.RegardingOpportunity = Mapper.Map<ViewModels.Activities.ActivityRegardingOpportunityViewModel>(ao);
                    viewModel.RegardingOpportunity.Opportunity = Mapper.Map<ViewModels.Opportunities.OpportunityViewModel>(ao.Opportunity);
                    viewModel.RegardingOpportunity.Opportunity.Account = Mapper.Map<ViewModels.Contacts.ContactViewModel>(ao.Opportunity.Account);
                    viewModel.RegardingOpportunity.Type = Mapper.Map<ViewModels.Activities.ActivityRegardingTypeViewModel>(regtype);
                }

                PopulateCoreDetails(viewModel, conn);
            }

            return View(viewModel);
        }

        [Authorize(Roles = "Login, User")]
        public ActionResult Create(long? regleadid, long? regopportunityid)
        {
            Common.Models.Account.Users currentUser;
            ViewModels.Activities.ActivityPhonecallViewModel viewModel = new ViewModels.Activities.ActivityPhonecallViewModel();
            List<ViewModels.Activities.ActivityDirectionViewModel> directionList = new List<ViewModels.Activities.ActivityDirectionViewModel>();
            List<ViewModels.Activities.ActivityStatusReasonViewModel> statusReasonList = new List<ViewModels.Activities.ActivityStatusReasonViewModel>();
            List<ViewModels.Activities.ActivityPriorityViewModel> priorityList = new List<ViewModels.Activities.ActivityPriorityViewModel>();

            using (IDbConnection conn = Data.Database.Instance.GetConnection())
            {
                currentUser = Data.Account.Users.Get(User.Identity.Name, conn, false);

                Data.Activities.ActivityDirection.List(conn, false).ForEach(x =>
                {
                    ViewModels.Activities.ActivityDirectionViewModel vm = Mapper.Map<ViewModels.Activities.ActivityDirectionViewModel>(x);
                    directionList.Add(vm);
                    if (vm.Order == 1)
                        viewModel.Direction = vm;
                });

                Data.Activities.ActivityStatusReason.List(conn, false).ForEach(x =>
                {
                    ViewModels.Activities.ActivityStatusReasonViewModel vm = Mapper.Map<ViewModels.Activities.ActivityStatusReasonViewModel>(x);
                    statusReasonList.Add(vm);
                    if (vm.Order == 1)
                        viewModel.StatusReason = vm;
                });

                Data.Activities.ActivityPriority.List(conn, false).ForEach(x =>
                {
                    ViewModels.Activities.ActivityPriorityViewModel vm = Mapper.Map<ViewModels.Activities.ActivityPriorityViewModel>(x);
                    priorityList.Add(vm);
                    if (vm.Default.HasValue && vm.Default.Value)
                        viewModel.Priority = vm;
                });

                if (regleadid != null && regleadid.HasValue)
                {
                    viewModel.RegardingLead = new ViewModels.Activities.ActivityRegardingLeadViewModel()
                    {
                        Type = new ViewModels.Activities.ActivityRegardingTypeViewModel()
                        {
                            Id = 1
                        }
                    };

                    viewModel.RegardingLead.Lead = Mapper.Map<ViewModels.Leads.LeadViewModel>(Data.Leads.Lead.Get(regleadid.Value, conn, false));
                    viewModel.RegardingLead.Lead.Contact = Mapper.Map<ViewModels.Contacts.ContactViewModel>(Data.Contacts.Contact.Get(viewModel.RegardingLead.Lead.Contact.Id.Value, conn, false));
                }
                else if (regopportunityid != null && regopportunityid.HasValue)
                {
                    viewModel.RegardingOpportunity = new ViewModels.Activities.ActivityRegardingOpportunityViewModel()
                    {
                        Type = new ViewModels.Activities.ActivityRegardingTypeViewModel()
                        {
                            Id = 2
                        }
                    };

                    viewModel.RegardingOpportunity.Opportunity = Mapper.Map<ViewModels.Opportunities.OpportunityViewModel>(Data.Opportunities.Opportunity.Get(regopportunityid.Value, conn, false));
                    viewModel.RegardingOpportunity.Opportunity.Account = Mapper.Map<ViewModels.Contacts.ContactViewModel>(Data.Contacts.Contact.Get(viewModel.RegardingOpportunity.Opportunity.Account.Id.Value, conn, false));
                }
                else
                    throw new ArgumentException("Must have regleadid or regopportunityid.");

                dynamic profile = System.Web.Profile.ProfileBase.Create(currentUser.Username);
                viewModel.Owner = Mapper.Map<ViewModels.Contacts.ContactViewModel>(Data.Contacts.Contact.Get(int.Parse(profile.ContactId), conn, false));
                viewModel.Type = Mapper.Map<ViewModels.Activities.ActivityTypeViewModel>(Data.Activities.ActivityType.Get("Phone Call", conn, false));
            }

            ViewBag.DirectionList = directionList;
            ViewBag.StatusReasonList = statusReasonList;
            ViewBag.PriorityList = priorityList;

            viewModel.Body = string.Empty;
            viewModel.Due = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0, DateTimeKind.Local);
            viewModel.Duration = 30;
            viewModel.IsCampaignResponse = false;
            viewModel.State = true;
            viewModel.Subject = string.Empty;

            return View(viewModel);
        }

        [HttpPost]
        [Authorize(Roles = "Login, User")]
        public ActionResult Create(ViewModels.Activities.ActivityPhonecallViewModel viewModel)
        {
            Common.Models.Account.Users currentUser;
            Common.Models.Activities.ActivityPhonecall model;

            using (Data.Transaction trans = Data.Transaction.Create(true))
            {
                try
                {
                    currentUser = Data.Account.Users.Get(trans, User.Identity.Name);

                    model = Mapper.Map<Common.Models.Activities.ActivityPhonecall>(viewModel);
                    model.Type = Data.Activities.ActivityType.Get(trans, "Phone Call");

                    if (!model.IsCampaignResponse.HasValue)
                        model.IsCampaignResponse = false;

                    model = Data.Activities.ActivityPhonecall.Create(trans, model, currentUser);

                    if (viewModel.RegardingLead != null && viewModel.RegardingLead.Lead != null && viewModel.RegardingLead.Lead.Id.HasValue)
                    {
                        Common.Models.Activities.ActivityRegardingLead arl = new Common.Models.Activities.ActivityRegardingLead()
                        {
                            Lead = new Common.Models.Leads.Lead()
                            {
                                Id = viewModel.RegardingLead.Lead.Id
                            },
                            Activity = model,
                            Type = new Common.Models.Activities.ActivityRegardingType()
                            {
                                Id = 1
                            }
                        };
                        Data.Activities.ActivityRegardingLead.Create(trans, arl, currentUser);

                        trans.Commit();

                        return RedirectToAction("Details", "Leads", new { Id = viewModel.RegardingLead.Lead.Id });
                    }
                    else if (viewModel.RegardingOpportunity != null && viewModel.RegardingOpportunity.Opportunity != null && viewModel.RegardingOpportunity.Opportunity.Id.HasValue)
                    {
                        Common.Models.Activities.ActivityRegardingOpportunity aro = new Common.Models.Activities.ActivityRegardingOpportunity()
                        {
                            Opportunity = new Common.Models.Opportunities.Opportunity()
                            {
                                Id = viewModel.RegardingOpportunity.Opportunity.Id
                            },
                            Activity = model,
                            Type = new Common.Models.Activities.ActivityRegardingType()
                            {
                                Id = 2
                            }
                        };
                        Data.Activities.ActivityRegardingOpportunity.Create(trans, aro, currentUser);

                        trans.Commit();

                        return RedirectToAction("Details", "Opportunities", new { Id = viewModel.RegardingOpportunity.Opportunity.Id });
                    }
                    else
                        throw new ArgumentException("Unkown regarding entity.");
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return RedirectToAction("Create");
                }
            }
        }

        [Authorize(Roles = "Login, User")]
        public ActionResult Edit(long id)
        {
            Common.Models.Account.Users currentUser;
            ViewModels.Activities.ActivityPhonecallViewModel viewModel = new ViewModels.Activities.ActivityPhonecallViewModel();
            List<ViewModels.Activities.ActivityDirectionViewModel> directionList = new List<ViewModels.Activities.ActivityDirectionViewModel>();
            List<ViewModels.Activities.ActivityStatusReasonViewModel> statusReasonList = new List<ViewModels.Activities.ActivityStatusReasonViewModel>();
            List<ViewModels.Activities.ActivityPriorityViewModel> priorityList = new List<ViewModels.Activities.ActivityPriorityViewModel>();

            using (IDbConnection conn = Data.Database.Instance.GetConnection())
            {
                currentUser = Data.Account.Users.Get(User.Identity.Name, conn, false);

                Common.Models.Activities.ActivityPhonecall model = Data.Activities.ActivityPhonecall.Get(id, conn, false);
                model.Direction = Data.Activities.ActivityDirection.Get(model.Direction.Id.Value, conn, false);
                model.Owner = Data.Contacts.Contact.Get(model.Owner.Id.Value, conn, false);
                model.Sender = Data.Contacts.Contact.Get(model.Sender.Id.Value, conn, false);
                model.Recipient = Data.Contacts.Contact.Get(model.Recipient.Id.Value, conn, false);
                model.Priority = Data.Activities.ActivityPriority.Get(model.Priority.Id.Value, conn, false);
                model.StatusReason = Data.Activities.ActivityStatusReason.Get(model.StatusReason.Id.Value, conn, false);
                model.Type = Data.Activities.ActivityType.Get(model.Type.Id.Value, conn, false);

                viewModel = Mapper.Map<ViewModels.Activities.ActivityPhonecallViewModel>(model);
                viewModel.Owner = Mapper.Map<ViewModels.Contacts.ContactViewModel>(model.Owner);
                viewModel.Sender = Mapper.Map<ViewModels.Contacts.ContactViewModel>(model.Sender);
                viewModel.Recipient = Mapper.Map<ViewModels.Contacts.ContactViewModel>(model.Recipient);

                Common.Models.Activities.ActivityRegardingType regtype = Data.Activities.ActivityRegardingType.GetFromActivityId(model.Id.Value, conn, false);

                if (regtype.Title == "Lead")
                {
                    Common.Models.Activities.ActivityRegardingLead ar = Data.Activities.ActivityRegardingLead.GetFromActivityId(model.Id.Value, conn, false);
                    ar.Lead = Data.Leads.Lead.Get(ar.Lead.Id.Value, conn, false);
                    ar.Lead.Contact = Data.Contacts.Contact.Get(ar.Lead.Contact.Id.Value, conn, false);
                    viewModel.RegardingLead = Mapper.Map<ViewModels.Activities.ActivityRegardingLeadViewModel>(ar);
                    viewModel.RegardingLead.Lead = Mapper.Map<ViewModels.Leads.LeadViewModel>(ar.Lead);
                    viewModel.RegardingLead.Lead.Contact = Mapper.Map<ViewModels.Contacts.ContactViewModel>(ar.Lead.Contact);
                    viewModel.RegardingLead.Type = Mapper.Map<ViewModels.Activities.ActivityRegardingTypeViewModel>(regtype);
                }
                else
                {
                    Common.Models.Activities.ActivityRegardingOpportunity ao = Data.Activities.ActivityRegardingOpportunity.GetFromActivityId(model.Id.Value, conn, false);
                    ao.Opportunity = Data.Opportunities.Opportunity.Get(ao.Opportunity.Id.Value, conn, false);
                    ao.Opportunity.Account = Data.Contacts.Contact.Get(ao.Opportunity.Account.Id.Value, conn, false);
                    viewModel.RegardingOpportunity = Mapper.Map<ViewModels.Activities.ActivityRegardingOpportunityViewModel>(ao);
                    viewModel.RegardingOpportunity.Opportunity = Mapper.Map<ViewModels.Opportunities.OpportunityViewModel>(ao.Opportunity);
                    viewModel.RegardingOpportunity.Opportunity.Account = Mapper.Map<ViewModels.Contacts.ContactViewModel>(ao.Opportunity.Account);
                    viewModel.RegardingOpportunity.Type = Mapper.Map<ViewModels.Activities.ActivityRegardingTypeViewModel>(regtype);
                }

                Data.Activities.ActivityDirection.List(conn, false).ForEach(x =>
                {
                    ViewModels.Activities.ActivityDirectionViewModel vm = Mapper.Map<ViewModels.Activities.ActivityDirectionViewModel>(x);
                    directionList.Add(vm);
                });

                Data.Activities.ActivityStatusReason.List(conn, false).ForEach(x =>
                {
                    ViewModels.Activities.ActivityStatusReasonViewModel vm = Mapper.Map<ViewModels.Activities.ActivityStatusReasonViewModel>(x);
                    statusReasonList.Add(vm);
                });

                Data.Activities.ActivityPriority.List(conn, false).ForEach(x =>
                {
                    ViewModels.Activities.ActivityPriorityViewModel vm = Mapper.Map<ViewModels.Activities.ActivityPriorityViewModel>(x);
                    priorityList.Add(vm);
                });
            }

            ViewBag.DirectionList = directionList;
            ViewBag.StatusReasonList = statusReasonList;
            ViewBag.PriorityList = priorityList;

            return View(viewModel);
        }

        [HttpPost]
        [Authorize(Roles = "Login, User")]
        public ActionResult Edit(long id, ViewModels.Activities.ActivityPhonecallViewModel viewModel)
        {
            Common.Models.Account.Users currentUser;
            Common.Models.Activities.ActivityPhonecall model;

            using (Data.Transaction trans = Data.Transaction.Create(true))
            {
                try
                {
                    currentUser = Data.Account.Users.Get(trans, User.Identity.Name);

                    model = Mapper.Map<Common.Models.Activities.ActivityPhonecall>(viewModel);
                    model.Type = Data.Activities.ActivityType.Get(trans, "Phone Call");

                    if (!model.IsCampaignResponse.HasValue)
                        model.IsCampaignResponse = false;

                    model = Data.Activities.ActivityPhonecall.Edit(trans, model, currentUser);
                    trans.Commit();

                    if (viewModel.RegardingLead != null && viewModel.RegardingLead.Lead != null && viewModel.RegardingLead.Lead.Id.HasValue)
                    {
                        return RedirectToAction("Details", "Leads", new { Id = viewModel.RegardingLead.Lead.Id });
                    }
                    else if (viewModel.RegardingOpportunity != null && viewModel.RegardingOpportunity.Opportunity != null && viewModel.RegardingOpportunity.Opportunity.Id.HasValue)
                    {
                        return RedirectToAction("Details", "Opportunities", new { Id = viewModel.RegardingOpportunity.Opportunity.Id });
                    }
                    else
                        throw new ArgumentException("Unkown regarding entity.");
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    return RedirectToAction("Edit", new { id = id });
                }
            }
        }
    }
}


text:
The Terra List is a structural component to arrange content within list/listitems.

## Getting Started

- Install with [npmjs](https://www.npmjs.com):
  - `npm install terra-list`
  - `yarn add terra-list`

## Usage

```jsx
import React from 'react';
import List from 'terra-list';

<List.Item
  content={<h1 blurb />}
  isSelected={true}
  isSelectable={true}
  hasChevron={false}
/>

<List isDivided={true}>
  <List.Item content={<h1 blurb />} />
  <List.Item content={<h1 blurb />} />
</List>
```

Terra also provides two variations for the list component.
* [Selectable List](https://github.com/cerner/terra-core/tree/master/packages/terra-list/docs/Selectable.md)

* [Single Select List](https://github.com/cerner/terra-core/tree/master/packages/terra-list/docs/SingleSelect.md)

* [Multi Select List](https://github.com/cerner/terra-core/tree/master/packages/terra-list/docs/MultiSelect.md)

## Component Features
* [Cross-Browser Support](https://github.com/cerner/terra-core/wiki/Component-Features#cross-browser-support)
* [Responsive Support](https://github.com/cerner/terra-core/wiki/Component-Features#responsive-support)
* [Mobile Support](https://github.com/cerner/terra-core/wiki/Component-Features#mobile-support)

redpajama_set_name: RedPajamaGithub


text:
function NodeViewModel() {
	var self = this;

	// handle requests to create a new node.
	$(".modal-node button").click(function(e) {

		var node = {
			address : $("#addr").val(),
			key     : $("#key").val(),
			cert    : $("#cert").val(),
			ca      : $("#ca").val()
		};

		$.ajax({
			url: "/api/nodes",
			type: "POST",
			contentType: "application/json",
			data: JSON.stringify(node),
			success: function( data ) {
				// clears the form value
				$(".modal-node input").val("");

				var el = $("<div>").attr("class", "col-sm-4").append(
					$("<div>").attr("class", "card").attr("data-id", data.id).append(
						$("<div>").attr("class", "card-header").append(
							$("<i>").attr("class", "linux_amd64")
						)
					).append(
						$("<div>").attr("class", "card-block").append(
							$("<h3>").text(data.address)
						).append(
							$("<p>").attr("class", "card-text").text(data.architecture)
						).append(
							$("<div>").attr("class", "btn-group").append(
								$("<button>").attr("class","btn btn-danger").text("Delete")
							)
						)
					)
				)

				$( ".node-row" ).prepend(el);
			},
			error: function( data ) {
 				console.log(data);
			}
		});
	});

	$(".node-row").on('click', '.btn-group .btn-danger', function(){
		// gets the unique identifier for the click row, which is
		// the user login id.
		var id = $( this ).context
					.parentNode
					.parentNode
					.parentNode.dataset.id;

		var r = confirm("Are you sure you want to delete node "+id+"?");
		if (r === false) {
			return;
		}

		// makes an API call to delete the user and then, if successful,
		// removes from the list.
		$.ajax({
			url: "/api/nodes/"+id,
			type: "DELETE",
			success: function( data ) {
				$("[data-id='"+id+"']").parent().remove();
			}
		});
	});
}


text:
/*
 __COMMENT_HEADING__
 */

#import "__CLASS_PREFIX__ApplicationController.h"
#import "__CLASS_PREFIX__ApplicationFactory.h"

@implementation __CLASS_PREFIX__ApplicationController

@synthesize window = _window;

-(void) startController {

	@autoreleasepool {
        // registers a factory that creates custom ViewControllers and Custom Actions
        __CLASS_PREFIX__ApplicationFactory *customApplicationFactory = [[__CLASS_PREFIX__ApplicationFactory alloc] init];
        [MBApplicationFactory setSharedInstance:customApplicationFactory];

        [self performSelectorOnMainThread:@selector(startApplication:) withObject:customApplicationFactory waitUntilDone:YES];

    }

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self startController];

    return YES;
}

- (void)dealloc
{
    [_window release];
    [super dealloc];
}

@end


text:
TEST_F(DifferentiabilityTest, LeafNodesHaveDifferentiableTree) {
    EXPECT_TRUE(cons1->HasDifferentiableTree());
    EXPECT_TRUE(cons2->HasDifferentiableTree());
}

TEST_F(DifferentiabilityTest, ConstantChannelDifferentiable) {
    EXPECT_TRUE(cons1->Channels(0).IsDifferentiableFunctor());
    EXPECT_TRUE(cons2->Channels(0).IsDifferentiableFunctor());
}

TEST_F(DifferentiabilityTest, NonDifferentiableNodeNotDifferentiable) {
    EXPECT_TRUE(nonDiffCons1->HasDifferentiableTree());
    EXPECT_FALSE(nonDiffCons1->Channels(0).IsDifferentiableFunctor());
}

TEST_F(DifferentiabilityTest, TestDifferentiableTreeFunction) {
    EXPECT_TRUE(addDiff->HasDifferentiableTree());
    EXPECT_TRUE(addDiff->Channels(0).IsDifferentiableFunctor());
}

TEST_F(DifferentiabilityTest, TestNonDifferentiableTreeFunction) {
    EXPECT_FALSE(addNonDiffComposition->HasDifferentiableTree());
    EXPECT_TRUE(addNonDiffComposition->Channels(0).IsDifferentiableFunctor());
}


text:
package org.apache.druid.java.util.common.parsers;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class JSONPathParserTest
{
  private static final String JSON =
      "{\"one\": \"foo\", \"two\" : [\"bar\", \"baz\"], \"three\" : \"qux\", \"four\" : null}";
  private static final String NUMBERS_JSON =
      "{\"five\" : 5.0, \"six\" : 6, \"many\" : 1234567878900, \"toomany\" : 1234567890000000000000}";
  private static final String WHACKY_CHARACTER_JSON =
      "{\"one\": \"foo\\uD900\"}";
  private static final String NESTED_JSON =
      "{\"simpleVal\":\"text\", \"ignore_me\":[1, {\"x\":2}], \"blah\":[4,5,6], \"newmet\":5, " +
      "\"foo\":{\"bar1\":\"aaa\", \"bar2\":\"bbb\"}, " +
      "\"baz\":[1,2,3], \"timestamp\":\"2999\", \"foo.bar1\":\"Hello world!\", " +
      "\"testListConvert\":[1234567890000000000000, \"foo\\uD900\"], " +
      "\"testListConvert2\":[1234567890000000000000, \"foo\\uD900\", [1234567890000000000000]], " +
      "\"testMapConvert\":{\"big\": 1234567890000000000000, \"big2\":{\"big2\":1234567890000000000000}}, " +
      "\"testEmptyList\": [], " +
      "\"hey\":[{\"barx\":\"asdf\"}], \"met\":{\"a\":[7,8,9]}}";
  private static final String NOT_JSON = "***@#%R#*(TG@(*H(#@(#@((H#(@TH@(#TH(@SDHGKJDSKJFBSBJK";

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void testSimple()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(true, fields), null, false);
    final Map<String, Object> jsonMap = jsonParser.parseToMap(JSON);
    Assert.assertEquals(
        "jsonMap",
        ImmutableMap.of("one", "foo", "two", ImmutableList.of("bar", "baz"), "three", "qux"),
        jsonMap
    );
  }

  @Test
  public void testWithNumbers()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(true, fields), null, false);
    final Map<String, Object> jsonMap = jsonParser.parseToMap(NUMBERS_JSON);
    Assert.assertEquals(
        "jsonMap",
        ImmutableMap.of("five", 5.0, "six", 6L, "many", 1234567878900L, "toomany", 1.23456789E21),
        jsonMap
    );
  }

  @Test
  public void testWithWhackyCharacters()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(true, fields), null, false);
    final Map<String, Object> jsonMap = jsonParser.parseToMap(WHACKY_CHARACTER_JSON);
    Assert.assertEquals(
        "jsonMap",
        ImmutableMap.of("one", "foo?"),
        jsonMap
    );
  }

  @Test
  public void testNestingWithFieldDiscovery()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.ROOT, "baz", "baz"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "nested-foo.bar1", "$.foo.bar1"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "nested-foo.bar2", "$.foo.bar2"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "heybarx0", "$.hey[0].barx"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array", "$.met.a"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.ROOT, "testListConvert2", "testListConvert2"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.ROOT, "testMapConvert", "testMapConvert"));

    fields.add(new JSONPathFieldSpec(JSONPathFieldType.ROOT, "INVALID_ROOT", "INVALID_ROOT_EXPR"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "INVALID_PATH", "INVALID_PATH_EXPR"));

    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-nested-foo.bar1", ".foo.bar1"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-nested-foo.bar2", ".foo.bar2"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-heybarx0", ".hey[0].barx"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-met-array", ".met.a"));

    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(true, fields), null, false);
    final Map<String, Object> jsonMap = jsonParser.parseToMap(NESTED_JSON);

    // Root fields
    Assert.assertEquals(ImmutableList.of(1L, 2L, 3L), jsonMap.get("baz"));
    Assert.assertEquals(ImmutableList.of(4L, 5L, 6L), jsonMap.get("blah"));
    Assert.assertEquals("text", jsonMap.get("simpleVal"));
    Assert.assertEquals(5L, jsonMap.get("newmet"));
    Assert.assertEquals("2999", jsonMap.get("timestamp"));
    Assert.assertEquals("Hello world!", jsonMap.get("foo.bar1"));

    List<Object> testListConvert = (List) jsonMap.get("testListConvert");
    Assert.assertEquals(1.23456789E21, testListConvert.get(0));
    Assert.assertEquals("foo?", testListConvert.get(1));

    List<Object> testListConvert2 = (List) jsonMap.get("testListConvert2");
    Assert.assertEquals(1.23456789E21, testListConvert2.get(0));
    Assert.assertEquals("foo?", testListConvert2.get(1));
    Assert.assertEquals(1.23456789E21, ((List) testListConvert2.get(2)).get(0));

    Map<String, Object> testMapConvert = (Map) jsonMap.get("testMapConvert");
    Assert.assertEquals(1.23456789E21, testMapConvert.get("big"));
    Assert.assertEquals(1.23456789E21, ((Map) testMapConvert.get("big2")).get("big2"));

    Assert.assertEquals(ImmutableList.of(), jsonMap.get("testEmptyList"));

    // Nested fields
    Assert.assertEquals("aaa", jsonMap.get("nested-foo.bar1"));
    Assert.assertEquals("bbb", jsonMap.get("nested-foo.bar2"));
    Assert.assertEquals("asdf", jsonMap.get("heybarx0"));
    Assert.assertEquals(ImmutableList.of(7L, 8L, 9L), jsonMap.get("met-array"));

    Assert.assertEquals("aaa", jsonMap.get("jq-nested-foo.bar1"));
    Assert.assertEquals("bbb", jsonMap.get("jq-nested-foo.bar2"));
    Assert.assertEquals("asdf", jsonMap.get("jq-heybarx0"));
    Assert.assertEquals(ImmutableList.of(7L, 8L, 9L), jsonMap.get("jq-met-array"));

    // Fields that should not be discovered
    Assert.assertFalse(jsonMap.containsKey("hey"));
    Assert.assertFalse(jsonMap.containsKey("met"));
    Assert.assertFalse(jsonMap.containsKey("ignore_me"));
    Assert.assertFalse(jsonMap.containsKey("foo"));

    // Invalid fields
    Assert.assertNull(jsonMap.get("INVALID_ROOT"));
    Assert.assertNull(jsonMap.get("INVALID_PATH"));
  }

  @Test
  public void testNestingNoDiscovery()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.ROOT, "simpleVal", "simpleVal"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.ROOT, "timestamp", "timestamp"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "nested-foo.bar2", "$.foo.bar2"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "heybarx0", "$.hey[0].barx"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array", "$.met.a"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-nested-foo.bar2", ".foo.bar2"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-heybarx0", ".hey[0].barx"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "jq-met-array", ".met.a"));

    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(false, fields), null, false);
    final Map<String, Object> jsonMap = jsonParser.parseToMap(NESTED_JSON);

    // Root fields
    Assert.assertEquals("text", jsonMap.get("simpleVal"));
    Assert.assertEquals("2999", jsonMap.get("timestamp"));

    // Nested fields
    Assert.assertEquals("bbb", jsonMap.get("nested-foo.bar2"));
    Assert.assertEquals("asdf", jsonMap.get("heybarx0"));
    Assert.assertEquals(ImmutableList.of(7L, 8L, 9L), jsonMap.get("met-array"));
    Assert.assertEquals("bbb", jsonMap.get("jq-nested-foo.bar2"));
    Assert.assertEquals("asdf", jsonMap.get("jq-heybarx0"));
    Assert.assertEquals(ImmutableList.of(7L, 8L, 9L), jsonMap.get("jq-met-array"));

    // Fields that should not be discovered
    Assert.assertFalse(jsonMap.containsKey("newmet"));
    Assert.assertFalse(jsonMap.containsKey("foo.bar1"));
    Assert.assertFalse(jsonMap.containsKey("baz"));
    Assert.assertFalse(jsonMap.containsKey("blah"));
    Assert.assertFalse(jsonMap.containsKey("nested-foo.bar1"));
    Assert.assertFalse(jsonMap.containsKey("hey"));
    Assert.assertFalse(jsonMap.containsKey("met"));
    Assert.assertFalse(jsonMap.containsKey("ignore_me"));
    Assert.assertFalse(jsonMap.containsKey("foo"));
  }

  @Test
  public void testRejectDuplicates()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array", "$.met.a"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array", "$.met.a"));

    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("Cannot have duplicate field definition: met-array");

    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(false, fields), null, false);
    jsonParser.parseToMap(NESTED_JSON);
  }

  @Test
  public void testRejectDuplicates2()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array", "$.met.a"));
    fields.add(new JSONPathFieldSpec(JSONPathFieldType.JQ, "met-array", ".met.a"));

    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("Cannot have duplicate field definition: met-array");

    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(false, fields), null, false);
    jsonParser.parseToMap(NESTED_JSON);
  }

  @Test
  public void testParseFail()
  {
    List<JSONPathFieldSpec> fields = new ArrayList<>();

    thrown.expect(ParseException.class);
    thrown.expectMessage("Unable to parse row [" + NOT_JSON + "]");

    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(true, fields), null, false);
    jsonParser.parseToMap(NOT_JSON);
  }

  @Test
  public void testJSONPathFunctions()
  {
    List<JSONPathFieldSpec> fields = Arrays.asList(
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-length", "$.met.a.length()"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-min", "$.met.a.min()"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-max", "$.met.a.max()"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-avg", "$.met.a.avg()"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-sum", "$.met.a.sum()"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-stddev", "$.met.a.stddev()"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "met-array-append", "$.met.a.append(10)"),
        new JSONPathFieldSpec(JSONPathFieldType.PATH, "concat", "$.concat($.foo.bar1, $.foo.bar2)")
    );

    final Parser<String, Object> jsonParser = new JSONPathParser(new JSONPathSpec(true, fields), null, false);
    final Map<String, Object> jsonMap = jsonParser.parseToMap(NESTED_JSON);

    // values of met.a array are: 7,8,9
    Assert.assertEquals(3, jsonMap.get("met-array-length"));
    Assert.assertEquals(7.0, jsonMap.get("met-array-min"));
    Assert.assertEquals(9.0, jsonMap.get("met-array-max"));
    Assert.assertEquals(8.0, jsonMap.get("met-array-avg"));
    Assert.assertEquals(24.0, jsonMap.get("met-array-sum"));

    //deviation of [7,8,9] is 1/3, stddev is sqrt(1/3), approximately 0.8165
    Assert.assertEquals(0.8165, (double) jsonMap.get("met-array-stddev"), 0.00001);

    Assert.assertEquals(ImmutableList.of(7L, 8L, 9L, 10L), jsonMap.get("met-array-append"));
    Assert.assertEquals("aaabbb", jsonMap.get("concat"));
  }

}


text:
package xtime

import (
	"database/sql/driver"
	"strconv"
	"time"
)

// Time be used to MySql timestamp converting.
type Time int64

func (jt *Time) Scan(src interface{}) (err error) {
	switch sc := src.(type) {
	case time.Time:
		*jt = Time(sc.Unix())
	case string:
		var i int64
		i, err = strconv.ParseInt(sc, 10, 64)
		*jt = Time(i)
	}
	return
}

func (jt Time) Value() (driver.Value, error) {
	return time.Unix(int64(jt), 0), nil
}

func (jt Time) Time() time.Time {
	return time.Unix(int64(jt), 0)
}

// Duration be used toml unmarshal string time, like 1s, 500ms.
type Duration time.Duration

func (d *Duration) UnmarshalText(text []byte) error {
	tmp, err := time.ParseDuration(string(text))
	if err == nil {
		*d = Duration(tmp)
	}
	return err
}


text:
#include "Types.h"
#include "XFS.h"

#define SECTOR_SIZE 0x200

//Basic Types
typedef byte	u8;
typedef word	u16;
typedef dword	u32;

//Disk types
typedef u32 LBA;
typedef u32 OFFSET;

typedef XFS_ENTRY XFS_Entry;
#define TO_SECTORS(X)	( ((X)%SECTOR_SIZE) ? (((X)/SECTOR_SIZE)+1) : ((X)/SECTOR_SIZE))
#define TO_OFFSET(X)	((X)*SECTOR_SIZE)
#define XFS_ENTRY_SIZE	sizeof(XFS_ENTRY)

#define XFS_ENTRY_USED_OFFSET			0
#define XFS_ENTRY_IS_DIRECTORY_OFFSET		1
#define XFS_ENTRY_ITEMS_OFFSET			2
#define XFS_ENTRY_NAME_SIZE_OFFSET		3
#define XFS_ENTRY_NAME_OFFSET			4
#define XFS_ENTRY_DIRECTION_OFFSET		56
#define XFS_ENTRY_SIZE_OFFSET			60

#endif


text:
title: "Oregon International Ballet Academy 俄勒冈国际芭蕾舞蹈学校"
location: "10226 SW Park Way, Portland, Oregon 97225"
sidebar:
  - title: "Address"
    text: "10226 SW Park Way, Portland, Oregon 97225"
    image: "/assets/images/activities/oiba.png"
  - title: "Phone"
    text: "503-297-4325"
  - title: "Email"
    text: "oiballet@hotmail.com"
  - title: "Website"
    text: "[oiballet.org/](http://oiballet.org/)"
---

**A message from Xuan and Ye:**

Classical ballet technique is the soul to any physical art form. We are not only teaching ballet, we are creating an environment for student's confidence and untapped potential for beauty to be nurtured. OIBA's teaching method is based on the Vaganova Method combined with our personal experiences dancing around the world. Teaching through explanation and clear demonstration, we inspire students to focus and find their own voice in dance. We want to see each child maintain their innocence and joy as they grow to achieve the highest level of technical proficiency.

\*Oregon International Ballet Academy is a non-profit organization.

## Our Mission

We believe that we are not only teaching Ballet, but we are passing on beauty, confidence, health, love and responsibility! Inspiring the students to reach their dreams and future!

Our aim is not only to be a great institution but a warm international family. We want to use our past experiences and connections to give our students a platform to perform on stages around the world, allowing each individual an opportunity to explore a similar journey of their own happiness on stage.


text:
// Copyright 2015 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.docgen.testutil;

import static com.google.devtools.build.lib.packages.Attribute.attr;
import static com.google.devtools.build.lib.packages.BuildType.LABEL_LIST;

import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.RuleConfiguredTargetFactory;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.RuleDefinition;
import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment;
import com.google.devtools.build.lib.packages.RuleClass;

/**
 * Rule definitions that can be used for testing.
 */
public class TestData {
  public static class TestRule implements RuleDefinition {
    @Override
    public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) {
      return builder
          .add(attr("foo", LABEL_LIST))
          .build();
    }

    @Override
    public Metadata getMetadata() {
      return RuleDefinition.Metadata.builder().name("testrule")
          .factoryClass(DummyRuleFactory.class).ancestors(IntermediateRule.class).build();
    }
  }

  public static class IntermediateRule implements RuleDefinition {
    @Override
    public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) {
      return builder.build();
    }

    @Override
    public Metadata getMetadata() {
      return RuleDefinition.Metadata.builder().name("testrule")
          .factoryClass(DummyRuleFactory.class).ancestors(BaseRule.class).build();
    }
  }

  public static class BaseRule implements RuleDefinition {
    @Override
    public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) {
      return builder.build();
    }

    @Override
    public Metadata getMetadata() {
      return RuleDefinition.Metadata.builder().name("base_rule")
          .factoryClass(DummyRuleFactory.class).build();
    }
  }

  public static class DummyRuleFactory implements RuleConfiguredTargetFactory {
    @Override
    public ConfiguredTarget create(RuleContext ruleContext) {
      throw new IllegalStateException();
    }
  }
}


text:
    <title>ActiveMQ Delayed Redelivery Example</title>
    <link rel="stylesheet" type="text/css" href="../common/common.css" />
    <link rel="stylesheet" type="text/css" href="../common/prettify.css" />

Delayed Redelivery Example

This example demonstrates how ActiveMQ can be configured to provide a delayed redelivery in the case
     where a message needs to be redelivered.

Delaying redelivery can often be useful in the case that clients regularly fail or roll-back. Without a delayed
     redelivery, the system can get into a "thrashing" state, with delivery being attempted, the client rolling back, and
     delivery being re-attempted ad infinitum in quick succession, using up valuable CPU and network resources.

Re-delivery occurs when the session is closed with unacknowledged messages. The unacknowledged messages will
     be redelivered.

By providing a redelivery delay, it can be specified that a delay of, say, 10 seconds is implemented between rollback
     and redelivery. The specific delay is configurable on both a global and per destination level, by using wild-card
     matching on the address settings.

Example setup

Redelivery delay is specified in the configuration file broker.xml:

In this example we set the redelivery delay to 5 seconds for the specific example queue. We could set redelivery delay on
     on multiple queues by specifying a wild-card in the match, e.g. match="jms.#" would apply the settings
     to all JMS queues and topics.

We then consume a message in a transacted session, and rollback, and note that the message is not redelivered until
     after 5 seconds.

         <address-setting match="jms.queue.exampleQueue">
            <redelivery-delay>5000</redelivery-delay>
         </address-setting>

To run the example, simply type mvn verify -Pexample from this directory

Create an initial context to perform the JNDI lookup.

           initialContext = getContext(0);

Perform a lookup on the queue

           Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");

Perform a lookup on the Connection Factory

           ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");

Create a JMS Connection

           connection = cf.createConnection();

Create a transacted JMS Session

           Session session = connection.createSession(true, 0);

Create a JMS Message Producer

          MessageProducer producer = session.createProducer(queue);

Create a Text Message

            TextMessage message = session.createTextMessage("this is a text message");

Send the Message

            producer.send(message);

We commit the session to effectively send the message to the queue

            session.commit();

We create a JMS message consumer on the queue

            MessageConsumer messageConsumer = session.createConsumer(queue);

We start the connection. In order for delivery to occur on any consumers or subscribers on a connection, the connection must be started

           connection.start();

We receive the message...

            TextMessage messageReceived = (TextMessage)messageConsumer.receive(5000);
            System.out.println("1st delivery from " + queue.getQueueName() + ": " + messageReceived.getText());

...but we roll back the session. the message returns to the queue, but only after a
            5 second delay

            session.rollback();

We try to receive the message but it's being delayed

         messageReceived = (TextMessage)messageConsumer.receive(3000);

         if (messageReceived != null)
         {
            return false;
         }

         System.out.println("Redelivery has been delayed so received message is " + messageReceived);

We try and receive the message again, this time we should get it

         messageReceived = (TextMessage)messageConsumer.receive(3000);

         System.out.println("2nd delivery from " + queue.getQueueName() + ": " + messageReceived.getText());

We rollback the session again to cause another redelivery, and we time how long this one takes

         long start = System.currentTimeMillis();

         session.rollback();

         messageReceived = (TextMessage)messageConsumer.receive(8000);

         long end = System.currentTimeMillis();

         System.out.println("3nd delivery from " + queue.getQueueName() + ": " + messageReceived.getText() +
                            " after " + (end - start) + " milliseconds.");

And finally, always remember to close your JMS connections and resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects

           finally
           {
              if (initialContext != null)
              {
                initialContext.close();
              }
              if (connection != null)
              {
                 connection.close();
              }
           }

More information

User Manual's Undelivered Messages chapter


text:
# React seed

A boilerplate for building React apps with ES6 and webpack.

## What you get

* React 0.13
* Compilation of ES6 & JSX to ES5
* Jest testing framework
* webpack bundling with react hot loader (as well as html, css & sass loaders)
* Basic flux architecture with app actions, stores and example web API usage

## Getting started

Clone the project and remove the git repository:

```bash
git clone --depth=1 https://github.com/badsyntax/react-seed.git my-project
cd my-project
rm -rf .git && git init
```

## npm scripts

* `npm start` - Build and start the app in dev mode at http://localhost:8000
* `npm test` - Run the tests
* `npm run build` - Run a production build

## Examples

### Writing components:

```js
// Filename: Menu.jsx

'use strict';

import './_Menu.scss';

import React from 'react';
import MenuItem from '../MenuItem/MenuItem';

let { PropTypes } = React;

class Menu extends React.Component {

  constructor(...args) {
    super(...args);
    // Set initial state
    this.state = {
      foo: false
    };
  }

  getMenuItem(item) {
    return (
      <MenuItem item={item} key={'menu-item-' + item.id} />
    );
  }

  render() {
    return (
      <ul className={'menu'}>
        {this.props.items.map(this.getMenuItem, this)}
      </ul>
    );
  }
}

Menu.propTypes = {
  items: PropTypes.array.isRequired
};

export default Menu;
```

### Using mixins:

It's a bit awkward to use mixins with ES6 classes. You'll need to use a mixin helper:

```js
import mixin from 'util/mixin';

let draggable = {
  drag() { /* … */ }
};

let droppable = {
  drop() { /* … */ }
};

class Dialog extends mixin(React.Component, draggable, droppable) {
  /* … */
}
```

Alternatively, just use `React.createClass`.

###Writing tests:

```js
// Filename: __tests__/Menu-test.js

'use strict';

import React from 'react/addons';

jest.dontMock('../Menu.jsx');
jest.dontMock('../../MenuItem/MenuItem.jsx');

import Menu from '../Menu.jsx';

let { TestUtils } = React.addons;

describe('Menu', () => {

  let menuItems = [
    { id: 1, label: 'Option 1' },
    { id: 2, label: 'Option 2' }
  ];

  let menu = TestUtils.renderIntoDocument(
    <Menu items={menuItems} />
  );
  let menuElem = React.findDOMNode(menu);

  it('Renders the menu items', () => {
    expect(menuElem.querySelectorAll('li').length).toEqual(2);
  });
});
```

## Sass, CSS & webpack

`import` Sass and CSS files from within your JavaScript component files:

```js
// Filename: app.jsx
import 'normalize.css/normalize.css';
import './scss/app.scss';
```

* Sass include paths can be adjusted in the `webpack.config.js` file.
* All CSS (compiled or otherwise) is run through Autoprefixer.
* CSS files are combined in the order in which they are imported in JavaScript, thus
you should always import your CSS/Sass before importing any other JavaScript files.
* Use an approach like [BEM](http://cssguidelin.es/#bem-like-naming) to avoid specificity
issues that might exist due to unpredicatable order of CSS rules.

## HTML files

All required `.html` files are compiled with lodash.template and synced into the `./build` directory:

```js
// Filename: app.jsx
import './index.html';
```

* You can adjust the lodash template data in the `webpack.config.js` file.

## Conventions

* Use fat arrows for anonymous functions
* Don't use `var`. Use `let` and `const`.

## Releasing

Updating version:

* `npm version patch` - Bump version
* `git push && git push --tags` - Push to remote

Publishing package:

* `npm login` - Login to npm
* `npm publish` - Publish package

## Credits

This project was initially forked from https://github.com/tcoopman/react-es6-browserify

## License

Copyright (c) 2015 Richard Willis

MIT (http://opensource.org/licenses/MIT)


text:
namespace chrono {

/// Base class for all 'simple' constraints between
/// two frames attached to two bodies. These constraints
/// can correspond to the typical 'mating' conditions that
/// are created in assemblies of 3D CAD tools (parallel
/// axis, or face-to-face, etc.).
/// Note that most of the ChLinkMate constraints can be
/// done also with the constraints inherited from ChLinkLock...
/// but in case of links of the ChLinkLock class they
/// reference two ChMarker objects, tht can also move, but
/// this is could be an unnecessary complication in most cases.

class ChApi ChLinkMate : public ChLink {

  public:
    ChLinkMate() {}
    ChLinkMate(const ChLinkMate& other) : ChLink(other) {}
    virtual ~ChLinkMate() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMate* Clone() const override { return new ChLinkMate(*this); }

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

CH_CLASS_VERSION(ChLinkMate,0)

// -----------------------------------------------------------------------------

/// Generic mate constraint, where one can select which DOFs must be constrained
/// between two frames attached to the two bodies.

class ChApi ChLinkMateGeneric : public ChLinkMate {

  protected:
    ChFrame<> frame1;
    ChFrame<> frame2;

    bool c_x;
    bool c_y;
    bool c_z;
    bool c_rx;
    bool c_ry;
    bool c_rz;

    int ndoc;    ///< number of DOC, degrees of constraint
    int ndoc_c;  ///< number of DOC, degrees of constraint (only bilaterals)
    int ndoc_d;  ///< number of DOC, degrees of constraint (only unilaterals)

    ChLinkMask* mask;

    ChMatrix<>* C;  ///< residuals

  public:
    ChLinkMateGeneric(bool mc_x = true,
                      bool mc_y = true,
                      bool mc_z = true,
                      bool mc_rx = true,
                      bool mc_ry = true,
                      bool mc_rz = true);
    ChLinkMateGeneric(const ChLinkMateGeneric& other);
    virtual ~ChLinkMateGeneric();

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateGeneric* Clone() const override { return new ChLinkMateGeneric(*this); }

    /// Get the link coordinate system, expressed relative to Body2 (the 'master'
    /// body). This represents the 'main' reference of the link: reaction forces
    /// are expressed in this coordinate system.
    /// (It is the coordinate system of the contact plane relative to Body2)
    virtual ChCoordsys<> GetLinkRelativeCoords() override { return frame2.GetCoord(); }

    /// Get the master coordinate system for the assets (this will return the
    /// absolute coordinate system of the 'master' marker2)
    virtual ChFrame<> GetAssetsFrame(unsigned int nclone = 0) override { return frame2 >> *GetBody2(); }

    /// Access the coordinate system considered attached to body1.
    /// Its position is expressed in the coordinate system of body1.
    ChFrame<>& GetFrame1() { return frame1; }

    /// Access the coordinate system considered attached to body1.
    /// Its position is expressed in the coordinate system of body1.
    ChFrame<>& GetFrame2() { return frame2; };

    bool IsConstrainedX() { return c_x; }
    bool IsConstrainedY() { return c_y; }
    bool IsConstrainedZ() { return c_z; }
    bool IsConstrainedRx() { return c_rx; }
    bool IsConstrainedRy() { return c_ry; }
    bool IsConstrainedRz() { return c_rz; }

    /// Sets which movements (of frame 1 respect to frame 2) are constrained
    void SetConstrainedCoords(bool mc_x, bool mc_y, bool mc_z, bool mc_rx, bool mc_ry, bool mc_rz);

    /// Specialized initialization for generic mate, given the two bodies to be connected, the
    /// positions of the two frames to connect on the bodies (each expressed
    /// in body or abs. coordinates).
    virtual void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                            std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                            bool pos_are_relative,  ///< true: following pos. are relative to bodies.
                            ChFrame<> mframe1,      ///< mate frame (slave), for 1st body (rel. or abs., see flag above)
                            ChFrame<> mframe2       ///< mate frame (master), for 2nd body (rel. or abs., see flag above)
                            );

    /// Initialization based on passing two vectors (point + dir) on the
    /// two bodies, they will represent the X axes of the two frames (Y and Z will
    /// be built from the X vector via Gram Schmidt orthonormalization).
    /// Use the other ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    virtual void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                            std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                            bool pos_are_relative,  ///< true: following pos. are relative to bodies.
                            ChVector<> mpt1,    ///< origin of slave frame 1, for 1st body (rel. or abs., see flag above)
                            ChVector<> mpt2,    ///< origin of master frame 2, for 2nd body (rel. or abs., see flag above)
                            ChVector<> mnorm1,  ///< X axis of slave plane, for 1st body (rel. or abs., see flag above)
                            ChVector<> mnorm2   ///< X axis of master plane, for 2nd body (rel. or abs., see flag above)
                            );

    //
    // UPDATING FUNCTIONS
    //

    /// Override _all_ time, jacobian etc. updating.
    virtual void Update(double mtime, bool update_assets = true) override;

    /// If some constraint is redundant, return to normal state
    virtual int RestoreRedundant() override;

    /// User can use this to enable/disable all the constraint of
    /// the link as desired.
    virtual void SetDisabled(bool mdis) override;

    /// Ex:3rd party software can set the 'broken' status via this method
    virtual void SetBroken(bool mon) override;

    virtual int GetDOC() override { return ndoc; }
    virtual int GetDOC_c() override { return ndoc_c; }
    virtual int GetDOC_d() override { return ndoc_d; }

    //
    // STATE FUNCTIONS
    //

    // (override/implement interfaces for global state vectors, see ChPhysicsItem for comments.)
    virtual void IntStateGatherReactions(const unsigned int off_L, ChVectorDynamic<>& L) override;
    virtual void IntStateScatterReactions(const unsigned int off_L, const ChVectorDynamic<>& L) override;
    virtual void IntLoadResidual_CqL(const unsigned int off_L,
                                     ChVectorDynamic<>& R,
                                     const ChVectorDynamic<>& L,
                                     const double c) override;
    virtual void IntLoadConstraint_C(const unsigned int off,
                                     ChVectorDynamic<>& Qc,
                                     const double c,
                                     bool do_clamp,
                                     double recovery_clamp) override;
    virtual void IntLoadConstraint_Ct(const unsigned int off, ChVectorDynamic<>& Qc, const double c) override;
    virtual void IntToDescriptor(const unsigned int off_v,
                                 const ChStateDelta& v,
                                 const ChVectorDynamic<>& R,
                                 const unsigned int off_L,
                                 const ChVectorDynamic<>& L,
                                 const ChVectorDynamic<>& Qc) override;
    virtual void IntFromDescriptor(const unsigned int off_v,
                                   ChStateDelta& v,
                                   const unsigned int off_L,
                                   ChVectorDynamic<>& L) override;

    //
    // SOLVER INTERFACE
    //

    virtual void InjectConstraints(ChSystemDescriptor& mdescriptor) override;
    virtual void ConstraintsBiReset() override;
    virtual void ConstraintsBiLoad_C(double factor = 1, double recovery_clamp = 0.1, bool do_clamp = false) override;
    virtual void ConstraintsBiLoad_Ct(double factor = 1) override;
    virtual void ConstraintsLoadJacobians() override;
    virtual void ConstraintsFetch_react(double factor = 1) override;

    //
    // SERIALIZATION
    //

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;

  protected:
    void SetupLinkMask();
    void ChangedLinkMask();
};

CH_CLASS_VERSION(ChLinkMateGeneric,0)

// -----------------------------------------------------------------------------

/// Mate constraint of plane-to-plane type. This correspond to the
/// typical planar face vs planar face mating used in 3D CAD assemblies.
/// The planes are defined by the Y and Z axes of the two frames.

class ChApi ChLinkMatePlane : public ChLinkMateGeneric {

  protected:
    bool flipped;
    double separation;

  public:
    ChLinkMatePlane() : ChLinkMateGeneric(true, false, false, false, true, true), flipped(false), separation(0) {}
    ChLinkMatePlane(const ChLinkMatePlane& other);
    ~ChLinkMatePlane() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMatePlane* Clone() const override { return new ChLinkMatePlane(*this); }

    /// Tell if the two normals must be opposed (flipped=false) or must have the same verse (flipped=true)
    void SetFlipped(bool doflip);
    bool IsFlipped() { return flipped; }

    /// Set the distance between the two planes, in normal direction
    void SetSeparation(double msep) { separation = msep; }
    /// Get the requested distance between the two planes, in normal direction
    double GetSeparation() { return separation; }

    /// Specialized initialization for plane-plane mate, given the two bodies to be connected,
    /// two points on the two faces, two normals on the faces (each expressed
    /// in body or abs. coordinates).
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    virtual void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                            std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                            bool pos_are_relative,  ///< true: following pos. are relative to bodies.
                            ChVector<> mpt1,    ///< point on slave plane, for 1st body (rel. or abs., see flag above)
                            ChVector<> mpt2,    ///< point on master plane, for 2nd body (rel. or abs., see flag above)
                            ChVector<> mnorm1,  ///< normal of slave plane, for 1st body (rel. or abs., see flag above)
                            ChVector<> mnorm2   ///< normal of master plane, for 2nd body (rel. or abs., see flag above)
                            ) override;

    /// Override _all_ time, jacobian etc. updating, inheriting parent but also adding the effect of separation
    virtual void Update(double mtime, bool update_assets = true) override;

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

CH_CLASS_VERSION(ChLinkMatePlane,0)

// -----------------------------------------------------------------------------

/// Mate constraint of coaxial type. This correspond to the
/// typical cylinder-vs-cylinder mating used in 3D CAD assemblies.
/// The two coaxial axes are the X axes of the two frames.

class ChApi ChLinkMateCoaxial : public ChLinkMateGeneric {

  protected:
    bool flipped;

  public:
    ChLinkMateCoaxial() : ChLinkMateGeneric(false, true, true, false, true, true), flipped(false) {}
    ChLinkMateCoaxial(const ChLinkMateCoaxial& other);
    virtual ~ChLinkMateCoaxial() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateCoaxial* Clone() const override { return new ChLinkMateCoaxial(*this); }

    /// Tell if the two axes must be opposed (flipped=false) or must have the same verse (flipped=true)
    void SetFlipped(bool doflip);
    bool IsFlipped() { return flipped; }

    /// Specialized initialization for coaxial mate, given the two bodies to be connected,
    /// two points, two directions (each expressed in body or abs. coordinates).
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    virtual void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                            std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                            bool pos_are_relative,  ///< true: following pos. are relative to bodies.
                            ChVector<> mpt1,   ///< point on slave axis, for 1st body (rel. or abs., see flag above)
                            ChVector<> mpt2,   ///< point on master axis, for 2nd body (rel. or abs., see flag above)
                            ChVector<> mdir1,  ///< direction of slave axis, for 1st body (rel. or abs., see flag above)
                            ChVector<> mdir2   ///< direction of master axis, for 2nd body (rel. or abs., see flag above)
                            ) override;

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

CH_CLASS_VERSION(ChLinkMateCoaxial,0)

// -----------------------------------------------------------------------------

/// Mate constraint of spherical type. This correspond to the
/// typical point-on-point or spherical joint mating used in 3D CAD assemblies.

class ChApi ChLinkMateSpherical : public ChLinkMateGeneric {

  public:
    ChLinkMateSpherical() : ChLinkMateGeneric(true, true, true, false, false, false) {}
    ChLinkMateSpherical(const ChLinkMateSpherical& other);
    virtual ~ChLinkMateSpherical() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateSpherical* Clone() const override { return new ChLinkMateSpherical(*this); }

    /// Specialized initialization for coincident mate, given the two bodies to be connected,
    /// and two points (each expressed in body or abs. coordinates).
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                    std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                    bool pos_are_relative,  ///< true: following pos. are relative to bodies.
                    ChVector<> mpt1,  ///< point, slave, for 1st body (rel. or abs., see flag above)
                    ChVector<> mpt2   ///< point, master, for 2nd body (rel. or abs., see flag above)
                    );
};

CH_CLASS_VERSION(ChLinkMateSpherical,0)

// -----------------------------------------------------------------------------

/// Mate constraining distance of origin of frame B respect to X axis of frame A.

class ChApi ChLinkMateXdistance : public ChLinkMateGeneric {

  protected:
    double distance;

  public:
    ChLinkMateXdistance() : ChLinkMateGeneric(true, false, false, false, false, false), distance(0) {}
    ChLinkMateXdistance(const ChLinkMateXdistance& other);
    virtual ~ChLinkMateXdistance() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateXdistance* Clone() const override { return new ChLinkMateXdistance(*this); }

    /// Set the distance on X of frame 2
    void SetDistance(double msep) { distance = msep; }
    /// Get the requested distance on X of frame 2
    double GetDistance() { return distance; }

    /// Specialized initialization for X distance mate, given the two bodies to be connected,
    /// and two points (each expressed in body or abs. coordinates).
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                    std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                    bool pos_are_relative,  ///< true: following pos. are relative to bodies
                    ChVector<> mpt1,  ///< point, slave, for 1st body (rel. or abs., see flag above)
                    ChVector<> mpt2,  ///< point, master, for 2nd body (rel. or abs., see flag above)
                    ChVector<> mdir2  ///< direction of master axis, for 2nd body (rel. or abs., see flag above)
                    );

    /// Override _all_ time, jacobian etc. updating, inheriting parent but also adding the effect of separation
    virtual void Update(double mtime, bool update_assets = true) override;

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

CH_CLASS_VERSION(ChLinkMateXdistance,0)

// -----------------------------------------------------------------------------

/// Mate constraint of parallel type. This correspond to the
/// typical axis-is-parallel-to-axis (or edge to edge, etc.) mating
/// used in 3D CAD assemblies. The axes to be kept parallel are
/// the two X axes of the two frames.

class ChApi ChLinkMateParallel : public ChLinkMateGeneric {

  protected:
    bool flipped;

  public:
    ChLinkMateParallel() : ChLinkMateGeneric(false, false, false, false, true, true), flipped(false) {}
    ChLinkMateParallel(const ChLinkMateParallel& other);
    virtual ~ChLinkMateParallel() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateParallel* Clone() const override { return new ChLinkMateParallel(*this); }

    /// Tell if the two axes must be opposed (flipped=false) or must have the same verse (flipped=true)
    void SetFlipped(bool doflip);
    bool IsFlipped() { return flipped; }

    /// Specialized initialization for parallel mate, given the two bodies to be connected,
    /// two points and two directions (each expressed in body or abs. coordinates).
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    virtual void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                            std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                            bool pos_are_relative,  ///< true: following pos. are relative to bodies
                            ChVector<> mpt1,   ///< point on slave axis, for 1st body (rel. or abs., see flag above)
                            ChVector<> mpt2,   ///< point on master axis, for 2nd body (rel. or abs., see flag above)
                            ChVector<> mdir1,  ///< direction of slave axis, for 1st body (rel. or abs., see flag above)
                            ChVector<> mdir2   ///< direction of master axis, for 2nd body (rel. or abs., see flag above
                            ) override;

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

CH_CLASS_VERSION(ChLinkMateParallel,0)

// -----------------------------------------------------------------------------

/// Mate constraint of orthogonal type. This correspond to the
/// typical axis-is-orthogonal-to-axis (or edge to edge, etc.) mating
/// used in 3D CAD assemblies. The the two X axes of the two frames
/// are aligned to the cross product of the two directions.

class ChApi ChLinkMateOrthogonal : public ChLinkMateGeneric {

  protected:
    ChVector<> reldir1;
    ChVector<> reldir2;

  public:
    ChLinkMateOrthogonal()
        : ChLinkMateGeneric(false, false, false, true, false, false), reldir1(VECT_X), reldir2(VECT_Y) {}
    ChLinkMateOrthogonal(const ChLinkMateOrthogonal& other);
    virtual ~ChLinkMateOrthogonal() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateOrthogonal* Clone() const override { return new ChLinkMateOrthogonal(*this); }

    /// Specialized initialization for orthogonal mate, given the two bodies to be connected,
    /// two points and two directions (each expressed in body or abs. coordinates).
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    virtual void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link
                            std::shared_ptr<ChBodyFrame> mbody2,  ///< second body to link
                            bool pos_are_relative,  ///< true: following pos. are relative to bodies
                            ChVector<> mpt1,   ///< point on slave axis, for 1st body (rel. or abs., see flag above)
                            ChVector<> mpt2,   ///< point on master axis, for 2nd body (rel. or abs., see flag above)
                            ChVector<> mdir1,  ///< direction of slave axis, for 1st body (rel. or abs., see flag above)
                            ChVector<> mdir2   ///< direction of master axis, for 2nd body (rel. or abs., see flag above
                            ) override;

    /// Override _all_ time, jacobian etc. updating, inheriting parent but also adding the effect of separation
    virtual void Update(double mtime, bool update_assets = true) override;

    /// Method to allow serialization of transient data to archives.
    virtual void ArchiveOUT(ChArchiveOut& marchive) override;

    /// Method to allow deserialization of transient data from archives.
    virtual void ArchiveIN(ChArchiveIn& marchive) override;
};

CH_CLASS_VERSION(ChLinkMateOrthogonal,0)

// -----------------------------------------------------------------------------

/// Mate constraint that completely fix one frame's rotation and translation
/// respect to the other frame.

class ChApi ChLinkMateFix : public ChLinkMateGeneric {

  public:
    ChLinkMateFix() : ChLinkMateGeneric(true, true, true, true, true, true) {}
    ChLinkMateFix(const ChLinkMateFix& other);
    virtual ~ChLinkMateFix() {}

    /// "Virtual" copy constructor (covariant return type).
    virtual ChLinkMateFix* Clone() const override { return new ChLinkMateFix(*this); }

    /// Specialized initialization for "fix" mate, given the two bodies to be connected;
    /// the positions of the two auxiliary frames where the two bodies are connected are
    /// both automatically initialized as the current absolute position of mbody1.
    /// Use ChLinkMateGeneric::Initialize() if you want to set the two frames directly.
    void Initialize(std::shared_ptr<ChBodyFrame> mbody1,  ///< first body to link, also frame for
                    std::shared_ptr<ChBodyFrame> mbody2   ///< second body to link
                    );
};

CH_CLASS_VERSION(ChLinkMateFix,0)

}  // end namespace chrono

#endif


text:
/*
 *
 * File:   StreamChannelGroup.h
 * Author: rmartins
 *
 * Created on August 31, 2010, 11:14 AM
 */

#ifndef STREAMCHANNELGROUP_H
#define	STREAMCHANNELGROUP_H

#include <euryale/net/AbstractStreamChannel.h>
#include <ace/Hash_Map_Manager.h>

#include <list>
using std::list;

template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
class ChannelManagerListener {
public:
    typedef AbstractStreamChannel<ACE_PEER_STREAM_2, ACE_SYNCH_USE> ChannelType;
    typename ChannelType::channel_ptr ChannelTypePtr;

    virtual void onClose(ChannelType* channel) = 0;
    virtual void onAdd(ChannelType* channel) = 0;
};

template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
class ChannelManager : public CloseListener<ACE_PEER_STREAM_2, ACE_SYNCH_USE> {
public:
    typedef AbstractStreamChannel<ACE_PEER_STREAM_2, ACE_SYNCH_USE> ChannelType;
    typedef typename ChannelType::channel_ptr ChannelTypePtr;
    typedef ChannelManagerListener<ACE_PEER_STREAM_2, ACE_SYNCH_USE> ListenerType;
    typedef ACE_SYNCH_RECURSIVE_MUTEX RECURSIVE_MUTEX;;
    //typedef ACE_SYNCH_DECL::RECURSIVE_MUTEX RECURSIVE_MUTEX;

    ChannelManager(ListenerType* listener = 0) :
    m_listener(listener) {
        m_debugChannelManager = RuntimeConfiguration::isClassDebugged("ChannelManager");
    }

    virtual ~ChannelManager() {
    }

    void close() {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        typename ACE_Hash_Map_Manager<UUIDPtr, ChannelTypePtr, ACE_SYNCH_RW_MUTEX>::iterator iter = m_map.begin();
        while (iter != m_map.end()) {
            (*iter).item()->close();
            iter++;
        }
        m_map.close();
    }

    int add(ChannelType* channel) {
        ACE_GUARD_RETURN(RECURSIVE_MUTEX, ace_mon, m_lock,-1);
        ChannelTypePtr channelPtr(channel);
        int ret = m_map.bind(channel->getChannelID(), channelPtr);
        if (ret == -1) {
            channel->close();
            delete channel;
            return -1;
        }
        //if (m_debugChannelManager) {
        ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)INFO: StreamChannelGroup::add() ret=%d pid=%s\n"), ret, channel->getPID()->toString().c_str()));
        //}
        if (channel->setCloseListener(this) == -1) {
            remove(channel);
            //channel->close();
            //delete channel;
            return -1;
        }
        fireOnAdd(channel);
        return ret;
    }

    void remove(ChannelType* channel) {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        //if (m_debugChannelManager) {
        ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)INFO: StreamChannelGroup::remove() - calling close()\n")));
        //}

        ChannelTypePtr channelPtr;
        //if (m_debugChannelManager) {
        ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)INFO: StreamChannelGroup::remove() - removing from map\n")));
        //}
        int ret = m_map.unbind(channel->getChannelID(), channelPtr);
        //if (m_debugChannelManager) {
        ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)INFO: StreamChannelGroup::remove() - removedfrom map ret =%d\n"), ret));
        //}
        if (ret == 0) {
            channel->setCloseListener(0);
            channel->close();
            fireOnClose(channel);
        }
    }

    void remove(UUIDPtr& uuid) {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        if (m_debugChannelManager) {
            ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t|%T)INFO: StreamChannelGroup::remove() - calling close()\n")));
        }
        ChannelTypePtr channelPtr;
        if (m_map.unbind(uuid, channelPtr) == 0) {
            channelPtr->setCloseListener(0);
            channelPtr->close();
            fireOnClose(channelPtr.get());
        }
    }

    virtual void onClose(ChannelType* channel) {
        remove(channel);
    }

    virtual int getChannelByID(UUIDPtr& channelID, ChannelTypePtr& channel) {
        ACE_GUARD_RETURN(RECURSIVE_MUTEX, ace_mon, m_lock, 0);
        return m_map.find(channelID, channel);
    }

    ChannelManagerListener<ACE_PEER_STREAM_2, ACE_SYNCH_USE>* deattach() {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        ChannelManagerListener<ACE_PEER_STREAM_2, ACE_SYNCH_USE>* temp = m_listener;
        m_listener = 0;
        return temp;
    }

    void setListener(ChannelManagerListener<ACE_PEER_STREAM_2, ACE_SYNCH_USE>* listener) {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        m_listener = listener;
    }

    UInt getSize() {
        //return m_channelList.size();
        return m_map.total_size();
    }

    void getPeerList(list<UUIDPtr>& l) {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        typename ACE_Hash_Map_Manager<UUIDPtr, ChannelTypePtr, ACE_SYNCH_RW_MUTEX>::iterator iter = m_map.begin();
        while (iter != m_map.end()) {
            l.push_back((*iter).item()->getPID());
            iter++;
        }
    }

    void getMemberList(list<ChannelTypePtr>& l) {
        ACE_GUARD(RECURSIVE_MUTEX, ace_mon, m_lock);
        typename ACE_Hash_Map_Manager<UUIDPtr, ChannelTypePtr, ACE_SYNCH_RW_MUTEX>::iterator iter = m_map.begin();
        while (iter != m_map.end()) {
            l.push_back(iter->item());
            iter++;
        }
    }

protected:
    bool m_debugChannelManager;
    RECURSIVE_MUTEX m_lock;
    ACE_Hash_Map_Manager<UUIDPtr, ChannelTypePtr, ACE_SYNCH_RW_MUTEX> m_map;
    ChannelManagerListener<ACE_PEER_STREAM_2, ACE_SYNCH_USE>* m_listener;

    bool hasValidListener() {
        return (m_listener != 0);
    }

    virtual void fireOnClose(AbstractStreamChannel<ACE_PEER_STREAM_2, ACE_SYNCH_USE>* channel) {
        if (hasValidListener()) {
            m_listener->onClose(channel);
        }
    }

    virtual void fireOnAdd(AbstractStreamChannel<ACE_PEER_STREAM_2, ACE_SYNCH_USE>* channel) {
        if (hasValidListener()) {
            m_listener->onAdd(channel);
        }
    }
};

#endif	/* STREAMCHANNELGROUP_H */


text:
package org.opencommercesearch.api.models

import org.opencommercesearch.api.Implicits._
import play.api.libs.functional.syntax._
import play.api.libs.json._
import reactivemongo.bson.{BSONDocument, BSONDocumentReader, BSONDocumentWriter}

/**
 * @author nkumar
 */
case class Generation (
  var number: Option[Int],
  var master: Option[Product]) {
}

object Generation {
  implicit val readsGenerationInfo : Reads[Generation] = (
     (__ \ "number").readNullable[Int] ~
     (__ \ "master").lazyReadNullable(Reads.of[Product])
  ) (Generation.apply _)

  implicit val writesGenerationInfo : Writes[Generation] = (
    (__ \ "number").writeNullable[Int] ~
    (__ \ "master").lazyWriteNullable(Writes.of[Product])
  ) (unlift(Generation.unapply))

  implicit object GenerationWriter extends BSONDocumentWriter[Generation] {
    import reactivemongo.bson._
    def write(generation: Generation): BSONDocument = BSONDocument(
      "number" -> generation.number,
      "master" -> generation.master
    )
  }

  implicit object GenerationReader extends BSONDocumentReader[Generation] {
    def read(doc: BSONDocument): Generation = Generation(
      doc.getAs[Int]("number"),
      doc.getAs[Product]("master")
    )
  }
}


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

public class PlayerController : MonoBehaviour {
	public GameObject player;
	public GameObject mainCamera;

	public GameObject firstWayPoint;
	public GameObject secondWayPoint;
	public GameObject thirdWayPoint;
	public GameObject fourthWayPoint;
	public GameObject originWayPoint;
	public Canvas healthCanvas;
	public Canvas extinguisherSelectionCanvas;
	public Canvas instructionsCanvas;

	public Slider healthBarSlider;
	private bool isGameOver = false;
	public Text gameOverText;

	// Use this for initialization
	void Start () {
		gameOverText.enabled = false;
		healthCanvas.enabled = false;
		extinguisherSelectionCanvas.enabled = false;
		instructionsCanvas.enabled = false;
		healthBarSlider.value = 1.0f;
	}

	// Update is called once per frame
	void Update () {
		// Example: get controller's current orientation:
		Quaternion ori = GvrController.Orientation;

		// If you want a vector that points in the direction of the controller
		// you can just multiply this quat by Vector3.forward:
		Vector3 vector = ori * Vector3.forward;

		Quaternion cameraOrientation =mainCamera.transform.rotation;
		Vector3 cameraOrientationVector = cameraOrientation * Vector3.forward;
		cameraOrientationVector.Normalize ();

		if (healthBarSlider.value > 0) {
			if (GvrController.ClickButtonDown) {
				Rigidbody rigidBodyPlayer = player.GetComponent<Rigidbody> ();
				Vector2 touchPos = GvrController.TouchPos;
				string clickPosition = checkTouchPadClickPosition (touchPos);
				switch (clickPosition) {
				case "TOP":
					//Vector3 moveForward = new Vector3 (0, 0, 1);
					//player.transform.position += moveForward;
					//rigidBodyPlayer.velocity = moveForward;
					//rigidBodyPlayer.MovePosition(player.transform.position += moveForward);
					//iTween.MoveTo (player, player.transform.position + moveForward, 2f);
					//iTween.MoveTo (player, cameraOrientationVector, 2f);
					//this.transform.Translate(mainCamera.transform.forward, Space.World);
					Vector3 moveForward = mainCamera.transform.forward;
					moveForward.y = 0;

					iTween.MoveTo (player, player.transform.position + moveForward, 2f);
					//iTween.MoveTo (player, vector, 2f);

					//healthBarSlider.value -= .02f;
					break;
				case "RIGHT":
					Vector3 moveRight = mainCamera.transform.right;
					moveRight.y = 0;
					//player.transform.position += moveRight;
					//rigidBodyPlayer.velocity = moveRight;

					//rigidBodyPlayer.MovePosition(player.transform.position += moveRight);

					iTween.MoveTo (player, player.transform.position + moveRight, 2f);
					//healthBarSlider.value -= .1f;
					break;
				case "BOTTOM":
					Vector3 moveBack = -mainCamera.transform.forward;
					moveBack.y = 0;
					//rigidBodyPlayer.velocity = moveBack;

					//player.transform.position += moveBack;
					//rigidBodyPlayer.MovePosition(player.transform.position += moveBack);

					iTween.MoveTo (player, player.transform.position + moveBack, 2f);
					//healthBarSlider.value -= .05f;
					break;
				case "LEFT":
					Vector3 moveLeft = -mainCamera.transform.right;
					moveLeft.y = 0;
					//player.transform.position += moveLeft;
					//rigidBodyPlayer.velocity = moveLeft;

					//rigidBodyPlayer.MovePosition(player.transform.position += moveLeft);

					iTween.MoveTo (player, player.transform.position + moveLeft, 2f);
					//healthBarSlider.value -= .08f;
					break;
				default:
					break;
				}
				/*switch (i) {
				case 0:
					iTween.MoveTo (player, firstWayPoint.transform.position, 5f);
					i++;
					healthBarSlider.value -= .02f;
					break;
				case 1:
					iTween.MoveTo (player, secondWayPoint.transform.position, 5f);
					i++;
					healthBarSlider.value -= .1f;
					break;
				case 2:
					iTween.MoveTo (player, thirdWayPoint.transform.position, 5f);
					i++;
					healthBarSlider.value -= .5f;
					break;
				case 3:
					iTween.MoveTo (player, fourthWayPoint.transform.position, 5f);
					i++;
					healthBarSlider.value -= .2f;
					break;
				case 4:
					iTween.MoveTo (player, originWayPoint.transform.position, 5f);
					i = 0;
					break;
				default:
					break;
				}*/

			}
		} else {
			isGameOver = true;
			gameOverText.enabled = true;
			gameOverText.text = "Got Burned! Try Again. Press AppButton";

		}
		bool isFireActiveNow = isFireActive ();

		if (GvrController.AppButtonDown) {
			if (isGameOver || !isFireActiveNow) {
				ResetScene ();
			} else {
				//rigidBodyPlayer.velocity = Vector3.zero;
			}
		}

		if (!isFireActiveNow && !isGameOver) {
			gameOverText.enabled = true;
			gameOverText.text = "Congratulations! Succesfully Extinguished All Fire. Press AppButton";
			gameOverText.color = Color.green;
		}

	}
	public void ResetScene()
	{
		// Reset the scene when the user clicks the sign post
		SceneManager.LoadScene("CodeRedMain");
	}

	public void moveToOriginWayPoint()
	{
		iTween.MoveTo (player, originWayPoint.transform.position, 3f);
		healthCanvas.enabled = true;
		extinguisherSelectionCanvas.enabled = true;
		instructionsCanvas.enabled = true;
		originWayPoint.GetComponent<GvrAudioSource> ().Play ();
	}

	public string checkTouchPadClickPosition(Vector2 touchPos){
		if ((touchPos.x > 0.25 && touchPos.x < 0.75) && (touchPos.y < 0.25)) {
			return "TOP";
		} else if ((touchPos.x > 0.75) && (touchPos.y > 0.25 && touchPos.y < 0.75)) {
			return "RIGHT";
		} else if ((touchPos.x > 0.25 && touchPos.x < 0.75) && (touchPos.y > 0.75)) {
			return "BOTTOM";
		} else if ((touchPos.x < 0.25) && (touchPos.y > 0.25 && touchPos.y < 0.75)) {
			return "LEFT";
		}else if((touchPos.x > 0.25 && touchPos.x < 0.75) &&(touchPos.y > 0.25 && touchPos.y < 0.75)){
			return "CENTER";
		}
		return "";
	}

	void OnCollisionEnter(Collision collision) {
		iTween.Stop ();
		if (collision.collider.tag == "Wall") {
			Rigidbody rigidBodyPlayer = player.GetComponent<Rigidbody> ();
			rigidBodyPlayer.isKinematic = true;
		}
	}
	void OnCollisionExit(Collision collision) {
		if (collision.collider.tag == "Wall") {
			Rigidbody rigidBodyPlayer = player.GetComponent<Rigidbody> ();
			rigidBodyPlayer.isKinematic = false;
		}
	}

	public bool isFireActive(){
		var particleSystems = GameObject.FindGameObjectsWithTag ("Fire");
		foreach (var particleSystem in particleSystems) {
			if (particleSystem.GetComponent<ParticleSystem>().emission.enabled) {
				return true;
			}
		}
		return false;
	}
}


text: <!DOCTYPE HTML>


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory android:title="基本设置" >
        <Preference
            android:key="about_dev"
            android:title="关于开发者" />
        <Preference
            android:key="app_version"
            android:title="版本:" />
    </PreferenceCategory>
</PreferenceScreen>


text:
<?php

namespace Mindy\Orm;

use Mindy\Helper\Creator;
use Mindy\Orm\Fields\ForeignField;

/**
 * Class MetaData
 * @package Mindy\Orm
 */
class MetaData
{
    /**
     * @var MetaData[]
     */
    private static $instances = [];
    /**
     * @var string
     */
    protected $modelClassName;
    /**
     * @var \Mindy\Orm\Fields\Field
     */
    protected $primaryKeyField;
    /**
     * @var array
     */
    protected $allFields = [];
    /**
     * @var array
     */
    protected $localFields = [];
    /**
     * @var array
     */
    protected $localFileFields = [];
    /**
     * @var array
     */
    protected $extFields = [];
    /**
     * @var array
     */
    protected $foreignFields = [];
    /**
     * @var array
     */
    protected $oneToOneFields = [];
    /**
     * @var array
     */
    protected $manyToManyFields = [];
    /**
     * @var array
     */
    protected $hasManyFields = [];
    /**
     * @var array
     */
    protected $attributes = null;
    /**
     * @var array
     */
    protected $primaryKeys = null;

    public function __construct($className)
    {
        $this->modelClassName = $className;
    }

    public function getPkName()
    {
        return $this->primaryKeyField->getName();
    }

    public function hasRelatedField($name)
    {
        return $this->hasManyToManyField($name) || $this->hasHasManyField($name) || $this->hasForeignField($name);
    }

    /**
     * @param $name
     * @return \Mindy\Orm\Fields\HasManyField|\Mindy\Orm\Fields\ManyToManyField|\Mindy\Orm\Fields\ForeignField|null
     */
    public function getRelatedField($name)
    {
        if ($this->hasManyToManyField($name)) {
            return $this->getManyToManyField($name);
        } else if ($this->hasHasManyField($name)) {
            return $this->getHasManyField($name);
        } else if ($this->hasForeignField($name)) {
            return $this->getForeignField($name);
        }
        return null;
    }

    /**
     * TODO refactoring
     * @return array
     */
    public function getRelatedFields()
    {
        return array_keys(array_merge(array_merge($this->hasManyFields, $this->manyToManyFields), array_flip($this->foreignFields)));
    }

    /**
     * @param $name
     * @return bool
     */
    public function hasFileField($name)
    {
        return array_key_exists($name, $this->localFileFields);
    }

    /**
     * @param $name
     * @return \Mindy\Orm\Fields\FileField
     */
    public function getFileField($name)
    {
        $field = $this->localFileFields[$name];
        $field->cleanValue();
        return $field;
    }

    public function hasForeignKey($name)
    {
        return array_key_exists($name, $this->foreignFields);
    }

    public function hasHasManyField($name)
    {
        return array_key_exists($name, $this->hasManyFields);
    }

    public function hasManyToManyField($name)
    {
        return array_key_exists($name, $this->manyToManyFields);
    }

    public function hasOneToOneField($name)
    {
        return array_key_exists($name, $this->oneToOneFields);
    }

    public function getForeignKey($name)
    {
        return $this->foreignFields[$name];
    }

    public function primaryKey()
    {
        if (is_null($this->primaryKeys)) {
            $this->primaryKeys = [];
            foreach ($this->allFields as $name => $field) {
                if ($field->primary) {
                    if ($this->hasForeignField($name)) {
                        $this->primaryKeys[] = $name . '_id';
                    } else {
                        $this->primaryKeys[] = $name;
                    }
                }
            }
        }
        return $this->primaryKeys;
    }

    public static function getInstance($className)
    {
        if (!isset(self::$instances[$className])) {
            self::$instances[$className] = new self($className);
            self::$instances[$className]->initFields();
        }

        return self::$instances[$className];
    }

    /**
     * @return array
     * @throws \Mindy\Exception\InvalidConfigException
     */
    public function getAttributes()
    {
        if ($this->attributes === null) {
            /** @var \Mindy\Orm\Model $className */
            $className = $this->modelClassName;
            $this->attributes = array_keys($className::getTableSchema()->columns);
        }
        return $this->attributes;
    }

    public function initFields(array $fields = [], $extra = false)
    {
        $className = $this->modelClassName;
        if (empty($fields)) {
            $fields = $className::getFields();
        }

        $needPk = !$extra;
        $fkFields = [];
        $m2mFields = [];

        foreach ($fields as $name => $config) {
            /* @var $field \Mindy\Orm\Fields\Field */

            if (!is_object($config) && !$config instanceof \Mindy\Orm\Fields\Field) {
                $field = Creator::createObject($config);
                $field->setName($name);
                $field->setModelClass($className);
            } else {
                $field = $config;
            }
            // $field->setModel($model);

            if (is_a($field, $className::$autoField) || $field->primary) {
                $needPk = false;
                $this->primaryKeyField = $field;
            }

            if (is_a($field, $className::$fileField)) {
                $this->localFileFields[$name] = $field;
            }

            if (is_a($field, $className::$relatedField)) {
                /* @var $field \Mindy\Orm\Fields\RelatedField */
                if (is_a($field, $className::$manyToManyField)) {
                    /* @var $field \Mindy\Orm\Fields\ManyToManyField */
                    $this->manyToManyFields[$name] = $field;
                    $m2mFields[$name] = $field;
                }

                if (is_a($field, $className::$hasManyField)) {
                    /* @var $field \Mindy\Orm\Fields\HasManyField */
                    $this->hasManyFields[$name] = $field;
                }

                if (is_a($field, $className::$oneToOneField) && $field->reversed) {
                    /* @var $field \Mindy\Orm\Fields\ForeignField */
                    $this->oneToOneFields[$name] = $field;
                }elseif (is_a($field, $className::$foreignField)) {
                    /* @var $field \Mindy\Orm\Fields\ForeignField */
                    $fkFields[$name] = $field;
                }
            } else {
                $this->localFields[$name] = $field;
            }
            $this->allFields[$name] = $field;

            if (!$extra) {
                $extraFields = $field->getExtraFields();
                if (!empty($extraFields)) {
                    $extraFieldsInitialized = $this->initFields($extraFields, true);
                    foreach ($extraFieldsInitialized as $key => $value) {
                        $field->setExtraField($key, $this->allFields[$key]);
                        $this->extFields[$name] = [$key => $this->allFields[$key]];
                    }
                }
            }
        }

        if ($needPk) {
            $pkName = 'id';
            /* @var $autoField \Mindy\Orm\Fields\AutoField */
            $autoFieldClass = $className::$autoField;
            $autoField = new $autoFieldClass;
            $autoField->setName($pkName);
            // $autoField->setModel($model);

            $this->allFields = array_merge([$pkName => $autoField], $this->allFields);
            $this->localFields = array_merge([$pkName => $autoField], $this->localFields);
            $this->primaryKeyField = $autoField;
        }

        foreach ($fkFields as $name => $field) {
            // ForeignKey in self model
            if ($field->modelClass == $className) {
                $this->foreignFields[$name . '_' . $this->primaryKeyField->getName()] = $name;
            } else {
                $this->foreignFields[$name . '_' . $field->getForeignPrimaryKey()] = $name;
            }
        }

        return $fields;
    }

    public function getFieldsInit()
    {
        return $this->allFields;
    }

    /**
     * @param $name
     * @return \Mindy\Orm\Fields\Field
     */
    public function getField($name)
    {
        $field = $this->allFields[$name];
        $field->cleanValue();
        return $field;
    }

    /**
     * @param $name
     * @return bool
     */
    public function hasField($name)
    {
        return array_key_exists($name, $this->allFields);
    }

    public function hasForeignField($name)
    {
        if (array_key_exists($name, $this->foreignFields)) {
            $name = $this->foreignFields[$name];
        }
        if ($this->hasField($name)) {
            return $this->getField($name) instanceof ForeignField;
        }
        return false;
    }

    public function getForeignField($name)
    {
        if (array_key_exists($name, $this->foreignFields)) {
            $name = $this->foreignFields[$name];
        }
        return $this->getField($name);
    }

    public function getForeignFields()
    {
        return $this->foreignFields;
    }

    public function getManyFields()
    {
        return $this->manyToManyFields;
    }

    public function getManyToManyField($name)
    {
        return $this->manyToManyFields[$name];
    }

    public function getHasManyField($name)
    {
        return $this->manyToManyFields[$name];
    }

    public function hasExtraFields($name)
    {
        return array_key_exists($name, $this->extFields);
    }

    public function getExtraFields($name)
    {
        return $this->extFields[$name];
    }
}


text:
package com.me.mygdxgame;

import com.badlogic.gdx.Game;

public class MyGdxGame extends Game {

	@Override
	public void create() {
		setScreen(new Playstate(this, "MainMenu Screen"));
	}
}