text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <parent>
    <groupId>nl.xup.samples.calculator</groupId>
    <artifactId>calculator-reactor</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>

  <artifactId>calculator-web</artifactId>
  <packaging>bundle</packaging>
  <name>Calculator :: Web</name>

  <properties>
    <cglib.range>[2,3)</cglib.range>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <!-- The bundle activator is only required if we do the things by hand. -->
            <Import-Package>
              org.apache.wicket,
              org.apache.wicket.util,
              org.apache.wicket.event,
              org.apache.wicket.page,
              org.apache.wicket.request.resource,
              org.apache.wicket.request.mapper,
              org.apache.wicket.request.cycle,
              org.apache.wicket.markup.html,
              org.apache.wicket.markup.html.basic,
              org.apache.wicket.protocol.http,
              org.apache.wicket.request.http,
              org.ops4j.pax.wicket.api,
              org.ops4j.pax.wicket.api.support,
              org.osgi.framework,
              net.sf.cglib.proxy;version="${cglib.range}",
              net.sf.cglib.core;version="${cglib.range}",
              net.sf.cglib.reflect;version="${cglib.range}",
              javax.servlet,
              org.apache.wicket.settings,
              org.apache.wicket.session,
              org.apache.wicket.util.file,
              org.apache.wicket.request,
              javax.servlet.http,
              org.apache.wicket.ajax,
              org.osgi.service.blueprint,
              org.apache.wicket.core.request.mapper,
              *
            </Import-Package>
            <Require-Bundle>org.ops4j.pax.wicket.service</Require-Bundle>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- Since we're using OSGi direclty we need a reference to those classes -->
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- We need wicket and pax-wicket references for this sample; simply add the core wicket bundle. -->
    <dependency>
      <groupId>org.ops4j.pax.wicket</groupId>
      <artifactId>org.ops4j.pax.wicket.service</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-web</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-core</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.wicketstuff</groupId>
      <artifactId>wicketstuff-shiro</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>


text:
        <button class='btn btn-primary' ng-click='close()'> X</button>

{{modal.mensaje}}

            <button type="button"
                    ng-click="descargar_remito()"
                    ng-disabled="bdescargado"
                    class="btn btn-default">
                Descargar recibo
            </button>

redpajama_set_name: RedPajamaGithub


text: require_tree './public' if RUBY_ENGINE == 'opal'


text:
require("libs.json")
bit = require("bit")

Input = class("Input")

-- This will be checked when keyBindings are loaded in from config.JSON.
-- keyBoardLayout = "arcade" -- todo: figure a way out to load config stuff
keyBoardLayout = "qwerty"

timeToPause = 15
timeToReset = 10
afkTimer = 0 -- don't touch this

IN_KEYS = {
    ["attack"] = bit.lshift(1, 1);
    ["jump"]   = bit.lshift(1, 2);
    ["left"]   = bit.lshift(1, 3);
    ["right"]  = bit.lshift(1, 4);
    ["crouch"] = bit.lshift(1, 5);
    [":|"]     = bit.lshift(1, 6);
    [":/"]     = bit.lshift(1, 7);
    ["select"] = bit.lshift(1, 8);
    ["start"]  = bit.lshift(1, 9);
}

function Input:initialize()
    self.binds = {}
    self.keyCodes = 0
    self._keyCodes = 0
    self.lastKeyCodes = 0
end

function Input:loadKeyBindings()
    -- run love . dvorak for dvorak bindings
    bindings_JSON = love.filesystem.read("config.json")
    bindings_o    = json.decode(bindings_JSON)

    if keyBoardLayout == "dvorak" then
        --bind all the dvorak keys for player 1.
        for key,action in pairs(bindings_o.player1.dvorak) do
            input:bind(key, action)
        end
        --bind all the dvorak keys for player 2.
        for key,action in pairs(bindings_o.player2.dvorak) do
            input2:bind(key, action)
        end
    elseif keyBoardLayout == "arcade" then
        --bind all the arcade keys for player 1.
        for key,action in pairs(bindings_o.player1.arcade) do
            input:bind(key, action)
        end
        --bind all the arcade keys for player 2.
        for key,action in pairs(bindings_o.player2.arcade) do
            input2:bind(key, action)
        end
    else
        --bind all the qwerty keys for player 1.
        for key,action in pairs(bindings_o.player1.qwerty) do
            input:bind(key, action)
        end
        --bind all the qwerty keys for player 2.
        for key,action in pairs(bindings_o.player2.qwerty) do
            input2:bind(key, action)
        end
    end
    --bind all the joystick buttons for player 1.
    for key,action in pairs(bindings_o.player1.joystick) do
        input:bind(key, action)
    end
    --bind all the joystick buttons for player 2.
    for key,action in pairs(bindings_o.player2.joystick) do
        input2:bind(key, action)
    end
end

-- usage: input:isKeyDown("attack") == true
function Input:isKeyDown(in_key)
    local key_enum = IN_KEYS[in_key]
    if key_enum == nil then return end
    return bit.band(self.keyCodes, key_enum) ~= 0
end

-- Only true for the first frame key is down. Use for jumping, etc.
function Input:wasKeyPressed(in_key)
    local key_enum = IN_KEYS[in_key]
    if key_enum == nil then return end

    return  (bit.band(self._keyCodes, key_enum) ~= 0) and
            (bit.band(self.lastKeyCodes, key_enum) == 0)
end

function Input:update()
    self.lastKeyCodes = self._keyCodes
    self._keyCodes = self.keyCodes
end

function Input:keyPress(in_key)
    if IN_KEYS[in_key] == nil then return end
    local key_enum = IN_KEYS[in_key]

    if bit.band(self.keyCodes, key_enum) == 0 then
        self.keyCodes = self.keyCodes + key_enum
    end
end

function Input:keyRelease(in_key)
    if IN_KEYS[in_key] == nil then return end
    local key_enum = IN_KEYS[in_key]

    if bit.band(self.keyCodes, key_enum) ~= 0 then
        self.lastKeyCodes = self.keyCodes
        self.keyCodes = self.keyCodes - key_enum
    end
end

function Input:eventKeyPressed(key)
    local in_key = self.binds[key]

    -- this isn't bound to anything valid. exit
    if in_key == nil then return end

    self:keyPress(in_key)
end

function Input:eventKeyReleased(key)
    local in_key = self.binds[key]

    -- this isn't bound to anything valid. exit
    if in_key == nil then return end

    self:keyRelease(in_key)
end

function Input:eventJoyPressed(key)
    local in_key = self.binds["joy_" .. key]

    if in_key == nil then return end

    self:keyPress(in_key)
end

function Input:eventJoyReleased(key)
    local in_key = self.binds["joy_" .. key]

    if in_key == nil then return end

    self:keyRelease(in_key)
end

function Input:bind(key, in_key)
    self.binds[key] = in_key
end

function love.keypressed(key, isrepeat)
    if afkTimer >= timeToPause then
        pausing = false
    end
    afkTimer = 0

    if key == "escape" then
        love.event.quit()
    end

    if not isrepeat then
        input:eventKeyPressed(key)
        input2:eventKeyPressed(key)
    end
end

function love.keyreleased(key)
    if afkTimer >= timeToPause then
        pausing = false
    end
    afkTimer = 0

    input:eventKeyReleased(key)
    input2:eventKeyReleased(key)
end

function love.joystickpressed( joystick, button )
    if afkTimer >= timeToPause then
        pausing = false
    end
    afkTimer = 0

    input:eventJoyPressed(joystick:getID() .. "_" .. button)
    input2:eventJoyPressed(joystick:getID() .. "_" .. button)
end

function love.joystickreleased( joystick, button )
    if afkTimer >= timeToPause then
        pausing = false
    end
    afkTimer = 0

    input:eventJoyReleased(joystick:getID() .. "_" .. button)
    input2:eventJoyReleased(joystick:getID() .. "_" .. button)
end

lastAxes = {}

function inputUpdate(dt)

    if map.mapname ~= "assets/maps/title" then
        afkTimer = afkTimer + dt
    end

    if afkTimer >= timeToPause and map.mapname ~= "assets/maps/title" then
        pausing = true
    end

    if afkTimer >= timeToPause + timeToReset and map.mapname ~= "assets/maps/title" then
        changeMap("title")
        afkTimer = 0
        pausing = false
    end

    local joysticks = love.joystick.getJoysticks()

    -- ipairs is like pairs but for arrays
    for _, joystick in ipairs(joysticks) do
        for i = 1, joystick:getAxisCount() do
            local axis = joystick:getAxis(i)
            local lastAxis = lastAxes[joystick:getID() .. "_" .. i] or 0
            if (axis > 0) and (lastAxis <= 0) then
                input:eventJoyPressed(joystick:getID() .. "_axisup_" .. i)
                input:eventJoyReleased(joystick:getID() .. "_axisdown_" .. i)
                input2:eventJoyPressed(joystick:getID() .. "_axisup_" .. i)
                input2:eventJoyReleased(joystick:getID() .. "_axisdown_" .. i)
            elseif (axis < 0) and (lastAxis >= 0) then
                input:eventJoyPressed(joystick:getID() .. "_axisdown_" .. i)
                input:eventJoyReleased(joystick:getID() .. "_axisup_" .. i)
                input2:eventJoyPressed(joystick:getID() .. "_axisdown_" .. i)
                input2:eventJoyReleased(joystick:getID() .. "_axisup_" .. i)
            elseif (axis == 0) and (lastAxis ~= 0) then
                input:eventJoyReleased(joystick:getID() .. "_axisdown_" .. i)
                input:eventJoyReleased(joystick:getID() .. "_axisup_" .. i)
                input2:eventJoyReleased(joystick:getID() .. "_axisdown_" .. i)
                input2:eventJoyReleased(joystick:getID() .. "_axisup_" .. i)
            end
            lastAxes[joystick:getID() .. "_" .. i] = axis
        end
    end

end

return Input


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

import {
  AttachModuleNameTransformer
} from './codegeneration/module/AttachModuleNameTransformer.js';
import {FromOptionsTransformer} from './codegeneration/FromOptionsTransformer.js';
import {Parser} from './syntax/Parser.js';
import {PureES6Transformer} from './codegeneration/PureES6Transformer.js';
import {SourceFile} from './syntax/SourceFile.js';
import {CollectingErrorReporter} from './util/CollectingErrorReporter.js';
import {Options, versionLockedOptions} from './Options.js';
import {ParseTreeMapWriter} from './outputgeneration/ParseTreeMapWriter.js';
import {ParseTreeWriter} from './outputgeneration/ParseTreeWriter.js';
import {
  SourceMapConsumer,
  SourceMapGenerator
} from './outputgeneration/SourceMapIntegration.js';

function merge(...srcs) {
  let dest = Object.create(null);
  srcs.forEach((src) => {
    Object.keys(src).forEach((key) => {
      dest[key] = src[key];
    });
    let srcModules = src.modules;  // modules is a getter on prototype
    if (typeof srcModules !== 'undefined') {
      dest.modules = srcModules;
    }

  });
  return dest;
}

function basePath(name) {
  if (!name)
    return null;
  let lastSlash = name.lastIndexOf('/');
  if (lastSlash < 0)
    return null;
  return name.substring(0, lastSlash + 1);
}

/**
 * Synchronous source to source compiler using default values for options.
 * @param {Options=} overridingOptions
 */
export class Compiler {
  constructor(overridingOptions = {}) {
    this.options_ = new Options(this.defaultOptions());
    this.options_.setFromObject(overridingOptions);
    // Only used if this.options_.sourceMaps is set.
    this.sourceMapConfiguration_ = null;
    // Only used if this.options_sourceMaps = 'memory'.
    this.sourceMapInfo_ = null;
    // Used to cache source map calculation
    this.sourceMapCache_ = null;
  }
  /**
   * Use Traceur to compile ES6 type=script source code to ES5 script.
   *
   * @param  {string} content ES6 source code.
   * @param  {Object=} options Traceur options to override defaults.
   * @return {Promise<{js: string, errors: Array, sourceMap: string}>} Transpiled code.
   */
  static script(content, options = {}) {
    options = new Options(options);  // fresh copy, don't write on argument.
    options.script = true;
    return new Compiler(options).compile(content);
  }
  /**
   * Use Traceur to compile ES6 module source code to 'bootstrap' module format.
   *
   * @param  {string} content ES6 source code.
   * @param  {Object=} options Traceur options to override defaults.
   * @return {Promise<{js: string, errors: Array, sourceMap: string}>} Transpiled code.
   */
  static module(content, options = {}) {
    options = new Options(options);  // fresh copy, don't write on argument.
    options.modules = 'bootstrap';
    return new Compiler(options).compile(content);
  }
  /**
   * Options to create 'amd' module format.
   *
   * @param  {Object=} options Traceur options to override defaults.
   * @return {Object}
   */
  static amdOptions(options = {}) {
    let amdOptions = {
      modules: 'amd',
      sourceMaps: false,
      moduleName: false
    };
    return merge(amdOptions, options);
  }
  /**
   * Options to create 'goog'/Closure module format.
   *
   * @param  {Object=} options Traceur options to override defaults.
   * @return {Object}
   */
  static closureOptions(options = {}) {
    let closureOptions = {
      modules: 'closure',
      sourceMaps: false,
      moduleName: true
    };
    return merge(closureOptions, options);
  }
  /**
   * Options to create 'commonjs' module format.
   *
   * @param  {Object=} options Traceur options to override defaults.
   * @return {Object}
   */
  static commonJSOptions(options = {}) {
    let commonjsOptions = {
      modules: 'commonjs',
      sourceMaps: false,
      moduleName: false
    };
    return merge(commonjsOptions, options);
  }

  /**
   * Compile ES6 source code with Traceur.
   *
   * @param {string} content ES6 source code.
   * @param {string} sourceName
   * @param {string} outputName
   * @param {string} sourceRoot defaults to dir of outputName
   * @return {string} equivalent ES5 source.
   */
  compile(content, sourceName = '<compileSource>',
      outputName = '<compileOutput>', sourceRoot = undefined) {

    sourceName = this.normalize(sourceName);
    outputName = this.normalize(outputName);
    let tree = this.parse(content, sourceName);
    tree = this.transform(tree, sourceName);
    // Attach the sourceURL only if the input and output names differ.
    let sourceURL = sourceName !== outputName ? sourceName : undefined;
    // The sourceRoot argument takes precidence over the option.
    if (sourceRoot === undefined)
      sourceRoot = this.options_.sourceRoot;

    return this.write(tree, outputName, sourceRoot, sourceURL);
  }

  throwIfErrors(errorReporter) {
    if (errorReporter.hadError())
      throw errorReporter.toError();
  }

  /**
   * @param {string} content to be compiled.
   * @param {string} sourceName inserted into sourceMaps
   * @return {ParseTree}
   */
  parse(content, sourceName = '<compiler-parse-input>') {
    sourceName = this.normalize(sourceName);
    this.sourceMapCache_ = null;
    this.sourceMapConfiguration_ = null;

    let errorReporter = new CollectingErrorReporter();
    let sourceFile = new SourceFile(sourceName, content);
    let parser = new Parser(sourceFile, errorReporter, this.options_);
    let tree =
        this.options_.script ? parser.parseScript() : parser.parseModule();
    this.throwIfErrors(errorReporter);

    return tree;
  }

  /**
   * Apply transformations selected by options to tree.
   * @param {ParseTree} tree
   * @param {string} candidateModuleName used as the moduleName iff the
   *    moduleName option is set true
   * @return {ParseTree}
   */
  transform(tree, candidateModuleName = undefined, metadata = undefined) {

    let transformer;
    if (candidateModuleName) {
      let transformer = new AttachModuleNameTransformer(candidateModuleName);
      tree = transformer.transformAny(tree);
    }

    let errorReporter = new CollectingErrorReporter();

    if (this.options_.outputLanguage.toLowerCase() === 'es6') {
      transformer = new PureES6Transformer(errorReporter, this.options_, metadata);
    } else {
      transformer = new FromOptionsTransformer(errorReporter, this.options_);
    }

    let transformedTree = transformer.transform(tree);
    this.throwIfErrors(errorReporter);
    return transformedTree;
  }

  createSourceMapConfiguration_(outputName, sourceRoot = undefined,
      sourceURL = undefined) {
    if (this.options_.sourceMaps) {
      return {
        sourceMapGenerator: new SourceMapGenerator({
          file: outputName,
          sourceRoot: sourceRoot,
          skipValidation: true
        }),
        basepath: basePath(outputName),
        inputSourceMap: this.options_.inputSourceMap,
        sourceURL: sourceURL,
        outputName: outputName
      };
    }
  }

  getSourceMap() {
    if (this.sourceMapCache_) {
      return this.sourceMapCache_;
    }

    if (this.sourceMapConfiguration_) {
      let sourceMap = this.sourceMapConfiguration_.sourceMapGenerator.toString();
      let inputSourceMap = this.sourceMapConfiguration_.inputSourceMap;
      if (inputSourceMap) {
        let generator = SourceMapGenerator.fromSourceMap(
            new SourceMapConsumer(sourceMap));
        generator.applySourceMap(new SourceMapConsumer(inputSourceMap));
        sourceMap = generator.toJSON();
      }
      this.sourceMapCache_ = sourceMap;
      return sourceMap;
    }
  }

  get sourceMapInfo() {
    if (!this.sourceMapInfo_ && this.sourceMapConfiguration_) {
      let sourceMap = this.getSourceMap();
      // The source map info for in-memory maps
      this.sourceMapInfo_ = {
        url: this.sourceMapConfiguration_.sourceURL,
        outputName: this.sourceMapConfiguration_.outputName,
        map: sourceMap
      };
    }
    return this.sourceMapInfo_;
  }

  /**
   * Produce output source from tree.
   * @param {ParseTree} tree
   * @param {string} outputName used for sourceMap URL and default sourceRoot.
   * @param {string} sourceRoot base for sourceMap sources
   * @param {string} sourceURL value for sourceURL
   * @return {string}
   */
  write(tree, outputName = undefined, sourceRoot = undefined,
      sourceURL = undefined) {
    outputName = this.normalize(outputName);

    if (sourceRoot === undefined)
      sourceRoot = this.options_.sourceRoot;

    if (sourceRoot === true)
      sourceRoot = basePath(outputName);
    else if (!sourceRoot) // false or '' or undefined
      sourceRoot = undefined;
    else
      sourceRoot = this.normalize(sourceRoot);

    let writer;
    this.sourceMapCache_ = null;
    this.sourceMapConfiguration_ =
        this.createSourceMapConfiguration_(outputName, sourceRoot, sourceURL);
    if (this.sourceMapConfiguration_) {
      this.sourceMapConfiguration_.lowResolution =
          this.options_.lowResolutionSourceMap;
      writer =
          new ParseTreeMapWriter(this.sourceMapConfiguration_, this.options_);
    } else {
      writer = new ParseTreeWriter(this.options_);
    }

    writer.visitAny(tree);

    let compiledCode = writer.toString();

    let link = this.debuggerLink(sourceURL, outputName);
    if (link) {
      compiledCode += link;
    }

    return compiledCode;
  }

  debuggerLink(sourceURL, outputName) {
    if (this.sourceMapConfiguration_) {
      if (this.options_.sourceMaps === 'memory') {
        return;
      }
      let sourceMappingURL =
         this.sourceMappingURL(sourceURL || outputName || 'unnamed.js');
      return '//# sourceMappingURL=' + sourceMappingURL + '\n';
    } else {
      if (sourceURL) {
        return '//# sourceURL=' + sourceURL + '\n';
      }
    }
  }

  sourceName(filename) {
    return filename;
  }

  sourceMappingURL(path) {
    // This implementation works for browsers. The NodeCompiler overrides
    // to use nodejs functions.
    if (this.options_.sourceMaps === 'inline') {
      if (Reflect.global.btoa) {
        return 'data:application/json;base64,' +
            btoa(unescape(encodeURIComponent(this.getSourceMap())));
      }
    }
    path = path || 'unamed.js';
    path = path.split('/').pop();
    return path + '.map';
  }

  sourceNameFromTree(tree) {
    return tree.location.start.source.name;
  }

  defaultOptions() {
    return versionLockedOptions;
  }

  normalize(name) {
    return name && name.replace(/\\/g,'/');
  }
}


text:
import RlMonthPickerComponent from 'ember-rl-month-picker/components/rl-month-picker';

export default RlMonthPickerComponent;


text:
div#installBox {
	background-color: #bdd2ef; /* light blue */
	width: 800px;
	margin: 20px auto;
	padding: 20px;
}

div#installBox.red {
	background-color: #efbdbd; /* pale red */
}

div#installBox table {
	width: 100%;
}

div#installBox table td {
	padding: 5px;
	vertical-align: top;
}

div#installBox table td.error {
	color: red;
	background-color: #e0e0ff;
	border: 1px solid #808080;
	padding: 10px;
	margin: 10px;
	font-weight: bold;
}

div#installBox col.left {
	width: 15em;
}

div#installBox td.submit input {
	width: 8em;
	margin-top: 20px;
}

td.line {
	background-image: url("line.png");
	background-repeat: repeat-x;
	padding: 5px;
	background-position: 0px 8px;
}

p.fieldDescription {
	font-size: 8pt;
	color: #404040;
	font-style: italic;
	margin: 2px;
}


text:
#ifndef _ASM_SPARC64_FTRACE
#define _ASM_SPARC64_FTRACE

#ifdef CONFIG_MCOUNT
#define MCOUNT_ADDR		((unsigned long)(_mcount))
#define MCOUNT_INSN_SIZE	4 /* sizeof mcount call */

#ifndef __ASSEMBLY__
void _mcount(void);
#endif

#endif

#ifdef CONFIG_DYNAMIC_FTRACE
/* reloction of mcount call site is the same as the address */
static inline unsigned long ftrace_call_adjust(unsigned long addr)
{
	return addr;
}

struct dyn_arch_ftrace {
};
#endif /*  CONFIG_DYNAMIC_FTRACE */

unsigned long prepare_ftrace_return(unsigned long parent,
				    unsigned long self_addr,
				    unsigned long frame_pointer);

#endif /* _ASM_SPARC64_FTRACE */


text:
package org.keycloak.models.cache.infinispan.entities;

import org.keycloak.common.util.MultivaluedHashMap;
import org.keycloak.models.GroupModel;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.cache.infinispan.DefaultLazyLoader;
import org.keycloak.models.cache.infinispan.LazyLoader;

import java.util.Collections;
import java.util.Set;
import java.util.function.Supplier;
import java.util.stream.Collectors;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
public class CachedGroup extends AbstractRevisioned implements InRealm {

    private final String realm;
    private final String name;
    private final String parentId;
    private final LazyLoader<GroupModel, MultivaluedHashMap<String, String>> attributes;
    private final LazyLoader<GroupModel, Set<String>> roleMappings;
    private final LazyLoader<GroupModel, Set<String>> subGroups;

    public CachedGroup(Long revision, RealmModel realm, GroupModel group) {
        super(revision, group.getId());
        this.realm = realm.getId();
        this.name = group.getName();
        this.parentId = group.getParentId();
        this.attributes = new DefaultLazyLoader<>(source -> new MultivaluedHashMap<>(source.getAttributes()), MultivaluedHashMap::new);
        this.roleMappings = new DefaultLazyLoader<>(source -> source.getRoleMappingsStream().map(RoleModel::getId).collect(Collectors.toSet()), Collections::emptySet);
        this.subGroups = new DefaultLazyLoader<>(source -> source.getSubGroupsStream().map(GroupModel::getId).collect(Collectors.toSet()), Collections::emptySet);
    }

    public String getRealm() {
        return realm;
    }

    public MultivaluedHashMap<String, String> getAttributes(Supplier<GroupModel> group) {
        return attributes.get(group);
    }

    public Set<String> getRoleMappings(Supplier<GroupModel> group) {
        // it may happen that groups were not loaded before so we don't actually need to invalidate entries in the cache
        if (group == null) {
            return Collections.emptySet();
        }
        return roleMappings.get(group);
    }

    public String getName() {
        return name;
    }

    public String getParentId() {
        return parentId;
    }

    public Set<String> getSubGroups(Supplier<GroupModel> group) {
        return subGroups.get(group);
    }
}


text:
package org.eclipse.php.internal.core.phar;

import java.io.IOException;
import java.io.OutputStream;

public class PharEntryBufferedOutputStream extends OutputStream {

	protected OutputStream innerStream;
	private boolean beforeWrited = false;

	public PharEntryBufferedOutputStream(OutputStream innerStream) {
		this.innerStream = innerStream;
	}

	@Override
	public void write(int b) throws IOException {
		if (!beforeWrited) {
			beforeWrite();
		}

		innerStream.write(b);
	}

	protected void beforeWrite() {
		beforeWrited = true;
	}

	@Override
	public void write(byte[] b) throws IOException {
		if (!beforeWrited) {
			beforeWrite();
		}

		innerStream.write(b);
	}

	@Override
	public void write(byte[] b, int off, int len) throws IOException {
		if (!beforeWrited) {
			beforeWrite();
		}

		innerStream.write(b, off, len);
	}

	@Override
	public void close() throws IOException {
		afterWrite();
		// innerStream.close();
	}

	protected void afterWrite() {

	}

}


text:
'''
PROBLEM LINK:
https://www.hackerrank.com/challenges/picking-numbers/problem
'''

import math
import os
import random
import re
import sys

#
# Complete the 'pickingNumbers' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER_ARRAY a as parameter.
#

def pickingNumbers(a):
    # Write your code here
    freq = {}
    for item in a:
        if item in freq:
            freq[item] += 1
        else:
            freq[item] = 1
    a_new = list(zip(list(freq.keys()) , list(freq.values())))
    a_new.sort()
    max_ints = max(freq.values())
    for i in range(len(a_new) - 1):
        if a_new[i+1][0] - a_new[i][0] <= 1:
            ints_number = a_new[i+1][1] + a_new[i][1]
            if max_ints < ints_number:
                max_ints = ints_number
    return max_ints

if __name__ == '__main__':
    # fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input().strip())

    a = list(map(int, input().rstrip().split()))

    result = pickingNumbers(a)

    print(result)

    # fptr.write(str(result) + '\n')

    # fptr.close()


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

package net.adoptopenjdk.bumblebench.examples;

import net.adoptopenjdk.bumblebench.core.MicroBench;
import sarong.ToppingRNG;

/**
 * ToppingBench score: 618121344.000000 (618.1M 2024.2%)
 *         uncertainty:   0.1%
 */
public final class ToppingBench extends MicroBench {

	protected long doBatch(long numIterations) throws InterruptedException {
		ToppingRNG rng = new ToppingRNG(0x12345678L);
		long sum = 0L;
		for (long i = 0; i < numIterations; i++)
			sum += rng.nextLong();
		return numIterations;
	}
}


text:
package com.tom.core.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelSaw extends ModelBase {
	// fields
	ModelRenderer sawHandle;
	ModelRenderer handle1;
	ModelRenderer sawBlade;
	ModelRenderer handle2;
	ModelRenderer blade2;
	ModelRenderer handle3;

	public ModelSaw() {
		textureWidth = 64;
		textureHeight = 64;

		sawHandle = new ModelRenderer(this, 8, 18);
		sawHandle.addBox(0F, 0F, 0F, 1, 1, 4);
		sawHandle.setRotationPoint(0F, 15F, 0F);
		sawHandle.setTextureSize(64, 64);
		sawHandle.mirror = true;
		setRotation(sawHandle, 0F, 0F, 0F);
		handle1 = new ModelRenderer(this, 9, 18);
		handle1.addBox(0F, 0F, 0F, 1, 1, 1);
		handle1.setRotationPoint(0F, 14F, 0F);
		handle1.setTextureSize(64, 64);
		handle1.mirror = true;
		setRotation(handle1, 0F, 0F, 0F);
		sawBlade = new ModelRenderer(this, 32, 0);
		sawBlade.addBox(0F, 0F, 0F, 1, 8, 3);
		sawBlade.setRotationPoint(0F, 16F, 0F);
		sawBlade.setTextureSize(64, 64);
		sawBlade.mirror = true;
		setRotation(sawBlade, 0F, 0F, 0F);
		handle2 = new ModelRenderer(this, 11, 18);
		handle2.addBox(0F, 0F, 0F, 1, 1, 1);
		handle2.setRotationPoint(0F, 14F, 4F);
		handle2.setTextureSize(64, 64);
		handle2.mirror = true;
		setRotation(handle2, 0F, 0F, 0F);
		blade2 = new ModelRenderer(this, 33, 2);
		blade2.addBox(0F, 0F, 0F, 1, 3, 1);
		blade2.setRotationPoint(0F, 16F, 3F);
		blade2.setTextureSize(64, 64);
		blade2.mirror = true;
		setRotation(blade2, 0F, 0F, 0F);
		handle3 = new ModelRenderer(this, 8, 18);
		handle3.addBox(0F, 0F, 0F, 1, 1, 5);
		handle3.setRotationPoint(0F, 13F, 0F);
		handle3.setTextureSize(64, 64);
		handle3.mirror = true;
		setRotation(handle3, 0F, 0F, 0F);
	}

	@Override
	public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
		super.render(entity, f, f1, f2, f3, f4, f5);
		setRotationAngles(f, f1, f2, f3, f4, f5, entity);
		sawHandle.render(f5);
		handle1.render(f5);
		sawBlade.render(f5);
		handle2.render(f5);
		blade2.render(f5);
		handle3.render(f5);
	}

	private void setRotation(ModelRenderer model, float x, float y, float z) {
		model.rotateAngleX = x;
		model.rotateAngleY = y;
		model.rotateAngleZ = z;
	}

	@Override
	public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent) {
		super.setRotationAngles(f, f1, f2, f3, f4, f5, ent);
	}

	public void renderStatic(float f5) {
		sawHandle.render(f5);
		handle1.render(f5);
		sawBlade.render(f5);
		handle2.render(f5);
		blade2.render(f5);
		handle3.render(f5);
	}
}


text:
//-----------------------------------------------------------------------
// <copyright file="CustomerModel.cs" company="Genesys Source">
//      Copyright (c) 2017-2018 Genesys Source. All rights reserved.
//      Licensed to the Apache Software Foundation (ASF) under one or more
//      contributor license agreements.  See the NOTICE file distributed with
//      this work for additional information regarding copyright ownership.
//      The ASF licenses this file to You under the Apache License, Version 2.0
//      (the 'License'); you may not use this file except in compliance with
//      the License.  You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//       Unless required by applicable law or agreed to in writing, software
//       distributed under the License is distributed on an 'AS IS' BASIS,
//       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//       See the License for the specific language governing permissions and
//       limitations under the License.
// </copyright>
//-----------------------------------------------------------------------
using System;
using Genesys.Extensions;
using System.Collections.Generic;
using Genesys.Framework.Data;

namespace Framework.Customer
{
    /// <summary>
    /// Customer screen model for binding and transport
    /// </summary>
    /// <remarks></remarks>
    public class GenderList : IGenderList
    {
        /// <summary>
        /// ISO 5218 Standard for Gender values
        /// </summary>
        public struct GenderData
        {
            /// <summary>
            /// Default. Not set
            /// </summary>
            public static KeyValuePair<int, string> NotSet { get; } = new KeyValuePair<int, string>(-1, "Not Set");

            /// <summary>
            /// Unknown gender
            /// </summary>
            public static KeyValuePair<int, string> NotKnown { get; } = new KeyValuePair<int, string>(0, "Not Known");

            /// <summary>
            /// Male gender
            /// </summary>
            public static KeyValuePair<int, string> Male { get; } = new KeyValuePair<int, string>(1, "Male");

            /// <summary>
            /// Femal Gender
            /// </summary>
            public static KeyValuePair<int, string> Female { get; } = new KeyValuePair<int, string>(2, "Female");

            /// <summary>
            /// Not applicable or do not want to specify
            /// </summary>
            public static KeyValuePair<int, string> NotApplicable { get; } = new KeyValuePair<int, string>(9, "Not Applicable");
        }

        /// <summary>
        /// List of Genders, bindable to int Id and string Name
        /// </summary>
        public List<KeyValuePair<int, string>> Genders
        {
            get
            {
                return GenderList.GetAll();
            }
        }

        /// <summary>
        /// List of Genders, bindable to int Id and string Name
        /// </summary>
        public static List<KeyValuePair<int, string>> GetAll()
        {
            return new List<KeyValuePair<int, string>>() { GenderData.NotSet, GenderData.Male, GenderData.Female };
        }
    }
}


text:
/*================================================================================
  code generated by: java2cpp
  author: Zoran Angelov, mailto://baldzar@gmail.com
  class: android.test.ActivityInstrumentationTestCase2
================================================================================*/

#ifndef J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_TEST_ACTIVITYINSTRUMENTATIONTESTCASE2_HPP_DECL
#define J2CPP_ANDROID_TEST_ACTIVITYINSTRUMENTATIONTESTCASE2_HPP_DECL

namespace j2cpp { namespace java { namespace lang { class String; } } }
namespace j2cpp { namespace java { namespace lang { class Class; } } }
namespace j2cpp { namespace java { namespace lang { class Object; } } }
namespace j2cpp { namespace junit { namespace framework { class Test; } } }
namespace j2cpp { namespace junit { namespace framework { class TestCase; } } }
namespace j2cpp { namespace junit { namespace framework { class Assert; } } }
namespace j2cpp { namespace android { namespace content { class Intent; } } }
namespace j2cpp { namespace android { namespace app { class Activity; } } }
namespace j2cpp { namespace android { namespace test { class InstrumentationTestCase; } } }
namespace j2cpp { namespace android { namespace test { class ActivityTestCase; } } }

#include <android/app/Activity.hpp>
#include <android/content/Intent.hpp>
#include <android/test/ActivityTestCase.hpp>
#include <android/test/InstrumentationTestCase.hpp>
#include <java/lang/Class.hpp>
#include <java/lang/Object.hpp>
#include <java/lang/String.hpp>
#include <junit/framework/Assert.hpp>
#include <junit/framework/Test.hpp>
#include <junit/framework/TestCase.hpp>

namespace j2cpp {

namespace android { namespace test {

	class ActivityInstrumentationTestCase2;
	class ActivityInstrumentationTestCase2
		: public object<ActivityInstrumentationTestCase2>
	{
	public:

		J2CPP_DECLARE_CLASS

		J2CPP_DECLARE_METHOD(0)
		J2CPP_DECLARE_METHOD(1)
		J2CPP_DECLARE_METHOD(2)
		J2CPP_DECLARE_METHOD(3)
		J2CPP_DECLARE_METHOD(4)
		J2CPP_DECLARE_METHOD(5)
		J2CPP_DECLARE_METHOD(6)
		J2CPP_DECLARE_METHOD(7)

		explicit ActivityInstrumentationTestCase2(jobject jobj)
		: object<ActivityInstrumentationTestCase2>(jobj)
		{
		}

		operator local_ref<java::lang::Object>() const;
		operator local_ref<junit::framework::Test>() const;
		operator local_ref<junit::framework::TestCase>() const;
		operator local_ref<junit::framework::Assert>() const;
		operator local_ref<android::test::InstrumentationTestCase>() const;
		operator local_ref<android::test::ActivityTestCase>() const;

		ActivityInstrumentationTestCase2(local_ref< java::lang::String > const&, local_ref< java::lang::Class > const&);
		ActivityInstrumentationTestCase2(local_ref< java::lang::Class > const&);
		local_ref< android::app::Activity > getActivity();
		void setActivityIntent(local_ref< android::content::Intent >  const&);
		void setActivityInitialTouchMode(jboolean);
	}; //class ActivityInstrumentationTestCase2

} //namespace test
} //namespace android

} //namespace j2cpp

#endif //J2CPP_ANDROID_TEST_ACTIVITYINSTRUMENTATIONTESTCASE2_HPP_DECL

#else //J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_TEST_ACTIVITYINSTRUMENTATIONTESTCASE2_HPP_IMPL
#define J2CPP_ANDROID_TEST_ACTIVITYINSTRUMENTATIONTESTCASE2_HPP_IMPL

namespace j2cpp {

android::test::ActivityInstrumentationTestCase2::operator local_ref<java::lang::Object>() const
{
	return local_ref<java::lang::Object>(get_jobject());
}

android::test::ActivityInstrumentationTestCase2::operator local_ref<junit::framework::Test>() const
{
	return local_ref<junit::framework::Test>(get_jobject());
}

android::test::ActivityInstrumentationTestCase2::operator local_ref<junit::framework::TestCase>() const
{
	return local_ref<junit::framework::TestCase>(get_jobject());
}

android::test::ActivityInstrumentationTestCase2::operator local_ref<junit::framework::Assert>() const
{
	return local_ref<junit::framework::Assert>(get_jobject());
}

android::test::ActivityInstrumentationTestCase2::operator local_ref<android::test::InstrumentationTestCase>() const
{
	return local_ref<android::test::InstrumentationTestCase>(get_jobject());
}

android::test::ActivityInstrumentationTestCase2::operator local_ref<android::test::ActivityTestCase>() const
{
	return local_ref<android::test::ActivityTestCase>(get_jobject());
}

android::test::ActivityInstrumentationTestCase2::ActivityInstrumentationTestCase2(local_ref< java::lang::String > const &a0, local_ref< java::lang::Class > const &a1)
: object<android::test::ActivityInstrumentationTestCase2>(
	call_new_object<
		android::test::ActivityInstrumentationTestCase2::J2CPP_CLASS_NAME,
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_NAME(0),
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_SIGNATURE(0)
	>(a0, a1)
)
{
}

android::test::ActivityInstrumentationTestCase2::ActivityInstrumentationTestCase2(local_ref< java::lang::Class > const &a0)
: object<android::test::ActivityInstrumentationTestCase2>(
	call_new_object<
		android::test::ActivityInstrumentationTestCase2::J2CPP_CLASS_NAME,
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_NAME(1),
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_SIGNATURE(1)
	>(a0)
)
{
}

local_ref< android::app::Activity > android::test::ActivityInstrumentationTestCase2::getActivity()
{
	return call_method<
		android::test::ActivityInstrumentationTestCase2::J2CPP_CLASS_NAME,
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_NAME(2),
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_SIGNATURE(2),
		local_ref< android::app::Activity >
	>(get_jobject());
}

void android::test::ActivityInstrumentationTestCase2::setActivityIntent(local_ref< android::content::Intent > const &a0)
{
	return call_method<
		android::test::ActivityInstrumentationTestCase2::J2CPP_CLASS_NAME,
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_NAME(3),
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_SIGNATURE(3),
		void
	>(get_jobject(), a0);
}

void android::test::ActivityInstrumentationTestCase2::setActivityInitialTouchMode(jboolean a0)
{
	return call_method<
		android::test::ActivityInstrumentationTestCase2::J2CPP_CLASS_NAME,
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_NAME(4),
		android::test::ActivityInstrumentationTestCase2::J2CPP_METHOD_SIGNATURE(4),
		void
	>(get_jobject(), a0);
}

J2CPP_DEFINE_CLASS(android::test::ActivityInstrumentationTestCase2,"android/test/ActivityInstrumentationTestCase2")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,0,"<init>","(Ljava/lang/String;Ljava/lang/Class;)V")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,1,"<init>","(Ljava/lang/Class;)V")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,2,"getActivity","()Landroid/app/Activity;")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,3,"setActivityIntent","(Landroid/content/Intent;)V")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,4,"setActivityInitialTouchMode","(Z)V")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,5,"setUp","()V")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,6,"tearDown","()V")
J2CPP_DEFINE_METHOD(android::test::ActivityInstrumentationTestCase2,7,"runTest","()V")

} //namespace j2cpp

#endif //J2CPP_ANDROID_TEST_ACTIVITYINSTRUMENTATIONTESTCASE2_HPP_IMPL

#endif //J2CPP_INCLUDE_IMPLEMENTATION


text:
<?php

namespace Test\Integration\Version3x0;

include_once(__DIR__. '/../Version2x8/SetsCommandsTest.php');

class SetsCommandsTest extends \Test\Integration\Version2x8\SetsCommandsTest {

}


text:
#ifndef __OPENCV_CORE_CVSTD_HPP__
#define __OPENCV_CORE_CVSTD_HPP__

#ifndef __cplusplus
#  error cvstd.hpp header must be compiled as C++
#endif

#include "opencv2/core/cvdef.h"

#include <cstddef>
#include <cstring>
#include <cctype>

#ifndef OPENCV_NOSTL
#  include <string>
#endif

// import useful primitives from stl
#ifndef OPENCV_NOSTL_TRANSITIONAL
#  include <algorithm>
#  include <utility>
#  include <cstdlib> //for abs(int)
#  include <cmath>

namespace cv
{
    using std::min;
    using std::max;
    using std::abs;
    using std::swap;
    using std::sqrt;
    using std::exp;
    using std::pow;
    using std::log;
}

namespace std
{
    static inline uchar abs(uchar a) { return a; }
    static inline ushort abs(ushort a) { return a; }
    static inline unsigned abs(unsigned a) { return a; }
    static inline uint64 abs(uint64 a) { return a; }
}

#else
namespace cv
{
    template<typename T> static inline T min(T a, T b) { return a < b ? a : b; }
    template<typename T> static inline T max(T a, T b) { return a > b ? a : b; }
    template<typename T> static inline T abs(T a) { return a < 0 ? -a : a; }
    template<typename T> static inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }

    template<> inline uchar abs(uchar a) { return a; }
    template<> inline ushort abs(ushort a) { return a; }
    template<> inline unsigned abs(unsigned a) { return a; }
    template<> inline uint64 abs(uint64 a) { return a; }
}
#endif

namespace cv {

//! @addtogroup core_utils
//! @{

//////////////////////////// memory management functions ////////////////////////////

/** @brief Allocates an aligned memory buffer.

The function allocates the buffer of the specified size and returns it. When the buffer size is 16
bytes or more, the returned buffer is aligned to 16 bytes.
@param bufSize Allocated buffer size.
 */
CV_EXPORTS void* fastMalloc(size_t bufSize);

/** @brief Deallocates a memory buffer.

The function deallocates the buffer allocated with fastMalloc . If NULL pointer is passed, the
function does nothing. C version of the function clears the pointer *pptr* to avoid problems with
double memory deallocation.
@param ptr Pointer to the allocated buffer.
 */
CV_EXPORTS void fastFree(void* ptr);

/*!
  The STL-compilant memory Allocator based on cv::fastMalloc() and cv::fastFree()
*/
template<typename _Tp> class Allocator
{
public:
    typedef _Tp value_type;
    typedef value_type* pointer;
    typedef const value_type* const_pointer;
    typedef value_type& reference;
    typedef const value_type& const_reference;
    typedef size_t size_type;
    typedef ptrdiff_t difference_type;
    template<typename U> class rebind { typedef Allocator<U> other; };

    explicit Allocator() {}
    ~Allocator() {}
    explicit Allocator(Allocator const&) {}
    template<typename U>
    explicit Allocator(Allocator<U> const&) {}

    // address
    pointer address(reference r) { return &r; }
    const_pointer address(const_reference r) { return &r; }

    pointer allocate(size_type count, const void* =0) { return reinterpret_cast<pointer>(fastMalloc(count * sizeof (_Tp))); }
    void deallocate(pointer p, size_type) { fastFree(p); }

    void construct(pointer p, const _Tp& v) { new(static_cast<void*>(p)) _Tp(v); }
    void destroy(pointer p) { p->~_Tp(); }

    size_type max_size() const { return cv::max(static_cast<_Tp>(-1)/sizeof(_Tp), 1); }
};

//! @} core_utils

//! @cond IGNORED

namespace detail
{

// Metafunction to avoid taking a reference to void.
template<typename T>
struct RefOrVoid { typedef T& type; };

template<>
struct RefOrVoid<void>{ typedef void type; };

template<>
struct RefOrVoid<const void>{ typedef const void type; };

template<>
struct RefOrVoid<volatile void>{ typedef volatile void type; };

template<>
struct RefOrVoid<const volatile void>{ typedef const volatile void type; };

// This class would be private to Ptr, if it didn't have to be a non-template.
struct PtrOwner;

}

template<typename Y>
struct DefaultDeleter
{
    void operator () (Y* p) const;
};

//! @endcond

//! @addtogroup core_basic
//! @{

/** @brief Template class for smart pointers with shared ownership

A Ptr\<T\> pretends to be a pointer to an object of type T. Unlike an ordinary pointer, however, the
object will be automatically cleaned up once all Ptr instances pointing to it are destroyed.

Ptr is similar to boost::shared_ptr that is part of the Boost library
(<http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm>) and std::shared_ptr from
the [C++11](http://en.wikipedia.org/wiki/C++11) standard.

This class provides the following advantages:
-   Default constructor, copy constructor, and assignment operator for an arbitrary C++ class or C
    structure. For some objects, like files, windows, mutexes, sockets, and others, a copy
    constructor or an assignment operator are difficult to define. For some other objects, like
    complex classifiers in OpenCV, copy constructors are absent and not easy to implement. Finally,
    some of complex OpenCV and your own data structures may be written in C. However, copy
    constructors and default constructors can simplify programming a lot. Besides, they are often
    required (for example, by STL containers). By using a Ptr to such an object instead of the
    object itself, you automatically get all of the necessary constructors and the assignment
    operator.
-   *O(1)* complexity of the above-mentioned operations. While some structures, like std::vector,
    provide a copy constructor and an assignment operator, the operations may take a considerable
    amount of time if the data structures are large. But if the structures are put into a Ptr, the
    overhead is small and independent of the data size.
-   Automatic and customizable cleanup, even for C structures. See the example below with FILE\*.
-   Heterogeneous collections of objects. The standard STL and most other C++ and OpenCV containers
    can store only objects of the same type and the same size. The classical solution to store
    objects of different types in the same container is to store pointers to the base class (Base\*)
    instead but then you lose the automatic memory management. Again, by using Ptr\<Base\> instead
    of raw pointers, you can solve the problem.

A Ptr is said to *own* a pointer - that is, for each Ptr there is a pointer that will be deleted
once all Ptr instances that own it are destroyed. The owned pointer may be null, in which case
nothing is deleted. Each Ptr also *stores* a pointer. The stored pointer is the pointer the Ptr
pretends to be; that is, the one you get when you use Ptr::get or the conversion to T\*. It's
usually the same as the owned pointer, but if you use casts or the general shared-ownership
constructor, the two may diverge: the Ptr will still own the original pointer, but will itself point
to something else.

The owned pointer is treated as a black box. The only thing Ptr needs to know about it is how to
delete it. This knowledge is encapsulated in the *deleter* - an auxiliary object that is associated
with the owned pointer and shared between all Ptr instances that own it. The default deleter is an
instance of DefaultDeleter, which uses the standard C++ delete operator; as such it will work with
any pointer allocated with the standard new operator.

However, if the pointer must be deleted in a different way, you must specify a custom deleter upon
Ptr construction. A deleter is simply a callable object that accepts the pointer as its sole
argument. For example, if you want to wrap FILE, you may do so as follows:
@code
    Ptr<FILE> f(fopen("myfile.txt", "w"), fclose);
    if(!f) throw ...;
    fprintf(f, ....);
    ...
    // the file will be closed automatically by f's destructor.
@endcode
Alternatively, if you want all pointers of a particular type to be deleted the same way, you can
specialize DefaultDeleter<T>::operator() for that type, like this:
@code
    namespace cv {
    template<> void DefaultDeleter<FILE>::operator ()(FILE * obj) const
    {
        fclose(obj);
    }
    }
@endcode
For convenience, the following types from the OpenCV C API already have such a specialization that
calls the appropriate release function:
-   CvCapture
-   CvFileStorage
-   CvHaarClassifierCascade
-   CvMat
-   CvMatND
-   CvMemStorage
-   CvSparseMat
-   CvVideoWriter
-   IplImage
@note The shared ownership mechanism is implemented with reference counting. As such, cyclic
ownership (e.g. when object a contains a Ptr to object b, which contains a Ptr to object a) will
lead to all involved objects never being cleaned up. Avoid such situations.
@note It is safe to concurrently read (but not write) a Ptr instance from multiple threads and
therefore it is normally safe to use it in multi-threaded applications. The same is true for Mat and
other C++ OpenCV classes that use internal reference counts.
*/
template<typename T>
struct Ptr
{
    /** Generic programming support. */
    typedef T element_type;

    /** The default constructor creates a null Ptr - one that owns and stores a null pointer.
    */
    Ptr();

    /**
    If p is null, these are equivalent to the default constructor.
    Otherwise, these constructors assume ownership of p - that is, the created Ptr owns and stores p
    and assumes it is the sole owner of it. Don't use them if p is already owned by another Ptr, or
    else p will get deleted twice.
    With the first constructor, DefaultDeleter\<Y\>() becomes the associated deleter (so p will
    eventually be deleted with the standard delete operator). Y must be a complete type at the point
    of invocation.
    With the second constructor, d becomes the associated deleter.
    Y\* must be convertible to T\*.
    @param p Pointer to own.
    @note It is often easier to use makePtr instead.
     */
    template<typename Y>
#ifdef DISABLE_OPENCV_24_COMPATIBILITY
    explicit
#endif
    Ptr(Y* p);

    /** @overload
    @param d Deleter to use for the owned pointer.
    @param p Pointer to own.
    */
    template<typename Y, typename D>
    Ptr(Y* p, D d);

    /**
    These constructors create a Ptr that shares ownership with another Ptr - that is, own the same
    pointer as o.
    With the first two, the same pointer is stored, as well; for the second, Y\* must be convertible
    to T\*.
    With the third, p is stored, and Y may be any type. This constructor allows to have completely
    unrelated owned and stored pointers, and should be used with care to avoid confusion. A relatively
    benign use is to create a non-owning Ptr, like this:
    @code
        ptr = Ptr<T>(Ptr<T>(), dont_delete_me); // owns nothing; will not delete the pointer.
    @endcode
    @param o Ptr to share ownership with.
    */
    Ptr(const Ptr& o);

    /** @overload
    @param o Ptr to share ownership with.
    */
    template<typename Y>
    Ptr(const Ptr<Y>& o);

    /** @overload
    @param o Ptr to share ownership with.
    @param p Pointer to store.
    */
    template<typename Y>
    Ptr(const Ptr<Y>& o, T* p);

    /** The destructor is equivalent to calling Ptr::release. */
    ~Ptr();

    /**
    Assignment replaces the current Ptr instance with one that owns and stores same pointers as o and
    then destroys the old instance.
    @param o Ptr to share ownership with.
     */
    Ptr& operator = (const Ptr& o);

    /** @overload */
    template<typename Y>
    Ptr& operator = (const Ptr<Y>& o);

    /** If no other Ptr instance owns the owned pointer, deletes it with the associated deleter. Then sets
    both the owned and the stored pointers to NULL.
    */
    void release();

    /**
    `ptr.reset(...)` is equivalent to `ptr = Ptr<T>(...)`.
    @param p Pointer to own.
    */
    template<typename Y>
    void reset(Y* p);

    /** @overload
    @param d Deleter to use for the owned pointer.
    @param p Pointer to own.
    */
    template<typename Y, typename D>
    void reset(Y* p, D d);

    /**
    Swaps the owned and stored pointers (and deleters, if any) of this and o.
    @param o Ptr to swap with.
    */
    void swap(Ptr& o);

    /** Returns the stored pointer. */
    T* get() const;

    /** Ordinary pointer emulation. */
    typename detail::RefOrVoid<T>::type operator * () const;

    /** Ordinary pointer emulation. */
    T* operator -> () const;

    /** Equivalent to get(). */
    operator T* () const;

    /** ptr.empty() is equivalent to `!ptr.get()`. */
    bool empty() const;

    /** Returns a Ptr that owns the same pointer as this, and stores the same
       pointer as this, except converted via static_cast to Y*.
    */
    template<typename Y>
    Ptr<Y> staticCast() const;

    /** Ditto for const_cast. */
    template<typename Y>
    Ptr<Y> constCast() const;

    /** Ditto for dynamic_cast. */
    template<typename Y>
    Ptr<Y> dynamicCast() const;

private:
    detail::PtrOwner* owner;
    T* stored;

    template<typename Y>
    friend struct Ptr; // have to do this for the cross-type copy constructor
};

/** Equivalent to ptr1.swap(ptr2). Provided to help write generic algorithms. */
template<typename T>
void swap(Ptr<T>& ptr1, Ptr<T>& ptr2);

/** Return whether ptr1.get() and ptr2.get() are equal and not equal, respectively. */
template<typename T>
bool operator == (const Ptr<T>& ptr1, const Ptr<T>& ptr2);
template<typename T>
bool operator != (const Ptr<T>& ptr1, const Ptr<T>& ptr2);

/** `makePtr<T>(...)` is equivalent to `Ptr<T>(new T(...))`. It is shorter than the latter, and it's
marginally safer than using a constructor or Ptr::reset, since it ensures that the owned pointer
is new and thus not owned by any other Ptr instance.
Unfortunately, perfect forwarding is impossible to implement in C++03, and so makePtr is limited
to constructors of T that have up to 10 arguments, none of which are non-const references.
 */
template<typename T>
Ptr<T> makePtr();
/** @overload */
template<typename T, typename A1>
Ptr<T> makePtr(const A1& a1);
/** @overload */
template<typename T, typename A1, typename A2>
Ptr<T> makePtr(const A1& a1, const A2& a2);
/** @overload */
template<typename T, typename A1, typename A2, typename A3>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9);
/** @overload */
template<typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
Ptr<T> makePtr(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8, const A9& a9, const A10& a10);

//////////////////////////////// string class ////////////////////////////////

class CV_EXPORTS FileNode; //for string constructor from FileNode

class CV_EXPORTS String
{
public:
    typedef char value_type;
    typedef char& reference;
    typedef const char& const_reference;
    typedef char* pointer;
    typedef const char* const_pointer;
    typedef ptrdiff_t difference_type;
    typedef size_t size_type;
    typedef char* iterator;
    typedef const char* const_iterator;

    static const size_t npos = size_t(-1);

    explicit String();
    String(const String& str);
    String(const String& str, size_t pos, size_t len = npos);
    String(const char* s);
    String(const char* s, size_t n);
    String(size_t n, char c);
    String(const char* first, const char* last);
    template<typename Iterator> String(Iterator first, Iterator last);
    explicit String(const FileNode& fn);
    ~String();

    String& operator=(const String& str);
    String& operator=(const char* s);
    String& operator=(char c);

    String& operator+=(const String& str);
    String& operator+=(const char* s);
    String& operator+=(char c);

    size_t size() const;
    size_t length() const;

    char operator[](size_t idx) const;
    char operator[](int idx) const;

    const char* begin() const;
    const char* end() const;

    const char* c_str() const;

    bool empty() const;
    void clear();

    int compare(const char* s) const;
    int compare(const String& str) const;

    void swap(String& str);
    String substr(size_t pos = 0, size_t len = npos) const;

    size_t find(const char* s, size_t pos, size_t n) const;
    size_t find(char c, size_t pos = 0) const;
    size_t find(const String& str, size_t pos = 0) const;
    size_t find(const char* s, size_t pos = 0) const;

    size_t rfind(const char* s, size_t pos, size_t n) const;
    size_t rfind(char c, size_t pos = npos) const;
    size_t rfind(const String& str, size_t pos = npos) const;
    size_t rfind(const char* s, size_t pos = npos) const;

    size_t find_first_of(const char* s, size_t pos, size_t n) const;
    size_t find_first_of(char c, size_t pos = 0) const;
    size_t find_first_of(const String& str, size_t pos = 0) const;
    size_t find_first_of(const char* s, size_t pos = 0) const;

    size_t find_last_of(const char* s, size_t pos, size_t n) const;
    size_t find_last_of(char c, size_t pos = npos) const;
    size_t find_last_of(const String& str, size_t pos = npos) const;
    size_t find_last_of(const char* s, size_t pos = npos) const;

    friend String operator+ (const String& lhs, const String& rhs);
    friend String operator+ (const String& lhs, const char*   rhs);
    friend String operator+ (const char*   lhs, const String& rhs);
    friend String operator+ (const String& lhs, char          rhs);
    friend String operator+ (char          lhs, const String& rhs);

    String toLowerCase() const;

#ifndef OPENCV_NOSTL
    String(const std::string& str);
    String(const std::string& str, size_t pos, size_t len = npos);
    String& operator=(const std::string& str);
    String& operator+=(const std::string& str);
    operator std::string() const;

    friend String operator+ (const String& lhs, const std::string& rhs);
    friend String operator+ (const std::string& lhs, const String& rhs);
#endif

private:
    char*  cstr_;
    size_t len_;

    char* allocate(size_t len); // len without trailing 0
    void deallocate();
};

//! @} core_basic

////////////////////////// cv::String implementation /////////////////////////

//! @cond IGNORED

inline
String::String()
    : cstr_(0), len_(0)
{}

inline
String::String(const String& str)
    : cstr_(str.cstr_), len_(str.len_)
{
    if (cstr_)
        CV_XADD(((int*)cstr_)-1, 1);
}

inline
String::String(const String& str, size_t pos, size_t len)
    : cstr_(0), len_(0)
{
    pos = min(pos, str.len_);
    len = min(str.len_ - pos, len);
    if (!len) return;
    if (len == str.len_)
    {
        CV_XADD(((int*)str.cstr_)-1, 1);
        cstr_ = str.cstr_;
        len_ = str.len_;
        return;
    }
    memcpy(allocate(len), str.cstr_ + pos, len);
}

inline
String::String(const char* s)
    : cstr_(0), len_(0)
{
    if (!s) return;
    size_t len = strlen(s);
    memcpy(allocate(len), s, len);
}

inline
String::String(const char* s, size_t n)
    : cstr_(0), len_(0)
{
    if (!n) return;
    memcpy(allocate(n), s, n);
}

inline
String::String(size_t n, char c)
    : cstr_(0), len_(0)
{
    memset(allocate(n), c, n);
}

inline
String::String(const char* first, const char* last)
    : cstr_(0), len_(0)
{
    size_t len = (size_t)(last - first);
    memcpy(allocate(len), first, len);
}

template<typename Iterator> inline
String::String(Iterator first, Iterator last)
    : cstr_(0), len_(0)
{
    size_t len = (size_t)(last - first);
    char* str = allocate(len);
    while (first != last)
    {
        *str++ = *first;
        ++first;
    }
}

inline
String::~String()
{
    deallocate();
}

inline
String& String::operator=(const String& str)
{
    if (&str == this) return *this;

    deallocate();
    if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1);
    cstr_ = str.cstr_;
    len_ = str.len_;
    return *this;
}

inline
String& String::operator=(const char* s)
{
    deallocate();
    if (!s) return *this;
    size_t len = strlen(s);
    memcpy(allocate(len), s, len);
    return *this;
}

inline
String& String::operator=(char c)
{
    deallocate();
    allocate(1)[0] = c;
    return *this;
}

inline
String& String::operator+=(const String& str)
{
    *this = *this + str;
    return *this;
}

inline
String& String::operator+=(const char* s)
{
    *this = *this + s;
    return *this;
}

inline
String& String::operator+=(char c)
{
    *this = *this + c;
    return *this;
}

inline
size_t String::size() const
{
    return len_;
}

inline
size_t String::length() const
{
    return len_;
}

inline
char String::operator[](size_t idx) const
{
    return cstr_[idx];
}

inline
char String::operator[](int idx) const
{
    return cstr_[idx];
}

inline
const char* String::begin() const
{
    return cstr_;
}

inline
const char* String::end() const
{
    return len_ ? cstr_ + 1 : 0;
}

inline
bool String::empty() const
{
    return len_ == 0;
}

inline
const char* String::c_str() const
{
    return cstr_ ? cstr_ : "";
}

inline
void String::swap(String& str)
{
    cv::swap(cstr_, str.cstr_);
    cv::swap(len_, str.len_);
}

inline
void String::clear()
{
    deallocate();
}

inline
int String::compare(const char* s) const
{
    if (cstr_ == s) return 0;
    return strcmp(c_str(), s);
}

inline
int String::compare(const String& str) const
{
    if (cstr_ == str.cstr_) return 0;
    return strcmp(c_str(), str.c_str());
}

inline
String String::substr(size_t pos, size_t len) const
{
    return String(*this, pos, len);
}

inline
size_t String::find(const char* s, size_t pos, size_t n) const
{
    if (n == 0 || pos + n > len_) return npos;
    const char* lmax = cstr_ + len_ - n;
    for (const char* i = cstr_ + pos; i <= lmax; ++i)
    {
        size_t j = 0;
        while (j < n && s[j] == i[j]) ++j;
        if (j == n) return (size_t)(i - cstr_);
    }
    return npos;
}

inline
size_t String::find(char c, size_t pos) const
{
    return find(&c, pos, 1);
}

inline
size_t String::find(const String& str, size_t pos) const
{
    return find(str.c_str(), pos, str.len_);
}

inline
size_t String::find(const char* s, size_t pos) const
{
    if (pos >= len_ || !s[0]) return npos;
    const char* lmax = cstr_ + len_;
    for (const char* i = cstr_ + pos; i < lmax; ++i)
    {
        size_t j = 0;
        while (s[j] && s[j] == i[j])
        {   if(i + j >= lmax) return npos;
            ++j;
        }
        if (!s[j]) return (size_t)(i - cstr_);
    }
    return npos;
}

inline
size_t String::rfind(const char* s, size_t pos, size_t n) const
{
    if (n > len_) return npos;
    if (pos > len_ - n) pos = len_ - n;
    for (const char* i = cstr_ + pos; i >= cstr_; --i)
    {
        size_t j = 0;
        while (j < n && s[j] == i[j]) ++j;
        if (j == n) return (size_t)(i - cstr_);
    }
    return npos;
}

inline
size_t String::rfind(char c, size_t pos) const
{
    return rfind(&c, pos, 1);
}

inline
size_t String::rfind(const String& str, size_t pos) const
{
    return rfind(str.c_str(), pos, str.len_);
}

inline
size_t String::rfind(const char* s, size_t pos) const
{
    return rfind(s, pos, strlen(s));
}

inline
size_t String::find_first_of(const char* s, size_t pos, size_t n) const
{
    if (n == 0 || pos + n > len_) return npos;
    const char* lmax = cstr_ + len_;
    for (const char* i = cstr_ + pos; i < lmax; ++i)
    {
        for (size_t j = 0; j < n; ++j)
            if (s[j] == *i)
                return (size_t)(i - cstr_);
    }
    return npos;
}

inline
size_t String::find_first_of(char c, size_t pos) const
{
    return find_first_of(&c, pos, 1);
}

inline
size_t String::find_first_of(const String& str, size_t pos) const
{
    return find_first_of(str.c_str(), pos, str.len_);
}

inline
size_t String::find_first_of(const char* s, size_t pos) const
{
    if (pos >= len_ || !s[0]) return npos;
    const char* lmax = cstr_ + len_;
    for (const char* i = cstr_ + pos; i < lmax; ++i)
    {
        for (size_t j = 0; s[j]; ++j)
            if (s[j] == *i)
                return (size_t)(i - cstr_);
    }
    return npos;
}

inline
size_t String::find_last_of(const char* s, size_t pos, size_t n) const
{
    if (pos >= len_) pos = len_ - 1;
    for (const char* i = cstr_ + pos; i >= cstr_; --i)
    {
        for (size_t j = 0; j < n; ++j)
            if (s[j] == *i)
                return (size_t)(i - cstr_);
    }
    return npos;
}

inline
size_t String::find_last_of(char c, size_t pos) const
{
    return find_last_of(&c, pos, 1);
}

inline
size_t String::find_last_of(const String& str, size_t pos) const
{
    return find_last_of(str.c_str(), pos, str.len_);
}

inline
size_t String::find_last_of(const char* s, size_t pos) const
{
    if (pos >= len_) pos = len_ - 1;
    for (const char* i = cstr_ + pos; i >= cstr_; --i)
    {
        for (size_t j = 0; s[j]; ++j)
            if (s[j] == *i)
                return (size_t)(i - cstr_);
    }
    return npos;
}

inline
String String::toLowerCase() const
{
    String res(cstr_, len_);

    for (size_t i = 0; i < len_; ++i)
        res.cstr_[i] = (char) ::tolower(cstr_[i]);

    return res;
}

//! @endcond

// ************************* cv::String non-member functions *************************

//! @relates cv::String
//! @{

inline
String operator + (const String& lhs, const String& rhs)
{
    String s;
    s.allocate(lhs.len_ + rhs.len_);
    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
    memcpy(s.cstr_ + lhs.len_, rhs.cstr_, rhs.len_);
    return s;
}

inline
String operator + (const String& lhs, const char* rhs)
{
    String s;
    size_t rhslen = strlen(rhs);
    s.allocate(lhs.len_ + rhslen);
    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
    memcpy(s.cstr_ + lhs.len_, rhs, rhslen);
    return s;
}

inline
String operator + (const char* lhs, const String& rhs)
{
    String s;
    size_t lhslen = strlen(lhs);
    s.allocate(lhslen + rhs.len_);
    memcpy(s.cstr_, lhs, lhslen);
    memcpy(s.cstr_ + lhslen, rhs.cstr_, rhs.len_);
    return s;
}

inline
String operator + (const String& lhs, char rhs)
{
    String s;
    s.allocate(lhs.len_ + 1);
    memcpy(s.cstr_, lhs.cstr_, lhs.len_);
    s.cstr_[lhs.len_] = rhs;
    return s;
}

inline
String operator + (char lhs, const String& rhs)
{
    String s;
    s.allocate(rhs.len_ + 1);
    s.cstr_[0] = lhs;
    memcpy(s.cstr_ + 1, rhs.cstr_, rhs.len_);
    return s;
}

static inline bool operator== (const String& lhs, const String& rhs) { return 0 == lhs.compare(rhs); }
static inline bool operator== (const char*   lhs, const String& rhs) { return 0 == rhs.compare(lhs); }
static inline bool operator== (const String& lhs, const char*   rhs) { return 0 == lhs.compare(rhs); }
static inline bool operator!= (const String& lhs, const String& rhs) { return 0 != lhs.compare(rhs); }
static inline bool operator!= (const char*   lhs, const String& rhs) { return 0 != rhs.compare(lhs); }
static inline bool operator!= (const String& lhs, const char*   rhs) { return 0 != lhs.compare(rhs); }
static inline bool operator<  (const String& lhs, const String& rhs) { return lhs.compare(rhs) <  0; }
static inline bool operator<  (const char*   lhs, const String& rhs) { return rhs.compare(lhs) >  0; }
static inline bool operator<  (const String& lhs, const char*   rhs) { return lhs.compare(rhs) <  0; }
static inline bool operator<= (const String& lhs, const String& rhs) { return lhs.compare(rhs) <= 0; }
static inline bool operator<= (const char*   lhs, const String& rhs) { return rhs.compare(lhs) >= 0; }
static inline bool operator<= (const String& lhs, const char*   rhs) { return lhs.compare(rhs) <= 0; }
static inline bool operator>  (const String& lhs, const String& rhs) { return lhs.compare(rhs) >  0; }
static inline bool operator>  (const char*   lhs, const String& rhs) { return rhs.compare(lhs) <  0; }
static inline bool operator>  (const String& lhs, const char*   rhs) { return lhs.compare(rhs) >  0; }
static inline bool operator>= (const String& lhs, const String& rhs) { return lhs.compare(rhs) >= 0; }
static inline bool operator>= (const char*   lhs, const String& rhs) { return rhs.compare(lhs) <= 0; }
static inline bool operator>= (const String& lhs, const char*   rhs) { return lhs.compare(rhs) >= 0; }

//! @} relates cv::String

} // cv

#ifndef OPENCV_NOSTL_TRANSITIONAL
namespace std
#else
namespace cv
#endif
{
    template<> inline
    void swap<cv::String>(cv::String& a, cv::String& b)
    {
        a.swap(b);
    }
}

#include "opencv2/core/ptr.inl.hpp"

#endif //__OPENCV_CORE_CVSTD_HPP__


text: I am the Etoy of a push-button.


text:
using Assets.Scripts.Constants;
using UnityEngine;
using GameScriptEvent = Assets.Scripts.Constants.GameScriptEvent;

namespace Assets.Scripts.GameScripts.GameLogic.Animator
{
    [AddComponentMenu("ObjectAnimator/PropAnimator")]
    [RequireComponent(typeof(UnityEngine.Animator))]
    public class PropAnimator : ObjectAnimator
    {
        protected override void Deinitialize()
        {
        }

        [Attributes.GameScriptEvent(GameScriptEvent.OnObjectHasNoHitPoint)]
        public void PlayDeathAnimation()
        {
            SetAnimatorBoolState(AnimatorControllerConstants.AnimatorParameterName.Death);
        }

        [Attributes.GameScriptEvent(GameScriptEvent.GateDeactivated)]
        public void PlayDeactivateAnimation()
        {
            SetAnimatorBoolState(AnimatorControllerConstants.AnimatorParameterName.Death);
        }

        [Attributes.GameScriptEvent(GameScriptEvent.GateActivated)]
        public void PlayActivateAnimation()
        {
            SetAnimatorBoolState(AnimatorControllerConstants.AnimatorParameterName.Idle);
        }
    }
}


text:
{-|
Module: Flaw.UI.Menu
Description: Menu.
License: MIT
-}

module Flaw.UI.Menu
  ( Menu(..)
  , MenuItem(..)
  , newPopupMenu
  ) where

import Control.Concurrent.STM
import Control.Monad
import qualified Data.Text as T

import Flaw.Math
import Flaw.UI
import Flaw.UI.Button
import Flaw.UI.Metrics
import Flaw.UI.Popup

newtype Menu = Menu [MenuItem]

data MenuItem
  = MenuItemCommand !T.Text !(STM ())
  -- MenuItemSubMenu !T.Text !Menu

newPopupMenu :: PopupService -> Position -> Menu -> STM ()
newPopupMenu popupService@PopupService
  { popupServiceMetrics = Metrics
    { metricsButtonSize = buttonSize@(Vec2 buttonWidth buttonHeight)
    }
  } (Vec2 px py) (Menu items) = do
  Popup
    { popupPanel = panel
    , popupClose = close
    } <- newPopup popupService (Vec4 px py (px + buttonWidth) (py + buttonHeight * length items))
  forM_ (zip [0..] items) $ \(i, MenuItemCommand text handler) -> do
    button <- newLabeledButton text
    buttonChild <- addFreeChild panel button
    layoutElement button buttonSize
    placeFreeChild panel buttonChild $ Vec2 0 (i * buttonHeight)
    setActionHandler button $ do
      close
      handler


text:
/**
* Package for calculate task.
*
* @author Ruslan Halmatov (mailto:HalmatovJava@yandex.ru)
* @version $Id$
* @since 05.09.2017
*/
package ru.job4j.loop;


text:
package com.originate.play.websocket.socketio

import com.originate.play.websocket.ComponentRegistry

object SocketIoSender extends SocketIoPacketSender {

  def send(connectionId: String, packet: SocketIoPacket) {
    ComponentRegistry.main.socketIoPacketSender.send(connectionId, packet)
  }
}


text:
package org.apache.hyracks.control.cc;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.hyracks.api.client.HyracksClientInterfaceFunctions;
import org.apache.hyracks.api.comm.NetworkAddress;
import org.apache.hyracks.api.dataset.DatasetJobRecord.Status;
import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.api.job.JobIdFactory;
import org.apache.hyracks.api.job.JobInfo;
import org.apache.hyracks.control.cc.work.CancelJobWork;
import org.apache.hyracks.control.cc.work.CliDeployBinaryWork;
import org.apache.hyracks.control.cc.work.CliUnDeployBinaryWork;
import org.apache.hyracks.control.cc.work.ClusterShutdownWork;
import org.apache.hyracks.control.cc.work.DestroyJobWork;
import org.apache.hyracks.control.cc.work.DistributeJobWork;
import org.apache.hyracks.control.cc.work.GetDatasetDirectoryServiceInfoWork;
import org.apache.hyracks.control.cc.work.GetJobInfoWork;
import org.apache.hyracks.control.cc.work.GetJobStatusWork;
import org.apache.hyracks.control.cc.work.GetNodeControllersInfoWork;
import org.apache.hyracks.control.cc.work.GetNodeDetailsJSONWork;
import org.apache.hyracks.control.cc.work.GetResultPartitionLocationsWork;
import org.apache.hyracks.control.cc.work.GetResultStatusWork;
import org.apache.hyracks.control.cc.work.GetThreadDumpWork;
import org.apache.hyracks.control.cc.work.JobStartWork;
import org.apache.hyracks.control.cc.work.WaitForJobCompletionWork;
import org.apache.hyracks.control.common.work.IPCResponder;
import org.apache.hyracks.ipc.api.IIPCHandle;
import org.apache.hyracks.ipc.api.IIPCI;
import org.apache.hyracks.ipc.exceptions.IPCException;

class ClientInterfaceIPCI implements IIPCI {

    private static final Logger LOGGER = Logger.getLogger(ClientInterfaceIPCI.class.getName());
    private final ClusterControllerService ccs;
    private final JobIdFactory jobIdFactory;

    ClientInterfaceIPCI(ClusterControllerService ccs, JobIdFactory jobIdFactory) {
        this.ccs = ccs;
        this.jobIdFactory = jobIdFactory;
    }

    @Override
    public void deliverIncomingMessage(IIPCHandle handle, long mid, long rmid, Object payload,
            Exception exception) {
        HyracksClientInterfaceFunctions.Function fn = (HyracksClientInterfaceFunctions.Function) payload;
        switch (fn.getFunctionId()) {
            case GET_CLUSTER_CONTROLLER_INFO:
                try {
                    handle.send(mid, ccs.getClusterControllerInfo(), null);
                } catch (IPCException e) {
                    LOGGER.log(Level.WARNING, "Error sending response to GET_CLUSTER_CONTROLLER_INFO request", e);
                }
                break;
            case GET_JOB_STATUS:
                HyracksClientInterfaceFunctions.GetJobStatusFunction gjsf =
                        (HyracksClientInterfaceFunctions.GetJobStatusFunction) fn;
                ccs.getWorkQueue().schedule(
                        new GetJobStatusWork(ccs.getJobManager(), gjsf.getJobId(), new IPCResponder<>(handle, mid)));
                break;
            case GET_JOB_INFO:
                HyracksClientInterfaceFunctions.GetJobInfoFunction gjif =
                        (HyracksClientInterfaceFunctions.GetJobInfoFunction) fn;
                ccs.getWorkQueue().schedule(new GetJobInfoWork(ccs.getJobManager(), gjif.getJobId(),
                        new IPCResponder<JobInfo>(handle, mid)));
                break;
            case DISTRIBUTE_JOB:
                HyracksClientInterfaceFunctions.DistributeJobFunction djf =
                        (HyracksClientInterfaceFunctions.DistributeJobFunction) fn;
                ccs.getWorkQueue().schedule(new DistributeJobWork(ccs, djf.getACGGFBytes(), jobIdFactory.create(),
                        new IPCResponder<JobId>(handle, mid)));
                break;
            case DESTROY_JOB:
                HyracksClientInterfaceFunctions.DestroyJobFunction dsjf =
                        (HyracksClientInterfaceFunctions.DestroyJobFunction) fn;
                ccs.getWorkQueue()
                        .schedule(new DestroyJobWork(ccs, dsjf.getJobId(), new IPCResponder<JobId>(handle, mid)));
                break;
            case CANCEL_JOB:
                HyracksClientInterfaceFunctions.CancelJobFunction cjf =
                        (HyracksClientInterfaceFunctions.CancelJobFunction) fn;
                ccs.getWorkQueue().schedule(
                        new CancelJobWork(ccs.getJobManager(), cjf.getJobId(), new IPCResponder<Void>(handle, mid)));
                break;
            case START_JOB:
                HyracksClientInterfaceFunctions.StartJobFunction sjf =
                        (HyracksClientInterfaceFunctions.StartJobFunction) fn;
                JobId jobId = sjf.getJobId();
                byte[] acggfBytes = null;
                boolean predistributed = false;
                if (jobId == null) {
                    //The job is new
                    jobId = jobIdFactory.create();
                    acggfBytes = sjf.getACGGFBytes();
                } else {
                    //The job has been predistributed. We don't need to send an ActivityClusterGraph
                    predistributed = true;
                }
                ccs.getWorkQueue().schedule(new JobStartWork(ccs, sjf.getDeploymentId(), acggfBytes, sjf.getJobFlags(),
                        jobId, new IPCResponder<JobId>(handle, mid), predistributed));
                break;
            case GET_DATASET_DIRECTORY_SERIVICE_INFO:
                ccs.getWorkQueue().schedule(new GetDatasetDirectoryServiceInfoWork(ccs,
                        new IPCResponder<NetworkAddress>(handle, mid)));
                break;
            case GET_DATASET_RESULT_STATUS:
                HyracksClientInterfaceFunctions.GetDatasetResultStatusFunction gdrsf =
                        (HyracksClientInterfaceFunctions.GetDatasetResultStatusFunction) fn;
                ccs.getWorkQueue().schedule(new GetResultStatusWork(ccs, gdrsf.getJobId(),
                        gdrsf.getResultSetId(), new IPCResponder<Status>(handle, mid)));
                break;
            case GET_DATASET_RESULT_LOCATIONS:
                HyracksClientInterfaceFunctions.GetDatasetResultLocationsFunction gdrlf =
                        (HyracksClientInterfaceFunctions.GetDatasetResultLocationsFunction) fn;
                ccs.getWorkQueue().schedule(new GetResultPartitionLocationsWork(ccs,
                        gdrlf.getJobId(), gdrlf.getResultSetId(), gdrlf.getKnownRecords(),
                        new IPCResponder<>(handle, mid)));
                break;
            case WAIT_FOR_COMPLETION:
                HyracksClientInterfaceFunctions.WaitForCompletionFunction wfcf =
                        (HyracksClientInterfaceFunctions.WaitForCompletionFunction) fn;
                ccs.getWorkQueue().schedule(new WaitForJobCompletionWork(ccs, wfcf.getJobId(),
                        new IPCResponder<>(handle, mid)));
                break;
            case GET_NODE_CONTROLLERS_INFO:
                ccs.getWorkQueue().schedule(
                        new GetNodeControllersInfoWork(ccs.getNodeManager(), new IPCResponder<>(handle, mid)));
                break;
            case GET_CLUSTER_TOPOLOGY:
                try {
                    handle.send(mid, ccs.getCCContext().getClusterTopology(), null);
                } catch (IPCException e) {
                    LOGGER.log(Level.WARNING, "Error sending response to GET_CLUSTER_TOPOLOGY request", e);
                }
                break;
            case CLI_DEPLOY_BINARY:
                HyracksClientInterfaceFunctions.CliDeployBinaryFunction dbf =
                        (HyracksClientInterfaceFunctions.CliDeployBinaryFunction) fn;
                ccs.getWorkQueue().schedule(new CliDeployBinaryWork(ccs, dbf.getBinaryURLs(),
                        dbf.getDeploymentId(), new IPCResponder<>(handle, mid)));
                break;
            case CLI_UNDEPLOY_BINARY:
                HyracksClientInterfaceFunctions.CliUnDeployBinaryFunction udbf =
                        (HyracksClientInterfaceFunctions.CliUnDeployBinaryFunction) fn;
                ccs.getWorkQueue().schedule(new CliUnDeployBinaryWork(ccs, udbf.getDeploymentId(),
                        new IPCResponder<>(handle, mid)));
                break;
            case CLUSTER_SHUTDOWN:
                HyracksClientInterfaceFunctions.ClusterShutdownFunction csf =
                        (HyracksClientInterfaceFunctions.ClusterShutdownFunction) fn;
                ccs.getWorkQueue().schedule(new ClusterShutdownWork(ccs,
                        csf.isTerminateNCService(), new IPCResponder<>(handle, mid)));
                break;
            case GET_NODE_DETAILS_JSON:
                HyracksClientInterfaceFunctions.GetNodeDetailsJSONFunction gndjf =
                        (HyracksClientInterfaceFunctions.GetNodeDetailsJSONFunction) fn;
                ccs.getWorkQueue()
                        .schedule(new GetNodeDetailsJSONWork(ccs.getNodeManager(), ccs.getCCConfig(), gndjf.getNodeId(),
                        gndjf.isIncludeStats(), gndjf.isIncludeConfig(), new IPCResponder<>(handle, mid)));
                break;
            case THREAD_DUMP:
                HyracksClientInterfaceFunctions.ThreadDumpFunction tdf =
                        (HyracksClientInterfaceFunctions.ThreadDumpFunction) fn;
                ccs.getWorkQueue().schedule(new GetThreadDumpWork(ccs, tdf.getNode(),
                        new IPCResponder<String>(handle, mid)));
                break;
            default:
                try {
                    handle.send(mid, null, new IllegalArgumentException("Unknown function " + fn.getFunctionId()));
                } catch (IPCException e) {
                    LOGGER.log(Level.WARNING, "Error sending Unknown function response", e);
                }
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using SharpMarkdown.Line;
using SharpMarkdown.Attributes;

namespace SharpMarkdown.Inline {
    /// <summary>
    /// 連結
    /// </summary>
    [Match(Regex = @"^\[.+\]\s*\[.+\]")]
    [Match(Regex = @"^\[.+\]\s*\(.+\)")]
    public class Link : MarkdownRaw {
        /// <summary>
        /// 文字
        /// </summary>
        public string Text { get; set; }

        /// <summary>
        /// 連結
        /// </summary>
        public string URL { get; set; }

        /// <summary>
        /// 參考標籤
        /// </summary>
        public Tag ReferenceTag { get; set; }

        public override string OuterMarkdown {
            get {
                string result = $"[{Text}]";
                if (string.IsNullOrWhiteSpace(URL)) {
                    result += $"[{ReferenceTag?.Id}]";
                } else {
                    result += $"({URL})";
                }
                return result;
            }
            set {
                int temp = 0;
                Link autoLink = Parse(value, out temp);
                this.Text = autoLink.Text;
                this.URL = autoLink.URL;
                this.ReferenceTag = autoLink.ReferenceTag;
            }
        }

        public override string OuterText {
            get {
                return Text;
            }
        }

        public static Link Parse(string text,out int length ) {
            var attrs = MatchAttribute.GetMatchAttributes<Link>()
                .Select(x => new {
                    match = x.GetRegex().IsMatch(text),
                    attr = x
                });

            if (!attrs.Any(x => x.match)) throw new FormatException();

            try {
                Regex tagLink = new Regex(@"\[[^\]]+\]\s*\[[^\]]+\]");
                Regex urlLink = new Regex(@"\[[^\]]+\]\s*\([^\)]+\)");

                string linkText = tagLink.IsMatch(text) ?
                    tagLink.Match(text)?.Value :
                    urlLink.Match(text)?.Value;

                Regex t1Regex = new Regex(@"\[[^\]]+\]");
                Regex t2Regex = new Regex(@"\(.+\)");
                Link result = new Link();
                result.Text = t1Regex.Match(linkText).Value;
                result.Text = result.Text.Substring(1, result.Text.Length - 2);
                length = 0;
                if (tagLink.IsMatch(text)) {
                    var match = t1Regex.Match(linkText).NextMatch();
                    string tagId = match.Value;
                    tagId = tagId.Substring(1, tagId.Length - 2);

                    result.ReferenceTag = new Tag() { Id = tagId.Trim(), IsRef = true };
                    length = match.Index + match.Length;
                } else if (urlLink.IsMatch(text)) {
                    var match = t2Regex.Match(linkText);
                    string url = t2Regex.Match(linkText).Value;
                    url = url.Substring(1, url.Length - 2);

                    result.URL = url.Trim();
                    length = match.Index + match.Length;
                }
                return result;
            }catch(Exception e) {
                throw new FormatException();
            }
        }
    }
}


text:
<!doctype html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Juniper</title>
  <meta name="description" content="">

  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link href="https://fonts.googleapis.com/css?family=Abel|Oswald|Raleway" rel="stylesheet">

<link href="./style.css" rel="stylesheet" type="text/css">

  <link href="//fonts.googleapis.com/css?family=Yantramanav:500,400,300" rel="stylesheet" type="text/css">


text:
Backbone.TableSorter
====================

A Backbone View that allows easy sorting of existing HTML elements.