text:
describe("Scale and Pan", function(){
  var oldPadName,
      padName,
      path,
      reloaded = false;

  var panMethods = {
    'middle click and drag': {
      button: 1
    },
    '<CTRL> click and drag': {
      button: 0,
      ctrlKey: true
    }
  };

  it("creates a pad", function(done) {
    padName = helper.newPad(done);
    this.timeout(60000);
  });

  it("draw a path", function(done) {
    var chrome$ = helper.padChrome$;
    var paper = window.frames[0].paper;

    // Mouse clicks and drags to create path
    var canvas = chrome$("#myCanvas");
    canvas.simulate('drag', {dx: 100, dy: 50});

    done();
  });

   describe('Panning', function() {
    var m;

    for (m in panMethods) {
      it(m + " pans linearly", (function(m) { return function(done) {
        this.timeout(5000);

        var chrome$ = helper.padChrome$;
        var paper = window.frames[0].paper;
        var view = paper.project.view;
        var startBounds = view.bounds;

        // Mouse clicks and drags to create path
        var canvas = chrome$("#myCanvas");
        canvas.simulate('drag', {
          dx: -100, dy: -50,
          eventOptions: panMethods[m]
        });

        var view = paper.project.view;
        var bounds = view.bounds;
        expect(bounds.x).to.be(startBounds.x + 100);
        expect(bounds.y).to.be(startBounds.y + 50);
        done();
      }; })(m));

      it(m + " pans backwards too", (function(m) { return function(done) {
        this.timeout(5000);

        var chrome$ = helper.padChrome$;
        var paper = window.frames[0].paper;
        var view = paper.project.view;
        var startBounds = view.bounds;

        // Mouse clicks and drags to create path
        var canvas = chrome$("#myCanvas");
        canvas.simulate('drag', {
          dx: 70, dy: 50,
          eventOptions: panMethods[m]
        });
        var view = paper.project.view;
        var bounds = view.bounds;
        expect(bounds.x).to.be(startBounds.x - 70);
        expect(bounds.y).to.be(startBounds.y - 50);
        done();
      }; })(m));
    }
  });

  var scrollTypes = {
    'pixel scroll': {
      eventOptions : {
        deltaX: -50,
        deltaY: 0,
        deltaMode: 0
      },
      scaleDiff: 50 * 0.002
    },
    'line scroll': {
      eventOptions : {
        deltaX: 5,
        deltaY: 0,
        deltaMode: 1
      },
      scaleDiff: -5 * 0.02
    },
    'page scroll': {
      eventOptions : {
        deltaX: -1,
        deltaY: 0,
        deltaMode: 2
      },
      scaleDiff: 1 * 0.1
    }
  };

  describe('Scaling', function() {
    var s;

    for (s in scrollTypes) {
      it(s + ' should scale', (function(s) { return function(done) {
        this.timeout(5000);

        var chrome$ = helper.padChrome$;
        var paper = window.frames[0].paper;
        var view = paper.project.view;
        var oldScale = view.zoom;

        // Mouse clicks and drags to create path
        var canvas = chrome$("#myCanvas");
        canvas.simulate('wheel', scrollTypes[s].eventOptions);

        var newScale = view.zoom;

        expect(newScale).to.be(oldScale + scrollTypes[s].scaleDiff);
        done();
      }; })(s));
    }
  });

  describe('Scaled panning', function() {
    it('should pan evenly when zoomed in', function(done) {
        var chrome$ = helper.padChrome$;
        var paper = window.frames[0].paper;
        var view = paper.project.view;
        view.zoom = 2;
        view.draw();

        var startBounds = view.bounds;

        // Mouse clicks and drags to create path
        var canvas = chrome$("#myCanvas");

        canvas.simulate('drag', {
          dx: -200, dy: -100,
          eventOptions: {
            button: 1
          }
        });

        var bounds = view.bounds;

        expect(bounds.x).to.be(startBounds.x + (200/2));
        expect(bounds.y).to.be(startBounds.y + (100/2));
        done();

    });
  });
});


text:
package exceptions;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * Created by vadim on 7/26/17.
 */
public class IncorrectRequestException extends Exception {
    public IncorrectRequestException (String message) {
        super(message);
    }
    public IncorrectRequestException (String message, Throwable cause) {
        super(message, cause);
    }

}

redpajama_set_name: RedPajamaGithub


text:
Traefik can be configured to use Marathon as a provider.
{: .subtitle }

See also [Marathon user guide](../user-guides/marathon.md).

## Configuration Examples

??? example "Configuring Marathon & Deploying / Exposing Applications"

    Enabling the marathon provider

    ```toml tab="File (TOML)"
    [providers.marathon]
    ```

    ```yaml tab="File (YAML)"
    providers:
      marathon: {}
    ```

    ```bash tab="CLI"
    --providers.marathon=true
    ```

    Attaching labels to marathon applications

    ```json
	{
		"id": "/whoami",
		"container": {
			"type": "DOCKER",
			"docker": {
				"image": "traefik/whoami",
				"network": "BRIDGE",
				"portMappings": [
					{
						"containerPort": 80,
						"hostPort": 0,
						"protocol": "tcp"
					}
				]
			}
		},
		"labels": {
			"traefik.http.Routers.app.Rule": "PathPrefix(`/app`)"
		}
	}
    ```

## Routing Configuration

See the dedicated section in [routing](../routing/providers/marathon.md).

## Provider Configuration

### `basic`

_Optional_

```toml tab="File (TOML)"
[providers.marathon.basic]
  httpBasicAuthUser = "foo"
  httpBasicPassword = "bar"
```

```yaml tab="File (YAML)"
providers:
  marathon:
    basic:
      httpBasicAuthUser: foo
      httpBasicPassword: bar
```

```bash tab="CLI"
--providers.marathon.basic.httpbasicauthuser=foo
--providers.marathon.basic.httpbasicpassword=bar
```

Enables Marathon basic authentication.

### `dcosToken`

_Optional_

```toml tab="File (TOML)"
[providers.marathon]
  dcosToken = "xxxxxx"
  # ...
```

```toml tab="File (YAML)"
providers:
  marathon:
    dcosToken: "xxxxxx"
    # ...
```

```bash tab="CLI"
--providers.marathon.dcosToken=xxxxxx
```

DCOSToken for DCOS environment.

If set, it overrides the Authorization header.

### `defaultRule`

_Optional, Default=```Host(`{{ normalize .Name }}`)```_

```toml tab="File (TOML)"
[providers.marathon]
  defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)"
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    defaultRule: "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)"
    # ...
```

```bash tab="CLI"
--providers.marathon.defaultRule=Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)
# ...
```

For a given application if no routing rule was defined by a label, it is defined by this defaultRule instead.

It must be a valid [Go template](https://golang.org/pkg/text/template/),
augmented with the [sprig template functions](http://masterminds.github.io/sprig/).

The app ID can be accessed as the Name identifier,
and the template has access to all the labels defined on this Marathon application.

### `dialerTimeout`

_Optional, Default=5s_

```toml tab="File (TOML)"
[providers.marathon]
  dialerTimeout = "10s"
  # ...
```

```toml tab="File (YAML)"
providers:
  marathon:
    dialerTimeout: "10s"
    # ...
```

```bash tab="CLI"
--providers.marathon.dialerTimeout=10s
```

Overrides DialerTimeout.

Amount of time the Marathon provider should wait before timing out,
when trying to open a TCP connection to a Marathon master.

Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration),
or directly as a number of seconds.

### `endpoint`

_Optional, Default=http://127.0.0.1:8080_

```toml tab="File (TOML)"
[providers.marathon]
  endpoint = "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080"
  # ...
```

```toml tab="File (YAML)"
providers:
  marathon:
    endpoint: "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080"
    # ...
```

```bash tab="CLI"
--providers.marathon.endpoint=http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080
```

Marathon server endpoint.

You can optionally specify multiple endpoints:

### `exposedByDefault`

_Optional, Default=true_

```toml tab="File (TOML)"
[providers.marathon]
  exposedByDefault = false
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    exposedByDefault: false
    # ...
```

```bash tab="CLI"
--providers.marathon.exposedByDefault=false
# ...
```

Exposes Marathon applications by default through Traefik.

If set to false, applications that don't have a `traefik.enable=true` label will be ignored from the resulting routing configuration.

See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery).

### `constraints`

_Optional, Default=""_

```toml tab="File (TOML)"
[providers.marathon]
  constraints = "Label(`a.label.name`,`foo`)"
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    constraints: "Label(`a.label.name`,`foo`)"
    # ...
```

```bash tab="CLI"
--providers.marathon.constraints=Label(`a.label.name`,`foo`)
# ...
```

Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application.
That is to say, if none of the application's labels match the expression, no route for the application is created.
In addition, the expression also matched against the application's constraints, such as described in [Marathon constraints](https://mesosphere.github.io/marathon/docs/constraints.html).
If the expression is empty, all detected applications are included.

The expression syntax is based on the `Label("key", "value")`, and `LabelRegex("key", "value")`, as well as the usual boolean logic.
In addition, to match against marathon constraints, the function `MarathonConstraint("field:operator:value")` can be used, where the field, operator, and value parts are joined together in a single string with the `:` separator.

??? example "Constraints Expression Examples"

    ```toml
    # Includes only applications having a label with key `a.label.name` and value `foo`
    constraints = "Label(`a.label.name`, `foo`)"
    ```

    ```toml
    # Excludes applications having any label with key `a.label.name` and value `foo`
    constraints = "!Label(`a.label.name`, `value`)"
    ```

    ```toml
    # With logical AND.
    constraints = "Label(`a.label.name`, `valueA`) && Label(`another.label.name`, `valueB`)"
    ```

    ```toml
    # With logical OR.
    constraints = "Label(`a.label.name`, `valueA`) || Label(`another.label.name`, `valueB`)"
    ```

    ```toml
    # With logical AND and OR, with precedence set by parentheses.
    constraints = "Label(`a.label.name`, `valueA`) && (Label(`another.label.name`, `valueB`) || Label(`yet.another.label.name`, `valueC`))"
    ```

    ```toml
    # Includes only applications having a label with key `a.label.name` and a value matching the `a.+` regular expression.
    constraints = "LabelRegex(`a.label.name`, `a.+`)"
    ```

    ```toml
    # Includes only applications having a Marathon constraint with field `A`, operator `B`, and value `C`.
    constraints = "MarathonConstraint(`A:B:C`)"
    ```

    ```toml
    # Uses both Marathon constraint and application label with logical operator.
    constraints = "MarathonConstraint(`A:B:C`) && Label(`a.label.name`, `value`)"
    ```

See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery).

### `forceTaskHostname`

_Optional, Default=false_

```toml tab="File (TOML)"
[providers.marathon]
  forceTaskHostname = true
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    forceTaskHostname: true
    # ...
```

```bash tab="CLI"
--providers.marathon.forceTaskHostname=true
# ...
```

By default, a task's IP address (as returned by the Marathon API) is used as backend server if an IP-per-task configuration can be found;
otherwise, the name of the host running the task is used.
The latter behavior can be enforced by enabling this switch.

### `keepAlive`

_Optional, Default=10s_

```toml tab="File (TOML)"
[providers.marathon]
  keepAlive = "30s"
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    keepAlive: "30s"
    # ...
```

```bash tab="CLI"
--providers.marathon.keepAlive=30s
# ...
```

Set the TCP Keep Alive interval for the Marathon HTTP Client.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration),
or directly as a number of seconds.

### `respectReadinessChecks`

_Optional, Default=false_

```toml tab="File (TOML)"
[providers.marathon]
  respectReadinessChecks = true
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    respectReadinessChecks: true
    # ...
```

```bash tab="CLI"
--providers.marathon.respectReadinessChecks=true
# ...
```

Applications may define readiness checks which are probed by Marathon during deployments periodically, and these check results are exposed via the API.
Enabling respectReadinessChecks causes Traefik to filter out tasks whose readiness checks have not succeeded.
Note that the checks are only valid at deployment times.

See the Marathon guide for details.

### `responseHeaderTimeout`

_Optional, Default=60s_

```toml tab="File (TOML)"
[providers.marathon]
  responseHeaderTimeout = "66s"
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    responseHeaderTimeout: "66s"
    # ...
```

```bash tab="CLI"
--providers.marathon.responseHeaderTimeout=66s
# ...
```

Overrides ResponseHeaderTimeout.
Amount of time the Marathon provider should wait before timing out,
when waiting for the first response header from a Marathon master.

Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration), or directly as a number of seconds.

### `tls`

_Optional_

#### `tls.ca`

Certificate Authority used for the secured connection to Marathon.

```toml tab="File (TOML)"
[providers.marathon.tls]
  ca = "path/to/ca.crt"
```

```yaml tab="File (YAML)"
providers:
  marathon:
    tls:
      ca: path/to/ca.crt
```

```bash tab="CLI"
--providers.marathon.tls.ca=path/to/ca.crt
```

#### `tls.caOptional`

Policy followed for the secured connection to Marathon with TLS Client Authentication.
Requires `tls.ca` to be defined.

- `true`: VerifyClientCertIfGiven
- `false`: RequireAndVerifyClientCert
- if `tls.ca` is undefined NoClientCert

```toml tab="File (TOML)"
[providers.marathon.tls]
  caOptional = true
```

```yaml tab="File (YAML)"
providers:
  marathon:
    tls:
      caOptional: true
```

```bash tab="CLI"
--providers.marathon.tls.caOptional=true
```

#### `tls.cert`

Public certificate used for the secured connection to Marathon.

```toml tab="File (TOML)"
[providers.marathon.tls]
  cert = "path/to/foo.cert"
  key = "path/to/foo.key"
```

```yaml tab="File (YAML)"
providers:
  marathon:
    tls:
      cert: path/to/foo.cert
      key: path/to/foo.key
```

```bash tab="CLI"
--providers.marathon.tls.cert=path/to/foo.cert
--providers.marathon.tls.key=path/to/foo.key
```

#### `tls.key`

Private certificate used for the secured connection to Marathon.

```toml tab="File (TOML)"
[providers.marathon.tls]
  cert = "path/to/foo.cert"
  key = "path/to/foo.key"
```

```yaml tab="File (YAML)"
providers:
  marathon:
    tls:
      cert: path/to/foo.cert
      key: path/to/foo.key
```

```bash tab="CLI"
--providers.marathon.tls.cert=path/to/foo.cert
--providers.marathon.tls.key=path/to/foo.key
```

#### `tls.insecureSkipVerify`

If `insecureSkipVerify` is `true`, TLS for the connection to Marathon accepts any certificate presented by the server and any host name in that certificate.

```toml tab="File (TOML)"
[providers.marathon.tls]
  insecureSkipVerify = true
```

```yaml tab="File (YAML)"
providers:
  marathon:
    tls:
      insecureSkipVerify: true
```

```bash tab="CLI"
--providers.marathon.tls.insecureSkipVerify=true
```

### `tlsHandshakeTimeout`

_Optional, Default=5s_

```toml tab="File (TOML)"
[providers.marathon]
  responseHeaderTimeout = "10s"
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    responseHeaderTimeout: "10s"
    # ...
```

```bash tab="CLI"
--providers.marathon.responseHeaderTimeout=10s
# ...
```

Overrides TLSHandshakeTimeout.

Amount of time the Marathon provider should wait before timing out,
when waiting for the TLS handshake to complete.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration),
or directly as a number of seconds.

### `trace`

_Optional, Default=false_

```toml tab="File (TOML)"
[providers.marathon]
  trace = true
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    trace: true
    # ...
```

```bash tab="CLI"
--providers.marathon.trace=true
# ...
```

Displays additional provider logs (if available).

### `watch`

_Optional, Default=true_

```toml tab="File (TOML)"
[providers.marathon]
  watch = false
  # ...
```

```yaml tab="File (YAML)"
providers:
  marathon:
    watch: false
    # ...
```

```bash tab="CLI"
--providers.marathon.watch=false
# ...
```

Enables watching for Marathon changes.


text:
package org.apache.geode.internal.cache.execute;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.geode.annotations.internal.MakeNotStatic;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.RegionDestroyedException;
import org.apache.geode.cache.RegionService;
import org.apache.geode.cache.client.Pool;
import org.apache.geode.cache.client.PoolManager;
import org.apache.geode.cache.client.internal.InternalClientCache;
import org.apache.geode.cache.client.internal.ProxyCache;
import org.apache.geode.cache.client.internal.ProxyRegion;
import org.apache.geode.cache.execute.Execution;
import org.apache.geode.cache.execute.Function;
import org.apache.geode.cache.execute.FunctionException;
import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.distributed.DistributedSystemDisconnectedException;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.InternalEntity;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalRegion;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.util.internal.GeodeGlossary;

public class InternalFunctionExecutionServiceImpl
    implements FunctionExecutionService, InternalFunctionExecutionService {

  /**
   * use when the optimization to execute onMember locally is not desired.
   */
  public static final boolean RANDOM_onMember =
      Boolean.getBoolean(GeodeGlossary.GEMFIRE_PREFIX + "randomizeOnMember");

  private static final String[] EMPTY_GROUPS = new String[0];

  @MakeNotStatic
  private static final ConcurrentHashMap<String, Function> idToFunctionMap =
      new ConcurrentHashMap<>();

  public InternalFunctionExecutionServiceImpl() {
    // nothing
  }

  // FunctionExecutionService API ----------------------------------------------------------------

  @Override
  public Execution onServer(Pool pool) {
    return onServer(pool, EMPTY_GROUPS);
  }

  @Override
  public Execution onServers(Pool pool) {
    return onServers(pool, EMPTY_GROUPS);
  }

  @Override
  public Execution onServer(RegionService regionService) {
    return onServer(regionService, EMPTY_GROUPS);
  }

  @Override
  public Execution onServers(RegionService regionService) {
    return onServers(regionService, EMPTY_GROUPS);
  }

  @Override
  public Execution onMember(DistributedMember distributedMember) {
    return onMember(getDistributedSystem(), distributedMember);
  }

  @Override
  public Execution onMembers(String... groups) {
    return onMembers(getDistributedSystem(), groups);
  }

  @Override
  public Execution onMembers(Set<DistributedMember> distributedMembers) {
    return onMembers(getDistributedSystem(), distributedMembers);
  }

  @Override
  public Execution onMember(String... groups) {
    return onMember(getDistributedSystem(), groups);
  }

  protected Pool findPool(String poolName) {
    return PoolManager.find(poolName);
  }

  @Override
  public Execution onRegion(Region region) {
    if (region == null) {
      throw new FunctionException("Region instance passed is null");
    }

    if (region.isDestroyed()) {
      ((LocalRegion) region).getCancelCriterion().checkCancelInProgress();
      throw new RegionDestroyedException("Region is destroyed", region.getFullPath());
    }

    ProxyCache proxyCache = null;
    String poolName = region.getAttributes().getPoolName();
    if (poolName != null) {
      Pool pool = findPool(poolName);

      if (pool == null) {
        throw new IllegalStateException(String.format("Could not find a pool named %s.", poolName));
      } else {
        if (pool.getMultiuserAuthentication()) {
          if (region instanceof ProxyRegion) {
            ProxyRegion proxyRegion = (ProxyRegion) region;
            region = proxyRegion.getRealRegion();
            proxyCache = proxyRegion.getAuthenticatedCache();
          } else {
            throw new UnsupportedOperationException();
          }
        }
      }
    }

    if (isClientRegion(region)) {
      return new ServerRegionFunctionExecutor(region, proxyCache);
    }
    if (PartitionRegionHelper.isPartitionedRegion(region)) {
      return new PartitionedRegionFunctionExecutor(region);
    }
    return new DistributedRegionFunctionExecutor(region);
  }

  @Override
  public Function getFunction(String functionId) {
    if (functionId == null) {
      throw new FunctionException(String.format("%s passed is null",
          "functionId instance "));
    }
    return idToFunctionMap.get(functionId);
  }

  @Override
  public void registerFunction(Function function) {
    if (function == null) {
      throw new FunctionException(String.format("%s passed is null",
          "function instance "));
    }
    if (function.getId() == null) {
      throw new FunctionException(
          "function.getId() returned null, implement the Function.getId() method properly");
    }
    if (function.isHA() && !function.hasResult()) {
      throw new FunctionException(
          "For Functions with isHA true, hasResult must also be true.");
    }

    idToFunctionMap.put(function.getId(), function);
  }

  @Override
  public void unregisterFunction(String functionId) {
    if (functionId == null) {
      throw new FunctionException(String.format("%s passed is null",
          "functionId instance "));
    }
    idToFunctionMap.remove(functionId);
  }

  @Override
  public boolean isRegistered(String functionId) {
    if (functionId == null) {
      throw new FunctionException(String.format("%s passed is null",
          "functionId instance "));
    }
    return idToFunctionMap.containsKey(functionId);
  }

  @Override
  public Map<String, Function> getRegisteredFunctions() {
    // We have to remove the internal functions before returning the map to the users
    final Map<String, Function> tempIdToFunctionMap = new HashMap<>();
    for (Map.Entry<String, Function> entry : idToFunctionMap.entrySet()) {
      if (!(entry.getValue() instanceof InternalEntity)) {
        tempIdToFunctionMap.put(entry.getKey(), entry.getValue());
      }
    }
    return tempIdToFunctionMap;
  }

  // InternalFunctionExecutionService OnServerGroups API -----------------------------------------

  @Override
  public Execution onServer(Pool pool, String... groups) {
    if (pool == null) {
      throw new FunctionException(
          String.format("%s passed is null", "Pool instance "));
    }

    if (pool.getMultiuserAuthentication()) {
      throw new UnsupportedOperationException();
    }

    return new ServerFunctionExecutor(pool, false, groups);
  }

  @Override
  public Execution onServers(Pool pool, String... groups) {
    if (pool == null) {
      throw new FunctionException(
          String.format("%s passed is null", "Pool instance "));
    }

    if (pool.getMultiuserAuthentication()) {
      throw new UnsupportedOperationException();
    }

    return new ServerFunctionExecutor(pool, true, groups);
  }

  @Override
  public Execution onServer(RegionService regionService, String... groups) {
    if (regionService == null) {
      throw new FunctionException(String.format("%s passed is null",
          "RegionService instance "));
    }
    if (regionService instanceof GemFireCacheImpl) {
      InternalClientCache internalCache = (InternalClientCache) regionService;
      if (!internalCache.isClient()) {
        throw new FunctionException("The cache was not a client cache");
      } else if (internalCache.getDefaultPool() != null) {
        return onServer(internalCache.getDefaultPool(), groups);
      } else {
        throw new FunctionException("The client cache does not have a default pool");
      }
    } else {
      ProxyCache proxyCache = (ProxyCache) regionService;
      return new ServerFunctionExecutor(proxyCache.getUserAttributes().getPool(), false, proxyCache,
          groups);
    }
  }

  @Override
  public Execution onServers(RegionService regionService, String... groups) {
    if (regionService == null) {
      throw new FunctionException(String.format("%s passed is null",
          "RegionService instance "));
    }
    if (regionService instanceof GemFireCacheImpl) {
      InternalClientCache internalCache = (InternalClientCache) regionService;
      if (!internalCache.isClient()) {
        throw new FunctionException("The cache was not a client cache");
      } else if (internalCache.getDefaultPool() != null) {
        return onServers(internalCache.getDefaultPool(), groups);
      } else {
        throw new FunctionException("The client cache does not have a default pool");
      }
    } else {
      ProxyCache proxyCache = (ProxyCache) regionService;
      return new ServerFunctionExecutor(proxyCache.getUserAttributes().getPool(), true, proxyCache,
          groups);
    }
  }

  // InternalFunctionExecutionService InDistributedSystem API ------------------------------------

  @Override
  public Execution onMember(DistributedSystem system, DistributedMember distributedMember) {
    if (system == null) {
      throw new FunctionException(String.format("%s passed is null",
          "DistributedSystem instance "));
    }
    if (distributedMember == null) {
      throw new FunctionException(String.format("%s passed is null",
          "DistributedMember instance "));
    }
    return new MemberFunctionExecutor(system, distributedMember);
  }

  @Override
  public Execution onMembers(DistributedSystem system, String... groups) {
    if (system == null) {
      throw new FunctionException(String.format("%s passed is null",
          "DistributedSystem instance "));
    }
    if (groups.length == 0) {
      return new MemberFunctionExecutor(system);
    }
    Set<DistributedMember> members = new HashSet<>();
    for (String group : groups) {
      members.addAll(system.getGroupMembers(group));
    }
    if (members.isEmpty()) {
      throw new FunctionException(String.format("No members found in group(s) %s",
          Arrays.toString(groups)));
    }
    return new MemberFunctionExecutor(system, members);
  }

  @Override
  public Execution onMember(DistributedSystem system, String... groups) {
    if (system == null) {
      throw new FunctionException(String.format("%s passed is null",
          "DistributedSystem instance "));
    }
    Set<DistributedMember> members = new HashSet<>();
    for (String group : groups) {
      List<DistributedMember> grpMembers = new ArrayList<>(system.getGroupMembers(group));
      if (!grpMembers.isEmpty()) {
        if (!RANDOM_onMember && grpMembers.contains(system.getDistributedMember())) {
          members.add(system.getDistributedMember());
        } else {
          Collections.shuffle(grpMembers);
          members.add(grpMembers.get(0));
        }
      }
    }
    if (members.isEmpty()) {
      throw new FunctionException(String.format("No members found in group(s) %s",
          Arrays.toString(groups)));
    }
    return new MemberFunctionExecutor(system, members);
  }

  @Override
  public Execution onMembers(DistributedSystem system, Set<DistributedMember> distributedMembers) {
    if (system == null) {
      throw new FunctionException(String.format("%s passed is null",
          "DistributedSystem instance "));
    }
    if (distributedMembers == null) {
      throw new FunctionException(String.format("%s passed is null",
          "distributedMembers set "));
    }
    return new MemberFunctionExecutor(system, distributedMembers);
  }

  // InternalFunctionExecutionService OnRegions API ----------------------------------------------

  @Override
  public Execution onRegions(Set<Region> regions) {
    if (regions == null) {
      throw new IllegalArgumentException(
          String.format("The input %s for the execute function request is null",
              "regions set"));
    }
    if (regions.contains(null)) {
      throw new IllegalArgumentException(
          "One or more region references added to the regions set is(are) null");
    }
    if (regions.isEmpty()) {
      throw new IllegalArgumentException(
          "Regions set is empty for onRegions function execution");
    }
    for (Region region : regions) {
      if (isClientRegion(region)) {
        throw new UnsupportedOperationException(
            "FunctionService#onRegions() is not supported for cache clients in client server mode");
      }
    }
    return new MultiRegionFunctionExecutor(regions);
  }

  // InternalFunctionExecutionService unregisterAllFunctions API ---------------------------------

  @Override
  public void unregisterAllFunctions() {
    // Unregistering all the functions registered with the FunctionService.
    for (String functionId : idToFunctionMap.keySet()) {
      unregisterFunction(functionId);
    }
  }

  /**
   * @return true if the method is called on a region has a {@link Pool}.
   * @since GemFire 6.0
   */
  private boolean isClientRegion(Region region) {
    return ((InternalRegion) region).hasServerProxy();
  }

  private static DistributedSystem getDistributedSystem() {
    DistributedSystem system = InternalDistributedSystem.getConnectedInstance();
    if (system == null) {
      throw new DistributedSystemDisconnectedException(
          "This connection to a distributed system has been disconnected.");
    }
    return system;
  }
}


text:
package com.indignado.logicbricks.systems.sensors.base;

import com.indignado.logicbricks.core.actuators.Actuator;

/**
 * @author Rubentxu.
 */
public class ActuatorTest extends Actuator {
}


text:
namespace chromeos::bluetooth::features {

// Enables/disables the bluetooth devcoredump feature
DEVICE_BLUETOOTH_EXPORT BASE_DECLARE_FEATURE(kBluetoothCoredump);

}  // namespace chromeos::bluetooth::features

#endif  // DEVICE_BLUETOOTH_CHROMEOS_PLATFORM_FEATURES_H_


text:
package net.mcft.copy.aho.config;

public enum EnumControl {

	/** Config settings are used as default
	 *  in the world creation screen. */
	DEFAULT,

	/** Config settings are locked in and can't
	 *  be changed in the world creation screen. */
	LOCK,

	/** Config settings are used automatically
	 *  and world creation screen is not modified. */
	HIDDEN

}


text: console.log("inline");


text:
namespace gepetto {

QStringInsertFunction& insertFunction()
{
  // Default function to use to insert a QString.
  static QStringInsertFunction insertFunction (use_toLocal8Bit);
  return insertFunction;
}

std::ofstream& logfile() GEPETTO_VIEWER_LOCAL;

std::ofstream& logfile()
{
  static std::ofstream ofs;
  return ofs;
}

void setLogFile(const char* filename)
{
  logfile().open(filename);
}

std::ostream& log()
{
  if (logfile().good())
    return logfile();
  else
    return std::cout;
}
} // namespace gepetto


text:
[Passport](http://passportjs.org/) strategy for authenticating with [OSChina](https://www.oschina.net/)
using the OAuth 2.0 API.

This module lets you authenticate using OSChina in your Node.js applications.
By plugging into Passport, OSChina authentication can be easily and
unobtrusively integrated into any application or framework that supports
[Connect](http://www.senchalabs.org/connect/)-style middleware, including
[Express](http://expressjs.com/).

## Install

    $ npm install passport-oschina

## Usage

#### Configure Strategy

The OSChina authentication strategy authenticates users using a OSChina account
and OAuth 2.0 tokens.  The strategy requires a `verify` callback, which accepts
these credentials and calls `done` providing a user, as well as `options`
specifying a client ID, client secret, and callback URL.

    passport.use(new OSChinaStrategy({
        clientID: OSCHINA_CLIENT_ID,
        clientSecret: OSCHINA_CLIENT_SECRET,
        callbackURL: "http://127.0.0.1:3000/auth/oschina/callback"
      },
      function(accessToken, refreshToken, profile, done) {
        User.findOrCreate({ oschinaId: profile.id }, function (err, user) {
          return done(err, user);
        });
      }
    ));

#### Authenticate Requests

Use `passport.authenticate()`, specifying the `'oschina'` strategy, to
authenticate requests.

For example, as route middleware in an [Express](http://expressjs.com/)
application:

    app.get('/auth/oschina',
      passport.authenticate('oschina'));

    app.get('/auth/oschina/callback',
      passport.authenticate('oschina', { failureRedirect: '/login' }),
      function(req, res) {
        // Successful authentication, redirect home.
        res.redirect('/');
      });

## Examples

For a complete, working example, refer to the [login example](https://github.com/geminiyellow/passport-oschina/tree/master/examples/login).

## Tests

    $ npm install --dev
    $ make test

[![Build Status](https://secure.travis-ci.org/geminiyellow/passport-oschina.png)](http://travis-ci.org/geminiyellow/passport-oschina)

## Credits

  - [geminiyellow](https://github.com/geminiyellow)

## License

[The MIT License](http://opensource.org/licenses/MIT)


text: """The uber component."""


text:
<?php declare(strict_types=1);

namespace Ekyna\Component\Commerce\Common\Calculator;

use Ekyna\Component\Commerce\Common\Currency\CurrencyConverterInterface;
use Ekyna\Component\Commerce\Common\Model;
use Ekyna\Component\Commerce\Common\Util\Money;
use Ekyna\Component\Commerce\Exception;
use Ekyna\Component\Commerce\Invoice\Calculator\InvoiceSubjectCalculatorInterface;
use Ekyna\Component\Commerce\Invoice\Model\InvoiceSubjectInterface;
use Ekyna\Component\Commerce\Stat\Calculator\StatFilter;
use Ekyna\Component\Commerce\Stock\Model\StockAssignmentsInterface;

/**
 * Class AmountCalculator
 * @package Ekyna\Component\Commerce\Common\Calculator
 * @author  Etienne Dauvergne <contact@ekyna.com>
 */
class AmountCalculator implements AmountCalculatorInterface
{
    /**
     * @var CurrencyConverterInterface
     */
    private $currencyConverter;

    /**
     * @var InvoiceSubjectCalculatorInterface
     */
    private $invoiceCalculator;

    /**
     * @var AmountCalculatorFactory
     */
    private $amountCalculatorFactory;

    /**
     * @var string
     */
    private $currency;

    /**
     * @var bool
     */
    private $revenue;

    /**
     * @var StatFilter
     */
    private $filter;

    /**
     * @var Model\Amount[]
     */
    private $cache;

    /**
     * Constructor.
     *
     * @param string          $currency
     * @param bool            $revenue
     * @param StatFilter|null $filter
     *
     * @internal Use Calculator factory
     */
    public function __construct(string $currency, bool $revenue, StatFilter $filter = null)
    {
        $this->currency = $currency;
        $this->revenue = $revenue;
        $this->filter = $filter;

        $this->clear();
    }

    /**
     * Clears the cache.
     */
    public function clear(): void
    {
        $this->cache = [];
    }

    /**
     * Sets the currency converter.
     *
     * @param CurrencyConverterInterface $converter
     */
    public function setCurrencyConverter(CurrencyConverterInterface $converter): void
    {
        $this->currencyConverter = $converter;
    }

    /**
     * Sets the invoice calculator.
     *
     * @param InvoiceSubjectCalculatorInterface $calculator
     */
    public function setInvoiceCalculator(InvoiceSubjectCalculatorInterface $calculator): void
    {
        $this->invoiceCalculator = $calculator;
    }

    /**
     * Sets the amount calculator factory.
     *
     * @param AmountCalculatorFactory $factory
     */
    public function setAmountCalculatorFactory(AmountCalculatorFactory $factory): void
    {
        $this->amountCalculatorFactory = $factory;
    }

    /**
     * @inheritDoc
     */
    public function calculateSale(Model\SaleInterface $sale, bool $asGross = false): Model\Amount
    {
        $key = spl_object_hash($sale);
        if ($result = $this->get($key . ($asGross ? '_gross' : '_final'))) {
            return $result;
        }

        // Items / Gross result
        if (null === $gross = $this->get($key . '_gross')) {
            $gross = clone $this->calculateSaleItems($sale);
            $this->set($key . '_gross', $gross);
        }

        // Final result
        $final = Model\Amount::createFinalFromGross($gross);
        $this->set($key . '_final', $final);

        // Discounts
        if ($sale->hasAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT)) {
            foreach ($sale->getAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT) as $adjustment) {
                $this->calculateSaleDiscount($adjustment, $gross, $final);
            }
        }

        // Shipment
        $this->calculateSaleShipment($sale, $final);

        // Round/finalize results.
        $gross->round();
        $final->finalize();

        return $asGross ? $gross : $final;
    }

    /**
     * @inheritDoc
     */
    public function calculateSaleItems(Model\SaleInterface $sale): Model\Amount
    {
        $key = spl_object_hash($sale) . '_items';
        if ($result = $this->get($key)) {
            return $result;
        }

        $result = new Model\Amount($this->currency);
        $this->set($key, $result);

        // Sum public
        foreach ($sale->getItems() as $item) {
            if ($this->isItemSkipped($item)) {
                continue;
            }

            if ($item->isPrivate()) {
                throw new Exception\LogicException("Root sale items can't be private.");
            }

            // Skip compound with only public children
            // TODO Removed (check) if (!($item->isCompound() && !$item->hasPrivateChildren())) {
            $result->merge($this->calculateSaleItem($item));
            //}

            $this->mergeItemsResults($item, $result);
        }

        // Set unit = gross
        $result->copyGrossToUnit();

        return $result;
    }

    /**
     * @inheritDoc
     *
     * @TODO use packaging format on quantities
     */
    public function calculateSaleItem(Model\SaleItemInterface $item, float $quantity = null, bool $asPublic = false): Model\Amount
    {
        if (null !== $quantity) {
            if ($this->revenue) {
                throw new Exception\LogicException("You can't override quantity if revenue mode is enabled.");
            }

            if (0 >= $quantity) {
                throw new Exception\InvalidArgumentException(
                    "Specific quantity must be greater than or equal to zero."
                );
            }
        }

        $key = spl_object_hash($item) . ($quantity ? "_$quantity" : '');
        if ($result = $this->get($key)) {
            return $result;
        }

        $sale = $item->getSale();
        $ati = $sale->isAtiDisplayMode();

        $taxGroup = $item->getTaxGroup();

        // Round unit price only for 'net' calculation
        $unit = $this
            ->currencyConverter
            ->convertWithSubject($item->getNetPrice(), $sale, $this->currency, !$ati);

        // Add private items unit prices
        foreach ($item->getChildren() as $child) {
            if ($this->isItemSkipped($child)) {
                continue;
            }

            $q = $quantity ? $quantity * $child->getQuantity() : null;
            $childResult = $this->calculateSaleItem($child, $q);

            if (!$child->isPrivate()) {
                continue;
            }

            if ($taxGroup !== $child->getTaxGroup()) {
                throw new Exception\LogicException("Private item must have the same tax group as its parent.");
            }

            if ($child->hasAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT)) {
                throw new Exception\LogicException("Private items can't have discount adjustment.");
            }

            $unit += $ati
                ? $childResult->getUnit() * $child->getQuantity()
                : Money::round($childResult->getUnit(), $this->currency) * $child->getQuantity();
        }

        $quantity = $quantity ?? $this->calculateSaleItemQuantity($item);

        if ($item->getSale()->isSample()) {
            // Sample sale case : zero amounts
            $result = new Model\Amount($this->currency);
        } elseif ($item->isPrivate() && !$asPublic) {
            // Private case : we just need unit amount
            $gross = $unit * $quantity;
            $result = new Model\Amount($this->currency, $unit, $gross, 0, $gross);
        } else {
            // Regular case
            $discounts = $taxes = [];
            $discount = $tax = 0;

            // Gross price
            $gross = $unit * $quantity;

            $parent = $item->getParent();
            $discountAdjustments = $item->getAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT)->toArray();

            // Items without subject inherit discounts from their non-compound parent
            if (empty($discountAdjustments)) {
                if (!$item->hasSubjectIdentity() && $parent && !$parent->isCompound()) {
                    $discountAdjustments = $parent->getAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT)->toArray();
                } elseif ($item->isPrivate() && $asPublic) {
                    $discountAdjustments = $item
                        ->getPublicParent()
                        ->getAdjustments(Model\AdjustmentTypes::TYPE_DISCOUNT)->toArray();
                }
            }

            // Discount amount and result adjustments
            $discountBase = $gross;
            foreach ($discountAdjustments as $data) {
                $adjustment = $this->createPercentAdjustment($data, $discountBase);
                $discountBase -= $adjustment->getAmount();
                $discount += $adjustment->getAmount();
                $discounts[] = $adjustment;
            }

            // Base
            $base = $ati
                ? round($gross - $discount, 5)
                : Money::round($gross - $discount, $this->currency);

            // Tax amount and result adjustments
            if ($item->isPrivate() && $asPublic) {
                $taxAdjustments = $item
                    ->getPublicParent()
                    ->getAdjustments(Model\AdjustmentTypes::TYPE_TAXATION)->toArray();
            } else {
                $taxAdjustments = $item->getAdjustments(Model\AdjustmentTypes::TYPE_TAXATION)->toArray();
            }

            foreach ($taxAdjustments as $data) {
                $adjustment = $this->createPercentAdjustment($data, $base);

                $tax += $adjustment->getAmount();
                $taxes[] = $adjustment;
            }

            // Total
            $total = Money::round($base + $tax, $this->currency);

            // Result
            $result = new Model\Amount(
                $this->currency,
                $unit, $gross, $discount, $base,
                $tax, $total, $discounts, $taxes
            );
        }

        if ($ati) {
            $result->round();
        }

        $this->set($key, $result);

        return $result;
    }

    /**
     * @inheritDoc
     */
    public function calculateSaleDiscount(
        Model\SaleAdjustmentInterface $adjustment,
        Model\Amount $gross = null,
        Model\Amount $final = null
    ): Model\Amount {
        $this->assertAdjustmentType($adjustment, Model\AdjustmentTypes::TYPE_DISCOUNT);

        $key = spl_object_hash($adjustment);
        if ($result = $this->get($key)) {
            return $result;
        }

        /** @var Model\SaleInterface $sale */
        $sale = $adjustment->getAdjustable();

        if (!$gross && !$gross = $this->get(spl_object_hash($adjustment->getSale()) . '_items')) {
            throw new Exception\LogicException("Failed to retrieve sale gross result.");
        }

        $this->set($key, $result = new Model\Amount($this->currency));

        // Sample sale case
        if ($sale->isSample()) {
            return $result;
        }

        // Revenue mode
        if ($this->revenue && $sale instanceof InvoiceSubjectInterface) {
            if (0 >= $this->invoiceCalculator->calculateSoldQuantity($adjustment)) {
                return $result;
            }
        }

        $base = $gross->getBase();

        $mode = $adjustment->getMode();
        if (Model\AdjustmentModes::MODE_PERCENT === $mode) {
            $rate = (float)$adjustment->getAmount();

            $result->addUnit(Money::round($base * $rate / 100, $this->currency));

            foreach ($gross->getTaxAdjustments() as $tax) {
                $amount = Money::round($tax->getAmount() * $rate / 100, $this->currency);
                $result->addTaxAdjustment(new Model\Adjustment($tax->getName(), $amount, $tax->getRate()));
                $result->addTax($amount);
            }
        } elseif (Model\AdjustmentModes::MODE_FLAT === $mode) {
            $realBase = $this->getRealGrossBase($sale);

            $amount = $this
                ->currencyConverter
                ->convertWithSubject((float)$adjustment->getAmount(), $sale, $this->currency, false);

            if (1 === Money::compare($realBase, $base, $this->currency)) {
                $unit = Money::round($amount * $base / $realBase, $this->currency);
            } else {
                $unit = $amount;
            }
            $result->addUnit($unit);

            foreach ($gross->getTaxAdjustments() as $tax) {
                $amount = Money::round($unit * $tax->getAmount() / $base, $this->currency);
                $result->addTaxAdjustment(new Model\Adjustment($tax->getName(), $amount, $tax->getRate()));
                $result->addTax($amount);
            }
        } else {
            throw new Exception\InvalidArgumentException("Unexpected adjustment mode '$mode'.");
        }

        $result->addGross($result->getUnit());
        $result->addBase($result->getUnit());
        $result->addTotal($result->getUnit() + $result->getTax());

        if (!$final) {
            return $result;
        }

        // Add to final result
        $final->addDiscount($result->getBase());
        $final->addBase(-$result->getBase());
        $final->addTotal(-$result->getBase());
        $final->addDiscountAdjustment(new Model\Adjustment(
            (string)$adjustment->getDesignation(),
            $result->getBase(),
            $adjustment->getMode() === Model\AdjustmentModes::MODE_PERCENT ? (float)$adjustment->getAmount() : 0
        ));

        foreach ($result->getTaxAdjustments() as $a) {
            $final->addTaxAdjustment(new Model\Adjustment($a->getName(), -$a->getAmount(), $a->getRate()));
            $final->addTax(-$a->getAmount());
            $final->addTotal(-$a->getAmount());
        }

        if ($sale->isAtiDisplayMode()) {
            $result->round();
        }

        return $result;
    }

    /**
     * @inheritDoc
     */
    public function calculateSaleShipment(
        Model\SaleInterface $sale,
        Model\Amount $final = null
    ): Model\Amount {
        $key = spl_object_hash($sale) . '_shipment';
        if ($result = $this->get($key)) {
            return $result;
        }

        $this->set($key, $result = new Model\Amount($this->currency));

        // Sample sale case
        if ($sale->isSample()) {
            return $result;
        }

        // Revenue mode
        if ($this->revenue && $sale instanceof InvoiceSubjectInterface) {
            if (0 >= $this->invoiceCalculator->calculateSoldQuantity($sale)) {
                return $result;
            }
        }

        // Abort if shipment cost is lower than or equals zero
        $base = $this
            ->currencyConverter
            ->convertWithSubject($sale->getShipmentAmount(), $sale, $this->currency, false);

        $result->addUnit($base);
        $result->addGross($base);
        $result->addBase($base);
        $result->addTotal($base);

        if (1 === Money::compare($base, 0, $this->currency)) {
            // Shipment taxation
            foreach ($sale->getAdjustments(Model\AdjustmentTypes::TYPE_TAXATION) as $data) {
                $adjustment = $this->createPercentAdjustment($data, $base);

                $result->addTaxAdjustment($adjustment);
                $result->addTax($adjustment->getAmount());
                $result->addTotal($adjustment->getAmount());
            }

            if ($final) {
                // Add to final result
                $final->addBase($result->getBase());
                $final->addTotal($result->getBase());

                foreach ($result->getTaxAdjustments() as $a) {
                    $final->addTaxAdjustment($a);
                    $final->addTax($a->getAmount());
                    $final->addTotal($a->getAmount());
                }
            }
        }

        if ($sale->isAtiDisplayMode()) {
            $result->round();
        }

        return $result;
    }

    /**
     * Calculates the sale item quantity.
     *
     * @param Model\SaleItemInterface $item
     *
     * @return float
     */
    protected function calculateSaleItemQuantity(Model\SaleItemInterface $item): float
    {
        if (!$this->revenue) {
            return $item->getTotalQuantity();
        }

        $quantity = 0.;

        if ($item instanceof StockAssignmentsInterface && $item->hasStockAssignments()) {
            foreach ($item->getStockAssignments() as $assignment) {
                $quantity += $assignment->getSoldQuantity();
            }

            return $quantity;
        }

        $sale = $item->getSale();
        if ($sale instanceof InvoiceSubjectInterface) {
            return $this->invoiceCalculator->calculateSoldQuantity($item);
        }

        return $item->getTotalQuantity();
    }

    /**
     * Creates a new result adjustment.
     *
     * @param Model\AdjustmentInterface $data
     * @param float                     $base
     *
     * @return Model\Adjustment
     */
    protected function createPercentAdjustment(Model\AdjustmentInterface $data, float $base): Model\Adjustment
    {
        $this->assertAdjustmentMode($data, Model\AdjustmentModes::MODE_PERCENT);

        $rate = (float)$data->getAmount();

        if ($data->getType() === Model\AdjustmentTypes::TYPE_TAXATION) {
            // Calculate taxation as ATI - NET
            $amount = Money::round($base * (1 + $rate / 100), $this->currency) - Money::round($base, $this->currency);
        } else {
            $amount = Money::round($base * $rate / 100, $this->currency);
        }

        return new Model\Adjustment((string)$data->getDesignation(), $amount, $rate);
    }

    /**
     * Asserts that the adjustment mode is as expected.
     *
     * @param Model\AdjustmentInterface $adjustment
     * @param string                    $expected
     */
    protected function assertAdjustmentMode(Model\AdjustmentInterface $adjustment, string $expected): void
    {
        if ($expected !== $mode = $adjustment->getMode()) {
            throw new Exception\InvalidArgumentException("Unexpected adjustment mode '$mode'.");
        }
    }

    /**
     * Returns whether the given item should be skipped regarding to the configured filter.
     *
     * @param Model\SaleItemInterface $item
     *
     * @return bool
     */
    protected function isItemSkipped(Model\SaleItemInterface $item): bool
    {
        if (!$this->filter) {
            return false;
        }

        if (!$item->hasSubjectIdentity()) {
            return !$this->filter->isExcludeSubjects();
        }

        return $this->filter->hasSubject($item->getSubjectIdentity()) xor !$this->filter->isExcludeSubjects();
    }

    /**
     * Merges the public children results recursively into the given result.
     *
     * @param Model\SaleItemInterface $item
     * @param Model\Amount            $result
     */
    protected function mergeItemsResults(Model\SaleItemInterface $item, Model\Amount $result): void
    {
        // At this points items result are calculated and set.
        foreach ($item->getChildren() as $child) {
            if ($child->isPrivate() || $this->isItemSkipped($child)) {
                continue;
            }

            // Skip compound with only public children
            if (!($child->isCompound() && !$child->hasPrivateChildren())) {
                $result->merge($this->calculateSaleItem($child));
            }

            if ($child->hasChildren()) {
                $this->mergeItemsResults($child, $result);
            }
        }
    }

    /**
     * Asserts that the adjustment type is as expected.
     *
     * @param Model\AdjustmentInterface $adjustment
     * @param string                    $expected
     */
    protected function assertAdjustmentType(Model\AdjustmentInterface $adjustment, string $expected): void
    {
        if ($expected !== $type = $adjustment->getType()) {
            throw new Exception\InvalidArgumentException("Unexpected adjustment type '$type'.");
        }
    }

    /**
     * Calculates the real sale gross base amount.
     *
     * @param Model\SaleInterface $sale
     *
     * @return float
     *
     * @throws Exception\LogicException
     */
    protected function getRealGrossBase(Model\SaleInterface $sale): float
    {
        // Calculate real gross base
        return $this
            ->amountCalculatorFactory
            ->create($this->currency)
            ->calculateSaleItems($sale)
            ->getBase();
    }

    /**
     * Returns the cached amount if any.
     *
     * @param string $key
     *
     * @return Model\Amount|null
     */
    protected function get(string $key): ?Model\Amount
    {
        if (isset($this->cache[$key])) {
            return $this->cache[$key];
        }

        return null;
    }

    /**
     * Sets the cached amount.
     *
     * @param string       $key
     * @param Model\Amount $amount
     */
    protected function set(string $key, Model\Amount $amount): void
    {
        $this->cache[$key] = $amount;
    }
}


text:
package com.nopcommerce.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.nopcommerce.json.JsonConstants;
import lombok.Data;

import java.util.ArrayList;

@Data
public class Language
{
    @JsonProperty(value = JsonConstants.ID)
    private int id;

    @JsonProperty(value = JsonConstants.NAME)
    private String name;

    @JsonProperty(value = JsonConstants.LANGUAGE_CULTURE)
    private String languageCulture;

    @JsonProperty(value = JsonConstants.LIMITED_TO_STORES)
    private boolean limitedToStores;

    @JsonProperty(value = JsonConstants.DISPLAY_ORDER)
    private Integer displayOrder;

    @JsonProperty(value = JsonConstants.STORE_IDS)
    private ArrayList<Integer> storeIds;
}