text:
#ifndef ABED_BAGGING_HPP
#define ABED_BAGGING_HPP

#include <cassert>
#include "ensemble.hpp"

namespace abed {

    //! Implementation of the Bootstrap Aggregating algorithm

    class Bagging : public EnsembleClassifier {
    public:
        Bagging (int d, int c) : dimension(d), no_classes(c) {}
        virtual void initialize (unsigned int seed = UINT_MAX);
        virtual Classifier* clone () const {
            return new Bagging(*this);
        }

        virtual double train (const StaticDataSet&,
                              double MAX_ERROR = DEFAULT_MAX_ERROR,
                              unsigned int MAX_IT = DEFAULT_MAX_IT);
        virtual double train (const DynamicDataSet&,
                              double MAX_ERROR = DEFAULT_MAX_ERROR,
                              unsigned int MAX_IT = DEFAULT_MAX_IT);

        virtual unsigned int predict_label (const StaticDataPoint&) const;
        virtual unsigned int predict_label (const DynamicDataPoint&) const;

    private:
        unsigned int dimension;
        unsigned int no_classes;
    };

} // namespace abed

#endif /* ABED_BAGGING_HPP */

redpajama_set_name: RedPajamaGithub


text:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com)         */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }

switch($op) {

    case "mod_authors":
    include("admin/modules/authors.php");
    break;

    case "modifyadmin":
    include("admin/modules/authors.php");
    break;

    case "UpdateAuthor":
    include("admin/modules/authors.php");
    break;

    case "AddAuthor":
    include("admin/modules/authors.php");
    break;

    case "deladmin2":
    include("admin/modules/authors.php");
    break;

    case "deladmin":
    include("admin/modules/authors.php");
    break;

    case "assignstories":
    include("admin/modules/authors.php");
    break;

    case "deladminconf":
    include("admin/modules/authors.php");
    break;

}

?>


text:
import os
import pygame
import game

button_back_color = [255, 128, 255]
button_width = 50
timer_to_next_question = 1000

class View:
    def __init__(self):
        self.engine = None
        self.screen = None

    def attach_engine(self, engine):
        self.engine = engine

    def send_action(self, action, data):
        self.engine.apply(action)

    def draw(self):
        if self.screen is None:
            return

        self.engine.gamestate.draw(self.screen)

    def update(self):
        pass

class BaseView(View):
    pass

class ClientView(View):
    """
    This is handles the input and output from the client
    """

    def __init__(self):
        super(ClientView, self).__init__()
        os.environ["SDL_VIDEO_CENTERED"] = "1"
        pygame.init()
        pygame.font.init()

        self.resolution = [1024, 768]
        self.screen = pygame.display.set_mode(self.resolution)
        pygame.display.set_caption("Pictionary clone")

        self.NormalText = pygame.font.Font(None, 25)
        self.ui_points_pos = [970, 700]

        self.prev_mouse_down = pygame.mouse.get_pressed()

        self.buttons = []

    def draw(self):
        super(ClientView, self).draw()

        screen = self.screen
        screen.fill([255, 255, 255])

        self.engine.gamestate.main_pad.draw(screen)

        if not self.engine.gamestate.is_current_active_player():
            self.generate_buttons(start_pos=[600, 30],
                                  max_width=self.resolution[0])
            self.draw_answers(screen)

        self.draw_messages(screen, pos_y=600)
        self.draw_points(screen)

        pygame.display.update()

    def update(self):
        self.update_mouseclicks()
        self.update_messages()

    def update_messages(self):
        if self.engine.gamestate.is_current_active_player():
            return

        # messages for inactive players
        message = ""
        timer = self.engine.gamestate.lockdown_timer

        if timer > 0:
            total_seconds = timer / 1000
            minutes = int(total_seconds / 60)
            seconds = int(total_seconds % 60)
            message = "Lockdown for : "
            if minutes:
                message += "{}:{} minutes".format(minutes, seconds)
            else:
                message += "{} seconds".format(seconds)

            self.engine.gamestate.messages.append(message)

    def update_mouseclicks(self):
        mouse_down = pygame.mouse.get_pressed()
        mouse_pos = pygame.mouse.get_pos()

        action, data = None, None

        if self.engine.gamestate.is_current_active_player():
            # drawing stage
            if any(mouse_down):
                data = {"mouse_down": mouse_down,
                        "pos": mouse_pos}
                action = game.Action_Draw(data)
        else:
            # answering stage
            answer_index = self.get_clicked_button(mouse_down,
                                                   self.prev_mouse_down,
                                                   mouse_pos)
            if answer_index is not None:
                data = {"answer": answer_index}
                action = game.Action_SendAnswer(data)

        if action and data:
            self.send_action(action, data)

        self.prev_mouse_down = mouse_down

    def draw_messages(self, screen, pos_y):
        for message in self.engine.gamestate.messages:
            output = self.NormalText.render(message, True, [0, 0, 0])
            screen.blit(output, [40, pos_y])
            pos_y += output.get_height() + 10

    def draw_points(self, screen):
        points = self.engine.gamestate.points
        points_text = self.NormalText.render(
            "{} pts".format(points), True, [0, 0, 0])
        pygame.draw.circle(screen,
                           [255, 128, 128],
                           self.ui_points_pos,
                           points_text.get_width() + 10)
        points_pos = points_text.get_rect()
        points_pos.center = self.ui_points_pos
        screen.blit(points_text,  points_pos)

    # Stage_select_word
    def generate_buttons(self, start_pos, max_width, padding=10):
        self.button_renders = []

        answers = self.engine.gamestate.choices
        current_x, current_y = start_pos
        max_height = 0
        for answer in answers:
            output = self.NormalText.render(answer, True, [0, 0, 0])
            pos = [current_x, current_y]
            rect = (output.get_rect()
                    .move(*pos)
                    .inflate(button_width, button_width / 2))
            max_height = max(max_height, rect.height + padding)

            if rect.right >= max_width:
                current_x = start_pos[0]
                current_y += max_height
                rect.move_ip(-pos[0], -pos[1])
                rect.move_ip(current_x, current_y)
                pos = [current_x, current_y]
                max_height = 0

            self.button_renders.append([output, rect, pos])
            current_x += rect.width + padding

    def draw_answers(self, screen):
        for output, rect, pos in self.button_renders:
            pygame.draw.rect(screen,
                             button_back_color,
                             rect)
            screen.blit(output, pos)

    def get_clicked_button(self, mouse_down, prev_mouse_down, mouse_pos):
        if (self.engine.gamestate.lockdown_timer <= 0 and
           (not mouse_down[0] and prev_mouse_down[0])):
            # player does left_click_up and is not in lockdown
            for answer_index, button in enumerate(self.button_renders):
                output, rect, pos = button
                if rect.collidepoint(mouse_pos):
                    return answer_index

        return None


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>statsmodels.tsa.vector_ar.irf.IRAnalysis.plot_cum_effects — statsmodels 0.8.0 documentation</title>

    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="statsmodels.tsa.vector_ar.irf.IRAnalysis.stderr" href="statsmodels.tsa.vector_ar.irf.IRAnalysis.stderr.html" />
    <link rel="prev" title="statsmodels.tsa.vector_ar.irf.IRAnalysis.plot" href="statsmodels.tsa.vector_ar.irf.IRAnalysis.plot.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />

Navigation

          index

          modules |

          next |

          previous |

Install
  |

Support
  |

Bugs
  |

Develop
  |

Examples
  |

FAQ
  |

Time Series analysis tsa |

statsmodels.tsa.vector_ar.irf.IRAnalysis |

statsmodels.tsa.vector_ar.irf.IRAnalysis.plot_cum_effects¶

IRAnalysis.plot_cum_effects(orth=False, impulse=None, response=None, signif=0.05, plot_params=None, subplot_params=None, plot_stderr=True, stderr_type='asym', repl=1000, seed=None)¶

Plot cumulative impulse response functions

<col class="field-name" />
<col class="field-body" />

Parameters:
orth : bool, default False

Compute orthogonalized impulse responses

impulse : string or int

variable providing the impulse

response : string or int

variable affected by the impulse

signif : float (0 < signif < 1)

Significance level for error bars, defaults to 95% CI

subplot_params : dict

To pass to subplot plotting funcions. Example: if fonts are too big,
pass {‘fontsize’ : 8} or some number to your taste.

plot_params : dict

plot_stderr: bool, default True

Plot standard impulse response error bands

stderr_type: string

‘asym’: default, computes asymptotic standard errors
‘mc’: monte carlo standard errors (use rpl)

repl: int, default 1000

Number of replications for monte carlo standard errors

seed: int

np.random.seed for Monte Carlo replications

Previous topic

statsmodels.tsa.vector_ar.irf.IRAnalysis.plot

Next topic

statsmodels.tsa.vector_ar.irf.IRAnalysis.stderr

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

        © Copyright 2009-2017, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
      Created using Sphinx 1.5.3.


text:
<!DOCTYPE HTML>

    <title>483</title>

483

You take out the sparkling jewel and place it on the regenerating corpse. There is a rush of icy wind, and crackling
    blue sparks surround the body. Within moments it begins to pulse with life. The pink bloom of fresh blood suffuses
    the re-formed flesh as the stone heart within its chest reverts to life. Slabs of muscle swell across the bones,
    sewn with gristle and skin. Skrymir rises from the dead.

He stands before you, towering towards the cave roof like the shadow of a great glacier. His beard sparkles with
    icicles; his eyes blaze with cold fury.

'Skrymir stands upon Middle-Earth once more!' he cries, shaking the rock walls with his voice of thunder. 'Legend
    reverberates to his battle-roar. The strength of the cracking rime of the Northland fills his thews. Let the magi
    who crouch upon the old thrones of Krarth beware - they shall not see another dawn, for the sky then shall be washed
    with their blood!'

He begins to turn towards the glowing beam above the atoll. He intends to use the Teleportation spell to return to
    the surface. He seems not to have noticed you at all.

If you wish to call out that you have restored him in Zyn's name and are ready to
    collect your reward, turn to 133.

If you think it's better just to let him go, turn to 257.


text:
package com.sadc.effjava.item._53;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.NoSuchElementException;

public class item_53_prefer_interfaces_to_reflection {
    public static void main(String[] args) {
        System.out.println("I have no idea why anyone would need to use Reflection " +
                           "unless it's to utilize legacy code, or to implement the weird stuff Spring does for IOC");
        System.out.println("Reflection lets you access constructors, methods and fields of a loaded class.\n" +
                           "You can write a class that reflectively uses another class,\n" +
                           "even if the class being used did not exist when the first class was compiled.");
        System.out.println("You can mitigate the disadvantages of reflection by accessing a reflective instance\n" +
                           "using an interface implemented by the reflected instance.");
    }
}


text:
#include "external/external_api.h"

CExternalContextPtr CExternalContext_newContext(
	const CExternalContextCallbacks& contextCallbacks
) {
	MR4C::ExternalContext* context = new MR4C::ExternalContext(contextCallbacks);
	return wrapExternalContext(context);
}

CExternalContextPtr wrapExternalContext(MR4C::ExternalContext* context) {
	if ( context==NULL ) {
		return NULL;
	}
	CExternalContextPtr handle = new CExternalContext();
	handle->context = context;
	return handle;
}


text:
package org.apache.drill.exec.planner;

import java.io.IOException;
import java.util.Set;

import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.common.config.LogicalPlanPersistence;
import org.apache.drill.common.logical.LogicalPlan;
import org.apache.drill.common.scanner.persistence.ScanResult;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.exec.coord.DrillbitEndpointSerDe;
import org.apache.drill.exec.physical.PhysicalPlan;
import org.apache.drill.exec.physical.base.FragmentLeaf;
import org.apache.drill.exec.physical.base.FragmentRoot;
import org.apache.drill.exec.physical.base.PhysicalOperator;
import org.apache.drill.exec.physical.base.PhysicalOperatorUtil;
import org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint;
import org.apache.drill.exec.record.MajorTypeSerDe;
import org.apache.drill.exec.server.options.OptionList;
import org.apache.drill.exec.store.StoragePluginRegistry;
import org.apache.drill.exec.store.pojo.DynamicPojoRecordReader;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.InjectableValues;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.deser.std.StdDelegatingDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.annotations.VisibleForTesting;

public class PhysicalPlanReader {
  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PhysicalPlanReader.class);

  private final ObjectReader physicalPlanReader;
  private final ObjectMapper mapper;
  private final ObjectReader operatorReader;
  private final ObjectReader logicalPlanReader;

  public PhysicalPlanReader(DrillConfig config, ScanResult scanResult, LogicalPlanPersistence lpPersistance, final DrillbitEndpoint endpoint,
                            final StoragePluginRegistry pluginRegistry) {

    ObjectMapper lpMapper = lpPersistance.getMapper();

    // Endpoint serializer/deserializer.
    SimpleModule deserModule = new SimpleModule("PhysicalOperatorModule") //
        .addSerializer(DrillbitEndpoint.class, new DrillbitEndpointSerDe.Se()) //
        .addDeserializer(DrillbitEndpoint.class, new DrillbitEndpointSerDe.De()) //
        .addSerializer(MajorType.class, new MajorTypeSerDe.Se())
        .addDeserializer(MajorType.class, new MajorTypeSerDe.De())
        .addDeserializer(DynamicPojoRecordReader.class,
            new StdDelegatingDeserializer<>(new DynamicPojoRecordReader.Converter(lpMapper)));

    lpMapper.registerModule(deserModule);
    Set<Class<? extends PhysicalOperator>> subTypes = PhysicalOperatorUtil.getSubTypes(scanResult);
    for (Class<? extends PhysicalOperator> subType : subTypes) {
      lpMapper.registerSubtypes(subType);
    }
    lpMapper.registerSubtypes(DynamicPojoRecordReader.class);
    InjectableValues injectables = new InjectableValues.Std() //
            .addValue(StoragePluginRegistry.class, pluginRegistry) //
        .addValue(DrillbitEndpoint.class, endpoint); //

    this.mapper = lpMapper;
    this.physicalPlanReader = mapper.reader(PhysicalPlan.class).with(injectables);
    this.operatorReader = mapper.reader(PhysicalOperator.class).with(injectables);
    this.logicalPlanReader = mapper.reader(LogicalPlan.class).with(injectables);
  }

  public String writeJson(OptionList list) throws JsonProcessingException{
    return mapper.writeValueAsString(list);
  }

  public String writeJson(PhysicalOperator op) throws JsonProcessingException{
    return mapper.writeValueAsString(op);
  }

  public PhysicalPlan readPhysicalPlan(String json) throws JsonProcessingException, IOException {
    logger.debug("Reading physical plan {}", json);
    return physicalPlanReader.readValue(json);
  }

  public FragmentRoot readFragmentRoot(String json) throws JsonProcessingException, IOException {
    logger.debug("Attempting to read {}", json);
    PhysicalOperator op = operatorReader.readValue(json);
    if(op instanceof FragmentRoot){
      return (FragmentRoot) op;
    }else{
      throw new UnsupportedOperationException(String.format("The provided json fragment doesn't have a FragmentRoot as its root operator.  The operator was %s.", op.getClass().getCanonicalName()));
    }
  }

  @VisibleForTesting
  public FragmentLeaf readFragmentLeaf(String json) throws JsonProcessingException, IOException {
    logger.debug("Attempting to read {}", json);
    PhysicalOperator op = operatorReader.readValue(json);
    if (op instanceof FragmentLeaf){
      return (FragmentLeaf) op;
    } else {
      throw new UnsupportedOperationException(String.format("The provided json fragment is not a FragmentLeaf. The operator was %s.", op.getClass().getCanonicalName()));
    }
  }

  public LogicalPlan readLogicalPlan(String json) throws JsonProcessingException, IOException{
    logger.debug("Reading logical plan {}", json);
    return logicalPlanReader.readValue(json);
  }
}


text:
<!DOCTYPE html>

<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<title>LICENSE - RDoc Documentation</title>

<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">

    Home
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Pages

ETSII_GEM.gemspec

Gemfile

Gemfile.lock

Guardfile

LICENSE

README

Rakefile

Rakefile~

created.rid

ETSII_GEM_spec.rb~

Class and Module Index

ETSIIGEM

EtsiiGem

EtsiiGem::Densa

EtsiiGem::Dispersa

EtsiiGem::Fraccion

EtsiiGem::Matriz

EtsiiGem::VectorDisperso

Test_ETSII_GEM

Copyright © 2013 Héctor J.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

[Validate]

Generated by RDoc 4.0.0.

Generated with the Darkfish Rdoc Generator 3.


text:
package com.projectlounge.bean;

import com.projectlounge.utils.Hashes;
import com.projectlounge.utils.Hashes4;
import com.projectlounge.utils.HashesAny;
import org.springframework.stereotype.Component;

/**
 * Created by main on 08.08.17.
 */
@Component
public class Create {

    public Hashes hashes(final byte[] hashes, final int prefixSize) {
        if (prefixSize==4) return new Hashes4(hashes);
        return new HashesAny(hashes, prefixSize);
    }

}


text:
<%= header %>
<%= boomerangSnippet %>

<%= footer %>


text:
'use strict';

const File = require('phylo');

const Base = require('../Base');

class Location extends Base {
    static from (src, resolver) {
        if (!src || src === '??') {
            return Location.NULL;
        }

        if (src.isLocation) {
            if (src.constructor === this) {
                return src;
            }

            return new this(src);
        }

        let parts = src.split(this.separator),
            i = parts.length;

        while (--i > 0) {
            parts[i] = +parts[i];
        }

        if (resolver) {
            parts[0] = resolver(parts[0]);
        }

        return new this(...parts);
    }

    static format (file, line, column) {
        if (file && file.isLocation) {
            return this.format(file.file, file.line, file.column);
        }

        let ret = File.path(file) || '?';

        if (line > 0) {
            ret += this.separator;
            ret += line;

            if (column > 0) {
                ret += this.separator;
                ret += column;
            }
        }

        return ret;
    }

    static join (...locations) {
        return this.joinAll(locations);
    }

    static joinAll (locations, resolver) {
        let ret = '';

        for (let loc of locations) {
            if (ret) {
                ret += this.delimiter;
            }

            if (loc && loc.file !== null) {
                let file = resolver ? String(resolver(loc.file)) : loc.file;

                ret += this.format(file, loc.line, loc.column);
            }
            else {
                ret += '??';
            }
        }

        return ret;
    }

    static split (src, resolver) {
        let locations = src.split(this.delimiter);

        for (let i = locations.length; i-- > 0; ) {
            locations[i] = this.from(locations[i], resolver);
        }

        return locations;
    }

    constructor (file, line, column) {
        super();

        this.change(file, line, column);
    }

    advance (numLines) {
        if (!this.isNull && this.line > 0) {
            this.line += (numLines == null) ? 1 : numLines;
        }
        return this;
    }

    advanceColumn (numColumns) {
        if (!this.isNull && this.column > 0) {
            this.column += (numColumns == null) ? 1 : numColumns;
        }
        return this;
    }

    at (offset) {
        let me = this,
            C = me.constructor,
            cursor;

        if (me.isNull) {
            return me;
        }

        cursor = me._cursor || (me._cursor = new C());

        cursor.file = me.file;
        cursor.line = me.line;
        cursor.column = me.column + offset;

        return cursor;
    }

    change (file, line, column) {
        let me = this;

        if (file && file.isLocation) {
            return me.change(file.file, file.line, file.column);
        }

        if (typeof file === 'number') { // passed 2 args (assume it was line & column)
            column = line;
            line = file;
        }
        else if (file === '?') {
            me.file = null;
        }
        else {
            me.file = File.from(file);
        }

        if (line > 0) {
            me.line = line;
        }

        if (column > 0) {
            me.column = column;
        }

        return me;
    }

    clone () {
        return new this.constructor(this);
    }

    generate (values) {
        let me = this;
        let ret = [];
        let offset = 0;
        let C = me.constructor;

        for (let v of values) {
            ret.push(me.isNull ? me : new C(me).advanceColumn(offset));
            offset += v.length + 1;  // +1 for separator
        }

        return ret;
    }

    lineCount (from) {
        if (from.isLocation) {
            if (from.file !== this.file) {
                throw new Error(`Cannot do lineCount across files ${this.file} --> ${from.file}`);
            }

            from = from.line;
        }

        let line = this.line;
        let count = line - from;

        if (count < 0) {
            count = -count;
        }

        return (line < 1 || from < 1)  ? -1 : count;
    }

    toString () {
        return this.constructor.format(this);
    }
}

Location.define({
    isLocation: true,

    file: null,
    line: -1,
    column: -1,
    isNull: false,

    static: {
        NULL: new Location(),

        // The character used to delimit concatenated locations (such as
        // 'Foo.js:123:20|Bar.js:343:10'):
        delimiter: '|',

        // The character used to separate the components of a stringified
        // location (e.g., 'Foo.js:123:20'). This format is most commonly
        // understood by log parsers (e.g., IDE's).
        separator: ':'
    }
});

Location.NULL.isNull = true;

Object.freeze(Location.NULL);

module.exports = Location;


text:
package com.github.mustard.chatterbox.slack.domain.event;

public class MessageEvent implements Event {

    public final String channel;
    public final String user;
    public final String text;

    public MessageEvent(
            String channel, String user, String text
    ) {
        this.channel = channel;
        this.user = user;
        this.text = text;
    }

}


text:
package com.example.flow.dagger;

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

import javax.inject.Scope;

/**
 * @author Lukasz Piliszczuk <lukasz.pili@gmail.com>
 */
@Scope
@Retention(RetentionPolicy.SOURCE)
public @interface ScreenScope {
    Class<?> value();
}


text:
const Promise = require('bluebird');

module.exports = {
  promise: (data) => Promise.resolve().then(() => data),

  blankPromise: () => new Promise(() => {})
};


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 io.trino.sql.gen;

import io.airlift.bytecode.BytecodeNode;
import io.airlift.bytecode.Scope;
import io.airlift.bytecode.Variable;
import io.trino.metadata.FunctionManager;
import io.trino.metadata.ResolvedFunction;
import io.trino.spi.function.InvocationConvention;
import io.trino.spi.function.ScalarFunctionImplementation;
import io.trino.sql.relational.RowExpression;

import java.lang.invoke.MethodHandle;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static io.trino.sql.gen.BytecodeUtils.generateFullInvocation;
import static io.trino.sql.gen.BytecodeUtils.generateInvocation;
import static java.util.Objects.requireNonNull;

public class BytecodeGeneratorContext
{
    private final RowExpressionCompiler rowExpressionCompiler;
    private final Scope scope;
    private final CallSiteBinder callSiteBinder;
    private final CachedInstanceBinder cachedInstanceBinder;
    private final FunctionManager functionManager;
    private final Variable wasNull;

    public BytecodeGeneratorContext(
            RowExpressionCompiler rowExpressionCompiler,
            Scope scope,
            CallSiteBinder callSiteBinder,
            CachedInstanceBinder cachedInstanceBinder,
            FunctionManager functionManager)
    {
        requireNonNull(rowExpressionCompiler, "rowExpressionCompiler is null");
        requireNonNull(cachedInstanceBinder, "cachedInstanceBinder is null");
        requireNonNull(scope, "scope is null");
        requireNonNull(callSiteBinder, "callSiteBinder is null");
        requireNonNull(functionManager, "functionManager is null");

        this.rowExpressionCompiler = rowExpressionCompiler;
        this.scope = scope;
        this.callSiteBinder = callSiteBinder;
        this.cachedInstanceBinder = cachedInstanceBinder;
        this.functionManager = functionManager;
        this.wasNull = scope.getVariable("wasNull");
    }

    public Scope getScope()
    {
        return scope;
    }

    public CallSiteBinder getCallSiteBinder()
    {
        return callSiteBinder;
    }

    public BytecodeNode generate(RowExpression expression)
    {
        return rowExpressionCompiler.compile(expression, scope);
    }

    public ScalarFunctionImplementation getScalarFunctionImplementation(ResolvedFunction resolvedFunction, InvocationConvention invocationConvention)
    {
        return functionManager.getScalarFunctionImplementation(resolvedFunction, invocationConvention);
    }

    /**
     * Generates a function call with null handling, automatic binding of session parameter, etc.
     */
    public BytecodeNode generateCall(ResolvedFunction resolvedFunction, List<BytecodeNode> arguments)
    {
        return generateInvocation(scope, resolvedFunction, functionManager, arguments, callSiteBinder);
    }

    public BytecodeNode generateFullCall(ResolvedFunction resolvedFunction, List<RowExpression> arguments)
    {
        List<Function<Optional<Class<?>>, BytecodeNode>> argumentCompilers = arguments.stream()
                .map(this::argumentCompiler)
                .collect(toImmutableList());

        Function<MethodHandle, BytecodeNode> instance = instanceFactory -> scope.getThis().getField(cachedInstanceBinder.getCachedInstance(instanceFactory));

        return generateFullInvocation(scope, resolvedFunction, functionManager, instance, argumentCompilers, callSiteBinder);
    }

    private Function<Optional<Class<?>>, BytecodeNode> argumentCompiler(RowExpression argument)
    {
        return lambdaInterface -> rowExpressionCompiler.compile(argument, scope, lambdaInterface);
    }

    public Variable wasNull()
    {
        return wasNull;
    }
}


text:
import path from 'path';
import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots';

initStoryshots({
  framework: 'html',
  integrityOptions: { cwd: path.resolve(__dirname, '../stories') },
  configPath: path.resolve(__dirname, '../.storybook'),
  test: multiSnapshotWithOptions(),
});


text:
<?xml version="1.0"?>

<document>

    The Byte Code Engineering Library (Apache Commons BCEL™) is intended to give users a
    convenient way to analyze, create, and manipulate (binary)
    Java class files (those ending with .class). Classes are
    represented by objects which contain all the symbolic information
    of the given class: methods, fields and byte code instructions, in
    particular.

    Such objects can be read from an existing file, be transformed
    by a program (e.g. a class loader at run-time) and written to a file again.
    An even more interesting application is the creation of classes from scratch
    at run-time. The Byte Code Engineering Library (BCEL) may be also useful
    if you want to learn about the Java Virtual Machine (JVM) and the format of
    Java .class files.

    BCEL contains a byte code verifier named JustIce, which usually
    gives you much better information about what's wrong with your
    code than the standard JVM message.

    BCEL is already being used successfully in several projects such
    as compilers, optimizers, obsfuscators, code generators
    and analysis tools. Unfortunately there hasn't been much development
    going on over the past few years. Feel free to help out or you
    might want to have a look into the ASM project at objectweb.

</document>


text:
            <input class="form-control" placeholder="{{searchPropertyPlaceholders[prop]}}"
                   ng-model="listData.search[prop]">

        <uib-pagination total-items="listData.count" items-per-page="listData.pagination.size"
                    ng-model="listData.pagination.page" max-size="10"
                    class="pagination-sm" boundary-links="true" rotate="false"
                    previous-text="{{paginationText.previous}}"
                    next-text="{{paginationText.next}}"
                    first-text="{{paginationText.first}}"
                    last-text="{{paginationText.last}}">
        </uib-pagination>

            {{listData.count}} Einträge gefunden. Einträge {{listData.firstResult}}-{{listData.lastResult}}

            Keine Einträge gefunden

        <uib-pagination total-items="listData.count" items-per-page="listData.pagination.size"
                    ng-model="listData.pagination.page" max-size="10"
                    class="pagination-sm" boundary-links="true" rotate="false"
                    previous-text="{{paginationText.previous}}"
                    next-text="{{paginationText.next}}"
                    first-text="{{paginationText.first}}"
                    last-text="{{paginationText.last}}">
        </uib-pagination>


text:
<?php

require 'vendor/autoload.php';

use Aws\Ec2\Ec2Client;

/**
 * Authorize SecurityGroup Ingress
 *
 * This code expects that you have AWS credentials set up per:
 * http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/credentials.html
 */

$ec2Client = new Ec2Client([
    'region' => 'us-west-2',
    'version' => '2016-11-15',
    'profile' => 'default'
]);

$result = $ec2Client->authorizeSecurityGroupIngress(array(
    'GroupName' => 'string',
    'SourceSecurityGroupName' => 'string'
));

var_dump($result);


text:
package ericminio.demo.primefactors.http;

import ericminio.demo.primefactors.domain.Decomposition;
import ericminio.demo.primefactors.domain.Mathematician;
import ericminio.demo.primefactors.security.TooManyRequestException;
import ericminio.demo.primefactors.security.TrafficLimiter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MathController {

    @Autowired
    Mathematician einstein;

    @Autowired
    TrafficLimiter trafficLimiter;

    @RequestMapping("/primeFactorsOf")
    public Decomposition primeFactorsOf(@RequestParam Integer number) {
        if (!trafficLimiter.isOpen(number)) {
            throw new TooManyRequestException();
        }
        return einstein.decompose(number);
    }

    @ExceptionHandler(IllegalArgumentException.class)
    public ResponseEntity<String> handleMathematicianLimitations(IllegalArgumentException exception) {
        return new ResponseEntity<>(exception.getMessage(), HttpStatus.NOT_IMPLEMENTED);
    }

    @ExceptionHandler(TooManyRequestException.class)
    public ResponseEntity<String> handleNotManyRequestException(TooManyRequestException exception) {
        return new ResponseEntity<>(exception.getMessage(), HttpStatus.TOO_MANY_REQUESTS);
    }

}


text:
require 'active_support'

module Groupify
  mattr_accessor :group_membership_class_name,
                 :group_class_name,
                 :member_class_name,
                 :members_association_name,
                 :groups_association_name,
                 :ignore_base_class_inference_errors,
                 :ignore_association_class_inference_errors

  self.group_membership_class_name = 'GroupMembership'
  self.group_class_name = nil # 'Group'
  self.member_class_name = nil # 'User'
  # Set to `false` if default association should not be created
  self.members_association_name = false # :members
  # Set to `false` if default association should not be created
  self.groups_association_name = false # :groups
  self.ignore_base_class_inference_errors = true
  self.ignore_association_class_inference_errors = true

  def self.configure
    yield self
  end

  def self.configure_legacy_defaults!
    configure do |config|
      config.group_class_name  = 'Group'
      config.member_class_name = 'User'

      config.groups_association_name  = :groups
      config.members_association_name = :members
    end
  end

  def self.group_membership_klass
    group_membership_class_name.constantize
  end

  # Get the value of the superclass method.
  # Return a default value if the result is `nil`.
  def self.superclass_fetch(klass, method_name, default_value = nil, &default_value_builder)
    # recursively try to get a non-nil value
    while (klass = klass.superclass).method_defined?(method_name)
      superclass_value = klass.__send__(method_name)

      return superclass_value unless superclass_value.nil?
    end

    block_given? ? yield : default_value
  end

  def self.infer_class_and_association_name(association_name)
    begin
      klass = association_name.to_s.classify.constantize
    rescue NameError => ex
      Rails.logger.warn "Groupify infer class error: #{ex.message}"

      if Groupify.ignore_association_class_inference_errors
        klass = association_name.to_s.classify
      end
    end

    if !association_name.is_a?(Symbol) && klass.is_a?(Class)
      association_name = klass.model_name.plural
    end

    [klass, association_name.to_sym]
  end

  def self.clean_membership_types(*membership_types)
    membership_types.flatten.compact.map(&:to_s).reject(&:empty?)
  end
end

require 'groupify/railtie' if defined?(Rails)


text:
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.xcase = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/es5/index.js":[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

function isLower(char) {
  return char >= 0x61 /* 'a' */ && char <= 0x7a /* 'z' */;
}

function isUpper(char) {
  return char >= 0x41 /* 'A' */ && char <= 0x5a /* 'Z' */;
}

function isDigit(char) {
  return char >= 0x30 /* '0' */ && char <= 0x39 /* '9' */;
}

function toUpper(char) {
  return char - 0x20;
}

function toUpperSafe(char) {
  if (isLower(char)) {
    return char - 0x20;
  }
  return char;
}

function toLower(char) {
  return char + 0x20;
}

function camelize$1(str, separator) {
  var firstChar = str.charCodeAt(0);
  if (isDigit(firstChar) || isUpper(firstChar) || firstChar == separator) {
    return str;
  }
  var out = [];
  var changed = false;
  if (isUpper(firstChar)) {
    changed = true;
    out.push(toLower(firstChar));
  } else {
    out.push(firstChar);
  }

  var length = str.length;
  for (var i = 1; i < length; ++i) {
    var c = str.charCodeAt(i);
    if (c === separator) {
      changed = true;
      c = str.charCodeAt(++i);
      if (isNaN(c)) {
        return str;
      }
      out.push(toUpperSafe(c));
    } else {
      out.push(c);
    }
  }
  return changed ? String.fromCharCode.apply(undefined, out) : str;
}

function decamelize$1(str, separator) {
  var firstChar = str.charCodeAt(0);
  if (!isLower(firstChar)) {
    return str;
  }
  var length = str.length;
  var changed = false;
  var out = [];
  for (var i = 0; i < length; ++i) {
    var c = str.charCodeAt(i);
    if (isUpper(c)) {
      out.push(separator);
      out.push(toLower(c));
      changed = true;
    } else {
      out.push(c);
    }
  }
  return changed ? String.fromCharCode.apply(undefined, out) : str;
}

function pascalize$1(str, separator) {
  var firstChar = str.charCodeAt(0);
  if (isDigit(firstChar) || firstChar == separator) {
    return str;
  }
  var length = str.length;
  var changed = false;
  var out = [];
  for (var i = 0; i < length; ++i) {
    var c = str.charCodeAt(i);
    if (c === separator) {
      changed = true;
      c = str.charCodeAt(++i);
      if (isNaN(c)) {
        return str;
      }
      out.push(toUpperSafe(c));
    } else if (i === 0 && isLower(c)) {
      changed = true;
      out.push(toUpper(c));
    } else {
      out.push(c);
    }
  }
  return changed ? String.fromCharCode.apply(undefined, out) : str;
}

function depascalize$1(str, separator) {
  var firstChar = str.charCodeAt(0);
  if (!isUpper(firstChar)) {
    return str;
  }
  var length = str.length;
  var changed = false;
  var out = [];
  for (var i = 0; i < length; ++i) {
    var c = str.charCodeAt(i);
    if (isUpper(c)) {
      if (i > 0) {
        out.push(separator);
      }
      out.push(toLower(c));
      changed = true;
    } else {
      out.push(c);
    }
  }
  return changed ? String.fromCharCode.apply(undefined, out) : str;
}

function shouldProcessValue(value) {
  return value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object' && !(value instanceof Date) && !(value instanceof Function);
}

function processKeys(obj, fun, opts) {
  var obj2 = void 0;
  if (obj instanceof Array) {
    obj2 = [];
  } else {
    if (typeof obj.prototype !== 'undefined') {
      // return non-plain object unchanged
      return obj;
    }
    obj2 = {};
  }
  for (var key in obj) {
    var value = obj[key];
    if (typeof key === 'string') key = fun(key, opts && opts.separator);
    if (shouldProcessValue(value)) {
      obj2[key] = processKeys(value, fun, opts);
    } else {
      obj2[key] = value;
    }
  }
  return obj2;
}

function processKeysInPlace(obj, fun, opts) {
  var keys = Object.keys(obj);
  for (var idx = 0; idx < keys.length; ++idx) {
    var key = keys[idx];
    var value = obj[key];
    var newKey = fun(key, opts && opts.separator);
    if (newKey !== key) {
      delete obj[key];
    }
    if (shouldProcessValue(value)) {
      obj[newKey] = processKeys(value, fun, opts);
    } else {
      obj[newKey] = value;
    }
  }
  return obj;
}

function camelize$$1(str, separator) {
  return camelize$1(str, separator && separator.charCodeAt(0) || 0x5f /* _ */);
}

function decamelize$$1(str, separator) {
  return decamelize$1(str, separator && separator.charCodeAt(0) || 0x5f /* _ */);
}

function pascalize$$1(str, separator) {
  return pascalize$1(str, separator && separator.charCodeAt(0) || 0x5f /* _ */);
}

function depascalize$$1(str, separator) {
  return depascalize$1(str, separator && separator.charCodeAt(0) || 0x5f /* _ */);
}

function camelizeKeys(obj, opts) {
  opts = opts || {};
  if (!shouldProcessValue(obj)) return obj;
  if (opts.inPlace) return processKeysInPlace(obj, camelize$$1, opts);
  return processKeys(obj, camelize$$1, opts);
}

function decamelizeKeys(obj, opts) {
  opts = opts || {};
  if (!shouldProcessValue(obj)) return obj;
  if (opts.inPlace) return processKeysInPlace(obj, decamelize$$1, opts);
  return processKeys(obj, decamelize$$1, opts);
}

function pascalizeKeys(obj, opts) {
  opts = opts || {};
  if (!shouldProcessValue(obj)) return obj;
  if (opts.inPlace) return processKeysInPlace(obj, pascalize$$1, opts);
  return processKeys(obj, pascalize$$1, opts);
}

function depascalizeKeys(obj, opts) {
  opts = opts || {};
  if (!shouldProcessValue(obj)) return obj;
  if (opts.inPlace) return processKeysInPlace(obj, depascalize$$1, opts);
  return processKeys(obj, depascalize$$1, opts);
}

exports.camelize = camelize$$1;
exports.decamelize = decamelize$$1;
exports.pascalize = pascalize$$1;
exports.depascalize = depascalize$$1;
exports.camelizeKeys = camelizeKeys;
exports.decamelizeKeys = decamelizeKeys;
exports.pascalizeKeys = pascalizeKeys;
exports.depascalizeKeys = depascalizeKeys;

},{}]},{},[])("/es5/index.js")
});


text:
package hmi.flipper.exceptions;

/**
 * This class is used for exceptions that arise during the verification and execution of Templates
 *
 * @author Mark ter Maat
 * @version 0.1
 */

public class TemplateRunException extends Exception
{
    /**
     * Creates a new TemplateRunException
     */
    public TemplateRunException()
    {
        super();
    }

    /**
     * Creates a new TemplateRunException with an error-message.
     * @param err - the error-message
     */
    public TemplateRunException( String err )
    {
        super(err);
    }
}


text:
Bienvenido a Punto Seguro,

Una aplicación para compartir información sobre la seguridad de tu barrio y comuna.

<?php slot('title') ?>
  <?php  echo sprintf('Puntos en '.$address) ?>
<?php end_slot(); ?>

<?php include_partial('buscadorSuperior',array('address' => $address, 'categories'=>$categories, 'filterCatArray'=>$filterCatArray)) ?>

Cargando...

<?php // echo image_tag('loading-image.gif','style=float:left;')?>


text:
using System.Collections;
using System.Runtime.CompilerServices;

namespace System {

    /// <summary>
    /// Provides access to the arguments of the current function.
    /// </summary>
    [ScriptIgnoreNamespace]
    [ScriptImport]
    [ScriptName("arguments")]
    public static class Arguments {

        /// <summary>
        /// Retrieves the arguments list.
        /// </summary>
        /// <returns>The arguments list.</returns>
        [ScriptAlias("arguments")]
        [ScriptField]
        public static object[] Current {
            get {
                return null;
            }
        }

        /// <summary>
        /// Retrieves the number of actual arguments passed to the function.
        /// </summary>
        /// <returns>The count of arguments.</returns>
        [ScriptField]
        public static int Length {
            get {
                return 0;
            }
        }

        /// <summary>
        /// Retrieves the specified actual argument value passed to the
        /// function by index.
        /// </summary>
        /// <param name="index">The index of the argument to retrieve.</param>
        /// <returns>The value of the specified argument.</returns>
        public static object GetArgument(int index) {
            return null;
        }

        /// <summary>
        /// Retrieves the specified actual argument value passed to the
        /// function by index.
        /// </summary>
        /// <param name="index">The index of the argument to retrieve.</param>
        /// <typeparam name="T">The type of the return value.</typeparam>
        /// <returns>The value of the specified argument.</returns>
        public static T GetArgument<T>(int index) {
            return default(T);
        }

        [ScriptAlias("Array.toArray")]
        public static Array ToArray() {
            return null;
        }
    }
}


text:
package edu.mit.streamjit.util;

import static com.google.common.math.LongMath.gcd;
import static com.google.common.math.LongMath.checkedAdd;
import static com.google.common.math.LongMath.checkedMultiply;

/**
 * Represents a Fraction.
 *
 * Imported from Jeffrey's Project Euler project on 4/30/2013.
 * @author Jeffrey Bosboom <jbosboom@csail.mit.edu>
 * @since 10/1/2011
 */
public final class Fraction extends Number implements Comparable<Fraction> {
	private static final long serialVersionUID = 1L;
	public static final Fraction ZERO = new Fraction(0);
	public static final Fraction ONE = new Fraction(1);
	private final long numerator, denominator;
	public Fraction(long numerator) {
		this(numerator, 1);
	}
	public Fraction(long numerator, long denominator) {
		if (denominator == 0)
			throw new ArithmeticException(numerator+"/"+denominator);

		if (numerator == 0)
			denominator = 1;
		else {
			long gcd = gcd(Math.abs(numerator), Math.abs(denominator));
			numerator /= gcd;
			denominator /= gcd;

			if (denominator < 0) {
				numerator = checkedNegate(numerator);
				denominator = checkedNegate(denominator);
			}
		}

		this.numerator = numerator;
		this.denominator = denominator;
	}

	public long num() {
		return numerator;
	}

	public long denom() {
		return denominator;
	}

	public Fraction add(Fraction other) {
		//TODO: use LCM here to be more overflow-resistant
		return new Fraction(checkedAdd(checkedMultiply(num(), other.denom()), checkedMultiply(other.num(), denom())), checkedMultiply(denom(), other.denom()));
	}

	public Fraction sub(Fraction other) {
		return this.add(other.neg());
	}

	public Fraction mul(Fraction other) {
		return new Fraction(checkedMultiply(num(), other.num()), checkedMultiply(denom(), other.denom()));
	}

	public Fraction div(Fraction other) {
		return this.mul(other.recip());
	}

	public Fraction neg() {
		return new Fraction(checkedNegate(numerator), denominator);
	}

	public Fraction recip() {
		return new Fraction(denominator, numerator);
	}

	/**
	 * If this Fraction represents a mathematical integer, returns that integer
	 * (the numerator).  Throws ArithmeticException otherwise.
	 *
	 * This might be considered a checked version of {@code #longValue()}.
	 * @return this fraction's value if it's an integer
	 */
	public long asInteger() {
		if (denom() != 1)
			throw new ArithmeticException("Not an integer: "+toString());
		return num();
	}

	@Override
	public int intValue() {
		return (int)doubleValue();
	}

	@Override
	public long longValue() {
		return (long)doubleValue();
	}

	@Override
	public float floatValue() {
		return (float)doubleValue();
	}

	@Override
	public double doubleValue() {
		return ((double)num())/denom();
	}

	@Override
	public int compareTo(Fraction other) {
		return Long.compare(num()*other.denom(), other.num()*denom());
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Fraction other = (Fraction)obj;
		if (this.numerator != other.numerator)
			return false;
		if (this.denominator != other.denominator)
			return false;
		return true;
	}

	@Override
	public int hashCode() {
		int hash = 7;
		hash = 13 * hash + (int)(this.numerator ^ (this.numerator >>> 32));
		hash = 13 * hash + (int)(this.denominator ^ (this.denominator >>> 32));
		return hash;
	}

	@Override
	public String toString() {
		return num()+"/"+denom();
	}

	private static long checkedNegate(long x) {
		if (x == Long.MIN_VALUE)
			throw new ArithmeticException();
		return -x;
	}
}


text:
package uk.me.chrs.inflect

import org.scalatest.FunSuite

class LocaleTest extends FunSuite {

  test("specify gb") {
    import uk.me.chrs.inflect.Inflect_EN_GB._
    assert(cardinal(107) === "one hundred and seven")
    assert(one("herb") ===  "a herb")
  }

  test("specify us") {
    import uk.me.chrs.inflect.Inflect_EN_US._
    assert(cardinal(107) === "one hundred seven")
    assert(one("herb") === "an herb")
  }
}


text:
#include "vtStorScsi/Internal/CommandHandlerScsi.h"
#include "CommandHandlerScsiManaged.h"

namespace vtStor
{
    namespace Managed
    {
        cCommandHandlerScsi::cCommandHandlerScsi( IRunTimeDll^ RunTimeDll, cProtocolInterface^ Protocol)
        {
            GetCommandHandlerDelegate getCommandHandlerDelegate = (GetCommandHandlerDelegate)RunTimeDll->GetFunction("cCommandHandlerScsi_GetCommandHandler");
            getCommandHandlerDelegate(*m_CommandHandler, *reinterpret_cast< std::shared_ptr<vtStor::IProtocol>*>((void*)*Protocol));
        }

        cCommandHandlerScsi::~cCommandHandlerScsi()
        {
        }

        cCommandHandlerScsi::!cCommandHandlerScsi()
        {
        }

        cCommandHandlerScsi::operator void*()
        {
            return(reinterpret_cast<void*>(&(*m_CommandHandler)));
        }
    }
}


text:
namespace RDKit {
  class DiscreteValueVect;
}
namespace RDGeom {
  class Point3D;

  class GridException : public std::exception {
  public:
    //! construct with an error message
    GridException(const char *msg) : _msg(msg) {};
    //! construct with an error message
    GridException(const std::string msg) : _msg(msg) {};
    //! get the error message
    const char *message () const { return _msg.c_str(); };
    ~GridException () throw () {};
  private:
    std::string _msg;
  };

  //! Virtual base class for a grid object
  class Grid3D {
  public:
    virtual ~Grid3D() {};
    virtual int getGridPointIndex(const Point3D &point) const = 0;
    virtual int getVal(const Point3D &point) const = 0;
    virtual void setVal(const Point3D &point, unsigned int val) = 0;

    virtual Point3D getGridPointLoc(unsigned int pointId) const = 0;
    virtual unsigned int getVal(unsigned int pointId) const = 0;
    virtual void setVal(unsigned int pointId, unsigned int val) = 0;

    virtual unsigned int getSize() const = 0;

    virtual const RDKit::DiscreteValueVect *getOccupancyVect() const = 0;
  };
}

#endif


text:
{% extends "base.html" %}

{% block extra_head %}

{% endblock %}

{% block content %}

             Back to My Searches

Your query has been deleted

    You are being redirected back to our home page

{% endblock %}


text:
define([
	'ash', 'game/components/common/PositionComponent', 'game/components/common/CampComponent', 'game/components/sector/CurrentNearestCampComponent'
], function(Ash, PositionComponent, CampComponent, CurrentNearestCampComponent) {
	var NearestCampNode = Ash.Node.create({
		nearestCamp : CurrentNearestCampComponent,
		camp: CampComponent,
		position : PositionComponent
	});

	return NearestCampNode;
});


text:
DEFINE_int32(port, 8080, "HTTP server port");
DEFINE_string(commons, "", "Commons store");
DEFINE_bool(kb, false, "Start knowledge base browser");
DEFINE_string(names, "local/data/e/wiki/en/name-table.repo", "Name table");
DEFINE_string(spec, "", "Document analyzer specification");

using namespace sling;
using namespace sling::nlp;

class CorpusBrowser : public DocumentService {
 public:
  CorpusBrowser(Store *commons,
                RecordDatabase *db,
                DocumentAnnotation *annotators)
      : DocumentService(commons), db_(db), annotators_(annotators) {}

  // Register service.
  void Register(HTTPServer *http) {
    http->Register("/fetch", this, &CorpusBrowser::HandleFetch);
    http->Register("/forward", this, &CorpusBrowser::HandleForward);
    http->Register("/back", this, &CorpusBrowser::HandleBack);
    app_content_.Register(http);
    common_content_.Register(http);
  }

  void HandleFetch(HTTPRequest *request, HTTPResponse *response) {
    WebService ws(commons_, request, response);
    Text docid = ws.Get("docid");
    if (docid.empty()) {
      response->SendError(400, nullptr, "docid missing");
      return;
    }

    // Fetch document record from database.
    Record record;
    if (!FetchRecord(docid, &record)) {
      response->SendError(404, nullptr, "unknown document");
      return;
    }

    ProcessRecord(&record, &ws);
  }

  void HandleForward(HTTPRequest *request, HTTPResponse *response) {
    WebService ws(commons_, request, response);

    // Fetch next document from database.
    Record record;
    if (!FetchNext(&record)) {
      response->SendError(400, nullptr, "no more documents");
      return;
    }

    ProcessRecord(&record, &ws);
  }

  void HandleBack(HTTPRequest *request, HTTPResponse *response) {
    WebService ws(commons_, request, response);

    // Fetch previous document from database.
    Record record;
    if (!FetchBackward(&record)) {
      response->SendError(400, nullptr, "no more documents");
      return;
    }

    ProcessRecord(&record, &ws);
  }

  bool FetchRecord(Text key, Record *record) {
    MutexLock lock(&mu_);
    if (db_->Lookup(key.slice(), record)) {
      history_.emplace_back(db_->current_shard(), record->position);
      return true;
    } else {
      return false;
    }
  }

  bool FetchNext(Record *record) {
    MutexLock lock(&mu_);
    if (db_->Next(record)) {
      history_.emplace_back(db_->current_shard(), record->position);
      return true;
    } else {
      return false;
    }
  }

  bool FetchBackward(Record *record) {
    MutexLock lock(&mu_);
    if (history_.empty()) return false;
    history_.pop_back();
    if (history_.empty()) return false;
    int shard = history_.back().first;
    int64 position = history_.back().second;
    return db_->Read(shard, position, record);
  }

  void ProcessRecord(Record *record, WebService *ws) {
    // Create document.
    Store *store = ws->store();
    Frame top = Decode(store, record->value).AsFrame();
    Document document(top);

    // Analyze document.
    annotators_->Annotate(&document);

    // Return document in JSON format.
    Frame json = Convert(document);
    ws->set_output(json);
  }

 private:
  // Record database with documents.
  RecordDatabase *db_;

  // History of records read from database.
  std::vector<std::pair<int, int64>> history_;

  // Document analyzer.
  DocumentAnnotation *annotators_;

  // Static web content.
  StaticContent app_content_{"/doc", "sling/nlp/document/app"};
  StaticContent common_content_{"/common", "app"};

  // Mutex for accessing database.
  Mutex mu_;
};

int main(int argc, char *argv[]) {
  InitProgram(&argc, &argv);

  // Get corpus files.
  std::vector<string> files;
  for (int i = 1; i < argc; ++i) {
    File::Match(argv[i], &files);
  }
  CHECK(!files.empty()) << "No document database files";

  // Open record database.
  RecordFileOptions recopts;
  RecordDatabase db(files, recopts);

  // Load document annotation pipeline.
  Store commons;
  LOG(INFO) << "Loading analyzer";
  DocumentAnnotation annotators;
  annotators.Init(&commons, FLAGS_spec);

  // Initialize knowledge base service.
  KnowledgeService kb;
  if (FLAGS_kb) kb.Load(&commons, FLAGS_names);

  // Initialize corpus browser.
  CorpusBrowser browser(&commons, &db, &annotators);
  commons.Freeze();

  LOG(INFO) << "Start HTTP server on port " << FLAGS_port;
  HTTPServerOptions httpopts;
  HTTPServer http(httpopts, FLAGS_port);

  browser.Register(&http);
  if (FLAGS_kb) kb.Register(&http);

  http.Register("/", [](HTTPRequest *req, HTTPResponse *rsp) {
    if (strcmp(req->path(), "/") == 0) {
      rsp->TempRedirectTo("/doc/corpus.html");
    } else {
      rsp->SendError(404, "Not found", "file not found");
    }
  });

  http.Register("/favicon.ico", [](HTTPRequest *req, HTTPResponse *rsp) {
    rsp->RedirectTo("/common/image/appicon.ico");
  });

  CHECK(http.Start());

  LOG(INFO) << "HTTP server running";
  http.Wait();

  LOG(INFO) << "HTTP server done";
  return 0;
}


text:
class ChromeNewWindowClient : public ash::mojom::NewWindowClient {
 public:
  ChromeNewWindowClient();
  ~ChromeNewWindowClient() override;

  // Overridden from ash::mojom::NewWindowClient:
  void NewTab() override;
  void NewWindow(bool incognito) override;
  void OpenFileManager() override;
  void OpenCrosh() override;
  void OpenGetHelp() override;
  void RestoreTab() override;
  void ShowKeyboardOverlay() override;
  void ShowTaskManager() override;
  void OpenFeedbackPage() override;

 private:
  class TabRestoreHelper;

  std::unique_ptr<TabRestoreHelper> tab_restore_helper_;

  ash::mojom::NewWindowControllerPtr new_window_controller_;

  // Binds this object to the client interface.
  mojo::AssociatedBinding<ash::mojom::NewWindowClient> binding_;

  DISALLOW_COPY_AND_ASSIGN(ChromeNewWindowClient);
};

#endif  // CHROME_BROWSER_UI_ASH_CHROME_NEW_WINDOW_CLIENT_H_


text:
<?xml version="1.0" encoding="UTF-8"?>
<ldswebml type="image" uri="/media-library/images/education/miscellaneous#education-242389" xml:lang="eng" locale="eng" status="publish">
  <search-meta>
      <uri-title its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">education-242389</uri-title>
      <source>education-242389</source>
      <publication-type its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">image</publication-type>
      <media-type its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">image</media-type>
      <publication value="ldsorg">LDS.org</publication>
      <publication-date value="2012-04-09">2012-04-09</publication-date>
      <title/>
      <description/>
      <collections>
          <collection its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">global-search</collection>
          <collection its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">media</collection>
          <collection its:translate="no" xmlns:its="http://www.w3.org/2005/11/its">images</collection>
      </collections>
      <subjects>
          <subject>Women</subject>
          <subject>Young Adults</subject>
          <subject>Libraries</subject>
          <subject>Shelves</subject>
          <subject>Books</subject>
          <subject>Studying</subject>
          <subject>Reading</subject>
          <subject>Bookshelves</subject>
          <subject>Tables</subject>
          <subject>Education</subject>
          <subject>Learning</subject>
          <subject>Knowledge</subject>
      </subjects>
  </search-meta>
  <no-search>
      <path>http://media.ldscdn.org/images/media-library/education/miscellaneous/education-242389-gallery.jpg</path>
      <images>
          http://media.ldscdn.org/images/media-library/education/miscellaneous/education-242389-thumbnail.jpg
      </images>
          <download-urls>
              <download-url>
                  Mobile
                  <size>73 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/education/miscellaneous/education-242389-mobile.jpg</path>
              </download-url>
              <download-url>
                  Tablet
                  <size>98 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/education/miscellaneous/education-242389-tablet.jpg</path>
              </download-url>
              <download-url>
                  Print
                  <size>225 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/education/miscellaneous/education-242389-print.jpg</path>
              </download-url>
              <download-url>
                  Wallpaper
                  <size>408 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/education/miscellaneous/education-242389-wallpaper.jpg</path>
              </download-url>
          </download-urls>
  </no-search>
<ldse-meta its:translate="no" xmlns="http://lds.org/code/lds-edit" xmlns:its="http://www.w3.org/2005/11/its"><document id="education-242389" locale="eng" uri="/media-library/images/education/miscellaneous#education-242389" status="publish" site="ldsorg" source="chq" words="118" tgp="0.4126"/><created username="lds-edit" userid=""/><last-modified date="2012-05-10T12:26:05.692556-06:00" username="lds-edit" userid=""/></ldse-meta></ldswebml>


text:
//-*- Mode: C++ -*-
// $Id: AliHLTEMCALOnlineDisplayEventTab.h 35071 2009-09-29 05:26:09Z phille $

#ifndef ALIHLTEMCALONLINEDISPLAYEVENTTAB_H
#define ALIHLTEMCALONLINEDISPLAYEVENTTAB_H

#include "AliHLTEMCALOnlineDisplayTab.h"
#include "AliHLTCaloConstants.h"
#include "AliHLTEMCALMapper.h"

#define NZRCUCOORD 2
#define NXRCUCOORD 2

//using namespace EmcalHLTConst;
using CALO::MAXHOSTS;

class TGTab;
class TRootEmbeddedCanvas;
class TCanvas;
class TH2D;
class TH1D;
class AliHLTEMCALOnlineDisplayTH2D;
class AliHLTEMCALGetEventButton;
class AliHLTHOMERReader;
class AliHLTCaloRcuCellEnergyDataStruct;
class AliHLTEMCALOnlineDisplay;
class AliHLTEMCALSharedMemoryInterface;
class AliHLTCaloChannelRawDataStruct;

class AliHLTEMCALOnlineDisplayEventTab : public AliHLTEMCALOnlineDisplayTab
{
 public:

  virtual ~AliHLTEMCALOnlineDisplayEventTab();

  AliHLTEMCALOnlineDisplayEventTab(AliHLTEMCALOnlineDisplay * onlineDisplayPtr, TGTab  *tabPtr,
				  AliHLTHOMERReader * homerSyncPtr,
				  AliHLTHOMERReader * homerPtrs[MAXHOSTS],
				  int nHosts,  int runnumber = -1);

  Int_t GetRawData(TH1D *histPtr, int x, int z, int gain);

  void UpdateDisplay();
  int GetNextEvent();
  virtual void ReadBlockData(AliHLTHOMERReader *homeReaderPtr);
  void FindFourierBlocks(AliHLTHOMERReader *homeReaderPtr) const;

  void ResetDisplay();
  TGTab               *fTab; // Tab for onlinedisplay
  TGTab               *fSubTab1;
  TRootEmbeddedCanvas *fEc1, *fEc2, *fEc3, *fEc4, *fEc5, *fEc6;// Embedded canvas for tower energies etc..
  TGCompositeFrame    *fSubF1, *fSubF2, *fSubF3; // comment
  TCanvas *fgCanvasPtr[NGAINS]; // Comment
  AliHLTEMCALOnlineDisplayTH2D *fgLegoPlotPtr[NGAINS];  // Legoplot with tower energies

  int *fChannelData[NMODULES][NZROWSMOD][NXCOLUMNSMOD][NGAINS]; // Arrays to hold tower energies
  Int_t fNChannelSamples[NMODULES][NZROWSMOD][NXCOLUMNSMOD][NGAINS]; // Arrays to holdrwa data
  Int_t fChannelEnergy[NMODULES][NZROWSMOD][NXCOLUMNSMOD][NGAINS];   // Arrays to hold tower energies

 private:
  AliHLTEMCALOnlineDisplayEventTab (const AliHLTEMCALOnlineDisplayEventTab & );
  AliHLTEMCALOnlineDisplayEventTab & operator = (const AliHLTEMCALOnlineDisplayEventTab  &);
  AliHLTEMCALOnlineDisplayEventTab();
  void FillRawData(const AliHLTCaloChannelRawDataStruct &rawStr);
  AliHLTEMCALGetEventButton* fgEventButtPtr;
  void InitDisplay(TGTab *tabPtr){};
  void InitDisplay(TGTab * tabPtr, int runnumber);
  AliHLTEMCALOnlineDisplay *fOnlineDisplayPtr;
  AliHLTEMCALSharedMemoryInterface  *fShmPtr;

};

#endif


text:
package me.doubledutch.phat.aggregates;

import java.io.*;
import javax.script.*;

public class JavascriptFunction{
	protected ScriptEngine jsEngine;
	protected Invocable jsInvocable;

	public JavascriptFunction(){
		ScriptEngineManager mgr = new ScriptEngineManager();
        jsEngine = mgr.getEngineByName("JavaScript");
        // jsEngine = mgr.getEngineByName("nashorn");
        jsInvocable = (Invocable) jsEngine;
	}
}


text:
package TerrariaClone.GameData;

import TerrariaClone.HorribleStartingSkycolorProvider;
import TerrariaClone.StartingSkycolorProvider;
import org.junit.Test;

import static org.junit.Assert.*;

public class JsonStartingSkycolorProviderTest {
    @Test
    public void consistentlyBoostrapStartingColors()
    {
        JsonStartingSkycolorProvider provider = new JsonStartingSkycolorProvider();
        provider.createStartingSkycolors(new HorribleStartingSkycolorProvider().getStartingSkycolors());
    }

    @Test
    public void getStartingSkycolors() throws Exception {
        StartingSkycolorProvider provider = new JsonStartingSkycolorProvider();
        StartingSkycolorProvider horrible_provider = new HorribleStartingSkycolorProvider();
        assertArrayEquals(provider.getStartingSkycolors(), horrible_provider.getStartingSkycolors());
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity">

    <item
        android:id="@+id/menu_create_new_entry"
        android:icon="@drawable/ic_add_box_white_24dp"
        android:title="@string/create_new_entry"
        app:showAsAction="always"/>

    <item
        android:id="@+id/menu_settings"
        android:icon="@drawable/ic_settings_white_24dp"
        android:orderInCategory="100"
        android:title="@string/settings"
        app:showAsAction="always" />

    <item
        android:icon="@drawable/ic_more_vert_white_24dp"
        android:orderInCategory="100"
        android:title="@string/options"
        app:showAsAction="always">
        <menu>

            <item
                android:id="@+id/menu_about"
                android:icon="@android:drawable/ic_menu_info_details"
                android:title="@string/about" />
        </menu>
    </item>

</menu>


text:
packet\_reactor module
======================

.. automodule:: packet_reactor
    :members:
    :undoc-members:
    :show-inheritance:


text:
package dk.statsbiblioteket.doms.client.objects;

import org.hamcrest.Description;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatcher;

import dk.statsbiblioteket.doms.central.CentralWebservice;
import dk.statsbiblioteket.doms.central.Checksum;
import dk.statsbiblioteket.doms.central.DatastreamProfile;
import dk.statsbiblioteket.doms.central.ObjectProfile;
import dk.statsbiblioteket.doms.client.impl.objects.DigitalObjectFactoryImpl;
import dk.statsbiblioteket.doms.client.relations.LiteralRelation;
import dk.statsbiblioteket.doms.client.relations.ObjectRelation;
import dk.statsbiblioteket.doms.client.relations.Relation;

import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.List;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

/**
 * Test relation operations
 */
public class RelationsTest {

    private static final String UUID = "uuid:XXX";
    private static final String CM_PID = "doms:ContentModel_Program";
    private DigitalObjectFactory factory;
    private CentralWebservice domsAPI;

    public RelationsTest() throws MalformedURLException {
        super();
    }

    @Before
    public void setUp() throws Exception {
        domsAPI = mock(CentralWebservice.class);
        factory = new DigitalObjectFactoryImpl(domsAPI);
        when(domsAPI.getObjectProfile(UUID)).thenReturn(createObjectProfile());
        when(domsAPI.getObjectProfile(CM_PID)).thenReturn(createCMObjectProfile());
        when(domsAPI.getDatastreamContents(CM_PID, "VIEW")).thenReturn(createView());
        when(domsAPI.getInverseRelations(CM_PID)).thenReturn(createInverseRelations());
    }

    /**
     * Test that relations are related to their content model view annotations.
     *
     * @throws Exception
     */
    @Test
    public void testViewRelations() throws Exception {
        //Read content model object
        DigitalObject cmdoms = factory.getDigitalObject(CM_PID);

        //This should call DOMS
        verify(domsAPI).getObjectProfile(CM_PID);
        verifyNoMoreInteractions(domsAPI);

        //Read view relations
        ContentModelObject cmo = (ContentModelObject) cmdoms;
        List<String> relationsWithViewAngle = cmo.getRelationsWithViewAngle("SummaVisible");

        //This should trigger a read of the VIEW relations
        verify(domsAPI).getDatastreamContents(CM_PID, "VIEW");
        verifyNoMoreInteractions(domsAPI);

        //A view relation should be found.
        assertNotNull(relationsWithViewAngle);
        assertEquals(1, relationsWithViewAngle.size());
        assertEquals("http://doms.statsbiblioteket.dk/relations/default/0/1/#hasFile", relationsWithViewAngle.get(0));
    }

    /**
     * Test getting inverse relations.
     * @throws Exception
     */
    @Test
    public void testInverseRelations() throws Exception {
        //Read content model object
        DigitalObject cmdoms = factory.getDigitalObject(CM_PID);

        //This should call DOMS
        verify(domsAPI).getObjectProfile(CM_PID);
        verifyNoMoreInteractions(domsAPI);

        //Read inverse relations
        List<ObjectRelation> inverseRelations = cmdoms.getInverseRelations();

        //This should call DOMS
        verify(domsAPI).getInverseRelations(CM_PID);
        verifyNoMoreInteractions(domsAPI);

        //Check results
        assertEquals(1, inverseRelations.size());
        assertEquals(inverseRelations.get(0).getObjectPid(), cmdoms.getPid());
        assertNotNull(inverseRelations.get(0).getSubjectPid());
        verifyNoMoreInteractions(domsAPI);

        //Check object can be read from relation
        DigitalObject subject = inverseRelations.get(0).getSubject();

        //Reads object from DOMS
        verify(domsAPI).getObjectProfile(UUID);

        //Is right object
        assertEquals(UUID, subject.getPid());
    }

    /**
     * Test adding literal relations.
     * @throws Exception
     */
    @Test
    public void testAddedRelationLiteral() throws Exception {
        //Read object
        DigitalObject object = factory.getDigitalObject(UUID);

        //This should call DOMS
        verify(domsAPI).getObjectProfile(UUID);
        verifyNoMoreInteractions(domsAPI);

        //Add a relation
        LiteralRelation newRel = object
                .addLiteralRelation("http://domclient.unittests/#testRelationPredicateLiteral", "literalValue");

        //This should not call DOMS until the object is saved.
        verifyNoMoreInteractions(domsAPI);

        //Save the change
        object.save();

        //This should call DOMS
        verify(domsAPI).addRelation(eq(UUID),
                                    isThisRelation(UUID, "http://domclient.unittests/#testRelationPredicateLiteral",
                                                   "literalValue", true), anyString());
        verifyNoMoreInteractions(domsAPI);
    }

    /**
     * Test removing literal relations.
     * @throws Exception
     */
    @Test
    public void testRemovedRelationLiteral() throws Exception {
        //Read object
        DigitalObject object = factory.getDigitalObject(UUID);

        //This should call DOMS
        verify(domsAPI).getObjectProfile(UUID);
        verifyNoMoreInteractions(domsAPI);

        //Find literal relation
        LiteralRelation literalRelation = null;
        for (Relation relation : object.getRelations()) {
            if (relation instanceof LiteralRelation) {
                literalRelation = (LiteralRelation) relation;
                break;
            }
        }
        assertNotNull("A literal relation should be found", literalRelation);

        //Remove literal relation
        literalRelation.remove();

        //This should not call DOMS until the object is saved.
        verifyNoMoreInteractions(domsAPI);

        //Save the change
        object.save();

        //This should call DOMS
        verify(domsAPI).deleteRelation(eq(UUID),
                                       isThisRelation(literalRelation.getSubjectPid(), literalRelation.getPredicate(),
                                                      literalRelation.getObject(), true), anyString());
        verifyNoMoreInteractions(domsAPI);
    }

    /**
     * Test adding object relations.
     * @throws Exception
     */
    @Test
    public void testAddedRelationObject() throws Exception {
        //Read object
        DigitalObject object = factory.getDigitalObject(UUID);

        //This should call DOMS
        verify(domsAPI).getObjectProfile(UUID);
        verifyNoMoreInteractions(domsAPI);

        //Add a relation
        object.addObjectRelation("http://domsclient.unittests/#testRelationPredicateObject", object);

        //This should not call DOMS until the object is saved.
        verifyNoMoreInteractions(domsAPI);

        //Save the change
        object.save();

        //This should call DOMS
        verify(domsAPI).addRelation(eq(UUID),
                                    isThisRelation(UUID, "http://domsclient.unittests/#testRelationPredicateObject",
                                                   UUID, false), anyString());
        verifyNoMoreInteractions(domsAPI);
    }

    /**
     * Test removing object relations.
     * @throws Exception
     */
    @Test
    public void testRemovedRelationObject() throws Exception {
        //Read object
        DigitalObject object = factory.getDigitalObject(UUID);

        //This should call DOMS
        verify(domsAPI).getObjectProfile(UUID);
        verifyNoMoreInteractions(domsAPI);

        //Find object relation
        ObjectRelation objectRelation = null;
        for (Relation relation : object.getRelations()) {
            if (relation instanceof ObjectRelation) {
                objectRelation = (ObjectRelation) relation;
                break;
            }
        }
        assertNotNull(objectRelation);

        //Remove object relation
        objectRelation.remove();

        //This should not call DOMS until the object is saved.
        verifyNoMoreInteractions(domsAPI);

        //Save the change
        object.save();

        //This should call DOMS
        verify(domsAPI).deleteRelation(eq(UUID),
                                       isThisRelation(objectRelation.getSubjectPid(), objectRelation.getPredicate(),
                                                      objectRelation.getObjectPid(), false), anyString());
        verifyNoMoreInteractions(domsAPI);

    }

    private ObjectProfile createObjectProfile() {
        ObjectProfile objectProfile = new ObjectProfile();
        objectProfile.setPid(UUID);
        objectProfile.setState("I");
        objectProfile.setTitle("Object");
        dk.statsbiblioteket.doms.central.Relation relation1 = new dk.statsbiblioteket.doms.central.Relation();
        relation1.setSubject("info:fedora/" + UUID);
        relation1.setPredicate("info:test/relation");
        relation1.setObject("Hello");
        relation1.setLiteral(true);
        dk.statsbiblioteket.doms.central.Relation relation2 = new dk.statsbiblioteket.doms.central.Relation();
        relation2.setSubject("info:fedora/" + UUID);
        relation2.setPredicate("info:test/relation2");
        relation2.setObject("info:fedora/doms:ContentModel_Program");
        relation2.setLiteral(false);
        objectProfile.getRelations().add(relation1);
        objectProfile.getRelations().add(relation2);
        return objectProfile;
    }

    private ObjectProfile createCMObjectProfile() {
        ObjectProfile objectProfile = new ObjectProfile();
        objectProfile.setPid(CM_PID);
        objectProfile.setType("ContentModel");
        objectProfile.setState("A");
        DatastreamProfile datastreamProfile = new DatastreamProfile();
        datastreamProfile.setId("VIEW");
        Checksum checksum = new Checksum();
        checksum.setType("DISABLED");
        datastreamProfile.setChecksum(checksum);
        objectProfile.getDatastreams().add(datastreamProfile);
        return objectProfile;
    }

    private String createView() {
        return "<v:views xmlns:v=\"http://doms.statsbiblioteket.dk/types/view/default/0/1/#\">\n"
                + "    <v:viewangle name=\"SummaVisible\">\n"
                + "        <v:relations xmlns:doms=\"http://doms.statsbiblioteket.dk/relations/default/0/1/#\">\n"
                + "            <doms:hasFile/>\n"
                + "        </v:relations>\n"
                + "        <v:inverseRelations/>\n"
                + "    </v:viewangle>\n"
                + "</v:views>\n";
    }

    private List<dk.statsbiblioteket.doms.central.Relation> createInverseRelations() {
        dk.statsbiblioteket.doms.central.Relation relation = new dk.statsbiblioteket.doms.central.Relation();
        relation.setSubject(UUID);
        relation.setPredicate("dk.statsbiblioteket.doms.client.objects.RelationsTest.testInverseRelations");
        relation.setObject(CM_PID);
        relation.setLiteral(false);

        return Arrays.asList(relation);
    }

    private static dk.statsbiblioteket.doms.central.Relation isThisRelation(String subject, String predicate, String object, boolean literal) {
        return argThat(new IsThisRelation(subject, predicate, object, literal));
    }

    private static class IsThisRelation extends ArgumentMatcher<dk.statsbiblioteket.doms.central.Relation> {
        private final String subject;
        private final String predicate;
        private final String object;
        private final boolean literal;

        public IsThisRelation(String subject, String predicate, String object, boolean literal) {
            this.subject = subject;
            this.predicate = predicate;
            this.object = object;
            this.literal = literal;
        }

        @Override
        public boolean matches(Object argument) {
            dk.statsbiblioteket.doms.central.Relation that = (dk.statsbiblioteket.doms.central.Relation) argument;
            return (clean(subject).equals(clean(that.getSubject()))
                    && predicate.equals(that.getPredicate())
                    && clean(object).equals(clean(that.getObject()))
                    && literal == that.isLiteral());
        }

        private String clean(String s) {
            return s.replaceAll("^info:fedora/", "");
        }

        @Override
        public void describeTo(Description description) {
            description.appendValue(
                    String.format("<relation: (%s, %s, %s), literal: %s>", subject, predicate, object, literal));
        }
    }
}


text:
package org.phema.executer.i2b2;

import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

import java.net.URI;
import java.net.URISyntaxException;

import static org.junit.jupiter.api.Assertions.*;

/**
 * Created by Luke Rasmussen on 7/19/17.
 */
@RunWith(JUnitPlatform.class)
public class I2b2ConfigurationTest {
    @Test
    void defaultConstructor() {
        I2B2ExecutionConfiguration config = new I2B2ExecutionConfiguration();
        assertNull(config.getI2b2ProjectManagementUrl());
        assertEquals("", config.getI2b2Login());
        assertEquals("", config.getI2b2Password());
        assertEquals("", config.getI2b2Project());
        assertEquals("", config.getI2b2Domain());
    }

    @Test
    void constructorWithParams() {
        I2B2ExecutionConfiguration config = null;
        try {
            config = new I2B2ExecutionConfiguration(new URI("http://test.com"), "2", "3", "4", "5");
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        assertNotNull(config);
        assertEquals("http://test.com", config.getI2b2ProjectManagementUrl().toString());
        assertEquals("2", config.getI2b2Login());
        assertEquals("3", config.getI2b2Password());
        assertEquals("4", config.getI2b2Project());
        assertEquals("5", config.getI2b2Domain());
    }
}


text:
import documentOffset from "document-offset";
import throttle from './throttle';
/**
 * Will take care of the dragging and reordering a list for one drag.
 * @function trackReorderDrag
 * @param  {event} paramE        The dragstart event, from which this should be called.
 * @param  {HTMLElement} paramEl       The main Element being dragged
 * @param  {Array<HTMLElement>} paramElements Array of elements to be tracked.
 * @return {void}
 */
export default function trackReorderDrag(paramE, paramEl, paramElements) {
  function setTranslation(el, val) {
    el.style.transform = `translate3d(0, ${val}px, 0)`; //  eslint-disable-line no-param-reassign
  }

  /**
   * @function resetElementsPositions
   * @param {Array<HTMLElement>} els Elements being tracked
   */
  function resetElementsPositions(els) {
    els.forEach((el) => {
      setTranslation(el, 0);
    });
  }

  /**
   * @function calculateElementHeight
   * @param  {Array<HTMLElement>} els    Elements ordered by vertical position
   * @param  {Integer} elIndex
   * @return {void}
   */
  function calculateElementHeight(els, elIndex) {
    let spaceOccupied;

    // If not the last element
    if (elIndex < els.length - 1) {
      const elTop = documentOffset(els[elIndex]).top;
      const nextElTop = documentOffset(els[elIndex + 1]).top;
      spaceOccupied = nextElTop - elTop;
    } else {
      // let's estimate the general vertical distance between elements by
      // subtracting the size of the first element from the distance between
      // its top and the next element.
      const firstElSpaceOccupied =
          documentOffset(els[1]).top - documentOffset(els[0]).top;
      const verticalDistance = firstElSpaceOccupied - els[0].clientHeight;
      const height = els[elIndex].clientHeight;
      spaceOccupied = height + verticalDistance;
    }

    return spaceOccupied;
  }

  /**
   * @function createDragMover
   * @param  {Array<HTMLElement>} els
   * @param  {Array<Integer>} tops        Initial tops
   * @param  {Integer} targetIndex Index of element being dragged around
   * @return {function}             The function to translate elements in the
   *                                  list to make room for the dragged element
   */
  function createDragMover(els, tops, targetIndex) {
    const target = els[targetIndex];
    const targetInitialTop = tops[targetIndex];
    const targetHeight = calculateElementHeight(els, targetIndex);
    return function doDragMove() {
      const targetTop = documentOffset(target).top;
      const movedUp = (targetTop < targetInitialTop);

      let i;
      for (i = 0; i < tops.length; i++) {
        if (i === targetIndex) {
          continue;
        } else
        if (!movedUp && targetTop > tops[i] && tops[i] > targetInitialTop) {
          setTranslation(els[i], -targetHeight);
        } else if (movedUp && targetTop < tops[i + 1] && tops[i] < targetInitialTop) {
          setTranslation(els[i], targetHeight);
        } else {
          setTranslation(els[i], 0);
        }
      }
    };
  }

  function createDragListener(els, tops, targetIndex, initialY) {
    const target = els[targetIndex];
    const doDragMove = createDragMover(els, tops, targetIndex);
    let shouldStopListening;
    function dragListener(e) {
      if (shouldStopListening) { return; }

      doDragMove();
      const newY = e.pageY;
      if (newY === 0) { return; } // correct weird behaviour when mouse goes up

      const diff = newY - initialY;
      setTranslation(target, diff);
    }

    dragListener.stop = () => {
      shouldStopListening = true;
    };

    return dragListener;
  }

  function getElementsCurrentTop(els) {
    const tops = [];
    els.forEach((el) => { tops.push(documentOffset(el).top); });

    return tops;
  }

  // function adjustElementsToTops(els, tops) {
  //   const currentTops = getElementsCurrentTop(els);
  //   els.forEach(function (el, i) {
  //     const diff =  currentTops[i] - tops[i];
  //     setTranslation(el, diff);
  //   });
  // }

  function insertTargetInRightPlace(els, initialTops, targetIndex) {
    const target = els[targetIndex];
    const topsBeforeInsertion = getElementsCurrentTop(els);
    const targetTop = topsBeforeInsertion[targetIndex];
    let i = 0;

    // Pass by all elements that are above the target
    while ((topsBeforeInsertion[i] && topsBeforeInsertion[i] < targetTop) ||
              (i === targetIndex)) {
      i++;
    }

    // Take away transitions from all elements and save them
    const initialTransitions = [];
    els.forEach((anEl) => {
      initialTransitions.push(anEl.style.transition);
      anEl.style.transition = 'none'; // eslint-disable-line no-param-reassign
    });

    // Put everyone at translate3d(0,0,0) without transitions
    resetElementsPositions(els);

    // Add the element in the appropriate place. This will displace everyone else.
    const parent = (els[i]) ? els[i].parentElement : els[els.length - 1].parentElement;
    if (!parent || !parent.appendChild) {
      throw new Error('trackReorderDrag(): No parent found in element list.');
    } else if (els[i]) {
      parent.insertBefore(target, els[i]);
    } else {
      const lastEl = els[els.length - 1];
      parent.insertBefore(target, lastEl);
      parent.insertBefore(lastEl, target);
    }

    // Now let's translate it to where it was just before it was repositioned
    // All without transitions. It will seem like it never left that spot.
    const futureTop = documentOffset(target).top;
    const displacement = targetTop - futureTop;
    setTranslation(target, displacement);

    // Let's add a timeout to get the last place in the UI queue and let the
    // CSS renderer to process the fact that all these elements do not have
    // transitions and should appear wherever their coordinates say immediately.
    setTimeout(() => {
      // Restore all transitions
      els.forEach((anEl, k) => {
        anEl.style.transition = initialTransitions[k]; // eslint-disable-line no-param-reassign
      });

      // Now transition the target can transition smoothly from where it
      // was dropped to its final position at translate value 0.
      setTranslation(target, 0);
    }, 15);

    //  adjustElementsToTops(els, topsBeforeInsertion);
  }

  function init(e, el, elements) {
    if (typeof el !== 'object') {
      throw new Error('trackReorderDrag(): Invalid parameter');
    }

    // Reorder elements
    elements.sort((el1, el2) => {
      return documentOffset(el1).top > documentOffset(el2).top;
    });

    // Set initial states
    const initialTops = [];
    elements.forEach((element) => {
      initialTops.push(documentOffset(element).top);
    });

    const elIndex = elements.indexOf(el);

    // Create throttled drag listener
    const initialY = e.pageY;
    const dragListener = createDragListener(elements, initialTops, elIndex, initialY);
    const throttledDragListener = throttle(50, dragListener);

    // Listen to drags
    const eventTarget = e.target;
    eventTarget.addEventListener('drag', throttledDragListener);
    eventTarget.addEventListener('dragend', function dragEndListener() {
      dragListener.stop();
      insertTargetInRightPlace(elements, initialTops, elIndex);
      eventTarget.removeEventListener('drag', throttledDragListener);
      eventTarget.removeEventListener('dragend', dragEndListener);
    });
  }

  init(paramE, paramEl, paramElements);
}


text:
<?php

class Path_helper_test extends CI_TestCase
{
    public function set_up()
    {
        $this->helper('path');
    }

    public function test_set_realpath()
    {
        $this->assertEquals(getcwd().DIRECTORY_SEPARATOR, set_realpath(getcwd()));
    }

    public function test_set_realpath_nonexistent_directory()
    {
        $expected = '/path/to/nowhere';
        $this->assertEquals($expected, set_realpath('/path/to/nowhere', false));
    }

    public function test_set_realpath_error_trigger()
    {
        $this->setExpectedException(
                'RuntimeException', 'CI Error: Not a valid path: /path/to/nowhere'
        );

        set_realpath('/path/to/nowhere', true);
    }
}


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

using Mag = mko.Newton.OrderOfMagnitude;

namespace mko.Newton
{
    public partial class Energy
    {
        // Nm
        public static EnergyInNm<Mag.One> Nm(Energy Value)
        {
            return new EnergyInNm<Mag.One>(Value);
        }

        // J
        public static EnergyInJoule<Mag.Micro> MicroJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Micro>(Value);
        }

        public static EnergyInJoule<Mag.Milli> MilliJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Milli>(Value);
        }

        public static EnergyInJoule<Mag.One> Joule(Energy Value)
        {
            return new EnergyInJoule<Mag.One>(Value);
        }

        public static EnergyInJoule<Mag.Kilo> KiloJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Kilo>(Value);
        }

        public static EnergyInJoule<Mag.Mega> MegaJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Mega>(Value);
        }

        public static EnergyInJoule<Mag.Giga> GigaJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Giga>(Value);
        }

        public static EnergyInJoule<Mag.Terra> TerraJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Terra>(Value);
        }

        public static EnergyInJoule<Mag.Peta> PetaJoule(Energy Value)
        {
            return new EnergyInJoule<Mag.Peta>(Value);
        }

        // Ws
        public static EnergyInWs<Mag.Micro> MicroWs(Energy Value)
        {
            return new EnergyInWs<Mag.Micro>(Value);
        }

        public static EnergyInWs<Mag.Milli> MilliWs(Energy Value)
        {
            return new EnergyInWs<Mag.Milli>(Value);
        }

        public static EnergyInWs<Mag.One> Ws(Energy Value)
        {
            return new EnergyInWs<Mag.One>(Value);
        }

        public static EnergyInWs<Mag.Kilo> KiloWs(Energy Value)
        {
            return new EnergyInWs<Mag.Kilo>(Value);
        }

        public static EnergyInWs<Mag.Mega> MegaWs(Energy Value)
        {
            return new EnergyInWs<Mag.Mega>(Value);
        }

        public static EnergyInWs<Mag.Giga> GigaWs(Energy Value)
        {
            return new EnergyInWs<Mag.Giga>(Value);
        }

        public static EnergyInWs<Mag.Terra> TerraWs(Energy Value)
        {
            return new EnergyInWs<Mag.Terra>(Value);
        }

        public static EnergyInWs<Mag.Peta> PetaWs(Energy Value)
        {
            return new EnergyInWs<Mag.Peta>(Value);
        }

        // Wh

        public static EnergyInWh<Mag.Micro> MicroWh(Energy Value)
        {
            return new EnergyInWh<Mag.Micro>(Value);
        }

        public static EnergyInWh<Mag.Milli> MilliWh(Energy Value)
        {
            return new EnergyInWh<Mag.Milli>(Value);
        }

        public static EnergyInWh<Mag.One> Wh(Energy Value)
        {
            return new EnergyInWh<Mag.One>(Value);
        }

        public static EnergyInWh<Mag.Kilo> KiloWh(Energy Value)
        {
            return new EnergyInWh<Mag.Kilo>(Value);
        }

        public static EnergyInWh<Mag.Mega> MegaWh(Energy Value)
        {
            return new EnergyInWh<Mag.Mega>(Value);
        }

        public static EnergyInWh<Mag.Giga> GigaWh(Energy Value)
        {
            return new EnergyInWh<Mag.Giga>(Value);
        }

        public static EnergyInWh<Mag.Terra> TerraWh(Energy Value)
        {
            return new EnergyInWh<Mag.Terra>(Value);
        }

        public static EnergyInWh<Mag.Peta> PetaWh(Energy Value)
        {
            return new EnergyInWh<Mag.Peta>(Value);
        }

        // SKE

        public static EnergyInSKE SKE(Energy Value)
        {
            return new EnergyInSKE(Value);
        }

    }
}


text:
@interface MWMButtonCell ()

@property(nonatomic) IBOutlet UIButton *button;
@property(weak, nonatomic) id<MWMButtonCellDelegate> delegate;

@end

@implementation MWMButtonCell

- (void)configureWithDelegate:(id<MWMButtonCellDelegate>)delegate title:(NSString *)title {
  [self.button setTitle:title forState:UIControlStateNormal];
  self.delegate = delegate;
}

- (IBAction)buttonTap {
  [self.delegate cellDidPressButton:self];
}

@end


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>CSS Test:  font-variant-alternates: character-variant(); low level equivalence</title>
<link rel="author" title="Chris Lilley" href="chris@w3.org">
<link rel="match" href="font-variant-alternates-09-ref.html">
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-variant-alternates-prop">
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-feature-settings-prop">
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-feature-values">
<meta name="assert" content="Enables display of specific character variants (font specific, OpenType feature: cv<feature-index>">

Test passes if the three lines below are identical, with seven crosses (✗), one check mark (✓) followed by twelve crosses (✗).

Xnophijklmqrstuvwxyz

Xnophijklmqrstuvwxyz

BBBBBBBABBBBBBBBBBBB


text:
% Number of coins to flip
N = 1000;

% Number of times to flip each coin
d = 10;

% Number of iterations
iter = 100000;

% v1, vrand, and vmin for each iteration
vs = zeros (iter, 3);

for i = 1:iter
  % Flips all coins (0 = heads ; 1 = tails)
  coins = rand (N, d) >= 0.5;

  % First coin
  c1 = coins(1,:);

  % Random coin
  crand = coins(fix (unifrnd (1, N)),:);

  % Coin which had the minimum frequency of heads
  tails = sum (coins, 2);
  minheads = tails == max (tails);
  cmin = coins(find (minheads)(1),:);

  % Fraction of heads for c1
  vs(i,1) = sum (!c1) / length (c1);

  % Fraction of heads for crand
  vs(i,2) = sum (!crand) / length (crand);

  % Fraction of heads for cmin
  vs(i,3) = sum (!cmin) / length (cmin);
end

% Compute the mean for each v1, vrand, and vmin
fprintf ("Fraction of heads for c1, crand and cmin is %f, %f, and %f\n", mean (vs));