text:
(function () {
  'use strict';
  var RelationRepository = require('./relation_repository').RelationRepository,
    Strategy = require('./strategy').Strategy,
    constructRoute = require('./construct_route').constructRoute,
    ModifyAnEntity,
    AddEntityToRepository,
    ConnectRepoWithEntity,
    ConnectStartWithRepository,
    ConnectToService,
    DisconnectTwoEntities,
    DisconnectTwoEntitiesToMany,
    ConnectEntityToService,
    ConnectTwoEntities,
    ConnectTwoEntitiesToMany,
    FollowToEntity,
    FollowToEntityToMany,
    FollowFromRepositoryToService;

  ConnectEntityToService = Strategy.extend({
    type: 'follow',
    from: 'entity',
    to: 'service',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      constructRoute({
        controller: controller,
        graph: graph,
        from: from,
        to: to,
        relation: relation
      });
    }
  });

  ModifyAnEntity = Strategy.extend({
    type: 'modify',
    from: 'entity',
    to: 'entity',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'patch',
        url: from.urlTemplate,
        action: function (req, res) {
          var id = req.params('id'),
          patch = req.params(from.name),
          result;

          from.repository.updateById(id, patch.forDB());
          result = from.repository.byIdWithNeighbors(id);

          res.json(result.forClient());
        },
        from: from,
        to: to,
        relation: relation,
        body: from
      });
    }
  });

  ConnectTwoEntities = Strategy.extend({
    type: 'connect',
    from: 'entity',
    to: 'entity',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      var relationRepository = new RelationRepository(from, to, relation, graph);

      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'post',
        url: from.urlForRelation(relation),
        action: function (req, res) {
          relationRepository.replaceRelation(req.params('id'), req.body()[relation.name]);
          res.status(204);
        },
        from: from,
        to: to,
        relation: relation
      });
    }
  });

  ConnectTwoEntitiesToMany = Strategy.extend({
    type: 'connect',
    from: 'entity',
    to: 'entity',
    cardinality: 'many',

    execute: function (controller, graph, relation, from, to) {
      var relationRepository = new RelationRepository(from, to, relation, graph);

      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'post',
        url: from.urlForRelation(relation),
        action: function (req, res) {
          relationRepository.addRelations(req.params('id'), req.body()[relation.name]);
          res.status(204);
        },
        from: from,
        to: to,
        relation: relation
      });
    }
  });

  DisconnectTwoEntities = Strategy.extend({
    type: 'disconnect',
    from: 'entity',
    to: 'entity',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      var relationRepository = new RelationRepository(from, to, relation, graph);

      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'delete',
        url: from.urlForRelation(relation),
        action: function (req, res) {
          relationRepository.deleteRelation(req.params('id'));
          res.status(204);
        },
        from: from,
        to: to,
        relation: relation
      });
    }
  });

  DisconnectTwoEntitiesToMany = Strategy.extend({
    type: 'disconnect',
    from: 'entity',
    to: 'entity',
    cardinality: 'many'
  });

  FollowToEntity = Strategy.extend({
    type: 'follow',
    from: 'entity',
    to: 'entity',
    cardinality: 'one'
  });

  FollowToEntityToMany = Strategy.extend({
    type: 'follow',
    from: 'entity',
    to: 'entity',
    cardinality: 'many'
  });

  AddEntityToRepository = Strategy.extend({
    type: 'connect',
    from: 'repository',
    to: 'entity',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      from.addActionWithMethodForRelation('POST', relation);

      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'post',
        url: from.urlTemplate,
        action: function (req, res) {
          var data = {},
          model = req.params(to.name);

          data[to.name] = from.repository.save(model).forClient();
          res.status(201);
          res.json(data);
        },
        from: from,
        to: to,
        relation: relation,
        body: to
      });
    }
  });

  ConnectRepoWithEntity = Strategy.extend({
    type: 'follow',
    from: 'repository',
    to: 'entity',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'get',
        action: function (req, res) {
          var id = req.params('id'),
          entry = from.repository.byIdWithNeighbors(id);

          res.json(entry.forClient());
        },
        from: from,
        to: to,
        relation: relation
      });

      from.addLinkToEntities(relation, to);
    }
  });

  ConnectStartWithRepository = Strategy.extend({
    type: 'follow',
    from: 'start',
    to: 'repository',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      from.addLinkViaTransitionTo(relation, to);

      constructRoute({
        controller: controller,
        graph: graph,
        verb: 'get',
        action: function (req, res) {
          res.json({
            properties: to.properties(),
            entities: to.entities(),
            links: to.filteredLinks(req),
            actions: to.filteredActions(req)
          });
        },
        from: from,
        to: to,
        relation: relation
      });
    }
  });

  ConnectToService = Strategy.extend({
    type: 'follow',
    from: 'start',
    to: 'service',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      from.addLinkViaTransitionTo(relation, to);

      constructRoute({
        controller: controller,
        graph: graph,
        from: from,
        to: to,
        relation: relation,
        body: to
      });
    }
  });

  FollowFromRepositoryToService = Strategy.extend({
    type: 'follow',
    from: 'repository',
    to: 'service',
    cardinality: 'one',

    execute: function (controller, graph, relation, from, to) {
      from.addLinkViaTransitionTo(relation, to);

      constructRoute({
        controller: controller,
        graph: graph,
        from: from,
        to: to,
        relation: relation
      });
    }
  });

  exports.mediaType = {
    strategies: [
      new ModifyAnEntity(),
      new ConnectTwoEntities(),
      new DisconnectTwoEntities(),
      new DisconnectTwoEntitiesToMany(),
      new FollowToEntity(),
      new FollowToEntityToMany(),
      new AddEntityToRepository(),
      new ConnectRepoWithEntity(),
      new ConnectEntityToService(),
      new ConnectToService(),
      new ConnectTwoEntitiesToMany(),
      new ConnectStartWithRepository(),
      new FollowFromRepositoryToService()
    ]
  };
}());


text:
<?php

namespace MetaTemplate\Test\Template;

use MetaTemplate\Template\PHPTemplate;

class PHPTemplateTest extends \PHPUnit_Framework_TestCase
{
    function testRendersEmptyContextWithSingleVariable()
    {
        $templ = new PHPTemplate(__DIR__ . "/fixtures/php/test.phtml");
        $output = $templ->render(new \StdClass, array('name' => 'Jim'));

        $this->assertEquals("Hello World Jim!\n", $output);
    }

    function testRendersTemplateWithContext()
    {
        $templ = new PHPTemplate(function() {
            return 'You won <?= $this->amount; ?> $.';
        });

        $context = (object) array(
            'amount' => 40000
        );
        $output = $templ->render($context);

        $this->assertEquals("You won 40000 $.", $output);
    }

    function testRendersWithShortTagsWithoutSemicolons()
    {
        $templ = new PHPTemplate(function() {
            return 'You won <?= $this->amount ?> $.';
        });

        $context = (object) array(
            'amount' => 40000
        );

        $output = $templ->render($context);

        $this->assertEquals("You won 40000 $.", $output);
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * Domains that would allow a CSP bypass if allowlisted.
 * Only most common paths will be listed here. Hence there might still be other
 * paths on these domains that would allow a bypass.
 */
export const URLS: string[] = [
  '//vk.com/swf/video.swf',
  '//ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/charts/assets/charts.swf'
];


text:
/*!
 * \file
 * \brief Tessellation Coordinates Tests
 *//*--------------------------------------------------------------------*/

#include "vktTessellationCoordinatesTests.hpp"
#include "vktTestCaseUtil.hpp"
#include "vktTessellationUtil.hpp"

#include "tcuTestLog.hpp"
#include "tcuRGBA.hpp"
#include "tcuSurface.hpp"
#include "tcuTextureUtil.hpp"
#include "tcuVectorUtil.hpp"

#include "vkDefs.hpp"
#include "vkBarrierUtil.hpp"
#include "vkQueryUtil.hpp"
#include "vkBuilderUtil.hpp"
#include "vkTypeUtil.hpp"
#include "vkCmdUtil.hpp"
#include "vkObjUtil.hpp"

#include "deUniquePtr.hpp"

#include <string>
#include <vector>

namespace vkt
{
namespace tessellation
{

using namespace vk;

namespace
{

template <typename T>
class SizeLessThan
{
public:
	bool operator() (const T& a, const T& b) const { return a.size() < b.size(); }
};

std::string getCaseName (const TessPrimitiveType primitiveType, const SpacingMode spacingMode, bool executionModeInEvaluationShader)
{
	std::ostringstream str;
	str << getTessPrimitiveTypeShaderName(primitiveType) << "_" << getSpacingModeShaderName(spacingMode);
	if (!executionModeInEvaluationShader)
		str << "_execution_mode_in_tesc";
	return str.str();
}

std::vector<TessLevels> genTessLevelCases (const TessPrimitiveType	primitiveType,
										   const SpacingMode		spacingMode)
{
	static const TessLevels rawTessLevelCases[] =
	{
		{ { 1.0f,	1.0f	},	{ 1.0f,		1.0f,	1.0f,	1.0f	} },
		{ { 63.0f,	24.0f	},	{ 15.0f,	42.0f,	10.0f,	12.0f	} },
		{ { 3.0f,	2.0f	},	{ 6.0f,		8.0f,	7.0f,	9.0f	} },
		{ { 4.0f,	6.0f	},	{ 2.0f,		3.0f,	1.0f,	4.0f	} },
		{ { 2.0f,	2.0f	},	{ 6.0f,		8.0f,	7.0f,	9.0f	} },
		{ { 5.0f,	6.0f	},	{ 1.0f,		1.0f,	1.0f,	1.0f	} },
		{ { 1.0f,	6.0f	},	{ 2.0f,		3.0f,	1.0f,	4.0f	} },
		{ { 5.0f,	1.0f	},	{ 2.0f,		3.0f,	1.0f,	4.0f	} },
		{ { 5.2f,	1.6f	},	{ 2.9f,		3.4f,	1.5f,	4.1f	} }
	};

	if (spacingMode == SPACINGMODE_EQUAL)
		return std::vector<TessLevels>(DE_ARRAY_BEGIN(rawTessLevelCases), DE_ARRAY_END(rawTessLevelCases));
	else
	{
		std::vector<TessLevels> result;
		result.reserve(DE_LENGTH_OF_ARRAY(rawTessLevelCases));

		for (int tessLevelCaseNdx = 0; tessLevelCaseNdx < DE_LENGTH_OF_ARRAY(rawTessLevelCases); ++tessLevelCaseNdx)
		{
			TessLevels curTessLevelCase = rawTessLevelCases[tessLevelCaseNdx];

			float* const inner = &curTessLevelCase.inner[0];
			float* const outer = &curTessLevelCase.outer[0];

			for (int j = 0; j < 2; ++j) inner[j] = static_cast<float>(getClampedRoundedTessLevel(spacingMode, inner[j]));
			for (int j = 0; j < 4; ++j) outer[j] = static_cast<float>(getClampedRoundedTessLevel(spacingMode, outer[j]));

			if (primitiveType == TESSPRIMITIVETYPE_TRIANGLES)
			{
				if (outer[0] > 1.0f || outer[1] > 1.0f || outer[2] > 1.0f)
				{
					if (inner[0] == 1.0f)
						inner[0] = static_cast<float>(getClampedRoundedTessLevel(spacingMode, inner[0] + 0.1f));
				}
			}
			else if (primitiveType == TESSPRIMITIVETYPE_QUADS)
			{
				if (outer[0] > 1.0f || outer[1] > 1.0f || outer[2] > 1.0f || outer[3] > 1.0f)
				{
					if (inner[0] == 1.0f) inner[0] = static_cast<float>(getClampedRoundedTessLevel(spacingMode, inner[0] + 0.1f));
					if (inner[1] == 1.0f) inner[1] = static_cast<float>(getClampedRoundedTessLevel(spacingMode, inner[1] + 0.1f));
				}
			}

			result.push_back(curTessLevelCase);
		}

		DE_ASSERT(static_cast<int>(result.size()) == DE_LENGTH_OF_ARRAY(rawTessLevelCases));
		return result;
	}
}

std::vector<tcu::Vec3> generateReferenceTessCoords (const TessPrimitiveType	primitiveType,
													const SpacingMode		spacingMode,
													const float*			innerLevels,
													const float*			outerLevels)
{
	if (isPatchDiscarded(primitiveType, outerLevels))
		return std::vector<tcu::Vec3>();

	switch (primitiveType)
	{
		case TESSPRIMITIVETYPE_TRIANGLES:
		{
			int inner;
			int outer[3];
			getClampedRoundedTriangleTessLevels(spacingMode, innerLevels, outerLevels, &inner, &outer[0]);

			if (spacingMode != SPACINGMODE_EQUAL)
			{
				// \note For fractional spacing modes, exact results are implementation-defined except in special cases.
				DE_ASSERT(de::abs(innerLevels[0] - static_cast<float>(inner)) < 0.001f);
				for (int i = 0; i < 3; ++i)
					DE_ASSERT(de::abs(outerLevels[i] - static_cast<float>(outer[i])) < 0.001f);
				DE_ASSERT(inner > 1 || (outer[0] == 1 && outer[1] == 1 && outer[2] == 1));
			}

			return generateReferenceTriangleTessCoords(spacingMode, inner, outer[0], outer[1], outer[2]);
		}

		case TESSPRIMITIVETYPE_QUADS:
		{
			int inner[2];
			int outer[4];
			getClampedRoundedQuadTessLevels(spacingMode, innerLevels, outerLevels, &inner[0], &outer[0]);

			if (spacingMode != SPACINGMODE_EQUAL)
			{
				// \note For fractional spacing modes, exact results are implementation-defined except in special cases.
				for (int i = 0; i < 2; ++i)
					DE_ASSERT(de::abs(innerLevels[i] - static_cast<float>(inner[i])) < 0.001f);
				for (int i = 0; i < 4; ++i)
					DE_ASSERT(de::abs(outerLevels[i] - static_cast<float>(outer[i])) < 0.001f);

				DE_ASSERT((inner[0] > 1 && inner[1] > 1) || (inner[0] == 1 && inner[1] == 1 && outer[0] == 1 && outer[1] == 1 && outer[2] == 1 && outer[3] == 1));
			}

			return generateReferenceQuadTessCoords(spacingMode, inner[0], inner[1], outer[0], outer[1], outer[2], outer[3]);
		}

		case TESSPRIMITIVETYPE_ISOLINES:
		{
			int outer[2];
			getClampedRoundedIsolineTessLevels(spacingMode, &outerLevels[0], &outer[0]);

			if (spacingMode != SPACINGMODE_EQUAL)
			{
				// \note For fractional spacing modes, exact results are implementation-defined except in special cases.
				DE_ASSERT(de::abs(outerLevels[1] - static_cast<float>(outer[1])) < 0.001f);
			}

			return generateReferenceIsolineTessCoords(outer[0], outer[1]);
		}

		default:
			DE_ASSERT(false);
			return std::vector<tcu::Vec3>();
	}
}

void drawPoint (tcu::Surface& dst, const int centerX, const int centerY, const tcu::RGBA& color, const int size)
{
	const int width		= dst.getWidth();
	const int height	= dst.getHeight();
	DE_ASSERT(de::inBounds(centerX, 0, width) && de::inBounds(centerY, 0, height));
	DE_ASSERT(size > 0);

	for (int yOff = -((size-1)/2); yOff <= size/2; ++yOff)
	for (int xOff = -((size-1)/2); xOff <= size/2; ++xOff)
	{
		const int pixX = centerX + xOff;
		const int pixY = centerY + yOff;
		if (de::inBounds(pixX, 0, width) && de::inBounds(pixY, 0, height))
			dst.setPixel(pixX, pixY, color);
	}
}

void drawTessCoordPoint (tcu::Surface& dst, const TessPrimitiveType primitiveType, const tcu::Vec3& pt, const tcu::RGBA& color, const int size)
{
	// \note These coordinates should match the description in the log message in TessCoordTestInstance::iterate.

	static const tcu::Vec2 triangleCorners[3] =
	{
		tcu::Vec2(0.95f, 0.95f),
		tcu::Vec2(0.5f,  0.95f - 0.9f*deFloatSqrt(3.0f/4.0f)),
		tcu::Vec2(0.05f, 0.95f)
	};

	static const float quadIsolineLDRU[4] =
	{
		0.1f, 0.9f, 0.9f, 0.1f
	};

	const tcu::Vec2 dstPos = primitiveType == TESSPRIMITIVETYPE_TRIANGLES ? pt.x()*triangleCorners[0]
																		  + pt.y()*triangleCorners[1]
																		  + pt.z()*triangleCorners[2]

					  : primitiveType == TESSPRIMITIVETYPE_QUADS ||
						primitiveType == TESSPRIMITIVETYPE_ISOLINES ? tcu::Vec2((1.0f - pt.x())*quadIsolineLDRU[0] + pt.x()*quadIsolineLDRU[2],
																			    (1.0f - pt.y())*quadIsolineLDRU[1] + pt.y()*quadIsolineLDRU[3])

					  : tcu::Vec2(-1.0f);

	drawPoint(dst,
			  static_cast<int>(dstPos.x() * (float)dst.getWidth()),
			  static_cast<int>(dstPos.y() * (float)dst.getHeight()),
			  color,
			  size);
}

void drawTessCoordVisualization (tcu::Surface& dst, const TessPrimitiveType primitiveType, const std::vector<tcu::Vec3>& coords)
{
	const int imageWidth  = 256;
	const int imageHeight = 256;
	dst.setSize(imageWidth, imageHeight);

	tcu::clear(dst.getAccess(), tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f));

	for (int i = 0; i < static_cast<int>(coords.size()); ++i)
		drawTessCoordPoint(dst, primitiveType, coords[i], tcu::RGBA::white(), 2);
}

inline bool vec3XLessThan (const tcu::Vec3& a, const tcu::Vec3& b)
{
	return a.x() < b.x();
}

int binarySearchFirstVec3WithXAtLeast (const std::vector<tcu::Vec3>& sorted, float x)
{
	const tcu::Vec3 ref(x, 0.0f, 0.0f);
	const std::vector<tcu::Vec3>::const_iterator first = std::lower_bound(sorted.begin(), sorted.end(), ref, vec3XLessThan);
	if (first == sorted.end())
		return -1;
	return static_cast<int>(std::distance(sorted.begin(), first));
}

// Check that all points in subset are (approximately) present also in superset.
bool oneWayComparePointSets (tcu::TestLog&					log,
							 tcu::Surface&					errorDst,
							 const TessPrimitiveType		primitiveType,
							 const std::vector<tcu::Vec3>&	subset,
							 const std::vector<tcu::Vec3>&	superset,
							 const char*					subsetName,
							 const char*					supersetName,
							 const tcu::RGBA&				errorColor)
{
	const std::vector<tcu::Vec3> supersetSorted		 = sorted(superset, vec3XLessThan);
	const float					 epsilon			 = 0.01f;
	const int					 maxNumFailurePrints = 5;
	int							 numFailuresDetected = 0;

	for (int subNdx = 0; subNdx < static_cast<int>(subset.size()); ++subNdx)
	{
		const tcu::Vec3& subPt = subset[subNdx];

		bool matchFound = false;

		{
			// Binary search the index of the first point in supersetSorted with x in the [subPt.x() - epsilon, subPt.x() + epsilon] range.
			const tcu::Vec3	matchMin			= subPt - epsilon;
			const tcu::Vec3	matchMax			= subPt + epsilon;
			const int		firstCandidateNdx	= binarySearchFirstVec3WithXAtLeast(supersetSorted, matchMin.x());

			if (firstCandidateNdx >= 0)
			{
				// Compare subPt to all points in supersetSorted with x in the [subPt.x() - epsilon, subPt.x() + epsilon] range.
				for (int superNdx = firstCandidateNdx; superNdx < static_cast<int>(supersetSorted.size()) && supersetSorted[superNdx].x() <= matchMax.x(); ++superNdx)
				{
					const tcu::Vec3& superPt = supersetSorted[superNdx];

					if (tcu::boolAll(tcu::greaterThanEqual	(superPt, matchMin)) &&
						tcu::boolAll(tcu::lessThanEqual		(superPt, matchMax)))
					{
						matchFound = true;
						break;
					}
				}
			}
		}

		if (!matchFound)
		{
			++numFailuresDetected;
			if (numFailuresDetected < maxNumFailurePrints)
				log << tcu::TestLog::Message << "Failure: no matching " << supersetName << " point found for " << subsetName << " point " << subPt << tcu::TestLog::EndMessage;
			else if (numFailuresDetected == maxNumFailurePrints)
				log << tcu::TestLog::Message << "Note: More errors follow" << tcu::TestLog::EndMessage;

			drawTessCoordPoint(errorDst, primitiveType, subPt, errorColor, 4);
		}
	}

	return numFailuresDetected == 0;
}

//! Returns true on matching coordinate sets.
bool compareTessCoords (tcu::TestLog&					log,
						TessPrimitiveType				primitiveType,
						const std::vector<tcu::Vec3>&	refCoords,
						const std::vector<tcu::Vec3>&	resCoords)
{
	tcu::Surface	refVisual;
	tcu::Surface	resVisual;
	bool			success = true;

	drawTessCoordVisualization(refVisual, primitiveType, refCoords);
	drawTessCoordVisualization(resVisual, primitiveType, resCoords);

	// Check that all points in reference also exist in result.
	success = oneWayComparePointSets(log, refVisual, primitiveType, refCoords, resCoords, "reference", "result", tcu::RGBA::blue()) && success;
	// Check that all points in result also exist in reference.
	success = oneWayComparePointSets(log, resVisual, primitiveType, resCoords, refCoords, "result", "reference", tcu::RGBA::red()) && success;

	if (!success)
	{
		log << tcu::TestLog::Message << "Note: in the following reference visualization, points that are missing in result point set are blue (if any)" << tcu::TestLog::EndMessage
			<< tcu::TestLog::Image("RefTessCoordVisualization", "Reference tessCoord visualization", refVisual)
			<< tcu::TestLog::Message << "Note: in the following result visualization, points that are missing in reference point set are red (if any)" << tcu::TestLog::EndMessage;
	}

	log << tcu::TestLog::Image("ResTessCoordVisualization", "Result tessCoord visualization", resVisual);

	return success;
}

class TessCoordTest : public TestCase
{
public:
								TessCoordTest	(tcu::TestContext&			testCtx,
												 const TessPrimitiveType	primitiveType,
												 const SpacingMode			spacingMode,
												 const bool					executionModeInEvaluationShader = true);

	void						initPrograms	(SourceCollections&			programCollection) const;
	TestInstance*				createInstance	(Context&					context) const;

private:
	const TessPrimitiveType		m_primitiveType;
	const SpacingMode			m_spacingMode;
	const bool					m_executionModeInEvaluationShader;
};

TessCoordTest::TessCoordTest (tcu::TestContext&			testCtx,
							  const TessPrimitiveType	primitiveType,
							  const SpacingMode			spacingMode,
							  const bool				executionModeInEvaluationShader)
	: TestCase							(testCtx, getCaseName(primitiveType, spacingMode, executionModeInEvaluationShader), "")
	, m_primitiveType					(primitiveType)
	, m_spacingMode						(spacingMode)
	, m_executionModeInEvaluationShader	(executionModeInEvaluationShader)
{
}

void TessCoordTest::initPrograms (SourceCollections& programCollection) const
{
	if (m_executionModeInEvaluationShader)
	{
		// Vertex shader - no inputs
		{
			std::ostringstream src;
			src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES) << "\n"
				<< "\n"
				<< "void main (void)\n"
				<< "{\n"
				<< "}\n";

			programCollection.glslSources.add("vert") << glu::VertexSource(src.str());
		}

		// Tessellation control shader
		{
			std::ostringstream src;
			src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES) << "\n"
				<< "#extension GL_EXT_tessellation_shader : require\n"
				<< "\n"
				<< "layout(vertices = 1) out;\n"
				<< "\n"
				<< "layout(set = 0, binding = 0, std430) readonly restrict buffer TessLevels {\n"
				<< "    float inner0;\n"
				<< "    float inner1;\n"
				<< "    float outer0;\n"
				<< "    float outer1;\n"
				<< "    float outer2;\n"
				<< "    float outer3;\n"
				<< "} sb_levels;\n"
				<< "\n"
				<< "void main (void)\n"
				<< "{\n"
				<< "    gl_TessLevelInner[0] = sb_levels.inner0;\n"
				<< "    gl_TessLevelInner[1] = sb_levels.inner1;\n"
				<< "\n"
				<< "    gl_TessLevelOuter[0] = sb_levels.outer0;\n"
				<< "    gl_TessLevelOuter[1] = sb_levels.outer1;\n"
				<< "    gl_TessLevelOuter[2] = sb_levels.outer2;\n"
				<< "    gl_TessLevelOuter[3] = sb_levels.outer3;\n"
				<< "}\n";

			programCollection.glslSources.add("tesc") << glu::TessellationControlSource(src.str());
		}

		// Tessellation evaluation shader
		{
			std::ostringstream src;
			src << glu::getGLSLVersionDeclaration(glu::GLSL_VERSION_310_ES) << "\n"
				<< "#extension GL_EXT_tessellation_shader : require\n"
				<< "\n"
				<< "layout(" << getTessPrimitiveTypeShaderName(m_primitiveType) << ", "
				<< getSpacingModeShaderName(m_spacingMode) << ", point_mode) in;\n" << "\n"
				<< "layout(set = 0, binding = 1, std430) coherent restrict buffer Output {\n"
				<< "    int  numInvocations;\n"
				<< "    vec3 tessCoord[];\n"		// alignment is 16 bytes, same as vec4
				<< "} sb_out;\n"
				<< "\n"
				<< "void main (void)\n"
				<< "{\n"
				<< "    int index = atomicAdd(sb_out.numInvocations, 1);\n"
				<< "    sb_out.tessCoord[index] = gl_TessCoord;\n"
				<< "}\n";

			programCollection.glslSources.add("tese") << glu::TessellationEvaluationSource(src.str());
		}
	}
	else
	{
		// note: spirv code for all stages coresponds to glsl version above

		programCollection.spirvAsmSources.add("vert")
			<< "OpCapability Shader\n"
			   "%glsl_ext_inst = OpExtInstImport \"GLSL.std.450\"\n"
			   "OpMemoryModel Logical GLSL450\n"
			   "OpEntryPoint Vertex %main_fun \"main\"\n"
			   "%type_void       = OpTypeVoid\n"
			   "%type_void_f     = OpTypeFunction %type_void\n"
			   "%main_fun        = OpFunction %type_void None %type_void_f\n"
			   "%main_label      = OpLabel\n"
			   "OpReturn\n"
			   "OpFunctionEnd\n";

		// glsl requires primitive_mode, vertex_spacing, ordering and point_mode layout qualifiers to be defined in
		// tessellation evaluation shader while spirv allows corresponding execution modes to be defined in TES and/or
		// TCS; here we test using execution modes only in TCS as TES is tested with glsl version of tests

		const std::string executionMode =
			std::string("OpExecutionMode %main_fun ") + getTessPrimitiveTypeShaderName(m_primitiveType, true) + "\n"
			"OpExecutionMode %main_fun " + getSpacingModeShaderName(m_spacingMode, true) + "\n" +
			"OpExecutionMode %main_fun PointMode\n"
			"OpExecutionMode %main_fun VertexOrderCcw\n";

		std::string tescSrc =
			   "OpCapability Tessellation\n"
			   "%glsl_ext_inst = OpExtInstImport \"GLSL.std.450\"\n"
			   "OpMemoryModel Logical GLSL450\n"
			   "OpEntryPoint TessellationControl %main_fun \"main\" %var_tess_level_inner %var_tess_level_outer\n"
			   "OpExecutionMode %main_fun OutputVertices 1\n";
		tescSrc += executionMode +
			   "OpDecorate %var_tess_level_inner Patch\n"
			   "OpDecorate %var_tess_level_inner BuiltIn TessLevelInner\n"
			   "OpMemberDecorate %type_struct_sb_levels 0 Restrict\n"
			   "OpMemberDecorate %type_struct_sb_levels 0 NonWritable\n"
			   "OpMemberDecorate %type_struct_sb_levels 0 Offset 0\n"
			   "OpMemberDecorate %type_struct_sb_levels 1 Restrict\n"
			   "OpMemberDecorate %type_struct_sb_levels 1 NonWritable\n"
			   "OpMemberDecorate %type_struct_sb_levels 1 Offset 4\n"
			   "OpMemberDecorate %type_struct_sb_levels 2 Restrict\n"
			   "OpMemberDecorate %type_struct_sb_levels 2 NonWritable\n"
			   "OpMemberDecorate %type_struct_sb_levels 2 Offset 8\n"
			   "OpMemberDecorate %type_struct_sb_levels 3 Restrict\n"
			   "OpMemberDecorate %type_struct_sb_levels 3 NonWritable\n"
			   "OpMemberDecorate %type_struct_sb_levels 3 Offset 12\n"
			   "OpMemberDecorate %type_struct_sb_levels 4 Restrict\n"
			   "OpMemberDecorate %type_struct_sb_levels 4 NonWritable\n"
			   "OpMemberDecorate %type_struct_sb_levels 4 Offset 16\n"
			   "OpMemberDecorate %type_struct_sb_levels 5 Restrict\n"
			   "OpMemberDecorate %type_struct_sb_levels 5 NonWritable\n"
			   "OpMemberDecorate %type_struct_sb_levels 5 Offset 20\n"
			   "OpDecorate %type_struct_sb_levels BufferBlock\n"
			   "OpDecorate %var_struct_sb_levels DescriptorSet 0\n"
			   "OpDecorate %var_struct_sb_levels Binding 0\n"
			   "OpDecorate %var_tess_level_outer Patch\n"
			   "OpDecorate %var_tess_level_outer BuiltIn TessLevelOuter\n"
			   "%type_void                 = OpTypeVoid\n"
			   "%type_void_f               = OpTypeFunction %type_void\n"
			   "%type_f32                  = OpTypeFloat 32\n"
			   "%type_u32                  = OpTypeInt 32 0\n"
			   "%c_u32_2                   = OpConstant %type_u32 2\n"
			   "%type_arr_f32_2            = OpTypeArray %type_f32 %c_u32_2\n"
			   "%type_arr_f32_2_ptr        = OpTypePointer Output %type_arr_f32_2\n"
			   "%type_i32                  = OpTypeInt 32 1\n"
			   "%type_struct_sb_levels     = OpTypeStruct %type_f32 %type_f32 %type_f32 %type_f32 %type_f32 %type_f32\n"
			   "%type_struct_sb_levels_ptr = OpTypePointer Uniform %type_struct_sb_levels\n"
			   "%var_struct_sb_levels      = OpVariable %type_struct_sb_levels_ptr Uniform\n"
			   "%type_uni_f32_ptr          = OpTypePointer Uniform %type_f32\n"
			   "%type_out_f32_ptr          = OpTypePointer Output %type_f32\n"
			   "%c_i32_0                   = OpConstant %type_i32 0\n"
			   "%c_i32_1                   = OpConstant %type_i32 1\n"
			   "%c_u32_4                   = OpConstant %type_u32 4\n"
			   "%c_i32_2                   = OpConstant %type_i32 2\n"
			   "%c_i32_3                   = OpConstant %type_i32 3\n"
			   "%c_i32_4                   = OpConstant %type_i32 4\n"
			   "%c_i32_5                   = OpConstant %type_i32 5\n"
			   "%type_arr_f32_4            = OpTypeArray %type_f32 %c_u32_4\n"
			   "%type_arr_f32_4_ptr        = OpTypePointer Output %type_arr_f32_4\n"
			   "%var_tess_level_inner      = OpVariable %type_arr_f32_2_ptr Output\n"
			   "%var_tess_level_outer      = OpVariable %type_arr_f32_4_ptr Output\n"
			   "%main_fun                  = OpFunction %type_void None %type_void_f\n"
			   "%main_label                = OpLabel\n"
			   "%tess_inner_0_ptr          = OpAccessChain %type_uni_f32_ptr %var_struct_sb_levels %c_i32_0\n"
			   "%tess_inner_0              = OpLoad %type_f32 %tess_inner_0_ptr\n"
			   "%gl_tess_inner_0           = OpAccessChain %type_out_f32_ptr %var_tess_level_inner %c_i32_0\n"
			   "                             OpStore %gl_tess_inner_0 %tess_inner_0\n"
			   "%tess_inner_1_ptr          = OpAccessChain %type_uni_f32_ptr %var_struct_sb_levels %c_i32_1\n"
			   "%tess_inner_1              = OpLoad %type_f32 %tess_inner_1_ptr\n"
			   "%gl_tess_inner_1           = OpAccessChain %type_out_f32_ptr %var_tess_level_inner %c_i32_1\n"
			   "                             OpStore %gl_tess_inner_1 %tess_inner_1\n"
			   "%tess_outer_0_ptr          = OpAccessChain %type_uni_f32_ptr %var_struct_sb_levels %c_i32_2\n"
			   "%tess_outer_0              = OpLoad %type_f32 %tess_outer_0_ptr\n"
			   "%gl_tess_outer_0           = OpAccessChain %type_out_f32_ptr %var_tess_level_outer %c_i32_0\n"
			   "                             OpStore %gl_tess_outer_0 %tess_outer_0\n"
			   "%tess_outer_1_ptr          = OpAccessChain %type_uni_f32_ptr %var_struct_sb_levels %c_i32_3\n"
			   "%tess_outer_1              = OpLoad %type_f32 %tess_outer_1_ptr\n"
			   "%gl_tess_outer_1           = OpAccessChain %type_out_f32_ptr %var_tess_level_outer %c_i32_1\n"
			   "                             OpStore %gl_tess_outer_1 %tess_outer_1\n"
			   "%tess_outer_2_ptr          = OpAccessChain %type_uni_f32_ptr %var_struct_sb_levels %c_i32_4\n"
			   "%tess_outer_2              = OpLoad %type_f32 %tess_outer_2_ptr\n"
			   "%gl_tess_outer_2           = OpAccessChain %type_out_f32_ptr %var_tess_level_outer %c_i32_2\n"
			   "                             OpStore %gl_tess_outer_2 %tess_outer_2\n"
			   "%tess_outer_3_ptr          = OpAccessChain %type_uni_f32_ptr %var_struct_sb_levels %c_i32_5\n"
			   "%tess_outer_3              = OpLoad %type_f32 %tess_outer_3_ptr\n"
			   "%gl_tess_outer_3           = OpAccessChain %type_out_f32_ptr %var_tess_level_outer %c_i32_3\n"
			   "                             OpStore %gl_tess_outer_3 %tess_outer_3\n"
			   "OpReturn\n"
			   "OpFunctionEnd\n";
		programCollection.spirvAsmSources.add("tesc") << tescSrc;

		std::string teseSrc =
			   "OpCapability Tessellation\n"
			   "%glsl_ext_inst = OpExtInstImport \"GLSL.std.450\"\n"
			   "OpMemoryModel Logical GLSL450\n"
			   "OpEntryPoint TessellationEvaluation %main_fun \"main\" %var_gl_tess_coord\n"
			   "OpDecorate %type_run_arr_v3_f32 ArrayStride 16\n"
			   "OpMemberDecorate %type_struct 0 Coherent\n"
			   "OpMemberDecorate %type_struct 0 Restrict\n"
			   "OpMemberDecorate %type_struct 0 Offset 0\n"
			   "OpMemberDecorate %type_struct 1 Coherent\n"
			   "OpMemberDecorate %type_struct 1 Restrict\n"
			   "OpMemberDecorate %type_struct 1 Offset 16\n"
			   "OpDecorate %type_struct BufferBlock\n"
			   "OpDecorate %var_struct_ptr DescriptorSet 0\n"
			   "OpDecorate %var_struct_ptr Binding 1\n"
			   "OpDecorate %var_gl_tess_coord BuiltIn TessCoord\n"
			   "%type_void             = OpTypeVoid\n"
			   "%type_void_f           = OpTypeFunction %type_void\n"
			   "%type_i32              = OpTypeInt 32 1\n"
			   "%type_u32              = OpTypeInt 32 0\n"
			   "%type_i32_fp           = OpTypePointer Function %type_i32\n"
			   "%type_f32              = OpTypeFloat 32\n"
			   "%type_v3_f32           = OpTypeVector %type_f32 3\n"
			   "%type_run_arr_v3_f32   = OpTypeRuntimeArray %type_v3_f32\n"
			   "%type_struct           = OpTypeStruct %type_i32 %type_run_arr_v3_f32\n"
			   "%type_uni_struct_ptr   = OpTypePointer Uniform %type_struct\n"
			   "%type_uni_i32_ptr      = OpTypePointer Uniform %type_i32\n"
			   "%type_uni_v3_f32_ptr   = OpTypePointer Uniform %type_v3_f32\n"
			   "%type_in_v3_f32_ptr    = OpTypePointer Input %type_v3_f32\n"
			   "%c_i32_0               = OpConstant %type_i32 0\n"
			   "%c_i32_1               = OpConstant %type_i32 1\n"
			   "%c_u32_0               = OpConstant %type_u32 1\n"
			   "%c_u32_1               = OpConstant %type_u32 0\n"
			   "%var_struct_ptr        = OpVariable %type_uni_struct_ptr Uniform\n"
			   "%var_gl_tess_coord     = OpVariable %type_in_v3_f32_ptr Input\n"
			   "%main_fun              = OpFunction %type_void None %type_void_f\n"
			   "%main_label            = OpLabel\n"
			   "%var_i32_ptr           = OpVariable %type_i32_fp Function\n"
			   "%num_invocations       = OpAccessChain %type_uni_i32_ptr %var_struct_ptr %c_i32_0\n"
			   "%index_0               = OpAtomicIAdd %type_i32 %num_invocations %c_u32_0 %c_u32_1 %c_i32_1\n"
			   "                         OpStore %var_i32_ptr %index_0\n"
			   "%index_1               = OpLoad %type_i32 %var_i32_ptr\n"
			   "%gl_tess_coord         = OpLoad %type_v3_f32 %var_gl_tess_coord\n"
			   "%out_tess_coord        = OpAccessChain %type_uni_v3_f32_ptr %var_struct_ptr %c_i32_1 %index_1\n"
			   "                         OpStore %out_tess_coord %gl_tess_coord\n"
			   "OpReturn\n"
			   "OpFunctionEnd\n";
		programCollection.spirvAsmSources.add("tese") << teseSrc;
	}
}

class TessCoordTestInstance : public TestInstance
{
public:
								TessCoordTestInstance (Context&					context,
													   const TessPrimitiveType	primitiveType,
													   const SpacingMode		spacingMode);

	tcu::TestStatus				iterate				  (void);

private:
	const TessPrimitiveType		m_primitiveType;
	const SpacingMode			m_spacingMode;
};

TessCoordTestInstance::TessCoordTestInstance (Context&					context,
											  const TessPrimitiveType	primitiveType,
											  const SpacingMode			spacingMode)
	: TestInstance		(context)
	, m_primitiveType	(primitiveType)
	, m_spacingMode		(spacingMode)
{
}

tcu::TestStatus TessCoordTestInstance::iterate (void)
{
	const DeviceInterface&	vk					= m_context.getDeviceInterface();
	const VkDevice			device				= m_context.getDevice();
	const VkQueue			queue				= m_context.getUniversalQueue();
	const deUint32			queueFamilyIndex	= m_context.getUniversalQueueFamilyIndex();
	Allocator&				allocator			= m_context.getDefaultAllocator();

	// Test data

	const std::vector<TessLevels>		 tessLevelCases			= genTessLevelCases(m_primitiveType, m_spacingMode);
	std::vector<std::vector<tcu::Vec3> > allReferenceTessCoords	(tessLevelCases.size());

	for (deUint32 i = 0; i < tessLevelCases.size(); ++i)
		allReferenceTessCoords[i] = generateReferenceTessCoords(m_primitiveType, m_spacingMode, &tessLevelCases[i].inner[0], &tessLevelCases[i].outer[0]);

	const size_t maxNumVertices = static_cast<int>(std::max_element(allReferenceTessCoords.begin(), allReferenceTessCoords.end(), SizeLessThan<std::vector<tcu::Vec3> >())->size());

	// Input buffer: tessellation levels. Data is filled in later.

	const Buffer tessLevelsBuffer(vk, device, allocator,
		makeBufferCreateInfo(sizeof(TessLevels), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);

	// Output buffer: number of invocations + padding + tessellation coordinates. Initialized later.

	const int          resultBufferTessCoordsOffset	 = 4 * (int)sizeof(deInt32);
	const int          extraneousVertices			 = 16;	// allow some room for extraneous vertices from duplicate shader invocations (number is arbitrary)
	const VkDeviceSize resultBufferSizeBytes		 = resultBufferTessCoordsOffset + (maxNumVertices + extraneousVertices)*sizeof(tcu::Vec4);
	const Buffer       resultBuffer					 (vk, device, allocator, makeBufferCreateInfo(resultBufferSizeBytes, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT), MemoryRequirement::HostVisible);

	// Descriptors

	const Unique<VkDescriptorSetLayout> descriptorSetLayout(DescriptorSetLayoutBuilder()
		.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT)
		.addSingleBinding(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT)
		.build(vk, device));

	const Unique<VkDescriptorPool> descriptorPool(DescriptorPoolBuilder()
		.addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
		.addType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
		.build(vk, device, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u));

	const Unique<VkDescriptorSet> descriptorSet(makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));

	const VkDescriptorBufferInfo tessLevelsBufferInfo = makeDescriptorBufferInfo(tessLevelsBuffer.get(), 0ull, sizeof(TessLevels));
	const VkDescriptorBufferInfo resultBufferInfo     = makeDescriptorBufferInfo(resultBuffer.get(), 0ull, resultBufferSizeBytes);

	DescriptorSetUpdateBuilder()
		.writeSingle(*descriptorSet, DescriptorSetUpdateBuilder::Location::binding(0u), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &tessLevelsBufferInfo)
		.writeSingle(*descriptorSet, DescriptorSetUpdateBuilder::Location::binding(1u), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &resultBufferInfo)
		.update(vk, device);

	// Pipeline: set up vertex processing without rasterization

	const Unique<VkRenderPass>		renderPass		(makeRenderPassWithoutAttachments (vk, device));
	const Unique<VkFramebuffer>		framebuffer		(makeFramebuffer(vk, device, *renderPass, 0u, DE_NULL, 1u, 1u));
	const Unique<VkPipelineLayout>	pipelineLayout	(makePipelineLayout(vk, device, *descriptorSetLayout));
	const Unique<VkCommandPool>		cmdPool			(makeCommandPool(vk, device, queueFamilyIndex));
	const Unique<VkCommandBuffer>	cmdBuffer		(allocateCommandBuffer(vk, device, *cmdPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));

	const Unique<VkPipeline> pipeline(GraphicsPipelineBuilder()
		.setShader(vk, device, VK_SHADER_STAGE_VERTEX_BIT,					m_context.getBinaryCollection().get("vert"), DE_NULL)
		.setShader(vk, device, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,	m_context.getBinaryCollection().get("tesc"), DE_NULL)
		.setShader(vk, device, VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, m_context.getBinaryCollection().get("tese"), DE_NULL)
		.build    (vk, device, *pipelineLayout, *renderPass));

	deUint32 numPassedCases = 0;

	// Repeat the test for all tessellation coords cases
	for (deUint32 tessLevelCaseNdx = 0; tessLevelCaseNdx < tessLevelCases.size(); ++tessLevelCaseNdx)
	{
		m_context.getTestContext().getLog()
			<< tcu::TestLog::Message
			<< "Tessellation levels: " << getTessellationLevelsString(tessLevelCases[tessLevelCaseNdx], m_primitiveType)
			<< tcu::TestLog::EndMessage;

		// Upload tessellation levels data to the input buffer
		{
			const Allocation& alloc				= tessLevelsBuffer.getAllocation();
			TessLevels* const bufferTessLevels	= static_cast<TessLevels*>(alloc.getHostPtr());

			*bufferTessLevels = tessLevelCases[tessLevelCaseNdx];
			flushAlloc(vk, device, alloc);
		}

		// Clear the results buffer
		{
			const Allocation& alloc = resultBuffer.getAllocation();

			deMemset(alloc.getHostPtr(), 0, static_cast<std::size_t>(resultBufferSizeBytes));
			flushAlloc(vk, device, alloc);
		}

		// Reset the command buffer and begin recording.
		beginCommandBuffer(vk, *cmdBuffer);
		beginRenderPassWithRasterizationDisabled(vk, *cmdBuffer, *renderPass, *framebuffer);

		vk.cmdBindPipeline(*cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);
		vk.cmdBindDescriptorSets(*cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *pipelineLayout, 0u, 1u, &descriptorSet.get(), 0u, DE_NULL);

		// Process a single abstract vertex.
		vk.cmdDraw(*cmdBuffer, 1u, 1u, 0u, 0u);
		endRenderPass(vk, *cmdBuffer);

		{
			const VkBufferMemoryBarrier shaderWriteBarrier = makeBufferMemoryBarrier(
				VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_HOST_READ_BIT, *resultBuffer, 0ull, resultBufferSizeBytes);

			vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_PIPELINE_STAGE_HOST_BIT, 0u,
				0u, DE_NULL, 1u, &shaderWriteBarrier, 0u, DE_NULL);
		}

		endCommandBuffer(vk, *cmdBuffer);
		submitCommandsAndWait(vk, device, queue, *cmdBuffer);

		// Verify results
		{
			const Allocation&				resultAlloc			= resultBuffer.getAllocation();

			invalidateAlloc(vk, device, resultAlloc);

			const deInt32					numResults			= *static_cast<deInt32*>(resultAlloc.getHostPtr());
			const std::vector<tcu::Vec3>	resultTessCoords	= readInterleavedData<tcu::Vec3>(numResults, resultAlloc.getHostPtr(), resultBufferTessCoordsOffset, sizeof(tcu::Vec4));
			const std::vector<tcu::Vec3>&	referenceTessCoords	= allReferenceTessCoords[tessLevelCaseNdx];
			const int						numExpectedResults	= static_cast<int>(referenceTessCoords.size());
			tcu::TestLog&					log					= m_context.getTestContext().getLog();

			if (numResults < numExpectedResults)
			{
				log << tcu::TestLog::Message
					<< "Failure: generated " << numResults << " coordinates, but the expected reference value is " << numExpectedResults
					<< tcu::TestLog::EndMessage;
			}
			else if (numResults == numExpectedResults)
				log << tcu::TestLog::Message << "Note: generated " << numResults << " tessellation coordinates" << tcu::TestLog::EndMessage;
			else
			{
				log << tcu::TestLog::Message
					<< "Note: generated " << numResults << " coordinates (out of which " << numExpectedResults << " must be unique)"
					<< tcu::TestLog::EndMessage;
			}

			if (m_primitiveType == TESSPRIMITIVETYPE_TRIANGLES)
				log << tcu::TestLog::Message << "Note: in the following visualization(s), the u=1, v=1, w=1 corners are at the right, top, and left corners, respectively" << tcu::TestLog::EndMessage;
			else if (m_primitiveType == TESSPRIMITIVETYPE_QUADS || m_primitiveType == TESSPRIMITIVETYPE_ISOLINES)
				log << tcu::TestLog::Message << "Note: in the following visualization(s), u and v coordinate go left-to-right and bottom-to-top, respectively" << tcu::TestLog::EndMessage;
			else
				DE_ASSERT(false);

			if (compareTessCoords(log, m_primitiveType, referenceTessCoords, resultTessCoords) && (numResults >= numExpectedResults))
				++numPassedCases;
		}
	}  // for tessLevelCaseNdx

	return (numPassedCases == tessLevelCases.size() ? tcu::TestStatus::pass("OK") : tcu::TestStatus::fail("Some cases have failed"));
}

TestInstance* TessCoordTest::createInstance (Context& context) const
{
	requireFeatures(context.getInstanceInterface(), context.getPhysicalDevice(), FEATURE_TESSELLATION_SHADER | FEATURE_VERTEX_PIPELINE_STORES_AND_ATOMICS);

	return new TessCoordTestInstance(context, m_primitiveType, m_spacingMode);
}

} // anonymous

//! Based on dEQP-GLES31.functional.tessellation.tesscoord.*
//! \note Transform feedback is replaced with SSBO. Because of that, this version allows duplicate coordinates from shader invocations.
//! The test still fails if not enough coordinates are generated, or if coordinates don't match the reference data.
tcu::TestCaseGroup* createCoordinatesTests (tcu::TestContext& testCtx)
{
	de::MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, "tesscoord", "Tessellation coordinates tests"));

	for (int primitiveTypeNdx = 0; primitiveTypeNdx < TESSPRIMITIVETYPE_LAST; ++primitiveTypeNdx)
		for (int spacingModeNdx = 0; spacingModeNdx < SPACINGMODE_LAST; ++spacingModeNdx)
		{
			group->addChild(new TessCoordTest(testCtx, (TessPrimitiveType)primitiveTypeNdx, (SpacingMode)spacingModeNdx));

			// test if TessCoord builtin has correct value in Evaluation shader when execution mode is set only in Control shader
			group->addChild(new TessCoordTest(testCtx, (TessPrimitiveType)primitiveTypeNdx, (SpacingMode)spacingModeNdx, false));
		}

	return group.release();
}

} // tessellation
} // vkt


text:
import sys
import os
import argparse
from string import Template

def get_args():
    parser = argparse.ArgumentParser(description='Pipeline for reference \
guided assembly')
    parser.add_argument("input", help="File describing read data information")
    parser.add_argument("reference", help="Fasta file of reference genome")
    parser.add_argument("dagtemplate", help="dag template")

    return parser.parse_args()

args = get_args()

with open(args.dagtemplate, "r") as template_file:
    template = Template(template_file.read())

with open(args.input, 'r') as infile:
    outfileName = args.input.split(".")[0] + "_toplevel.dag"
    with open(outfileName, "w") as outfile:
        for line in infile:
            line = line.strip()
            inputList = line.split()
            variableMap = {}
            variableMap['ref'] = args.reference
            variableMap['run'] = inputList[0]
            variableMap['sample'] = inputList[1]
            variableMap['lib'] = inputList[2]
            variableMap['platform'] = inputList[3].lower()
            pair = inputList[4].lower()
            with open("{0}_rga.dag".format(variableMap['run']), "w") as dagfile:
                out = template.substitute(variableMap)
                dagfile.write(out)
            outfile.write("SPLICE {0} {0}_rga.dag\n".format(variableMap['run']))


text:
<?php

namespace Prooph\Processing\Type;

use Prooph\Processing\Type\Description\Description;
use Prooph\Processing\Type\Description\DescriptionRegistry;
use Prooph\Processing\Type\Description\NativeType;

/**
 * Class StringCollection
 *
 * @package Prooph\Processing\Type
 * @author Alexander Miertsch <kontakt@codeliner.ws>
 */
class StringCollection extends AbstractCollection
{
    /**
     * Returns the prototype of the items type
     *
     * A collection has always one property with name item representing the type of all items in the collection.
     *
     * @return Prototype
     */
    public static function itemPrototype()
    {
        return String::prototype();
    }

    /**
     * @return Description
     */
    public static function buildDescription()
    {
        if (DescriptionRegistry::hasDescription(__CLASS__)) return DescriptionRegistry::getDescription(__CLASS__);

        $desc = new Description('StringCollection', NativeType::COLLECTION, false);

        DescriptionRegistry::registerDescriptionFor(__CLASS__, $desc);

        return $desc;
    }
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class ScoreMaster
{

    public static List<int> GetScoreCumulative(List<int> rolls)
    {
        var scoreCumulative = new List<int>();

        var sum = 0;
        var scoreFrames = GetScoreFrames(rolls);

        foreach (var scoreFrame in scoreFrames)
        {
            sum += scoreFrame;
            scoreCumulative.Add(sum);
        }

        return scoreCumulative;
    }

    public static List<int> GetScoreFrames(List<int> rolls)
    {
        var scoreFrames = new List<int>();
        var length = rolls.Count;

        for (var i = 0; i < length - 1 && scoreFrames.Count <= 9; i+=2)//Need next roll value available and limit scoreFrames' count to 10
        {
            var sum = rolls[i] + rolls[i + 1];
            if (sum >= 10)//Strike or spare then add the next roll value if available
            {
                if (i < length - 2) scoreFrames.Add(sum + rolls[i + 2]);
                if (rolls[i] == 10) i--; //Strike frame only has one roll
            }
            else scoreFrames.Add(sum);
        }

        return scoreFrames;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Picums.Data.Domain;

namespace Picums.Data.CQRS.DataAccess
{
    public interface IDataCollectionReader<TSource> where TSource : IAggregateRoot
    {
        Task<IEnumerable<TSource>> Collection(Func<TSource, bool> predicate);
    }
}


text:
package com.gs.fw.common.mithra.test.domain.pure;

import java.sql.Timestamp;

public class PureType2DatedReadOnlyTypesB extends PureType2DatedReadOnlyTypesBAbstract
{

    public PureType2DatedReadOnlyTypesB(Timestamp businessDate, Timestamp processingDate)
	{
		super(businessDate, processingDate);
	}
}


text:
<?php

namespace WellCommerce\Bundle\CatalogBundle\Tests\Manager;

use WellCommerce\Bundle\CatalogBundle\Controller\Box\ProductSearchBoxController;
use WellCommerce\Bundle\CoreBundle\Test\Configurator\AbstractLayoutBoxConfiguratorTestCase;
use WellCommerce\Component\Layout\Configurator\LayoutBoxConfiguratorInterface;

/**
 * Class ProductSearchBoxConfiguratorTest
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class ProductSearchBoxConfiguratorTest extends AbstractLayoutBoxConfiguratorTestCase
{
    protected function getService(): LayoutBoxConfiguratorInterface
    {
        return $this->container->get('product_search.layout_box.configurator');
    }

    public function provideLayoutBoxConfiguration()
    {
        return [
            ['ProductSearch', ProductSearchBoxController::class],
        ];
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="4dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="4dp"
    app:cardCornerRadius="4dp"
    app:cardElevation="3dp"
    app:cardPreventCornerOverlap="true"
    app:cardUseCompatPadding="false">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="24dp" >

        <TextView
            android:id="@+id/tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="teste"
            android:textColor="#000" />
    </LinearLayout>

</android.support.v7.widget.CardView>


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>Uses of Class edu.umn.biomedicus.numbers.Token (BioMedICUS Measures 2.0.1 API)</title>
<meta name="date" content="2018-02-07">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
edu.umn.biomedicus.numbers.Token

Packages that use Token

Package
Description

edu.umn.biomedicus.numbers

Classes for the detection of numbers in token sequences.

Uses of Token in edu.umn.biomedicus.numbers

Method parameters in edu.umn.biomedicus.numbers with type arguments of type Token

Modifier and Type
Method and Description

List<NumberResult>
AbstractNumberDetector.checkTokens(Iterable<Token> tokens)

Checks all the tokens in the list, returning any numbers.

Iterable<NumberResult>
AbstractNumberDetector.findNumbers(Iterable<Token> tokens)

Iteratively finds the numbers in an iterable sequence of tokens.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2018 University of Minnesota Institute for Health Informatics NLP/IE Program. All rights reserved.


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

    <!-- common -->
    <string name="empty"></string>
    <string name="ok">确定</string>
    <string name="cancel">取消</string>
    <string name="clear_empty">清空</string>
    <string name="iknow">知道了</string>
    <string name="search">搜索</string>
    <string name="remove">移除</string>
    <string name="add">添加</string>
    <string name="create">新建</string>
    <string name="without_content">暂无</string>
    <string name="network_is_not_available">网络连接失败,请检查你的网络设置</string>
    <string name="open">开启</string>
    <string name="close">关闭</string>
    <string name="menu">菜单</string>
    <string name="now_allow_space">不能含有空格</string>
    <string name="readed">已读</string>

    <!-- session -->
    <string name="input_panel_photo">图 片</string>
    <string name="input_panel_video">视频</string>
    <string name="input_panel_location">位 置</string>
    <string name="input_panel_take">拍 摄</string>
    <string name="im_choose_pic">请选择JPG PNG BMP GIF格式的图片文件</string>
    <string name="repeat_download_message">重新下载?</string>
    <string name="repeat_send_has_blank">重 发</string>
    <string name="repeat_send_message">重发消息?</string>
    <string name="copy_has_blank">复 制</string>
    <string name="delete_has_blank">删 除</string>
    <string name="voice_to_text">转文字</string>
    <string name="forward_to_person">转发到个人</string>
    <string name="forward_to_team">转发到群组</string>
    <string name="withdrawn_msg">撤 回</string>
    <string name="save">保存</string>
    <string name="main_msg_list_delete_chatting">删除该聊天</string>
    <string name="main_msg_list_sticky_on_top">置顶该聊天</string>
    <string name="main_msg_list_clear_sticky_on_top">取消置顶</string>
    <string name="save_to_device">保存到手机</string>
    <string name="picture_save_fail">图片保存失败</string>
    <string name="picture_save_to">图片已保存到手机</string>
    <string name="search_join_team">搜索加入群组</string>
    <string name="file_transfer_state_downloaded">已下载</string>
    <string name="file_transfer_state_undownload">未下载</string>
    <string name="trans_voice_failed">语音转化失败</string>
    <string name="team_invalid_tip">您已退出该群</string>
    <string name="normal_team_invalid_tip">您已退出该讨论组</string>
    <string name="team_send_message_not_allow">您已不在该群,不能发送消息</string>
    <string name="send">发送</string>
    <string name="unsupport_title">无法显示该内容</string>
    <string name="unsupport_desc">客户端版本不支持该内容</string>
    <string name="revoke_failed">发送时间超过2分钟的消息,不能被撤回</string>

    <!-- 语音 -->
    <string name="record_audio">按住 说话</string>
    <string name="record_audio_end">松开  结束</string>
    <string name="sdcard_not_exist_error">请插入SD卡</string>
    <string name="recording_error">录音失败,请重试</string>
    <string name="recording_init_failed">初始化录音失败</string>
    <string name="recording_cancel">手指上滑,取消发送</string>
    <string name="timer_default">00:00</string>
    <string name="recording_cancel_tip">松开手指,取消发送</string>
    <string name="recording_max_time">录音达到最大时间,是否发送?</string>

    <!-- 拍照视频 -->
    <string name="gallery_invalid">你的手机没有图库程序</string>
    <string name="sdcard_not_enough_head_error">SD卡被拔出或存储空间不足,无法保存照片</string>
    <string name="sdcard_not_enough_error">存储空间不足,无法保存此次多媒体消息</string>
    <string name="download_video">正在下载视频</string>
    <string name="download_video_fail">视频下载失败,请重试</string>
    <string name="look_video_fail">无法播放该视频</string>
    <string name="look_video_fail_try_again">暂时无法播放视频,请重试</string>
    <string name="video_play">视频播放</string>
    <string name="video_record">视频录制</string>
    <string name="video_record_symbol">REC</string>
    <string name="video_record_begin">开始录制</string>
    <string name="connect_vedio_device_fail">无法连接视频设备 ,请稍候再试</string>
    <string name="capture_video_size_in_kb">视频文件大小为: %1$dKB,</string>
    <string name="capture_video_size_in_mb">视频文件大小为: %1$.2fMB,</string>
    <string name="is_send_video">是否发送该视频?</string>
    <string name="start_camera_to_record_failed">启动摄像头录制视频失败</string>
    <string name="stop_fail_maybe_stopped">停止失败,可能已经停止</string>
    <string name="video_exception">视频文件异常</string>
    <string name="im_choose_video_file_size_too_large">视频文件过大,系统限制为20MB</string>
    <string name="im_choose_video">请选择3GP MP4格式的视频文件</string>
    <string name="video_record_short">录制视频太短</string>
    <string name="download_progress_description">%1$s(%2$s/%3$s)</string>

    <!-- 联系人选择器 -->
    <string name="contact_selector">联系人选择器</string>

    <!-- team -->
    <string name="team_need_authentication">需要身份验证</string>
    <string name="team_allow_anyone_join">允许任何人加入</string>
    <string name="team_not_allow_anyone_join">不允许任何人申请加入</string>
    <string name="team_admin_invite">管理员邀请</string>
    <string name="team_everyone_invite">所有人邀请</string>
    <string name="team_admin_update">管理员修改</string>
    <string name="team_everyone_update">所有人修改</string>
    <string name="team_invitee_need_authen">需要验证</string>
    <string name="team_invitee_not_need_authen">不需要验证</string>
    <string name="team_nickname">群昵称</string>
    <string name="team_nickname_none">未填写</string>
    <string name="team_identity">身份</string>
    <string name="remove_member">移出本群</string>
    <string name="team_member_info">成员信息</string>
    <string name="team_admin">管理员</string>
    <string name="team_creator">群主</string>
    <string name="team_member">群成员</string>
    <string name="update_success">保存成功</string>
    <string name="update_failed">保存失败, code:%d</string>
    <string name="no_permission">没有权限</string>
    <string name="set_team_admin">设为管理员</string>
    <string name="cancel_team_admin">取消管理员</string>
    <string name="team_member_remove_confirm">确定要将其移出群组么?</string>
    <string name="team_annourcement">群公告</string>
    <string name="invite_member">邀请成员</string>
    <string name="team_name">群名称</string>
    <string name="team_introduce">群介绍</string>
    <string name="team_extension">扩展示例</string>
    <string name="click_set">点击设置</string>
    <string name="create_advanced_team">创建高级群</string>
    <string name="reach_team_member_capacity">成员数量不能超过%1$d</string>
    <string name="team_authentication">身份验证</string>
    <string name="team_invite">邀请他人权限</string>
    <string name="team_info_update">群资料修改权限</string>
    <string name="team_invitee_authentication">被邀请人身份验证</string>
    <string name="create_team">创建群</string>
    <string name="over_team_member_capacity">邀请失败,成员人数上限为%1$d人</string>
    <string name="over_team_capacity">创建失败,创建群数量达到限制</string>
    <string name="create_team_failed">创建失败</string>
    <string name="create_team_success">创建成功</string>
    <string name="team_announce_title">标题</string>
    <string name="team_announce_content">公告内容</string>
    <string name="team_announce_notice">请输入群公告标题</string>
    <string name="my_team_card">我的群名片</string>
    <string name="team_introduce_hint">点击填写群介绍</string>
    <string name="team_extension_hint">点击修改扩展内容</string>
    <string name="team_announce_hint">点击填写群公告</string>
    <string name="team_notification_config">消息提醒</string>
    <string name="team_transfer_without_member">没有可转移的群成员</string>
    <string name="team_invite_members_success">群成员邀请已发出</string>
    <string name="team_invite_members_failed">群成员邀请失败</string>
    <string name="team_transfer_success">群转移成功</string>
    <string name="team_transfer_failed">群转移失败</string>
    <string name="quit_team_success">您已退群</string>
    <string name="quit_team_failed">退群失败</string>
    <string name="quit_normal_team_success">您已经退出讨论组</string>
    <string name="quit_normal_team_failed">退出讨论组失败</string>
    <string name="dismiss_team_success">群已解散</string>
    <string name="dismiss_team_failed">解散群失败</string>
    <string name="dismiss_team">解散本群</string>
    <string name="transfer_team">转让群</string>
    <string name="quit_team">退出群</string>
    <string name="quit_normal_team">退出讨论组</string>
    <string name="team_apply_to_join">申请加入</string>
    <string name="advanced_team">高级群</string>
    <string name="normal_team">讨论组</string>
    <string name="team_name_toast">群名称不能为空</string>
    <string name="not_allow_empty">不能为空</string>
    <string name="chat_setting">聊天信息</string>
    <string name="team_settings_name">设置名称</string>
    <string name="normal_team_name">讨论组名称</string>
    <string name="remove_member_success">移除成员成功</string>
    <string name="remove_member_failed">移除成员失败</string>
    <string name="invite_member_success">邀请成员成功</string>
    <string name="invite_member_failed">邀请成员失败</string>
    <string name="team_create_notice">请添加群成员</string>
    <string name="team_settings_set_name">取个名字吧</string>
    <string name="team_not_exist">该群不存在</string>
    <string name="normal_team_not_exist">该讨论组不存在</string>
    <string name="mute_msg">设置禁言</string>
    <string name="set_head_image">设置头像</string>
    <string name="team_update_cancel">取消更新</string>
    <string name="team_update_failed">群头像设置失败</string>
    <string name="reach_capacity">人数已达上限</string>
    <!-- 消息搜索 -->
    <string name="message_search_no_result">无结果</string>
    <string name="message_search_title">查看聊天内容</string>

    <!-- image picker -->
    <string name="picker_image_preview">预览</string>
    <string name="picker_image_send">发送</string>
    <string name="picker_image_folder">相册</string>
    <string name="picker_image_album_loading">相册加载中…</string>
    <string name="picker_image_album_empty">相册中没有图片!</string>
    <string name="picker_image_folder_info">共%d张</string>
    <string name="picker_image_exceed_max_image_select">最多选择%d张图片!</string>
    <string name="picker_image_send_select">完成(%d)</string>
    <string name="picker_image_preview_original">发送原图</string>
    <string name="picker_image_preview_original_select">发送原图(%s)</string>
    <string name="picker_image_error">获取图片出错</string>
    <string name="image_compressed_size">该原始图片大小为: %1$s,</string>
    <string name="unknow_size">未知大小</string>
    <string name="is_send_image">是否发送该原始图片?</string>
    <string name="multi_image_compressed_size">原始图片总大小为: %1$s,</string>
    <string name="is_send_multi_image">是否发送这些原始图片?</string>
    <string name="waitfor_image_local">正在打开相册,请稍候\u2026</string>
    <string name="recapture">重拍</string>
    <string name="image_show_error">图片显示异常</string>
    <string name="memory_out">内存不足</string>
    <string name="choose_from_photo_album">从手机相册选择</string>
    <string name="choose">选取</string>
    <string name="edit">编辑</string>
    <string name="crop">裁剪</string>

    <!-- 消息类型 -->
    <string name="msg_type_image">图片</string>
    <string name="msg_type_audio">语音</string>

    <!-- 查看大图 -->
    <string name="download_picture_fail">图片下载失败</string>
    <string name="look_up_original_photo_format">查看原图(%s)</string>

    <!--全文检索-->
    <string name="fts_enable">全文检索(FTS4)</string>
    <string name="fts_prefix_hit">前缀匹配高亮检索结果</string>
    <string name="msg_search">全文检索</string>
    <string name="msg_search_limit">全文检索显示条数</string>

</resources>


text:
var GIVe = (function (give) {
  'use strict'

  /**
   * Withering nodes.
   * These nodes have a property called `_lastUpdateGen` to show their last
   *    updated generation number. When `.wither()` is called, the age will
   *    be calculated by `this.tree._currGen` and then compared with
   *    `this.tree.lifeSpan`. If the node is older than expected, then the
   *    content of the node will be purged with `null` with `.clear(null)`.
   * The node is also responsible for withering of all its children. For any
   *    child that returns `true` for its `.wither()` call, call
   *    `.remove(child, true)` to remove them.
   *
   * @typedef {object} WitheringMixin
   * @property {number} _lastUpdateGen - Last updated generation of this node.
   *    This value will be updated whenever `.insert()` or `.traverse()` is
   *    called so that active branches won't wither easily. Because of this,
   *    the `_lastUpdateGen` for parents should always be no earlier than their
   *    children (see `this.wither()` for a potential exception and the
   *    solution for that).
   *
   * @class give.witheringMixin
   *
   * @constructor
   * @param {object} [props] - properties that will be passed to the individual
   *    implementations
   * @param {object} [props._currGen] - the current generation
   */
  give.WitheringMixin = Base => class extends Base {
    constructor (props) {
      super(...arguments)
      if ((props && props._currGen) || (this.tree && this.tree.lifeSpan)) {
        this._lastUpdateGen = props._currGen || this.tree._currGen
      }
    }

    mergeAfter (node) {
      let nodeGen = node
        ? (node._lastUpdateGen || this._lastUpdateGen) : this._lastUpdateGen
      if (typeof super.mergeAfter === 'function') {
        let result = super.mergeAfter(...arguments)
        if (result) {
          if (this._genOlderThan(nodeGen)) {
            this._lastUpdateGen = nodeGen
          }
        }
        return result
      }
      return false
    }

    _genOlderThan (generationToComp) {
      return this.tree && this.tree.lifeSpan &&
        generationToComp > this._lastUpdateGen &&
        ((generationToComp <= this.tree._currGen) ===
          (this._lastUpdateGen <= this.tree._currGen)
        )
    }

    /**
     * wither - Let nodes and/or their children that are too old wither
     *    Note that this withering only removes nodes, it does not do any
     *    restructuring that may be required for some trees. The restructuring
     *    needs to happen in the __`GiveTree`__ object calling this.
     *
     * @returns {boolean} `true` if the node itself has withered and should
     *    be removed from its parent.
     */
    wither () {
      // If `this.tree.neighboringLinks === true`, traversing may get around
      //    parents, which may cause the generation of parent nodes to be older
      //    than their offspring, this needs to be corrected first.
      if (this.tree.neighboringLinks) {
        this.values.forEach(value => {
          if (value && typeof value._lastUpdateGen === 'number' &&
            this._genOlderThan(value._lastUpdateGen)
          ) {
            this._lastUpdateGen = value._lastUpdateGen
          }
        })
      }
      // If current node itself withers,
      // it will cause this and *all the children of this* wither
      // NOTE: Root node may also wither, which causes the whole tree to wither
      if (this._shouldWither) {
        this.clear(null)
        return true
      }
      // For children, mark all children that needs to be withered
      // then call `this.delete` on all children marked.
      for (let index = 0; index < this.childNum; index++) {
        let child = this.values[index]
        if (child && typeof child.wither === 'function' && child.wither()) {
          this.remove(child, true, null)
          index--
        }
      }
      return this.childNum <= 1 && this.values[0] === null
    }

    get _shouldWither () {
      if (!this.tree || !this.tree.lifeSpan) {
        return false
      }
      return !(this.firstChild && this.firstChild._shouldWither === false) && (
        this.tree._currGen >= this._lastUpdateGen
          ? this.tree._currGen - this._lastUpdateGen > this.tree.lifeSpan
          : this.tree._currGen +
            (this.tree.constructor.MAX_GENERATION - this._lastUpdateGen) >
            this.tree.lifeSpan
      )
    }

    rejuvenate () {
      if (this.tree && this.tree.lifeSpan) {
        this._lastUpdateGen = this.tree._currGen
      }
    }

    traverse (chrRange, callback, filter, breakOnFalse, props, ...args) {
      let result
      if (typeof super.traverse === 'function') {
        result = super.traverse(...arguments)
      }
      if (!props || !props.doNotWither) {
        this.rejuvenate()
      }
      return result
    }

    getUncachedRange (chrRange, props, ...args) {
      let result
      if (typeof super.getUncachedRange === 'function') {
        result = super.getUncachedRange(...arguments)
      }
      if (!props || !props.doNotWither) {
        this.rejuvenate()
      }
      return result
    }
  }

  return give
})(GIVe || {})


text:
var globals = {};
globals.devwidth = Ti.Platform.getDisplayCaps().platformWidth;
globals.devheight = Ti.Platform.getDisplayCaps().platformHeight;
globals.dpi = Ti.Platform.getDisplayCaps().dpi;
globals.multiplier = globals.dpi / 160;
globals.loaded = false;
globals.os = Ti.Platform.osname;
globals.isiOS7;

var version = Titanium.Platform.version.split(".");
var major = parseInt(version[0]);
if (major == 7){globals.isiOS7 = true;
} else {globals.isiOS7 = false;} // iOS 6

//alert(globals.multiplier);


text:
@implementation DSPaths (Library)

+ (NSString*)libraryDirectory {
    return [self pathWithSearchPathDirectory:NSLibraryDirectory];
}

+ (NSString*)libraryWithFile:(NSString *)filename {
    return [self pathWithFile:filename inSearchPathDirectory:NSLibraryDirectory];
}

+(NSString*)libraryWithPathComponents:(NSArray *)pathComponents {
    return [self pathWithComponents:pathComponents inSearchPathDirectory:NSLibraryDirectory];
}

@end


text:
module EventDelegate {
    'use strict';

    export module Directives {

        class EventDelegate implements ng.IDirective {
            restrict = 'A';
            link: ng.IDirectiveLinkFn;

            constructor(){
                this.link = (scope, el, attr) => {
                    var
                        eventDelegate = scope.$eval(attr['eventDelegate']);

                    angular.forEach(eventDelegate, (selector, event) => {

                        el.on(event + '.eventDelegate', selector, (e) => {
                            e.preventDefault();

                            var
                                target: ng.IAugmentedJQuery = angular.element(e.currentTarget),
                                fn: ng.ICompiledExpression,
                                targetScope: ng.IScope;

                            if ((fn = target.data('EventDelegateTarget')) && (targetScope = target.data('EventDelegateTargetScope'))) {
                                scope.$apply(() => fn(targetScope, { $event: e }));
                            }
                        });

                    });

                    scope.$on('$destroy', () => {
                        eventDelegate = null;
                        el.off('.eventDelegate');
                    });
                };
            }

            static instance(){
                return [() => new this()];
            }
        }

        export var eventDelegate: ng.IDirective = EventDelegate.instance();

        class EventDelegateTarget implements ng.IDirective {
            restrict = 'A';
            link: ng.IDirectiveLinkFn;

            constructor($parse: ng.IParseService) {
                this.link = (scope, el, attr) => {

                    attr.$observe('eventDelegateTarget', (att) => {
                        el.data({
                            'EventDelegateTarget': $parse(att),
                            'EventDelegateTargetScope': scope
                        });
                    });

                };
            }

            static instance(){
                return ['$parse', ($parse) => new this($parse)];
            }
        }

        export var eventDelegateTarget: ng.IDirective = EventDelegateTarget.instance();
    }

    angular.module('EventDelegate', []).directive({
      'eventDelegateTarget': Directives.eventDelegateTarget,
      'eventDelegate': Directives.eventDelegate
    });
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **string** | Name of the list |
**folderId** | **int** | Id of the parent folder in which this list is to be created |

[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)


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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
			  xmlns:app="http://schemas.android.com/apk/res-auto"
			  android:layout_width="match_parent"
			  android:layout_height="match_parent"
			  android:orientation="vertical">

	<LinearLayout
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:gravity="center_vertical"
		android:orientation="horizontal">

		<jsettlers.main.android.gameplay.customviews.InGameButton
			android:id="@+id/image_view_priority"
			android:layout_width="0dp"
			android:layout_height="wrap_content"
			android:layout_weight="1"
			android:visibility="invisible"/>

		<TextView
			android:id="@+id/text_view_building_name"
			android:layout_width="0dp"
			android:layout_height="wrap_content"
			android:layout_weight="1"
			android:gravity="center_horizontal"
			android:text="TextView"/>

		<jsettlers.main.android.gameplay.customviews.InGameButton
			android:id="@+id/image_view_destroy"
			android:layout_width="0dp"
			android:layout_height="wrap_content"
			android:layout_weight="1"
			android:visibility="invisible"/>

	</LinearLayout>

	<FrameLayout
		android:layout_width="match_parent"
		android:layout_height="0dp"
		android:layout_weight="1">

		<android.support.v7.widget.RecyclerView
			android:id="@+id/recyclerView"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:visibility="gone"
			android:layout_gravity="center"
			app:layoutManager="GridLayoutManager"
			app:spanCount="7"/>

		<ImageView
			android:id="@+id/image_view_building"
			android:layout_width="64dp"
			android:layout_height="64dp"
			android:layout_gravity="center"/>
	</FrameLayout>

	<LinearLayout
		android:id="@+id/layout_materials"
		android:layout_width="match_parent"
		android:layout_height="@dimen/menu_button_size"
		android:orientation="horizontal"
		android:layout_margin="8dp"/>

</LinearLayout>