text:
Options to control the testing process.

### The difference between options

Test run options are specified when the command runs in command line interface:

```
tst .imply verbosity:7 .run
```

The verbosity of report is set to the level `7`.

At the same time, the test suite options are specified in the test file, they are written as the run options:

```js
let Self =
{

  name : 'TestSuiteName',
  verbosity : 9,

  tests :
  {
    routine1,
    routine2,
  }

}

wTestSuite( Self );
```

The verbosity of report is set to the level `9`. Most run options have priority over test suite options. For this reason, in the example, the verbal level will be `7`, not` 9`.

#### Run option `sanitareTime`

Sets the delay between completing the test suite and running the next.

The option is intended to complete the execution of tests with asynchronous functions. It is determined in milliseconds. The default value is 2000ms.

The `tst .imply sanitareTime:1000 .run path/to/dir` command runs the test in the specified directory; the delay before running the next test suite is set to one second.

#### Run option `fails`

Sets the number of errors that the utility must receive to interrupt the test.

When the specified number of errors is reached, the utility finishes testing. By default, the number of errors is not limited.

The `tst .imply fails:5 .run path/to/dir` command runs the test in the specified directory. If the test checks fail five times, then the testing will end.

#### Run option `beeping`

It is intended to turn on the beep after the test is completed.

The option has two values: 1 is enabled, 0 is off. Default value is 1.

The `tst .imply beeping:0 .run path/to/dir` command will complete the testing quietly without a beep.

#### Run option `coloring`

Desined to enable the color marking of the test report.

The option has two values: 1 is enabled, 0 is off. Default value is 1.

Example: `tst .imply coloring:0 .run path/to/dir`. The test report output will be simple, without color marking of the results.

#### Run option `timing`

It is intended to enable measurement of time spent on testing.

The option has two values: 1 is enabled, 0 is off. By default - 1.

Example: `tst .imply timing:0 .run path/to/dir`. Time data will not be available in the report after the test is completed.

#### Run option `debug`

It is intended to to disable assertion by changing default value of `Config.debug`.

The option has two values: 1 is enabled, 0 is off. By default - null, so utility does not change `debug` mode of object of testing.

Example: `tst .imply debug:0 .run path/to/dir`. During testing, the assertions will be ignored.

#### Run option `rapidity`

The option controls the amount of time spent on testing. Each test routine can specify its own option `rapidity` with a value from `-9` to `+9`. By default, routine option `rapidity`  is `0`. A routine doesn't run when the value of run option `rapidity` is greater than the value of routine option `rapidity`.

The option accepts values from `-9` to `+9`: `-9` is the slowest testing, `+9` is the fastest. The default value is `0`.

The `tst .imply rapidity:-9 .run path/to/dir` command tests each test routine.

The `tst .imply rapidity:4 .run path/to/dir` command skips all test routines, which routine options `rapidity` are less than `4`.

#### Run option `testRoutineTimeOut`

The option limits the testing time for a test routine. Each test routine can have its own `timeOut`. If the test routine has its own `timeOut` then the value of the run option `testRoutineTimeOut` does not change it.

The routine is denoted as failed (red) if it has not been tested at the specified time.

Option is determined in milliseconds. The default value is 5000ms.

The `tst .imply testRoutineTimeOut:60000 .run path/to/dir` command gives each test routine without explicitly setting `timeOut` one minute to complete it.

#### Run option `concurrent`

Designed to enable parallel execution of test suites.

The utility can run more than one test suite at the same time if there are several test suites in the specified directory.

The option has two values: 1 - parallel testing is on, 0 - is disabled and testing is in turn. By default - 0.

The command `tst .imply  concurrent:1 .run path/to/dir` runs parallel execution of test suites in the` path/to/dir` directory.

#### Run option `verbosity`

Sets the verbosity of report, that is, the amount of output information.

Accepts a value from 0 to 9. When the value is set to 0, it does not display a single line. If it is set to 9, the report has a maximum of information. The default value is 4.

The test suite can have a `verbosity` option. In this case, the value set in the test suite has a priority over the run option.

The `tst .imply verbosity:5 .run path/to/dir` command prints a more detailed test report by displaying information about test checks. By default, information about the test checks is not displayed.

#### Run option `negativity`

It is intended to restrict the output of information of routines with the status `ok` / `pass` and to increase the amount of information about the checks with the status `failed`.

Accepts values from 0 to 9. By default - 1.

The `tst .imply negativity:0 .run path/to/dir` command displays the report without detailed information about the failed checks.

#### Run option `silencing`

Enables hiding the console output from the test unit. The test object and the code of the test routines can have its own output. This issue may worsen the readability of the test report.

The `silencing` run option has priority over the test suite option.

The option has two values: 1 is enabled, 0 is off. By default - 0.

The `tst .imply silencing:1 .run path/to/dir` command displays a clean report without additional output of the test unit.

#### Run option `shoulding`

Designed to disable negative testing. Test checks beginning with `should*` can be disabled by this option.

<!-- qqq : show example of such test check -->

The option has two values: 1 is enabled, 0 is off. By default - 1.

The `tst .imply shoulding:0 .run path/to/dir` command executes the test by skipping all `should*` checks.

#### Run option `accuracy`

The option sets the numeric deviation for the comparison of numerical values.

The default value is set to `1e-7`.

The `tst .imply accuracy:1e-4 .run path/to/dir` command changes the result of the next test check:

```js
test.equivalent( 1, 1.00001 );
```

By default, this test check fails. However, the `accuracy:1e-4` run option changes the permissible deviation, and this check is passed.

### Summary

- Run options and suites options control the testing process.
- The run options have priority over the test suites options.
- The run and suites options have the same wording.

[Back to content](../README.md#Tutorials)


text:
package com.auth0.client.mgmt.filter;

/**
 * Class used to filter the results received when calling the Connections endpoint. Related to the {@link com.auth0.client.mgmt.ConnectionsEntity} entity.
 * <p>
 * This class is not thread-safe.
 *
 * @see BaseFilter
 */
public class ConnectionFilter extends FieldsFilter {

    /**
     * Filter by strategy
     *
     * @param strategy only retrieve items with this strategy.
     * @return this filter instance
     */
    public ConnectionFilter withStrategy(String strategy) {
        parameters.put("strategy", strategy);
        return this;
    }

    /**
     * Filter by name
     *
     * @param name only retrieve the item with this name.
     * @return this filter instance
     */
    public ConnectionFilter withName(String name) {
        parameters.put("name", name);
        return this;
    }

    /**
     * Filter by page
     *
     * @param pageNumber    the page number to retrieve.
     * @param amountPerPage the amount of items per page to retrieve.
     * @return this filter instance
     */
    public ConnectionFilter withPage(int pageNumber, int amountPerPage) {
        parameters.put("page", pageNumber);
        parameters.put("per_page", amountPerPage);
        return this;
    }

    /**
     * Include the query summary.
     * Warning: Can only be used with {@link com.auth0.client.mgmt.ConnectionsEntity#listAll(ConnectionFilter)}
     *
     * @param includeTotals whether to include or not the query summary.
     * @return this filter instance
     */
    public ConnectionFilter withTotals(boolean includeTotals) {
        parameters.put("include_totals", includeTotals);
        return this;
    }

    @Override
    public ConnectionFilter withFields(String fields, boolean includeFields) {
        super.withFields(fields, includeFields);
        return this;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.commons.feedparser.output;

import java.io.OutputStream;

import org.apache.commons.feedparser.DefaultFeedParserListener;
import org.apache.commons.feedparser.FeedParserListener;
import org.apache.commons.feedparser.FeedParserState;

/**
 *
 * @author Kevin A. Burton (burtonator)
 * @version $Id$
 */
public class RSS10_OutputFeedParserListener extends DefaultFeedParserListener
    implements FeedParserListener {

    private OutputStream out = null;

    /**
     *
     * Create a new RSS10_OutputFeedParserListener instance.
     *
     *
     */
    public RSS10_OutputFeedParserListener( OutputStream out ) {
        this.out = out;
    }

    /**
     * Called prior to event parsing to signal the parsing of a new feed.
     *
     *
     */
    public void init() {}
    public void setContext( Object context ) {}

    /**
     * Called when a channel item is found.
     *
     *
     */
    public void onChannel( FeedParserState state,
                           String title,
                           String link,
                           String description ) {

    }

    public void onChannelEnd() {

    }

    /**
     * Called when an RSS image is found.
     *
     *
     */
    public void onImage( FeedParserState state,
                         String title,
                         String link,
                         String url ) {

    }

    public void onImageEnd() {

    }

    /**
     * Called when an RSS item or Atom entry is found.
     *
     *
     */
    public void onItem( FeedParserState state,
                        String title,
                        String link,
                        String description,
                        String permalink ) {

    }

    public void onItemEnd() {

    }

    /**
     * Called when the feed has finished parsing.
     *
     *
     */
    public void finished() {

    }

}


text:
package org.greencheek.related.searching.disruptor.searchexecution;

import com.lmax.disruptor.EventHandler;
import org.greencheek.related.api.searching.RelatedItemSearch;

public interface RelatedItemSearchDisruptorEventHandler extends EventHandler<RelatedItemSearch> {
    public void shutdown();
}


text:
store an AppCache-enabled site on disk for local use

## Usage

### FetcherOptions

- @typedef {Object} FetcherOptions

- @property {string} localPath - filesystem directory to store assets.
- @property {string} remoteUrl
- @property {boolean} [strictMode=true] - W3C behaviour, halt on failure.

### `new Fetcher(opts)`

- @constructor
- @param {FetcherOptions} opts

### `Fetcher#go()`

Trigger the whole process, downloading remote assets, processing them,
and storing them locally.

## Compatibility

- versions >=2.x require Node.js >=4.x


text:
package com.answers.woody.core.model;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.TYPE })
public @interface Inject {

	public static enum Type {ALL, JSON, MODEL}

	Type value() default Type.MODEL;
}


text:
#ifndef TRACE_COMM_H
#define TRACE_COMM_H

#include <stdlib.h>

#define PT_COMM_FILENAME                "phptrace.sock"
#define PT_COMM_MAXRECV                 10
#define PT_COMM_BACKLOG                 128

#define PT_MSG_HEADER_SIZE              sizeof(pt_comm_message_t)
#define PT_MSG_SIZE(msg)                sizeof(pt_comm_message_t) + msg->len
#define PT_MSG_SIZE_MIN                 0
#define PT_MSG_SIZE_MAX                 1024 * 1024

enum {
    /* Codes for inner message */
    PT_MSG_EMPTY        = 0x00000000,
    PT_MSG_PEERDOWN,
    PT_MSG_ERR_SOCK,
    PT_MSG_ERR_BUF,
    PT_MSG_INVALID,

    /* Codes for user defined message. MUST >= 0x80000000 */
    PT_MSG_USER         = 0x80000000,

    PT_MSG_DO_TRACE,
    PT_MSG_DO_STATUS,
    PT_MSG_DO_FILTER,

    PT_MSG_FRAME,
    PT_MSG_REQ,
    PT_MSG_STATUS,
};

typedef struct {
    int32_t len;                /* message length */
    int32_t type;               /* message type */
    int32_t pid;                /* pid TODO to be moved out */
    char data[];                /* scaleable data */
} pt_comm_message_t;

/* function declation */
int pt_comm_connect(const char *addrstr);
int pt_comm_listen(const char *addrstr);
int pt_comm_accept(int fd);
int pt_comm_recv_msg(int fd, pt_comm_message_t **msg_ptr);
int pt_comm_build_msg(pt_comm_message_t **msg_ptr, size_t size, int type);
int pt_comm_send_type(int fd, int type);
int pt_comm_send_msg(int fd, pt_comm_message_t *msg);
int pt_comm_close(int fd, const char *addrstr);

#endif


text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="actionOverflowMenuStyle">@style/OverflowMenu</item>
    </style>

    <style name="AnimationActivity" parent="@android:style/Animation.Activity">
        <item name="android:activityOpenEnterAnimation">@anim/slide_in_left</item>
        <item name="android:activityOpenExitAnimation">@anim/slide_out_left</item>
        <item name="android:activityCloseEnterAnimation">@anim/slide_in_right</item>
        <item name="android:activityCloseExitAnimation">@anim/slide_out_right</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <!--<item name="android:windowFullscreen">true</item>-->
        <item name="windowActionBar">false</item>
        <item name="android:windowAnimationStyle">@style/AnimationActivity</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="SplashStyle" parent="AppTheme.NoActionBar">
        <item name="android:windowFullscreen">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    <!--menu 背景色-->
    <style name="OverflowMenu" parent="Widget.AppCompat.PopupMenu.Overflow">
        <item name="overlapAnchor">false</item>
        <item name="android:dropDownVerticalOffset">4dp</item>
        <item name="android:layout_marginRight">4dp</item>
        <item name="android:popupBackground">@color/colorPrimary</item>
        <item name="android:textColor">@color/white</item>
    </style>

</resources>


text:
// @(#)traffic_PacketTrain.java   9/2002
// Copyright (c) 1998-2002, Distributed Real-time Computing Lab (DRCL)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
//    this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
// 3. Neither the name of "DRCL" nor the names of its contributors may be used
//    to endorse or promote products derived from this software without specific
//    prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

package drcl.net.traffic;
/**
 * This class describes the packet train traffic model.
 * It defines the following parameters:
 *

 *
Packet Size
 *
Size of packets (byte).
 *
 *
Packet Inter-arrival Time
 *
Time interval between the arrival times of any two consecutive packets.
 *

 */
public class traffic_PacketTrain extends TrafficModel implements TrafficPeriodic
{
	public int   packetSize;
	public double interArrivalTime;

	public traffic_PacketTrain()
	{}

	public traffic_PacketTrain(int mtu_, double iat_)
	{ set(mtu_, iat_); }

	public void set(int mtu_, double iat_)
	{
		packetSize = mtu_;
		interArrivalTime = iat_;
	}

	public double getLoad()
	{ return (double)(packetSize << 3)/interArrivalTime; }

	public double getPeriod() { return interArrivalTime; }
	public int getBurst() { return packetSize; }

	public TrafficModel merge(TrafficModel that_)
	{
		if (!(that_ instanceof traffic_PacketTrain)) return null;
		traffic_PacketTrain thatTraffic_ = (traffic_PacketTrain) that_;
		double load1_ = getLoad();
		double load2_ = thatTraffic_.getLoad();
		packetSize = Math.max(packetSize, thatTraffic_.packetSize);
		interArrivalTime = (packetSize << 3) / (load1_ + load2_);
		return this;
	}

	public void duplicate(Object source_)
	{
		if (!(source_ instanceof traffic_PacketTrain)) return;
		traffic_PacketTrain that_ = (traffic_PacketTrain) source_;
		packetSize = that_.packetSize;
		interArrivalTime = that_.interArrivalTime;
	}

	public String oneline()
	{
		return getClass().getName() + ":packetSize=" + packetSize
			+ ", interArrivalTime=" + interArrivalTime;
	}

	//
	private void ___PROPERTY___() {}
	//

	public void setPacketSize(int size_) { packetSize = size_; }
	public int getPacketSize() { return packetSize; }

	public void setIntArrivalTime(double t_) { interArrivalTime = t_; }
	public double getIntArrivalTime() { return interArrivalTime; }

	public int getMTU() { return packetSize; }
}


text:
<title>Zend Framework API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="css/black-tie/jquery-ui-1.8.2.custom.css" type="text/css"></link><link rel="stylesheet" href="css/jquery.treeview.css" type="text/css"></link><link rel="stylesheet" href="css/theme.css" type="text/css"></link>

API Documentation

Measure/Angle.php

Global

                      Classes

\Zend_Measure_Angle

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.

category

Zend

copyright

Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)

license

New BSD License

package

Zend_Measure

version

$Id: Angle.php 23775 2011-03-01 17:25:24Z ralph $

\Zend_Measure_Angle
jump to top

Class for handling angle conversions

Extends from

\Zend_Measure_Abstract

category

Zend

copyright

Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)

license

New BSD License

package

Zend_Measure

subpackage

Zend_Measure_Angle

Constants

                STANDARD
                = 'RADIAN'

                RADIAN
                = 'RADIAN'

                MIL
                = 'MIL'

                GRAD
                = 'GRAD'

                DEGREE
                = 'DEGREE'

                MINUTE
                = 'MINUTE'

                SECOND
                = 'SECOND'

                POINT
                = 'POINT'

                CIRCLE_16
                = 'CIRCLE_16'

                CIRCLE_10
                = 'CIRCLE_10'

                CIRCLE_8
                = 'CIRCLE_8'

                CIRCLE_6
                = 'CIRCLE_6'

                CIRCLE_4
                = 'CIRCLE_4'

                CIRCLE_2
                = 'CIRCLE_2'

                FULL_CIRCLE
                = 'FULL_CIRCLE'

Properties

array
                 $_units= 'array'

Calculations for all angle units

Default valuearrayDetails

Type

array

Methods

__construct(
          mixed $value, int $type
              =
              null, \Zend_Locale $locale
              =
              null
          )

        :
          void

Zend_Measure_Abstract is an abstract class for the different measurement types

Inherited from:
                    \Zend_Measure_Abstract::__construct()

Parameters

Name
Type
Description

$value
mixed
Value as string, integer, real or float

$type
int
OPTIONAL a measure type f.e. Zend_Measure_Length::METER

$locale
\Zend_Locale
OPTIONAL a Zend_Locale Type

Throws

Exception
Description

\Zend_Measure_Exception

__toString(

          )

        :
          string

Returns a string representation

Inherited from:
                    \Zend_Measure_Abstract::__toString()

Returns

Type
Description

string

add(
          \Zend_Measure_Abstract $object
          )

        :
          \Zend_Measure_Abstract

Adds an unit to another one

Inherited from:
                    \Zend_Measure_Abstract::add()

Parameters

Name
Type
Description

$object
\Zend_Measure_Abstract
object of same unit type

Returns

Type
Description

\Zend_Measure_Abstract

compare(
          \Zend_Measure_Abstract $object
          )

        :
          boolean

Compares two units

Inherited from:
                    \Zend_Measure_Abstract::compare()

Parameters

Name
Type
Description

$object
\Zend_Measure_Abstract
object of same unit type

Returns

Type
Description

boolean

convertTo(
          string $type, integer $round
              =
              2, string|\Zend_Locale $locale
              =
              null
          )

        :
          string

Alias function for setType returning the converted unit

Inherited from:
                    \Zend_Measure_Abstract::convertTo()

Parameters

Name
Type
Description

$type
string
Constant Type

$round
integer

(Optional) Rounds the value to a given precision

$locale
string|\Zend_Locale

(Optional) Locale to set for the number

Returns

Type
Description

string

equals(
          \Zend_Measure_Abstract $object
          )

        :
          boolean

Compare if the value and type is equal

Inherited from:
                    \Zend_Measure_Abstract::equals()

Parameters

Name
Type
Description

$object
\Zend_Measure_Abstract
object to compare

Returns

Type
Description

boolean

getConversionList(

          )

        :
          array

Returns the conversion list

Inherited from:
                    \Zend_Measure_Abstract::getConversionList()

Returns

Type
Description

array

getLocale(

          )

        :
          string

Returns the actual set locale

Inherited from:
                    \Zend_Measure_Abstract::getLocale()

Returns

Type
Description

string

getType(

          )

        :
          \type

Returns the original type

Inherited from:
                    \Zend_Measure_Abstract::getType()

Returns

Type
Description

\type

getValue(
          integer $round, string|\Zend_Locale $locale
              =
              null
          )

        :
          integer|string

Returns the internal value

Inherited from:
                    \Zend_Measure_Abstract::getValue()

Parameters

Name
Type
Description

$round
integer

(Optional) Rounds the value to an given precision, Default is -1 which returns without rounding

$locale
string|\Zend_Locale

(Optional) Locale for number representation

Returns

Type
Description

integerstring

setLocale(
          string|\Zend_Locale $locale
              =
              null, boolean $check
              =
              false
          )

        :
          \Zend_Measure_Abstract

Sets a new locale for the value representation

Inherited from:
                    \Zend_Measure_Abstract::setLocale()

Parameters

Name
Type
Description

$locale
string|\Zend_Locale

(Optional) New locale to set

$check
boolean

False, check but don't set; True, set the new locale

Returns

Type
Description

\Zend_Measure_Abstract

setType(
          string $type
          )

        :
          \Zend_Measure_Abstract

Set a new type, and convert the value

Inherited from:
                    \Zend_Measure_Abstract::setType()

Parameters

Name
Type
Description

$type
string
New type to set

Returns

Type
Description

\Zend_Measure_Abstract

Throws

Exception
Description

\Zend_Measure_Exception

setValue(
          integer|string $value, string $type
              =
              null, string|\Zend_Locale $locale
              =
              null
          )

        :
          \Zend_Measure_Abstract

Set a new value

Inherited from:
                    \Zend_Measure_Abstract::setValue()

Parameters

Name
Type
Description

$value
integer|string
Value as string, integer, real or float

$type
string
OPTIONAL A measure type f.e. Zend_Measure_Length::METER

$locale
string|\Zend_Locale

OPTIONAL Locale for parsing numbers

Returns

Type
Description

\Zend_Measure_Abstract

Throws

Exception
Description

\Zend_Measure_Exception

sub(
          \Zend_Measure_Abstract $object
          )

        :
          \Zend_Measure_Abstract

Substracts an unit from another one

Inherited from:
                    \Zend_Measure_Abstract::sub()

Parameters

Name
Type
Description

$object
\Zend_Measure_Abstract
object of same unit type

Returns

Type
Description

\Zend_Measure_Abstract

toString(
          integer $round, string|\Zend_Locale $locale
              =
              null
          )

        :
          string

Returns a string representation

Inherited from:
                    \Zend_Measure_Abstract::toString()

Parameters

Name
Type
Description

$round
integer

(Optional) Runds the value to an given exception

$locale
string|\Zend_Locale

(Optional) Locale to set for the number

Returns

Type
Description

string

Documentation was generated by DocBlox 0.13.3.


text:
%% Clearing Old Data
clear all;
clf;
clc;
tic;
%% Opening the file
filename = 'test.stl';

%% Clustering
result = do_cluster_02(filename);

num_points = result{1};
num_faces = result{2};
p = result{3};
k = result{4};
v = result{5};
f = result{6};
connectivity = result{7};
PlaneID = result{8};
ClusterID = result{9};
planes = result{10};
clusters = result{11};
dissimilarity = result{12};
%% Plotting the clusters
% Display file parameters
disp(['File Name:                         ' filename]);
disp(['Number of vertices:                ' num2str(num_points)]);
disp(['Number of faces:                   ' num2str(num_faces)]);
disp(['Number of cross sections:          ' num2str(p)]);
disp(['Number of clusters:                ' num2str(k)]);

% http://www.mathworks.com/help/matlab/ref/colormap.html
colors = jet(k);

for cluster = 1:k

    current_cluster = clusters{cluster};

    % Displaying some information about the cluster
    fprintf('\n');
    disp(['Cluster ' num2str(cluster)]);
    [center, radius, area, numericArea] = numericAreaCalculation(current_cluster);
    disp(['Cluster Center:                    ' num2str(center)]);
    disp(['Cluster Radius:                    ' num2str(radius)]);
    disp(['Cluster Area:                      ' num2str(area)]);
    disp(['Cluster Numeric Area:              ' num2str(numericArea)]);
    X = current_cluster(:,1);
    Y = current_cluster(:,2);
    Z = current_cluster(:,3);
    S = 16;
    C = repmat(colors(cluster,:),numel(X),1);

    scatter3(X,Y,Z,S,C);
    hold on;

    clearvars X Y Z S C
end

clearvars colors cluster current_cluster

patch('Faces',f,'Vertices',v);
alpha(0.5);
hold off;

fprintf('\n');
toc;


text:
package com.simsilica.demo.bullet;

import com.jme3.scene.Spatial;
import com.google.common.base.Function;

/**
 *
 *
 *  @author    Paul Speed
 */
public interface ModelFactory extends Function<ModelInfo, Spatial> {

    public Spatial apply( ModelInfo modelInfo );

    public Spatial loadModel( String name );
}


text:
/*
 * OP and thread related logic
 */

const main = require('../main'),
	PostCommon = require('./common'),
	{$, _, Backbone, util, oneeSama, state} = main;

module.exports = PostCommon.extend({
	tagName: 'section',
	render() {
		const attrs = this.model.attributes;
		this.setElement(oneeSama.section(attrs)).insertIntoDOM();

		// Insert reply box into the new thread
		const reply = util.parseDOM(oneeSama.replyBox());
		if (attrs.num in state.ownPosts || !!main.request('postForm'))
			reply.style.display = 'none';
		this.el.append(reply);

		// Remove next

		this.el.nextElementSibling.remove();
		return this;
	},
	insertIntoDOM() {
		main.$threads[0].query('aside')
			.after(this.el, document.createElement('hr'));
		this.fun();
	},
	renderLocked(locked) {
		this.el.classList[locked ? 'add' : 'remove']('locked');
	},
	remove() {
		// Remove next

		this.el.nextElementSibling.remove();
		this.el.remove();
		this.stopListening();
		return this;
	},
	/*
	 Remove the top reply on board pages, if over limit, when a new reply is
	 added
	 */
	shiftReplies(postForm) {
		const attrs = this.model.attributes,
			{replies} = attrs;
		let lim = state.hotConfig.get('ABBREVIATED_REPLIES'),
			changed;
		if (postForm)
			lim--;
		// Need a static length, because the original array get's modified
		const len = replies.slice().length;
		for (let i = len; i > lim; i--) {
			const post = state.posts.get(replies.shift());
			if (!post)
				continue;
			if (post.get('image'))
				attrs.image_omit++;
			attrs.omit++;
			changed = true;
			post.remove();
		}
		if (changed)
			this.renderOmit(attrs.omit, attrs.image_omit)
	},
	// Posts and images omited indicator
	renderOmit(omit = this.model.get('omit'),
		image_omit = this.model.get('image_omit')
	) {
		if (omit === 0)
			return;
		const {thread, href} = state.page.attributes;
		this.el.query('.omit').innerHTML = oneeSama.lang.abbrev_msg(omit,
			this.model.get('image_omit'), thread && href.split('?')[0]);
	},
	// Move thread to the top of the page
	bumpThread() {
		this.el.nextElementSibling.remove();
		this.el.remove();
		this.insertIntoDOM();
	}
});


text:
package com.telefonica.euro_iaas.paasmanager.rest.util;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.Before;
import org.junit.Test;

import com.telefonica.euro_iaas.paasmanager.model.Attribute;
import com.telefonica.euro_iaas.paasmanager.model.ProductInstance;
import com.telefonica.euro_iaas.paasmanager.model.dto.EnvironmentDto;
import com.telefonica.euro_iaas.paasmanager.model.dto.EnvironmentInstanceDto;
import com.telefonica.euro_iaas.paasmanager.model.dto.ProductInstanceDto;
import com.telefonica.euro_iaas.paasmanager.model.dto.ProductReleaseDto;
import com.telefonica.euro_iaas.paasmanager.model.dto.TierDto;
import com.telefonica.euro_iaas.paasmanager.model.dto.TierInstanceDto;
import com.telefonica.euro_iaas.paasmanager.util.SystemPropertiesProvider;

/**
 * @author jesus.movilla
 */
public class OVFGenerationFiwareImplTest {

    private OVFGenerationFiwareImpl ovfGenerationImpl;
    private SystemPropertiesProvider systemPropertiesProvider;

    EnvironmentInstanceDto environmentInstanceDto;
    TierInstanceDto tierInstanceDto;

    List<ProductInstance> productInstances = new ArrayList<ProductInstance>();
    List<TierInstanceDto> tierInstancesDto = new ArrayList<TierInstanceDto>();

    ProductInstanceDto pInstance1, pInstance2;
    TierInstanceDto tierInstanceDto1, tierInstanceDto2;

    ProductReleaseDto pReleaseDto1, pReleaseDto2;

    @Before
    public void setUp() throws Exception {

        systemPropertiesProvider = mock(SystemPropertiesProvider.class);
        when(systemPropertiesProvider.getProperty(any(String.class))).thenReturn("./../core/src/main/resources/");
        ovfGenerationImpl = new OVFGenerationFiwareImpl();
        ovfGenerationImpl.setSystemPropertiesProvider(systemPropertiesProvider);

        Attribute attr1 = new Attribute("key1", "value1");
        Attribute attr2 = new Attribute("key2", "value2");
        Attribute attr3 = new Attribute("key3", "value3");

        Set<Attribute> privateAttributes1 = new HashSet<Attribute>();
        privateAttributes1.add(attr1);
        privateAttributes1.add(attr2);

        Set<Attribute> privateAttributes2 = new HashSet<Attribute>();
        privateAttributes2.add(attr2);
        privateAttributes2.add(attr3);

        pReleaseDto1 = new ProductReleaseDto();
        pReleaseDto1.setProductName("nameTest");
        pReleaseDto1.setVersion("versionTest");

        pReleaseDto2 = new ProductReleaseDto();
        pReleaseDto2.setProductName("nameTest");
        pReleaseDto2.setVersion("versionTest");

        pInstance1 = new ProductInstanceDto(pReleaseDto1);
        pInstance1.setAttributes(privateAttributes1);
        pInstance1.setName("pInstanceName1");

        pInstance2 = new ProductInstanceDto(pReleaseDto2);
        pInstance2.setName("pInstanceName2");
        pInstance2.setAttributes(privateAttributes2);

        List<ProductInstanceDto> pInstances1 = new ArrayList<ProductInstanceDto>();
        pInstances1.add(pInstance1);

        List<ProductInstanceDto> pInstances2 = new ArrayList<ProductInstanceDto>();
        pInstances2.add(pInstance2);

        tierInstanceDto1 = new TierInstanceDto("tierInstaceName1", new TierDto(), 1, pInstances1, "fqnTierInstance1");
        tierInstanceDto2 = new TierInstanceDto("tierInstanceName2", new TierDto(), 1, pInstances2, "fqnTierInstance2");

        tierInstancesDto.add(tierInstanceDto1);
        tierInstancesDto.add(tierInstanceDto2);

        environmentInstanceDto = new EnvironmentInstanceDto("envInstanceName", new EnvironmentDto(), tierInstancesDto,
                "vdc");
    }

    @Test
    public void testCreateOvfFromEnvironmentFiware() throws Exception {

        Attribute attr1 = new Attribute("key1", "value1");
        Attribute attr2 = new Attribute("key2", "value2");
        Attribute attr3 = new Attribute("key3", "value3");

        List<Attribute> privateAttributes1 = new ArrayList<Attribute>();
        privateAttributes1.add(attr1);
        privateAttributes1.add(attr2);

        List<Attribute> privateAttributes2 = new ArrayList<Attribute>();
        privateAttributes2.add(attr2);
        privateAttributes2.add(attr3);

        pReleaseDto1 = new ProductReleaseDto();
        pReleaseDto1.setProductName("nameTest");
        pReleaseDto1.setVersion("versionTest");

        pReleaseDto2 = new ProductReleaseDto();
        pReleaseDto2.setProductName("nameTest");
        pReleaseDto2.setVersion("versionTest");

        List<ProductReleaseDto> p1Releases = new ArrayList<ProductReleaseDto>();
        p1Releases.add(pReleaseDto1);

        List<ProductReleaseDto> p2Releases = new ArrayList<ProductReleaseDto>();
        p2Releases.add(pReleaseDto2);

        TierDto tier1 = new TierDto("tiertomcat", 1, 1, 1, p1Releases, "1", "image", "icono", "security_group",
                "keypair", "yes");
        TierDto tier2 = new TierDto("tierpostgres", 1, 1, 1, p2Releases, "1", "image", "icono", "security_group",
                "keypair", "yes");

        Set<TierDto> tiersDto = new HashSet<TierDto>();
        tiersDto.add(tier1);
        tiersDto.add(tier2);

        EnvironmentDto environment = new EnvironmentDto(tiersDto, "environmentname", "description");

        String ovf = ovfGenerationImpl.createOvf(environment);

    }

    @Test
    public void testCreateOvfFromEnvironmentNoFiware() throws Exception {

        Attribute attr1 = new Attribute("key1", "value1");
        Attribute attr2 = new Attribute("key2", "value2");
        Attribute attr3 = new Attribute("key3", "value3");

        List<Attribute> privateAttributes1 = new ArrayList<Attribute>();
        privateAttributes1.add(attr1);
        privateAttributes1.add(attr2);

        List<Attribute> privateAttributes2 = new ArrayList<Attribute>();
        privateAttributes2.add(attr2);
        privateAttributes2.add(attr3);

        pReleaseDto1 = new ProductReleaseDto();
        pReleaseDto1.setProductName("nameTest");
        pReleaseDto1.setVersion("versionTest");

        pReleaseDto2 = new ProductReleaseDto();
        pReleaseDto2.setProductName("nameTest");
        pReleaseDto2.setVersion("versionTest");

        List<ProductReleaseDto> p1Releases = new ArrayList<ProductReleaseDto>();
        p1Releases.add(pReleaseDto1);

        List<ProductReleaseDto> p2Releases = new ArrayList<ProductReleaseDto>();
        p2Releases.add(pReleaseDto2);

        TierDto tier1 = new TierDto("tiertomcat", 1, 1, 1, p1Releases);
        TierDto tier2 = new TierDto("tierpostgres", 1, 1, 1, p2Releases);
        tier1.setImage("image");
        tier2.setImage("image2");

        Set<TierDto> tiersDto = new HashSet<TierDto>();
        tiersDto.add(tier1);
        tiersDto.add(tier2);

        EnvironmentDto environment = new EnvironmentDto(tiersDto, "environmentname", "description");

        String ovf = ovfGenerationImpl.createOvf(environment);

    }

    @Test
    public void testCreateOvfMongo() throws Exception {

        Attribute attr1 = new Attribute("key1", "value1");
        Attribute attr2 = new Attribute("key2", "value2");
        Attribute attr3 = new Attribute("key3", "value3");

        List<Attribute> privateAttributes1 = new ArrayList<Attribute>();
        privateAttributes1.add(attr1);
        privateAttributes1.add(attr2);

        List<Attribute> privateAttributes2 = new ArrayList<Attribute>();
        privateAttributes2.add(attr2);
        privateAttributes2.add(attr3);

        pReleaseDto2 = new ProductReleaseDto();
        pReleaseDto2.setProductName("nameTest");
        pReleaseDto2.setVersion("versionTest");

        List<ProductReleaseDto> p2Releases = new ArrayList<ProductReleaseDto>();
        p2Releases.add(pReleaseDto2);

        /*
         * <tierDtos> <minimum_number_instances>1</minimum_number_instances>
         * <initial_number_instances>1</initial_number_instances> <maximum_number_instances>1</maximum_number_instances>
         * <name>mongoconfig</name> <flavour>2</flavour> <image>945689be-1231-4414-8c3e-09bcee4e8e63</image>
         * <keypair>testpaas</keypair> <floatingip>false</floatingip> <productReleaseDtos>
         * <productName>mongodbconfig</productName> <version>2.2.3</version> </productReleaseDtos> </tierDtos>
         */

        ProductReleaseDto pReleaseDto1 = new ProductReleaseDto();
        pReleaseDto1.setProductName("mongodbconfig");
        pReleaseDto1.setVersion("2.2.3");
        List<ProductReleaseDto> p1Releasesmongoconfig = new ArrayList<ProductReleaseDto>();
        p1Releasesmongoconfig.add(pReleaseDto1);
        TierDto tiermongoconfig = new TierDto("tiermongoconfig", 1, 1, 1, p1Releasesmongoconfig, "2",
                "945689be-1231-4414-8c3e-09bcee4e8e63", "icono", "testpaas", "false");
        tiermongoconfig.setSecurityGroup("security_group");

        Set<TierDto> tiersDto = new HashSet<TierDto>();
        tiersDto.add(tiermongoconfig);

        /*
         * <tierDtos> <minimum_number_instances>1</minimum_number_instances>
         * <initial_number_instances>1</initial_number_instances> <maximum_number_instances>5</maximum_number_instances>
         * <name>mongoshard</name> <flavour>2</flavour> <image>945689be-1231-4414-8c3e-09bcee4e8e63</image>
         * <keypair>testpaas</keypair> <floatingip>false</floatingip> <productReleaseDtos>
         * <productName>mongodbshard</productName> <version>2.2.3</version> </productReleaseDtos> </tierDtos>
         */

        ProductReleaseDto pReleaseDto2 = new ProductReleaseDto();
        pReleaseDto2.setProductName("mongodbshard");
        pReleaseDto2.setVersion("2.2.3");
        List<ProductReleaseDto> p1Releasesmongoshard = new ArrayList<ProductReleaseDto>();
        p1Releasesmongoshard.add(pReleaseDto2);

        TierDto tiermongoshard = new TierDto("tiermongoshard", 6, 1, 1, p1Releasesmongoshard, "2",
                "945689be-1231-4414-8c3e-09bcee4e8e63", "icono", "testpaas", "false");
        tiermongoshard.setSecurityGroup("security_group");

        tiersDto.add(tiermongoshard);

        /*
         * <tierDtos> <minimum_number_instances>1</minimum_number_instances>
         * <initial_number_instances>1</initial_number_instances> <maximum_number_instances>1</maximum_number_instances>
         * <name>contextbroker</name> <flavour>2</flavour> <image>945689be-1231-4414-8c3e-09bcee4e8e63</image>
         * <keypair>testpaas</keypair> <floatingip>true</floatingip> <productReleaseDtos>
         * <productName>mongos</productName> <version>2.2.3</version> </productReleaseDtos> <productReleaseDtos>
         * <productName>contextbroker</productName> <version>1.0.0</version> </productReleaseDtos> </tierDtos>
         */

        ProductReleaseDto p1Releasecontextbroker = new ProductReleaseDto();
        p1Releasecontextbroker.setProductName("mongos");
        p1Releasecontextbroker.setVersion("2.2.3");
        ProductReleaseDto p1Releasecontextbroker2 = new ProductReleaseDto();
        p1Releasecontextbroker2.setProductName("tiercontextbroker");
        p1Releasecontextbroker2.setVersion("1.0.0");
        List<ProductReleaseDto> p1Releasescontextbroker = new ArrayList<ProductReleaseDto>();
        p1Releasescontextbroker.add(p1Releasecontextbroker);
        p1Releasescontextbroker.add(p1Releasecontextbroker2);

        TierDto tiercontextbroker = new TierDto("contextbroker ", 1, 1, 1, p1Releasescontextbroker, "2",
                "945689be-1231-4414-8c3e-09bcee4e8e63", "icono", "testpaas", "false");
        tiercontextbroker.setSecurityGroup("security_group");

        tiersDto.add(tiercontextbroker);

        EnvironmentDto environment = new EnvironmentDto(tiersDto, "environmentname", "description");

        String ovf = ovfGenerationImpl.createOvf(environment);

    }

    @Test
    public void testCreateOvfTierNoproduct() throws Exception {

        TierDto tiercontextbroker = new TierDto("contextbroker ", 1, 1, 1, null, "2",
                "945689be-1231-4414-8c3e-09bcee4e8e63", "icono", "testpaas", "false");
        tiercontextbroker.setSecurityGroup("security_group");

        Set<TierDto> tiersDto = new HashSet<TierDto>();
        tiersDto.add(tiercontextbroker);

        EnvironmentDto environment = new EnvironmentDto(tiersDto, "environmentname", "description");

        String ovf = ovfGenerationImpl.createOvf(environment);
    }

}


text:
/*!
 * FullCalendar v3.8.2
 * Docs & License: https://fullcalendar.io/
 * (c) 2018 Adam Shaw
 */
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("fullcalendar"), require("jquery"));
	else if(typeof define === 'function' && define.amd)
		define(["fullcalendar", "jquery"], factory);
	else if(typeof exports === 'object')
		factory(require("fullcalendar"), require("jquery"));
	else
		factory(root["FullCalendar"], root["jQuery"]);
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 265);
/******/ })
/************************************************************************/
/******/ ({

/***/ 1:
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_1__;

/***/ }),

/***/ 2:
/***/ (function(module, exports) {

/*
derived from:
https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js

only include the helpers we need, to keep down filesize
*/
var extendStatics = Object.setPrototypeOf ||
    ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
    function (d, b) { for (var p in b)
        if (b.hasOwnProperty(p))
            d[p] = b[p]; };
exports.__extends = function (d, b) {
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};

/***/ }),

/***/ 265:
/***/ (function(module, exports, __webpack_require__) {

Object.defineProperty(exports, "__esModule", { value: true });
var exportHooks = __webpack_require__(1);
var GcalEventSource_1 = __webpack_require__(266);
exportHooks.EventSourceParser.registerClass(GcalEventSource_1.default);
exportHooks.GcalEventSource = GcalEventSource_1.default;

/***/ }),

/***/ 266:
/***/ (function(module, exports, __webpack_require__) {

Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = __webpack_require__(2);
var $ = __webpack_require__(3);
var fullcalendar_1 = __webpack_require__(1);
var GcalEventSource = /** @class */ (function (_super) {
    tslib_1.__extends(GcalEventSource, _super);
    function GcalEventSource() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GcalEventSource.parse = function (rawInput, calendar) {
        var rawProps;
        if (typeof rawInput === 'object') {
            rawProps = rawInput;
        }
        else if (typeof rawInput === 'string') {
            rawProps = { url: rawInput }; // url will be parsed with parseGoogleCalendarId
        }
        if (rawProps) {
            return fullcalendar_1.EventSource.parse.call(this, rawProps, calendar);
        }
        return false;
    };
    GcalEventSource.prototype.fetch = function (start, end, timezone) {
        var _this = this;
        var url = this.buildUrl();
        var requestParams = this.buildRequestParams(start, end, timezone);
        var ajaxSettings = this.ajaxSettings || {};
        var onSuccess = ajaxSettings.success;
        if (!requestParams) {
            return fullcalendar_1.Promise.reject();
        }
        this.calendar.pushLoading();
        return fullcalendar_1.Promise.construct(function (onResolve, onReject) {
            $.ajax($.extend({}, // destination
            fullcalendar_1.JsonFeedEventSource.AJAX_DEFAULTS, ajaxSettings, {
                url: url,
                data: requestParams,
                success: function (responseData, status, xhr) {
                    var rawEventDefs;
                    var successRes;
                    _this.calendar.popLoading();
                    if (responseData.error) {
                        _this.reportError('Google Calendar API: ' + responseData.error.message, responseData.error.errors);
                        onReject();
                    }
                    else if (responseData.items) {
                        rawEventDefs = _this.gcalItemsToRawEventDefs(responseData.items, requestParams.timeZone);
                        successRes = fullcalendar_1.applyAll(onSuccess, _this, [responseData, status, xhr]); // passthru
                        if ($.isArray(successRes)) {
                            rawEventDefs = successRes;
                        }
                        onResolve(_this.parseEventDefs(rawEventDefs));
                    }
                },
                error: function (xhr, statusText, errorThrown) {
                    _this.reportError('Google Calendar network failure: ' + statusText, [xhr, errorThrown]);
                    _this.calendar.popLoading();
                    onReject();
                }
            }));
        });
    };
    GcalEventSource.prototype.gcalItemsToRawEventDefs = function (items, gcalTimezone) {
        var _this = this;
        return items.map(function (item) {
            return _this.gcalItemToRawEventDef(item, gcalTimezone);
        });
    };
    GcalEventSource.prototype.gcalItemToRawEventDef = function (item, gcalTimezone) {
        var url = item.htmlLink || null;
        // make the URLs for each event show times in the correct timezone
        if (url && gcalTimezone) {
            url = injectQsComponent(url, 'ctz=' + gcalTimezone);
        }
        return {
            id: item.id,
            title: item.summary,
            start: item.start.dateTime || item.start.date,
            end: item.end.dateTime || item.end.date,
            url: url,
            location: item.location,
            description: item.description
        };
    };
    GcalEventSource.prototype.buildUrl = function () {
        return GcalEventSource.API_BASE + '/' +
            encodeURIComponent(this.googleCalendarId) +
            '/events?callback=?'; // jsonp
    };
    GcalEventSource.prototype.buildRequestParams = function (start, end, timezone) {
        var apiKey = this.googleCalendarApiKey || this.calendar.opt('googleCalendarApiKey');
        var params;
        if (!apiKey) {
            this.reportError('Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/');
            return null;
        }
        // The API expects an ISO8601 datetime with a time and timezone part.
        // Since the calendar's timezone offset isn't always known, request the date in UTC and pad it by a day on each
        // side, guaranteeing we will receive all events in the desired range, albeit a superset.
        // .utc() will set a zone and give it a 00:00:00 time.
        if (!start.hasZone()) {
            start = start.clone().utc().add(-1, 'day');
        }
        if (!end.hasZone()) {
            end = end.clone().utc().add(1, 'day');
        }
        params = $.extend(this.ajaxSettings.data || {}, {
            key: apiKey,
            timeMin: start.format(),
            timeMax: end.format(),
            singleEvents: true,
            maxResults: 9999
        });
        if (timezone && timezone !== 'local') {
            // when sending timezone names to Google, only accepts underscores, not spaces
            params.timeZone = timezone.replace(' ', '_');
        }
        return params;
    };
    GcalEventSource.prototype.reportError = function (message, apiErrorObjs) {
        var calendar = this.calendar;
        var calendarOnError = calendar.opt('googleCalendarError');
        var errorObjs = apiErrorObjs || [{ message: message }]; // to be passed into error handlers
        if (this.googleCalendarError) {
            this.googleCalendarError.apply(calendar, errorObjs);
        }
        if (calendarOnError) {
            calendarOnError.apply(calendar, errorObjs);
        }
        // print error to debug console
        fullcalendar_1.warn.apply(null, [message].concat(apiErrorObjs || []));
    };
    GcalEventSource.prototype.getPrimitive = function () {
        return this.googleCalendarId;
    };
    GcalEventSource.prototype.applyManualStandardProps = function (rawProps) {
        var superSuccess = fullcalendar_1.EventSource.prototype.applyManualStandardProps.apply(this, arguments);
        var googleCalendarId = rawProps.googleCalendarId;
        if (googleCalendarId == null && rawProps.url) {
            googleCalendarId = parseGoogleCalendarId(rawProps.url);
        }
        if (googleCalendarId != null) {
            this.googleCalendarId = googleCalendarId;
            return superSuccess;
        }
        return false;
    };
    GcalEventSource.prototype.applyMiscProps = function (rawProps) {
        if (!this.ajaxSettings) {
            this.ajaxSettings = {};
        }
        $.extend(this.ajaxSettings, rawProps);
    };
    GcalEventSource.API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
    return GcalEventSource;
}(fullcalendar_1.EventSource));
exports.default = GcalEventSource;
GcalEventSource.defineStandardProps({
    // manually process...
    url: false,
    googleCalendarId: false,
    // automatically transfer...
    googleCalendarApiKey: true,
    googleCalendarError: true
});
function parseGoogleCalendarId(url) {
    var match;
    // detect if the ID was specified as a single string.
    // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars.
    if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) {
        return url;
    }
    else if ((match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
        (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))) {
        return decodeURIComponent(match[1]);
    }
}
// Injects a string like "arg=value" into the querystring of a URL
function injectQsComponent(url, component) {
    // inject it after the querystring but before the fragment
    return url.replace(/(\?.*?)?(#|$)/, function (whole, qs, hash) {
        return (qs ? qs + '&' : '?') + component + hash;
    });
}

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_3__;

/***/ })

/******/ });
});


text:
import type { FractureRuleType } from "../../types/css-rules";

export const width: Array<FractureRuleType> = [
  { selector: 'w-0', declarations: { width: '0' }, description: 'Width is 0 pixel.' },
  { selector: 'w-viewport', declarations: { width: '100vw' }, description: 'Width is 100 viewport-width.' },
  { selector: 'w-px', declarations: { width: 'var(--box-px)' }, description: 'Width is {1}px.' },
  { selector: 'w-1', declarations: { width: 'var(--box-1)' }, description: 'Width is {2}px.' },
  { selector: 'w-2', declarations: { width: 'var(--box-2)' }, description: 'Width is {4}px.' },
  { selector: 'w-3', declarations: { width: 'var(--box-3)' }, description: 'Width is {4}px.' },
  { selector: 'w-4', declarations: { width: 'var(--box-4)' }, description: 'Width is {8}px.' },
  { selector: 'w-5', declarations: { width: 'var(--box-5)' }, description: 'Width is {10}px.' },
  { selector: 'w-6', declarations: { width: 'var(--box-6)' }, description: 'Width is {12}px.' },
  { selector: 'w-7', declarations: { width: 'var(--box-7)' }, description: 'Width is {14}px.' },
  { selector: 'w-8', declarations: { width: 'var(--box-8)' }, description: 'Width is {16}px.' },
  { selector: 'w-9', declarations: { width: 'var(--box-9)' }, description: 'Width is {18}px.' },
  { selector: 'w-10', declarations: { width: 'var(--box-10)' }, description: 'Width is {20}px.' },
  { selector: 'w-11', declarations: { width: 'var(--box-11)' }, description: 'Width is {22}px.' },
  { selector: 'w-12', declarations: { width: 'var(--box-12)' }, description: 'Width is {24}px.' },
  { selector: 'w-13', declarations: { width: 'var(--box-13)' }, description: 'Width is {26}px.' },
  { selector: 'w-14', declarations: { width: 'var(--box-14)' }, description: 'Width is {28}px.' },
  { selector: 'w-15', declarations: { width: 'var(--box-15)' }, description: 'Width is {30}px.' },
  { selector: 'w-16', declarations: { width: 'var(--box-16)' }, description: 'Width is {32}px.' },
  { selector: 'w-24', declarations: { width: 'var(--box-24)' }, description: 'Width is {48}px.' },
  { selector: 'w-32', declarations: { width: 'var(--box-32)' }, description: 'Width is {64}px.' },
  { selector: 'w-40', declarations: { width: 'var(--box-40)' }, description: 'Width is {80}px.' },
  { selector: 'w-48', declarations: { width: 'var(--box-48)' }, description: 'Width is {96}px.' },

  { selector: 'wp-10', declarations: { width: '10%' }, description: 'Width is 10%.' },
  { selector: 'wp-15', declarations: { width: '15%' }, description: 'Width is 15%.' },
  { selector: 'wp-20', declarations: { width: '20%' }, description: 'Width is 20%.' },
  { selector: 'wp-25', declarations: { width: '25%' }, description: 'Width is 25%.' },
  { selector: 'wp-30', declarations: { width: '30%' }, description: 'Width is 30%.' },
  { selector: 'wp-33', declarations: { width: 'calc(100%/3)' }, description: 'Width is 33%.' },
  { selector: 'wp-35', declarations: { width: '35%' }, description: 'Width is 35%.' },
  { selector: 'wp-40', declarations: { width: '40%' }, description: 'Width is 40%.' },
  { selector: 'wp-45', declarations: { width: '45%' }, description: 'Width is 45%.' },
  { selector: 'wp-50', declarations: { width: '50%' }, description: 'Width is 50%.' },
  { selector: 'wp-55', declarations: { width: '55%' }, description: 'Width is 55%.' },
  { selector: 'wp-60', declarations: { width: '60%' }, description: 'Width is 60%.' },
  { selector: 'wp-66', declarations: { width: 'calc((100%/3)*2)' }, description: 'Width is 66%.' },
  { selector: 'wp-65', declarations: { width: '65%' }, description: 'Width is 65%.' },
  { selector: 'wp-70', declarations: { width: '70%' }, description: 'Width is 70%.' },
  { selector: 'wp-75', declarations: { width: '75%' }, description: 'Width is 75%.' },
  { selector: 'wp-80', declarations: { width: '80%' }, description: 'Width is 80%.' },
  { selector: 'wp-85', declarations: { width: '85%' }, description: 'Width is 85%.' },
  { selector: 'wp-90', declarations: { width: '90%' }, description: 'Width is 90%.' },
  { selector: 'wp-95', declarations: { width: '95%' }, description: 'Width is 95%.' },
  { selector: 'wp-100', declarations: { width: '100%' }, description: 'Width is 100%.' },

  { selector: 'wmax-0', declarations: { maxWidth: '0' }, description: 'Max-width is 0.' },
  { selector: 'wmax-viewport', declarations: { maxWidth: '100vw' }, description: 'Max-width is 100 viewport-width.' },
  { selector: 'wmax-px', declarations: { maxWidth: 'var(--box-px)' }, description: 'Max-width is {1}px.' },
  { selector: 'wmax-1', declarations: { maxWidth: 'var(--box-1)' }, description: 'Max-width is {2}px.' },
  { selector: 'wmax-2', declarations: { maxWidth: 'var(--box-2)' }, description: 'Max-width is {4}px.' },
  { selector: 'wmax-3', declarations: { maxWidth: 'var(--box-3)' }, description: 'Max-width is {6}px.' },
  { selector: 'wmax-4', declarations: { maxWidth: 'var(--box-4)' }, description: 'Max-width is {8}px.' },
  { selector: 'wmax-5', declarations: { maxWidth: 'var(--box-5)' }, description: 'Max-width is {10}px.' },
  { selector: 'wmax-6', declarations: { maxWidth: 'var(--box-6)' }, description: 'Max-width is {12}px.' },
  { selector: 'wmax-7', declarations: { maxWidth: 'var(--box-7)' }, description: 'Max-width is {14}px.' },
  { selector: 'wmax-8', declarations: { maxWidth: 'var(--box-8)' }, description: 'Max-width is {16}px.' },
  { selector: 'wmax-9', declarations: { maxWidth: 'var(--box-9)' }, description: 'Max-width is {18}px.' },
  { selector: 'wmax-10', declarations: { maxWidth: 'var(--box-10)' }, description: 'Max-width is {20}px.' },
  { selector: 'wmax-11', declarations: { maxWidth: 'var(--box-11)' }, description: 'Max-width is {22}px.' },
  { selector: 'wmax-12', declarations: { maxWidth: 'var(--box-12)' }, description: 'Max-width is {24}px.' },
  { selector: 'wmax-13', declarations: { maxWidth: 'var(--box-13)' }, description: 'Max-width is {26}px.' },
  { selector: 'wmax-14', declarations: { maxWidth: 'var(--box-14)' }, description: 'Max-width is {28}px.' },
  { selector: 'wmax-15', declarations: { maxWidth: 'var(--box-15)' }, description: 'Max-width is {30}px.' },
  { selector: 'wmax-16', declarations: { maxWidth: 'var(--box-16)' }, description: 'Max-width is {32}px.' },
  { selector: 'wmax-24', declarations: { maxWidth: 'var(--box-24)' }, description: 'Max-width is {48}px.' },
  { selector: 'wmax-32', declarations: { maxWidth: 'var(--box-32)' }, description: 'Max-width is {64}px.' },
  { selector: 'wmax-40', declarations: { maxWidth: 'var(--box-40)' }, description: 'Max-width is {80}px.' },
  { selector: 'wmax-48', declarations: { maxWidth: 'var(--box-48)' }, description: 'Max-width is {96}px.' },

  { selector: 'wpmax-10', declarations: { maxWidth: '10%' }, description: 'Max-width is 10%.' },
  { selector: 'wpmax-15', declarations: { maxWidth: '15%' }, description: 'Max-width is 15%.' },
  { selector: 'wpmax-20', declarations: { maxWidth: '20%' }, description: 'Max-width is 20%.' },
  { selector: 'wpmax-25', declarations: { maxWidth: '25%' }, description: 'Max-width is 25%.' },
  { selector: 'wpmax-30', declarations: { maxWidth: '30%' }, description: 'Max-width is 30%.' },
  { selector: 'wpmax-33', declarations: { maxWidth: 'calc(100%/3)' }, description: 'Max-width is 33%.' },
  { selector: 'wpmax-35', declarations: { maxWidth: '35%' }, description: 'Max-width is 35%.' },
  { selector: 'wpmax-40', declarations: { maxWidth: '40%' }, description: 'Max-width is 40%.' },
  { selector: 'wpmax-45', declarations: { maxWidth: '45%' }, description: 'Max-width is 45%.' },
  { selector: 'wpmax-50', declarations: { maxWidth: '50%' }, description: 'Max-width is 50%.' },
  { selector: 'wpmax-55', declarations: { maxWidth: '55%' }, description: 'Max-width is 55%.' },
  { selector: 'wpmax-60', declarations: { maxWidth: '60%' }, description: 'Max-width is 60%.' },
  { selector: 'wpmax-66', declarations: { maxWidth: 'calc((100%/3)*2)' }, description: 'Max-width is 66%.' },
  { selector: 'wpmax-65', declarations: { maxWidth: '65%' }, description: 'Max-width is 65%.' },
  { selector: 'wpmax-70', declarations: { maxWidth: '70%' }, description: 'Max-width is 70%.' },
  { selector: 'wpmax-75', declarations: { maxWidth: '75%' }, description: 'Max-width is 75%.' },
  { selector: 'wpmax-80', declarations: { maxWidth: '80%' }, description: 'Max-width is 80%.' },
  { selector: 'wpmax-85', declarations: { maxWidth: '85%' }, description: 'Max-width is 85%.' },
  { selector: 'wpmax-90', declarations: { maxWidth: '90%' }, description: 'Max-width is 90%.' },
  { selector: 'wpmax-95', declarations: { maxWidth: '95%' }, description: 'Max-width is 95%.' },
  { selector: 'wpmax-100', declarations: { maxWidth: '100%' }, description: 'Max-width is 100%.' },

  { selector: 'wmin-0', declarations: { minWidth: '0' }, description: 'Min-width is 0.' },
  { selector: 'wmin-viewport', declarations: { minWidth: '100vw' }, description: 'Min-width is 100 viewport-width.' },
  { selector: 'wmin-px', declarations: { minWidth: 'var(--box-px)' }, description: 'Min-width is {1}px.' },
  { selector: 'wmin-1', declarations: { minWidth: 'var(--box-1)' }, description: 'Min-width is {2}px.' },
  { selector: 'wmin-2', declarations: { minWidth: 'var(--box-2)' }, description: 'Min-width is {4}px.' },
  { selector: 'wmin-3', declarations: { minWidth: 'var(--box-3)' }, description: 'Min-width is {6}px.' },
  { selector: 'wmin-4', declarations: { minWidth: 'var(--box-4)' }, description: 'Min-width is {8}px.' },
  { selector: 'wmin-5', declarations: { minWidth: 'var(--box-5)' }, description: 'Min-width is {10}px.' },
  { selector: 'wmin-6', declarations: { minWidth: 'var(--box-6)' }, description: 'Min-width is {12}px.' },
  { selector: 'wmin-7', declarations: { minWidth: 'var(--box-7)' }, description: 'Min-width is {14}px.' },
  { selector: 'wmin-8', declarations: { minWidth: 'var(--box-8)' }, description: 'Min-width is {16}px.' },
  { selector: 'wmin-9', declarations: { minWidth: 'var(--box-9)' }, description: 'Min-width is {18}px.' },
  { selector: 'wmin-10', declarations: { minWidth: 'var(--box-10)' }, description: 'Min-width is {20}px.' },
  { selector: 'wmin-11', declarations: { minWidth: 'var(--box-11)' }, description: 'Min-width is {22}px.' },
  { selector: 'wmin-12', declarations: { minWidth: 'var(--box-12)' }, description: 'Min-width is {24}px.' },
  { selector: 'wmin-13', declarations: { minWidth: 'var(--box-13)' }, description: 'Min-width is {26}px.' },
  { selector: 'wmin-14', declarations: { minWidth: 'var(--box-14)' }, description: 'Min-width is {28}px.' },
  { selector: 'wmin-15', declarations: { minWidth: 'var(--box-15)' }, description: 'Min-width is {30}px.' },
  { selector: 'wmin-16', declarations: { minWidth: 'var(--box-16)' }, description: 'Min-width is {32}px.' },
  { selector: 'wmin-24', declarations: { minWidth: 'var(--box-24)' }, description: 'Min-width is {48}px.' },
  { selector: 'wmin-32', declarations: { minWidth: 'var(--box-32)' }, description: 'Min-width is {64}px.' },
  { selector: 'wmin-40', declarations: { minWidth: 'var(--box-40)' }, description: 'Min-width is {80}px.' },
  { selector: 'wmin-48', declarations: { minWidth: 'var(--box-48)' }, description: 'Min-width is {96}px.' },

  { selector: 'wpmin-10', declarations: { minWidth: '10%' }, description: 'Min-width is 10%.' },
  { selector: 'wpmin-15', declarations: { minWidth: '15%' }, description: 'Min-width is 15%.' },
  { selector: 'wpmin-20', declarations: { minWidth: '20%' }, description: 'Min-width is 20%.' },
  { selector: 'wpmin-25', declarations: { minWidth: '25%' }, description: 'Min-width is 25%.' },
  { selector: 'wpmin-30', declarations: { minWidth: '30%' }, description: 'Min-width is 30%.' },
  { selector: 'wpmin-33', declarations: { minWidth: 'calc(100%/3)' }, description: 'Min-width is 33%.' },
  { selector: 'wpmin-35', declarations: { minWidth: '35%' }, description: 'Min-width is 35%.' },
  { selector: 'wpmin-40', declarations: { minWidth: '40%' }, description: 'Min-width is 40%.' },
  { selector: 'wpmin-45', declarations: { minWidth: '45%' }, description: 'Min-width is 45%.' },
  { selector: 'wpmin-50', declarations: { minWidth: '50%' }, description: 'Min-width is 50%.' },
  { selector: 'wpmin-55', declarations: { minWidth: '55%' }, description: 'Min-width is 55%.' },
  { selector: 'wpmin-60', declarations: { minWidth: '60%' }, description: 'Min-width is 60%.' },
  { selector: 'wpmin-65', declarations: { minWidth: '65%' }, description: 'Min-width is 65%.' },
  { selector: 'wpmin-66', declarations: { minWidth: 'calc((100%/3)*2)' }, description: 'Min-width is 66%.' },
  { selector: 'wpmin-70', declarations: { minWidth: '70%' }, description: 'Min-width is 70%.' },
  { selector: 'wpmin-75', declarations: { minWidth: '75%' }, description: 'Min-width is 75%.' },
  { selector: 'wpmin-80', declarations: { minWidth: '80%' }, description: 'Min-width is 80%.' },
  { selector: 'wpmin-85', declarations: { minWidth: '85%' }, description: 'Min-width is 85%.' },
  { selector: 'wpmin-90', declarations: { minWidth: '90%' }, description: 'Min-width is 90%.' },
  { selector: 'wpmin-95', declarations: { minWidth: '95%' }, description: 'Min-width is 95%.' },
  { selector: 'wpmin-100', declarations: { minWidth: '100%' }, description: 'Min-width is 100%.' },
];


text:
namespace content {

// Filters interface requests received from an execution context of the type
// corresponding to |spec| in the renderer process with ID |process_id|.
// |receiver| is the PendingReceiver<InterfaceProvider> from the renderer; an
// equivalent PendingReceiver<InterfaceProvider> where GetInterface receivers
// have been filtered.
//
// If |process_id| does not refer to a renderer process or if that renderer's
// BrowserContext does not have a Connector, the connection is broken instead;
// that is, |receiver| and the mojo::PendingRemote<Interface> corresponding
// to the returned receiver are both closed.
mojo::PendingReceiver<service_manager::mojom::InterfaceProvider>
FilterRendererExposedInterfaces(
    const char* spec,
    int process_id,
    mojo::PendingReceiver<service_manager::mojom::InterfaceProvider> receiver);

namespace test {

// Allows through all interface requests while in scope. For testing only.
//
// TODO(https://crbug.com/792407): See if browser tests can just set up the
// service_Manager::Connector properly instead of this heavy-handed solution.
class CONTENT_EXPORT ScopedInterfaceFilterBypass {
 public:
  ScopedInterfaceFilterBypass();
  ~ScopedInterfaceFilterBypass();

 private:
  DISALLOW_COPY_AND_ASSIGN(ScopedInterfaceFilterBypass);
};

}  // namespace test

}  // namespace content

#endif  // CONTENT_BROWSER_INTERFACE_PROVIDER_FILTERING_H_


text:
namespace Microsoft.Azure.Management.Monitor.Management.Models
{
    using Microsoft.Azure;
    using Microsoft.Azure.Management;
    using Microsoft.Azure.Management.Monitor;
    using Microsoft.Azure.Management.Monitor.Management;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Email notification of an autoscale event.
    /// </summary>
    public partial class EmailNotification
    {
        /// <summary>
        /// Initializes a new instance of the EmailNotification class.
        /// </summary>
        public EmailNotification()
        {
          CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the EmailNotification class.
        /// </summary>
        /// <param name="sendToSubscriptionAdministrator">a value indicating
        /// whether to send email to subscription administrator.</param>
        /// <param name="sendToSubscriptionCoAdministrators">a value indicating
        /// whether to send email to subscription co-administrators.</param>
        /// <param name="customEmails">the custom e-mails list. This value can
        /// be null or empty, in which case this attribute will be
        /// ignored.</param>
        public EmailNotification(bool? sendToSubscriptionAdministrator = default(bool?), bool? sendToSubscriptionCoAdministrators = default(bool?), IList<string> customEmails = default(IList<string>))
        {
            SendToSubscriptionAdministrator = sendToSubscriptionAdministrator;
            SendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators;
            CustomEmails = customEmails;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets a value indicating whether to send email to
        /// subscription administrator.
        /// </summary>
        [JsonProperty(PropertyName = "sendToSubscriptionAdministrator")]
        public bool? SendToSubscriptionAdministrator { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether to send email to
        /// subscription co-administrators.
        /// </summary>
        [JsonProperty(PropertyName = "sendToSubscriptionCoAdministrators")]
        public bool? SendToSubscriptionCoAdministrators { get; set; }

        /// <summary>
        /// Gets or sets the custom e-mails list. This value can be null or
        /// empty, in which case this attribute will be ignored.
        /// </summary>
        [JsonProperty(PropertyName = "customEmails")]
        public IList<string> CustomEmails { get; set; }

    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Arij</title>
    <link href=https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css rel=stylesheet>
    <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">


text:
package org.daisy.pipeline.modules;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.google.common.collect.Iterators;

import org.daisy.common.file.URLs;
import org.daisy.pipeline.xmlcatalog.XmlCatalog;
import org.daisy.pipeline.xmlcatalog.XmlCatalogParser;

import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Daisy pipeline module holds a set of components accessible via their uri, its
 * name, version and dependencies.
 */
public abstract class Module {

	private String name;
	private String version;
	private String title;
	private final Map<URI,Component> components = new HashMap<>();
	private final Map<String,Entity> entities = new HashMap<>();

	private static final Logger mLogger = LoggerFactory.getLogger(Module.class);

	/**
	 * Instantiate a new module
	 */
	protected Module(String name, String version, String title) {
		this.name = name;
		this.version = version;
		this.title = title;
	}

	/**
	 * Initialize the module
	 */
	protected void init(XmlCatalogParser parser) {
		Class<?> thisClass = this.getClass();
		try {
			URI jarFileURI = thisClass.getProtectionDomain().getCodeSource().getLocation().toURI();
			try {
				File jarFile = new File(jarFileURI);
				mLogger.trace("Creating module from JAR: " + jarFile);
				parseCatalog(
					parser,
					new ResourceLoader() {
						// Can't use ClassLoader.getResource() because there can be name
						// clashes between resources in different JARs. Alternative
						// solution would be to have a ClassLoader for each JAR.
						@Override
						public URL loadResource(String path) {
							// Paths are assumed to be relative to META-INF
							if (!path.startsWith("../")) {
								throw new RuntimeException("Paths must start with '../' but got '" + path + "'");
							}
							path = path.substring(2);
							try {
								return jarFile.isDirectory() ?
									new URL(jarFile.toURI().toASCIIString() + path) :
									new URL("jar:" + jarFile.toURI().toASCIIString() + "!" + path);
							} catch (MalformedURLException e) {
								throw new RuntimeException(e);
							}
						}
						@Override
						public Iterable<URL> loadResources(final String path) {
							throw new UnsupportedOperationException("Not supported without OSGi.");
						}
					});
			} catch (IllegalArgumentException e) {
				// Could be because we are running in OSGi context
				OSGiHelper.init(this, parser);
			}
		} catch (URISyntaxException e) {
			throw new RuntimeException(e);
		}
	}

	// static nested class in order to delay class loading
	private static abstract class OSGiHelper {
		static void init(Module thiz, XmlCatalogParser parser) {
			Bundle bundle = FrameworkUtil.getBundle(thiz.getClass());
			mLogger.trace("Creating module from OSGi bundle: " + bundle);
			ResourceLoader loader = new ResourceLoader() {
				@Override
				public URL loadResource(String path) {
					// Paths are assumed to be relative to META-INF
					if (!path.startsWith("../")) {
						throw new RuntimeException("Paths must start with '../' but got '" + path + "'");
					}
					path = path.substring(3);
					URL url = bundle.getResource(path);
					return url;
				}
				@Override
				public Iterable<URL> loadResources(final String path) {
					return new Iterable<URL>() {
						@Override
						public Iterator<URL> iterator() {
							return Iterators.forEnumeration(
								bundle.findEntries(path.replace("../", ""), "*", true));
						}
					};
				}
			};
			thiz.parseCatalog(parser, loader);
			// these fields are already set, but now get the values from the bundle metadata
			thiz.name = bundle.getHeaders().get("Bundle-Name").toString();
			thiz.version = bundle.getVersion().toString();
			thiz.title = bundle.getSymbolicName();
		}
	}

	/**
	 * Parse catalog.xml file
	 */
	private void parseCatalog(XmlCatalogParser parser, ResourceLoader loader) {
		URL catalogURL = loader.loadResource("../META-INF/catalog.xml");
		if (catalogURL == null)
			throw new RuntimeException("/META-INF/catalog.xml file not found");
		XmlCatalog catalog = parser.parse(URLs.asURI(catalogURL));
		parseCatalog(catalog, loader);
	}

	// package private for unit tests
	void parseCatalog(XmlCatalog catalog, ResourceLoader loader) {
		for (Map.Entry<URI, URI> entry : catalog.getSystemIdMappings().entrySet()) {
			addComponent(entry.getKey(), entry.getValue().toString(), loader);
		}
		for (Map.Entry<URI, URI> entry : catalog.getUriMappings().entrySet()) {
			addComponent(entry.getKey(), entry.getValue().toString(), loader);
		}
		for (Map.Entry<String, URI> entry : catalog.getPublicMappings().entrySet()) {
			addEntity(entry.getKey(), entry.getValue().toString(), loader);
		}
		for (Map.Entry<URI, URI> rule : catalog.getRewriteUris().entrySet()) {
			Iterable<URL> entries = loader.loadResources(rule.getValue().toString());
			for (URL url : entries) {
				try {
					// get tail of the path i.e. ../static/css/ -> /css/
					String path = url.toURI().getPath().toString().replace(rule.getValue().toString().replace("..",""),"");
					addComponent(rule.getKey().resolve(URI.create(path)), url.toString(), loader);
				} catch (URISyntaxException e) {
					mLogger.warn("Exception while generating paths");
				}
			}
		}
	}

	private void addComponent(URI uri, String path, ResourceLoader loader) {
		mLogger.trace("add component:" + uri.toString() + ", path: " + path);
		Component component = new Component(uri, path, loader);
		component.setModule(this);
		components.put(component.getURI(), component);
	}

	private void addEntity(String publicId, String path, ResourceLoader loader) {
		mLogger.trace("add entity:" + publicId.toString() + ", path: " + path);
		Entity entity = new Entity(publicId, path, loader);
		entity.setModule(this);
		entities.put(entity.getPublicId(), entity);
	}

	/**
	 * Gets the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * Gets the version.
	 */
	public String getVersion() {
		return version;
	}

	/**
	 * Gets the title.
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Gets the components.
	 */
	public Iterable<Component> getComponents() {
		return components.values();
	}

	/**
	 * Gets the component identified by the given uri.
	 */
	public Component getComponent(URI uri) {
		return components.get(uri);
	}

	/**
	 * Gets the list of entities.
	 */
	public Iterable<Entity> getEntities() {
		return entities.values();
	}

	/**
	 * Gets the entity identified by the given public id.
	 */
	public Entity getEntity(String publicId) {
		return entities.get(publicId);
	}

	@Override
	public String toString() {
		return getName() + " [" + getVersion() + "]";
	}
}


text:
package org.scalaide.debug.internal.command

/** A step in the Scala debug model. Implementations need to be thread safe. */
trait ScalaStep {
  /** Initiate the step action. */
  def step(): Unit

  /** Terminates the step action and clean the resources. */
  def stop(): Unit
}


text:
using System;
using System.Threading;
using System.Threading.Tasks;
using grpc = global::Grpc.Core;

namespace HOLMS.Types.Money.RPC {
  public static partial class AccountingTxnSvc
  {
    static readonly string __ServiceName = "holms.types.money.rpc.AccountingTxnSvc";

    static readonly grpc::Marshaller<global::Google.Protobuf.WellKnownTypes.Empty> __Marshaller_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus> __Marshaller_AccountingTxnExportStatus = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus.Parser.ParseFrom);
    static readonly grpc::Marshaller<global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest> __Marshaller_AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest.Parser.ParseFrom);

    static readonly grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus> __Method_GetExportJobStatus = new grpc::Method<global::Google.Protobuf.WellKnownTypes.Empty, global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus>(
        grpc::MethodType.Unary,
        __ServiceName,
        "GetExportJobStatus",
        __Marshaller_Empty,
        __Marshaller_AccountingTxnExportStatus);

    static readonly grpc::Method<global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest, global::Google.Protobuf.WellKnownTypes.Empty> __Method_UploadPropertyTransactionsInFormat = new grpc::Method<global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest, global::Google.Protobuf.WellKnownTypes.Empty>(
        grpc::MethodType.Unary,
        __ServiceName,
        "UploadPropertyTransactionsInFormat",
        __Marshaller_AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest,
        __Marshaller_Empty);

    /// Service descriptor
    public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
    {
      get { return global::HOLMS.Types.Money.RPC.AccountingTxnSvcReflection.Descriptor.Services[0]; }
    }

    /// Base class for server-side implementations of AccountingTxnSvc
    public abstract partial class AccountingTxnSvcBase
    {
      public virtual global::System.Threading.Tasks.Task<global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus> GetExportJobStatus(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

      public virtual global::System.Threading.Tasks.Task<global::Google.Protobuf.WellKnownTypes.Empty> UploadPropertyTransactionsInFormat(global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest request, grpc::ServerCallContext context)
      {
        throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
      }

    }

    /// Client for AccountingTxnSvc
    public partial class AccountingTxnSvcClient : grpc::ClientBase<AccountingTxnSvcClient>
    {
      /// Creates a new client for AccountingTxnSvc
      /// <param name="channel">The channel to use to make remote calls.</param>
      public AccountingTxnSvcClient(grpc::Channel channel) : base(channel)
      {
      }
      /// Creates a new client for AccountingTxnSvc that uses a custom <c>CallInvoker</c>.
      /// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
      public AccountingTxnSvcClient(grpc::CallInvoker callInvoker) : base(callInvoker)
      {
      }
      /// Protected parameterless constructor to allow creation of test doubles.
      protected AccountingTxnSvcClient() : base()
      {
      }
      /// Protected constructor to allow creation of configured clients.
      /// <param name="configuration">The client configuration.</param>
      protected AccountingTxnSvcClient(ClientBaseConfiguration configuration) : base(configuration)
      {
      }

      public virtual global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus GetExportJobStatus(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetExportJobStatus(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus GetExportJobStatus(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_GetExportJobStatus, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus> GetExportJobStatusAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return GetExportJobStatusAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::HOLMS.Types.Money.Accounting.AccountingTxnExportStatus> GetExportJobStatusAsync(global::Google.Protobuf.WellKnownTypes.Empty request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_GetExportJobStatus, null, options, request);
      }
      public virtual global::Google.Protobuf.WellKnownTypes.Empty UploadPropertyTransactionsInFormat(global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return UploadPropertyTransactionsInFormat(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual global::Google.Protobuf.WellKnownTypes.Empty UploadPropertyTransactionsInFormat(global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest request, grpc::CallOptions options)
      {
        return CallInvoker.BlockingUnaryCall(__Method_UploadPropertyTransactionsInFormat, null, options, request);
      }
      public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> UploadPropertyTransactionsInFormatAsync(global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
      {
        return UploadPropertyTransactionsInFormatAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
      }
      public virtual grpc::AsyncUnaryCall<global::Google.Protobuf.WellKnownTypes.Empty> UploadPropertyTransactionsInFormatAsync(global::HOLMS.Types.Money.RPC.AccountTxnExportSvcUploadPropertyTransactionsInFormatRequest request, grpc::CallOptions options)
      {
        return CallInvoker.AsyncUnaryCall(__Method_UploadPropertyTransactionsInFormat, null, options, request);
      }
      /// Creates a new instance of client from given <c>ClientBaseConfiguration</c>.
      protected override AccountingTxnSvcClient NewInstance(ClientBaseConfiguration configuration)
      {
        return new AccountingTxnSvcClient(configuration);
      }
    }

    /// Creates service definition that can be registered with a server
    /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
    public static grpc::ServerServiceDefinition BindService(AccountingTxnSvcBase serviceImpl)
    {
      return grpc::ServerServiceDefinition.CreateBuilder()
          .AddMethod(__Method_GetExportJobStatus, serviceImpl.GetExportJobStatus)
          .AddMethod(__Method_UploadPropertyTransactionsInFormat, serviceImpl.UploadPropertyTransactionsInFormat).Build();
    }

  }
}
#endregion