text:
package com.liferay.pushnotifications.service;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream;
import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayOutputStream;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.ClassLoaderObjectInputStream;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.BaseModel;

import com.liferay.pushnotifications.model.AppVersionClp;
import com.liferay.pushnotifications.model.ApplicationClp;
import com.liferay.pushnotifications.model.ApplicationPreferencesClp;
import com.liferay.pushnotifications.model.PushNotificationsDeviceClp;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import java.lang.reflect.Method;

import java.util.ArrayList;
import java.util.List;

public class ClpSerializer {
    private static Log _log = LogFactoryUtil.getLog(ClpSerializer.class);
    private static String _servletContextName;
    private static boolean _useReflectionToTranslateThrowable = true;

    public static String getServletContextName() {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        synchronized (ClpSerializer.class) {
            if (Validator.isNotNull(_servletContextName)) {
                return _servletContextName;
            }

            try {
                ClassLoader classLoader = ClpSerializer.class.getClassLoader();

                Class<?> portletPropsClass = classLoader.loadClass(
                        "com.liferay.util.portlet.PortletProps");

                Method getMethod = portletPropsClass.getMethod("get",
                        new Class<?>[] { String.class });

                String portletPropsServletContextName = (String) getMethod.invoke(null,
                        "push-notifications-portlet-deployment-context");

                if (Validator.isNotNull(portletPropsServletContextName)) {
                    _servletContextName = portletPropsServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info(
                        "Unable to locate deployment context from portlet properties");
                }
            }

            if (Validator.isNull(_servletContextName)) {
                try {
                    String propsUtilServletContextName = PropsUtil.get(
                            "push-notifications-portlet-deployment-context");

                    if (Validator.isNotNull(propsUtilServletContextName)) {
                        _servletContextName = propsUtilServletContextName;
                    }
                } catch (Throwable t) {
                    if (_log.isInfoEnabled()) {
                        _log.info(
                            "Unable to locate deployment context from portal properties");
                    }
                }
            }

            if (Validator.isNull(_servletContextName)) {
                _servletContextName = "push-notifications-portlet";
            }

            return _servletContextName;
        }
    }

    public static Object translateInput(BaseModel<?> oldModel) {
        Class<?> oldModelClass = oldModel.getClass();

        String oldModelClassName = oldModelClass.getName();

        if (oldModelClassName.equals(ApplicationClp.class.getName())) {
            return translateInputApplication(oldModel);
        }

        if (oldModelClassName.equals(ApplicationPreferencesClp.class.getName())) {
            return translateInputApplicationPreferences(oldModel);
        }

        if (oldModelClassName.equals(AppVersionClp.class.getName())) {
            return translateInputAppVersion(oldModel);
        }

        if (oldModelClassName.equals(PushNotificationsDeviceClp.class.getName())) {
            return translateInputPushNotificationsDevice(oldModel);
        }

        return oldModel;
    }

    public static Object translateInput(List<Object> oldList) {
        List<Object> newList = new ArrayList<Object>(oldList.size());

        for (int i = 0; i < oldList.size(); i++) {
            Object curObj = oldList.get(i);

            newList.add(translateInput(curObj));
        }

        return newList;
    }

    public static Object translateInputApplication(BaseModel<?> oldModel) {
        ApplicationClp oldClpModel = (ApplicationClp) oldModel;

        BaseModel<?> newModel = oldClpModel.getApplicationRemoteModel();

        newModel.setModelAttributes(oldClpModel.getModelAttributes());

        return newModel;
    }

    public static Object translateInputApplicationPreferences(
        BaseModel<?> oldModel) {
        ApplicationPreferencesClp oldClpModel = (ApplicationPreferencesClp) oldModel;

        BaseModel<?> newModel = oldClpModel.getApplicationPreferencesRemoteModel();

        newModel.setModelAttributes(oldClpModel.getModelAttributes());

        return newModel;
    }

    public static Object translateInputAppVersion(BaseModel<?> oldModel) {
        AppVersionClp oldClpModel = (AppVersionClp) oldModel;

        BaseModel<?> newModel = oldClpModel.getAppVersionRemoteModel();

        newModel.setModelAttributes(oldClpModel.getModelAttributes());

        return newModel;
    }

    public static Object translateInputPushNotificationsDevice(
        BaseModel<?> oldModel) {
        PushNotificationsDeviceClp oldClpModel = (PushNotificationsDeviceClp) oldModel;

        BaseModel<?> newModel = oldClpModel.getPushNotificationsDeviceRemoteModel();

        newModel.setModelAttributes(oldClpModel.getModelAttributes());

        return newModel;
    }

    public static Object translateInput(Object obj) {
        if (obj instanceof BaseModel<?>) {
            return translateInput((BaseModel<?>) obj);
        } else if (obj instanceof List<?>) {
            return translateInput((List<Object>) obj);
        } else {
            return obj;
        }
    }

    public static Object translateOutput(BaseModel<?> oldModel) {
        Class<?> oldModelClass = oldModel.getClass();

        String oldModelClassName = oldModelClass.getName();

        if (oldModelClassName.equals(
                    "com.liferay.pushnotifications.model.impl.ApplicationImpl")) {
            return translateOutputApplication(oldModel);
        } else if (oldModelClassName.endsWith("Clp")) {
            try {
                ClassLoader classLoader = ClpSerializer.class.getClassLoader();

                Method getClpSerializerClassMethod = oldModelClass.getMethod(
                        "getClpSerializerClass");

                Class<?> oldClpSerializerClass = (Class<?>) getClpSerializerClassMethod.invoke(oldModel);

                Class<?> newClpSerializerClass = classLoader.loadClass(oldClpSerializerClass.getName());

                Method translateOutputMethod = newClpSerializerClass.getMethod("translateOutput",
                        BaseModel.class);

                Class<?> oldModelModelClass = oldModel.getModelClass();

                Method getRemoteModelMethod = oldModelClass.getMethod("get" +
                        oldModelModelClass.getSimpleName() + "RemoteModel");

                Object oldRemoteModel = getRemoteModelMethod.invoke(oldModel);

                BaseModel<?> newModel = (BaseModel<?>) translateOutputMethod.invoke(null,
                        oldRemoteModel);

                return newModel;
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to translate " + oldModelClassName, t);
                }
            }
        }

        if (oldModelClassName.equals(
                    "com.liferay.pushnotifications.model.impl.ApplicationPreferencesImpl")) {
            return translateOutputApplicationPreferences(oldModel);
        } else if (oldModelClassName.endsWith("Clp")) {
            try {
                ClassLoader classLoader = ClpSerializer.class.getClassLoader();

                Method getClpSerializerClassMethod = oldModelClass.getMethod(
                        "getClpSerializerClass");

                Class<?> oldClpSerializerClass = (Class<?>) getClpSerializerClassMethod.invoke(oldModel);

                Class<?> newClpSerializerClass = classLoader.loadClass(oldClpSerializerClass.getName());

                Method translateOutputMethod = newClpSerializerClass.getMethod("translateOutput",
                        BaseModel.class);

                Class<?> oldModelModelClass = oldModel.getModelClass();

                Method getRemoteModelMethod = oldModelClass.getMethod("get" +
                        oldModelModelClass.getSimpleName() + "RemoteModel");

                Object oldRemoteModel = getRemoteModelMethod.invoke(oldModel);

                BaseModel<?> newModel = (BaseModel<?>) translateOutputMethod.invoke(null,
                        oldRemoteModel);

                return newModel;
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to translate " + oldModelClassName, t);
                }
            }
        }

        if (oldModelClassName.equals(
                    "com.liferay.pushnotifications.model.impl.AppVersionImpl")) {
            return translateOutputAppVersion(oldModel);
        } else if (oldModelClassName.endsWith("Clp")) {
            try {
                ClassLoader classLoader = ClpSerializer.class.getClassLoader();

                Method getClpSerializerClassMethod = oldModelClass.getMethod(
                        "getClpSerializerClass");

                Class<?> oldClpSerializerClass = (Class<?>) getClpSerializerClassMethod.invoke(oldModel);

                Class<?> newClpSerializerClass = classLoader.loadClass(oldClpSerializerClass.getName());

                Method translateOutputMethod = newClpSerializerClass.getMethod("translateOutput",
                        BaseModel.class);

                Class<?> oldModelModelClass = oldModel.getModelClass();

                Method getRemoteModelMethod = oldModelClass.getMethod("get" +
                        oldModelModelClass.getSimpleName() + "RemoteModel");

                Object oldRemoteModel = getRemoteModelMethod.invoke(oldModel);

                BaseModel<?> newModel = (BaseModel<?>) translateOutputMethod.invoke(null,
                        oldRemoteModel);

                return newModel;
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to translate " + oldModelClassName, t);
                }
            }
        }

        if (oldModelClassName.equals(
                    "com.liferay.pushnotifications.model.impl.PushNotificationsDeviceImpl")) {
            return translateOutputPushNotificationsDevice(oldModel);
        } else if (oldModelClassName.endsWith("Clp")) {
            try {
                ClassLoader classLoader = ClpSerializer.class.getClassLoader();

                Method getClpSerializerClassMethod = oldModelClass.getMethod(
                        "getClpSerializerClass");

                Class<?> oldClpSerializerClass = (Class<?>) getClpSerializerClassMethod.invoke(oldModel);

                Class<?> newClpSerializerClass = classLoader.loadClass(oldClpSerializerClass.getName());

                Method translateOutputMethod = newClpSerializerClass.getMethod("translateOutput",
                        BaseModel.class);

                Class<?> oldModelModelClass = oldModel.getModelClass();

                Method getRemoteModelMethod = oldModelClass.getMethod("get" +
                        oldModelModelClass.getSimpleName() + "RemoteModel");

                Object oldRemoteModel = getRemoteModelMethod.invoke(oldModel);

                BaseModel<?> newModel = (BaseModel<?>) translateOutputMethod.invoke(null,
                        oldRemoteModel);

                return newModel;
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to translate " + oldModelClassName, t);
                }
            }
        }

        return oldModel;
    }

    public static Object translateOutput(List<Object> oldList) {
        List<Object> newList = new ArrayList<Object>(oldList.size());

        for (int i = 0; i < oldList.size(); i++) {
            Object curObj = oldList.get(i);

            newList.add(translateOutput(curObj));
        }

        return newList;
    }

    public static Object translateOutput(Object obj) {
        if (obj instanceof BaseModel<?>) {
            return translateOutput((BaseModel<?>) obj);
        } else if (obj instanceof List<?>) {
            return translateOutput((List<Object>) obj);
        } else {
            return obj;
        }
    }

    public static Throwable translateThrowable(Throwable throwable) {
        if (_useReflectionToTranslateThrowable) {
            try {
                UnsyncByteArrayOutputStream unsyncByteArrayOutputStream = new UnsyncByteArrayOutputStream();
                ObjectOutputStream objectOutputStream = new ObjectOutputStream(unsyncByteArrayOutputStream);

                objectOutputStream.writeObject(throwable);

                objectOutputStream.flush();
                objectOutputStream.close();

                UnsyncByteArrayInputStream unsyncByteArrayInputStream = new UnsyncByteArrayInputStream(unsyncByteArrayOutputStream.unsafeGetByteArray(),
                        0, unsyncByteArrayOutputStream.size());

                Thread currentThread = Thread.currentThread();

                ClassLoader contextClassLoader = currentThread.getContextClassLoader();

                ObjectInputStream objectInputStream = new ClassLoaderObjectInputStream(unsyncByteArrayInputStream,
                        contextClassLoader);

                throwable = (Throwable) objectInputStream.readObject();

                objectInputStream.close();

                return throwable;
            } catch (SecurityException se) {
                if (_log.isInfoEnabled()) {
                    _log.info("Do not use reflection to translate throwable");
                }

                _useReflectionToTranslateThrowable = false;
            } catch (Throwable throwable2) {
                _log.error(throwable2, throwable2);

                return throwable2;
            }
        }

        Class<?> clazz = throwable.getClass();

        String className = clazz.getName();

        if (className.equals(PortalException.class.getName())) {
            return new PortalException();
        }

        if (className.equals(SystemException.class.getName())) {
            return new SystemException();
        }

        if (className.equals(
                    "com.liferay.pushnotifications.NoSuchApplicationException")) {
            return new com.liferay.pushnotifications.NoSuchApplicationException();
        }

        if (className.equals(
                    "com.liferay.pushnotifications.NoSuchApplicationPreferencesException")) {
            return new com.liferay.pushnotifications.NoSuchApplicationPreferencesException();
        }

        if (className.equals(
                    "com.liferay.pushnotifications.NoSuchAppVersionException")) {
            return new com.liferay.pushnotifications.NoSuchAppVersionException();
        }

        if (className.equals(
                    "com.liferay.pushnotifications.NoSuchDeviceException")) {
            return new com.liferay.pushnotifications.NoSuchDeviceException();
        }

        return throwable;
    }

    public static Object translateOutputApplication(BaseModel<?> oldModel) {
        ApplicationClp newModel = new ApplicationClp();

        newModel.setModelAttributes(oldModel.getModelAttributes());

        newModel.setApplicationRemoteModel(oldModel);

        return newModel;
    }

    public static Object translateOutputApplicationPreferences(
        BaseModel<?> oldModel) {
        ApplicationPreferencesClp newModel = new ApplicationPreferencesClp();

        newModel.setModelAttributes(oldModel.getModelAttributes());

        newModel.setApplicationPreferencesRemoteModel(oldModel);

        return newModel;
    }

    public static Object translateOutputAppVersion(BaseModel<?> oldModel) {
        AppVersionClp newModel = new AppVersionClp();

        newModel.setModelAttributes(oldModel.getModelAttributes());

        newModel.setAppVersionRemoteModel(oldModel);

        return newModel;
    }

    public static Object translateOutputPushNotificationsDevice(
        BaseModel<?> oldModel) {
        PushNotificationsDeviceClp newModel = new PushNotificationsDeviceClp();

        newModel.setModelAttributes(oldModel.getModelAttributes());

        newModel.setPushNotificationsDeviceRemoteModel(oldModel);

        return newModel;
    }
}


text:
import React, { Component } from 'react';
import { render } from 'react-dom'

import TxRegionsInput, { getMatchMarker, markers } from 'txregions';

const editableProps = { className: 'editable' };

const DemoA = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="Enter an email address"
        preset="email"
    />
);

const DemoB = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="Enter more than three characters and change the focus"
        maxLength="3"
    />
);

const DemoC = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="Enter a uint"
        validators={/\d+/}
    />
);

const DemoD = () => (
    <TxRegionsInput
        setEditableProps={{className: 'editable mad-styles'}}
        placeholder="Enter a numbers, e.g. -1,234 or 1.56"
        maxLength="10"
        preset="number"
        invalidClassName="mad-invalid"
    />
);

const DemoE = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="Invalid entries also mark a hidden input as :invalid"
        required
        defaultValue="This is not a valid URL"
        preset="url"
        input="url_form_name"
    />
);

const DemoF = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="3 to 10 in length"
        maxLength="10"
        minLength="3"
        defaultValue="This is too long"
    />
);

const DemoG = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="Enter an email address"
        preset="email"
        maxLength="64"
        minLength="3"
        required
    >

This value must be at least 3 characters in length.

This value is too long (the max length is 255).

This field is required.

Please enter a valid email address.

    </TxRegionsInput>
);

class DemoH extends Component {
    constructor(props) {
        super(props);
        this.state = {
            substringRx: /go all the way/gi
        };
        // this._substringInput = undefined;
        this.handleUpdateDynamicMarker = this.handleUpdateDynamicMarker.bind(this);
    }

    handleUpdateDynamicMarker(event) {
        event.preventDefault();
        const elements = event.target.elements;
        let rx;
        try {
            rx = new RegExp(elements.rxInput.value, 'gi');
        } catch (err) {
            console.error(err);
            return;
        }
        this.setState({substringRx: rx});
    }

    render() {
        return (

                    <form className="rx-form" onSubmit={this.handleUpdateDynamicMarker}>
                        /<input
                            type="text"
                            placeholder="find"
                            defaultValue="go all the way"
                            name="rxInput"
                        />/gi
                    </form>
                      Return to apply

                <TxRegionsInput
                    setEditableProps={editableProps}
                    defaultValue={`"If you're going to try, go all the way. Otherwise, don't even start. This could mean losing girlfriends, wives, relatives and maybe even your mind. It could mean not eating for three or four days. It could mean freezing on a park bench. It could mean jail. It could mean derision. It could mean mockery--isolation. Isolation is the gift. All the others are a test of your endurance, of how much you really want to do it. And, you'll do it, despite rejection and the worst odds. And it will be better than anything else you can imagine. If you're going to try, go all the way. There is no other feeling like that. You will be alone with the gods, and the nights will flame with fire. You will ride life straight to perfect laughter. It's the only good fight there is." -- Charles Bukowski, Factotum`}
                    dynamicMarkers
                    markers={getMatchMarker(this.state.substringRx, 'word-find')}
                />

        );
    }
}

const DemoI = () => (
    <TxRegionsInput
        setEditableProps={editableProps}
        placeholder="All your base are belong to us"
        defaultValue="An email address: example@example.com, and a couple of URLs: google.com, https://www.google.com"
        markers={[markers.email, markers.urls]}
    />
);

class DemoJ extends Component {
    constructor(props) {
        super(props);
        this.state = { value: null };
        this.handleSetValue = this.handleSetValue.bind(this);
        this.handleRawChange = this.handleRawChange.bind(this);
    }

    handleSetValue(event) {
        event.preventDefault();
        const elements = event.target.elements;
        this.setState({ value: elements.valueInput.value });
    }

    handleRawChange(data) {
        this.setState({ value: data.raw });
    }

    render() {
        return (

                    <form className="set-value-form" onSubmit={this.handleSetValue}>
                        <input
                            type="text"
                            defaultValue="Hello World"
                            name="valueInput"
                        />
                    </form>
                      Return to apply

                <TxRegionsInput
                    setEditableProps={editableProps}
                    placeholder="controlled"
                    maxLength="10"
                    value={this.state.value}
                    onRawChange={this.handleRawChange}
                />

        );
    }
}

const demos = [
    [<DemoA />, 'js-demo-a'],
    [<DemoB />, 'js-demo-b'],
    [<DemoC />, 'js-demo-c'],
    [<DemoD />, 'js-demo-d'],
    [<DemoE />, 'js-demo-e'],
    [<DemoF />, 'js-demo-f'],
    [<DemoG />, 'js-demo-g'],
    [<DemoH />, 'js-demo-h'],
    [<DemoI />, 'js-demo-i'],
    [<DemoJ />, 'js-demo-j']
];

demos.forEach(([component, id]) => {
    render(component, document.getElementById(id));
});

document.getElementById('js-main-section').removeAttribute('hidden');

redpajama_set_name: RedPajamaGithub


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycotaxon 63: 133 (1997)

#### Original name
Endogone aurantiaca Blaszk., 1997

### Remarks
null


text:
<?php

namespace OOUI\Tests;

use OOUI\Theme;
use OOUI\WikimediaUITheme;

class TestCase extends \PHPUnit\Framework\TestCase {
	/**
	 * Subclasses can override
	 * @return Theme
	 */
	protected function getTheme() {
		return new WikimediaUITheme();
	}

	public function setUp(): void {
		parent::setUp();
		Theme::setSingleton( $this->getTheme() );
	}

	public function tearDown(): void {
		Theme::setSingleton( null );
		parent::tearDown();
	}
}


text:
[![Build Status](https://travis-ci.org/drupal-media/entity_browser.svg?branch=8.x-1.x)](https://travis-ci.org/drupal-media/entity_browser) [![Scrutinizer](https://img.shields.io/scrutinizer/g/drupal-media/entity_browser.svg)](https://scrutinizer-ci.com/g/drupal-media/entity_browser)

Provides standardized interface to list, create and select entities.

## Requirements

* Latest dev release of Drupal 8.x.
* [Chaos tool set](https://drupal.org/project/ctools) (soft dependency for configuration UI)

## Configuration

Module ships with a simple configuration UI which allows you to create, edit
and delete entity browsers. It depends on
[Chaos tool set](https://drupal.org/project/ctools). Enable it and navigate to
/admin/config/content/entity_browser.

In order to use this configuration for testing or to help you contribute just
enable "Entity Browser example" module (entity_browser_example).

## Technical details

Architecture details can be found on [architecture meta-issue.](https://www.drupal.org/node/2289821).

## Maintainers
 - Janez Urevc (@slashrsm) drupal.org/user/744628
 - Primož Hmeljak (@primsi) drupal.org/user/282629


text:
using Xunit;

namespace SyncTool.FileSystem.Test
{
    /// <summary>
    /// Tests for <see cref="PathParser"/>
    /// </summary>
    public class PathParserTest
    {
        [Fact]
        public void GetFileName_returns_expected_result()
        {
            Assert.Equal("file", PathParser.GetFileName("file"));
            Assert.Equal("file", PathParser.GetFileName("/file"));
            Assert.Equal("file", PathParser.GetFileName("/root/file"));
            Assert.Equal("file", PathParser.GetFileName("dir/file"));
        }

        [Fact]
        public void GetDirectoryName_returns_expected_result()
        {
            Assert.Equal("", PathParser.GetDirectoryName("file"));
            Assert.Equal("/", PathParser.GetDirectoryName("/file"));
            Assert.Equal("/root", PathParser.GetDirectoryName("/root/file"));
            Assert.Equal("dir", PathParser.GetDirectoryName("dir/file"));
        }
    }
}


text:
\def \indexFooter{Index of CITES Species}
\def \historyFooter{History of CITES listings}
\def \indexIntroductionFile{../../public/latex/index_introduction_en.pdf}
\def \historyIntroductionFile{../../public/latex/history_introduction_en.pdf}
\def \hashAnnotationsHistoryInfo{
\noindent Annotations are used in the CITES Appendices to indicate which population, parts or derivatives are concerned by the listing or to clarify its scope. The meaning of these annotations has changed over the years. Below is a historical summary of these meanings, with the date when they became valid and the meeting of the Conference of the Parties (CoP) at which they were adopted. For instance, annotation "\#1" originally simply designated "roots", while it now designates:
\vspace{15pt}

\begin{adjustwidth}{1.5cm}{}
All parts and derivatives, except:
\begin{enumerate}[a)]
\item seeds, spores and pollen (including pollinia);
\item seedling or tissue cultures obtained in vitro, in solid or liquid media, transported in sterile containers;
\item cut flowers of artificially propagated plants; and
\item fruits, and parts and derivatives thereof, of artificially propagated plants of the genus \textit{Vanilla}.
\end{enumerate}
\end{adjustwidth}
\vspace{15pt}

\noindent The validity dates indicated in the table below refer to the dates of entry into effect of new Appendices I and II, that is 90 days after each meeting of the Conference of Parties (CoP). Since inclusions in Appendix III may be made at any time, however, annotations specific to species included in that Appendix may have come into force later than 90 days after the CoP they appear under. For instance, annotation \#13 listed under the CoP15 section below (valid from 23 June 2010) is linked to the inclusion of a species in Appendix III that entered into force on 14 October 2010. Such cases are very rare and, in any case, the date of entry into force of any annotation is indicated in the History of CITES Listings next to the species it applies to.
}


text:
package api_test

import (
	"errors"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	. "github.com/sclevine/agouti/api"
	"github.com/sclevine/agouti/api/internal/mocks"
	. "github.com/sclevine/agouti/internal/matchers"
)

var _ = Describe("Element", func() {
	var (
		bus     *mocks.Bus
		session *Session
		element *Element
	)

	BeforeEach(func() {
		bus = &mocks.Bus{}
		session = &Session{bus}
		element = &Element{"some-id", session}
	})

	Describe("#Send", func() {
		It("should successfully send a request to the provided endpoint", func() {
			Expect(element.Send("method", "endpoint", "body", nil)).To(Succeed())
			Expect(bus.SendCall.Method).To(Equal("method"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/endpoint"))
			Expect(bus.SendCall.BodyJSON).To(MatchJSON(`"body"`))
		})

		It("should retrieve the result", func() {
			var result string
			bus.SendCall.Result = `"some result"`
			Expect(element.Send("method", "endpoint", "body", &result)).To(Succeed())
			Expect(result).To(Equal("some result"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				err := element.Send("method", "endpoint", "body", nil)
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetElement", func() {
		It("should successfully send a POST request to the element endpoint", func() {
			_, err := element.GetElement(Selector{"css selector", "#selector"})
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("POST"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/element"))
			Expect(bus.SendCall.BodyJSON).To(MatchJSON(`{"using": "css selector", "value": "#selector"}`))
		})

		It("should return an element with an ID and session", func() {
			bus.SendCall.Result = `{"ELEMENT": "some-id"}`
			singleElement, err := element.GetElement(Selector{})
			Expect(err).NotTo(HaveOccurred())
			Expect(singleElement.ID).To(Equal("some-id"))
			Expect(singleElement.Session).To(ExactlyEqual(session))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.GetElement(Selector{"css selector", "#selector"})
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetElements", func() {
		It("should successfully send a POST request to the elements endpoint", func() {
			_, err := element.GetElements(Selector{"css selector", "#selector"})
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("POST"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/elements"))
			Expect(bus.SendCall.BodyJSON).To(MatchJSON(`{"using": "css selector", "value": "#selector"}`))
		})

		It("should return a slice of elements with IDs and sessions", func() {
			bus.SendCall.Result = `[{"ELEMENT": "some-id"}, {"ELEMENT": "some-other-id"}]`
			elements, err := element.GetElements(Selector{"css selector", "#selector"})
			Expect(err).NotTo(HaveOccurred())
			Expect(elements[0].ID).To(Equal("some-id"))
			Expect(elements[0].Session).To(ExactlyEqual(session))
			Expect(elements[1].ID).To(Equal("some-other-id"))
			Expect(elements[1].Session).To(ExactlyEqual(session))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.GetElements(Selector{"css selector", "#selector"})
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetText", func() {
		It("should successfully send a GET request to the text endpoint", func() {
			_, err := element.GetText()
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/text"))
		})

		It("should return the visible text on the element", func() {
			bus.SendCall.Result = `"some text"`
			text, err := element.GetText()
			Expect(err).NotTo(HaveOccurred())
			Expect(text).To(Equal("some text"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error indicating the bus failed to retrieve the text", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.GetText()
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetName", func() {
		It("should successfully send a GET request to the name endpoint", func() {
			_, err := element.GetName()
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/name"))
		})

		It("should return the tag name of the element", func() {
			bus.SendCall.Result = `"some-name"`
			text, err := element.GetName()
			Expect(err).NotTo(HaveOccurred())
			Expect(text).To(Equal("some-name"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error indicating the bus failed to retrieve the tag name", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.GetName()
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetAttribute", func() {
		It("should successfully send a GET request to the attribute/some-name endpoint", func() {
			_, err := element.GetAttribute("some-name")
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/attribute/some-name"))
		})

		It("should return the value of the attribute", func() {
			bus.SendCall.Result = `"some value"`
			value, err := element.GetAttribute("")
			Expect(err).NotTo(HaveOccurred())
			Expect(value).To(Equal("some value"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.GetAttribute("some-name")
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetCSS", func() {
		It("should successfully send a GET request to the css/some-property endpoint", func() {
			_, err := element.GetCSS("some-property")
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/css/some-property"))
		})

		It("should return the value of the CSS property", func() {
			bus.SendCall.Result = `"some value"`
			value, err := element.GetCSS("some-property")
			Expect(err).NotTo(HaveOccurred())
			Expect(value).To(Equal("some value"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.GetCSS("some-property")
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#Click", func() {
		It("should successfully send a POST request to the click endpoint", func() {
			Expect(element.Click()).To(Succeed())
			Expect(bus.SendCall.Method).To(Equal("POST"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/click"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				Expect(element.Click()).To(MatchError("some error"))
			})
		})
	})

	Describe("#Clear", func() {
		It("should successfully send a POST request to the clear endpoint", func() {
			Expect(element.Clear()).To(Succeed())
			Expect(bus.SendCall.Method).To(Equal("POST"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/clear"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				Expect(element.Clear()).To(MatchError("some error"))
			})
		})
	})

	Describe("#Value", func() {
		It("should successfully send a POST request to the value endpoint", func() {
			Expect(element.Value("text")).To(Succeed())
			Expect(bus.SendCall.Method).To(Equal("POST"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/value"))
			Expect(bus.SendCall.BodyJSON).To(MatchJSON(`{"value": ["t", "e", "x", "t"]}`))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				Expect(element.Value("text")).To(MatchError("some error"))
			})
		})
	})

	Describe("#IsSelected", func() {
		It("should successfully send a GET request to the selected endpoint", func() {
			_, err := element.IsSelected()
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/selected"))
		})

		It("should return the selected status", func() {
			bus.SendCall.Result = "true"
			value, err := element.IsSelected()
			Expect(err).NotTo(HaveOccurred())
			Expect(value).To(BeTrue())
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.IsSelected()
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#IsDisplayed", func() {
		It("should successfully send a GET request to the displayed endpoint", func() {
			_, err := element.IsDisplayed()
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/displayed"))
		})

		It("should return the displayed status", func() {
			bus.SendCall.Result = "true"
			value, err := element.IsDisplayed()
			Expect(err).NotTo(HaveOccurred())
			Expect(value).To(BeTrue())
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.IsDisplayed()
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#IsEnabled", func() {
		It("should successfully send a GET request to the enabled endpoint", func() {
			_, err := element.IsEnabled()
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/enabled"))
		})

		It("should return the enabled status", func() {
			bus.SendCall.Result = "true"
			value, err := element.IsEnabled()
			Expect(err).NotTo(HaveOccurred())
			Expect(value).To(BeTrue())
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.IsEnabled()
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#Submit", func() {
		It("should successfully send a POST request to the submit endpoint", func() {
			Expect(element.Submit()).To(Succeed())
			Expect(bus.SendCall.Method).To(Equal("POST"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/submit"))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				Expect(element.Submit()).To(MatchError("some error"))
			})
		})
	})

	Describe("#IsEqualTo", func() {
		It("should successfully send a GET request to the equals/other-id endpoint", func() {
			otherElement := &Element{"other-id", session}
			_, err := element.IsEqualTo(otherElement)
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/equals/other-id"))
		})

		It("should return whether the elements are equal", func() {
			bus.SendCall.Result = "true"
			equal, err := element.IsEqualTo(&Element{})
			Expect(err).NotTo(HaveOccurred())
			Expect(equal).To(BeTrue())
		})

		Context("when the other element is nil", func() {
			It("should return an error", func() {
				_, err := element.IsEqualTo(nil)
				Expect(err).To(MatchError("nil element is invalid"))
			})
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error", func() {
				bus.SendCall.Err = errors.New("some error")
				_, err := element.IsEqualTo(&Element{})
				Expect(err).To(MatchError("some error"))
			})
		})
	})

	Describe("#GetLocation", func() {
		It("should successfully send a GET request to the location endpoint", func() {
			_, _, err := element.GetLocation()
			Expect(err).NotTo(HaveOccurred())
			Expect(bus.SendCall.Method).To(Equal("GET"))
			Expect(bus.SendCall.Endpoint).To(Equal("element/some-id/location"))
		})

		It("should return the rounded location of the element", func() {
			bus.SendCall.Result = `{"x": 100.7, "y": 200}`
			x, y, err := element.GetLocation()
			Expect(err).NotTo(HaveOccurred())
			Expect(x).To(Equal(101))
			Expect(y).To(Equal(200))
		})

		Context("when the bus indicates a failure", func() {
			It("should return an error indicating the bus failed to retrieve the location", func() {
				bus.SendCall.Err = errors.New("some error")
				_, _, err := element.GetLocation()
				Expect(err).To(MatchError("some error"))
			})
		})
	})
})


text:
namespace base {
class Thread;
}  // namespace base

namespace viz {
class OutputSurfaceProvider;
class FrameSinkManagerImpl;
class ServerSharedBitmapManager;

#if defined(OS_ANDROID)
using VizCompositorThreadType = base::android::JavaHandlerThread;
#else
using VizCompositorThreadType = base::Thread;
#endif

class VizCompositorThreadRunnerImpl : public VizCompositorThreadRunner {
 public:
  VizCompositorThreadRunnerImpl();

  VizCompositorThreadRunnerImpl(const VizCompositorThreadRunnerImpl&) = delete;
  VizCompositorThreadRunnerImpl& operator=(
      const VizCompositorThreadRunnerImpl&) = delete;

  // Performs teardown on thread and then stops thread.
  ~VizCompositorThreadRunnerImpl() override;

  // VizCompositorThreadRunner overrides.
  base::SingleThreadTaskRunner* task_runner() override;
  base::PlatformThreadId thread_id() override;
  void CreateFrameSinkManager(mojom::FrameSinkManagerParamsPtr params) override;
  void CreateFrameSinkManager(
      mojom::FrameSinkManagerParamsPtr params,
      gpu::CommandBufferTaskExecutor* task_executor,
      GpuServiceImpl* gpu_service,
      HintSessionFactory* hint_session_factory) override;

 private:
  void CreateFrameSinkManagerOnCompositorThread(
      mojom::FrameSinkManagerParamsPtr params,
      gpu::CommandBufferTaskExecutor* task_executor,
      GpuServiceImpl* gpu_service,
      HintSessionFactory* hint_session_factory);
  void TearDownOnCompositorThread();

  // Start variables to be accessed only on |task_runner_|.
  std::unique_ptr<ServerSharedBitmapManager> server_shared_bitmap_manager_;
  std::unique_ptr<OutputSurfaceProvider> output_surface_provider_;
  std::unique_ptr<FrameSinkManagerImpl> frame_sink_manager_;
  // End variables to be accessed only on |task_runner_|.

  std::unique_ptr<VizCompositorThreadType> thread_;
  scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
};

}  // namespace viz

#endif  // COMPONENTS_VIZ_SERVICE_MAIN_VIZ_COMPOSITOR_THREAD_RUNNER_IMPL_H_


text:
get_envs() { find $SNAP_DATA $SNAP_COMMON -maxdepth 1 -regex '.*\.env$'; }

init_user_environment_variables() {
  # Check both $SNAP_COMMON and $SNAP_DATA
  # I was hoping this to work without a for loop like this
  # find $SNAP_COMMON $SNAP_DATA -maxdepth 1 -regex '.*\.env$' \
  #  | while read filename; do source $filename; done
  set -a; for filename in `get_envs`; do source $filename; done; set +a
}

# list migration scripts based on where it's called (pre-refresh/post-refresh)
get_migrations() { local __=${0##*/}; find -L $SNAP/migrations/${__/-/_} -perm /111 -type f; }


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

using ArkNet.Model.BaseModels;

namespace ArkNet.Model.Account
{
    /// <summary>
    /// Extends the <see cref="ArkResponseBase"/> type for the Ark Account Balance response model.
    /// </summary>
    ///
    public class ArkAccountBalance : ArkResponseBase
    {
        /// <summary>
        /// Unconfirmed balance of the account.
        /// </summary>
        ///
        /// <value>Gets/sets the value as an <see cref="long"/>.</value>
        ///
        public long UnconfirmedBalance { get; set; }

        /// <summary>
        /// Balance of the account.
        /// </summary>
        ///
        /// <value>Gets/sets the value as a <see cref="long"/>.</value>
        ///
        public long Balance { get; set; }
    }
}


text:
require 'gooddata/rest/rest'

describe GoodData::Rest::Resource do
end


text:
var toString = require('../lang/toString');
var truncate = require('./truncate');
/**
 * Truncate string at full words.
 */
function crop(str, maxChars, append) {
    str = toString(str);
    return truncate(str, maxChars, append, true);
}

module.exports = crop;


text:
import json

from keystoneauth1.identity.generic import password
from keystoneauth1 import session
from zaqarclient.queues.v2 import client as zaqarclient

from nabu import context
from nabu.db import api
from nabu import service

class EventDispatcher(object):
    """Dispatcher class to send event to Zaqar.

    This dispatcher looks up for subscriptions in the Nabu database, and send
    matching events to the configured Zaqar queue.

    To enable this dispatcher, the following section needs to be present in
    ceilometer.conf file

    [DEFAULT]
    event_dispatchers = nabu
    """
    def __init__(self, conf):
        self.context = context.DispatcherContext()
        self.nabu_conf = service.prepare_service([])
        self.api = api.SubscriptionAPI(self.context, self.nabu_conf)
        self._endpoint = None

    @property
    def endpoint(self):
        if self._endpoint is None:
            conf = self.nabu_conf.keystone_authtoken
            auth_plugin = password.Password(
                username=conf.username,
                password=conf.password,
                auth_url=conf.auth_url,
                project_name=conf.project_name)
            sess = session.Session(auth=auth_plugin)
            self._endpoint = sess.get_endpoint(service_type='messaging')
        return self._endpoint

    def record_events(self, events):
        if not isinstance(events, list):
            events = [events]

        for event in events:
            ids = [trait[2] for trait in event['traits']
                   if trait[0] == 'project_id']
            if len(ids) != 1:
                # Nothing we can do with that event
                continue
            project_id = ids[0]
            ids = [trait[2] for trait in event['traits']
                   if trait[0] == 'instance_id']
            instance_id = ids[0] if len(ids) == 1 else None
            subscribers = self.api.match(project_id, event['event_type'],
                                         instance_id)
            for sub in subscribers:
                self._send(sub, event)

    def _send(self, subscriber, event):
        """Send event data to the given subscriber using Zaqar."""
        data = json.loads(subscriber.signed_url_data)
        opts = {
            'paths': data['paths'],
            'expires': data['expires'],
            'methods': data['methods'],
            'signature': data['signature'],
            'os_project_id': data['project'],
        }
        auth_opts = {'backend': 'signed-url',
                     'options': opts}
        conf = {'auth_opts': auth_opts}
        client = zaqarclient.Client(url=self.endpoint, conf=conf, version=2)
        queue = client.queue(subscriber.target, auto_create=False)
        queue.post({'body': event, 'ttl': subscriber.message_ttl})


text:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="vertical"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/topFrame"
        android:layout_weight="3.5"
        android:isScrollContainer="true">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <EditText
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/etHouseName"
                android:hint="@string/etHouseHint"
                android:padding="5sp"
                android:imeOptions="actionDone"
                android:lines="1"
                android:maxLines="1"
                android:inputType="textCapWords" />
            <EditText
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/etReviewerName"
                android:hint="@string/etReviewerHint"
                android:padding="5sp"
                android:lines="1"
                android:maxLines="1"
                android:imeOptions="actionDone"
                android:inputType="textCapWords" />
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
                <Spinner
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/spinDepartments"
                    android:entries="@array/DepartmentSpinner"
                    android:layout_weight="2"></Spinner>
                <Spinner
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/spinTitles"
                    android:layout_weight="1"
                    android:entries="@array/Titles"></Spinner>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <fragment class="org.trinity_services.cleaningchecklist.views.MainFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/mainFragment"
        android:layout_weight="1.5"></fragment>
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:background="@color/Trinity_Green"
        android:layout_weight="4"
        android:orientation="horizontal">

        <ImageButton
            android:src="@drawable/dyn_submit_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imgSubmitList"
            android:background="@null"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imgbtnComment"
            android:src="@drawable/dyn_comment_button"
            android:background="@null"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    </RelativeLayout>

</LinearLayout>


text:
%% BTH Dissertation Style 2 (see https://github.com/CaterHatterPillar/bth-dissertation-style-2)
%% Blekinge Institute of Technology alternative dissertation/thesis template. See https://github.com/CaterHatterPillar/bth-dissertation-style for a style resembling the official, close-source, dissertation template commonly used in BTH computer science theses.
%%
%% Based on the ILLC Dissertation Style by the Institute for Logic, Language and Computation, University of Amsterdam (used with permission).
%% Licensed under the BSD 3-Clause License. See adjoined LICENSE for more information.
%% Currently maintained by Eric Nilsson.
%%
%% Version: June 29, 2014.
%%

\thispagestyle{plain}
\mbox{}

\vspace{2in}

% TODO: inser optional dedication.
\begin{center}
	{\em
		To my Sun\\
		and Stars
	}
\end{center}


text:
import unittest

import rugby_rankings.weighting_high_score

class TestWeightingHighScore(unittest.TestCase):

    def test_high_score(self):

        weighting = rugby_rankings.weighting_high_score.WeightingHighScore(10, 15)
        self.assertEqual(1, weighting.apply(1))

        weighting = rugby_rankings.weighting_high_score.WeightingHighScore(15, 10)
        self.assertEqual(1, weighting.apply(1))

        weighting = rugby_rankings.weighting_high_score.WeightingHighScore(0, 15)
        self.assertEqual(1, weighting.apply(1))

        weighting = rugby_rankings.weighting_high_score.WeightingHighScore(0, 16)
        self.assertEqual(1.5, weighting.apply(1))

        weighting = rugby_rankings.weighting_high_score.WeightingHighScore(100, 84)
        self.assertEqual(1.5, weighting.apply(1))


text:
Eva
===

Eva catalog module


text:
Given(/^we have no local copy of the "(.*?)" file$/) do |f|
  @f = f
end

Given(/^we have a string "(.*?)"$/) do |input|
  @input = input
end

Given(/^we have a cyrillic string "(.*?)"$/) do |input|
  @input = input
end

Given(/^we have a pattern "(.*?)"$/) do |pattern|
  @pattern = pattern
end

Given(/^we have a pattern looking like a tag$/) do
  @pattern = /<.*?>/
end

Given(/^we have a symbol "(.*?)"$/) do |symbol|
  @input = symbol
end

Given(/^we have a symbol with codebase "(.*?)"$/) do |cb|
  @input = cb.to_i(16)
end

###############################################################################
#####    WHEN
###############################################################################

When(/^we call "(.*?)" method on Forkforge::Unicode$/) do |method|
  @output = Forkforge::Unicode::send method.to_sym, @input
end

When(/^we ask to print known conditions$/) do
  @output = Forkforge::SpecialCasing.all_condition_list.map { |k, v|
    v.map { |vv|
      vv[:condition_list]
    }
  }.flatten.uniq
end

When(/^the string is upcased with language set to "(.*?)"$/) do |lang|
  @output = Forkforge::Unicode::uppercase @input, lang
end

When(/^the string is downcased with language set to "(.*?)"$/) do |lang|
  @output = Forkforge::Unicode::lowercase @input, lang
end

When(/^the string is upcased$/) do
  @output = Forkforge::Unicode::uppercase @input
end

When(/^we decompose it$/) do
  @output = Forkforge::Unicode::decompose @input
end

When(/^we decompose it with circle tag only$/) do
  @output = Forkforge::Unicode::decompose @input, :circle
end

When(/^the string is downcased$/) do
  @output = Forkforge::Unicode::lowercase @input
end

When(/^the string is titlecased$/) do
  @output = Forkforge::Unicode::titlecase @input
end

When(/^we call all_character_decomposition_mapping on Forkforge::UnicodeData$/) do
  @output = Forkforge::UnicodeData::all_character_decomposition_mapping
end

When(/^we call "(.*?)" method on Forkforge::Letter$/) do |method|
  @output = Forkforge::Letter::send :"#{method}"
end

When(/^we call uppercase_code_point on Forkforge::Letter$/) do
  @output = Forkforge::Letter::uppercase_code_point
end

When(/^we call "(.*?)" method on Forkforge::Mark$/) do |method|
  @output = Forkforge::Mark::send :"#{method}"
end

When(/^we call "(.*?)" method on Forkforge::Number$/) do |method|
  @output = Forkforge::Number::send :"#{method}"
end

When(/^we call "(.*?)" method on Forkforge::Punctuation$/) do |method|
  @output = Forkforge::Punctuation::send :"#{method}"
end

When(/^we call "(.*?)" method on Forkforge::Symbol$/) do |method|
  @output = Forkforge::Symbol::send :"#{method}"
end

When(/^we call "(.*?)" method on Forkforge::Separator$/) do |method|
  @output = Forkforge::Separator::send :"#{method}"
end

When(/^we call "(.*?)" method on Forkforge::Other$/) do |method|
  @output = Forkforge::Other::send :"#{method}"
end

When(/^lookup using all_character_name is done with this pattern$/) do
  @output = Forkforge::UnicodeData::all_character_name Regexp.new @pattern
end

When(/^lookup is done with this pattern$/) do
  @output = Forkforge::Unicode::lookup Regexp.new @pattern, Regexp::IGNORECASE
end

When(/^result is filtered to show tags$/) do
  @output = Forkforge::TaggedCharacterName::ALL
end

When(/^result is filtered to show tagged characters$/) do
  @output = Forkforge::TaggedCharacterName::CHARACTERS
end

When(/^result is set to response from "(.*?)" function call$/) do |method|
  @output = Forkforge::TaggedCharacterName::send :"#{method}"
end

When(/^we retrieve it's info$/) do
  @output = Forkforge::UnicodeData::info(@input)[:character_name]
end

When(/^we add custom decomposition rule$/) do
  @pending # Will be implemented after core is done
end

When(/^we construct Tag object against it$/) do
  @output = Forkforge::CharacterDecompositionMapping::Tag.new @input
end

When(/^we compose input to "(.*?)"$/) do |tag|
  @output = (Forkforge::Unicode::compose @input, "#{tag}").values.join(',')
end

When(/^we widify input$/) do
  @output = Forkforge::Unicode::wide @input
end

When(/^we circlefy input$/) do
  @output = Forkforge::Unicode::circle @input
end

When(/^we call "(.*?)" method on Forkforge::CodePoints for "(.*?)"$/) do |method, sym|
  @output = Forkforge::UnicodeData::code_points.send(method.to_sym, sym)
end

When(/^the string is directly widefied$/) do
  @output = @input.compose_wide
end

When(/^the string is directly upcased$/) do
  @output = @input.upcase
end

###############################################################################
#####    THEN
###############################################################################

Then(/^the file is got from www.unicode.org\/Public\/5.1.0\/ucd\/UnicodeData.txt is printed out$/) do
  @hash = Forkforge::UnicodeData.send :hash # just here for testing purposes, method is private
  puts @hash.take 2
end

Then(/^the result is "(.*?)"$/) do |result|
  expect(@output).to eq(result)
end

Then(/^the result to string is "(.*?)"$/) do |result|
  expect(@output.to_s).to eq(result)
end

Then(/^the result count equals to (\d+)$/) do |count|
  expect(@output.count).to eq(count.to_i)
end

Then(/^the first item equals to "(.*?)"$/) do |string|
  expect(@output[0]).to eq(string)
end

Then(/^the first item's value equals to "(.*?)"$/) do |string|
  expect(@output.values[0]).to eq(string)
end

Then(/^the result's first element nested count is "(.*?)"$/) do |count|
  expect(@output.values[0].count).to eq(count.to_i)
end

Then(/^we print first (\d+) results$/) do |count|
  puts @output.take count.to_i
end

Then(/^we print results$/) do
  puts @output
end

Then(/^we print a result count$/) do
  puts @output.count
end

Then(/^both sym and tag have correct values$/) do
  expect(@output.tag).to eq('<font>')
  expect(@output.sym).to eq(:font)
  expect(@output.valid?).to eq(true)
end

Then(/^both sym and tag have nil values$/) do
  expect(@output.tag).to eq(nil)
  expect(@output.sym).to eq(nil)
  expect(@output.valid?).to eq(false)
end


text:
2nd-7th Floor

             <img src="<?php echo base_url() ?>\uploads\AT2-7_1.jpg" class="img-responsive img-thumbnail animated bounceIn" alt="intermark" width="100%">

           <img src="<?php echo base_url() ?>\uploads\AT2-7_2.jpg" class="img-responsive img-thumbnail" alt="intermark" width="100%">

         <img src="<?php echo base_url() ?>\uploads\AT2-7_3.jpg" class="img-responsive img-thumbnail animated bounceIn" alt="intermark" width="100%">

       <img src="<?php echo base_url() ?>\uploads\AT2-7_4.jpg" class="img-responsive img-thumbnail animated bounceIn" alt="intermark" width="100%">

     <img src="<?php echo base_url() ?>\uploads\AT2-7_5.jpg" class="img-responsive img-thumbnail animated bounceIn" alt="intermark" width="100%">

      <img src="<?php echo base_url() ?>\uploads\AT_logo.png" class="img-responsive animated slideInRight" alt="intermark" width="100%">

Intermark Indonesia © 2017, All Rights Reserved

        The informations displayed about this property compromises a property advertisement
        Please contact the selling agent or developer directly to obtain any information, which may be available under terms of the application law

        <button type="button" class="close" data-dismiss="modal">×Close</button>

          <button type="button" class="btn btn-primary" id="show-previous-image">Previous</button>

          This text will be overwritten by jQuery

          <button type="button" id="show-next-image" class="btn btn-default">Next</button>


text:
package com.wci.umls.server.model.meta;

/**
 * Represents a language without a locale.
 */
public interface Language extends Abbreviation {

  /**
   * Returns the ISO code.
   *
   * @return the ISO code
   */
  public String getISOCode();

  /**
   * Sets the ISO code.
   *
   * @param isoCode the ISO code
   */
  public void setISOCode(String isoCode);

  /**
   * Returns the iS o3 code.
   *
   * @return the iS o3 code
   */
  public String getISO3Code();

  /**
   * Sets the ISO 3 code.
   *
   * @param iso3Code the IS o3 code
   */
  public void setISO3Code(String iso3Code);

}


text:
@implementation FUUpdatePreferences

- (IBAction)checkForUpdates:(id)sender {
//    [[[FUApplication instance] updater] checkForUpdates:self];
}

@end


text:
'use strict';

/*
 * Module dependencies.
 */
var http = require("http")
  , url = require("url")
  , cluster = require('cluster')
  , WebSocketServer = require('websocket').server
  , EventEmitter = require('events').EventEmitter
  , util = require('util');

/**
 * Expose `WebsocketBroker` constructor.
 */
if (typeof(module) != "undefined" && typeof(exports) != "undefined") {
  exports = module.exports = WebsocketBroker;
}

/**
 * Initialize a new `WebsocketBroker` with the given `options`.
 *
 * @param {Object} options
 * @api private
 */
function WebsocketBroker(options) {
  // Superclass Constructor
  EventEmitter.call(this);

  options = options || {};
  this.clientsPath = [];
  this.host = options.host || 'localhost';
  this.port = options.port || 8000;
  this.endpoint = options.endpoint || null;
  this.thingid = options.thingid || '5550937980d51931b3000009';
  this.wsServer = null;
  this.httpServer = null;
}

util.inherits(WebsocketBroker, EventEmitter);

/**
 * Initialize a new `WebsocketBroker` with the given `options`.
 *
 * @param {Object} request
 * @param {Object} response
 * @api private
 */
WebsocketBroker.prototype.onRequest = function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end();
};

/**
 * Initialize a new `WebsocketBroker` with the given `options`.
 *
 * @param {String} path
 * @param {Object} data
 * @api private
 */

WebsocketBroker.prototype.dispatchData = function(path, data) {
  var connections = this.clientsPath[path];

  if (typeof(connections) === 'undefined')
    return;

  for (var i = 0; i < connections.length; i++) {
    connections[i].sendUTF(data);
  }
};

/**
 * Initialize a new `WebsocketBroker` with the given `options`.
 *
 * @param {Object} request
 * @param {Object} response
 * @api private
 */

WebsocketBroker.prototype.dispatchStatus = function(path, data) {
  var connections = this.clientsPath[path];

  if (typeof connections === 'undefined')
    return;

  for (var i = 0; i < connections.length; i++) {
    connections[i].sendUTF(data);
  }
};

/**
 * Start the Websocket server.
 *
 * @param {Object} route
 * @return {}
 * @api public
 */
WebsocketBroker.prototype.start = function(route, handlers) {
  var self = this;

  // Use options or environment variables
  var port = self.port || process.env['PORT'];
  var host = self.host || process.env['HOST'];
  var endpoint = self.endpoint || process.env['ENDPOINT'];

  // Update attributes
  this.port = port;
  this.host = host;
  this.endpoint = endpoint;

  var httpServer = http.createServer(this.onRequest).listen(port, host, function() {
      console.info('node is running at ws://' + self.host + ':' + self.port);
  });

  var wsServer = new WebSocketServer({
    httpServer: httpServer,
    autoAcceptConnections: false
  });

  this.httpServer = httpServer;
  this.wsServer = wsServer;

  /**
   * handlers
   */
  var onWsRequest = function(request) {
    var connection = request.accept('', request.origin);

    // bind information
    connection.server = self;

    route(request.resource, connection, handlers, self.clientsPath);

    // register this thing
    self.emit('newThing', {
      name: connection.pathname
    });

    connection.on('message', onWsConnMessage);
    connection.on('close', onWsConnClose);

    if (typeof (connection.statusViewer) !== 'undefined')
      self.dispatchStatus(connection.statusViewer, JSON.stringify({ isAlive: true }));
  };

  var onWsConnMessage = function(message) {
    // Dispatching request message
    self.emit('data', {
      data: message.utf8Data,
      pathname: this.pathname
    });

    // Is it a sender ? Yes, then push data to all viewers.
    if (typeof (this.viewer) !== 'undefined')
      self.dispatchData(this.viewer, message.utf8Data);

    if (typeof (this.statusViewer) !== 'undefined')
      self.dispatchStatus(this.statusViewer, JSON.stringify({ isAlive: true }));
  };

  var onWsConnect = function(webSocketConnection) {
  };

  var onWsConnClose = function(reasonCode, description) {
    if (typeof (this.statusViewer) !== 'undefined')
        self.dispatchStatus(this.statusViewer, JSON.stringify({ isAlive: false }));
  };

  wsServer.on('request', onWsRequest);
  wsServer.on('connect', onWsConnect);
};

/**
 * Shutdown the Websocket server.
 *
 * @param cb {Function} The complete callback
 * @return {}
 * @api public
 */
WebsocketBroker.prototype.shutdown = function(cb) {
    var self = this;

    this.httpServer.close(function() {
        self.wsServer.shutDown();
        if (typeof cb === 'function') return cb();
    });
};


text:
namespace agent {
namespace asan {
namespace heaps {

// A block heap that wraps a raw heap.
class SimpleBlockHeap : public BlockHeapInterface {
 public:
  // Constructor.
  // @param heap Is the underlying raw heap that will be used by this heap.
  explicit SimpleBlockHeap(HeapInterface* heap);

  // Virtual destructor.
  virtual ~SimpleBlockHeap();

  // @name HeapInterface implementation.
  // @{
  virtual HeapType GetHeapType() const;
  virtual uint32 GetHeapFeatures() const;
  virtual void* Allocate(size_t bytes);
  virtual bool Free(void* alloc);
  virtual bool IsAllocated(const void* alloc);
  virtual size_t GetAllocationSize(const void* alloc);
  virtual void Lock();
  virtual void Unlock();
  virtual bool TryLock();
  // @}

  // @name BlockHeapInterface implementation.
  // @{
  virtual void* AllocateBlock(size_t size,
                              size_t min_left_redzone_size,
                              size_t min_right_redzone_size,
                              BlockLayout* layout);
  virtual bool FreeBlock(const BlockInfo& block_info);
  // @}

 protected:
  // The underlying raw heap.
  HeapInterface* heap_;

 private:
  DISALLOW_COPY_AND_ASSIGN(SimpleBlockHeap);
};

}  // namespace heaps
}  // namespace asan
}  // namespace agent

#endif  // SYZYGY_AGENT_ASAN_HEAPS_SIMPLE_BLOCK_HEAP_H_


text:
package com.binkery.libs.base.activities;

import com.binkery.libs.R;

/**
 * Created by huangbin on 2016/1/7.
 */
public interface Res {

    interface Layout {
        int TOOLBAR_TABLAYOUT_VIEWPAGER = R.layout.abs_layout_toolbar_tablayout_viewpager;

        int TOOLBAR = R.layout.abs_layout_toolbar;

        int TOOLBAR_RECYELER = R.layout.abs_layout_toolbar_recycler;

        int TOOLBAR_SCROLL = R.layout.abs_layout_toolbar_scrollview;

        int TOOLBAR_WEBVIEW = R.layout.abs_layout_toolbar_webview;
    }

}


text:
package de.huberlin.wbi.hiway.am.cuneiformj;

import java.util.Set;

import de.huberlin.wbi.cuneiform.core.invoc.Invocation;
import de.huberlin.wbi.hiway.common.HiWayConfiguration.HIWAY_WORKFLOW_LANGUAGE_OPTS;
import de.huberlin.wbi.hiway.common.TaskInstance;
import de.huberlin.wbi.hiway.common.WorkflowStructureUnknownException;

public class CuneiformJTaskInstance extends TaskInstance {

	private Invocation invocation;

	public CuneiformJTaskInstance(Invocation invocation) {
		super(invocation.getTicketId(), invocation.getRunId(), invocation.getTaskName(), invocation.getTaskId(), invocation.getLangLabel());
		this.invocation = invocation;
	}

	@Override
	public void addChildTask(TaskInstance childTask) throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public void addParentTask(TaskInstance parentTask) throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public Set<TaskInstance> getChildTasks() throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public int getDepth() throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public Set<TaskInstance> getParentTasks() throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public double getUpwardRank() throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public void setDepth(int depth) throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	@Override
	public void setUpwardRank(double upwardRank) throws WorkflowStructureUnknownException {
		throw new WorkflowStructureUnknownException(HIWAY_WORKFLOW_LANGUAGE_OPTS.cuneiformJ);
	}

	public Invocation getInvocation() {
		return invocation;
	}

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

}


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProductoProfessionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('products_professions', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('producto_id')->unsigned()->nullable();
            $table->integer('products_professions_id')->unsigned()->nullable();
            $table->float('porcentaje');
            $table->timestamps();

            $table->foreign('producto_id')->references('id')->on('products')->onDelete('cascade');
            $table->foreign('products_professions_id')->references('id')->on('professions');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}


text:
function testifelseusername (input) {
    var username = input.username;
    var password = input.password;
    var message;
    if (username == "admin" && password == "Password%1") {
        console.log("success : true");
        message = "success : true";
    } else {
        console.log("success : false");
        message = "success : false";
    }

    return message;
}

exports = exports || window;
exports.testifelseusername = testifelseusername;


text:
package org.apache.lucene.index;

import org.apache.lucene.util.Bits;
import org.apache.lucene.util.Bits.MatchAllBits;

/**
 * Exposes multi-valued view over a single-valued instance.
 * <p>
 * This can be used if you want to have one multi-valued implementation
 * that works for single or multi-valued types.
 */
final class SingletonSortedNumericDocValues extends SortedNumericDocValues {
  private final NumericDocValues in;
  private final Bits docsWithField;
  private long value;
  private int count;

  public SingletonSortedNumericDocValues(NumericDocValues in, Bits docsWithField) {
    this.in = in;
    this.docsWithField = docsWithField instanceof MatchAllBits ? null : docsWithField;
  }

  /** Return the wrapped {@link NumericDocValues} */
  public NumericDocValues getNumericDocValues() {
    return in;
  }

  /** Return the wrapped {@link Bits} */
  public Bits getDocsWithField() {
    return docsWithField;
  }

  @Override
  public void setDocument(int doc) {
    value = in.get(doc);
    if (docsWithField != null && value == 0 && docsWithField.get(doc) == false) {
      count = 0;
    } else {
      count = 1;
    }
  }

  @Override
  public long valueAt(int index) {
    return value;
  }

  @Override
  public int count() {
    return count;
  }
}


text:
import { h } from 'vue';
import { Options, Prop, Vue } from 'vue-property-decorator';
import { ContentObject } from '../../content-object';

@Options({})
export class AppContentViewerHardBreak extends Vue {
	@Prop({ type: ContentObject })
	contentData!: ContentObject;

	render() {
		return h('br');
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ak.android.tutorialview.app" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.ak.android.tutorialview.app.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".SampleTutorialActivity"
            android:label="@string/title_sample_tutorial_activity" >
        </activity>
        <activity
            android:name="com.ak.android.tutorialview.app.SingleShotTutorialActivity"
            android:label="@string/title_activity_single_shot_tutorial" >
        </activity>
    </application>

</manifest>


text:
import sbt._

object ManagementBuild extends Build {
  lazy val root = Project("root", file(".")) aggregate(management, managementLogback, managementMongo, example)

  lazy val management = managementProject("management")

  lazy val managementLogback = managementProject("management-logback") dependsOn (management)

  lazy val example = managementProject("example") dependsOn (management, managementLogback)

  lazy val managementMongo = managementProject("management-mongo") dependsOn  (management)

  def managementProject(name: String) = Project(name, file(name))
}


text:
'use strict';

const env = process.env;

module.exports = {
  get isProduction() {
    return env.NODE_ENV === 'production';
  },
};


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class com.haw.projecthorse.level.game.applerun.Entity</title>
<meta name="date" content="2015-01-10">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
com.haw.projecthorse.level.game.applerun.Entity

Packages that use Entity

Package
Description

com.haw.projecthorse.level.game.applerun

Uses of Entity in com.haw.projecthorse.level.game.applerun

Subclasses of Entity in com.haw.projecthorse.level.game.applerun

Modifier and Type
Class and Description

class
Apple

Apple Entity.

class
Branch

Fallender Ast.

Methods in com.haw.projecthorse.level.game.applerun that return Entity

Modifier and Type
Method and Description

static Entity
GameObjectFactory.getApple()

getApple.

static Entity
GameObjectFactory.getBranch()

getBranch.

Methods in com.haw.projecthorse.level.game.applerun that return types with arguments of type Entity

Modifier and Type
Method and Description

java.util.ArrayList<Entity>
EntityGroup.getEntityList()

Returns an ordered list of child actors in this group.

Methods in com.haw.projecthorse.level.game.applerun with parameters of type Entity

Modifier and Type
Method and Description

void
EntityGroup.addActor(Entity entity)

entity als child hinzufügen.

static void
GameObjectFactory.giveBackEntity(Entity entity)

Ein Object zurueck geben damit es wieder verwendet werden kann.

void
Gamestate.removeFallingEntity(Entity entity)

spawnEntities.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
namespace suic
{

ImplementRTTIOfClass(ToolBar, HeaderedItemsControl)

DpProperty* ToolBar::BandIndexProperty;
DpProperty* ToolBar::BandProperty;
DpProperty* ToolBar::HasOverflowItemsProperty;
DpProperty* ToolBar::IsOverflowItemProperty;
DpProperty* ToolBar::IsOverflowOpenProperty;
DpProperty* ToolBar::OrientationProperty;
DpProperty* ToolBar::OverflowModeProperty;

ToolBar::ToolBar()
{
    ToolBar::StaticInit();
}

ToolBar::~ToolBar()
{
}

void ToolBar::StaticInit()
{
    if (NULL == OrientationProperty)
    {
        suic::HeaderedItemsControl::StaticInit();
        ToolBarPanel::StaticInit();

        OrientationProperty = DpProperty::Register(_T("Orientation"), RTTIType(), Integer::RTTIType()
            , DpPropMemory::GetPropMeta(OrientationBox::HorizontalBox, PropMetadataOptions::AffectsMeasure));

        BandIndexProperty = DpProperty::Register(_T("BandIndex"), RTTIType(), Integer::RTTIType()
            , DpPropMemory::GetPropMeta(new Integer(0), PropMetadataOptions::AffectsParentMeasure));
        BandProperty = DpProperty::Register(_T("Band"), RTTIType(), Integer::RTTIType()
            , DpPropMemory::GetPropMeta(new Integer(0), PropMetadataOptions::AffectsParentMeasure));
        HasOverflowItemsProperty = DpProperty::Register(_T("HasOverflowItems"), RTTIType(), Boolean::RTTIType()
            , DpPropMemory::GetPropMeta(Boolean::False, PropMetadataOptions::AffectsNone));
        IsOverflowItemProperty = DpProperty::Register(_T("IsOverflowItem"), RTTIType(), Object::RTTIType()
            , DpPropMemory::GetPropMeta(NULL, PropMetadataOptions::AffectsNone));
        IsOverflowOpenProperty = DpProperty::Register(_T("IsOverflowOpen"), RTTIType(), Boolean::RTTIType()
            , DpPropMemory::GetPropMeta(Boolean::False, PropMetadataOptions::AffectsNone));
        OverflowModeProperty = DpProperty::Register(_T("OverflowMode"), RTTIType(), Integer::RTTIType()
            , DpPropMemory::GetPropMeta(new Integer(OverflowMode::AsNeeded), PropMetadataOptions::AffectsNone));
    }
}

bool ToolBar::CoerceIsOverflowOpen(DpObject* d, bool val)
{
    if (val)
    {
        ToolBar* bar = DynamicCast<ToolBar>(d);

        if (!bar->IsLoaded())
        {
            bar->RegisterToOpenOnLoad();
            return false;
        }
    }
    return val;
}

Orientation ToolBar::CoerceOrientation(DpObject* d, Orientation val)
{
    ToolBar* toolBar = DynamicCast<ToolBar>(d);
    ToolBarTray* toolBarTray = toolBar->GetToolBarTray();

    if (toolBarTray == NULL)
    {
        return val;
    }
    else
    {
        return toolBarTray->GetOrientation();
    }
}

bool ToolBar::CoerceToolTipIsEnabled(DpObject* d, bool val)
{
    ToolBar* bar = DynamicCast<ToolBar>(d);

    if (!bar->IsOverflowOpen())
    {
        return val;
    }
    else
    {
        return false;
    }
}

bool ToolBar::GetIsOverflowItem(DpObject* elem)
{
    if (elem == NULL)
    {
        throw new ArgumentNullException("element", __FILELINE__);
    }

    return elem->GetValue(IsOverflowItemProperty)->ToBool();
}

bool ToolBar::IsValidOverflowMode(int val)
{
    OverflowMode mode = (OverflowMode)val;

    if ((mode != OverflowMode::AsNeeded) && (mode != OverflowMode::Always))
    {
        return (mode == OverflowMode::Never);
    }
    else
    {
        return true;
    }
}

void ToolBar::SetIsOverflowItem(DpObject* elem, Object* val)
{
    elem->SetValue(IsOverflowItemProperty, val);
}

void ToolBar::SetOverflowMode(DpObject* elem, OverflowMode mode)
{
    if (elem == NULL)
    {
        throw new ArgumentNullException("elem", __FILELINE__);
    }
    elem->SetValue(OverflowModeProperty, new Integer(mode));
}

OverflowMode ToolBar::GetOverflowMode(DpObject* elem)
{
    if (elem == NULL)
    {
        throw ArgumentNullException("elem", __FILELINE__);
    }
    return (OverflowMode)elem->GetValue(OverflowModeProperty)->ToInt();
}

Orientation ToolBar::GetOrientation()
{
    return (Orientation)GetValue(OrientationProperty)->ToInt();
}

ToolBarTray* ToolBar::GetToolBarTray()
{
    return DynamicCast<ToolBarTray>(GetParent());
}

int ToolBar::GetBand()
{
    return GetValue(BandProperty)->ToInt();
}

void ToolBar::SetBand(int val)
{
    SetValue(BandProperty, new Integer(val));
}

int ToolBar::GetBandIndex()
{
    return GetValue(BandIndexProperty)->ToInt();
}

void ToolBar::SetBandIndex(int val)
{
    SetValue(BandIndexProperty, new Integer(val));
}

bool ToolBar::IsOverflowOpen()
{
    return (bool)GetValue(IsOverflowOpenProperty)->ToBool();
}

void ToolBar::SetIsOverflowOpen(bool val)
{
    SetValue(IsOverflowOpenProperty, BOOLTOBOOLEAN(val));
}

int ToolBar::GetMinLength() const
{
    return _minLength;
}

int ToolBar::GetMaxLength() const
{
    return _maxLength;
}

ToolBarOverflowPanel* ToolBar::GetToolBarOverflowPanel()
{
    if (_toolBarOverflowPanel == NULL)
    {
        _toolBarOverflowPanel = FindToolBarOverflowPanel();
    }
    return _toolBarOverflowPanel;
}

ToolBarPanel* ToolBar::GetToolBarPanel()
{
    if (_toolBarPanel == NULL)
    {
        _toolBarPanel = FindToolBarPanel();
    }
    return _toolBarPanel;
}

ToolBarOverflowPanel* ToolBar::FindToolBarOverflowPanel()
{
    DpObject* templateChild = GetTemplateChild("PART_ToolBarOverflowPanel");
    ToolBarOverflowPanel* panel = DynamicCast<ToolBarOverflowPanel>(templateChild);

    if ((templateChild != NULL) && (panel == NULL))
    {
        throw ;
    }

    return panel;
}

ToolBarPanel* ToolBar::FindToolBarPanel()
{
    DpObject* templateChild = GetTemplateChild("PART_ToolBarPanel");
    ToolBarPanel* panel = DynamicCast<ToolBarPanel>(templateChild);

    if ((templateChild != NULL) && (panel == NULL))
    {
        throw;
    }
    return panel;
}

void ToolBar::InvalidateLayout()
{
    _minLength = 0;
    _maxLength = 0;
    InvalidateMeasure();
    ToolBarPanel* toolBarPanel = GetToolBarPanel();

    if (toolBarPanel != NULL)
    {
        toolBarPanel->InvalidateMeasure();
    }
}

void ToolBar::Close()
{
    SetValue(IsOverflowOpenProperty, Boolean::False);
}

Size ToolBar::OnMeasure(const Size& constraint)
{
    Size size = HeaderedItemsControl::OnMeasure(constraint);
    ToolBarPanel* toolBarPanel = GetToolBarPanel();

    if (toolBarPanel != NULL)
    {
        int num = 0;
        Rect margin = toolBarPanel->GetMargin();

        if (toolBarPanel->GetOrientation() == Orientation::Horizontal)
        {
            num = max((int)0, (int)(((size.Width() - toolBarPanel->GetDesiredSize().Width()) + margin.left) + margin.right));
        }
        else
        {
            num = max((int)0, (int)(((size.Height() - toolBarPanel->GetDesiredSize().Height()) + margin.top) + margin.bottom));
        }

        _minLength = toolBarPanel->GetMinLength() + num;
        _maxLength = toolBarPanel->GetMaxLength() + num;
    }

    return size;
}

void ToolBar::OnItemsChanged(NotifyCollChangedEventArg* e)
{
    InvalidateLayout();
    HeaderedItemsControl::OnItemsChanged(e);
}

void ToolBar::OnTemplateChangedInternal(FrameworkTemplate* oldTemplate, FrameworkTemplate* newTemplate)
{
    _toolBarPanel = NULL;
    _toolBarOverflowPanel = NULL;
    HeaderedItemsControl::OnTemplateChangedInternal(oldTemplate, newTemplate);
}

void ToolBar::OnMouseDown(Element* sender, MouseButtonEventArg* e)
{
    ToolBar* bar = DynamicCast<ToolBar>(sender);
    if (!e->IsHandled())
    {
        bar->Close();
        e->SetHandled(true);
    }
}

void ToolBar::OnOverflowModeChanged(DpObject* d, DpPropChangedEventArg* e)
{
    ToolBar* bar = DynamicCast<ToolBar>(ItemsControl::ItemsControlFromItemContainer(d));
    if (bar != NULL)
    {
        bar->InvalidateLayout();
    }
}

void ToolBar::OnOverflowOpenChanged(DpObject* d, DpPropChangedEventArg* e)
{
    ToolBar* bar = DynamicCast<ToolBar>(d);
    if (e->GetNewValue()->ToBool())
    {
        //Mouse.Capture(bar, CaptureMode.SubTree);
        //bar.SetFocusOnToolBarOverflowPanel();
    }
    else
    {
        ToolBarOverflowPanel* toolBarOverflowPanel = bar->GetToolBarOverflowPanel();
        if ((toolBarOverflowPanel != NULL) && toolBarOverflowPanel->IsKeyboardFocusWithin())
        {
            Keyboard::Focus(NULL);
        }
        if (Mouse::GetCaptured() == bar)
        {
            Mouse::SetCaptured(NULL);
        }
    }

    //bar->CoerceValue(ToolTipService.IsEnabledProperty);
}

void ToolBar::RegisterToOpenOnLoad()
{
    //LoadedEvent += new RoutedEventHandler(this.OpenOnLoad);
}

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

DpProperty* ToolBarTray::OrientationProperty;

ToolBarCollection::ToolBarCollection(ToolBarTray* parent)
    : _parent(parent)
{
    _toolBars.Resize(4);
}

ToolBarCollection::~ToolBarCollection()
{
    Clear();
}

void ToolBarCollection::Clear()
{
    int count = GetCount();

    if (count > 0)
    {
        for (int i = 0; i < count; i++)
        {
            ToolBar* child = GetToolBar(i);

            _parent->RemoveVisualChild(child);
            _parent->RemoveLogicalChild(child);
            child->unref();
        }

        _parent->InvalidateMeasure();
    }

    _toolBars.Clear();
}

int ToolBarCollection::GetCount() const
{
    return _toolBars.GetCount();
}

ToolBar* ToolBarCollection::GetToolBar(int index) const
{
    return _toolBars[index];
}

bool ToolBarCollection::Contains(Object* value)
{
    return (IndexOf(value) != -1);
}

int ToolBarCollection::IndexOf(Object* val)
{
    for (int i = 0; i < _toolBars.Length(); ++i)
    {
        if (_toolBars[i] == val)
        {
            return i;
        }
    }
    return -1;
}

void ToolBarCollection::AddToolBar(ToolBar* toolBar)
{
    toolBar->ref();
    _toolBars.Add(toolBar);
    AddToolBarItem(toolBar);
}

void ToolBarCollection::AddToolBarItem(ToolBar* toolBar)
{
    _parent->AddLogicalChild(toolBar);
    _parent->AddVisualChild(toolBar);
    _parent->InvalidateMeasure();
}

void ToolBarCollection::InsertToolBar(int index, ToolBar* toolBar)
{
    toolBar->ref();
    _toolBars.Insert(index, toolBar);
    AddToolBarItem(toolBar);
}

void ToolBarCollection::RemoveToolBar(int index)
{
    ToolBar* child = GetToolBar(index);
    RemoveToolBarItem(child);
    _toolBars.RemoveAt(index);
}

void ToolBarCollection::SetToolBar(int index, ToolBar* toolBar)
{
    ToolBar* child = GetToolBar(index);

    if (toolBar != child)
    {
        RemoveToolBarItem(child);
        toolBar->ref();
        _toolBars.SetItem(index, toolBar);
        AddToolBarItem(toolBar);
    }
}

void ToolBarCollection::RemoveToolBarItem(ToolBar* child)
{
    _parent->RemoveVisualChild(child);
    _parent->RemoveLogicalChild(child);
    _parent->InvalidateMeasure();
    child->unref();
}

ToolBarTray::ToolBarTray()
    : _bandsDirty(false)
    , _toolBarsCollection(NULL)
{

}

ToolBarTray::~ToolBarTray()
{
    for (int i = 0; i < _bands.Length(); ++i)
    {
        delete _bands[i];
    }

    if (_toolBarsCollection)
    {
        delete _toolBarsCollection;
    }
}

void ToolBarTray::StaticInit()
{
    if (NULL == OrientationProperty)
    {
        OrientationProperty = DpProperty::Register(_T("Orientation"), RTTIType(), Integer::RTTIType()
            , DpPropMemory::GetPropMeta(OrientationBox::HorizontalBox, PropMetadataOptions::AffectsMeasure));
    }
}

ToolBarCollection* ToolBarTray::GetToolBars()
{
    if (_toolBarsCollection == NULL)
    {
        _toolBarsCollection = new ToolBarCollection(this);
    }
    return _toolBarsCollection;
}

Orientation ToolBarTray::GetOrientation()
{
    return (Orientation)GetValue(OrientationProperty)->ToInt();
}

void ToolBarTray::SetOrientation(Orientation val)
{
    SetValue(OrientationProperty, OrientationBox::From(val));
}

BandInfo* ToolBarTray::CreateBand(int startIndex)
{
    ToolBarCollection* toolBars = GetToolBars();
    BandInfo* info = new BandInfo();
    ToolBar* item = toolBars->GetToolBar(startIndex);
    info->GetBand().Add(item);

    int band = item->GetBand();

    for (int i = startIndex + 1; i < toolBars->GetCount(); i++)
    {
        item = toolBars->GetToolBar(i);

        if (band == item->GetBand())
        {
            InsertToolBar(item, info->GetBand());
        }
    }

    return info;
}

void ToolBarTray::ExpandToolBars(Array<ToolBar*, false>& band, int startIndex, int endIndex, int expandAmount)
{
    if (GetOrientation() == Orientation::Horizontal)
    {
        for (int i = endIndex; i >= startIndex; i--)
        {
            ToolBar* bar = band[i];
            if (bar->GetRenderSize().Width() + expandAmount <= bar->GetMaxLength())
            {
                bar->SetWidth(bar->GetRenderSize().Width() + expandAmount);
                return;
            }

            bar->SetWidth(bar->GetMaxLength());
            expandAmount -= bar->GetMaxLength() - bar->GetRenderSize().Width();
        }
    }
    else
    {
        for (int j = endIndex; j >= startIndex; j--)
        {
            ToolBar* bar2 = band[j];
            if (bar2->GetRenderSize().Height() + expandAmount <= bar2->GetMaxLength())
            {
                bar2->SetHeight(bar2->GetRenderSize().Height() + expandAmount);
                return;
            }

            bar2->SetHeight(bar2->GetMaxLength());
            expandAmount -= bar2->GetMaxLength() - bar2->GetRenderSize().Height();
        }
    }
}

void ToolBarTray::GenerateBands()
{
    if (IsBandsDirty())
    {
        ToolBarCollection* toolBars = GetToolBars();
        _bands.Clear();

        for (int i = 0; i < toolBars->GetCount(); i++)
        {
            InsertBand(toolBars->GetToolBar(i), i);
        }

        for (int j = 0; j < _bands.Length(); j++)
        {
            Array<ToolBar*, false>& band = _bands[j]->GetBand();
            for (int k = 0; k < band.Length(); k++)
            {
                ToolBar* bar = band[k];
                bar->SetBand(j);
                bar->SetBandIndex(k);
            }
        }

        _bandsDirty = false;
    }
}

int ToolBarTray::GetBandFromOffset(int toolBarOffset)
{
    if (toolBarOffset < 0)
    {
        return -1;
    }

    int num = 0.0;
    for (int i = 0; i < _bands.Length(); i++)
    {
        num += _bands[i]->GetThickness();
        if (num > toolBarOffset)
        {
            return i;
        }
    }
    return _bands.Length();
}

void ToolBarTray::InsertBand(ToolBar* toolBar, int toolBarIndex)
{
    int band = toolBar->GetBand();

    for (int i = 0; i < _bands.Length(); i++)
    {
        int num3 = _bands[i]->GetBand().GetItem(0)->GetBand();

        if (band == num3)
        {
            return;
        }

        if (band < num3)
        {
            _bands.Insert(i, CreateBand(toolBarIndex));
            return;
        }
    }

    _bands.Add(CreateBand(toolBarIndex));
}

void ToolBarTray::InsertToolBar(ToolBar* toolBar, Array<ToolBar*, false>& band)
{
    for (int i = 0; i < band.Length(); i++)
    {
        if (toolBar->GetBandIndex() < band[i]->GetBandIndex())
        {
            band.Insert(i, toolBar);
            return;
        }
    }

    band.Add(toolBar);
}

bool ToolBarTray::IsBandsDirty()
{
    if (_bandsDirty)
    {
        return true;
    }

    int num = 0;
    ToolBarCollection* toolBars = GetToolBars();

    for (int i = 0; i < _bands.Length(); i++)
    {
        Array<ToolBar*, false>& band = _bands[i]->GetBand();

        for (int j = 0; j < band.Length(); j++)
        {
            ToolBar* item = band[j];
            if (((item->GetBand() != i) || (item->GetBandIndex() != j)) || !toolBars->Contains(item))
            {
                return true;
            }
        }
        num += band.Length();
    }

    return (num != toolBars->GetCount());
}

Element* ToolBarTray::GetVisualChild(int index)
{
    if (_toolBarsCollection == NULL)
    {
        throw ArgumentException("index", __FILELINE__);
    }

    return _toolBarsCollection->GetToolBar(index);
}

int ToolBarTray::GetVisualChildrenCount()
{
    if (_toolBarsCollection == NULL)
    {
        return 0;
    }
    else
    {
        return _toolBarsCollection->GetCount();
    }
}

void ToolBarTray::AddText(String val)
{

}

void ToolBarTray::AddChild(Object* child)
{
    if (child == NULL)
    {
        throw ArgumentNullException("child", __FILELINE__);
    }

    ToolBar* item = RTTICast<ToolBar>(child);

    if (item == NULL)
    {
        throw ArgumentException("UnexpectedParameterType", __FILELINE__);
    }

    GetToolBars()->AddToolBar(item);
}

void ToolBarTray::OnArrange(const Size& arrangeSize)
{
    bool flag = GetOrientation() == Orientation::Horizontal;
    Rect finalRect;

    for (int i = 0; i < _bands.Length(); i++)
    {
        Array<ToolBar*, false>& band = _bands[i]->GetBand();
        int thickness = _bands[i]->GetThickness();

        if (flag)
        {
            finalRect.left = 0;
        }
        else
        {
            finalRect.top = 0;
        }

        for (int j = 0; j < band.Length(); j++)
        {
            ToolBar* bar = band[j];
            Size size(flag ? bar->GetDesiredSize().Width() : thickness, flag ? thickness : bar->GetDesiredSize().Height());

            finalRect.right = finalRect.left + size.cx;
            finalRect.bottom = finalRect.top + size.cy;

            bar->Arrange(finalRect);

            if (flag)
            {
                finalRect.left += size.Width();
                finalRect.right += size.Width();
            }
            else
            {
                finalRect.top += size.Height();
                finalRect.bottom += size.Height();
            }
        }

        if (flag)
        {
            finalRect.top += thickness;
            finalRect.bottom += thickness;
        }
        else
        {
            finalRect.left += thickness;
            finalRect.right += thickness;
        }
    }
}

Size ToolBarTray::OnMeasure(const Size& constraint)
{
    GenerateBands();

    Size size;
    bool flag = GetOrientation() == Orientation::Horizontal;
    Size availableSize(Numeric::MeasureInt, Numeric::MeasureInt);

    for (int i = 0; i < _bands.Length(); i++)
    {
        int num3 = flag ? constraint.Width() : constraint.Height();
        Array<ToolBar*, false>& band = _bands[i]->GetBand();
        int num4 = 0;
        int num5 = 0;
        int num2 = 0;

        while (num2 < band.Length())
        {
            ToolBar* bar = band[num2];
            num3 -= bar->GetMinLength();

            if (num3 < 0)
            {
                num3 = 0;
                break;
            }
            num2++;
        }

        for (num2 = 0; num2 < band.Length(); num2++)
        {
            ToolBar* bar2 = band[num2];
            Size desiredSize = bar2->GetDesiredSize();

            num3 += bar2->GetMinLength();

            if (flag)
            {
                availableSize.cx = num3;
            }
            else
            {
                availableSize.cy = num3;
            }

            MeasureChild(bar2, availableSize);
            num4 = Math::Max(num4, flag ? desiredSize.Height() : desiredSize.Width());
            num5 += flag ? desiredSize.Width() : desiredSize.Height();
            num3 -= flag ? desiredSize.Width() : desiredSize.Height();

            if (num3 < 0)
            {
                num3 = 0.0;
            }
        }

        _bands[i]->SetThickness(num4);

        if (flag)
        {
            size.cy += num4;
            size.cx = max(size.Width(), num5);
        }
        else
        {
            size.cx += num4;
            size.cy = max(size.Height(), num5);
        }
    }

    return size;
}

}


text:
package com.tencent.bugly.demo;

import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.bugly.demo.mockcrash.CrashMock;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

/**
 * 简单测试crash
 * 注:如想查看crash日志,需先到http://bugly.qq.com/注册app,并配置appID,之后就可以在bugly查看到日志啦
 * @author wenjiewu
 * @date 2016/5/23
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btnTestJavaCrash;
    private Button btnTestANRCrash;
    private Button btnTestNativeCrash;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btnTestJavaCrash = (Button) findViewById(R.id.btnTestJavaCrash);
        btnTestANRCrash = (Button) findViewById(R.id.btnTestANRCrash);
        btnTestNativeCrash = (Button)findViewById(R.id.btnTestNativeCrash);
        btnTestJavaCrash.setOnClickListener(this);
        btnTestANRCrash.setOnClickListener(this);
        btnTestNativeCrash.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btnTestJavaCrash: // 点击测试Java Crash
                CrashMock.mockJavaCrash();
                break;
            case R.id.btnTestANRCrash: // 点击测试ANR Crash
                CrashReport.testANRCrash();
                break;
            case R.id.btnTestNativeCrash: // 点击测试Native Crash
                CrashReport.testNativeCrash();
                break;
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05.SortNumbers
{
    class Program
    {
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split().Select(decimal.Parse).ToList();

            numbers.Sort();

            Console.WriteLine(string.Join(" <= ", numbers));
        }
    }
}