text:
<?xml version="1.0" encoding="utf-8"?>
<!-- # Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
	# # 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. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.wso2.carbon.apimgt</groupId>
        <artifactId>apimgt</artifactId>
        <version>6.0.6-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.apimgt.impl</artifactId>
    <packaging>bundle</packaging>
    <name>WSO2 Carbon - API Management Implementation </name>

    <dependencies>

        <dependency>
            <groupId>org.wso2.carbon.analytics-common</groupId>
            <artifactId>org.wso2.carbon.event.output.adapter.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.analytics-common</groupId>
            <artifactId>org.wso2.carbon.event.output.adapter.email</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon.analytics-common</groupId>
            <artifactId>org.wso2.carbon.event.output.adapter.sms</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.woden.wso2</groupId>
            <artifactId>woden</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.user.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.governance</groupId>
            <artifactId>org.wso2.carbon.governance.api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.registry</groupId>
            <artifactId>org.wso2.carbon.registry.ws.client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.poi.wso2</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.keymgt.client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.identity.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.identity.oauth</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.governance</groupId>
            <artifactId>org.wso2.carbon.governance.registry.extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database.wso2</groupId>
            <artifactId>h2-database-engine</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.osgi</groupId>
                    <artifactId>org.eclipse.osgi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-codec.wso2</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.handlers.security.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.commons</groupId>
            <artifactId>org.wso2.carbon.event.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.registry</groupId>
            <artifactId>org.wso2.carbon.registry.indexing</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple.wso2</groupId>
            <artifactId>json-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.keymgt.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.gateway.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.identity.application.mgt.stub</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.um.ws.api.stub</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.user.mgt.stub</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon.analytics-common</groupId>
            <artifactId>org.wso2.carbon.databridge.agent</artifactId>
        </dependency>

        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.statsupdate.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.governance</groupId>
            <artifactId>org.wso2.carbon.governance.custom.lifecycles.checklist</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.tier.cache.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.apimgt</groupId>
            <artifactId>org.wso2.carbon.apimgt.registry.cache.stub</artifactId>
        </dependency>
        <dependency>
             <groupId>org.wso2.orbit.org.apache.pdfbox</groupId>
             <artifactId>pdfbox</artifactId>
         </dependency>
        <dependency>
            <groupId>org.wso2.carbon.governance</groupId>
            <artifactId>org.wso2.carbon.governance.lcm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.event-processing</groupId>
            <artifactId>org.wso2.carbon.event.processor.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.io.swagger</groupId>
            <artifactId>swagger-codegen</artifactId>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-models</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.io.swagger</groupId>
            <artifactId>swagger-parser</artifactId>
        </dependency>
        <dependency>
            <groupId>xerces.wso2</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity</groupId>
            <artifactId>org.wso2.carbon.identity.user.profile.stub</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>create-test-database</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <path id="h2.classpath">
                                    <path refid="maven.compile.classpath" />
                                </path>
                                <echo message="########### Create Test Database ##############" />
                                <sql driver="org.h2.Driver" url="jdbc:h2:${basedir}/target/repository/database/WSO2AM_DB" userid="wso2carbon" password="wso2carbon" autocommit="true" onerror="continue">
                                    <classpath>
                                        <path refid="h2.classpath" />
                                    </classpath>
                                    <fileset file="${basedir}/src/test/resources/dbscripts/h2.sql" />
                                    <fileset file="${basedir}/src/test/resources/dbscripts/h2-sample-data.sql" />

                                </sql>
                                <echo message="##################### END ########################" />
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>APIManagerDBConfigurationPath</name>
                            <value>${basedir}/src/test/resources/amConfig.xml</value>
                        </property>
                        <property>
                            <name>IdentityConfigurationPath</name>
                            <value>${basedir}/src/test/resources/identity.xml</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>1.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Private-Package>
                            org.wso2.carbon.apimgt.impl.internal.*
                        </Private-Package>
                        <Export-Package>
                            !org.apache.commons.codec.*,
                            !org.wso2.carbon.apimgt.impl.dto.xsd;version="${carbon.apimgt.version}",
                            org.wso2.carbon.apimgt.impl.*;version="${carbon.apimgt.version}"
                        </Export-Package>
                        <Import-Package>
                            !org.wso2.carbon.apimgt.api.model.xsd.*,
                            org.wso2.carbon.governance.api.*,
                            org.wso2.carbon.registry.ws.client.*,
                            org.apache.woden.*,
                            org.wso2.carbon.apimgt.keymgt.client.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.handlers.security.stub.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.api.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.api.model.xsd;version="${carbon.apimgt.imp.pkg.version}",
                            javax.servlet;version="${javax.servlet.imp.pkg.version}",
                            javax.servlet.http;version="${javax.servlet.imp.pkg.version}",
                            javax.servlet.resources;version="${javax.servlet.imp.pkg.version}",
                            org.eclipse.equinox.http.helper,
                            com.google.gson,
                            org.apache.axis2.*; version="${imp.pkg.version.axis2}",
                            org.apache.commons.*,
                            org.apache.http.*,
                            org.apache.synapse.*,
                            org.osgi.framework.*,
                            org.osgi.util.*,
                            org.osgi.service.*,
                            org.apache.axiom.*; version="${imp.pkg.version.axiom}",
                            org.wso2.carbon.utils; version="${carbon.platform.package.import.version.range}",
                            org.wso2.carbon.registry.core.*; version="${carbon.registry.imp.pkg.version}",
                            org.wso2.carbon.registry.common.*,
                            org.wso2.carbon.registry.indexing.*; version="${carbon.registry.package.import.version.range}",
                            org.apache.pdfbox.*; version="${orbit.version.pdfbox}",
                            org.apache.poi.*,
                            org.apache.thrift.*; version="${libthrift.import.version.range}",
                            org.apache.neethi.*,
                            org.apache.velocity.*,
                            org.apache.solr.common,
                            javax.cache,
                            javax.naming,
                            javax.sql,
                            javax.wsdl.*,
                            javax.xml.*;version="0.0.0",
                            org.json.*,
                            org.slf4j,
                            org.w3c.dom,
                            com.ibm.wsdl.*,
                            net.sf.saxon.*,
                            org.wso2.carbon.identity.oauth.*;version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}",
                            org.wso2.carbon.identity.oauth2.*;version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}",
                            org.wso2.carbon.identity.*;version="${carbon.identity.imp.pkg.version}",
                            org.wso2.carbon.apimgt.keymgt.stub.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.statsupdate.stub.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.gateway.stub.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.tier.cache.stub.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.apimgt.gateway.dto.stub.*;version="${carbon.apimgt.imp.pkg.version}",
                            org.wso2.carbon.utils.*; version="${carbon.platform.package.import.version.range}",
                            org.wso2.carbon.authenticator.stub.*;version="${carbon.platform.package.import.version.range}",
                            org.wso2.carbon.base;version="${imp.pkg.version.org.wso2.carbon.base}",
                            org.wso2.carbon.context;version="${carbon.platform.package.import.version.range}",
                            org.wso2.carbon.core.*;version="${carbon.platform.package.import.version.range}",
                            org.wso2.carbon.user.core.*;version="${carbon.platform.package.import.version.range}",
                            org.wso2.carbon.user.api;version="${imp.pkg.version.org.wso2.carbon.user.api}",
                            org.wso2.carbon.user.mgt.stub.*;version="${carbon.identity.imp.pkg.version}",
                            org.wso2.carbon.user.mgt.*;version="${carbon.identity.imp.pkg.version}",
                            org.xml.sax,
                            org.wso2.carbon.rest.api.stub.*,
                            org.wso2.carbon.um.ws.api.stub,
                            org.wso2.securevault.*,
                            org.wso2.carbon.registry.*;version="${carbon.registry.imp.pkg.version}",
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-scr-scrdescriptor</id>
                        <goals>
                            <goal>scr</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


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

<title>IRegistry</title>
<meta name="date" content="2016-01-10">
<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 Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.hpms.mw.dcrud

Interface IRegistry

public interface IRegistry

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

java.util.Set<java.net.InetSocketAddress>
getClients(java.lang.String intrfc)

java.util.Set<java.net.InetSocketAddress>
getConsumers(java.lang.String dataname)

java.util.Set<java.net.InetSocketAddress>
getParticipants()

Method Detail

getParticipants

java.util.Set<java.net.InetSocketAddress> getParticipants()

getClients

java.util.Set<java.net.InetSocketAddress> getClients(java.lang.String intrfc)

getConsumers

java.util.Set<java.net.InetSocketAddress> getConsumers(java.lang.String dataname)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

    <meta charset="utf-8">

    <title>So Many Services</title>

    <meta name="description" content="Issues/thoughts about too many services">
    <meta name="author" content="Mr Rogers">

    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

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

    <link rel="stylesheet" href="css/reveal.min.css">
    <link rel="stylesheet" href="css/theme/night.css" id="theme">
    <link rel="stylesheet" href="css/customizations.css">

    <link rel="stylesheet" href="lib/css/zenburn.css">

So Many Services

            Mr Rogers / @rcode5

Rails is MVC

M odel

V iew

C ontroller

              Fine for simple stuff

But Single Responsibility?

              “
              every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility
              ”

Compartmentalize

Compartmentalize

              views
              services
              models
              mailers
              helpers
              controllers
              assets
              presenters
              validators
              serializers
              forms
              policies
              lib
              workers
              paginators
              jobs
              inputs
              importers
              authorizors

app/services

              % ls app/services

              artist_email_list_manager.rb
              artist_studio_manager.rb
              tag_frequency_service.rb
              ...

app/services/artist_email_list_manager.rb

class ArtistEmailListManager
  def initialize(artist)
    @artist = artist
  end

  def add_email(email)
    ...
  end

  def remove_email(email)
    ...
  end
end

app/services/artist_studio_manager.rb

class ArtistStudioManager
  def initialize(artist)
    @artist = artist
  end

  def assign_studio(studio)
    ...
  end

  def unassign_studio(studio)
    ...
  end
end

app/services/tag_frequency_service.rb

class TagFrequencyService
  def self.compute(model)
    # compute frequency of tag usage for model
    ...
  end
end

Repos (from Hexagonal Rails)

app/repos/artists_repo.rb

class ArtistRepo
  def self.find_by_art(art)
    ...
  end

  def self.find_by_name_or_login(name_or_login)
    ...
  end
end

Is this still SRP?

class ArtistAssociationsManager
  def initialize(artist)
    @artist = artist
  end

  def add_email(email)
    ...
  end

  def remove_email(email)
    ...
  end

  def assign_studio(studio)
    ...
  end

  def unassign_studio(studio)
    ...
  end
end

How do we name these things?

ActiveRecord abstraction things (Repos)

Things that manage 2+ models (Managers, Form Objects, Domain Models)

Things that compute stuff (Calculators, Paginators)

Is app/lib ever right?

Proposal:

Think about it early

Add more directories

Agree on “how big is a responsibility”

Thanks for not sleeping

References/Reading list

Using Services to keep controllers clean and DRY

Service Objectrs in Rails

Single Responsibility Principle (Wikipedia)

Hexagonal Rails and the Ludicrous Terminal Application

            Mr Rogers
            jon@carbonfive.com
            bunnymatic
            @rcode5


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>All Classes (Lucene 4.6.1 API)</title>
<meta name="date" content="2014-01-23">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

All Classes

BeiderMorseFilter

BeiderMorseFilterFactory

DoubleMetaphoneFilter

DoubleMetaphoneFilterFactory

PhoneticFilter

PhoneticFilterFactory


text:
Generative artwork in node/browser based on a seeded random.

Blog post and more details:

[Generative Art with Node.js and Canvas](http://mattdesl.svbtle.com/generative-art-with-nodejs-and-canvas)

## Live Demo

You can view the algorithm in real-time here:

http://color-wander.surge.sh/

In Chrome, you can right-click the canvas an "Save As" to get the full resolution.

## Outputs

Here are a few examples.

You can download some of these as lossless PNG [here](https://www.dropbox.com/sh/qhrwaw2rzjqbf5r/AABsYzFc7a4ewWkIJYHHBs85a?dl=0).

## Usage

```sh
git clone https://github.com/mattdesl/color-wander.git
cd color-wander
npm install
```

To run the browser experience:

```sh
npm run start
```

When you find a seed you like, you can render it as a high-resolution (2560x1440) print. The following will render a PNG into the `output/` folder.

```sh
node print [seed]
```

Example:

```sh
node print 180423
```

> *Note:* For this experiment, the Node output resolution is currently the same as the browser canvas. Typically this approach, using `node-canvas`, is only worthwhile for much larger canvas resolutions.

## License

This project has two licenses, depending on the usage. The source code is licensed as MIT. This means you can use a piece of the project, such as one of the utility functions, within your own libraries and projects. However; to maintain my own artistic intellectual property, and to avoid rampant commercialization of the artwork, the "art project" (color-wander) as a whole and any output imagery from it (including current and new output images from the existing and/or slightly modified codebases) is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International](https://creativecommons.org/licenses/by-nc-nd/4.0/). This means that if you use the code here to produce something that is close in likeness to the color-wander outputs, and then attempt to commercialize it (i.e. selling the work for profit), it will not fall within the fair use of the project licensing, and will be a form of copyright infringement.


text:
package routers

import (
	"github.com/gorilla/mux"

	"github.com/shijuvar/gokit/examples/bookmark-api/controllers"
)

// SetUserRoutes registers routes for user entity
func SetUserRoutes(router *mux.Router) *mux.Router {
	router.HandleFunc("/users", controllers.Register).Methods("POST")
	router.HandleFunc("/users/login", controllers.Login).Methods("POST")
	return router
}


text:
Large-Cero
==========

this is the 2nd project. this cero is diamond shape and it is rotated when extruded


text:
package org.apache.camel.component.bean.issues;

import org.apache.camel.Exchange;

public class TransformerImpl extends AbstractTransformer<String> {

    @Override
    public String transform(Exchange exchange) {
        return getTest();
    }
}


text:
mkdir -p static
mkdir -p static/documentation
mkdir -p static/behaviour-option
mkdir -p static/configurations
mkdir -p static/contact
mkdir -p static/download
mkdir -p static/events-callbacks
mkdir -p static/examples
mkdir -p static/more
mkdir -p static/number-formatting
mkdir -p static/pips
mkdir -p static/reference
mkdir -p static/slider-options
mkdir -p static/slider-read-write
mkdir -p static/slider-values

cp -r documentation/assets static/documentation
cp -r dist static
cp -r tests static

php documentation/_run/router.php "index" > static/index.html
php documentation/_run/router.php "behaviour-option" > static/behaviour-option/index.html
php documentation/_run/router.php "configurations" > static/configurations/index.html
php documentation/_run/router.php "contact" > static/contact/index.html
php documentation/_run/router.php "download" > static/download/index.html
php documentation/_run/router.php "events-callbacks" > static/events-callbacks/index.html
php documentation/_run/router.php "examples" > static/examples/index.html
php documentation/_run/router.php "more" > static/more/index.html
php documentation/_run/router.php "number-formatting" > static/number-formatting/index.html
php documentation/_run/router.php "pips" > static/pips/index.html
php documentation/_run/router.php "reference" > static/reference/index.html
php documentation/_run/router.php "slider-options" > static/slider-options/index.html
php documentation/_run/router.php "slider-read-write" > static/slider-read-write/index.html
php documentation/_run/router.php "slider-values" > static/slider-values/index.html


text:
package org.opensplice.dds.core.policy;

import java.util.Collection;
import java.util.Set;

import org.omg.dds.core.policy.QosPolicy;

/**
 * By using the SubscriptionKey QosPolicy, a DataReader can force its own
 * key-list definition on data samples. The consequences are that the DataReader
 * will internally keep track of instances based on its own key list, instead of
 * the key list dictated by the Topic. Operations that operate on instances or
 * instance handles, such as
 * {@link org.omg.dds.sub.DataReader#lookupInstance(Object)} or
 * {@link org.omg.dds.sub.DataReader#getKeyValue(org.omg.dds.core.InstanceHandle)}
 * , respect the alternative key-list and work as expected.
 *

 * However, since the mapping of writer instances to reader instances is no
 * longer trivial (one writer instance may now map to more than one matching
 * reader instance and vice versa), a writer instance will no longer be able to
 * fully determine the lifecycle of its matching reader instance, nor the value
 * its {@link org.omg.dds.sub.ViewState} and
 * {@link org.omg.dds.sub.InstanceState}.
 *

 * In fact, by diverting from the conceptual 1 - 1 mapping between writer
 * instance and reader instance, the writer can no longer keep an (empty) reader
 * instance ALIVE by just refusing to unregister its matching writer instance.
 * That means that when a reader takes all samples from a particular reader
 * instance, that reader instance will immediately be removed from the reader's
 * administration. Any subsequent reception of a message with the same keys will
 * re-introduce the instance into the reader administration, setting its
 * view_state back to NEW. Compare this to the default behavior, where the
 * reader instance will be kept alive as long as the writer does not unregister
 * it. That causes the view_state in the reader instance to remain NOT_NEW, even
 * if the reader has consumed all of its samples prior to receiving an update.
 *

 * Another consequence of allowing an alternative keylist is that events that
 * are communicated by invalid samples (i.e. samples that have only initialized
 * their keyfields) may no longer be interpreted by the reader to avoid
 * situations in which uninitialized non-keyfields are treated as keys in the
 * alternative keylist. This effectively means that all invalid samples (e.g.
 * unregister messages and both implicit and explicit dispose messages) will be
 * skipped and can no longer affect the InstanceState, which will therefore
 * remain ALIVE. The only exceptions to this are the messages that are
 * transmitted explicitly using the
 * {@link org.opensplice.dds.pub.DataWriter#writeDispose(Object)} call, which
 * always includes a full and valid sample and can therefore modify the
 * InstanceState to NOT_ALIVE_DISPOSED.
 *

 * By default, the SubscriptionKey QosPolicy is not used.
 *

 * This QosPolicy is applicable to a DataReader only, and cannot be changed
 * after the DataReader is enabled.
 */
public interface SubscriptionKeys extends QosPolicy.ForDataReader {

    /**
     * @return an unmodifiable collection of subscription keys.
     */
    public Set<String> getKey();

    /**
     * Copy this policy and override the value of the property.
     * @param keyList           A collection of strings with one or more names of topic fields acting as alternative keys.
     * @return a new SubscriptionKeys policy
     */
    public SubscriptionKeys withKey(Collection<String> keyList);

    /**
     * Copy this policy and override the value of the property.
     * @param keyList           A strings with one name of topic fields acting as alternative key.
     * @return a new SubscriptionKeys policy
     */
    public SubscriptionKeys withKey(String keyList);

    /**
     * Copy this policy and override the value of the property.
     * @param keyList           An arbitrary number of strings with one or more names of topic fields acting as alternative keys.
     * @return a new SubscriptionKeys policy
     */
    public SubscriptionKeys withKey(String... keyList);
}


text:
package com.github.guillesup.fnacsp.template.algorithms;

import org.junit.Ignore;
import org.junit.Test;

import java.time.ZoneId;
import java.time.ZonedDateTime;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;

public abstract class AlgorithmTest {

    final double longitude;
    final double latitude;
    final double pressure;
    final double temperature;
    private final double hour;
    private final int day;
    private final int month;
    private final int year;
    private final String zoneId;
    private final double delta = 1.0E-04;
    private final double expectedZenith;
    private final double expectedAzimuth;
    private final double expectedRightAscension;
    private final double expectedDeclination;
    private final double expectedHourAngle;
    Algorithm algorithm;

    AlgorithmTest(String zoneId, double hour, int day, int month, int year, double longitude, double latitude,
                  double pressure, double temperature, double expectedZenith, double expectedAzimuth,
                  double expectedRightAscension, double expectedDeclination, double expectedHourAngle) {

        this.zoneId = zoneId;
        this.hour = hour;
        this.day = day;
        this.month = month;
        this.year = year;
        this.longitude = longitude;
        this.latitude = latitude;
        this.pressure = pressure;
        this.temperature = temperature;
        this.expectedZenith = expectedZenith;
        this.expectedAzimuth = expectedAzimuth;
        this.expectedRightAscension = expectedRightAscension;
        this.expectedDeclination = expectedDeclination;
        this.expectedHourAngle = expectedHourAngle;
    }

    final void compute() {
        algorithm.compute();
    }

    ZonedDateTime decimalTimeToZonedDateTime() {
        int hour = (int) this.hour;
        int minute = (int) ((hour - (int) this.hour) * 60.0);
        int second = (int) (((hour - (int) this.hour) * 60.0 - minute) * 60.0);
        int nanoSecond = (int) ((((hour - (int) this.hour) * 60.0 - minute) * 60.0 - second) * 1e9);

        return ZonedDateTime.of(year, month, day, hour, minute, second, nanoSecond, ZoneId.of(zoneId));
    }

    @Test
    public void zenithInRange() {
        assertTrue(isInRange(0, Algorithm.PI, algorithm.getZenith()));
    }

    private boolean isInRange(double leftBound, double rightBound, double value) {
        return value >= leftBound && value <= rightBound;
    }

    @Test
    public void azimuthInRange() {
        assertTrue(isInRange(-Algorithm.PI, Algorithm.PI, algorithm.getAzimuth()));
    }

    @Test
    @Ignore("The right ascension range has to be reviewed")
    public void rightAscensionInRange() {
        assertTrue(isInRange(0, Algorithm.PI2, algorithm.getRightAscension()));
    }

    @Test
    public void declinationInRange() {
        assertTrue(isInRange(-Algorithm.PIM, Algorithm.PIM, algorithm.getDeclination()));
    }

    @Test
    @Ignore("The hour angle range has to be reviewed")
    public void hourAngleInRange() {
        assertTrue(isInRange(-Algorithm.PI, Algorithm.PI, algorithm.getHourAngle()));
    }

    @Test
    public void zenithAtUT() {
        assertEquals(expectedZenith, algorithm.getZenith(), delta);
    }

    @Test
    public void azimuthAtUT() {
        assertEquals(expectedAzimuth, algorithm.getAzimuth(), delta);
    }

    @Test
    public void rightAscensionAtUT() {
        assertEquals(expectedRightAscension, algorithm.getRightAscension(), delta);
    }

    @Test
    public void declinationAtUT() {
        assertEquals(expectedDeclination, algorithm.getDeclination(), delta);
    }

    @Test
    public void hourAngleAtUT() {
        assertEquals(expectedHourAngle, algorithm.getHourAngle(), delta);
    }
}


text:
package graphTheory.algorithms.steinerProblems.steinerArborescenceApproximation;

import graphTheory.graph.Arc;
import graphTheory.utils.*;

import java.util.*;

/**
 *
 * Faster Implementation of the G_F_Triangle algorithm.
 *

 * This algorithm returns a feasible solution for the Directed Steiner Tree
 * problem. It is a greedy algorihm which uses a sub-algorihthm named FLAC.
 *

 * FLAC is designed to returns a feasible solution for the minimum Density
 * Directed Steiner Tree problem: it searches for a tree rooted in the root of
 * the instance which spans a part of the terminal. It try to minimize the total
 * cost of the tree divided by the number of terminals.
 *

 * To span the terminals, FLAC grows a flow from the terminals: we call them
 * sources. That flow is send through the entering arcs, with a flow rate equals
 * to 1 L/s, considering the volume of an arc is its weight. Then, when an arc
 * is full (we say saturated), the source feeds its entering arcs. If two
 * sources reach the same arc with a path of saturated arcs, the flow rate is 2
 * L/s. And if more sources reaches the arc, the flow rate increases again: the
 * flow rate inside an arc is equals to the number of sources it can reach with
 * paths of saturated arcs
 *

 * FLAC continue until the root is reached, and we return the set of saturated
 * arcs linked to the root. As we want to return a tree, each time an arc is
 * saturated, if a node is connected to the same source with two paths of
 * saturated arcs, we delete that last saturated arc.
 *

 * The previous implementation of G_F_Triangle first builds the closure metric of the graph where each arc (u,v) is associated with a shortest path linking u to v.
 * It then works exclusively in that new graph. It uses FLAC to span some terminals, delete those terminals, and repeat FLAC
 * to span other terminals. It continues until all the terminals are reached. At the end, each arc in the solution is replaced by the shortest path associated with.
 *

 * This version of G_F_Triangle does not build the closure metric at the beggining. The costs are initialized with +infinity for each arc which does not appear in the original graph.
 * And, when necessary, it uses a Roy-Floyd-Warshall-like operation to decrease the weights some arcs. The main property of this version is that the cost of any saturated arc at any iteration is always the cost of a shortest path in the original graph.
 *
 *
 * @author Watel Dimitri
 *
 */
public class GFLACTR3Algorithm extends SteinerArborescenceApproximationAlgorithm {

	// --------------------   Directed Steiner Tree Part --------------------//

	/**
	 * Copy of the costs of the instance. Each arc is here represented by a couple of nodes (~ integers).
	 * As this algorithm works in the complete metric closure  graph, all the couples exist in this map, except when the first node
	 * is equal to the second one.
	 *

	 * This map lets the algorithm modify the costs without modifying the instance itself.
	 *

	 * Note that, for an couple c, the cost of c is initialized if and only if we need it.
	 */
	private HashMap<Couple<Integer,Integer>, Integer> costs;

	/**
	 * For each couple of nodes (u,v), contains, at the end of the algorithm, the ordered list of arcs
	 * in a shortest path from u to v in the original graph.
	 */
	private HashMap<Couple<Integer,Integer>, TreeIterator<Arc>> shortestPath;

	/**
	 * Copy of the required vertices of the instance. It lets the algorithm
	 * modify this set without modifiying the instance.
	 */
	private HashSet<Integer> requiredVertices;

	/**
	 * List of nodes that are currently reached by the root in the current partial solution.
	 */
	private HashSet<Integer> reachedNodes;

	/**
	 * A comparator used to sort couples of nodes by costs.
	 */
	private Comparator<Couple<Integer,Integer>> comp;

	/**
	 * Set of saturated arcs (ie full of fluid)
	 */
	private HashSet<Couple<Integer,Integer>> saturated;

	/**
	 * For each node, this map saves the sources this node is linked to with a
	 * path of saturated arcs
	 */
	private HashMap<Integer, HashSet<Integer>> sources;

	/**
	 * For each node, this map saves SOME OF the sources the ancestors of this node are linked to with a
	 * path of saturated arcs.
	 * sourcesOfAncestors may not contain all those sources.
	 * sourcesOfAncestors[i] always include sources[i]
	 */
	private HashMap<Integer, HashSet<Integer>> sourcesOfAncestors;

	/**
	 * Set of nodes for which one entering arc is saturating. The key of each
	 * node in the Fibonacci Heap is the physical time when its next saturating
	 * arc will be saturated.
	 */
	private CustomFibonacciHeap<Integer, DoubleBoolean> sortedSaturating;

	/**
	 * The actual physical time since the beginning of saturation
	 */
	private double time;

	/**
	 * This maps each node to the node of the fibonacci heap containing it.
	 */
	private HashMap<Integer, CustomFibonacciHeapNode<Integer, DoubleBoolean>> n2fbn;

	/**
	 * For each node, this map sorts its input arcs (in the complete metric closure graph) by cost.
	 */
	private HashMap<Integer, TreeSet<Couple<Integer,Integer>>> sortedInputArcs;

	/**
	 * For each node, this map contains an iterator to its sorted list of inputs arc
	 * described by {@link #sortedInputArcs}
	 */
	private HashMap<Integer, Iterator<Couple<Integer,Integer>>> sortedInputArcsIterator;

	/**
	 * For each node v , this map contains the last arc iterated by the iterator in {@link #sortedInputArcsIterator} associated with v
	 */
	private HashMap<Integer, Couple<Integer,Integer>> nextSaturatedInputArc;

	/**
	 * Initialize the maps, sets and lists used by the algorithm.
	 */
	private void init() {
		// Copy the required vertices
		requiredVertices = new HashSet<Integer>(instance.getRequiredVertices());
		// Remove the root, if it is a terminal, otherwise, this algorithm could start
		// a infinite loop
		requiredVertices.remove(instance.getRoot());

		// Initialize the set of nodes that are reached from the root by the current solution.
		reachedNodes = new HashSet<Integer>();
		// At the beggining, the root only reaches itself.
		reachedNodes.add(instance.getRoot());

		// Build the comparator.
		comp = getArcsComparator();

		// Initialisation of every parameter
		// Note that those parameters are currently empty. Elements are added to them later
		// when it is necessary.
		costs = new HashMap<Couple<Integer,Integer>, Integer>();
		shortestPath = new HashMap<Couple<Integer,Integer>, TreeIterator<Arc>>();
		saturated = new HashSet<Couple<Integer,Integer>>();
		sources = new HashMap<Integer, HashSet<Integer>>();
        sourcesOfAncestors = new HashMap<Integer, HashSet<Integer>>();
		sortedSaturating = new CustomFibonacciHeap<Integer, DoubleBoolean>();
		n2fbn = new HashMap<Integer, CustomFibonacciHeapNode<Integer, DoubleBoolean>>();
		sortedInputArcs = new HashMap<Integer, TreeSet<Couple<Integer,Integer>>>();
		sortedInputArcsIterator = new HashMap<Integer, Iterator<Couple<Integer,Integer>>>();
		nextSaturatedInputArc = new HashMap<Integer, Couple<Integer,Integer>>();
	}

	@Override
	protected void computeWithoutTime() {

		// Initialize parameters
		this.init();

		// This set will merge the trees returned by FLAC
		HashSet<Arc> currentSol = new HashSet<Arc>();

		// Until all the terminals are reached
		while (requiredVertices.size() > 0) {

			// Search a low Density Directed Steiner Tree with the FLAC algorithm
			Couple<HashSet<Couple<Integer,Integer>>, HashSet<Integer>> result =
					applyFLAC();

			if (result == null) {
				// If the algorithm get here, there is either an error in the algorithm
				// or an error in the instance (it does not contain a feasible solution)
				this.arborescence = null;
				this.cost = null;
				return;
			}

			// This is the tree returned by FLAC
			HashSet<Couple<Integer,Integer>> tbest = result.first;

            HashSet<Integer> newReachedNodes = new HashSet<Integer>();

			/*
			 * Merge the tree and the current solution.
			 * Update the list of nodes reached by the current solution so that
			 * the next tree returned by FLAC is preferentially
			 * merged by the current partial solution.
			 */
			for (Couple<Integer,Integer> a : tbest) {
				// path is the list of arcs in a shortest path from a.first to a.second in the original graph.
				TreeIterator<Arc> path = getShortestPaths(a);
				while(path.hasNext()){
					Arc b = path.next();
					currentSol.add(b);
                    newReachedNodes.add(b.getOutput());
				}
			}

            reachedNodes.addAll(newReachedNodes);
			// Remove the reached terminals from the required vertices of the instance
            requiredVertices.removeAll(newReachedNodes);
		}

		// Set the output of this algorithm : the returned tree and its cost
		arborescence = currentSol;
		cost = 0;
		for(Arc a : arborescence){
			cost += instance.getIntCost(a);
		}
	}

	/**
	 * @return a comparator for the arcs of the complete graph.
	 */
	private Comparator<Couple<Integer, Integer>> getArcsComparator() {
		return new Comparator<Couple<Integer, Integer>>() {

			@Override
			public int compare(Couple<Integer, Integer> o1, Couple<Integer, Integer> o2) {
				// If arcs are the same : return 0
				if(o1 == o2)
					return 0;
				// If the first one is null, its cost is considered as Positive Infinity
				else if (o1 == null)
					return 1;
				// If the second one is null, its cost is considered as Positive Infinity
				else if (o2 == null)
					return -1;
				// If the arcs are equals : return 0 (we do not need to compute their respective costs)
				else if (o1.equals(o2))
					return 0;
				else {
					// Compute the costs of o1 and o2
					Integer i1 = GFLACTR3Algorithm.this.getCost(o1);
					Integer i2 = GFLACTR3Algorithm.this.getCost(o2);
					int comp;

					// Compare the costs
					if (i1 == i2)
						comp = 0;
					else if(i1 == null)
						return 1;
					else if (i2 == null)
						return -1;
					else
						comp = i1.compareTo(i2);
					if (comp != 0)
						return comp;

					// If the costs are the same, return the comparison of the nodes of the arc
					// so that arcs with same cost are ordered.
					comp = o1.first.compareTo(o2.first);
					if (comp != 0)
						return comp;

					return o1.second.compareTo(o2.second);
				}
			}
		};
	}

	// ---------- density Directed Steiner Tree part ---------

	/**
	 * @return a tree rooted in the root of the instance spanning a part of the
	 *         terminals, and the set of those terminals.
	 */
	private Couple<HashSet<Couple<Integer,Integer>>, HashSet<Integer>> applyFLAC() {

		// Reinitialize the parameters to let FLAC restart normally
		reinit();

		while (true) {
			// Check which arc will be the next saturated one
			Couple<Integer,Integer> a = nextSaturatedArc();

			Integer u = a.first;
			Integer v = a.second;

			// If the root or a node already linked to the root in the current solution is reached by the terminals, we can return a tree
			if (reachedNodes.contains(u)) {
                saturated.add(a);
				return buildTree();
			}

			// We now check if a node is linked to the root with two paths of saturated arcs: it is called a conflict
			boolean conflict = findConflict(u, v);

			// Whatever the case,
			// we first have to update the costs of all non saturated arcs entering v if possible except (u,v)
			// we then have to check which arc of v will be its next saturated entering arc, and when
			// it will be saturated
			saturationConsequences(a);

			// If there is a conflict, we just ignore the arc saturation, as if it was never added to the arc
			if (!conflict){
				// If there is no conflict, we have to update the flow rate of other arcs as a new arc is
				// saturated.
				saturateArcAndUpdate(a);
			}
		}
	}

	/**
	 * Clear the maps, sets and lists used by the algorithm FLAC. Reinitialize
	 * the parameters used by FLAC.
	 */
	private void reinit() {
		saturated.clear();
		sources.clear();
        sourcesOfAncestors.clear();
		sortedSaturating.clear();
		n2fbn.clear();

		// The saturation begin at 0 seconds
		time = 0D;

		// Clear the Iterators and next Saturating input arcs as we reset the flow : no more arc is saturated.
		// Note that the sortedInputArcs map is not cleared : it does not depend on the quantity of flow in the graph.
		nextSaturatedInputArc.clear();
		sortedInputArcsIterator.clear();

		// Init parameters for each terminal
		Iterator<Integer> it = instance.getGraph().getVerticesIterator();
		while (it.hasNext()) {
			Integer v = it.next();
			if (requiredVertices.contains(v)) {

				// define the sources feeding that terminal as the terminal itself
				getSources(v).add(v);
                getAncestorSources(v).add(v);

                // define the next saturated arc entering v, and compute the time
				// in seconds needed to saturate it.
				updateNextSaturatedArc(v);
			}
		}
	}

	/**
	 * @param v
	 * @return the set of sources of v. If it was not initialized, init it.
	 */
	private HashSet<Integer> getSources(Integer v) {
		HashSet<Integer> srcs = sources.get(v);
		if (srcs == null) {
			srcs = new HashSet<Integer>();
			sources.put(v, srcs);
		}
		return srcs;
	}

    /**
     * @param v
     * @return the set of sources of v. If it was not initialized, init it.
     */
    private HashSet<Integer> getAncestorSources(Integer v) {
        HashSet<Integer> srcs = sourcesOfAncestors.get(v);
        if (srcs == null) {
            srcs = new HashSet<Integer>();
            sourcesOfAncestors.put(v, srcs);
        }
        return srcs;
    }

	/**
	 * For an arc a = (u,v) full of flow, update the costs of every arc entering v except a, if necessary
	 * Then check which arc entering v will be the next arc full of flow after a.
	 * @param a
	 */
	private void saturationConsequences(Couple<Integer,Integer> a ) {

		boolean updated = updateCosts(a);

		// If the cost of at least one arc was updated and consequently the orederd set of arcs entering v was updated, we have to update the iterator of that set before using it again.
		if(updated)
			resetSortedInputArcsIterator(a.second);
		updateNextSaturatedArc(a.second);
	}

	/**
	 * For an arc a = (u,v) update the costs of every arcs (w,v) entering v if and only if firstly, (w,u) is an arc in the original graph, and secondly, the cost of (w,v) is greater than the cost of (w,u) plus the cost of (u,v).
	 * @param cuv
	 * @return true if at least one cost was modified, and consequently, if the list of ordered set of arcs entering v was updated.
	 */
	private boolean updateCosts(Couple<Integer,Integer> cuv){

		// The cost of the arc (u,v)
		Integer cost_uv = this.getCost(cuv);

		Integer u = cuv.first;
		Integer v = cuv.second;

		// Check if at least one cost is modified
		boolean modified = false;

		// We iterate over each arc entering u in the ORIGINAL graph
		Iterator<Arc> it = instance.getGraph().getInputArcsIterator(u);
		while(it.hasNext()){
			Arc b = it.next();
			Integer w = b.getInput();

			// If w equals v then, whatever the case, we will not update (u,v)
			if(w.equals(v))
				continue;

			// Arc (w,v)
			Couple<Integer, Integer> cwv = new Couple<Integer, Integer>();
			cwv.first = w;
			cwv.second = v;

			// Cost of the arc (w,v)
			Integer cost_wv = this.getCost(cwv);

			// Arc (w,u)
			Couple<Integer, Integer> cwu = new Couple<Integer, Integer>();
			cwu.first = w;
			cwu.second = u;

			// Cost of the arc (w,v)
			Integer cost_wu = this.getCost(cwu);

			// Updated cost of the arc (w,v)
			Integer cost_wvp;
			if(cost_wu == null)
				// If the cost of (w,u) is positive_infinitly then, whatever the case, cost_wvp can not be less than cost_wv
				continue;
			else
				// Value of the updated cost of (w,v)
				cost_wvp = cost_wu + cost_uv;

			// If the updated cost if less than the previous cost of (w,v) we update that cost.
			if(cost_wv == null || cost_wvp < cost_wv){
				// At least one cost was updated so the flag modified is true
				modified = true;

				// We decrease the cost of (w,v) and update its position in the oredered set of arcs entering v
				decreaseKey(cwv, cost_wvp);

				// We update the list of arcs in the shortest path linking w to v in the original graph (it is not possible to only define the predecessor of v in that path as this leads to infinite loops)
				TreeIterator<Arc> t = TreeIterator.getTreeIterator(getShortestPaths(cwu), getShortestPaths(cuv));
				shortestPath.put(cwv, t);
			}

		}
		return modified;
	}

	/**
	 * Assuming an entering arc of v is saturated, the next one is the next in
	 * the list of entering arcs of v sorted by weigths.

	 * This method find this arc and compute when it will be saturated
	 *
	 * @param v
	 */
	private void updateNextSaturatedArc(Integer v) {

		// Last saturated arc entering v
		Couple<Integer,Integer> cuv = getNextSaturatedInputArc(v);

		// Shift the iterator of arcs entering v to the next one
		boolean shifted = shiftNextSaturatedInputArc(v);
		if(!shifted){
			// If cuv was the last saturated arc entering v
			n2fbn.remove(v);
			return;
		}
		// If not, we continue ...

		// a is the new next saturating entering arc of v
		Couple<Integer,Integer> a = getNextSaturatedInputArc(v);

		// Saturated time of a
		Double satTime;
		Double volume = getVolume(a);
		double rate = getVolFlowRate(v);

		if(Double.isInfinite(volume))
			satTime = Double.POSITIVE_INFINITY;
		else if (cuv == null)
			// If a is the first arc entering v which starts to saturate
			satTime = volume / rate;
		else
			// If not...
			satTime = (volume - getVolume(cuv)) / rate;

		// Reinsert v in the list with the saturated time of a
		CustomFibonacciHeapNode<Integer, DoubleBoolean> fbn = sortedSaturating
				.insert(v, new DoubleBoolean(time + satTime, !a.first
						.equals(instance.getRoot())));
		n2fbn.put(v, fbn);

	}

	/**
	 * @param v
	 * @return the next arc entering v which will saturated. In other words, the first arc in the ordered set of arcs entering v which is not aleready saturated (or marked).
	 */
	private Couple<Integer, Integer> getNextSaturatedInputArc(Integer v) {
		return nextSaturatedInputArc.get(v);
	}

	/**
	 * Take the next arc returned by the iterator of the ordered set of arcs entering v and define it as the next saturated arc entering v.
	 * @param v
	 * @return true if there is one arc entering v which is not saturated
	 */
	private boolean shiftNextSaturatedInputArc(Integer v) {
		Iterator<Couple<Integer,Integer>> it = getSortedInputArcsIterator(v);
		if(it.hasNext()){
			nextSaturatedInputArc.put(v, it.next());
			return true;
		}
		return false;
	}

	/**
	 * Reset the iterator of the ordered set of arcs entering v : let (u,v) be the next saturated arc entering v, the next arc which is iterated is the one following (u,v) in the ordered set of arcs entering v.
	 * @param v
	 */
	private void resetSortedInputArcsIterator(Integer v){
		Couple<Integer,Integer> nextSaturatedInputArc = getNextSaturatedInputArc(v);
		TreeSet<Couple<Integer,Integer>> tree = getSortedInputArcs(v);
		Iterator<Couple<Integer,Integer>> it = tree.tailSet(nextSaturatedInputArc, false).iterator(); // According to the documentation, this should be done in O(log(n))
		sortedInputArcsIterator.put(v, it);
	}

	/**
	 * @param v
	 * @return the iterator of the ordered set of arcs entering v. If it does not exists, init it.
	 */
	private Iterator<Couple<Integer,Integer>> getSortedInputArcsIterator(Integer v){
		Iterator<Couple<Integer,Integer>> it = sortedInputArcsIterator.get(v);
		if(it == null){
			TreeSet<Couple<Integer,Integer>> tree = getSortedInputArcs(v);
			it = tree.iterator();
			sortedInputArcsIterator.put(v, it);
		}
		return it;
	}

	/**
	 *
	 * @param v
	 * @return the ordered set of arcs entering v. If it does not exists, init it.
	 */
	private TreeSet<Couple<Integer,Integer>> getSortedInputArcs(Integer v){
		TreeSet<Couple<Integer,Integer>> tree = sortedInputArcs.get(v);
		if(tree == null){
			tree = sortInputArcs(v);
			sortedInputArcs.put(v,tree);
		}
		return tree;
	}

	/**
	 * Sort the input arcs of v by cost
	 * @param v
	 */
	private TreeSet<Couple<Integer,Integer>>  sortInputArcs(Integer v) {

		TreeSet<Couple<Integer,Integer>> tree = new TreeSet<Couple<Integer,Integer>>(this.comp);
		Iterator<Integer> it = instance.getGraph().getVerticesIterator();

		while (it.hasNext()) {
			Integer w = it.next();
			if(w.equals(v))
				continue;
			Couple<Integer, Integer> c = new Couple<Integer, Integer>();
			c.first = w;
			c.second = v;

			tree.add(c);
		}

		return tree;
	}

	/**
	 * Decrease the cost of the arc cuv (~ (u,v)) to newCost. Update the set of ordered set entering v.
	 * @param cuv
	 * @param newCost
	 */
	private void decreaseKey(Couple<Integer,Integer> cuv, Integer newCost){
		Integer v = cuv.second;
		TreeSet<Couple<Integer,Integer>> tree = sortedInputArcs.get(v);
		// We first have to remove the arc from the tree or it will not be able to find it anymore.
		tree.remove(cuv);
		// Change the cost
		costs.put(cuv, newCost);
		// Add it in the tree again.
		tree.add(cuv);
	}

	/**
	 * @param cuv
	 * @return the current cost of the arc cuv. If it does not exists, init it.
	 */
	private Integer getCost(Couple<Integer,Integer> cuv){
		Integer cost;
		if(!costs.containsKey(cuv)){
			Arc b = instance.getGraph().getLink(cuv.first, cuv.second);
			cost = instance.getIntCost(b, true);
			costs.put(cuv, cost);
		}
		else
			cost = costs.get(cuv);
		return cost;
	}

	/**
	 *
	 * @param cuv
	 * @return the maximum value of flow an arc a can contain: its cost
	 */
	private Double getVolume(Couple<Integer,Integer> cuv) {
		Integer cost = getCost(cuv);
		if (cost == null)
			return Double.POSITIVE_INFINITY;
		else
			return (double) cost;
	}

	/**
	 * @param cuv : the arc (u,v) in the complete graph
	 * @return the list of arcs in a shortest path from u to v in the original graph.
	 */
	private TreeIterator<Arc> getShortestPaths(Couple<Integer,Integer> cuv){
		TreeIterator<Arc> t;
		if(!shortestPath.containsKey(cuv)){
			Arc b = instance.getGraph().getLink(cuv.first, cuv.second);
			t = TreeIterator.getTreeIterator(b);
			shortestPath.put(cuv, t);
		}
		else
			t = shortestPath.get(cuv);
		return t;
	}

	/**
	 *
	 * @param v
	 * @return the current flow rate entering v: the sources it can reach with
	 *         saturated arcs
	 */
	private double getVolFlowRate(Integer v) {
		return (double) getSources(v).size();
	}

	/**
	 * @return the next arc which will be full of flow in the graph.
	 */
	private Couple<Integer,Integer> nextSaturatedArc() {
		// Find the first node for which an entering arc will be full of flow
		CustomFibonacciHeapNode<Integer, DoubleBoolean> fbn = sortedSaturating
				.removeMin();
		time = fbn.getKey().getDoubleValue();

		// Return the first saturated entering arc of that node
		return getNextSaturatedInputArc(fbn.getData());
	}

	/**
	 * @return the set of arcs reaching the current solution with a path of saturated arcs. This shoud be a tree. This method also returns the set of terminals which are reached by that tree.
	 */
	private Couple<HashSet<Couple<Integer, Integer>>, HashSet<Integer>> buildTree() {
		LinkedList<Integer> toList = new LinkedList<Integer>();
		toList.addAll(reachedNodes);

		HashSet<Couple<Integer, Integer>> tree = new HashSet<Couple<Integer, Integer>>();
		HashSet<Integer> leaves = new HashSet<Integer>();

		while (!toList.isEmpty()) {

			Integer v = toList.pollFirst();
			if (requiredVertices.contains(v))
				leaves.add(v);

			Iterator<Integer> it = instance.getGraph().getVerticesIterator();
			while (it.hasNext()) {
				Integer w = it.next();

				if(w.equals(v))
					continue;

				Couple<Integer, Integer> c = new Couple<Integer,Integer>();
				c.first = v;
				c.second = w;
				if (!isSaturated(c))
					continue;

				tree.add(c);
				toList.add(w);
			}
		}
		return new Couple<HashSet<Couple<Integer, Integer>>, HashSet<Integer>>(tree, leaves);
	}

	/**
	 *
	 * @param a
	 * @return true if a is full of flow
	 */
	private boolean isSaturated(Couple<Integer,Integer> a) {
		return saturated.contains(a);
	}

	private boolean findConflict(Integer u, Integer v) {
		// Will contain the list of nodes linked to u with a saturated path...
		LinkedList<Integer> toList = new LinkedList<Integer>();
		// ... including u
		toList.add(u);

		// If one of those nodes is already linked to one of the sources linked to v
		// there is a conflict.
		HashSet<Integer> vsrcs = getSources(v);

        // Contain, for each node w, the successor of w in in path of saturated arc from w to u, if
        // such a path exists.
        HashMap<Integer, Integer> successor = new HashMap<Integer, Integer>();

		while (!toList.isEmpty()) {
			Integer w = toList.pollFirst();

            // If the sources reaching w intersect the sources reaching v there is a conflict
            if (nonEmptyIntersection(getAncestorSources(w), vsrcs)) {
                updateAncestorSources(w, successor);
                return true;
            }

			// Add all the saturated arcs entering w to the list of arcs we have to check
			Couple<Integer,Integer> saturatingInputArc = getNextSaturatedInputArc(w);
			if (saturatingInputArc == null)
				continue;

			// For each node linked to w with a saturated arc, we insert it in the list
			// of nodes we have to check
			Iterator<Couple<Integer,Integer>> it = getSortedInputArcs(w).iterator();
			while(it.hasNext()){
				Couple<Integer,Integer> inputArc = it.next();
				if(saturatingInputArc.equals(inputArc))
					break;
				if(isSaturated(inputArc)) { // Notice this test is necessary as some arcs could be full of flow but not saturated (and then marked)
                    Integer predecessor = inputArc.first;
                    toList.add(predecessor);
                    successor.put(predecessor, w);
                }
			}
		}
		return false;
	}

    /**
     * Update, for each node v which is a descendant of w in the list of successors, the set of sources
     * an ancestor of v can reach with a path of saturated arcs :
     * put all the sources an ancestor of w can reach into the vector of the successor v of w
     * and then recursively do it with v and all the descendant until the successor of v is null.
     * @param w
     * @param successor
     */
    private void updateAncestorSources(Integer w, HashMap<Integer, Integer> successor){
        HashSet<Integer> srcs = sourcesOfAncestors.get(w);
        HashSet<Integer> srcs2;
        Integer toUpdate = successor.get(w);
        while(toUpdate != null){
            srcs2 = sourcesOfAncestors.get(toUpdate);
            srcs2.addAll(srcs);

            srcs = srcs2;
            toUpdate = successor.get(toUpdate);
        }
    }

	/**
	 *
	 * @param s1
	 * @param s2
	 * @return true if s1 and s2 have a non empty intersection
	 */
	private boolean nonEmptyIntersection(HashSet<Integer> s1,
			HashSet<Integer> s2) {
		HashSet<Integer> sa, sb;

		if (s2.size() > s1.size()) {
			sa = s1;
			sb = s2;
		} else {
			sa = s2;
			sb = s1;
		}

		for (Integer v : sa) {
			if (sb.contains(v))
				return true;
		}

		return false;
	}

	private void saturateArcAndUpdate(Couple<Integer, Integer> a) {
		Integer u = a.first;
		Integer v = a.second;

		// This list will contain the set of node for which the flow rate will change
		// after the saturation of a...
		LinkedList<Integer> toUpdate = new LinkedList<Integer>();
		// ...including u
		toUpdate.add(u);

		// The sources of v we have to add to update the affected nodes
		HashSet<Integer> vsrcs = getSources(v);

		while (!toUpdate.isEmpty()) {
			Integer w = toUpdate.pollFirst();

			// The current flow rate inside each entering arc of w, before a is saturated
			double prevVolFlowRate = getVolFlowRate(w);
			getSources(w).addAll(vsrcs); // disjoint union, because there is no conflict
            getAncestorSources(w).addAll(vsrcs);

			if (prevVolFlowRate != 0) {
				// if w already received flow before a became saturated
				// the time the next entering arc of w is saturated is accelerated like this:
				CustomFibonacciHeapNode<Integer, DoubleBoolean> fbn = n2fbn
						.get(w);
				// by the following test, we test if there is an entering arc of w which is not fully saturated
				// in the other case we do nothing
				if (fbn != null) {
					Double prevNextSaturatedEnteringArcTime = fbn.getKey()
							.getDoubleValue();

					if(!Double.isInfinite(prevNextSaturatedEnteringArcTime)){

						double newVolFlowRate = getVolFlowRate(w);

						Double newNextSaturatedEnteringArcTime = time
								+ (prevNextSaturatedEnteringArcTime - time)
								* (prevVolFlowRate / newVolFlowRate);

						sortedSaturating.decreaseKey(fbn, new DoubleBoolean(
								newNextSaturatedEnteringArcTime, fbn.getKey()
								.getBooleanValue()));
					}
				}
			} else
				// if w did not receive any flow from the source, we initialize its saturation like this
				updateNextSaturatedArc(w);

			// For each node linked to w with a saturated arc, we insert it in the list
			// of nodes we have to update
			Couple<Integer,Integer> saturatingInputArc = getNextSaturatedInputArc(w);
			if (saturatingInputArc == null)
				continue;
			Iterator<Couple<Integer,Integer>> it = getSortedInputArcs(w).iterator();
			while(it.hasNext()){
				Couple<Integer,Integer> inputArc = it.next();
				if(saturatingInputArc.equals(inputArc))
					break;
				if(isSaturated(inputArc))// Notice this test is necessary as some arcs could be full of flow but not saturated (and then marked)
					toUpdate.add(inputArc.first);
			}
		}

        saturated.add(a);

	}

}


text:
package com.aspose.barcode.cloud.client.examples.generatingSaving.cloudStorage;

import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

import com.aspose.barcode.api.BarcodeApi;
import com.aspose.barcode.cloud.client.examples.Configuration;
import com.aspose.barcode.model.SaaSposeResponse;
import com.aspose.storage.api.StorageApi;

/**
 * This sample code allows you to create barcode and save image to local disk
 * using Aspose BarCode Cloud API.
 *
 */
public class CreateBarcodeAndSaveAsposeCloudStorage {

	public static void main(String[] args) {

		// ExStart:CreateBarcodeAndSaveAsposeCloudStorage
		try {

			// Instantiate Aspose Storage Cloud API SDK
			StorageApi storageApi = new StorageApi(Configuration.apiKey, Configuration.appSID, true);

			// Instantiate Aspose BarCode Cloud API SDK
			BarcodeApi barcodeApi = new BarcodeApi(Configuration.apiKey, Configuration.appSID, true);

			// Set the barcode file name created on server.
			String name = "sample-barcode";

			// Set Text to encode inside barcode.
			String text = "AsposeBarCode";

			// Set Barcode Symbology
			String type = "Code128";

			// Set Generated Barcode Image Format
			String format = "jpeg";

			// Set Resolution along X and Y in dpi.
			Float resolutionX = 0.0f;
			Float resolutionY = 0.0f;

			//Set Width and Height of barcode unit
			Float dimensionX = 0.0f;
			Float dimensionY = 0.0f;

			//Set Location, Measurement  of the code
			String codeLocation = "Below";
			String grUnit = "mm";

			// Sets if barcode's size will be updated automatically
			String autoSize = "true";

			 // Height of the bar.
			Float barHeight = 0.0f;

			//Set height, Width and quality of the image.
			Float imageHeight = 0.0f;
			Float imageWidth = 0.0f;
			String imageQuality = "default";

			// Set Angle of barcode orientation
			Float rotAngle = 0.0f; // .

			// Set Margin of image border
			Float topMargin = 0.0f;
			Float bottomMargin = 0.0f;
			Float leftMargin = 0.0f;
			Float rightMargin = 0.0f;

			// Sets if checksum will be added to barcode image.
			String enableChecksum = "Yes";

			//Set 3rd party cloud storage server (if any)
			String storage = ""; // .

			// Set folder location at cloud storage
			String folder = "";

			// Set local file (if any)
			File file = null;

			// invoke Aspose.BarCode Cloud SDK API to create barcode and put in
			// cloud storage
			SaaSposeResponse apiResponse = barcodeApi.PutBarcodeGenerateFile(
					name, text, type, format, resolutionX, resolutionY,
					dimensionX, dimensionY, codeLocation, grUnit, autoSize,
					barHeight, imageHeight, imageWidth, imageQuality, rotAngle,
					topMargin, bottomMargin, leftMargin, rightMargin,
					enableChecksum, storage, folder, file);

			if (apiResponse != null && apiResponse.getStatus().equals("OK")) {

				// download generated barcode from cloud storage
				com.aspose.storage.model.ResponseMessage storageRes = storageApi
						.GetDownload(name, null, null);
				//Save response stream to a file
				InputStream responseStream = storageRes.getInputStream();
				final Path destination = Paths.get( name
						+ "." + format);
				Files.copy(responseStream, destination,
						StandardCopyOption.REPLACE_EXISTING);
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		//ExEnd: CreateBarcodeAndSaveAsposeCloudStorage
	}

}


text:
 [](#skip-navbar_top "Skip navigation links")

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

Overview
Package
 Class
Use
Tree
Deprecated
Index
Help

 PREV CLASS   NEXT CLASS
FRAMES    NO FRAMES
All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD

------------------------------------------------------------------------

org.apache.struts.webapp.examples
 Class CustomActionMapping
---------------------------------

    java.lang.Object
      org.apache.struts.config.BaseConfig
          org.apache.struts.config.ActionConfig
              org.apache.struts.action.ActionMapping
                  org.apache.struts.webapp.examples.CustomActionMapping

**All Implemented Interfaces:**
[Serializable](http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html.md?is-external=true "class or interface in java.io")

------------------------------------------------------------------------

    public final class CustomActionMapping

extends [ActionMapping](http://struts.apache.org/apidocs/org/apache/struts/action/ActionMapping.html.md?is-external=true "class or interface in org.apache.struts.action")

Custom ActionMapping to demonstrate usage.

**Version:**
$Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $

**See Also:**
[Serialized Form](../../../../../serialized-form.html.md#org.apache.struts.webapp.examples.CustomActionMapping)

------------------------------------------------------------------------

**Field Summary**

| **Fields inherited from class org.apache.struts.config.[ActionConfig](http://struts.apache.org/apidocs/org/apache/struts/config/ActionConfig.html.md?is-external=true "class or interface in org.apache.struts.config")**                                  |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `actionId, attribute, cancellable, catalog, command, exceptions, extensionProcessed, forward, forwards, include, inherit, input, moduleConfig, multipartClass, name, parameter, path, prefix, roleNames, roles, scope, suffix, type, unknown, validate` |

| **Fields inherited from class org.apache.struts.config.[BaseConfig](http://struts.apache.org/apidocs/org/apache/struts/config/BaseConfig.html.md?is-external=true "class or interface in org.apache.struts.config")** |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `configured`                                                                                |

| **Constructor Summary**  |
|--------------------------|
| ` CustomActionMapping()`
                           |

**Method Summary**

` String`

` getExample()`
           Return the example String.

` void`

` setExample(String example)`
           Set the example String.

| **Methods inherited from class org.apache.struts.action.[ActionMapping](http://struts.apache.org/apidocs/org/apache/struts/action/ActionMapping.html.md?is-external=true "class or interface in org.apache.struts.action")** |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `findForward, findForwards, getInputForward`                                                                                |

| **Methods inherited from class org.apache.struts.config.[ActionConfig](http://struts.apache.org/apidocs/org/apache/struts/config/ActionConfig.html.md?is-external=true "class or interface in org.apache.struts.config")**                                                                                |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `addExceptionConfig, addForwardConfig, checkCircularInheritance, findException, findExceptionConfig, findExceptionConfigs, findForwardConfig, findForwardConfigs, freeze, getActionId, getAttribute, getCancellable, getCatalog, getCommand, getExtends, getForward, getInclude, getInput, getModuleConfig, getMultipartClass, getName, getParameter, getPath, getPrefix, getRoleNames, getRoles, getScope, getSuffix, getType, getUnknown, getValidate, inheritExceptionHandlers, inheritForwards, inheritFrom, isExtensionProcessed, processExtends, removeExceptionConfig, removeForwardConfig, setActionId, setAttribute, setCancellable, setCatalog, setCommand, setExtends, setForward, setInclude, setInput, setModuleConfig, setMultipartClass, setName, setParameter, setPath, setPrefix, setRoles, setScope, setSuffix, setType, setUnknown, setValidate, toString` |

| **Methods inherited from class org.apache.struts.config.[BaseConfig](http://struts.apache.org/apidocs/org/apache/struts/config/BaseConfig.html.md?is-external=true "class or interface in org.apache.struts.config")** |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `copyProperties, getProperties, getProperty, inheritProperties, setProperties, setProperty, throwIfConfigured`                                                                                |

| **Methods inherited from class java.lang.[Object](http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html.md?is-external=true "class or interface in java.lang")** |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`                                                                                |

**Constructor Detail**

### CustomActionMapping

    public CustomActionMapping()

**Method Detail**

### getExample

    public String getExample()

Return the example String.

------------------------------------------------------------------------

### setExample

    public void setExample(String example)

Set the example String.

**Parameters:**
`example` - The new example String.

------------------------------------------------------------------------

 [](#skip-navbar_bottom "Skip navigation links")

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

Overview
Package
 Class
Use
Tree
Deprecated
Index
Help

 PREV CLASS   NEXT CLASS
FRAMES    NO FRAMES
All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD

------------------------------------------------------------------------

Copyright © 2000-2008 [Apache Software Foundation](http://www.apache.org/). All Rights Reserved.


text:
package shiki.com.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

import shiki.com.bean.Weather;
import shiki.com.database.DBManager;
import shiki.com.tool.Util;
import shiki.com.weathertest.R;

import static shiki.com.database.DBManager.getInstance;

public class WeatherInfo extends AppCompatActivity {
    ArrayList<String> cityQueue = new ArrayList<String>();
    private int current = 0;
    private int cityCount = 0;
    private int currentPage = 1;
    private String mainCity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.weather_activity);
        SharedPreferences pref = getSharedPreferences("data", MODE_PRIVATE);
        current = pref.getInt("current", 0);
        cityCount = pref.getInt("cityCount", 0);
        if (cityCount == 0) {
            Intent intent = new Intent(WeatherInfo.this, InputActivity.class);
            startActivityForResult(intent, 2);
        } else {
            mainCity = pref.getString("main", null);
            for (int i = 0; i < cityCount; i++)
                cityQueue.add(i, pref.getString("city" + i, null));

            Log.d("tag", "onCreate: " + mainCity);

            Util.sendHttpRequest(cityQueue.get(current), getApplicationContext());
            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(600);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    WeatherInfo.this.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            upDateUi(cityQueue.get(current));
                        }
                    });
                }
            }).start();
        }
        Button left = (Button) findViewById(R.id.left);
        left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (--current > -1) {
                    upDateUi(cityQueue.get(current));
                } else {
                    Toast.makeText(WeatherInfo.this, "已经是第一个", Toast.LENGTH_SHORT).show();
                    current++;
                }

            }
        });
        Button right = (Button) findViewById(R.id.right);
        right.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (++current < cityCount) {
                    upDateUi(cityQueue.get(current));
                } else {
                    Toast.makeText(WeatherInfo.this, "已经是最后一个", Toast.LENGTH_SHORT).show();
                    current--;
                }
            }

        });

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_scrolling, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        DBManager dbManager = DBManager.getInstance(getApplicationContext());

        //noinspection SimplifiableIfStatement
        switch (id) {
            case R.id.add: {
                Intent intent = new Intent(WeatherInfo.this, InputActivity.class);
                startActivityForResult(intent, 1);
            }
            break;
            case R.id.dec: {

                if (current != 0) {

                    if (dbManager.loadWeather(cityQueue.get(current)).getMain() == 1)
                        dbManager.setMain(cityQueue.get(current), cityQueue.get(current-1));
                    cityQueue.remove(current);
                    cityCount--;
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Thread.sleep(600);
                                WeatherInfo.this.runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        upDateUi(cityQueue.get(current));
                                    }
                                });
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }).start();
                } else {

                    if (dbManager.loadWeather(cityQueue.get(current)).getMain() == 1)
                        dbManager.setMain(cityQueue.get(current), cityQueue.get(current+1));
                    cityQueue.remove(current);

                    cityCount--;
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Thread.sleep(600);
                                WeatherInfo.this.runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        upDateUi(cityQueue.get(current));
                                    }
                                });
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }).start();

                }
            }
            break;
            case R.id.setMain: {
                dbManager.setMain(mainCity, cityQueue.get(current));
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            Thread.sleep(600);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        WeatherInfo.this.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                upDateUi(cityQueue.get(current));
                            }
                        });
                    }
                }).start();
            }
            break;
            default:
                break;

        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        SharedPreferences.Editor editor = getSharedPreferences("data", MODE_PRIVATE).edit();
        editor.putInt("current", current);
        Log.d("tag", "setPreference: " + current);
        editor.putInt("cityCount", cityCount);
        editor.putString("main", mainCity);
        for (int i = 0; i < cityCount; i++) {
            editor.putString("city" + i, cityQueue.get(i));
        }
        editor.apply();
        Log.d("tag", "onDestroy: " + mainCity);
    }

    public void upDateUi(String currentCity) {
        DBManager dbManager = getInstance(getApplicationContext());
        Weather currentWeather = dbManager.loadWeather(currentCity);
        TextView tvInfo = (TextView) findViewById(R.id.info);
        TextView tvLocation = (TextView) findViewById(R.id.location);
        TextView tvDate = (TextView) findViewById(R.id.date);
        TextView tvDirect = (TextView) findViewById(R.id.direct);
        TextView tvHumidity = (TextView) findViewById(R.id.humidity);
        TextView tvImg = (TextView) findViewById(R.id.img);
        TextView tvTime = (TextView) findViewById(R.id.time);
        TextView tvMoon = (TextView) findViewById(R.id.moon);
        TextView tvPower = (TextView) findViewById(R.id.power);
        TextView tvTemperature = (TextView) findViewById(R.id.temperature);
        TextView tvMain = (TextView) findViewById(R.id.main);
        TextView tvPage = (TextView) findViewById(R.id.page);
        ImageView imageView = (ImageView) findViewById(R.id.img_info);
        String imgText = currentWeather.getInfo();
        switch (imgText) {
            case "晴": {
                imageView.setImageResource(R.drawable.sun);
                break;
            }
            case "多云": {
                imageView.setImageResource(R.drawable.cloud);
                break;
            }
            case "阵雨": {
                imageView.setImageResource(R.drawable.rain_tmp);
                break;
            }
            case "雨": {
                imageView.setImageResource(R.drawable.rain_big);
                break;
            }
            case "暴雨": {
                imageView.setImageResource(R.drawable.rain_super);
                break;
            }
            case "阴": {
                imageView.setImageResource(R.drawable.overcast);
                break;
            }
            case "小雪": {
                imageView.setImageResource(R.drawable.snow_min);
                break;
            }
            case "中雪": {
                imageView.setImageResource(R.drawable.snow);
                break;
            }
            case "大雪": {
                imageView.setImageResource(R.drawable.snow_big);
                break;
            }
            case "暴雪": {
                imageView.setImageResource(R.drawable.snow_super);
                break;
            }
            case "阵雪": {
                imageView.setImageResource(R.drawable.snow_tmp);
                break;
            }
            case "雾": {
                imageView.setImageResource(R.drawable.fogg_min);
                break;
            }
            case "霾": {
                imageView.setImageResource(R.drawable.fogg_big);
                break;
            }
            case "冰雹": {
                imageView.setImageResource(R.drawable.ice);
                break;
            }
            case "雷阵雨": {
                imageView.setImageResource(R.drawable.thunder_rain);
                break;
            }
        }

        tvInfo.setText(currentWeather.getInfo());
        if (currentWeather.getMain() == 1) {
            tvLocation.setText(currentWeather.getCity_name());
            tvMain.setVisibility(View.VISIBLE);
        } else {
            tvLocation.setText(currentWeather.getCity_name());
            tvMain.setVisibility(View.INVISIBLE);
        }

        tvDate.setText(currentWeather.getDate());
        tvDirect.setText(currentWeather.getDirect());
        tvHumidity.setText("湿度:" + currentWeather.getHumidity());
        tvImg.setText("可视:" + currentWeather.getImg());
        tvMoon.setText("农历:" + currentWeather.getMoon());
        tvPower.setText("风力:" + currentWeather.getPower());
        tvTemperature.setText(currentWeather.getTemperature() + "°");
        tvTime.setText("时间:" + currentWeather.getTime());
        currentPage = current + 1;
        tvPage.setText(currentPage + "/" + cityCount);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
        switch (requestCode) {
            case 1:
                Log.d("TAG", "onActivityResult: case1" + requestCode + resultCode);
                if (resultCode == RESULT_OK) {
                    cityCount += 1;
                    current = cityCount - 1;
                    cityQueue.add(intent.getStringExtra("cityName"));
                    Util.sendHttpRequest(cityQueue.get(current), getApplicationContext());
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Thread.sleep(600);
                                WeatherInfo.this.runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        upDateUi(cityQueue.get(current));
                                    }
                                });
                            } catch (Exception e) {
                                e.printStackTrace();
                            }

                        }
                    }).start();

                }
                break;
            case 2:
                if (resultCode == RESULT_OK) {
                    Log.d("tag", "onActivityResult: case2" + requestCode + resultCode);
                    cityCount += 1;
                    mainCity = intent.getStringExtra("cityName");
                    DBManager.getInstance(getApplicationContext()).setMain("null", mainCity);
                    cityQueue.add(mainCity);
                    Util.sendHttpRequest(cityQueue.get(current), getApplicationContext());
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                Thread.sleep(600);
                                WeatherInfo.this.runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {
                                        upDateUi(cityQueue.get(current));
                                    }
                                });
                            } catch (Exception e) {
                                e.printStackTrace();
                            }

                        }
                    }).start();

                }
                break;
            default:

        }

    }
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

/*============================================================
**
** Class:  Comparer
**
** Purpose: Compares two objects for equivalence,
**          where string comparisons are case-sensitive.
**
===========================================================*/

using System;
using System.Globalization;
using System.Diagnostics.Contracts;

namespace System.Collections
{
    public sealed class Comparer : IComparer
    {
        private CompareInfo _compareInfo;
        public static readonly Comparer Default = new Comparer(CultureInfo.CurrentCulture);
        public static readonly Comparer DefaultInvariant = new Comparer(CultureInfo.InvariantCulture);

        private const String CompareInfoName = "CompareInfo";

        private Comparer()
        {
            _compareInfo = null;
        }

        public Comparer(CultureInfo culture)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }
            Contract.EndContractBlock();
            _compareInfo = culture.CompareInfo;
        }

        // Compares two Objects by calling CompareTo.
        // If a == b, 0 is returned.
        // If a implements IComparable, a.CompareTo(b) is returned.
        // If a doesn't implement IComparable and b does, -(b.CompareTo(a)) is returned.
        // Otherwise an exception is thrown.
        //
        public int Compare(Object a, Object b)
        {
            if (a == b) return 0;
            if (a == null) return -1;
            if (b == null) return 1;
            if (_compareInfo != null)
            {
                String sa = a as String;
                String sb = b as String;
                if (sa != null && sb != null)
                    return _compareInfo.Compare(sa, sb);
            }

            IComparable ia = a as IComparable;
            if (ia != null)
                return ia.CompareTo(b);

            IComparable ib = b as IComparable;
            if (ib != null)
                return -ib.CompareTo(a);

            throw new ArgumentException(SR.Argument_ImplementIComparable);
        }
    }
}


text:
package org.eclipse.bpel.apache.ode.deploy.model.dd;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.FeatureMap;

/**
 *
 * A representation of the model object 'TProvide'.
 *
 *
 *

 * The following features are supported:
 *

 *
{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProvide#getService Service}

 *
{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProvide#getPartnerLink Partner Link}

 *
{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProvide#getCorrelationFilter Correlation Filter}

 *

 *

 *
 * @see org.eclipse.bpel.apache.ode.deploy.model.dd.ddPackage#getTProvide()
 * @model extendedMetaData="name='tProvide' kind='elementOnly'"
 * @generated
 */
public interface TProvide extends EObject {
	/**
	 * Returns the value of the 'Service' containment reference.
	 *
	 *

	 * If the meaning of the 'Service' containment reference isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Service' containment reference.
	 * @see #setService(TService)
	 * @see org.eclipse.bpel.apache.ode.deploy.model.dd.ddPackage#getTProvide_Service()
	 * @model containment="true" required="true"
	 *        extendedMetaData="kind='element' name='service' namespace='##targetNamespace'"
	 * @generated
	 */
	TService getService();

	/**
	 * Sets the value of the '{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProvide#getService Service}' containment reference.
	 *
	 *
	 * @param value the new value of the 'Service' containment reference.
	 * @see #getService()
	 * @generated
	 */
	void setService(TService value);

	/**
	 * Returns the value of the 'Partner Link' attribute.
	 *
	 *

	 * If the meaning of the 'Partner Link' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Partner Link' attribute.
	 * @see #setPartnerLink(String)
	 * @see org.eclipse.bpel.apache.ode.deploy.model.dd.ddPackage#getTProvide_PartnerLink()
	 * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
	 *        extendedMetaData="kind='attribute' name='partnerLink'"
	 * @generated
	 */
	String getPartnerLink();

	/**
	 * Sets the value of the '{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProvide#getPartnerLink Partner Link}' attribute.
	 *
	 *
	 * @param value the new value of the 'Partner Link' attribute.
	 * @see #getPartnerLink()
	 * @generated
	 */
	void setPartnerLink(String value);

	/**
	 * Returns the value of the 'Correlation Filter' attribute.
	 *
	 *

	 * If the meaning of the 'Correlation Filter' attribute isn't clear,
	 * there really should be more of a description here...
	 *

	 *
	 * @return the value of the 'Correlation Filter' attribute.
	 * @see #setCorrelationFilter(String)
	 * @see org.eclipse.bpel.apache.ode.deploy.model.dd.ddPackage#getTProvide_CorrelationFilter()
	 * @model dataType="org.eclipse.emf.ecore.xml.type.String"
	 * @generated
	 */
	String getCorrelationFilter();

	/**
	 * Sets the value of the '{@link org.eclipse.bpel.apache.ode.deploy.model.dd.TProvide#getCorrelationFilter Correlation Filter}' attribute.
	 *
	 *
	 * @param value the new value of the 'Correlation Filter' attribute.
	 * @see #getCorrelationFilter()
	 * @generated
	 */
	void setCorrelationFilter(String value);

} // TProvide


text:
using System.Collections.Generic;
using System.Web;
using AlloyDemoKit.Models.Pages;

namespace AlloyDemoKit.Models.ViewModels
{
    public class SearchContentModel : PageViewModel<SearchPage>
    {
        public SearchContentModel(SearchPage currentPage) : base(currentPage)
        {
        }

        public bool SearchServiceDisabled { get; set; }
        public string SearchedQuery { get; set; }
        public int NumberOfHits { get; set; }
        public IEnumerable<SearchHit> Hits { get; set; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<com.android.camera.ui.RotateLayout style="@style/RemainingLayout"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView android:id="@id/remaining_view" style="@style/RemainingText" />
</com.android.camera.ui.RotateLayout>


text:
<?php

namespace App\Presenters;

use App\Transformers\TagSharedTransformer;
use Prettus\Repository\Presenter\FractalPresenter;

/**
 * Class TagSharedPresenter
 *
 * @package namespace App\Presenters;
 */
class TagSharedPresenter extends FractalPresenter
{
    /**
     * Transformer
     *
     * @return \League\Fractal\TransformerAbstract
     */
    public function getTransformer()
    {
        return app(TagSharedTransformer::class);
    }
}