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

<!--
 Copyright (c) 2012 Joe Rowley
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 -->

<FrameLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

	<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
		style="@style/layoutRootNight"
	    android:id="@+id/manage_equipment_root"
	    >

        <LinearLayout
            android:id="@+id/header_container"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
    	    android:layout_gravity="center"
            >

		    <TextView
			    style="@style/headerBarNight"
			    android:id="@+id/add_catalogs_header"
			    android:text="@string/app_name"
			    />

		    <Button
		        style="@style/menu_launcher_button_night"
		        android:id="@+id/menu_launcher"
		        />

	    </LinearLayout>

	    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
		    android:id="@android:id/tabhost"
		    android:layout_width="fill_parent"
		    android:layout_height="wrap_content">

		    <RelativeLayout
		        android:layout_width="fill_parent"
		        android:layout_height="wrap_content"
		        android:padding="@dimen/five_pix">

		        <TabWidget
		            android:id="@android:id/tabs"
		            android:layout_width="fill_parent"
		            android:layout_height="wrap_content"
		            android:tabStripEnabled="true"/>

		        <FrameLayout
		            android:id="@android:id/tabcontent"
		            android:layout_width="fill_parent"
		            android:layout_height="wrap_content"
		            android:padding="5dp"
		            android:layout_below="@android:id/tabs" />

		    </RelativeLayout>

		</TabHost>

	</LinearLayout>

    <include android:id="@+id/custom_menu"
        layout="@layout/custom_menu_night"
        android:layout_width="wrap_content"
    	android:layout_height="fill_parent"
    	android:visibility="invisible"
    	/>

</FrameLayout>


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->
<web-app
	xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	version="2.5">

   <!--
   ======================== Introduction ==============================

   This document defines default values for *all* web applications
   loaded into this instance of Tomcat.  As each application is
   deployed, this file is processed, followed by the
   "/WEB-INF/web.xml" deployment descriptor from your own
   applications.

   WARNING:  Do not configure application-specific resources here!
   They should go in the "/WEB-INF/web.xml" file in your application.

   ================== Built In Servlet Definitions ====================

   The default servlet for all web applications, that serves static
   resources.  It processes all requests that are not mapped to other
   servlets with servlet mappings (defined either here or in your own
   web.xml file.  This servlet supports the following initialization
   parameters (default values are in square brackets):

     debug               Debugging detail level for messages logged
                         by this servlet.  [0]

     fileEncoding        Encoding to be used to read static resources
                         [platform default]

     input               Input buffer size (in bytes) when reading
                         resources to be served.  [2048]

     listings            Should directory listings be produced if there
                         is no welcome file in this directory?  [false]
                         WARNING: Listings for directories with many
                         entries can be slow and may consume
                         significant proportions of server resources.

     output              Output buffer size (in bytes) when writing
                         resources to be served.  [2048]

     readonly            Is this context "read only", so HTTP
                         commands like PUT and DELETE are
                         rejected?  [true]

     readmeFile          File name to display with the directory
                         contents. [null]

     sendfileSize        If the connector used supports sendfile, this
                         represents the minimal file size in KB for
                         which sendfile will be used. Use a negative
                         value to always disable sendfile.  [48]

     useAcceptRanges     Should the Accept-Ranges header be included
                         in responses where appropriate? [true]

    For directory listing customization. Checks localXsltFile, then
    globalXsltFile, then defaults to original behavior.

     localXsltFile       Make directory listings an XML doc and
                         pass the result to this style sheet residing
                         in that directory. This overrides
                         contextXsltFile and globalXsltFile[null]

     contextXsltFile     Make directory listings an XML doc and
                         pass the result to this style sheet which is
                         relative to the context root. This overrides
                         globalXsltFile[null]

     globalXsltFile      Site wide configuration version of
                         localXsltFile This argument is expected
                         to be a physical file. [null]

                                                                     -->

	<servlet>
		<servlet-name>default</servlet-name>
		<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
		<init-param>
			<param-name>debug</param-name>
			<param-value>0</param-value>
		</init-param>
		<init-param>
			<param-name>listings</param-name>
			<param-value>false</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet>
		<servlet-name>jsp</servlet-name>
		<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
		<init-param>
			<param-name>fork</param-name>
			<param-value>false</param-value>
		</init-param>
		<init-param>
			<param-name>xpoweredBy</param-name>
			<param-value>false</param-value>
		</init-param>
		<load-on-startup>3</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>default</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>jsp</servlet-name>
		<url-pattern>*.jsp</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>jsp</servlet-name>
		<url-pattern>*.jspx</url-pattern>
	</servlet-mapping>

	<session-config>
		<session-timeout>1</session-timeout>
	</session-config>

	<mime-mapping>
		<extension>abs</extension>
		<mime-type>audio/x-mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ai</extension>
		<mime-type>application/postscript</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>aif</extension>
		<mime-type>audio/x-aiff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>aifc</extension>
		<mime-type>audio/x-aiff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>aiff</extension>
		<mime-type>audio/x-aiff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>aim</extension>
		<mime-type>application/x-aim</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>art</extension>
		<mime-type>image/x-jg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>asf</extension>
		<mime-type>video/x-ms-asf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>asx</extension>
		<mime-type>video/x-ms-asf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>au</extension>
		<mime-type>audio/basic</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>avi</extension>
		<mime-type>video/x-msvideo</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>avx</extension>
		<mime-type>video/x-rad-screenplay</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>bcpio</extension>
		<mime-type>application/x-bcpio</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>bin</extension>
		<mime-type>application/octet-stream</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>bmp</extension>
		<mime-type>image/bmp</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>body</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>cdf</extension>
		<mime-type>application/x-cdf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>cer</extension>
		<mime-type>application/x-x509-ca-cert</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>class</extension>
		<mime-type>application/java</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>cpio</extension>
		<mime-type>application/x-cpio</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>csh</extension>
		<mime-type>application/x-csh</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>css</extension>
		<mime-type>text/css</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>dib</extension>
		<mime-type>image/bmp</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>doc</extension>
		<mime-type>application/msword</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>dtd</extension>
		<mime-type>application/xml-dtd</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>dv</extension>
		<mime-type>video/x-dv</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>dvi</extension>
		<mime-type>application/x-dvi</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>eps</extension>
		<mime-type>application/postscript</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>etx</extension>
		<mime-type>text/x-setext</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>exe</extension>
		<mime-type>application/octet-stream</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>gif</extension>
		<mime-type>image/gif</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>gtar</extension>
		<mime-type>application/x-gtar</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>gz</extension>
		<mime-type>application/x-gzip</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>hdf</extension>
		<mime-type>application/x-hdf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>hqx</extension>
		<mime-type>application/mac-binhex40</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>htc</extension>
		<mime-type>text/x-component</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>htm</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>html</extension>
		<mime-type>text/html</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>hqx</extension>
		<mime-type>application/mac-binhex40</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ief</extension>
		<mime-type>image/ief</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jad</extension>
		<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jar</extension>
		<mime-type>application/java-archive</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>java</extension>
		<mime-type>text/plain</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jnlp</extension>
		<mime-type>application/x-java-jnlp-file</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jpe</extension>
		<mime-type>image/jpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jpeg</extension>
		<mime-type>image/jpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jpg</extension>
		<mime-type>image/jpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>js</extension>
		<mime-type>text/javascript</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jsf</extension>
		<mime-type>text/plain</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>jspf</extension>
		<mime-type>text/plain</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>kar</extension>
		<mime-type>audio/x-midi</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>latex</extension>
		<mime-type>application/x-latex</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>m3u</extension>
		<mime-type>audio/x-mpegurl</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mac</extension>
		<mime-type>image/x-macpaint</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>man</extension>
		<mime-type>application/x-troff-man</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mathml</extension>
		<mime-type>application/mathml+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>me</extension>
		<mime-type>application/x-troff-me</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mid</extension>
		<mime-type>audio/x-midi</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>midi</extension>
		<mime-type>audio/x-midi</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mif</extension>
		<mime-type>application/x-mif</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mov</extension>
		<mime-type>video/quicktime</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>movie</extension>
		<mime-type>video/x-sgi-movie</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mp1</extension>
		<mime-type>audio/x-mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mp2</extension>
		<mime-type>audio/x-mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mp3</extension>
		<mime-type>audio/x-mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mp4</extension>
		<mime-type>video/mp4</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mpa</extension>
		<mime-type>audio/x-mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mpe</extension>
		<mime-type>video/mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mpeg</extension>
		<mime-type>video/mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mpega</extension>
		<mime-type>audio/x-mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mpg</extension>
		<mime-type>video/mpeg</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>mpv2</extension>
		<mime-type>video/mpeg2</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ms</extension>
		<mime-type>application/x-wais-source</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>nc</extension>
		<mime-type>application/x-netcdf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>oda</extension>
		<mime-type>application/oda</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Database -->
		<extension>odb</extension>
		<mime-type>application/vnd.oasis.opendocument.database</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Chart -->
		<extension>odc</extension>
		<mime-type>application/vnd.oasis.opendocument.chart</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Formula -->
		<extension>odf</extension>
		<mime-type>application/vnd.oasis.opendocument.formula</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Drawing -->
		<extension>odg</extension>
		<mime-type>application/vnd.oasis.opendocument.graphics</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Image -->
		<extension>odi</extension>
		<mime-type>application/vnd.oasis.opendocument.image</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Master Document -->
		<extension>odm</extension>
		<mime-type>application/vnd.oasis.opendocument.text-master</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Presentation -->
		<extension>odp</extension>
		<mime-type>application/vnd.oasis.opendocument.presentation</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Spreadsheet -->
		<extension>ods</extension>
		<mime-type>application/vnd.oasis.opendocument.spreadsheet</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Text -->
		<extension>odt</extension>
		<mime-type>application/vnd.oasis.opendocument.text</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ogg</extension>
		<mime-type>application/ogg</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Drawing Template -->
		<extension>otg</extension>
		<mime-type>application/vnd.oasis.opendocument.graphics-template</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- HTML Document Template -->
		<extension>oth</extension>
		<mime-type>application/vnd.oasis.opendocument.text-web</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Presentation Template -->
		<extension>otp</extension>
		<mime-type>application/vnd.oasis.opendocument.presentation-template</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Spreadsheet Template -->
		<extension>ots</extension>
		<mime-type>application/vnd.oasis.opendocument.spreadsheet-template</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- OpenDocument Text Template -->
		<extension>ott</extension>
		<mime-type>application/vnd.oasis.opendocument.text-template</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pbm</extension>
		<mime-type>image/x-portable-bitmap</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pct</extension>
		<mime-type>image/pict</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pdf</extension>
		<mime-type>application/pdf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pgm</extension>
		<mime-type>image/x-portable-graymap</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pic</extension>
		<mime-type>image/pict</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pict</extension>
		<mime-type>image/pict</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pls</extension>
		<mime-type>audio/x-scpls</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>png</extension>
		<mime-type>image/png</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pnm</extension>
		<mime-type>image/x-portable-anymap</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pnt</extension>
		<mime-type>image/x-macpaint</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ppm</extension>
		<mime-type>image/x-portable-pixmap</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ppt</extension>
		<mime-type>application/vnd.ms-powerpoint</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>pps</extension>
		<mime-type>application/vnd.ms-powerpoint</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ps</extension>
		<mime-type>application/postscript</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>psd</extension>
		<mime-type>image/x-photoshop</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>qt</extension>
		<mime-type>video/quicktime</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>qti</extension>
		<mime-type>image/x-quicktime</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>qtif</extension>
		<mime-type>image/x-quicktime</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ras</extension>
		<mime-type>image/x-cmu-raster</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>rdf</extension>
		<mime-type>application/rdf+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>rgb</extension>
		<mime-type>image/x-rgb</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>rm</extension>
		<mime-type>application/vnd.rn-realmedia</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>roff</extension>
		<mime-type>application/x-troff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>rtf</extension>
		<mime-type>application/rtf</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>rtx</extension>
		<mime-type>text/richtext</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>sh</extension>
		<mime-type>application/x-sh</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>shar</extension>
		<mime-type>application/x-shar</mime-type>
	</mime-mapping>
<!--
    <mime-mapping>
        <extension>shtml</extension>
        <mime-type>text/x-server-parsed-html</mime-type>
    </mime-mapping>
-->
	<mime-mapping>
		<extension>smf</extension>
		<mime-type>audio/x-midi</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>sit</extension>
		<mime-type>application/x-stuffit</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>snd</extension>
		<mime-type>audio/basic</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>src</extension>
		<mime-type>application/x-wais-source</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>sv4cpio</extension>
		<mime-type>application/x-sv4cpio</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>sv4crc</extension>
		<mime-type>application/x-sv4crc</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>svg</extension>
		<mime-type>image/svg+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>svgz</extension>
		<mime-type>image/svg+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>swf</extension>
		<mime-type>application/x-shockwave-flash</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>t</extension>
		<mime-type>application/x-troff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tar</extension>
		<mime-type>application/x-tar</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tcl</extension>
		<mime-type>application/x-tcl</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tex</extension>
		<mime-type>application/x-tex</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>texi</extension>
		<mime-type>application/x-texinfo</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>texinfo</extension>
		<mime-type>application/x-texinfo</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tif</extension>
		<mime-type>image/tiff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tiff</extension>
		<mime-type>image/tiff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tr</extension>
		<mime-type>application/x-troff</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>tsv</extension>
		<mime-type>text/tab-separated-values</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>txt</extension>
		<mime-type>text/plain</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ulw</extension>
		<mime-type>audio/basic</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>ustar</extension>
		<mime-type>application/x-ustar</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>vxml</extension>
		<mime-type>application/voicexml+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xbm</extension>
		<mime-type>image/x-xbitmap</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xht</extension>
		<mime-type>application/xhtml+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xhtml</extension>
		<mime-type>application/xhtml+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xls</extension>
		<mime-type>application/vnd.ms-excel</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xml</extension>
		<mime-type>application/xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xpm</extension>
		<mime-type>image/x-xpixmap</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xsl</extension>
		<mime-type>application/xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xslt</extension>
		<mime-type>application/xslt+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xul</extension>
		<mime-type>application/vnd.mozilla.xul+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xwd</extension>
		<mime-type>image/x-xwindowdump</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>vsd</extension>
		<mime-type>application/x-visio</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>wav</extension>
		<mime-type>audio/x-wav</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- Wireless Bitmap -->
		<extension>wbmp</extension>
		<mime-type>image/vnd.wap.wbmp</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- WML Source -->
		<extension>wml</extension>
		<mime-type>text/vnd.wap.wml</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- Compiled WML -->
		<extension>wmlc</extension>
		<mime-type>application/vnd.wap.wmlc</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- WML Script Source -->
		<extension>wmls</extension>
		<mime-type>text/vnd.wap.wmlscript</mime-type>
	</mime-mapping>
	<mime-mapping>
        <!-- Compiled WML Script -->
		<extension>wmlscriptc</extension>
		<mime-type>application/vnd.wap.wmlscriptc</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>wmv</extension>
		<mime-type>video/x-ms-wmv</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>wrl</extension>
		<mime-type>x-world/x-vrml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>wspolicy</extension>
		<mime-type>application/wspolicy+xml</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>Z</extension>
		<mime-type>application/x-compress</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>z</extension>
		<mime-type>application/x-compress</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>zip</extension>
		<mime-type>application/zip</mime-type>
	</mime-mapping>

	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>

</web-app>

redpajama_set_name: RedPajamaGithub


text:
package jep.model.optimizationProblem.correctiveProcedure;

import jep.model.optimizationProblem.OptimizationProblem;
import jep.model.optimizationProblem.Solution;

/**
 * This interface defines a general corrective procedure. Actual corrective procedure
 * implementations are to implement this interface.
 *
 * @param <T> specific {@link OptimizationProblem}-instance this procedure is to be used for
 */
public interface CorrectiveProcedure<T extends OptimizationProblem> {

    /**
     * Enum which defines the result modes of an corrective procedure
     * {@link AbstractCorrectiveProcedure#run(ResultMode)}-method.
     *

     *
{@link #TOTAL_BEST}: Every iteration the neighbor is compared to the current best result,
     * if the neighbor has a better fitness than the current best solution, it is set as the current
     * best result. When the run-method finishes it returns the current best result.

     *
{@link #LAST}: When the run-method finishes it returns the last result.

     *

     *
     */
    public enum ResultMode {

        /**
         * Indicates that the total best result (best of initial solution and all found neighbors)
         * is to be returned.
         */
        TOTAL_BEST,

        /**
         * Indicates that the last result is to be returned.
         */
        LAST;
    }

    /**
     * Runs this corrective procedure for the given resultMode.
     *
     * @param resultMode defines if the total best or the last result is to be returned
     * @return
     */
    Solution<T> run(ResultMode resultMode);

    /**
     * This procedure is called at the end of the run method and allows to reset procedure specific
     * variables.
     */
    void reset();

    /**
     * Returns the number of iterations of the last run.
     *
     * @return
     */
    long getNumberOfIterations();
}


text:
package util;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class JsonUtils {

	private Gson gson;

	public JsonUtils() {
		GsonBuilder gsonBuilder = new GsonBuilder().setPrettyPrinting();
		gsonBuilder.setDateFormat("yyyy-MM-dd'T'HH:mm:ss");
		gsonBuilder.setExclusionStrategies(new ExclusionStrategy() {
			public boolean shouldSkipField(FieldAttributes f) {
				return f.getName().contains("_");
			}

			public boolean shouldSkipClass(Class<?> clazz) {
				// TODO Auto-generated method stub
				return false;
			}
		});

		gson = gsonBuilder.create();
	}

	public JsonUtils(final String... exclude) {
		GsonBuilder gsonBuilder = new GsonBuilder().setPrettyPrinting();
		gsonBuilder.setDateFormat("yyyy-MM-dd'T'HH:mm:ss");
		gsonBuilder.setExclusionStrategies(new ExclusionStrategy() {
			public boolean shouldSkipField(FieldAttributes f) {
				if(exclude.length > 0) {
					for (String value : exclude) {
						return value.equalsIgnoreCase(f.getName());
					}
				}

				return false;
			}

			public boolean shouldSkipClass(Class<?> clazz) {
				return false;
			}
		});

		gson = gsonBuilder.create();
	}

	public <T> T fromJson(String json, Class<T> classOfT) {
		return gson.fromJson(json, classOfT);
	}

	public Gson getGson() {
		return gson;
	}

	public void setGson(Gson gson) {
		this.gson = gson;
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static String normalize(Collection list) {

		StringBuilder jsonStr = new StringBuilder();
		jsonStr.append("[");

		Integer countProperties = 0;
		for (Object value : list) {

			if (countProperties > 0) {
				jsonStr.append(",");
			}

			if (value instanceof LinkedHashMap) {
				jsonStr.append(JsonUtils.normalize((LinkedHashMap) value));

			} else if (value instanceof Collection) {
				jsonStr.append(JsonUtils.normalize((Collection) value));

			} else {
				jsonStr.append("\"" + value.toString() + "\"");
			}

			countProperties++;
		}

		jsonStr.append("]");

		return jsonStr.toString();
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static String normalize(LinkedHashMap<String, String> map) {

		StringBuilder jsonStr = new StringBuilder();
		Iterator<String> keys = map.keySet().iterator();

		jsonStr.append("{");

		Integer countProperties = 0;
		while (keys.hasNext()) {
			Object key = keys.next();
			Object value = map.get(key);

			if (countProperties > 0) {
				jsonStr.append(",");
			}

			jsonStr.append(key.toString());
			jsonStr.append(":");

			if (value instanceof LinkedHashMap) {
				jsonStr.append(JsonUtils.normalize((LinkedHashMap) value));
			} else if (value instanceof Collection) {
				jsonStr.append(JsonUtils.normalize((Collection) value));

			} else {
				if (value != null) {
					jsonStr.append("\"" + value.toString() + "\"");
				}
			}
			countProperties = +1;
		}
		jsonStr.append("}");

		return jsonStr.toString();
	}

	public String toJson(Object obj) {
		return gson.toJson(obj);
	}

	public static String toJsonException(Object obj) {
		return new JsonUtils().toJson(obj);
	}

	public static String toJsonException(Object obj, String... exclude) {
		return new JsonUtils(exclude).toJson(obj);
	}

	public static String formatarMensagem(String msg) {
		return msg != null && msg.length() > 1000 ? msg.substring(0, 999) : msg;
	}

}


text:
package io.github.furti.spring.web.extended.template.legacy.optimize;

import java.util.List;

import io.github.furti.spring.web.extended.io.ResourceType;
import ro.isdc.wro.model.resource.processor.ResourcePreProcessor;

public interface OptimizerConfig
{
    // TODO: hier sollte noch die möglichkeit rein das man die optimizer
    // sortieren kann. Sowas wie "before:anotheroptimizer"
    /*
     * TODO: denke wir brauchen hier keinen Namen. So wie SpringSecurity das
     * macht mit before <Klasse des Optimizers> müsste es funktionieren.
     */
    void addOptimizer(ResourceType type, String name, ResourcePreProcessor processor);

    // TODO: möglichkeit Optimizer zu entfernen.

    List<ResourcePreProcessor> getProcessors(ResourceType type);
}


text:
NODE_TARGETS=node_modules/coffee-script node_modules/handlebars

build: clean deps templates coffee-build

devel:
	${MAKE} -j2 coffee flask-server

flask-server:
	python furrypoll.py

coffee: $(NODE_TARGETS)
	node_modules/coffee-script/bin/coffee -o static/js -cw static/coffee

coffee-build: $(NODE_TARGETS)
	node_modules/coffee-script/bin/coffee -o static/js -c static/coffee

templates: $(NODE_TARGETS)
	node_modules/handlebars/bin/handlebars -f static/js/templates.js static/templates/*

.venv/bin/python:
	virtualenv .venv

$(NODE_TARGETS): package.json
	npm install

deps: .venv/bin/python $(NODE_TARGETS)
	.venv/bin/pip install -r requirements.pip

clean:
	find . -name '*.py[co]' -exec rm -f {} \;

clean-all: clean
	rm -rf .venv
	rm -rf node_modules

.PHONY: build clean clean-all coffee coffee-build deps devel flask-server templates


text:
<?php

namespace Acme\Console;

class CommandInputParser
{
    public function parse($path, $properties)
    {
        $segments = explode('\\', str_replace('/', '\\', $path));
        $className = array_pop($segments);
        $namespace = implode('\\', $segments);
        $properties = $this->parseProperties($properties);

        return new CommandInput($className, $namespace, $properties);
    }

    /**
     * @param $properties
     * @return array|mixed
     */
    private function parseProperties($properties)
    {
        return preg_split('/ ?, ?/', $properties, null, PREG_SPLIT_NO_EMPTY);
    }
}


text:
<?php defined('SYSPATH') or die('No direct script access.');
class Model_Abstract_model extends Model
{

}


text:
class Client < ActiveRecord::Base
  belongs_to :user
  has_many :invoices
  has_many :students

  mount_uploader :logo_emp, LogoEmpUploader

  accepts_nested_attributes_for :students

  attr_accessible :students_attributes, :name, :rfc, :street, :num_ext, :num_int, :suburb, :township, :state,
                  :cp, :logo_emp, :email

  validates :email, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :message => "No es un email valido" }

  validates_presence_of :name, :rfc, :street, :num_ext, :num_int, :suburb, :township, :state, :cp, :message => "No puede estar Vacio"

  validates_uniqueness_of :rfc, :scope => :user_id, :message => "Este RFC ya se dio de alta"
  #validates :logo_emp, :format => {
   #       :with => %r{\.(gif|jpg|png)$}i,
    #      :message => 'must be a URL for GIF, JPG or PNG image.'
     # }

  def self.search(search)
    if search
      where('name LIKE ?', "%#{search}%")
    else
      scoped
    end
  end

  def self.find_by_user_id(user_id)
    where('user_id = ?', "#{user_id}")
  end

end


text:
function test() {
	alert("jerrylin, bkato");
}


text:
{% if page.author %} {% assign author = site.data.authors[page.author] %}{% else %}{% assign author = site.owner %} {% endif %}

      {% if author.avatar %}

      {% endif %}

      {{ author.name }}
      {{ author.job }}
@ University of Texas at Austin
 (Expected Graduation, Fall 22)

        Curriculum Vitae

      {% include social-links.html %}


text:
export type MenuIDs =
  | 'rename-branch'
  | 'delete-branch'
  | 'preferences'
  | 'update-branch'
  | 'merge-branch'
  | 'view-repository-on-github'
  | 'compare-branch'
  | 'open-in-shell'
  | 'push'
  | 'pull'
  | 'branch'
  | 'repository'
  | 'create-branch'
  | 'show-changes'
  | 'show-history'
  | 'show-repository-list'
  | 'show-branches-list'
  | 'open-working-directory'
  | 'show-repository-settings'
  | 'open-external-editor'
  | 'remove-repository'
  | 'new-repository'
  | 'add-local-repository'
  | 'clone-repository'
  | 'about'
  | 'create-pull-request'


text:
namespace trinity {

static const char* FIndex_method_names[] = {
  "/trinity.FIndex/GetFMap",
  "/trinity.FIndex/SetFMap",
};

std::unique_ptr< FIndex::Stub> FIndex::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
  std::unique_ptr< FIndex::Stub> stub(new FIndex::Stub(channel));
  return stub;
}

FIndex::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
  : channel_(channel), rpcmethod_GetFMap_(FIndex_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
  , rpcmethod_SetFMap_(FIndex_method_names[1], ::grpc::RpcMethod::NORMAL_RPC, channel)
  {}

::grpc::Status FIndex::Stub::GetFMap(::grpc::ClientContext* context, const ::trinity::FMapRequest& request, ::trinity::ForwardMap* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_GetFMap_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::ForwardMap>* FIndex::Stub::AsyncGetFMapRaw(::grpc::ClientContext* context, const ::trinity::FMapRequest& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::ForwardMap>::Create(channel_.get(), cq, rpcmethod_GetFMap_, context, request);
}

::grpc::Status FIndex::Stub::SetFMap(::grpc::ClientContext* context, const ::trinity::ForwardMap& request, ::trinity::SetResult* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_SetFMap_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::SetResult>* FIndex::Stub::AsyncSetFMapRaw(::grpc::ClientContext* context, const ::trinity::ForwardMap& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::SetResult>::Create(channel_.get(), cq, rpcmethod_SetFMap_, context, request);
}

FIndex::Service::Service() {
  AddMethod(new ::grpc::RpcServiceMethod(
      FIndex_method_names[0],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< FIndex::Service, ::trinity::FMapRequest, ::trinity::ForwardMap>(
          std::mem_fn(&FIndex::Service::GetFMap), this)));
  AddMethod(new ::grpc::RpcServiceMethod(
      FIndex_method_names[1],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< FIndex::Service, ::trinity::ForwardMap, ::trinity::SetResult>(
          std::mem_fn(&FIndex::Service::SetFMap), this)));
}

FIndex::Service::~Service() {
}

::grpc::Status FIndex::Service::GetFMap(::grpc::ServerContext* context, const ::trinity::FMapRequest* request, ::trinity::ForwardMap* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

::grpc::Status FIndex::Service::SetFMap(::grpc::ServerContext* context, const ::trinity::ForwardMap* request, ::trinity::SetResult* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

static const char* IIndex_method_names[] = {
  "/trinity.IIndex/GetIMap",
  "/trinity.IIndex/SetIMap",
};

std::unique_ptr< IIndex::Stub> IIndex::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
  std::unique_ptr< IIndex::Stub> stub(new IIndex::Stub(channel));
  return stub;
}

IIndex::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
  : channel_(channel), rpcmethod_GetIMap_(IIndex_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
  , rpcmethod_SetIMap_(IIndex_method_names[1], ::grpc::RpcMethod::NORMAL_RPC, channel)
  {}

::grpc::Status IIndex::Stub::GetIMap(::grpc::ClientContext* context, const ::trinity::IMapRequest& request, ::trinity::InvertedMap* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_GetIMap_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::InvertedMap>* IIndex::Stub::AsyncGetIMapRaw(::grpc::ClientContext* context, const ::trinity::IMapRequest& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::InvertedMap>::Create(channel_.get(), cq, rpcmethod_GetIMap_, context, request);
}

::grpc::Status IIndex::Stub::SetIMap(::grpc::ClientContext* context, const ::trinity::InvertedMap& request, ::trinity::SetResult* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_SetIMap_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::SetResult>* IIndex::Stub::AsyncSetIMapRaw(::grpc::ClientContext* context, const ::trinity::InvertedMap& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::SetResult>::Create(channel_.get(), cq, rpcmethod_SetIMap_, context, request);
}

IIndex::Service::Service() {
  AddMethod(new ::grpc::RpcServiceMethod(
      IIndex_method_names[0],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< IIndex::Service, ::trinity::IMapRequest, ::trinity::InvertedMap>(
          std::mem_fn(&IIndex::Service::GetIMap), this)));
  AddMethod(new ::grpc::RpcServiceMethod(
      IIndex_method_names[1],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< IIndex::Service, ::trinity::InvertedMap, ::trinity::SetResult>(
          std::mem_fn(&IIndex::Service::SetIMap), this)));
}

IIndex::Service::~Service() {
}

::grpc::Status IIndex::Service::GetIMap(::grpc::ServerContext* context, const ::trinity::IMapRequest* request, ::trinity::InvertedMap* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

::grpc::Status IIndex::Service::SetIMap(::grpc::ServerContext* context, const ::trinity::InvertedMap* request, ::trinity::SetResult* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

static const char* Trinity_method_names[] = {
  "/trinity.Trinity/GetRootConfig",
  "/trinity.Trinity/SetRootConfig",
};

std::unique_ptr< Trinity::Stub> Trinity::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
  std::unique_ptr< Trinity::Stub> stub(new Trinity::Stub(channel));
  return stub;
}

Trinity::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
  : channel_(channel), rpcmethod_GetRootConfig_(Trinity_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
  , rpcmethod_SetRootConfig_(Trinity_method_names[1], ::grpc::RpcMethod::NORMAL_RPC, channel)
  {}

::grpc::Status Trinity::Stub::GetRootConfig(::grpc::ClientContext* context, const ::trinity::ConfigRequest& request, ::trinity::RootConfig* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_GetRootConfig_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::RootConfig>* Trinity::Stub::AsyncGetRootConfigRaw(::grpc::ClientContext* context, const ::trinity::ConfigRequest& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::RootConfig>::Create(channel_.get(), cq, rpcmethod_GetRootConfig_, context, request);
}

::grpc::Status Trinity::Stub::SetRootConfig(::grpc::ClientContext* context, const ::trinity::RootConfig& request, ::trinity::SetResult* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_SetRootConfig_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::SetResult>* Trinity::Stub::AsyncSetRootConfigRaw(::grpc::ClientContext* context, const ::trinity::RootConfig& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::SetResult>::Create(channel_.get(), cq, rpcmethod_SetRootConfig_, context, request);
}

Trinity::Service::Service() {
  AddMethod(new ::grpc::RpcServiceMethod(
      Trinity_method_names[0],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< Trinity::Service, ::trinity::ConfigRequest, ::trinity::RootConfig>(
          std::mem_fn(&Trinity::Service::GetRootConfig), this)));
  AddMethod(new ::grpc::RpcServiceMethod(
      Trinity_method_names[1],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< Trinity::Service, ::trinity::RootConfig, ::trinity::SetResult>(
          std::mem_fn(&Trinity::Service::SetRootConfig), this)));
}

Trinity::Service::~Service() {
}

::grpc::Status Trinity::Service::GetRootConfig(::grpc::ServerContext* context, const ::trinity::ConfigRequest* request, ::trinity::RootConfig* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

::grpc::Status Trinity::Service::SetRootConfig(::grpc::ServerContext* context, const ::trinity::RootConfig* request, ::trinity::SetResult* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

static const char* Subsystem_method_names[] = {
  "/trinity.Subsystem/StartMainLoop",
};

std::unique_ptr< Subsystem::Stub> Subsystem::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
  std::unique_ptr< Subsystem::Stub> stub(new Subsystem::Stub(channel));
  return stub;
}

Subsystem::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
  : channel_(channel), rpcmethod_StartMainLoop_(Subsystem_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
  {}

::grpc::Status Subsystem::Stub::StartMainLoop(::grpc::ClientContext* context, const ::trinity::StartSubsystemRequest& request, ::trinity::StartSubsystemResponse* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_StartMainLoop_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::StartSubsystemResponse>* Subsystem::Stub::AsyncStartMainLoopRaw(::grpc::ClientContext* context, const ::trinity::StartSubsystemRequest& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::StartSubsystemResponse>::Create(channel_.get(), cq, rpcmethod_StartMainLoop_, context, request);
}

Subsystem::Service::Service() {
  AddMethod(new ::grpc::RpcServiceMethod(
      Subsystem_method_names[0],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< Subsystem::Service, ::trinity::StartSubsystemRequest, ::trinity::StartSubsystemResponse>(
          std::mem_fn(&Subsystem::Service::StartMainLoop), this)));
}

Subsystem::Service::~Service() {
}

::grpc::Status Subsystem::Service::StartMainLoop(::grpc::ServerContext* context, const ::trinity::StartSubsystemRequest* request, ::trinity::StartSubsystemResponse* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

static const char* Gateway_method_names[] = {
  "/trinity.Gateway/Search",
};

std::unique_ptr< Gateway::Stub> Gateway::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
  std::unique_ptr< Gateway::Stub> stub(new Gateway::Stub(channel));
  return stub;
}

Gateway::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
  : channel_(channel), rpcmethod_Search_(Gateway_method_names[0], ::grpc::RpcMethod::NORMAL_RPC, channel)
  {}

::grpc::Status Gateway::Stub::Search(::grpc::ClientContext* context, const ::trinity::SearchRequest& request, ::trinity::SearchResponse* response) {
  return ::grpc::BlockingUnaryCall(channel_.get(), rpcmethod_Search_, context, request, response);
}

::grpc::ClientAsyncResponseReader< ::trinity::SearchResponse>* Gateway::Stub::AsyncSearchRaw(::grpc::ClientContext* context, const ::trinity::SearchRequest& request, ::grpc::CompletionQueue* cq) {
  return ::grpc::ClientAsyncResponseReader< ::trinity::SearchResponse>::Create(channel_.get(), cq, rpcmethod_Search_, context, request);
}

Gateway::Service::Service() {
  AddMethod(new ::grpc::RpcServiceMethod(
      Gateway_method_names[0],
      ::grpc::RpcMethod::NORMAL_RPC,
      new ::grpc::RpcMethodHandler< Gateway::Service, ::trinity::SearchRequest, ::trinity::SearchResponse>(
          std::mem_fn(&Gateway::Service::Search), this)));
}

Gateway::Service::~Service() {
}

::grpc::Status Gateway::Service::Search(::grpc::ServerContext* context, const ::trinity::SearchRequest* request, ::trinity::SearchResponse* response) {
  (void) context;
  (void) request;
  (void) response;
  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}

}  // namespace trinity


text:
package tests

import "testing"

func TestSinkTS(t *testing.T) {
	t1 := &testDataStruct{[]string{"./exampleCode/structTest.go"}, 1}
	td := []*testDataStruct{t1}
	check(td, t)
}

func TestFieldSensitiv(t *testing.T) {
	t1 := &testDataStruct{[]string{"./exampleCode/structTestV2.go"}, 0}
	td := []*testDataStruct{t1}
	check(td, t)
}

func TestAssignTSToNewVariable(t *testing.T) {
	t1 := &testDataStruct{[]string{"./exampleCode/structTestV4.go"}, 2}
	td := []*testDataStruct{t1}
	check(td, t)
}

func TestPointerAsParameterSignature(t *testing.T) {
	t1 := &testDataStruct{[]string{"./exampleCode/structTestV3Ref.go"}, 2}
	t2 := &testDataStruct{[]string{"./exampleCode/structTestV3RefSimple.go"}, 1}
	td := []*testDataStruct{t1, t2}
	check(td, t)
}

func TestPointerAsParameterCall(t *testing.T) {
	t1 := &testDataStruct{[]string{"./exampleCode/structTestV3Val.go"}, 1}
	td := []*testDataStruct{t1}
	check(td, t)
}

func TestFunctionAsParameter(t *testing.T) {
	// TODO implement feature such that the tool can handle functions as a parameter too
	//	t1 := &testDataStruct{[]string{"./exampleCode/pointerToFunc.go"}, 1}
	t1 := &testDataStruct{[]string{"./exampleCode/pointerToFunc.go"}, 0}
	testData := []*testDataStruct{t1}
	check(testData, t)
}

func TestAliasingThroughFields(t *testing.T) {
	t1 := &testDataStruct{[]string{"./exampleCode/aliasingThroughFields.go"}, 2}
	t2 := &testDataStruct{[]string{"./exampleCode/aliasingThroughFields2.go"}, 2}
	testData := []*testDataStruct{t1, t2}
	check(testData, t)
}


text:
package org.elasticsearch.xpack.ml.job.retention;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
import org.elasticsearch.action.admin.indices.stats.IndexStats;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest;
import org.elasticsearch.client.OriginSettingClient;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;

import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;

import static java.util.stream.Collectors.toSet;

/**
 * This class deletes empty indices matching .ml-state* pattern that are not pointed at by the .ml-state-write alias.
 */
public class EmptyStateIndexRemover implements MlDataRemover {

    private final OriginSettingClient client;

    public EmptyStateIndexRemover(OriginSettingClient client) {
        this.client = Objects.requireNonNull(client);
    }

    @Override
    public void remove(float requestsPerSec, ActionListener<Boolean> listener, Supplier<Boolean> isTimedOutSupplier) {
        try {
            if (isTimedOutSupplier.get()) {
                listener.onResponse(false);
                return;
            }
            getEmptyStateIndices(
                ActionListener.wrap(
                    emptyStateIndices -> {
                        if (emptyStateIndices.isEmpty()) {
                            listener.onResponse(true);
                            return;
                        }
                        getCurrentStateIndices(
                            ActionListener.wrap(
                                currentStateIndices -> {
                                    Set<String> stateIndicesToRemove = Sets.difference(emptyStateIndices, currentStateIndices);
                                    if (stateIndicesToRemove.isEmpty()) {
                                        listener.onResponse(true);
                                        return;
                                    }
                                    executeDeleteEmptyStateIndices(stateIndicesToRemove, listener);
                                },
                                listener::onFailure
                            )
                        );
                    },
                    listener::onFailure
                )
            );
        } catch (Exception e) {
            listener.onFailure(e);
        }
    }

    private void getEmptyStateIndices(ActionListener<Set<String>> listener) {
        IndicesStatsRequest indicesStatsRequest = new IndicesStatsRequest().indices(AnomalyDetectorsIndex.jobStateIndexPattern());
        client.admin().indices().stats(
            indicesStatsRequest,
            ActionListener.wrap(
                indicesStatsResponse -> {
                    Set<String> emptyStateIndices =
                        indicesStatsResponse.getIndices().values().stream()
                            .filter(stats -> stats.getTotal().getDocs().getCount() == 0)
                            .map(IndexStats::getIndex)
                            .collect(toSet());
                    listener.onResponse(emptyStateIndices);
                },
                listener::onFailure
            )
        );
    }

    private void getCurrentStateIndices(ActionListener<Set<String>> listener) {
        GetIndexRequest getIndexRequest = new GetIndexRequest().indices(AnomalyDetectorsIndex.jobStateIndexWriteAlias());
        client.admin().indices().getIndex(
            getIndexRequest,
            ActionListener.wrap(
                getIndexResponse -> listener.onResponse(Set.of(getIndexResponse.getIndices())),
                listener::onFailure
            )
        );
    }

    private void executeDeleteEmptyStateIndices(Set<String> emptyStateIndices, ActionListener<Boolean> listener) {
        DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(emptyStateIndices.toArray(new String[0]));
        client.admin().indices().delete(
            deleteIndexRequest,
            ActionListener.wrap(
                deleteResponse -> listener.onResponse(deleteResponse.isAcknowledged()),
                listener::onFailure
            )
        );
    }
}


text:
package controllers

import scala.Array.canBuildFrom
import scala.collection.JavaConversions.mapAsJavaMap

import play.core.parsers.FormUrlEncodedParser

object ScalaUtils {
  def parseQueryString(queryString: String): java.util.Map[String, Array[String]] = {
    val map = new java.util.HashMap[String, Array[String]]

    if (queryString == null || queryString == "")
      return map;

    val qs = queryString.split('?').last

    for ((key, values) <- FormUrlEncodedParser.parse(qs)) {
      map.put(key, values.toArray)
    }

    map
  }
}


text:
[![Gem Version](https://badge.fury.io/rb/rtype.svg)](https://badge.fury.io/rb/rtype)
[![Build Status](https://travis-ci.org/sputnikgugja/rtype.svg?branch=master)](https://travis-ci.org/sputnikgugja/rtype)
[![Coverage Status](https://coveralls.io/repos/github/sputnikgugja/rtype/badge.svg?branch=master)](https://coveralls.io/github/sputnikgugja/rtype?branch=master)

```ruby
require 'rtype'

class Test
  rtype [:to_i, Numeric] => Numeric
  def sum(a, b)
    a.to_i + b
  end

  rtype [{state: Boolean}] => Boolean
  def self.invert(state:)
    !state
  end

  # Hashes of hashes params require () to prevent invalid syntax
  rtype({state: Boolean} => Boolean)
  def self.invert2(state:)
    !state
  end
end

Test.new.sum(123, "asd")
# (Rtype::ArgumentTypeError) for 2nd argument:
# Expected "asd" to be a Numeric

Test.invert(state: 0)
# (Rtype::ArgumentTypeError) for 'state' argument:
# Expected 0 to be a Boolean

Test.invert2(state: 0)
# (Rtype::ArgumentTypeError) for 'state' argument:
# Expected 0 to be a Boolean
```

## Requirements
- Ruby >= 2.1
  - If you need to use old ruby, see [rtype-legacy](https://github.com/sputnikgugja/rtype-legacy) for ruby 1.9+
- MRI
  - If C native extension is used. otherwise it is not required
- JRuby (JRuby 9000+)
  - If Java extension is used. otherwise it is not required

## Features
- Provides type checking for arguments and return
- Provides type checking for [Keyword Argument](#keyword-argument)
- [Type checking for hash elements](#hash)
- [Duck Typing](#duck-typing)
- [Typed Array](#typed-array), Typed Set, Typed Hash
- [Numeric check](#special-behaviors). e.g. `Int >= 0`
- [Type checking for getter and setter](#attr_accessor-with-rtype)
- [float_accessor](#float_accessor), [bool_accessor](#bool_accessor)
- Custom type behavior
- ...

## Installation
Run `gem install rtype` or add `gem 'rtype'` to your `Gemfile`

And add to your `.rb` source file:
```ruby
require 'rtype'
```

### Native extension
Rtype itself is pure-ruby gem. but you can make it more faster by using native extension.

#### Native extension for MRI
Run
```ruby
gem install rtype-native
```
or add to your `Gemfile`:
```ruby
gem 'rtype-native'
```
then, Rtype uses it. (**Do not** `require 'rtype-native'`)

#### Java extension for JRuby is automatic
**Do not** `require 'rtype-java'`

## Usage

### Supported Type Behaviors
- `Module` : Value must be of this module (`is_a?`)
  - `Any` : Alias for `BasicObject` (means Any Object)
  - `Boolean` : `true` or `false`
- `Symbol` : Value must respond to a method with this name
- `Regexp` : Value must match this regexp pattern
- `Range` : Value must be included in this range
- `Array` : Value can be any type in this array
- `Proc` : Value must return a truthy value for this proc
- `true` : Value must be truthy
- `false` : Value must be falsy
- `nil` : Value must be nil
- `Hash`
  - Value must be a hash
  - Each of elements must be valid
  - Keys of the value must be equal to keys of this hash
  - **String** key is **different** from **symbol** key
  - vs. Keyword arguments (e.g.)
    - `[{}]` is **not** hash argument. it is keyword argument, because its position is last
    - `[{}, {}]` is hash argument (first) and keyword argument (second)
    - `[{}, {}, {}]` is two hash argument (first, second) and keyword argument (last)
    - `{}` is keyword argument. non-keyword arguments must be in array.
  - Of course, nested hash works
  - Example: [Hash](#hash)

- [Special Behaviors](#special-behaviors)
  - `TypedArray, TypedSet, TypedHash`, `Num, Int, Flo`, `And`, `Xor`, `Not`, `Nilable`

### Examples

#### Basic
```ruby
require 'rtype'

class Example
  rtype [Integer] => nil
  def test(i)
  end

  rtype [Any] => nil
  def any_type_arg(arg)
  end

  rtype [] => Integer
  def return_type_test
    "not integer"
  end
end

e = Example.new
e.test("not integer")
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected "not integer" to be a Integer

e.any_type_arg("Any argument!") # Works

e.return_type_test
# (Rtype::ReturnTypeError) for return:
# Expected "not integer" to be a Integer
```

#### Keyword argument
```ruby
require 'rtype'

class Example
  rtype {name: String} => Any
  def say_your_name(name:)
    puts "My name is #{name}"
  end

  # Mixing positional arguments and keyword arguments
  rtype [String, {age: Integer}] => Any
  def name_and_age(name, age:)
    puts "Name: #{name}, Age: #{age}"
  end
end

Example.new.say_your_name(name: "Babo") # My name is Babo
Example.new.name_and_age("Bamboo", age: 100) # Name: Bamboo, Age: 100

Example.new.say_your_name(name: 12345)
# (Rtype::ArgumentTypeError) for 'name' argument:
# Expected 12345 to be a String
```

#### Duck typing
```ruby
require 'rtype'

class Duck
  rtype [:to_i] => Any
  def says(i)
    puts "duck:" + " quack"*i.to_i
  end
end

Duck.new.says("2") # duck: quack quack
```

#### Array
```ruby
rtype :ruby!, [[String, Integer]] => Any
def ruby!(arg)
	puts "ruby!"
end

func("str") # ruby!
func(123) # ruby!

func(nil)
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected nil to be a String
# OR Expected nil to be a Integer
```

#### Hash
```ruby
# last hash element is keyword arguments
rtype :func, [{msg: String}, {}] => Any
def func(hash)
  puts hash[:msg]
end

func({})
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected {} to be a hash with 1 elements:
# - msg : Expected nil to be a String

func({msg: 123})
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected {:msg=>123} to be a hash with 1 elements:
# - msg : Expected 123 to be a String

func({msg: "hello", key: 'value'})
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected {:msg=>"hello", :key=>"value"} to be a hash with 1 elements:
# - msg : Expected "hello" to be a String

func({"msg" => "hello hash"})
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected {"msg"=>"hello hash"} to be a hash with 1 elements:
# - msg : Expected nil to be a String

func({msg: "hello hash"}) # hello hash
```

#### attr_accessor with rtype
- `rtype_accessor(*names, type)` : calls `attr_accessor` if the accessor methods(getter/setter) are not defined. and makes it typed
- `rtype_reader(*names, type)` : calls `attr_reader` if the getters are not defined. and makes it typed
- `rtype_writer(*names, type)` : calls `attr_writer` if the setters are not defined. and makes it typed

You can use `rtype_accessor_self` for static accessor. (`rtype_reader_self`, `rtype_writer_self` also exist)

```ruby
require 'rtype'

class Example
  rtype_accessor :value, String

  def initialize
    @value = 456
  end
end

Example.new.value = 123
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected 123 to be a String

Example.new.value
# (Rtype::ReturnTypeError) for return:
# Expected 456 to be a String
```

#### Typed Array
```ruby
### TEST 1 ###
class Test
	rtype [Array.of(Integer)] => Any
	def sum(args)
		num = 0
		args.each { |e| num += e }
	end
end

sum([1, 2, 3]) # => 6

sum([1.0, 2, 3])
# (Rtype::ArgumentTypeError) for 1st argument:
# Expected [1.0, 2, 3] to be an array with type Integer"
```

```ruby
### TEST 2 ###
class Test
	rtype [ Array.of([Integer, Float]) ] => Any
	def sum(args)
		num = 0
		args.each { |e| num += e }
	end
end

sum([1, 2, 3]) # => 6
sum([1.0, 2, 3]) # => 6.0
```

#### float_accessor
```ruby
class Point
  float_accessor :x, :y
end

v = Point.new
v.x = 1
v.x # => 1.0 (always Float)
```

#### bool_accessor
```ruby
class Human
  bool_accessor :hungry
end

a = Human.new
a.hungry = true
a.hungry? # => true
a.hungry # NoMethodError
```

#### `rtype`
```ruby
require 'rtype'

class Example
  # Recommended. With annotation mode (no method name required)
  rtype [Integer, String] => String
  def hello_world(i, str)
    puts "Hello? #{i} #{st
  end

  # Works (with specifying method name)
  rtype :hello_world, [Integer, String] => String
  def hello_world(i, str)
    puts "Hello? #{i} #{st
  end

  # Works
  def hello_world_two(i, str)
    puts "Hello? #{i} #{str}"
  end
  rtype :hello_world_two, [Integer, String] => String

  # Also works (String will be converted to Symbol)
  rtype 'hello_world_three', [Integer, String] => String
  def hello_world_three(i, str)
    puts "Hello? #{i} #{str}"
  end

  # Doesn't work. annotation mode works for following (next) method
  def hello_world_four(i, str)
    puts "Hello? #{i} #{str}"
  end
  rtype [Integer, String] => String
end
```

#### In the outside of module (root)
In the outside of module, annotation mode doesn't work. You must specify method name.

```ruby
rtype :say, [String] => Any
def say(message)
  puts message
end

Test.new.say "Hello" # Hello

rtype [String] => Any
# (ArgumentError) Annotation mode not working in the outside of module
```

#### Class method
Annotation mode works for both instance method and class method

```ruby
require 'rtype'

class Example
  rtype [:to_i] => Any
  def self.say_ya(i)
    puts "say" + " ya"*i.to_i
  end
end

Example::say_ya(3) #say ya ya ya
```

if you specify method name, however, you must use `rtype_self` instead of `rtype`

```ruby
require 'rtype'

class Example
  rtype_self :say_ya, [:to_i] => Any
  def self.say_ya(i)
    puts "say" + " ya"*i.to_i
  end
end

Example::say_ya(3) #say ya ya ya
```

#### Type information
This is just 'information'

Any change of this doesn't affect type checking

```ruby
require 'rtype'

class Example
  rtype [:to_i] => Any
  def test(i)
  end
end

Example.new.method(:test).type_info
# => [:to_i] => Any
Example.new.method(:test).argument_type
# => [:to_i]
Example.new.method(:test).return_type
# => Any
```

#### Special Behaviors
  - `TypedArray` : Ensures value is an array with the type (type signature)
    - `Array.of(type)` (recommended)
    - Example: [TypedArray](#typed-array)

  - `TypedSet` : Ensures value is a set with the type (type signature)
    - `Set.of(type)` (recommended)

  - `TypedHash` : Ensures value is a hash with the type (type signature)
    - `Hash.of(key_type, value_type)` (recommended)

  - `Num, Int, Flo` : Numeric check
    - `Num/Int/Flo >/>=/</<=/== x`
    - e.g. `Num >= 2` means value must be a `Numeric` and >= 2
    - e.g. `Int >= 2` means value must be a `Integer` and >= 2
    - e.g. `Flo >= 2` means value must be a `Float` and >= 2

  - `And` : Ensures value is valid for all given types
    - `Rtype.and(*types)`, `Rtype::Behavior::And[*types]`
    - or `Array#comb`, `Object#and(*others)`

  - `Xor` : Ensures value is valid for only one of given types
    - `Rtype.xor(*types)`, `Rtype::Behavior::Xor[*types]`
    - or `Object#xor(*others)`

  - `Not` : Ensures value is not valid for all given types
    - `Rtype.not(*types)`, `Rtype::Behavior::Not[*types]`
    - or `Object#not`

  - `Nilable` : Value can be nil
    - `Rtype.nilable(type)`, `Rtype::Behavior::Nilable[type]`
    - or `Object#nilable`, `Object#or_nil`

  - You can create custom behaviors by extending `Rtype::Behavior::Base`

## Documentation
[RubyDoc.info](http://www.rubydoc.info/gems/rtype)

## Benchmarks
Result of `rake benchmark` ([source](https://github.com/sputnikgugja/rtype/tree/master/benchmark/benchmark.rb))

### MRI
```
Rtype with C native extension
Ruby version: 2.1.7
Ruby engine: ruby
Ruby description: ruby 2.1.7p400 (2015-08-18 revision 51632) [x64-mingw32]
Rtype version: 0.3.0
Rubype version: 0.3.1
Sig version: 1.0.1
Contracts version: 0.13.0
Typecheck version: 0.1.2
Warming up --------------------------------------
                pure    85.328k i/100ms
               rtype    25.665k i/100ms
              rubype    21.414k i/100ms
                 sig     8.921k i/100ms
           contracts     4.638k i/100ms
           typecheck     1.110k i/100ms
Calculating -------------------------------------
                pure      3.282M (± 2.7%) i/s -     16.468M
               rtype    339.065k (± 2.6%) i/s -      1.720M
              rubype    266.893k (± 5.9%) i/s -      1.349M
                 sig     99.952k (± 2.1%) i/s -    499.576k
           contracts     49.693k (± 1.5%) i/s -    250.452k
           typecheck     11.356k (± 1.6%) i/s -     57.720k

Comparison:
                pure:  3282431.9 i/s
               rtype:   339064.9 i/s - 9.68x slower
              rubype:   266892.9 i/s - 12.30x slower
                 sig:    99952.2 i/s - 32.84x slower
           contracts:    49693.0 i/s - 66.05x slower
           typecheck:    11355.9 i/s - 289.05x slower
```

### JRuby
Without Rubype that doesn't support JRuby

```
Rtype with Java extension
Ruby version: 2.2.3
Ruby engine: jruby
Ruby description: jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.60-b23 on 1.8.0_60-b27 +jit [Windows 10-amd64]
Rtype version: 0.3.0
Sig version: 1.0.1
Contracts version: 0.13.0
Typecheck version: 0.1.2
Warming up --------------------------------------
                pure     9.994k i/100ms
               rtype     6.181k i/100ms
                 sig     4.041k i/100ms
           contracts   951.000  i/100ms
           typecheck   970.000  i/100ms
Calculating -------------------------------------
                pure      7.128M (?±35.6%) i/s -     30.831M
               rtype    121.556k (?± 6.2%) i/s -    605.738k
                 sig     72.187k (?± 6.4%) i/s -    359.649k
           contracts     24.984k (?± 3.9%) i/s -    125.532k
           typecheck     12.041k (?± 9.5%) i/s -     60.140k

Comparison:
                pure:  7128373.0 i/s
               rtype:   121555.8 i/s - 58.64x slower
                 sig:    72186.8 i/s - 98.75x slower
           contracts:    24984.5 i/s - 285.31x slower
           typecheck:    12041.0 i/s - 592.01x slower
```

## Rubype, Sig
Rtype is influenced by [Rubype](https://github.com/gogotanaka/Rubype) and [Sig](https://github.com/janlelis/sig).

If you don't like Rtype, You can use other library such as Contracts, Rubype, Rtc, Typecheck, Sig.

## Author
Sputnik Gugja (sputnikgugja@gmail.com)

## License
MIT license (@ Sputnik Gugja)

See `LICENSE` file.


text:
package org.jivesoftware.spark.ui;

import org.jivesoftware.spark.component.RolloverButton;

import javax.swing.Icon;

/**
 * Button to use with ChatRooms to allow for conformity in the Chat Room look and feel.
 */
public class ChatRoomButton extends RolloverButton {
	private static final long serialVersionUID = -2292789979004158240L;

	/**
     * Create a new ChatRoomButton.
     */
    public ChatRoomButton() {
    }

    /**
     * Create a new ChatRoomButton
     *
     * @param icon the icon to use on the button.
     */
    public ChatRoomButton(Icon icon) {
        super(icon);
    }

    /**
     * Create a new ChatRoomButton.
     *
     * @param text the button text.
     * @param icon the button icon.
     */
    public ChatRoomButton(String text, Icon icon) {
        super(text, icon);
    }

    /**
     * Creates a new ChatRoomButton.
     *
     * @param text the text to display on the button.
     */
    public ChatRoomButton(String text) {
        super(text);

    }

}


text:
import { Injectable } from '@angular/core';
import {HttpAuthService} from '../login/httpAuth.service';
import {IncomingInvoice} from './incoming-invoice/incoming-invoice';
import {RequestOptions, Response, Headers} from '@angular/http';
import {LoginService} from '../login/login.service';
import {User} from '../user/user';
import {Host} from '../../util/host';
import {FormGroup} from '@angular/forms';
import {Goods} from '../goods/goods';
import {ActivatedRoute} from '@angular/router';
import {OutgoingInvoice} from './outgoing-invoice/outgoing-invoice';
import {Observable} from 'rxjs/Observable';
import {InvoiceStatus} from './invoice-status';

const path = Host.getURL() + 'invoice';

@Injectable()
export class InvoiceService {

  constructor(private httpAuthService: HttpAuthService,
              private loginService: LoginService) { }

  getAllIncoming(page?: number, count?: number) {
    const url = path + '/incoming';
    const headers = new Headers();
    const params = new URLSearchParams();
    if (page != null) {
      params.set('page', page.toString());
    }
    if (count != null) {
      params.set('count', count.toString());
    }
    const options = new RequestOptions({
      headers: headers,
      params: params
    });

    return this.httpAuthService.get(url, options).map((response: Response) => {
      return (response.json()).map(item => {
        return this.mapIncomingInvoiceFromItem(item);
      });
    });
  }

  getAllOutgoing(page?: number, count?: number) {
    const url = path + '/outgoing';
    const headers = new Headers();
    const params = new URLSearchParams();
    if (page != null) {
      params.set('page', page.toString());
    }
    if (count != null) {
      params.set('count', count.toString());
    }
    const options = new RequestOptions({
      headers: headers,
      params: params
    });

    return this.httpAuthService.get(url, options).map((response: Response) => {
      return (response.json()).map(item => {
        return this.mapOutgoingInvoiceFromItem(item);
      });
    });
  }

  getInvoicesCount() {
    const url = path + '/count';
    const headers = new Headers();
    const params = new URLSearchParams();
    const options = new RequestOptions({
      headers: headers,
      params: params
    });

    return this.httpAuthService.get(url, options).map((response: Response) => {
      return response.json().count;
    });
  }

  getIncomingInvoiceById(id: number) {
    if (id != null) {
      const url = path + '/incoming/' + id;
      const headers = new Headers();
      const options = new RequestOptions({
        headers: headers,
      });

      return this.httpAuthService.get(url, options).map((response: Response) => {
        const item = response.json();
        return this.mapIncomingInvoiceFromItem(item);
      });
    }
  }

  getOutgoingInvoiceById(id: number) {
    if (id != null) {
      const url = path + '/outgoing/' + id;
      const headers = new Headers();
      const options = new RequestOptions({
        headers: headers,
      });

      return this.httpAuthService.get(url, options).map((response: Response) => {
        const item = response.json();
        return this.mapOutgoingInvoiceFromItem(item);
      });
    }
  }

  saveIncomingInvoice(invoice: IncomingInvoice) {
    const url = path + '/incoming/';
    const body = JSON.stringify(invoice);
    return this.saveInvoice(url, body);
  }

  saveOutgoingInvoice(invoice: OutgoingInvoice) {
    const url = path + '/outgoing/';
    const body = JSON.stringify(invoice);
    return this.saveInvoice(url, body);
  }

  updateIncomingInvoice(invoice: IncomingInvoice) {
    const url = path + '/incoming/' + invoice.id;
    const body = JSON.stringify(invoice);
    return this.updateInvoice(url, body);
  }

  updateOutgoingInvoice(invoice: OutgoingInvoice) {
    const url = path + '/outgoing/' + invoice.id;
    const body = JSON.stringify(invoice);
    return this.updateInvoice(url, body);
  }

  updateInvoiceStatus(id: number, status: InvoiceStatus) {
    const url = path + '/' + id + '?status=' + InvoiceStatus[status];
    const headers = new Headers();
    const options = new RequestOptions({
      headers: headers
    });

    // todo remove cause is not used
    const body = '';

    return this.httpAuthService.put(url, body, options).map((response: Response) => {
      if (response.text()) {
        return (response.json());
      }
    });
  }

  delete(id: number) {
    if (id != null) {
      const url = path + '/' + id.toString();
      const headers = new Headers();
      headers.set('Content-Type', 'application/json;charset=utf-8');
      const options = new RequestOptions({
        headers: headers
      });

      return this.httpAuthService.delete(url, options).map((response: Response) => {
        if (response.text()) {
          return (response.json());
        }
      });
    }
  }

  invoiceExistsByNumber(number: string) {
    const url = path + '/?number=' + number;
    const headers = new Headers();
    const options = new RequestOptions({
      headers: headers
    });

    return this.httpAuthService.get(url, options).map((response: Response) => {
      return response.text();
    });
  }

  parseIdParam(route: ActivatedRoute) {
    let id;
    route.params.subscribe(params => {
      id = params['id'];
    });
    return id;
  }

  private saveInvoice(url: string, body: string) {
    const headers = new Headers();
    headers.set('Content-Type', 'application/json;charset=utf-8');
    const options = new RequestOptions({
      headers: headers
    });

    return this.httpAuthService.post(url, body, options).map((response: Response) => {
      if (response.text()) {
        return (response.json());
      }
    });
  }

  private updateInvoice(url: string, body: string) {
    const headers = new Headers();
    headers.set('Content-Type', 'application/json;charset=utf-8');
    const options = new RequestOptions({
      headers: headers
    });

    return this.httpAuthService.put(url, body, options).map((response: Response) => {
      if (response.text()) {
        return (response.json());
      }
    });
  }

  private buildFullName(user: User) {
    let name = '';
    if (user.lastName != null) {
      name += user.lastName;
      name += ' ';
    }
    if (user.firstName != null) {
      name += user.firstName;
    }
    return name;
  }

  mapIncomingInvoiceFromForm(form: FormGroup, id?: number) {
    const invoice = new IncomingInvoice();
    if (id != null) {
      invoice.id = id;
    }
    invoice.number = form.controls['number'].value;
    invoice.issueDate = form.controls['issueDate'].value;
    invoice.transportCompany = form.controls['transportCompany'].value;
    invoice.supplierCompany = form.controls['supplierCompany'].value;
    invoice.transportNumber = form.controls['transportNumber'].value;
    invoice.transportName = form.controls['transportName'].value;
    if (form.controls['driver'].value != null) {
      invoice.driver = form.controls['driver'].value;
    }
    invoice.description = form.controls['description'].value;
    return invoice;
  }

  mapOutgoingInvoiceFromForm(form: FormGroup, id?: number) {
    const invoice = new OutgoingInvoice();
    if (id != null) {
      invoice.id = id;
    }
    invoice.number = form.controls['number'].value;
    invoice.issueDate = form.controls['issueDate'].value;
    invoice.transportCompany = form.controls['transportCompany'].value;
    invoice.receiverCompany = form.controls['receiverCompany'].value;
    invoice.transportNumber = form.controls['transportNumber'].value;
    invoice.transportName = form.controls['transportName'].value;
    if (form.controls['driver'].value != null) {
      invoice.driver = form.controls['driver'].value;
    }
    invoice.description = form.controls['description'].value;
    return invoice;
  }

  private mapIncomingInvoiceFromItem(item: any): IncomingInvoice{
    const invoice = new IncomingInvoice();
    invoice.id = item.id;
    invoice.number = item.number;
    invoice.issueDate = item.issueDate;
    invoice.transportCompany = item.transportCompany;
    invoice.supplierCompany = item.supplierCompany;
    invoice.transportName = item.transportName;
    invoice.transportNumber = item.transportNumber;
    if (item.driver != null) {
      invoice.driver = item.driver;
    }
    invoice.description = item.description;
    invoice.goodsEntryCount = item.goodsEntryCount;
    invoice.status = item.status;
    invoice.goods = item.goods;
    return invoice;
  }

  private mapOutgoingInvoiceFromItem(item: any): OutgoingInvoice{
    const invoice = new OutgoingInvoice();
    invoice.id = item.id;
    invoice.number = item.number;
    invoice.issueDate = item.issueDate;
    invoice.transportCompany = item.transportCompany;
    invoice.receiverCompany = item.receiverCompany;
    invoice.transportName = item.transportName;
    invoice.transportNumber = item.transportNumber;
    if (item.driver != null) {
      invoice.driver = item.driver;
    }
    invoice.description = item.description;
    invoice.goodsEntryCount = item.goodsEntryCount;
    invoice.status = item.status;
    invoice.goods = item.goods;
    return invoice;
  }

  removeIncomingInvoiceFromArray(invoices: IncomingInvoice[], invoice: IncomingInvoice) {
    const index = invoices.indexOf(invoice, 0);
    if (index > -1) {
      invoices.splice(index, 1);
    }
    return invoices;
  }

  deleteGoodsFromArray(goodsList: Goods[], goods: Goods) {
    const index = goodsList.indexOf(goods, 0);
    if (index > -1) {
      goodsList.splice(index, 1);
    }
    return goodsList;
  }

  removeOutgoingInvoiceFromArray(invoices: OutgoingInvoice[], invoice: OutgoingInvoice) {
    const index = invoices.indexOf(invoice, 0);
    if (index > -1) {
      invoices.splice(index, 1);
    }
    return invoices;
  }
}


text:
/**
 * Test that a user may currentOp, and then killOp their own operations.
 *
 * Theory of operation: Create a long running operation from a user which does not have the killOp
 * or inProg privileges. Using the same user, run currentOp to get the opId, and then run killOp
 * against it.
 */

(function() {
    'use strict';

    function runTest(m) {
        var db = m.getDB("foo");
        var admin = m.getDB("admin");

        admin.createUser({user: 'admin', pwd: 'password', roles: jsTest.adminUserRoles});
        admin.auth('admin', 'password');
        db.createUser({user: 'reader', pwd: 'reader', roles: [{db: 'foo', role: 'read'}]});
        db.createUser(
            {user: 'otherReader', pwd: 'otherReader', roles: [{db: 'foo', role: 'read'}]});
        admin.createRole({
            role: 'opAdmin',
            roles: [],
            privileges: [{resource: {cluster: true}, actions: ['inprog', 'killop']}]
        });
        db.createUser({user: 'opAdmin', pwd: 'opAdmin', roles: [{role: 'opAdmin', db: 'admin'}]});

        var t = db.jstests_killop;
        t.save({x: 1});

        assert.commandWorked(
            db.adminCommand({setParameter: 1, internalQueryExecYieldIterations: 1}));

        admin.logout();

        /**
         * This function filters for the operations that we're looking for, based on their state and
         * the contents of their query object.
         */
        function ops(ownOps = true) {
            var p = db.currentOp({$ownOps: ownOps}).inprog;
            var ids = [];
            for (var i in p) {
                var o = p[i];
                // We *can't* check for ns, b/c it's not guaranteed to be there unless the query is
                // active, which it may not be in our polling cycle - particularly b/c we sleep
                // every
                // second in both the query and the assert
                if ((o.active || o.waitingForLock) && o.query && o.query &&
                    o.query.find === "jstests_killop" && o.query.comment === "kill_own_ops") {
                    print("OP: " + tojson(o));
                    ids.push(o.opid);
                }
            }
            return ids;
        }

        var queryAsReader =
            'db = db.getSiblingDB("foo"); db.auth("reader", "reader"); db.jstests_killop.find().comment("kill_own_ops").toArray()';

        jsTestLog("Starting long-running operation");
        db.auth('reader', 'reader');
        assert.commandWorked(
            db.adminCommand({configureFailPoint: "setYieldAllLocksHang", mode: "alwaysOn"}));
        var s1 = startParallelShell(queryAsReader, m.port);

        jsTestLog("Finding ops in currentOp() output");
        var o = [];
        assert.soon(
            function() {
                o = ops();
                return o.length == 1;
            },
            {
              toString: function() {
                  return tojson(db.currentOp().inprog);
              }
            },
            60000);

        jsTestLog("Checking that another user cannot see or kill the op");
        db.logout();
        db.auth('otherReader', 'otherReader');
        assert.eq([], ops());
        assert.commandFailed(db.killOp(o[0]));
        db.logout();
        db.auth('reader', 'reader');
        assert.eq(1, ops().length);
        db.logout();

        jsTestLog("Checking that originating user can kill operation");
        var start = new Date();
        db.auth('reader', 'reader');
        assert.commandWorked(db.killOp(o[0]));
        assert.commandWorked(
            db.adminCommand({configureFailPoint: "setYieldAllLocksHang", mode: "off"}));

        jsTestLog("Waiting for ops to terminate");
        var exitCode = s1({checkExitSuccess: false});
        assert.neq(0,
                   exitCode,
                   "expected shell to exit abnormally due to operation execution being terminated");

        // don't want to pass if timeout killed the js function.
        var end = new Date();
        var diff = end - start;
        assert.lt(diff, 30000, "Start: " + start + "; end: " + end + "; diff: " + diff);

        jsTestLog("Starting a second long-running operation");
        assert.commandWorked(
            db.adminCommand({configureFailPoint: "setYieldAllLocksHang", mode: "alwaysOn"}));
        var s2 = startParallelShell(queryAsReader, m.port);
        jsTestLog("Finding ops in currentOp() output");
        var o2 = [];
        assert.soon(
            function() {
                o2 = ops();
                return o2.length == 1;
            },
            {
              toString: function() {
                  return tojson(db.currentOp().inprog);
              }
            },
            60000);

        db.logout();
        db.auth('opAdmin', 'opAdmin');

        jsTestLog("Checking that an administrative user can find others' operations");
        assert.eq(o2, ops(false));

        jsTestLog(
            "Checking that an administrative user cannot find others' operations with ownOps");
        assert.eq([], ops());

        jsTestLog("Checking that an administrative user can kill others' operations");
        var start = new Date();
        assert.commandWorked(db.killOp(o2[0]));
        assert.commandWorked(
            db.adminCommand({configureFailPoint: "setYieldAllLocksHang", mode: "off"}));
        jsTestLog("Waiting for ops to terminate");
        var exitCode = s2({checkExitSuccess: false});
        assert.neq(
            0, exitCode, "expected shell to exit abnormally due to JS execution being terminated");

        var end = new Date();
        var diff = end - start;
        assert.lt(diff, 30000, "Start: " + start + "; end: " + end + "; diff: " + diff);
    }

    var m = MongoRunner.runMongod({auth: ""});
    runTest(m);
    MongoRunner.stopMongod(m);

    // TODO: This feature is currently not supported on sharded clusters.
    /*var st =
        new ShardingTest({shards: 2, config: 3, keyFile: 'jstests/libs/key1', useHostname: false});
    runTest(st.s);
    st.stop();*/
})();


text:
package org.ovirt.engine.ui.common.widget.uicommon.vm;

import org.ovirt.engine.core.common.businessentities.VmNetworkInterface;
import org.ovirt.engine.ui.common.system.ClientStorage;
import org.ovirt.engine.ui.common.uicommon.model.SearchableTableModelProvider;
import org.ovirt.engine.ui.uicommonweb.models.pools.PoolInterfaceListModel;

import com.google.gwt.event.shared.EventBus;

public class PoolInterfaceListModelTable extends BaseInterfaceListModelTable<PoolInterfaceListModel> {

    public PoolInterfaceListModelTable(
            SearchableTableModelProvider<VmNetworkInterface, PoolInterfaceListModel> modelProvider,
            EventBus eventBus, ClientStorage clientStorage) {
        super(modelProvider, eventBus, clientStorage);
    }
}


text:
package edu.wpi.first.wpilibj.templates.subsystems;

/**
 * @author Ryan
 */
public class LevelManager {

    // Put methods for controlling this subsystem
    // here. Call these from Commands.
	private static int level = 0;;

    public static void setLevel(int lvl) {
    	level = lvl;
    }

    public static void incrementLevel() {
    	level++;
    }
    public static void decrementLevel() {
    	level--;
    }
    public static int getLevel() {
    	return level;
    }
}