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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface com.mongodb.client.ListCollectionsIterable (neohabitat 0.1.0-SNAPSHOT API)</title>
<meta name="date" content="2017-01-17">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
com.mongodb.client.ListCollectionsIterable

Packages that use ListCollectionsIterable

Package
Description

com.mongodb.client

Uses of ListCollectionsIterable in com.mongodb.client

Methods in com.mongodb.client that return ListCollectionsIterable

Modifier and Type
Method and Description

ListCollectionsIterable<TResult>
ListCollectionsIterable.batchSize(int batchSize)

Sets the number of documents to return per batch.

ListCollectionsIterable<TResult>
ListCollectionsIterable.filter(org.bson.conversions.Bson filter)

Sets the query filter to apply to the query.

ListCollectionsIterable<org.bson.Document>
MongoDatabase.listCollections()

Finds all the collections in this database.

<TResult> ListCollectionsIterable<TResult>
MongoDatabase.listCollections(Class<TResult> resultClass)

Finds all the collections in this database.

ListCollectionsIterable<TResult>
ListCollectionsIterable.maxTime(long maxTime,
       TimeUnit timeUnit)

Sets the maximum execution time on the server for this operation.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2017. All rights reserved.


text:
var path = require('path');

var UrlRewriter = require('./url-rewriter');

module.exports = function UrlRebase(options, context) {
  var process = function(data) {
    var rebaseOpts = {
      absolute: !!options.root,
      relative: !options.root && !!options.target,
      fromBase: options.relativeTo
    };

    if (!rebaseOpts.absolute && !rebaseOpts.relative)
      return data;

    if (rebaseOpts.absolute && !!options.target)
      context.warnings.push('Both \'root\' and output file given so rebasing URLs as absolute paths');

    if (rebaseOpts.absolute)
      rebaseOpts.toBase = path.resolve(options.root);

    if (rebaseOpts.relative)
      rebaseOpts.toBase = path.resolve(path.dirname(options.target));

    if (!rebaseOpts.fromBase || !rebaseOpts.toBase)
      return data;

    return UrlRewriter.process(data, rebaseOpts);
  };

  return { process: process };
};

redpajama_set_name: RedPajamaGithub


text:
import bpy
from bpy.types import PropertyGroup
from bpy.props import StringProperty
from bpy.props import IntProperty
from bpy.props import FloatVectorProperty
from bpy.props import FloatProperty
from bpy.props import CollectionProperty
from bpy.props import EnumProperty

from mmd_tools.core.model import Model as FnModel
from mmd_tools.core.bone import FnBone
from mmd_tools.core.material import FnMaterial
from mmd_tools import utils

def _get_name(prop):
    return prop.get('name', '')

def _set_name(prop, value):
    mmd_root = prop.id_data.mmd_root
    #morph_type = mmd_root.active_morph_type
    morph_type = '%s_morphs'%prop.bl_rna.identifier[:-5].lower()
    #assert(prop.bl_rna.identifier.endswith('Morph'))
    #print('_set_name:', prop, value, morph_type)
    value = utils.uniqueName(value, getattr(mmd_root, morph_type))
    prop_name = prop.get('name', None)
    if prop_name and prop_name != value:
        if morph_type == 'vertex_morphs':
            for mesh in FnModel(prop.id_data).meshes():
                shape_keys = mesh.data.shape_keys
                if shape_keys is None:
                    continue
                shape_key = shape_keys.key_blocks.get(prop_name, None)
                if shape_key:
                    shape_key.name = value
                    value = shape_key.name

        if 1:#morph_type != 'group_morphs':
            for m in mmd_root.group_morphs:
                for d in m.data:
                    if d.name == prop_name and d.morph_type == morph_type:
                        d.name = value

        for item in mmd_root.display_item_frames[u'表情'].items:
            if item.name == prop_name and item.morph_type == morph_type:
                item.name = value
                break

    prop['name'] = value

class _MorphBase:
    name = StringProperty(
        name='Name',
        description='Japanese Name',
        set=_set_name,
        get=_get_name,
        )
    name_e = StringProperty(
        name='Name(Eng)',
        description='English Name',
        default='',
        )
    category = EnumProperty(
        name='Category',
        description='Select category',
        items = [
            ('SYSTEM', 'Hidden', '', 0),
            ('EYEBROW', 'Eye Brow', '', 1),
            ('EYE', 'Eye', '', 2),
            ('MOUTH', 'Mouth', '', 3),
            ('OTHER', 'Other', '', 4),
            ],
        default='OTHER',
        )

def _get_bone(prop):
    bone_id = prop.get('bone_id', -1)
    if bone_id < 0:
        return ''
    root = prop.id_data
    fnModel = FnModel(root)
    arm = fnModel.armature()
    fnBone = FnBone.from_bone_id(arm, bone_id)
    if not fnBone:
        return ''
    return fnBone.pose_bone.name

def _set_bone(prop, value):
    root = prop.id_data
    fnModel = FnModel(root)
    arm = fnModel.armature()
    if value not in arm.pose.bones.keys():
        prop['bone_id'] = -1
        return
    pose_bone = arm.pose.bones[value]
    fnBone = FnBone(pose_bone)
    prop['bone_id'] = fnBone.bone_id

class BoneMorphData(PropertyGroup):
    """
    """
    bone = StringProperty(
        name='Bone',
        description='Target bone',
        set=_set_bone,
        get=_get_bone,
        )

    bone_id = IntProperty(
        name='Bone ID',
        )

    location = FloatVectorProperty(
        name='Location',
        description='Location',
        subtype='TRANSLATION',
        size=3,
        default=[0, 0, 0],
        )

    rotation = FloatVectorProperty(
        name='Rotation',
        description='Rotation in quaternions',
        subtype='QUATERNION',
        size=4,
        default=[1, 0, 0, 0],
        )

class BoneMorph(_MorphBase, PropertyGroup):
    """Bone Morph
    """
    data = CollectionProperty(
        name='Morph Data',
        type=BoneMorphData,
        )
    active_bone_data = IntProperty(
        name='Active Bone Data',
        min=0,
        default=0,
        )

def _get_material(prop):
    mat_id = prop.get('material_id', -1)
    if mat_id < 0:
        return ''
    fnMat = FnMaterial.from_material_id(mat_id)
    if not fnMat:
        return ''
    return fnMat.material.name

def _set_material(prop, value):
    if value not in bpy.data.materials.keys():
        prop['material_id'] = -1
        return
    mat = bpy.data.materials[value]
    fnMat = FnMaterial(mat)
    prop['material_id'] = fnMat.material_id

def _set_related_mesh(prop, value):
    rig = FnModel(prop.id_data)
    if rig.findMesh(value):
        prop['related_mesh'] = value

def _get_related_mesh(prop):
    return prop.get('related_mesh', '')

class MaterialMorphData(PropertyGroup):
    """
    """
    related_mesh = StringProperty(
        name='Related Mesh',
        description='Stores a reference to the mesh where this morph data belongs to',
        set=_set_related_mesh,
        get=_get_related_mesh,
        )
    offset_type = EnumProperty(
        name='Offset Type',
        description='Select offset type',
        items=[
            ('MULT', 'Multiply', '', 0),
            ('ADD', 'Add', '', 1)
            ],
        default='ADD'
        )
    material = StringProperty(
        name='Material',
        description='Target material',
        get=_get_material,
        set=_set_material,
        )

    material_id = IntProperty(
        name='Material ID',
        default=-1,
        )

    diffuse_color = FloatVectorProperty(
        name='Diffuse Color',
        description='Diffuse color',
        subtype='COLOR',
        size=4,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0, 1],
        )

    specular_color = FloatVectorProperty(
        name='Specular Color',
        description='Specular color',
        subtype='COLOR',
        size=3,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0],
        )

    shininess = FloatProperty(
        name='Reflect',
        description='Reflect',
        soft_min=0,
        soft_max=500,
        step=100.0,
        default=0.0,
        )

    ambient_color = FloatVectorProperty(
        name='Ambient Color',
        description='Ambient color',
        subtype='COLOR',
        size=3,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0],
        )

    edge_color = FloatVectorProperty(
        name='Edge Color',
        description='Edge color',
        subtype='COLOR',
        size=4,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0, 1],
        )

    edge_weight = FloatProperty(
        name='Edge Weight',
        description='Edge weight',
        soft_min=0,
        soft_max=2,
        step=0.1,
        default=0,
        )

    texture_factor = FloatVectorProperty(
        name='Texture factor',
        description='Texture factor',
        subtype='COLOR',
        size=4,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0, 1],
        )

    sphere_texture_factor = FloatVectorProperty(
        name='Sphere Texture factor',
        description='Sphere texture factor',
        subtype='COLOR',
        size=4,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0, 1],
        )

    toon_texture_factor = FloatVectorProperty(
        name='Toon Texture factor',
        description='Toon texture factor',
        subtype='COLOR',
        size=4,
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=[0, 0, 0, 1],
        )

class MaterialMorph(_MorphBase, PropertyGroup):
    """ Material Morph
    """
    data = CollectionProperty(
        name='Morph Data',
        type=MaterialMorphData,
        )
    active_material_data = IntProperty(
        name='Active Material Data',
        min=0,
        default=0,
        )

class UVMorphOffset(PropertyGroup):
    """UV Morph Offset
    """
    index = IntProperty(
        name='Vertex Index',
        description='Vertex index',
        min=0,
        default=0,
        )
    offset = FloatVectorProperty(
        name='UV Offset',
        description='UV offset',
        size=4,
        #min=-1,
        #max=1,
        #precision=3,
        step=0.1,
        default=[0, 0, 0, 0],
        )

class UVMorph(_MorphBase, PropertyGroup):
    """UV Morph
    """
    uv_index = IntProperty(
        name='UV Index',
        description='UV index (UV, UV1 ~ UV4)',
        min=0,
        max=4,
        default=0,
        )
    data = CollectionProperty(
        name='Morph Data',
        type=UVMorphOffset,
        )
    active_uv_data = IntProperty(
        name='Active UV Data',
        min=0,
        default=0,
        )

class GroupMorphOffset(PropertyGroup):
    """Group Morph Offset
    """
    morph_type = EnumProperty(
        name='Morph Type',
        description='Select morph type',
        items = [
            ('material_morphs', 'Material', 'Material Morphs', 0),
            ('uv_morphs', 'UV', 'UV Morphs', 1),
            ('bone_morphs', 'Bone', 'Bone Morphs', 2),
            ('vertex_morphs', 'Vertex', 'Vertex Morphs', 3),
            ('group_morphs', 'Group', 'Group Morphs', 4),
            ],
        default='vertex_morphs',
        )
    factor = FloatProperty(
        name='Factor',
        description='Factor',
        soft_min=0,
        soft_max=1,
        precision=3,
        step=0.1,
        default=0
        )

class GroupMorph(_MorphBase, PropertyGroup):
    """Group Morph
    """
    data = CollectionProperty(
        name='Morph Data',
        type=GroupMorphOffset,
        )
    active_group_data = IntProperty(
        name='Active Group Data',
        min=0,
        default=0,
        )

class VertexMorph(_MorphBase, PropertyGroup):
    """Vertex Morph
    """


text:
package com.indignado.logicbricks.utils.builders.sensors;

import com.indignado.logicbricks.core.sensors.KeyboardSensor;

/**
 * @author Rubentxu.
 */
public class KeyboardSensorBuilder extends SensorBuilder<KeyboardSensor> {

    public KeyboardSensorBuilder() {
        brick = new KeyboardSensor();

    }

    public KeyboardSensorBuilder setKeyCode(int keyCode) {
        brick.keyCode = keyCode;
        return this;

    }

    public KeyboardSensorBuilder setAllKeys(boolean allKeys) {
        brick.allKeys = allKeys;
        return this;

    }

    public KeyboardSensorBuilder setLogToggle(boolean logToggle) {
        brick.logToggle = logToggle;
        return this;

    }

    public KeyboardSensorBuilder setTarget(String target) {
        brick.target = target;
        return this;

    }

    @Override
    public KeyboardSensor getBrick() {
        KeyboardSensor brickTemp = brick;
        brick = new KeyboardSensor();
        return brickTemp;

    }

}


text:
using Xunit;

namespace WmcSoft
{
    public class NullableExtensionsTests
    {
        [Fact]
        public void CheckFormattable()
        {
            double? d = 3.14159d;
            var expected = d.GetValueOrDefault().ToString("g");
            var actual = d.ToString("g");
            Assert.Equal(expected, actual);
        }

        //[Fact]
        //public void CheckBind() {
        //    TimeSpan? t = null;
        //    var actual = t.Bind(x => x.TotalSeconds);
        //    Assert.Equal(0d, actual);
        //}

        //[Fact]
        //public void CheckMap() {
        //    TimeSpan? t = null;
        //    var actual = t.Map(x => x.TotalSeconds);
        //    Assert.Equal(null, actual);
        //}
    }
}


text:
module Pod
  module Downloader
    # Concreted Downloader class that provides support for specifications with
    # git sources.
    #
    class Git < Base
      def self.options
        [:commit, :tag, :branch, :submodules]
      end

      def options_specific?
        !(options[:commit] || options[:tag]).nil?
      end

      def checkout_options
        options = {}
        options[:git] = url
        options[:commit] = target_git('rev-parse', 'HEAD').chomp
        options[:submodules] = true if self.options[:submodules]
        options
      end

      def self.preprocess_options(options)
        return options unless options[:branch]

        command = ['ls-remote',
                   options[:git],
                   options[:branch]]
        output = Git.execute_command('git', command)
        match = /^([a-z0-9]*)\t.*/.match(output)

        return options if match.nil?

        options[:commit] = match[1]
        options.delete(:branch)

        options
      end

      private

      # @!group Base class hooks

      def download!
        clone
        checkout_commit if options[:commit]
      end

      # @return [void] Checks out the HEAD of the git source in the destination
      #         path.
      #
      def download_head!
        clone(true)
      end

      # @!group Download implementations

      executable :git

      # Clones the repo. If possible the repo will be shallowly cloned.
      #
      # @note   The `:commit` option requires a specific strategy as it is not
      #         possible to specify the commit to the `clone` command.
      #
      # @note   `--branch` command line option can also take tags and detaches
      #         the HEAD.
      #
      # @param  [Bool] force_head
      #         If any specific option should be ignored and the HEAD of the
      #         repo should be cloned.
      #
      # @param  [Bool] shallow_clone
      #         Whether a shallow clone of the repo should be attempted, if
      #         possible given the specified {#options}.
      #
      def clone(force_head = false, shallow_clone = true)
        ui_sub_action('Git download') do
          begin
            git! clone_arguments(force_head, shallow_clone)
            update_submodules
          rescue DownloaderError => e
            if e.message =~ /^fatal:.*does not support --depth$/im
              clone(force_head, false)
            else
              raise
            end
          end
        end
      end

      def update_submodules
        return unless options[:submodules]
        target_git %w(submodule update --init --recursive)
      end

      # The arguments to pass to `git` to clone the repo.
      #
      # @param  [Bool] force_head
      #         If any specific option should be ignored and the HEAD of the
      #         repo should be cloned.
      #
      # @param  [Bool] shallow_clone
      #         Whether a shallow clone of the repo should be attempted, if
      #         possible given the specified {#options}.
      #
      # @return [Array<String>] arguments to pass to `git` to clone the repo.
      #
      def clone_arguments(force_head, shallow_clone)
        command = ['clone', url, target_path, '--template=']

        if shallow_clone && !options[:commit]
          command += %w(--single-branch --depth 1)
        end

        unless force_head
          if tag_or_branch = options[:tag] || options[:branch]
            command += ['--branch', tag_or_branch]
          end
        end

        command
      end

      # Checks out a specific commit of the cloned repo.
      #
      def checkout_commit
        target_git 'checkout', '--quiet', options[:commit]
        update_submodules
      end

      def target_git(*args)
        git!(['-C', target_path] + args)
      end
    end
  end
end


text:
//   Copyright 2004-2014 Jim Voris
//
//   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.
//
// $FilePath$
//     $Date: Wednesday, March 21, 2012 10:31:03 PM $
//   $Header: DatabaseManagerTest.java Revision:1.3 Wednesday, March 21, 2012 10:31:03 PM JimVoris $
// $Copyright © 2011-2012 Define this string in the qvcs.keywords.properties property file $

package com.qumasoft.server;

import com.qumasoft.TestHelper;
import java.sql.Connection;
import java.sql.SQLException;
import org.junit.After;
import org.junit.AfterClass;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
 * Test the Database manager class.
 *
 * @author $Author: JimVoris $
 */
public class DatabaseManagerTest {

    private static final String DERBY_TEST_DIRECTORY = "/temp/qvcse/dbManagerUnitTest";

    /**
     * Execute this stuff once when the class is loaded.
     *
     * @throws Exception if we have a problem with initialization.
     */
    @BeforeClass
    public static void setUpClass() throws Exception {
        TestHelper.emptyDerbyTestDirectory(DERBY_TEST_DIRECTORY);
        DatabaseManager.getInstance().setDerbyHomeDirectory(DERBY_TEST_DIRECTORY);
    }

    /**
     * Execute this just once after we complete all the tests defined in this class.
     *
     * @throws Exception if we have a problem tearing things down.
     */
    @AfterClass
    public static void tearDownClass() throws Exception {
        DatabaseManager.getInstance().shutdownDatabase();
    }

    /**
     * Set up the things common to all the tests.
     */
    @Before
    public void setUp() {
    }

    /**
     * We tear this down after each test.
     */
    @After
    public void tearDown() {
    }

    /**
     * Test of initializeDatabase method, of class DatabaseManager.
     *
     * @throws SQLException if there was a db problem.
     */
    @Test
    public void testInitializeDatabase() throws SQLException {
        System.out.println("initializeDatabase");
        DatabaseManager.getInstance().initializeDatabase();
    }

    /**
     * Test of getConnection method, of class DatabaseManager.
     *
     * @throws SQLException if there was a db problem.
     */
    @Test
    public void testGetConnection() throws SQLException {
        System.out.println("getConnection");
        Connection result = DatabaseManager.getInstance().getConnection();
        assertNotNull("Got unexpected null for db connection", result);
    }

    /**
     * Test of closeConnection method, of class DatabaseManager.
     *
     * @throws SQLException if there was a db problem.
     */
    @Test
    public void testCloseConnection() throws SQLException {
        System.out.println("closeConnection");
        DatabaseManager.getInstance().closeConnection();
    }
}


text:
package gnu.javax.net.ssl.provider;

import gnu.classpath.debug.Component;
import gnu.classpath.debug.SystemLogger;

/**
 * @author Casey Marshall (csm@gnu.org)
 */
public abstract class DelegatedTask implements Runnable
{
  private static final SystemLogger logger = SystemLogger.SYSTEM;
  private boolean hasRun;
  protected Throwable thrown;

  protected DelegatedTask()
  {
    hasRun = false;
  }

  public final void run()
  {
    if (hasRun)
      throw new IllegalStateException("task already ran");
    try
      {
        if (Debug.DEBUG)
          logger.logv(Component.SSL_DELEGATED_TASK,
                      "running delegated task {0} in {1}", this,
                      Thread.currentThread());
        implRun();
      }
    catch (Throwable t)
      {
        if (Debug.DEBUG)
          logger.log(Component.SSL_DELEGATED_TASK, "task threw exception", t);
        thrown = t;
      }
    finally
      {
        hasRun = true;
      }
  }

  public final boolean hasRun()
  {
    return hasRun;
  }

  public final Throwable thrown()
  {
    return thrown;
  }

  protected abstract void implRun() throws Throwable;
}


text:
package collector

import "github.com/prometheus/client_golang/prometheus"

const namespace = "mail"

var (
	openConnections = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "mail_open_connections",
		Help: "Number of open connections to the server.",
	}, []string{"protocol"})

	mailsTransferred = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "mail_mails_transferred",
		Help: "Transferred mails in any direction",
	}, []string{"direction"})

	greylistedMail = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "mail_greylisted",
		Help: "Count of greylisted or passed mails.",
	}, []string{"status"})

	blockedCounter = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "mail_incoming_blocked",
		Help: "Blocked incoming mails.",
	})

	bouncedCounter = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "mail_outgoing_bounced",
		Help: "Outgoing mails that bounced.",
	})
)

func RegisterMetrics() {
	prometheus.MustRegister(openConnections)
	prometheus.MustRegister(mailsTransferred)
	prometheus.MustRegister(greylistedMail)
	prometheus.MustRegister(blockedCounter)
	prometheus.MustRegister(bouncedCounter)
}


text:
package org.elasticsearch.cluster.routing.allocation;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.ESAllocationTestCase;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.RoutingNodes;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.common.settings.Settings;

import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

public class PrimaryElectionRoutingTests extends ESAllocationTestCase {
    private final Logger logger = LogManager.getLogger(PrimaryElectionRoutingTests.class);

    public void testBackupElectionToPrimaryWhenPrimaryCanBeAllocatedToAnotherNode() {
        AllocationService strategy = createAllocationService(Settings.builder()
            .put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());

        logger.info("Building initial routing table");

        Metadata metadata = Metadata.builder()
                .put(IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1))
                .build();

        RoutingTable routingTable = RoutingTable.builder()
                .addAsNew(metadata.index("test"))
                .build();

        ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING
            .getDefault(Settings.EMPTY)).metadata(metadata).routingTable(routingTable).build();

        logger.info("Adding two nodes and performing rerouting");
        clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().add(newNode("node1"))).build();
        clusterState = strategy.reroute(clusterState, "reroute");

        clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes())
            .add(newNode("node2"))).build();
        clusterState = strategy.reroute(clusterState, "reroute");

        logger.info("Start the primary shard (on node1)");
        RoutingNodes routingNodes = clusterState.getRoutingNodes();
        clusterState = startInitializingShardsAndReroute(strategy, clusterState, routingNodes.node("node1"));

        logger.info("Start the backup shard (on node2)");
        routingNodes = clusterState.getRoutingNodes();
        clusterState = startInitializingShardsAndReroute(strategy, clusterState, routingNodes.node("node2"));

        logger.info("Adding third node and reroute and kill first node");
        clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes())
            .add(newNode("node3")).remove("node1")).build();
        RoutingTable prevRoutingTable = clusterState.routingTable();
        clusterState = strategy.disassociateDeadNodes(clusterState, true, "reroute");
        routingNodes = clusterState.getRoutingNodes();
        routingTable = clusterState.routingTable();

        assertThat(prevRoutingTable != routingTable, equalTo(true));
        assertThat(routingTable.index("test").shards().size(), equalTo(1));
        assertThat(routingNodes.node("node1"), nullValue());
        assertThat(routingNodes.node("node2").numberOfShardsWithState(STARTED), equalTo(1));
        assertThat(routingNodes.node("node3").numberOfShardsWithState(INITIALIZING), equalTo(1));
        // verify where the primary is
        assertThat(routingTable.index("test").shard(0).primaryShard().currentNodeId(), equalTo("node2"));
        assertThat(clusterState.metadata().index("test").primaryTerm(0), equalTo(2L));
        assertThat(routingTable.index("test").shard(0).replicaShards().get(0).currentNodeId(), equalTo("node3"));
    }

    public void testRemovingInitializingReplicasIfPrimariesFails() {
        AllocationService allocation = createAllocationService(Settings.builder()
            .put("cluster.routing.allocation.node_concurrent_recoveries", 10).build());

        logger.info("Building initial routing table");

        Metadata metadata = Metadata.builder()
                .put(IndexMetadata.builder("test").settings(settings(Version.CURRENT)).numberOfShards(2).numberOfReplicas(1))
                .build();

        RoutingTable routingTable = RoutingTable.builder()
                .addAsNew(metadata.index("test"))
                .build();

        ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING
            .getDefault(Settings.EMPTY)).metadata(metadata).routingTable(routingTable).build();

        logger.info("Adding two nodes and performing rerouting");
        clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().add(newNode("node1"))
            .add(newNode("node2"))).build();
        clusterState = allocation.reroute(clusterState, "reroute");

        logger.info("Start the primary shards");
        clusterState = startInitializingShardsAndReroute(allocation, clusterState);
        RoutingNodes routingNodes = clusterState.getRoutingNodes();

        assertThat(routingNodes.shardsWithState(STARTED).size(), equalTo(2));
        assertThat(routingNodes.shardsWithState(INITIALIZING).size(), equalTo(2));
        assertThat(clusterState.metadata().index("test").primaryTerm(0), equalTo(1L));
        assertThat(clusterState.metadata().index("test").primaryTerm(1), equalTo(1L));

        // now, fail one node, while the replica is initializing, and it also holds a primary
        logger.info("--> fail node with primary");
        String nodeIdToFail = clusterState.routingTable().index("test").shard(0).primaryShard().currentNodeId();
        String nodeIdRemaining = nodeIdToFail.equals("node1") ? "node2" : "node1";
        clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().add(newNode(nodeIdRemaining))).build();
        clusterState = allocation.disassociateDeadNodes(clusterState, true, "reroute");
        routingNodes = clusterState.getRoutingNodes();

        assertThat(routingNodes.shardsWithState(STARTED).size(), equalTo(1));
        assertThat(routingNodes.shardsWithState(INITIALIZING).size(), equalTo(0));
        assertThat(routingNodes.shardsWithState(UNASSIGNED).size(), equalTo(3)); // 2 replicas and one primary
        assertThat(routingNodes.node(nodeIdRemaining).shardsWithState(STARTED).get(0).primary(), equalTo(true));
        assertThat(clusterState.metadata().index("test").primaryTerm(0), equalTo(2L));

    }
}


text:
using System;
using System.Data;

namespace OpenADK.Library
{
    /// <summary>
    /// Represents a set of type converters that use SIFFormatter instances to convert
    /// Strings into SIFSimpleType instances
    /// </summary>
    /// <typeparam name="T">The datatype that a particular type converter is capable of converting,
    /// such as bool? DateTime?, etc.</typeparam>
    public abstract class SifTypeConverter<T> : TypeConverter
    {
        SifSimpleType TypeConverter.Parse( SifFormatter formatter,
                                           string xmlValue )
        {
            return Parse( formatter, xmlValue );
        }

        /// <summary>
        /// Converts the native datatype to the datatype used by the ADK. e.g. converts an 'int' to a 'SifInt'
        /// </summary>
        /// <param name="nativeType"></param>
        /// <returns>A SifsimpleType of the appropriate value</returns>
        /// <exception cref="InvalidCastException">This conversion is not supported</exception>
        public virtual SifSimpleType GetSifSimpleType( object nativeType )
        {
            if ( nativeType == null ) {
                return GetSifSimpleType( default(T) );
            }
            if ( !(nativeType is T) ) {
                // Try converting the object. This will throw a ClassCastExcption if it does not succeed
                nativeType = Convert.ChangeType( nativeType, this.TypeCode );
            }
            return GetSifSimpleType( (T) nativeType );
        }

        /// <summary>
        /// Parses the given XML string value into a SIFSimpleType instance
        /// </summary>
        /// <param name="formatter">the formatter to use for the specific version of SIF being parsed</param>
        /// <param name="xmlValue">The XML string value</param>
        /// <returns>A SIFSimpleType instance</returns>
        /// <exception cref="AdkParsingException">thrown if the value cannot be parsed</exception>
        public abstract SifSimpleType Parse( SifFormatter formatter,
                                             string xmlValue );

        /// <summary>
        /// Returns a SifSiimpleType instance that wraps the specified native value
        /// </summary>
        /// <param name="nativeType">An instance of the native type object, such as
        /// a String or DateTime</param>
        /// <returns>The appropriate AdkDataType instantiation for this instance</returns>
        public abstract SifSimpleType GetSifSimpleType( T nativeType );

        /// <summary>
        /// Converts the given SIFSimpleType instance to an XML string value
        /// </summary>
        /// <param name="formatter">The formatter to sue for the current version of SIF being written to</param>
        /// <param name="value">The value to write</param>
        /// <returns>A string representing the XML payload used for the specified version
        /// of SIF. All types are nullable in SIF, so the resulting value could be null/</returns>
        public abstract String ToString( SifFormatter formatter,
                                         AdkDataType<T> value );

        /// <summary>
        /// A value from the SifDataType enum
        /// </summary>
        public abstract SifDataType DataType { get; }

        /// <summary>
        /// The System.Data.DbType value for this data type
        /// </summary>
        public abstract DbType DbType { get; }

        /// <summary>
        /// The native .Net TypeCode for this data type
        /// </summary>
        public abstract TypeCode TypeCode { get; }

        /// <summary>
        /// Parses the XML string value and returns the proper SimpleField instance to hold
        /// the element value
        /// </summary>
        /// <param name="parent">The parent SIFElement of this field</param>
        /// <param name="id">The metadata definition of the field</param>
        /// <param name="formatter">The formatter to use for the specific version of SIF being parsed</param>
        /// <param name="xmlValue">A string representing the XML payload being used for this version of SIF</param>
        /// <returns>A simple field initialized with the proper value</returns>
        /// <exception cref="AdkTypeParseException">thrown if the value cannot be parsed according to the
        /// formatting rules for this version of SIF</exception>
        public SimpleField ParseField(
            SifElement parent,
            IElementDef id,
            SifFormatter formatter,
            string xmlValue )
        {
            return Parse( formatter, xmlValue ).CreateField( parent, id );
        }
    }
}


text:
package com.nerodesk.om.mock;

import com.nerodesk.om.Attributes;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.UserDefinedFileAttributeView;
import java.util.Date;
import org.apache.commons.io.FileUtils;

/**
 * Mock of document attributes.
 *
 * @author Krzysztof Krason (Krzysztof.Krason@gmail.com)
 * @version $Id$
 * @since 0.4
 */
public final class MkAttributes implements Attributes {
    /**
     * The "visibility" attribute.
     */
    private static final String VISIBILITY = "nerodesk.mkattributes.visibility";

    /**
     * File of document.
     */
    private final transient File file;

    /**
     * Constructor.
     * @param fle File to use
     */
    public MkAttributes(final File fle) {
        this.file = fle;
    }

    @Override
    public long size() throws IOException {
        return FileUtils.sizeOf(this.file);
    }

    @Override
    public String type() throws IOException {
        String type = Files.probeContentType(this.file.toPath());
        if (type == null) {
            type = "unknown";
        }
        return type;
    }

    @Override
    public Date created() throws IOException {
        return new Date(
            Files.readAttributes(
                this.file.toPath(), BasicFileAttributes.class
            ).creationTime().toMillis()
        );
    }

    @Override
    public boolean visible() throws IOException {
        final boolean shown;
        final UserDefinedFileAttributeView view =
            Files.getFileAttributeView(
                this.file.toPath(), UserDefinedFileAttributeView.class
            );
        if (view.list().contains(MkAttributes.VISIBILITY)) {
            final ByteBuffer buf = ByteBuffer.allocate(
                view.size(MkAttributes.VISIBILITY)
            );
            view.read(MkAttributes.VISIBILITY, buf);
            buf.flip();
            shown = Boolean.valueOf(
                StandardCharsets.UTF_8.decode(buf).toString()
            );
        } else {
            shown = false;
        }
        return shown;
    }

    @Override
    public void show(final boolean shwn) throws IOException {
        Files.getFileAttributeView(
            this.file.toPath(), UserDefinedFileAttributeView.class
        ).write(
                MkAttributes.VISIBILITY,
                StandardCharsets.UTF_8.encode(String.valueOf(shwn))
            );
    }
}


text:
<?php

namespace Foodcloud\APILibrary\Facades;

use Illuminate\Support\Facades\Facade;

/**
 * This is the foodcloud facade class.
 *
 * @author Jillberth Estillore <ejillberth@gmail.com>
 */
class Foodcloud extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return \Foodcloud\APILibrary\Foodcloud::class;
    }
}


text:
package quasar.db

import slamdata.Predef._

import doobie.imports._
import scalaz.concurrent.Task

final case class StatefulTransactor(transactor: Transactor[Task], shutdown: Task[Unit])


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <title>{{ site.name }} - {{ site.description }}</title>
    <meta name="description" content="{{ site.meta_description}}" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="MobileOptimized" content="320" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" type="text/css" href="/assets/css/screen.css" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

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

    <link rel="apple-touch-icon" sizes="57x57" href="/assets/icons.ico/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/assets/icons.ico/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/assets/icons.ico/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/assets/icons.ico/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/assets/icons.ico/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/assets/icons.ico/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/assets/icons.ico/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/assets/icons.ico/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/assets/icons.ico/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192" href="/assets/icons.ico/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/assets/icons.ico/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="/assets/icons.ico/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/assets/icons.ico/favicon-16x16.png">
    <link rel="manifest" href="/assets/icons.ico/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">

    {% include nav.html %}

    {{ content }}

        {{ site.name }} ©
              {{date format="YYYY"}} • All rights reserved.

Made with Jekyll using
        Kasper theme

    {% include ga.html %}


text:
package seedu.taskmanager.model.task;

import static seedu.taskmanager.logic.commands.SortCommand.SORT_KEYWORD_STARTDATE;

import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.taskmanager.commons.core.UnmodifiableObservableList;
import seedu.taskmanager.commons.exceptions.DuplicateDataException;
import seedu.taskmanager.commons.util.CollectionUtil;

/**
 * A list of tasks that enforces uniqueness between its elements and does not
 * allow nulls.
 *
 * Supports a minimal set of list operations.
 *
 * @see Task#equals(Object)
 * @see CollectionUtil#elementsAreUnique(Collection)
 */
public class UniqueTaskList implements Iterable<Task> {
    private final ObservableList<Task> internalList = FXCollections.observableArrayList();
    // @@author A0131278H
    public static final String KEYWORD_UNDEFINED = "undefined";
    private String sortCriterion = KEYWORD_UNDEFINED;
    // @@author

    /**
     * Returns true if the list contains an equivalent task as the given
     * argument.
     */
    public boolean contains(ReadOnlyTask toCheck) {
        assert toCheck != null;
        return internalList.contains(toCheck);
    }

    // @@author A0131278H
    /**
     * Adds a task to the list. Resort the list if it was already sorted.
     *
     * @return index of new task if list is sorted or size-1 if list in unsorted
     *
     * @throws DuplicateTaskException
     *             if the task to add is a duplicate of an existing task in the
     *             list.
     */
    public void add(Task toAdd) throws DuplicateTaskException {
        assert toAdd != null;
        // @@author A0114269E
        if ((toAdd.getStatus().value == false) && contains(toAdd)) {
            throw new DuplicateTaskException();
        }
        // @@author
        internalList.add(toAdd);
        // @@author A0131278H
        if (!sortCriterion.equals(KEYWORD_UNDEFINED)) {
            sortByDate(sortCriterion);
        }
        // @@author
    }

    /**
     * Updates the task in the list at position {@code index} with
     * {@code editedTask}. Resort the list if it was already sorted.
     *
     * @return updatedIndex if the internal list is sorted or input index if
     *         list is unsorted
     *
     * @throws DuplicateTaskException
     *             if updating the task's details causes the task to be
     *             equivalent to another existing task in the list.
     * @throws IndexOutOfBoundsException
     *             if {@code index} < 0 or >= the size of the list.
     */
    public void updateTask(int index, ReadOnlyTask editedTask) throws DuplicateTaskException {
        assert editedTask != null;

        Task taskToUpdate = internalList.get(index);
        // @@author A0114269E
        if ((editedTask.getStatus().value == false) && !taskToUpdate.equals(editedTask)
                && internalList.contains(editedTask)) {
            throw new DuplicateTaskException();
        }
        // @@author

        taskToUpdate.resetData(editedTask);
        internalList.set(index, taskToUpdate);
        // @@author A0131278H
        if (!sortCriterion.equals(KEYWORD_UNDEFINED)) {
            sortByDate(sortCriterion);
        }
        // @@author
    }

    // @@author

    /**
     * Removes the equivalent task from the list.
     *
     * @throws TaskNotFoundException
     *             if no such task could be found in the list.
     */
    public boolean remove(ReadOnlyTask toRemove) throws TaskNotFoundException {
        assert toRemove != null;
        final boolean taskFoundAndDeleted = internalList.remove(toRemove);
        if (!taskFoundAndDeleted) {
            throw new TaskNotFoundException();
        }
        return taskFoundAndDeleted;
    }

    public void setTasks(UniqueTaskList replacement) {
        this.internalList.setAll(replacement.internalList);
    }

    public void setTasks(List<? extends ReadOnlyTask> tasks) throws DuplicateTaskException {
        final UniqueTaskList replacement = new UniqueTaskList();
        for (final ReadOnlyTask task : tasks) {
            replacement.add(new Task(task));
        }
        setTasks(replacement);
    }

    public UnmodifiableObservableList<Task> asObservableList() {
        return new UnmodifiableObservableList<>(internalList);
    }

    @Override
    public Iterator<Task> iterator() {
        return internalList.iterator();
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof UniqueTaskList // instanceof handles nulls
                        && this.internalList.equals(((UniqueTaskList) other).internalList));
    }

    @Override
    public int hashCode() {
        return internalList.hashCode();
    }

    /**
     * Signals that an operation would have violated the 'no duplicates'
     * property of the list.
     */
    public static class DuplicateTaskException extends DuplicateDataException {
        protected DuplicateTaskException() {
            super("Operation would result in duplicate tasks");
        }
    }

    /**
     * Signals that an operation targeting a specified task in the list would
     * fail because there is no such matching task in the list.
     */
    public static class TaskNotFoundException extends Exception {
    }

    // @@author A0131278H

    /**
     * Sorts task list based on keywords (StartDate or EndDate). Tasks without
     * start StartDate or EndDate are ranked at the bottom.
     */
    public void sortByDate(String keyword) {
        this.sortCriterion = keyword;
        internalList.sort(new DateComparator(sortCriterion));
    }

    /**
     * Filters task list based on task status (Done or Not Done).
     */
    public ObservableList<Task> getTaskListByStatus(String status) {
        if (status.equals(Status.STATUS_DONE)) {
            return internalList.filtered(StatusPredicate.isDone());
        } else if (status.equals(Status.STATUS_NOT_DONE)) {
            return internalList.filtered(StatusPredicate.isNotDone());
        } else {
            return internalList; // return list of all task if status is invalid
        }
    }

    // @@author A0114523U
    /**
     * Filters task list to show overdue tasks
     */
    public ObservableList<Task> getTodayTaskList(Date today) {
        return internalList.filtered(TodayTaskPredicate.dueToday(today));
    }

    /**
     * Filters task list to show overdue tasks
     */
    public ObservableList<Task> getOverdueTaskList(Date today) {
        return internalList.filtered(OverdueTaskPredicate.overdue(today));
    }

    // ========== Inner classes/interfaces used for filtering and comparison
    static class StatusPredicate {

        public static Predicate<Task> isDone() {
            return p -> p.getStatus().toString().equals(Status.STATUS_DONE);
        }

        public static Predicate<Task> isNotDone() {
            return p -> p.getStatus().toString().equals(Status.STATUS_NOT_DONE);
        }
    }

    static class OverdueTaskPredicate {

        public static Predicate<Task> overdue(Date today) {
            return p -> p.getEndDate().isPresent() && !p.getStatus().value ?
                    p.getEndDate().get().before(today) : false;
        }

    }

    static class TodayTaskPredicate {

        public static Predicate<Task> dueToday(Date today) {
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            return p -> p.getEndDate().isPresent() && !p.getStatus().value
                    ? sdf.format(today).equals(sdf.format(p.getEndDate().get())) : false;
        }

    }
    // @@author A0131278H

    class DateComparator implements Comparator<Task> {
        String sortCriterion;

        public DateComparator(String sortCriterion) {
            this.sortCriterion = sortCriterion;
        }

        @Override
        public int compare(Task t1, Task t2) {
            if (sortCriterion.equals(SORT_KEYWORD_STARTDATE)) {
                return this.compareByStartDate(t1, t2);
            } else {
                return this.compareByEndDate(t1, t2);
            }
        }

        private int compareByStartDate(Task t1, Task t2) {
            if (t1.getStartDate().isPresent() && t2.getStartDate().isPresent()) {
                return t1.getStartDate().get().compareTo(t2.getStartDate().get());
            }
            // @@author A0140032E
            if (!t1.getStartDate().isPresent() && !t2.getStartDate().isPresent()) {
                return 0;
            } else if (t1.getStartDate().isPresent()) {
                return -1;
            } else {
                return 1;
            }
            // @@author A0131278H
        }

        private int compareByEndDate(Task t1, Task t2) {
            if (t1.getEndDate().isPresent() && t2.getEndDate().isPresent()) {
                return t1.getEndDate().get().compareTo(t2.getEndDate().get());
            }
            // @@author A0140032E
            if (!t1.getEndDate().isPresent() && !t2.getEndDate().isPresent()) {
                return 0;
            } else if (t1.getEndDate().isPresent()) {
                return -1;
            } else {
                return 1;
            }
        }
    }
}


text:
package org.spongepowered.api.entity;

import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.manipulator.mutable.entity.FallingBlockData;
import org.spongepowered.api.data.value.mutable.Value;

/**
 * Represents a falling block. A falling block may harm entities where it lands,
 * and optionally may place a block, or drop an item.
 */
public interface FallingBlock extends Entity {

    /**
     * Gets a copy of the currently used {@link FallingBlockData}.
     *
     * @return A copy of the currently used falling block data
     */
    default FallingBlockData getFallingBlockData() {
        return get(FallingBlockData.class).get();
    }

    /**
     * Gets the {@link Value} for the damage to deal per block the
     * {@link FallingBlock} has fallen.
     *
     * @return The immutable value for the damage per block of falling
     */
    default Value<Double> fallDamagePerBlock() {
        return getValue(Keys.FALL_DAMAGE_PER_BLOCK).get();
    }

    /**
     * Gets the maximum damage the {@link FallingBlock} can deal to another
     * entity for falling on the entity.
     *
     * @return The maximum damage the block can deal
     */
    default Value<Double> maxFallDamage() {
        return getValue(Keys.MAX_FALL_DAMAGE).get();
    }

    /**
     * Gets the {@link BlockState} the falling block is representing.
     *
     * @return The falling block's block state
     */
    default Value<BlockState> blockState() {
        return getValue(Keys.FALLING_BLOCK_STATE).get();
    }

    /**
     * Gets whether this falling block will try to place itself where it lands.
     *
     * @return True if this block will attempt to place itself when it lands
     */
    default Value<Boolean> canPlaceAsBlock() {
        return getValue(Keys.CAN_PLACE_AS_BLOCK).get();
    }

    /**
     * Gets whether this falling block can drop as an item if it lands in a way
     * that it can not be placed.
     *
     * @return Whether this falling block can drop as an item
     */
    default Value<Boolean> canDropAsItem() {
        return getValue(Keys.CAN_DROP_AS_ITEM).get();
    }

    /**
     * Gets the time the block has been falling. Defaults to a value of 1.
     *
     * @return The time the block has been falling
     */
    default Value<Integer> fallTime() {
        return getValue(Keys.FALL_TIME).get();
    }

    /**
     * Gets whether this falling block will damage entities where it lands.
     *
     * @return Whether this falling block will damage entities where it lands
     */
    default Value<Boolean> canHurtEntities() {
        return getValue(Keys.FALLING_BLOCK_CAN_HURT_ENTITIES).get();
    }

}


text:
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.Extensions.Logging;
using Umbraco.Extensions;

namespace Umbraco.Cms.Web.BackOffice.Filters
{
    /// <summary>
    /// Logs any unhandled exception.
    /// </summary>
    public class UnhandledExceptionLoggerMiddleware : IMiddleware
    {
        private readonly ILogger<UnhandledExceptionLoggerMiddleware> _logger;

        public UnhandledExceptionLoggerMiddleware(ILogger<UnhandledExceptionLoggerMiddleware> logger)
        {
            _logger = logger;
        }

        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            // If it's a client side request just call next and don't try to log anything
            if (context.Request.IsClientSideRequest())
            {
                await next(context);
            }
            else
            {
                // Call the next middleware, and catch any errors that occurs in the rest of the pipeline
                try
                {
                    await next(context);
                }
                catch (Exception e)
                {
                    _logger.LogError(e, "Unhandled controller exception occurred for request '{RequestUrl}'", context.Request.GetEncodedPathAndQuery());
                    // Throw the error again, just in case it gets handled
                    throw;
                }
            }
        }
    }
}


text:
<?php

namespace NovaPoshta\MethodParameters;

/**
 * Параметры метода getDocumentPrice модели InternetDocument
 *
 * Class InternetDocument_documentsTracking
 * @package NovaPoshta\DataMethods
 * @property string CitySender
 * @property string CityRecipient
 * @property string ServiceType
 * @property float  Weight
 * @property float  Cost
 * @property string DateTime
 */
class InternetDocument_getDocumentPrice extends MethodParameters
{
    /**
     * Устанавливает реф города отправителя
     *
     * @param string $value
     * @return $this
     */
    public function setCitySender($value)
    {
        $this->CitySender = $value;
        return $this;
    }

    /**
     * Получить реф города отправителя
     *
     * @return string
     */
    public function getCitySender()
    {
        return $this->CitySender;
    }

    /**
     * Устанавливает реф города получателя
     *
     * @param string $value
     * @return $this
     */
    public function setCityRecipient($value)
    {
        $this->CityRecipient = $value;
        return $this;
    }

    /**
     * Получить реф города получателя
     *
     * @return string
     */
    public function getCityRecipient()
    {
        return $this->CityRecipient;
    }

    /**
     * Устанавливает технологию доставки
     *
     * @param string $value
     * @return $this
     */
    public function setServiceType($value)
    {
        $this->ServiceType = $value;
        return $this;
    }

    /**
     * Получить технологию доставки
     *
     * @return string
     */
    public function getServiceType()
    {
        return $this->ServiceType;
    }

    /**
     * Устанавливает вес
     *
     * @param float $value
     * @return $this
     */
    public function setWeight($value)
    {
        $this->Weight = $value;
        return $this;
    }

    /**
     * Получить вес
     *
     * @return float
     */
    public function getWeight()
    {
        return $this->Weight;
    }

    /**
     * Устанавливает цену
     *
     * @param float $value
     * @return $this
     */
    public function setCost($value)
    {
        $this->Cost = $value;
        return $this;
    }

    /**
     * Получить цену
     *
     * @return float
     */
    public function getCost()
    {
        return $this->Cost;
    }

    /**
     * Устанавливает дату
     *
     * @param string $value
     * @return $this
     */
    public function setDateTime($value)
    {
        $this->DateTime = $value;
        return $this;
    }

    /**
     * Получить дату
     *
     * @return string
     */
    public function getDateTime()
    {
        return $this->DateTime;
    }
}


text:
	<form class="login-form" (ngSubmit)="onSubmit()" #loginForm="ngForm">

		<input type="text" class="input-text" placeholder="type your username" required
               [(ngModel)]="model.username" ngControl="username"
               ngControl="username"  #iusername="ngForm">

		<input type="password" class="input-text" placeholder="type your password" required
               [(ngModel)]="model.password" ngControl="password"
               ngControl="password"  #password="ngForm">

        <input type="submit" class="btn-login" [disabled]="!loginForm.form.valid"
               value="QUOTE THEM ALL!">

	</form>


text:
'use strict';

if (typeof Promise === 'function') {
  module.exports = Promise;
}
else {
  module.exports = require('es6-promise').Promise;
}


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

package com.rfc2445.antonchik.android.iter;

import com.rfc2445.antonchik.android.values.DateValue;
import com.rfc2445.antonchik.android.values.TimeValue;

/**
 * DateValue comparison methods.
 *
When we're pulling dates off the priority order, we need them to come off
 * in a consistent order, so we need a total ordering on date values.
 *
This means that a DateValue with no time must not be equal to a
 * DateTimeValue at midnight.  Since it obviously doesn't make sense for a
 * DateValue to be after a DateTimeValue the same day at 23:59:59, we put the
 * DateValue before 0 hours of the same day.
 *
If we didn't have a total ordering, then it would be harder to correctly
 * handle the case
 *

 *   RDATE:20060607
 *   EXDATE:20060607
 *   EXDATE:20060607T000000Z
 *

 * because we'd have two exdates that are equal according to the comparison, but
 * only the first should match.
 *
In the following example
 *

 *   RDATE:20060607
 *   RDATE:20060607T000000Z
 *   EXDATE:20060607
 *

 * the problem is worse because we may pull a candidate RDATE off the
 * priority queue and then not know whether to consume the EXDATE or not.
 *
Absent a total ordering, the following case could only be solved with
 * lookahead and ugly logic.
 *

 *   RDATE:20060607
 *   RDATE:20060607T000000Z
 *   EXDATE:20060607
 *   EXDATE:20060607T000000Z
 *

 *
The conversion to GMT is also an implementation detail, so it's not clear
 * which timezone we should consider midnight in, and a total ordering allows
 * us to avoid timezone conversions during iteration.

 *
 * @author mikesamuel+svn@gmail.com (Mike Samuel)
 */
final class DateValueComparison {

  /**
   * reduces a date to a value that can be easily compared to others, consistent
   * with {@link com.google.ical.values.DateValueImpl#compareTo}.
   */
  static long comparable(DateValue dv) {
    long comp = (((((long) dv.year()) << 4) + dv.month()) << 5) + dv.day();
    if (dv instanceof TimeValue) {
      TimeValue tv = (TimeValue) dv;
      // We add 1 to comparable for timed values to make sure that timed
      // events are distinct from all-day events, in keeping with
      // DateValue.compareTo.

      // It would be odd if an all day exclusion matched a midnight event on
      // the same day, but not one at another time of day.
      return (((((comp << 5) + tv.hour()) << 6) + tv.minute()) << 6)
        +  tv.second() + 1;
    } else {
      return comp << 17;
    }
  }

  private DateValueComparison() {
    // uninstantiable
  }

}