text:
package com.github.donkirkby.vograbulary.russian;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.github.donkirkby.vograbulary.LetterDisplay;
import com.github.donkirkby.vograbulary.LetterDisplayFactory;

/**
 * Control the display of one of the target words. This abstract class must
 * have a concrete subclass for each platform that sets the position and
 * content of the two text fields.
 * @author don
 *
 */
public abstract class TargetDisplay {
    /** get the x position of the drag button for the target */
    public abstract int getDragX();

    /** set the x position of the drag button for the target */
    public abstract void setDragX(int x);

    /** is the drag button for the target visible? */
    public abstract boolean isDragVisible();

    /** set the visibility of the drag button for the target */
    public abstract void setDragVisible(boolean isDragVisible);

    /** is the insert button visible? */
    public abstract boolean isInsertVisible();

    /** set the visibility of the insert button. */
    public abstract void setInsertVisible(boolean isInsertVisible);

    private LetterDisplayFactory factory;
    private List<LetterDisplay> letters = new ArrayList<>();
    private Puzzle puzzle;
    private int dragStartX;
    private TargetDisplay other;
    private int visibleBoundary;
    private int sign;
    private int screenWidth;

    public TargetDisplay(LetterDisplayFactory factory) {
        this.factory = factory;
    }

    public void setOther(TargetDisplay other) {
        this.other = other;
        other.other = this;
    }

    public void setPuzzle(Puzzle puzzle) {
        this.puzzle = puzzle;
        other.puzzle = puzzle;
        setText(puzzle.getTarget(0));
        other.setText(puzzle.getTarget(1));
        setDragVisible(false);
        other.setDragVisible(false);
        setInsertVisible(true);
        this.sign = other.sign = 0;
    }

    public void setText(String text) {
        for (LetterDisplay letterDisplay : letters) {
            factory.destroy(letterDisplay);
        }
        letters.clear();
        for (int i = 0; i < text.length(); i++) {
            LetterDisplay letter = factory.create(text.substring(i, i+1));
            letters.add(letter);
        }
    }

    public String getText() {
        StringBuilder builder = new StringBuilder();
        for (LetterDisplay letterDisplay : letters) {
            builder.append(letterDisplay.getLetter());
        }
        return builder.toString();
    }

    public TargetDisplay getOther() {
        return other;
    }

    public void dragStart(int x) {
        dragStartX = x;
        if (sign == 0) {
            // first drag
            setInsertVisible(false);
            sign = (int)Math.signum(other.getLettersLeft() - getLettersLeft());
            other.sign = -sign;
            boolean isOtherMovingLeft = sign > 0;
            other.recordLetterStartPositions(isOtherMovingLeft);
        }
        visibleBoundary =
                screenWidth/2
                - getLettersWidth() * (1+sign)/2
                - other.getLettersWidth() * sign;
    }

    private void recordLetterStartPositions(boolean isMovingLeft) {
        for (LetterDisplay letterDisplay : letters) {
            letterDisplay.recordStartPosition();
            letterDisplay.setMovingLeft(isMovingLeft);
        }
    }

    public void drag(int x) {
        int offset = x - dragStartX;
        translate(offset);
        for (LetterDisplay letterDisplay : letters) {
            letterDisplay.setLeft(letterDisplay.getLeft() + offset);
        }

        other.surround(getLettersLeft(), getLettersRight());

        other.setDragVisible(sign*getLettersLeft() <= sign*visibleBoundary);
    }

    public void dragStop() {
        if (other.isDragVisible()) {
            this.sign = other.sign = 0;
        }
    }

    public int getLettersRight() {
        return letters.get(letters.size()-1).getRight();
    }

    public int getLettersLeft() {
        return letters.get(0).getLeft();
    }

    public int getLettersWidth() {
        return getLettersRight() - getLettersLeft();
    }

    private void surround(int left, int right) {
        List<LetterDisplay> before = new ArrayList<>();
        List<LetterDisplay> after = new ArrayList<>();
        for (LetterDisplay letterDisplay : letters) {
            letterDisplay.split(left, right, before, after);
        }

        if (before.size() == 0 || after.size() == 0) {
            puzzle.clearTargets();
        }
        else {
            puzzle.setTargetWord(sign == 1 ? 0 : 1);
            puzzle.setTargetCharacter(before.size());
        }

        if (before.size() > 0 && letters.get(letters.size()-1).getStartRight() > left) {
            int leftEdge = left;
            for (int i = before.size()-1; i >= 0; i--) {
                LetterDisplay letterDisplay = letters.get(i);
                letterDisplay.setRight(leftEdge);
                leftEdge = letterDisplay.getLeft();
            }
        }
        if (after.size() > 0 && letters.get(0).getStartLeft() < right) {
            int rightEdge = right;
            for (LetterDisplay letterDisplay : after) {
                letterDisplay.setLeft(rightEdge);
                rightEdge = letterDisplay.getRight();
            }
        }
    }

    private void translate(int offset) {
        setDragX(getDragX() + offset);
    }

    public List<LetterDisplay> getLetters() {
        return Collections.unmodifiableList(letters);
    }

    public void layout() {
        int nextX = screenWidth / 2;
        for (LetterDisplay letterDisplay : letters) {
            nextX += letterDisplay.getWidth();
        }
        other.setDragX(nextX);
        for (LetterDisplay letterDisplay : other.letters) {
            letterDisplay.setLeft(nextX);
            nextX += letterDisplay.getWidth();
        }
        nextX = screenWidth - nextX;
        setDragX(nextX);
        for (LetterDisplay letterDisplay : letters) {
            letterDisplay.setLeft(nextX);
            nextX += letterDisplay.getWidth();
        }
    }

    /** Get the width of the screen that the display should be centred on. */
    public int getScreenWidth() {
        return screenWidth;
    }
    /** Set the width of the screen that the display should be centred on. */
    public void setScreenWidth(int screenWidth) {
        this.screenWidth = other.screenWidth = screenWidth;
    }
}


text:
package net.unit8.solr.jdbc.impl;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;

import net.unit8.solr.jdbc.expression.ColumnExpression;
import net.unit8.solr.jdbc.expression.Expression;
import net.unit8.solr.jdbc.message.DbException;
import net.unit8.solr.jdbc.message.ErrorCode;
import net.unit8.solr.jdbc.value.SolrType;

public class CollectionResultSet extends AbstractResultSet {
	private List<String> columns;

	public CollectionResultSet() {
		this.docList = new SolrDocumentList();
		this.columns = new ArrayList<String>();
	}

	protected void add(List<Object> record) {
		SolrDocument doc = new SolrDocument();
		for (int i=0; i<columns.size(); i++) {
			doc.setField(columns.get(i), record.get(i));
		}
		docList.add(doc);
	}

	protected void setColumns(List<String> columnNames) {
		this.columns = columnNames;
		List<Expression> expressions = new ArrayList<Expression>();
		for(String columnName : columns) {
			ColumnExpression expression = new ColumnExpression(null, columnName, SolrType.UNKNOWN);
			expressions.add(expression);
		}
		this.metaData = new ResultSetMetaDataImpl(this, expressions, null);
	}
	@Override
	public int findColumn(String columnLabel) throws SQLException {
		int i=0;
		for(; i<columns.size(); i++) {
			if (StringUtils.equals(columnLabel, columns.get(i))) {
				break;
			}
		}
		if(i==columns.size()) {
			throw DbException.get(ErrorCode.COLUMN_NOT_FOUND, columnLabel);
		}
		return i+1;
	}

}

redpajama_set_name: RedPajamaGithub


text:
/* ------------------------------------------------------------------------- */
//
// Copyright (c) 2010 CubeSoft, Inc.
//
// 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.
//
/* ------------------------------------------------------------------------- */
using System;
using System.Threading;
using System.Threading.Tasks;
using Cube.Net.Ntp;
using Cube.Net.Ntp.Synchronous;
using Cube.Tests;
using NUnit.Framework;

namespace Cube.Net.Tests.Ntp
{
    /* --------------------------------------------------------------------- */
    ///
    /// NtpMonitorTest
    ///
    /// <summary>
    /// Tests the NtpMonitor class.
    /// </summary>
    ///
    /* --------------------------------------------------------------------- */
    [TestFixture]
    class NtpMonitorTest
    {
        #region Tests

        /* ----------------------------------------------------------------- */
        ///
        /// Monitor
        ///
        /// <summary>
        /// Tests to communicate with the NTP server periodically.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        [Test]
        public void Monitor()
        {
            using var mon = new NtpMonitor();

            var start = DateTime.Now;
            var count = 0;
            var cts   = new CancellationTokenSource();

            mon.Server  = ""; // test
            mon.Server  = "ntp.cube-soft.jp";
            mon.Port    = 0; // test
            mon.Port    = 123;
            mon.Timeout = TimeSpan.FromMilliseconds(500);

            _ = mon.SubscribeSync(_ => throw new ArgumentException("Test"));
            _ = mon.SubscribeSync(_ => { ++count; cts.Cancel(); });
            mon.Start();
            mon.Start(); // ignore
            Assert.That(Wait.For(cts.Token), "Timeout");
            mon.Stop();
            mon.Stop(); // ignore

            Assert.That(count, Is.AtLeast(1));
            Assert.That(mon.Last.Value, Is.GreaterThan(start));
            Assert.That(mon.Interval, Is.EqualTo(TimeSpan.FromHours(1)));
        }

        /* ----------------------------------------------------------------- */
        ///
        /// Monitor_NotFound
        ///
        /// <summary>
        /// Tests to monitor the inexistent NTP server.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        [Test]
        public void Monitor_NotFound()
        {
            using var mon = new NtpMonitor { Interval = TimeSpan.FromMilliseconds(100) };
            var count = 0;

            mon.Server  = "dummy";
            mon.Port    = 999;
            mon.Timeout = TimeSpan.FromMilliseconds(100);

            _ = mon.SubscribeSync(_ => ++count);
            mon.Start();
            Task.Delay(1000).Wait();
            mon.Stop();

            Assert.That(count, Is.EqualTo(0));
        }

        /* ----------------------------------------------------------------- */
        ///
        /// Monitor_NoSubscriptions
        ///
        /// <summary>
        /// Tests to monitor the NTP server with no subscriptions.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        [Test]
        public void Monitor_NoSubscriptions()
        {
            using var mon = new NtpMonitor { Interval = TimeSpan.FromMilliseconds(500) };

            mon.Start();
            Task.Delay(1000).Wait();
            mon.Stop();
            Assert.That(mon.Last.HasValue, Is.True);
        }

        /* ----------------------------------------------------------------- */
        ///
        /// Reset
        ///
        /// <summary>
        /// Tests the Reset method.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        [Test]
        public void Reset()
        {
            using var mon = new NtpMonitor { Interval = TimeSpan.FromSeconds(1) };
            var count = 0;
            var cts   = new CancellationTokenSource();

            mon.Server  = "ntp.cube-soft.jp";
            mon.Port    = 123;
            mon.Timeout = TimeSpan.FromMilliseconds(500);

            _ = mon.SubscribeSync(_ => { ++count; cts.Cancel(); });
            mon.Start(mon.Interval);
            mon.Reset();
            Assert.That(mon.State, Is.EqualTo(TimerState.Run));
            Assert.That(Wait.For(cts.Token), "Timeout");
            mon.Stop();

            Assert.That(count, Is.EqualTo(1));
        }

        #endregion
    }
}


text:
package br.hugo.sistema.snmp;

import java.io.*;
import java.net.*;
import java.util.*;

/**
*    The class SNMPTrapListenerInterface implements a server which listens for trap and inform request
* 	 messages sent from remote SNMP entities. The approach is that from version 1 and 2c of SNMP, using no
* 	 encryption of data. Communication occurs via UDP, using port 162, the standard SNMP trap port, or an
*    alternate (non-standard) port supplied in the constructor. This interface can handle both SNMPv1 and
*    SNMPv2 traps (which have different PDU types), and SNMPv2 Inform Requests.
*
*    Applications utilize this class with classes which implement the SNMPTrapListener or SNMPv2TrapListener or
*    SNMPv2InformRequestListener interfaces. These must provide a processTrap(), processv2Trap() or processInformRequest()
* 	 method, and are registered/unregistered with this class through its addv1TrapListener()/removev1TrapListener(),
*    addv2TrapListener()/removev2TrapListener(), or addv2InformRequestListener()/removev2InformRequestListener()
*    methods.
*/

public class SNMPTrapReceiverInterface
                        implements Runnable
{
    public static final int SNMP_TRAP_PORT = 162;

    // largest size for datagram packet payload; based on
    // RFC 1157, need to handle messages of at least 484 bytes
    private int receiveBufferSize = 512;

    private DatagramSocket dSocket;
    private Thread receiveThread;

    private Vector v1TrapListenerVector;
    private Vector v2TrapListenerVector;
    private Vector v2InformRequestListenerVector;
    private PrintWriter errorLog;

    /**
    *    Construct a new trap receiver object to receive traps from remote SNMP hosts.
    *    Uses the standard SNMP trap reception port 162, and System.out to report errors.
    */

    public SNMPTrapReceiverInterface()
        throws SocketException
    {
        // set System.out as the error writer
        this(new PrintWriter(System.out));
    }

    /**
    *    Construct a new trap receiver object to receive traps from remote SNMP hosts.
    *    Uses the specified Writer to deliver error messages, and the standard SNMP trap
    *    port 162.
    */

    public SNMPTrapReceiverInterface(PrintWriter errorReceiver)
        throws SocketException
    {
        this(errorReceiver, SNMP_TRAP_PORT);
    }

    /**
     *    Construct a new trap receiver object to receive traps from remote SNMP hosts.
     *    Uses the specified port for trap reception, and System.out to report errors.
     */

     public SNMPTrapReceiverInterface(int trapReceivePort)
         throws SocketException
     {
         this(new PrintWriter(System.out), trapReceivePort);
     }

     /**
     *    Construct a new trap receiver object to receive traps from remote SNMP hosts.
     *    This version will accept messages from all hosts using any community name. Uses the
     *   specified Writer to deliver error messages and the specified port to listen on.
     */

     public SNMPTrapReceiverInterface(PrintWriter errorReceiver, int trapReceivePort)
         throws SocketException
     {
         dSocket = new DatagramSocket(trapReceivePort);

         v1TrapListenerVector = new Vector();
         v2TrapListenerVector = new Vector();
         v2InformRequestListenerVector = new Vector();

         receiveThread = new Thread(this);

         errorLog = errorReceiver;

     }

    /**
    *    Set the specified PrintWriter to receive error messages.
    */

    public void setErrorReceiver(PrintWriter errorReceiver)
    {
        errorLog = errorReceiver;
    }

    public void addv1TrapListener(SNMPv1TrapListener listener)
    {
        // see if listener already added; if so, ignore
        for (int i = 0; i < v1TrapListenerVector.size(); i++)
        {
            if (listener == v1TrapListenerVector.elementAt(i))
            {
                return;
            }
        }

        // if got here, it's not in the list; add it
        v1TrapListenerVector.add(listener);
    }

    public void removev1TrapListener(SNMPv1TrapListener listener)
    {
        // see if listener in list; if so, remove, if not, ignore
        for (int i = 0; i < v1TrapListenerVector.size(); i++)
        {
            if (listener == v1TrapListenerVector.elementAt(i))
            {
                v1TrapListenerVector.removeElementAt(i);
                break;
            }
        }

    }

    public void addv2TrapListener(SNMPv2TrapListener listener)
    {
        // see if listener already added; if so, ignore
        for (int i = 0; i < v2TrapListenerVector.size(); i++)
        {
            if (listener == v2TrapListenerVector.elementAt(i))
            {
                return;
            }
        }

        // if got here, it's not in the list; add it
        v2TrapListenerVector.add(listener);
    }

    public void removev2TrapListener(SNMPv2TrapListener listener)
    {
        // see if listener in list; if so, remove, if not, ignore
        for (int i = 0; i < v2TrapListenerVector.size(); i++)
        {
            if (listener == v2TrapListenerVector.elementAt(i))
            {
                v2TrapListenerVector.removeElementAt(i);
                break;
            }
        }

    }

    public void addv2InformRequestListener(SNMPv2InformRequestListener listener)
    {
        // see if listener already added; if so, ignore
        for (int i = 0; i < v2InformRequestListenerVector.size(); i++)
        {
            if (listener == v2InformRequestListenerVector.elementAt(i))
            {
                return;
            }
        }

        // if got here, it's not in the list; add it
        v2InformRequestListenerVector.add(listener);
    }

    public void removev2InformRequestListener(SNMPv2InformRequestListener listener)
    {
        // see if listener in list; if so, remove, if not, ignore
        for (int i = 0; i < v2InformRequestListenerVector.size(); i++)
        {
            if (listener == v2InformRequestListenerVector.elementAt(i))
            {
                v2InformRequestListenerVector.removeElementAt(i);
                break;
            }
        }

    }

    /**
    *    Start listening for trap and inform messages.
    */

    public void startReceiving()
    {
        // if receiveThread not already running, start it
        if (!receiveThread.isAlive())
        {
            receiveThread = new Thread(this);
            receiveThread.start();
        }
    }

    /**
    *    Stop listening for trap and inform messages.
    */

    public void stopReceiving()
        throws SocketException
    {
        // interrupt receive thread so it will die a natural death
        receiveThread.interrupt();
    }

    /**
    *    The run() method for the trap interface's listener. Just waits for trap or inform messages to
    *    come in on port 162, then dispatches the recieved PDUs to each of the registered
    *    listeners by calling their processTrap() or processInform() methods.
    */

    public void run()
    {

        int errorStatus = 0;
        int errorIndex = 0;

        while (!receiveThread.isInterrupted())
        {

            try
               {

                DatagramPacket inPacket = new DatagramPacket(new byte[receiveBufferSize], receiveBufferSize);

                dSocket.receive(inPacket);

                byte[] encodedMessage = inPacket.getData();

                // get IP address of sender, to supply with SNMPv2 traps
                // which don't include this in the PDU
                InetAddress agentIPAddress = inPacket.getAddress();

                /*
                errorLog.println("Message bytes length (in): " + inPacket.getLength());

                errorLog.println("Message bytes (in):");
                for (int i = 0; i < encodedMessage.length; ++i)
                {
                    errorLog.print(hexByte(encodedMessage[i]) + " ");
                }
                errorLog.println("\n");
                */

                SNMPMessage receivedMessage = new SNMPMessage(SNMPBERCodec.extractNextTLV(encodedMessage,0).value);

                String communityName = receivedMessage.getCommunityName();

                Object receivedPDU = receivedMessage.getPDUAsObject();

                if (!(receivedPDU instanceof SNMPv1TrapPDU) && !(receivedPDU instanceof SNMPv2TrapPDU) && !(receivedPDU instanceof SNMPv2InformRequestPDU))
                {
                    throw new SNMPBadValueException("PDU received that's not a v1 or v2 trap or inform request; message payload of type " + receivedPDU.getClass().toString());
                }

                // pass the received trap PDU to the processTrap or procesv2Trap method of any listeners
                if (receivedPDU instanceof SNMPv1TrapPDU)
                {
                    for (int i = 0; i < v1TrapListenerVector.size(); i++)
                    {
                        SNMPv1TrapListener listener = (SNMPv1TrapListener)v1TrapListenerVector.elementAt(i);

                        listener.processv1Trap((SNMPv1TrapPDU)receivedPDU, communityName);
                    }
                }
                else if (receivedPDU instanceof SNMPv2TrapPDU)
                {
                    for (int i = 0; i < v2TrapListenerVector.size(); i++)
                    {
                        SNMPv2TrapListener listener = (SNMPv2TrapListener)v2TrapListenerVector.elementAt(i);

                        listener.processv2Trap((SNMPv2TrapPDU)receivedPDU, communityName, agentIPAddress);
                    }
                }
                else if (receivedPDU instanceof SNMPv2InformRequestPDU)
                {
                    for (int i = 0; i < v2InformRequestListenerVector.size(); i++)
                    {
                        SNMPv2InformRequestListener listener = (SNMPv2InformRequestListener)v2InformRequestListenerVector.elementAt(i);

                        listener.processv2InformRequest((SNMPv2InformRequestPDU)receivedPDU, communityName, agentIPAddress);
                    }
                }

            }
            catch (IOException e)
            {
                // just report the problem
                errorLog.println("IOException during request processing: " + e.toString());
                errorLog.flush();
            }
            catch (SNMPBadValueException e)
            {
                // just report the problem
                errorLog.println("SNMPBadValueException during request processing: " + e.toString());
                errorLog.flush();
            }
            catch (Exception e)
            {
                // just report the problem
                errorLog.println("Exception during request processing: " + e.toString());
                errorLog.flush();
            }

        }

    }

    private String hexByte(byte b)
    {
        int pos = b;
        if (pos < 0)
            pos += 256;
        String returnString = new String();
        returnString += Integer.toHexString(pos/16);
        returnString += Integer.toHexString(pos%16);
        return returnString;
    }

    private String getHex(byte theByte)
    {
        int b = theByte;

        if (b < 0)
            b += 256;

        String returnString = new String(Integer.toHexString(b));

        // add leading 0 if needed
        if (returnString.length()%2 == 1)
            returnString = "0" + returnString;

        return returnString;
    }

    /**
    *   Set the size of the buffer used to receive response packets. RFC 1157 stipulates that an SNMP
    *   implementation must be able to receive packets of at least 484 bytes, so if you try to set the
    *   size to a value less than this, the receive buffer size will be set to 484 bytes. In addition,
    *   the maximum size of a UDP packet payload is 65535 bytes, so setting the buffer to a larger size
    *   will just waste memory. The default value is 512 bytes. The value may need to be increased if
    *   get-requests are issued for multiple OIDs.
    */

    public void setReceiveBufferSize(int receiveBufferSize)
    {
        if (receiveBufferSize >= 484)
        {
            this.receiveBufferSize = receiveBufferSize;
        }
        else
        {
            this.receiveBufferSize = 484;
        }
    }

    /**
    *   Returns the current size of the buffer used to receive packets.
    */

    public int getReceiveBufferSize()
    {
        return this.receiveBufferSize;
    }

}


text:
<?php

namespace Reborn\MVC\View;

use Reborn\Cores\Setting;
use Reborn\Filesystem\File;
use Reborn\Cores\Application;
use Reborn\Filesystem\Directory as Dir;
use Reborn\Event\EventManager as Event;

/**
 * View Manager class for the Reborn
 *
 * @package Reborn\MVC\View
 * @author Myanmar Links Professional Web Development Team
 **/
class ViewManager
{
    /**
     * Application (IOC) Container instance
     *
     * @var \Reborn\Cores\Application
     **/
    protected $app;

    /**
     * Template Object Instance
     *
     * @var Reborn\MVC\View\Template
     **/
    protected $template;

    /**
     * Theme Object Instance
     *
     * @var Reborn\MVC\View\Theme
     **/
    protected $theme;

    /**
     * View Object Instance
     *
     * @var Reborn\MVC\View\View
     **/
    protected $view;

    /**
     * Parser Object Instance
     *
     * @var Reborn\MVC\View\Parser
     **/
    protected $parser;

    // Extension for view file.
    protected $ext = '.html';

    public function __construct(Application $app)
    {
        $this->app = $app;

        $this->theme = $this->themeSetter();

        $this->parser = new Parser();

        Event::call('reborn.parser.create', array($this->parser));

        $this->addParserHandler();

        $this->checkHelpersFileFromTheme();

        $this->view = new View($app['config']->get('template.cache_path'), new Block());

        $this->ext = $app['config']->get('template.template_extension');

        $this->template = new Template($this->theme, $this->view, $this->ext);

        $this->setObject();
    }

    /**
     * Get the Template Object
     *
     * @return Reborn\MVC\View\Template
     */
    public function getTemplate()
    {
        return $this->template;
    }

    /**
     * Get the Theme Object
     *
     * @return Reborn\MVC\View\Theme
     */
    public function getTheme()
    {
        return $this->theme;
    }

    /**
     * Get the View Object
     *
     * @return Reborn\MVC\View\View
     */
    public function getView()
    {
        return $this->view;
    }

    /**
     * Get the Parser Object
     *
     * @return Reborn\MVC\View\Parser
     */
    public function getParser()
    {
        return $this->parser;
    }

    /**
     * Get Admin Theme instance
     *
     * @return Reborn\MVC\View\Theme
     **/
    public function adminTheme()
    {
        $theme = Setting::get('admin_theme');
        $themePath = ADMIN_THEME;

        return new Theme($this->app, $theme, $themePath);
    }

    /**
     * Create the Theme Object
     *
     * @return Reborn\MVC\View\Theme
     */
    protected function themeSetter()
    {
        if (defined('ADMIN')) {
            $theme = Setting::get('admin_theme');
            $themePath = ADMIN_THEME;
        } else {
            $theme = Setting::get('public_theme');
            $themePath = THEMES;
        }

        // Add for Multisite
        if (! Dir::is($themePath.$theme)) {
            if (Dir::is(SHARED.'themes'.DS.$theme)) {
                $themePath = SHARED.'themes'.DS;
            }
        }

        // Register Event from Theme
        $events = $themePath.$theme.DS.'events.php';
        if (File::is($events)) {
            require $events;
        }

        return new Theme($this->app, $theme, $themePath);
    }

    /**
     * Set the Parser and Template at View
     *
     * @return void
     **/
    protected function setObject()
    {
        $this->view->setObject($this->parser, $this->template);
    }

    /**
     * Check and add the parser handler from the active theme
     *
     * @return void
     **/
    protected function addParserHandler()
    {
        $active = $this->theme->getThemePath();
        $handler = $active.'handler'.DS.'register.php';

        if (Dir::is($active.'handler') and file_exists($handler)) {
            require $handler;
        }

        // Add Habdler Object From Reborn
        $files = Dir::get(__DIR__.DS.'Handler'.DS.'*.php');
        $namespace = '\Reborn\MVC\View\Handler\\';
        foreach ($files as $file) {
            $name = pathinfo($file, PATHINFO_FILENAME);
            $obj = $namespace.$name;
            $ins = new $obj($this->parser);
            $key = $ins->getKey();
            $this->parser->addHandler($key, $namespace.$name);
        }
    }

    /**
     * Check helpers.php from active theme root and import
     *
     * @return void
     **/
    protected function checkHelpersFileFromTheme()
    {
        $active = $this->theme->getThemePath();

        $file = $active.'helpers.php';

        if (file_exists($file)) {
            require $file;
        }
    }

} // END class ViewManager


text:
from unittest import TestCase

from businessdate import BusinessDate, BusinessRange

from dcf.compounding import simple_compounding, continuous_rate
from dcf import ZeroRateCurve, DiscountFactorCurve, ShortRateCurve, CashRateCurve

class InterestRateCurveUnitTests(TestCase):
    def setUp(self):
        self.today = BusinessDate()
        self.domain = BusinessRange(self.today, self.today + '1Y', '3M')
        self.len = len(self.domain)
        self.periods = ('1D', '2B', '8D', '2W', '14B', '1M', '1M1D', '3M', '6M', '6M2W1D', '9M', '12M')

    def test_zero_rate_curve(self):
        rate = 0.02
        curve = ZeroRateCurve(self.domain, [rate] * self.len)
        for d in self.domain:
            for p in self.periods:
                self.assertAlmostEqual(curve.get_discount_factor(d + p, d + p), 1.)

                self.assertAlmostEqual(curve.get_zero_rate(self.today, d + p), rate)
                self.assertAlmostEqual(curve.get_short_rate(d + p), rate)
                yf = curve.day_count(d + p, (d + p) + curve.forward_tenor)
                cr = simple_compounding(curve.get_cash_rate(d + p), yf)
                self.assertAlmostEqual(continuous_rate(cr, yf), rate)

    def test_discount_factor_curve(self):
        zr_curve = ZeroRateCurve([self.today, self.today + '1d'], [.02, .02])
        df_curve = DiscountFactorCurve(zr_curve.domain, [1., zr_curve.get_discount_factor(self.today + '1d')])
        for p in self.periods:
            x = self.today + p
            self.assertAlmostEqual(df_curve.get_discount_factor(x, x), 1.)
            z = zr_curve.get_zero_rate(x)
            d = df_curve.get_zero_rate(x)
            self.assertAlmostEqual(z, d)
            z = zr_curve.get_discount_factor(x)
            d = df_curve.get_discount_factor(x)
            self.assertAlmostEqual(z, d)
            z = zr_curve.get_short_rate(x)
            d = df_curve.get_short_rate(x)
            self.assertAlmostEqual(z, d)
            z = zr_curve.get_cash_rate(x)
            d = df_curve.get_cash_rate(x)
            self.assertAlmostEqual(z, d)

class CastZeroRateCurveUnitTests(TestCase):
    def setUp(self):
        self.cast_type = ZeroRateCurve
        self.grid = ['0D', '3M', '12M']
        self.points = [0.02, 0.01, 0.015]
        self.grid = ['0D', '1M', '2M', '3M', '4M', '5M', '6M', '1Y']
        self.points = [0.02, 0.018, 0.0186, 0.018, 0.0167, 0.0155, 0.015, 0.015]

        self.precision = 10
        self.cash_precision = 2

        self.today = BusinessDate()
        self.today_eom = self.today == self.today.end_of_month()
        self.periods = ('0D', '1D', '2B', '8D', '2W', '14B', '1M', '1M1D', '3M', '6M', '6M2W1D', '9M', '12M')

        def pp(d, a, b):
            print((d, abs(a(d) - b(d)) < self.precision, a(d), b(d)))

        self.pp = pp

        def curve(p='0D'):
            grid = [self.today + p + _ for _ in self.grid]
            return self.cast_type(grid, self.points)

        self.curve = curve

    def test_interpolation(self):
        curve = self.curve()
        for t in (DiscountFactorCurve, ZeroRateCurve, ShortRateCurve):
            cast = t(curve)
            curve.cast(t)
            recast = self.cast_type(cast)
            self.assertEqual(self.cast_type._interpolation, curve.interpolation)
            self.assertEqual(t._interpolation, cast.interpolation)
            self.assertEqual(self.cast_type._interpolation, recast.interpolation)

    def test_discount_cast(self):
        for p in self.periods:
            curve = self.curve(p)
            cast = self.cast_type(DiscountFactorCurve(curve))
            for d in curve.domain[1:]:
                self.assertAlmostEqual(cast(d), curve(d), self.precision)

    def test_zero_cast(self):
        for p in self.periods:
            curve = self.curve(p)
            cast = self.cast_type(ZeroRateCurve(curve))
            for d in curve.domain[1:]:
                self.assertAlmostEqual(cast(d), curve(d), self.precision)

    def test_short_cast(self):
        for p in self.periods:
            curve = self.curve(p)
            cast = self.cast_type(ShortRateCurve(curve))
            for d in curve.domain[1:]:
                self.assertAlmostEqual(cast(d), curve(d), self.precision)

    def test_cash1m_cast(self):
        for p in self.periods:
            curve = self.curve(p)
            cast = self.cast_type(CashRateCurve(curve, forward_tenor='1M'))
            for d in curve.domain[1:]:
                self.assertAlmostEqual(cast(d), curve(d), self.cash_precision)

    def test_cash3m_cast(self):
        for p in self.periods:
            curve = self.curve(p)
            cast = self.cast_type(CashRateCurve(curve, forward_tenor='3M'))
            for d in curve.domain[1:]:
                self.assertAlmostEqual(cast(d), curve(d), self.cash_precision)

class CastDiscountFactorCurveUnitTests(CastZeroRateCurveUnitTests):
    def setUp(self):
        super(CastDiscountFactorCurveUnitTests, self).setUp()
        self.cast_type = DiscountFactorCurve
        self.grid = ['0D', '3M', '12M']
        self.points = [1., 0.9999, 0.997]

class CastShortRateCurveUnitTests(CastZeroRateCurveUnitTests):
    def setUp(self):
        super(CastShortRateCurveUnitTests, self).setUp()
        self.cast_type = ShortRateCurve

class CastCashRateCurveUnitTests(CastZeroRateCurveUnitTests):
    def setUp(self):
        super(CastCashRateCurveUnitTests, self).setUp()
        self.cast_type = CashRateCurve
        self.precision = 2
        self.cash_precision = 10


text:
using QRCoder;
using ThermalTalk.Imaging;

namespace ThermalTalk.BarcodePrinting
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            // Sample 500 character string to encode
            const string stringToEncode = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo " +
                                          "ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis " +
                                          "dis parturient montes, nascetur ridiculus mus. Donec quam felis, " +
                                          "ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa " +
                                          "quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, " +
                                          "arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. " +
                                          "Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibu";

            // Connect to printer - CHANGE THIS TO YOUR PRINTER'S COM PORT
            var printer = new PhoenixPrinter("COM14");

            var document = new StandardDocument
            {
                CodePage = CodePages.CPSPACE,
            };

            var headerSection = new StandardSection
            {
                Content = "Header",
                Justification = FontJustification.JustifyCenter,
                HeightScalar = FontHeighScalar.h2,
                WidthScalar = FontWidthScalar.w2,
                Effects = FontEffects.Bold,
                Font = ThermalFonts.A,
                AutoNewline = true,
            };

            var storeIdSection = new StandardSection
            {
                Content = "# STORE: 1234",
                Justification = FontJustification.JustifyCenter,
                HeightScalar = FontHeighScalar.h2,
                WidthScalar = FontWidthScalar.w2,
                Effects = FontEffects.Bold,
                Font = ThermalFonts.A,
                AutoNewline = true,
            };

            // add text
            document.Sections.Add(headerSection);

            // Use QRCoder library to generate QR code image
            var qrGenerator = new QRCodeGenerator();
            var qrData = qrGenerator.CreateQrCode(stringToEncode, QRCodeGenerator.ECCLevel.Q);
            var qrCode = new QRCode(qrData);
            var qrCodeImage = qrCode.GetGraphic(3);

            // set printer image
            var printerImage = new PrinterImage(qrCodeImage);
            printer.SetImage(printerImage, document, 1);
            document.Sections.Add(storeIdSection);

            // Print sample image
            printer.PrintDocument(document);
            printer.FormFeed();
        }
    }
}


text:
<?php
echo GWF_Box::box($lang->lang('info_request'), $lang->lang('pt_request'));
echo $form;


text:
package com.creditease.dbus.domain.mapper;

import com.creditease.dbus.domain.model.ProjectUser;

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

public interface ProjectUserMapper {

    int deleteByPrimaryKey(Integer id);

    int insert(ProjectUser record);

    ProjectUser selectByPrimaryKey(Integer id);

    List<ProjectUser> selectAll();

    int updateByPrimaryKey(ProjectUser record);

    List<Map<String, Object>> selectByProjectId(int projectId);

    int deleteByProjectId(Integer id);

    List<String> selectProjectExpireEmails(int projectId);

}


text:
package org.wikimedia.wikibase.entitysuggester.wikiparser;

import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.*;
import org.wikimedia.wikibase.entitysuggester.wikiparser.XMLInputFormat.XMLRecordReader;

/**
 * InputFormat implementation to be used with Hadoop for parsing the wikidata
 * XML dumps,
 *
 * @author Nilesh Chakraborty
 */
public class WikiPageInputFormat extends FileInputFormat<LongWritable, Text> {

    /**
     * Everything between the start and end tags is treated as a single chunk
     * and passed to the mapper.
     */
    public static final String START_TAG = "<page>";
    public static final String END_TAG = "</page>";

    /**
     *
     * @param split
     * @param conf
     * @param reporter
     * @return RecordReader for Hadoop
     * @throws IOException
     */
    @Override
    public RecordReader<LongWritable, Text> getRecordReader(InputSplit split,
            JobConf conf, Reporter reporter) throws IOException {
        conf.set(XMLInputFormat.START_TAG_KEY, START_TAG);
        conf.set(XMLInputFormat.END_TAG_KEY, END_TAG);
        return new XMLRecordReader((FileSplit) split, conf);
    }
}


text:
.class public Landroid/graphics/drawable/InsetDrawable;
.super Landroid/graphics/drawable/Drawable;
.source "InsetDrawable.java"

# interfaces
.implements Landroid/graphics/drawable/Drawable$Callback;

# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Landroid/graphics/drawable/InsetDrawable$1;,
        Landroid/graphics/drawable/InsetDrawable$InsetState;
    }
.end annotation

# instance fields
.field private mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

.field private mMutated:Z

.field private final mTmpRect:Landroid/graphics/Rect;

# direct methods
.method constructor <init>()V
    .locals 1

    .prologue
    const/4 v0, 0x0

    .line 54
    invoke-direct {p0, v0, v0}, Landroid/graphics/drawable/InsetDrawable;-><init>(Landroid/graphics/drawable/InsetDrawable$InsetState;Landroid/content/res/Resources;)V

    .line 55
    return-void
.end method

.method public constructor <init>(Landroid/graphics/drawable/Drawable;I)V
    .locals 6
    .parameter "drawable"
    .parameter "inset"

    .prologue
    .line 58
    move-object v0, p0

    move-object v1, p1

    move v2, p2

    move v3, p2

    move v4, p2

    move v5, p2

    invoke-direct/range {v0 .. v5}, Landroid/graphics/drawable/InsetDrawable;-><init>(Landroid/graphics/drawable/Drawable;IIII)V

    .line 59
    return-void
.end method

.method public constructor <init>(Landroid/graphics/drawable/Drawable;IIII)V
    .locals 1
    .parameter "drawable"
    .parameter "insetLeft"
    .parameter "insetTop"
    .parameter "insetRight"
    .parameter "insetBottom"

    .prologue
    const/4 v0, 0x0

    .line 63
    invoke-direct {p0, v0, v0}, Landroid/graphics/drawable/InsetDrawable;-><init>(Landroid/graphics/drawable/InsetDrawable$InsetState;Landroid/content/res/Resources;)V

    .line 65
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput-object p1, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    .line 66
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput p2, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetLeft:I

    .line 67
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput p3, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetTop:I

    .line 68
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput p4, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetRight:I

    .line 69
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput p5, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetBottom:I

    .line 71
    if-eqz p1, :cond_0

    .line 72
    invoke-virtual {p1, p0}, Landroid/graphics/drawable/Drawable;->setCallback(Landroid/graphics/drawable/Drawable$Callback;)V

    .line 74
    :cond_0
    return-void
.end method

.method private constructor <init>(Landroid/graphics/drawable/InsetDrawable$InsetState;Landroid/content/res/Resources;)V
    .locals 1
    .parameter "state"
    .parameter "res"

    .prologue
    .line 312
    invoke-direct {p0}, Landroid/graphics/drawable/Drawable;-><init>()V

    .line 50
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mTmpRect:Landroid/graphics/Rect;

    .line 313
    new-instance v0, Landroid/graphics/drawable/InsetDrawable$InsetState;

    invoke-direct {v0, p1, p0, p2}, Landroid/graphics/drawable/InsetDrawable$InsetState;-><init>(Landroid/graphics/drawable/InsetDrawable$InsetState;Landroid/graphics/drawable/InsetDrawable;Landroid/content/res/Resources;)V

    iput-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    .line 314
    return-void
.end method

.method synthetic constructor <init>(Landroid/graphics/drawable/InsetDrawable$InsetState;Landroid/content/res/Resources;Landroid/graphics/drawable/InsetDrawable$1;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"
    .parameter "x2"

    .prologue
    .line 46
    invoke-direct {p0, p1, p2}, Landroid/graphics/drawable/InsetDrawable;-><init>(Landroid/graphics/drawable/InsetDrawable$InsetState;Landroid/content/res/Resources;)V

    return-void
.end method

# virtual methods
.method public draw(Landroid/graphics/Canvas;)V
    .locals 1
    .parameter "canvas"

    .prologue
    .line 158
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->draw(Landroid/graphics/Canvas;)V

    .line 159
    return-void
.end method

.method public getChangingConfigurations()I
    .locals 2

    .prologue
    .line 163
    invoke-super {p0}, Landroid/graphics/drawable/Drawable;->getChangingConfigurations()I

    move-result v0

    iget-object v1, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v1, v1, Landroid/graphics/drawable/InsetDrawable$InsetState;->mChangingConfigurations:I

    or-int/2addr v0, v1

    iget-object v1, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v1, v1, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v1}, Landroid/graphics/drawable/Drawable;->getChangingConfigurations()I

    move-result v1

    or-int/2addr v0, v1

    return v0
.end method

.method public getConstantState()Landroid/graphics/drawable/Drawable$ConstantState;
    .locals 2

    .prologue
    .line 243
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    invoke-virtual {v0}, Landroid/graphics/drawable/InsetDrawable$InsetState;->canConstantState()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 244
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    invoke-virtual {p0}, Landroid/graphics/drawable/InsetDrawable;->getChangingConfigurations()I

    move-result v1

    iput v1, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mChangingConfigurations:I

    .line 245
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    .line 247
    :goto_0
    return-object v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public getIntrinsicHeight()I
    .locals 1

    .prologue
    .line 238
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicHeight()I

    move-result v0

    return v0
.end method

.method public getIntrinsicWidth()I
    .locals 1

    .prologue
    .line 233
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getIntrinsicWidth()I

    move-result v0

    return v0
.end method

.method public getOpacity()I
    .locals 1

    .prologue
    .line 203
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->getOpacity()I

    move-result v0

    return v0
.end method

.method public getPadding(Landroid/graphics/Rect;)Z
    .locals 3
    .parameter "padding"

    .prologue
    .line 170
    iget-object v1, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v1, v1, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v1, p1}, Landroid/graphics/drawable/Drawable;->getPadding(Landroid/graphics/Rect;)Z

    move-result v0

    .line 172
    .local v0, pad:Z
    iget v1, p1, Landroid/graphics/Rect;->left:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetLeft:I

    add-int/2addr v1, v2

    iput v1, p1, Landroid/graphics/Rect;->left:I

    .line 173
    iget v1, p1, Landroid/graphics/Rect;->right:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetRight:I

    add-int/2addr v1, v2

    iput v1, p1, Landroid/graphics/Rect;->right:I

    .line 174
    iget v1, p1, Landroid/graphics/Rect;->top:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetTop:I

    add-int/2addr v1, v2

    iput v1, p1, Landroid/graphics/Rect;->top:I

    .line 175
    iget v1, p1, Landroid/graphics/Rect;->bottom:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetBottom:I

    add-int/2addr v1, v2

    iput v1, p1, Landroid/graphics/Rect;->bottom:I

    .line 177
    if-nez v0, :cond_0

    iget-object v1, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v1, v1, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetLeft:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetRight:I

    or-int/2addr v1, v2

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetTop:I

    or-int/2addr v1, v2

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetBottom:I

    or-int/2addr v1, v2

    if-eqz v1, :cond_1

    .line 179
    :cond_0
    const/4 v1, 0x1

    .line 181
    :goto_0
    return v1

    :cond_1
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public inflate(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;)V
    .locals 12
    .parameter "r"
    .parameter "parser"
    .parameter "attrs"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/xmlpull/v1/XmlPullParserException;,
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    const/4 v11, 0x4

    const/4 v10, 0x2

    const/4 v9, 0x0

    .line 81
    sget-object v8, Lcom/android/internal/R$styleable;->InsetDrawable:[I

    invoke-virtual {p1, p3, v8}, Landroid/content/res/Resources;->obtainAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;

    move-result-object v0

    .line 84
    .local v0, a:Landroid/content/res/TypedArray;
    invoke-super {p0, p1, p2, v0, v9}, Landroid/graphics/drawable/Drawable;->inflateWithAttributes(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/content/res/TypedArray;I)V

    .line 87
    const/4 v8, 0x1

    invoke-virtual {v0, v8, v9}, Landroid/content/res/TypedArray;->getResourceId(II)I

    move-result v2

    .line 90
    .local v2, drawableRes:I
    invoke-virtual {v0, v10, v9}, Landroid/content/res/TypedArray;->getDimensionPixelOffset(II)I

    move-result v4

    .line 92
    .local v4, inLeft:I
    invoke-virtual {v0, v11, v9}, Landroid/content/res/TypedArray;->getDimensionPixelOffset(II)I

    move-result v6

    .line 94
    .local v6, inTop:I
    const/4 v8, 0x3

    invoke-virtual {v0, v8, v9}, Landroid/content/res/TypedArray;->getDimensionPixelOffset(II)I

    move-result v5

    .line 96
    .local v5, inRight:I
    const/4 v8, 0x5

    invoke-virtual {v0, v8, v9}, Landroid/content/res/TypedArray;->getDimensionPixelOffset(II)I

    move-result v3

    .line 99
    .local v3, inBottom:I
    invoke-virtual {v0}, Landroid/content/res/TypedArray;->recycle()V

    .line 102
    if-eqz v2, :cond_2

    .line 103
    invoke-virtual {p1, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    .line 116
    .local v1, dr:Landroid/graphics/drawable/Drawable;
    :goto_0
    if-nez v1, :cond_0

    .line 117
    const-string v8, "drawable"

    const-string v9, "No drawable specified for <inset>"

    invoke-static {v8, v9}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 120
    :cond_0
    iget-object v8, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput-object v1, v8, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    .line 121
    iget-object v8, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput v4, v8, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetLeft:I

    .line 122
    iget-object v8, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput v5, v8, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetRight:I

    .line 123
    iget-object v8, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput v6, v8, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetTop:I

    .line 124
    iget-object v8, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iput v3, v8, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetBottom:I

    .line 126
    if-eqz v1, :cond_1

    .line 127
    invoke-virtual {v1, p0}, Landroid/graphics/drawable/Drawable;->setCallback(Landroid/graphics/drawable/Drawable$Callback;)V

    .line 129
    :cond_1
    return-void

    .line 105
    .end local v1           #dr:Landroid/graphics/drawable/Drawable;
    :cond_2
    invoke-interface {p2}, Lorg/xmlpull/v1/XmlPullParser;->next()I

    move-result v7

    .local v7, type:I
    if-eq v7, v11, :cond_2

    .line 107
    if-eq v7, v10, :cond_3

    .line 108
    new-instance v8, Lorg/xmlpull/v1/XmlPullParserException;

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    invoke-interface {p2}, Lorg/xmlpull/v1/XmlPullParser;->getPositionDescription()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, ": <inset> tag requires a \'drawable\' attribute or "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    const-string v10, "child tag defining a drawable"

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-direct {v8, v9}, Lorg/xmlpull/v1/XmlPullParserException;-><init>(Ljava/lang/String;)V

    throw v8

    .line 113
    :cond_3
    invoke-static {p1, p2, p3}, Landroid/graphics/drawable/Drawable;->createFromXmlInner(Landroid/content/res/Resources;Lorg/xmlpull/v1/XmlPullParser;Landroid/util/AttributeSet;)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    .restart local v1       #dr:Landroid/graphics/drawable/Drawable;
    goto :goto_0
.end method

.method public invalidateDrawable(Landroid/graphics/drawable/Drawable;)V
    .locals 1
    .parameter "who"

    .prologue
    .line 134
    invoke-virtual {p0}, Landroid/graphics/drawable/InsetDrawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 135
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    .line 136
    invoke-interface {v0, p0}, Landroid/graphics/drawable/Drawable$Callback;->invalidateDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 138
    :cond_0
    return-void
.end method

.method public isStateful()Z
    .locals 1

    .prologue
    .line 208
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->isStateful()Z

    move-result v0

    return v0
.end method

.method public mutate()Landroid/graphics/drawable/Drawable;
    .locals 1

    .prologue
    .line 252
    iget-boolean v0, p0, Landroid/graphics/drawable/InsetDrawable;->mMutated:Z

    if-nez v0, :cond_0

    invoke-super {p0}, Landroid/graphics/drawable/Drawable;->mutate()Landroid/graphics/drawable/Drawable;

    move-result-object v0

    if-ne v0, p0, :cond_0

    .line 253
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0}, Landroid/graphics/drawable/Drawable;->mutate()Landroid/graphics/drawable/Drawable;

    .line 254
    const/4 v0, 0x1

    iput-boolean v0, p0, Landroid/graphics/drawable/InsetDrawable;->mMutated:Z

    .line 256
    :cond_0
    return-object p0
.end method

.method protected onBoundsChange(Landroid/graphics/Rect;)V
    .locals 6
    .parameter "bounds"

    .prologue
    .line 220
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mTmpRect:Landroid/graphics/Rect;

    .line 221
    .local v0, r:Landroid/graphics/Rect;
    invoke-virtual {v0, p1}, Landroid/graphics/Rect;->set(Landroid/graphics/Rect;)V

    .line 223
    iget v1, v0, Landroid/graphics/Rect;->left:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetLeft:I

    add-int/2addr v1, v2

    iput v1, v0, Landroid/graphics/Rect;->left:I

    .line 224
    iget v1, v0, Landroid/graphics/Rect;->top:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetTop:I

    add-int/2addr v1, v2

    iput v1, v0, Landroid/graphics/Rect;->top:I

    .line 225
    iget v1, v0, Landroid/graphics/Rect;->right:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetRight:I

    sub-int/2addr v1, v2

    iput v1, v0, Landroid/graphics/Rect;->right:I

    .line 226
    iget v1, v0, Landroid/graphics/Rect;->bottom:I

    iget-object v2, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget v2, v2, Landroid/graphics/drawable/InsetDrawable$InsetState;->mInsetBottom:I

    sub-int/2addr v1, v2

    iput v1, v0, Landroid/graphics/Rect;->bottom:I

    .line 228
    iget-object v1, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v1, v1, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    iget v2, v0, Landroid/graphics/Rect;->left:I

    iget v3, v0, Landroid/graphics/Rect;->top:I

    iget v4, v0, Landroid/graphics/Rect;->right:I

    iget v5, v0, Landroid/graphics/Rect;->bottom:I

    invoke-virtual {v1, v2, v3, v4, v5}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V

    .line 229
    return-void
.end method

.method protected onStateChange([I)Z
    .locals 2
    .parameter "state"

    .prologue
    .line 213
    iget-object v1, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v1, v1, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v1, p1}, Landroid/graphics/drawable/Drawable;->setState([I)Z

    move-result v0

    .line 214
    .local v0, changed:Z
    invoke-virtual {p0}, Landroid/graphics/drawable/InsetDrawable;->getBounds()Landroid/graphics/Rect;

    move-result-object v1

    invoke-virtual {p0, v1}, Landroid/graphics/drawable/InsetDrawable;->onBoundsChange(Landroid/graphics/Rect;)V

    .line 215
    return v0
.end method

.method public scheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V
    .locals 1
    .parameter "who"
    .parameter "what"
    .parameter "when"

    .prologue
    .line 141
    invoke-virtual {p0}, Landroid/graphics/drawable/InsetDrawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 142
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    .line 143
    invoke-interface {v0, p0, p2, p3, p4}, Landroid/graphics/drawable/Drawable$Callback;->scheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;J)V

    .line 145
    :cond_0
    return-void
.end method

.method public setAlpha(I)V
    .locals 1
    .parameter "alpha"

    .prologue
    .line 193
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->setAlpha(I)V

    .line 194
    return-void
.end method

.method public setColorFilter(Landroid/graphics/ColorFilter;)V
    .locals 1
    .parameter "cf"

    .prologue
    .line 198
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1}, Landroid/graphics/drawable/Drawable;->setColorFilter(Landroid/graphics/ColorFilter;)V

    .line 199
    return-void
.end method

.method public setVisible(ZZ)Z
    .locals 1
    .parameter "visible"
    .parameter "restart"

    .prologue
    .line 187
    iget-object v0, p0, Landroid/graphics/drawable/InsetDrawable;->mInsetState:Landroid/graphics/drawable/InsetDrawable$InsetState;

    iget-object v0, v0, Landroid/graphics/drawable/InsetDrawable$InsetState;->mDrawable:Landroid/graphics/drawable/Drawable;

    invoke-virtual {v0, p1, p2}, Landroid/graphics/drawable/Drawable;->setVisible(ZZ)Z

    .line 188
    invoke-super {p0, p1, p2}, Landroid/graphics/drawable/Drawable;->setVisible(ZZ)Z

    move-result v0

    return v0
.end method

.method public unscheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V
    .locals 1
    .parameter "who"
    .parameter "what"

    .prologue
    .line 148
    invoke-virtual {p0}, Landroid/graphics/drawable/InsetDrawable;->getCallback()Landroid/graphics/drawable/Drawable$Callback;

    move-result-object v0

    .line 149
    .local v0, callback:Landroid/graphics/drawable/Drawable$Callback;
    if-eqz v0, :cond_0

    .line 150
    invoke-interface {v0, p0, p2}, Landroid/graphics/drawable/Drawable$Callback;->unscheduleDrawable(Landroid/graphics/drawable/Drawable;Ljava/lang/Runnable;)V

    .line 152
    :cond_0
    return-void
.end method


text:
// @formatter:off

package com.microsoft.alm.teamfoundation.sourcecontrol.webapi;

import java.util.ArrayList;

/**
 */
public class UpdateRefsRequest {

    private ArrayList<GitRefUpdate> refUpdateRequests;
    private GitRefUpdateMode updateMode;

    public ArrayList<GitRefUpdate> getRefUpdateRequests() {
        return refUpdateRequests;
    }

    public void setRefUpdateRequests(final ArrayList<GitRefUpdate> refUpdateRequests) {
        this.refUpdateRequests = refUpdateRequests;
    }

    public GitRefUpdateMode getUpdateMode() {
        return updateMode;
    }

    public void setUpdateMode(final GitRefUpdateMode updateMode) {
        this.updateMode = updateMode;
    }
}


text:
TensorBoard data is organized around the concept of a `run`, which represents
all the related data thrown off by a single execution of TensorFlow, a `tag`,
which groups values of data that come from the same source within a TensorFlow
run, and `tag types`, which are our way of distinguishing different types of
data that have fundamentally different representations and should be processed
on different code paths. For example, a "train" run may have a `scalars`
tag that represents the learning rate, another `scalars` tag that
represents the value of the objective function, a `histograms` tag that reveals
information on weights in a particular layer over time, and an `images` tag that
shows input images flowing into the system. The "eval" run might have an
entirely different set of tag names, or some duplicated tag names.

The currently supported tag types are `scalars`, `images`, `audio`,
`histograms`, `graph` and `run_metadata`. Each tag type corresponds to a route
(documented below) for retrieving tag data of that type.

All of the data provided comes from TensorFlow events files ('\*.tfevents\*'),
which are written using the SummaryWriter class
(tensorflow/python/training/summary_writer.py), and the data is generated by
summary ops (tensorflow/python/ops/summary_ops.py). The `scalars` come from the
`ScalarSummary` op, the `histograms` from the `HistogramSummary`, the `audio`
from the `AudioSummary`, and the `images` from `ImageSummary`. The tag type
`graph` is special in that it is not a collection of tags of that type, but a
boolean denoting if there is a graph definition associated with the run. The tag
is provided to the summary op (usually as a constant).

## `data/runs`

Returns a dictionary mapping from `run name` (quoted string) to dictionaries
mapping from all available tagTypes to a list of tags of that type available for
the run. Think of this as a comprehensive index of all of the data available
from the TensorBoard server. Here is an example:

    {
      "train_run": {
        "histograms": ["foo_histogram", "bar_histogram"],
        "compressedHistograms": ["foo_histogram", "bar_histogram"],
        "scalars": ["xent", "loss", "learning_rate"],
        "images": ["input"],
        "audio": ["input_audio"],
        "graph": true,
        "firstEventTimestamp": 123456.789
        "run_metadata": ["forward prop", "inference"]
      },
      "eval": {
        "histograms": ["foo_histogram", "bar_histogram"],
        "compressedHistograms": ["foo_histogram", "bar_histogram"],
        "scalars": ["precision", "recall"],
        "images": ["input"],
        "audio": ["input_audio"],
        "graph": false,
        "run_metadata": []
      }
      }

The `firstEventTimestamp` value is in seconds since the epoch.

Note that the same tag may be present for many runs. It is not guaranteed that
they will have the same meaning across runs. It is also not guaranteed that they
will have the same tag type across different runs.

## '/data/scalars?run=foo&tag=bar'

Returns an array of event_accumulator.SimpleValueEvents ([wall_time, step,
value]) for the given run and tag. wall_time is seconds since epoch.

Example:

    [
      [1443856985.705543, 1448, 0.7461960315704346],  # wall_time, step, value
      [1443857105.704628, 3438, 0.5427092909812927],
      [1443857225.705133, 5417, 0.5457325577735901],
      ...
    ]

If the format parameter is set to 'csv', the response will instead be in CSV
format:

    Wall time,step,value
    1443856985.705543,1448,0.7461960315704346
    1443857105.704628,3438,0.5427092909812927
    1443857225.705133,5417,0.5457325577735901

## '/data/scalars?[sample_count=10]'

Without any parameters, returns a dictionary mapping from run name to a
dictionary mapping from tag name to a sampled list of scalars from that run and
tag. The values are given in the same format as when the run and tag are
specified. For example:

    {
      "train_run": {
        "my_tag": [
          [1443856985.705543, 1448, 0.7461960315704346],
          [1443857105.704628, 3438, 0.5427092909812927],
          [1443857225.705133, 5417, 0.5457325577735901]
        ]
      }
    }

The samples are distributed uniformly over the list of values. The sample_count
parameter is optional and defaults to 10; it must be at least 2. The first and
the last value will always be sampled.

## '/data/histograms?run=foo&tag=bar'

Returns an array of event_accumulator.HistogramEvents ([wall_time, step,
HistogramValue]) for the given run and tag. A HistogramValue is [min, max, num,
sum, sum_squares, bucket_limit, bucket]. wall_time is seconds since epoch.

Annotated Example: (note - real data is higher precision)

    [
      [
        1443871386.185149, # wall_time
        235166,            # step
        [
          -0.66,           # minimum value
          0.44,            # maximum value
          8.0,             # number of items in the histogram
          -0.80,           # sum of items in the histogram
          0.73,            # sum of squares of items in the histogram
          [-0.68, -0.62, -0.292, -0.26, -0.11, -0.10, -0.08, -0.07, -0.05,
          -0.0525, -0.0434, -0.039, -0.029, -0.026, 0.42, 0.47, 1.8e+308],
                          # the right edge of each bucket
        [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0,
          1.0, 0.0]        # the number of elements within each bucket
        ]
      ]
    ]

## '/data/compressedHistograms?run=foo&tag=bar'

Returns an array of event_accumulator.CompressedHistogramEvents ([wall_time,
step, CompressedHistogramValues]) for the given run and tag.

CompressedHistogramValues is a list of namedtuples with each tuple specifying
a basis point (bps) as well as an interpolated value of the histogram value
at that basis point. A basis point is 1/100 of a percent.

The current compression strategy is to choose basis points that correspond to
the median and bands of 1SD, 2SD, and 3SDs around the median. Note that the
current compression strategy does not work well for representing multimodal
data -- this is something that will be improved in a later iteration.

Annotated Example: (note - real data is higher precision)

    [
      [
        1441154832.580509,   # wall_time
        5,                   # step
        [  [0, -3.67],       # CompressedHistogramValue for 0th percentile
          [2500, -4.19],    # CompressedHistogramValue for 25th percentile
          [5000, 6.29],
          [7500, 1.64],
          [10000, 3.67]
        ]
      ],
      ...
    ]

## `/data/images?run=foo&tag=bar`

Gets a sample of ImageMetadatas for the given run and tag.

Returns an array of objects containing information about available images,
crucially including the query parameter that may be used to retrieve that image.
(See /individualImage for details.)

For example:

      {
        "width": 28,                 # width in pixels
        "height": 28,                # height in pixels
        "wall_time": 1440210599.246, # time in seconds since epoch
        "step": 63702821,            # number of steps that have passed
        "query": "index=0&tagname=input%2Fimage%2F2&run=train"
                                     # param for /individualImage
      }

## `/data/individualImage?{{query}}`

Retrieves an individual image. The image query should not be generated by the
frontend, but instead acquired from calling the /images route (the image
metadata objects contain the query to use). The response is the image itself
with mime-type 'image/png'.

Note that the query is not guaranteed to always refer to the same image even
within a single run, as images may be removed from the sampling reservoir and
replaced with other images. (See Notes for details on the reservoir sampling.)

An example call to this route would look like this:
/individualImage?index=0&tagname=input%2Fimage%2F2&run=train

## `/audio?run=foo&tag=bar`

Gets a sample of AudioMetadatas for the given run and tag.

Returns an array of objects containing information about available audio,
crucially including the query parameter that may be used to retrieve that audio.
(See /individualAudio for details.)

For example:

      {
        "wall_time": 1440210599.246, # time in seconds since epoch
        "step": 63702821,            # number of steps that have passed
        "content_type": "audio/wav"  # the MIME-type of the audio
        "query": "index=0&tagname=input%2Faudio%2F2&run=train"
                                     # param for /individualAudio
      }

## `/individualAudio?{{query}}`

Retrieves an individual audio clip. The audio query should not be generated by
the frontend, but instead acquired from calling the /audio route (the audio
metadata objects contain the query to use). The response is the audio itself
with an appropriate Content-Type header set.

Note that the query is not guaranteed to always refer to the same clip even
within a single run, as audio may be removed from the sampling reservoir and
replaced with other clips. (See Notes for details on the reservoir sampling.)

An example call to this route would look like this:
/individualAudio?index=0&tagname=input%2Faudio%2F2&run=train

## `/data/graph?run=foo&limit_attr_size=1024&large_attrs_key=key`

Returns the graph definition for the given run in gzipped pbtxt format. The
graph is composed of a list of nodes, where each node is a specific TensorFlow
operation which takes as inputs other nodes (operations).

The query parameters `limit_attr_size` and `large_attrs_key` are optional.

`limit_attr_size` specifies the maximum allowed size in bytes, before the
attribute is considered large and filtered out of the graph. If specified,
it must be an int and > 0. If not specified, no filtering is applied.

`large_attrs_key` is the attribute key that will be used for storing
attributes that are too large. The value of this key (list of strings)
should be used by the client in order to determine which attributes
have been filtered. Must be specified if `limit_attr_size` is specified.

For the query `/graph?run=foo&limit_attr_size=1024&large_attrs_key=_too_large`,
here is an example pbtxt response of a graph with 3 nodes, where the second
node had two large attributes "a" and "b" that were filtered out (size > 1024):

    node {
      op: "Input"
      name: "A"
    }
    node {
      op: "Input"
      name: "B"
      attr {
        key: "small_attr"
        value: {
          s: "some string"
        }
      }
      attr {
        key: "_too_large"
        value {
          list {
            s: "a"
            s: "b"
          }
        }
      }
    }
    node {
      op: "MatMul"
      name: "C"
      input: "A"
      input: "B"
    }

Prior to filtering, the original node "B" had the following content:

    node {
      op: "Input"
      name: "B"
      attr {
        key: "small_attr"
        value: {
          s: "some string"
        }
      }
      attr {
        key: "a"
        value { Very large object... }
      }
      attr {
        key: "b"
        value { Very large object... }
      }
    }

## `/data/run_metadata?run=foo&tag=bar`

Given a run and tag, returns the metadata of a particular
`session.run()` as a gzipped, pbtxt serialized [`RunMetadata`](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/config.proto)
proto. For example:

    step_stats {
      dev_stats {
        device: "/job:localhost/replica:0/task:0/cpu:0"
        node_stats {
          node_name: "_SOURCE"
          all_start_micros: 1458337695775395
          op_start_rel_micros: 11
          op_end_rel_micros: 12
          all_end_rel_micros: 38
          memory {
            allocator_name: "cpu"
          }
          timeline_label: "_SOURCE = NoOp()"
          scheduled_micros: 1458337695775363
        }
      }
    }

## Notes

All returned values, histograms, audio, and images are returned in the order
they were written by TensorFlow (which should correspond to increasing
`wall_time` order, but may not necessarily correspond to increasing step count
if the process had to restart from a previous checkpoint).

The returned values may be downsampled using reservoir sampling, which is
configurable by the TensorBoard server. When downsampling occurs, the server
guarantees that different tags will all sample at the same sequence of indices,
so that if there are two tags `A` and `B` which are related so that `A[i] ~
B[i]` for all `i`, then `D(A)[i] ~ D(B)[i]` for all `i`, where `D` represents
the downsampling operation.

The reservoir sampling puts an upper bound on the number of items that will be
returned for a given run-tag combination, and guarantees that all items are
equally likely to be in the final sample (ie it is a uniform distribution over
the values), with the proviso that the most recent individual item is always
included in the sample.

The reservoir sizes are configurable on a per-tag type basis.


text:
package com.github.christopheml.mtgapi.json;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.christopheml.mtgapi.responses.ListResponse;
import com.github.christopheml.mtgapi.responses.SingleResponse;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Optional;

public class JsonDeserializer {

    private final ObjectMapper objectMapper;

    public JsonDeserializer(ObjectMapper objectMapper) {
        this.objectMapper = objectMapper;
    }

    public <ENTITY, T extends SingleResponse<ENTITY>> ENTITY deserialize(InputStream json, T singleResponse) {
        try {
            JsonNode root = objectMapper.readTree(json);
            JsonNode entityRoot = Optional
                    .ofNullable(root.findValue(singleResponse.getEntityRoot()))
                    .orElseThrow(() -> new MalformedJsonResponseException(String.format("Can't find root element %s in response", singleResponse.getEntityRoot())));
            return objectMapper.treeToValue(entityRoot, singleResponse.getEntityClass());
        } catch (IOException e) {
            throw new MalformedJsonResponseException(e);
        }
    }

    public <ENTITY, T extends ListResponse<ENTITY>> List<ENTITY> deserialize(InputStream json, T listResponse) {
        try {
            JsonNode root = objectMapper.readTree(json);
            JsonNode entityRoot = Optional
                    .ofNullable(root.findValue(listResponse.getEntityRoot()))
                    .orElseThrow(() -> new MalformedJsonResponseException(String.format("Can't find root element %s in response", listResponse.getEntityRoot())));
           return objectMapper.readValue(entityRoot.traverse(), new TypeReference<List<ENTITY>>(){});
        } catch (IOException e) {
            throw new MalformedJsonResponseException(e);
        }
    }

}


text:
package net.sf.ntru.polynomial;

import java.util.Random;

/** Static utility class */
public class PolynomialGenerator {

    private PolynomialGenerator() { }

    /**
     * Generates a "sparse" or "dense" polynomial containing numOnes ints equal to 1,
     * numNegOnes int equal to -1, and the rest equal to 0.
     * @param N
     * @param numOnes
     * @param numNegOnes
     * @param sparse whether to create a {@link SparseTernaryPolynomial} or {@link DenseTernaryPolynomial}
     * @param rng the random number generator to use
     * @return a ternary polynomial
     */
    public static TernaryPolynomial generateRandomTernary(int N, int numOnes, int numNegOnes, boolean sparse, Random rng) {
        if (sparse)
            return SparseTernaryPolynomial.generateRandom(N, numOnes, numNegOnes, rng);
        else
            return DenseTernaryPolynomial.generateRandom(N, numOnes, numNegOnes, rng);
    }
}


text:
Monadic Parser Combinator for [try! Swift](http://www.tryswiftconf.com/).

- Inspired by Haskell [Attoparsec](https://hackage.haskell.org/package/attoparsec) & [Aeson](https://hackage.haskell.org/package/aeson), Swift  [Argo](https://github.com/thoughtbot/Argo).
- Supports CSV, XML, JSON (+ mapping)
- Doesn't `try`, but please try :)

**NOTE:** This library is still in early development. Please see [TODO & FIXME](#todo--fixme).

## Quick Play

Open `Examples/TryParsecPlayground.playground`.

```bash
$ sudo gem install fastlane
$ fastlane play   # prepares Xcode Playground
```

## How to use

```swift
// Simple Arithmetic
let ans = parseArithmetic(" ( 12 + 3 )         * 4+5").value
expect(ans) == 65

// CSV
let csv = parseCSV("foo,bar,baz\r\n1,22,333\r\n").value
expect(csv) == [["foo", "bar", "baz"], ["1", "22", "333"]]

// XML
let xmlString = "<p class=\"welcome\"><a href=\"underground.html\" target=\"_blank\">Hello</a><?php echo ' Cruel'; ?> World<!-- 💀 --><![CDATA[💣->😇]]></p>"
let xml = parseXML(xmlString).value
expect(xml) == [.element("p", [XML.Attribute("class", "welcome")], [.element("a", [XML.Attribute("href", "underground.html"), XML.Attribute("target", "_blank")], [.text("Hello")]), .processingInstruction("php echo ' Cruel'; "), .text(" World"), .comment(" 💀 "), .text("💣->😇")])]

// JSON
let jsonString = "{ \"string\" : \"hello\", \"array\" : [1, \"two\", [true, null]] }"
let json = parseJSON(jsonString).value
expect(json) == JSON.object([
    "string" : .string("hello"),
    "array" : .array([.number(1), .string("two"), .array([.bool(true), .null])])
])
```

### JSON Decoding & Encoding

```swift
import Curry

struct Model: FromJSON, ToJSON
{
    let string: String
    let array: [Any]?

    static func fromJSON(json: JSON) -> Result<Model, JSON.ParseError>
    {
        return curry(self.init)
            <^> json !! "string"
            <*> json !? "array"
    }

    static func toJSON(model: Model) -> JSON
    {
        return toJSONObject([
            "string" ~ model.string,
            "array" ~ model.array
        ])
    }
}

let jsonString = "{ \"string\" : \"hello\", \"array\" : [1, \"two\", [true, null]] }"

// JSON String -> Model
let decoded: Result<Model, JSON.ParseError> = decode(jsonString)

// Model -> JSON String
let encoded: String = encode(decoded.value!)
```

For `curry`ing, see [thoughtbot/Curry](https://github.com/thoughtbot/Curry) for more information.

## Supported functions

- **Basic Operators:** `>>-`, `<^>`, `<*>`, `*>`, `<*`, `<|>`, `<?>`
- **Combinators:** `zeroOrOne`, `many`, `many1`, `manyTill`, `skipMany`, `skipMany1`, `sepBy`, `sepBy1`, `sepEndBy`, `sepEndBy1`, `count`, `chainl`, `chainl1`, `chainr`, `chainr1`
- **Text (UnicodeScalarView):** `peek`, `endOfInput`, `satisfy`, `skip`, `skipWhile`, `take`, `takeWhile`, `any`, `char`, `not`, `string`, `asciiCI`, `oneOf`, `noneOf`, `digit`, `hexDigit`, `lowerAlphabet`, `upperAlphabet`, `alphabet`, `alphaNum`, `space`, `skipSpaces`, `endOfLine`, `number`

## TODO & FIXME

- **Improve overall performance**
  - Current JSON parsing is 70x~ slower than `NSJSONSerialization` (even with whole-module-optimization)
- Improve error reporting
- Support indent parser (e.g. YAML)
- Once [apple/swift](https://github.com/apple/swift) supports [Higher Kinded Types](https://en.wikipedia.org/wiki/Kind_(type_theory))...
  - Support incremental input
  - Remove workarounds e.g. reflection-based JSON encoding

## Acknowledgement

This library is heavily inspired by following developers & libraries:

- Bryan O'Sullivan: Author of [Attoparsec](https://hackage.haskell.org/package/attoparsec) & [Aeson](https://hackage.haskell.org/package/aeson) (Haskell)
- Daan Leijen: Author of [Parsec](https://hackage.haskell.org/package/parsec) (Haskell)
- thoughtbot: Author of [Argo](https://github.com/thoughtbot/Argo) (Swift JSON decoding library)

## References

- [Parser Combinators in Swift](https://realm.io/news/tryswift-yasuhiro-inami-parser-combinator/) (video)
- [Parser Combinator in Swift // Speaker Deck](https://speakerdeck.com/inamiy/parser-combinator-in-swift) (slide)

## Licence

[MIT](LICENSE)


text:
class gsVBOMonitor
{
public:
    gsVBOMonitor(int spyContextId);
    ~gsVBOMonitor();

public:
    // On Event functions:
    void onFirstTimeContextMadeCurrent();
    void onVertexBufferObjectGeneration(GLsizei amountOfGeneratedVertexBuffers, GLuint* vertexBufferNames);
    void onVertexBufferObjectDeletion(GLsizei amountOfDeletedVertexBuffers, const GLuint* vertexBufferNames);
    void onVertexBufferObjectTargetBind(GLenum target, GLuint vboName);
    void addTargetToBufferObject(GLenum target, GLuint vboName, bool bind = false);
    void onVertexBufferObjectDirectAccessDataSet(GLuint buffer, GLsizeiptr sizeOfData);
    void onVertexBufferObjectDataSet(GLenum target, GLsizeiptr sizeOfData);
    void onVertexBufferObjectDirectAccessSubDataSet(GLuint buffer);
    void onVertexBufferObjectSubDataSet(GLenum target);

    bool getVBOName(int vboIndex, GLuint& vboName) const;
    GLenum getVBOLatestAttachment(GLuint vboName) const;
    void getAllCurrentVBOAttachments(GLuint vboName, gtVector<GLenum>& vboAttachments) const;
    GLuint getAttachedVBOName(GLenum vboAttachment) const;

    bool updateVBORawData(apGLVBO* pVBO, oaTexelDataFormat bufferDataFormat);

    // VBO display properties:
    bool setVBODisplayProperties(GLuint vboName, oaTexelDataFormat displayFormat, int offset, GLsizei stride);

    // VBO data:
    apGLVBO* getVBODetails(GLuint vboName) const ;
    int amountOfVBOs() const {return (int)_vbos.size();};

    // Memory:
    bool calculateBuffersMemorySize(gtUInt64& buffersMemorySize) const ;

private:
    // Do not allow use of the = operator for this class. Use reference or pointer transferral instead
    gsVBOMonitor& operator=(const gsVBOMonitor& otherMonitor);
    gsVBOMonitor(const gsVBOMonitor& otherMonitor);

    // VBO actions:
    bool removeVBO(GLuint vboName);
    apGLVBO* addNewVBO(GLuint vboName);

    size_t getVBOIndex(GLuint vboName) const;
    void generateVBOFilePath(GLuint vboName, osFilePath& bufferFilePath) const;
    apGLVBO* getBoundVBO(GLenum target);

    // Bind VBO for reading:
    bool bindVBO(GLuint vboName, GLenum target);

    int _spyContextId;

    // Hold the VBOs that reside in this render context:
    gtPtrVector<apGLVBO*> _vbos;

    // Maps VBO OpenGL name to the VBO vector index:
    gtMap<GLuint, int> _vboOpenGLNameToIndex;

    // Map VBO names to bound targets:
    gtMap<GLuint, GLenum> _vboNameToTargetMap;

    GLuint m_bindArrayBufferVBOName;            // GL_ARRAY_BUFFER
    GLuint m_bindAtmoicCounterBufferVBOName;    // GL_ATOMIC_COUNTER_BUFFER
    GLuint m_bindCopyReadBufferVBOName;         // GL_COPY_READ_BUFFER
    GLuint m_bindCopyWriteBufferVBOName;        // GL_COPY_WRITE_BUFFER
    GLuint m_bindDispatchIndirectBufferVBOName; // GL_DISPATCH_INDIRECT_BUFFER
    GLuint m_bindDrawIndirectBufferVBOName;     // GL_DRAW_INDIRECT_BUFFER
    GLuint m_bindElementArrayBufferVBOName;     // GL_ELEMENT_ARRAY_BUFFER
    GLuint m_bindPixelPackBuffer;               // GL_PIXEL_PACK_BUFFER
    GLuint m_bindPixelUnPackBuffer;             // GL_PIXEL_UNPACK_BUFFER
    GLuint m_bindQueryBufferVBOName;            // GL_QUERY_BUFFER
    GLuint m_bindShaderStorageBufferVBOName;    // GL_SHADER_STORAGE_BUFFER
    GLuint m_bindTextureBufferName;             // GL_TEXTURE_BUFFER
    GLuint m_bindTransformFeedbackBufferVBOName;// GL_TRANSFORM_FEEDBACK_BUFFER
    GLuint m_bindUniformBufferName;             // GL_UNIFORM_BUFFER
    GLuint m_bindUniformBufferEXTName;          // GL_UNIFORM_BUFFER_EXT

    // Support unexpected targets:
    gtMap<GLenum, GLuint> m_vboTargetToAttachedNameMap;

    // Note that GL_UNIFORM_BUFFER and GL_UNIFORM_BUFFER_EXT are different enum values,
    // so theoretically these could be two different attachment points.

#if !((AMDT_BUILD_TARGET == AMDT_LINUX_OS) && (AMDT_LINUX_VARIANT == AMDT_MAC_OS_X_LINUX_VARIANT))

    PFNGLBINDBUFFERPROC _glBindBuffer;
    PFNGLGETBUFFERSUBDATAPROC _glGetBufferSubData;

#endif

};

#endif  // __GSDISPLAYLISTMONITOR


text:
const userService = require('../service/user')

module.exports = async () => {
  return userService.initTrafficAsync()
}