text:
import defined from "../../Core/defined.js";
import ComponentDatatype from "../../Core/ComponentDatatype.js";
import PrimitiveType from "../../Core/PrimitiveType.js";
import AttributeType from "../AttributeType.js";
import VertexAttributeSemantic from "../VertexAttributeSemantic.js";
import GeometryStageFS from "../../Shaders/ModelExperimental/GeometryStageFS.js";
import GeometryStageVS from "../../Shaders/ModelExperimental/GeometryStageVS.js";
import SelectedFeatureIdPipelineStage from "./SelectedFeatureIdPipelineStage.js";
import ShaderDestination from "../../Renderer/ShaderDestination.js";
import ModelExperimentalUtility from "./ModelExperimentalUtility.js";
import ModelExperimentalType from "./ModelExperimentalType.js";

/**
 * The geometry pipeline stage processes the vertex attributes of a primitive.
 *
 * @namespace GeometryPipelineStage
 *
 * @private
 */
const GeometryPipelineStage = {};
GeometryPipelineStage.name = "GeometryPipelineStage"; // Helps with debugging

GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS =
  "ProcessedAttributesVS";
GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS =
  "ProcessedAttributesFS";
GeometryPipelineStage.STRUCT_NAME_PROCESSED_ATTRIBUTES = "ProcessedAttributes";
GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES =
  "initializeAttributes";
GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES =
  "void initializeAttributes(out ProcessedAttributes attributes)";
GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS =
  "setDynamicVaryingsVS";
GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS =
  "setDynamicVaryingsFS";
GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS =
  "void setDynamicVaryings(inout ProcessedAttributes attributes)";

/**
 * This pipeline stage processes the vertex attributes of a primitive, adding the attribute declarations to the shaders,
 * the attribute objects to the render resources and setting the flags as needed.
 *
 * Processes a primitive. This stage modifies the following parts of the render resources:
 * <ul>
 *  <li> adds attribute and varying declarations for the vertex attributes in the vertex and fragment shaders
 *  <li> creates the objects required to create VertexArrays
 *  <li> sets the flag for point primitive types
 * </ul>
 *
 * @param {PrimitiveRenderResources} renderResources The render resources for this primitive.
 * @param {ModelComponents.Primitive} primitive The primitive.
 *
 * @private
 */
GeometryPipelineStage.process = function (renderResources, primitive) {
  const shaderBuilder = renderResources.shaderBuilder;
  // These structs are similar, though the fragment shader version has a couple
  // additional fields.
  shaderBuilder.addStruct(
    GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,
    "ProcessedAttributes",
    ShaderDestination.VERTEX
  );
  shaderBuilder.addStruct(
    GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
    "ProcessedAttributes",
    ShaderDestination.FRAGMENT
  );

  // The Feature struct is always added since it's required for compilation. It may be unused if features are not present.
  shaderBuilder.addStruct(
    SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,
    SelectedFeatureIdPipelineStage.STRUCT_NAME_SELECTED_FEATURE,
    ShaderDestination.BOTH
  );

  // This initialization function is only needed in the vertex shader,
  // it assigns the non-quantized attribute struct fields from the
  // physical attributes
  shaderBuilder.addFunction(
    GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,
    GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,
    ShaderDestination.VERTEX
  );

  // Positions in other coordinate systems need more variables
  shaderBuilder.addVarying("vec3", "v_positionWC");
  shaderBuilder.addVarying("vec3", "v_positionEC");
  shaderBuilder.addStructField(
    GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
    "vec3",
    "positionWC"
  );
  shaderBuilder.addStructField(
    GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
    "vec3",
    "positionEC"
  );

  // Though they have identical signatures, the implementation is different
  // between vertex and fragment shaders. The VS stores attributes in
  // varyings, while the FS unpacks the varyings for use by other stages.
  shaderBuilder.addFunction(
    GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,
    GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,
    ShaderDestination.VERTEX
  );
  shaderBuilder.addFunction(
    GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,
    GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,
    ShaderDestination.FRAGMENT
  );

  // .pnts point clouds store sRGB color rather than linear color
  const modelType = renderResources.model.type;
  if (modelType === ModelExperimentalType.TILE_PNTS) {
    shaderBuilder.addDefine(
      "HAS_SRGB_COLOR",
      undefined,
      ShaderDestination.FRAGMENT
    );
  }

  for (let i = 0; i < primitive.attributes.length; i++) {
    const attribute = primitive.attributes[i];
    const attributeLocationCount = AttributeType.getAttributeLocationCount(
      attribute.type
    );

    let index;
    if (attributeLocationCount > 1) {
      index = renderResources.attributeIndex;
      renderResources.attributeIndex += attributeLocationCount;
    } else if (attribute.semantic === VertexAttributeSemantic.POSITION) {
      index = 0;
    } else {
      index = renderResources.attributeIndex++;
    }
    processAttribute(renderResources, attribute, index, attributeLocationCount);
  }

  handleBitangents(shaderBuilder, primitive.attributes);

  if (primitive.primitiveType === PrimitiveType.POINTS) {
    shaderBuilder.addDefine("PRIMITIVE_TYPE_POINTS");
  }

  shaderBuilder.addVertexLines([GeometryStageVS]);
  shaderBuilder.addFragmentLines([GeometryStageFS]);
};

function processAttribute(
  renderResources,
  attribute,
  attributeIndex,
  attributeLocationCount
) {
  const shaderBuilder = renderResources.shaderBuilder;
  const attributeInfo = ModelExperimentalUtility.getAttributeInfo(attribute);

  if (attributeLocationCount > 1) {
    // matrices are stored as multiple attributes, one per column vector.
    addMatrixAttributeToRenderResources(
      renderResources,
      attribute,
      attributeIndex,
      attributeLocationCount
    );
  } else {
    addAttributeToRenderResources(renderResources, attribute, attributeIndex);
  }
  addAttributeDeclaration(shaderBuilder, attributeInfo);
  addVaryingDeclaration(shaderBuilder, attributeInfo);

  // For common attributes like positions, normals and tangents, the code is
  // already in GeometryStageVS, we just need to enable it
  if (defined(attribute.semantic)) {
    addSemanticDefine(shaderBuilder, attribute);
  }

  // Some GLSL code must be dynamically generated
  updateAttributesStruct(shaderBuilder, attributeInfo);
  updateInitializeAttributesFunction(shaderBuilder, attributeInfo);
  updateSetDynamicVaryingsFunction(shaderBuilder, attributeInfo);
}

function addSemanticDefine(shaderBuilder, attribute) {
  const semantic = attribute.semantic;
  const setIndex = attribute.setIndex;
  switch (semantic) {
    case VertexAttributeSemantic.NORMAL:
      shaderBuilder.addDefine("HAS_NORMALS");
      break;
    case VertexAttributeSemantic.TANGENT:
      shaderBuilder.addDefine("HAS_TANGENTS");
      break;
    case VertexAttributeSemantic.FEATURE_ID:
      // `_FEATURE_ID starts with an underscore so no need to double the
      // underscore.
      shaderBuilder.addDefine(`HAS${semantic}_${setIndex}`);
      break;
    case VertexAttributeSemantic.TEXCOORD:
    case VertexAttributeSemantic.COLOR:
      shaderBuilder.addDefine(`HAS_${semantic}_${setIndex}`);
  }
}

function addAttributeToRenderResources(
  renderResources,
  attribute,
  attributeIndex
) {
  const quantization = attribute.quantization;
  let type;
  let componentDatatype;
  if (defined(quantization)) {
    type = quantization.type;
    componentDatatype = quantization.componentDatatype;
  } else {
    type = attribute.type;
    componentDatatype = attribute.componentDatatype;
  }

  const semantic = attribute.semantic;
  const setIndex = attribute.setIndex;
  if (
    semantic === VertexAttributeSemantic.FEATURE_ID &&
    setIndex >= renderResources.featureIdVertexAttributeSetIndex
  ) {
    renderResources.featureIdVertexAttributeSetIndex = setIndex + 1;
  }

  const vertexAttribute = {
    index: attributeIndex,
    value: defined(attribute.buffer) ? undefined : attribute.constant,
    vertexBuffer: attribute.buffer,
    componentsPerAttribute: AttributeType.getNumberOfComponents(type),
    componentDatatype: componentDatatype,
    offsetInBytes: attribute.byteOffset,
    strideInBytes: attribute.byteStride,
    normalize: attribute.normalized,
  };

  renderResources.attributes.push(vertexAttribute);
}

function addMatrixAttributeToRenderResources(
  renderResources,
  attribute,
  attributeIndex,
  columnCount
) {
  const quantization = attribute.quantization;
  let type;
  let componentDatatype;
  if (defined(quantization)) {
    type = quantization.type;
    componentDatatype = quantization.componentDatatype;
  } else {
    type = attribute.type;
    componentDatatype = attribute.componentDatatype;
  }

  const normalized = attribute.normalized;

  // componentCount is either 4, 9 or 16
  const componentCount = AttributeType.getNumberOfComponents(type);
  // componentsPerColumn is either 2, 3, or 4
  const componentsPerColumn = componentCount / columnCount;

  const componentSizeInBytes = ComponentDatatype.getSizeInBytes(
    componentDatatype
  );

  const columnLengthInBytes = componentsPerColumn * componentSizeInBytes;

  // The stride between corresponding columns of two matrices is constant
  // regardless of where you start
  const strideInBytes = attribute.byteStride;

  for (let i = 0; i < columnCount; i++) {
    const offsetInBytes = attribute.byteOffset + i * columnLengthInBytes;

    // upload a single column vector.
    const columnAttribute = {
      index: attributeIndex + i,
      vertexBuffer: attribute.buffer,
      componentsPerAttribute: componentsPerColumn,
      componentDatatype: componentDatatype,
      offsetInBytes: offsetInBytes,
      strideInBytes: strideInBytes,
      normalize: normalized,
    };

    renderResources.attributes.push(columnAttribute);
  }
}

function addVaryingDeclaration(shaderBuilder, attributeInfo) {
  const variableName = attributeInfo.variableName;
  let varyingName = `v_${variableName}`;

  let glslType;
  if (variableName === "normalMC") {
    // though the attribute is in model coordinates, the varying is
    // in eye coordinates.
    varyingName = "v_normalEC";
    glslType = attributeInfo.glslType;
  } else if (variableName === "tangentMC") {
    // Tangent's glslType is vec4, but in the shader it is split into
    // vec3 tangent and vec3 bitangent
    glslType = "vec3";
    // like normalMC, the varying is converted to eye coordinates
    varyingName = "v_tangentEC";
  } else {
    glslType = attributeInfo.glslType;
  }

  shaderBuilder.addVarying(glslType, varyingName);
}

function addAttributeDeclaration(shaderBuilder, attributeInfo) {
  const semantic = attributeInfo.attribute.semantic;
  const variableName = attributeInfo.variableName;

  let attributeName;
  let glslType;
  if (attributeInfo.isQuantized) {
    attributeName = `a_quantized_${variableName}`;
    glslType = attributeInfo.quantizedGlslType;
  } else {
    attributeName = `a_${variableName}`;
    glslType = attributeInfo.glslType;
  }

  if (semantic === VertexAttributeSemantic.POSITION) {
    shaderBuilder.setPositionAttribute(glslType, attributeName);
  } else {
    shaderBuilder.addAttribute(glslType, attributeName);
  }
}

function updateAttributesStruct(shaderBuilder, attributeInfo) {
  const vsStructId = GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS;
  const fsStructId = GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS;
  const variableName = attributeInfo.variableName;

  if (variableName === "tangentMC") {
    // The w component of the tangent is only used for computing the bitangent,
    // so it can be separated from the other tangent components.
    shaderBuilder.addStructField(vsStructId, "vec3", "tangentMC");
    shaderBuilder.addStructField(vsStructId, "float", "tangentSignMC");
    // The tangent is in model coordinates in the vertex shader
    // but in eye space in the fragment coordinates
    shaderBuilder.addStructField(fsStructId, "vec3", "tangentEC");
  } else if (variableName === "normalMC") {
    // Normals are in model coordinates in the vertex shader but in eye
    // coordinates in the fragment shader
    shaderBuilder.addStructField(vsStructId, "vec3", "normalMC");
    shaderBuilder.addStructField(fsStructId, "vec3", "normalEC");
  } else {
    shaderBuilder.addStructField(
      vsStructId,
      attributeInfo.glslType,
      variableName
    );
    shaderBuilder.addStructField(
      fsStructId,
      attributeInfo.glslType,
      variableName
    );
  }
}

function updateInitializeAttributesFunction(shaderBuilder, attributeInfo) {
  if (attributeInfo.isQuantized) {
    // Skip initialization, it will be handled in the dequantization stage.
    return;
  }

  const functionId = GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES;
  const variableName = attributeInfo.variableName;
  const lines = [];
  if (variableName === "tangentMC") {
    lines.push("attributes.tangentMC = a_tangentMC.xyz;");
    lines.push("attributes.tangentSignMC = a_tangentMC.w;");
  } else {
    lines.push(`attributes.${variableName} = a_${variableName};`);
  }
  shaderBuilder.addFunctionLines(functionId, lines);
}

function updateSetDynamicVaryingsFunction(shaderBuilder, attributeInfo) {
  const semantic = attributeInfo.attribute.semantic;
  const setIndex = attributeInfo.attribute.setIndex;
  if (defined(semantic) && !defined(setIndex)) {
    // positions, normals, and tangents are handled statically in
    // GeometryStageVS
    return;
  }

  // In the vertex shader, we want things like
  // v_texCoord_1 = attributes.texCoord_1;
  let functionId = GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;
  const variableName = attributeInfo.variableName;
  let line = `v_${variableName} = attributes.${variableName};`;
  shaderBuilder.addFunctionLines(functionId, [line]);

  // In the fragment shader, we do the opposite:
  // attributes.texCoord_1 = v_texCoord_1;
  functionId = GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS;
  line = `attributes.${variableName} = v_${variableName};`;
  shaderBuilder.addFunctionLines(functionId, [line]);
}

function handleBitangents(shaderBuilder, attributes) {
  let hasNormals = false;
  let hasTangents = false;
  for (let i = 0; i < attributes.length; i++) {
    const attribute = attributes[i];
    if (attribute.semantic === VertexAttributeSemantic.NORMAL) {
      hasNormals = true;
    } else if (attribute.semantic === VertexAttributeSemantic.TANGENT) {
      hasTangents = true;
    }
  }

  // Bitangents are only defined if we have normals and tangents
  if (!hasNormals || !hasTangents) {
    return;
  }

  shaderBuilder.addDefine("HAS_BITANGENTS");

  shaderBuilder.addVarying("vec3", "v_bitangentEC");
  shaderBuilder.addStructField(
    GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,
    "vec3",
    "bitangentMC"
  );
  shaderBuilder.addStructField(
    GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
    "vec3",
    "bitangentEC"
  );
}

export default GeometryPipelineStage;


text:
"use strict";

var toInteger = require("../../../number/to-integer")
  , value     = require("../../../object/valid-value")
  , isValue   = require("../../../object/is-value")
  , min       = Math.min
  , max       = Math.max;

module.exports = function (searchString/*, endPosition*/) {
	var self, start, endPos;
	self = String(value(this));
	searchString = String(searchString);
	endPos = arguments[1];
	start =
		(isValue(endPos) ? min(max(toInteger(endPos), 0), self.length) : self.length) -
		searchString.length;
	return start < 0 ? false : self.indexOf(searchString, start) === start;
};

redpajama_set_name: RedPajamaGithub


text:
package org.w3c.domts.level2.core;

import org.w3c.dom.*;

import org.w3c.domts.DOMTestCase;
import org.w3c.domts.DOMTestDocumentBuilderFactory;

/**
 *     The "importNode(importedNode,deep)" method for a
 *    Document should import the given importedNode into that Document.
 *    The importedNode is of type CData_Section.
 *
 *    Create a CDATASection node with value being the string "this is CDATASection data" in
 *    a different document.  Invoke method importNode(importedNode,deep) on
 *    this document.  Method should return a CDATASection node whose value matches
 *    the above string. The returned node should belong to this document whose systemId is "staff.dtd"
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode
*/
public final class importNode02 extends DOMTestCase {

   /**
    * Constructor.
    * @param factory document factory, may not be null
    * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
    */
   public importNode02(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
      super(factory);

    //
    //   check if loaded documents are supported for content type
    //
    String contentType = getContentType();
    preload(contentType, "staffNS", true);
    preload(contentType, "staffNS", true);
    }

   /**
    * Runs the test case.
    * @throws Throwable Any uncaught exception causes test to fail
    */
   public void runTest() throws Throwable {
      Document doc;
      Document aNewDoc;
      CDATASection cDataSec;
      Node aNode;
      Document ownerDocument;
      DocumentType docType;
      String system;
      String value;
      doc = (Document) load("staffNS", true);
      aNewDoc = (Document) load("staffNS", true);
      cDataSec = aNewDoc.createCDATASection("this is CDATASection data");
      aNode = doc.importNode(cDataSec, false);
      ownerDocument = aNode.getOwnerDocument();
      assertNotNull("ownerDocumentNotNull", ownerDocument);
      docType = ownerDocument.getDoctype();
      system = docType.getSystemId();
      assertURIEquals("dtdSystemId", null, null, null, "staffNS.dtd", null, null, null, null, system);
value = aNode.getNodeValue();
      assertEquals("nodeValue", "this is CDATASection data", value);
      }
   /**
    *  Gets URI that identifies the test.
    *  @return uri identifier of test
    */
   public String getTargetURI() {
      return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode02";
   }
   /**
    * Runs this test from the command line.
    * @param args command line arguments
    */
   public static void main(final String[] args) {
        DOMTestCase.doMain(importNode02.class, args);
   }
}


text:
module ChartHelper
  def chart_values(distribution_hash)
    Hash[
      distribution_hash.collect do |key, data|
        [key, data['value']]
      end
    ]
  end

  def chart_colors(distribution_hash)
    distribution_hash.collect do |_key, data|
      data['color']
    end
  end
end


text:
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Collections
{
    // http://msdn.microsoft.com/ru-ru/library/system.collections.arraylist%28v=vs.110%29.aspx
    class ArrayList_p
    {
        private ArrayList arrayList;
        private ArrayList arrayList1;

        public ArrayList_p()
        {
            arrayList = new ArrayList();
            arrayList1 = new ArrayList(40);

            Console.WriteLine("ArrayList default capacity: {0}", arrayList.Capacity);
            Console.WriteLine("ArrayList(40) default capacity: {0}", arrayList1.Capacity);

            arrayList.Add("some");
            arrayList.Add("text");

            Console.WriteLine("ArrayList capacity (after adding 2 elements): {0}", arrayList.Capacity);

            arrayList.Add("foo");
            arrayList.Add("bar");
            arrayList.Add("lol");

            Console.WriteLine("ArrayList capacity (after adding 3 elements): {0}", arrayList.Capacity);
            Console.WriteLine("ArrayList count elements: {0}", arrayList.Count);

            Console.WriteLine("ArrayList has a fixed size: {0}", arrayList.IsFixedSize);
            Console.WriteLine("ArrayList is read-only: {0}", arrayList.IsReadOnly);
            Console.WriteLine("ArrayList is synchronized (thread-safe): {0}", arrayList.IsSynchronized);

            var s_arrList = ArrayList.Synchronized(arrayList);

            Console.WriteLine("ArrayList is synchronized (thread-safe): {0}", s_arrList.IsSynchronized);

            lock (arrayList.SyncRoot)
            {
                foreach (var element in arrayList)
                {
                    Console.Write("{0} ", element.ToString());
                }
                Console.Write("\n");
            }

            // ArrayList does not guarantee sorted array, need to sort in manually before doing BinarySearch
            arrayList.Sort();
            int elementIndex = arrayList.BinarySearch("foo");
            Console.WriteLine("ArrayList BinarySearch returns element position: {0}", elementIndex.ToString());

            arrayList.TrimToSize();
            Console.WriteLine("ArrayList capacity after trimming to size: {0}", arrayList.Capacity);

            arrayList.Clear();
            Console.WriteLine("ArrayList count after clearing: {0}", arrayList.Count);
            Console.WriteLine("ArrayList capacity after clearing: {0}", arrayList.Capacity);

        }
    }
}


text:
package com.taskadapter.redmineapi.internal.json;

import org.json.JSONException;
import org.json.JSONWriter;

/**
 * Json object writer.
 *
 * @author maxkar
 *
 */
public interface JsonObjectWriter<T> {
	public void write(JSONWriter writer, T object) throws JSONException;
}


text:
import widgets from './widgets';

export class HTMLPreModel extends widgets.StringModel {
  defaults() {
    return {
      ...super.defaults(),
      _view_name: "HTMLPreView",
      _model_name: "HTMLPreModel",
      _model_module: 'beakerx',
      _view_module: 'beakerx',
      _model_module_version: BEAKERX_MODULE_VERSION,
      _view_module_version: BEAKERX_MODULE_VERSION
    };
  }
}

export class HTMLPreView extends widgets.DescriptionView {
  render() {
    const pre = document.createElement('pre');

    pre.innerHTML = this.model.get('value');
    this.el.appendChild(pre);
    this.el.classList.add('widget-html-pre');
  }
}

export default {
  HTMLPreModel,
  HTMLPreView
};


text:
package blocks

import (
	"github.com/ava-labs/avalanchego/codec"
)

func Parse(c codec.Manager, b []byte) (Block, error) {
	var blk Block
	if _, err := c.Unmarshal(b, &blk); err != nil {
		return nil, err
	}
	return blk, blk.initialize(b)
}


text:
[View Javadoc](../../../../../apidocs/org/apache/struts/tiles/Controller.html.md)

    1
    21
    22  package org.apache.struts.tiles;
    23
    24  import java.io.IOException;
    25
    26  import javax.servlet.ServletContext;
    27  import javax.servlet.ServletException;
    28  import javax.servlet.http.HttpServletRequest;
    29  import javax.servlet.http.HttpServletResponse;
    30
    31  /**
    32   * A controller is a piece of code called before rendering a jsp page.
    33   * A controller can be associated to a tile. See <insert> or
    34   * <definition> for association syntax.
    35   */
    36  public interface Controller {
    37
    38      /**
    39       * Method associated to a tile and called immediately before the tile
    40       * is included.
    41       *
    42       * @param tileContext    Current tile context.
    43       * @param request        Current request
    44       * @param response       Current response
    45       * @param servletContext Current servlet context
    46       * @deprecated Use execute() instead.  This will be removed after
    47       *             Struts 1.2.
    48       */
    49      public void perform(
    50              ComponentContext tileContext,
    51              HttpServletRequest request,
    52              HttpServletResponse response,
    53              ServletContext servletContext)
    54              throws ServletException, IOException;
    55
    56      /**
    57       * Method associated to a tile and called immediately before the tile
    58       * is included.
    59       *
    60       * @param tileContext    Current tile context.
    61       * @param request        Current request
    62       * @param response       Current response
    63       * @param servletContext Current servlet context
    64       */
    65      public void execute(
    66              ComponentContext tileContext,
    67              HttpServletRequest request,
    68              HttpServletResponse response,
    69              ServletContext servletContext)
    70              throws Exception;
    71  }

------------------------------------------------------------------------

This page was automatically generated by [Maven](http://maven.apache.org/)


text:
//
//  YGInputView.h
//  ChatKeyBoard
//
//  Created by 叶根长 on 15/6/16.
//  Copyright (c) 2015年 叶根长. All rights reserved.
//

#import <UIKit/UIKit.h>
#define kKeyBorad_H 45

@class YGInputView;

@protocol YGInputViewDelegate <NSObject>

/**
 *输入视图发生改变
 */
-(void)inputViewHeightChange:(YGInputView *)inputview height:(CGFloat)height;

@end

@interface YGInputView : UIView
+(YGInputView *)view;
@property(nonatomic,copy) void(^heightChange)(CGFloat height);
@property(nonatomic,weak) id<YGInputViewDelegate> delegate;
@end


text:
package org.opencb.biodata.tools.variant.stats;

import org.junit.Test;
import org.opencb.biodata.models.feature.Genotype;
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.VariantAggregatedVcfFactory;
import org.opencb.biodata.models.variant.VariantSource;
import org.opencb.biodata.models.variant.StudyEntry;
import org.opencb.biodata.models.variant.stats.VariantStats;
import org.opencb.commons.test.GenericTest;

import java.util.*;

import static org.junit.Assert.*;

/**
 * Created by jmmut on 2015-08-25.
 *
 * @author Jose Miguel Mut Lopez <jmmut@ebi.ac.uk>
 */
public class VariantAggregatedStatsCalculatorTest extends GenericTest {

    private VariantSource source = new VariantSource("filename.vcf", "fileId", "studyId", "studyName");
    private VariantAggregatedVcfFactory factory = new VariantAggregatedVcfFactory();

    @Test
    public void parseAC_AN() {
        String line = "1\t54722\t.\tTTC\tT,TCTC\t999\tPASS\tDP4=3122,3282,891,558;DP=22582;INDEL;IS=3,0.272727;VQSLOD=6.76;AN=3854;AC=889,61;TYPE=del,ins;HWE=0;ICF=-0.155251";   // structure like uk10k

        List<Variant> variants = factory.create(source, line);
        VariantAggregatedStatsCalculator calculator = new VariantAggregatedStatsCalculator();
        calculator.calculate(variants);

        VariantStats stats = variants.get(0).getSourceEntry(source.getFileId(), source.getStudyId()).getStats(StudyEntry.DEFAULT_COHORT);
        assertEquals(2904, stats.getRefAlleleCount().longValue());
        assertEquals(889, stats.getAltAlleleCount().longValue());

        stats = variants.get(1).getSourceEntry(source.getFileId(), source.getStudyId()).getStats(StudyEntry.DEFAULT_COHORT);
        assertEquals(2904, stats.getRefAlleleCount().longValue());
        assertEquals(61, stats.getAltAlleleCount().longValue());
        assertEquals(0.015827711, stats.getMaf(), 0.0001);
    }

    @Test
    public void parseGTC () {
        String line = "20\t61098\trs6078030\tC\tT\t51254.56\tPASS\tAC=225;AN=996;GTC=304,163,31";   // structure like gonl

        List<Variant> variants = factory.create(source, line);
        VariantAggregatedStatsCalculator calculator = new VariantAggregatedStatsCalculator();
        calculator.calculate(variants);

        VariantStats stats = variants.get(0).getSourceEntry(source.getFileId(), source.getStudyId()).getStats(StudyEntry.DEFAULT_COHORT);
        assertEquals(new Integer(304), stats.getGenotypesCount().get(new Genotype("0/0", "C", "T")));
        assertEquals(new Integer(163), stats.getGenotypesCount().get(new Genotype("0/1", "C", "T")));
        assertEquals(new Integer(31),  stats.getGenotypesCount().get(new Genotype("T/T", "C", "T")));
        assertEquals(0.225903614, stats.getMaf(), 0.0001);
    }

    @Test
    public void parseCustomGTC () {
        String line = "1\t1225579\t.\tG\tA,C\t170.13\tPASS\tAC=3,8;AN=534;AF=0.006,0.015;HPG_GTC=0/0:258,0/1:1,0/2:6,1/1:1,1/2:0,2/2:1,./.:0";  // structure like HPG

        Properties properties = new Properties();
        properties.put("ALL.GTC", "HPG_GTC");
        properties.put("ALL.AC", "AC");
        properties.put("ALL.AN", "AN");
        properties.put("ALL.AF", "AF");
        List<Variant> variants = new VariantAggregatedVcfFactory().create(source, line);
        VariantAggregatedStatsCalculator calculator = new VariantAggregatedStatsCalculator(properties);
        calculator.calculate(variants);

        VariantStats stats = variants.get(0).getSourceEntry(source.getFileId(), source.getStudyId()).getStats(StudyEntry.DEFAULT_COHORT);
        assertEquals(Integer.valueOf(523), stats.getRefAlleleCount());
        assertEquals(Integer.valueOf(3), stats.getAltAlleleCount());
        assertEquals(0.006, stats.getAltAlleleFreq(), 0.0001);
        assertEquals(3.0/534, stats.getMaf(), 0.0001);
        assertEquals(Integer.valueOf(258), stats.getGenotypesCount().get(new Genotype("0/0", "G", "A")));
        assertEquals(Integer.valueOf(1), stats.getGenotypesCount().get(new Genotype("0/1", "G", "A")));
        assertEquals(Integer.valueOf(1), stats.getGenotypesCount().get(new Genotype("A/A", "G", "A")));
        assertEquals(Integer.valueOf(6), stats.getGenotypesCount().get(new Genotype("0/2", "G", "A")));
        assertEquals(Integer.valueOf(0), stats.getGenotypesCount().get(new Genotype("./.", "G", "A")));

        stats = variants.get(1).getSourceEntry(source.getFileId(), source.getStudyId()).getCohortStats("ALL");
        assertEquals(Integer.valueOf(6), stats.getGenotypesCount().get(new Genotype("0/1", "G", "C")));

    }

    @Test
    public void parseWithGTS () {
        String line = "1\t861255\t.\tA\tG\t.\tPASS\tAC=2;AF=0.0285714285714286;AN=70;GTS=GG,GA,AA;GTC=1,0,34";

        List<Variant> variants = factory.create(source, line);
        VariantAggregatedStatsCalculator calculator = new VariantAggregatedStatsCalculator();
        calculator.calculate(variants);

        VariantStats stats = variants.get(0).getSourceEntry(source.getFileId(), source.getStudyId()).getStats(StudyEntry.DEFAULT_COHORT);
        assertEquals(new Integer(34), stats.getGenotypesCount().get(new Genotype("0/0", "A", "G")));
        assertEquals(new Integer(0),  stats.getGenotypesCount().get(new Genotype("0/1", "A", "G")));
        assertEquals(new Integer(1),  stats.getGenotypesCount().get(new Genotype("G/G", "A", "G")));
        assertEquals(2.0/70, stats.getMaf(), 0.0001);
    }

    @Test
    public void getCohorts() {
        Properties properties = new Properties();
        properties.put("EUR.GTC", "EUR_HPG_GTC");
        properties.put("EUR.AC", "EUR_AC");
        properties.put("EUR.AN", "EUR_AN");
        properties.put("EUR.AF", "EUR_AF");
        properties.put("ALL.AN", "AN");
        properties.put("ALL.AF", "AF");
        properties.put(VariantAggregatedEVSStatsCalculator.GROUPS_ORDER, "EUR,ALL");

        assertEquals(new LinkedHashSet<>(Arrays.asList("EUR", "ALL")), VariantAggregatedStatsCalculator.getCohorts(properties));
    }
    @Test
    public void getGenotype() {
        for (int i = 0; i < 11; i++) {
            Integer alleles[] = new Integer[2];
            VariantAggregatedStatsCalculator.getGenotype(i, alleles);
            System.out.println("alleles[" + i + "] = " + alleles[0] + "/" + alleles[1]);
        }

        Integer alleles[] = new Integer[2];
        VariantAggregatedStatsCalculator.getGenotype(0, alleles);    // 0/0
        assertEquals(alleles[0], alleles[1]);
        VariantAggregatedStatsCalculator.getGenotype(2, alleles);    // 1/1
        assertEquals(alleles[0], alleles[1]);
        VariantAggregatedStatsCalculator.getGenotype(5, alleles);    // 2/2
        assertEquals(alleles[0], alleles[1]);
        assertEquals(alleles[0], new Integer(2));
    }

}


text:
from testtools import matchers

from tempest.api.volume import base
from tempest import test

class VolumesV2MetadataTest(base.BaseVolumeTest):

    @classmethod
    def resource_setup(cls):
        super(VolumesV2MetadataTest, cls).resource_setup()
        # Create a volume
        cls.volume = cls.create_volume()
        cls.volume_id = cls.volume['id']

    def tearDown(self):
        # Update the metadata to {}
        self.volumes_client.update_volume_metadata(self.volume_id, {})
        super(VolumesV2MetadataTest, self).tearDown()

    @test.attr(type='gate')
    @test.idempotent_id('6f5b125b-f664-44bf-910f-751591fe5769')
    def test_create_get_delete_volume_metadata(self):
        # Create metadata for the volume
        metadata = {"key1": "value1",
                    "key2": "value2",
                    "key3": "value3",
                    "key4": "<value&special_chars>"}

        body = self.volumes_client.create_volume_metadata(self.volume_id,
                                                          metadata)
        # Get the metadata of the volume
        body = self.volumes_client.show_volume_metadata(self.volume_id)
        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
        # Delete one item metadata of the volume
        self.volumes_client.delete_volume_metadata_item(
            self.volume_id, "key1")
        body = self.volumes_client.show_volume_metadata(self.volume_id)
        self.assertNotIn("key1", body)
        del metadata["key1"]
        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))

    @test.attr(type='gate')
    @test.idempotent_id('774d2918-9beb-4f30-b3d1-2a4e8179ec0a')
    def test_update_volume_metadata(self):
        # Update metadata for the volume
        metadata = {"key1": "value1",
                    "key2": "value2",
                    "key3": "value3"}

        update = {"key4": "value4",
                  "key1": "value1_update"}

        # Create metadata for the volume
        body = self.volumes_client.create_volume_metadata(
            self.volume_id, metadata)
        # Get the metadata of the volume
        body = self.volumes_client.show_volume_metadata(self.volume_id)
        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
        # Update metadata
        body = self.volumes_client.update_volume_metadata(
            self.volume_id, update)
        # Get the metadata of the volume
        body = self.volumes_client.show_volume_metadata(self.volume_id)
        self.assertThat(body.items(), matchers.ContainsAll(update.items()))

    @test.attr(type='gate')
    @test.idempotent_id('862261c5-8df4-475a-8c21-946e50e36a20')
    def test_update_volume_metadata_item(self):
        # Update metadata item for the volume
        metadata = {"key1": "value1",
                    "key2": "value2",
                    "key3": "value3"}
        update_item = {"key3": "value3_update"}
        expect = {"key1": "value1",
                  "key2": "value2",
                  "key3": "value3_update"}
        # Create metadata for the volume
        body = self.volumes_client.create_volume_metadata(
            self.volume_id, metadata)
        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
        # Update metadata item
        body = self.volumes_client.update_volume_metadata_item(
            self.volume_id, "key3", update_item)
        # Get the metadata of the volume
        body = self.volumes_client.show_volume_metadata(self.volume_id)
        self.assertThat(body.items(), matchers.ContainsAll(expect.items()))

class VolumesV1MetadataTest(VolumesV2MetadataTest):
    _api_version = 1


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Id: hu.xml 699 2012-09-15 11:57:13Z namiltd $ -->
<!--
phpSysInfo language file Language: Hungary Created by: Bálint Kiss
-->
<tns:translation language="english" charset="utf-8"
 xmlns:tns="http://phpsysinfo.sourceforge.net/translation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://phpsysinfo.sourceforge.net/translation translation.xsd">
  <expression id="001" name="title">
    <exp>Rendszer információk</exp>
  </expression>
  <expression id="002" name="vitals">
    <exp>Alapvető információk</exp>
  </expression>
  <expression id="003" name="hostname">
    <exp>Hosztnév</exp>
  </expression>
  <expression id="004" name="ip">
    <exp>Figyelt IP</exp>
  </expression>
  <expression id="005" name="kversion">
    <exp>Kernel Verzió</exp>
  </expression>
  <expression id="006" name="dversion">
    <exp>Distro Név</exp>
  </expression>
  <expression id="007" name="uptime">
    <exp>Uptime</exp>
  </expression>
  <expression id="008" name="users">
    <exp>Jelenlegi Felhasználok</exp>
  </expression>
  <expression id="009" name="loadavg">
    <exp>Terheltség</exp>
  </expression>
  <expression id="010" name="hardware">
    <exp>Hardver Információk</exp>
  </expression>
  <expression id="011" name="numcpu">
    <exp>Processzorok</exp>
  </expression>
  <expression id="012" name="cpumodel">
    <exp>Model</exp>
  </expression>
  <expression id="013" name="cpuspeed">
    <exp>CPU Sebesség</exp>
  </expression>
  <expression id="014" name="busspeed">
    <exp>BUS Sebesség</exp>
  </expression>
  <expression id="015" name="cache">
    <exp>Cache Méret</exp>
  </expression>
  <expression id="016" name="bogomips">
    <exp>Rendszer Bogomips</exp>
  </expression>
  <expression id="017" name="pci">
    <exp>PCI Eszközök</exp>
  </expression>
  <expression id="018" name="ide">
    <exp>IDE Eszközök</exp>
  </expression>
  <expression id="019" name="scsi">
    <exp>SCSI Eszközök</exp>
  </expression>
  <expression id="020" name="usb">
    <exp>USB Eszközök</exp>
  </expression>
  <expression id="021" name="netusage">
    <exp>Hálózat Használat</exp>
  </expression>
  <expression id="022" name="device">
    <exp>Eszköz</exp>
  </expression>
  <expression id="023" name="received">
    <exp>Fogadott</exp>
  </expression>
  <expression id="024" name="sent">
    <exp>Küldött</exp>
  </expression>
  <expression id="025" name="errors">
    <exp>Hibás/Eldobott</exp>
  </expression>
  <expression id="026" name="connections">
    <exp>Hálózati Csatlakozások</exp>
  </expression>
  <expression id="027" name="memusage">
    <exp>Memória Használat</exp>
  </expression>
  <expression id="028" name="phymem">
    <exp>Fizikai Memória</exp>
  </expression>
  <expression id="029" name="swap">
    <exp>Lemez Swap</exp>
  </expression>
  <expression id="030" name="fs">
    <exp>Csatlakoztatott File Rendszerek </exp>
  </expression>
  <expression id="031" name="mount">
    <exp>Csatlakozási pont</exp>
  </expression>
  <expression id="032" name="partition">
    <exp>Partíció</exp>
  </expression>
  <expression id="033" name="percent">
    <exp>Használt</exp>
  </expression>
  <expression id="034" name="type">
    <exp>Típus</exp>
  </expression>
  <expression id="035" name="free">
    <exp>Szabad</exp>
  </expression>
  <expression id="036" name="used">
    <exp>Felhasznált</exp>
  </expression>
  <expression id="037" name="size">
    <exp>Méret</exp>
  </expression>
  <expression id="038" name="totals">
    <exp>Összes</exp>
  </expression>
  <expression id="039" name="kb">
    <exp>KB</exp>
  </expression>
  <expression id="040" name="mb">
    <exp>MB</exp>
  </expression>
  <expression id="041" name="gb">
    <exp>GB</exp>
  </expression>
  <expression id="042" name="none">
    <exp>nincs</exp>
  </expression>
  <expression id="043" name="capacity">
    <exp>Kapacitás</exp>
  </expression>
  <expression id="044" name="template">
    <exp>Sablon</exp>
  </expression>
  <expression id="045" name="language">
    <exp>Nyelv</exp>
  </expression>
  <expression id="046" name="submit">
    <exp>Rendben</exp>
  </expression>
  <expression id="047" name="created">
    <exp>Készítette:</exp>
  </expression>
  <expression id="048" name="days">
    <exp>nap</exp>
  </expression>
  <expression id="049" name="hours">
    <exp>óra</exp>
  </expression>
  <expression id="050" name="minutes">
    <exp>perc</exp>
  </expression>
  <expression id="051" name="temperature">
    <exp>Hőmérsékletek</exp>
  </expression>
  <expression id="052" name="voltage">
    <exp>Feszültségek</exp>
  </expression>
  <expression id="053" name="fans">
    <exp>Ventilátorok</exp>
  </expression>
  <expression id="054" name="s_value">
    <exp>Érték</exp>
  </expression>
  <expression id="055" name="s_min">
    <exp>Min</exp>
  </expression>
  <expression id="056" name="s_max">
    <exp>Max</exp>
  </expression>
  <expression id="057" name="hysteresis">
    <exp>Hiszterézis</exp>
  </expression>
  <expression id="058" name="s_limit">
    <exp>Limit</exp>
  </expression>
  <expression id="059" name="s_label">
    <exp>Címke</exp>
  </expression>
  <expression id="060" name="degreec">
    <exp>C</exp>
  </expression>
  <expression id="061" name="degreef">
    <exp>F</exp>
  </expression>
  <expression id="062" name="voltage_mark">
    <exp>V</exp>
  </expression>
  <expression id="063" name="rpm_mark">
    <exp>RPM</exp>
  </expression>
  <expression id="064" name="app">
    <exp>Kernel + Alkalmazások</exp>
  </expression>
  <expression id="065" name="buffers">
    <exp>Bufferek</exp>
  </expression>
  <expression id="066" name="cached">
    <exp>Cached</exp>
  </expression>
  <expression id="067" name="jumpto">
    <exp>Ugrás ide:</exp>
  </expression>
  <expression id="068" name="ups_title">
    <exp>UPS information</exp>
  </expression>
  <expression id="069" name="ups_name">
    <exp>Name</exp>
  </expression>
  <expression id="070" name="ups_model">
    <exp>Model</exp>
  </expression>
  <expression id="071" name="ups_mode">
    <exp>Mode</exp>
  </expression>
  <expression id="072" name="ups_start_time">
    <exp>Started</exp>
  </expression>
  <expression id="073" name="ups_status">
    <exp>Status</exp>
  </expression>
  <expression id="074" name="ups_outages_count">
    <exp>Outages</exp>
  </expression>
  <expression id="075" name="ups_last_outage">
    <exp>Last outage cause</exp>
  </expression>
  <expression id="076" name="ups_last_outage_finish">
    <exp>Last outage timestamp</exp>
  </expression>
  <expression id="077" name="ups_line_voltage">
    <exp>Line voltage</exp>
  </expression>
  <expression id="078" name="ups_load_percent">
    <exp>Load percent</exp>
  </expression>
  <expression id="079" name="ups_battery_voltage">
    <exp>Battery voltage</exp>
  </expression>
  <expression id="080" name="ups_battery_charge_percent">
    <exp>Battery charge</exp>
  </expression>
  <expression id="081" name="ups_time_left_minutes">
    <exp>Time left on batteries</exp>
  </expression>
  <expression id="082" name="ups_voltage_mark">
    <exp>V</exp>
  </expression>
  <expression id="083" name="ups_minutes_mark">
    <exp>minutes</exp>
  </expression>
  <expression id="084" name="ups_temperature">
    <exp>Temperature</exp>
  </expression>
  <expression id="085" name="tb">
    <exp>TB</exp>
  </expression>
  <expression id="086" name="tib">
    <exp>TiB</exp>
  </expression>
  <expression id="087" name="gib">
    <exp>GiB</exp>
  </expression>
  <expression id="088" name="mib">
    <exp>MiB</exp>
  </expression>
  <expression id="089" name="kib">
    <exp>KiB</exp>
  </expression>
  <expression id="090" name="pib">
    <exp>PiB</exp>
  </expression>
  <expression id="091" name="pb">
    <exp>PB</exp>
  </expression>
  <expression id="092" name="mhz">
    <exp>MHz</exp>
  </expression>
  <expression id="093" name="ghz">
    <exp>GHz</exp>
  </expression>
  <expression id="094" name="virtualization">
    <exp>Virtualization</exp>
  </expression>
  <expression id="095" name="lastboot">
    <exp>Last boot</exp>
  </expression>
  <expression id="096" name="bytes">
    <exp>B</exp>
  </expression>
  <expression id="097" name="syslang">
    <exp>System Language</exp>
  </expression>
  <expression id="098" name="codepage">
    <exp>Code Page</exp>
  </expression>
  <expression id="099" name="details">
    <exp>Details</exp>
  </expression>
  <expression id="100" name="cpuspeedMax">
    <exp>CPU Speed Max</exp>
  </expression>
  <expression id="101" name="cpuspeedMin">
    <exp>CPU Speed Min</exp>
  </expression>
  <expression id="102" name="power">
    <exp>Power</exp>
  </expression>
  <expression id="103" name="power_mark">
    <exp>W</exp>
  </expression>
  <expression id="104" name="ups_battery_date">
    <exp>Battery date</exp>
  </expression>
</tns:translation>


text:
package com.epam.imageloader;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

class FileCache {
    private static final String DIR_CACHE_NAME = "_cache_images";

    private long mSize;
    private long mMaxSize;
    private File mCacheDir;

    /**
     * Currently maxSize feature not implemented
     *
     * @param context The app Context
     * @param maxSize Max cache size in MB, less than 1 means infinite
     */
    FileCache(@NonNull Context context, int maxSize) {
        File appCacheDir = context.getCacheDir();
        if (null != appCacheDir) {
            mCacheDir = new File(appCacheDir, DIR_CACHE_NAME);
            if (null != mCacheDir && false == mCacheDir.exists()) {
                mCacheDir.mkdirs();
            }
        }

        mMaxSize = maxSize * 1024 * 1024; // MB to bytes
        if (mMaxSize <= 0) {
            mSize = mMaxSize = 0;
        } else {
            mSize = calcCacheDirSize();
        }
    }

    @Nullable
    File add(@NonNull InputStream is, @NonNull String fileName) throws IOException {
        if (null == fileName) {
            throw new NullPointerException("key == null");
        }

        if (null == is) {
            throw new NullPointerException("is == null");
        }

        OutputStream os = null;

        synchronized (this) {
            final File imageFile = getCacheFile(fileName);
            if (null == imageFile) {
                return null;
            }

            try {
                os = new FileOutputStream(imageFile);
                StreamUtils.copyStream(is, os);
            } finally {
                if (null != os) {
                    os.close();
                }
            }

            mSize += sizeOf(imageFile);
            trimCacheSize();
            return imageFile;
        }
    }

    @Nullable
    File get(@NonNull String fileName) {
        if (null == fileName) {
            throw new NullPointerException("key == null");
        }

        synchronized (this) {
            File file = getCacheFile(fileName);
            if (null == file || false == file.exists()) {
                return null;
            }

            return file;
        }
    }

    void remove(@NonNull String fileName) {
        if (null == fileName) {
            throw new NullPointerException("key == null");
        }

        synchronized (this) {
            final File file = getCacheFile(fileName);
            if (null != file) {
                long size = sizeOf(file);
                boolean success = file.delete();
                if (true == success) {
                    mSize -= size;
                }
            }
        }
    }

    void clear() {
        String[] fileNames = mCacheDir.list();
        if (null == fileNames) {
            return;
        }

        for (int i = 0; i < fileNames.length; i++) {
            remove(fileNames[i]);
        }
    }

    private File getCacheFile(@NonNull String fileName) {
        return new File(mCacheDir, fileName);
    }

    private long calcCacheDirSize() {
        if (null == mCacheDir) {
            return 0L;
        }

        File[] files = mCacheDir.listFiles();
        if (null == files) {
            return 0L;
        }

        long size = 0L;
        for (int i = 0; i < files.length; i++) {
            size += sizeOf(files[i]);
        }

        return size;
    }

    private long sizeOf(File file) {
        if (null == file || false == file.isFile()) {
            return 0L;
        }

        return file.length();
    }

    private void trimCacheSize() {
        //todo
    }
}


text:
set -ex

# default language level: c++03
if [[ -z "$CXXSTD" ]]; then
    CXXSTD=03
fi

$BOOST_ROOT/b2 . toolset=$TOOLSET cxxstd=$CXXSTD $CXXFLAGS $DEFINES $LINKFLAGS $TESTFLAGS $B2_ADDRESS_MODEL $B2_LINK $B2_THREADING $B2_VARIANT -j3 $*


text:
package dfa.analyses.testanalyses;

import dfa.framework.DFADirection;
import dfa.framework.DFAFactory;
import dfa.framework.DataFlowAnalysis;
import dfa.framework.SimpleBlockGraph;

/**
 * Dummy factory for slow analyses.
 *
 * @author Sebastian Rauch
 */
public class SlowDummyFactory extends DFAFactory<DummyElement>{

    private int waitTime = 500;

    @Override
    public String getName() {
        return "Slow Dummy Analysis";
    }

    @Override
    public DFADirection getDirection() {
        return DFADirection.FORWARD;
    }

    @Override
    public DataFlowAnalysis<DummyElement> getAnalysis(SimpleBlockGraph blockGraph) {
        return new SlowDummyAnalysis(blockGraph, waitTime);
    }

}


text:
package play.learn.java.design.api_gateway;

//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;

//@SpringBootApplication
public class ImageApplication {
	public static void main(String[] args) {
		//SpringApplication.run(ImageApplication.class, args);
	}
}


text:
#region Using Statements

using Jitter.LinearMath;
using SharpDX;

#endregion

namespace Jitter.Collision
{

    /// <summary>
    /// GJK based implementation of Raycasting.
    /// </summary>
    public sealed class GJKCollide
    {
        private const int MaxIterations = 15;

        private static readonly ResourcePool<VoronoiSimplexSolver> SimplexSolverPool = new ResourcePool<VoronoiSimplexSolver>();

        private static void SupportMapTransformed(ISupportMappable support, ref Matrix3x3 orientation, ref Vector3 position, ref Vector3 direction, out Vector3 result)
        {
            //JVector.Transform(ref direction, ref invOrientation, out result);
            //support.SupportMapping(ref result, out result);
            //JVector.Transform(ref result, ref orientation, out result);
            //JVector.Add(ref result, ref position, out result);

            result.X = ((direction.X * orientation.M11) + (direction.Y * orientation.M12)) + (direction.Z * orientation.M13);
            result.Y = ((direction.X * orientation.M21) + (direction.Y * orientation.M22)) + (direction.Z * orientation.M23);
            result.Z = ((direction.X * orientation.M31) + (direction.Y * orientation.M32)) + (direction.Z * orientation.M33);

            support.SupportMapping(ref result, out result);

            float x = ((result.X * orientation.M11) + (result.Y * orientation.M21)) + (result.Z * orientation.M31);
            float y = ((result.X * orientation.M12) + (result.Y * orientation.M22)) + (result.Z * orientation.M32);
            float z = ((result.X * orientation.M13) + (result.Y * orientation.M23)) + (result.Z * orientation.M33);

            result.X = position.X + x;
            result.Y = position.Y + y;
            result.Z = position.Z + z;
        }

        /// <summary>
        /// Checks if given point is within a shape.
        /// </summary>
        /// <param name="support">The supportmap implementation representing the shape.</param>
        /// <param name="orientation">The orientation of the shape.</param>
        /// <param name="invOrientation">The inverse orientation of the shape.</param>
        /// <param name="position">The position of the shape.</param>
        /// <param name="point">The point to check.</param>
        /// <returns>Returns true if the point is within the shape, otherwise false.</returns>
        public static bool Pointcast(ISupportMappable support, ref Matrix3x3 orientation,ref Vector3 position,ref Vector3 point)
        {
            Vector3 arbitraryPoint;

            SupportMapTransformed(support, ref orientation, ref position, ref point, out arbitraryPoint);
            Vector3.Subtract(ref point, ref arbitraryPoint, out arbitraryPoint);

            Vector3 r; support.SupportCenter(out r);
            Vector3.Transform(ref r, ref orientation, out r);
            Vector3.Add(ref position, ref r, out r);
            Vector3.Subtract(ref point, ref r, out r);

            Vector3 x = point;
            Vector3 w, p;
            float VdotR;

            Vector3 v; Vector3.Subtract(ref x, ref arbitraryPoint, out v);
            float dist = v.LengthSquared();
            float epsilon = 0.0001f;

            int maxIter = MaxIterations;

            VoronoiSimplexSolver simplexSolver = SimplexSolverPool.GetNew();

            simplexSolver.Reset();

            while ((dist > epsilon) && (maxIter-- != 0))
            {
                SupportMapTransformed(support, ref orientation, ref position, ref v, out p);
                Vector3.Subtract(ref x, ref p, out w);

                float VdotW;
                Vector3.Dot(ref v, ref w, out VdotW);

                if (VdotW > 0.0f)
                {
                    Vector3.Dot(ref v, ref r, out VdotR);

                    if (VdotR >= -(JMath.Epsilon * JMath.Epsilon)) { SimplexSolverPool.GiveBack(simplexSolver); return false; }
                    else simplexSolver.Reset();
                }
                if (!simplexSolver.InSimplex(w)) simplexSolver.AddVertex(w, x, p);

                if (simplexSolver.Closest(out v)) dist = v.LengthSquared();
                else dist = 0.0f;
            }

            SimplexSolverPool.GiveBack(simplexSolver);
            return true;

        }

        public static bool ClosestPoints(ISupportMappable support1, ISupportMappable support2, ref Matrix3x3 orientation1, ref Matrix3x3 orientation2, ref Vector3 position1, ref Vector3 position2, out Vector3 p1, out Vector3 p2, out Vector3 normal)
        {

            VoronoiSimplexSolver simplexSolver = SimplexSolverPool.GetNew();
            simplexSolver.Reset();

            p1 = p2 = Vector3.Zero;

            var r = position1 - position2;
            Vector3 w, v;

            Vector3 supVertexA;
            Vector3 rn,vn;

            rn = Vector3.Negate(r);

            SupportMapTransformed(support1, ref orientation1, ref position1, ref rn, out supVertexA);

            Vector3 supVertexB;
            SupportMapTransformed(support2, ref orientation2, ref position2, ref r, out supVertexB);

            v = supVertexA - supVertexB;

            normal = Vector3.Zero;

            int maxIter = 15;

            float distSq = v.LengthSquared();
            float epsilon = 0.00001f;

            while ((distSq > epsilon) && (maxIter-- != 0))
            {
                vn = Vector3.Negate(v);
                SupportMapTransformed(support1, ref orientation1, ref position1, ref vn, out supVertexA);
                SupportMapTransformed(support2, ref orientation2, ref position2, ref v, out supVertexB);
                w = supVertexA - supVertexB;

                if (!simplexSolver.InSimplex(w)) simplexSolver.AddVertex(w, supVertexA, supVertexB);
                if (simplexSolver.Closest(out v))
                {
                    distSq = v.LengthSquared();
                    normal = v;
                }
                else distSq = 0.0f;
            }

            simplexSolver.ComputePoints(out p1, out p2);

            if (normal.LengthSquared() > JMath.Epsilon * JMath.Epsilon)
                normal.Normalize();

            SimplexSolverPool.GiveBack(simplexSolver);

            return true;

        }

        #region TimeOfImpact Conservative Advancement - Depricated
    //    public static bool TimeOfImpact(ISupportMappable support1, ISupportMappable support2, ref JMatrix orientation1,
    //ref JMatrix orientation2, ref JVector position1, ref JVector position2, ref JVector sweptA, ref JVector sweptB,
    //out JVector p1, out JVector p2, out JVector normal)
    //    {

    //        VoronoiSimplexSolver simplexSolver = simplexSolverPool.GetNew();
    //        simplexSolver.Reset();

    //        float lambda = 0.0f;

    //        p1 = p2 = JVector.Zero;

    //        JVector x1 = position1;
    //        JVector x2 = position2;

    //        JVector r = sweptA - sweptB;
    //        JVector w, v;

    //        JVector supVertexA;
    //        JVector rn = JVector.Negate(r);
    //        SupportMapTransformed(support1, ref orientation1, ref x1, ref rn, out supVertexA);

    //        JVector supVertexB;
    //        SupportMapTransformed(support2, ref orientation2, ref x2, ref r, out supVertexB);

    //        v = supVertexA - supVertexB;

    //        bool hasResult = false;

    //        normal = JVector.Zero;

    //        float lastLambda = lambda;

    //        int maxIter = MaxIterations;

    //        float distSq = v.LengthSquared();
    //        float epsilon = 0.00001f;

    //        float VdotR;

    //        while ((distSq > epsilon) && (maxIter-- != 0))
    //        {

    //            JVector vn = JVector.Negate(v);
    //            SupportMapTransformed(support1, ref orientation1, ref x1, ref vn, out supVertexA);
    //            SupportMapTransformed(support2, ref orientation2, ref x2, ref v, out supVertexB);
    //            w = supVertexA - supVertexB;

    //            float VdotW = JVector.Dot(ref v, ref w);

    //            if (VdotW > 0.0f)
    //            {
    //                VdotR = JVector.Dot(ref v, ref r);

    //                if (VdotR >= -JMath.Epsilon)
    //                {
    //                    simplexSolverPool.GiveBack(simplexSolver);
    //                    return false;
    //                }
    //                else
    //                {
    //                    lambda = lambda - VdotW / VdotR;

    //                    x1 = position1 + lambda * sweptA;
    //                    x2 = position2 + lambda * sweptB;

    //                    w = supVertexA - supVertexB;

    //                    normal = v;
    //                    hasResult = true;
    //                }
    //            }
    //            if (!simplexSolver.InSimplex(w)) simplexSolver.AddVertex(w, supVertexA, supVertexB);
    //            if (simplexSolver.Closest(out v))
    //            {
    //                distSq = v.LengthSquared();
    //                normal = v;
    //                hasResult = true;
    //            }
    //            else distSq = 0.0f;
    //        }

    //        simplexSolver.ComputePoints(out p1, out p2);

    //        if (normal.LengthSquared() > JMath.Epsilon * JMath.Epsilon)
    //            normal.Normalize();

    //        p1 = p1 - lambda * sweptA;
    //        p2 = p2 - lambda * sweptB;

    //        simplexSolverPool.GiveBack(simplexSolver);

    //        return true;

    //    }
        #endregion

        // see: btSubSimplexConvexCast.cpp

        /// <summary>
        /// Checks if a ray definied through it's origin and direction collides
        /// with a shape.
        /// </summary>
        /// <param name="support">The supportmap implementation representing the shape.</param>
        /// <param name="orientation">The orientation of the shape.</param>
        /// <param name="invOrientation">The inverse orientation of the shape.</param>
        /// <param name="position">The position of the shape.</param>
        /// <param name="origin">The origin of the ray.</param>
        /// <param name="direction">The direction of the ray.</param>
        /// <param name="fraction">The fraction which gives information where at the
        /// ray the collision occured. The hitPoint is calculated by: origin+friction*direction.</param>
        /// <param name="normal">The normal from the ray collision.</param>
        /// <returns>Returns true if the ray hit the shape, false otherwise.</returns>
        public static bool Raycast(ISupportMappable support, ref Matrix3x3 orientation, ref Matrix3x3 invOrientation, ref Vector3 position,ref Vector3 origin,ref Vector3 direction, out float fraction, out Vector3 normal)
        {
            VoronoiSimplexSolver simplexSolver = SimplexSolverPool.GetNew();
            simplexSolver.Reset();

            normal = Vector3.Zero;
            fraction = float.MaxValue;

            float lambda = 0.0f;

            var r = direction;
            var x = origin;
            Vector3 w, p, v;

            Vector3 arbitraryPoint;
            SupportMapTransformed(support, ref orientation, ref position, ref r, out arbitraryPoint);
            Vector3.Subtract(ref x, ref arbitraryPoint, out v);

            int maxIter = MaxIterations;

            float distSq = v.LengthSquared();
            float epsilon = 0.000001f;

            float VdotR;

            while ((distSq > epsilon) && (maxIter-- != 0))
            {
                SupportMapTransformed(support, ref orientation, ref position, ref v, out p);
                Vector3.Subtract(ref x, ref p, out w);

                float VdotW;
                Vector3.Dot(ref v, ref w, out VdotW);

                if (VdotW > 0.0f)
                {
                    Vector3.Dot(ref v, ref r, out VdotR);

                    if (VdotR >= -JMath.Epsilon)
                    {
                        SimplexSolverPool.GiveBack(simplexSolver);
                        return false;
                    }
                    else
                    {
                        lambda = lambda - VdotW / VdotR;
                        Vector3.Multiply(ref r, lambda, out x);
                        Vector3.Add(ref origin, ref x, out x);
                        Vector3.Subtract(ref x, ref p, out w);
                        normal = v;
                    }
                }
                if (!simplexSolver.InSimplex(w)) simplexSolver.AddVertex(w, x, p);
                if (simplexSolver.Closest(out v)) { distSq = v.LengthSquared();  }
                else distSq = 0.0f;
            }

            #region Retrieving hitPoint

            // Giving back the fraction like this *should* work
            // but is inaccurate against large objects:
            // fraction = lambda;

            Vector3 p1, p2;
            simplexSolver.ComputePoints(out p1, out p2);

            p2 = p2 - origin;
            fraction = p2.Length() / direction.Length();

            #endregion

            if (normal.LengthSquared() > JMath.Epsilon * JMath.Epsilon)
                normal.Normalize();

            SimplexSolverPool.GiveBack(simplexSolver);

            return true;
        }

        // see: btVoronoiSimplexSolver.cpp
        #region private class VoronoiSimplexSolver - Bullet

        // Bullet has problems with raycasting large objects - so does jitter
        // hope to fix that in the next versions.

        /*
          Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru
          Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com

          This software is provided 'as-is', without any express or implied
          warranty.  In no event will the authors be held liable for any damages
          arising from the use of this software.

          Permission is granted to anyone to use this software for any purpose,
          including commercial applications, and to alter it and redistribute it
          freely, subject to the following restrictions:

          1. The origin of this software must not be misrepresented; you must not
             claim that you wrote the original software. If you use this software
             in a product, an acknowledgment in the product documentation would be
             appreciated but is not required.
          2. Altered source versions must be plainly marked as such, and must not be
             misrepresented as being the original software.
          3. This notice may not be removed or altered from any source distribution.
        */

        private class UsageBitfield
        {
            private bool _usedVertexA, _usedVertexB, _usedVertexC, _usedVertexD;

            public bool UsedVertexA { get { return _usedVertexA; } set { _usedVertexA = value; } }
            public bool UsedVertexB { get { return _usedVertexB; } set { _usedVertexB = value; } }
            public bool UsedVertexC { get { return _usedVertexC; } set { _usedVertexC = value; } }
            public bool UsedVertexD { get { return _usedVertexD; } set { _usedVertexD = value; } }

            public void Reset()
            {
                _usedVertexA = _usedVertexB = _usedVertexC = _usedVertexD = false;
            }
        }

        private class SubSimplexClosestResult
        {
            private Vector3 _closestPointOnSimplex;

            //MASK for m_usedVertices
            //stores the simplex vertex-usage, using the MASK,
            // if m_usedVertices & MASK then the related vertex is used
            private UsageBitfield _usedVertices = new UsageBitfield();
            private float[] _barycentricCoords = new float[4];
            private bool _degenerate;

            public Vector3 ClosestPointOnSimplex { get { return _closestPointOnSimplex; } set { _closestPointOnSimplex = value; } }
            public UsageBitfield UsedVertices { get { return _usedVertices; } set { _usedVertices = value; } }
            public float[] BarycentricCoords { get { return _barycentricCoords; } set { _barycentricCoords = value; } }
            public bool Degenerate { get { return _degenerate; } set { _degenerate = value; } }

            public void Reset()
            {
                _degenerate = false;
                SetBarycentricCoordinates();
                _usedVertices.Reset();
            }

            public bool IsValid
            {
                get
                {
                    return (_barycentricCoords[0] >= 0f) &&
                            (_barycentricCoords[1] >= 0f) &&
                            (_barycentricCoords[2] >= 0f) &&
                            (_barycentricCoords[3] >= 0f);
                }
            }

            public void SetBarycentricCoordinates()
            {
                SetBarycentricCoordinates(0f, 0f, 0f, 0f);
            }

            public void SetBarycentricCoordinates(float a, float b, float c, float d)
            {
                _barycentricCoords[0] = a;
                _barycentricCoords[1] = b;
                _barycentricCoords[2] = c;
                _barycentricCoords[3] = d;
            }
        }

        /// VoronoiSimplexSolver is an implementation of the closest point distance
        /// algorithm from a 1-4 points simplex to the origin.
        /// Can be used with GJK, as an alternative to Johnson distance algorithm.
        private class VoronoiSimplexSolver
        {
            private const int VertexA = 0, VertexB = 1, VertexC = 2, VertexD = 3;

            private const int VoronoiSimplexMaxVerts = 5;
            private const bool CatchDegenerateTetrahedron = true;

            private int _numVertices;

            private readonly Vector3[] _simplexVectorW = new Vector3[VoronoiSimplexMaxVerts];
            private readonly Vector3[] _simplexPointsP = new Vector3[VoronoiSimplexMaxVerts];
            private readonly Vector3[] _simplexPointsQ = new Vector3[VoronoiSimplexMaxVerts];

            private Vector3 _cachedPA;
            private Vector3 _cachedPB;
            private Vector3 _cachedV;
            private Vector3 _lastW;
            private bool _cachedValidClosest;

            private SubSimplexClosestResult _cachedBC = new SubSimplexClosestResult();

            // Note that this assumes ray-casts and point-casts will always be called from the
            // same thread which I assume is true from the _cachedBC member
            // If this needs to made multi-threaded a resource pool will be needed
            private SubSimplexClosestResult tempResult = new SubSimplexClosestResult();

            private bool _needsUpdate;

            #region ISimplexSolver Members

            public bool FullSimplex
            {
                get
                {
                    return _numVertices == 4;
                }
            }

            public int NumVertices
            {
                get
                {
                    return _numVertices;
                }
            }

            public void Reset()
            {
                _cachedValidClosest = false;
                _numVertices = 0;
                _needsUpdate = true;
                _lastW = new Vector3(1e30f, 1e30f, 1e30f);
                _cachedBC.Reset();
            }

            public void AddVertex(Vector3 w, Vector3 p, Vector3 q)
            {
                _lastW = w;
                _needsUpdate = true;

                _simplexVectorW[_numVertices] = w;
                _simplexPointsP[_numVertices] = p;
                _simplexPointsQ[_numVertices] = q;

                _numVertices++;
            }

            //return/calculate the closest vertex
            public bool Closest(out Vector3 v)
            {
                bool succes = UpdateClosestVectorAndPoints();
                v = _cachedV;
                return succes;
            }

            public float MaxVertex
            {
                get
                {
                    int numverts = NumVertices;
                    float maxV = 0f, curLen2;
                    for (int i = 0; i < numverts; i++)
                    {
                        curLen2 = _simplexVectorW[i].LengthSquared();
                        if (maxV < curLen2) maxV = curLen2;
                    }
                    return maxV;
                }
            }

            //return the current simplex
            public int GetSimplex(out Vector3[] pBuf, out Vector3[] qBuf, out Vector3[] yBuf)
            {
                int numverts = NumVertices;
                pBuf = new Vector3[numverts];
                qBuf = new Vector3[numverts];
                yBuf = new Vector3[numverts];
                for (int i = 0; i < numverts; i++)
                {
                    yBuf[i] = _simplexVectorW[i];
                    pBuf[i] = _simplexPointsP[i];
                    qBuf[i] = _simplexPointsQ[i];
                }
                return numverts;
            }

            public bool InSimplex(Vector3 w)
            {
                //check in case lastW is already removed
                if (w == _lastW) return true;

                //w is in the current (reduced) simplex
                int numverts = NumVertices;
                for (int i = 0; i < numverts; i++)
                    if (_simplexVectorW[i] == w) return true;

                return false;
            }

            public void BackupClosest(out Vector3 v)
            {
                v = _cachedV;
            }

            public bool EmptySimplex
            {
                get
                {
                    return NumVertices == 0;
                }
            }

            public void ComputePoints(out Vector3 p1, out Vector3 p2)
            {
                UpdateClosestVectorAndPoints();
                p1 = _cachedPA;
                p2 = _cachedPB;
            }

            #endregion

            public void RemoveVertex(int index)
            {
                 _numVertices--;
                _simplexVectorW[index] = _simplexVectorW[_numVertices];
                _simplexPointsP[index] = _simplexPointsP[_numVertices];
                _simplexPointsQ[index] = _simplexPointsQ[_numVertices];
            }

            public void ReduceVertices(UsageBitfield usedVerts)
            {
                if ((NumVertices >= 4) && (!usedVerts.UsedVertexD)) RemoveVertex(3);
                if ((NumVertices >= 3) && (!usedVerts.UsedVertexC)) RemoveVertex(2);
                if ((NumVertices >= 2) && (!usedVerts.UsedVertexB)) RemoveVertex(1);
                if ((NumVertices >= 1) && (!usedVerts.UsedVertexA)) RemoveVertex(0);
            }

            public bool UpdateClosestVectorAndPoints()
            {
                if (_needsUpdate)
                {
                    _cachedBC.Reset();
                    _needsUpdate = false;

                    Vector3 p, a, b, c, d;
                    switch (NumVertices)
                    {
                        case 0:
                            _cachedValidClosest = false;
                            break;
                        case 1:
                            _cachedPA = _simplexPointsP[0];
                            _cachedPB = _simplexPointsQ[0];
                            _cachedV = _cachedPA - _cachedPB;
                            _cachedBC.Reset();
                            _cachedBC.SetBarycentricCoordinates(1f, 0f, 0f, 0f);
                            _cachedValidClosest = _cachedBC.IsValid;
                            break;
                        case 2:
                            //closest point origin from line segment
                            Vector3 from = _simplexVectorW[0];
                            Vector3 to = _simplexVectorW[1];
                            Vector3 nearest;

                            Vector3 diff = from * (-1);
                            Vector3 v = to - from;
                            float t = Vector3.Dot(v, diff);

                            if (t > 0)
                            {
                                float dotVV = v.LengthSquared();
                                if (t < dotVV)
                                {
                                    t /= dotVV;
                                    diff -= t * v;
                                    _cachedBC.UsedVertices.UsedVertexA = true;
                                    _cachedBC.UsedVertices.UsedVertexB = true;
                                }
                                else
                                {
                                    t = 1;
                                    diff -= v;
                                    //reduce to 1 point
                                    _cachedBC.UsedVertices.UsedVertexB = true;
                                }
                            }
                            else
                            {
                                t = 0;
                                //reduce to 1 point
                                _cachedBC.UsedVertices.UsedVertexA = true;
                            }

                            _cachedBC.SetBarycentricCoordinates(1 - t, t, 0, 0);
                            nearest = from + t * v;

                            _cachedPA = _simplexPointsP[0] + t * (_simplexPointsP[1] - _simplexPointsP[0]);
                            _cachedPB = _simplexPointsQ[0] + t * (_simplexPointsQ[1] - _simplexPointsQ[0]);
                            _cachedV = _cachedPA - _cachedPB;

                            ReduceVertices(_cachedBC.UsedVertices);

                            _cachedValidClosest = _cachedBC.IsValid;
                            break;
                        case 3:
                            //closest point origin from triangle
                            p = new Vector3();
                            a = _simplexVectorW[0];
                            b = _simplexVectorW[1];
                            c = _simplexVectorW[2];

                            ClosestPtPointTriangle(p, a, b, c, ref _cachedBC);
                            _cachedPA = _simplexPointsP[0] * _cachedBC.BarycentricCoords[0] +
                                            _simplexPointsP[1] * _cachedBC.BarycentricCoords[1] +
                                            _simplexPointsP[2] * _cachedBC.BarycentricCoords[2] +
                                            _simplexPointsP[3] * _cachedBC.BarycentricCoords[3];

                            _cachedPB = _simplexPointsQ[0] * _cachedBC.BarycentricCoords[0] +
                                            _simplexPointsQ[1] * _cachedBC.BarycentricCoords[1] +
                                            _simplexPointsQ[2] * _cachedBC.BarycentricCoords[2]+
                                            _simplexPointsQ[3] * _cachedBC.BarycentricCoords[3];

                            _cachedV = _cachedPA - _cachedPB;

                            ReduceVertices(_cachedBC.UsedVertices);
                            _cachedValidClosest = _cachedBC.IsValid;
                            break;
                        case 4:
                            p = new Vector3();
                            a = _simplexVectorW[0];
                            b = _simplexVectorW[1];
                            c = _simplexVectorW[2];
                            d = _simplexVectorW[3];

                            bool hasSeperation = ClosestPtPointTetrahedron(p, a, b, c, d, ref _cachedBC);

                            if (hasSeperation)
                            {
                                _cachedPA = _simplexPointsP[0] * _cachedBC.BarycentricCoords[0] +
                                                _simplexPointsP[1] * _cachedBC.BarycentricCoords[1] +
                                                _simplexPointsP[2] * _cachedBC.BarycentricCoords[2] +
                                                _simplexPointsP[3] * _cachedBC.BarycentricCoords[3];

                                _cachedPB = _simplexPointsQ[0] * _cachedBC.BarycentricCoords[0] +
                                                _simplexPointsQ[1] * _cachedBC.BarycentricCoords[1] +
                                                _simplexPointsQ[2] * _cachedBC.BarycentricCoords[2] +
                                                _simplexPointsQ[3] * _cachedBC.BarycentricCoords[3];

                                _cachedV = _cachedPA - _cachedPB;
                                ReduceVertices(_cachedBC.UsedVertices);
                            }
                            else
                            {
                                if (_cachedBC.Degenerate)
                                {
                                    _cachedValidClosest = false;
                                }
                                else
                                {
                                    _cachedValidClosest = true;
                                    //degenerate case == false, penetration = true + zero
                                    _cachedV.X = _cachedV.Y = _cachedV.Z = 0f;
                                }
                                break; // !!!!!!!!!!!! proverit na vsakiy sluchai
                            }

                            _cachedValidClosest = _cachedBC.IsValid;

                            //closest point origin from tetrahedron
                            break;
                        default:
                            _cachedValidClosest = false;
                            break;
                    }
                }

                return _cachedValidClosest;
            }

            public bool ClosestPtPointTriangle(Vector3 p, Vector3 a, Vector3 b, Vector3 c,
                ref SubSimplexClosestResult result)
            {
                result.UsedVertices.Reset();

                float v, w;

                // Check if P in vertex region outside A
                var ab = b - a;
                var ac = c - a;
                var ap = p - a;
                float d1 = Vector3.Dot(ab, ap);
                float d2 = Vector3.Dot(ac, ap);
                if (d1 <= 0f && d2 <= 0f)
                {
                    result.ClosestPointOnSimplex = a;
                    result.UsedVertices.UsedVertexA = true;
                    result.SetBarycentricCoordinates(1, 0, 0, 0);
                    return true; // a; // barycentric coordinates (1,0,0)
                }

                // Check if P in vertex region outside B
                var bp = p - b;
                float d3 = Vector3.Dot(ab, bp);
                float d4 = Vector3.Dot(ac, bp);
                if (d3 >= 0f && d4 <= d3)
                {
                    result.ClosestPointOnSimplex = b;
                    result.UsedVertices.UsedVertexB = true;
                    result.SetBarycentricCoordinates(0, 1, 0, 0);

                    return true; // b; // barycentric coordinates (0,1,0)
                }
                // Check if P in edge region of AB, if so return projection of P onto AB
                float vc = d1 * d4 - d3 * d2;
                if (vc <= 0f && d1 >= 0f && d3 <= 0f)
                {
                    v = d1 / (d1 - d3);
                    result.ClosestPointOnSimplex = a + v * ab;
                    result.UsedVertices.UsedVertexA = true;
                    result.UsedVertices.UsedVertexB = true;
                    result.SetBarycentricCoordinates(1 - v, v, 0, 0);
                    return true;
                    //return a + v * ab; // barycentric coordinates (1-v,v,0)
                }

                // Check if P in vertex region outside C
                Vector3 cp = p - c;
                float d5 = Vector3.Dot(ab, cp);
                float d6 = Vector3.Dot(ac, cp);
                if (d6 >= 0f && d5 <= d6)
                {
                    result.ClosestPointOnSimplex = c;
                    result.UsedVertices.UsedVertexC = true;
                    result.SetBarycentricCoordinates(0, 0, 1, 0);
                    return true;//c; // barycentric coordinates (0,0,1)
                }

                // Check if P in edge region of AC, if so return projection of P onto AC
                float vb = d5 * d2 - d1 * d6;
                if (vb <= 0f && d2 >= 0f && d6 <= 0f)
                {
                    w = d2 / (d2 - d6);
                    result.ClosestPointOnSimplex = a + w * ac;
                    result.UsedVertices.UsedVertexA = true;
                    result.UsedVertices.UsedVertexC = true;
                    result.SetBarycentricCoordinates(1 - w, 0, w, 0);
                    return true;
                    //return a + w * ac; // barycentric coordinates (1-w,0,w)
                }

                // Check if P in edge region of BC, if so return projection of P onto BC
                float va = d3 * d6 - d5 * d4;
                if (va <= 0f && (d4 - d3) >= 0f && (d5 - d6) >= 0f)
                {
                    w = (d4 - d3) / ((d4 - d3) + (d5 - d6));

                    result.ClosestPointOnSimplex = b + w * (c - b);
                    result.UsedVertices.UsedVertexB = true;
                    result.UsedVertices.UsedVertexC = true;
                    result.SetBarycentricCoordinates(0, 1 - w, w, 0);
                    return true;
                    // return b + w * (c - b); // barycentric coordinates (0,1-w,w)
                }

                // P inside face region. Compute Q through its barycentric coordinates (u,v,w)
                float denom = 1.0f / (va + vb + vc);
                v = vb * denom;
                w = vc * denom;

                result.ClosestPointOnSimplex = a + ab * v + ac * w;
                result.UsedVertices.UsedVertexA = true;
                result.UsedVertices.UsedVertexB = true;
                result.UsedVertices.UsedVertexC = true;
                result.SetBarycentricCoordinates(1 - v - w, v, w, 0);

                return true;
            }

            /// Test if point p and d lie on opposite sides of plane through abc
            public int PointOutsideOfPlane(Vector3 p, Vector3 a, Vector3 b, Vector3 c, Vector3 d)
            {
                var normal = Vector3.Cross(b - a, c - a);

                float signp = Vector3.Dot(p - a, normal); // [AP AB AC]
                float signd = Vector3.Dot(d - a, normal); // [AD AB AC]

                //if (CatchDegenerateTetrahedron)
                    if (signd * signd < (1e-4f * 1e-4f)) return -1;

                // Points on opposite sides if expression signs are opposite
                return signp * signd < 0f ? 1 : 0;
            }

            public bool ClosestPtPointTetrahedron(Vector3 p, Vector3 a, Vector3 b, Vector3 c, Vector3 d, ref SubSimplexClosestResult finalResult)
            {
                tempResult.Reset();

                // Start out assuming point inside all halfspaces, so closest to itself
                finalResult.ClosestPointOnSimplex = p;
                finalResult.UsedVertices.Reset();
                finalResult.UsedVertices.UsedVertexA = true;
                finalResult.UsedVertices.UsedVertexB = true;
                finalResult.UsedVertices.UsedVertexC = true;
                finalResult.UsedVertices.UsedVertexD = true;

                int pointOutsideABC = PointOutsideOfPlane(p, a, b, c, d);
                int pointOutsideACD = PointOutsideOfPlane(p, a, c, d, b);
                int pointOutsideADB = PointOutsideOfPlane(p, a, d, b, c);
                int pointOutsideBDC = PointOutsideOfPlane(p, b, d, c, a);

                if (pointOutsideABC < 0 || pointOutsideACD < 0 || pointOutsideADB < 0 || pointOutsideBDC < 0)
                {
                    finalResult.Degenerate = true;
                    return false;
                }

                if (pointOutsideABC == 0 && pointOutsideACD == 0 && pointOutsideADB == 0 && pointOutsideBDC == 0)
                    return false;

                float bestSqDist = float.MaxValue;
                // If point outside face abc then compute closest point on abc
                if (pointOutsideABC != 0)
                {
                    ClosestPtPointTriangle(p, a, b, c, ref tempResult);
                    Vector3 q = tempResult.ClosestPointOnSimplex;

                    float sqDist = ((q - p)).LengthSquared();
                    // Update best closest point if (squared) distance is less than current best
                    if (sqDist < bestSqDist)
                    {
                        bestSqDist = sqDist;
                        finalResult.ClosestPointOnSimplex = q;
                        //convert result bitmask!
                        finalResult.UsedVertices.Reset();
                        finalResult.UsedVertices.UsedVertexA = tempResult.UsedVertices.UsedVertexA;
                        finalResult.UsedVertices.UsedVertexB = tempResult.UsedVertices.UsedVertexB;
                        finalResult.UsedVertices.UsedVertexC = tempResult.UsedVertices.UsedVertexC;
                        finalResult.SetBarycentricCoordinates(
                                tempResult.BarycentricCoords[VertexA],
                                tempResult.BarycentricCoords[VertexB],
                                tempResult.BarycentricCoords[VertexC],
                                0);
                    }
                }

                // Repeat test for face acd
                if (pointOutsideACD != 0)
                {
                    ClosestPtPointTriangle(p, a, c, d, ref tempResult);
                    Vector3 q = tempResult.ClosestPointOnSimplex;
                    //convert result bitmask!

                    float sqDist = ((q - p)).LengthSquared();
                    if (sqDist < bestSqDist)
                    {
                        bestSqDist = sqDist;
                        finalResult.ClosestPointOnSimplex = q;
                        finalResult.UsedVertices.Reset();
                        finalResult.UsedVertices.UsedVertexA = tempResult.UsedVertices.UsedVertexA;
                        finalResult.UsedVertices.UsedVertexC = tempResult.UsedVertices.UsedVertexB;
                        finalResult.UsedVertices.UsedVertexD = tempResult.UsedVertices.UsedVertexC;
                        finalResult.SetBarycentricCoordinates(
                                tempResult.BarycentricCoords[VertexA],
                                0,
                                tempResult.BarycentricCoords[VertexB],
                                tempResult.BarycentricCoords[VertexC]);
                    }
                }
                // Repeat test for face adb

                if (pointOutsideADB != 0)
                {
                    ClosestPtPointTriangle(p, a, d, b, ref tempResult);
                    var q = tempResult.ClosestPointOnSimplex;
                    //convert result bitmask!

                    float sqDist = ((q - p)).LengthSquared();
                    if (sqDist < bestSqDist)
                    {
                        bestSqDist = sqDist;
                        finalResult.ClosestPointOnSimplex = q;
                        finalResult.UsedVertices.Reset();
                        finalResult.UsedVertices.UsedVertexA = tempResult.UsedVertices.UsedVertexA;
                        finalResult.UsedVertices.UsedVertexD = tempResult.UsedVertices.UsedVertexB;
                        finalResult.UsedVertices.UsedVertexB = tempResult.UsedVertices.UsedVertexC;
                        finalResult.SetBarycentricCoordinates(
                                tempResult.BarycentricCoords[VertexA],
                                tempResult.BarycentricCoords[VertexC],
                                0,
                                tempResult.BarycentricCoords[VertexB]);

                    }
                }
                // Repeat test for face bdc

                if (pointOutsideBDC != 0)
                {
                    ClosestPtPointTriangle(p, b, d, c, ref tempResult);
                    var q = tempResult.ClosestPointOnSimplex;
                    //convert result bitmask!
                    float sqDist = ((q - p)).LengthSquared();
                    if (sqDist < bestSqDist)
                    {
                        bestSqDist = sqDist;
                        finalResult.ClosestPointOnSimplex = q;
                        finalResult.UsedVertices.Reset();
                        finalResult.UsedVertices.UsedVertexB = tempResult.UsedVertices.UsedVertexA;
                        finalResult.UsedVertices.UsedVertexD = tempResult.UsedVertices.UsedVertexB;
                        finalResult.UsedVertices.UsedVertexC = tempResult.UsedVertices.UsedVertexC;

                        finalResult.SetBarycentricCoordinates(
                                0,
                                tempResult.BarycentricCoords[VertexA],
                                tempResult.BarycentricCoords[VertexC],
                                tempResult.BarycentricCoords[VertexB]);
                    }
                }

                //help! we ended up full !

                if (finalResult.UsedVertices.UsedVertexA &&
                    finalResult.UsedVertices.UsedVertexB &&
                    finalResult.UsedVertices.UsedVertexC &&
                    finalResult.UsedVertices.UsedVertexD)
                {
                    return true;
                }

                return true;
            }
        }

        #endregion

    }
}


text:
require 'fileutils'

module Jekyll
  class PageWithoutAFile < Page
    def read_yaml(*)
      @data ||= {}
    end
  end

  class JekyllSitemap < Jekyll::Generator
    safe true

    # Main plugin action, called by Jekyll-core
    def generate(site)
      @site = site
      @site.config["time"]         = Time.new
      @site.config["html_files"]   = html_files.map(&:to_liquid)
      unless sitemap_exists?
        write
        @site.keep_files ||= []
        @site.keep_files << "sitemap.xml"
      end
    end

    # Array of all non-jekyll site files with an HTML extension
    def html_files
      @site.static_files.select { |file| File.extname(file.relative_path) == ".html" }
    end

    # Path to sitemap.xml template file
    def source_path
      File.expand_path "sitemap.xml", File.dirname(__FILE__)
    end

    # Destination for sitemap.xml file within the site source directory
    def destination_path
      @site.in_dest_dir("sitemap.xml")
    end

    # copy sitemap template from source to destination
    def write
      FileUtils.mkdir_p File.dirname(destination_path)
      File.open(destination_path, 'w') { |f| f.write(sitemap_content) }
    end

    def sitemap_content
      site_map = PageWithoutAFile.new(@site, File.dirname(__FILE__), "", "sitemap.xml")
      site_map.content = File.read(source_path)
      site_map.data["layout"] = nil
      site_map.render(Hash.new, @site.site_payload)
      site_map.output.gsub(/[\s\n]*\n+/, "\n")
    end

    # Checks if a sitemap already exists in the site source
    def sitemap_exists?
      File.exists? @site.in_source_dir("sitemap.xml")
    end
  end
end


text:
package org.apache.myfaces.trinidadinternal.share.xml;

import org.xml.sax.Locator;

import org.apache.myfaces.trinidadinternal.share.expl.ExpressionContext;
import org.apache.myfaces.trinidadinternal.share.expl.PrefixMapper;
import org.apache.myfaces.trinidadinternal.share.expl.NSFunctionMapper;

import org.apache.myfaces.trinidadinternal.share.util.NamespaceMap;

/**
 * The base implementation of ParseContext.  Clients can subclass
 * this if they wish to change the behavior, but a more common
 * use is simply creating a ParseContext so you can set properties.
 *

 * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/share/xml/ParseContextImpl.java#0 $) $Date: 10-nov-2005.18:59:12 $
 */
public class ParseContextImpl implements ParseContext, Cloneable
{
  /**
   * Creates a ParseContext that uses the provided
   * ParserManager to get NodeParsers.
   */
  public ParseContextImpl()
  {
    this(null);
  }

  protected ParseContextImpl(ExpressionContext bc)
  {
    if (bc!=null)
      _bindingContext = bc;
    else
    {

      final PrefixMapper mapper = new PrefixMapper()
        {
          public String getNamespaceURI(String prefix)
          {
            // this is backwards: we are calling a deprecated method here;
            // however, we need to do this to maintain backwards compatibility:
            return ParseContextImpl.this.getNamespaceURI(prefix);
          }
        };

      _bindingContext= new ExpressionContext()
        {
          public PrefixMapper getPrefixMapper()
          {
            return mapper;
          }

          public NSFunctionMapper getFunctionMapper()
          {
            return null;
          }
        };

    }
  }

  /**
   * Returns the default node parser that shold be used
   * for a specific element name, given the type of expected object.
   *

   * @param expectedType the Class of the Java object expected for this element
   * @param namespaceURI the namespace of the XML element
   * @param localName the local name of the XML element
   */
  public NodeParser getParser(
    Class<?>   expectedType,
    String     namespaceURI,
    String     localName)
  {
    return null;
  }

  /**
   * Returns a parser extension.
   *

   * @param currentType the Class of the Java object being built
   * @param namespaceURI the namespace of the XML element or attribute
   */
  public ParserExtension getExtension(
    String     namespaceURI)
  {
    return null;
  }

  /**
   * Returns the parser manager.
   */
  public ParserManager getParserManager()
  {
    return null;
  }

  /**
   * gets the bindingContext
   */
  public final ExpressionContext getExpressionContext()
  {
    return _bindingContext;
  }

  /**
   * Convert a string prefix to a full namespace URI.
   * @param prefix the string prefix of the namspace, or the empty
   *     string for the default namespace
   * @return the URI of that namespace, or null if the prefix
   *    hasn't been mapped
   * @deprecated since 2.2.0 use {@link #getExpressionContext()} and
   * {@link ExpressionContext#getPrefixMapper()}
   */
  @Deprecated
  public String getNamespaceURI(String prefix)
  {
    return null;
  }

  /**
   * Return a SAX Locator object for identifying the document location.
   * @return a locator, or null if none is available
   */
  public Locator getLocator()
  {
    return null;
  }

  /**
   * Get an XMLProvider.
   */
  public XMLProvider getXMLProvider()
  {
    return null;
  }

  /**
   * Gets a property stored on the context.
   */
  public Object getProperty(String namespace, Object key)
  {
    return _properties.get(namespace, key);
  }

  /**
   * Stores a property on the context.
   */
  public void setProperty(String namespace, Object key, Object value)
  {
    if (value != null)
    {
      _properties.put(namespace, key, value);
    }
    else
    {
      _properties.remove(namespace, key);
    }
  }

  /**
   *
   */
  @Override
  public Object clone()
  {
    try
    {
      ParseContextImpl copy = (ParseContextImpl) super.clone();
      copy._properties = (NamespaceMap) _properties.clone();
      return copy;
    }
    catch (CloneNotSupportedException cnse)
    {
      return null;
    }
  }

  private final ExpressionContext _bindingContext;
  private NamespaceMap _properties = new NamespaceMap();
}


text:
package com.ch.resource;

import java.util.ArrayList;
import java.util.HashMap;

import static org.lwjgl.opengl.GL15.glDeleteBuffers;
import static org.lwjgl.opengl.GL20.glCreateProgram;

public class ShaderResource {

	private int program;
	private HashMap<String, Integer> uniforms;
	private ArrayList<String> uniformNames;
	private ArrayList<String> uniformTypes;
	private int refCount;

	public ShaderResource() {
		this.program = glCreateProgram();
		this.refCount = 1;

		if (program == 0) {
			System.err.println("Shader creation failed: Could not find valid memory location in constructor");
			System.exit(1);
		}

		uniforms = new HashMap<String, Integer>();
		uniformNames = new ArrayList<String>();
		uniformTypes = new ArrayList<String>();
	}

	@Override
	protected void finalize() {
		glDeleteBuffers(program);
	}

	public void addReference() {
		refCount++;
	}

	public boolean removeReference() {
		refCount--;
		return refCount == 0;
	}

	public int getProgram() {
		return program;
	}

	public HashMap<String, Integer> getUniforms() {
		return uniforms;
	}

	public ArrayList<String> getUniformNames() {
		return uniformNames;
	}

	public ArrayList<String> getUniformTypes() {
		return uniformTypes;
	}
}