text:
package com.github.leeyazhou.scf.server.deploy.bytecode;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.github.leeyazhou.scf.core.loader.DynamicClassLoader;
import com.github.leeyazhou.scf.server.deploy.bytecode.ContractInfo.SessionBean;

public class ContractConfig {

  private ContractConfig() {

  }

  /**
   * load service contract
   *
   * @param configPath
   * @return
   * @throws Exception
   */
  public static ContractInfo loadContractInfo(String configPath, DynamicClassLoader classLoader) throws Exception {

    File f = new File(configPath);
    if (f != null && !f.exists()) {
      throw new Exception("contract config not exists: " + configPath);
    }

    ContractInfo sc = new ContractInfo();

    DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    domFactory.setNamespaceAware(true);
    DocumentBuilder builder = domFactory.newDocumentBuilder();
    Document doc = builder.parse(configPath);

    XPathFactory factory = XPathFactory.newInstance();
    XPath xpath = factory.newXPath();
    // XPathExpression exprServiceName =
    // xpath.compile("//contract/service-name");
    XPathExpression exprSessionBean = xpath.compile("//contract/sessionbean");
    XPathExpression exprInterface = xpath.compile("interface");
    XPathExpression exprInstanceClass = xpath.compile("instance/class");
    XPathExpression exprInstanceLookup = xpath.compile("instance/lookup");

    // Node snNode = (Node)exprServiceName.evaluate(doc, XPathConstants.NODE);
    // String serviceName = snNode.getTextContent().trim();
    // sc.setServiceName(serviceName);

    List<SessionBean> sbList = new ArrayList<SessionBean>();
    NodeList sessionBeanNodes = (NodeList) exprSessionBean.evaluate(doc, XPathConstants.NODESET);
    for (int i = 0; i < sessionBeanNodes.getLength(); i++) {
      Node interfaceNode = (Node) exprInterface.evaluate(sessionBeanNodes.item(i), XPathConstants.NODE);

      Map<String, String> map = new HashMap<String, String>();
      NodeList instanceClassNodes = (NodeList) exprInstanceClass.evaluate(sessionBeanNodes.item(i), XPathConstants.NODESET);
      NodeList instanceLookupNodes = (NodeList) exprInstanceLookup.evaluate(sessionBeanNodes.item(i), XPathConstants.NODESET);
      for (int j = 0; j < instanceClassNodes.getLength(); j++) {
        map.put(instanceLookupNodes.item(j).getTextContent().trim(), instanceClassNodes.item(j).getTextContent().trim());
      }

      String interfaceName = interfaceNode.getTextContent().trim();
      Class<?> cls = classLoader.loadClass(interfaceName);
      ClassInfo ci = ScanClass.contract(cls, true);

      sbList.add(new SessionBean(interfaceName, map, ci));
    }

    sc.setSessionBeanList(sbList);
    return sc;
  }
}


text:
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:exslt="http://exslt.org/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd" version="3.3" ID="P0b002ee184a2836f">
<name type="corporate">
 <namePart>United States Government Printing Office</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">printer</roleTerm>
  <roleTerm type="code" authority="marcrelator">prt</roleTerm>
</role>
 <role>
  <roleTerm type="text" authority="marcrelator">distributor</roleTerm>
  <roleTerm type="code" authority="marcrelator">dst</roleTerm>
</role>
</name>
<name type="corporate">
 <namePart>United States</namePart>
 <namePart>United States District Court Eastern District of California</namePart>
 <role>
  <roleTerm type="text" authority="marcrelator">author</roleTerm>
  <roleTerm type="code" authority="marcrelator">aut</roleTerm>
</role>
 <description>Government Organization</description>
</name>
<typeOfResource>text</typeOfResource>
<genre authority="marcgt">government publication</genre>
<language>
 <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</language>
<extension>
 <collectionCode>USCOURTS</collectionCode>
 <category>Judicial Publications</category>
 <branch>judicial</branch>
 <dateIngested>2013-05-08</dateIngested>
</extension>
<originInfo>
 <publisher>Administrative Office of the United States Courts</publisher>
 <dateIssued encoding="w3cdtf">2013-05-07</dateIssued>
 <issuance>monographic</issuance>
</originInfo>
<physicalDescription>
 <note type="source content type">deposited</note>
 <digitalOrigin>born digital</digitalOrigin>
</physicalDescription>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="uri">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-2_12-cv-03093</identifier>
<identifier type="local">P0b002ee184a2836f</identifier>
<recordInfo>
 <recordContentSource authority="marcorg">DGPO</recordContentSource>
 <recordCreationDate encoding="w3cdtf">2013-05-08</recordCreationDate>
 <recordChangeDate encoding="w3cdtf">2013-05-08</recordChangeDate>
 <recordIdentifier source="DGPO">USCOURTS-caed-2_12-cv-03093</recordIdentifier>
 <recordOrigin>machine generated</recordOrigin>
 <languageOfCataloging>
  <languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</languageOfCataloging>
</recordInfo>
<accessCondition type="GPO scope determination">fdlp</accessCondition>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-caed-2_12-cv-03093</accessId>
 <courtType>District</courtType>
 <courtCode>caed</courtCode>
 <courtCircuit>9th</courtCircuit>
 <courtState>California</courtState>
 <courtSortOrder>2061</courtSortOrder>
 <caseNumber>2:12-cv-03093</caseNumber>
 <caseOffice>Sacramento</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>530</natureSuitCode>
 <natureSuit>Prisoner Petitions - Habeas Corpus</natureSuit>
 <cause>28:2254 Petition for Writ of Habeas Corpus (State)</cause>
 <party firstName="Rodney" fullName="Rodney D. Mitchell" lastName="Mitchell" middleName="D." role="Petitioner"></party>
 <party fullName="Unknown" lastName="Unknown" role="Respondent"></party>
</extension>
<titleInfo>
 <title>(HC) Mitchell v. Unknown</title>
 <partNumber>2:12-cv-03093</partNumber>
</titleInfo>
<location>
 <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-2_12-cv-03093/content-detail.html</url>
</location>
<classification authority="sudocs">JU 4.15</classification>
<identifier type="preferred citation">2:12-cv-03093;12-3093</identifier>
<name type="corporate">
 <namePart>United States District Court Eastern District of California</namePart>
 <namePart>9th Circuit</namePart>
 <namePart>Sacramento</namePart>
 <affiliation>U.S. Courts</affiliation>
 <role>
  <roleTerm authority="marcrelator" type="text">author</roleTerm>
  <roleTerm authority="marcrelator" type="code">aut</roleTerm>
</role>
</name>
<name type="personal">
 <displayForm>Rodney D. Mitchell</displayForm>
 <namePart type="family">Mitchell</namePart>
 <namePart type="given">Rodney</namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Petitioner</description>
</name>
<name type="personal">
 <displayForm>Unknown</displayForm>
 <namePart type="family">Unknown</namePart>
 <namePart type="given"></namePart>
 <namePart type="termsOfAddress"></namePart>
 <description>Respondent</description>
</name>
<extension>
 <docClass>USCOURTS</docClass>
 <accessId>USCOURTS-caed-2_12-cv-03093</accessId>
 <courtType>District</courtType>
 <courtCode>caed</courtCode>
 <courtCircuit>9th</courtCircuit>
 <courtState>California</courtState>
 <courtSortOrder>2061</courtSortOrder>
 <caseNumber>2:12-cv-03093</caseNumber>
 <caseOffice>Sacramento</caseOffice>
 <caseType>civil</caseType>
 <natureSuitCode>530</natureSuitCode>
 <natureSuit>Prisoner Petitions - Habeas Corpus</natureSuit>
 <cause>28:2254 Petition for Writ of Habeas Corpus (State)</cause>
 <party firstName="Rodney" fullName="Rodney D. Mitchell" lastName="Mitchell" middleName="D." role="Petitioner"></party>
 <party fullName="Unknown" lastName="Unknown" role="Respondent"></party>
 <state>California</state>
</extension>
<relatedItem type="constituent" ID="id-USCOURTS-caed-2_12-cv-03093-0" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-caed-2_12-cv-03093/USCOURTS-caed-2_12-cv-03093-0/mods.xml">
 <titleInfo>
  <title>(HC) Mitchell v. Unknown</title>
  <subTitle>ORDER signed by Magistrate Judge Edmund F. Brennan on 1/4/13 ORDERING that petitioner shall file a petition for writ of habeas corpus within 30 days of the date of this order; Petitioner is warned that failure to do so will result in this case being closed; and the Clerk of the Court is directed to send petitioner the courts form for application for writ of habeas corpus.(Dillon, M)</subTitle>
  <partNumber>0</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2013-01-04</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-caed-2_12-cv-03093-0.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee184a2dd90</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-2_12-cv-03093/USCOURTS-caed-2_12-cv-03093-0</identifier>
 <identifier type="former granule identifier">caed-2_12-cv-03093_0.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-2_12-cv-03093/USCOURTS-caed-2_12-cv-03093-0/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-2_12-cv-03093/pdf/USCOURTS-caed-2_12-cv-03093-0.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 2:12-cv-03093; (HC) Mitchell v. Unknown; </searchTitle>
  <courtName>United States District Court Eastern District of California</courtName>
  <state>California</state>
  <accessId>USCOURTS-caed-2_12-cv-03093-0</accessId>
  <sequenceNumber>0</sequenceNumber>
  <dateIssued>2013-01-04</dateIssued>
  <docketText>ORDER signed by Magistrate Judge Edmund F. Brennan on 1/4/13 ORDERING that petitioner shall file a petition for writ of habeas corpus within 30 days of the date of this order; Petitioner is warned that failure to do so will result in this case being closed; and the Clerk of the Court is directed to send petitioner the courts form for application for writ of habeas corpus.(Dillon, M)</docketText>
</extension>
</relatedItem>
<relatedItem type="constituent" ID="id-USCOURTS-caed-2_12-cv-03093-1" xlink:href="http://www.gpo.gov/fdsys/granule/USCOURTS-caed-2_12-cv-03093/USCOURTS-caed-2_12-cv-03093-1/mods.xml">
 <titleInfo>
  <title>(HC) Mitchell v. Unknown</title>
  <subTitle>ORDER signed by Magistrate Judge Edmund F. Brennan on 5/7/2013 ORDERING that this action is TRANSFERRED to the USDC for the Central District of California. CASE CLOSED. (Yin, K)</subTitle>
  <partNumber>1</partNumber>
</titleInfo>
 <originInfo>
  <dateIssued>2013-05-07</dateIssued>
</originInfo>
 <relatedItem xlink:href="http://www.gpo.gov/fdsys/pkg/pdf/USCOURTS-caed-2_12-cv-03093-1.pdf" type="otherFormat">
  <identifier type="FDsys Unique ID">D09002ee184a2dd8f</identifier>
</relatedItem>
 <identifier type="uri">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-2_12-cv-03093/USCOURTS-caed-2_12-cv-03093-1</identifier>
 <identifier type="former granule identifier">caed-2_12-cv-03093_1.pdf</identifier>
 <location>
  <url access="object in context" displayLabel="Content Detail">http://www.gpo.gov/fdsys/granule/USCOURTS-caed-2_12-cv-03093/USCOURTS-caed-2_12-cv-03093-1/content-detail.html</url>
  <url access="raw object" displayLabel="PDF rendition">http://www.gpo.gov/fdsys/pkg/USCOURTS-caed-2_12-cv-03093/pdf/USCOURTS-caed-2_12-cv-03093-1.pdf</url>
</location>
 <extension>
  <searchTitle>USCOURTS 2:12-cv-03093; (HC) Mitchell v. Unknown; </searchTitle>
  <courtName>United States District Court Eastern District of California</courtName>
  <state>California</state>
  <accessId>USCOURTS-caed-2_12-cv-03093-1</accessId>
  <sequenceNumber>1</sequenceNumber>
  <dateIssued>2013-05-07</dateIssued>
  <docketText>ORDER signed by Magistrate Judge Edmund F. Brennan on 5/7/2013 ORDERING that this action is TRANSFERRED to the USDC for the Central District of California. CASE CLOSED. (Yin, K)</docketText>
</extension>
</relatedItem>
</mods>

redpajama_set_name: RedPajamaGithub


text:
foo(...new SymbolIterator, ...new StringIterator);

function foo(...s: (symbol | string)[]) { }
class SymbolIterator {
    next() {
        return {
            value: Symbol(),
            done: false
        };
    }

    [Symbol.iterator]() {
        return this;
    }
}

class StringIterator {
    next() {
        return {
            value: "",
            done: false
        };
    }

    [Symbol.iterator]() {
        return this;
    }
}


text:
NS_RURU_BEGIN

typedef size_t ComponentType_t;
typedef int ComponentHandle_t;

const ComponentHandle_t COMPONENT_NULL_HANDLE = -1;
const size_t COMPONENT_DEFAULT_ALLOCATION = 1000;
const size_t COMPONENT_TYPE_COUNT = 100;

NS_RURU_END

#endif


text:
package crm

import (
	. "aliyun-openapi-go-sdk/core"
)

type QueryCustomerLabelRequest struct {
	RpcRequest
	LabelSeries string
}

func (r *QueryCustomerLabelRequest) SetLabelSeries(value string) {
	r.LabelSeries = value
	r.QueryParams.Set("LabelSeries", value)
}
func (r *QueryCustomerLabelRequest) GetLabelSeries() string {
	return r.LabelSeries
}

func (r *QueryCustomerLabelRequest) Init() {
	r.RpcRequest.Init()
	r.SetVersion(Version)
	r.SetAction("QueryCustomerLabel")
	r.SetProduct(Product)
}

type QueryCustomerLabelResponse struct {
	Success bool   `xml:"Success" json:"Success"`
	Code    string `xml:"Code" json:"Code"`
	Message string `xml:"Message" json:"Message"`
	Data    struct {
		CustomerLabel []struct {
			Label       string `xml:"Label" json:"Label"`
			LabelSeries string `xml:"LabelSeries" json:"LabelSeries"`
		} `xml:"CustomerLabel" json:"CustomerLabel"`
	} `xml:"Data" json:"Data"`
}

func QueryCustomerLabel(req *QueryCustomerLabelRequest, accessId, accessSecret string) (*QueryCustomerLabelResponse, error) {
	var pResponse QueryCustomerLabelResponse
	body, err := ApiHttpRequest(accessId, accessSecret, req)
	if err != nil {
		return nil, err
	}
	ApiUnmarshalResponse(req.GetFormat(), body, &pResponse)
	return &pResponse, err
}


text:
COMPONENT=TestGyroBoard

USE_IP=True
SELECT_WIRED_OR_WIRELESS=True

include ../Makerules


text:
#ifndef TUDAT_ENTRYGUIDANCE_H
#define TUDAT_ENTRYGUIDANCE_H

#include "tudat/astro/reference_frames/aerodynamicAngleCalculator.h"

namespace tudat
{

namespace aerodynamics
{

//! Base class in which the aerodynamic angles (angle of attack, sideslip and bank angle) are computed. A derived class
//! implementing a specific guidance law is to be implemented by the user.
class AerodynamicGuidance
{
public:

    //! Constructor.
    AerodynamicGuidance( ):
        currentAngleOfAttack_( TUDAT_NAN ), currentAngleOfSideslip_( TUDAT_NAN ), currentBankAngle_( TUDAT_NAN ){ }

    //! Destructor
    virtual ~AerodynamicGuidance( ){ }

    //! Pure virtual function to update the guidance to the current time and state
    /*!
     *  Pure virtual function to update the guidance to the current time and state
     *  \param currentTime Time to which the guidance object is to be updated.
     */
    virtual void updateGuidance( const double currentTime ) = 0;

    //! Function to retrieve the current angle of attack, as set by last call to updateGuidance function
    /*!
     * Function to retrieve the current angle of attack, as set by last call to updateGuidance function
     * \return Current angle of attack, as set by last call to updateGuidance function
     */
    double getCurrentAngleOfAttack( )
    {
        return currentAngleOfAttack_;
    }

    //! Function to retrieve the current angle of sideslip, as set by last call to updateGuidance function
    /*!
     * Function to retrieve the current angle of sideslip, as set by last call to updateGuidance function
     * \return Current angle of sideslip, as set by last call to updateGuidance function
     */
    double getCurrentAngleOfSideslip( )
    {
        return currentAngleOfSideslip_;
    }

    //! Function to retrieve the current bank angle, as set by last call to updateGuidance function
    /*!
     * Function to retrieve the current bank angle, as set by last call to updateGuidance function
     * \return Current bank angle, as set by last call to updateGuidance function
     */
    double getCurrentBankAngle( )
    {
        return currentBankAngle_;
    }

protected:

    //! Current angle of attack, as set by last call to updateGuidance function
    double currentAngleOfAttack_;

    //! Current angle of sideslip, as set by last call to updateGuidance function
    double currentAngleOfSideslip_;

    //! Current bank angle, as set by last call to updateGuidance function
    double currentBankAngle_;

};

} // namespace aerodynamics

} // namespace tudat

#endif // TUDAT_ENTRYGUIDANCE_H


text:
package org.apache.wicket.markup.html.form;

import org.apache.wicket.Component;
import org.apache.wicket.Page;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.model.IModel;
import org.apache.wicket.util.string.PrependingStringBuffer;
import org.apache.wicket.version.undo.Change;

/**
 * Abstract class for links that are capable of submitting a form.
 *
 * @author Matej Knopp
 *
 */
public abstract class AbstractSubmitLink extends AbstractLink implements IFormSubmittingComponent
{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Target form or null if the form is parent of the link.
	 */
	private Form<?> form;

	/**
	 * If false, all standard processing like validating and model updating is skipped.
	 */
	private boolean defaultFormProcessing = true;

	/**
	 * Construct.
	 *
	 * @param id
	 * @param model
	 */
	public AbstractSubmitLink(String id, IModel<?> model)
	{
		super(id, model);
	}

	/**
	 *
	 * Construct.
	 *
	 * @param id
	 */
	public AbstractSubmitLink(String id)
	{
		super(id);
	}

	/**
	 * Construct.
	 *
	 * @param id
	 * @param model
	 * @param form
	 */
	public AbstractSubmitLink(String id, IModel<?> model, Form<?> form)
	{
		super(id, model);
		this.form = form;
	}

	/**
	 * Construct.
	 *
	 * @param id
	 * @param form
	 */
	public AbstractSubmitLink(String id, Form<?> form)
	{
		super(id);
		this.form = form;
	}

	/**
	 * Sets the defaultFormProcessing property. When false (default is true), all validation and
	 * formupdating is bypassed and the onSubmit method of that button is called directly, and the
	 * onSubmit method of the parent form is not called. A common use for this is to create a cancel
	 * button.
	 *
	 * TODO: This is a copy & paste from Button
	 *
	 * @param defaultFormProcessing
	 *            defaultFormProcessing
	 * @return This
	 */
	public final AbstractSubmitLink setDefaultFormProcessing(boolean defaultFormProcessing)
	{
		if (this.defaultFormProcessing != defaultFormProcessing)
		{
			addStateChange(new Change()
			{
				private static final long serialVersionUID = 1L;

				boolean formerValue = AbstractSubmitLink.this.defaultFormProcessing;

				@Override
				public void undo()
				{
					AbstractSubmitLink.this.defaultFormProcessing = formerValue;
				}

				@Override
				public String toString()
				{
					return "DefaultFormProcessingChange[component: " + getPath() +
						", default processing: " + formerValue + "]";
				}
			});
		}

		this.defaultFormProcessing = defaultFormProcessing;
		return this;
	}

	/**
	 * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#getDefaultFormProcessing()
	 */
	public boolean getDefaultFormProcessing()
	{
		return defaultFormProcessing;
	}

	/**
	 * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#getForm()
	 */
	public Form<?> getForm()
	{
		if (form != null)
		{
			return form;
		}
		else
		{
			return findParent(Form.class);
		}
	}

	/**
	 * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#getInputName()
	 */
	public String getInputName()
	{
		// TODO: This is a copy & paste from the FormComponent class.
		String id = getId();
		final PrependingStringBuffer inputName = new PrependingStringBuffer(id.length());
		Component c = this;
		while (true)
		{
			inputName.prepend(id);
			c = c.getParent();
			if (c == null || (c instanceof Form && ((Form<?>)c).isRootForm()) || c instanceof Page)
			{
				break;
			}
			inputName.prepend(Component.PATH_SEPARATOR);
			id = c.getId();
		}

		// having input name "submit" causes problems with javascript, so we
		// create a unique string to replace it by prepending a path separator
		if (inputName.equals("submit"))
		{
			inputName.prepend(Component.PATH_SEPARATOR);
		}
		return inputName.toString();
	}
}


text:
package hamt32

import (
	"github.com/lleo/go-hamt-key"
)

// nodeI is the interface for every entry in a table; so table entries are
// either a leaf or a table or nil.
//
// The nodeI interface can be for compressedTable, fullTable, flatLeaf, or
// collisionLeaf.
//
// The tableI interface is for compressedTable and fullTable.
//
// The Hash30() method for leaf structs is the 30 most significant bits of
// the keys hash.
//
// The Hash30() method for table structs is the depth*nBits of the hash path
// that leads to the table's position in the Trie.
//
// For leafs Hash30() is the 30 bits returned by a keys Hash30().
// For collisionLeafs this is the definition of what a collision is.
//
type nodeI interface {
	Hash30() key.HashVal30
	String() string
}

// Every leafI is a nodeI
type leafI interface {
	nodeI
	get(key key.Key) (interface{}, bool)
	put(key key.Key, val interface{}) (leafI, bool) //bool == added? key/val pair
	del(key key.Key) (leafI, interface{}, bool)     //bool == deleted? key
	keyVals() []key.KeyVal
}

type KeyVals []key.KeyVal

func (kvs KeyVals) contains(k0 key.Key) bool {
	for _, kv := range kvs {
		var k1 = kv.Key
		if k0.Equals(k1) {
			return true
		}
	}
	return false
}

// Every tableI is a nodeI.
//
type tableI interface {
	nodeI

	LongString(indent string, recurse bool) string

	nentries() uint // get the number of nodeI entries

	// Get an Ordered list of index and node pairs. This slice MUST BE Ordered
	// from lowest index to highest.
	entries() []tableEntry

	get(idx uint) nodeI

	insert(idx uint, entry nodeI) tableI
	replace(idx uint, entry nodeI) tableI
	remove(idx uint) tableI
}

type tableEntry struct {
	idx  uint
	node nodeI
}


text:
template<typename _Object>
class CStateMonsterSmartTerrainTask : public CState<_Object> {
	typedef CState<_Object>		inherited;
	typedef CState<_Object>*	state_ptr;

	CALifeSmartTerrainTask *m_current_task;
public:
						CStateMonsterSmartTerrainTask	(_Object *obj);
	virtual				~CStateMonsterSmartTerrainTask	();

	virtual void		initialize				();
	virtual	void		reselect_state			();
	virtual bool		check_start_conditions	();
	virtual bool		check_completion		();
	virtual void		setup_substates			();
	virtual void		check_force_state		();
};

#include "monster_state_smart_terrain_task_inline.h"


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

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Obtain the payment url (needs 2 arguments)</title>

nthmac

Cryptography Extensions

SPPLUS Functions

PHP Manual

signeurlpaiement

(PECL spplus >= 1.0.0)

signeurlpaiement — Obtain the payment url (needs 2 arguments)

Description

   string nthmac
    ( string $clent
   , string $data
   )

Warning
This function is
currently not documented; only its argument list is available.

Return Values

   Returns TRUE on success or FALSE on failure.

Notes

Warning
This function is
EXPERIMENTAL. The behaviour of this function, its name, and
surrounding documentation may change without notice in a future release of PHP.
This function should be used at your own risk.

nthmac

Cryptography Extensions

SPPLUS Functions

PHP Manual


text:
.composeMessageDialog .dnnLeft .dnnFormItem{border-bottom:solid 1px #eee;width:400px;}
.composeMessageDialog .dnnLeft .dnnFormItem img{vertical-align:middle;float:right;}
.composeMessageDialog .dnnLeft button{cursor:pointer;padding:0.5em 1em;border:none;}
.composeMessageDialog .dnnFormItem label, .composeMessageDialog .dnnFormItem .dnnFormLabel, .composeMessageDialog .dnnFormItem .dnnTooltip{width: 25%;}
ul.token-input-list-facebook{width: 46%; margin-bottom: 18px;}
div.token-input-dropdown-facebook ul li img{padding-right:10px;vertical-align:middle;}
/* MESSAGE ATTACHMENTS */
.composeMessageDialog .messageAttachments {
    width:300px;
    float:right;
}
.composeMessageDialog .messageAttachments ul li{
	overflow:auto;
	list-style:none;
	border-bottom:1px solid #ddd;
	margin-bottom:5px;
}
.composeMessageDialog .messageAttachments ul li a{
	float:left;
	font-size:12px;
	text-decoration:none;
}
.composeMessageDialog .messageAttachments a.removeAttachment{
	float:right;
	display:block;
	padding:3px;
	width:10px; height:10px;
	background:url(images/delete.png) no-repeat 3px 3px;
	opacity:0.75;
}
.composeMessageDialog .messageAttachments a.removeAttachment:hover{
	opacity:1;
}


text:
"""Tests for the views of the ``django-tinylinks`` app."""
from django.contrib.auth.models import Permission
from django.test import TestCase
from django.core.urlresolvers import reverse

from django_libs.tests.mixins import ViewRequestFactoryTestMixin
from mixer.backend.django import mixer
from mock import patch
from requests import Response

from .. import views
from ..models import Tinylink

class TinylinkViewTestsMixin(object):
    def setUp(self):
        self.user = mixer.blend('auth.User')
        # User needs this permission to access the create view.
        self.user.user_permissions.add(Permission.objects.get(
            codename="add_tinylink"))
        self.user.user_permissions.add(Permission.objects.get(
            codename="delete_tinylink"))
        self.tinylink = mixer.blend(
            'tinylinks.TinyLink', short_url="vB7f5b",
            long_url="http://www.example.com/thisisalongURL", user=self.user)
        self.second_user = mixer.blend('auth.User')
        self.second_user.user_permissions.add(Permission.objects.get(
            codename="add_tinylink"))
        self.second_user.user_permissions.add(Permission.objects.get(
            codename="delete_tinylink"))
        self.staff = mixer.blend('auth.User', is_staff=True, is_superuser=True)

class TinylinkListViewTestCase(ViewRequestFactoryTestMixin,
                               TinylinkViewTestsMixin, TestCase):
    """Tests for the ``TinylinkListView`` generic view class."""
    view_class = views.TinylinkListView

    @patch('requests.get')
    def test_view(self, mock):
        resp = Response()
        resp.status_code = 200
        mock.return_value = resp

        self.is_callable(user=self.staff)
        self.is_callable(user=self.user)
        self.is_not_callable(user=self.user, data={'validateABC': True},
                             post=True)
        self.is_not_callable(user=self.user, data={'validate999': True},
                             post=True)
        self.tinylink.long_url = "http://www.google.com"
        self.tinylink.is_broken = True
        self.tinylink.save()
        self.is_postable(user=self.user, data={
            'validate{0}'.format(self.tinylink.id): True}, ajax=True)
        self.assertFalse(Tinylink.objects.get(pk=self.tinylink.pk).is_broken,
                         msg="Link should be valid.")

class TinylinkCreateViewTestCase(ViewRequestFactoryTestMixin,
                                 TinylinkViewTestsMixin, TestCase):
    """Tests for the ``TinylinkCreateView`` generic view class."""
    view_class = views.TinylinkCreateView

    def test_view(self):
        self.is_callable(user=self.user)
        # User is redirected to a predefined form.
        # She can change the short URL or add a more readable one.
        self.is_postable(user=self.user, to_url_name='tinylink_update', data={
            'long_url': 'http://www.example.com/foobar'})

class TinylinkUpdateViewTestCase(ViewRequestFactoryTestMixin,
                                 TinylinkViewTestsMixin, TestCase):
    """
    Tests for the ``TinylinkUpdateView`` generic view class.

    """
    view_class = views.TinylinkUpdateView

    def get_view_kwargs(self):
        return {'pk': self.tinylink.id, 'mode': 'change-short'}

    def test_view(self):
        self.login(self.user)
        # Redirect to list after saving.
        data = {
            'long_url': self.tinylink.long_url,
            'short_url': 'foobar',
        }
        self.is_postable(user=self.user, data=data,
                         to_url_name='tinylink_list')

class TinylinkDeleteViewTestCase(ViewRequestFactoryTestMixin,
                                 TinylinkViewTestsMixin, TestCase):
    """Tests for the ``TinylinkDeleteView`` generic view class."""
    view_class = views.TinylinkDeleteView

    def get_view_kwargs(self):
        return {'pk': self.tinylink.id}

    def test_view(self):
        # Raise 404 if user is not author of the tinylink.
        self.is_not_callable(user=self.second_user)
        self.is_callable(user=self.user)
        self.is_postable(user=self.user, data={'Foo': 'Bar'},
                         to_url_name='tinylink_list')

class TinylinkRedirectViewTestCase(ViewRequestFactoryTestMixin,
                                   TinylinkViewTestsMixin, TestCase):
    """
    Tests for the ``TinylinkRedirectView`` generic view class.

    """
    view_class = views.TinylinkRedirectView

    def get_view_kwargs(self):
        return {'short_url': self.tinylink.short_url}

    def test_view(self):
        resp = self.redirects(user=self.user)
        # Valid redirection to long URL.
        self.assertEqual(
            resp.get('Location'),
            self.tinylink.long_url,
            msg=('Should redirect to long url. Response was {0}'.format(resp)))
        view_amount = Tinylink.objects.get(pk=self.tinylink.pk).amount_of_views
        self.assertEqual(view_amount, 1, msg=(
            'Should set the view amount to 1. Amount:{0}'.format(view_amount)))
        # Invalid short URL. Send to a 404-like template.
        resp = self.client.get('/aaaaa/')
        self.assertIn(
            reverse('tinylink_notfound'),
            resp.get('Location'),
            msg=('Should redirect to "Not found" page if short_url is'
                 ' inexistent. Response was {0}'.format(resp.get('Location'))))

    def test_can_handle_urls_with_percent_characters(self):
        """Regression test due to reported internal server errors."""
        tinylink = mixer.blend(
            'tinylinks.TinyLink', user=self.user, short_url='abcdef',
            long_url='http://www.example.com/test%20Efile.pdf')
        resp = self.redirects(user=self.user, kwargs={
            'short_url': tinylink.short_url})
        self.assertEqual(
            resp.get('Location'),
            tinylink.long_url,
            msg=('Should redirect to long url. Response was {0}'.format(resp)))

class StatisticsViewTestCase(ViewRequestFactoryTestMixin,
                             TinylinkViewTestsMixin, TestCase):
    """Tests for the ``StatisticsView`` generic view class."""
    view_class = views.StatisticsView

    def test_view(self):
        self.is_not_callable(user=self.user)
        self.user.is_staff = True
        self.user.save()
        self.is_callable(user=self.user)


text:
See comprehensive documentation on our [GitHub
page](https://github.com/docker/docker-registry).

## Run the Registry

### Recommended: run the registry docker container

 * install docker according to the [following
   instructions](http://docs.docker.io/installation/#installation)
 * run the registry: `docker run -p 5000:5000 registry`

or

```
docker run \
         -e SETTINGS_FLAVOR=s3 \
         -e AWS_BUCKET=acme-docker \
         -e STORAGE_PATH=/registry \
         -e AWS_KEY=AKIAHSHB43HS3J92MXZ \
         -e AWS_SECRET=xdDowwlK7TJajV1Y7EoOZrmuPEJlHYcNP2k4j49T \
         -e SEARCH_BACKEND=sqlalchemy \
         -p 5000:5000 \
         registry
```

NOTE: The container will try to allocate the port 5000. If the port is already
taken, find out which container is already using it by running `docker ps`.


text:
<?php

namespace GrumPHP\Locator;

use Gitonomy\Git\Diff\File;
use Gitonomy\Git\Repository;
use GrumPHP\Collection\FilesCollection;
use SplFileInfo;

/**
 * Class Git
 *
 * @package GrumPHP\Locator
 */
class ChangedFiles implements LocatorInterface
{

    /**
     * @var Repository
     */
    protected $repository;

    /**
     * @param Repository $repository
     */
    public function __construct(Repository $repository)
    {
        $this->repository = $repository;

    }

    /**
     * @return FilesCollection
     */
    public function locate()
    {
        $diff = $this->repository->getDiff('HEAD');
        $files = array();
        /** @var File $file */
        foreach ($diff->getFiles() as $file) {
            if ($file->isDeletion()) {
                continue;
            }

            $fileName = $file->isRename() ? $file->getNewName() : $file->getName();
            $files[] = new SplFileInfo($fileName);
        }

        return new FilesCollection($files);
    }
}


text:
<?php
/**
 * Test for net::stubbles::webapp::xml::route::stubBcRouteReader.
 *
 * @package     stubbles
 * @subpackage  webapp_xml_route
 * @version     $Id$
 */
stubClassLoader::load('net::stubbles::webapp::xml::route::stubBcRouteReader');
/**
 * Test for net::stubbles::webapp::xml::route::stubBcRouteReader.
 *
 * @package     stubbles
 * @subpackage  webapp_xml_route
 * @since       1.7.0
 * @deprecated
 * @group       webapp
 * @group       webapp_xml
 * @group       webapp_xml_route
 */
class stubBcRouteReaderTestCase extends PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function hasAnnotationsOnConstructor()
    {
        $refClass    = new stubReflectionClass('stubBcRouteReader');
        $constructor = $refClass->getConstructor();
        $this->assertTrue($constructor->hasAnnotation('Inject'));

        $parameters = $constructor->getParameters();
        $this->assertTrue($parameters[0]->hasAnnotation('Named'));
        $this->assertEquals('xml', $parameters[0]->getAnnotation('Named')->getName());
    }

    /**
     * @test
     */
    public function usesRouterToDetectRoute()
    {
        $mockRouter    = $this->getMock('stubRouter');
        $mockRequest   = $this->getMock('stubRequest');
        $bcRouteReader = new stubBcRouteReader($mockRouter, $mockRequest);
        $route         = new stubRoute(new stubProperties());
        $mockRouter->expects($this->once())
                   ->method('route')
                   ->with($this->equalTo($mockRequest))
                   ->will($this->returnValue($route));
        $this->assertSame($route, $bcRouteReader->getRoute('foo'));
    }
}
?>


text:
Visibility can be changed with the as aliasing construct as well.
--FILE--
<?php
error_reporting(E_ALL);

trait HelloWorld {
   public function sayHello() {
     echo 'Hello World!';
   }
}

class MyClass {
   use HelloWorld { sayHello as protected; }
}

$o = new MyClass;
$o->sayHello();

?>
--EXPECTF--

Fatal error: Call to protected method MyClass::sayHello() from context '' in %s on line %d, position %d


text:
<#
.SYNOPSIS
Designed to set a Windows host to connect to the httptester container running
on the Ansible host. This will setup the Windows host file and forward the
local ports to use this connection. This will continue to run in the background
until the script is deleted.

Run this with SSH with the -R arguments to foward ports 8080 and 8443 to the
httptester container.

.PARAMETER Hosts
A list of hostnames, delimited by '|', to add to the Windows hosts file for the
httptester container, e.g. 'ansible.host.com|secondary.host.test'.
#>
[CmdletBinding()]
param(
    [Parameter(Mandatory=$true, Position=0)][String]$Hosts
)
$Hosts = $Hosts.Split('|')

$ProgressPreference = "SilentlyContinue"
$ErrorActionPreference = "Stop"
$os_version = [Version](Get-Item -Path "$env:SystemRoot\System32\kernel32.dll").VersionInfo.ProductVersion
Write-Verbose -Message "Configuring HTTP Tester on Windows $os_version for '$($Hosts -join "', '")'"

Function Get-PmapperRuleBytes {
    <#
    .SYNOPSIS
    Create the byte values that configures a rule in the PMapper configuration
    file. This isn't really documented but because PMapper is only used for
    Server 2008 R2 we will stick to 1 version and just live with the legacy
    work for now.

    .PARAMETER ListenPort
    The port to listen on localhost, this will be forwarded to the host defined
    by ConnectAddress and ConnectPort.

    .PARAMETER ConnectAddress
    The hostname or IP to map the traffic to.

    .PARAMETER ConnectPort
    This port of ConnectAddress to map the traffic to.
    #>
    param(
        [Parameter(Mandatory=$true)][UInt16]$ListenPort,
        [Parameter(Mandatory=$true)][String]$ConnectAddress,
        [Parameter(Mandatory=$true)][Int]$ConnectPort
    )

    $connect_field = "$($ConnectAddress):$ConnectPort"
    $connect_bytes = [System.Text.Encoding]::ASCII.GetBytes($connect_field)
    $data_length = [byte]($connect_bytes.Length + 6) # size of payload minus header, length, and footer
    $port_bytes = [System.BitConverter]::GetBytes($ListenPort)

    $payload = [System.Collections.Generic.List`1[Byte]]@()
    $payload.Add([byte]16) > $null # header is \x10, means Configure Mapping rule
    $payload.Add($data_length) > $null
    $payload.AddRange($connect_bytes)
    $payload.AddRange($port_bytes)
    $payload.AddRange([byte[]]@(0, 0)) # 2 extra bytes of padding
    $payload.Add([byte]0) > $null # 0 is TCP, 1 is UDP
    $payload.Add([byte]0) > $null # 0 is Any, 1 is Internet
    $payload.Add([byte]31) > $null # footer is \x1f, means end of Configure Mapping rule

    return ,$payload.ToArray()
}

Write-Verbose -Message "Adding host file entries"
$hosts_file = "$env:SystemRoot\System32\drivers\etc\hosts"
$hosts_file_lines = [System.IO.File]::ReadAllLines($hosts_file)
$changed = $false
foreach ($httptester_host in $Hosts) {
    $host_line = "127.0.0.1 $httptester_host # ansible-test httptester"
    if ($host_line -notin $hosts_file_lines) {
        $hosts_file_lines += $host_line
        $changed = $true
    }
}
if ($changed) {
    Write-Verbose -Message "Host file is missing entries, adding missing entries"
    [System.IO.File]::WriteAllLines($hosts_file, $hosts_file_lines)
}

# forward ports
$forwarded_ports = @{
    80 = 8080
    443 = 8443
}
if ($os_version -ge [Version]"6.2") {
    Write-Verbose -Message "Using netsh to configure forwarded ports"
    foreach ($forwarded_port in $forwarded_ports.GetEnumerator()) {
        $port_set = netsh interface portproxy show v4tov4 | `
            Where-Object { $_ -match "127.0.0.1\s*$($forwarded_port.Key)\s*127.0.0.1\s*$($forwarded_port.Value)" }

        if (-not $port_set) {
            Write-Verbose -Message "Adding netsh portproxy rule for $($forwarded_port.Key) -> $($forwarded_port.Value)"
            $add_args = @(
                "interface",
                "portproxy",
                "add",
                "v4tov4",
                "listenaddress=127.0.0.1",
                "listenport=$($forwarded_port.Key)",
                "connectaddress=127.0.0.1",
                "connectport=$($forwarded_port.Value)"
            )
            $null = netsh $add_args 2>&1
        }
    }
} else {
    Write-Verbose -Message "Using Port Mapper to configure forwarded ports"
    # netsh interface portproxy doesn't work on local addresses in older
    # versions of Windows. Use custom application Port Mapper to acheive the
    # same outcome
    # http://www.analogx.com/contents/download/Network/pmapper/Freeware.htm
    $s3_url = "https://ansible-ci-files.s3.amazonaws.com/ansible-test/pmapper-1.04.exe"

    # download the Port Mapper executable to a temporary directory
    $pmapper_folder = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath ([System.IO.Path]::GetRandomFileName())
    $pmapper_exe = Join-Path -Path $pmapper_folder -ChildPath pmapper.exe
    $pmapper_config = Join-Path -Path $pmapper_folder -ChildPath pmapper.dat
    New-Item -Path $pmapper_folder -ItemType Directory > $null

    $stop = $false
    do {
        try {
            Write-Verbose -Message "Attempting download of '$s3_url'"
            (New-Object -TypeName System.Net.WebClient).DownloadFile($s3_url, $pmapper_exe)
            $stop = $true
        } catch { Start-Sleep -Second 5 }
    } until ($stop)

    # create the Port Mapper rule file that contains our forwarded ports
    $fs = [System.IO.File]::Create($pmapper_config)
    try {
        foreach ($forwarded_port in $forwarded_ports.GetEnumerator()) {
            Write-Verbose -Message "Creating forwarded port rule for $($forwarded_port.Key) -> $($forwarded_port.Value)"
            $pmapper_rule = Get-PmapperRuleBytes -ListenPort $forwarded_port.Key -ConnectAddress 127.0.0.1 -ConnectPort $forwarded_port.Value
            $fs.Write($pmapper_rule, 0, $pmapper_rule.Length)
        }
    } finally {
        $fs.Close()
    }

    Write-Verbose -Message "Starting Port Mapper '$pmapper_exe' in the background"
    $start_args = @{
        CommandLine = $pmapper_exe
        CurrentDirectory = $pmapper_folder
    }
    $res = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments $start_args
    if ($res.ReturnValue -ne 0) {
        $error_msg = switch($res.ReturnValue) {
            2 { "Access denied" }
            3 { "Insufficient privilege" }
            8 { "Unknown failure" }
            9 { "Path not found" }
            21 { "Invalid parameter" }
            default { "Undefined Error: $($res.ReturnValue)" }
        }
        Write-Error -Message "Failed to start pmapper: $error_msg"
    }
    $pmapper_pid = $res.ProcessId
    Write-Verbose -Message "Port Mapper PID: $pmapper_pid"
}

Write-Verbose -Message "Wait for current script at '$PSCommandPath' to be deleted before running cleanup"
$fsw = New-Object -TypeName System.IO.FileSystemWatcher
$fsw.Path = Split-Path -Path $PSCommandPath -Parent
$fsw.Filter = Split-Path -Path $PSCommandPath -Leaf
$fsw.WaitForChanged([System.IO.WatcherChangeTypes]::Deleted, 3600000) > $null
Write-Verbose -Message "Script delete or timeout reached, cleaning up Windows httptester artifacts"

Write-Verbose -Message "Cleanup host file entries"
$hosts_file_lines = [System.IO.File]::ReadAllLines($hosts_file)
$new_lines = [System.Collections.ArrayList]@()
$changed = $false
foreach ($host_line in $hosts_file_lines) {
    if ($host_line.EndsWith("# ansible-test httptester")) {
        $changed = $true
        continue
    }
    $new_lines.Add($host_line) > $null
}
if ($changed) {
    Write-Verbose -Message "Host file has extra entries, removing extra entries"
    [System.IO.File]::WriteAllLines($hosts_file, $new_lines)
}

if ($os_version -ge [Version]"6.2") {
    Write-Verbose -Message "Cleanup of forwarded port configured in netsh"
    foreach ($forwarded_port in $forwarded_ports.GetEnumerator()) {
        $port_set = netsh interface portproxy show v4tov4 | `
            Where-Object { $_ -match "127.0.0.1\s*$($forwarded_port.Key)\s*127.0.0.1\s*$($forwarded_port.Value)" }

        if ($port_set) {
            Write-Verbose -Message "Removing netsh portproxy rule for $($forwarded_port.Key) -> $($forwarded_port.Value)"
            $delete_args = @(
                "interface",
                "portproxy",
                "delete",
                "v4tov4",
                "listenaddress=127.0.0.1",
                "listenport=$($forwarded_port.Key)"
            )
            $null = netsh $delete_args 2>&1
        }
    }
} else {
    Write-Verbose -Message "Stopping Port Mapper executable based on pid $pmapper_pid"
    Stop-Process -Id $pmapper_pid -Force

    # the process may not stop straight away, try multiple times to delete the Port Mapper folder
    $attempts = 1
    do {
        try {
            Write-Verbose -Message "Cleanup temporary files for Port Mapper at '$pmapper_folder' - Attempt: $attempts"
            Remove-Item -Path $pmapper_folder -Force -Recurse
            break
        } catch {
            Write-Verbose -Message "Cleanup temporary files for Port Mapper failed, waiting 5 seconds before trying again:$($_ | Out-String)"
            if ($attempts -ge 5) {
                break
            }
            $attempts += 1
            Start-Sleep -Second 5
        }
    } until ($true)
}


text:
package org.onosproject.yangutils.datamodel;

/**
 * Abstraction of information about entity being resolved.
 *
 * @param <T> type of entity being resolved, uses / grouping
 */
public interface YangEntityToResolveInfo<T> {

    /**
     * Retrieves the entity to be resolved.
     *
     * @return entity to be resolved
     */
    T getEntityToResolve();

    /**
     * Sets entity to be resolved.
     *
     * @param entityToResolve entity to be resolved
     */
    void setEntityToResolve(T entityToResolve);

    /**
     * Retrieves the parent node which contains the entity to be resolved.
     *
     * @return parent node which contains the entity to be resolved
     */
    YangNode getHolderOfEntityToResolve();

    /**
     * Sets parent node which contains the entity to be resolved.
     *
     * @param holderOfEntityToResolve parent node which contains the entity to
     *                                be resolved
     */
    void setHolderOfEntityToResolve(YangNode holderOfEntityToResolve);
}


text:
package altsrc

import (
	"flag"
	"io/ioutil"
	"os"
	"testing"

	"github.com/urfave/cli"
)

const (
	fileName   = "current.json"
	simpleJSON = `{"test": 15}`
	nestedJSON = `{"top": {"test": 15}}`
)

func TestCommandJSONFileTest(t *testing.T) {
	cleanup := writeTempFile(t, fileName, simpleJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("test")
			expect(t, val, 15)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "test"}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))
	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileTestGlobalEnvVarWins(t *testing.T) {
	cleanup := writeTempFile(t, fileName, simpleJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	os.Setenv("THE_TEST", "10")
	defer os.Setenv("THE_TEST", "")

	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("test")
			expect(t, val, 10)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "test", EnvVars: []string{"THE_TEST"}}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileTestGlobalEnvVarWinsNested(t *testing.T) {
	cleanup := writeTempFile(t, fileName, nestedJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	os.Setenv("THE_TEST", "10")
	defer os.Setenv("THE_TEST", "")

	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("top.test")
			expect(t, val, 10)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "top.test", EnvVars: []string{"THE_TEST"}}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileTestSpecifiedFlagWins(t *testing.T) {
	cleanup := writeTempFile(t, fileName, simpleJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	test := []string{"test-cmd", "--load", fileName, "--test", "7"}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("test")
			expect(t, val, 7)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "test"}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileTestSpecifiedFlagWinsNested(t *testing.T) {
	cleanup := writeTempFile(t, fileName, nestedJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	test := []string{"test-cmd", "--load", fileName, "--top.test", "7"}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("top.test")
			expect(t, val, 7)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "top.test"}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileTestDefaultValueFileWins(t *testing.T) {
	cleanup := writeTempFile(t, fileName, simpleJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("test")
			expect(t, val, 15)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "test", Value: 7}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileTestDefaultValueFileWinsNested(t *testing.T) {
	cleanup := writeTempFile(t, fileName, nestedJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("top.test")
			expect(t, val, 15)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "top.test", Value: 7}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))

	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileFlagHasDefaultGlobalEnvJSONSetGlobalEnvWins(t *testing.T) {
	cleanup := writeTempFile(t, fileName, simpleJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	os.Setenv("THE_TEST", "11")
	defer os.Setenv("THE_TEST", "")

	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("test")
			expect(t, val, 11)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "test", Value: 7, EnvVars: []string{"THE_TEST"}}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))
	err := command.Run(c)

	expect(t, err, nil)
}

func TestCommandJSONFileFlagHasDefaultGlobalEnvJSONSetGlobalEnvWinsNested(t *testing.T) {
	cleanup := writeTempFile(t, fileName, nestedJSON)
	defer cleanup()

	app := &cli.App{}
	set := flag.NewFlagSet("test", 0)
	os.Setenv("THE_TEST", "11")
	defer os.Setenv("THE_TEST", "")

	test := []string{"test-cmd", "--load", fileName}
	set.Parse(test)

	c := cli.NewContext(app, set, nil)

	command := &cli.Command{
		Name:        "test-cmd",
		Aliases:     []string{"tc"},
		Usage:       "this is for testing",
		Description: "testing",
		Action: func(c *cli.Context) error {
			val := c.Int("top.test")
			expect(t, val, 11)
			return nil
		},
		Flags: []cli.Flag{
			NewIntFlag(&cli.IntFlag{Name: "top.test", Value: 7, EnvVars: []string{"THE_TEST"}}),
			&cli.StringFlag{Name: "load"}},
	}
	command.Before = InitInputSourceWithContext(command.Flags, NewJSONSourceFromFlagFunc("load"))
	err := command.Run(c)

	expect(t, err, nil)
}

func writeTempFile(t *testing.T, name string, content string) func() {
	if err := ioutil.WriteFile(name, []byte(content), 0666); err != nil {
		t.Fatalf("cannot write %q: %v", name, err)
	}
	return func() {
		if err := os.Remove(name); err != nil {
			t.Errorf("cannot remove %q: %v", name, err)
		}
	}
}


text:
package org.opencb.opencga.core.models.study;

import org.opencb.opencga.core.models.AclEntryList;

public class StudyAclEntryList extends AclEntryList<StudyPermissions.Permissions> {
}


text:
import sys
import numpy as np
import cv2
from pylepton import Lepton
from mq import *
import time

try:
    print("Press CTRL+C to abort.")

    mq = MQ();
    while True:
        perc = mq.MQPercentage()
        sys.stdout.write("\r")
        sys.stdout.write("\033[K")
        sys.stdout.write("LPG: %g ppm, CO: %g ppm, Smoke: %g ppm" % (perc["GAS_LPG"], perc["CO"], perc["SMOKE"]))
        sys.stdout.flush()
        time.sleep(0.1)

def capture(flip_v = False, device = "/dev/spidev0.0"):
  with Lepton(device) as l:
    a,_ = l.capture()
  if flip_v:
    cv2.flip(a,0,a)
  cv2.normalize(a, a, 0, 65535, cv2.NORM_MINMAX)
  np.right_shift(a, 8, a)
  return np.uint8(a)

if __name__ == '__main__':
  from optparse import OptionParser

  usage = "usage: %prog [options] output_file[.format]"
  parser = OptionParser(usage=usage)

  parser.add_option("-f", "--flip-vertical",
                    action="store_true", dest="flip_v", default=False,
                    help="flip the output image vertically")

  parser.add_option("-d", "--device",
                    dest="device", default="/dev/spidev0.0",
                    help="specify the spi device node (might be /dev/spidev0.1 on a newer device)")

  (options, args) = parser.parse_args()

  if len(args) < 1:
    print("You must specify an output filename")
    sys.exit(1)

  image = capture(flip_v = options.flip_v, device = options.device)
  cv2.imwrite(args[0], image)


text:
/**
 * @author Mark McKenna <mark.denis.mckenna@gmail.com>
 * @version 0.1
 * @since 04/08/2014
 */
@ParametersAreNonnullByDefault
package com.lantopia.oppo.transport;

import javax.annotation.ParametersAreNonnullByDefault;


text:
using namespace boost::python;
using namespace std;
using namespace swganh::messages;

struct UpdateTransformWithParentMessageWrapper : UpdateTransformWithParentMessage, wrapper<UpdateTransformWithParentMessage>
{

};
void exportUpdateTransformWithParentMessage()
{
    class_<UpdateTransformWithParentMessageWrapper, boost::noncopyable>("UpdateTransformWithParentMessage");
}


text:
+++ ./cmake/OpenCVVersion.cmake	2013-10-24 00:13:06.000000000 -0400
@@ -11,7 +11,7 @@
   set(OPENCV_VERSION "${OPENCV_VERSION}.${OPENCV_VERSION_TWEAK}")
 endif()

-set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
+set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}")
 set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")

 # create a dependency on version file


text:
<!DOCTYPE html>

    <title>Task6</title>
    <link href="style.css" rel="stylesheet" />

Write a script that enters the coefficients a, b and c of a quadratic equation a*x2 + b*x + c = 0 and calculates and prints its real roots. Note that quadratic equations may have 0, 1 or 2 real roots..

        Coeficcient A:
        <input type="text" id="firstNum" autofocus="autofocus" placeholder="Enter an integer number"/>
        Coeficcient B:
        <input type="text" id="secondNum" placeholder="Enter an integer number"/>
        Coeficcient C:
        <input type="text" id="thirdNum" placeholder="Enter an integer number"/>
        <button onclick="calculateRoots()">Calculate roots</button>


text:
package model.node.turtleCommand;

import model.node.ZeroArgOperation;
import model.turtle.Turtle;

public class HideTurtle extends ZeroArgOperation {

    private Turtle myTurtle;

    public HideTurtle (Turtle t) {
        myTurtle = t;
    }

    @Override
    public double evaluate () {
        return myTurtle.hide();
    }
}


text:
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <fcntl.h>
#include <unistd.h>
#include <inttypes.h>
#include "build-id.h"
#include "util.h"
#include "debug.h"
#include "machine.h"
#include "symbol.h"
#include "strlist.h"

#include <elf.h>
#include <limits.h>
#include <sys/utsname.h>

#ifndef KSYM_NAME_LEN
#define KSYM_NAME_LEN 256
#endif

static int dso__load_kernel_sym(struct dso *dso, struct map *map,
				symbol_filter_t filter);
static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
			symbol_filter_t filter);
int vmlinux_path__nr_entries;
char **vmlinux_path;

struct symbol_conf symbol_conf = {
	.exclude_other	  = true,
	.use_modules	  = true,
	.try_vmlinux_path = true,
	.annotate_src	  = true,
	.demangle	  = true,
	.symfs            = "",
};

static enum dso_binary_type binary_type_symtab[] = {
	DSO_BINARY_TYPE__KALLSYMS,
	DSO_BINARY_TYPE__GUEST_KALLSYMS,
	DSO_BINARY_TYPE__JAVA_JIT,
	DSO_BINARY_TYPE__DEBUGLINK,
	DSO_BINARY_TYPE__BUILD_ID_CACHE,
	DSO_BINARY_TYPE__FEDORA_DEBUGINFO,
	DSO_BINARY_TYPE__UBUNTU_DEBUGINFO,
	DSO_BINARY_TYPE__BUILDID_DEBUGINFO,
	DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
	DSO_BINARY_TYPE__GUEST_KMODULE,
	DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE,
	DSO_BINARY_TYPE__NOT_FOUND,
};

#define DSO_BINARY_TYPE__SYMTAB_CNT ARRAY_SIZE(binary_type_symtab)

bool symbol_type__is_a(char symbol_type, enum map_type map_type)
{
	symbol_type = toupper(symbol_type);

	switch (map_type) {
	case MAP__FUNCTION:
		return symbol_type == 'T' || symbol_type == 'W';
	case MAP__VARIABLE:
		return symbol_type == 'D';
	default:
		return false;
	}
}

static int prefix_underscores_count(const char *str)
{
	const char *tail = str;

	while (*tail == '_')
		tail++;

	return tail - str;
}

#define SYMBOL_A 0
#define SYMBOL_B 1

static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
{
	s64 a;
	s64 b;

	/* Prefer a symbol with non zero length */
	a = syma->end - syma->start;
	b = symb->end - symb->start;
	if ((b == 0) && (a > 0))
		return SYMBOL_A;
	else if ((a == 0) && (b > 0))
		return SYMBOL_B;

	/* Prefer a non weak symbol over a weak one */
	a = syma->binding == STB_WEAK;
	b = symb->binding == STB_WEAK;
	if (b && !a)
		return SYMBOL_A;
	if (a && !b)
		return SYMBOL_B;

	/* Prefer a global symbol over a non global one */
	a = syma->binding == STB_GLOBAL;
	b = symb->binding == STB_GLOBAL;
	if (a && !b)
		return SYMBOL_A;
	if (b && !a)
		return SYMBOL_B;

	/* Prefer a symbol with less underscores */
	a = prefix_underscores_count(syma->name);
	b = prefix_underscores_count(symb->name);
	if (b > a)
		return SYMBOL_A;
	else if (a > b)
		return SYMBOL_B;

	/* If all else fails, choose the symbol with the longest name */
	if (strlen(syma->name) >= strlen(symb->name))
		return SYMBOL_A;
	else
		return SYMBOL_B;
}

void symbols__fixup_duplicate(struct rb_root *symbols)
{
	struct rb_node *nd;
	struct symbol *curr, *next;

	nd = rb_first(symbols);

	while (nd) {
		curr = rb_entry(nd, struct symbol, rb_node);
again:
		nd = rb_next(&curr->rb_node);
		next = rb_entry(nd, struct symbol, rb_node);

		if (!nd)
			break;

		if (curr->start != next->start)
			continue;

		if (choose_best_symbol(curr, next) == SYMBOL_A) {
			rb_erase(&next->rb_node, symbols);
			goto again;
		} else {
			nd = rb_next(&curr->rb_node);
			rb_erase(&curr->rb_node, symbols);
		}
	}
}

void symbols__fixup_end(struct rb_root *symbols)
{
	struct rb_node *nd, *prevnd = rb_first(symbols);
	struct symbol *curr, *prev;

	if (prevnd == NULL)
		return;

	curr = rb_entry(prevnd, struct symbol, rb_node);

	for (nd = rb_next(prevnd); nd; nd = rb_next(nd)) {
		prev = curr;
		curr = rb_entry(nd, struct symbol, rb_node);

		if (prev->end == prev->start && prev->end != curr->start)
			prev->end = curr->start - 1;
	}

	/* Last entry */
	if (curr->end == curr->start)
		curr->end = roundup(curr->start, 4096);
}

void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)
{
	struct map *prev, *curr;
	struct rb_node *nd, *prevnd = rb_first(&mg->maps[type]);

	if (prevnd == NULL)
		return;

	curr = rb_entry(prevnd, struct map, rb_node);

	for (nd = rb_next(prevnd); nd; nd = rb_next(nd)) {
		prev = curr;
		curr = rb_entry(nd, struct map, rb_node);
		prev->end = curr->start - 1;
	}

	/*
	 * We still haven't the actual symbols, so guess the
	 * last map final address.
	 */
	curr->end = ~0ULL;
}

struct symbol *symbol__new(u64 start, u64 len, u8 binding, const char *name)
{
	size_t namelen = strlen(name) + 1;
	struct symbol *sym = calloc(1, (symbol_conf.priv_size +
					sizeof(*sym) + namelen));
	if (sym == NULL)
		return NULL;

	if (symbol_conf.priv_size)
		sym = ((void *)sym) + symbol_conf.priv_size;

	sym->start   = start;
	sym->end     = len ? start + len - 1 : start;
	sym->binding = binding;
	sym->namelen = namelen - 1;

	pr_debug4("%s: %s %#" PRIx64 "-%#" PRIx64 "\n",
		  __func__, name, start, sym->end);
	memcpy(sym->name, name, namelen);

	return sym;
}

void symbol__delete(struct symbol *sym)
{
	free(((void *)sym) - symbol_conf.priv_size);
}

size_t symbol__fprintf(struct symbol *sym, FILE *fp)
{
	return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %c %s\n",
		       sym->start, sym->end,
		       sym->binding == STB_GLOBAL ? 'g' :
		       sym->binding == STB_LOCAL  ? 'l' : 'w',
		       sym->name);
}

size_t symbol__fprintf_symname_offs(const struct symbol *sym,
				    const struct addr_location *al, FILE *fp)
{
	unsigned long offset;
	size_t length;

	if (sym && sym->name) {
		length = fprintf(fp, "%s", sym->name);
		if (al) {
			offset = al->addr - sym->start;
			length += fprintf(fp, "+0x%lx", offset);
		}
		return length;
	} else
		return fprintf(fp, "[unknown]");
}

size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp)
{
	return symbol__fprintf_symname_offs(sym, NULL, fp);
}

void symbols__delete(struct rb_root *symbols)
{
	struct symbol *pos;
	struct rb_node *next = rb_first(symbols);

	while (next) {
		pos = rb_entry(next, struct symbol, rb_node);
		next = rb_next(&pos->rb_node);
		rb_erase(&pos->rb_node, symbols);
		symbol__delete(pos);
	}
}

void symbols__insert(struct rb_root *symbols, struct symbol *sym)
{
	struct rb_node **p = &symbols->rb_node;
	struct rb_node *parent = NULL;
	const u64 ip = sym->start;
	struct symbol *s;

	while (*p != NULL) {
		parent = *p;
		s = rb_entry(parent, struct symbol, rb_node);
		if (ip < s->start)
			p = &(*p)->rb_left;
		else
			p = &(*p)->rb_right;
	}
	rb_link_node(&sym->rb_node, parent, p);
	rb_insert_color(&sym->rb_node, symbols);
}

static struct symbol *symbols__find(struct rb_root *symbols, u64 ip)
{
	struct rb_node *n;

	if (symbols == NULL)
		return NULL;

	n = symbols->rb_node;

	while (n) {
		struct symbol *s = rb_entry(n, struct symbol, rb_node);

		if (ip < s->start)
			n = n->rb_left;
		else if (ip > s->end)
			n = n->rb_right;
		else
			return s;
	}

	return NULL;
}

struct symbol_name_rb_node {
	struct rb_node	rb_node;
	struct symbol	sym;
};

static void symbols__insert_by_name(struct rb_root *symbols, struct symbol *sym)
{
	struct rb_node **p = &symbols->rb_node;
	struct rb_node *parent = NULL;
	struct symbol_name_rb_node *symn, *s;

	symn = container_of(sym, struct symbol_name_rb_node, sym);

	while (*p != NULL) {
		parent = *p;
		s = rb_entry(parent, struct symbol_name_rb_node, rb_node);
		if (strcmp(sym->name, s->sym.name) < 0)
			p = &(*p)->rb_left;
		else
			p = &(*p)->rb_right;
	}
	rb_link_node(&symn->rb_node, parent, p);
	rb_insert_color(&symn->rb_node, symbols);
}

static void symbols__sort_by_name(struct rb_root *symbols,
				  struct rb_root *source)
{
	struct rb_node *nd;

	for (nd = rb_first(source); nd; nd = rb_next(nd)) {
		struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
		symbols__insert_by_name(symbols, pos);
	}
}

static struct symbol *symbols__find_by_name(struct rb_root *symbols,
					    const char *name)
{
	struct rb_node *n;

	if (symbols == NULL)
		return NULL;

	n = symbols->rb_node;

	while (n) {
		struct symbol_name_rb_node *s;
		int cmp;

		s = rb_entry(n, struct symbol_name_rb_node, rb_node);
		cmp = strcmp(name, s->sym.name);

		if (cmp < 0)
			n = n->rb_left;
		else if (cmp > 0)
			n = n->rb_right;
		else
			return &s->sym;
	}

	return NULL;
}

struct symbol *dso__find_symbol(struct dso *dso,
				enum map_type type, u64 addr)
{
	return symbols__find(&dso->symbols[type], addr);
}

struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
					const char *name)
{
	return symbols__find_by_name(&dso->symbol_names[type], name);
}

void dso__sort_by_name(struct dso *dso, enum map_type type)
{
	dso__set_sorted_by_name(dso, type);
	return symbols__sort_by_name(&dso->symbol_names[type],
				     &dso->symbols[type]);
}

size_t dso__fprintf_symbols_by_name(struct dso *dso,
				    enum map_type type, FILE *fp)
{
	size_t ret = 0;
	struct rb_node *nd;
	struct symbol_name_rb_node *pos;

	for (nd = rb_first(&dso->symbol_names[type]); nd; nd = rb_next(nd)) {
		pos = rb_entry(nd, struct symbol_name_rb_node, rb_node);
		fprintf(fp, "%s\n", pos->sym.name);
	}

	return ret;
}

int kallsyms__parse(const char *filename, void *arg,
		    int (*process_symbol)(void *arg, const char *name,
					  char type, u64 start))
{
	char *line = NULL;
	size_t n;
	int err = -1;
	FILE *file = fopen(filename, "r");

	if (file == NULL)
		goto out_failure;

	err = 0;

	while (!feof(file)) {
		u64 start;
		int line_len, len;
		char symbol_type;
		char *symbol_name;

		line_len = getline(&line, &n, file);
		if (line_len < 0 || !line)
			break;

		line[--line_len] = '\0'; /* \n */

		len = hex2u64(line, &start);

		len++;
		if (len + 2 >= line_len)
			continue;

		symbol_type = line[len];
		len += 2;
		symbol_name = line + len;
		len = line_len - len;

		if (len >= KSYM_NAME_LEN) {
			err = -1;
			break;
		}

		err = process_symbol(arg, symbol_name,
				     symbol_type, start);
		if (err)
			break;
	}

	free(line);
	fclose(file);
	return err;

out_failure:
	return -1;
}

struct process_kallsyms_args {
	struct map *map;
	struct dso *dso;
};

static u8 kallsyms2elf_type(char type)
{
	if (type == 'W')
		return STB_WEAK;

	return isupper(type) ? STB_GLOBAL : STB_LOCAL;
}

static int map__process_kallsym_symbol(void *arg, const char *name,
				       char type, u64 start)
{
	struct symbol *sym;
	struct process_kallsyms_args *a = arg;
	struct rb_root *root = &a->dso->symbols[a->map->type];

	if (!symbol_type__is_a(type, a->map->type))
		return 0;

	/*
	 * module symbols are not sorted so we add all
	 * symbols, setting length to 0, and rely on
	 * symbols__fixup_end() to fix it up.
	 */
	sym = symbol__new(start, 0, kallsyms2elf_type(type), name);
	if (sym == NULL)
		return -ENOMEM;
	/*
	 * We will pass the symbols to the filter later, in
	 * map__split_kallsyms, when we have split the maps per module
	 */
	symbols__insert(root, sym);

	return 0;
}

/*
 * Loads the function entries in /proc/kallsyms into kernel_map->dso,
 * so that we can in the next step set the symbol ->end address and then
 * call kernel_maps__split_kallsyms.
 */
static int dso__load_all_kallsyms(struct dso *dso, const char *filename,
				  struct map *map)
{
	struct process_kallsyms_args args = { .map = map, .dso = dso, };
	return kallsyms__parse(filename, &args, map__process_kallsym_symbol);
}

/*
 * Split the symbols into maps, making sure there are no overlaps, i.e. the
 * kernel range is broken in several maps, named [kernel].N, as we don't have
 * the original ELF section names vmlinux have.
 */
static int dso__split_kallsyms(struct dso *dso, struct map *map,
			       symbol_filter_t filter)
{
	struct map_groups *kmaps = map__kmap(map)->kmaps;
	struct machine *machine = kmaps->machine;
	struct map *curr_map = map;
	struct symbol *pos;
	int count = 0, moved = 0;
	struct rb_root *root = &dso->symbols[map->type];
	struct rb_node *next = rb_first(root);
	int kernel_range = 0;

	while (next) {
		char *module;

		pos = rb_entry(next, struct symbol, rb_node);
		next = rb_next(&pos->rb_node);

		module = strchr(pos->name, '\t');
		if (module) {
			if (!symbol_conf.use_modules)
				goto discard_symbol;

			*module++ = '\0';

			if (strcmp(curr_map->dso->short_name, module)) {
				if (curr_map != map &&
				    dso->kernel == DSO_TYPE_GUEST_KERNEL &&
				    machine__is_default_guest(machine)) {
					/*
					 * We assume all symbols of a module are
					 * continuous in * kallsyms, so curr_map
					 * points to a module and all its
					 * symbols are in its kmap. Mark it as
					 * loaded.
					 */
					dso__set_loaded(curr_map->dso,
							curr_map->type);
				}

				curr_map = map_groups__find_by_name(kmaps,
							map->type, module);
				if (curr_map == NULL) {
					pr_debug("%s/proc/{kallsyms,modules} "
					         "inconsistency while looking "
						 "for \"%s\" module!\n",
						 machine->root_dir, module);
					curr_map = map;
					goto discard_symbol;
				}

				if (curr_map->dso->loaded &&
				    !machine__is_default_guest(machine))
					goto discard_symbol;
			}
			/*
			 * So that we look just like we get from .ko files,
			 * i.e. not prelinked, relative to map->start.
			 */
			pos->start = curr_map->map_ip(curr_map, pos->start);
			pos->end   = curr_map->map_ip(curr_map, pos->end);
		} else if (curr_map != map) {
			char dso_name[PATH_MAX];
			struct dso *ndso;

			if (count == 0) {
				curr_map = map;
				goto filter_symbol;
			}

			if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
				snprintf(dso_name, sizeof(dso_name),
					"[guest.kernel].%d",
					kernel_range++);
			else
				snprintf(dso_name, sizeof(dso_name),
					"[kernel].%d",
					kernel_range++);

			ndso = dso__new(dso_name);
			if (ndso == NULL)
				return -1;

			ndso->kernel = dso->kernel;

			curr_map = map__new2(pos->start, ndso, map->type);
			if (curr_map == NULL) {
				dso__delete(ndso);
				return -1;
			}

			curr_map->map_ip = curr_map->unmap_ip = identity__map_ip;
			map_groups__insert(kmaps, curr_map);
			++kernel_range;
		}
filter_symbol:
		if (filter && filter(curr_map, pos)) {
discard_symbol:		rb_erase(&pos->rb_node, root);
			symbol__delete(pos);
		} else {
			if (curr_map != map) {
				rb_erase(&pos->rb_node, root);
				symbols__insert(&curr_map->dso->symbols[curr_map->type], pos);
				++moved;
			} else
				++count;
		}
	}

	if (curr_map != map &&
	    dso->kernel == DSO_TYPE_GUEST_KERNEL &&
	    machine__is_default_guest(kmaps->machine)) {
		dso__set_loaded(curr_map->dso, curr_map->type);
	}

	return count + moved;
}

bool symbol__restricted_filename(const char *filename,
				 const char *restricted_filename)
{
	bool restricted = false;

	if (symbol_conf.kptr_restrict) {
		char *r = realpath(filename, NULL);

		if (r != NULL) {
			restricted = strcmp(r, restricted_filename) == 0;
			free(r);
			return restricted;
		}
	}

	return restricted;
}

int dso__load_kallsyms(struct dso *dso, const char *filename,
		       struct map *map, symbol_filter_t filter)
{
	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
		return -1;

	if (dso__load_all_kallsyms(dso, filename, map) < 0)
		return -1;

	symbols__fixup_duplicate(&dso->symbols[map->type]);
	symbols__fixup_end(&dso->symbols[map->type]);

	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
		dso->symtab_type = DSO_BINARY_TYPE__GUEST_KALLSYMS;
	else
		dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS;

	return dso__split_kallsyms(dso, map, filter);
}

static int dso__load_perf_map(struct dso *dso, struct map *map,
			      symbol_filter_t filter)
{
	char *line = NULL;
	size_t n;
	FILE *file;
	int nr_syms = 0;

	file = fopen(dso->long_name, "r");
	if (file == NULL)
		goto out_failure;

	while (!feof(file)) {
		u64 start, size;
		struct symbol *sym;
		int line_len, len;

		line_len = getline(&line, &n, file);
		if (line_len < 0)
			break;

		if (!line)
			goto out_failure;

		line[--line_len] = '\0'; /* \n */

		len = hex2u64(line, &start);

		len++;
		if (len + 2 >= line_len)
			continue;

		len += hex2u64(line + len, &size);

		len++;
		if (len + 2 >= line_len)
			continue;

		sym = symbol__new(start, size, STB_GLOBAL, line + len);

		if (sym == NULL)
			goto out_delete_line;

		if (filter && filter(map, sym))
			symbol__delete(sym);
		else {
			symbols__insert(&dso->symbols[map->type], sym);
			nr_syms++;
		}
	}

	free(line);
	fclose(file);

	return nr_syms;

out_delete_line:
	free(line);
out_failure:
	return -1;
}

int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
{
	char *name;
	int ret = -1;
	u_int i;
	struct machine *machine;
	char *root_dir = (char *) "";
	int ss_pos = 0;
	struct symsrc ss_[2];
	struct symsrc *syms_ss = NULL, *runtime_ss = NULL;

	dso__set_loaded(dso, map->type);

	if (dso->kernel == DSO_TYPE_KERNEL)
		return dso__load_kernel_sym(dso, map, filter);
	else if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
		return dso__load_guest_kernel_sym(dso, map, filter);

	if (map->groups && map->groups->machine)
		machine = map->groups->machine;
	else
		machine = NULL;

	dso->adjust_symbols = 0;

	if (strncmp(dso->name, "/tmp/perf-", 10) == 0) {
		struct stat st;

		if (lstat(dso->name, &st) < 0)
			return -1;

		if (st.st_uid && (st.st_uid != geteuid())) {
			pr_warning("File %s not owned by current user or root, "
				"ignoring it.\n", dso->name);
			return -1;
		}

		ret = dso__load_perf_map(dso, map, filter);
		dso->symtab_type = ret > 0 ? DSO_BINARY_TYPE__JAVA_JIT :
					     DSO_BINARY_TYPE__NOT_FOUND;
		return ret;
	}

	if (machine)
		root_dir = machine->root_dir;

	name = malloc(PATH_MAX);
	if (!name)
		return -1;

	/* Iterate over candidate debug images.
	 * Keep track of "interesting" ones (those which have a symtab, dynsym,
	 * and/or opd section) for processing.
	 */
	for (i = 0; i < DSO_BINARY_TYPE__SYMTAB_CNT; i++) {
		struct symsrc *ss = &ss_[ss_pos];
		bool next_slot = false;

		enum dso_binary_type symtab_type = binary_type_symtab[i];

		if (dso__binary_type_file(dso, symtab_type,
					  root_dir, name, PATH_MAX))
			continue;

		/* Name is now the name of the next image to try */
		if (symsrc__init(ss, dso, name, symtab_type) < 0)
			continue;

		if (!syms_ss && symsrc__has_symtab(ss)) {
			syms_ss = ss;
			next_slot = true;
		}

		if (!runtime_ss && symsrc__possibly_runtime(ss)) {
			runtime_ss = ss;
			next_slot = true;
		}

		if (next_slot) {
			ss_pos++;

			if (syms_ss && runtime_ss)
				break;
		}

	}

	if (!runtime_ss && !syms_ss)
		goto out_free;

	if (runtime_ss && !syms_ss) {
		syms_ss = runtime_ss;
	}

	/* We'll have to hope for the best */
	if (!runtime_ss && syms_ss)
		runtime_ss = syms_ss;

	if (syms_ss)
		ret = dso__load_sym(dso, map, syms_ss, runtime_ss, filter, 0);
	else
		ret = -1;

	if (ret > 0) {
		int nr_plt;

		nr_plt = dso__synthesize_plt_symbols(dso, runtime_ss, map, filter);
		if (nr_plt > 0)
			ret += nr_plt;
	}

	for (; ss_pos > 0; ss_pos--)
		symsrc__destroy(&ss_[ss_pos - 1]);
out_free:
	free(name);
	if (ret < 0 && strstr(dso->name, " (deleted)") != NULL)
		return 0;
	return ret;
}

struct map *map_groups__find_by_name(struct map_groups *mg,
				     enum map_type type, const char *name)
{
	struct rb_node *nd;

	for (nd = rb_first(&mg->maps[type]); nd; nd = rb_next(nd)) {
		struct map *map = rb_entry(nd, struct map, rb_node);

		if (map->dso && strcmp(map->dso->short_name, name) == 0)
			return map;
	}

	return NULL;
}

int dso__load_vmlinux(struct dso *dso, struct map *map,
		      const char *vmlinux, symbol_filter_t filter)
{
	int err = -1;
	struct symsrc ss;
	char symfs_vmlinux[PATH_MAX];
	enum dso_binary_type symtab_type;

	snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
		 symbol_conf.symfs, vmlinux);

	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
		symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
	else
		symtab_type = DSO_BINARY_TYPE__VMLINUX;

	if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type))
		return -1;

	err = dso__load_sym(dso, map, &ss, &ss, filter, 0);
	symsrc__destroy(&ss);

	if (err > 0) {
		dso__set_long_name(dso, (char *)vmlinux);
		dso__set_loaded(dso, map->type);
		pr_debug("Using %s for symbols\n", symfs_vmlinux);
	}

	return err;
}

int dso__load_vmlinux_path(struct dso *dso, struct map *map,
			   symbol_filter_t filter)
{
	int i, err = 0;
	char *filename;

	pr_debug("Looking at the vmlinux_path (%d entries long)\n",
		 vmlinux_path__nr_entries + 1);

	filename = dso__build_id_filename(dso, NULL, 0);
	if (filename != NULL) {
		err = dso__load_vmlinux(dso, map, filename, filter);
		if (err > 0) {
			dso->lname_alloc = 1;
			goto out;
		}
		free(filename);
	}

	for (i = 0; i < vmlinux_path__nr_entries; ++i) {
		err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter);
		if (err > 0) {
			dso__set_long_name(dso, strdup(vmlinux_path[i]));
			dso->lname_alloc = 1;
			break;
		}
	}
out:
	return err;
}

static int dso__load_kernel_sym(struct dso *dso, struct map *map,
				symbol_filter_t filter)
{
	int err;
	const char *kallsyms_filename = NULL;
	char *kallsyms_allocated_filename = NULL;
	/*
	 * Step 1: if the user specified a kallsyms or vmlinux filename, use
	 * it and only it, reporting errors to the user if it cannot be used.
	 *
	 * For instance, try to analyse an ARM perf.data file _without_ a
	 * build-id, or if the user specifies the wrong path to the right
	 * vmlinux file, obviously we can't fallback to another vmlinux (a
	 * x86_86 one, on the machine where analysis is being performed, say),
	 * or worse, /proc/kallsyms.
	 *
	 * If the specified file _has_ a build-id and there is a build-id
	 * section in the perf.data file, we will still do the expected
	 * validation in dso__load_vmlinux and will bail out if they don't
	 * match.
	 */
	if (symbol_conf.kallsyms_name != NULL) {
		kallsyms_filename = symbol_conf.kallsyms_name;
		goto do_kallsyms;
	}

	if (symbol_conf.vmlinux_name != NULL) {
		err = dso__load_vmlinux(dso, map,
					symbol_conf.vmlinux_name, filter);
		if (err > 0) {
			dso__set_long_name(dso,
					   strdup(symbol_conf.vmlinux_name));
			dso->lname_alloc = 1;
			goto out_fixup;
		}
		return err;
	}

	if (vmlinux_path != NULL) {
		err = dso__load_vmlinux_path(dso, map, filter);
		if (err > 0)
			goto out_fixup;
	}

	/* do not try local files if a symfs was given */
	if (symbol_conf.symfs[0] != 0)
		return -1;

	/*
	 * Say the kernel DSO was created when processing the build-id header table,
	 * we have a build-id, so check if it is the same as the running kernel,
	 * using it if it is.
	 */
	if (dso->has_build_id) {
		u8 kallsyms_build_id[BUILD_ID_SIZE];
		char sbuild_id[BUILD_ID_SIZE * 2 + 1];

		if (sysfs__read_build_id("/sys/kernel/notes", kallsyms_build_id,
					 sizeof(kallsyms_build_id)) == 0) {
			if (dso__build_id_equal(dso, kallsyms_build_id)) {
				kallsyms_filename = "/proc/kallsyms";
				goto do_kallsyms;
			}
		}
		/*
		 * Now look if we have it on the build-id cache in
		 * $HOME/.debug/[kernel.kallsyms].
		 */
		build_id__sprintf(dso->build_id, sizeof(dso->build_id),
				  sbuild_id);

		if (asprintf(&kallsyms_allocated_filename,
			     "%s/.debug/[kernel.kallsyms]/%s",
			     getenv("HOME"), sbuild_id) == -1) {
			pr_err("Not enough memory for kallsyms file lookup\n");
			return -1;
		}

		kallsyms_filename = kallsyms_allocated_filename;

		if (access(kallsyms_filename, F_OK)) {
			pr_err("No kallsyms or vmlinux with build-id %s "
			       "was found\n", sbuild_id);
			free(kallsyms_allocated_filename);
			return -1;
		}
	} else {
		/*
		 * Last resort, if we don't have a build-id and couldn't find
		 * any vmlinux file, try the running kernel kallsyms table.
		 */
		kallsyms_filename = "/proc/kallsyms";
	}

do_kallsyms:
	err = dso__load_kallsyms(dso, kallsyms_filename, map, filter);
	if (err > 0)
		pr_debug("Using %s for symbols\n", kallsyms_filename);
	free(kallsyms_allocated_filename);

	if (err > 0) {
		dso__set_long_name(dso, strdup("[kernel.kallsyms]"));
out_fixup:
		map__fixup_start(map);
		map__fixup_end(map);
	}

	return err;
}

static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
				      symbol_filter_t filter)
{
	int err;
	const char *kallsyms_filename = NULL;
	struct machine *machine;
	char path[PATH_MAX];

	if (!map->groups) {
		pr_debug("Guest kernel map hasn't the point to groups\n");
		return -1;
	}
	machine = map->groups->machine;

	if (machine__is_default_guest(machine)) {
		/*
		 * if the user specified a vmlinux filename, use it and only
		 * it, reporting errors to the user if it cannot be used.
		 * Or use file guest_kallsyms inputted by user on commandline
		 */
		if (symbol_conf.default_guest_vmlinux_name != NULL) {
			err = dso__load_vmlinux(dso, map,
				symbol_conf.default_guest_vmlinux_name, filter);
			goto out_try_fixup;
		}

		kallsyms_filename = symbol_conf.default_guest_kallsyms;
		if (!kallsyms_filename)
			return -1;
	} else {
		sprintf(path, "%s/proc/kallsyms", machine->root_dir);
		kallsyms_filename = path;
	}

	err = dso__load_kallsyms(dso, kallsyms_filename, map, filter);
	if (err > 0)
		pr_debug("Using %s for symbols\n", kallsyms_filename);

out_try_fixup:
	if (err > 0) {
		if (kallsyms_filename != NULL) {
			machine__mmap_name(machine, path, sizeof(path));
			dso__set_long_name(dso, strdup(path));
		}
		map__fixup_start(map);
		map__fixup_end(map);
	}

	return err;
}

static void vmlinux_path__exit(void)
{
	while (--vmlinux_path__nr_entries >= 0) {
		free(vmlinux_path[vmlinux_path__nr_entries]);
		vmlinux_path[vmlinux_path__nr_entries] = NULL;
	}

	free(vmlinux_path);
	vmlinux_path = NULL;
}

static int vmlinux_path__init(void)
{
	struct utsname uts;
	char bf[PATH_MAX];

	vmlinux_path = malloc(sizeof(char *) * 5);
	if (vmlinux_path == NULL)
		return -1;

	vmlinux_path[vmlinux_path__nr_entries] = strdup("vmlinux");
	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
		goto out_fail;
	++vmlinux_path__nr_entries;
	vmlinux_path[vmlinux_path__nr_entries] = strdup("/boot/vmlinux");
	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
		goto out_fail;
	++vmlinux_path__nr_entries;

	/* only try running kernel version if no symfs was given */
	if (symbol_conf.symfs[0] != 0)
		return 0;

	if (uname(&uts) < 0)
		return -1;

	snprintf(bf, sizeof(bf), "/boot/vmlinux-%s", uts.release);
	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
		goto out_fail;
	++vmlinux_path__nr_entries;
	snprintf(bf, sizeof(bf), "/lib/modules/%s/build/vmlinux", uts.release);
	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
		goto out_fail;
	++vmlinux_path__nr_entries;
	snprintf(bf, sizeof(bf), "/usr/lib/debug/lib/modules/%s/vmlinux",
		 uts.release);
	vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
	if (vmlinux_path[vmlinux_path__nr_entries] == NULL)
		goto out_fail;
	++vmlinux_path__nr_entries;

	return 0;

out_fail:
	vmlinux_path__exit();
	return -1;
}

static int setup_list(struct strlist **list, const char *list_str,
		      const char *list_name)
{
	if (list_str == NULL)
		return 0;

	*list = strlist__new(true, list_str);
	if (!*list) {
		pr_err("problems parsing %s list\n", list_name);
		return -1;
	}
	return 0;
}

static bool symbol__read_kptr_restrict(void)
{
	bool value = false;

	if (geteuid() != 0) {
		FILE *fp = fopen("/proc/sys/kernel/kptr_restrict", "r");
		if (fp != NULL) {
			char line[8];

			if (fgets(line, sizeof(line), fp) != NULL)
				value = atoi(line) != 0;

			fclose(fp);
		}
	}

	return value;
}

int symbol__init(void)
{
	const char *symfs;

	if (symbol_conf.initialized)
		return 0;

	symbol_conf.priv_size = PERF_ALIGN(symbol_conf.priv_size, sizeof(u64));

	symbol__elf_init();

	if (symbol_conf.sort_by_name)
		symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) -
					  sizeof(struct symbol));

	if (symbol_conf.try_vmlinux_path && vmlinux_path__init() < 0)
		return -1;

	if (symbol_conf.field_sep && *symbol_conf.field_sep == '.') {
		pr_err("'.' is the only non valid --field-separator argument\n");
		return -1;
	}

	if (setup_list(&symbol_conf.dso_list,
		       symbol_conf.dso_list_str, "dso") < 0)
		return -1;

	if (setup_list(&symbol_conf.comm_list,
		       symbol_conf.comm_list_str, "comm") < 0)
		goto out_free_dso_list;

	if (setup_list(&symbol_conf.sym_list,
		       symbol_conf.sym_list_str, "symbol") < 0)
		goto out_free_comm_list;

	/*
	 * A path to symbols of "/" is identical to ""
	 * reset here for simplicity.
	 */
	symfs = realpath(symbol_conf.symfs, NULL);
	if (symfs == NULL)
		symfs = symbol_conf.symfs;
	if (strcmp(symfs, "/") == 0)
		symbol_conf.symfs = "";
	if (symfs != symbol_conf.symfs)
		free((void *)symfs);

	symbol_conf.kptr_restrict = symbol__read_kptr_restrict();

	symbol_conf.initialized = true;
	return 0;

out_free_comm_list:
	strlist__delete(symbol_conf.comm_list);
out_free_dso_list:
	strlist__delete(symbol_conf.dso_list);
	return -1;
}

void symbol__exit(void)
{
	if (!symbol_conf.initialized)
		return;
	strlist__delete(symbol_conf.sym_list);
	strlist__delete(symbol_conf.dso_list);
	strlist__delete(symbol_conf.comm_list);
	vmlinux_path__exit();
	symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL;
	symbol_conf.initialized = false;
}


text:
package org.apache.activemq.artemis.core.paging;

import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.core.paging.cursor.PageIterator;
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
import org.apache.activemq.artemis.core.paging.cursor.PagedReference;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.transaction.Transaction;

public interface PageTransactionInfo extends EncodingSupport {

   boolean isCommit();

   boolean isRollback();

   void setCommitted(boolean committed);

   void commit();

   void rollback();

   long getRecordID();

   void setRecordID(long id);

   long getTransactionID();

   void store(StorageManager storageManager, PagingManager pagingManager, Transaction tx) throws Exception;

   void storeUpdate(StorageManager storageManager, PagingManager pagingManager, Transaction tx) throws Exception;

   void reloadUpdate(StorageManager storageManager,
                     PagingManager pagingManager,
                     Transaction tx,
                     int increment) throws Exception;

   // To be used after the update was stored or reload
   boolean onUpdate(int update, StorageManager storageManager, PagingManager pagingManager);

   boolean checkSize(StorageManager storageManager, PagingManager pagingManager);

   void increment(int durableSize, int nonDurableSize);

   int getNumberOfMessages();

   /**
    * This method will hold the position to be delivered later in case this transaction is pending.
    * If the tx is not pending, it will return false, so the caller can deliver it right away
    *
    * @return true if the message will be delivered later, false if it should be delivered right away
    */
   boolean deliverAfterCommit(PageIterator pageIterator, PageSubscription cursor, PagedReference pagedMessage);

}


text:
package supersnake.state;

import supersnake.attribute.Renderable;
import supersnake.attribute.Updatable;

public abstract class AbstractState implements Updatable, Renderable{
  public abstract void exit();
  public abstract void load();
  public abstract void pause();
  public abstract void resume();
}


text: export { ChevronSortUp16 as default } from "../../";


text:
/* Author: Ioan Sucan */

#include <pluginlib/class_loader.hpp>
#include <moveit/planning_request_adapter/planning_request_adapter.h>
#include <ros/ros.h>
#include <memory>

int main(int argc, char** argv)
{
  ros::init(argc, argv, "list_planning_adapter_plugins");

  std::unique_ptr<pluginlib::ClassLoader<planning_request_adapter::PlanningRequestAdapter>> loader;
  try
  {
    loader = std::make_unique<pluginlib::ClassLoader<planning_request_adapter::PlanningRequestAdapter>>(
        "moveit_core", "planning_request_adapter::PlanningRequestAdapter");
  }
  catch (pluginlib::PluginlibException& ex)
  {
    std::cout << "Exception while creating class loader " << ex.what() << std::endl;
  }

  const std::vector<std::string>& classes = loader->getDeclaredClasses();
  std::cout << "Available planning request adapter plugins:" << std::endl;
  for (const std::string& adapter_plugin_name : classes)
  {
    std::cout << " \t " << adapter_plugin_name << std::endl;
    planning_request_adapter::PlanningRequestAdapterConstPtr ad;
    try
    {
      ad = loader->createUniqueInstance(adapter_plugin_name);
    }
    catch (pluginlib::PluginlibException& ex)
    {
      std::cout << " \t\t  Exception while planning adapter plugin '" << adapter_plugin_name << "': " << ex.what()
                << std::endl;
    }
    if (ad)
      std::cout << " \t\t  " << ad->getDescription() << std::endl;
    std::cout << std::endl << std::endl;
  }

  return 0;
}


text:
import Backbone from 'backbone';

import {JsonInputView} from 'pageflow/ui';

describe('pageflow.JsonInputView', () => {
  it('displays attribute value as pretty printed JSON', () => {
    var model = new Backbone.Model({
      json: {some: 'data'}
    });
    var jsonInputView = new JsonInputView({
      model: model,
      propertyName: 'json'
    });

    jsonInputView.render();

    var textArea = jsonInputView.$el.find('textarea');

    expect(textArea.val()).toBe('{\n  "some": "data"\n}');
  });

  it('saves parsed JSON to attribute if valid', () => {
    var model = new Backbone.Model();
    var jsonInputView = new JsonInputView({
      model: model,
      propertyName: 'json'
    });

    jsonInputView.render();

    var textArea = jsonInputView.$el.find('textarea');
    textArea.val('{"some": "data"}');
    textArea.trigger('change');

    expect(model.get('json')).toEqual({some: 'data'});
  });

  it('sets attribute to null if text is empty', () => {
    var model = new Backbone.Model({
      json: {some: 'data'}
    });
    var jsonInputView = new JsonInputView({
      model: model,
      propertyName: 'json'
    });

    jsonInputView.render();

    var textArea = jsonInputView.$el.find('textarea');
    textArea.val('');
    textArea.trigger('change');

    expect(model.get('json')).toBeNull();
  });

  it('does save invalid JSON but displays validation error', () => {
    var model = new Backbone.Model({
      json: {some: 'data'}
    });
    var jsonInputView = new JsonInputView({
      model: model,
      propertyName: 'json'
    });

    jsonInputView.render();

    var textArea = jsonInputView.$el.find('textarea');
    textArea.val('{not "json"}');
    textArea.trigger('change');

    expect(jsonInputView.$el).toHaveClass('invalid');
    expect(model.get('json')).toEqual({some: 'data'});
  });
});


text:
layout: page
title: Bowers Bolt Research Party
date: 2016-05-24
author: Cynthia Madden
tags: weekly links, java
status: published
summary: Mauris mollis velit sit amet magna accumsan malesuada.
banner: images/banner/leisure-03.jpg
booking:
  startDate: 06/23/2017
  endDate: 06/28/2017
  ctyhocn: ORKHHHX
  groupCode: BBRP
published: true
---
Aliquam erat volutpat. Duis vulputate posuere lectus vitae interdum. Nam porta aliquet lobortis. Donec odio velit, cursus eget accumsan ac, bibendum in eros. Sed finibus leo eget aliquam mattis. Integer semper, diam et gravida porta, diam felis accumsan est, nec facilisis felis felis id est. Vivamus tristique finibus nunc non interdum. Sed non nisi dui.
Nullam vel tellus rhoncus, dapibus lacus a, efficitur sem. Aenean dolor velit, porttitor a pharetra sit amet, vulputate vitae dui. Sed nec velit elit. Sed a lorem quis justo tempor efficitur. Cras egestas orci iaculis sem tincidunt placerat. Donec accumsan lectus nisi, a imperdiet mauris vulputate quis. Nulla lobortis, est at mollis convallis, ex tortor pharetra arcu, vestibulum congue diam erat commodo ipsum. Sed venenatis magna ac sem blandit euismod. Donec tristique ex in quam malesuada sagittis. Fusce tempor, felis fermentum fringilla facilisis, purus ante luctus enim, in varius sem odio et elit. Vivamus ut aliquet purus. Pellentesque congue fringilla enim sed lobortis. Quisque lobortis, risus id bibendum mollis, ligula tellus dignissim lorem, eget ultrices nibh nibh sed quam.

* Pellentesque consectetur turpis sit amet justo faucibus, vel tincidunt elit congue
* Cras eget felis facilisis, fermentum odio nec, tincidunt orci
* In vestibulum tellus in sapien viverra, id aliquet velit aliquet
* Maecenas vel est eget urna consectetur porttitor
* Pellentesque at lectus id nisi pulvinar malesuada.

Nullam quis ipsum pretium, elementum nunc non, cursus sem. Morbi interdum ex suscipit, imperdiet ante eget, consequat quam. Aenean condimentum sem tortor, quis viverra nulla ultricies a. Sed suscipit tortor sed velit pellentesque, nec luctus metus ullamcorper. Suspendisse eu ornare metus. Nunc interdum, erat eget volutpat faucibus, dui risus tempus tortor, ut consequat magna sem in velit. Maecenas tincidunt nisi vel posuere cursus. Sed molestie tincidunt est, id consectetur arcu cursus scelerisque. Duis consequat fermentum erat eu consequat. Quisque vitae blandit lacus. Proin aliquam porta sodales. Maecenas eget tellus massa. Duis eget ultricies mauris, ut pharetra elit.


text:
package android.util;

/**
 * @author Dmitry Skiba
 *
 */
public interface AttributeSet {
	int getAttributeCount();

	String getAttributeName(int index);

	String getAttributeValue(int index);

	String getPositionDescription();

	int getAttributeNameResource(int index);

	int getAttributeListValue(int index, String options[], int defaultValue);

	boolean getAttributeBooleanValue(int index, boolean defaultValue);

	int getAttributeResourceValue(int index, int defaultValue);

	int getAttributeIntValue(int index, int defaultValue);

	int getAttributeUnsignedIntValue(int index, int defaultValue);

	float getAttributeFloatValue(int index, float defaultValue);

	String getIdAttribute();

	String getClassAttribute();

	int getIdAttributeResourceValue(int index);

	int getStyleAttribute();

	String getAttributeValue(String namespace, String attribute);

	int getAttributeListValue(String namespace, String attribute,
			String options[], int defaultValue);

	boolean getAttributeBooleanValue(String namespace, String attribute,
			boolean defaultValue);

	int getAttributeResourceValue(String namespace, String attribute,
			int defaultValue);

	int getAttributeIntValue(String namespace, String attribute,
			int defaultValue);

	int getAttributeUnsignedIntValue(String namespace, String attribute,
			int defaultValue);

	float getAttributeFloatValue(String namespace, String attribute,
			float defaultValue);

	// TODO: remove
	int getAttributeValueType(int index);

	int getAttributeValueData(int index);
}


text:
package mil.nga.giat.mage.sdk;

import java.util.Date;

public interface Temporal {

    public Date getTimestamp();

}


text:
package marc.henrard.murisq.pricer.swap;

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

import com.google.common.collect.ImmutableList;
import com.opengamma.strata.basics.currency.Payment;
import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.collect.tuple.Pair;
import com.opengamma.strata.pricer.impl.rate.swap.CashFlowEquivalentCalculator;
import com.opengamma.strata.product.swap.NotionalExchange;
import com.opengamma.strata.product.swap.ResolvedSwapLeg;
import com.opengamma.strata.product.swap.SwapPaymentEvent;

/**
 * Utilities to manipulate results of {@link CashFlowEquivalentCalculator}
 *
 * @author Marc Henrard
 */
public class CashFlowEquivalentUtils {

  /**
   * Sort by increasing dates and compress cash flows at the same date.
   * <p>
   * The input cash flow equivalent must be made of {@link NotionalExchange} {@link SwapPaymentEvent}.
   *
   * @param cfe  the starting cash flow equivalent
   * @return  the sorted and compressed cash flow equivalent
   */
  public static ResolvedSwapLeg sortCompress(ResolvedSwapLeg cfe) {
    ImmutableList<SwapPaymentEvent> cfePeriods = cfe.getPaymentEvents();
    int nbCf = cfePeriods.size();
    // Sort
    List<Pair<LocalDate, Integer>> dateIndices = new ArrayList<>();
    for (int loopcf = 0; loopcf < nbCf; loopcf++) {
      ArgChecker.isTrue(cfePeriods.get(loopcf) instanceof NotionalExchange,
          "each period must be of the type NotionalExchange");
      dateIndices.add(Pair.of(cfePeriods.get(loopcf).getPaymentDate(), loopcf));
    }
    Collections.sort(dateIndices);
    // Compress duplicate dates
    List<SwapPaymentEvent> cfeCompressed = new ArrayList<>();
    cfeCompressed.add(cfePeriods.get(dateIndices.get(0).getSecond()));
    for (int loopcf = 1; loopcf < nbCf; loopcf++) {
      if (dateIndices.get(loopcf).getFirst().equals(dateIndices.get(loopcf - 1).getFirst())) {
        NotionalExchange cfPrevious = (NotionalExchange) cfeCompressed.get(cfeCompressed.size() - 1);
        NotionalExchange cf = (NotionalExchange) cfePeriods.get(dateIndices.get(loopcf).getSecond());
        NotionalExchange cfCompressed = NotionalExchange.of(
            Payment.of(cf.getCurrency(),
                cfPrevious.getPaymentAmount().getAmount() + cf.getPaymentAmount().getAmount(),
                cf.getPaymentDate()));
        cfeCompressed.set(cfeCompressed.size() - 1, cfCompressed);
      } else { // different date
        cfeCompressed.add(cfePeriods.get(dateIndices.get(loopcf).getSecond()));
      }
    }
    return ResolvedSwapLeg.builder()
        .paymentEvents(cfeCompressed)
        .type(cfe.getType())
        .payReceive(cfe.getPayReceive()).build();
  }

}


text:
require "spec_helper"

RSpec.describe Bedi do
end