text:
package org.skfiy.typhon.rnsd.service.impl;

import com.alibaba.fastjson.JSONObject;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.http.HttpHost;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.skfiy.typhon.rnsd.domain.OS;
import org.skfiy.typhon.rnsd.domain.Recharging;
import org.skfiy.typhon.rnsd.domain.Region;
import org.skfiy.typhon.rnsd.domain.Zucks;
import org.skfiy.typhon.rnsd.repository.RechargingRepository;
import org.skfiy.typhon.rnsd.service.RechargingException;
import org.skfiy.typhon.rnsd.service.RechargingService;
import org.skfiy.typhon.rnsd.service.RegionService;
import org.skfiy.typhon.rnsd.service.handler.RechargingBO;
import org.skfiy.typhon.rnsd.service.handler.RechargingHandler;
import org.skfiy.typhon.rnsd.service.handler.TradeValidatedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Kevin Zou <kevinz@skfiy.org>
 */
public class RechargingServiceImpl implements RechargingService {

    private static final Logger LOG = LoggerFactory.getLogger(RechargingService.class);

    @Resource
    private RegionService regionService;
    @Resource
    private RechargingRepository rechargingRepository;
    @Resource
    private Map<String, RechargingHandler> rechargingHandlers;

    private final String basicAuth;
    //
    private final HttpClientBuilder HC_BUILDER = HttpClientBuilder.create();
    private final Map<OS, String> zucksKeys = new HashMap<>();

    private RechargingServiceImpl(String basicAuth) {
        this.basicAuth = basicAuth;

        zucksKeys.put(OS.ANDROID, "fa5396f7705881831269de56b921d6eb");
        zucksKeys.put(OS.IOS, "530e936ead86ffc313f2f3cbd8382d76");
    }

    @Transactional
    @Override
    public String recharge(JSONObject json) throws TradeValidatedException {
        RechargingBO rechargingBo = rechargingHandlers.get(json.getString("platform")).handle(json);
        LOG.debug("recharging info: {}", rechargingBo.getRecharging());

        rechargingRepository.save(rechargingBo.getRecharging());

        // 通知游戏服务器
        sendToGameServer(rechargingBo.getRecharging());

        // 保存订单信息
        rechargingBo.getRecharging().setStatus("S");
        return rechargingBo.getResult();
    }

    @Transactional
    @Override
    public void giveZucks(JSONObject json) throws TradeValidatedException {
        Zucks zucks = new Zucks();
        zucks.setOs(OS.valueOf(json.getString("os")));
        zucks.setZid(json.getString("id"));
        zucks.setPoint(json.getIntValue("point"));
        zucks.setUid(json.getString("userId"));

        // validate
        String sha1 = DigestUtils.sha1Hex(zucksKeys.get(zucks.getOs()) + zucks.getUid() + zucks.getPoint() + zucks.getZid());
        if (!json.getString("verify").equals(sha1)) {
            throw new TradeValidatedException(sha1, "verify failed");
        }

        rechargingRepository.save(zucks);

        Region region = regionService.loadAll().get(0);

        CloseableHttpClient hc = HC_BUILDER.build();
        HttpHost httpHost = new HttpHost(region.getIp(), region.getJmxPort());

        StringBuilder query = new StringBuilder();
        query.append("/InvokeAction//org.skfiy.typhon.spi%3Aname%3DGMConsoleProvider%2Ctype%3Dorg.skfiy.typhon.spi.GMConsoleProvider/action=pushItem?action=pushItem");
        query.append("&uid%2Bjava.lang.String=").append(zucks.getUid());
        query.append("&iid%2Bjava.lang.String=").append("w036");
        query.append("&count%2Bjava.lang.String=").append(zucks.getPoint());

        HttpGet httpGet = new HttpGet(query.toString());
        httpGet.addHeader("Authorization", basicAuth);

        CloseableHttpResponse response = null;
        try {
            response = hc.execute(httpHost, httpGet);
        } catch (IOException ex) {
            LOG.error("host:port -> {}:{}", region.getIp(), region.getJmxPort(), ex);
            throw new RechargingException("send to game server error error", ex);
        } finally {
            try {
                hc.close();
            } catch (IOException ex) {
            }
        }

        if (response == null || response.getStatusLine().getStatusCode() != HttpStatus.OK.value()) {
            LOG.error("recharging failed. {}", response);
            throw new RechargingException("recharging failed");
        }
    }

    private void sendToGameServer(Recharging recharging) {
        Region region = regionService.load(Integer.parseInt(recharging.getRegion()));

        CloseableHttpClient hc = HC_BUILDER.build();
        HttpHost httpHost = new HttpHost(region.getIp(), region.getJmxPort());

        StringBuilder query = new StringBuilder();
        query.append("/InvokeAction//org.skfiy.typhon.spi%3Aname%3DGMConsoleProvider%2Ctype%3Dorg.skfiy.typhon.spi.GMConsoleProvider/action=recharge?action=recharge");
        query.append("&rid%2Bjava.lang.String=").append(recharging.getUid());
        query.append("&cash%2Bjava.lang.String=").append(recharging.getGoods());

        HttpGet httpGet = new HttpGet(query.toString());
        httpGet.addHeader("Authorization", basicAuth);

        CloseableHttpResponse response = null;
        try {
            response = hc.execute(httpHost, httpGet);
        } catch (IOException ex) {
            LOG.error("host:port -> {}:{}", region.getIp(), region.getJmxPort(), ex);
            throw new RechargingException("send to game server error error", ex);
        } finally {
            try {
                hc.close();
            } catch (IOException ex) {
            }
        }

        if (response == null || response.getStatusLine().getStatusCode() != HttpStatus.OK.value()) {
            LOG.error("recharging failed. {}", response);
            throw new RechargingException("recharging failed");
        }
    }

}


text:
package org.gwtproject.editor.client;

/**
 * Used to edit non-object or immutable values. The Editor framework will not descend into a
 * LeafValueEditor.
 *
 * @param <T> The type of primitive value
 * @see org.gwtproject.editor.client.adapters.SimpleEditor
 */
public interface LeafValueEditor<T> extends Editor<T> {
  /**
   * Sets the value.
   *
   * @param value a value object of type V
   * @see #getValue()
   */
  void setValue(T value);

  /**
   * Returns the current value.
   *
   * @return the value as an object of type V
   * @see #setValue
   */
  T getValue();
}

redpajama_set_name: RedPajamaGithub


text:
dojo.provide("<%= name %>");
dojo.require("dijit.dijit");

dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.declare("<%= name %>",
	[dijit._Widget, dijit._Templated],
	{
		templatePath: dojo.moduleUrl("<%= module_prefix %>", "templates/<%= module_name %>.html"),

		constructor: function(){

		},

		// This handler is declared in the widget
		onClickHandler: function(evt){
			alert("clicked");
			dojo.stopEvent(evt);
		},

		postCreate: function(){
			dojo.query("span", this.domNode).addContent("
Example of coercing values in postCreate
");
		},

		someMethod: function(){
			return false;
		}
	}
);


text:
<?php

class IcalParserService
{

    public static function parseICalEvent($iCalEvent)
    {
        if (array_key_exists("VEVENT", $iCalEvent)) {
            $event = new Event();
            IcalParserService::parseICalData($iCalEvent, $event);
        }
    }

    private static function parseICalData($iCalData)
    {
        if (array_key_exists('RRULE', $iCalData)) {
            $data = IcalParserService::doubleExplode(';', '=', $iCalData['RRULE']);
            $startDate = strtotime($iCalData['DTSTART']);
            $endDate = strtotime($iCalData['DTEND']);
            $until = strtotime($data['UNTIL']);
            $timeDiff = '+' . $data['INTERVAL'] . ' ';
            $uid = $iCalData['UID'];
            $count = 1;
            if ($data['FREQ'] == 'DAILY') {
                $timeDiff .= 'day';
            } elseif ($data['FREQ'] == 'WEEKLY') {
                $timeDiff .= 'week';
            } elseif ($data['FREQ'] == 'MONTHLY') {
                $timeDiff .= 'month';
            } else {
                throw new Exception('Frequency ' . $data['FREQ'] . ' unknown!');
            }
            do {
                if ($endDate >= strtotime('- 2 weeks')) {
                    $uuid = $uid . '_' . $count;
                    $event = IcalParserService::convertSingleElement($iCalData, null, $uuid, $startDate, $endDate);
                    if (!$event->save()) {
                        var_dump($event->getErrors());
                    }
                }
                $startDate = strtotime($timeDiff, $startDate);
                $endDate = strtotime($timeDiff, $endDate);
                $count++;
            } while ($startDate <= ($until + (22 * 60 * 60)));
        } else {
            var_dump($iCalData);
            if (strtotime($iCalData['DTEND']) >= strtotime('- 2 weeks')) {
                $event = IcalParserService::convertSingleElement($iCalData);
                if (!$event->save()) {
                    var_dump($event->getErrors());
                }
            }
        }
        return;
    }

    private static function convertSingleElement($iCalData, $event = null, $uid = null, $dtStart = null, $dtEnd = null)
    {
        if (is_null($event)) {
            if (is_null($uid)) {
                $event = Event::model()->findByPk($iCalData['UID']);
            } else {
                $event = Event::model()->findByPk($uid);
            }
        }
        if (empty($event)) {
            $event = new Event();
        }
        if (!empty($uid)) {
            $event->uid = $uid;
        } elseif (array_key_exists('UID', $iCalData)) {
            $event->uid = $iCalData['UID'];
        }
        if (array_key_exists('DTSTAMP', $iCalData)) {
            $ts = strtotime($iCalData['DTSTAMP']);
            $event->create_time = $ts;
            $event->update_time = $ts;
        }
        if (!is_null($dtStart)) {
            $event->start = $dtStart;
        } else if (array_key_exists('DTSTART', $iCalData)) {
            $event->start = strtotime($iCalData['DTSTART']);
        }
        if (!is_null($dtEnd)) {
            $event->ende = $dtEnd;
        } else if (array_key_exists('DTEND', $iCalData)) {
            $event->ende = strtotime($iCalData['DTEND']);
        }
        if (array_key_exists('CATEGORIES', $iCalData)) {
            if ($event->category != trim($iCalData['CATEGORIES'])) {
                $event->category = trim($iCalData['CATEGORIES']);
            }
        }
        if (array_key_exists('SUMMARY', $iCalData)) {
            if ($event->summary != trim($iCalData['SUMMARY'])) {
                $event->summary = trim($iCalData['SUMMARY']);
            }
        }
        if (array_key_exists('DESCRIPTION', $iCalData)) {
            if ($event->description != trim($iCalData['DESCRIPTION'])) {
                $event->description = trim($iCalData['DESCRIPTION']);
            }
        }
        if (array_key_exists('LOCATION', $iCalData)) {
            if ($event->location != trim($iCalData['LOCATION'])) {
                $event->location = trim($iCalData['LOCATION']);
            }
        }
        return $event;
    }

    public static function doubleExplode($del1, $del2, $string)
    {
        $result = array();
        foreach (explode($del1, $string) as $val1) {
            $val2 = explode($del2, $val1);
            if (count($val2) == 1) {
                $result[$val2[0]] = null;
            } elseif (count($val2) == 2) {
                $result[$val2[0]] = $val2[1];
            }
        }
        return $result;
    }
}


text:
from util import RenpyCallbacks

class PopupsViewController(object):
    def __init__(self, manager):
        self._manager = manager
        self._manager.listen_populate(self.show)
        self._fade_time = 1

    @property
    def popups(self):
        return self._manager.popups

    @property
    def total(self):
        return self._manager.total

    def update(self, dt):
        self._manager.update(dt)

    def get_transparency(self, popup):
        lifespan = self._clamp(popup.lifespan, 0, self._fade_time)
        return 255 * lifespan / self._fade_time

    def _clamp(self, value, _min, _max):
        if value > _max:
            return _max
        elif value < _min:
            return _min
        return value

    def show(self, _):
        RenpyCallbacks.get_instance().show_screen("popup", self)


text:
require 'test_helper'

class Ipv6sControllerTest < ActionController::TestCase
  setup do
    @ipv6 = ipv6s(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:ipv6s)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create ipv6" do
    assert_difference('Ipv6.count') do
      post :create, ipv6: { address: @ipv6.address, gigabit_ethernet_id: @ipv6.gigabit_ethernet_id, primary: @ipv6.primary }
    end

    assert_redirected_to ipv6_path(assigns(:ipv6))
  end

  test "should show ipv6" do
    get :show, id: @ipv6
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @ipv6
    assert_response :success
  end

  test "should update ipv6" do
    patch :update, id: @ipv6, ipv6: { address: @ipv6.address, gigabit_ethernet_id: @ipv6.gigabit_ethernet_id, primary: @ipv6.primary }
    assert_redirected_to ipv6_path(assigns(:ipv6))
  end

  test "should destroy ipv6" do
    assert_difference('Ipv6.count', -1) do
      delete :destroy, id: @ipv6
    end

    assert_redirected_to ipv6s_path
  end
end


text:
\documentclass[a4paper]{article}
% \usepackage{fullpage}
\usepackage[utf8]{inputenc}
\usepackage[nottoc,numbib]{tocbibind}
% \usepackage{amssymb}
% \usepackage{amsmath}
\usepackage[czech]{babel}
\usepackage{listings}
\usepackage{todonotes}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{placeins}

% \definecolor{string}{rgb}{0.7,0.0,0.0}
% \definecolor{comment}{rgb}{0.13,0.54,0.13}
% \definecolor{keyword}{rgb}{0.0,0.0,1.0}
% \lstset{
% % numbers=left,
%   language=Ruby,
%   frame=single,
%   tabsize=2,
%   basicstyle=\footnotesize\ttfamily,
%   keywordstyle=\color{keyword}\textbf,
%   commentstyle=\color{comment}\textit,
%   stringstyle=\color{string}
% }
% \pgfdeclarelayer{background}
% \pgfdeclarelayer{foreground}
% \pgfsetlayers{background,main,foreground}

\begin{document}
\title{Uživatelská dokumentace \\ CompulsiveSkinPicking - C\# CSP solver}
\author{Michael Pokorný}
\date{13.7.2014}

\maketitle

\tableofcontents

\section{Úvod}
CSP (\textit{Constrain Satisfaction Problem}) je klasický příklad
NP-kompletního problému.
Představme si množinu \textit{proměnných} $V$, kde proměnná
$V_i$ může nabývat pouze hodnot z $D(V_i)$. Dále omezme hodnoty těchto proměnných
\textit{podmínkami} $C$. Každá podmínka $C_i$ je $n_i$-ární relace nad definičními
obory $n_i$ proměnných:
$$C_i \subseteq D(V_{v_1})\times \cdots \times D(V_{v_{n_i}})$$
Řešení CSP problému je takové přiřazení hodnot z $D(V_i)$ každé proměnné
$V_i$, které splňuje všechny tyto podmínky. NP-kompletnost lze dokázat například
triviálním převodem SAT na CSP.

CSP se často používá jako alternativní reprezentace jiných těžkých problémů v
umělé inteligenci. Při vhodném překladu z původního problému na CSP lze výhodně
využít existující techniky pro CSP řešiče. Na CSP se například často převádí
plánovací a rozvrhovací problémy.

Účel této knihovny je paralelně řešit zadanou instanci CSP.

\section{Reprezentace problému}
Nejdříve je potřeba vytvořit reprezentaci daného problému.
K tomu slouží třída \texttt{Problem}:
\begin{lstlisting}
using CompulsiveSkinPicking;
...
Problem problem = new Problem();
\end{lstlisting}

Problém se skládá z proměnných a podmínek.
Nezáleží na pořadí, v jakém se přidávají -- pouze musí být každá podmínka
přidána po všech proměnných, na kterých závisí.

\subsection{Proměnné}
Knihovna CompulsiveSkinPicking umožňuje pouze používat proměnné s konečnými
diskrétními doménami. Proměnná se reprezentují instancemi třídy
\texttt{Variable} a lze je přidávat voláním metod vlastnosti \texttt{Variables}
třídy \texttt{Problem}. Takto lze přidat buď celočíselné proměnné, nebo
booleovské proměnné. Booleovské proměnné jsou pouze speciální případ, lišící se
standardní doménou $\{0;1\}$:
\begin{lstlisting}
// 0 <= X <= 10
Variable x = problem.Variables.AddInteger(0, 10);
// Volitelne jde nastavit jmeno.
Variable x2 = problem.Variables.AddInteger(0, 10, "X2");

// 3 promenne, -5 <= X < -3
Variable[] abc = problem.Variables.AddIndeger(3, -5, -3);
// Lze nastavit pojmenovavaci konvenci. Predane funkci
// se predavaji indexy 0, 1, 2 pro pojmenovani kazde
// promenne.
Variable[] prom123 =
  problem.Variables.AddIndeger(3, -5, -3, x =>
    string.Format("Prom{0}", x+1)
  );

Variable x = problem.Variables.AddBoolean();
Variable xs = problem.Variables.AddBooleans(10);
\end{lstlisting}

\subsection{Podmínky}
Pro přidávání podmínek slouží vlastnost \texttt{Constrains} třídy
\texttt{Problem}. Ke konstrukci podmínek se dá použít statická třída
\texttt{Constrain}. Je možné také zkonstruovat vlastní podmínky (což popisuje
podrobněji programátorská dokumentace).

Následující podmínky je možno zkontruovat pomocí třídy \texttt{Constrains}:
\begin{itemize}
\item
	\texttt{NotEqual(X,Y)}: hodnoty proměnných musí být různé
\item
	\texttt{Equal(X,Y)}: hodnoty proměnných musí být shodné
\item
	\texttt{Plus(X,Y,Z)}: součet hodnot proměnných X a Y musí být hodnota Z
\item
	\texttt{Minus(X,Y,Z)}: analogické k \texttt{Plus}
\item
	\texttt{Multiply(X,Y,Z)}: analogické k \texttt{Plus}
\item
	\texttt{Divide(X,Y,Z)}: analogické k \texttt{Plus}. Jedná se o
	celočíselné dělení -- například $15 / 6 = 2$.
\item
	\texttt{Modulo(X,Y,Z)}: analogické k \texttt{Plus}. Jde o zbytek po
	celočíselném dělení -- například $15 \% 6 = 3$.
\item
	\texttt{VariableNot(X,Y)}: pravdivost proměnné X musí být opak
	logické hodnoty proměnné Y. Pravdivostí se pro účely této podmínky
	a všech následujících rozumí nenulovost. (Toto umožňuje kombinovat
	booleovské a celočíselné proměnné.)
\item
	\texttt{VariableAnd(X,Y,Z)}: pravdivost Z musí být pravdivost X $\wedge$
	pravdivost Y
\item
	\texttt{VariableOr(X,Y,Z)}: analogicky, $\vee$
\item
	\texttt{VariableXor(X,Y,Z)}: analogicky, $\oplus$
\item
	\texttt{VariableImplies(X,Y,Z)}: analogicky, $\rightarrow$
\item
	\texttt{VariableGreaterThan(X,Y,Z)}: proměnná Z je pravdivá právě když
	hodnota X je větší, než hodnota Y.
\item
	\texttt{VariableGreaterThanOrEqualTo(X,Y,Z)}: analogicky, $\geq$
\item
	\texttt{GreaterThan(X,Y)}: hodnota X musí být větší než hodnota Y
\item
	\texttt{GreaterThanOrEqualTo(X,Y,Z)}: analogicky, $\geq$
\item
	\texttt{AllDifferent(X,Y,\ldots)}: všechny předané proměnné musí mít
	různé hodnoty. Přijímá jak pole proměnných, tak proměnné uvedené jako
	jednotlivé parametry.
\item
	\texttt{Truth(X)}: proměnná X má pravdivou hodnotu
\item
	\texttt{Relational(r,X[])}: na předaném poli proměnných platí daná
	relace. Relace je funkce, která dostane jako parametry hodnoty
	jednotlivých proměnných (\texttt{int}) a vrátí, je-li splněna.
	Příklad použití:
\begin{lstlisting}
problem.Constrains.Add(Constrain.Relational(
	(x) => (x[0] + x[1] == x[2]) || (x[0] - x[2] == x[1]),
	new Variable[] { A, B, C }
));
\end{lstlisting}
	Proměnné lze uvést polem nebo jednotlivými argumenty.
\item
	\texttt{BinaryFunctional(f,A,B,Y)}: $Y=f(A,B)$. Příklad použití:
\begin{lstlisting}
problem.Constrains.Add(Constrain.BinaryFunctional(
	(a,b) => Math.Abs(a - b),
	X, Y, Z
)); // |X-Y|=Z
\end{lstlisting}
\end{itemize}

\subsection{Výrazové proměnné}
Zatím uvedené podmínky nedávají dost pohodlí ke konstrukci složitějších
algebraických omezení. K tomu lze využít výrazové proměnné.
Jedná se o mechanismus, který na základě matematického výrazu nad proměnnými
vyrobí novou proměnnou reprezentující jeho hodnotu.

Pokud například máme proměnné S, E, N a D obsahující číslice, můžeme
následujícím způsobem vyrobit proměnnou reprezentující hodnotu SEND:
\begin{lstlisting}
Variable SEND =
  (S * 1000 + E * 100 + N * 10 + D).Build(problem);
\end{lstlisting}

Tento mechanismus je potřeba použít pro vytvoření proměnné v místě,
kam bychom chtěli předat konstantu:
\begin{lstlisting}
problem.Constrains.Add(
  Constrain.Plus(X, Y, 5.Build(problem))
);
\end{lstlisting}

Mezi podporované operátory patří závorky, \texttt{+}, \texttt{-}, \texttt{*},
\texttt{/}, \texttt{\%}, \texttt{\&}, \texttt{|}, \texttt{\^}, \texttt{!}.
Kromě toho lze jako "pseudooperátory" používat statické metody
\texttt{GreaterThan}, \texttt{GreaterThanOrEqualTo}, \texttt{LessThan},
\texttt{LessThanOrEqualTo} třídy
\texttt{CompulsiveSkinPicking.AlgebraicExpression.Node}. Tyto metody vrací
booleovskou proměnnou, jejíž pravdivost záleží na splnění dané relace.

\subsection{Optimalizace}
Některé úlohy kromě splnění podmínek také vyžadují minimalizaci nebo
maximalizaci hodnoty některé proměnné. Rozvrhování například může vyžadovat
co nejkratší dobu vykonávání rozvrhu nebo co nejméně použitých zdrojů.

Proměnnou k optimalizaci a směr optimalizace lze nastavit zavoláním metody
\texttt{SetObjective} třídy \texttt{Problem}:
\begin{lstlisting}
problem.SetObjective(RESOURCES_USED, ObjectiveDirection.Minimize);
\end{lstlisting}

Jeden problém může optimalizovat nejvýše jednu proměnnou.

\section{Volání solveru}
Solver je komponenta řešící CSP problém. Knihovna CompulsiveSkinPicking obsahuje
pouze jednu implementaci:
\begin{lstlisting}
Solver solver = new Solver();
\end{lstlisting}
Když je hotové zadání problému, stačí k jeho vyřešení zavolat na solveru metody
\texttt{Solve}. Její první parametr je problém a její druhý výstupní parametr je
proměnná, do které bude uloženo řešení (typu
\texttt{CompulsiveSkinPicking.IVariableAssignment}). Tato metoda vrátí boolean, který značí,
bylo-li řešení úspěšné:
\begin{lstlisting}
IVariableAssignment solution;
if (!solver.Solve(problem, out solution)) {
  Console.WriteLine("No solution exists :(");
  Environment.Exit(1);
}
Console.WriteLine("Solution found");
\end{lstlisting}

Nalezené řešení lze zkoumat indexerem, jehož parametr je proměnná:
\begin{lstlisting}
Console.WriteLine("Resources used: {0}",
  solution[RESOURCES_USED].Value
);
\end{lstlisting}

\end{document}


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

<title>Klondike.Rules</title>
<meta name="date" content="2015-08-15">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

info.jayharris.klondike

Class Klondike.Rules

java.lang.Object

info.jayharris.klondike.Klondike.Rules

Enclosing class:

Klondike

public static class Klondike.Rules
extends java.lang.Object

Method Summary

Methods

Modifier and Type
Method and Description

int
getDeal()

int
getPasses()

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

getDeal

public int getDeal()

getPasses

public int getPasses()

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
import sys, os, logging, argparse, boto3, socket, textwrap
from yaml import safe_load
from urllib.parse import urlparse
from socket import gethostname as ghn

__version__ = '0.1'
try:
    import coloredlogs
    coloredlogs.install(
        isatty = True,
        show_name = False,
        show_severity = False,
        level = logging.NOTSET,
        severity_to_style = {'DEBUG': {'color': 'blue'}},
    )
except:
    logging.basicConfig(
        stream = sys.stdout,
        format = '%(asctime)s ' + ghn() + ' %(levelname)-8s %(message)s',
        datefmt = "%Y-%m-%d %H:%M:%S",
        level = logging.NOTSET,
    )
log = logging.getLogger(os.path.basename(sys.argv[0]))

def clamp(low, x, high):
    return low if x < low else high if x > high else x

def unwrap(txt):
    return ' '.join(textwrap.wrap(textwrap.dedent(txt).strip()))

def set_logging_level(quiet, verbose):
    level_adj = (quiet - verbose) * 10
    new_level = clamp(
        logging.NOTSET,
        logging.WARNING + level_adj,
        logging.CRITICAL
    )
    for handler in getattr(logging.getLogger(), 'handlers', []):
        handler.setLevel(new_level)
        cls_name = handler.__class__.__name__
        log.debug('Set %s handler level to %d', cls_name, new_level)

def parse_args():
    p = argparse.ArgumentParser(
        description=unwrap("""
            Copy files between the local system and S3, or directly between
            locations in S3. Optionally, assume an IAM role before performing
            the copy operation. This command does _not_ handle recursive
            copies.
        """),
    )
    p.add_argument(
        '--profile', '-p',
        metavar = 'NAME',
        default = None,
        help    = unwrap("""
            Use a profile to perform the copy or assume-role operation. If not
            specified, the default credential search order is used.
        """),
    )
    p.add_argument(
        '--assume-role', '-a',
        metavar = 'ARN',
        default = None,
        help    = unwrap("""
            ARN of an IAM role to assume before performing the copy operation.
        """),
    )
    p.add_argument(
        '--assume-role-session-name',
        metavar = 'NAME',
        default = 'assume-role-s3-copy',
        help    = unwrap("""
            The session name to use when assuming the role. Defaults to
            'assume-role-s3-copy'.
        """),
    )

    p.add_argument(
        '--verbose', '-v',
        action  = 'count',
        default = 0,
        help    = 'Be more verbose.',
    )
    p.add_argument(
        '--quiet', '-q',
        action  = 'count',
        default = 0,
        help    = 'Be less verbose.',
    )
    p.add_argument(
        '--version', '-V',
        action  = 'version',
        version = '%(prog)s {0}'.format(__version__),
        help    = 'Show version information and exit.',
    )

    p.add_argument(
        '--extra-args',
        metavar = 'FILE',
        help    = 'A YAML or JSON file to load extra upload args from.',
    )
    p.add_argument(
        'source',
        metavar = 'SRC',
        help    = 'A local path or s3://<bucket>/<path> URL.',
    )
    p.add_argument(
        'destination',
        metavar = 'DST',
        help    = 'A local path or s3://<bucket>/<path> URL.',
    )

    return p.parse_args()

def resolve_local_path(path, copy_basename_from = '', create_missing_dirs = False):
    log.debug('resolve_local_path "%s" "%s"', path, copy_basename_from)
    path = os.path.expanduser(path)
    basename = os.path.basename(copy_basename_from)
    if not os.path.exists(path):
        if create_missing_dirs and path.endswith('/'):
            log.info('Creating directories: %s', path)
            os.makedirs(path)
        else:
            log.error('Local path does not exist: %s', path)
            raise SystemExit(1)
    if os.path.isdir(path):
        path = os.path.join(path, basename)
    path = os.path.abspath(path)
    return path

def resolve_s3_key(key, copy_basename_from = ''):
    log.debug('resolve_s3_key "%s" "%s"', key, copy_basename_from)
    key = key.lstrip('/')
    basename = os.path.basename(copy_basename_from)
    if key == '':
        if copy_basename_from:
            return basename
        else:
            log.error('S3 key cannot be blank.')
            raise SystemExit(1)
    if key.endswith('/'):
        key = os.path.join(key, basename)
    return key

def main():
    args = parse_args()
    set_logging_level(args.quiet, args.verbose)
    log.debug('Args: %r', args)

    session = boto3.Session(profile_name=args.profile)

    if args.assume_role is not None:
        sts = session.client('sts')
        assumed_role = sts.assume_role(
            RoleArn         = args.assume_role,
            RoleSessionName = args.assume_role_session_name,
        )
        credentials = assumed_role.get('Credentials', {})
        session = boto3.Session(
            aws_access_key_id     = credentials.get('AccessKeyId', ''),
            aws_secret_access_key = credentials.get('SecretAccessKey', ''),
            aws_session_token     = credentials.get('SessionToken', ''),
        )
    s3 = session.client('s3')

    source      = urlparse(args.source)
    destination = urlparse(args.destination)

    if source.scheme == 's3' and destination.scheme == 's3':
        copy_source = {
            'Bucket': source.netloc,
            'Key': resolve_s3_key(source.path),
        }
        bucket     = destination.netloc
        key        = resolve_s3_key(destination.path, copy_source.get('Key'))
        log.debug('Copy %r => %s : %s', copy_source, bucket, key)
        s3.copy(copy_source, bucket, key)
    elif source.scheme == 's3':
        bucket     = source.netloc
        key        = resolve_s3_key(source.path)
        local_path = resolve_local_path(destination.path, source.path, True)
        log.debug('Download %s : %s => %s', bucket, key, local_path)
        s3.download_file(bucket, key, local_path)
    elif destination.scheme == 's3':
        local_path = resolve_local_path(source.path)
        bucket     = destination.netloc
        key        = resolve_s3_key(destination.path, local_path)
        extra_args = safe_load(open(args.extra_args)) if args.extra_args else {}
        log.debug('Upload %s => %s : %s (%r)', local_path, bucket, key, extra_args)
        s3.upload_file(local_path, bucket, key, ExtraArgs = extra_args)
    else:
        log.error('At least one of source or destination must be an S3 URL.')
        raise SystemExit(1)

if __name__ == '__main__':
    main()


text:
template <typename T>
struct Bar {
    Bar & ref() { return *this; }
    const Bar & const_ref() { return *this; }
    T value;
};

template <typename T>
struct Foo {
    int bar_value(const Bar<int> & bar) { return bar.value; }
};

#endif


text:
# Cognitive Services Translator Text SDK

> see https://aka.ms/autorest

Configuration for generating Translator Text SDK.

The current release is `release_3_0`.

The current document batch preview release is `release_1_0_preview.1'`.

``` yaml

tag: release_3_0
add-credentials: true
openapi-type: data-plane
```

``` yaml

tag: release_1_0_preview.1
add-credentials: true
openapi-type: data-plane
```
``` yaml

tag: release_1_0
add-credentials: true
openapi-type: data-plane
```
# Releases

### Preview 1.0
This setting is for batch document translator and only applied when `--tag=release_1_0_preview.1` is specified on the command line.
``` yaml $(tag) == 'release_1_0_preview.1'
input-file: preview/v1.0-preview.1/TranslatorBatch.json
```

### 1.0 Batch API
This setting is for batch document translator and only applied when `--tag=release_1_0` is specified on the command line.
``` yaml $(tag) == 'release_1_0'
input-file: stable/v1.0/TranslatorBatch.json
```

### Release 3.0
These settings apply only when `--tag=release_3_0` is specified on the command line.

``` yaml $(tag) == 'release_3_0'
input-file: stable/v3.0/TranslatorText.json
```

## Swagger to SDK

This section describes what SDK should be generated by the automatic system.
This is not used by Autorest itself.

``` yaml $(swagger-to-sdk)
swagger-to-sdk:
  - repo: azure-sdk-for-python
  - repo: azure-sdk-for-java
  - repo: azure-sdk-for-go
  - repo: azure-sdk-for-nodejs
```

## CSharp Settings
These settings apply only when `--csharp` is specified on the command line.
``` yaml $(csharp)
csharp:
  sync-methods: None
  license-header: MICROSOFT_MIT_NO_VERSION
  azure-arm: false
  namespace: Microsoft.Azure.CognitiveServices.TranslatorText
  output-folder: $(csharp-sdks-folder)/CognitiveServices/dataPlane/TranslatorText/TranslatorText/Generated
  clear-output-folder: true
```

## Python

See configuration in [readme.python.md](./readme.python.md)

## Go

See configuration in [readme.go.md](./readme.go.md)

## Java

These settings apply only when `--java` is specified on the command line.
Please also specify `--azure-libraries-for-java-folder=<path to the root directory of your azure-libraries-for-java clone>`.

``` yaml $(java)
java:
  azure-arm: true
  namespace: com.microsoft.azure.cognitiveservices.translatortext
  license-header: MICROSOFT_MIT_NO_CODEGEN
  payload-flattening-threshold: 1
  output-folder: $(azure-libraries-for-java-folder)/cognitiveservices/data-plane/translatortext
  with-optional-parameters: true
  with-single-async-method: true
```

## Node.js

``` yaml $(nodejs)
nodejs:
  package-name: azure-cognitiveservices-translatortext
  output-folder: $(node-sdks-folder)/lib/services/translatorText
  azure-arm: false
  generate-license-txt: true
  generate-package-json: true
  generate-readme-md: false
```

### Tag: release_1_0_preview.1 and nodejs

These settings apply only when `--tag=release_1_0_preview.1 --nodejs` is specified on the command line.

``` yaml $(tag) == 'release_1_0_preview.1' && $(nodejs)
  package-version: 1.0.1
```

### Tag: release_1_0 and nodejs

These settings apply only when `--tag=release_1_0 --nodejs` is specified on the command line.

``` yaml $(tag) == 'release_1_0' && $(nodejs)
  package-version: 1.0
```

### Tag: release_3_0 and go

These settings apply only when `--tag=release_3_0 --nodejs` is specified on the command line.

``` yaml $(tag) == 'release_3_0' && $(nodejs)
  package-version: 3.0.0
```

## Multi-API/Profile support for AutoRest v3 generators

AutoRest V3 generators require the use of `--tag=all-api-versions` to select api files.

This block is updated by an automatic script. Edits may be lost!

``` yaml $(tag) == 'all-api-versions' /* autogenerated */
# include the azure profile definitions from the standard location
require: $(this-folder)/../../../../profiles/readme.md

# all the input files across all versions
input-file:
  - $(this-folder)/preview/v1.0-preview.1/TranslatorBatch.json
  - $(this-folder)/stable/v3.0/TranslatorText.json

```

If there are files that should not be in the `all-api-versions` set,
uncomment the  `exclude-file` section below and add the file paths.

``` yaml $(tag) == 'all-api-versions'
#exclude-file:
#  - $(this-folder)/Microsoft.Example/stable/2010-01-01/somefile.json
```


text:
import * as world from './xsolve_wtf';
import {By} from 'selenium-webdriver';
const config = world.getConfig();
let driver;

export default class Validator {
    constructor(d) {
        this.driver = d;
        driver = d;
    }

    validateExtendedPageState(customTimeout = config.defaultTimeout) {
        return driver.wait(function() {
            return world.checkExtendedPageState()
                .then(function(value) {
                    if(value) {
                        return true;
                    }

                    return world.sleep(config.pollingRate)
                        .then(() => false);
                });
            },
            customTimeout
        );
    }

    getDocumentReadyState() {//internal only
        return driver.executeScript(
            'return document.readyState === \'complete\'',
            ''
        ).then((result) => result);
    }

    validatePageReadyState(customTimeout = config.defaultTimeout) {
        return driver.wait(function() {
            return world.getDocumentReadyState()
                .then(function(value) {
                    if(value) {
                        return true;
                    }

                    return world.sleep(config.pollingRate)
                        .then(() => false);
                });
            },
            customTimeout
        ).then(function() {
            return world.validateExtendedPageState(customTimeout);
        });
    }

    validateUrl(url, customTimeout = config.defaultTimeout) {
        return driver.wait(function() {
                return driver.getCurrentUrl().then(function(currentUrl) {
                    world.logMessage(`validateUrl currentUrl ${ currentUrl }, expectedUrl ${ url }`, true);
                    if(currentUrl.indexOf(url) !== -1) {
                        return true;
                    }

                    return world.sleep(config.pollingRate).then(function() {
                        return false;
                    });
                });
            },
            customTimeout
        );
    }

    validateUrlByRegex(regex, customTimeout = config.defaultTimeout) {
        return driver.wait(function() {
                return driver.getCurrentUrl().then(function(currentUrl) {
                    let r = new RegExp(regex);
                    if(r.test(currentUrl)) {
                        return true;
                    }

                    return world.sleep(config.pollingRate).then(() => false);
                });
            },
            customTimeout
        );
    }

    validateElementText(xpath, text, customTimeout = config.defaultTimeout) {
        return driver.wait(
            function () {
                return world.getElementText(xpath, customTimeout).then(function(currentText) {
                    return currentText === text;
                });
            },
            customTimeout
        ).catch(function(err){
            throw(`validateElementText failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
        });
    }

    validateCheckboxValue(xpath, value, customTimeout = config.defaultTimeout) {
        return driver.wait(
            function () {
                return world.getCheckboxValue(xpath, customTimeout)
                    .then((currentValue) => currentValue === value);
            },
            customTimeout
        ).catch(function(err){
            throw(`validateCheckboxValue failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
        });
    }

    validateElementVisible(xpath, customTimeout = config.defaultTimeout) {//element visible in sources and may be displayed or not
        return driver.wait(
            function () {
                return world.findElements(xpath).then(function(elem) {
                    if(elem.length !== 0) {
                        return true;
                    }

                    return world.sleep(config.pollingRate)
                        .then(() => false);
                });
            },
            customTimeout
        ).catch(function(err){
            throw(`validateElementVisible failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
        });
    }

    validateElementNotVisible(xpath, customTimeout = config.defaultTimeout) {//not visible in sources and not displayed
        return world.validatePageReadyState().then(function() {
            return driver.wait(
                function () {
                    return driver.findElements(By.xpath(xpath)).then(function(elem) {
                        if(elem.length === 0) {
                            return true;
                        }

                        return world.sleep(config.pollingRate)
                            .then(() => false);
                    });
                },
                customTimeout
            ).catch(function(err){
                    throw(`validateElementNotVisible failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
            });
        });
    }

    validateElementDisplayed(xpath, customTimeout = config.defaultTimeout) {//visible in sources AND displayed
        return driver.wait(
            function () {
                return world.findElements(xpath, customTimeout).then(function(elem) {
                    if(elem[0].isDisplayed()) {
                        return true;
                    }

                    return world.sleep(config.pollingRate)
                        .then(() => false);
                });
            },
            customTimeout
        ).catch(function(err){
            throw(`validateElementDisplayed failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
        });
    }

    validateElementNotDisplayed(xpath, customTimeout = config.defaultTimeout) {//element visible in sources and not displayed
        return driver.wait(
            function () {
                return world.findElements(xpath, customTimeout).then(function(elem) {
                    if(!elem[0].isDisplayed()) {
                        return true;
                    }

                    return world.sleep(config.pollingRate)
                        .then(() => false);
                });
            },
            customTimeout
        ).catch(function(err){
            throw(`validateElementNotDisplayed failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
        });
    }

    validateElementsNumber(xpath, number, customTimeout = config.defaultTimeout) {
        if(number === 0) {
            return world.validatePageReadyState()
                .then(() => world.validateElementNotVisible(xpath, customTimeout));
        } else {
            return driver.wait(
                function () {
                    return world.findElements(xpath, customTimeout).then(function(elem) {
                        if(elem.length === number) {
                            return true;
                        }

                        return world.sleep(config.pollingRate)
                            .then(() => false);
                    });
                },
                customTimeout
            ).catch(function(err){
                throw(`validateElementsNumber failed on element: "${ xpath }" - error message: "${ err.message }", error stack: "${ err.stack }`);
            });
        }
    }

    checkAngularPresence() {
        let script = 'return (window.angular !== undefined)';

        return driver.executeScript(script, '')
            .then((result) => result);
    }

    checkExtendedPageState() {
        if(!config.extendedPageReadyStateValidation) {
            return world.boolPromiseResult(true);
        }

        return world.checkAngularPresence().then(function(present) {
            if(present) {
                //angular-based page - validation
                let script = 'return (angular.element(document.body).injector() !== undefined) && ' +
                '(angular.element(document.body).injector().get(\'$http\').pendingRequests.length === 0)';

                return driver.executeScript(script, '')
                    .then((result) => result);
            }

            return true;//currently only Angular
        });
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="HelloLinker.HelloLinker" android:versionCode="1" android:versionName="1.0">
	<uses-sdk android:minSdkVersion="16" />
	<application android:label="HelloLinker"></application>
</manifest>


text:
<?php
class HomePage extends Page {

  private static $db = array(
  );

  private static $has_one = array(
  );

  private static $has_many = array(
  );

  function getCMSFields() {
    $fields = parent::getCMSFields();

    return $fields;
  }

}

class HomePage_Controller extends Page_Controller {

  public function init(){
    parent::init();

  }

  private static $allowed_actions = array (
  );

}


text:
package notify

import "github.com/humpback/gounits/logger"
import "gopkg.in/gomail.v1"

// SMTPEndPoint is exported
type SMTPEndPoint struct {
	IEndPoint
	EndPoint
	mailer *gomail.Mailer
}

// NewSMTPEndpoint is exported
func NewSMTPEndpoint(endpoint EndPoint) IEndPoint {

	mailer := gomail.NewMailer(endpoint.Host, endpoint.User, endpoint.Password, endpoint.Port)
	return &SMTPEndPoint{
		EndPoint: endpoint,
		mailer:   mailer,
	}
}

// DoEvent is exported
func (endpoint *SMTPEndPoint) DoEvent(event *Event, data interface{}) {

	if !endpoint.Enabled {
		return
	}

	msg := gomail.NewMessage()
	msg.SetHeader("From", endpoint.Sender)
	msg.SetHeader("To", event.ContactInfo)
	msg.SetHeader("Subject", event.makeSubjectText())
	msg.SetBody("text/html", data.(string))
	if err := endpoint.mailer.Send(msg); err != nil {
		logger.ERROR("[#notify#] smtp endpoint post error: %s", err.Error())
	}
}


text:
package com.hazelcast.simulator.utils;

import com.google.common.base.Charsets;
import com.google.common.io.Files;
import com.google.common.io.Resources;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.apache.commons.lang3.text.StrSubstitutor;
import org.apache.log4j.Logger;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;

import static com.hazelcast.simulator.utils.CommonUtils.closeQuietly;
import static com.hazelcast.simulator.utils.EmptyStatement.ignore;
import static com.hazelcast.simulator.utils.Preconditions.checkNotNull;
import static java.lang.String.format;
import static java.util.Collections.emptyList;

@SuppressFBWarnings("DM_DEFAULT_ENCODING")
@SuppressWarnings("checkstyle:methodcount")
public final class FileUtils {

    public static final String USER_HOME = System.getProperty("user.home");

    private static final int READ_BUFFER_SIZE = 8192;
    private static final int COPY_BUFFER_SIZE = 1024;

    private static final Logger LOGGER = Logger.getLogger(FileUtils.class);
    private static final Pattern VALID_FILE_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9-_]+$");

    private FileUtils() {
    }

    public static boolean isValidFileName(String fileName) {
        return VALID_FILE_NAME_PATTERN.matcher(fileName).matches();
    }

    public static File newFile(String path) {
        path = path.trim();
        if (path.equals("~")) {
            path = USER_HOME;
        } else if (path.startsWith("~" + File.separator)) {
            path = USER_HOME + path.substring(1);
        }
        path = new StrSubstitutor().replace(path);

        return new File(path);
    }

    public static File newFile(File file, String... items) {
        for (String item : items) {
            file = new File(file, item);
        }
        return file;
    }

    public static File newFile(String... items) {
        File file = newFile(items[0]);
        for (int i = 1; i < items.length; i++) {
            file = new File(file, items[i]);
        }
        return file;
    }

    public static void writeText(String text, File file) {
        checkNotNull(text, "Text can't be null");
        checkNotNull(file, "File can't be null");

        FileOutputStream stream = null;
        OutputStreamWriter streamWriter = null;
        BufferedWriter writer = null;
        try {
            stream = new FileOutputStream(file);
            streamWriter = new OutputStreamWriter(stream);
            writer = new BufferedWriter(streamWriter);
            writer.write(text);
            writer.close();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            closeQuietly(writer);
            closeQuietly(streamWriter);
            closeQuietly(stream);
        }
    }

    public static File appendText(String text, String fileName) {
        File file = new File(fileName);
        appendText(text, file);

        return file;
    }

    public static void appendText(String text, File file) {
        checkNotNull(text, "Text can't be null");
        checkNotNull(file, "File can't be null");

        FileOutputStream stream = null;
        OutputStreamWriter streamWriter = null;
        BufferedWriter writer = null;
        try {
            stream = new FileOutputStream(file, true);
            streamWriter = new OutputStreamWriter(stream);
            writer = new BufferedWriter(streamWriter);
            writer.append(text);
            writer.close();
        } catch (IOException e) {
            throw new UncheckedIOException("Could not append text", e);
        } finally {
            closeQuietly(writer);
            closeQuietly(streamWriter);
            closeQuietly(stream);
        }
    }

    public static String getResourceFile(String fileName) {
        try {
            URL url = Resources.getResource(fileName);
            return Resources.toString(url, Charsets.UTF_8);
        } catch (Exception e) {
            throw new UncheckedIOException(e);
        }
    }

    public static String fileAsText(String fileName) {
        return fileAsText(new File(fileName));
    }

    public static String fileAsText(File file) {
        FileInputStream stream = null;
        InputStreamReader streamReader = null;
        BufferedReader reader = null;
        try {
            stream = new FileInputStream(file);
            streamReader = new InputStreamReader(stream);
            reader = new BufferedReader(streamReader);

            StringBuilder builder = new StringBuilder();
            char[] buffer = new char[READ_BUFFER_SIZE];
            int read;
            while ((read = reader.read(buffer, 0, buffer.length)) > 0) {
                builder.append(buffer, 0, read);
            }
            return builder.toString();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            closeQuietly(reader);
            closeQuietly(streamReader);
            closeQuietly(stream);
        }
    }

    public static void deleteQuiet(String fileName) {
        deleteQuiet(new File(fileName));
    }

    public static void deleteQuiet(File file) {
        if (file == null) {
            return;
        }
        try {
            delete(file);
        } catch (Exception ignored) {
            ignore(ignored);
        }
    }

    public static void delete(File file) {
        if (!file.exists()) {
            return;
        }

        if (file.isDirectory()) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File fileInDirectory : files) {
                    delete(fileInDirectory);
                }
            }
        }

        if (!file.delete()) {
            throw new UncheckedIOException("Failed to delete file: " + file);
        }
    }

    public static File ensureExistingFile(String fileName) {
        File file = new File(fileName);
        ensureExistingFile(file);
        return file;
    }

    public static File ensureExistingFile(File parent, String fileName) {
        File file = new File(parent, fileName);
        ensureExistingFile(file);
        return file;
    }

    public static void ensureExistingFile(File file) {
        if (file.isFile()) {
            return;
        }

        if (file.isDirectory()) {
            throw new IllegalArgumentException(format("File [%s] is a directory", file.getAbsolutePath()));
        }

        if (!file.exists()) {
            try {
                if (!file.createNewFile()) {
                    throw new UncheckedIOException("Could not create file: " + file.getAbsolutePath());
                }
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }
    }

    public static File ensureExistingDirectory(String dirName) {
        File dir = new File(dirName);
        ensureExistingDirectory(dir);
        return dir;
    }

    public static File ensureExistingDirectory(File parent, String dirName) {
        File dir = new File(parent, dirName);
        ensureExistingDirectory(dir);
        return dir;
    }

    public static File ensureExistingDirectory(File dir) {
        if (dir.isDirectory()) {
            return dir;
        }

        if (dir.isFile()) {
            throw new IllegalArgumentException(format("File [%s] is not a directory", dir.getAbsolutePath()));
        }

        // we don't care about the result because multiple threads are allowed to call this method concurrently
        // and therefore mkdirs() can return false if the directory has been created by another thread
        //noinspection ResultOfMethodCallIgnored
        dir.mkdirs();

        // we just need to make sure the directory is created
        if (!dir.exists()) {
            throw new UncheckedIOException("Could not create directory: " + dir.getAbsolutePath());
        }

        return dir;
    }

    public static File ensureNewDirectory(File dir) {
        if (dir.exists()) {
            throw new UncheckedIOException(format("Directory [%s] already exists", dir.getAbsoluteFile()));
        }
        if (!dir.mkdirs()) {
            throw new UncheckedIOException("Could not create directory [%s]" + dir.getAbsolutePath());
        }
        return dir;
    }

    public static void rename(File source, File target) {
        if (!source.exists()) {
            return;
        }
        if (!source.renameTo(target)) {
            throw new UncheckedIOException(format("Could not rename [%s] to [%s]",
                    source.getAbsolutePath(), target.getAbsolutePath()));
        }
    }

    public static void copy(File file, OutputStream outputStream) {
        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream(file);

            byte[] buffer = new byte[COPY_BUFFER_SIZE];
            while (true) {
                int readCount = inputStream.read(buffer);
                if (readCount < 0) {
                    break;
                }
                outputStream.write(buffer, 0, readCount);
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            closeQuietly(inputStream);
        }
    }

    public static void copy(File from, File to) {
        FileOutputStream out;
        try {
            out = new FileOutputStream(to);
        } catch (FileNotFoundException e) {
            throw new UncheckedIOException(e);
        }
        try {
            copy(from, out);
        } finally {
            closeQuietly(out);
        }

    }

    public static File getUserDir() {
        String userDirTest = System.getProperty("user.dir.test");
        if (userDirTest != null) {
            return new File(userDirTest);
        }
        return new File(System.getProperty("user.dir"));
    }

    public static String getUserHomePath() {
        String userDirTest = System.getProperty("user.dir.test");
        if (userDirTest != null) {
            return new File(userDirTest).getAbsolutePath();
        }
        return System.getProperty("user.home");
    }

    public static File getSimulatorHome() {
        String home = System.getProperty("SIMULATOR_HOME");
        if (home != null) {
            return new File(home);
        }

        home = System.getenv("SIMULATOR_HOME");
        return home != null ? new File(home) : getUserDir();
    }

    /**
     * Gets a {@link File} from a defined {@link OptionSpec}.
     *
     * @param spec    The {@link OptionSpec} which contains the filename.
     * @param options The {@link OptionSet} which contains the actual options.
     * @param desc    The description of the file.
     * @return the {@link File} from the defined {@link OptionSpec}
     * @throws CommandLineExitException if the file cannot be found.
     */
    public static File getFileOrExit(OptionSpec<String> spec, OptionSet options, String desc) {
        File file = newFile(options.valueOf(spec));
        if (!file.exists()) {
            throw new CommandLineExitException(format("%s [%s] does not exist", desc, file));
        }
        return file;
    }

    public static String getFileAsTextFromWorkingDirOrBaseDir(File baseDir, String fileName, String desc) {
        File file = newFile(fileName);
        if (!file.exists()) {
            file = newFile(baseDir + File.separator + "conf" + File.separator + fileName);
        }
        if (!file.exists()) {
            throw new UncheckedIOException(format("%s [%s] does not exist", desc, file.getAbsolutePath()));
        }
        LOGGER.info("Loading " + desc + ": " + file.getAbsolutePath());

        return fileAsText(file);
    }

    public static List<File> getFilesFromClassPath(String classpath) {
        if (classpath == null) {
            return emptyList();
        }

        List<File> files = new LinkedList<File>();
        for (String filePath : classpath.split(";")) {
            File file = new File(filePath);

            if (file.getName().contains("*")) {
                File parent = file.getParentFile();
                if (parent == null || !parent.isDirectory()) {
                    throw new UncheckedIOException(format("Could not find matching files for wildcard classpath [%s]", filePath));
                }

                String regex = file.getName().replace("*", "(.*)");
                File[] parentFiles = parent.listFiles();
                if (parentFiles != null) {
                    for (File child : parentFiles) {
                        if (child.getName().matches(regex)) {
                            files.add(child);
                        }
                    }
                }
            } else if (file.exists()) {
                files.add(file);
            } else {
                throw new UncheckedIOException(format("Cannot convert classpath to java.io.File. [%s] doesn't exist", filePath));
            }
        }

        return files;
    }

    /**
     * Copies a directory recursively.
     *
     * @param source the source directory
     * @param target the target directory
     */
    public static void copyDirectory(File source, File target) {
        for (File srcFile : source.listFiles()) {
            if (srcFile.isDirectory()) {
                File targetChild = new File(target, srcFile.getName());
                ensureExistingDirectory(targetChild);
                copyDirectory(srcFile, targetChild);
            } else {
                copyFileToDirectory(srcFile, target);
            }
        }
    }

    public static void copyFilesToDirectory(File[] sourceFiles, File targetDirectory) {
        for (File sourceFile : sourceFiles) {
            copyFileToDirectory(sourceFile, targetDirectory);
        }
    }

    public static void copyFileToDirectory(File sourceFile, File targetDirectory) {
        File targetFile = newFile(targetDirectory, sourceFile.getName());
        try {
            Files.copy(sourceFile, targetFile);
            if (sourceFile.canExecute()) {
                targetFile.setExecutable(true);
            }
        } catch (IOException e) {
            throw new UncheckedIOException(format("Error while copying file from %s to %s", sourceFile.getAbsolutePath(),
                    targetFile.getAbsolutePath()), e);
        }
    }

    public static File getConfigurationFile(String filename) {
        File file = new File(getUserDir(), filename).getAbsoluteFile();
        if (file.exists()) {
            return file;
        } else {
            return newFile(getSimulatorHome(), "conf", filename).getAbsoluteFile();
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<litepal>

    <dbname value="anxin_weather" />

    <version value="1" />

    <list>
        <mapping class="com.anxinweather.android.db.Province" />
        <mapping class="com.anxinweather.android.db.City" />
        <mapping class="com.anxinweather.android.db.County" />
    </list>

</litepal>


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#include <sstream>
#include <limits>

#include "ifcpp/model/AttributeObject.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/model/BuildingGuid.h"
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/IFC4X3/include/IfcActorRole.h"
#include "ifcpp/IFC4X3/include/IfcAppliedValue.h"
#include "ifcpp/IFC4X3/include/IfcApproval.h"
#include "ifcpp/IFC4X3/include/IfcConstraint.h"
#include "ifcpp/IFC4X3/include/IfcContextDependentUnit.h"
#include "ifcpp/IFC4X3/include/IfcConversionBasedUnit.h"
#include "ifcpp/IFC4X3/include/IfcExternalReference.h"
#include "ifcpp/IFC4X3/include/IfcExternalReferenceRelationship.h"
#include "ifcpp/IFC4X3/include/IfcLabel.h"
#include "ifcpp/IFC4X3/include/IfcMaterialDefinition.h"
#include "ifcpp/IFC4X3/include/IfcPhysicalQuantity.h"
#include "ifcpp/IFC4X3/include/IfcProfileDef.h"
#include "ifcpp/IFC4X3/include/IfcPropertyAbstraction.h"
#include "ifcpp/IFC4X3/include/IfcResourceObjectSelect.h"
#include "ifcpp/IFC4X3/include/IfcShapeAspect.h"
#include "ifcpp/IFC4X3/include/IfcText.h"
#include "ifcpp/IFC4X3/include/IfcTimeSeries.h"

// ENTITY IfcExternalReferenceRelationship
IFC4X3::IfcExternalReferenceRelationship::IfcExternalReferenceRelationship( int tag ) { m_tag = tag; }
shared_ptr<BuildingObject> IFC4X3::IfcExternalReferenceRelationship::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcExternalReferenceRelationship> copy_self( new IfcExternalReferenceRelationship() );
	if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); }
	if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); }
	if( m_RelatingReference ) { copy_self->m_RelatingReference = dynamic_pointer_cast<IfcExternalReference>( m_RelatingReference->getDeepCopy(options) ); }
	for( size_t ii=0; ii<m_RelatedResourceObjects.size(); ++ii )
	{
		auto item_ii = m_RelatedResourceObjects[ii];
		if( item_ii )
		{
			copy_self->m_RelatedResourceObjects.emplace_back( dynamic_pointer_cast<IfcResourceObjectSelect>(item_ii->getDeepCopy(options) ) );
		}
	}
	return copy_self;
}
void IFC4X3::IfcExternalReferenceRelationship::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_tag << "= IFCEXTERNALREFERENCERELATIONSHIP" << "(";
	if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_RelatingReference ) { stream << "#" << m_RelatingReference->m_tag; } else { stream << "$"; }
	stream << ",";
	stream << "(";
	for( size_t ii = 0; ii < m_RelatedResourceObjects.size(); ++ii )
	{
		if( ii > 0 )
		{
			stream << ",";
		}
		const shared_ptr<IfcResourceObjectSelect>& type_object = m_RelatedResourceObjects[ii];
		if( type_object )
		{
			type_object->getStepParameter( stream, true );
		}
		else
		{
			stream << "$";
		}
	}
	stream << ")";
	stream << ");";
}
void IFC4X3::IfcExternalReferenceRelationship::getStepParameter( std::stringstream& stream, bool /*is_select_type*/ ) const { stream << "#" << m_tag; }
void IFC4X3::IfcExternalReferenceRelationship::readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<BuildingEntity> >& map, std::stringstream& errorStream )
{
	const size_t num_args = args.size();
	if( num_args != 4 ){ std::stringstream err; err << "Wrong parameter count for entity IfcExternalReferenceRelationship, expecting 4, having " << num_args << ". Entity ID: " << m_tag << std::endl; throw BuildingException( err.str().c_str() ); }
	m_Name = IfcLabel::createObjectFromSTEP( args[0], map, errorStream );
	m_Description = IfcText::createObjectFromSTEP( args[1], map, errorStream );
	readEntityReference( args[2], m_RelatingReference, map, errorStream );
	readSelectList( args[3], m_RelatedResourceObjects, map, errorStream );
}
void IFC4X3::IfcExternalReferenceRelationship::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IFC4X3::IfcResourceLevelRelationship::getAttributes( vec_attributes );
	vec_attributes.emplace_back( std::make_pair( "RelatingReference", m_RelatingReference ) );
	if( !m_RelatedResourceObjects.empty() )
	{
		shared_ptr<AttributeObjectVector> RelatedResourceObjects_vec_object( new AttributeObjectVector() );
		std::copy( m_RelatedResourceObjects.begin(), m_RelatedResourceObjects.end(), std::back_inserter( RelatedResourceObjects_vec_object->m_vec ) );
		vec_attributes.emplace_back( std::make_pair( "RelatedResourceObjects", RelatedResourceObjects_vec_object ) );
	}
}
void IFC4X3::IfcExternalReferenceRelationship::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IFC4X3::IfcResourceLevelRelationship::getAttributesInverse( vec_attributes_inverse );
}
void IFC4X3::IfcExternalReferenceRelationship::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcResourceLevelRelationship::setInverseCounterparts( ptr_self_entity );
	shared_ptr<IfcExternalReferenceRelationship> ptr_self = dynamic_pointer_cast<IfcExternalReferenceRelationship>( ptr_self_entity );
	if( !ptr_self ) { throw BuildingException( "IfcExternalReferenceRelationship::setInverseCounterparts: type mismatch" ); }
	for( size_t i=0; i<m_RelatedResourceObjects.size(); ++i )
	{
		shared_ptr<IfcActorRole>  RelatedResourceObjects_IfcActorRole = dynamic_pointer_cast<IfcActorRole>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcActorRole )
		{
			RelatedResourceObjects_IfcActorRole->m_HasExternalReference_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcAppliedValue>  RelatedResourceObjects_IfcAppliedValue = dynamic_pointer_cast<IfcAppliedValue>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcAppliedValue )
		{
			RelatedResourceObjects_IfcAppliedValue->m_HasExternalReference_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcApproval>  RelatedResourceObjects_IfcApproval = dynamic_pointer_cast<IfcApproval>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcApproval )
		{
			RelatedResourceObjects_IfcApproval->m_HasExternalReferences_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcConstraint>  RelatedResourceObjects_IfcConstraint = dynamic_pointer_cast<IfcConstraint>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcConstraint )
		{
			RelatedResourceObjects_IfcConstraint->m_HasExternalReferences_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcContextDependentUnit>  RelatedResourceObjects_IfcContextDependentUnit = dynamic_pointer_cast<IfcContextDependentUnit>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcContextDependentUnit )
		{
			RelatedResourceObjects_IfcContextDependentUnit->m_HasExternalReference_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcConversionBasedUnit>  RelatedResourceObjects_IfcConversionBasedUnit = dynamic_pointer_cast<IfcConversionBasedUnit>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcConversionBasedUnit )
		{
			RelatedResourceObjects_IfcConversionBasedUnit->m_HasExternalReference_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcMaterialDefinition>  RelatedResourceObjects_IfcMaterialDefinition = dynamic_pointer_cast<IfcMaterialDefinition>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcMaterialDefinition )
		{
			RelatedResourceObjects_IfcMaterialDefinition->m_HasExternalReferences_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcPhysicalQuantity>  RelatedResourceObjects_IfcPhysicalQuantity = dynamic_pointer_cast<IfcPhysicalQuantity>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcPhysicalQuantity )
		{
			RelatedResourceObjects_IfcPhysicalQuantity->m_HasExternalReferences_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcProfileDef>  RelatedResourceObjects_IfcProfileDef = dynamic_pointer_cast<IfcProfileDef>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcProfileDef )
		{
			RelatedResourceObjects_IfcProfileDef->m_HasExternalReference_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcPropertyAbstraction>  RelatedResourceObjects_IfcPropertyAbstraction = dynamic_pointer_cast<IfcPropertyAbstraction>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcPropertyAbstraction )
		{
			RelatedResourceObjects_IfcPropertyAbstraction->m_HasExternalReferences_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcShapeAspect>  RelatedResourceObjects_IfcShapeAspect = dynamic_pointer_cast<IfcShapeAspect>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcShapeAspect )
		{
			RelatedResourceObjects_IfcShapeAspect->m_HasExternalReferences_inverse.emplace_back( ptr_self );
		}
		shared_ptr<IfcTimeSeries>  RelatedResourceObjects_IfcTimeSeries = dynamic_pointer_cast<IfcTimeSeries>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcTimeSeries )
		{
			RelatedResourceObjects_IfcTimeSeries->m_HasExternalReference_inverse.emplace_back( ptr_self );
		}
	}
	if( m_RelatingReference )
	{
		m_RelatingReference->m_ExternalReferenceForResources_inverse.emplace_back( ptr_self );
	}
}
void IFC4X3::IfcExternalReferenceRelationship::unlinkFromInverseCounterparts()
{
	IfcResourceLevelRelationship::unlinkFromInverseCounterparts();
	for( size_t i=0; i<m_RelatedResourceObjects.size(); ++i )
	{
		shared_ptr<IfcActorRole>  RelatedResourceObjects_IfcActorRole = dynamic_pointer_cast<IfcActorRole>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcActorRole )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReference_inverse = RelatedResourceObjects_IfcActorRole->m_HasExternalReference_inverse;
			for( auto it_HasExternalReference_inverse = HasExternalReference_inverse.begin(); it_HasExternalReference_inverse != HasExternalReference_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReference_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReference_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReference_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReference_inverse= HasExternalReference_inverse.erase( it_HasExternalReference_inverse );
				}
				else
				{
					++it_HasExternalReference_inverse;
				}
			}
		}
		shared_ptr<IfcAppliedValue>  RelatedResourceObjects_IfcAppliedValue = dynamic_pointer_cast<IfcAppliedValue>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcAppliedValue )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReference_inverse = RelatedResourceObjects_IfcAppliedValue->m_HasExternalReference_inverse;
			for( auto it_HasExternalReference_inverse = HasExternalReference_inverse.begin(); it_HasExternalReference_inverse != HasExternalReference_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReference_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReference_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReference_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReference_inverse= HasExternalReference_inverse.erase( it_HasExternalReference_inverse );
				}
				else
				{
					++it_HasExternalReference_inverse;
				}
			}
		}
		shared_ptr<IfcApproval>  RelatedResourceObjects_IfcApproval = dynamic_pointer_cast<IfcApproval>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcApproval )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReferences_inverse = RelatedResourceObjects_IfcApproval->m_HasExternalReferences_inverse;
			for( auto it_HasExternalReferences_inverse = HasExternalReferences_inverse.begin(); it_HasExternalReferences_inverse != HasExternalReferences_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReferences_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReferences_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReferences_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReferences_inverse= HasExternalReferences_inverse.erase( it_HasExternalReferences_inverse );
				}
				else
				{
					++it_HasExternalReferences_inverse;
				}
			}
		}
		shared_ptr<IfcConstraint>  RelatedResourceObjects_IfcConstraint = dynamic_pointer_cast<IfcConstraint>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcConstraint )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReferences_inverse = RelatedResourceObjects_IfcConstraint->m_HasExternalReferences_inverse;
			for( auto it_HasExternalReferences_inverse = HasExternalReferences_inverse.begin(); it_HasExternalReferences_inverse != HasExternalReferences_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReferences_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReferences_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReferences_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReferences_inverse= HasExternalReferences_inverse.erase( it_HasExternalReferences_inverse );
				}
				else
				{
					++it_HasExternalReferences_inverse;
				}
			}
		}
		shared_ptr<IfcContextDependentUnit>  RelatedResourceObjects_IfcContextDependentUnit = dynamic_pointer_cast<IfcContextDependentUnit>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcContextDependentUnit )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReference_inverse = RelatedResourceObjects_IfcContextDependentUnit->m_HasExternalReference_inverse;
			for( auto it_HasExternalReference_inverse = HasExternalReference_inverse.begin(); it_HasExternalReference_inverse != HasExternalReference_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReference_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReference_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReference_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReference_inverse= HasExternalReference_inverse.erase( it_HasExternalReference_inverse );
				}
				else
				{
					++it_HasExternalReference_inverse;
				}
			}
		}
		shared_ptr<IfcConversionBasedUnit>  RelatedResourceObjects_IfcConversionBasedUnit = dynamic_pointer_cast<IfcConversionBasedUnit>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcConversionBasedUnit )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReference_inverse = RelatedResourceObjects_IfcConversionBasedUnit->m_HasExternalReference_inverse;
			for( auto it_HasExternalReference_inverse = HasExternalReference_inverse.begin(); it_HasExternalReference_inverse != HasExternalReference_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReference_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReference_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReference_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReference_inverse= HasExternalReference_inverse.erase( it_HasExternalReference_inverse );
				}
				else
				{
					++it_HasExternalReference_inverse;
				}
			}
		}
		shared_ptr<IfcMaterialDefinition>  RelatedResourceObjects_IfcMaterialDefinition = dynamic_pointer_cast<IfcMaterialDefinition>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcMaterialDefinition )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReferences_inverse = RelatedResourceObjects_IfcMaterialDefinition->m_HasExternalReferences_inverse;
			for( auto it_HasExternalReferences_inverse = HasExternalReferences_inverse.begin(); it_HasExternalReferences_inverse != HasExternalReferences_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReferences_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReferences_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReferences_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReferences_inverse= HasExternalReferences_inverse.erase( it_HasExternalReferences_inverse );
				}
				else
				{
					++it_HasExternalReferences_inverse;
				}
			}
		}
		shared_ptr<IfcPhysicalQuantity>  RelatedResourceObjects_IfcPhysicalQuantity = dynamic_pointer_cast<IfcPhysicalQuantity>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcPhysicalQuantity )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReferences_inverse = RelatedResourceObjects_IfcPhysicalQuantity->m_HasExternalReferences_inverse;
			for( auto it_HasExternalReferences_inverse = HasExternalReferences_inverse.begin(); it_HasExternalReferences_inverse != HasExternalReferences_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReferences_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReferences_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReferences_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReferences_inverse= HasExternalReferences_inverse.erase( it_HasExternalReferences_inverse );
				}
				else
				{
					++it_HasExternalReferences_inverse;
				}
			}
		}
		shared_ptr<IfcProfileDef>  RelatedResourceObjects_IfcProfileDef = dynamic_pointer_cast<IfcProfileDef>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcProfileDef )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReference_inverse = RelatedResourceObjects_IfcProfileDef->m_HasExternalReference_inverse;
			for( auto it_HasExternalReference_inverse = HasExternalReference_inverse.begin(); it_HasExternalReference_inverse != HasExternalReference_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReference_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReference_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReference_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReference_inverse= HasExternalReference_inverse.erase( it_HasExternalReference_inverse );
				}
				else
				{
					++it_HasExternalReference_inverse;
				}
			}
		}
		shared_ptr<IfcPropertyAbstraction>  RelatedResourceObjects_IfcPropertyAbstraction = dynamic_pointer_cast<IfcPropertyAbstraction>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcPropertyAbstraction )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReferences_inverse = RelatedResourceObjects_IfcPropertyAbstraction->m_HasExternalReferences_inverse;
			for( auto it_HasExternalReferences_inverse = HasExternalReferences_inverse.begin(); it_HasExternalReferences_inverse != HasExternalReferences_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReferences_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReferences_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReferences_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReferences_inverse= HasExternalReferences_inverse.erase( it_HasExternalReferences_inverse );
				}
				else
				{
					++it_HasExternalReferences_inverse;
				}
			}
		}
		shared_ptr<IfcShapeAspect>  RelatedResourceObjects_IfcShapeAspect = dynamic_pointer_cast<IfcShapeAspect>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcShapeAspect )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReferences_inverse = RelatedResourceObjects_IfcShapeAspect->m_HasExternalReferences_inverse;
			for( auto it_HasExternalReferences_inverse = HasExternalReferences_inverse.begin(); it_HasExternalReferences_inverse != HasExternalReferences_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReferences_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReferences_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReferences_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReferences_inverse= HasExternalReferences_inverse.erase( it_HasExternalReferences_inverse );
				}
				else
				{
					++it_HasExternalReferences_inverse;
				}
			}
		}
		shared_ptr<IfcTimeSeries>  RelatedResourceObjects_IfcTimeSeries = dynamic_pointer_cast<IfcTimeSeries>( m_RelatedResourceObjects[i] );
		if( RelatedResourceObjects_IfcTimeSeries )
		{
			std::vector<weak_ptr<IfcExternalReferenceRelationship> >& HasExternalReference_inverse = RelatedResourceObjects_IfcTimeSeries->m_HasExternalReference_inverse;
			for( auto it_HasExternalReference_inverse = HasExternalReference_inverse.begin(); it_HasExternalReference_inverse != HasExternalReference_inverse.end(); )
			{
				weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_HasExternalReference_inverse;
				if( self_candidate_weak.expired() )
				{
					++it_HasExternalReference_inverse;
					continue;
				}
				shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_HasExternalReference_inverse );
				if( self_candidate.get() == this )
				{
					it_HasExternalReference_inverse= HasExternalReference_inverse.erase( it_HasExternalReference_inverse );
				}
				else
				{
					++it_HasExternalReference_inverse;
				}
			}
		}
	}
	if( m_RelatingReference )
	{
		std::vector<weak_ptr<IfcExternalReferenceRelationship> >& ExternalReferenceForResources_inverse = m_RelatingReference->m_ExternalReferenceForResources_inverse;
		for( auto it_ExternalReferenceForResources_inverse = ExternalReferenceForResources_inverse.begin(); it_ExternalReferenceForResources_inverse != ExternalReferenceForResources_inverse.end(); )
		{
			weak_ptr<IfcExternalReferenceRelationship> self_candidate_weak = *it_ExternalReferenceForResources_inverse;
			if( self_candidate_weak.expired() )
			{
				++it_ExternalReferenceForResources_inverse;
				continue;
			}
			shared_ptr<IfcExternalReferenceRelationship> self_candidate( *it_ExternalReferenceForResources_inverse );
			if( self_candidate.get() == this )
			{
				it_ExternalReferenceForResources_inverse= ExternalReferenceForResources_inverse.erase( it_ExternalReferenceForResources_inverse );
			}
			else
			{
				++it_ExternalReferenceForResources_inverse;
			}
		}
	}
}


text:
package xep

import (
	"encoding/xml"
)

type RegisterQuery struct {
	XMLName xml.Name `xml:"jabber:iq:register query"`
}

func (_ RegisterQuery) Name() string {
	return "query"
}

func (_ RegisterQuery) FullName() string {
	return "jabber:iq:register query"
}


text:
package com.orientechnologies.orient.core.storage.impl.local.paginated;

import java.io.IOException;

import org.testng.Assert;
import org.testng.annotations.Test;

import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.ODatabase.OPERATION_MODE;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.id.ORecordId;
import com.orientechnologies.orient.core.storage.OPhysicalPosition;
import com.orientechnologies.orient.core.storage.OStorage;
import com.orientechnologies.orient.core.storage.OStorageOperationResult;
import com.orientechnologies.orient.core.version.OSimpleVersion;

public class ClusterDebugInfoTest {

  @Test
  public void testOnePageRecordDebugInfo() throws IOException {
    ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:ClusterDebugInfoTest");
    db.create();
    try {
      OStorage storage = db.getStorage();
      int defaultId = storage.getDefaultClusterId();
      OPaginatedCluster cluster = (OPaginatedCluster) storage.getClusterById(defaultId);
      int size = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger();
      int half = size / 2;
      byte[] content = new byte[half * 1024];
      OStorageOperationResult<OPhysicalPosition> result = storage.createRecord(new ORecordId(defaultId), content,
          new OSimpleVersion(), (byte) 'b', OPERATION_MODE.SYNCHRONOUS.ordinal(), null);

      OPaginatedClusterDebug debug = cluster.readDebug(result.getResult().clusterPosition);

      Assert.assertEquals(debug.clusterPosition, result.getResult().clusterPosition);
      Assert.assertNotEquals(debug.contentSize, 0);
      Assert.assertFalse(debug.empty);
      Assert.assertEquals(debug.pages.size(), 1);

      Assert.assertNotEquals(debug.pages.get(0).pageIndex, -1);
      Assert.assertNotEquals(debug.pages.get(0).inPagePosition, -1);
      Assert.assertNotEquals(debug.pages.get(0).inPageSize, -1);
      Assert.assertNotNull(debug.pages.get(0).content);
    } finally {
      db.drop();
    }
  }

  @Test
  public void testTwoPagesRecordDebugInfo() throws IOException {
    ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:ClusterDebugInfoTest");
    db.create();
    try {
      OStorage storage = db.getStorage();
      int defaultId = storage.getDefaultClusterId();
      OPaginatedCluster cluster = (OPaginatedCluster) storage.getClusterById(defaultId);
      int size = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger();
      int half = size / 2;
      byte[] content = new byte[(size + half) * 1024];
      OStorageOperationResult<OPhysicalPosition> result = storage.createRecord(new ORecordId(defaultId), content,
          new OSimpleVersion(), (byte) 'b', OPERATION_MODE.SYNCHRONOUS.ordinal(), null);

      OPaginatedClusterDebug debug = cluster.readDebug(result.getResult().clusterPosition);

      Assert.assertEquals(debug.pages.size(), 2);
      Assert.assertEquals(debug.clusterPosition, result.getResult().clusterPosition);
      Assert.assertNotEquals(debug.contentSize, 0);
      Assert.assertFalse(debug.empty);

      Assert.assertNotEquals(debug.pages.get(0).pageIndex, -1);
      Assert.assertNotEquals(debug.pages.get(0).inPagePosition, -1);
      Assert.assertNotEquals(debug.pages.get(0).inPageSize, -1);
      Assert.assertNotNull(debug.pages.get(0).content);

      Assert.assertNotEquals(debug.pages.get(1).pageIndex, -1);
      Assert.assertNotEquals(debug.pages.get(1).inPagePosition, -1);
      Assert.assertNotEquals(debug.pages.get(1).inPageSize, -1);
      Assert.assertNotNull(debug.pages.get(1).content);

    } finally {
      db.drop();
    }
  }

  @Test
  public void testThreePagesRecordDebugInfo() throws IOException {
    ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:ClusterDebugInfoTest");
    db.create();
    try {
      OStorage storage = db.getStorage();
      int defaultId = storage.getDefaultClusterId();
      OPaginatedCluster cluster = (OPaginatedCluster) storage.getClusterById(defaultId);
      int size = OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger();
      byte[] content = new byte[(size + size) * 1024];
      OStorageOperationResult<OPhysicalPosition> result = storage.createRecord(new ORecordId(defaultId), content,
          new OSimpleVersion(), (byte) 'b', OPERATION_MODE.SYNCHRONOUS.ordinal(), null);
      OPaginatedClusterDebug debug = cluster.readDebug(result.getResult().clusterPosition);

      Assert.assertEquals(debug.clusterPosition, result.getResult().clusterPosition);
      Assert.assertNotEquals(debug.contentSize, 0);
      Assert.assertFalse(debug.empty);
      Assert.assertEquals(debug.pages.size(), 3);

      Assert.assertNotEquals(debug.pages.get(0).pageIndex, -1);
      Assert.assertNotEquals(debug.pages.get(0).inPagePosition, -1);
      Assert.assertNotEquals(debug.pages.get(0).inPageSize, -1);
      Assert.assertNotNull(debug.pages.get(0).content);

      Assert.assertNotEquals(debug.pages.get(1).pageIndex, -1);
      Assert.assertNotEquals(debug.pages.get(1).inPagePosition, -1);
      Assert.assertNotEquals(debug.pages.get(1).inPageSize, -1);
      Assert.assertNotNull(debug.pages.get(1).content);

      Assert.assertNotEquals(debug.pages.get(2).pageIndex, -1);
      Assert.assertNotEquals(debug.pages.get(2).inPagePosition, -1);
      Assert.assertNotEquals(debug.pages.get(2).inPageSize, -1);
      Assert.assertNotNull(debug.pages.get(2).content);
    } finally {
      db.drop();
    }
  }

}


text:
**1 - After Install the microscope, run the `grunt serve` command for watch for changes and build when necessary.**

[how to install?](INSTALLATION.md)

**2 - Edit or create yours components**

See how in:

- [Create a component](CREATE-A-COMPONENT.md)
- [Edit an existing component](EDIT-AN-EXISTING-COMPONENT.md)

**3 - View your Style guide on [http://localhost:9000/](http://localhost:9000/)**


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.BizTalk.ExplorerOM;
using System.Collections.ObjectModel;

namespace BztToolbox.Modules.AssembliesExplorer.Services
{
	public class AssembliesExplorerServices : IAssembliesExplorerServices
	{
		private BtsCatalogExplorer _catalog;

		public AssembliesExplorerServices(string connectionString) {
			this._catalog = new BtsCatalogExplorer();
			this._catalog.ConnectionString = connectionString;
		}

		#region IAssembliesExplorerServices Membres

		public System.Collections.ObjectModel.ObservableCollection<Microsoft.BizTalk.ExplorerOM.BtsAssembly> GetAllAssemblies() {
			return new ObservableCollection<BtsAssembly>(
				this._catalog.Assemblies
					.Cast<BtsAssembly>()
					.OrderBy(x => x.Name)
					.ThenBy(x => x.Version)
			);
		}

		#endregion
	}
}


text:
sc_require('responders/state');

/**

  Hanles sender classification commands

  @extends SC.Responder
*/
App.state.SENDER_CLASSIFICATION = SC.Responder.create({
	name: 'SENDER_CLASSIFICATION',

	// returns a complete array of flows
	// array of {included (bool), flow (object), name (string)} for a given contact
	 _createContactFlowArray: function (contact) {
		var allFlows = App.store.find(App.query.GET_FLOWS);
		var contactFlows = contact.get('flows');
		var a = [];

		contactFlows.forEach( function (f) { a.pushObject( {
				included: true,
				flow: f, name:
				f.get('name')}); });

		allFlows.forEach( function (f) {
			var found = a.find( function(item) { return item.flow.get('guid') === f.get('guid'); } , f);
			if ( !found )
				a.pushObject({
					included: false,
					flow: f,
					name: f.get('name')});
		});

		return a;
	},

	// when we become first responder, show classification panel
	didBecomeFirstResponder: function () {
		// setup a controller for the classification page
		var senders = App.store.find(App.query.GET_TOP_UNCLASSIFIED_CONTACTS);
		var controller = App.senderClassificationController;

		controller.set('contentBinging', senders);

		// show the page
		App.getPath('senderClassificationPage.mainPane').append();
	},

	willLoseFirstResponder: function () {
		// hide the page
	    App.getPath('senderClassificationPage.mainPane').remove();
	},

	// advance selection to the next sender
	nextSender : function () {
		var controller = App.senderClassificationController;

		// reached the end, go to flows
		var currentIndex = controller.get('senderSelectionIndex');
		if( !currentIndex || currentIndex === controller.get('length') - 1) {
			App.states.main.go('flows');
			return;
		}

		nextSenderIndex = controller.get('senderSelectionIndex') + 1;

		controller.selectObject(controller.objectAt(nextSenderIndex));
		controller.set('senderSelectionIndex', nextSenderIndex);

		// set the flows.
		App.senderClassificationFlowsController.set(
				'content',
				App.states.senderClassification._createContactFlowArray(
						controller.objectAt(nextSenderIndex)));

	},

	newFlowPlanel: function () {
		App.getPath('senderClassificationPage.newFlowPane').append();
	},

	closeNewFlowPlanel: function () {
		App.getPath('senderClassificationPage.newFlowPane').remove();
	},

	createNewFlow: function (name) {
		App.store.createRecord(App.model.Flow, {
			'name' : name
		});
	}
});


text:
permutation-rank
================
Ranks and unranks permutations.  Based on the following paper:

W. Myrvold, F. Ruskey. (2000) "[Ranking and Unranking Permutations in Linear Time](http://webhome.cs.uvic.ca/~ruskey/Publications/RankPerm/RankPerm.html)". Information Processing Letters.

Usage
=====
First install using npm:

    npm install permutation-rank

Then you can use it like this:

```javascript
var prank = require("permutation-rank")
var perm = [0,3,1,2]
var r = prank.rank(perm)
console.log("r = ", r)
var u = prank.unrank(perm.length, r)
console.log("u = ", u)

//Prints:
//        r =  15
//        u =  [ 0, 3, 1, 2 ]
```

`prank.rank(permutation)`
-----------------------------------------------
Computes an integer representing the colexicographic rank of the permutation

* `permutation` is an array encoding some permutation

**Returns** An integer representing the ranked encoding of the permutation

`prank.unrank(length, rank[, result])`
--------------------------------------------------
Computes a permutation from a rank order with the given length

* `length` is the length of the permuation
* `rank` is the index of the permutation
* `result` is an optional argument which stores the result of the inversion

**Returns** The permutation at the given rank

Credits
=======
(c) 2013 Mikola Lysenko. MIT License


text:
package socialite.tables;
import socialite.util.HashCode;
import java.io.Externalizable;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.IOException;
import socialite.util.SociaLiteException;

public class Tuple_long_double_int extends Tuple implements Externalizable {
	private static final long serialVersionUID = 1;

	public long _0;
	public double _1;
	public int _2;

	public Tuple_long_double_int() {}

	public Tuple_long_double_int(long __0, double __1, int __2) {
		_0 = __0;
		_1 = __1;
		_2 = __2;

	}

	public Tuple_long_double_int clone() {
		return new Tuple_long_double_int(_0, _1, _2);
	}

	public int size() { return 3; }

	public void update(Tuple _t) {
		if (!(_t instanceof Tuple_long_double_int))
			throw new SociaLiteException("Not supported operation");

		Tuple_long_double_int t = (Tuple_long_double_int)_t;
		_0 = t._0;
		_1 = t._1;
		_2 = t._2;

	}

	public int hashCode() {
		return HashCode.get(_0)^HashCode.get(_1)^HashCode.get(_2);
	}
	public boolean equals(Object o) {
		if (!(o instanceof Tuple)) return false;

		Tuple _t = (Tuple)o;
		if (_t.getClass().equals(Tuple_long_double_int.class)) {
			Tuple_long_double_int t=(Tuple_long_double_int)_t;
			return (_0==(t._0))&& (_1==(t._1))&& (_2==(t._2));
		}
		return false;
	}

	public Object get(int column) {
		if (column==0) return _0;
		if (column==1) return _1;
		if (column==2) return _2;

		return null;
	}
	public int getInt(int column) {
		if (column==2) return _2;

		throw new UnsupportedOperationException();
	}
	public long getLong(int column) {
		if (column==0) return _0;

		throw new UnsupportedOperationException();
	}
	public float getFloat(int column) {

		throw new UnsupportedOperationException();
	}
	public double getDouble(int column) {
		if (column==1) return _1;

		throw new UnsupportedOperationException();
	}
	public Object getObject(int column) {
		throw new UnsupportedOperationException();
	}

	public void setInt(int column, int v) {
		if (column==2) { _2=v; return; }

		throw new UnsupportedOperationException();
	}
	public void setLong(int column, long v) {
		if (column==0) { _0=v; return; }

		throw new UnsupportedOperationException();
	}
	public void setFloat(int column, float v) {
		throw new UnsupportedOperationException();
	}
	public void setDouble(int column, double  v) {
		if (column==1) { _1=v; return; }

		throw new UnsupportedOperationException();
	}
	public void setObject(int column, Object v) {
		throw new UnsupportedOperationException();
	}
	public String toString() {
		return ""+_0+", "+_1+", "+_2;
	}

	@Override
	public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
		_0=in.readLong();
		_1=in.readDouble();
		_2=in.readInt();

	}
	@Override
	public void writeExternal(ObjectOutput out) throws IOException {
		out.writeLong(_0);
		out.writeDouble(_1);
		out.writeInt(_2);

	}
}