text:
package org.apache.hadoop.yarn.webapp.util;

import static org.apache.hadoop.yarn.util.StringHelper.PATH_JOINER;

import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;

import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.http.HttpConfig.Policy;
import org.apache.hadoop.http.HttpServer2;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.conf.HAUtil;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.util.RMHAUtils;

@Private
@Evolving
public class WebAppUtils {
  public static final String WEB_APP_TRUSTSTORE_PASSWORD_KEY =
      "ssl.server.truststore.password";
  public static final String WEB_APP_KEYSTORE_PASSWORD_KEY =
      "ssl.server.keystore.password";
  public static final String WEB_APP_KEY_PASSWORD_KEY =
      "ssl.server.keystore.keypassword";
  public static final String HTTPS_PREFIX = "https://";
  public static final String HTTP_PREFIX = "http://";

  public static void setRMWebAppPort(Configuration conf, int port) {
    String hostname = getRMWebAppURLWithoutScheme(conf);
    hostname =
        (hostname.contains(":")) ? hostname.substring(0, hostname.indexOf(":"))
            : hostname;
    setRMWebAppHostnameAndPort(conf, hostname, port);
  }

  public static void setRMWebAppHostnameAndPort(Configuration conf,
      String hostname, int port) {
    String resolvedAddress = hostname + ":" + port;
    if (YarnConfiguration.useHttps(conf)) {
      conf.set(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS, resolvedAddress);
    } else {
      conf.set(YarnConfiguration.RM_WEBAPP_ADDRESS, resolvedAddress);
    }
  }

  public static void setNMWebAppHostNameAndPort(Configuration conf,
      String hostName, int port) {
    if (YarnConfiguration.useHttps(conf)) {
      conf.set(YarnConfiguration.NM_WEBAPP_HTTPS_ADDRESS,
          hostName + ":" + port);
    } else {
      conf.set(YarnConfiguration.NM_WEBAPP_ADDRESS,
          hostName + ":" + port);
    }
  }

  public static String getRMWebAppURLWithScheme(Configuration conf) {
    return getHttpSchemePrefix(conf) + getRMWebAppURLWithoutScheme(conf);
  }

  public static String getRMWebAppURLWithoutScheme(Configuration conf) {
    if (YarnConfiguration.useHttps(conf)) {
      return conf.get(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS,
          YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS);
    }else {
      return conf.get(YarnConfiguration.RM_WEBAPP_ADDRESS,
          YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS);
    }
  }

  public static List<String> getProxyHostsAndPortsForAmFilter(
      Configuration conf) {
    List<String> addrs = new ArrayList<String>();
    String proxyAddr = conf.get(YarnConfiguration.PROXY_ADDRESS);
    // If PROXY_ADDRESS isn't set, fallback to RM_WEBAPP(_HTTPS)_ADDRESS
    // There could be multiple if using RM HA
    if (proxyAddr == null || proxyAddr.isEmpty()) {
      // If RM HA is enabled, try getting those addresses
      if (HAUtil.isHAEnabled(conf)) {
        List<String> haAddrs =
            RMHAUtils.getRMHAWebappAddresses(new YarnConfiguration(conf));
        for (String addr : haAddrs) {
          try {
            InetSocketAddress socketAddr = NetUtils.createSocketAddr(addr);
            addrs.add(getResolvedAddress(socketAddr));
          } catch(IllegalArgumentException e) {
            // skip if can't resolve
          }
        }
      }
      // If couldn't resolve any of the addresses or not using RM HA, fallback
      if (addrs.isEmpty()) {
        addrs.add(getResolvedRMWebAppURLWithoutScheme(conf));
      }
    } else {
      addrs.add(proxyAddr);
    }
    return addrs;
  }

  public static String getProxyHostAndPort(Configuration conf) {
    String addr = conf.get(YarnConfiguration.PROXY_ADDRESS);
    if(addr == null || addr.isEmpty()) {
      addr = getResolvedRMWebAppURLWithoutScheme(conf);
    }
    return addr;
  }

  public static String getResolvedRemoteRMWebAppURLWithScheme(
      Configuration conf) {
    return getHttpSchemePrefix(conf)
        + getResolvedRemoteRMWebAppURLWithoutScheme(conf);
  }

  public static String getResolvedRMWebAppURLWithScheme(Configuration conf) {
    return getHttpSchemePrefix(conf)
        + getResolvedRMWebAppURLWithoutScheme(conf);
  }

  public static String getResolvedRemoteRMWebAppURLWithoutScheme(
      Configuration conf) {
    return getResolvedRemoteRMWebAppURLWithoutScheme(conf,
        YarnConfiguration.useHttps(conf) ? Policy.HTTPS_ONLY : Policy.HTTP_ONLY);
  }

  public static String getResolvedRMWebAppURLWithoutScheme(Configuration conf) {
    return getResolvedRMWebAppURLWithoutScheme(conf,
        YarnConfiguration.useHttps(conf) ? Policy.HTTPS_ONLY : Policy.HTTP_ONLY);
  }

  public static String getResolvedRMWebAppURLWithoutScheme(Configuration conf,
      Policy httpPolicy) {
    InetSocketAddress address = null;
    if (httpPolicy == Policy.HTTPS_ONLY) {
      address =
          conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS,
              YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS,
              YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
    } else {
      address =
          conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS,
              YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS,
              YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
    }
    return getResolvedAddress(address);
  }

  public static String getResolvedRemoteRMWebAppURLWithoutScheme(Configuration conf,
      Policy httpPolicy) {
    InetSocketAddress address = null;
    String rmId = null;
    if (HAUtil.isHAEnabled(conf)) {
      // If HA enabled, pick one of the RM-IDs and rely on redirect to go to
      // the Active RM
      rmId = (String) HAUtil.getRMHAIds(conf).toArray()[0];
    }

    if (httpPolicy == Policy.HTTPS_ONLY) {
      address =
          conf.getSocketAddr(
              rmId == null
                  ? YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS
                  : HAUtil.addSuffix(
                  YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS, rmId),
              YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS,
              YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
    } else {
      address =
          conf.getSocketAddr(
              rmId == null
                  ? YarnConfiguration.RM_WEBAPP_ADDRESS
                  : HAUtil.addSuffix(
                  YarnConfiguration.RM_WEBAPP_ADDRESS, rmId),
              YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS,
              YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
    }
    return getResolvedAddress(address);
  }

  public static String getResolvedAddress(InetSocketAddress address) {
    address = NetUtils.getConnectAddress(address);
    StringBuilder sb = new StringBuilder();
    InetAddress resolved = address.getAddress();
    if (resolved == null || resolved.isAnyLocalAddress() ||
        resolved.isLoopbackAddress()) {
      String lh = address.getHostName();
      try {
        lh = InetAddress.getLocalHost().getCanonicalHostName();
      } catch (UnknownHostException e) {
        //Ignore and fallback.
      }
      sb.append(lh);
    } else {
      sb.append(address.getHostName());
    }
    sb.append(":").append(address.getPort());
    return sb.toString();
  }

  /**
   * Get the URL to use for binding where bind hostname can be specified
   * to override the hostname in the webAppURLWithoutScheme. Port specified in the
   * webAppURLWithoutScheme will be used.
   *
   * @param conf the configuration
   * @param hostProperty bind host property name
   * @param webAppURLWithoutScheme web app URL without scheme String
   * @return String representing bind URL
   */
  public static String getWebAppBindURL(
      Configuration conf,
      String hostProperty,
      String webAppURLWithoutScheme) {

    // If the bind-host setting exists then it overrides the hostname
    // portion of the corresponding webAppURLWithoutScheme
    String host = conf.getTrimmed(hostProperty);
    if (host != null && !host.isEmpty()) {
      if (webAppURLWithoutScheme.contains(":")) {
        webAppURLWithoutScheme = host + ":" + webAppURLWithoutScheme.split(":")[1];
      }
      else {
        throw new YarnRuntimeException("webAppURLWithoutScheme must include port specification but doesn't: " +
                                       webAppURLWithoutScheme);
      }
    }

    return webAppURLWithoutScheme;
  }

  public static String getNMWebAppURLWithoutScheme(Configuration conf) {
    if (YarnConfiguration.useHttps(conf)) {
      return conf.get(YarnConfiguration.NM_WEBAPP_HTTPS_ADDRESS,
        YarnConfiguration.DEFAULT_NM_WEBAPP_HTTPS_ADDRESS);
    } else {
      return conf.get(YarnConfiguration.NM_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_NM_WEBAPP_ADDRESS);
    }
  }

  public static String getAHSWebAppURLWithoutScheme(Configuration conf) {
    return getTimelineReaderWebAppURL(conf);
  }

  public static String getTimelineReaderWebAppURL(Configuration conf) {
    if (YarnConfiguration.useHttps(conf)) {
      return conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS);
    } else {
      return conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS);
    }
  }

  /**
   * if url has scheme then it will be returned as it is else it will return
   * url with scheme.
   * @param schemePrefix eg. http:// or https://
   * @param url
   * @return url with scheme
   */
  public static String getURLWithScheme(String schemePrefix, String url) {
    // If scheme is provided then it will be returned as it is
    if (url.indexOf("://") > 0) {
      return url;
    } else {
      return schemePrefix + url;
    }
  }

  public static String getRunningLogURL(
      String nodeHttpAddress, String containerId, String user) {
    if (nodeHttpAddress == null || nodeHttpAddress.isEmpty() ||
        containerId == null || containerId.isEmpty() ||
        user == null || user.isEmpty()) {
      return null;
    }
    return PATH_JOINER.join(
        nodeHttpAddress, "node", "containerlogs", containerId, user);
  }

  public static String getAggregatedLogURL(String serverHttpAddress,
      String allocatedNode, String containerId, String entity, String user) {
    if (serverHttpAddress == null || serverHttpAddress.isEmpty() ||
        allocatedNode == null || allocatedNode.isEmpty() ||
        containerId == null || containerId.isEmpty() ||
        entity == null || entity.isEmpty() ||
        user == null || user.isEmpty()) {
      return null;
    }
    return PATH_JOINER.join(serverHttpAddress, "applicationhistory", "logs",
        allocatedNode, containerId, entity, user);
  }

  /**
   * Choose which scheme (HTTP or HTTPS) to use when generating a URL based on
   * the configuration.
   *
   * @return the scheme (HTTP / HTTPS)
   */
  public static String getHttpSchemePrefix(Configuration conf) {
    return YarnConfiguration.useHttps(conf) ? HTTPS_PREFIX : HTTP_PREFIX;
  }

  /**
   * Load the SSL keystore / truststore into the HttpServer builder.
   * @param builder the HttpServer2.Builder to populate with ssl config
   */
  public static HttpServer2.Builder loadSslConfiguration(
      HttpServer2.Builder builder) {
    return loadSslConfiguration(builder, null);
  }

  /**
   * Load the SSL keystore / truststore into the HttpServer builder.
   * @param builder the HttpServer2.Builder to populate with ssl config
   * @param sslConf the Configuration instance to use during loading of SSL conf
   */
  public static HttpServer2.Builder loadSslConfiguration(
      HttpServer2.Builder builder, Configuration sslConf) {
    if (sslConf == null) {
      sslConf = new Configuration(false);
    }
    boolean needsClientAuth = YarnConfiguration.YARN_SSL_CLIENT_HTTPS_NEED_AUTH_DEFAULT;
    sslConf.addResource(YarnConfiguration.YARN_SSL_SERVER_RESOURCE_DEFAULT);

    return builder
        .needsClientAuth(needsClientAuth)
        .keyPassword(getPassword(sslConf, WEB_APP_KEY_PASSWORD_KEY))
        .keyStore(sslConf.get("ssl.server.keystore.location"),
            getPassword(sslConf, WEB_APP_KEYSTORE_PASSWORD_KEY),
            sslConf.get("ssl.server.keystore.type", "jks"))
        .trustStore(sslConf.get("ssl.server.truststore.location"),
            getPassword(sslConf, WEB_APP_TRUSTSTORE_PASSWORD_KEY),
            sslConf.get("ssl.server.truststore.type", "jks"));
  }

  /**
   * Leverages the Configuration.getPassword method to attempt to get
   * passwords from the CredentialProvider API before falling back to
   * clear text in config - if falling back is allowed.
   * @param conf Configuration instance
   * @param alias name of the credential to retreive
   * @return String credential value or null
   */
  static String getPassword(Configuration conf, String alias) {
    String password = null;
    try {
      char[] passchars = conf.getPassword(alias);
      if (passchars != null) {
        password = new String(passchars);
      }
    }
    catch (IOException ioe) {
      password = null;
    }
    return password;
  }
}


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

<TITLE>
E-Index
</TITLE>

<META NAME="date" CONTENT="2011-06-28">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C D E F G H I J K L M N O P R S T V W

E

emitElement(Element) -
Method in interface com.rhizospherejs.gwt.client.renderer.RenderingOutput

Invoked by renderers that emit their renderings as HTML elements.

emitElement(Element) -
Method in class com.rhizospherejs.gwt.client.renderer.RenderingOutputImpl

emitHTML(String) -
Method in interface com.rhizospherejs.gwt.client.renderer.RenderingOutput

Invoked by renderers that emit their renderings as Strings (that must
 parse into correct HTML).

emitHTML(String) -
Method in class com.rhizospherejs.gwt.client.renderer.RenderingOutputImpl

emitSafeHtml(SafeHtml) -
Method in interface com.rhizospherejs.gwt.client.renderer.RenderingOutput

Invoked by renderers that emit their renderings as SafeHtml.

emitSafeHtml(SafeHtml) -
Method in class com.rhizospherejs.gwt.client.renderer.RenderingOutputImpl

emitWidget(Widget) -
Method in interface com.rhizospherejs.gwt.client.renderer.RenderingOutput

Invoked by renderers that emit their renderings as GWT widgets.

emitWidget(Widget) -
Method in class com.rhizospherejs.gwt.client.renderer.RenderingOutputImpl

ensureInjected(Runnable) -
Method in class com.rhizospherejs.gwt.client.RhizosphereLoader

Registers a callback to be invoked after Rhizosphere libraries have been
 successfully injected into a GWT host page.

expandable(RenderingHints) -
Method in interface com.rhizospherejs.gwt.client.renderer.HasExpandable

Defines whether the renderings emitted by the
 RhizosphereRenderer tagged with
 this interface can be rendered in expanded (maximized) status or not.

expandableByModel(T, RenderingHints) -
Method in interface com.rhizospherejs.gwt.client.renderer.HasExpandableByModel

Defines whether the rendering associated to the given model supports
 expanded (maximized) status or not.

extractModel(JavaScriptObject) -
Method in class com.rhizospherejs.gwt.client.bridge.ModelBridge

extractModel(JavaScriptObject) -
Method in interface com.rhizospherejs.gwt.client.bridge.ModelExtractor

Extracts the Java object that was originally used to represent a
 Rhizosphere model (via
 Rhizosphere.addModel(Object)) from
 the JavaScriptObject (used in the visualization javascript library code)
 that wraps it.

      Overview
      Package
      Class
      Use
      Tree
      Deprecated
    Index
      Help

 PREV LETTER
 NEXT LETTER

  FRAMES
 NO FRAMES

  All Classes

A B C D E F G H I J K L M N O P R S T V W

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />

<link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico" />
<title>android.net.sip - Android SDK | Android Developers</title>

<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../../assets/css/default.css" rel="stylesheet" type="text/css">

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

          	Quicknav
			      Quicknav

                  Design

Develop

Distribute

Links

Google Play Developer Console

Android Developers Blog

About Android

Android Sites

Android.com

Android Developers

Android Open Source Project

      <form onsubmit="return submit_search()">
        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../')"
onkeyup="return search_changed(event, false, '../../../../')" />
      </form>

        close

Get Started

Style

Patterns

Building Blocks

Downloads

Videos

Training

API Guides

Reference

Tools

Get the SDK

Google Services

Google Play

Publishing

Promoting

App Quality

Spotlight

Open Distribution

Results

Loading...

Training

API Guides

Reference

Tools

Google Services

to top

          API level:

            <select id="apiLevelSelector">

            </select>

Android APIs

  android

  android.accessibilityservice

  android.accounts

  android.animation

  android.app

  android.app.admin

  android.app.backup

  android.appwidget

  android.bluetooth

  android.content

  android.content.pm

  android.content.res

  android.database

  android.database.sqlite

  android.drm

  android.gesture

  android.graphics

  android.graphics.drawable

  android.graphics.drawable.shapes

  android.graphics.pdf

  android.hardware

  android.hardware.display

  android.hardware.input

  android.hardware.location

  android.hardware.usb

  android.inputmethodservice

  android.location

  android.media

  android.media.audiofx

  android.media.effect

  android.mtp

  android.net

  android.net.http

  android.net.nsd

  android.net.rtp

  android.net.sip

  android.net.wifi

  android.net.wifi.p2p

  android.net.wifi.p2p.nsd

  android.nfc

  android.nfc.cardemulation

  android.nfc.tech

  android.opengl

  android.os

  android.os.storage

  android.preference

  android.print

  android.print.pdf

  android.printservice

  android.provider

  android.renderscript

  android.sax

  android.security

  android.service.dreams

  android.service.notification

  android.service.textservice

  android.service.wallpaper

  android.speech

  android.speech.tts

  android.support.v13.app

  android.support.v4.accessibilityservice

  android.support.v4.app

  android.support.v4.content

  android.support.v4.content.pm

  android.support.v4.database

  android.support.v4.graphics.drawable

  android.support.v4.hardware.display

  android.support.v4.media

  android.support.v4.net

  android.support.v4.os

  android.support.v4.print

  android.support.v4.text

  android.support.v4.util

  android.support.v4.view

  android.support.v4.view.accessibility

  android.support.v4.widget

  android.support.v7.app

  android.support.v7.appcompat

  android.support.v7.gridlayout

  android.support.v7.media

  android.support.v7.mediarouter

  android.support.v7.view

  android.support.v7.widget

  android.support.v8.renderscript

  android.telephony

  android.telephony.cdma

  android.telephony.gsm

  android.test

  android.test.mock

  android.test.suitebuilder

  android.text

  android.text.format

  android.text.method

  android.text.style

  android.text.util

  android.transition

  android.util

  android.view

  android.view.accessibility

  android.view.animation

  android.view.inputmethod

  android.view.textservice

  android.webkit

  android.widget

  dalvik.bytecode

  dalvik.system

  java.awt.font

  java.beans

  java.io

  java.lang

  java.lang.annotation

  java.lang.ref

  java.lang.reflect

  java.math

  java.net

  java.nio

  java.nio.channels

  java.nio.channels.spi

  java.nio.charset

  java.nio.charset.spi

  java.security

  java.security.acl

  java.security.cert

  java.security.interfaces

  java.security.spec

  java.sql

  java.text

  java.util

  java.util.concurrent

  java.util.concurrent.atomic

  java.util.concurrent.locks

  java.util.jar

  java.util.logging

  java.util.prefs

  java.util.regex

  java.util.zip

  javax.crypto

  javax.crypto.interfaces

  javax.crypto.spec

  javax.microedition.khronos.egl

  javax.microedition.khronos.opengles

  javax.net

  javax.net.ssl

  javax.security.auth

  javax.security.auth.callback

  javax.security.auth.login

  javax.security.auth.x500

  javax.security.cert

  javax.sql

  javax.xml

  javax.xml.datatype

  javax.xml.namespace

  javax.xml.parsers

  javax.xml.transform

  javax.xml.transform.dom

  javax.xml.transform.sax

  javax.xml.transform.stream

  javax.xml.validation

  javax.xml.xpath

  junit.framework

  junit.runner

  org.apache.http

  org.apache.http.auth

  org.apache.http.auth.params

  org.apache.http.client

  org.apache.http.client.entity

  org.apache.http.client.methods

  org.apache.http.client.params

  org.apache.http.client.protocol

  org.apache.http.client.utils

  org.apache.http.conn

  org.apache.http.conn.params

  org.apache.http.conn.routing

  org.apache.http.conn.scheme

  org.apache.http.conn.ssl

  org.apache.http.conn.util

  org.apache.http.cookie

  org.apache.http.cookie.params

  org.apache.http.entity

  org.apache.http.impl

  org.apache.http.impl.auth

  org.apache.http.impl.client

  org.apache.http.impl.conn

  org.apache.http.impl.conn.tsccm

  org.apache.http.impl.cookie

  org.apache.http.impl.entity

  org.apache.http.impl.io

  org.apache.http.io

  org.apache.http.message

  org.apache.http.params

  org.apache.http.protocol

  org.apache.http.util

  org.json

  org.w3c.dom

  org.w3c.dom.ls

  org.xml.sax

  org.xml.sax.ext

  org.xml.sax.helpers

  org.xmlpull.v1

  org.xmlpull.v1.sax2

Interfaces

SipRegistrationListener

Classes

SipAudioCall

SipAudioCall.Listener

SipErrorCode

SipManager

SipProfile

SipProfile.Builder

SipSession

SipSession.Listener

SipSession.State

Exceptions

SipException

      fullscreen
      Use Tree NavigationUse Panel Navigation

  Added in API level 9

  package

android.net.sip

Provides access to Session Initiation Protocol (SIP) functionality, such as
making and answering VOIP calls using SIP.

For more information, see the
Session Initiation Protocol
developer guide.

To get started, you need to get an instance of the SipManager by
calling newInstance().

With the SipManager, you can initiate SIP audio calls with makeAudioCall() and takeAudioCall(). Both methods require
a SipAudioCall.Listener that receives callbacks when the state of the
call changes, such as when the call is ringing, established, or ended.

Both makeAudioCall() also requires two
SipProfile objects, representing the local device and the peer
device. You can create a SipProfile using the SipProfile.Builder subclass.

Once you have a SipAudioCall, you can perform SIP audio call actions with
the instance, such as make a call, answer a call, mute a call, turn on speaker mode, send DTMF
tones, and more.

If you want to create generic SIP connections (such as for video calls or other), you can
create a SIP connection from the SipManager, using open(). If you only want to create audio SIP calls, though, you
should use the SipAudioCall class, as described above.

Note:
Not all Android-powered devices support VOIP functionality with SIP. Before performing any SIP
activity, you should call isVoipSupported()
to verify that the device supports VOIP calling and isApiSupported() to verify that the device supports the
SIP APIs.
Your application must also request the INTERNET and USE_SIP permissions in order to use the SIP APIs.

Interfaces

              SipRegistrationListener
              Listener for SIP registration events.

Classes

              SipAudioCall
              Handles an Internet audio call over SIP.

              SipAudioCall.Listener
              Listener for events relating to a SIP call, such as when a call is being
 recieved ("on ringing") or a call is outgoing ("on calling").

              SipErrorCode
              Defines error codes returned during SIP actions.

              SipManager
              Provides APIs for SIP tasks, such as initiating SIP connections, and provides access to related
 SIP services.

              SipProfile
              Defines a SIP profile, including a SIP account, domain and server information.

              SipProfile.Builder
              Helper class for creating a SipProfile.

              SipSession
              Represents a SIP session that is associated with a SIP dialog or a standalone
 transaction not within a dialog.

              SipSession.Listener
              Listener for events relating to a SIP session, such as when a session is being registered
 ("on registering") or a call is outgoing ("on calling").

              SipSession.State
              Defines SIP session states, such as "registering", "outgoing call", and "in call".

Exceptions

              SipException
              Indicates a general SIP-related exception.

  Except as noted, this content is licensed under Apache 2.0.
  For details and restrictions, see the
  Content License.

    Android 4.4 r1 —

    About Android  |
    Legal  |
    Support


text:
<?php

// Call Zend_Validate_File_WordCountTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
    define("PHPUnit_MAIN_METHOD", "Zend_Validate_File_WordCountTest::main");
}

/**
 * Test helper
 */
require_once dirname(__FILE__) . '/../../../TestHelper.php';

/**
 * @see Zend_Validate_File_WordCount
 */
require_once 'Zend/Validate/File/WordCount.php';

/**
 * @category   Zend
 * @package    Zend_Validate_File
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Validate
 */
class Zend_Validate_File_WordCountTest extends PHPUnit_Framework_TestCase
{
    /**
     * Runs the test methods of this class.
     *
     * @return void
     */
    public static function main()
    {
        $suite  = new PHPUnit_Framework_TestSuite("Zend_Validate_File_WordCountTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }

    /**
     * Ensures that the validator follows expected behavior
     *
     * @return void
     */
    public function testBasic()
    {
        $valuesExpected = array(
            array(15, true),
            array(4, false),
            array(array('min' => 0, 'max' => 10), true),
            array(array('min' => 10, 'max' => 15), false),
            );

        foreach ($valuesExpected as $element) {
            $validator = new Zend_Validate_File_WordCount($element[0]);
            $this->assertEquals(
                $element[1],
                $validator->isValid(dirname(__FILE__) . '/_files/wordcount.txt'),
                "Tested with " . var_export($element, 1)
            );
        }
    }

    /**
     * Ensures that getMin() returns expected value
     *
     * @return void
     */
    public function testGetMin()
    {
        $validator = new Zend_Validate_File_WordCount(array('min' => 1, 'max' => 5));
        $this->assertEquals(1, $validator->getMin());

        try {
            $validator = new Zend_Validate_File_WordCount(array('min' => 5, 'max' => 1));
            $this->fail("Missing exception");
        } catch (Zend_Validate_Exception $e) {
            $this->assertContains("greater than or equal", $e->getMessage());
        }

        $validator = new Zend_Validate_File_WordCount(array('min' => 1, 'max' => 5));
        $this->assertEquals(1, $validator->getMin());

        try {
            $validator = new Zend_Validate_File_WordCount(array('min' => 5, 'max' => 1));
            $this->fail("Missing exception");
        } catch (Zend_Validate_Exception $e) {
            $this->assertContains("greater than or equal", $e->getMessage());
        }
    }

    /**
     * Ensures that setMin() returns expected value
     *
     * @return void
     */
    public function testSetMin()
    {
        $validator = new Zend_Validate_File_WordCount(array('min' => 1000, 'max' => 10000));
        $validator->setMin(100);
        $this->assertEquals(100, $validator->getMin());

        try {
            $validator->setMin(20000);
            $this->fail("Missing exception");
        } catch (Zend_Validate_Exception $e) {
            $this->assertContains("less than or equal", $e->getMessage());
        }
    }

    /**
     * Ensures that getMax() returns expected value
     *
     * @return void
     */
    public function testGetMax()
    {
        $validator = new Zend_Validate_File_WordCount(array('min' => 1, 'max' => 100));
        $this->assertEquals(100, $validator->getMax());

        try {
            $validator = new Zend_Validate_File_WordCount(array('min' => 5, 'max' => 1));
            $this->fail("Missing exception");
        } catch (Zend_Validate_Exception $e) {
            $this->assertContains("greater than or equal", $e->getMessage());
        }
    }

    /**
     * Ensures that setMax() returns expected value
     *
     * @return void
     */
    public function testSetMax()
    {
        $validator = new Zend_Validate_File_WordCount(array('min' => 1000, 'max' => 10000));
        $validator->setMax(1000000);
        $this->assertEquals(1000000, $validator->getMax());

        $validator->setMin(100);
        $this->assertEquals(1000000, $validator->getMax());
    }
}

// Call Zend_Validate_File_WordCountTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Validate_File_WordCountTest::main") {
    Zend_Validate_File_WordCountTest::main();
}


text:
namespace boost { namespace spirit { namespace qi
{
    ///////////////////////////////////////////////////////////////////////////
    // compatible STL containers
    template <typename Container>
    struct meta_create_container
    {
        typedef make_unary_proto_expr<
            typename Container::value_type
          , proto::tag::dereference, qi::domain
        > make_proto_expr;

        typedef typename make_proto_expr::type type;

        static type call()
        {
            return make_proto_expr::call();
        }
    };

    ///////////////////////////////////////////////////////////////////////////
    // Fusion sequences
    template <typename Sequence>
    struct meta_create_sequence
    {
        // create a mpl sequence from the given fusion sequence
        typedef typename mpl::fold<
            typename fusion::result_of::as_vector<Sequence>::type
          , mpl::vector<>, mpl::push_back<mpl::_, mpl::_>
        >::type sequence_type;

        typedef make_nary_proto_expr<
            sequence_type, proto::tag::shift_right, qi::domain
        > make_proto_expr;

        typedef typename make_proto_expr::type type;

        static type call()
        {
            return make_proto_expr::call();
        }
    };

    ///////////////////////////////////////////////////////////////////////////
    // the default is to use the standard streaming operator unless it's a
    // STL container or a fusion sequence

    // The default implementation will be chosen if no predefined mapping of
    // the data type T to a Qi component is defined.
    struct no_auto_mapping_exists {};

    template <typename T, typename Enable = void>
    struct meta_create_impl : mpl::identity<no_auto_mapping_exists> {};

    template <typename T>
    struct meta_create_impl<T
          , typename enable_if<mpl::and_<
                traits::is_container<T>, mpl::not_<traits::is_string<T> > >
            >::type>
      : meta_create_container<T> {};

    template <typename T>
    struct meta_create_impl<T
          , typename enable_if<fusion::traits::is_sequence<T> >::type>
      : meta_create_sequence<T> {};

    template <typename T, typename Enable = void>
    struct meta_create : meta_create_impl<T> {};

    ///////////////////////////////////////////////////////////////////////////
    // optional
    template <typename T>
    struct meta_create<boost::optional<T> >
    {
        typedef make_unary_proto_expr<
            T, proto::tag::negate, qi::domain
        > make_proto_expr;

        typedef typename make_proto_expr::type type;

        static type call()
        {
            return make_proto_expr::call();
        }
    };

    ///////////////////////////////////////////////////////////////////////////
    // alternatives
    template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
    struct meta_create<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
    {
        typedef make_nary_proto_expr<
            typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
          , proto::tag::bitwise_or, qi::domain
        > make_proto_expr;

        typedef typename make_proto_expr::type type;

        static type call()
        {
            return make_proto_expr::call();
        }
    };

    ///////////////////////////////////////////////////////////////////////////
    // predefined specializations for primitive components

    // character generator
    template <>
    struct meta_create<char>
    {
        typedef spirit::standard::char_type type;
        static type const& call() { return spirit::standard::char_; }
    };
    template <>
    struct meta_create<signed char>
    {
        typedef spirit::standard::char_type type;
        static type const& call() { return spirit::standard::char_; }
    };
    template <>
    struct meta_create<wchar_t>
    {
        typedef spirit::standard_wide::char_type type;
        static type const& call() { return spirit::standard_wide::char_; }
    };

    template <>
    struct meta_create<unsigned char>
    {
        typedef spirit::standard::char_type type;
        static type const& call() { return spirit::standard::char_; }
    };

    // boolean generator
    template <>
    struct meta_create<bool>
    {
        typedef spirit::bool__type type;
        static type const& call() { return spirit::bool_; }
    };

    // integral generators
    template <>
    struct meta_create<int>
    {
        typedef spirit::int__type type;
        static type const& call() { return spirit::int_; }
    };
    template <>
    struct meta_create<short>
    {
        typedef spirit::short__type type;
        static type const& call() { return spirit::short_; }
    };
    template <>
    struct meta_create<long>
    {
        typedef spirit::long__type type;
        static type const& call() { return spirit::long_; }
    };
    template <>
    struct meta_create<unsigned int>
    {
        typedef spirit::uint__type type;
        static type const& call() { return spirit::uint_; }
    };
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
    template <>
    struct meta_create<unsigned short>
    {
        typedef spirit::ushort__type type;
        static type const& call() { return spirit::ushort_; }
    };
#endif
    template <>
    struct meta_create<unsigned long>
    {
        typedef spirit::ulong__type type;
        static type const& call() { return spirit::ulong_; }
    };

#ifdef BOOST_HAS_LONG_LONG
    template <>
    struct meta_create<boost::long_long_type>
    {
        typedef spirit::long_long_type type;
        static type const& call() { return spirit::long_long; }
    };
    template <>
    struct meta_create<boost::ulong_long_type>
    {
        typedef spirit::ulong_long_type type;
        static type const& call() { return spirit::ulong_long; }
    };
#endif

    // floating point generators
    template <>
    struct meta_create<float>
    {
        typedef spirit::float__type type;
        static type const& call() { return spirit::float_; }
    };
    template <>
    struct meta_create<double>
    {
        typedef spirit::double__type type;
        static type const& call() { return spirit::double_; }
    };
    template <>
    struct meta_create<long double>
    {
        typedef spirit::long_double_type type;
        static type const& call() { return spirit::long_double; }
    };
}}}

///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace traits
{
    ///////////////////////////////////////////////////////////////////////////
    // main customization point for create_parser
    template <typename T, typename Enable = void>
    struct create_parser : qi::meta_create<T> {};

    ///////////////////////////////////////////////////////////////////////////
    // dispatch this to the Qi related specializations
    template <typename T>
    struct meta_create<qi::domain, T>
      : create_parser<typename spirit::detail::remove_const_ref<T>::type> {};

    ///////////////////////////////////////////////////////////////////////////
    // Check whether a valid mapping exits for the given data type to a Qi
    // component
    template <typename T>
    struct meta_create_exists<qi::domain, T>
      : mpl::not_<is_same<
            qi::no_auto_mapping_exists
          , typename meta_create<qi::domain, T>::type
        > > {};
}}}

#endif


text:
#region License and Terms

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

#endregion

using System;

namespace CustomExtensions.ForIConvertible
{
    public static partial class ExtendIConvertible
    {
        //http://stackoverflow.com/a/939498/213169

        /// <summary>
        /// Converts IConvertible object to type <typeparamref name="T"/> or provided other value if conversion fails
        /// </summary>
        /// <typeparam name="T">Type to convert to.</typeparam>
        /// <param name="source">Object implementing <see cref="IConvertible"/></param>
        /// <param name="other">Value to return if conversion fails</param>
        /// <returns>Converted object or <paramref name="other"/> if conversion fails</returns>
        public static T ToOrOther <T>(this IConvertible source, T other)
        {
            T converted;
            source.ToOrOther(out converted, other);
            return converted;
        }

        /// <summary>
        /// Converts IConvertible object to type <typeparamref name="T"/> or provided other value if conversion fails
        /// </summary>
        /// <typeparam name="T">Type to convert to.</typeparam>
        /// <param name="source">Object implementing <see cref="IConvertible"/></param>
        /// <param name="converted">Converted object or <paramref name="other"/> if conversion fails</param>
        /// <param name="other">Value to return if conversion fails</param>
        /// <returns>True if conversion was successful, false if conversion failed and <paramref name="other"/> was returned</returns>
        public static bool ToOrOther <T>(this IConvertible source, out T converted, T other)
        {
            try
            {
                converted = To<T>(source);
                return true;
            }
            catch (Exception ex)
            {
                if (ex is InvalidCastException ||
                    ex is FormatException ||
                    ex is OverflowException ||
                    ex is ArgumentNullException)
                {
                    converted = other;
                    return false;
                }
                throw;
            }
        }
    }
}


text:
import zipfile
import boto3
import io
import datetime
import requests
import pandas as pd

def get_creds(cred_fpath=None, api_path=None):
    """helper function to obtain aws keys
    """
    if cred_fpath is not None:
        print("reading keys from credentials file")
        keys = pd.read_csv(cred_fpath, sep="=")
        myAccessKey = keys.loc['aws_access_key_id ']['[default]'].strip()
        mySecretKey = keys.loc['aws_secret_access_key ']['[default]'].strip()
        myToken = ""
    else:
        r = requests.get(api_path)
        creds = r.json()
        myAccessKey = creds["AccessKeyId"]
        mySecretKey = creds["SecretAccessKey"]
        myToken = creds["Token"]
    return myAccessKey, mySecretKey, myToken

def s3zip_func(s3zip_path, _func=None, cred_fpath=None, api_path=None, num_files=-1, verbose=False, include=None, **kwargs):
    """
    unzip a zip file on s3 and perform func with kwargs.
     func must accept `fpath` and `fname` as key word arguments.
    fpath: pointer to unzipped subfile in zip file
    fname: str of subfile in zip file
    num_files: int: if -1 include all files

    adapted from https://stackoverflow.com/questions/23376816/python-s3-download-zip-file
    """

    def operate(subfile, _func, verbose, **kwargs):
        if verbose:
            print("current time is {}".format(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
            print("{} opened.".format(subfile))
        if _func is None:
            return subfile
        else:
            return _func(fpath=zipf.open(subfile), fname=subfile, **kwargs)

    s3bucket, s3zip = s3zip_path.split("s3://")[-1].split('/', 1)
    myAccessKey, mySecretKey, myToken = get_creds(cred_fpath=cred_fpath, api_path=api_path)

    session = boto3.session.Session(
        aws_access_key_id=myAccessKey,
        aws_secret_access_key=mySecretKey,
        aws_session_token=myToken
    )

    s3 = session.resource("s3")
    bucket = s3.Bucket(s3bucket)
    obj = bucket.Object(s3zip)

    with io.BytesIO(obj.get()["Body"].read()) as tf:

        # rewind the file
        tf.seek(0)

        # Read the file as a zipfile and process the members
        with zipfile.ZipFile(tf, mode='r') as zipf:
            zipfiles = zipf.namelist()
            if include is None:
                include = zipfiles
            if num_files == -1:
                num_files = len(zipfiles)
            results = [operate(subfile, _func, verbose, **kwargs)
                       for subfile in zipfiles[:num_files] if subfile in include]
    return results


text:
import java.util.*;

// https://www.hackerrank.com/challenges/java-string-compare
public class Solution {

    public static String getSmallestAndLargest(String s, int k) {
        /*
         * get the smallest substring and the biggest substring
         *   using two additional methods
         */
        return auxSmall(s, k, s.substring(0, k)) + "\n" + auxBig(s, k, s.substring(0, k));
    }

    public static String auxSmall(String s, int k, String crtMin) {
        /* find the smallest substring of length k */
    	for (int i = 0; i < s.length()-k+1; i++)
    		if (s.substring(i, i+k).compareTo(crtMin) < 0)
                /* if there is a substring smaller than the current one, update it */
    			crtMin = s.substring(i, i+k);
    	return crtMin;
    }

    public static String auxBig(String s, int k, String crtMax) {
        /* find the biggest substring of length k */
    	for (int i = 0; i < s.length()-k+1; i++)
    		if (s.substring(i, i+k).compareTo(crtMax) > 0)
                /* if there is a substring bigger than the current one, update it */
    			crtMax = s.substring(i, i+k);
    	return crtMax;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        int k = scan.nextInt();
        scan.close();

        System.out.println(getSmallestAndLargest(s, k));
    }
}


text:
from django.forms.widgets import DateInput

from django.templatetags.static import *

class DatePickerWidget(DateInput):
    class Media:
        css = {
            "all": (
                static("css/cupertino/jquery-ui-1.10.3.custom.css"),
            )
        }
        js = (
            static("js/jqcalendar.js"),
            static("js/jquery-ui-1.10.3.custom.js"),
        )

    def __init__(self, *args, **kwargs):
        super(DatePickerWidget, self).__init__(*args, **kwargs)
        self.attrs = {'class': 'datepicker'}


text:
//
//  Author:
//       Nicolas VERINAUD <n.verinaud@gmail.com>
//
//  Copyright (c) 2015 Nicolas Verinaud. All Rights Reserved.
//
using System.Reflection;
using Foundation;

[assembly: LinkerSafe]

[assembly: AssemblyTitle("SCSiriWaveformView-Mono")]
[assembly: AssemblyCompany("Nicolas Verinaud")]
[assembly: AssemblyCopyright("Nicolas Verinaud")]
[assembly: AssemblyProduct("SCSiriWaveformView")]
[assembly: AssemblyVersion("1.0.1")]


text:
using std::cout;
using std::endl;

const double TOL = 1e-15;

template <class AE>
typename AE::value_type mean_square(const boost::numeric::ublas::matrix_expression<AE> &me) {
    typename AE::value_type s(0);
    typename AE::size_type i, j;
    for (i=0; i!= me().size1(); i++) {
        for (j=0; j!= me().size2(); j++) {
          s += boost::numeric::ublas::scalar_traits<typename AE::value_type>::type_abs(me()(i,j));
        }
    }
    return s/me().size1()*me().size2();
}

template<typename T>
bool check_sortedness(const boost::numeric::ublas::coordinate_matrix<T>& matrix) {
  bool result = true;
  typedef boost::numeric::ublas::coordinate_matrix<T> matrix_type;
  typename matrix_type::index_array_type i1 = matrix.index1_data();
  typename matrix_type::index_array_type i2 = matrix.index2_data();
  typename matrix_type::array_size_type size = matrix.filled();

  for (typename matrix_type::array_size_type i = 0; i + 1 < size && result; ++ i) {
    result &= ( (i1[i] < i1[i + 1]) ||
                ((i1[i] == i1[i]) &&
                 (i2[i] < i2[i + 1])) );

  }
  return result;
}

void print_entries(size_t size_x, size_t size_y,
                   const std::vector<std::pair<size_t, size_t> >& entries)
{
  std::cerr << "Error - Size:" << size_x << " x " << size_y << ". Entries: ";
  for (size_t i = 0; i < entries.size(); ++ i) {
    std::cerr << entries[i].first << ", " << entries[i].second << "; ";
  }
  std::cerr << "\n";
}

BOOST_UBLAS_TEST_DEF( test_coordinate_matrix_inplace_merge_random )
{
  const size_t max_repeats = 100;
  const size_t max_size = 100;
  const size_t dim_var = 10;
  const size_t nr_entries = 10;

  for (size_t repeats = 1; repeats < max_repeats; ++repeats ) {
    for (size_t size = 1; size < max_size; size += 5) {
      size_t size_x = size + rand() % dim_var;
      size_t size_y = size + rand() % dim_var;

      boost::numeric::ublas::coordinate_matrix<double> matrix_coord(size_x, size_y);
      boost::numeric::ublas::matrix<double> matrix_dense(size_x, size_y, 0);

      matrix_coord.sort();

      std::vector<std::pair<size_t, size_t> > entries;
      for (int entry = 0; entry < nr_entries; ++ entry) {
        int x = rand() % size_x;
        int y = rand() % size_y;
        entries.push_back(std::make_pair(x, y));
        matrix_coord.append_element(x, y, 1);
        matrix_dense(x, y) += 1;
      }
      matrix_coord.sort();

      {
        bool sorted = check_sortedness(matrix_coord);
        bool identical = mean_square(matrix_coord - matrix_dense) < TOL;
        if (!(sorted && identical)) {
          print_entries(size_x, size_y, entries);
        }
        BOOST_UBLAS_TEST_CHECK( check_sortedness(matrix_coord) );
        BOOST_UBLAS_TEST_CHECK( mean_square(matrix_coord - matrix_dense) < TOL);
      }

      for (int entry = 0; entry < nr_entries; ++ entry) {
        int x = rand() % size_x;
        int y = rand() % size_y;
        entries.push_back(std::make_pair(x, y));
        matrix_coord(x, y) += 1;
        matrix_dense(x, y) += 1;
        matrix_coord.sort();
      }

      {
        bool sorted = check_sortedness(matrix_coord);
        bool identical = mean_square(matrix_coord - matrix_dense) < TOL;
        if (!(sorted && identical)) {
          print_entries(size_x, size_y, entries);
        }
        BOOST_UBLAS_TEST_CHECK( sorted );
        BOOST_UBLAS_TEST_CHECK( identical );
      }
    }
  }
}

int main()
{
    BOOST_UBLAS_TEST_BEGIN();

    BOOST_UBLAS_TEST_DO( test_coordinate_matrix_inplace_merge_random );

    BOOST_UBLAS_TEST_END();

    return EXIT_SUCCESS;;
}


text:
<?php
/**
 * Eaterstop Lite Theme Customizer
 *
 * @package Eaterstop Lite
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function eaterstop_lite_customize_register( $wp_customize ) {
	//Add a class for titles
    class eaterstop_lite_Info extends WP_Customize_Control {
        public $type = 'info';
        public $label = '';
        public function render_content() {
        ?>

<?php echo esc_html( $this->label ); ?>

        <?php
        }
    }

	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';

	$wp_customize->add_setting('color_scheme',array(
			'default'	=> '#D66200',
			'sanitize_callback'	=> 'sanitize_hex_color'
	));

	$wp_customize->add_control(
		new WP_Customize_Color_Control($wp_customize,'color_scheme',array(
			'label' => __('Color Scheme','eaterstop-lite'),
			 'description'	=> __('More color options in PRO Version','eaterstop-lite'),
			'section' => 'colors',
			'settings' => 'color_scheme'
		))
	);

	// Slider Section
	$wp_customize->add_section( 'slider_section', array(
            'title' => __('Slider Settings', 'eaterstop-lite'),
            'priority' => null,
            'description'	=> __('Featured Image Size Should be ( 1400x580 ).','eaterstop-lite'),
        )
    );

	$wp_customize->add_setting('page-setting7',array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control('page-setting7',array(
			'type'	=> 'dropdown-pages',
			'label'	=> __('Select page for slide one:','eaterstop-lite'),
			'section'	=> 'slider_section'
	));

	$wp_customize->add_setting('page-setting8',array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control('page-setting8',array(
			'type'	=> 'dropdown-pages',
			'label'	=> __('Select page for slide two:','eaterstop-lite'),
			'section'	=> 'slider_section'
	));

	$wp_customize->add_setting('page-setting9',array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control('page-setting9',array(
			'type'	=> 'dropdown-pages',
			'label'	=> __('Select page for slide three:','eaterstop-lite'),
			'section'	=> 'slider_section'
	));	// Slider Section

	$wp_customize->add_setting('disabled_slides',array(
				'default' => true,
				'sanitize_callback' => 'sanitize_text_field',
				'capability' => 'edit_theme_options',
	));

	$wp_customize->add_control( 'disabled_slides', array(
			   'settings' => 'disabled_slides',
			   'section'   => 'slider_section',
			   'label'     => __('Uncheck To Enable This Section','eaterstop-lite'),
			   'type'      => 'checkbox'
	 ));//Disable Slider Section

	// Home Welcome Section
	$wp_customize->add_section('section_welcome',array(
			'title'	=> __('Homepage Todays Special Menu ','eaterstop-lite'),
			'description'	=> __('Select Page from the dropdown for first section','eaterstop-lite'),
			'priority'	=> null
	));

	$wp_customize->add_setting('page-setting1',	array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
		));

	$wp_customize->add_control(	'page-setting1',array('type' => 'dropdown-pages',
			'section' => 'section_welcome',
	));

	$wp_customize->add_setting('disabled_welcomepage',array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control( 'disabled_welcomepage', array(
			   'settings' => 'disabled_welcomepage',
			   'section'   => 'section_welcome',
			   'label'     => __('Uncheck To Enable This Section','eaterstop-lite'),
			   'type'      => 'checkbox'
	 ));//Disable Todays Special Menu Section

	// Home four Boxes Section
	$wp_customize->add_section('section_second', array(
		'title'	=> __('Homepage Four Boxes Section','eaterstop-lite'),
		'description'	=> __('Select Pages from the dropdown for homepage four boxes section','eaterstop-lite'),
		'priority'	=> null
	));

	$wp_customize->add_setting('page-column1',	array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
		));

	$wp_customize->add_control(	'page-column1',array('type' => 'dropdown-pages',
			'section' => 'section_second',
	));

	$wp_customize->add_setting('page-column2',	array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control(	'page-column2',array('type' => 'dropdown-pages',
			'section' => 'section_second',
	));

	$wp_customize->add_setting('page-column3',	array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control(	'page-column3',array('type' => 'dropdown-pages',
			'section' => 'section_second',
	));

	$wp_customize->add_setting('page-column4',	array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control(	'page-column4',array('type' => 'dropdown-pages',
			'section' => 'section_second',
	));	//end four column part

	$wp_customize->add_setting('disabled_pageboxes',array(
			'default'	=> '0',
			'capability' => 'edit_theme_options',
			'sanitize_callback'	=> 'absint'
	));

	$wp_customize->add_control( 'disabled_pageboxes', array(
			   'settings' => 'disabled_pageboxes',
			   'section'   => 'section_second',
			   'label'     => __('Uncheck To Enable This Section','eaterstop-lite'),
			   'type'      => 'checkbox'
	 ));//Disable page boxes Section

	//Social Section
	$wp_customize->add_section('social_sec',array(
			'title'	=> __('Social Settings','eaterstop-lite'),
			'description'	=> __('More social icon available in PRO Version','eaterstop-lite'),
			'priority'		=> null
	));

	$wp_customize->add_setting('fb_link',array(
			'default'	=> '#',
			'sanitize_callback'	=> 'esc_url_raw'
	));

	$wp_customize->add_control('fb_link',array(
			'label'	=> __('Add facebook link here','eaterstop-lite'),
			'section'	=> 'social_sec',
			'setting'	=> 'fb_link'
	));
	$wp_customize->add_setting('twitt_link',array(
			'default'	=> '#',
			'sanitize_callback'	=> 'esc_url_raw'
	));

	$wp_customize->add_control('twitt_link',array(
			'label'	=> __('Add twitter link here','eaterstop-lite'),
			'section'	=> 'social_sec',
			'setting'	=> 'twitt_link'
	));
	$wp_customize->add_setting('gplus_link',array(
			'default'	=> '#',
			'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('gplus_link',array(
			'label'	=> __('Add google plus link here','eaterstop-lite'),
			'section'	=> 'social_sec',
			'setting'	=> 'gplus_link'
	));
	$wp_customize->add_setting('linked_link',array(
			'default'	=> '#',
			'sanitize_callback'	=> 'esc_url_raw'
	));
	$wp_customize->add_control('linked_link',array(
			'label'	=> __('Add linkedin link here','eaterstop-lite'),
			'section'	=> 'social_sec',
			'setting'	=> 'linked_link'
	));

	//Footer Section
	$wp_customize->add_section('footer_area',array(
			'title'	=> __('Footer Area','eaterstop-lite'),
			'priority'	=> null,
	));

	$wp_customize->add_setting('about_title',array(
			'default'	=> __('About Us','eaterstop-lite'),
			'sanitize_callback'	=> 'sanitize_text_field'
	));

	$wp_customize->add_control('about_title',array(
			'label'	=> __('Add title for about us','eaterstop-lite'),
			'section'	=> 'footer_area',
			'setting'	=> 'about_title'
	));

	$wp_customize->add_setting( 'about_description', array(
			'default'	=> __('We Provide all types of vegetarian and non vegetarian food in our restaurant. our Food quality is not only important main important things is customer satisfaction.','eaterstop-lite'),
			'sanitize_callback' => 'esc_textarea',
	) );

	$wp_customize->add_control( 'about_description', array(
			'type' => 'textarea',
			'label' => __( 'About Description', 'eaterstop-lite' ),
			'section' => 'footer_area',
			'setting'	=> 'about_description',
	) );

	$wp_customize->add_setting('menu_title',array(
			'default'	=> __('Main Navigation','eaterstop-lite'),
			'sanitize_callback'	=> 'sanitize_text_field'
	));

	$wp_customize->add_control('menu_title',array(
			'label'	=> __('Add title for menu','eaterstop-lite'),
			'section'	=> 'footer_area',
			'setting'	=> 'menu_title'
	));

	$wp_customize->add_setting('latestpost_title',array(
			'default'	=> __('Latest Posts','eaterstop-lite'),
			'sanitize_callback'	=> 'sanitize_text_field'
	));

	$wp_customize->add_control('latestpost_title',array(
			'label'	=> __('Add title for footer latest posts','eaterstop-lite'),
			'section'	=> 'footer_area',
			'setting'	=> 'latestpost_title'
	));

	$wp_customize->add_setting('contact_title',array(
			'default'	=> __('Contact Info','eaterstop-lite'),
			'sanitize_callback'	=> 'sanitize_text_field'
	));

	$wp_customize->add_control('contact_title',array(
			'label'	=> __('Add title for footer contact info','eaterstop-lite'),
			'section'	=> 'footer_area',
			'setting'	=> 'contact_title'
	));

	$wp_customize->add_setting('contact_add',array(
			'default'	=> __('505 New St, Demo Address here, Newyork US','eaterstop-lite'),
			'sanitize_callback'	=> 'esc_textarea',
	));

	$wp_customize->add_control(	'contact_add', array(
				'type' => 'textarea',
				'label'	=> __('Add contact address here','eaterstop-lite'),
				'section'	=> 'footer_area',
				'setting'	=> 'contact_add'
	));
	$wp_customize->add_setting('contact_no',array(
			'default'	=> __('Phone: +123 456 7890','eaterstop-lite'),
			'sanitize_callback'	=> 'sanitize_text_field'
	));
	$wp_customize->add_control('contact_no',array(
			'label'	=> __('Add contact number here.','eaterstop-lite'),
			'section'	=> 'footer_area',
			'setting'	=> 'contact_no'
	));
	$wp_customize->add_setting('contact_mail',array(
			'default'	=> 'contact@company.com',
			'sanitize_callback'	=> 'sanitize_email'
	));

	$wp_customize->add_control('contact_mail',array(
			'label'	=> __('Add you email here','eaterstop-lite'),
			'section'	=> 'footer_area',
			'setting'	=> 'contact_mail'
	));

	$wp_customize->add_setting('disabled_footer',array(
				'default' => true,
				'sanitize_callback' => 'sanitize_text_field',
				'capability' => 'edit_theme_options',
	));

	$wp_customize->add_control( 'disabled_footer', array(
			   'settings' => 'disabled_footer',
			   'section'   => 'footer_area',
			   'label'     => __('Uncheck To Enable This Section','eaterstop-lite'),
			   'type'      => 'checkbox'
	 ));//Disable Todays Special Menu Section

	//Copyright section
	$wp_customize->add_section('copyright_section',array(
			'title'	=> __('Footer Copyright','eaterstop-lite'),
			'priority'	=> null,
	));

	$wp_customize->add_setting('copyright_text',array(
			'default'	=> __('2016 Eaterstop Lite. All Rights Reserved','eaterstop-lite'),
			'sanitize_callback'	=> 'sanitize_text_field'
	));

	$wp_customize->add_control('copyright_text',array(
			'label'	=> __('Change Copyright Text','eaterstop-lite'),
			'section'	=> 'copyright_section',
			'setting'	=> 'copyright_text'
	));

}
add_action( 'customize_register', 'eaterstop_lite_customize_register' );

//Custom css
function eaterstop_lite_custom_css(){
		?>

<?php
}

add_action('wp_head','eaterstop_lite_custom_css');

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function eaterstop_lite_customize_preview_js() {
	wp_enqueue_script( 'eaterstop_lite_customizer', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20130508', true );
}
add_action( 'customize_preview_init', 'eaterstop_lite_customize_preview_js' );


text:
module.exports = colorSupport({ alwaysReturn: true }, colorSupport)

function hasNone (obj, options) {
  obj.level = 0
  obj.hasBasic = false
  obj.has256 = false
  obj.has16m = false
  if (!options.alwaysReturn) {
    return false
  }
  return obj
}

function hasBasic (obj) {
  obj.hasBasic = true
  obj.has256 = false
  obj.has16m = false
  obj.level = 1
  return obj
}

function has256 (obj) {
  obj.hasBasic = true
  obj.has256 = true
  obj.has16m = false
  obj.level = 2
  return obj
}

function has16m (obj) {
  obj.hasBasic = true
  obj.has256 = true
  obj.has16m = true
  obj.level = 3
  return obj
}

function colorSupport (options, obj) {
  options = options || {}

  obj = obj || {}

  // if just requesting a specific level, then return that.
  if (typeof options.level === 'number') {
    switch (options.level) {
      case 0:
        return hasNone(obj, options)
      case 1:
        return hasBasic(obj)
      case 2:
        return has256(obj)
      case 3:
        return has16m(obj)
    }
  }

  obj.level = 0
  obj.hasBasic = false
  obj.has256 = false
  obj.has16m = false

  if (typeof process === 'undefined' ||
      !process ||
      !process.stdout ||
      !process.env ||
      !process.platform) {
    return hasNone(obj, options)
  }

  var env = options.env || process.env
  var stream = options.stream || process.stdout
  var term = options.term || env.TERM || ''
  var platform = options.platform || process.platform

  if (!options.ignoreTTY && !stream.isTTY) {
    return hasNone(obj, options)
  }

  if (!options.ignoreDumb && term === 'dumb' && !env.COLORTERM) {
    return hasNone(obj, options)
  }

  if (platform === 'win32') {
    return hasBasic(obj)
  }

  if (env.TMUX) {
    return has256(obj)
  }

  if (!options.ignoreCI && (env.CI || env.TEAMCITY_VERSION)) {
    if (env.TRAVIS) {
      return has256(obj)
    } else {
      return hasNone(obj, options)
    }
  }

  // TODO: add more term programs
  switch (env.TERM_PROGRAM) {
    case 'iTerm.app':
      var ver = env.TERM_PROGRAM_VERSION || '0.'
      if (/^[0-2]\./.test(ver)) {
        return has256(obj)
      } else {
        return has16m(obj)
      }

    case 'HyperTerm':
      return has16m(obj)

    case 'MacTerm':
      return has16m(obj)

    case 'Apple_Terminal':
      return has256(obj)
  }

  if (/^xterm-256/.test(term)) {
    return has256(obj)
  }

  if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(term)) {
    return hasBasic(obj)
  }

  if (env.COLORTERM) {
    return hasBasic(obj)
  }

  return hasNone(obj, options)
}


text:
@interface BDViewController (Private)
- (void) _demoAsyncDataLoading;
- (void) buildBarButtons;
@end


text:
export default {
  getParent(instance, Ctor) {
    while (instance = instance.$parent) {
      if (instance instanceof Ctor) {
        return instance
      }
    }

    return null
  },

  getPropByPath (obj, path) {
    const key = '([\\w\\$]+)'
    const origPath = path
    const origObj = obj

    var lastPath
    var lastObj

    lastPath = path
    lastObj = obj

    path = path.replace(new RegExp('^' + key), (_, match) => {
      try {
        obj = obj[match]
      } catch (e) {
        console.error(`Cannot get value by ${origPath} in `, JSON.stringify(origObj))
        obj = ''
      }
      return ''
    })

    while (path) {
      let found = false
      lastPath = path
      lastObj = obj
      path = path.replace(new RegExp('^\\.' + key + '|^\\[' + key + '\\]'), (_, value1, value2) => {
        const value = value1 || value2
        try {
          obj = obj[value]
          found = true

        } catch (e) {
          console.error(`Cannot get value by ${origPath} in `, JSON.stringify(origObj))
          obj = ''
        }
        return ''
      })

      if (!found) {
        if (attr) {
          console.error(`Cannot match path ${path} in `, JSON.stringify(origObj))
        }
        break
      }
    }

    return {
      get () {
        return obj
      },
      set (value) {
        lastObj[lastPath] = value
      }
    }
  }
}


text:
require 'railstar/engine'
require 'railstar/code_holder'
require 'railstar/search_base'

require 'railstar/helper'
ActionView::Base.send(:include, Railstar::Helper)
require 'railstar/active_record_ext'
ActiveRecord::Base.send(:include, Railstar::ActiveRecordExt)

#require 'railstar/column_comment' if /mysql/i =~ Rails.configuration.database_configuration[Rails.env]["adapter"]

module Railstar
  def self.env
    @env ||= load_env
  end

  def self.load_env
    puts "################# LOAD railstar.yml #################"
    if File.exist?(file = File.join(Rails.root.to_s, 'config', 'railstar.yml'))
      rs = YAML.load_file(file)
      (rs["default"] || {}).merge(rs[Rails.env] || {})
    else
      {}
    end
  end

  def self.code_dir
    self.root + "/../config/resources/code"
  end

  def self.root
    RAILSTAR_ROOT
  end
end

C = Railstar::CodeHolder.new
RAILSTAR_ROOT = File.expand_path(File.dirname(__FILE__))


text:
package vod

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// ResultItem is a nested struct in vod response
type ResultItem struct {
	Score      string `json:"Score" xml:"Score"`
	Suggestion string `json:"Suggestion" xml:"Suggestion"`
	Label      string `json:"Label" xml:"Label"`
	Scene      string `json:"Scene" xml:"Scene"`
}


text:
using MQTTnet.Protocol;

namespace MQTTnet.Server
{
    public class MqttConnectionValidatorContext
    {
        public MqttConnectionValidatorContext(string clientId, string username, string password, MqttApplicationMessage willMessage, string endpoint)
        {
            ClientId = clientId;
            Username = username;
            Password = password;
            WillMessage = willMessage;
            Endpoint = endpoint;
        }

        public string ClientId { get; }

        public string Username { get; }

        public string Password { get; }

        public MqttApplicationMessage WillMessage { get; }

        public string Endpoint { get; }

        public MqttConnectReturnCode ReturnCode { get; set; } = MqttConnectReturnCode.ConnectionAccepted;
    }
}


text:
//
// teamplay_gamerules.cpp
//
#include	"extdll.h"
#include	"util.h"
#include	"cbase.h"
#include	"player.h"
#include	"weapons.h"
#include	"gamerules.h"
#include	"teamplay_gamerules.h"
#include	"game.h"

static char team_names[MAX_TEAMS][MAX_TEAMNAME_LENGTH];
static int team_scores[MAX_TEAMS];
static int num_teams = 0;

extern DLL_GLOBAL BOOL		g_fGameOver;

CHalfLifeTeamplay :: CHalfLifeTeamplay()
{
	m_DisableDeathMessages = FALSE;
	m_DisableDeathPenalty = FALSE;

	memset( team_names, 0, sizeof(team_names) );
	memset( team_scores, 0, sizeof(team_scores) );
	num_teams = 0;

	// Copy over the team from the server config
	m_szTeamList[0] = 0;

	// Cache this because the team code doesn't want to deal with changing this in the middle of a game
	strncpy( m_szTeamList, teamlist.string, TEAMPLAY_TEAMLISTLENGTH );

	edict_t *pWorld = INDEXENT(0);
	if ( pWorld && pWorld->v.team )
	{
		if ( teamoverride.value )
		{
			const char *pTeamList = STRING(pWorld->v.team);
			if ( pTeamList && strlen(pTeamList) )
			{
				strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH );
			}
		}
	}
	// Has the server set teams
	if ( strlen( m_szTeamList ) )
		m_teamLimit = TRUE;
	else
		m_teamLimit = FALSE;

	RecountTeams();
}

extern cvar_t timeleft, fragsleft;

#include "voice_gamemgr.h"
extern CVoiceGameMgr	g_VoiceGameMgr;

void CHalfLifeTeamplay :: Think ( void )
{
	///// Check game rules /////
	static int last_frags;
	static int last_time;

	int frags_remaining = 0;
	int time_remaining = 0;

	g_VoiceGameMgr.Update(gpGlobals->frametime);

	if ( g_fGameOver )   // someone else quit the game already
	{
		CHalfLifeMultiplay::Think();
		return;
	}

	float flTimeLimit = CVAR_GET_FLOAT("mp_timelimit") * 60;

	time_remaining = (int)(flTimeLimit ? ( flTimeLimit - gpGlobals->time ) : 0);

	if ( flTimeLimit != 0 && gpGlobals->time >= flTimeLimit )
	{
		GoToIntermission();
		return;
	}

	float flFragLimit = fraglimit.value;
	if ( flFragLimit )
	{
		int bestfrags = 9999;
		int remain;

		// check if any team is over the frag limit
		for ( int i = 0; i < num_teams; i++ )
		{
			if ( team_scores[i] >= flFragLimit )
			{
				GoToIntermission();
				return;
			}

			remain = flFragLimit - team_scores[i];
			if ( remain < bestfrags )
			{
				bestfrags = remain;
			}
		}
		frags_remaining = bestfrags;
	}

	// Updates when frags change
	if ( frags_remaining != last_frags )
	{
		g_engfuncs.pfnCvar_DirectSet( &fragsleft, UTIL_VarArgs( "%i", frags_remaining ) );
	}

	// Updates once per second
	if ( timeleft.value != last_time )
	{
		g_engfuncs.pfnCvar_DirectSet( &timeleft, UTIL_VarArgs( "%i", time_remaining ) );
	}

	last_frags = frags_remaining;
	last_time  = time_remaining;
}

//=========================================================
// ClientCommand
// the user has typed a command which is unrecognized by everything else;
// this check to see if the gamerules knows anything about the command
//=========================================================
BOOL CHalfLifeTeamplay :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{
	if(g_VoiceGameMgr.ClientCommand(pPlayer, pcmd))
		return TRUE;

	if ( FStrEq( pcmd, "menuselect" ) )
	{
		if ( CMD_ARGC() < 2 )
			return TRUE;

		int slot = atoi( CMD_ARGV(1) );

		// select the item from the current menu

		return TRUE;
	}

	return FALSE;
}

extern int gmsgGameMode;
extern int gmsgSayText;
extern int gmsgTeamInfo;
extern int gmsgTeamNames;
extern int gmsgScoreInfo;

void CHalfLifeTeamplay :: UpdateGameMode( CBasePlayer *pPlayer )
{
	MESSAGE_BEGIN( MSG_ONE, gmsgGameMode, NULL, pPlayer->edict() );
		WRITE_BYTE( 1 );  // game mode teamplay
	MESSAGE_END();
}

const char *CHalfLifeTeamplay::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
{
	// copy out the team name from the model
	char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
	strncpy( pPlayer->m_szTeamName, mdls, TEAM_NAME_LENGTH );

	RecountTeams();

	// update the current player of the team he is joining
	if ( pPlayer->m_szTeamName[0] == '\0' || !IsValidTeam( pPlayer->m_szTeamName ) || defaultteam.value )
	{
		const char *pTeamName = NULL;

		if ( defaultteam.value )
		{
			pTeamName = team_names[0];
		}
		else
		{
			pTeamName = TeamWithFewestPlayers();
		}
		strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );
	}

	return pPlayer->m_szTeamName;
}

//=========================================================
// InitHUD
//=========================================================
void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer )
{
	int i;

	SetDefaultPlayerTeam( pPlayer );
	CHalfLifeMultiplay::InitHUD( pPlayer );

	// Send down the team names
	MESSAGE_BEGIN( MSG_ONE, gmsgTeamNames, NULL, pPlayer->edict() );
		WRITE_BYTE( num_teams );
		for ( i = 0; i < num_teams; i++ )
		{
			WRITE_STRING( team_names[ i ] );
		}
	MESSAGE_END();

	RecountTeams();

	char *mdls = g_engfuncs.pfnInfoKeyValue( g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model" );
	// update the current player of the team he is joining
	char text[1024];
	if ( !strcmp( mdls, pPlayer->m_szTeamName ) )
	{
		sprintf( text, "* you are on team \'%s\'\n", pPlayer->m_szTeamName );
	}
	else
	{
		sprintf( text, "* assigned to team %s\n", pPlayer->m_szTeamName );
	}

	ChangePlayerTeam( pPlayer, pPlayer->m_szTeamName, FALSE, FALSE );
	UTIL_SayText( text, pPlayer );
	int clientIndex = pPlayer->entindex();
	RecountTeams();
	// update this player with all the other players team info
	// loop through all active players and send their team info to the new client
	for ( i = 1; i <= gpGlobals->maxClients; i++ )
	{
		CBaseEntity *plr = UTIL_PlayerByIndex( i );
		if ( plr && IsValidTeam( plr->TeamID() ) )
		{
			MESSAGE_BEGIN( MSG_ONE, gmsgTeamInfo, NULL, pPlayer->edict() );
				WRITE_BYTE( plr->entindex() );
				WRITE_STRING( plr->TeamID() );
			MESSAGE_END();
		}
	}
}

void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, BOOL bKill, BOOL bGib )
{
	int damageFlags = DMG_GENERIC;
	int clientIndex = pPlayer->entindex();

	if ( !bGib )
	{
		damageFlags |= DMG_NEVERGIB;
	}
	else
	{
		damageFlags |= DMG_ALWAYSGIB;
	}

	if ( bKill )
	{
		// kill the player,  remove a death,  and let them start on the new team
		m_DisableDeathMessages = TRUE;
		m_DisableDeathPenalty = TRUE;

		entvars_t *pevWorld = VARS( INDEXENT(0) );
		pPlayer->TakeDamage( pevWorld, pevWorld, 900, damageFlags );

		m_DisableDeathMessages = FALSE;
		m_DisableDeathPenalty = FALSE;
	}

	// copy out the team name from the model
	strncpy( pPlayer->m_szTeamName, pTeamName, TEAM_NAME_LENGTH );

	g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
	g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );

	// notify everyone's HUD of the team change
	MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo );
		WRITE_BYTE( clientIndex );
		WRITE_STRING( pPlayer->m_szTeamName );
	MESSAGE_END();

	MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
		WRITE_BYTE( clientIndex );
		WRITE_SHORT( pPlayer->pev->frags );
		WRITE_SHORT( pPlayer->m_iDeaths );
		WRITE_SHORT( 0 );
		WRITE_SHORT( g_pGameRules->GetTeamIndex( pPlayer->m_szTeamName ) + 1 );
	MESSAGE_END();
}

//=========================================================
// ClientUserInfoChanged
//=========================================================
void CHalfLifeTeamplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer )
{
	char text[1024];

	// prevent skin/color/model changes
	char *mdls = g_engfuncs.pfnInfoKeyValue( infobuffer, "model" );

	if ( !stricmp( mdls, pPlayer->m_szTeamName ) )
		return;

	if ( defaultteam.value )
	{
		int clientIndex = pPlayer->entindex();

		g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
		g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
		sprintf( text, "* Not allowed to change teams in this game!\n" );
		UTIL_SayText( text, pPlayer );
		return;
	}

	if ( defaultteam.value || !IsValidTeam( mdls ) )
	{
		int clientIndex = pPlayer->entindex();

		g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "model", pPlayer->m_szTeamName );
		sprintf( text, "* Can't change team to \'%s\'\n", mdls );
		UTIL_SayText( text, pPlayer );
		sprintf( text, "* Server limits teams to \'%s\'\n", m_szTeamList );
		UTIL_SayText( text, pPlayer );
		return;
	}
	// notify everyone of the team change
	sprintf( text, "* %s has changed to team \'%s\'\n", STRING(pPlayer->pev->netname), mdls );
	UTIL_SayTextAll( text, pPlayer );

	UTIL_LogPrintf( "\"%s<%i><%s><%s>\" joined team \"%s\"\n",
		STRING(pPlayer->pev->netname),
		GETPLAYERUSERID( pPlayer->edict() ),
		GETPLAYERAUTHID( pPlayer->edict() ),
		pPlayer->m_szTeamName,
		mdls );

	ChangePlayerTeam( pPlayer, mdls, TRUE, TRUE );
	// recound stuff
	RecountTeams( TRUE );
}

extern int gmsgDeathMsg;

//=========================================================
// Deathnotice.
//=========================================================
void CHalfLifeTeamplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pevInflictor )
{
	if ( m_DisableDeathMessages )
		return;

	if ( pVictim && pKiller && pKiller->flags & FL_CLIENT )
	{
		CBasePlayer *pk = (CBasePlayer*) CBaseEntity::Instance( pKiller );

		if ( pk )
		{
			if ( (pk != pVictim) && (PlayerRelationship( pVictim, pk ) == GR_TEAMMATE) )
			{
				MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
					WRITE_BYTE( ENTINDEX(ENT(pKiller)) );		// the killer
					WRITE_BYTE( ENTINDEX(pVictim->edict()) );	// the victim
					WRITE_STRING( "teammate" );		// flag this as a teammate kill
				MESSAGE_END();
				return;
			}
		}
	}

	CHalfLifeMultiplay::DeathNotice( pVictim, pKiller, pevInflictor );
}

//=========================================================
//=========================================================
void CHalfLifeTeamplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor )
{
	if ( !m_DisableDeathPenalty )
	{
		CHalfLifeMultiplay::PlayerKilled( pVictim, pKiller, pInflictor );
		RecountTeams();
	}
}

//=========================================================
// IsTeamplay
//=========================================================
BOOL CHalfLifeTeamplay::IsTeamplay( void )
{
	return TRUE;
}

BOOL CHalfLifeTeamplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker )
{
	if ( pAttacker && PlayerRelationship( pPlayer, pAttacker ) == GR_TEAMMATE )
	{
		// my teammate hit me.
		if ( (friendlyfire.value == 0) && (pAttacker != pPlayer) )
		{
			// friendly fire is off, and this hit came from someone other than myself,  then don't get hurt
			return FALSE;
		}
	}

	return CHalfLifeMultiplay::FPlayerCanTakeDamage( pPlayer, pAttacker );
}

//=========================================================
//=========================================================
int CHalfLifeTeamplay::PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget )
{
	// half life multiplay has a simple concept of Player Relationships.
	// you are either on another player's team, or you are not.
	if ( !pPlayer || !pTarget || !pTarget->IsPlayer() )
		return GR_NOTTEAMMATE;

	if ( (*GetTeamID(pPlayer) != '\0') && (*GetTeamID(pTarget) != '\0') && !stricmp( GetTeamID(pPlayer), GetTeamID(pTarget) ) )
	{
		return GR_TEAMMATE;
	}

	return GR_NOTTEAMMATE;
}

//=========================================================
//=========================================================
BOOL CHalfLifeTeamplay::ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target )
{
	// always autoaim, unless target is a teammate
	CBaseEntity *pTgt = CBaseEntity::Instance( target );
	if ( pTgt && pTgt->IsPlayer() )
	{
		if ( PlayerRelationship( pPlayer, pTgt ) == GR_TEAMMATE )
			return FALSE; // don't autoaim at teammates
	}

	return CHalfLifeMultiplay::ShouldAutoAim( pPlayer, target );
}

//=========================================================
//=========================================================
int CHalfLifeTeamplay::IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled )
{
	if ( !pKilled )
		return 0;

	if ( !pAttacker )
		return 1;

	if ( pAttacker != pKilled && PlayerRelationship( pAttacker, pKilled ) == GR_TEAMMATE )
		return -1;

	return 1;
}

//=========================================================
//=========================================================
const char *CHalfLifeTeamplay::GetTeamID( CBaseEntity *pEntity )
{
	if ( pEntity == NULL || pEntity->pev == NULL )
		return "";

	// return their team name
	return pEntity->TeamID();
}

int CHalfLifeTeamplay::GetTeamIndex( const char *pTeamName )
{
	if ( pTeamName && *pTeamName != 0 )
	{
		// try to find existing team
		for ( int tm = 0; tm < num_teams; tm++ )
		{
			if ( !stricmp( team_names[tm], pTeamName ) )
				return tm;
		}
	}

	return -1;	// No match
}

const char *CHalfLifeTeamplay::GetIndexedTeamName( int teamIndex )
{
	if ( teamIndex < 0 || teamIndex >= num_teams )
		return "";

	return team_names[ teamIndex ];
}

BOOL CHalfLifeTeamplay::IsValidTeam( const char *pTeamName )
{
	if ( !m_teamLimit )	// Any team is valid if the teamlist isn't set
		return TRUE;

	return ( GetTeamIndex( pTeamName ) != -1 ) ? TRUE : FALSE;
}

const char *CHalfLifeTeamplay::TeamWithFewestPlayers( void )
{
	int i;
	int minPlayers = MAX_TEAMS;
	int teamCount[ MAX_TEAMS ];
	char *pTeamName = NULL;

	memset( teamCount, 0, MAX_TEAMS * sizeof(int) );

	// loop through all clients, count number of players on each team
	for ( i = 1; i <= gpGlobals->maxClients; i++ )
	{
		CBaseEntity *plr = UTIL_PlayerByIndex( i );

		if ( plr )
		{
			int team = GetTeamIndex( plr->TeamID() );
			if ( team >= 0 )
				teamCount[team] ++;
		}
	}

	// Find team with least players
	for ( i = 0; i < num_teams; i++ )
	{
		if ( teamCount[i] < minPlayers )
		{
			minPlayers = teamCount[i];
			pTeamName = team_names[i];
		}
	}

	return pTeamName;
}

//=========================================================
//=========================================================
void CHalfLifeTeamplay::RecountTeams( bool bResendInfo )
{
	char	*pName;
	char	teamlist[TEAMPLAY_TEAMLISTLENGTH];

	// loop through all teams, recounting everything
	num_teams = 0;

	// Copy all of the teams from the teamlist
	// make a copy because strtok is destructive
	strcpy( teamlist, m_szTeamList );
	pName = teamlist;
	pName = strtok( pName, ";" );
	while ( pName != NULL && *pName )
	{
		if ( GetTeamIndex( pName ) < 0 )
		{
			strcpy( team_names[num_teams], pName );
			num_teams++;
		}
		pName = strtok( NULL, ";" );
	}

	if ( num_teams < 2 )
	{
		num_teams = 0;
		m_teamLimit = FALSE;
	}

	// Sanity check
	memset( team_scores, 0, sizeof(team_scores) );

	// loop through all clients
	for ( int i = 1; i <= gpGlobals->maxClients; i++ )
	{
		CBaseEntity *plr = UTIL_PlayerByIndex( i );

		if ( plr )
		{
			const char *pTeamName = plr->TeamID();
			// try add to existing team
			int tm = GetTeamIndex( pTeamName );

			if ( tm < 0 ) // no team match found
			{
				if ( !m_teamLimit )
				{
					// add to new team
					tm = num_teams;
					num_teams++;
					team_scores[tm] = 0;
					strncpy( team_names[tm], pTeamName, MAX_TEAMNAME_LENGTH );
				}
			}

			if ( tm >= 0 )
			{
				team_scores[tm] += plr->pev->frags;
			}

			if ( bResendInfo ) //Someone's info changed, let's send the team info again.
			{
				if ( plr && IsValidTeam( plr->TeamID() ) )
				{
					MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo, NULL );
						WRITE_BYTE( plr->entindex() );
						WRITE_STRING( plr->TeamID() );
					MESSAGE_END();
				}
			}
		}
	}
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "specialization".
 *
 * @property integer $id
 * @property string $created_on
 * @property string $last_modified_on
 * @property string $trash
 * @property string $name
 * @property string $status
 * @property integer $subsector
 * @property double $Expert technical weight
 * @property double $Expert economical weight
 * @property double $Expert creative weight
 *
 * @property ExpertSpecialization[] $expertSpecializations
 * @property SubSector $subsector0
 */
class Specialization extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'specialization';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['created_on', 'last_modified_on'], 'safe'],
            [['trash', 'status'], 'string'],
            [['name', 'subsector', 'Expert technical weight', 'Expert economical weight', 'Expert creative weight'], 'required'],
            [['subsector'], 'integer'],
            [['Expert technical weight', 'Expert economical weight', 'Expert creative weight'], 'number'],
            [['name'], 'string', 'max' => 20],
            [['subsector'], 'exist', 'skipOnError' => true, 'targetClass' => SubSector::className(), 'targetAttribute' => ['subsector' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'created_on' => 'Created On',
            'last_modified_on' => 'Last Modified On',
            'trash' => 'Trash',
            'name' => 'Name',
            'status' => 'Status',
            'subsector' => 'Subsector',
            'Expert technical weight' => 'Expert Technical Weight',
            'Expert economical weight' => 'Expert Economical Weight',
            'Expert creative weight' => 'Expert Creative Weight',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getExpertSpecializations()
    {
        return $this->hasMany(ExpertSpecialization::className(), ['name' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getSubsector0()
    {
        return $this->hasOne(SubSector::className(), ['id' => 'subsector']);
    }
}


text:
Galileo Rev D                            {#galileorevd}
=============

Galileo is a microcontroller board based on the Intel® Quark SoC X1000
Application Processor, a 32-bit Intel Pentium-class system on a chip.

The rev D board has the following limitations in libmraa:

- gpio register access via /dev/uio is limited to pin2 and 3
- gpio interupts will only work on GPIO_EDGE_BOTH


text:
package com.wincom.mstar.readconfig;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

public class ReadConfig {
	private String Filter="";
	public ReadConfig(){
		try {
			HttpServletRequest request = ServletActionContext.getRequest();
			String basePath=request.getSession().getServletContext().getRealPath("/WEB-INF/FilterSignalName.properties");
			Properties prop = new Properties();
			FileInputStream fis=new FileInputStream(basePath);
			BufferedReader bf = new BufferedReader(new InputStreamReader(fis,"utf8"));
			prop.load(bf);
			Filter=prop.getProperty( "Filter" ).trim();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
	public String getFilter(){
		return Filter;
	}
}


text:
package com.github.florent37.materialviewpager.worldmovies.model;

import java.io.Serializable;

/**
 * Created by aaron on 2016/4/4.
 */

public class ImdbObject implements Serializable {
    private String title;
    private String top;
    private String year;
    private String detailUrl;
    private String description;
    private String rating;
    private String posterUrl;
    private String cast;
    private String review;
    private String slate;
    private String summery;
    private String plot;
    private String genre;
    private String votes;
    private String runTime;
    private String metaScore;
    private String delta;
    private String type;
    private String country;
    private String detailPosterUrl;
    private String trailerUrl;
    private String galleryUrl;
    private boolean bookmark;

    public class GalleryItem {
        private String type;
        private String url;

        public String getType() {
            return type;
        }

        public String getUrl() {
            return url;
        }
    }

    public class CastItem {
        private String cast;
        private String link;
        private String as;
        private String avatar;

        public String getCast() {
            return cast;
        }

        public String getAs() {
            return as;
        }

        public String getAvatar() {
            return avatar;
        }

        public String getUrl() {
            return link;
        }
    }

    public void setBookmark(boolean bookmark) {
        this.bookmark = bookmark;
    }

    public Boolean getBookmark() { return this.bookmark;}

    public class RatingItem {
        private String score;
        private String votes;
        public String getScore() { return score;}
        public String getVotes() { return votes;}
    }

    public ImdbObject(String title, String top, String year, String description, String rating,
                      String posterUrl, String slate, String summery, String plot, String genre,
                      String votes, String runTime, String metaScore, String delta, String country, String trailerUrl, String cast, String galleryUrl, String detailUrl) {
        this.title = title;
        this.top = top;
        this.description = description;
        this.year = year;
        this.detailUrl = detailUrl;
        this.rating = rating;
        this.posterUrl = posterUrl;
        this.slate = slate;
        this.summery = summery;
        this.plot = plot;
        this.genre = genre;
        this.votes = votes;
        this.runTime = runTime;
        this.metaScore = metaScore;
        this.country = country;
        this.cast = cast;
        this.delta = delta;
        this.detailPosterUrl = detailPosterUrl;
        this.trailerUrl = trailerUrl;
        this.galleryUrl = galleryUrl;
        this.bookmark = false;
    }

    public String getCast() { return cast;}

    public String getTrailerUrl() {
        return trailerUrl;
    }

    public String getTitle() {
        return title;
    }

    public String getTop() {
        return top;
    }

    public String getRating() {
        return rating;
    }

    public String getYear() {
        return year;
    }

    public String getDetailUrl() {
        return detailUrl;
    }

    public String getDescription() {
        return description;
    }

    public String getPosterUrl() {
        return posterUrl;
    }

    public String getGalleryUrl() {
        return galleryUrl;
    }

    public String getSlate() {
        return slate;
    }

    public String getSummery() {
        return summery;
    }

    public String getPlot() {return plot;}

    public String getGenre() {
        String[] items = genre.replaceAll("\\[", "").replaceAll("\\]","").split(",");
        String result = "";
        for (int i = 0; i<items.length; i++){
            items[i] = items[i].replaceAll("\"","");
            if (i+1 < items.length)
                result += items[i] + ", ";
            else
                result += items[i];
        }
        return result;}

    public String getVotes() {return votes;}

    public String getRunTime() {return runTime;}

    public String getMetaScore() {return metaScore;}

    public int getDelta() {
        if (delta.equals("0"))
            return 0;
        else
            return Integer.parseInt(delta);
    }

    public String getCountry() {
        return country;
    }

    public String getReview() { return review; }

    public String getType() { return type; }

    public String getDetailPosterUrl() {
        return detailPosterUrl;
    }

    public void setPosterUrl(String imageUrl) {
        this.posterUrl = posterUrl;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setType (String type) { this.type = type; }
}


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

namespace Microsoft.Azure.Commands.LogicApp.Cmdlets
{
    using Microsoft.Azure.Commands.LogicApp.Utilities;
    using System.Management.Automation;

    /// <summary>
    /// Gets the access key of a workflow.
    /// </summary>
    [Cmdlet(VerbsCommon.Get, "AzureRmLogicAppAccessKey"), OutputType(typeof(object))]
    public class GetAzureLogicAppAccessKeyCommand : LogicAppBaseCmdlet
    {
        #region private attribues

        private string _accessKeyName = "default";

        #endregion private attribues
        #region Input Parameters

        [Parameter(Mandatory = true, HelpMessage = "The targeted resource group for the workflow.",
            ValueFromPipelineByPropertyName = true)]
        [ValidateNotNullOrEmpty]
        public string ResourceGroupName { get; set; }

        [Parameter(Mandatory = true, HelpMessage = "The name of the workflow.",
            ValueFromPipelineByPropertyName = true)]
        [ValidateNotNullOrEmpty]
        public string Name { get; set; }

        [Parameter(Mandatory = false, HelpMessage = "The name of the workflow accesskey.",
            ValueFromPipelineByPropertyName = true)]
        [ValidateNotNullOrEmpty]
        public string AccessKeyName
        {
            get { return this._accessKeyName; }
            set { this._accessKeyName = value; }
        }

        #endregion Input Parameters

        /// <summary>
        /// Executes the get workflow accesskey command
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            this.WriteObject(
                LogicAppClient.GetWorkflowAccessKey(this.ResourceGroupName, this.Name, this.AccessKeyName), true);
        }
    }
}


text:
package org.neo4j.kernel.impl.api;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertThat;
import static org.neo4j.collection.primitive.PrimitiveLongCollections.iterator;
import static org.neo4j.graphdb.Neo4jMatchers.hasSamePrimitiveItems;

import java.util.Iterator;

import org.junit.Test;
import org.neo4j.collection.primitive.PrimitiveLongIterator;
import org.neo4j.kernel.impl.util.diffsets.DiffSets;

public class LongDiffSetsTest
{

    // TODO empty diffset EMPTY
    // TODO null/isEmpty elements

    @Test
    public void shouldContainSourceForEmptyDiffSets() throws Exception
    {
        // given
        DiffSets<Long> diffSets = new DiffSets<>( );
        Iterator<Long> expected = diffSets.apply( iteratorSource( 1l, 2l ) );

        // when
        PrimitiveLongIterator actual = diffSets.augment( iterator( 1l, 2l ) );

        // then
        assertThat( expected, hasSamePrimitiveItems( actual ) );
    }

    @Test
    public void shouldContainFilteredSourceForDiffSetsWithRemovedElements() throws Exception
    {
        // given
        DiffSets<Long> diffSets = new DiffSets<>( );
        diffSets.remove( 17l );
        diffSets.remove( 18l );
        Iterator<Long> expected = diffSets.apply( iteratorSource( 1L, 17l, 3l ) );

        // when
        PrimitiveLongIterator actual = diffSets.augment( iterator( 1l, 17l, 3l ) );

        // then
        assertThat( expected, hasSamePrimitiveItems( actual ) );
    }

    @Test
    public void shouldContainFilteredSourceForDiffSetsWithAddedElements() throws Exception
    {
        // given
        DiffSets<Long> diffSets = new DiffSets<>( );
        diffSets.add( 17l );
        diffSets.add( 18l );
        Iterator<Long> expected = diffSets.apply( iteratorSource( 1L, 17l, 3l ) );

        // when
        PrimitiveLongIterator actual = diffSets.augment( iterator( 1l, 17l, 3l ) );

        // then
        assertThat( expected, hasSamePrimitiveItems( actual ) );
    }

    @Test
    public void shouldContainAddedElementsForDiffSetsWithAddedElements() throws Exception
    {
        // given
        DiffSets<Long> diffSets = new DiffSets<>( );
        diffSets.add( 19l );
        diffSets.add( 20l );
        Iterator<Long> expected = diffSets.apply( iteratorSource( 19l ) );

        // when
        PrimitiveLongIterator actual = diffSets.augment( iterator( 19l ) );

        // then
        assertThat( expected, hasSamePrimitiveItems( actual ) );
    }

    private static Iterator<Long> iteratorSource( Long... values )
    {
        return asList( values ).iterator();
    }
}


text:
using System.Linq;
using Assets.Fort.Infrastuctures.Events;
using Fort.Info;
using Fort.Info.Language;
using UnityEngine;

namespace Fort
{
    [Service(ServiceType = typeof(ILanguageService))]
    class LanguageService:MonoBehaviour,ILanguageService
    {
        #region Implementation of ILanguageService

        public void ActivateLanguage(LanguageInfo language)
        {
            LanguageSavedData languageSavedData =
                ServiceLocator.Resolve<IStorageService>().ResolveData<LanguageSavedData>() ?? new LanguageSavedData();
            languageSavedData.LanguageId = language.Id;
            ServiceLocator.Resolve<IStorageService>().UpdateData(languageSavedData);
            ServiceLocator.Resolve<IEventAggregatorService>().GetEvent<LanguageActivatedEvent>().Publish(new LanguageActivatedEventArgs(language));
        }

        public LanguageInfo GetActiveLanguage()
        {
            LanguageSavedData languageSavedData =
                ServiceLocator.Resolve<IStorageService>().ResolveData<LanguageSavedData>() ?? new LanguageSavedData();
            LanguageInfo result =
                InfoResolver.Resolve<FortInfo>().Language.ActiveLanguages.Where(info => info != null).FirstOrDefault(
                    info => info.Id == languageSavedData.LanguageId);
            if (result == null)
            {
                result = InfoResolver.Resolve<FortInfo>().Language.DefaultLanguage;
                if (result == null)
                {
                    result = InfoResolver.Resolve<FortInfo>().Language.ActiveLanguages.FirstOrDefault(info => info != null);
                }
            }
            return result;
        }

        public LanguageInfo[] GetLanguagesList()
        {
            return InfoResolver.Resolve<FortInfo>().Language.ActiveLanguages.Where(info => info != null).ToArray();
        }

        #endregion

        class LanguageSavedData
        {
            public string LanguageId { get; set; }
        }
    }
}