text:
define([
	"dcl/dcl", "intern!object", "intern/chai!assert", "delite/register", "dojo/dom-class", "deliteful/Button"
], function (dcl, registerSuite, assert, register, domClass, Button) {

	var container, html = "<button is='d-button' id='b1'>b1</button>" +
		"<button is='d-button' id='b2' value='foo'>b2</button>" +
		"<button is='d-button' id='b3' iconClass='ic1'>b3</button>" +
		"<button is='d-button' id='b4' iconClass='ic1' label='on'>off</button>";

	var commonSuite = {

		"Default State": function () {
			var b = document.getElementById("b1");
			b.deliver();
			assert.isTrue(domClass.contains(b, "d-button"), "Unexpected baseClass.");
			assert.isFalse(b.disabled, "Unexpected default value for 'disabled' property");
			assert.strictEqual("b1", b.label, "Unexpected default value for 'label' (inherited) property.");
			assert.strictEqual("b1", b.textContent, "Unexpected default value for textContent.");

			var b2 = document.getElementById("b2");
			b2.deliver();
			assert.strictEqual(b2.value, "foo",
				"Unexpected default value for 'value' property if 'value' specified/unchecked");

			b = document.getElementById("b3");
			b.deliver();
			assert.strictEqual("b3", b.label, "Unexpected default value for 'label' (inherited) property.");
			assert.strictEqual("b3", b.textContent, "Unexpected default value for textContent [2].");
			assert.strictEqual("ic1", b.iconClass, "Unexpected default value for iconClass.");
			assert.isTrue(/ic1/.test(b.iconNode.className), "Missing icon css class on iconNode.");
		},

		"label": function () {
			var b4 = document.getElementById("b4");
			b4.deliver();
			assert.strictEqual("on", b4.label, "Unexpected value for textContent after label set.");
			assert.strictEqual("on", b4.textContent, "Unexpected value for textContent after label set.");
			b4.label = "b4";
			b4.deliver();
			assert.strictEqual("b4", b4.label, "Unexpected value for textContent after label set.");
			assert.strictEqual("b4", b4.textContent, "Unexpected value for textContent after label set.");
		},

		"iconClass": function () {
			var b4 = document.getElementById("b4");
			// test label is properly updated according to checked state when checkedLabel is set a value
			b4.iconClass = "ic3";
			b4.deliver();
			assert.isTrue(/ic3/.test(b4.iconNode.className), "Unexpected value for css class on iconNode (b4) [2].");
		},

		"value": function () {
			var b = document.getElementById("b1");
			b.value = "foo";
			assert.strictEqual(b.value, "foo", "Unexpected value for 'value' attribute.");
		},

		afterEach: function () {
			container.parentNode.removeChild(container);
		}
	};

	// Markup
	var suite = {
		name: "deliteful/Button: markup",
		beforeEach: function () {
			container = document.createElement("div");
			document.body.appendChild(container);
			container.innerHTML = html;
			register.parse();
		}
	};
	dcl.mix(suite, commonSuite);
	registerSuite(suite);

	suite = {
		name: "deliteful/Button: programmatic",
		beforeEach: function () {
			container = document.createElement("div");
			document.body.appendChild(container);
			var b = new Button({id: "b1", label: "b1"});
			container.appendChild(b);
			b.startup();
			b = new Button({id: "b2", value: "foo", label: "b2"});
			container.appendChild(b);
			b.startup();
			b = new Button({id: "b3", label: "b3", iconClass: "ic1"});
			container.appendChild(b);
			b.startup();
			b = new Button({id: "b4", label: "on", iconClass: "ic1"});
			container.appendChild(b);
			b.startup();
		}
	};
	dcl.mix(suite, commonSuite);
	registerSuite(suite);
});


text:
import React from "react";
import { iterator } from "@times-components/test-utils";
import * as Icons from "../src/icons";

export default renderMethod => {
  const tests = [];

  Object.entries(Icons).forEach(([name, Icon]) => {
    tests.push({
      name: `${name} renders with different colours`,
      test() {
        const stroke = "#c0ffee";
        const fill = "#facade";

        const output = renderMethod(
          <Icon fillColour={fill} height={50} strokeColour={stroke} />
        );

        expect(output).toMatchSnapshot();
      }
    });
  });

  iterator(tests);
};

redpajama_set_name: RedPajamaGithub


text:
Rails.application.routes.draw do
  mount Surveyor::Engine => "/surveys", :as => "surveyor"

  #root "welcome#{index}"
  get "welcome/index"

  unless Rails.env.production?
    match '/emulator(/*path)', :controller => 'emulator', :action => 'index'
  end

end


text:
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2007
 *
 *  Last modified:
 *     $Date$ by $Author$
 *     $Revision$
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  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.
 *
 */

#include <gecode/int/channel.hh>

namespace Gecode { namespace Int { namespace Channel {

  /// Iterates the values to be removed as defined by an array of Boolean views
  class BoolIter {
  private:
    /// The array of Boolean views
    const ViewArray<BoolView>& x;
    /// The offset
    const int o;
    /// Current position in the array
    int i;
  public:
    /// Initialize iterator
    BoolIter(const ViewArray<BoolView>& x0, int o0);
    /// Test whether further values available
    bool operator ()(void) const;
    /// Return value
    int val(void) const;
    /// Move to the next value
    void operator ++(void);
  };

  forceinline
  BoolIter::BoolIter(const ViewArray<BoolView>& x0, int o0) :
    x(x0), o(o0), i(0) {
    while ((i<x.size()) && !x[i].zero())
      i++;
  }
  forceinline bool
  BoolIter::operator ()(void) const {
    return i<x.size();
  }
  forceinline int
  BoolIter::val(void) const {
    assert(x[i].zero());
    return i+o;
  }
  forceinline void
  BoolIter::operator ++(void) {
    do {
      i++;
    } while ((i<x.size()) && !x[i].zero());
  }

  forceinline
  LinkMulti::LinkMulti(Space& home, bool share, LinkMulti& p)
    : MixNaryOnePropagator<BoolView,PC_BOOL_NONE,IntView,PC_INT_DOM>
  (home,share,p), status(S_NONE), o(p.o) {
    assert(p.status == S_NONE);
    c.update(home,share,p.c);
  }

  Actor*
  LinkMulti::copy(Space& home, bool share) {
    return new (home) LinkMulti(home,share,*this);
  }

  forceinline size_t
  LinkMulti::dispose(Space& home) {
    Advisors<Advisor> as(c);
    x.cancel(home,as.advisor());
    c.dispose(home);
    (void) MixNaryOnePropagator<BoolView,PC_BOOL_NONE,IntView,PC_INT_DOM>
      ::dispose(home);
    return sizeof(*this);
  }

  PropCost
  LinkMulti::cost(const Space&, const ModEventDelta& med) const {
    if ((status == S_ONE) || (IntView::me(med) == ME_INT_VAL))
      return PropCost::unary(PropCost::LO);
    else
      return PropCost::linear(PropCost::LO, x.size());
  }

  ExecStatus
  LinkMulti::advise(Space&, Advisor&, const Delta& d) {
    if (status == S_RUN)
      return ES_FIX;
    // Detect a one
    if (BoolView::one(d))
      status = S_ONE;
    return ES_NOFIX;
  }

  ExecStatus
  LinkMulti::propagate(Space& home, const ModEventDelta& med) {
    int n = x.size();

    // Always maintain the invariant that y lies inside the x-array
    assert((y.min()-o >= 0) && (y.max()-o < n));

    if (y.assigned()) {
      status = S_RUN;
      int j=y.val()-o;
      GECODE_ME_CHECK(x[j].one(home));
      for (int i=0; i<j; i++)
        GECODE_ME_CHECK(x[i].zero(home));
      for (int i=j+1; i<n; i++)
        GECODE_ME_CHECK(x[i].zero(home));
      return home.ES_SUBSUMED(*this);
    }

    // Check whether there is a one
    if (status == S_ONE) {
      status = S_RUN;
      for (int i=0; true; i++)
        if (x[i].one()) {
          for (int j=0; j<i; j++)
            GECODE_ME_CHECK(x[j].zero(home));
          for (int j=i+1; j<n; j++)
            GECODE_ME_CHECK(x[j].zero(home));
          GECODE_ME_CHECK(y.eq(home,i+o));
          return home.ES_SUBSUMED(*this);
        }
      GECODE_NEVER;
    }

    status = S_RUN;

  redo:

    // Assign all Boolean views to zero that are outside bounds
    {
      int min=y.min()-o;
      for (int i=0; i<min; i++)
        GECODE_ME_CHECK(x[i].zero(home));
      x.drop_fst(min); o += min; n = x.size();

      int max=y.max()-o;
      for (int i=max+1; i<n; i++)
        GECODE_ME_CHECK(x[i].zero(home));
      x.drop_lst(max); n = x.size();
    }

    {
      // Remove zeros on the left
      int i=0;
      while ((i < n) && x[i].zero()) i++;
      if (i >= n)
        return ES_FAILED;
      x.drop_fst(i); o += i; n = x.size();
    }

    {
      // Remove zeros on the right
      int i=n-1;
      while ((i >= 0) && x[i].zero()) i--;
      assert(i >= 0);
      x.drop_lst(i); n = x.size();
    }

    assert(n >= 1);

    // Is there only one left?
    if (n == 1) {
      GECODE_ME_CHECK(x[0].one(home));
      GECODE_ME_CHECK(y.eq(home,o));
      return home.ES_SUBSUMED(*this);
    }

    // Update bounds
    GECODE_ME_CHECK(y.gq(home,o));
    GECODE_ME_CHECK(y.lq(home,o+n-1));
    if ((y.min() > o) || (y.max() < o+n-1))
      goto redo;

    assert((n >= 2) && x[0].none() && x[n-1].none());
    assert((y.min()-o == 0) && (y.max()-o == n-1));

    // Propagate from y to Boolean views
    if ((IntView::me(med) == ME_INT_BND) || (IntView::me(med) == ME_INT_DOM)) {
      ViewValues<IntView> v(y);
      int i=0;
      do {
        int j = v.val()-o;
        if (i < j) {
          GECODE_ME_CHECK(x[i].zero(home));
          ++i;
        } else if (i > j) {
          ++v;
        } else {
          assert(i == j);
          ++i; ++v;
        }
      } while (v() && (i < n));
    }

    // Propagate from Boolean views to y
    if (BoolView::me(med) == ME_BOOL_VAL) {
      BoolIter bv(x,o);
      GECODE_ME_CHECK(y.minus_v(home,bv,false));
    }
    status = S_NONE;
    return ES_FIX;
  }

}}}

// STATISTICS: int-prop


text:
<?php

namespace vitex\service\model;

use vitex\service\model\exception\FieldNotAllowNullException;
use vitex\service\model\exception\FieldNotMatchException;

/**
 * 数据类型  会对插入数据库的类型进行初步的检测
 * @package vitex\service\model
 */
class DataType
{
    //INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT   FLOAT, DOUBLE   DECIMAL, NUMERIC

    /**
     * 类型
     */
    const TYPE = [
        'INT'=>'intval',
        'TINYINT'=>'intval',
        'SMALLINT'=>'intval',
        'MEDIUMINT'=>'intval',
        'BIGINT'=>'intval',
        'FLOAT'=>'floatval',
        'DOUBLE'=>'doubleval',
        'DECIMAL'=>'doubleval',

        'DATE'=>'date',
        'TIME'=>'time',
        'YEAR'=>'year',
        'DATETIME'=>'datetime',
        'TIMESTAMP'=>'timestamp',
        'CHAR'=>'text',
        'VARCHAR'=>'text',
        'TINYTEXT'=>'text',
        'TEXT'=>'text',
        'MEDIUMTEXT'=>'text',
        'LONGTEXT'=>'text',

        'GEOMETRY'=>'text',
        'POINT'=>'text',
        'LINESTRING'=>'text',
        'POLYGON'=>'text',
        'MULTIPOINT'=>'text',
        'MULTILINESTRING'=>'text',
        'MULTIPOLYGON'=>'text',
        'GEOMETRYCOLLECTION'=>'text'
    ];

    /**
     * null
     * @param $val
     * @param $null
     * @throws FieldNotAllowNullException
     */
    private function null($val, $null)
    {
        if (!$null && $val == null) {
            throw new FieldNotAllowNullException();
        }
    }

    public function intval($val, $null = false)
    {
        $this->null($val, $null);
        if (!preg_match('/^[0-9]+$/', $val)) {
            throw new FieldNotMatchException($val);
        }
        return intval($val);
    }

    public function floatval($val, $null = false)
    {
        $this->null($val, $null);
        if (!preg_match('/^[0-9\\.]+$/', $val)) {
            throw new FieldNotMatchException($val);
        }
        return floatval($val);
    }

    public function doubleval($val, $null = false)
    {
        $this->null($val, $null);
        if (!preg_match('/^[0-9\\.]+$/', $val)) {
            throw new FieldNotMatchException($val);
        }
        return floatval($val);
    }

    public function date(string $val, $null = false)
    {
        $this->null($val, $null);
        if (strtotime($val) === false) {
            throw new FieldNotMatchException($val);
        }
        return $val;
    }

    public function time(string $val, $null = false)
    {
        $this->null($val, $null);
        return $val;

    }

    public function year(string $val, $null = false)
    {
        $this->null($val, $null);
        if (!preg_match('/^[0-9]+$/', $val)) {
            throw new FieldNotMatchException($val);
        }
        return intval($val);

    }

    public function datetime(string $val, $null = false)
    {
        $this->null($val, $null);
        if (strtotime($val) === false) {
            throw new FieldNotMatchException($val);
        }
        return $val;
    }

    public function timestamp(string $val, $null = false)
    {
        $this->null($val, $null);
        if (strtotime($val) === false) {
            throw new FieldNotMatchException($val);
        }
        return $val;
    }

    public function text(string $val, $null = false)
    {
        $this->null($val, $null);
        return $val;
    }
}


text: export { default } from './WikiToggle';


text:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # http://stackoverflow.com/questions/59895
export PYTHONPATH=~/python-packages/lib/python2.6/site-packages
export PATH=~/python-packages/bin:$PATH
alias monit="monit -c $DIR/servers/monitrc"


text:
var option1 = document.getElementById("box1");
var option1Selected = option1.options[option1.selectedIndex].text

option1.addEventListener("change", function(){
	option1Selected = option1.options[option1.selectedIndex].text;
});

option2.addEventListener("change", function(){
	option2Selected = option2.options[option2.selectedIndex].text;
})

function redirect () {
	if (TandooriChicken){
		location.href="Tandoori.html";
	}

	else if (Chicken){
		location.href="Chicken.html";
	}

	else if (DinnerSpecials){
		location.href="DinnerSpecials.html";
	}

	else if (CurryDishes){
		location.href="CurryDishes.html";
	}

	else if (CombinationDinner){
		location.href="CombinationDinner.html";
	}

	else if (SideOrders){
		location.href="SideOrders.html";
	}

	else if (Beverages){
		location.href="Beverages.html";
	}

	else(Dessert){
		location.href="Dessert.html";
	}
}


text:
pub mod capabilities;
pub mod types;
pub mod visitor;


text:
layout: data_model
title: ICMPv4TimestampRequestType
this_version: 1.1.1
---

  Heads up! These docs are for STIX 1.1.1, which is not the latest version (1.2). View the latest!

ICMPv4TimestampRequestTypeNetwork Packet Object Schema

Time Stamp Request informational message; ICMP type=13.

      <form id="nav-version">
        <select>

            <option value="1.2" >STIX 1.2</option>

            <option value="1.1.1" selected="selected">STIX 1.1.1</option>

            <option value="1.1" >STIX 1.1</option>

            <option value="1.0.1" >STIX 1.0.1</option>

            <option value="1.0" >STIX 1.0</option>

        </select>
      </form>

Fields

      Field Name
      Type
      Description

      Timestamp0..1

          boolean

This is the only subtype of a timestamp request message (code=0).

      Originate_Timestamp0..1

          UnsignedIntegerObjectPropertyType

32-bits; number of ms since midnight UT. The originate timestamp is the time the sender last touched the message before sending it. If the time is not available in milliseconds or cannot be provided with respect to midnight UT, then any time can be inserted in a timestamp provided the high order bit of the timestamp is also set to indicate this non-standard value.


text:
package uk.theretiredprogrammer.marktimingsrecorder.nodes;

import uk.theretiredprogrammer.marktimingsrecorder.dataobjects.Race;
import uk.theretiredprogrammer.marktimingsrecorder.dataobjects.Raceentry;
import java.awt.datatransfer.DataFlavor;
import java.io.IOException;
import java.util.List;
import javax.swing.Action;
import uk.theretiredprogrammer.nbpcglibrary.annotations.UseCommonNodeAction;
import uk.theretiredprogrammer.nbpcglibrary.annotations.UseCommonNodeActions;
import uk.theretiredprogrammer.nbpcglibrary.data.entity.*;
import uk.theretiredprogrammer.nbpcglibrary.node.nodes.*;
import uk.theretiredprogrammer.nbpcglibrary.node.properties.*;
import uk.theretiredprogrammer.nbpcglibrary.api.LogicException;
import org.openide.nodes.PropertySupport;
import uk.theretiredprogrammer.marktimingsrecorder.dataobjects.Raceentry.RaceentryField;

/**
 * Node for RaceentryNode.
 *
 * (Class generated by NetBeans Platform Code Generator tools using script.xml.
 * Do not edit this file. Apply any changes to the definition file and
 * regenerate all files.)
 *
 * @author Richard Linsdale (richard at theretiredprogrammer.uk)
 */
public class RaceentryNode extends TreeNode<Integer, Raceentry, Race, RaceentryField> {

    /**
     * Data Flavor for Nodes of type RaceentryNode
     */
    public static final DataFlavor RACEENTRYNODE_FLAVOR = new DataFlavor(RaceentryNode.class, "RaceentryNode");

    /**
     * Constructor
     *
     * @param e the entity associated with this node
     */
    public RaceentryNode(Raceentry e) {
        super("RaceentryNode", e, Raceentry.EM.class, CAN_COPY | CAN_DELETE | CAN_CUT);
    }

    @UseCommonNodeActions({
        @UseCommonNodeAction(id = "uk.theretiredprogrammer.nbpcglibrary.node.actions.NodeCutAction",
                node = "RaceentryNode",
                position = 850, separator = 800),
        @UseCommonNodeAction(id = "uk.theretiredprogrammer.nbpcglibrary.node.actions.NodeCopyAction",
                node = "RaceentryNode", position = 870),
        @UseCommonNodeAction(id = "uk.theretiredprogrammer.nbpcglibrary.node.actions.NodeDeleteAction",
                node = "RaceentryNode", position = 890),})
    private static void useCommonNodeActions() {
    } // a dummy method

    @Override
    protected DataFlavor nodeGetDataFlavor() {
        return RACEENTRYNODE_FLAVOR;
    }

    /**
     * Get the node display name
     *
     * @return the display name
     */
    @Override
    public String getDisplayName() {
        return getEntity() != null ? getEntity().getDisplayName() : "#undefined#";
    }

    /**
     * Get the node display title
     *
     * @return the display title
     */
    @Override
    public String getDisplayTitle() {
        return getEntity() != null ? getEntity().getDisplayTitle() : "#undefined#";
    }

    StringReadonlyProperty entryproperty;
    StringReadonlyProperty raceproperty;
    StringReadonlyProperty idproperty;
    StringReadonlyProperty createdbyproperty;
    StringReadonlyProperty createdonproperty;
    StringReadonlyProperty updatedbyproperty;
    StringReadonlyProperty updatedonproperty;

    @Override
    protected List<PropertySupport.ReadOnly<?>> createPropertyItems(List<PropertySupport.ReadOnly<?>> props) {
        Raceentry e = getEntity();
        if (e != null) {
            props.add(new StringReadonlyProperty("Node Type", "RaceentryNode"));
            props.add(entryproperty = new StringReadonlyProperty("Entry", e.formatEntry()));
            props.add(raceproperty = new StringReadonlyProperty("Race", e.formatRace()));
            props.add(idproperty = new StringReadonlyProperty("Id", e.formatId()));
            props.add(createdbyproperty = new StringReadonlyProperty("Created by", e.formatCreatedby()));
            props.add(createdonproperty = new StringReadonlyProperty("Created on", e.formatCreatedon()));
            props.add(updatedbyproperty = new StringReadonlyProperty("Updated by", e.formatUpdatedby()));
            props.add(updatedonproperty = new StringReadonlyProperty("Updated on", e.formatUpdatedon()));
        }
        return props;
    }

    @Override
    protected void nodeProcessFieldChange(RaceentryField field) {
        Raceentry e = getEntity();
        if (field == null) {
            if (e != null && idproperty != null) {
                entryproperty.update(e.formatEntry());
                raceproperty.update(e.formatRace());
                idproperty.update(e.formatId());
                createdbyproperty.update(e.formatCreatedby());
                createdonproperty.update(e.formatCreatedon());
                updatedbyproperty.update(e.formatUpdatedby());
                updatedonproperty.update(e.formatUpdatedon());
                propertyChange();
            }
        } else {
            switch (field) {
                case ENTRY:
                    if (e != null && entryproperty != null) {
                        entryproperty.update(e.formatEntry());
                        propertyChange("Entry");
                    }
                    break;
                case RACE:
                    if (e != null && raceproperty != null) {
                        raceproperty.update(e.formatRace());
                        propertyChange("Race");
                    }
                    break;
            }
        }
    }

    @Override
    protected void nodeCutPaste(BasicNode child) throws IOException {
        CoreEntity e = child.getEntity();
        addNewChild(e);
    }

    @Override
    protected void nodeCopyPaste(BasicNode child) throws IOException {
        CoreEntity e = child.getEntity();
        addNewChild(e);
    }

    private void addNewChild(CoreEntity e) {
        throw new LogicException("Raceentry Entity does not have a child of the requested class (" + e.getClass().getSimpleName() + ")");
    }

    @Override
    protected void nodeDelete() throws IOException {
        getEntity().remove();
    }

    @Override
    protected void nodeReorderChildByFlavor(DataFlavor df, int[] perm) {
    }

    @Override
    public Action getPreferredAction() {
        return findDefaultAction("RaceentryNode");
    }

    @Override
    public Action[] getActions(boolean context) {
        return findActions("RaceentryNode");
    }
}


text:
FROM rust:1.29.1

ADD ./ /nickel
WORKDIR /nickel

RUN cargo clean
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release

CMD ./target/release/nickel


text:
@interface BIPActionsheetTests : XCTestCase

@end

@implementation BIPActionsheetTests

- (void)setUp {
    [super setUp];

}

- (void)testInitWithEmptyItems {

    BIPActionSheet *actionSheet = [[BIPActionSheet alloc] initWithItems:@[] cancelButtonTitle:@"Cancel" cancelHandler:nil];
    XCTAssertNotNil(actionSheet);
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end


text:
package elasta.composer.flow.holder;

import elasta.core.flow.Flow;
import lombok.Builder;
import lombok.Value;

import java.util.Objects;

/**
 * Created by sohan on 6/30/2017.
 */
@Value
@Builder
final public class AddAllFlowHolder {
    final Flow flow;

    public AddAllFlowHolder(Flow flow) {
        Objects.requireNonNull(flow);
        this.flow = flow;
    }
}


text:
package com.songcaster.main;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class SongCasterBroadcastReceiver extends BroadcastReceiver{

	@Override
	public void onReceive(Context context, Intent intent) {
		// The notification when received will trigger this class
	}
}


text:
package main

import (
	"encoding/json"
	"os"

	"github.com/enaml-ops/pluginlib/pluginutil"
)

const passLength = 20

func main() {
	fieldnames := []string{
		"router-pass",
		"nats-pass",
		"mysql-admin-password",
		"mysql-bootstrap-password",
		"mysql-proxy-api-password",
		"cc-staging-upload-password",
		"cc-bulk-api-password",
		"cc-internal-api-password",
		"db-uaa-password",
		"db-ccdb-password",
		"db-console-password",
		"diego-db-passphrase",
		"uaa-ldap-user-password",
		"admin-password",
		"push-apps-manager-password",
		"smoke-tests-password",
		"system-services-password",
		"system-verification-password",
		"system-passwords-client-secret",
		"doppler-shared-secret",
		"ssh-proxy-uaa-secret",
		"metron-secret",
		"uaa-admin-secret",
		"opentsdb-firehose-nozzle-client-secret",
		"identity-client-secret",
		"login-client-secret",
		"portal-client-secret",
		"autoscaling-service-client-secret",
		"cc-service-dashboards-client-secret",
		"doppler-client-secret",
		"gorouter-client-secret",
		"notifications-client-secret",
		"notifications-ui-client-secret",
		"cloud-controller-username-lookup-client-secret",
		"cc-routing-client-secret",
		"ssh-proxy-client-secret",
		"apps-metrics-client-secret",
		"apps-metrics-processing-client-secret",
		"consul-encryption-key",
		"cc-db-encryption-key",
		"host-key-fingerprint",
		"uaa-jwt-signing-key",
		"uaa-jwt-verification-key",
		"uaa-saml-service-provider-key",
	}

	passVault := make(map[string]string)
	for _, fn := range fieldnames {
		passVault[fn] = pluginutil.NewPassword(passLength)
	}
	json.NewEncoder(os.Stdout).Encode(passVault)
}


text:
layout: doc
title: JOSM Relations
permalink: /it/editing/josm-relations/
lang: it
category: editing
---

Relations
==========
In the [Beginner's Guide](/en/beginner) we explained that there are three
types of objects that can be drawn in OpenStreetMap - points (nodes), lines (ways), and
polygons (closed ways). Lines contain numerous points, and the line itself carries
the attributes that define what it represents.  Polygons are the same as
lines, except that the the line must finish where it begins in order to
form a shape.

In fact, we lied to you, because there is one other type of object in OpenStreetMap,
called relations.  In the same way that a line consists of other
points, a relation contains a group of other objects, be they points,
lines, or polygons.  If you are looking to advance your editing
skills, then understanding and knowing how to properly edit relations is
important.

For example, imagine that you want to map a building that has courtyards
in the center.  You would need to draw a polygon around the outside of
the building, and you would want other polygons around the courtyards
to indicate that they are not part of the building.  This is an example
of a relation.  The relation would contain several polygons - and the
attributes of the building would be attached to the relation, not the
polygons.

![multipolygon demo][]

Relations are used to represent anything that requires a collection of
objects to define.  Other examples are bus routes (a collections of
lines), long and complex objects (rivers or roads), or multiple polygons
that are all part of one location (like buildings in a university).

There are mainly four types of relations you will encounter in OSM:
Multipolygons, Routes, Boundaries, and Restrictions (such as, no left
turns).  In this section we will cover Multipolygons and Routes.

Creating Multipolygon Relations
-------------------------------
Let's see how to create a multipolygon relation like the one shown above.

-   First, draw your shapes. In this case we will draw three polygons, an
    outer rectangle, and two smaller rectangles.

![multipolygon ways][]

-   Select all of the polygons. Remember you can select multiple objects
    by holding SHIFT and clicking on each.
-   Go to *Presets->Man Made->Man Made->Building*.

![building preset][]

-   Click on "New Relation."

![new relation][]

-   You should now see the relations window. This is a little bit complex
    because now you are adding tags to a collection of ways.

![building relation][]

-   Observe that at the top of the panel are the tags for the relation. These tags
    work the same way as tags always work.
-   At the bottom is a list of the members of the relation. This relation has
    three members - that is, the three ways that are part of our relation.
-   We need to do a couple things to finish defining our multipolygon. First,
    notice that because we used the building preset we already have one tag
    defined for us, *building=yes*. We need to add one more tag that defines
    the **type** of the relation. We must add a tag that says *type=multipolygon*.
-   Click in the tag box and add this tag.

![type multipolygon][]

-   Next we need to define what are called **roles**. Each member of a relation
    has a role, which indicates what that member's purpose is. In this case, the
    role of the outside polygon must be defined as **outer** and the role of the
    two inner polygons must be defined as **inner**. These are the roles that are
    available for members of a multipolygon.
-   In the lower left panel select each member in the list. You can see the member
    that is selected will be highlighted in the map window. Enter **outer** and
    **inner** for the correct polygons.

![outer inner][]

-   Click OK and your multipolygon relation is complete!

![new multipolygon][]

When you create a multipolygon like this it will be rendered on the map like so:

![multipolygon mapnik][]

Multipolygons can be used for any complex object that requires inner and outer polygons, like
a building or a river with patches of land inside it. Detailed multipolygon information can be
found on the [OSM Wiki](http://wiki.openstreetmap.org/wiki/Relation:multipolygon).

Route Relations
----------------
Relations are also very useful for representing long routes. For example, a bus
or bicycle route follows various road segments. To define such a route, we can
create a relation which contains all of the road segments that are part of the route.
Additional features, such as bus stops can also be members of a route relation.

![route relation][]

Let's see how to create a relation for a bus route in JOSM:

-   First, select all of the ways which the route runs along. You may need to
    split some streets into separate segments if only part of them belong to
    the relation. You can do this using the "Split Way" tool.
-   When all the segments are selected, go to *Presets->Transport->Public Transport->
    Public transport route*.

![public transport preset][]

-   Next to Route type, select "bus."
-   Click "New Relation." You will see the relation window pop up, just as when
    you create a multipolygon.

![bus route relation][]

-   Notice that there are already tags which define the relation as a route. Instead
    of *type=multipolygon*, we have *type=route*. We also have a tag defining it as
    a bus route, as opposed to another type of route.
-   You may now think, what should the **role** of the members be? Well, in the case
    of a route, we don't need to define the role of the members. By leaving the role blank
    the software knows that they are simply part of the route. We could also define the role
    of each segment as **route**, but it is not necessary.
-   Click OK and your route relation will be complete!

>   If you want a list of all the relations on the map, you can open the relations panel
>   by clicking on this button on the left:
>   ![relation panel button][]
>   This will open a panel where you can select, edit, and create new relations.

Summary
-------
Relations can be difficult to understand and do not need to be used often,
but they are necessary to know about. Every so often you may realize that you
need a relation to map something correctly, and you can use this knowledge, and find
more information on the OSM Wiki, to help you map relations correctly.

[multipolygon ways]: /images/en/editing/josm-relations/multipolygon-ways.png
[building preset]: /images/en/editing/josm-relations/building-preset.png
[new relation]: /images/en/editing/josm-relations/new-relation.png
[building relation]: /images/en/editing/josm-relations/building-relation.png
[new relation]: /images/en/editing/josm-relations/new-relation.png
[type multipolygon]: /images/en/editing/josm-relations/type-multipolygon.png
[outer inner]: /images/en/editing/josm-relations/outer-inner.png
[new multipolygon]: /images/en/editing/josm-relations/new-multipolygon.png
[multipolygon mapnik]: /images/en/editing/josm-relations/multipolygon-mapnik.png
[multipolygon demo]: /images/en/editing/josm-relations/multipolygon-demo.png
[route relation]: /images/en/editing/josm-relations/route-relation.png
[public transport preset]: /images/en/editing/josm-relations/public-transport-preset.png
[bus route relation]: /images/en/editing/josm-relations/bus-route-relation.png
[relation panel button]: /images/en/editing/josm-relations/relation-panel-button.png


text:
# DEPRECIATED

MaterialScrollBar has been moved to [MaterialScrollbar2](https://github.com/wynneplaga/materialScrollbar2). MaterialScrollbar2 has been re-written in Kotlin and should be generally faster and easier to use. This repo will be moved over to that address in the coming months. See you there!

-
-
-
-
-
-
-
-
-

[![Apache 2.0](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![](https://jitpack.io/v/turing-tech/MaterialScrollBar.svg)](https://jitpack.io/#turing-tech/MaterialScrollBar) [![Version](https://img.shields.io/badge/API-11%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=7) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-MaterialScrollBar-blue.svg?style=flat)](https://android-arsenal.com/details/1/2441)

An Android library that brings the Material Design 5.1 scrollbar to pre-5.1 devices. Designed for Android's `recyclerView`.

![](sample.png)

[Video](https://youtu.be/F5glJeAFnA4)

[Image Preview](http://imgur.com/a/2SSeY)

[Google Play - Test Out the App](https://play.google.com/store/apps/details?id=com.turingtechnologies.materialscrollbardemo)

[Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UH23JHQ8K4U2C)

## Table of Contents
1. [Gradle](https://github.com/turing-tech/MaterialScrollBar#gradle)
2. [Documentation](https://github.com/turing-tech/MaterialScrollBar#documentation)
    1. [How to use](https://github.com/turing-tech/MaterialScrollBar#how-to-use)
    2. [My recyclerView elements aren't all the same size! What do I do?](https://github.com/turing-tech/MaterialScrollBar#my-recyclerview-elements-arent-all-the-same-size-what-do-i-do)
    3. [Indicators](https://github.com/turing-tech/MaterialScrollBar#indicators)
    4. [Specific Indicators](https://github.com/turing-tech/MaterialScrollBar#specific-indicators)
3. [License](https://github.com/turing-tech/MaterialScrollBar#license)

## Gradle

```gradle
allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
```

```gradle
dependencies {
    // Will be moved to 'com.github.wynneplaga:MaterialScrollBar:13.+' on July 1, 2022
    // If it is after the date, update the line below
    implementation 'com.github.turing-tech:MaterialScrollBar:13.+'
}
```
## Documentation

Note: All customisation methods (`setAutoHide`, `setBarColor`, etc) return the `materialScrollBar`, so they can be chained together if wanted. Alternatively, you can just operate on a variable.

### How to use

The library comes in two flavours, drag and touch. Try both out to see which you prefer.

Option 1 - Drag

```xml
<com.turingtechnologies.materialscrollbar.DragScrollBar
    android:id="@+id/dragScrollBar"
    android:layout_width="wrap_content"
    app:msb_recyclerView="@id/recyclerView"
    app:msb_lightOnTouch="[[boolean]]"
    android:layout_height="match_parent" />
```

or

Option 2 - Touch

```xml
<com.turingtechnologies.materialscrollbar.TouchScrollBar
    android:id="@+id/touchScrollBar"
    android:layout_width="wrap_content"
    app:msb_recyclerView="@id/recyclerView"
    app:msb_lightOnTouch="[[boolean]]"
    android:layout_height="match_parent" />
```

Additonal optional attributes:

* msb_handleColor - Color
* msb_barColor - Color
* msb_handleOffColor - Color
* msb_textColor - Color
* msb_barThickness - Integer
* msb_rightToLeft - Boolean

Please note that for both of these configurations, both recyclerView and lightOnTouch* must have a valid value. The recyclerView attribute should point to the id of the `recyclerView` to which you want to link the scrollbar.

\* lightOnTouch behaves like this: A value of true will cause the handle to be grey until pressed, when it will become the normal accent color (as set). A value of false will cause the handle to always have the accent color, even when not being pressed.

------

### My recyclerView elements aren't all the same size! What do I do?

If you are in the situation of using headers of one size and elements of another, we've developed a solution speicifcally for you. Please follow the tutorial [here](https://github.com/krimin-killr21/MaterialScrollBar/wiki/Header-Tutorial).

If you are in some other situation where you're elements are differently sized, implement [ICustomScroller](https://github.com/turing-tech/MaterialScrollBar/blob/master/lib/src/main/java/com/turingtechnologies/materialscrollbar/ICustomScroller.java) in your adapter and complete the included methods.

------

### Indicators

To add an indicator, simply add the following line of code:

```java
scrollBar.setIndicator({{Indicator}}, {{addSpace}});
```

The indicator should be either `AlphatbetIndicator`, `DateAndTimeIndicator`, or `CustomIndicator`. See below for specific instructions per indicator.

`{{addSpace}}` is a boolean which indicates whether there should be space in between the indicator and the bar. True adds space, as in the latest version of the Google Launcher, while false adds no space, as in the Android 5.1 system scrollbars.

To use an indicator, you **MUST** make your `recyclerView`'s adapter implement the relevant interface. If you do not, the library will throw a runtime error informing you of your mistake. See documentation for the relevant interface.

------

### Specific Indicators
**AlphabetIndicator**

**Required Interface:** `INameableAdapter`

To implement an `AlphabetIndicator`, which displays one character usually corresponding to the first letter of each item, add the following to the end of your scroll bar instantiation, or add it as a seperate line.
```java
...setIndicator(new AlphabetIndicator(this));
```

**DateAndTimeIndicator**

**Required Interface:** `IDateableAdapter`

To implement a `DateAndTimeIndicator`, which displays any combination of time, day of the month, month, and year, add the following to the end of your scroll bar instantiation, or add it as a seperate line.
```java
...setIndicator(new DateAndTimeIndicator(this, {{includeYear}}, {{includeMonth}}, {{includeDay}}, {{includeTime}}));
```

All of the arguments are booleans (except for this first one obviously). The indicator will dynamically size, add punctuation, and localise for you. All you need to do is provide a `Date` object for each element in your adapter. You should almost always use miliseconds since the epoch unless you have a good reason not to. Otherwise, the library might crash.

**CustomIndicator**

**Required Interface:** `ICustomAdapter`

To implement a `CustomIndicator`, which displays any text you want, add the following to the end of your scroll bar instantiation, or add it as a seperate line.
```java
...setIndicator(new CustomIndicator(this));
```

## License

Material Scroll Bar:

    Copyright 2016-2021 Wynne Plaga.

    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.

    This licensing is applicable to all code offered as part of this
    repository, which can be identified by the lisence notice preceding
    the content AND/OR by its inclusion in a package starting with "com.
    turingtechnologies.materialscrollbar".

RecyclerView-FastScroll:

     Copyright (C) 2016 Tim Malseed

    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.

Launcher 3:

     Copyright (C) 2010 The Android Open Source Project

    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.


text:
package org.jivesoftware.openfire.group;

import java.io.Serializable;
import java.util.*;

import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import org.apache.commons.lang3.StringUtils;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.event.GroupEventDispatcher;
import org.jivesoftware.openfire.event.GroupEventListener;
import org.jivesoftware.openfire.event.UserEventDispatcher;
import org.jivesoftware.openfire.event.UserEventListener;
import org.jivesoftware.openfire.user.User;
import org.jivesoftware.util.CacheableOptional;
import org.jivesoftware.util.SystemProperty;
import org.jivesoftware.util.cache.Cache;
import org.jivesoftware.util.cache.CacheFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.packet.JID;

/**
 * Manages groups.
 *
 * @see Group
 * @author Matt Tucker
 */
public class GroupManager {

    public static final SystemProperty<Class> GROUP_PROVIDER = SystemProperty.Builder.ofType(Class.class)
        .setKey("provider.group.className")
        .setBaseClass(GroupProvider.class)
        .setDefaultValue(DefaultGroupProvider.class)
        .addListener(GroupManager::initProvider)
        .setDynamic(true)
        .build();

    private static final Logger Log = LoggerFactory.getLogger(GroupManager.class);

    private static final class GroupManagerContainer {
        private static final GroupManager instance = new GroupManager();
    }

    private static final Interner<String> groupBasedMutex = Interners.newWeakInterner();
    private static final Interner<String> userBasedMutex = Interners.newWeakInterner();
    private static final Interner<String> keyBasedMutex = Interners.newWeakInterner();

    private static final String GROUP_COUNT_KEY = "GROUP_COUNT";
    private static final String SHARED_GROUPS_KEY = "SHARED_GROUPS";
    private static final String GROUP_NAMES_KEY = "GROUP_NAMES";
    private static final String PUBLIC_GROUPS = "PUBLIC_GROUPS";
    private static final String USER_SHARED_GROUPS_KEY = "USER_SHARED_GROUPS";
    private static final String USER_GROUPS_KEY = "USER_GROUPS";

    /**
     * Returns a singleton instance of GroupManager.
     *
     * @return a GroupManager instance.
     */
    public static GroupManager getInstance() {
        return GroupManagerContainer.instance;
    }

    private Cache<String, CacheableOptional<Group>> groupCache;
    private Cache<String, Serializable> groupMetaCache;
    private static GroupProvider provider;

    private GroupManager() {
        // Initialize caches.
        groupCache = CacheFactory.createCache("Group");

        // A cache for meta-data around groups: count, group names, groups associated with
        // a particular user
        groupMetaCache = CacheFactory.createCache("Group Metadata Cache");

        initProvider(GROUP_PROVIDER.getValue());

        GroupEventDispatcher.addListener(new GroupEventListener() {
            @Override
            public void groupCreated(Group group, Map params) {

                // Adds default properties if they don't exists, since the creator of
                // the group could set them.
                if (group.getProperties().get("sharedRoster.showInRoster") == null) {
                    group.getProperties().put("sharedRoster.showInRoster", "nobody");
                    group.getProperties().put("sharedRoster.displayName", "");
                    group.getProperties().put("sharedRoster.groupList", "");
                }

                // Since the group could be created by the provider, add it possible again
                groupCache.put(group.getName(), CacheableOptional.of(group));

                // Evict only the information related to Groups.
                // Do not evict groups with 'user' as keys.
                clearGroupCountCache();
                clearGroupNameCache();
                clearSharedGroupCache();

                // Evict cached information for affected users
                evictCachedUsersForGroup(group);

                // Evict cached paginated group names
                evictCachedPaginatedGroupNames();
            }

            @Override
            public void groupDeleting(Group group, Map params) {
                // Since the group could be deleted by the provider, remove it possible again
                groupCache.put(group.getName(), CacheableOptional.of( null ));

                // Evict only the information related to Groups.
                // Do not evict groups with 'user' as keys.
                clearGroupCountCache();
                clearGroupNameCache();
                clearSharedGroupCache();

                // Evict cached information for affected users
                evictCachedUsersForGroup(group);

                // Evict cached paginated group names
                evictCachedPaginatedGroupNames();
            }

            @Override
            public void groupModified(Group group, Map params) {
                String type = (String)params.get("type");
                // If shared group settings changed, expire the cache.
                if (type != null) {
                    if (type.equals("propertyModified") ||
                        type.equals("propertyDeleted") || type.equals("propertyAdded"))
                    {
                        Object key = params.get("propertyKey");
                        if ("sharedRoster.showInRoster".equals(key) || "*".equals(key))
                        {
                            clearGroupNameCache();
                            clearSharedGroupCache();

                            String originalValue = (String) params.get("originalValue");
                            String newValue = group.getProperties().get("sharedRoster.showInRoster");

                            // 'showInRoster' has changed
                            if (!StringUtils.equals(originalValue, newValue)) {

                                if ("everybody".equals(originalValue) || "everybody".equals(newValue)) {
                                    evictCachedUserSharedGroups();
                                }
                            }
                        } else if ("sharedRoster.groupList".equals(key)) {

                            String originalValue = (String) params.get("originalValue");
                            String newValue = group.getProperties().get("sharedRoster.groupList");

                            // 'groupList' has changed
                            if (!StringUtils.equals(originalValue, newValue)) {
                                evictCachedUsersForGroup( group );

                                // Also clear the cache for groups that have been removed from the shared list.
                                if ( originalValue != null ) {
                                    final Set<String> newGroupNames = newValue == null ? new HashSet<>() : splitGroupList(newValue);
                                    final Set<String> oldGroupNames = splitGroupList(originalValue);

                                    // The 'new' group names are already handled by the evictCachedUserForGroup call above. No need to do that twice.
                                    oldGroupNames.removeAll(newGroupNames);
                                    oldGroupNames.forEach( g -> evictCachedUsersForGroup(g) );
                                }
                            }
                        }
                    }
                    // clean up cache for old group name
                    if (type.equals("nameModified")) {
                        String originalName = (String) params.get("originalValue");
                        if (originalName != null) {
                            groupCache.remove(originalName);
                        }

                        clearGroupNameCache();
                        clearSharedGroupCache();

                        // Evict cached information for affected users
                        evictCachedUsersForGroup(group);

                        // Evict cached paginated group names
                        evictCachedPaginatedGroupNames();

                    }
                }
                // Set object again in cache. This is done so that other cluster nodes
                // get refreshed with latest version of the object
                groupCache.put(group.getName(), CacheableOptional.of(group));
            }

            @Override
            public void memberAdded(Group group, Map params) {
                // Set object again in cache. This is done so that other cluster nodes
                // get refreshed with latest version of the object
                groupCache.put(group.getName(), CacheableOptional.of(group));

                // Remove only the collection of groups the member belongs to.
                String member = (String) params.get("member");
                evictCachedUserForGroup(member);
            }

            @Override
            public void memberRemoved(Group group, Map params) {
                // Set object again in cache. This is done so that other cluster nodes
                // get refreshed with latest version of the object
                groupCache.put(group.getName(), CacheableOptional.of(group));

                // Remove only the collection of groups the member belongs to.
                String member = (String) params.get("member");
                evictCachedUserForGroup(member);
            }

            @Override
            public void adminAdded(Group group, Map params) {
                // Set object again in cache. This is done so that other cluster nodes
                // get refreshed with latest version of the object
                groupCache.put(group.getName(), CacheableOptional.of(group));

                // Remove only the collection of groups the member belongs to.
                String member = (String) params.get("admin");
                evictCachedUserForGroup(member);
            }

            @Override
            public void adminRemoved(Group group, Map params) {
                // Set object again in cache. This is done so that other cluster nodes
                // get refreshed with latest version of the object
                groupCache.put(group.getName(), CacheableOptional.of(group));

                // Remove only the collection of groups the member belongs to.
                String member = (String) params.get("admin");
                evictCachedUserForGroup(member);
            }

        });

        UserEventDispatcher.addListener(new UserEventListener() {
            @Override
            public void userCreated(User user, Map<String, Object> params) {
                // ignore
            }

            @Override
            public void userDeleting(User user, Map<String, Object> params) {
                deleteUser(user);
            }

            @Override
            public void userModified(User user, Map<String, Object> params) {
                // ignore
            }
        });
    }

    private static void initProvider(final Class clazz) {
        if (provider == null || !clazz.equals(provider.getClass())) {
            try {
                provider = (GroupProvider) clazz.newInstance();
            } catch (Exception e) {
                Log.error("Error loading group provider: " + clazz.getName(), e);
                provider = new DefaultGroupProvider();
            }
        }
    }

    /**
     * Factory method for creating a new Group. A unique name is the only required field.
     *
     * @param name the new and unique name for the group.
     * @return a new Group.
     * @throws GroupAlreadyExistsException if the group name already exists in the system.
     */
    public Group createGroup(String name) throws GroupAlreadyExistsException {
        synchronized (groupBasedMutex.intern(name)) {
            Group newGroup;
            try {
                getGroup(name);
                // The group already exists since now exception, so:
                throw new GroupAlreadyExistsException();
            }
            catch (GroupNotFoundException unfe) {
                // The group doesn't already exist so we can create a new group
                newGroup = provider.createGroup(name);
                // Update caches.
                clearGroupNameCache();
                clearGroupCountCache();
                groupCache.put(name, CacheableOptional.of(newGroup));

                // Fire event.
                GroupEventDispatcher.dispatchEvent(newGroup,
                        GroupEventDispatcher.EventType.group_created, Collections.emptyMap());
            }
            return newGroup;
        }
    }

    /**
     * Returns the corresponding group if the given JID represents a group.
     *
     * @param jid The JID for the group to retrieve
     * @return The group corresponding to the JID, or null if the JID does not represent a group
     * @throws GroupNotFoundException if the JID represents a group that does not exist
     */
    public Group getGroup(JID jid) throws GroupNotFoundException {
        JID groupJID = GroupJID.fromJID(jid);
        return (groupJID instanceof GroupJID) ? getGroup(((GroupJID)groupJID).getGroupName()) : null;
    }

    /**
     * Returns a Group by name.
     *
     * @param name The name of the group to retrieve
     * @return The group corresponding to that name
     * @throws GroupNotFoundException if the group does not exist.
     */
    public Group getGroup(String name) throws GroupNotFoundException {
        return getGroup(name, false);
    }

    /**
     * Returns a Group by name.
     *
     * @param name The name of the group to retrieve
     * @param forceLookup Invalidate the group cache for this group
     * @return The group corresponding to that name
     * @throws GroupNotFoundException if the group does not exist.
     */
    public Group getGroup(String name, boolean forceLookup) throws GroupNotFoundException {

        final CacheableOptional<Group> firstCachedGroup;
        if (forceLookup) {
            firstCachedGroup = null;
            groupCache.remove(name);
        } else {
            firstCachedGroup = groupCache.get(name);
        }

        if (firstCachedGroup != null) {
            return toGroup(name, firstCachedGroup);
        }

        synchronized (groupBasedMutex.intern(name)) {
            final CacheableOptional<Group> secondCachedGroup = groupCache.get(name);
            if (secondCachedGroup != null) {
                return toGroup(name, secondCachedGroup);
            }

            try {
                final Group group = provider.getGroup(name);
                groupCache.put(name, CacheableOptional.of(group));
                return group;
            } catch (final GroupNotFoundException e) {
                groupCache.put(name, CacheableOptional.of(null));
                throw e;
            }
        }
    }

    private Group toGroup(final String name, final CacheableOptional<Group> coGroup) throws GroupNotFoundException {
        return coGroup
            .toOptional()
            .orElseThrow(() -> new GroupNotFoundException("Group with name " + name + " not found (cached)."));
    }

    /**
     * Deletes a group from the system.
     *
     * @param group the group to delete.
     */
    public void deleteGroup(Group group) {
        // Fire event.
        GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.EventType.group_deleting,
                Collections.emptyMap());

        // Delete the group.
        provider.deleteGroup(group.getName());

        // Add a no-hit to the cache.
        groupCache.put(group.getName(), CacheableOptional.of(null));
        clearGroupNameCache();
        clearGroupCountCache();
    }

    /**
     * Deletes a user from all the groups where he/she belongs. The most probable cause
     * for this request is that the user has been deleted from the system.
     *
     * @param user the deleted user from the system.
     */
    public void deleteUser(User user) {
        JID userJID = XMPPServer.getInstance().createJID(user.getUsername(), null);
        for (Group group : getGroups(userJID)) {
            if (group.getAdmins().contains(userJID)) {
                if (group.getAdmins().remove(userJID)) {
                    // Remove the group from cache.
                    groupCache.remove(group.getName());
                }
            }
            else {
                if (group.getMembers().remove(userJID)) {
                    // Remove the group from cache.
                    groupCache.remove(group.getName());
                }
            }
        }
        evictCachedUserForGroup(userJID.toBareJID());
    }

    /**
     * Returns the total number of groups in the system.
     *
     * @return the total number of groups.
     */
    public int getGroupCount() {
            Integer count = getGroupCountFromCache();
        if (count == null) {
            synchronized(GROUP_COUNT_KEY) {
                count = getGroupCountFromCache();
                if (count == null) {
                    count = provider.getGroupCount();
                    saveGroupCountInCache(count);
                }
            }
        }
        return count;
    }

    /**
     * Returns an unmodifiable Collection of all groups in the system.
     *
     * NOTE: Iterating through the resulting collection has the effect of loading
     * every group into memory. This may be an issue for large deployments. You
     * may call the size() method on the resulting collection to determine the best
     * approach to take before iterating over (and thus instantiating) the groups.
     *
     * @return an unmodifiable Collection of all groups.
     */
    public Collection<Group> getGroups() {
        HashSet<String> groupNames = getGroupNamesFromCache();
        if (groupNames == null) {
            synchronized(GROUP_NAMES_KEY) {
                groupNames = getGroupNamesFromCache();
                if (groupNames == null) {
                    groupNames = new HashSet<>(provider.getGroupNames());
                    saveGroupNamesInCache(groupNames);
                }
            }
        }
        return new GroupCollection(groupNames);
    }

    /**
     * Returns an unmodifiable Collection of all shared groups in the system.
     *
     * NOTE: Iterating through the resulting collection has the effect of loading all
     * shared groups into memory. This may be an issue for large deployments. You
     * may call the size() method on the resulting collection to determine the best
     * approach to take before iterating over (and thus instantiating) the groups.
     *
     * @return an unmodifiable Collection of all shared groups.
     */
    public Collection<Group> getSharedGroups() {
        HashSet<String> groupNames = getSharedGroupsFromCache();
        if (groupNames == null) {
            synchronized(SHARED_GROUPS_KEY) {
                groupNames = getSharedGroupsFromCache();
                if (groupNames == null) {
                    groupNames = new HashSet<>(provider.getSharedGroupNames());
                    saveSharedGroupsInCache(groupNames);
                }
            }
        }
        return new GroupCollection(groupNames);
    }

    /**
     * Returns an unmodifiable Collection of all shared groups in the system for a given userName.
     *
     * @param userName the user to check
     * @return an unmodifiable Collection of all shared groups for the given userName.
     */
    public Collection<Group> getSharedGroups(String userName) {
        HashSet<String> groupNames = getSharedGroupsForUserFromCache(userName);
        if (groupNames == null) {
            synchronized (userBasedMutex.intern(userName)) {
                groupNames = getSharedGroupsForUserFromCache(userName);
                if (groupNames == null) {
                    // assume this is a local user
                    groupNames = new HashSet<>(provider.getSharedGroupNames(new JID(userName,
                            XMPPServer.getInstance().getServerInfo().getXMPPDomain(), null)));
                    saveSharedGroupsForUserInCache(userName, groupNames);
                }
            }
        }
        return new GroupCollection(groupNames);
    }

    /**
     * Returns an unmodifiable Collection of all shared groups in the system for a given userName.
     *
     * @param groupToCheck The group to check
     * @return an unmodifiable Collection of all shared groups for the given userName.
     */
    public Collection<Group> getVisibleGroups(Group groupToCheck) {
        // Get all the public shared groups.
        HashSet<String> groupNames = getPublicGroupsFromCache();
        if (groupNames == null) {
            synchronized(PUBLIC_GROUPS) {
                groupNames = getPublicGroupsFromCache();
                if (groupNames == null) {
                    groupNames = new HashSet<>(provider.getPublicSharedGroupNames());
                    savePublicGroupsInCache(groupNames);
                }
            }
        }
        // Now get all visible groups to the given group.
        groupNames.addAll(provider.getVisibleGroupNames(groupToCheck.getName()));
        return new GroupCollection(groupNames);
    }

    /**
     * Returns an unmodifiable Collection of all public shared groups in the system.
     *
     * @return an unmodifiable Collection of all shared groups.
     */
    public Collection<Group> getPublicSharedGroups() {
        HashSet<String> groupNames = getPublicGroupsFromCache();
        if (groupNames == null) {
            synchronized(PUBLIC_GROUPS) {
                groupNames = getPublicGroupsFromCache();
                if (groupNames == null) {
                    groupNames = new HashSet<>(provider.getPublicSharedGroupNames());
                    savePublicGroupsInCache(groupNames);
                }
            }
        }
        return new GroupCollection(groupNames);
    }

    /**
     * Returns an unmodifiable Collection of all groups in the system that
     * match given propValue for the specified propName.
     *
     * @param propName the property name to search for
     * @param propValue the property value to search for
     * @return an unmodifiable Collection of all shared groups.
     */
    public Collection<Group> search(String propName, String propValue) {
        Collection<String> groupsWithProps = provider.search(propName, propValue);
        return new GroupCollection(groupsWithProps);
    }

    /**
     * Returns all groups given a start index and desired number of results. This is
     * useful to support pagination in a GUI where you may only want to display a certain
     * number of results per page. It is possible that the number of results returned will
     * be less than that specified by numResults if numResults is greater than the number
     * of records left in the system to display.
     *
     * @param startIndex start index in results.
     * @param numResults number of results to return.
     * @return an Iterator for all groups in the specified range.
     */
    public Collection<Group> getGroups(int startIndex, int numResults) {
        HashSet<String> groupNames = getPagedGroupNamesFromCache(startIndex, numResults);
        if (groupNames == null) {
            synchronized (keyBasedMutex.intern(getPagedGroupNameKey(startIndex, numResults))) {
                groupNames = getPagedGroupNamesFromCache(startIndex, numResults);
                if (groupNames == null) {
                    groupNames = new HashSet<>(provider.getGroupNames(startIndex, numResults));
                    savePagedGroupNamesFromCache(groupNames, startIndex, numResults);
                }
            }
        }
        return new GroupCollection(groupNames);
    }

    /**
     * Returns an iterator for all groups that the User is a member of.
     *
     * @param user the user.
     * @return all groups the user belongs to.
     */
    public Collection<Group> getGroups(User user) {
        return getGroups(XMPPServer.getInstance().createJID(user.getUsername(), null, true));
    }

    /**
     * Returns an iterator for all groups that the entity with the specified JID is a member of.
     *
     * @param user the JID of the entity to get a list of groups for.
     * @return all groups that an entity belongs to.
     */
    public Collection<Group> getGroups(JID user) {
        HashSet<String> groupNames = getUserGroupsFromCache(user);
        if (groupNames == null) {
            synchronized (userBasedMutex.intern(user.getNode())) {
                groupNames = getUserGroupsFromCache(user);
                if (groupNames == null) {
                    groupNames = new HashSet<>(provider.getGroupNames(user));
                    saveUserGroupsInCache(user, groupNames);
                }
            }
        }
        return new GroupCollection(groupNames);
    }

    /**
     * Returns true if groups are read-only.
     *
     * @return true if groups are read-only.
     */
    public boolean isReadOnly() {
        return provider.isReadOnly();
    }

    /**
     * Returns true if searching for groups is supported.
     *
     * @return true if searching for groups are supported.
     */
    public boolean isSearchSupported() {
        return provider.isSearchSupported();
    }

    /**
     * Returns the groups that match the search. The search is over group names and
     * implicitly uses wildcard matching (although the exact search semantics are left
     * up to each provider implementation). For example, a search for "HR" should match
     * the groups "HR", "HR Department", and "The HR People".<p>
     *
     * Before searching or showing a search UI, use the {@link #isSearchSupported} method
     * to ensure that searching is supported.
     *
     * @param query the search string for group names.
     * @return all groups that match the search.
     */
    public Collection<Group> search(String query) {
        Collection<String> groupNames = provider.search(query);
        return new GroupCollection(groupNames);
    }

    /**
     * Returns the groups that match the search given a start index and desired number
     * of results. The search is over group names and implicitly uses wildcard matching
     * (although the exact search semantics are left up to each provider implementation).
     * For example, a search for "HR" should match the groups "HR", "HR Department", and
     * "The HR People".<p>
     *
     * Before searching or showing a search UI, use the {@link #isSearchSupported} method
     * to ensure that searching is supported.
     *
     * @param query the search string for group names.
     * @param startIndex the start index to retrieve the group list from
     * @param numResults the maximum number of results to return
     * @return all groups that match the search.
     */
    public Collection<Group> search(String query, int startIndex, int numResults) {
        Collection<String> groupNames = provider.search(query, startIndex, numResults);
        return new GroupCollection(groupNames);
    }

    /**
     * Returns the configured group provider. Note that this method has special access
     * privileges since only a few certain classes need to access the provider directly.
     *
     * @return the group provider.
     */
    public GroupProvider getProvider() {
        return provider;
    }

    private void evictCachedUserForGroup(String userJid) {
        if (userJid != null) {
            JID user = new JID(userJid);

            // remove cache for getGroups
            synchronized (USER_GROUPS_KEY) {
                clearUserGroupsCache(user);
            }

            // remove cache for getSharedGroups
            if (XMPPServer.getInstance().isLocal(user)) {
                synchronized (USER_SHARED_GROUPS_KEY) {
                    clearSharedGroupsForUserCache(user.getNode());
                }
            }
        }
    }

    /**
     * Evict from cache all cached user entries that relate to the provided group.
     *
     * This method ignores group names for which a group cannot be found.
     *
     * @param groupName The name of a group for which to evict cached user entries (cannot be null).
     */
    private void evictCachedUsersForGroup(String groupName)
    {
        try {
            evictCachedUsersForGroup( getGroup(groupName) );
        } catch ( GroupNotFoundException e ) {
            Log.debug("Unable to evict cached users for group '{}': this group does not exist.", groupName, e);
        }
    }

    /**
     * Evict from cache all cached user entries that relate to the provided group.
     *
     * @param group The group for which to evict cached user entries (cannot be null).
     */
    private void evictCachedUsersForGroup(Group group)
    {
        // Get all nested groups, removing any cyclic dependency.
        final Set<Group> groups = getSharedGroups( group, new HashMap<>() );

        // Evict cached information for affected users.
        groups.forEach( g -> {
            g.getAdmins().forEach( jid -> evictCachedUserForGroup( jid.toBareJID()) );
            g.getMembers().forEach( jid -> evictCachedUserForGroup( jid.toBareJID()) );
        });

        // If any of the groups is shared with everybody, evict all cached groups.
        if ( groups.stream().anyMatch( g -> {
            final String showInRoster = g.getProperties().get("sharedRoster.showInRoster");
            return "everybody".equalsIgnoreCase( showInRoster );
        } )) {
            evictCachedUserSharedGroups();
        }
    }

    /**
     * Find the unique set of groups with which the provided group is shared,
     * directly or indirectly. An indirect share is defined as a scenario where
     * the group is shared by a group that's shared with another group).
     *
     * This method is designed to allow for cyclic group sharing dependencies.
     *
     * The returned set will include the original group itself.
     *
     * @param group The group for which to return all groups that its shared with (cannot be null).
     * @param result An intermediate result, used in recursive calls. Cannot be null. Use an empty group when invoking this.
     * @return A set of groups with which all members of 'group' are shared with (never null, will at least contain 'group').
     */
    private Set<Group> getSharedGroups( final Group group, final Map<String, Group> result ) {
        result.put( group.getName(), group );

        final String showInRoster = group.getProperties().get("sharedRoster.showInRoster");
        if ( "onlygroup".equals(showInRoster.toLowerCase()) )
        {
            final Set<String> groupNames = new HashSet<>();
            final String groupList = group.getProperties().get("sharedRoster.groupList");
            if ( groupList != null ) {
                groupNames.addAll( splitGroupList( groupList ) );
            }

            for ( String groupName : groupNames )
            {
                // When this group is shared with groups that we haven't visited yet, recurse.
                if ( !result.containsKey(groupName) )
                {
                    try
                    {
                        final Group nested = getGroup(groupName);
                        getSharedGroups(nested, result);
                    }
                    catch ( GroupNotFoundException e )
                    {
                        Log.debug("While iterating over subgroups of group '{}', an unrecognized spefgroup was found: '{}'", group.getName(), groupName, e);
                    }
                }
            }
        }

        return new HashSet<>(result.values());
    }

    /**
     * Splits a comma-separated string of group name in a set of group names.
     * @param csv The comma-separated list. Cannot be null.
     * @return A set of group names.
     */
    protected static Set<String> splitGroupList( String csv )
    {
        final Set<String> result = new HashSet<>();
        final StringTokenizer tokenizer = new StringTokenizer(csv, ",\t\n\r\f");
        while ( tokenizer.hasMoreTokens() )
        {
            result.add(tokenizer.nextToken().trim());
        }

        return result;
    }

    private void evictCachedPaginatedGroupNames() {
        groupMetaCache.keySet().stream()
            .filter(key -> key.startsWith(GROUP_NAMES_KEY))
            .forEach(key -> groupMetaCache.remove(key));
    }

    private void evictCachedUserSharedGroups() {
        synchronized (USER_SHARED_GROUPS_KEY) {
            groupMetaCache.keySet().stream()
                .filter(key -> key.startsWith(USER_SHARED_GROUPS_KEY) || key.startsWith(GROUP_NAMES_KEY))
                .forEach(key -> groupMetaCache.remove(key));
        }
    }

    /*
        For reasons currently unclear, this class stores a number of different objects in the groupMetaCache. To
        better encapsulate this, all access to the groupMetaCache is via these methods
     */
    @SuppressWarnings("unchecked")
    private HashSet<String> getGroupNamesFromCache() {
        return (HashSet<String>)groupMetaCache.get(GROUP_NAMES_KEY);
    }

    private void clearGroupNameCache() {
        groupMetaCache.remove(GROUP_NAMES_KEY);
    }

    private void saveGroupNamesInCache(final HashSet<String> groupNames) {
        groupMetaCache.put(GROUP_NAMES_KEY, groupNames);
    }

    private String getPagedGroupNameKey(final int startIndex, final int numResults) {
        return GROUP_NAMES_KEY + startIndex + "," + numResults;
    }

    @SuppressWarnings("unchecked")
    private HashSet<String> getPagedGroupNamesFromCache(final int startIndex, final int numResults) {
        return (HashSet<String>)groupMetaCache.get(getPagedGroupNameKey(startIndex, numResults));
    }

    private void savePagedGroupNamesFromCache(final HashSet<String> groupNames, final int startIndex, final int numResults) {
        groupMetaCache.put(getPagedGroupNameKey(startIndex, numResults), groupNames);

    }

    private Integer getGroupCountFromCache() {
        return (Integer)groupMetaCache.get(GROUP_COUNT_KEY);
    }

    private void saveGroupCountInCache(final int count) {
        groupMetaCache.put(GROUP_COUNT_KEY, count);
    }

    private void clearGroupCountCache() {
        groupMetaCache.remove(GROUP_COUNT_KEY);
    }

    @SuppressWarnings("unchecked")
    private HashSet<String> getSharedGroupsFromCache() {
        return (HashSet<String>)groupMetaCache.get(SHARED_GROUPS_KEY);
    }

    private void clearSharedGroupCache() {
        groupMetaCache.remove(SHARED_GROUPS_KEY);
    }

    private void saveSharedGroupsInCache(final HashSet<String> groupNames) {
        groupMetaCache.put(SHARED_GROUPS_KEY, groupNames);
    }

    private String getSharedGroupsForUserKey(final String userName) {
        return USER_SHARED_GROUPS_KEY + userName;
    }

    @SuppressWarnings("unchecked")
    private HashSet<String> getSharedGroupsForUserFromCache(final String userName) {
        return (HashSet<String>)groupMetaCache.get(getSharedGroupsForUserKey(userName));
    }

    private void clearSharedGroupsForUserCache(final String userName) {
        groupMetaCache.remove(getSharedGroupsForUserKey(userName));
    }

    private void saveSharedGroupsForUserInCache(final String userName, final HashSet<String> groupNames) {
        groupMetaCache.put(getSharedGroupsForUserKey(userName), groupNames);
    }

    @SuppressWarnings("unchecked")
    private HashSet<String> getPublicGroupsFromCache() {
        return (HashSet<String>)groupMetaCache.get(PUBLIC_GROUPS);
    }

    private void clearPublicGroupsCache() {
        groupMetaCache.remove(PUBLIC_GROUPS);
    }

    private void savePublicGroupsInCache(final HashSet<String> groupNames) {
        groupMetaCache.put(PUBLIC_GROUPS, groupNames);
    }

    @SuppressWarnings("unchecked")
    private HashSet<String> getUserGroupsFromCache(final JID user) {
        return (HashSet<String>)groupMetaCache.get(getUserGroupsKey(user));
    }

    private void clearUserGroupsCache(final JID user) {
        groupMetaCache.remove(getUserGroupsKey(user));
    }

    private void saveUserGroupsInCache(final JID user, final HashSet<String> groupNames) {
        groupMetaCache.put(getUserGroupsKey(user), groupNames);
    }

    private String getUserGroupsKey(final JID user) {
        return USER_GROUPS_KEY + user.toBareJID();
    }

}


text:
package com.intellij.psi;

import javax.annotation.Nonnull;

/**
 * Represents an array initializer expression.
 *
 * @see PsiNewExpression#getArrayInitializer()
 */
public interface PsiArrayInitializerExpression extends PsiExpression {
  /**
   * Returns the list of expressions initializing members of the array.
   *
   * @return the array of member initializer expressions.
   */
  @Nonnull
  PsiExpression[] getInitializers();
}


text:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">


text:
__author__ = 'kohlmannj'

from Ity import celery_tasks as tasks

corpus_path = "/Users/kohlmannj/Dropbox/VEP Workspace/Apps/Serendip+Ity/Data/Corpora/Globe_Rev/"

if __name__ == "__main__":
    # the_corpus = Corpus(corpus_path)
    saved_files = tasks.save_corpus(*process_corpus(path=corpus_path))
    print saved_files


text:
package com.github.bustedearlobes.themis.taskmanager;

import java.util.concurrent.TimeUnit;

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

import com.github.bustedearlobes.themis.music.GuildMusicManager;

import net.dv8tion.jda.api.entities.Guild;

public class MusicInactivityTask extends ScheduledTask {
    private static final Logger LOG = LoggerFactory.getLogger(MusicInactivityTask.class);
    private String guildID;

    public MusicInactivityTask(String guildID) {
        super(30, 0, TimeUnit.SECONDS, 0);
        this.guildID = guildID;
    }

    private static final long serialVersionUID = 1L;

    @Override
    public String getName() {
        return "Music Inactivity Task";
    }

    @Override
    protected void runTask() {
        Guild guild = getGuildById(guildID);
        GuildMusicManager musicManager = getThemis().getGlobalMusicManager().getGuildMusicManager(guild);
        if(guild.getAudioManager().isConnected()
                && guild.getAudioManager().getConnectedChannel().getMembers().size() == 1) {
            musicManager.getTrackScheduler().clear();
            musicManager.getAudioPlayer().stopTrack();
            guild.getAudioManager().closeAudioConnection();
            LOG.info("Closing audio connection in guild {} due to inactive channel", guild.getName());
        } else {
            getThemis().getTaskManager().addTask(new MusicInactivityTask(guild.getId()));
        }
    }

}


text:
package org.jboss.resteasy.reactive.common.headers;

import java.util.List;

import javax.ws.rs.core.CacheControl;
import javax.ws.rs.ext.RuntimeDelegate;

import org.jboss.resteasy.reactive.common.util.ExtendedCacheControl;

/**
 * @author Bill Burke
 */
public class CacheControlDelegate implements RuntimeDelegate.HeaderDelegate<CacheControl> {
    public static final CacheControlDelegate INSTANCE = new CacheControlDelegate();

    public CacheControl fromString(String value) throws IllegalArgumentException {
        if (value == null)
            throw new IllegalArgumentException("Param was null");
        ExtendedCacheControl result = new ExtendedCacheControl();
        result.setNoTransform(false);

        String[] directives = value.split(",");
        for (String directive : directives) {
            directive = directive.trim();

            String[] nv = directive.split("=");
            String name = nv[0].trim();
            String val = null;
            if (nv.length > 1) {
                val = nv[1].trim();
                if (val.startsWith("\""))
                    val = val.substring(1);
                if (val.endsWith("\""))
                    val = val.substring(0, val.length() - 1);
            }

            String lowercase = name.toLowerCase();
            if ("no-cache".equals(lowercase)) {
                result.setNoCache(true);
                if (val != null && !"".equals(val)) {
                    result.getNoCacheFields().add(val);
                }
            } else if ("private".equals(lowercase)) {
                result.setPrivate(true);
                if (val != null && !"".equals(val)) {
                    result.getPrivateFields().add(val);
                }
            } else if ("no-store".equals(lowercase)) {
                result.setNoStore(true);
            } else if ("max-age".equals(lowercase)) {
                if (val == null)
                    throw new IllegalArgumentException("null max age");
                result.setMaxAge(Integer.valueOf(val));
            } else if ("s-maxage".equals(lowercase)) {
                if (val == null)
                    throw new IllegalArgumentException("null s-maxage");
                result.setSMaxAge(Integer.valueOf(val));
            } else if ("no-transform".equals(lowercase)) {
                result.setNoTransform(true);
            } else if ("must-revalidate".equals(lowercase)) {
                result.setMustRevalidate(true);
            } else if ("proxy-revalidate".equals(lowercase)) {
                result.setProxyRevalidate(true);
            } else if ("public".equals(lowercase)) {
                result.setPublic(true);
            } else {
                if (val == null)
                    val = "";
                result.getCacheExtension().put(name, val);
            }
        }
        return result;
    }

    private static StringBuffer addDirective(String directive, StringBuffer buffer) {
        if (buffer.length() > 0)
            buffer.append(", ");
        buffer.append(directive);
        return buffer;
    }

    public String toString(CacheControl value) {
        if (value == null)
            throw new IllegalArgumentException("param was null");
        StringBuffer buffer = new StringBuffer();
        if (value.isNoCache()) {
            List<String> fields = value.getNoCacheFields();
            if (fields.size() < 1) {
                addDirective("no-cache", buffer);
            } else {
                for (String field : value.getNoCacheFields()) {
                    addDirective("no-cache", buffer).append("=\"").append(field).append("\"");
                }
            }
        }
        if (value instanceof ExtendedCacheControl) {
            ExtendedCacheControl ecc = (ExtendedCacheControl) value;
            if (ecc.isPublic()) {
                addDirective("public", buffer);
            }
        }
        if (value.isMustRevalidate())
            addDirective("must-revalidate", buffer);
        if (value.isNoTransform())
            addDirective("no-transform", buffer);
        if (value.isNoStore())
            addDirective("no-store", buffer);
        if (value.isProxyRevalidate())
            addDirective("proxy-revalidate", buffer);
        if (value.getSMaxAge() > -1)
            addDirective("s-maxage", buffer).append("=").append(value.getSMaxAge());
        if (value.getMaxAge() > -1)
            addDirective("max-age", buffer).append("=").append(value.getMaxAge());
        if (value.isPrivate()) {
            List<String> fields = value.getPrivateFields();
            if (fields.size() < 1)
                addDirective("private", buffer);
            else {
                for (String field : value.getPrivateFields()) {
                    addDirective("private", buffer).append("=\"").append(field).append("\"");
                }
            }
        }
        for (String key : value.getCacheExtension().keySet()) {
            String val = value.getCacheExtension().get(key);
            addDirective(key, buffer);
            if (val != null && !"".equals(val)) {
                buffer.append("=\"").append(val).append("\"");
            }
        }
        return buffer.toString();
    }

}


text:
package gd.core;

import java.awt.image.BufferedImage;
import java.awt.image.PixelGrabber;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

/**
 * Computes the fitness of a program as the Least-Mean-Sqare distance between
 * the image it generates and the target image.
 *
 * @author lokee
 */
public class LMSFitnessFunction
        extends FitnessFunction {

    private final GAConfiguration m_conf;
    private final int[] targetPixels;

    LMSFitnessFunction(GAConfiguration a_conf) {
        super();
        m_conf = a_conf;

        BufferedImage target = m_conf.getTarget();
        targetPixels = new int[target.getWidth() * target.getHeight()];
        PixelGrabber pg = new PixelGrabber(target, 0, 0, target.getWidth(),
                target.getHeight(), targetPixels, 0, target.getWidth());
        try {
            pg.grabPixels();
        } catch (InterruptedException ex) {
            Logger.getLogger(LMSFitnessFunction.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    protected double evaluate(IChromosome a_chromosome) {
        BufferedImage generated = m_conf.getPhenotypeExpresser().express(a_chromosome);
        final int[] generatedPixels = new int[generated.getWidth() * generated.getHeight()];
        PixelGrabber pg = new PixelGrabber(generated, 0, 0, generated.getWidth(),
                generated.getHeight(), generatedPixels, 0, generated.getWidth());
        try {
            pg.grabPixels();
        } catch (InterruptedException ex) {
            Logger.getLogger(LMSFitnessFunction.class.getName()).log(Level.SEVERE, null, ex);
        }

        long sum = 0;
        for (int i = 0; i < generatedPixels.length && i < targetPixels.length; i++) {
            int c1 = targetPixels[i];
            int c2 = generatedPixels[i];

            int r = ((c1 >> 16) & 0xff) - ((c2 >> 16) & 0xff);
            int g = ((c1 >> 8) & 0xff) - ((c2 >> 8) & 0xff);
            int b = (c1 & 0xff) - (c2 & 0xff);

            sum += r * r + g * g + b * b;
        }

        return Math.sqrt((double) sum);
    }
}


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

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="up" title="FatFs" href="../00index_e.html">
<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/getcwd.html">
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
<title>FatFs - f_getcwd</title>

f_getcwd

The f_getcwd function retrieves the current directory.

FRESULT f_getcwd (
  TCHAR* Buffer,  /* Pointer to the buffer */
  UINT BufferLen  /* The length of the buffer */
);

Parameters

Buffer

Pointer to the buffer to receive the current directory string.

BufferLen

Size of the buffer in unit of TCHAR.

Return Values

FR_OK,
FR_DISK_ERR,
FR_INT_ERR,
FR_NOT_READY,
FR_NOT_ENABLED,
FR_NO_FILESYSTEM,
FR_TIMEOUT,
FR_NOT_ENOUGH_CORE

Description

The f_getcwd function retrieves the current directory of the current drive in full path string including drive number.

QuickInfo

Available when <tt>_FS_RPATH == 2</tt>.

See Also

<tt>f_chdrive, f_chdir</tt>

Return


text:
using System;
namespace TrickyStrings
{
    public class concatenateStrings
    {
        public static void Main()
        {
            string delimiter = Console.ReadLine();
            int lenght = int.Parse(Console.ReadLine());

            string[] endString = new string[lenght * 2 - 1];

            for (int i = 0; i < endString.Length; i++)
            {
                endString[i] = i % 2 == 0 ? Console.ReadLine(): delimiter;
            }
            for (int i = 0; i < endString.Length; i++)
            {
                Console.Write(endString[i] + "");
            }
            Console.WriteLine();
        }
    }
}


text:
<!doctype html>

    <title>Code coverage report for out/global.js</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../prettify.css">
    <link rel="stylesheet" href="../base.css">

Code coverage report for out/global.js

        Statements: 62.5% (5 / 8)
        Branches: 25% (1 / 4)
        Functions: 100% (2 / 2)
        Lines: 62.5% (5 / 8)
        Ignored: none

All files » out/ » global.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

1

1
2
2

1

/**
 * just.js extension package
 *
 * @author danikas2k2 (danikas2k2@gmail.com)
 */
'use strict';

(function () {

    function globalScope() {
        Eif (typeof global !== 'undefined') {
            return global;
        }
        if (typeof window !== 'undefined') {
            return window;
        }
        throw 'No global global found!';
    }

    globalScope().globalScope = globalScope;
})();

Generated by istanbul at Wed Jul 08 2015 23:33:26 GMT+0300 (EEST)


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

namespace Genkgo\Push\Firebase;

use Genkgo\Push\Exception\ForbiddenToSendMessageException;
use Genkgo\Push\Exception\UnknownRecipientException;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Psr7\Request;

final class CloudMessaging
{
    private const FCM_ENDPOINT = 'https://fcm.googleapis.com/v1';

    /**
     * @var AuthorizationHeaderProviderInterface
     */
    private $authorizationHeaderProvider;

    /**
     * @var ClientInterface
     */
    private $client;

    /**
     * @param ClientInterface $client
     * @param AuthorizationHeaderProviderInterface $authorizationHeaderProvider
     */
    public function __construct(
        ClientInterface $client,
        AuthorizationHeaderProviderInterface $authorizationHeaderProvider
    ) {
        $this->authorizationHeaderProvider = $authorizationHeaderProvider;
        $this->client = $client;
    }

    /**
     * @param string $projectId
     * @param string $token
     * @param Notification $notification
     */
    public function send(string $projectId, string $token, Notification $notification): void
    {
        $authorizationHeader = \call_user_func($this->authorizationHeaderProvider);

        try {
            $json = \json_encode([
                'message' => [
                    'token' => $token,
                    'data' => $this->convertDataToStrings($notification->getData()),
                    'notification' => [
                        'body' => $notification->getBody(),
                        'title' => $notification->getTitle(),
                    ]
                ]
            ]);

            if ($json === false) {
                throw new \UnexpectedValueException('Cannot encode HTTP message');
            }

            $this->client
                ->send(
                    new Request(
                        'POST',
                        \sprintf(
                            '%s/projects/%s/messages:send',
                            self::FCM_ENDPOINT,
                            $projectId
                        ),
                        [
                            'Content-Type' => 'application/json',
                            'Authorization' => $authorizationHeader,
                        ],
                        $json
                    )
                );
        } catch (ClientException $e) {
            $response = $e->getResponse();
            if ($response !== null && $response->getStatusCode() === 403) {
                throw new ForbiddenToSendMessageException(
                    'Cannot send message due to access restriction:' . $e->getMessage(),
                    $e->getCode(),
                    $e
                );
            }

            if ($response !== null && $response->getStatusCode() === 404) {
                throw new UnknownRecipientException(
                    'Cannot send message, unknown recipient:' . $e->getMessage(),
                    $e->getCode(),
                    $e
                );
            }

            throw $e;
        }
    }

    /**
     * @param array<mixed, mixed> $data
     * @return array<string, mixed>
     */
    private function convertDataToStrings(array $data): array
    {
        $callback = function ($item) {
            return (string)$item;
        };

        $func = function ($item) use (&$func, &$callback) {
            return \is_array($item) ? \array_map($func, $item) : \call_user_func($callback, $item);
        };

        return \array_map($func, $data);
    }
}


text:
<?xml version="1.0"?>
<!-- exception message: invalid author element -->
<rss version="2.0">
	<channel>
		<title>Test Case</title>
		<link>https://github.com/imnotjames/syndicator</link>
		<description>This is a test case that fails because the item author has no email in it</description>
		<item>
			<title>Test Case</title>
			<link>https://github.com/imnotjames/syndicator</link>
			<description>This is a test case item</description>
			<author>no email here</author>
		</item>
	</channel>
</rss>