text:
       implicit none
       real lats,longs,cornerlat,cornerlong,offsetlat,offsetlong
       character*50 arg,arg2
       integer i
!----------------------------------------------------------------
!
       call getarg(1,arg)
       read(arg,*) cornerlong
       call getarg(2,arg2)
       read(arg2,*) cornerlat
       open(1,file='/home/rdaigle/track/part_loc.ll')
       open(2,file='/home/rdaigle/track/part_loc_forgrid.ll')

!----------------------------------------------------------------
!
!       print *, cornerlat,cornerlong

!       random.choice(open('/home/rdaigle/track/part_loc_forgrid.ll').readlines( ))

       DO i=1,150000
        read(2,*)longs,lats
     	write(1,*)cornerlong+longs,cornerlat+lats
       end DO
      close(1)
      close(2)
      end


text:
const RADIUS = 15;
const MAX_POINTS_COUNT = 8;
const FACTOR = 5;
const ENTRANCE_BEACON = "EntryBeacon";
const CHOCOLATE_BEACON = "ChocolateBeacon";
const WINE_BEACON = "WineBeacon";
const CHEESE_BEACON = "CheeseBeacon";
const REFRESH_INTERVAL_MS = 5000;

//specific constants for IE version only.
const X_POSITION_IE = 15;
const HEATMAP_HEIGHT_IE = 188; //Cavas's height - 2 * RADIUS

redpajama_set_name: RedPajamaGithub


text:
http_path = "/skin/frontend/rwd/default/"
css_dir = "../css"
sass_dir = "../scss"
images_dir = "../images"
javascripts_dir = "../js"
relative_assets = true

output_style = :expanded
environment = :production


text:
package y2w.Account;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentProviderClient;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SyncResult;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.util.Log;

import y2w.service.AotoLoginService;

public class SyncAdapter extends AbstractThreadedSyncAdapter {

    public static final String ACCOUNT_TYPE = "com.yun2win.demo";
    private static final String TAG = "SyncAdapter";
    private static final String SYNC_MARKER_KEY = "com.yun2win.demo.marker";
    private final AccountManager mAccountManager;
    private final Context mContext;

    public SyncAdapter(Context context, boolean autoInitialize) {
        super(context, autoInitialize);
        mContext = context;
        mAccountManager = AccountManager.get(context);
    }

    @Override
    public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {

        try {
            long lastSyncMarker = getServerSyncMarker(account);
            if (lastSyncMarker == 0) {
                setAccountContactsVisibility(getContext(), account, true);
            }
            setServerSyncMarker(account, ++lastSyncMarker);
            mContext.startService(new Intent(mContext, AotoLoginService.class));
        } catch (final Exception e) {
            Log.e(TAG, "JSONException", e);
            syncResult.stats.numParseExceptions++;
        }
    }

    /**
     * 得到标识
     */
    private long getServerSyncMarker(Account account) {
        String markerString = mAccountManager.getUserData(account, SYNC_MARKER_KEY);
        if (!TextUtils.isEmpty(markerString)) {
            return Long.parseLong(markerString);
        }
        return 0;
    }

    /**
     * 设置标识
     */
    private void setServerSyncMarker(Account account, long marker) {
        mAccountManager.setUserData(account, SYNC_MARKER_KEY, Long.toString(marker));
    }

    /**
     * 设置对此帐号可见
     */
    public void setAccountContactsVisibility(Context context, Account account, boolean visible) {
        ContentValues values = new ContentValues();
        values.put(ContactsContract.RawContacts.ACCOUNT_NAME, account.name);
        values.put(ContactsContract.RawContacts.ACCOUNT_TYPE, ACCOUNT_TYPE);
        values.put(ContactsContract.Settings.UNGROUPED_VISIBLE, visible ? 1 : 0);

        context.getContentResolver().insert(ContactsContract.Settings.CONTENT_URI, values);
    }
}


text:
package jodd.db.oom.fixtures;

import jodd.db.oom.meta.DbColumn;
import jodd.db.oom.meta.DbId;
import jodd.db.oom.meta.DbTable;

@DbTable
public class Tester {

	@DbId
	protected Long id;

	@DbColumn
	protected String name;

	@DbColumn
	protected Integer value;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getValue() {
		return value;
	}

	public void setValue(Integer value) {
		this.value = value;
	}

	@Override
	public String toString() {
		return "{" + id + ',' + name + ',' + value + '}';
	}
}


text:
What is RBTLIB?

.. image:: https://travis-ci.org/bminard/rbtlib.svg?branch=master
    :target: https://travis-ci.org/bminard/rbtlib
    :alt: Travis CI Build Status

.. image:: https://readthedocs.org/projects/rbtlib/badge/?version=latest
    :target: http://rbtlib.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status
---------------

**rbtlib** is a client-side Python package for `Review Board`_.
Use it to write your own Review Board clients.

**rbt** is a simple RBTools clone that uses **rbtlib**.
Use it to collect the Root List and Review Requests List Resources.
Limit Review Requests using **rbt** options snd post review requests.

Documentation for **rbtlib** and **rbt** is available on `readthedocs.org`_.

Pre-requisites
--------------

**rbtlib** and **rbt** require Python to run.
See ``setup.py`` for dependencies.

Installing
----------

**rbtlib** can be installed from PyPi (Python package index)::

    > pip install rbtlib

Alternatively, download the source distribution either from PyPi or
the main Github project page. When you unzip the source distribution, run::

    > python setup.py install

Running rbt without installing
------------------------------

**rbt** supports direct invocation without installing it.

Unzip the **rbt** distribution into a directory.
Let's assume its full path is ``/path/to/rbt``.
Run::

    > /path/to/python /path/to/rbt

This will invoke **rbt** as expected.
This command can also be tied to an alias or placed in a shell (or batch) script.

How to use it?
--------------

**rbt** is meant to be executed from the command line. Running it with no
arguments or with ``--help`` prints a detailed usage message.
Run::

    > rbt review-requests reviews.reviewboard.org --counts-only
    {
      "count": 144,
      "stat": "ok"
    }

to get a count of reviews.
Or::

    > rbt review-requests reviews.reviewboard.org --time-added-from 2016-02-27
    {
      "links": {
        "create": {
          "href": "https://reviews.reviewboard.org/api/review-requests/",
          "method": "POST"
        },
        "next": {
          "href": "https://reviews.reviewboard.org/api/review-requests/?start=25&max-results=25&time-added-from=2016-02-27",
          "method": "GET"
        },
        "self": {
          "href": "https://reviews.reviewboard.org/api/review-requests/?time-added-from=2016-02-27",
          "method": "GET"
        }
      },
      "review_requests": [
        ...
      ],
      "stat": "ok",
      "total_results": 32
    }

to get a list of reviews from the specified date.

Post a review::

    > rbt post demo.reviewboard.org /path/to/patch
    Username: guest6894
    Password: ****
    Repeat for confirmation: ****
    posted review 1755

Write your own client using the **rbtlib** API.

License
-------

**rbtlib** is open-source software. See the ``LICENSE`` file for more details.

Acknowledgements
----------------

**rbtlib** wouldn't exist if it weren't for the Review Board team's Web API
documentation.
It's well documented.
Thank you!

.. _Review Board: https://www.reviewboard.org
.. _readthedocs.org: http://rbtlib.readthedocs.io/en/latest/


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Values</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with Oracle NoSQL Database Key/Value API" />
    <link rel="up" href="schema.html" title="Chapter 3. Record Design Considerations" />
    <link rel="prev" href="schema.html" title="Chapter 3. Record Design Considerations" />
    <link rel="next" href="storewrites.html" title="Chapter 4. Writing and Deleting Records" />

Library Version 12.1.3.5

          Values

          Prev
          Chapter 3. Record Design Considerations
           Next

Values

          Records in the store are organized as key-value pairs. The
          value is the data that you want to store,
          manage and retrieve. In almost all cases, you should create your
          values using Avro to describe the value's data schema. Avro
          schemas are described in
          Avro Schemas.

          In simple cases, values can also be organized as a byte array. If
          so, the mapping of the arrays to data structures (serialization
          and deserialization) is left entirely to the application.
          Note that while the earliest portions of this manual show byte
          array usage in its examples, this is not the recommended
          approach. Instead, you should use Avro even for very simple
          values.

          There are no restrictions on the size of your values. However,
          you should consider your store's performance when deciding how
          large you are willing to allow your individual records to become.
          As is the case with any data storage scheme, the larger your
          record, the longer it takes to read the information from storage,
          and to write the information to storage.  If your values become
          so large that they impact store read/write performance, or are
          even too large to fit into your memory cache (or even your Java
          heap space) then you should consider storing your values using
          Oracle NoSQL Database's large object support. See the
          Oracle NoSQL API Large Object API
          introduction for details.

          On the other hand, every record carries with it some amount of
          overhead. Also, as the number of your records grows very large,
          search times may begin to be adversely affected. As a result,
          choosing to store an extremely large number of very small records
          can also harm your store's performance.

          Therefore, when designing your store's content, you must find the
          appropriate balance between a small number of very large records
          and a large number of very small records. You should also
          consider how frequently any given piece of information will be
          accessed.

          For example, suppose your store contains information about users,
          where each user is identified by their email address. There is a
          set of information that you want to maintain about each user.
          Some of this information is small in size, and some of it is
          large. Some of it you expect will be frequently accessed, while
          other information is infrequently accessed.

          Small properties are:

                  name

                  gender

                  address

                  phone number

          Large properties are:

                    image file

                  public key 1

                  public key 2

                  recorded voice greeting

          There are several possible ways you can organize this data. How
          you should do it depends on your data access patterns.

          For example, suppose your application requires you to read and
          write all of the properties identified above every time you
          access a record. (This is unlikely, but it does represent the
          simplest case.) In that event, you might create a single Avro
          schema that represents each of the properties you maintain for
          the users in your application.  You can then trivially organize
          your records using only major key components so that, for
          example, all of the data for user Bob Smith can be accessed using
          the key
          /Smith/Bob.

          However, the chances are good that your application will not
          require you to access all of the properties
          for a user's record every time you access that record. While it is
          possible that you will always need to read all of the properties every
          time you perform a user look up, it is likely that on updates you
          will operate only on some properties.

          Given this, it is useful to consider how frequently data will be
          accessed, and its size. Large, infrequently accessed properties
          should use a key other than that used by the frequently accessed
          properties. The different keys for these large properties can
          share major key components, while differing in their minor key
          components.  However, if you are using large object support for
          your large properties, then these must be under a major key that
          is different from the major key you use for the other properties
          you are storing.

          At the same time, there is overhead involved with every key your
          store contains, so you do not want to create a key for every
          possible user property. For this reason, if you have a lot of
          small properties, you might want to organize them all under a
          single key even if only some of them are likely to be updated or
          read for any given operation.

         For example, for the properties identified above, suppose the
         application requires:

                  all of the small properties to always be used whenever
                  the user's record is accessed.

                  all of the large properties to be read for simple user
                  look ups.

                  on user record updates, the public keys are always
                  updated (written) at the same time.

                  The image file and recorded voice greeting can be updated
                  independently of everything else.

          In this case, you might store user properties using four keys
          per user. Each key shares the same major components, and differs
          in its minor component, in the following way:

                  /surname/familiar
                      name/-/contact

                  The value for this key is a Avro record that contains
                  all of the small user properties (name, phone number,
                  address, and so forth).

                  /surname/familiar
                      name/-/publickeys

                  The value for this key is an Avro record that contains
                  the user's public keys. These are always read and written
                  at the same time, so it makes sense to organize them
                  under one key.

                  /image.lob/-/surname/familiar
                      name

                  The value for this key is an image file, saved using
                  Oracle NoSQL Database's large object support.

                  /audio.lob/-/voicegreeting/surname/familiar
                      name

                  The value for this key is an mp3 file, also saved using
                  the large object support.

          Any data organized under different keys which differ only in the
          minor key component allows you to read and update the various
          properties all at once using a single atomic operation, which
          gives you full ACID support for user record updates.  At the same
          time, your application does not have to be reading and writing
          large properties (image files, voice recordings, and so forth)
          unless it is absolutely necessary. When it is necessary to read
          or write these large objects, you can use the Oracle NoSQL Database stream
          interface which is optimized for that kind of traffic.

          Prev

            Up

           Next

          Chapter 3. Record Design Considerations

            Home

           Chapter 4. Writing and Deleting Records


text:
@interface MOSViewValidatingToolbarItem : NSToolbarItem

@end


text:
@interface CLHighlightShadowEffect : CLEffectBase

@end


text:
import React, {ChangeEvent} from 'react';
import {ClientConn, decode} from '../../../../src/core/editor';
import {TicloLayoutContext, TicloLayoutContextType} from '../../component/LayoutContext';
import {NodeTree} from '../..';
import {Button, Input, Menu, Tooltip} from 'antd';
import FileAddIcon from '@ant-design/icons/FileAddOutlined';
import ReloadIcon from '@ant-design/icons/ReloadOutlined';
import {AddNewJob} from './AddNewJob';
import {DragDropDiv, DragState} from 'rc-dock/lib';
import {NodeTreeItem} from '../../node-tree/NodeRenderer';
import {ClickParam} from 'antd/lib/menu';

interface Props {
  conn: ClientConn;
  basePaths: string[];
  hideRoot?: boolean;
  onSelect?: (keys: string[]) => void;
  showMenu?: boolean;
}

interface State {
  jobModelVisible: boolean;
  jobBasePath?: string;
  selectedKeys: string[];
}

export class NodeTreePane extends React.PureComponent<Props, State> {
  static contextType = TicloLayoutContextType;
  context!: TicloLayoutContext;

  state: State = {selectedKeys: [], jobModelVisible: false};

  _nodeTree: NodeTree;
  getNodeTree = (ref: NodeTree) => {
    this._nodeTree = ref;
  };

  onChange(selectedKeys: string[]) {
    this.setState({selectedKeys});
  }

  onSourceChange(source: any): void {}

  componentDidMount(): void {
    this.context?.selectedPaths.listen(this);
  }
  componentWillUnmount(): void {
    this.context?.selectedPaths.unlisten(this);
  }

  reload = () => {
    this._nodeTree?.reload();
  };

  onAddNewJobClick = (param: ClickParam) => {
    let path = param.item.props.defaultValue;
    this.setState({jobBasePath: `${path}.`, jobModelVisible: true});
  };

  getMenu = (item: NodeTreeItem) => {
    let {showMenu} = this.props;
    let menuItems: React.ReactElement[] = [];
    if (showMenu) {
      let seekParent = item;
      while (seekParent.functionId === 'job:main') {
        seekParent = seekParent.parent;
      }
      // find the root node, so every level of parents is Job
      if (seekParent.id === '') {
        menuItems.push(
          <Menu.Item key="addJob" defaultValue={item.key} onClick={this.onAddNewJobClick}>
            <FileAddIcon />
            Add Child Job
          </Menu.Item>
        );
      }
    }
    return menuItems;
  };

  showNewJobModel = () => {
    this.setState({jobModelVisible: true, jobBasePath: null});
  };
  hideNewJobModel = () => {
    this.setState({jobModelVisible: false});
  };

  newJobDragOver = (e: DragState) => {
    let {conn} = this.props;
    let path = DragState.getData('path', conn.getBaseConn());
    if (path) {
      e.accept('tico-fas-plus-square');
    }
  };
  newJobDrop = (e: DragState) => {
    let {conn} = this.props;
    let path = DragState.getData('path', conn.getBaseConn());
    if (path) {
      this.setState({jobBasePath: `${path}.`, jobModelVisible: true});
    }
  };
  render() {
    let {conn, basePaths, hideRoot, onSelect, showMenu} = this.props;
    let {selectedKeys, jobModelVisible, jobBasePath} = this.state;

    return (

        {showMenu ? (

            <Tooltip title="Reload">
              <Button size="small" icon={<ReloadIcon />} onClick={this.reload} />
            </Tooltip>
            <Tooltip title="New Job">
              <DragDropDiv onDragOverT={this.newJobDragOver} onDropT={this.newJobDrop}>
                <Button size="small" icon={<FileAddIcon />} onClick={this.showNewJobModel} />
              </DragDropDiv>
            </Tooltip>
            <AddNewJob conn={conn} onClose={this.hideNewJobModel} visible={jobModelVisible} basePath={jobBasePath} />

        ) : null}
        <NodeTree
          ref={this.getNodeTree}
          conn={conn}
          basePaths={basePaths}
          hideRoot={hideRoot}
          selectedKeys={selectedKeys || []}
          onSelect={onSelect}
          getMenu={this.getMenu}
        />

    );
  }
}


text:
package centaur.test.formulas

import cats.syntax.flatMap._
import cats.syntax.functor._
import centaur.test.Operations._
import centaur.test.Test.testMonad
import centaur.test.markers.CallMarker
import centaur.test.submit.{SubmitHttpResponse, SubmitResponse}
import centaur.test.workflow.Workflow
import centaur.test.{Operations, Test}
import centaur.{CentaurConfig, CromwellManager, ManagedCromwellServer}
import cromwell.api.model.{Aborted, Failed, SubmittedWorkflow, Succeeded, TerminalStatus}

import scala.concurrent.duration._

/**
  * A collection of test formulas which can be used, building upon operations by chaining them together via a
  * for comprehension. These assembled formulas can then be run by a client
  */
object TestFormulas {
  private def runWorkflowUntilTerminalStatus(workflow: Workflow, status: TerminalStatus): Test[SubmittedWorkflow] = {
    for {
      s <- submitWorkflow(workflow)
      _ <- pollUntilStatus(s, status)
    } yield s
  }

  private def runSuccessfulWorkflow(workflow: Workflow): Test[SubmittedWorkflow] = runWorkflowUntilTerminalStatus(workflow, Succeeded)
  private def runFailingWorkflow(workflow: Workflow): Test[SubmittedWorkflow] = runWorkflowUntilTerminalStatus(workflow, Failed)

  def runSuccessfulWorkflowAndVerifyMetadata(workflowDefinition: Workflow): Test[SubmitResponse] = for {
    w <- runSuccessfulWorkflow(workflowDefinition)
    _ <- validateMetadata(w, workflowDefinition)
    _ <- validateDirectoryContentsCounts(workflowDefinition, w)
  } yield SubmitResponse(w)

  def runFailingWorkflowAndVerifyMetadata(workflowDefinition: Workflow): Test[SubmitResponse] = for {
    w <- runFailingWorkflow(workflowDefinition)
    _ <- validateMetadata(w, workflowDefinition)
    _ <- validateDirectoryContentsCounts(workflowDefinition, w)
  } yield SubmitResponse(w)

  def runWorkflowTwiceExpectingCaching(workflowDefinition: Workflow): Test[SubmitResponse] = {
    for {
      firstWF <- runSuccessfulWorkflow(workflowDefinition)
      secondWf <- runSuccessfulWorkflow(workflowDefinition)
      metadata <- validateMetadata(secondWf, workflowDefinition, Option(firstWF.id.id))
      _ <- validateNoCacheMisses(metadata, workflowDefinition.testName)
      _ <- validateDirectoryContentsCounts(workflowDefinition, secondWf)
    } yield SubmitResponse(secondWf)
  }

  def runWorkflowTwiceExpectingNoCaching(workflowDefinition: Workflow): Test[SubmitResponse] = {
    for {
      _ <- runSuccessfulWorkflow(workflowDefinition) // Build caches
      testWf <- runSuccessfulWorkflow(workflowDefinition)
      metadata <- validateMetadata(testWf, workflowDefinition)
      _ <- validateNoCacheHits(metadata, workflowDefinition.testName)
      _ <- validateDirectoryContentsCounts(workflowDefinition, testWf)
    } yield SubmitResponse(testWf)
  }

  def runFailingWorkflowTwiceExpectingNoCaching(workflowDefinition: Workflow): Test[SubmitResponse] = {
    for {
      _ <- runFailingWorkflow(workflowDefinition) // Build caches
      testWf <- runFailingWorkflow(workflowDefinition)
      metadata <- validateMetadata(testWf, workflowDefinition)
      _ <- validateNoCacheHits(metadata, workflowDefinition.testName)
      _ <- validateDirectoryContentsCounts(workflowDefinition, testWf)
    } yield SubmitResponse(testWf)
  }

  private def cromwellRestart(workflowDefinition: Workflow, callMarker: CallMarker, testRecover: Boolean, finalStatus: TerminalStatus): Test[SubmitResponse] = CentaurConfig.runMode match {
    case ManagedCromwellServer(_, postRestart, withRestart) if withRestart =>
      for {
        w <- submitWorkflow(workflowDefinition)
        jobId <- pollUntilCallIsRunning(w, callMarker.callKey)
        _ = CromwellManager.stopCromwell()
        _ = CromwellManager.startCromwell(postRestart)
        _ <- pollUntilStatus(w, finalStatus)
        _ <- validateMetadata(w, workflowDefinition)
        _ <- if(testRecover) validateRecovered(w, callMarker.callKey, jobId) else Test.successful(())
        _ <- validateDirectoryContentsCounts(workflowDefinition, w)
      } yield SubmitResponse(w)
    case _ if finalStatus == Succeeded => runSuccessfulWorkflowAndVerifyMetadata(workflowDefinition)
    case _ if finalStatus == Failed => runFailingWorkflowAndVerifyMetadata(workflowDefinition)
    case _ => Test.failed(new Exception("This test can only run successful or failed workflow"))
  }

  def instantAbort(workflowDefinition: Workflow): Test[SubmitResponse] = for {
    w <- submitWorkflow(workflowDefinition)
    _ <- abortWorkflow(w)
    _ <- pollUntilStatus(w, Aborted)
    _ <- validateMetadata(w, workflowDefinition)
    _ <- validateDirectoryContentsCounts(workflowDefinition, w)
  } yield SubmitResponse(w)

  def scheduledAbort(workflowDefinition: Workflow, callMarker: CallMarker, restart: Boolean): Test[SubmitResponse] = {
    def withRestart() = CentaurConfig.runMode match {
      case ManagedCromwellServer(_, postRestart, withRestart) if withRestart =>
        CromwellManager.stopCromwell()
        CromwellManager.startCromwell(postRestart)
      case _ =>
    }

    for {
      w <- submitWorkflow(workflowDefinition)
      jobId <- pollUntilCallIsRunning(w, callMarker.callKey)
      _ <- abortWorkflow(w)
      _ = if(restart) withRestart()
      _ <- pollUntilStatus(w, Aborted)
      _ <- validatePAPIAborted(jobId, w)
      // Wait a little to make sure that if the abort didn't work and calls start running we see them in the metadata
      _ <- waitFor(30.seconds)
      _ <- validateMetadata(w, workflowDefinition)
      _ <- validateDirectoryContentsCounts(workflowDefinition, w)
    } yield SubmitResponse(w)
  }

  def workflowRestart(workflowDefinition: Workflow,
                             callMarker: CallMarker,
                             recover: Boolean,
                             finalStatus: TerminalStatus): Test[SubmitResponse] = {
    cromwellRestart(workflowDefinition, callMarker, testRecover = recover, finalStatus = finalStatus)
  }

  def submitInvalidWorkflow(workflow: Workflow, expectedSubmitResponse: SubmitHttpResponse): Test[SubmitResponse] = {
    for {
      actualSubmitResponse <- Operations.submitInvalidWorkflow(workflow)
      _ <- validateSubmitFailure(workflow, expectedSubmitResponse, actualSubmitResponse)
    } yield actualSubmitResponse
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Analytics
{
    public class HttpRequestFactory
    {
        private static HttpRequestFactory _instance;
        public static HttpRequestFactory Instance
        {
            get
            {
                return _instance == null ? (_instance = new HttpRequestFactory()) : _instance;
            }
        }

        private HttpRequestFactory() { }

        public System.Net.WebRequest CreateRequest(string uri)
        {
            System.Net.WebRequest request = System.Net.HttpWebRequest.Create(uri);
            request.Proxy = ProxyHelper.GetProxy();
            request.Timeout = (int)(Settings.Instance.RequestTimeout * 1000);
            return request;
        }
    }
}


text:
package statemachine;

import static common.Utilities.isEmpty;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import common.BaseNamedObject;

/**
 * A state machine governs the transition that stateful objects can take.
 *
 * It is a named object because object types that have their state machines
 * defined this way are generally referred by a logical reference, usually a
 * name.
 *
 * @author patrick
 *
 * @param <S>
 *            the stateful object type managed by this state machine
 *
 */
public class StateMachine<S extends StatefulObject<S>> extends BaseNamedObject<StateMachine<S>> {
    private static final long serialVersionUID = 1L;

    /*
     * State Definitions
     */
    /**
     * when the state machine is constructed it will generate logical names to
     * use as keys to represent the states. this map maps the logical names to
     * the state labels that were provided.
     */
    private final Map<String, String>            stateNames;
    /**
     * map of descriptions to state logical, or reference, names.
     */
    private final Map<String, String>            stateDescriptions;

    /*
     * Transition Definitions
     */
    /**
     * when the state machine is constructed it will generate logical names to
     * use as keys to represent the transitions. this map maps the logical names
     * to the transition labels that were provided.
     */
    private final Map<String, String>            transitionNames;
    /**
     * map of descriptions to transition logical, or reference, names.
     */
    private final Map<String, String>            transitionDescriptions;

    /**
	 * additional transition properties defined in JSON file but not handled by
	 * the base state machine engine.
	 */
    private final Map<String, Map<String, Object>> transitionProperties;

    /**
     * when transitions are defined, they are defined relative to the
     * destination state that will be reached once the transition completes.
     * there is only one destination, or target state for each transition.
     * however, several transitions can define the same target state.
     */
    private final Map<String, String>            targetStates;

    /*
     * State Machine Initialization
     */
    /**
     * all the possible entry points into the state machine.
     */
    private final Set<String>                    initialTransitions;
    /**
     * a state machine must define at least one entry point. the first entry
     * point is defined as the the default initial transition for the state
     * machine. this field defines which of the initial transitions is the
     * default transition.
     */
    private final String                         initialTransition;

    /*
     * State Machine Transitions
     */
    /**
     * a map of state names and all the valid, or allowed, transitions from that
     * state. for each from/to state pairings, there should only be one
     * transition that defines that transition. a state may have 0, 1, or more
     * valid transitions defined.
     */
    final Map<String, Set<String>>               validTransitions;
    /**
     * a map of state names and the default transition for that state. if a
     * state has no transitions defined, then it will not have a default
     * transition defined in this map. however, if the state has one or more
     * transitions defined, then the first (or only) transition is declared as
     * the default transition.
     */
    final Map<String, String>                    defaultTransitions;

	/**
	 * logic that defines what transition the state machine should invoke as a
	 * result of transition data provided. used by
	 * advance() when given a transition data object.
	 */
	private final TransitionSelector<S> transitionSelector;

    /*
     * Triggers
     */
    /**
     * map of transition to pre-trigger. each transition may define at most 1
     * pre trigger.
     */
    private final Map<String, Class<Trigger<S,?>>> preTriggerRegistry;
    /**
     * map of transition to post-trigger. each transition may define at most 1
     * post trigger.
     */
    private final Map<String, Class<Trigger<S,?>>> postTriggerRegistry;

    /**
     * map of transition to pre-trigger. each transition may define at most 1
     * pre trigger.
     */
    private transient Map<String, Trigger<S,?>>    preTriggers;
    /**
     * map of transition to post-trigger. each transition may define at most 1
     * post trigger.
     */
    private transient Map<String, Trigger<S, ?>>    postTriggers;

    /**
     * @param config
     * @throws MalformedStateMachineException
     */
    @SuppressWarnings("unchecked")
	protected StateMachine ( Map<String,Serializable> config ) throws MalformedStateMachineException {
    	this(
    			(String) config.get( "name" ),
    			(String) config.get( "description" ),
    			(Map<String, String>) config.get( "stateNames" ),
                (Map<String, String>) config.get( "stateDescriptions" ),
                (Map<String, String>) config.get( "transitionNames" ),
                (Map<String, String>) config.get( "transitionDescriptions" ),
                (Map<String, Map<String,Object>>) config.get( "transitionProperties" ),
                (String) config.get( "initialTransition" ),
                (Set<String>) config.get( "initialTransitions" ),
                (Map<String, Set<String>>) config.get( "validTransitions" ),
                (Map<String, String>) config.get( "defaultTransitions" ),
                (Map<String, String>) config.get( "targetStates" ),
                (TransitionSelector<S>) config.get( "transitionSelector" ),
                (Map<String, Class<Trigger<S,?>>>) config.get( "preTriggers" ),
                (Map<String, Class<Trigger<S,?>>>) config.get( "postTriggers" )
    	);
    }

    /**
     * Creates a state machine. Because the construction process is so
     * difficult, this is intended to be called only by the state machine
     * builder class.
     *
     * @param name
     *            name of the state machine
     * @param description
     *            description of the state machine
     * @param provider
     * @param logger
     *            shared logger
     * @param stateNames
     *            map of state key and display names, or labels
     * @param stateDescriptions
     *            map of state key and descriptions
     * @param transitionNames
     *            map of transition key and display names, or labels
     * @param transitionDescriptions
     *            map of transition key and descriptions
     * @param initialTransition
     *            key of default entry point into state machine
     * @param initialTransitions
     *            set of transition keys that correspond to entry points into
     *            state machine
     * @param validTransitions
     *            map of state keys and all allowed transitions from those
     *            states, if any
     * @param defaultTransitions
     *            map of state keys and the default transition for that state,
     *            if any
     * @param targetStates
     *            map of transition keys and target states for those transitions
     * @param preTriggers
     *            map of transition keys and pre-trigger operations
     * @param postTriggers
     *            map of transition keys and post-trigger operations
     * @throws MalformedStateMachineException if state machine is invalid
     *
     */
    StateMachine(final String name, final String description,
            final Map<String, String> stateNames,
            final Map<String, String> stateDescriptions,
            final Map<String, String> transitionNames,
            final Map<String, String> transitionDescriptions,
            final Map<String, Map<String,Object>> transitionProperties,
            final String initialTransition,
            final Set<String> initialTransitions,
            final Map<String, Set<String>> validTransitions,
            final Map<String, String> defaultTransitions,
            final Map<String, String> targetStates,
            final TransitionSelector<S> transitionSelector,
            final Map<String, Class<Trigger<S,?>>> preTriggers,
            final Map<String, Class<Trigger<S,?>>> postTriggers) throws MalformedStateMachineException {
        // set the name and description of the state machine
        super(name, description);

        // define the states in the state machine
        this.stateNames = Collections
                .unmodifiableMap(new HashMap<String, String>(stateNames));
        this.stateDescriptions = Collections
                .unmodifiableMap(new HashMap<String, String>(stateDescriptions));

        // define the transitions in the state machine
        this.transitionNames = Collections
                .unmodifiableMap(new HashMap<String, String>(transitionNames));
        this.transitionDescriptions = Collections
                .unmodifiableMap(new HashMap<String, String>(
                        transitionDescriptions));
        this.transitionProperties = Collections
                .unmodifiableMap(new HashMap<String, Map<String,Object>>(
                		transitionProperties));
        this.targetStates = Collections
                .unmodifiableMap(new HashMap<String, String>(targetStates));

        // define the entry points into the state machine
        this.initialTransition = initialTransition;
        this.initialTransitions = Collections
                .unmodifiableSet(new HashSet<String>(initialTransitions));

        // define the state machine transitions
        final Map<String, Set<String>> valid = new HashMap<String, Set<String>>(
                validTransitions.size());
        Set<String> transitions = null;
        for (final Entry<String, Set<String>> entry : validTransitions
                .entrySet()) {
            transitions = Collections.unmodifiableSet(new HashSet<String>(entry
                    .getValue()));
            valid.put(entry.getKey(), transitions);
        }
        this.validTransitions = Collections.unmodifiableMap(valid);
        this.defaultTransitions = Collections
                .unmodifiableMap(new HashMap<String, String>(defaultTransitions));

        // define the pluggable transition selection logic
        this.transitionSelector = transitionSelector == null ? new DefaultStateTransitionSelector<S>() : transitionSelector;

        // define the transition triggers
        this.preTriggerRegistry = Collections
                .unmodifiableMap(new HashMap<String, Class<Trigger<S,?>>>(
                        preTriggers));
        this.postTriggerRegistry = Collections
                .unmodifiableMap(new HashMap<String, Class<Trigger<S,?>>>(
                        postTriggers));

        // create trigger caches
        this.preTriggers = new HashMap<String, Trigger<S,?>>(
                preTriggerRegistry.size());
        this.postTriggers = new HashMap<String, Trigger<S,?>>(
                postTriggerRegistry.size());

        // try to initialize the cache of trigger instances
        loadTriggerCache(preTriggerRegistry, this.preTriggers);
        loadTriggerCache(postTriggerRegistry, this.postTriggers);

    }

    /**
     * @param registry
     * @param cache
     * @throws MalformedStateMachineException
     * @throws StateTransitionException
     */
    private void loadTriggerCache( final Map<String, Class<Trigger<S,?>>> registry, final Map<String, Trigger<S,?>> cache) throws MalformedStateMachineException {
        for (final Entry<String, Class<Trigger<S,?>>> trigger : registry.entrySet()) {
            cache.put( trigger.getKey(), newTrigger( trigger.getKey(), trigger.getValue() ) );
        }
    }

    /**
     * invoke the default initial transition defined by the state machine
     *
     * @param statefulObject
     *            the object to initialize
     * @throws StateTransitionException
     *             if the object could not be initialized
     */
    public final void initialize(final S statefulObject) throws StateTransitionException {
        invokeTransition(getInitialTransition(), statefulObject);
    }

    /**
     * test to see if item has been initialized
     *
     * @return true if state machine has been initialized,
     *         false otherwise.
     */
    final boolean isInitialized(final S statefulObject) {
        return statefulObject.getCurrentState() != null;
    }

    /**
     * @return
     */
    public final Map<String,Serializable> asGraph( Object... params ) {
    	Map<String,Serializable> graph = new LinkedHashMap<String,Serializable>();
		graph.put( "name", getName() );
		graph.put( "description", getDescription() );
		graph.put( "stateNames", (Serializable) getStateNames() );
        graph.put( "stateDescriptions", (Serializable) getStateDescriptions() );
        graph.put( "transitionNames", (Serializable) getTransitionNames() );
        graph.put( "transitionDescriptions", (Serializable) getTransitionDescriptions() );
        graph.put( "transitionProperties", new LinkedHashMap<>( transitionProperties ) );
        graph.put( "initialTransition", getInitialTransition() );
        graph.put( "initialTransitions", (Serializable) getInitialTransitions() );
        graph.put( "validTransitions", new LinkedHashMap<>( validTransitions ) );
        graph.put( "defaultTransitions", new LinkedHashMap<>( defaultTransitions ) );
        graph.put( "targetStates", new LinkedHashMap<>( targetStates ) );
        graph.put( "transitionSelector", transitionSelector.getClass().getName() );
        if( !preTriggerRegistry.isEmpty() ) {
        	graph.put( "preTriggers", (Serializable) getPreTriggers() );
        }
        if( !postTriggerRegistry.isEmpty() ) {
        	graph.put( "postTriggers", (Serializable) getPostTriggers() );
        }
        return graph;
    }

	/**
     * template method that defines the transition sequence.
     *
     * @param statefulObject
     *            the object to transition
     * @param transition
     *            the transition to invoke
     * @param transitionData
     * @throws StateTransitionException
     *             if the transition failed
     */
    @SuppressWarnings("unchecked")
	public final <OUT> OUT invokeTransition(final String transition, final S statefulObject, final Object... transitionData) throws StateTransitionException {
        // 1. check to make sure that a transition is provided
        if (isEmpty(transition)) {
            throw new IllegalArgumentException("must specify a transition");
        }

        // 2. check to make sure that a transition is provided
        if (statefulObject == null) {
            throw new IllegalArgumentException("must specify an object to transition");
        }

        // 3. find the appropriate transition key
        final String transitionKey = findTransitionKey(transition);

        if (transitionKey == null) {
            throw new StateTransitionException("no such transition: " + transition);
        }

        // 4. check the valid transitions for current state
        // 4a. get the current state of the object
        final String currentState = getObjectState(statefulObject);

        // 4b. auto advance until the appropriate pre transition step is reached
        Set<String> transitions = null;
        String stateText = null;
        if (currentState == null) {
            // not yet initialized
            transitions = getInitialTransitions();
            stateText = "a valid initial transition";
        } else {
            // active object at some state in the state machine
            transitions = validTransitions.get(currentState);
            stateText = String.format("allowed from state '%s'", getStateNames().get(currentState));
        }
        if (!transitions.contains(transitionKey)) {
            // if the requested transition is not allowed from the current
            // state, find path to get there using default transitions.
            final ArrayList<String> path = new ArrayList<String>();
            String t = null;
            String s = currentState;
            do {
                t = s == null ? getInitialTransition() : defaultTransitions.get(s);
                path.add(t);
                s = getTargetStates().get(t);
                transitions = validTransitions.get(s);
            } while ((transitions != null) && !transitions.contains(transitionKey));
            if (transitions == null) {
                // no path thru default transitions arrives at a state where the
                // requested transition is valid.
                throw new StateTransitionException(String.format( "transition '%s' is not %s", getTransitionNames().get(transitionKey), stateText));
            }

            // execute the transitions and walk object to the default state
            // where the requested transition can be executed
            OUT result = null;
            for (final String tr : path) {
            	result = invokeTransition(tr, statefulObject, transitionData);
                if( result != null ) {
                	return result;
                }
            }
        }

        // 6. perform pre-trigger to verify or validate transition
        // pre-requisites.
        if (preTriggers == null) {
            preTriggers = new HashMap<String, Trigger<S,?>>( preTriggerRegistry.size());
        }
        OUT result = this.<OUT>runTrigger(this.<OUT>getTrigger(preTriggerRegistry, preTriggers, transitionKey), transitionKey, statefulObject, transitionData);
        if( result != null ) {
        	return result;
        }

	    // 7. update the stateful object's state
	    statefulObject.setCurrentState(getTargetStates().get(transitionKey));

	    // 8. perform post-trigger to notify that transition occurred
        // since transition has occurred, ...
        if (postTriggers == null) {
            postTriggers = new HashMap<String, Trigger<S,?>>(postTriggerRegistry.size());
        }
        return (OUT) runTrigger(getTrigger(postTriggerRegistry, postTriggers, transitionKey), transitionKey, statefulObject, transitionData);

    }

    /**
     * utility method that returns the state key for the stateful object
     * @param statefulObject
     * @return
     */
    private String getObjectState(final S statefulObject) {
        final String state = statefulObject.getCurrentState();
        return findStateKey(state);
    }

	/**
	 * look up utility method that returns the state key for the given state name
	 * @param state
	 * @return
	 */
	private String findStateKey(String state) {
		String stateKey = null;
        if (!isEmpty(state)) {
            state = state.trim();
            for (final Entry<String, String> st : getStateNames().entrySet()) {
                if (st.getKey().equalsIgnoreCase(state)
                        || st.getValue().equalsIgnoreCase(state)) {
                    stateKey = st.getKey();
                    break;
                }
            }
        }

        return stateKey;
	}

    /**
     * look up utility method that returns the transition key for the given transition name
     * @param transition
     * @return
     */
    private String findTransitionKey(final String transition) {
        if (isEmpty(transition)) {
            return null;
        }

        String transitionKey = null;

        for (final Entry<String, String> tr : getTransitionNames().entrySet()) {
            if (tr.getKey().equalsIgnoreCase(transition.trim())
                    || tr.getValue().equalsIgnoreCase(transition.trim())) {
                transitionKey = tr.getKey();
                break;
            }
        }
        return transitionKey;
    }

    /**
     * @return
     */
    private final Map<String,String> getPreTriggers() {
    	return extractTriggerClassNames(preTriggerRegistry);
	}

    /**
     * @return
     */
    private final Map<String,String> getPostTriggers() {
    	return extractTriggerClassNames(postTriggerRegistry);
	}

	/**
	 * @param triggerRegistry
	 * @return
	 */
	private final Map<String, String> extractTriggerClassNames( Map<String, Class<Trigger<S, ?>>> triggerRegistry ) {
		Map<String,String> triggers = new LinkedHashMap<String,String>( triggerRegistry.size() );
    	for( Entry<String, Class<Trigger<S, ?>>> trigger : triggerRegistry.entrySet() ) {
    		triggers.put( trigger.getKey(), trigger.getValue().getName() );
    	}
		return triggers;
	}

    /**
     * utility method that returns an instance of the trigger for the specified transition
     * @param registry
     * @param cache
     * @param transition
     * @return
     * @throws StateTransitionException
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
	private <OUT> Trigger<S,OUT> getTrigger(final Map<String, Class<Trigger<S,?>>> registry, final Map<String, Trigger<S,?>> cache, final String transition) throws StateTransitionException  {
        Trigger<S,OUT> trigger = (Trigger<S,OUT>) cache.get(transition);
        if (trigger == null) {
            final Class triggerClass = registry.get(transition);
            if (triggerClass != null) {
                try {
					trigger = (Trigger<S,OUT>) newTrigger(transition, triggerClass);
				} catch (final MalformedStateMachineException e) {
					throw new StateTransitionException( String.format("unable to load the trigger for transition '%s'.", transition), e );
				}
            }
        }
        return trigger;
    }

    /**
     * utility method that creates an instance of a trigger when state machine is constructed
     * @param transition
     * @param triggerClass
     * @param provider2
     * @param logger
     * @return
     * @throws StateTransitionException
     */
    private Trigger<S,?> newTrigger(final String transition, final Class<Trigger<S,?>> triggerClass) throws MalformedStateMachineException {
    	try {
    		return triggerClass.newInstance();
    	} catch (final Exception e) {
            throw new MalformedStateMachineException( String.format("unable to get trigger for transition '%s'.", getTransitionNames().get(transition)), e );
        }
    }

    /**
     * convenience method that executes pre and post triggers - if they are
     * defined for transition.
     *
     * @param transition
     *            the transition key
     * @param transitionData
     * @param triggerType
     *            the trigger collection that contains the trigger to execute
     *            for the key provided.
     * @return
     * @throws Exception
     *             if the trigger execution failed
     */
    private <OUT> OUT runTrigger(final Trigger<S,OUT> trigger, final String transition, final S obj, final Object... transitionData) throws StateTransitionException {
        // if a trigger has been defined for that transition
        if (trigger != null) {
            // run the trigger. if the transition is invalid, or not
            // authorized or permitted, raise a StateTransitionException.
            return trigger.onTransition( transition, obj, transitionData );
        }

    	return null;
    }

    /**
     * convenience method that advances the object thru its state machine by
     * using the default actions defined for this state machine.
     *
     * @param statefulObject
     *            the object to transition
     * @throws StateTransitionException
     *             if the transition failed
     */
    public final <OUT> OUT advance(final S statefulObject, final Object... transitionData) throws StateTransitionException {
        final String defaultTransition = getNextTransition(statefulObject);
        final Map<String,Serializable> validTransitions = new LinkedHashMap<String, Serializable>();
        Map<String,Object> transitionProperties = null;
        for( final String t : this.validTransitions.get( findStateKey( statefulObject.getCurrentState() ) ) ) {
        	transitionProperties = this.transitionProperties.get( t );
        	if( (transitionProperties == null) || transitionProperties.isEmpty() ) {
                validTransitions.put( t, "*" );
        	} else {
            	validTransitions.put( t, new LinkedHashMap<String, Object>( transitionProperties ) );
        	}
        }
        final String transition = transitionSelector.selectTransition(defaultTransition, validTransitions, statefulObject, transitionData );

        if (transition == null) {
            throw new StateTransitionException(
                    "no transition available for this state");
        }

        return invokeTransition(transition, statefulObject, transitionData);
    }

    /**
     * convenience method that helps advance the object through the state
     * machine by obtaining the next transition to execute based on the default
     * transition from the current state of the object.
     *
     * @param statefulObject
     *            the object to transition
     * @return the next transition to execute on the object
     */
    private String getNextTransition(final S statefulObject) {
        return statefulObject.getCurrentState() == null ? getInitialTransition()
                : defaultTransitions.get(statefulObject.getCurrentState());
    }

    /**
     * convenience method that helps determine if the object has reached a
     * terminal, or end state according to this state machine.
     *
     * @param statefulObject
     *            the object to test
     * @return true if the current state of the object has
     *         transitions defined, false otherwise.
     */
    final boolean isInEndState(final S statefulObject) {
        // make sure an object was provided
        if (statefulObject == null) {
            throw new IllegalArgumentException("must specify an object");
        }

        // if an object was provided, see if its current state is a terminal, or
        // end state
        return isEndState(statefulObject.getCurrentState());
    }

    /**
     * convenience method that helps determine if the state given is a terminal,
     * or end state according to this state machine.
     *
     * @param state
     *            the state to test
     * @return true if the state has transitions defined,
     *         false otherwise.
     */
    final boolean isEndState(final String state) {
        // make sure a state was provided
        if (isEmpty(state)) {
            throw new IllegalArgumentException("must specify a state");
        }

        // check to see that the state is a known and valid state
        boolean isValidState = false;

        for (final Entry<String, String> entry : getStateNames().entrySet()) {
            if (entry.getKey().equalsIgnoreCase(state.trim())
                    || entry.getValue().equalsIgnoreCase(state.trim())) {
                isValidState = true;
                break;
            }
        }
        if (!isValidState) {
            throw new IllegalArgumentException(String.format(
                    "no such state: %s", state));
        }

        // if it is, to be an end state, there must be no transitions defined
        // for it.
        final Set<String> transitions = validTransitions.get(state.trim());
        return (transitions == null) || (transitions.size() == 0);
    }

//    /**
//     * load pre and post triggers
//     * @throws MalformedStateMachineException
//     */
//    public final void loadTriggers() throws MalformedStateMachineException {
//        if (preTriggers == null) {
//            preTriggers = new HashMap<String, Trigger<S,?>>(
//                    preTriggerRegistry.size());
//        }
//        loadTriggerCache(preTriggerRegistry, preTriggers);
//
//        if (postTriggers == null) {
//            postTriggers = new HashMap<String, Trigger<S,?>>(
//                    postTriggerRegistry.size());
//        }
//        loadTriggerCache(postTriggerRegistry, postTriggers);
//    }

    /**
     * Provide default for transient fields here
     *
     * @param in
     * @throws IOException
     * @throws ClassNotFoundException
     */
    private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        preTriggers = null;
        postTriggers = null;
    }

    /**
     * Returns map of state names associated with this state machine
     *
     * @return map of state names
     */
    public final Map<String, String> getStateNames() {
        return new LinkedHashMap<>( stateNames );
    }

    /**
     * @return
     */
    final Map<String, String> getStateDescriptions() {
        return new LinkedHashMap<>( stateDescriptions );
    }

    /**
     * @return
     */
    final Map<String, String> getTransitionNames() {
        return new LinkedHashMap<>( transitionNames );
    }

    /**
     * @return
     */
    final Map<String, String> getTransitionDescriptions() {
        return new LinkedHashMap<>( transitionDescriptions );
    }

    /**
     * @return
     */
    final Map<String, Object> getTransitionProperties( final String transition ) {
    	return new LinkedHashMap<String,Object>( transitionProperties.get( findTransitionKey(transition) ) );
    }

    /**
     * @return
     */
    final Map<String, String> getTargetStates() {
        return new LinkedHashMap<>( targetStates );
    }

    /**
     * @return
     */
    final Set<String> getInitialTransitions() {
        return new LinkedHashSet<>( initialTransitions );
    }

    /**
     * @return
     */
    final String getInitialTransition() {
        return initialTransition;
    }

    /**
     * @return
     */
    public final String getInitialState() {
    	return stateNames.get( targetStates.get( initialTransition ) );
    }

	/**
	 * @param obj
	 * @return
	 */
	public final boolean isDone(final S obj) {
		return isInEndState( obj );
	}

}


text:
/* --------------- Prevents light flicker on dark mode --------------- */

body {
    display: none;
}

.visible {
    display: block;
}

/* --------------- Dark Mode --------------- */

/* Dark color shades, starting with darkest */
:root {
    --dark-color-1: #161c25;
    --dark-color-2: #0c1015;
    --dark-color-3: #191d22;
    --dark-color-4: #1c232f;
    --dark-color-5: #303030;
    --dark-color-6: #222831;
    --dark-color-7: #454545;
    --dark-color-warning: #ffa21d;
    --dark-color-success: #17C666;
    --dark-color-danger: #ea4d4d;
    --dark-color-info: #3ec9d6;
    --dark-text-shade-1: rgb(162 162 162);
}

.dark body,
.dark #wrapper #content-wrapper,
.dark .error_log {
    background-color: var(--dark-color-2);
    color: var(--dark-text-shade-1);
}

.dark .colorpicker-input-addon,
.dark .colorpicker-input-addon::before,
.dark .colorpicker-input-addon:focus,
.dark .input-group-append:focus {
    background-color: var(--dark-color-1);
}

.dark .dropdown-item,
.dark .dropdown-menu,
.dark .topbar .dropdown-list .dropdown-item:active {
    background-color: #161c25;
    color: var(--dark-text-shade-1);
    border-color: #0c1015 !important;
}

.dark .dropdown-item:hover {
    background-color: var(--dark-color-6);
}

.dark .sidebar {
    background-image: linear-gradient(180deg, var(--dark-color-4) 10%, var(--dark-color-4) 100%) !important;
}

.dark .sidebar .nav-item .collapse .collapse-inner .collapse-item:hover,
.dark .sidebar .nav-item .collapsing .collapse-inner .collapse-item:hover,
.dark .sidebar .nav-item .collapse .collapse-inner .active,
.dark .sidebar .nav-item .collapsing .collapse-inner .active,
.dark .topbar #sidebarToggleTop:hover {
    background-color: var(--dark-color-3);
}

.dark input[type="radio"] {
    background-color: var(--dark-text-shade-1) !important;
}

.dark .shadow {
    box-shadow: none !important;
}

.dark .table th,
.dark .table td,
.dark .table thead th,
.dark .border,
.dark .table-bordered {
    border-color: var(--dark-color-3) !important;
}

.dark .text-gray-300,
.dark .text-gray-600,
.dark .text-gray-800,
.dark .text-gray-900,
.dark .topbar.navbar-light .navbar-nav .nav-item .nav-link,
.dark .sidebar .nav-item .collapse .collapse-inner .collapse-item,
.dark .sidebar .nav-item .collapsing .collapse-inner .collapse-item,
.dark .breadcrumb,
.dark .form-control,
.dark .btn-default,
.dark .popover-body,
.dark .popover-header,
.dark .close,
.dark .table {
    color: var(--dark-text-shade-1) !important;
}

.dark .btn-default {
    background-color: var(--dark-color-2);
    border-color: var(--dark-color-3);
}

.dark .paginate_button a,
.dark .pagination .page-item a {
    background-color: var(--dark-color-3) !important;
    border-color: var(--dark-color-2) !important;
}

.dark .list-group-item {
    background-color: #161c25 !important;
}

.dark .bg-white,
.dark .card,
.dark .breadcrumb,
.dark .modal-content,
.dark option:checked {
    background-color: var(--dark-color-4) !important;
}

.dark .card-header {
    background-color: #161c25 !important;
    border: 0;
}

.dark .modal-header,
.dark .modal-footer {
    border-color: var(--dark-color-6);
}

.dark ul.thumbnails.image_picker_selector li .thumbnail {
    border-color: var(--dark-color-7);
}

.dark .form-control,
.dark .dropzone {
    background-color: var(--dark-color-3);
    border: 0;
    color: #bfbfbf !important;
}

.dark .form-control:focus {
    background-color: #21252a !important;
    color: #fff !important;
    box-shadow: none !important;
}

.dark .topbar-divider {
    border-color: var(--dark-color-6);
}

.dark ::-webkit-scrollbar-track,
.dark ::-webkit-scrollbar-corner {
    background: var(--dark-color-2);
}

.dark ::-webkit-scrollbar-thumb {
    background: var(--dark-color-3);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color-5);
}

.dark hr {
    border-color: var(--dark-color-7);
}

.dark .input-group-text.colorpicker-input-addon,
.dark .input-group-text.colorpicker-input-addon:focus {
    border: none !important;
    outline: none;
}

.dark select option:hover,
.dark select option:focus,
.dark select option:active,
.dark select option:checked {
    background: linear-gradient(var(--dark-color-4), var(--dark-color-4)) !important;
    background-color: var(--dark-color-4) !important;
    /* IE Fallback */
}

.dark .text-github {
    color: rgba(255, 255, 255) !important;
}

.dark .nav-item:hover {
    background-color: #161c25 !important;
}

.dark .nav-item.active {
    background-color: #161c25 !important;
}

/* ----------- Popover Darkmode ----------- */
.dark .popover {
    background-color: rgb(12 16 21);
    box-shadow: 2px 2px 2px 2px rgb(12 16 21 / 9%)
}

.dark .popover .arrow,
.dark .popover .arrow::after {
    border-top-color: #202630 !important;
}

.dark .card-header,
.dark .popover-body,
.dark .popover-header {
    background-color: #202630 !important;
    border-color: #0c1015 !important;
}

/* ----------- Text Darkmode ----------- */
.dark .text-warning {
    color: var(--dark-color-warning) !important;
}

.dark .text-success {
    color: var(--dark-color-success) !important;
}

.dark .text-danger {
    color: var(--dark-color-danger) !important;
}

.dark .text-info {
    color: var(--dark-color-info) !important;
}

/* ----------- Alerts Dark mode ----------- */
.dark .alert-warning {
    color: #ffffff;
    background-color: var(--dark-color-warning) !important;
    border-color: var(--dark-color-warning) !important;
}

.dark .alert-success {
    color: #ffffff;
    background-color: var(--dark-color-success) !important;
    border-color: var(--dark-color-success) !important;
}

.dark .alert-danger {
    color: #ffffff;
    background-color: var(--dark-color-danger) !important;
    border-color: var(--dark-color-danger) !important;
}

.dark .alert-info {
    color: #ffffff;
    background-color: var(--dark-color-info) !important;
    border-color: var(--dark-color-info) !important;
}

/* --------------- Badge Dark mode --------------- */
.dark .badge-warning {
    color: #ffffff;
    background-color: var(--dark-color-warning) !important;
}

.dark .badge-success {
    color: #ffffff;
    background-color: var(--dark-color-success) !important;
}

.dark .badge-danger {
    color: #ffffff;
    background-color: var(--dark-color-danger) !important;
}

.dark .badge-info {
    color: #ffffff;
    background-color: var(--dark-color-info) !important;
}

/* --------------- Dark Mode BG --------------- */
.dark .bg-warning {
    background-color: var(--dark-color-warning) !important;
}

.dark .bg-success {
    background-color: var(--dark-color-success) !important;
}

.dark .bg-danger {
    background-color: var(--dark-color-danger) !important;
}

.dark .bg-info {
    background-color: var(--dark-color-info) !important;
}

/* --------------- Scrollbar --------------- */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: #C0C0C0;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #B8B8B8;
}

/* --------------- Sidebar --------------- */

.sidebar {
    z-index: 999;
}

@media (min-width: 768px) {
    .sidebar {
        width: 17rem !important;
    }

    .sidebar.toggled {
        width: 7rem !important;
        scrollbar-width: thin;
    }

    .sidebar .nav-item .nav-link {
        width: 16.5rem;
        padding: .70rem 1rem;
    }

    .sidebar .nav-item .nav-link span {
        font-size: .90rem;
    }
}

@media (max-width: 768px) {
    .sidebar.toggled+#content-wrapper {
        margin-left: 0 !important;
    }
}

/* --------------- Other --------------- */

body {
    color: #56575b;
}

.btn-user,
.form-control-user {
    border-radius: .35rem !important;
}

.thumbnails li img {
    width: 60px;
}

.dropdown-menu-lg {
    max-width: none;
}

.collapse-item {
    white-space: normal !important;
}

.table-hover.dataTables-users tbody tr {
    cursor: pointer;
}

.btn.disabled,
.btn:disabled {
    pointer-events: none;
}

a,
i,
#sidebarToggle,
.alert span,
.alert button,
.close {
    transition: .25s;
}

.card {
    border: none;
}

.btn-accordion {
    text-decoration: none !important;
    box-shadow: none !important;
}

.alert span:hover,
.alert button:hover {
    color: #FFF;
}

.btn-default {
    border: 1px solid #d1d3e2;
    background-color: #f4f4f4;
    color: #444 !important;
}

@media (max-width: 575px) {
    #content .breadcrumb {
        background-color: transparent !important;
        padding: initial !important;
        margin-top: 10px;
    }
}

@media (max-width: 767px) {
    form .col-md-6:last-child {
        padding-top: 10px;
    }
}

.CodeMirror {
    border: 1px solid #ddd;
}

.profile-user-img {
    max-width: 50%;
}

footer.sticky-footer {
    padding: 1.4rem 0;
}

.font-size-sa {
    font-size: small;
}

.text-discord {
    color: #7289da !important;
}

.text-github {
    color: rgba(0, 0, 0) !important;
}

.custom-switch>.custom-control-label::before {
    /* slightly larger than default */
    top: 0.20rem;
    height: 1.1rem;
    width: 1.85rem;
    border-radius: 0.6rem;
}

.toast .move-right {
    position: absolute;
    left: 20px;
}

@media only screen and (max-width: 425px) {
    .statistics {
        display: none;
    }
}


text:
class ChangeUsUserPreferences < ActiveRecord::Migration

  def down
    if !Redmine::Plugin.installed?(:a_common_libs) && UserPreference.respond_to?(:favourite_project_id)
      remove_column :user_preferences, :favourite_project_id
    end
  end

end


text:
package com.dell.doradus.olap.io;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.dell.doradus.service.db.DBService;
import com.dell.doradus.service.db.DBTransaction;
import com.dell.doradus.service.db.DColumn;
import com.dell.doradus.service.db.Tenant;

public class CassandraIO implements IO {
    private final Tenant m_tenant;

	public CassandraIO(Tenant tenant) {
	    m_tenant = tenant;
	}

	@Override
	public byte[] getValue(String app, String key, String column) {
		DColumn col = DBService.instance().getColumn(m_tenant, app, key, column);
		if(col == null) return null;
		return col.getRawValue();
	}

	@Override
	public List<ColumnValue> get(String app, String key, String prefix) {
		List<ColumnValue> result = new ArrayList<ColumnValue>();
		Iterator<DColumn> iColumns = DBService.instance().getColumnSlice(m_tenant, app, key, prefix, prefix + "\uFFFF");
		while (iColumns.hasNext()) {
			DColumn column = iColumns.next();
			result.add(new ColumnValue(column.getName().substring(prefix.length()), column.getRawValue()));
		}
		return result;
	}

	@Override
	public void createCF(String name) {
	}

	@Override
	public void deleteCF(String name) {
	}

	@Override
	public void delete(String columnFamily, String key, String columnName) {
		DBTransaction transaction = DBService.instance().startTransaction(m_tenant);
		if (columnName == null) {
			transaction.deleteRow(columnFamily, key);
		} else {
			transaction.deleteColumn(columnFamily, key, columnName);
		}
		DBService.instance().commit(transaction);
	}

	@Override public void write(String app, String key, List<ColumnValue> values) {
	    DBTransaction transaction = DBService.instance().startTransaction(m_tenant);
	    for(ColumnValue v : values) {
	        transaction.addColumn(app, key, v.columnName, v.columnValue);
	    }
	    DBService.instance().commit(transaction);
	}

}


text:
swoole的一些例子

leetcode的python实现


text:
require "integration_test_helper"
require "app"

class ElasticsearchDeletionTest < IntegrationTest
  def setup
    stub_elasticsearch_settings
    create_test_indexes
  end

  def teardown
    clean_test_indexes
  end

  def test_removes_a_document_from_the_index
    commit_document("mainstream_test", {
      "link" => "/an-example-page"
    })

    delete "/documents/%2Fan-example-page"

    assert_document_missing_in_rummager(link: "/an-example-page")
  end

  def test_removes_a_document_from_the_index_queued
    app.settings.enable_queue = true
    commit_document("mainstream_test", {
      "link" => "/an-example-page"
    })

    delete "/documents/%2Fan-example-page"

    assert_equal 202, last_response.status
    assert_document_missing_in_rummager(link: "/an-example-page")
  end

  def test_removes_document_with_url
    commit_document("mainstream_test", {
      "link" => "http://example.com/",
    })

    delete "/documents/edition/http:%2F%2Fexample.com%2F"

    assert last_response.ok?
    assert_document_missing_in_rummager(link: "http://example.com/")
  end

  def test_should_delete_a_best_bet_by_type_and_id
    post "/metasearch_test/documents", {
      "_id" => "jobs_exact",
      "_type" => "best_bet",
      "link" => "/something",
    }.to_json

    commit_index

    delete "/metasearch_test/documents/best_bet/jobs_exact"

    assert_raises RestClient::ResourceNotFound do
      RestClient.get("http://localhost:9200/metasearch_test/best_bet/jobs_exact")
    end
  end

private

  def assert_document_missing_in_rummager(link:)
    assert_raises RestClient::ResourceNotFound do
      fetch_document_from_rummager(link: link)
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<TestPlan>
   <Test>7</Test>
   <RegistryEndpoint>http://129.6.24.109:9080/axis2/services/xdsregistryb</RegistryEndpoint>
    <TestStep id="object_type">
        <ExpectedStatus>Failure</ExpectedStatus>
        <ExpectedErrorMessage>XDSDocumentEntry has incorrect objectType</ExpectedErrorMessage>
        <RegisterTransaction>
            <XDSb/>
            <MetadataFile>single_doc.xml</MetadataFile>
        </RegisterTransaction>
    </TestStep>
</TestPlan>


text:
@interface NSAMethod ()

- (instancetype)initWithMethod:(Method)method;
+ (instancetype)methodWithMethod:(Method)method;

@end

@implementation NSAClass

@synthesize class=_class;

- (id)initWithClass:(Class)class {
    [self release];
    return (id)class;
}

+ (id)classWithClass:(Class)class {
    return class;
}

+ (id)classWithUTF8Name:(const char *)name {
    return [self classWithClass:objc_getClass(name)];
}

+ (id)classWithName:(NSString *)name {
    return [self classWithUTF8Name:name.UTF8String];
}

@end

@implementation NSObject (NSAClassDeprecated)

+ (const char *)UTF8Name {
    return class_getName(self);
}

+ (id)superclassObject {
    return (id)[self superclass];
}

@end

@implementation NSObject (NSAClass)

- (NSAClass *)classObject {
    return [NSAClass classWithClass:self.class];
}

+ (NSAClass *)classObject {
    return [NSAClass classWithClass:self];
}

@end


text:
package org.apache.tinkerpop.gremlin.process.traversal.step.map;

import org.apache.tinkerpop.gremlin.LoadGraphWith;
import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
import org.apache.tinkerpop.gremlin.process.traversal.Scope;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.bothE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
@RunWith(GremlinProcessRunner.class)
public abstract class MeanTest extends AbstractGremlinProcessTest {

    public abstract Traversal<Vertex, Double> get_g_V_age_mean();

    public abstract Traversal<Vertex, Double> get_g_V_age_fold_meanXlocalX();

    public abstract Traversal<Vertex, Number> get_g_V_foo_mean();

    public abstract Traversal<Vertex, Number> get_g_V_foo_fold_meanXlocalX();

    public abstract Traversal<Vertex, Map<String, Number>> get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX();

    public abstract Traversal<Vertex, Double> get_g_V_aggregateXaX_byXageX_meanXlocalX();

    public abstract Traversal<Vertex, Double> get_g_V_aggregateXaX_byXageX_capXaX_unfold_mean();

    public abstract Traversal<Vertex, Double> get_g_V_aggregateXaX_byXfooX_meanXlocalX();

    public abstract Traversal<Vertex, Double> get_g_V_aggregateXaX_byXfooX_capXaX_unfold_mean();

    public abstract Traversal<Integer, Double> get_g_injectXnull_10_20_nullX_mean();

    public abstract Traversal<List<Integer>, Double> get_g_injectXlistXnull_10_20_nullXX_meanXlocalX();

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_age_mean() {
        for (final Traversal<Vertex, Double> traversal : Arrays.asList(get_g_V_age_mean(), get_g_V_age_fold_meanXlocalX())) {
            printTraversalForm(traversal);
            final Double mean = traversal.next();
            assertEquals(30.75, mean, 0.05);
            assertFalse(traversal.hasNext());
        }
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_foo_mean() {
        for (final Traversal<Vertex, Number> traversal : Arrays.asList(get_g_V_foo_mean(), get_g_V_foo_fold_meanXlocalX())) {
            printTraversalForm(traversal);
            assertFalse(traversal.hasNext());
        }
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_aggregateXaX_byXfooX_meanXlocalX() {
        final Traversal<Vertex, Double> traversal = get_g_V_aggregateXaX_byXfooX_meanXlocalX();
        printTraversalForm(traversal);
        assertFalse(traversal.hasNext());
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_aggregateXaX_byXfooX_capXaX_unfold_mean() {
        final Traversal<Vertex, Double> traversal = get_g_V_aggregateXaX_byXfooX_capXaX_unfold_mean();
        printTraversalForm(traversal);
        assertFalse(traversal.hasNext());
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX() {
        final Traversal<Vertex, Map<String, Number>> traversal = get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX();
        printTraversalForm(traversal);
        assertTrue(traversal.hasNext());
        final Map<String, Number> map = traversal.next();
        assertFalse(traversal.hasNext());
        assertEquals(2, map.size());
        assertEquals(1.0, map.get("ripple"));
        assertEquals(1.0 / 3, map.get("lop"));
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_V_aggregateXaX_byXageX_meanXlocalX() {
        for (final Traversal<Vertex, Double> traversal : Arrays.asList(get_g_V_aggregateXaX_byXageX_capXaX_unfold_mean(), get_g_V_aggregateXaX_byXageX_meanXlocalX())) {
            printTraversalForm(traversal);
            final Double mean = traversal.next();
            assertEquals(30.75, mean, 0.05);
            assertFalse(traversal.hasNext());
        }
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_injectXnull_10_20_nullX_mean() {
        final Traversal<Integer, Double> traversal = get_g_injectXnull_10_20_nullX_mean();
        printTraversalForm(traversal);
        final Double mean = traversal.next();
        assertEquals(15.00, mean, 0.05);
        assertFalse(traversal.hasNext());
    }

    @Test
    @LoadGraphWith(MODERN)
    public void g_injectXlistXnull_10_20_nullXX_meanXlocalX() {
        final Traversal<List<Integer>, Double> traversal = get_g_injectXlistXnull_10_20_nullXX_meanXlocalX();
        printTraversalForm(traversal);
        final Double mean = traversal.next();
        assertEquals(15.00, mean, 0.05);
        assertFalse(traversal.hasNext());
    }

    public static class Traversals extends MeanTest {

        @Override
        public Traversal<Vertex, Double> get_g_V_age_mean() {
            return g.V().values("age").mean();
        }

        @Override
        public Traversal<Vertex, Double> get_g_V_aggregateXaX_byXfooX_meanXlocalX() {
            return g.V().aggregate("a").by("foo").cap("a").mean(Scope.local);
        }

        @Override
        public Traversal<Vertex, Double> get_g_V_aggregateXaX_byXfooX_capXaX_unfold_mean() {
            return g.V().aggregate("a").by("foo").cap("a").unfold().mean();
        }

        @Override
        public Traversal<Vertex, Double> get_g_V_age_fold_meanXlocalX() {
            return g.V().values("age").fold().mean(Scope.local);
        }

        @Override
        public Traversal<Vertex, Number> get_g_V_foo_mean() {
            return g.V().values("foo").mean();
        }

        @Override
        public Traversal<Vertex, Number> get_g_V_foo_fold_meanXlocalX() {
            return g.V().values("foo").fold().mean(Scope.local);
        }

        @Override
        public Traversal<Vertex, Map<String, Number>> get_g_V_hasLabelXsoftwareX_group_byXnameX_byXbothE_weight_meanX() {
            return g.V().hasLabel("software").<String, Number>group().by("name").by(bothE().values("weight").mean());
        }

        @Override
        public Traversal<Vertex, Double> get_g_V_aggregateXaX_byXageX_meanXlocalX() {
            return g.V().aggregate("a").by("age").cap("a").mean(Scope.local);
        }

        @Override
        public Traversal<Vertex, Double> get_g_V_aggregateXaX_byXageX_capXaX_unfold_mean() {
            return g.V().aggregate("a").by("age").cap("a").unfold().mean();
        }

        @Override
        public Traversal<Integer, Double> get_g_injectXnull_10_20_nullX_mean() {
            return g.inject(null, 10, 20, null).mean();
        }

        @Override
        public Traversal<List<Integer>, Double> get_g_injectXlistXnull_10_20_nullXX_meanXlocalX() {
            return g.inject(Arrays.asList(null, 10, 20, null)).mean(Scope.local);
        }
    }
}


text:
package org.apache.hadoop.hdds.scm.client;

import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
import org.apache.hadoop.hdds.scm.container.ContainerInfo;
import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos
    .ContainerData;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;

import java.io.Closeable;
import java.io.IOException;
import java.util.List;

/**
 * The interface to call into underlying container layer.
 *
 * Written as interface to allow easy testing: implement a mock container layer
 * for standalone testing of CBlock API without actually calling into remote
 * containers. Actual container layer can simply re-implement this.
 *
 * NOTE this is temporarily needed class. When SCM containers are full-fledged,
 * this interface will likely be removed.
 */
@InterfaceStability.Unstable
public interface ScmClient extends Closeable {
  /**
   * Creates a Container on SCM and returns the pipeline.
   * @return ContainerInfo
   * @throws IOException
   */
  ContainerWithPipeline createContainer(String owner) throws IOException;

  /**
   * Gets a container by Name -- Throws if the container does not exist.
   * @param containerId - Container ID
   * @return Pipeline
   * @throws IOException
   */
  ContainerInfo getContainer(long containerId) throws IOException;

  /**
   * Gets a container by Name -- Throws if the container does not exist.
   * @param containerId - Container ID
   * @return ContainerWithPipeline
   * @throws IOException
   */
  ContainerWithPipeline getContainerWithPipeline(long containerId)
      throws IOException;

  /**
   * Close a container.
   *
   * @param containerId - ID of the container.
   * @param pipeline - Pipeline where the container is located.
   * @throws IOException
   */
  void closeContainer(long containerId, Pipeline pipeline) throws IOException;

  /**
   * Close a container.
   *
   * @param containerId - ID of the container.
   * @throws IOException
   */
  void closeContainer(long containerId) throws IOException;

  /**
   * Deletes an existing container.
   * @param containerId - ID of the container.
   * @param pipeline - Pipeline that represents the container.
   * @param force - true to forcibly delete the container.
   * @throws IOException
   */
  void deleteContainer(long containerId, Pipeline pipeline, boolean force)
      throws IOException;

  /**
   * Deletes an existing container.
   * @param containerId - ID of the container.
   * @param force - true to forcibly delete the container.
   * @throws IOException
   */
  void deleteContainer(long containerId, boolean force) throws IOException;

  /**
   * Lists a range of containers and get their info.
   *
   * @param startContainerID start containerID.
   * @param count count must be > 0.
   *
   * @return a list of pipeline.
   * @throws IOException
   */
  List<ContainerInfo> listContainer(long startContainerID,
      int count) throws IOException;

  /**
   * Read meta data from an existing container.
   * @param containerID - ID of the container.
   * @param pipeline - Pipeline where the container is located.
   * @return ContainerInfo
   * @throws IOException
   */
  ContainerData readContainer(long containerID, Pipeline pipeline)
      throws IOException;

  /**
   * Read meta data from an existing container.
   * @param containerID - ID of the container.
   * @return ContainerInfo
   * @throws IOException
   */
  ContainerData readContainer(long containerID)
      throws IOException;

  /**
   * Gets the container size -- Computed by SCM from Container Reports.
   * @param containerID - ID of the container.
   * @return number of bytes used by this container.
   * @throws IOException
   */
  long getContainerSize(long containerID) throws IOException;

  /**
   * Creates a Container on SCM and returns the pipeline.
   * @param type - Replication Type.
   * @param replicationFactor - Replication Factor
   * @return ContainerInfo
   * @throws IOException - in case of error.
   */
  ContainerWithPipeline createContainer(HddsProtos.ReplicationType type,
      HddsProtos.ReplicationFactor replicationFactor,
      String owner) throws IOException;

  /**
   * Returns a set of Nodes that meet a query criteria.
   * @param nodeStatuses - Criteria that we want the node to have.
   * @param queryScope - Query scope - Cluster or pool.
   * @param poolName - if it is pool, a pool name is required.
   * @return A set of nodes that meet the requested criteria.
   * @throws IOException
   */
  List<HddsProtos.Node> queryNode(HddsProtos.NodeState nodeStatuses,
      HddsProtos.QueryScope queryScope, String poolName) throws IOException;

  /**
   * Creates a specified replication pipeline.
   * @param type - Type
   * @param factor - Replication factor
   * @param nodePool - Set of machines.
   * @throws IOException
   */
  Pipeline createReplicationPipeline(HddsProtos.ReplicationType type,
      HddsProtos.ReplicationFactor factor, HddsProtos.NodePool nodePool)
      throws IOException;
}


text:
package com.whoa.leventejonas.marvelous.feature.base.activity;

import android.app.SearchManager;
import android.content.Context;
import android.support.v7.widget.SearchView;
import android.view.Menu;
import android.view.MenuItem;

import com.whoa.leventejonas.marvelous.R;

/**
 * Created by leventejonas on 11/07/17.
 */

public abstract class BaseListActivity extends BaseDrawerActivity {

    protected SearchView searchView;

    @Override
    protected int toolbarMenu() {
        return R.menu.menu_toolbar_list;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuItem menuItem = menu.findItem(R.id.menu_search);
        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        searchView = (SearchView) menuItem.getActionView();
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setOnQueryTextListener(searchQueryTextListener());
        searchView.setOnCloseListener(searchCloseListener());
        return true;
    }

    protected abstract SearchView.OnQueryTextListener searchQueryTextListener();

    protected abstract SearchView.OnCloseListener searchCloseListener();
}


text:
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.opensim.modeling;

/**
 *  This is a fixed length column vector designed for no-overhead inline

 * computation.

 *

 *
 */
public class SpatialVec {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  public SpatialVec(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(SpatialVec obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        opensimSimbodyJNI.delete_SpatialVec(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  /**
   *  The number of elements in this Vec (note that stride does not

   *     affect this number.) *
   */
  public static int size() {
    return opensimSimbodyJNI.SpatialVec_size();
  }

  /**
   *  The number of rows in a Vec is the number of elements. *
   */
  public static int nrow() {
    return opensimSimbodyJNI.SpatialVec_nrow();
  }

  /**
   *  The number of columns in a Vec is always 1. *
   */
  public static int ncol() {
    return opensimSimbodyJNI.SpatialVec_ncol();
  }

  /**
   *  Default construction initializes %Vec's elements to NaN when debugging

   *     but leaves them uninitialized garbage otherwise, so declarations have zero

   *     cost in Release builds. *
   */
  public SpatialVec() {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_0(), true);
  }

  /**
   *  Copy constructor copies the logically-included elements from the

   *     source %Vec; gaps due to stride are not accessed in either source or

   *     destination. *
   */
  public SpatialVec(SpatialVec src) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_1(SpatialVec.getCPtr(src), src), true);
  }

  /**
   *  Construction from a single value of this %Vec's element type assigns

   *     that value to each element. *
   */
  public SpatialVec(Vec3 e) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_2(Vec3.getCPtr(e), e), true);
  }

  /**
   *  Given an int value, turn it into a suitable floating point number,

   *     convert that to element type E and then feed that to the above

   *     single-element constructor.

   *     @see Vec#Vec(SWIGTYPE_p_E). *
   */
  public SpatialVec(int i) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_3(i), true);
  }

  /**
   *  Construct a Vec<2,E> from two elements of type E, etc. *
   */
  public SpatialVec(Vec3 e0, Vec3 e1) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_4(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_5(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2, Vec3 e3) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_6(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2, Vec3.getCPtr(e3), e3), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2, Vec3 e3, Vec3 e4) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_7(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2, Vec3.getCPtr(e3), e3, Vec3.getCPtr(e4), e4), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2, Vec3 e3, Vec3 e4, Vec3 e5) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_8(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2, Vec3.getCPtr(e3), e3, Vec3.getCPtr(e4), e4, Vec3.getCPtr(e5), e5), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2, Vec3 e3, Vec3 e4, Vec3 e5, Vec3 e6) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_9(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2, Vec3.getCPtr(e3), e3, Vec3.getCPtr(e4), e4, Vec3.getCPtr(e5), e5, Vec3.getCPtr(e6), e6), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2, Vec3 e3, Vec3 e4, Vec3 e5, Vec3 e6, Vec3 e7) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_10(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2, Vec3.getCPtr(e3), e3, Vec3.getCPtr(e4), e4, Vec3.getCPtr(e5), e5, Vec3.getCPtr(e6), e6, Vec3.getCPtr(e7), e7), true);
  }

  public SpatialVec(Vec3 e0, Vec3 e1, Vec3 e2, Vec3 e3, Vec3 e4, Vec3 e5, Vec3 e6, Vec3 e7, Vec3 e8) {
    this(opensimSimbodyJNI.new_SpatialVec__SWIG_11(Vec3.getCPtr(e0), e0, Vec3.getCPtr(e1), e1, Vec3.getCPtr(e2), e2, Vec3.getCPtr(e3), e3, Vec3.getCPtr(e4), e4, Vec3.getCPtr(e5), e5, Vec3.getCPtr(e6), e6, Vec3.getCPtr(e7), e7, Vec3.getCPtr(e8), e8), true);
  }

  /**
   *  Set every scalar in this %Vec to NaN; this is the default initial

   *     value in Debug builds, but not in Release. *
   */
  public void setToNaN() {
    opensimSimbodyJNI.SpatialVec_setToNaN(swigCPtr, this);
  }

  /**
   *  Set every scalar in this %Vec to zero. *
   */
  public void setToZero() {
    opensimSimbodyJNI.SpatialVec_setToZero(swigCPtr, this);
  }

  /**
   *  Return true if any element of this Vec contains a NaN anywhere. *
   */
  public boolean isNaN() {
    return opensimSimbodyJNI.SpatialVec_isNaN(swigCPtr, this);
  }

  /**
   *  Return true if any element of this Vec contains a +Infinity

   *     or -Infinity somewhere but no element contains a NaN anywhere. *
   */
  public boolean isInf() {
    return opensimSimbodyJNI.SpatialVec_isInf(swigCPtr, this);
  }

  /**
   *  Return true if no element of this %Vec contains an Infinity or a NaN

   *     anywhere. *
   */
  public boolean isFinite() {
    return opensimSimbodyJNI.SpatialVec_isFinite(swigCPtr, this);
  }

  /**
   *  For approximate comparisions, the default tolerance to use for a vector is

   *     the same as its elements' default tolerance. *
   */
  public static double getDefaultTolerance() {
    return opensimSimbodyJNI.SpatialVec_getDefaultTolerance();
  }

  /**
   *  %Test whether every element of this vector is numerically equal to the given

   *     element, using either a specified tolerance or the vector's

   *     default tolerance (which is always the same or looser than the default

   *     tolerance for one of its elements). *
   */
  public boolean isNumericallyEqual(Vec3 e, double tol) {
    return opensimSimbodyJNI.SpatialVec_isNumericallyEqual__SWIG_2(swigCPtr, this, Vec3.getCPtr(e), e, tol);
  }

  /**
   *  %Test whether every element of this vector is numerically equal to the given

   *     element, using either a specified tolerance or the vector's

   *     default tolerance (which is always the same or looser than the default

   *     tolerance for one of its elements). *
   */
  public boolean isNumericallyEqual(Vec3 e) {
    return opensimSimbodyJNI.SpatialVec_isNumericallyEqual__SWIG_3(swigCPtr, this, Vec3.getCPtr(e), e);
  }

  /**
   *  Print Vec into a string and return it.  Please refer to operator<< for details. *
   */
  public String toString() {
    return opensimSimbodyJNI.SpatialVec_toString(swigCPtr, this);
  }

  /**
   *  Variant of operator[] that's scripting friendly to set ith entry *
   */
  public void set(int i, Vec3 value) {
    opensimSimbodyJNI.SpatialVec_set(swigCPtr, this, i, Vec3.getCPtr(value), value);
  }

  /**
   *  Variant of operator[] that's scripting friendly to get const reference to ith entry *
   */
  public Vec3 get(int i) {
    return new Vec3(opensimSimbodyJNI.SpatialVec_get(swigCPtr, this, i), false);
  }

}