text:
import falcon

from partizan.api import utils
from partizan.db import models
from partizan import db

class PackagesResource(object):
    def on_get(self, req, resp):
        session = db.get_session()
        q = session.query(models.Package)
        rows = q.all()
        resp.json = {"packages": map(dict, rows)}

    @falcon.before(utils.deserialize)
    def on_post(self, req, resp):
        obj = models.Package.create(req.json)
        resp.json = dict(obj)
        resp.status = falcon.HTTP_201

class PackageResource(object):
    def on_delete(self, req, resp, package_id):
        models.Package.delete(package_id)
        resp.status = falcon.HTTP_204

    def on_get(self, req, resp, package_id):
        session = db.get_session()
        q = session.query(models.Package)
        q = q.filter_by(id=package_id)
        obj = q.one()
        resp.json = dict(obj)

redpajama_set_name: RedPajamaGithub


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 Class net.sourceforge.pmd.lang.ecmascript.rule.EcmascriptRuleViolationFactory (PMD JavaScript 5.5.1 API)</title>
<meta name="date" content="2016-07-27">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
net.sourceforge.pmd.lang.ecmascript.rule.EcmascriptRuleViolationFactory

Packages that use EcmascriptRuleViolationFactory

Package
Description

net.sourceforge.pmd.lang.ecmascript.rule

Uses of EcmascriptRuleViolationFactory in net.sourceforge.pmd.lang.ecmascript.rule

Fields in net.sourceforge.pmd.lang.ecmascript.rule declared as EcmascriptRuleViolationFactory

Modifier and Type
Field and Description

static EcmascriptRuleViolationFactory
EcmascriptRuleViolationFactory.INSTANCE

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2002–2016 InfoEther. All rights reserved.


text:
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys

# local imports
sys.path.append(os.path.abspath('sphinxext'))
from apigen import ApiDocWriter

#*****************************************************************************
if __name__ == '__main__':
    pjoin = os.path.join
    package = 'IPython'
    outdir = pjoin('source','api','generated')
    docwriter = ApiDocWriter(package,rst_extension='.txt')
    # You have to escape the . here because . is a special char for regexps.
    # You must do make clean if you change this!
    docwriter.package_skip_patterns += [r'\.fixes$',
                                        r'\.external$',
                                        r'\.extensions',
                                        r'\.kernel\.config',
                                        r'\.attic',
                                        r'\.quarantine',
                                        r'\.deathrow',
                                        r'\.config\.default',
                                        r'\.config\.profile',
                                        r'\.frontend',
                                        r'\.gui',
                                        r'\.kernel',
                                        # For now, the zmq code has
                                        # unconditional top-level code so it's
                                        # not import safe.  This needs fixing
                                        r'\.zmq',
                                        ]

    docwriter.module_skip_patterns += [ r'\.core\.fakemodule',
                                        r'\.testing\.iptest',
                                        # Keeping these disabled is OK
                                        r'\.parallel\.controller\.mongodb',
                                        r'\.lib\.inputhookwx',
                                        r'\.lib\.inputhookgtk',
                                        r'\.cocoa',
                                        r'\.ipdoctest',
                                        r'\.Gnuplot',
                                        r'\.frontend\.process\.winprocess',
                                        r'\.Shell',
                                        ]

    # If we don't have pexpect, we can't load irunner, so skip any code that
    # depends on it
    try:
        import pexpect
    except ImportError:
        docwriter.module_skip_patterns += [r'\.lib\.irunner',
                                           r'\.testing\.mkdoctests']
    # Now, generate the outputs
    docwriter.write_api_docs(outdir)
    docwriter.write_index(outdir, 'gen',
                          relative_to = pjoin('source','api')
                          )
    print '%d files written' % len(docwriter.written_modules)


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TAlex.MathCore;
using TAlex.PowerCalc.Services;
using TAlex.PowerCalc.ViewModels.Matrices;
using TAlex.WPF.Converters;

namespace TAlex.PowerCalc.Converters
{
    public class WorksheetMatrixCachedValueToStringConverter : ConverterBase<WorksheetMatrixCachedValueToStringConverter>
    {
        private WorksheetMatrixCachedValueConverter _converter;

        public WorksheetMatrixCachedValueToStringConverter()
        {
            _converter = new WorksheetMatrixCachedValueConverter(Properties.Settings.Default);
        }

        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return _converter.ToString(value);
        }
    }

    public class WorksheetMatrixCachedValueConverter
    {
        protected readonly IAppSettings AppSettings;

        public WorksheetMatrixCachedValueConverter(IAppSettings settings)
        {
            AppSettings = settings;
        }

        public virtual string ToString(object value)
        {
            if (value is Complex)
            {
                Complex normilizedValue = NumericUtil.ComplexZeroThreshold((Complex)value, AppSettings.ComplexThreshold, AppSettings.ZeroThreshold);
                return normilizedValue.ToString(AppSettings.NumericFormat, CultureInfo.InvariantCulture);
            }
            else if (value is MatrixIndexOutOfRangeException)
            {
                return "#N/A";
            }
            else if (value is Exception)
            {
                return "#ERROR";
            }

            return null;
        }
    }
}


text:
if /bin/true; then
  # ./tests/inputs/extatom2.hex
  # ./tests/inputs/extatom10.hex;
  # ./tests/inputs/store_parseable_1.hex
  # ./tests/inputs/setminus_learn1.hex
  # ./tests/inputs/setminus_learn2.hex
  for WHAT in ./tests/inputs/relevance_learning2.hex; do
    echo "=== $WHAT python"
    EXTRA=""
    EXTRA="--verbose"
    EXTRA="--verbose --debug"
    EXTRA="--verbose --debug --flpcheck=none --stats"
    EXTRA="--verbose --debug --flpcheck=none --stats --noskipevalfromnogoods"
    EXTRA="--verbose --debug --flpcheck=none --stats --nocache"
    EXTRA="--stats --nocache"
    hexlite $EXTRA \
      --pluginpath=./plugins/ \
      --plugin=stringplugin --plugin=testplugin \
      $WHAT
  done
fi

# for java plugin
if /bin/false; then
  # ./tests/inputs/extatom2.hex
  # ./tests/inputs/extatom10.hex
  # ./tests/inputs/nonmon_guess.hex
  # ./tests/inputs/setminus_learn.hex
  PLUGIN=at.ac.tuwien.kr.hexlite.testplugin.SetMinusApi2Plugin
  PLUGIN=at.ac.tuwien.kr.hexlite.testplugin.SetMinusApi3Plugin
  PLUGIN=at.ac.tuwien.kr.hexlite.testplugin.ConcatSetMinusPlugin
  for WHAT in ./tests/inputs/nonmon_guess.hex ./tests/inputs/nonmon_inc.hex ./tests/inputs/nonmon_guess.hex ./tests/inputs/nonmon_inc.hex ; do
    echo "=== $WHAT java"
    EXTRA="--verbose --debug"
    EXTRA="--verbose"
    EXTRA=""
    CLASSPATH=./java-api/target/classes \
    hexlite --pluginpath=./plugins/ \
      --plugin javaapiplugin $PLUGIN \
      $EXTRA \
      -- $WHAT
  done
fi

# for acthex development
if /bin/false; then
  echo "+++++"

  WHAT="./tests/inputs/acthex_bubblesort_sortenv.hex"
  EXTRA="--plugin=stringplugin"
  EXTRA=""
  EXTRA="$EXTRA --debug"
  EXTRA="$EXTRA --verbose"
  acthex $EXTRA \
    --pluginpath=./plugins/ \
    --plugin=acthex-testplugin \
    $WHAT

  echo "====="

  WHAT="./tests/inputs/acthex_bubblesort_persistenceenv.hex"
  EXTRA="--plugin=stringplugin"
  EXTRA=""
  EXTRA="$EXTRA --debug"
  EXTRA="$EXTRA --verbose"
  acthex $EXTRA \
    --pluginpath=./plugins/ \
    --plugin=acthex-testplugin \
    $WHAT

fi


text:
// Code generated by client-gen. DO NOT EDIT.

package fake

import (
	v2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2"
	rest "k8s.io/client-go/rest"
	testing "k8s.io/client-go/testing"
)

type FakeAutoscalingV2 struct {
	*testing.Fake
}

func (c *FakeAutoscalingV2) HorizontalPodAutoscalers(namespace string) v2.HorizontalPodAutoscalerInterface {
	return &FakeHorizontalPodAutoscalers{c, namespace}
}

// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeAutoscalingV2) RESTClient() rest.Interface {
	var ret *rest.RESTClient
	return ret
}


text:
package org.apache.geode.management.internal.cli.commands;

import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.test.junit.categories.RegionsTest;
import org.apache.geode.test.junit.rules.GfshCommandRule;
import org.apache.geode.test.junit.rules.GfshCommandRule.PortType;
import org.apache.geode.test.junit.rules.ServerStarterRule;

@Category({RegionsTest.class})
public class DescribeRegionIntegrationTest {
  private static final String MEMBER_NAME = "test-server";
  private static final String REGION_NAME = "test-region";
  private static final String GROUP_NAME = "test-group";

  @ClassRule
  public static ServerStarterRule server = new ServerStarterRule()
      .withRegion(RegionShortcut.REPLICATE, REGION_NAME).withName(MEMBER_NAME)
      .withProperty("groups", GROUP_NAME).withJMXManager().withAutoStart();

  @Rule
  public GfshCommandRule gfsh =
      new GfshCommandRule(server::getJmxPort, PortType.jmxManager).withTimeout(2);

  @Test
  public void commandFailsWhenNotConnected() throws Exception {
    gfsh.disconnect();
    gfsh.executeAndAssertThat("describe region").statusIsError()
        .containsOutput("was found but is not currently available");
  }

  @Test
  public void commandFailsWithBadNameOption() throws Exception {
    String cmd = "describe region --name=invalid-region-name";
    gfsh.executeAndAssertThat(cmd).statusIsError().containsOutput("invalid-region-name not found");
  }

  @Test
  public void commandSucceedsWithGoodNameOption() throws Exception {
    String cmd = "describe region --name=" + REGION_NAME;
    gfsh.executeAndAssertThat(cmd).statusIsSuccess().containsOutput("Name", "Data Policy",
        "Hosting Members");
  }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<meta name="distribution" content="global" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	<meta name="author" content="Javascript Malaysia" />
	<meta name="publisher" content="Javascript Malaysia" />
	<meta name="rating" content="general" />
	<meta name="copyright" content="Javascript Malaysia" />
	<meta name="robots" content="all" />
	<meta name="spiders" content="all" />
	<meta name="webcrawlers" content="all" />
	<meta name="company" content="Javascript Malaysia" />
	<meta name="abstract" content="Javascript Malaysia" />
	<meta name="subject" content="Javascript Malaysia" />
	<meta name="description" content="Javascript Malaysia" />
	<meta name="keywords" content="javascript, malaysia, Javascript Malaysia, Malaysia Javascript" />

	<meta property="fb:admins" content="" />
	<meta property="fb:page_id" content="" />
	<meta property="fb:app_id" content="" />
	<meta property="og:site_name" content="" />
	<meta property="og:type" content="" />

	<meta property="og:title" content="" />
	<meta property="og:url" content="" />
	<meta property="og:description" content="" />
	<meta property="og:image" content="" />

	<meta name="twitter:card" content="summary_large_image" />
	<meta name="twitter:site" content="" />
	<meta name="twitter:title" content="" />
	<meta name="twitter:url" content="" />
	<meta name="twitter:description" content="" />
	<meta name="twitter:image:src" content="" />

	<title>{{#meta.title}}{{meta.title}} - {{/meta.title}}{{config.site_title}}</title>
	{{#meta.description}}<meta name="description" content="{{meta.description}}">{{/meta.description}}

	<link rel="shortcut icon" href="/favicon.ico">
	<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
	<link rel="stylesheet" href="/bower_components/highlightjs/styles/solarized_light.css">
	<link rel="stylesheet" href="/styles/raneto.css">

	{{{config.analytics}}}

					{{config.site_title}}

					<form class="search-form form-inline pull-right" role="form" action="/">

							Search
							<input type="search" class="form-control" name="search" id="search" size="30" value="{{search}}" placeholder="Search">

					</form>

		{{{ yield }}}

			{{#config.copyright}}

{{{config.copyright}}}

			{{/config.copyright}}


text:
layout: docs
title: Setup with Gradle
permalink: /docs/setup-gradle/
---

This quickstart shows you how to setup a new Citrus project with Gradle. After that you will be able to get Citrus tests running
within minutes. You can find the project sources on GitHub [citrus-samples/sample-gradle](https://github.com/christophd/citrus-samples/blob/master/sample-gradle).

### Preconditions

You need following software on your computer, in order to use the Citrus Framework:

- **Java 8 or higher**
  Installed JDK plus JAVA_HOME environment variable set up and pointing to your Java installation directory
- **Java IDE**
  A Java IDE will help you manage your Citrus project, create and execute test cases. Just use the Java IDE that you are
  used to (e.g. [Eclipse](http://www.eclipse.org/) or [IntelliJ IDEA](http://www.jetbrains.com/idea/)).
- **Gradle 2.13 or higher**
  Citrus tests will be executed with the [Gradle](https://gradle.org/) build tool.

Citrus uses Maven internally for building software. But of course you can also integrate the Citrus tests in a Gradle
project. As the Citrus tests are nothing but normal JUnit or TestNG tests the integration in the Gradle build is very easy.

### Gradle project

First of all we create a new Java project called *citrus-sample*. There are multiple ways to get started with a Gradle project. I personally
prefer to use my Java IDE (IntelliJ) for generating a basic Gradle project setup. Of course there are lots of Gradle project start samples out there.
And summing up the Gradle project structure is pretts simple so you could also create this manually. Here is the basic project structure that we
are going to use in this quickstart.

    citrus-sample
      |   + src
      |   |   + main
      |   |    |   + java
      |   |    |   + resources
      |   |   + test
      |   |    |   + java
      |   |    |   + resources
      build.gradle
      settings.gradle

The Gradle build configuration is done in the **build.gradle** and **settings.gradle** files. Here we define the project name and the project version.

{% highlight shell %}
rootProject.name = 'citrus-sample-gradle'
group 'com.consol.citrus.samples'
version '2.7.3-SNAPSHOT'
{% endhighlight %}

Now as Citrus libraries are available on Maven central repository we add these repositories so Gradle knows how to download the required
Citrus artifacts.

{% highlight shell %}
repositories {
    mavenCentral()
    maven {
        url 'http://labs.consol.de/maven/snapshots-repository/'
    }
}
{% endhighlight %}

Citrus stable release versions are available on Maven central. If you want to use the very latest snapshot version of Citrus you need
to also add the ConSol Labs snapshot repository as server. This is optional and only applies if you want to use the snapshot versions of Citrus.

Now lets move on with adding the Citrus libraries to the project.

{% highlight shell %}
dependencies {
    testCompile group: 'com.consol.citrus', name: 'citrus-core', version: '2.7.3-SNAPSHOT'
    testCompile group: 'com.consol.citrus', name: 'citrus-java-dsl', version: '2.7.3-SNAPSHOT'
    testCompile group: 'org.testng', name: 'testng', version: '6.11'
    [...]
}
{% endhighlight %}

This enables the Citrus support for the project so we can use the Citrus classes and APIs. We decided to use TestNG unit test library.

{% highlight shell %}
test {
    useTestNG()
}
{% endhighlight %}

Of course JUnit is also supported. This is all for build configuration settings. We can move on to writing some Citrus integration tests. The Java test classes
usually go to the **src/test/java** directory.

Lets write a simple Citrus test case in Java and save it to the **src/test/java** folder in package **com.consol.citrus.samples**.

{% highlight java %}
import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.channel.ChannelEndpoint;
import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;
import com.consol.citrus.message.MessageType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.Test;

@ContextConfiguration(classes = { EndpointConfig.class })
public class MessagingTest extends TestNGCitrusTestDesigner {

    @Autowired
    private ChannelEndpoint testChannelEndpoint;

    @Test
    @CitrusTest
    public void testMessaging() {
        echo("Test simple message send and receive");

        send(testChannelEndpoint)
            .messageType(MessageType.PLAINTEXT)
            .payload("Hello Citrus!");

        receive(testChannelEndpoint)
            .messageType(MessageType.PLAINTEXT)
            .payload("Hello Citrus!");

        echo("Successful send and receive");
    }
}
{% endhighlight %}

This sample uses pure Java code for both Citrus configuration and tests. The
Citrus TestNG test uses a context configuration annotation.

{% highlight java %}
@ContextConfiguration(classes = { EndpointConfig.class })
{% endhighlight %}

This tells Spring to load the configuration from the Java class ***EndpointConfig***.

{% highlight java %}
public class EndpointConfig {
    @Bean
    public ChannelEndpoint testChannelEndpoint() {
        ChannelEndpointConfiguration endpointConfiguration = new ChannelEndpointConfiguration();
        endpointConfiguration.setChannel(testChannel());
        return new ChannelEndpoint(endpointConfiguration);
    }

    @Bean
    private MessageChannel testChannel() {
        return new MessageSelectingQueueChannel();
    }
}
{% endhighlight %}

In the configuration class we are able to define Citrus components for usage in tests. As usual
we can autowire the endpoint components as Spring beans in the test cases.

{% highlight java %}
@Autowired
private ChannelEndpoint testChannelEndpoint;
{% endhighlight %}

### Run

The sample application uses Gradle as build tool. So you can use the Gradle wrapper to compile, package and test the
sample with Gradle build.

{% highlight shell %}
gradlew clean build
{% endhighlight %}

This executes all Citrus test cases during the build and you will see Citrus performing some integration test logging output.
After the tests are finished build is successful and you are ready to go for writing some tests on your own.

If you just want to execute all tests you can call

{% highlight shell %}
gradlew clean check
{% endhighlight %}

Of course you can also start the Citrus tests from your favorite IDE.
Just start the Citrus test using the Gradle integration in IntelliJ, Eclipse or Netbeans.

So now you are ready to use Citrus! Write test cases and add more logic to the test project. Have fun with it!


text:
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
    <handler-chain>
        <handler>
            <handler-name>ServiceLogicalHandler</handler-name>
            <handler-class>airservice.jaxws.test.handler.LogicalHandler</handler-class>
        </handler>
        <handler>
            <handler-name>ServiceSOAPHandler</handler-name>
            <handler-class>airservice.jaxws.test.handler.SOAPHandler</handler-class>
        </handler>
    </handler-chain>
</handler-chains>


text:
#ifndef PCL_SEGMENTATION_IMPL_RANDOM_WALKER_HPP
#define PCL_SEGMENTATION_IMPL_RANDOM_WALKER_HPP

#include <boost/bimap.hpp>

#include <Eigen/Sparse>

namespace pcl
{

  namespace segmentation
  {

    namespace detail
    {

      /** \brief Multilabel graph segmentation using random walks.
        *
        * This is an implementation of the algorithm described in "Random Walks
        * for Image Segmentation" by Leo Grady.
        *
        * See the documentation of the randomWalker() function for details.
        *
        * \author Sergey Alexandrov
        * \ingroup segmentation
        */
      template <class Graph, class EdgeWeightMap, class VertexColorMap>
      class RandomWalker
      {

        public:

          using Color = typename boost::property_traits<VertexColorMap>::value_type;
          using Weight = typename boost::property_traits<EdgeWeightMap>::value_type;
          using GraphTraits = boost::graph_traits<Graph>;
          using EdgeDescriptor = typename GraphTraits::edge_descriptor;
          using VertexDescriptor = typename GraphTraits::vertex_descriptor;
          using EdgeIterator = typename GraphTraits::edge_iterator;
          using OutEdgeIterator = typename GraphTraits::out_edge_iterator;
          using VertexIterator = typename GraphTraits::vertex_iterator;
          using VertexIndexMap = typename boost::property_map<Graph, boost::vertex_index_t>::type;
          using VertexDegreeMap = boost::iterator_property_map<typename std::vector<Weight>::iterator, VertexIndexMap>;
          using SparseMatrix = Eigen::SparseMatrix<Weight>;
          using Matrix = Eigen::Matrix<Weight, Eigen::Dynamic, Eigen::Dynamic>;
          using Vector = Eigen::Matrix<Weight, Eigen::Dynamic, 1>;

          RandomWalker (Graph& g, EdgeWeightMap weights, VertexColorMap colors)
          : g_ (g)
          , weight_map_ (weights)
          , color_map_ (colors)
          , index_map_ (boost::get (boost::vertex_index, g_))
          , degree_storage_ (boost::num_vertices (g_), 0)
          , degree_map_ (boost::make_iterator_property_map (degree_storage_.begin (), index_map_))
          {
          }

          bool
          segment ()
          {
            computeVertexDegrees ();
            buildLinearSystem ();
            return solveLinearSystem ();
          }

          void
          computeVertexDegrees ()
          {
            using namespace boost;
            EdgeIterator ei, e_end;
            for (tie (ei, e_end) = edges (g_); ei != e_end; ++ei)
            {
              Weight w = weight_map_[*ei];
              degree_map_[source (*ei, g_)] += w;
              degree_map_[target (*ei, g_)] += w;
            }
          }

          void
          buildLinearSystem ()
          {
            using namespace boost;

            using T = Eigen::Triplet<float>;
            using Triplets = std::vector<T>;
            Triplets L_triplets;
            Triplets B_triplets;

            VertexIterator vi, v_end;
            for (tie (vi, v_end) = vertices (g_); vi != v_end; ++vi)
            {
              // If this is a labeled vertex add it to the seeds list and register its color
              if (color_map_[*vi])
              {
                seeds_.push_back (*vi);
                colors_.insert (color_map_[*vi]);
              }
              // Skip seeds and vertices with zero connectivity
              if (color_map_[*vi] || std::fabs (degree_map_[*vi]) < std::numeric_limits<Weight>::epsilon ())
                continue;
              // Create a row in L matrix for the vertex
              size_t current_row = insertInBimap (L_vertex_bimap, *vi);
              // Add diagonal degree entry for the vertex
              L_triplets.push_back (T (current_row, current_row, degree_map_[*vi]));
              // Iterate over incident vertices and add entries on corresponding columns of L or B
              OutEdgeIterator ei, e_end;
              for (tie (ei, e_end) = out_edges (*vi, g_); ei != e_end; ++ei)
              {
                Weight w = weight_map_[*ei];
                VertexDescriptor tgt = target (*ei, g_);
                Color color = color_map_[tgt];
                if (color)
                {
                  // This is a seed and will go to B matrix
                  size_t column;
                  if (B_color_bimap.right.count (color) == 0)
                  {
                    // This is the first time we encountered this color, create a new column in B
                    column = insertInBimap (B_color_bimap, color);
                  }
                  else
                  {
                    column = B_color_bimap.right.at (color);
                  }
                  B_triplets.push_back (T (current_row, column, w));
                }
                else
                {
                  // This is a non-seed and will go to L matrix,
                  // but only if a row for this vertex already exists
                  if (L_vertex_bimap.right.count (tgt) && L_vertex_bimap.right.at (tgt) != current_row)
                  {
                    L_triplets.push_back (T (current_row, L_vertex_bimap.right.at (tgt), -w));
                  }
                }
              }
            }

            size_t num_equations = L_vertex_bimap.size ();
            size_t num_colors = B_color_bimap.size ();
            L.resize (num_equations, num_equations);
            B.resize (num_equations, num_colors);
            if (!L_triplets.empty ())
              L.setFromTriplets(L_triplets.begin(), L_triplets.end());
            if (!B_triplets.empty ())
              B.setFromTriplets(B_triplets.begin(), B_triplets.end());
          }

          bool solveLinearSystem()
          {
            X.resize (L.rows (), B.cols ());

            // Nothing to solve
            if (L.rows () == 0 || B.cols () == 0)
              return true;

            Eigen::SimplicialCholesky<SparseMatrix, Eigen::Lower> cg;
            cg.compute (L);
            bool succeeded = true;
            for (Eigen::Index i = 0; i < B.cols (); ++i)
            {
              Vector b = B.col (i);
              X.col (i) = cg.solve (b);
              if (cg.info () != Eigen::Success)
                succeeded = false;
            }

            assignColors ();
            return succeeded;
          }

          void
          assignColors ()
          {
            using namespace boost;
            if (X.cols ())
              for (Eigen::Index i = 0; i < X.rows (); ++i)
              {
                size_t max_column;
                X.row (i).maxCoeff (&max_column);
                VertexDescriptor vertex = L_vertex_bimap.left.at (i);
                Color color = B_color_bimap.left.at (max_column);
                color_map_[vertex] = color;
              }
          }

          void
          getPotentials (Matrix& potentials, std::map<Color, size_t>& color_to_column_map)
          {
            using namespace boost;
            potentials = Matrix::Zero (num_vertices (g_), colors_.size ());
            // Copy over rows from X
            for (Eigen::Index i = 0; i < X.rows (); ++i)
              potentials.row (L_vertex_bimap.left.at (i)).head (X.cols ()) = X.row (i);
            // In rows that correspond to seeds put ones in proper columns
            for (size_t i = 0; i < seeds_.size (); ++i)
            {
              VertexDescriptor v = seeds_[i];
              insertInBimap (B_color_bimap, color_map_[v]);
              potentials (seeds_[i], B_color_bimap.right.at (color_map_[seeds_[i]])) = 1;
            }
            // Fill in a map that associates colors with columns in potentials matrix
            color_to_column_map.clear ();
            for (Eigen::Index i = 0; i < potentials.cols (); ++i)
              color_to_column_map[B_color_bimap.left.at (i)] = i;
          }

          template <typename T> static inline size_t
          insertInBimap (boost::bimap<size_t, T>& bimap, T value)
          {
            if (bimap.right.count (value) != 0)
            {
              return bimap.right.at (value);
            }
            size_t s = bimap.size ();
            bimap.insert (typename boost::bimap<size_t, T>::value_type (s, value));
            return s;
          }

          Graph& g_;
          EdgeWeightMap weight_map_;
          VertexColorMap color_map_;
          VertexIndexMap index_map_;

          std::vector<VertexDescriptor> seeds_;
          std::set<Color> colors_;

          std::vector<Weight> degree_storage_;
          VertexDegreeMap degree_map_;
          SparseMatrix L;
          SparseMatrix B;
          Matrix X;

          // Map vertex identifiers to the rows/columns of L and vice versa
          boost::bimap<size_t, VertexDescriptor> L_vertex_bimap;
          // Map colors to the columns of B and vice versa
          boost::bimap<size_t, Color> B_color_bimap;

      };

    }

    template <class Graph> bool
    randomWalker (Graph& graph)
    {
      return randomWalker (graph,
                           boost::get (boost::edge_weight, graph),
                           boost::get (boost::vertex_color, graph));
    }

    template <class Graph, class EdgeWeightMap, class VertexColorMap> bool
    randomWalker (Graph& graph,
                  EdgeWeightMap weights,
                  VertexColorMap colors)
    {
      using namespace boost;

      using EdgeDescriptor = typename graph_traits<Graph>::edge_descriptor;
      using VertexDescriptor = typename graph_traits<Graph>::vertex_descriptor;

      BOOST_CONCEPT_ASSERT ((VertexListGraphConcept<Graph>));                                 // to have vertices(), num_vertices()
      BOOST_CONCEPT_ASSERT ((EdgeListGraphConcept<Graph>));                                   // to have edges()
      BOOST_CONCEPT_ASSERT ((IncidenceGraphConcept<Graph>));                                  // to have source(), target() and out_edges()
      BOOST_CONCEPT_ASSERT ((ReadablePropertyMapConcept<EdgeWeightMap, EdgeDescriptor>));     // read weight-values from edges
      BOOST_CONCEPT_ASSERT ((ReadWritePropertyMapConcept<VertexColorMap, VertexDescriptor>)); // read and write color-values from vertices

      ::pcl::segmentation::detail::RandomWalker
      <
        Graph,
        EdgeWeightMap,
        VertexColorMap
      >
      rw (graph, weights, colors);
      return rw.segment ();
    }

    template <class Graph, class EdgeWeightMap, class VertexColorMap> bool
    randomWalker (Graph& graph,
                  EdgeWeightMap weights,
                  VertexColorMap colors,
                  Eigen::Matrix<typename boost::property_traits<EdgeWeightMap>::value_type, Eigen::Dynamic, Eigen::Dynamic>& potentials,
                  std::map<typename boost::property_traits<VertexColorMap>::value_type, size_t>& colors_to_columns_map)
    {
      using namespace boost;

      using EdgeDescriptor = typename graph_traits<Graph>::edge_descriptor;
      using VertexDescriptor = typename graph_traits<Graph>::vertex_descriptor;

      BOOST_CONCEPT_ASSERT ((VertexListGraphConcept<Graph>));                                 // to have vertices(), num_vertices()
      BOOST_CONCEPT_ASSERT ((EdgeListGraphConcept<Graph>));                                   // to have edges()
      BOOST_CONCEPT_ASSERT ((IncidenceGraphConcept<Graph>));                                  // to have source(), target() and out_edges()
      BOOST_CONCEPT_ASSERT ((ReadablePropertyMapConcept<EdgeWeightMap, EdgeDescriptor>));     // read weight-values from edges
      BOOST_CONCEPT_ASSERT ((ReadWritePropertyMapConcept<VertexColorMap, VertexDescriptor>)); // read and write color-values from vertices

      ::pcl::segmentation::detail::RandomWalker
      <
        Graph,
        EdgeWeightMap,
        VertexColorMap
      >
      rw (graph, weights, colors);
      bool result = rw.segment ();
      rw.getPotentials (potentials, colors_to_columns_map);
      return result;
    }

  }

}

#endif /* PCL_SEGMENTATION_IMPL_RANDOM_WALKER_HPP */


text:
//// TODO:
//// [O] Contracts
//// [O] Documentation

namespace Splunk.Client
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Globalization;
    using System.IO;
    using System.Threading.Tasks;
    using System.Xml;

    ///
    /// Provides an object representation of a Splunk Atom Feed response.
    ///
    /// <remarks>
    /// <para>References:</para>
    /// <list type="number">
    /// <item><description>
    ///     REST API Reference Manual: Accessing
    ///     Splunk resources.
    /// </description></item>
    /// <item><description>
    ///     REST API Reference Manual: Atom Feed
    ///     responses.
    /// </description></item>
    /// </list>
    /// </remarks>
    public sealed class AtomFeed
    {

        #region Privates/internals

        static readonly ReadOnlyCollection<AtomEntry> emptyAtomEntryCollection = new ReadOnlyCollection<AtomEntry>(new List<AtomEntry>());
        static readonly ReadOnlyDictionary<string, Uri> emptyLinksDictionary = new ReadOnlyDictionary<string, Uri>(new Dictionary<string, Uri>());
        static readonly ReadOnlyCollection<Message> emptyMessageCollection = new ReadOnlyCollection<Message>(new List<Message>());

        #endregion

        #region Constructors

        ///
        /// Initializes a new instance of an <see cref="AtomFeed"/>
        ///
        public AtomFeed()
        { }

        #endregion

        #region Properties

        ///
        /// Gets the author of the current <see cref="AtomFeed"/> response.
        ///
        /// <value>
        /// Author of the current <see cref="AtomFeed"/> response.
        /// </value>
        public string Author
        { get; private set; }

        ///
        /// Gets the list of <see cref="AtomEntry"/> instances returned in the
        /// current <see cref="AtomFeed"/> response.
        ///
        /// <value>
        /// The list of <see cref="AtomEntry"/> instances returned in the current
        /// <see cref="AtomFeed"/> response.
        /// </value>
        public ReadOnlyCollection<AtomEntry> Entries
        { get; private set; }

        ///
        /// Gets the version number of the generator that produced the current
        /// <see cref="AtomFeed"/> response.
        ///
        /// <value>
        /// The <see cref="AtomFeed"/> generator version number.
        /// </value>
        public Version GeneratorVersion
        { get; private set; }

        ///
        /// Gets the Splunk management URI for accessing the current
        /// <see cref= "AtomFeed"/> response.
        ///
        /// <value>
        /// The Splunk management URI for accessing the current
        /// <see cref= "AtomFeed"/> response.
        /// </value>
        public Uri Id
        { get; private set; }

        ///
        /// Gets the links.
        ///
        /// <value>
        /// The links.
        /// </value>
        public IReadOnlyDictionary<string, Uri> Links
        { get; private set; }

        ///
        /// Gets the list of info, warning, and error messages returned in the
        /// current <see cref="AtomFeed"/> response.
        ///
        /// <remarks>
        /// Not all responses from an endpoint produce messages.
        /// </remarks>
        /// <value>
        /// The list of info, warning, and error messages returned in the current
        /// <see cref="AtomFeed"/> response.
        /// </value>
        public ReadOnlyCollection<Message> Messages
        { get; private set; }

        ///
        /// Gets the list of pagination attributes for the response to a GET
        /// operation.
        ///
        /// <value>
        /// Pagination attributes for the response to a GET operation.
        /// </value>
        public Pagination Pagination
        { get; private set; }

        ///
        /// Gets the human readable name of the current <see cref="AtomFeed"/>
        /// response.
        ///
        /// <remarks>
        /// This value is typically derived from the last segment of
        /// <see cref= "Id"/>.
        /// </remarks>
        /// <value>
        /// Human readable name of the current <see cref="AtomFeed"/> response.
        /// </value>
        public string Title
        { get; private set; }

        ///
        /// Gets the date that the endpoint used to access the current
        /// <see cref="AtomFeed"/> response was implemented in Splunk.
        ///
        /// <value>
        /// The date that the endpoint used to access the current
        /// <see cref= "AtomFeed"/> response was implemented in Splunk.
        /// </value>
        public DateTime Updated
        { get; private set; }

        #endregion

        #region Methods

        ///
        /// Asynchronously reads XML data into the current <see cref="AtomFeed"/>.
        ///
        /// <exception cref="InvalidDataException">
        /// Thrown when an Invalid Data error condition occurs.
        /// </exception>
        /// <param name="reader">
        /// The reader from which to read.
        /// </param>
        /// <returns>
        /// A <see cref="Task"/> representing the operation.
        /// </returns>
        public async Task ReadXmlAsync(XmlReader reader)
        {
            Contract.Requires<ArgumentNullException>(reader != null, "reader");

            this.Author = null;
            this.Entries = null;
            this.GeneratorVersion = null;
            this.Id = null;
            this.Links = null;
            this.Messages = null;
            this.Pagination = Pagination.None;
            this.Title = null;
            this.Updated = DateTime.MinValue;

            reader.Requires(await reader.MoveToDocumentElementAsync("feed").ConfigureAwait(false));
            var documentElementName = reader.Name;

            List<AtomEntry> entries = null;
            Dictionary<string, Uri> links = null;
            List<Message> messages = null;

            await reader.ReadAsync().ConfigureAwait(false);

            while (reader.NodeType == XmlNodeType.Element)
            {
                string name = reader.Name;

                switch (name)
                {
                    case "title":

                        this.Title = await reader.ReadElementContentAsync(StringConverter.Instance).ConfigureAwait(false);
                        break;

                    case "id":

                        this.Id = await reader.ReadElementContentAsync(UriConverter.Instance).ConfigureAwait(false);
                        break;

                    case "author":

                        await reader.ReadAsync().ConfigureAwait(false);
                        reader.EnsureMarkup(XmlNodeType.Element, "name");
                        this.Author = await reader.ReadElementContentAsync(StringConverter.Instance).ConfigureAwait(false);
                        reader.EnsureMarkup(XmlNodeType.EndElement, "author");
                        await reader.ReadAsync().ConfigureAwait(false);
                        break;

                    case "generator":

                        // string build = reader.GetRequiredAttribute("build"); // TODO: Incorporate build number? Build number sometimes adds a fifth digit.
                        string version = reader.GetRequiredAttribute("version");
                        this.GeneratorVersion = VersionConverter.Instance.Convert(string.Join(".", version));
                        await reader.ReadAsync().ConfigureAwait(false);
                        break;

                    case "updated":

                        this.Updated = await reader.ReadElementContentAsync(DateTimeConverter.Instance).ConfigureAwait(false);
                        break;

                    case "entry":

                        var entry = new AtomEntry();

                        if (entries == null)
                        {
                            entries = new List<AtomEntry>();
                        }

                        entries.Add(entry);

                        await entry.ReadXmlAsync(reader).ConfigureAwait(false);
                        break;

                    case "link":

                        var href = reader.GetRequiredAttribute("href");
                        var rel = reader.GetRequiredAttribute("rel");

                        if (links == null)
                        {
                            links = new Dictionary<string, Uri>();
                        }

                        links[rel] = UriConverter.Instance.Convert(href);
                        await reader.ReadAsync().ConfigureAwait(false);
                        break;

                    case "s:messages":

                        bool isEmptyElement = reader.IsEmptyElement;
                        await reader.ReadAsync().ConfigureAwait(false);

                        if (messages == null)
                        {
                            messages = new List<Message>();
                        }

                        if (isEmptyElement)
                        {
                            continue;
                        }

                        while (reader.NodeType == XmlNodeType.Element && reader.Name == "s:msg")
                        {
                            var value = reader.GetRequiredAttribute("type");
                            var type = EnumConverter<MessageType>.Instance.Convert(value);
                            var text = await reader.ReadElementContentAsStringAsync().ConfigureAwait(false);

                            messages.Add(new Message(type, text));
                        }

                        if (reader.NodeType == XmlNodeType.EndElement)
                        {
                            reader.EnsureMarkup(XmlNodeType.EndElement, "s:messages");
                            await reader.ReadAsync().ConfigureAwait(false);
                        }

                        break;

                    case "opensearch:itemsPerPage":

                        int itemsPerPage = await reader.ReadElementContentAsync(Int32Converter.Instance).ConfigureAwait(false);
                        this.Pagination = new Pagination(itemsPerPage, this.Pagination.StartIndex, this.Pagination.TotalResults);
                        break;

                    case "opensearch:startIndex":

                        int startIndex = await reader.ReadElementContentAsync(Int32Converter.Instance).ConfigureAwait(false);
                        this.Pagination = new Pagination(this.Pagination.ItemsPerPage, startIndex, this.Pagination.TotalResults);
                        break;

                    case "opensearch:totalResults":

                        int totalResults = await reader.ReadElementContentAsync(Int32Converter.Instance).ConfigureAwait(false);
                        this.Pagination = new Pagination(this.Pagination.ItemsPerPage, this.Pagination.StartIndex, totalResults);
                        break;

                    default: throw new InvalidDataException(string.Format("Unexpected start tag: {0}", reader.Name)); // TODO: Improved diagnostics
                }
            }

            reader.EnsureMarkup(XmlNodeType.EndElement, documentElementName);
            await reader.ReadAsync().ConfigureAwait(false);

            this.Entries = entries == null ? emptyAtomEntryCollection : new ReadOnlyCollection<AtomEntry>(entries);
            this.Links = links == null ? emptyLinksDictionary : new ReadOnlyDictionary<string, Uri>(links);
            this.Messages = messages == null ? emptyMessageCollection : new ReadOnlyCollection<Message>(messages);
        }

        ///
        /// Gets a string representation for the current <see cref="AtomFeed"/>.
        ///
        /// <returns>
        /// A string representation of the current <see cref="AtomFeed"/>.
        /// </returns>
        /// <seealso cref="M:System.Object.ToString()"/>
        public override string ToString()
        {
            var text = string.Format(CultureInfo.CurrentCulture, "AtomFeed(Title={0}, Author={1}, Id={2}, Updated={3})",
                this.Title, this.Author, this.Id, this.Updated);
            return text;
        }

        #endregion
    }
}


text:
package org.apache.ofbiz.entity.model;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.base.util.UtilXml;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.entity.model.ModelViewEntity.ComplexAliasMember;
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias;
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAliasAll;
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelMemberEntity;
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelViewLink;
/**
 * This class is used for declaring Dynamic View Entities, to be used and thrown away.
 * A special method exists on the Delegator to accept a DynamicViewEntity instead
 * of an entity-name.
 *
 */
public class DynamicViewEntity {
    public static final String module = DynamicViewEntity.class.getName();

    /** The entity-name of the Entity */
    protected String entityName = "DynamicViewEntity";

    /** The package-name of the Entity */
    protected String packageName = "org.apache.ofbiz.dynamicview";

    /** The default-resource-name of the Entity, used with the getResource call to check for a value in a resource bundle */
    protected String defaultResourceName = "";

    /** The title for documentation purposes */
    protected String title = "";

    /** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */
    protected Map<String, ModelMemberEntity> memberModelMemberEntities = new HashMap<String, ModelMemberEntity>();

    /** List of alias-alls which act as a shortcut for easily pulling over member entity fields */
    protected List<ModelAliasAll> aliasAlls = new ArrayList<ModelAliasAll>();

    /** List of aliases with information in addition to what is in the standard field list */
    protected List<ModelAlias> aliases = new ArrayList<ModelAlias>();

    /** List of fields to group by */
    protected List<String> groupBy;

    /** List of view links to define how entities are connected (or "joined") */
    protected List<ModelViewLink> viewLinks = new ArrayList<ModelViewLink>();

    /** relations defining relationships between this entity and other entities */
    protected List<ModelRelation> relations = new ArrayList<ModelRelation>();

    public DynamicViewEntity() {
    }

    public ModelViewEntity makeModelViewEntity(Delegator delegator) {
        ModelViewEntity modelViewEntity = new ModelViewEntity(this, delegator.getModelReader());
        return modelViewEntity;
    }

    public String getViewXml(String entityName) throws IOException {
        Document doc = UtilXml.makeEmptyXmlDocument();
        Element viewElement = getViewElement(doc, entityName);
        return UtilXml.writeXmlDocument(viewElement);
    }

    public Element getViewElement(Document doc, String entityName) {
        Element viewElement = doc.createElement("view-entity");
        viewElement.setAttribute("entity-name", entityName);

        for (ModelMemberEntity member: memberModelMemberEntities.values()) {
            Element memberElement = doc.createElement("member-entity");
            memberElement.setAttribute("entity-alias", member.getEntityAlias());
            memberElement.setAttribute("entity-name", member.getEntityName());
            viewElement.appendChild(memberElement);
        }
        for (ModelAliasAll aliasAll: aliasAlls) {
            Element aliasAllElement = doc.createElement("alias-all");
            aliasAllElement.setAttribute("entity-alias", aliasAll.getEntityAlias());
            if (UtilValidate.isNotEmpty(aliasAll.getPrefix())) aliasAllElement.setAttribute("prefix", aliasAll.getPrefix());
            if (aliasAll.getGroupBy()) aliasAllElement.setAttribute("group-by", "true");
            if (UtilValidate.isNotEmpty(aliasAll.getFunction())) aliasAllElement.setAttribute("function", aliasAll.getFunction());
            for (String excludeField: aliasAll) {
                Element excludeElement = doc.createElement("exclude");
                excludeElement.setAttribute("field", excludeField);
                aliasAllElement.appendChild(excludeElement);
            }
            viewElement.appendChild(aliasAllElement);
        }
        for (ModelAlias alias: aliases) {
            Element aliasElement = doc.createElement("alias");
            aliasElement.setAttribute("entity-alias", alias.getEntityAlias());
            aliasElement.setAttribute("name", alias.getName());
            if (!alias.getName().equals(alias.getField())) aliasElement.setAttribute("field", alias.getField());
            String colAlias = ModelUtil.dbNameToVarName(alias.getColAlias());
            if (!alias.getName().equals(colAlias)) aliasElement.setAttribute("col-alias", colAlias);
            if (alias.getIsPk() != null) aliasElement.setAttribute("prim-key", alias.getIsPk().toString());
            if (alias.getGroupBy()) aliasElement.setAttribute("group-by", "true");
            if (UtilValidate.isNotEmpty(alias.getFunction())) aliasElement.setAttribute("function", alias.getFunction());
            // TODO: description, complex-alias
            viewElement.appendChild(aliasElement);
        }
        for (ModelViewLink viewLink: viewLinks) {
            Element viewLinkElement = doc.createElement("view-link");
            viewLinkElement.setAttribute("entity-alias", viewLink.getEntityAlias());
            if (viewLink.isRelOptional()) viewLinkElement.setAttribute("rel-optional", "true");
            viewLinkElement.setAttribute("rel-entity-alias", viewLink.getRelEntityAlias());
            for (ModelKeyMap keyMap: viewLink) {
                Element keyMapElement = doc.createElement("key-map");
                keyMapElement.setAttribute("field-name", keyMap.getFieldName());
                if (!keyMap.getFieldName().equals(keyMap.getRelFieldName())) keyMapElement.setAttribute("rel-field-name", keyMap.getRelFieldName());
                viewLinkElement.appendChild(keyMapElement);
            }
            // TODO: conditions
            viewElement.appendChild(viewLinkElement);
        }
        for (ModelRelation relation: relations) {
            viewElement.appendChild(relation.toXmlElement(doc));
        }
        return viewElement;
    }

    public String getOneRealEntityName() {
        // return first entity name for memberModelMemberEntities Map
        if (this.memberModelMemberEntities.size() == 0) {
            return null;
        }

        ModelMemberEntity modelMemberEntity = this.memberModelMemberEntities.entrySet().iterator().next().getValue();
        return modelMemberEntity.getEntityName();
    }

    /** Getter for property entityName.
     * @return Value of property entityName.
     *
     */
    public String getEntityName() {
        return entityName;
    }

    /** Setter for property entityName.
     * @param entityName New value of property entityName.
     *
     */
    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    /** Getter for property packageName.
     * @return Value of property packageName.
     *
     */
    public String getPackageName() {
        return packageName;
    }

    /** Setter for property packageName.
     * @param packageName New value of property packageName.
     *
     */
    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    /** Getter for property defaultResourceName.
     * @return Value of property defaultResourceName.
     *
     */
    public String getDefaultResourceName() {
        return defaultResourceName;
    }

    /** Setter for property defaultResourceName.
     * @param defaultResourceName New value of property defaultResourceName.
     *
     */
    public void setDefaultResourceName(String defaultResourceName) {
        this.defaultResourceName = defaultResourceName;
    }

    /** Getter for property title.
     * @return Value of property title.
     *
     */
    public String getTitle() {
        return title;
    }

    /** Setter for property title.
     * @param title New value of property title.
     *
     */
    public void setTitle(String title) {
        this.title = title;
    }

    public void addMemberEntity(String entityAlias, String entityName) {
        ModelMemberEntity modelMemberEntity = new ModelMemberEntity(entityAlias, entityName);
        this.memberModelMemberEntities.put(entityAlias, modelMemberEntity);
    }

    public Iterator<Map.Entry<String, ModelMemberEntity>> getModelMemberEntitiesEntryIter() {
        return this.memberModelMemberEntities.entrySet().iterator();
    }

    /**
     * @deprecated use {@link #addAliasAll(String, String, Collection)}
     */
    @Deprecated
    public void addAliasAll(String entityAlias, String prefix) {
        addAliasAll(entityAlias, prefix, null);
    }

    public void addAliasAll(String entityAlias, String prefix, Collection<String> excludes) {
        ModelAliasAll aliasAll = new ModelAliasAll(entityAlias, prefix, false, null, null, excludes);
        this.aliasAlls.add(aliasAll);
    }

    public void addAllAliasAllsToList(List<ModelAliasAll> addList) {
        addList.addAll(this.aliasAlls);
    }

    public void addAlias(String entityAlias, String name) {
        this.addAlias(entityAlias, name, null, null, null, null, null);
    }

    /** Add an alias, full detail. All parameters can be null except entityAlias and name. */
    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function) {
        addAlias(entityAlias, name, field, colAlias, primKey, groupBy, function, null, null);
    }

    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function, ComplexAliasMember complexAliasMember) {
        addAlias(entityAlias, name, field, colAlias, primKey, groupBy, function, null, complexAliasMember);
    }

    public void addAlias(String entityAlias, String name, String field, String colAlias, Boolean primKey, Boolean groupBy, String function, String fieldSet, ComplexAliasMember complexAliasMember) {
        if (entityAlias == null && complexAliasMember == null) {
            throw new IllegalArgumentException("entityAlias cannot be null if this is not a complex alias in call to DynamicViewEntity.addAlias");
        }
        if (name == null) {
            throw new IllegalArgumentException("name cannot be null in call to DynamicViewEntity.addAlias");
        }

        ModelAlias alias = new ModelAlias(entityAlias, name, field, colAlias, primKey, groupBy, function, fieldSet);
        if (complexAliasMember != null) {
            alias.setComplexAliasMember(complexAliasMember);
        }
        this.aliases.add(alias);
    }

    public void addAllAliasesToList(List<ModelAlias> addList) {
        addList.addAll(this.aliases);
    }

    public void addViewLink(String entityAlias, String relEntityAlias, Boolean relOptional, List<ModelKeyMap> modelKeyMaps) {
        ModelViewLink modelViewLink = new ModelViewLink(entityAlias, relEntityAlias, relOptional, null, modelKeyMaps);
        this.viewLinks.add(modelViewLink);
    }

    public void addAllViewLinksToList(List<ModelViewLink> addList) {
        addList.addAll(this.viewLinks);
    }

    public void addRelation(String type, String title, String relEntityName, List<ModelKeyMap> modelKeyMaps) {
        ModelRelation relation = ModelRelation.create(null, null, type, title, relEntityName, null, modelKeyMaps, false);
        this.relations.add(relation);
    }

    public void addAllRelationsToList(List<ModelRelation> addList) {
        addList.addAll(this.relations);
    }

    public void setGroupBy(List<String> groupBy) {
        this.groupBy = groupBy;
    }

    public void addAllGroupByFieldsToList(List<String> addList) {
        if (groupBy != null) {
            addList.addAll(this.groupBy);
        }
    }
}


text:
package com.orangesignal.csv.manager;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import com.orangesignal.csv.Constants;
import com.orangesignal.csv.CsvConfig;
import com.orangesignal.csv.filters.SimpleBeanFilter;
import com.orangesignal.csv.filters.SimpleCsvNamedValueFilter;
import com.orangesignal.csv.model.SampleBean;

/**
 * {@link CsvColumnNameMappingBeanManager} クラスの単体テストです。
 *
 * @author Koji Sugisawa
 */
public class CsvColumnNameMappingBeanManagerTest {

	private static CsvConfig cfg;

	@Rule
	public ExpectedException exception = ExpectedException.none();

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		cfg = new CsvConfig(',');
		cfg.setEscapeDisabled(false);
		cfg.setNullString("NULL");
		cfg.setIgnoreTrailingWhitespaces(true);
		cfg.setIgnoreLeadingWhitespaces(true);
		cfg.setIgnoreEmptyLines(true);
		cfg.setLineSeparator(Constants.CRLF);
	}

	@Test
	public void testCsvColumnNameMappingBeanManager() {
		new CsvColumnNameMappingBeanManager();
		new CsvColumnNameMappingBeanManager(cfg);
	}

	@Test
	public void testCsvColumnNameMappingBeanManagerIllegalArgumentException() {
		exception.expect(IllegalArgumentException.class);
		exception.expectMessage("CsvConfig must not be null");
		new CsvColumnNameMappingBeanManager(null);
	}

	@Test
	public void testConfig() {
		new CsvColumnNameMappingBeanManager().config(cfg);
	}

	@Test
	public void testConfigIllegalArgumentException() {
		exception.expect(IllegalArgumentException.class);
		exception.expectMessage("CsvConfig must not be null");
		new CsvColumnNameMappingBeanManager().config(null);
	}

	@Test
	public void testLoad() throws Exception {
		final Reader reader = new StringReader(
				"シンボル,名称,価格,出来高,日付\r\n" +
				"GCQ09,COMEX 金 2009年08月限,1058.70,10,2008/08/06\r\n" +
				"GCU09,COMEX 金 2009年09月限,1068.70,10,2008/09/06\r\n" +
				"GCV09,COMEX 金 2009年10月限,1078.70,11,2008/10/06\r\n" +
				"GCX09,COMEX 金 2009年11月限,1088.70,12,2008/11/06\r\n" +
				"GCZ09,COMEX 金 2009年12月限,1098.70,13,2008/12/06\r\n"
			);

		try {
			final DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
			final List<SampleBean> list = new CsvColumnNameMappingBeanManager(cfg)
				.load(SampleBean.class)
				.column("シンボル", "symbol")
				.column("名称", "name")
				.column("価格", "price")
				.column("出来高", "volume")
				.column("日付", "date", new SimpleDateFormat("yyyy/MM/dd"))
				.filter(new SimpleCsvNamedValueFilter().ne(0, "gcu09", true))
				.filter(new SimpleBeanFilter().ne("date", df.parse("2008/11/06")))
				.offset(1).limit(1)
				.from(reader);

			assertThat(list.size(), is(1));
			final SampleBean o1 = list.get(0);
			assertThat(o1.symbol, is("GCV09"));
			assertThat(o1.name, is("COMEX 金 2009年10月限"));
			assertThat(o1.price.doubleValue(), is(1078.70D));
			assertThat(o1.volume.longValue(), is(11L));
			assertThat(o1.date, is(df.parse("2008/10/06")));
		} finally {
			reader.close();
		}
	}

	@Test
	public void testSaveNoHeader() throws Exception {
		final DateFormat df = new SimpleDateFormat("yyyy/MM/dd");

		final List<SampleBean> list = new ArrayList<SampleBean>();
		list.add(new SampleBean("GCU09", "COMEX 金 2009年09月限", 1068.70, 10, df.parse("2008/09/06")));
		list.add(new SampleBean("GCV09", "COMEX 金 2009年10月限", 1078.70, 11, df.parse("2008/10/06")));
		list.add(new SampleBean("GCX09", "COMEX 金 2009年11月限", 1088.70, 12, df.parse("2008/11/06")));

		final StringWriter sw = new StringWriter();
		try {
			new CsvColumnNameMappingBeanManager(cfg)
				.save(list, SampleBean.class)
				.header(false)
				.column("シンボル", "symbol")
				.column("名称",     "name")
				.column("価格",     "price", new DecimalFormat("0.00"))
				.column("出来高",   "volume")
				.column("日付",     "date", new SimpleDateFormat("yyyy/MM/dd"))
				.filter(new SimpleCsvNamedValueFilter().ne("シンボル", "gcu09", true))
				.filter(new SimpleBeanFilter().ne("date", df.parse("2008/11/06")))
				.to(sw);

			assertThat(sw.getBuffer().toString(), is("GCV09,COMEX 金 2009年10月限,1078.70,11,2008/10/06\r\n"));
		} finally {
			sw.close();
		}
	}

	@Test
	public void testSave() throws Exception {
		final DateFormat df = new SimpleDateFormat("yyyy/MM/dd");

		final List<SampleBean> list = new ArrayList<SampleBean>();
		list.add(new SampleBean("GCU09", "COMEX 金 2009年09月限", 1068.70, 10, df.parse("2008/09/06")));
		list.add(new SampleBean("GCV09", "COMEX 金 2009年10月限", 1078.70, 11, df.parse("2008/10/06")));
		list.add(new SampleBean("GCX09", "COMEX 金 2009年11月限", 1088.70, 12, df.parse("2008/11/06")));

		final StringWriter sw = new StringWriter();
		try {
			new CsvColumnNameMappingBeanManager(cfg)
				.save(list, SampleBean.class)
				.column("シンボル", "symbol")
				.column("名称",     "name")
				.column("価格",     "price", new DecimalFormat("0.00"))
				.column("出来高",   "volume")
				.column("日付",     "date", new SimpleDateFormat("yyyy/MM/dd"))
				.filter(new SimpleCsvNamedValueFilter().ne("シンボル", "gcu09", true))
				.filter(new SimpleBeanFilter().ne("date", df.parse("2008/11/06")))
				.to(sw);

			assertThat(sw.getBuffer().toString(), is("シンボル,名称,価格,出来高,日付\r\nGCV09,COMEX 金 2009年10月限,1078.70,11,2008/10/06\r\n"));
		} finally {
			sw.close();
		}
	}

}


text:
<?php
/**
 * Contains EWSType_BodyTypeResponseType.
 */

/**
 * Defines how the body text is formatted in the response.
 *
 * @package php-ews\Enumerations
 */
class EWSType_BodyTypeResponseType extends EWSType
{
    /**
     * The response will return the richest available content of body text.
     *
     * This is useful if it is unknown whether the content is text or HTML. The
     * returned body will be text if the stored body is plain text. Otherwise,
     * the response will return HTML if the stored body is in either HTML or RTF
     * format.
     *
     * This is the default value.
     *
     * @since Exchange 2007
     *
     * @var string
     */
    const BEST = 'Best';

    /**
     * The response will return an item body as HTML.
     *
     * @since Exchange 2007
     *
     * @var string
     */
    const HTML = 'HTML';

    /**
     * The response will return an item body as plain text.
     *
     * @since Exchange 2007
     *
     * @var string
     */
    const TEXT = 'Text';

    /**
     * Element value.
     *
     * @var string
     */
    public $_;

    /**
     * Returns the value of this object as a string.
     *
     * @return string
     */
    public function __toString()
    {
        return $this->_;
    }
}


text:
package com.planet_ink.coffee_mud.core.exceptions;

public class ScriptParseException extends CoffeeMudException
{
	static final long serialVersionUID=0;

	public ScriptParseException(String s)
	{
		super(s);
	}
}


text:
using System;
using System.Reflection;
using System.Threading.Tasks;

namespace NSpec.Domain
{
    public class AsyncMethodExample : MethodExampleBase
    {
        public AsyncMethodExample(MethodInfo method, string tags)
            : base(method, tags)
        {
            runner = new AsyncMethodRunner(method, "example");
        }

        public override void Run(nspec nspec)
        {
            runner.Run(nspec);
        }

        readonly AsyncMethodRunner runner;
    }

    public class AsyncMethodRunner
    {
        public AsyncMethodRunner(MethodInfo method, string hookName)
        {
            this.method = method;
            this.hookName = hookName;
        }

        public void Run(nspec nspec)
        {
            if (method.ReturnType == typeof(void))
            {
                throw new AsyncMismatchException(
                    "'async void' method-level {0} is not supported, please use 'async Task' instead".With(hookName));
            }

            if (method.ReturnType.GetTypeInfo().IsGenericType)
            {
                throw new AsyncMismatchException(
                    "'async Task<T>' method-level {0} is not supported, please use 'async Task' instead".With(hookName));
            }

            Func<Task> asyncWork = () => (Task)method.Invoke(nspec, null);

            asyncWork.Offload();
        }

        readonly MethodInfo method;
        readonly string hookName;
    }
}


text:
<test>
  <sql>SELECT	'Test'.ToString(),
		'Test'.ToStrng()</sql>
  <expectedErrors>
    <expectedError id="UndeclaredMethod" text="Type 'String' does not have a method 'ToStrng()'." />
  </expectedErrors>
</test>


text:
foam.CLASS({
  package: 'foam.nanos.export',
  name: 'JSONDriver',
  implements: [ 'foam.nanos.export.ExportDriver' ],

  documentation: 'Class for exporting data from a DAO to JSON',

  properties: [
    {
      class: 'FObjectProperty',
      of: 'foam.json.Outputter',
      name: 'outputter',
      factory: function() { return foam.json.PrettyStrict; }
    }
  ],

  methods: [
    function exportFObject(X, obj) {
      return this.outputter.stringify(obj);
    },
    function exportDAO(X, dao) {
      var self = this;
      return dao.select().then(function (sink) {
        return self.outputter.stringify(sink.array);
      });
    }
  ]
});


text:
package org.stem.db.compaction;

import org.stem.db.Blob;
import org.stem.db.FatFile;

import java.io.IOException;
import java.util.Iterator;

public class FFScanner implements Iterator<Blob> {

    private FatFile ff;
    private Blob currentBlob;
    int nextOffset = FatFile.PAYLOAD_OFFSET;

    public FFScanner(FatFile ff) {
        this.ff = ff;

        // TODO: looks like it's mistake, we can iterate not-full files
        //if (!ff.isFull())
        //throw new RuntimeException("Non-FULL FatFiles can not be iterated with FFScanner");
    }

    @Override
    public boolean hasNext() {
        ff.readLock.lock();
        try {
            Blob blob = Blob.deserialize(ff, nextOffset);
            if (null != blob) {
                currentBlob = blob;
                nextOffset += Blob.Header.SIZE + blob.getHeader().length;
                return true;
            } else {
                return false;
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            ff.readLock.unlock();
        }
    }

    @Override
    public Blob next() {
        return currentBlob;
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }
}


text:
const getDate = function () {
	const date = new Date()
	date.setUTCHours(date.getUTCHours() - 7);
	const dateToString = date.toUTCString().replace('GMT', '').trim()
	return dateToString
}

module.exports = {
	getDate : getDate
}


text:
<?php

namespace backend\components\panels;

class DataStoragePanel extends \yii\debug\Panel
{
    use DataStoragePanelTrait;
}


text:
package net.scalytica.symbiotic.api.types

import net.scalytica.symbiotic.api.types.PartyBaseTypes.UserId
import org.joda.time.DateTime

/**
 * Used for handling (un)locking files for change (or version incrementation)
 */
case class Lock(by: UserId, date: DateTime)


text:
from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    # Examples:
    # url(r'^$', 'fragment_hub.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', 'fragment_hub.views.index'),

    # for user signup and login
    url(r'^user/login/', 'fragment_hub.views.login'),
    url(r'^user/signup/', 'fragment_hub.views.signup'),
    url(r'^user/change_password/', 'fragment_hub.views.change_password'),
]