text:
#include "config.h"
#include "core/inspector/TimelineRecordFactory.h"

#include "bindings/v8/ScriptCallStackFactory.h"
#include "core/dom/Event.h"
#include "core/inspector/ScriptCallStack.h"
#include "core/platform/JSONValues.h"
#include "core/platform/graphics/FloatQuad.h"
#include "core/platform/graphics/LayoutRect.h"
#include "core/platform/network/ResourceRequest.h"
#include "core/platform/network/ResourceResponse.h"
#include "wtf/CurrentTime.h"

namespace WebCore {

PassRefPtr<JSONObject> TimelineRecordFactory::createGenericRecord(double startTime, int maxCallStackDepth, const String& type)
{
    RefPtr<JSONObject> record = JSONObject::create();
    record->setNumber("startTime", startTime);

    if (maxCallStackDepth) {
        RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(maxCallStackDepth, true);
        if (stackTrace && stackTrace->size())
            record->setValue("stackTrace", stackTrace->buildInspectorArray());
    }
    record->setString("type", type);
    return record.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createBackgroundRecord(double startTime, const String& threadName)
{
    RefPtr<JSONObject> record = JSONObject::create();
    record->setNumber("startTime", startTime);
    record->setString("thread", threadName);
    return record.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createGCEventData(const size_t usedHeapSizeDelta)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setNumber("usedHeapSizeDelta", usedHeapSizeDelta);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("scriptName", scriptName);
    data->setNumber("scriptLine", scriptLine);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createEventDispatchData(const Event& event)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("type", event.type().string());
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createGenericTimerData(int timerId)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setNumber("timerId", timerId);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createTimerInstallData(int timerId, int timeout, bool singleShot)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setNumber("timerId", timerId);
    data->setNumber("timeout", timeout);
    data->setBoolean("singleShot", singleShot);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createXHRReadyStateChangeData(const String& url, int readyState)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("url", url);
    data->setNumber("readyState", readyState);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createXHRLoadData(const String& url)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("url", url);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createEvaluateScriptData(const String& url, double lineNumber)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("url", url);
    data->setNumber("lineNumber", lineNumber);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createTimeStampData(const String& message)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("message", message);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createScheduleResourceRequestData(const String& url)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("url", url);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createResourceSendRequestData(const String& requestId, const ResourceRequest& request)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("requestId", requestId);
    data->setString("url", request.url().string());
    data->setString("requestMethod", request.httpMethod());
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createResourceReceiveResponseData(const String& requestId, const ResourceResponse& response)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("requestId", requestId);
    data->setNumber("statusCode", response.httpStatusCode());
    data->setString("mimeType", response.mimeType());
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createResourceFinishData(const String& requestId, bool didFail, double finishTime)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("requestId", requestId);
    data->setBoolean("didFail", didFail);
    if (finishTime)
        data->setNumber("networkTime", finishTime);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createReceiveResourceData(const String& requestId, int length)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("requestId", requestId);
    data->setNumber("encodedDataLength", length);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createLayoutData(unsigned dirtyObjects, unsigned totalObjects, bool partialLayout)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setNumber("dirtyObjects", dirtyObjects);
    data->setNumber("totalObjects", totalObjects);
    data->setBoolean("partialLayout", partialLayout);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createDecodeImageData(const String& imageType)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setString("imageType", imageType);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createResizeImageData(bool shouldCache)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setBoolean("cached", shouldCache);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createMarkData(bool isMainFrame)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setBoolean("isMainFrame", isMainFrame);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createParseHTMLData(unsigned startLine)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setNumber("startLine", startLine);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createAnimationFrameData(int callbackId)
{
    RefPtr<JSONObject> data = JSONObject::create();
    data->setNumber("id", callbackId);
    return data.release();
}

static PassRefPtr<JSONArray> createQuad(const FloatQuad& quad)
{
    RefPtr<JSONArray> array = JSONArray::create();
    array->pushNumber(quad.p1().x());
    array->pushNumber(quad.p1().y());
    array->pushNumber(quad.p2().x());
    array->pushNumber(quad.p2().y());
    array->pushNumber(quad.p3().x());
    array->pushNumber(quad.p3().y());
    array->pushNumber(quad.p4().x());
    array->pushNumber(quad.p4().y());
    return array.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createLayerData(long long layerRootNodeId)
{
    RefPtr<JSONObject> data = JSONObject::create();
    if (layerRootNodeId)
        data->setNumber("layerRootNode", layerRootNodeId);
    return data.release();
}

PassRefPtr<JSONObject> TimelineRecordFactory::createPaintData(const FloatQuad& quad, long long layerRootNodeId)
{
    RefPtr<JSONObject> data = TimelineRecordFactory::createLayerData(layerRootNodeId);
    data->setArray("clip", createQuad(quad));
    return data.release();
}

void TimelineRecordFactory::appendLayoutRoot(JSONObject* data, const FloatQuad& quad, long long rootNodeId)
{
    data->setArray("root", createQuad(quad));
    if (rootNodeId)
        data->setNumber("rootNode", rootNodeId);
}

void TimelineRecordFactory::appendStyleRecalcDetails(JSONObject* data, unsigned elementCount)
{
    data->setNumber("elementCount", elementCount);
}

} // namespace WebCore


text:
'use strict';

/**
 * Module dependencies
 */
var _ = require('lodash'),
  mongoose = require('mongoose'),
  User = mongoose.model('User');

/**
 * User middleware
 */
exports.userByID = function (req, res, next, id) {
  if (!mongoose.Types.ObjectId.isValid(id)) {
    return res.status(500).send({
      message: 'User is invalid'
    });
  }

  User.findOne({
    _id: id
  }).exec(function (err, user) {
    if (err) {
      return next(err);
    } else if (!user) {
      return next(new Error('Failed to load User ' + id));
    }

    req.profile = user;
    next();
  });
};

redpajama_set_name: RedPajamaGithub


text:
<resources>

    <style name="video_player_progressbar_style">
        <item name="android:maxWidth">43.0dip</item>
        <item name="android:maxHeight">43.0dip</item>
        <item name="android:indeterminateDrawable">@anim/anim_video_player_loading</item>
        <item name="android:minWidth">43.0dip</item>
        <item name="android:minHeight">43.0dip</item>
    </style>

    <style name="switcher_item_text_style">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">45dp</item>
        <item name="android:textSize">15sp</item>
        <item name="android:textColor">@color/switcher_item_text_selector</item>
    </style>

</resources>


text:
module.exports = {
  testPathIgnorePatterns: [`/node_modules/`, `__tests__/fixtures`, `.cache`],
  moduleNameMapper: {
    "^gatsby-page-utils/(.*)$": `gatsby-page-utils/dist/$1`, // Workaround for https://github.com/facebook/jest/issues/9771
    "^gatsby-core-utils/(.*)$": `gatsby-core-utils/dist/$1`, // Workaround for https://github.com/facebook/jest/issues/9771
    "^gatsby-plugin-utils/(.*)$": [
      `gatsby-plugin-utils/dist/$1`,
      `gatsby-plugin-utils/$1`,
    ], // Workaround for https://github.com/facebook/jest/issues/9771
  },
}


text:
package edu.mit.streamjit.util.bytecode;

import static com.google.common.base.Preconditions.*;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import edu.mit.streamjit.util.bytecode.insts.ArrayLengthInst;
import edu.mit.streamjit.util.bytecode.insts.ArrayLoadInst;
import edu.mit.streamjit.util.bytecode.insts.ArrayStoreInst;
import edu.mit.streamjit.util.bytecode.insts.BinaryInst;
import edu.mit.streamjit.util.bytecode.insts.BranchInst;
import edu.mit.streamjit.util.bytecode.insts.CallInst;
import edu.mit.streamjit.util.bytecode.insts.CastInst;
import edu.mit.streamjit.util.bytecode.insts.InstanceofInst;
import edu.mit.streamjit.util.bytecode.insts.Instruction;
import edu.mit.streamjit.util.bytecode.insts.JumpInst;
import edu.mit.streamjit.util.bytecode.insts.LoadInst;
import edu.mit.streamjit.util.bytecode.insts.NewArrayInst;
import edu.mit.streamjit.util.bytecode.insts.PhiInst;
import edu.mit.streamjit.util.bytecode.insts.ReturnInst;
import edu.mit.streamjit.util.bytecode.insts.StoreInst;
import edu.mit.streamjit.util.bytecode.insts.SwitchInst;
import edu.mit.streamjit.util.bytecode.insts.TerminatorInst;
import edu.mit.streamjit.util.bytecode.insts.ThrowInst;
import edu.mit.streamjit.util.bytecode.types.ArrayType;
import edu.mit.streamjit.util.bytecode.types.MethodType;
import edu.mit.streamjit.util.bytecode.types.NullType;
import edu.mit.streamjit.util.bytecode.types.PrimitiveType;
import edu.mit.streamjit.util.bytecode.types.ReferenceType;
import edu.mit.streamjit.util.bytecode.types.RegularType;
import edu.mit.streamjit.util.bytecode.types.ReturnType;
import edu.mit.streamjit.util.bytecode.types.Type;
import edu.mit.streamjit.util.bytecode.types.TypeFactory;
import edu.mit.streamjit.util.bytecode.types.VoidType;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.IntInsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.LocalVariableNode;
import org.objectweb.asm.tree.LookupSwitchInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.MultiANewArrayInsnNode;
import org.objectweb.asm.tree.TypeInsnNode;
import org.objectweb.asm.tree.VarInsnNode;

/**
 * Builds bytecode from methods.
 * @author Jeffrey Bosboom <jbosboom@csail.mit.edu>
 * @since 4/17/2013
 */
public final class MethodUnresolver {
	public static MethodNode unresolve(Method m) {
		checkNotNull(m);
		//Unresolving immutable methods (live Class methods) is only useful
		//during testing.
		//checkArgument(m.isMutable(), "unresolving immutable method %s", m);
		if (!m.modifiers().contains(Modifier.ABSTRACT))
			checkArgument(m.isResolved(), "unresolving unresolved method %s", m);
		return new MethodUnresolver(m).unresolve();
	}

	private final Method method;
	private final MethodNode methodNode;
	private final Map<Value, Integer> registers;
	private final Map<BasicBlock, LabelNode> labels;
	private final PrimitiveType booleanType, byteType, charType, shortType,
			intType, longType, floatType, doubleType;
	private MethodUnresolver(Method m) {
		this.method = m;
		this.methodNode = new MethodNode(Opcodes.ASM4);
		this.registers = new IdentityHashMap<>();
		this.labels = new IdentityHashMap<>();
		TypeFactory tf = m.getParent().getParent().types();
		this.booleanType = tf.getPrimitiveType(boolean.class);
		this.byteType = tf.getPrimitiveType(byte.class);
		this.charType = tf.getPrimitiveType(char.class);
		this.shortType = tf.getPrimitiveType(short.class);
		this.intType = tf.getPrimitiveType(int.class);
		this.longType = tf.getPrimitiveType(long.class);
		this.floatType = tf.getPrimitiveType(float.class);
		this.doubleType = tf.getPrimitiveType(double.class);
	}

	public MethodNode unresolve() {
		this.methodNode.access = Modifier.toBits(method.modifiers());
		this.methodNode.name = method.getName();
		this.methodNode.desc = methodDescriptor(method);
		this.methodNode.exceptions = Collections.emptyList();

		if (!method.modifiers().contains(Modifier.ABSTRACT)) {
			allocateRegisters();
			createLabels();
			for (BasicBlock b : method.basicBlocks())
				methodNode.instructions.add(emit(b));
			peepholeOptimizations();
			int maxRegister = registers.values().isEmpty() ? 0 : Collections.max(registers.values());
			this.methodNode.maxLocals = maxRegister+2;
			//We'd like to use ClassWriter's COMPUTE_MAXS option to compute this
			//for us, but we also want to use CheckClassAdapter before
			//ClassWriter to get useful errors.  But CheckClassAdapter will
			//raise an error if we get this too low and run out of memory if we
			//just say Short.MAX_VALUE.  I think any bytecode can push at most
			//+2 net, so conservatively try 2*instructions.size().  Note that
			//this counts labels and other pseudo-instructions, as well as
			//instructions that have obviously no stack increase or a decrease.
			this.methodNode.maxStack = Math.min(2*methodNode.instructions.size(), Short.MAX_VALUE);
			buildLocalVariableTable();
		}

		return methodNode;
	}

	private void allocateRegisters() {
		//We allocate one or two registers (depending on type category) to each
		//instruction producing a non-void value, the method arguments, and the
		//local variables.
		int regNum = 0;
		for (Argument a : method.arguments()) {
			registers.put(a, regNum);
			regNum += a.getType().getCategory();
		}
		if (method.isMutable())
			for (LocalVariable v : method.localVariables()) {
				registers.put(v, regNum);
				regNum += v.getType().getFieldType().getCategory();
			}
		for (BasicBlock b : method.basicBlocks())
			for (Instruction i : b.instructions())
				if (!(i.getType() instanceof VoidType)) {
					registers.put(i, regNum);
					regNum += i.getType().getCategory();
				}
	}

	private void createLabels() {
		for (BasicBlock b : method.basicBlocks())
			labels.put(b, new LabelNode(new Label()));
	}

	private void buildLocalVariableTable() {
		LabelNode first = new LabelNode(), last = new LabelNode();
		methodNode.instructions.insert(first);
		methodNode.instructions.add(last);
		methodNode.localVariables = new ArrayList<>(registers.size());
		for (Map.Entry<Value, Integer> r : registers.entrySet()) {
			RegularType type = r.getKey() instanceof LocalVariable ?
					((LocalVariable)r.getKey()).getType().getFieldType() :
					(RegularType)r.getKey().getType();
			methodNode.localVariables.add(new LocalVariableNode(
					r.getKey().getName(),
					type.getDescriptor(),
					null,
					first,
					last,
					r.getValue()));
		}
	}

	private InsnList emit(BasicBlock block) {
		FluentIterable<TerminatorInst> terminators = FluentIterable.from(block.instructions()).filter(TerminatorInst.class);
		if (terminators.isEmpty())
			throw new IllegalArgumentException("block "+block.getName()+" in method "+block.getParent().getName()+" lacks a terminator");
		if (terminators.size() > 1)
			throw new IllegalArgumentException("block "+block.getName()+" in method "+block.getParent().getName()+" has multiple terminators: "+terminators);

		InsnList insns = new InsnList();
		insns.add(labels.get(block));
		for (Instruction i : block.instructions()) {
			if (i instanceof TerminatorInst)
				emitPhiMoves(block, insns);

			if (i instanceof ArrayLengthInst)
				emit((ArrayLengthInst)i, insns);
			else if (i instanceof ArrayLoadInst)
				emit((ArrayLoadInst)i, insns);
			else if (i instanceof ArrayStoreInst)
				emit((ArrayStoreInst)i, insns);
			else if (i instanceof BinaryInst)
				emit((BinaryInst)i, insns);
			else if (i instanceof BranchInst)
				emit((BranchInst)i, insns);
			else if (i instanceof CallInst)
				emit((CallInst)i, insns);
			else if (i instanceof CastInst)
				emit((CastInst)i, insns);
			else if (i instanceof InstanceofInst)
				emit((InstanceofInst)i, insns);
			else if (i instanceof JumpInst)
				emit((JumpInst)i, insns);
			else if (i instanceof LoadInst)
				emit((LoadInst)i, insns);
			else if (i instanceof NewArrayInst)
				emit((NewArrayInst)i, insns);
			else if (i instanceof PhiInst)
				//PhiInst deliberately omitted
				;
			else if (i instanceof ReturnInst)
				emit((ReturnInst)i, insns);
			else if (i instanceof StoreInst)
				emit((StoreInst)i, insns);
			else if (i instanceof SwitchInst)
				emit((SwitchInst)i, insns);
			else if (i instanceof ThrowInst)
				emit((ThrowInst)i, insns);
			else
				throw new AssertionError("can't emit "+i);
		}
		return insns;
	}

	private void emit(ArrayLengthInst i, InsnList insns) {
		load(i.getOperand(0), insns);
		insns.add(new InsnNode(Opcodes.ARRAYLENGTH));
		store(i, insns);
	}
	private void emit(ArrayLoadInst i, InsnList insns) {
		load(i.getArray(), insns);
		load(i.getIndex(), insns);
		if (i.getType() instanceof ReferenceType)
			insns.add(new InsnNode(Opcodes.AALOAD));
		else if (i.getType().equals(booleanType) || i.getType().equals(byteType))
			insns.add(new InsnNode(Opcodes.BALOAD));
		else if (i.getType().equals(charType))
			insns.add(new InsnNode(Opcodes.CALOAD));
		else if (i.getType().equals(shortType))
			insns.add(new InsnNode(Opcodes.SALOAD));
		else if (i.getType().equals(intType))
			insns.add(new InsnNode(Opcodes.IALOAD));
		else if (i.getType().equals(longType))
			insns.add(new InsnNode(Opcodes.LALOAD));
		else if (i.getType().equals(floatType))
			insns.add(new InsnNode(Opcodes.FALOAD));
		else if (i.getType().equals(doubleType))
			insns.add(new InsnNode(Opcodes.DALOAD));
		else
			throw new AssertionError(i);
		store(i, insns);
	}
	private void emit(ArrayStoreInst i, InsnList insns) {
		load(i.getArray(), insns);
		load(i.getIndex(), insns);
		load(i.getData(), insns);
		//TODO: what if the array is a null constant?
		RegularType componentType = ((ArrayType)i.getArray().getType()).getComponentType();
		if (componentType instanceof ReferenceType)
			insns.add(new InsnNode(Opcodes.AASTORE));
		else if (componentType.equals(booleanType) || componentType.equals(byteType))
			insns.add(new InsnNode(Opcodes.BASTORE));
		else if (componentType.equals(charType))
			insns.add(new InsnNode(Opcodes.CASTORE));
		else if (componentType.equals(shortType))
			insns.add(new InsnNode(Opcodes.SASTORE));
		else if (componentType.equals(intType))
			insns.add(new InsnNode(Opcodes.IASTORE));
		else if (componentType.equals(longType))
			insns.add(new InsnNode(Opcodes.LASTORE));
		else if (componentType.equals(floatType))
			insns.add(new InsnNode(Opcodes.FASTORE));
		else if (componentType.equals(doubleType))
			insns.add(new InsnNode(Opcodes.DASTORE));
		else
			throw new AssertionError(i);
	}
	private void emit(BinaryInst i, InsnList insns) {
		load(i.getOperand(0), insns);
		load(i.getOperand(1), insns);
		int opcode = 0;
		if (i.getOperand(0).getType().isSubtypeOf(intType)) {
			switch (i.getOperation()) {
				case ADD:
					opcode = Opcodes.IADD;
					break;
				case SUB:
					opcode = Opcodes.ISUB;
					break;
				case MUL:
					opcode = Opcodes.IMUL;
					break;
				case DIV:
					opcode = Opcodes.IDIV;
					break;
				case REM:
					opcode = Opcodes.IREM;
					break;
				case SHL:
					opcode = Opcodes.ISHL;
					break;
				case SHR:
					opcode = Opcodes.ISHR;
					break;
				case USHR:
					opcode = Opcodes.ISHR;
					break;
				case AND:
					opcode = Opcodes.IAND;
					break;
				case OR:
					opcode = Opcodes.IOR;
					break;
				case XOR:
					opcode = Opcodes.IXOR;
					break;
				default:
					throw new AssertionError(i);
			}
		} else if (i.getOperand(0).getType().equals(longType)) {
			switch (i.getOperation()) {
				case ADD:
					opcode = Opcodes.LADD;
					break;
				case SUB:
					opcode = Opcodes.LSUB;
					break;
				case MUL:
					opcode = Opcodes.LMUL;
					break;
				case DIV:
					opcode = Opcodes.LDIV;
					break;
				case REM:
					opcode = Opcodes.LREM;
					break;
				case SHL:
					opcode = Opcodes.LSHL;
					break;
				case SHR:
					opcode = Opcodes.LSHR;
					break;
				case USHR:
					opcode = Opcodes.LSHR;
					break;
				case AND:
					opcode = Opcodes.LAND;
					break;
				case OR:
					opcode = Opcodes.LOR;
					break;
				case XOR:
					opcode = Opcodes.LXOR;
					break;
				case CMP:
					opcode = Opcodes.LCMP;
					break;
				default:
					throw new AssertionError(i);
			}
		} else if (i.getOperand(0).getType().equals(floatType)) {
			switch (i.getOperation()) {
				case ADD:
					opcode = Opcodes.FADD;
					break;
				case SUB:
					opcode = Opcodes.FSUB;
					break;
				case MUL:
					opcode = Opcodes.FMUL;
					break;
				case DIV:
					opcode = Opcodes.FDIV;
					break;
				case REM:
					opcode = Opcodes.FREM;
					break;
				case CMP:
					opcode = Opcodes.FCMPL;
					break;
				case CMPG:
					opcode = Opcodes.FCMPG;
					break;
				default:
					throw new AssertionError(i);
			}
		} else if (i.getOperand(0).getType().equals(doubleType)) {
			switch (i.getOperation()) {
				case ADD:
					opcode = Opcodes.DADD;
					break;
				case SUB:
					opcode = Opcodes.DSUB;
					break;
				case MUL:
					opcode = Opcodes.DMUL;
					break;
				case DIV:
					opcode = Opcodes.DDIV;
					break;
				case REM:
					opcode = Opcodes.DREM;
					break;
				case CMP:
					opcode = Opcodes.DCMPL;
					break;
				case CMPG:
					opcode = Opcodes.DCMPG;
					break;
				default:
					throw new AssertionError(i);
			}
		} else
			throw new AssertionError(i);
		insns.add(new InsnNode(opcode));
		store(i, insns);
	}
	private void emit(BranchInst i, InsnList insns) {
		//TODO: accessor methods on BranchInst
		Value left = i.getOperand(0), right = i.getOperand(1);
		BasicBlock target = (BasicBlock)i.getOperand(2), fallthrough = (BasicBlock)i.getOperand(3);
		if (!method.basicBlocks().contains(target))
			throw new IllegalArgumentException("Branch targets block not in method: "+i);
		if (!method.basicBlocks().contains(fallthrough))
			throw new IllegalArgumentException("Branch falls through to block not in method: "+i);
		load(i.getOperand(0), insns);
		load(i.getOperand(1), insns);
		//TODO: long, float, doubles need to go through CMP inst first
		int opcode;
		if (left.getType() instanceof ReferenceType || left.getType() instanceof VoidType) {
			switch (i.getSense()) {
				case EQ:
					opcode = Opcodes.IF_ACMPEQ;
					break;
				case NE:
					opcode = Opcodes.IF_ACMPNE;
					break;
				default:
					throw new AssertionError(i);
			}
		} else if (left.getType().isSubtypeOf(intType)) {
			switch (i.getSense()) {
				case EQ:
					opcode = Opcodes.IF_ICMPEQ;
					break;
				case NE:
					opcode = Opcodes.IF_ICMPNE;
					break;
				case LT:
					opcode = Opcodes.IF_ICMPLT;
					break;
				case GT:
					opcode = Opcodes.IF_ICMPGT;
					break;
				case LE:
					opcode = Opcodes.IF_ICMPLE;
					break;
				case GE:
					opcode = Opcodes.IF_ICMPGE;
					break;
				default:
					throw new AssertionError(i);
			}
		} else
			throw new AssertionError(i);
		insns.add(new JumpInsnNode(opcode, labels.get(target)));
		insns.add(new JumpInsnNode(Opcodes.GOTO, labels.get(fallthrough)));
	}
	private void emit(CallInst i, InsnList insns) {
		Method m = i.getMethod();
		boolean callingSuperCtor = false;
		if (m.isConstructor()) {
			//If we're calling super(), load this.
			//TODO: this will get confused if we call a superclass constructor
			//for any reason other than our own initialization!
			if (method.isConstructor() && method.getParent().getSuperclass().equals(m.getParent())) {
				load(method.arguments().get(0), insns);
				callingSuperCtor = true;
			} else {
				insns.add(new TypeInsnNode(Opcodes.NEW, internalName(m.getType().getReturnType().getKlass())));
				insns.add(new InsnNode(Opcodes.DUP));
			}
		}
		int opcode;
		if (m.modifiers().contains(Modifier.STATIC))
			opcode = Opcodes.INVOKESTATIC;
		else if (m.isConstructor() ||
				m.getAccess().equals(Access.PRIVATE) ||
				//We're calling a superclass method we've overridden.
				(Iterables.contains(method.getParent().superclasses(), m.getParent())) &&
				method.getParent().getMethodByVirtual(m.getName(), m.getType()) != m)
			opcode = Opcodes.INVOKESPECIAL;
		else if (m.getParent().modifiers().contains(Modifier.INTERFACE))
			//TODO: may not be correct?
			opcode = Opcodes.INVOKEINTERFACE;
		else
			opcode = Opcodes.INVOKEVIRTUAL;

		String owner = internalName(m.getParent());
		//hack to make cloning arrays work
		if (opcode == Opcodes.INVOKESPECIAL && m.getName().equals("clone") && i.getArgument(0).getType() instanceof ArrayType) {
			opcode = Opcodes.INVOKEVIRTUAL;
			owner = internalName(((ArrayType)i.getArgument(0).getType()).getKlass());
		}

		for (Value v : i.arguments())
			load(v, insns);
		insns.add(new MethodInsnNode(opcode, owner, m.getName(), i.callDescriptor()));

		if (!(i.getType() instanceof VoidType) && !callingSuperCtor)
			store(i, insns);
	}
	private void emit(CastInst i, InsnList insns) {
		load(i.getOperand(0), insns);
		if (i.getType() instanceof ReferenceType) {
			insns.add(new TypeInsnNode(Opcodes.CHECKCAST, internalName(((ReferenceType)i.getType()).getKlass())));
		} else {
			PrimitiveType from = (PrimitiveType)i.getOperand(0).getType();
			PrimitiveType to = (PrimitiveType)i.getType();
			for (int op : from.getCastOpcode(to))
				insns.add(new InsnNode(op));
		}
		store(i, insns);
	}
	private void emit(InstanceofInst i, InsnList insns) {
		load(i.getOperand(0), insns);
		insns.add(new TypeInsnNode(Opcodes.INSTANCEOF, internalName(i.getTestType().getKlass())));
		store(i, insns);
	}
	private void emit(JumpInst i, InsnList insns) {
		BasicBlock target = (BasicBlock)i.getOperand(0);
		if (!method.basicBlocks().contains(target))
			throw new IllegalArgumentException("Jump to block not in method: "+i);
		insns.add(new JumpInsnNode(Opcodes.GOTO, labels.get(target)));
	}
	private void emit(LoadInst i, InsnList insns) {
		Value location = i.getLocation();
		if (location instanceof LocalVariable) {
			load(location, insns);
			store(i, insns);
		} else {
			Field f = (Field)location;
			if (!f.isStatic())
				load(i.getInstance(), insns);
			insns.add(new FieldInsnNode(
					f.isStatic() ? Opcodes.GETSTATIC : Opcodes.GETFIELD,
					internalName(f.getParent()),
					f.getName(),
					f.getType().getFieldType().getDescriptor()));
			store(i, insns);
		}
	}
	private void emit(NewArrayInst i, InsnList insns) {
		ArrayType t = i.getType();
		if (t.getDimensions() == 1) {
			load(i.getOperand(0), insns);
			RegularType ct = t.getComponentType();
			if (ct instanceof PrimitiveType) {
				if (ct.equals(booleanType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_BOOLEAN));
				else if (ct.equals(byteType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_BYTE));
				else if (ct.equals(charType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_CHAR));
				else if (ct.equals(shortType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_SHORT));
				else if (ct.equals(intType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_INT));
				else if (ct.equals(longType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_LONG));
				else if (ct.equals(floatType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_FLOAT));
				else if (ct.equals(doubleType))
					insns.add(new IntInsnNode(Opcodes.NEWARRAY, Opcodes.T_DOUBLE));
			} else {
				insns.add(new TypeInsnNode(Opcodes.ANEWARRAY, internalName(ct.getKlass())));
			}
		} else {
			for (Value v : i.operands())
				load(v, insns);
			insns.add(new MultiANewArrayInsnNode(t.getDescriptor(), i.getNumOperands()));
		}
		store(i, insns);
	}
	private void emit(ReturnInst i, InsnList insns) {
		ReturnType rt = i.getReturnType();
		if (rt instanceof VoidType)
			insns.add(new InsnNode(Opcodes.RETURN));
		else {
			load(i.getOperand(0), insns);
			if (rt instanceof ReferenceType)
				insns.add(new InsnNode(Opcodes.ARETURN));
			else if (rt.isSubtypeOf(intType))
				insns.add(new InsnNode(Opcodes.IRETURN));
			else if (rt.equals(longType))
				insns.add(new InsnNode(Opcodes.LRETURN));
			else if (rt.equals(floatType))
				insns.add(new InsnNode(Opcodes.FRETURN));
			else if (rt.equals(doubleType))
				insns.add(new InsnNode(Opcodes.DRETURN));
			else
				throw new AssertionError(i);
		}
	}
	private void emit(StoreInst i, InsnList insns) {
		Value location = i.getLocation();
		if (location instanceof LocalVariable) {
			load(i.getData(), insns);
			store(location, insns);
		} else {
			Field f = (Field)location;
			if (!f.isStatic())
				load(i.getInstance(), insns);
			load(i.getData(), insns);
			insns.add(new FieldInsnNode(
					f.isStatic() ? Opcodes.PUTSTATIC : Opcodes.PUTFIELD,
					internalName(f.getParent()),
					f.getName(),
					f.getType().getFieldType().getDescriptor()));
		}
	}
	private void emit(SwitchInst i, InsnList insns) {
		load(i.getValue(), insns);
		LookupSwitchInsnNode insn = new LookupSwitchInsnNode(null, null, null);
		insn.dflt = labels.get(i.getDefault());
		Iterator<Constant<Integer>> cases = i.cases().iterator();
		Iterator<BasicBlock> targets = i.successors().iterator();
		while (cases.hasNext()) {
			insn.keys.add(cases.next().getConstant());
			insn.labels.add(labels.get(targets.next()));
		}
		insns.add(insn);
	}
	private void emit(ThrowInst i, InsnList insns) {
		load(i.getOperand(0), insns);
		insns.add(new InsnNode(Opcodes.ATHROW));
	}

	private void emitPhiMoves(BasicBlock block, InsnList insns) {
		//In case phi instructions refer to one another, load all values onto
		//the operand stack, then store all at once.
		Deque<Value> pendingStores = new ArrayDeque<>();
		for (BasicBlock b : block.successors())
			for (Instruction i : b.instructions())
				if (i instanceof PhiInst) {
					PhiInst p = (PhiInst)i;
					Value ourDef = p.get(block);
					if (ourDef != null) {
						load(ourDef, insns);
						pendingStores.push(p);
					}
				}
		while (!pendingStores.isEmpty())
			store(pendingStores.pop(), insns);
	}

	private void load(Value v, InsnList insns) {
		if (v instanceof Constant) {
			Object c = ((Constant<?>)v).getConstant();
			if (c == null)
				insns.add(new InsnNode(Opcodes.ACONST_NULL));
			else if (c instanceof Class)
				insns.add(new LdcInsnNode(org.objectweb.asm.Type.getType((Class)c)));
			else if (c instanceof Boolean)
				insns.add(loadIntegerConstant(((Boolean)c) ? 1 : 0));
			else if (c instanceof Character)
				insns.add(loadIntegerConstant((int)((Character)c).charValue()));
			else if (c instanceof Byte || c instanceof Short || c instanceof Integer)
				insns.add(loadIntegerConstant(((Number)c).intValue()));
			else if (c instanceof Long)
				insns.add(loadLongConstant((Long)c));
			else if (c instanceof Float)
				insns.add(loadFloatConstant((Float)c));
			else if (c instanceof Double)
				insns.add(loadDoubleConstant((Double)c));
			else
				insns.add(new LdcInsnNode(c));
			return;
		}

		assert registers.containsKey(v) : v;
		int reg = registers.get(v);
		Type t = v instanceof LocalVariable ? ((LocalVariable)v).getType().getFieldType() : v.getType();
		if (t instanceof ReferenceType || t instanceof NullType)
			insns.add(new VarInsnNode(Opcodes.ALOAD, reg));
		else if (t.equals(longType))
			insns.add(new VarInsnNode(Opcodes.LLOAD, reg));
		else if (t.equals(floatType))
			insns.add(new VarInsnNode(Opcodes.FLOAD, reg));
		else if (t.equals(doubleType))
			insns.add(new VarInsnNode(Opcodes.DLOAD, reg));
		else if (t.isSubtypeOf(intType))
			insns.add(new VarInsnNode(Opcodes.ILOAD, reg));
		else
			throw new AssertionError("unloadable value: "+v);
	}

	private AbstractInsnNode loadIntegerConstant(int c) {
		if (c == -1)
			return new InsnNode(Opcodes.ICONST_M1);
		if (c == 0)
			return new InsnNode(Opcodes.ICONST_0);
		if (c == 1)
			return new InsnNode(Opcodes.ICONST_1);
		if (c == 2)
			return new InsnNode(Opcodes.ICONST_2);
		if (c == 3)
			return new InsnNode(Opcodes.ICONST_3);
		if (c == 4)
			return new InsnNode(Opcodes.ICONST_4);
		if (c == 5)
			return new InsnNode(Opcodes.ICONST_5);
		if (Byte.MIN_VALUE <= c && c <= Byte.MAX_VALUE)
			return new IntInsnNode(Opcodes.BIPUSH, c);
		if (Short.MIN_VALUE <= c && c <= Short.MAX_VALUE)
			return new IntInsnNode(Opcodes.SIPUSH, c);
		return new LdcInsnNode(c);
	}

	private AbstractInsnNode loadLongConstant(long c) {
		if (c == 0)
			return new InsnNode(Opcodes.LCONST_0);
		if (c == 1)
			return new InsnNode(Opcodes.LCONST_1);
		return new LdcInsnNode(c);
	}

	private AbstractInsnNode loadFloatConstant(float c) {
		if (c == 0.0f)
			return new InsnNode(Opcodes.FCONST_0);
		if (c == 1.0f)
			return new InsnNode(Opcodes.FCONST_1);
		if (c == 2.0f)
			return new InsnNode(Opcodes.FCONST_2);
		return new LdcInsnNode(c);
	}

	private AbstractInsnNode loadDoubleConstant(double c) {
		if (c == 0.0)
			return new InsnNode(Opcodes.DCONST_0);
		if (c == 1.0)
			return new InsnNode(Opcodes.DCONST_1);
		return new LdcInsnNode(c);
	}

	private void store(Value v, InsnList insns) {
		assert registers.containsKey(v) : v;
		int reg = registers.get(v);
		Type t = v instanceof LocalVariable ? ((LocalVariable)v).getType().getFieldType() : v.getType();
		if (t instanceof ReferenceType || t instanceof NullType)
			insns.add(new VarInsnNode(Opcodes.ASTORE, reg));
		else if (t.equals(longType))
			insns.add(new VarInsnNode(Opcodes.LSTORE, reg));
		else if (t.equals(floatType))
			insns.add(new VarInsnNode(Opcodes.FSTORE, reg));
		else if (t.equals(doubleType))
			insns.add(new VarInsnNode(Opcodes.DSTORE, reg));
		else if (t.isSubtypeOf(intType))
			insns.add(new VarInsnNode(Opcodes.ISTORE, reg));
		else
			throw new AssertionError("unstorable value: "+v);
	}

	private static String methodDescriptor(Method m) {
		//TODO: maybe put this on Method?  I vaguely recall using it somewhere else...
		MethodType type = m.getType();
		if (m.isConstructor())
			type = type.withReturnType(type.getTypeFactory().getVoidType());
		if (m.hasReceiver())
			type = type.dropFirstArgument();
		return type.getDescriptor();
	}

	private String internalName(Klass k) {
		return k.getName().replace('.', '/');
	}

	/**
	 * Performs peephole optimizations at the bytecode level, primarily to
	 * reduce bytecode size for better inlining.  (HotSpot makes inlining
	 * decisions based partially on the number of bytes in a method.)
	 */
	private void peepholeOptimizations() {
		boolean progress;
		do {
			progress = false;
			progress |= removeLoadStore();
			progress |= removeUnnecessaryGotos();
		} while (progress);
	}

	private static final ImmutableList<Integer> LOADS = ImmutableList.of(
			Opcodes.ALOAD, Opcodes.DLOAD, Opcodes.FLOAD, Opcodes.ILOAD, Opcodes.LLOAD
	);
	private static final ImmutableList<Integer> STORES = ImmutableList.of(
			Opcodes.ASTORE, Opcodes.DSTORE, Opcodes.FSTORE, Opcodes.ISTORE, Opcodes.LSTORE
	);
	/**
	 * Removes "xLOAD N xSTORE N".
	 * @return true iff changes were made
	 */
	private boolean removeLoadStore() {
		InsnList insns = methodNode.instructions;
		for (int i = 0; i < insns.size()-1; ++i) {
			AbstractInsnNode first = insns.get(i);
			int index = LOADS.indexOf(first.getOpcode());
			if (index == -1) continue;
			AbstractInsnNode second = insns.get(i+1);
			if (second.getOpcode() != STORES.get(index)) continue;
			if (((VarInsnNode)first).var != ((VarInsnNode)second).var) continue;
			insns.remove(first);
			insns.remove(second);
			return true;
		}
		return false;
	}

	/**
	 * Removes goto instructions that go to the label immediately following
	 * them.
	 * @return true iff changes were made
	 */
	private boolean removeUnnecessaryGotos() {
		InsnList insns = methodNode.instructions;
		for (int i = 0; i < insns.size()-1; ++i) {
			AbstractInsnNode first = insns.get(i);
			if (first.getOpcode() != Opcodes.GOTO) continue;
			AbstractInsnNode second = insns.get(i+1);
			if (!(second instanceof LabelNode)) continue;
			if (((JumpInsnNode)first).label != second) continue;
			insns.remove(first);
			return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Module m = new Module();
		Klass k = m.getKlass(Module.class);
		Method ar = k.getMethods("getArrayKlass").iterator().next();
		ar.resolve();
		MethodNode mn = unresolve(ar);
		for (int i = 0; i < mn.instructions.size(); ++i) {
			AbstractInsnNode insn = mn.instructions.get(i);
			System.out.format("%d: %d %s%n", i, insn.getOpcode(), insn);
		}
	}
}


text:
package org.jetbrains.plugins.groovy.lang.resolve;

import javax.annotation.Nonnull;

import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.runner.GroovyScriptUtil;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.ResolveScopeProvider;
import com.intellij.psi.search.GlobalSearchScope;

/**
 * @author Max Medvedev
 */
public class GroovyResolveScopeProvider extends ResolveScopeProvider {
  @Override
  public GlobalSearchScope getResolveScope(@Nonnull VirtualFile file, Project project) {
    if (file.getFileType() != GroovyFileType.GROOVY_FILE_TYPE) return null;

    ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
    Module module = projectFileIndex.getModuleForFile(file);

    if (module == null) return null; //groovy files are only in modules

    boolean includeTests = projectFileIndex.isInTestSourceContent(file) || !projectFileIndex.isInSourceContent(file);
    final GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, includeTests);

    final PsiFile psi = PsiManager.getInstance(project).findFile(file);
    if (psi instanceof GroovyFile && ((GroovyFile)psi).isScript()) {
      return GroovyScriptUtil.getScriptType((GroovyFile)psi).patchResolveScope((GroovyFile)psi, scope);
    }
    else {
      return scope;
    }
  }
}


text:
/**
@module gallery-lazy-promise
@author Steven Olmsted
*/
(function (Y) {
    'use strict';

    var _Promise = Y.Promise,

        /**
        A LazyPromise acts just like a Promise with the exception that it won't be
        executed until its `then` method is called.
        @class LazyPromise
        @constructor
        @param {Function} fn A function where to insert the logic that resolves this
        promise.  Receives `fulfill` and `reject` functions as parameters.  This
        function is executed the first time the `then` method is called.
        */
        _Class = function (fn) {
            if (!(this instanceof _Class)) {
                return new _Class(fn);
            }

            /**
            A temporary reference to fn.
            @property _fn
            @type Function
            @protected
            */
            this._fn = fn;
        };

    _Class.prototype = {
        /**
        Returns the current status of the operation.  Possible results are
        'pending', 'fulfilled', and 'rejected'.

        @method getStatus
        @return {String}
        **/
        getStatus: function () {
            var promise = this._promise;
            return promise ? promise.getStatus() : 'pending';
        },
        /**
        Schedule execution of a callback to either or both of `fulfill` and
        `reject` resolutions for this promise.  The callbacks are wrapped in a
        new promise and that promise is returned.  Callbacks are guaranteed to
        be called in a future turn of the event loop.

        @method then
        @param {Function} [callback] function to execute if the lazy promise
        resolves successfully.
        @param {Function} [errback] function to execute if the lazy promise
        resolves unsuccessfully.
        @return {Promise} A promise wrapping the resolution of either the
        `resolve` or `reject` callback.
        **/
        then: function (callback, errback) {
            var me = this,
                promise = me._promise;

            if (!promise) {
                promise = new _Promise(function (fulfill, reject) {
                    /**
                    An internal promise instance.
                    @property _promise
                    @type Promise
                    @protected
                    */
                    me._promise = this;

                    me._fn(fulfill, reject);
                    delete me._fn;
                });
            }

            return promise.then(callback, errback);
        }
    };

    Y.LazyPromise = _Class;
}(Y));


text:
var common = require('../common');

// This test *only* verifies that invoking the stdin getter does not
// cause node to hang indefinitely.
// If it does, then the test-runner will nuke it.

// invoke the getter.
process.stdin;

console.error('Should exit normally now.');


text:
package org.wso2.carbon.identity.user.functionality.mgt.dao.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockTestCase;
import org.testng.IObjectFactory;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.ObjectFactory;
import org.testng.annotations.Test;
import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
import org.wso2.carbon.identity.core.util.IdentityUtil;
import org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityManager;
import org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityManagerImpl;
import org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityMgtConstants;
import org.wso2.carbon.identity.user.functionality.mgt.dao.UserFunctionalityPropertyDAO;
import org.wso2.carbon.identity.user.functionality.mgt.exception.UserFunctionalityManagementException;
import org.wso2.carbon.identity.user.functionality.mgt.exception.UserFunctionalityManagementServerException;
import org.wso2.carbon.identity.user.functionality.mgt.internal.UserFunctionalityManagerComponentDataHolder;
import org.wso2.carbon.identity.user.functionality.mgt.util.TestUtils;
import org.wso2.carbon.user.api.UserRealm;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.core.UniqueIDUserStoreManager;
import org.wso2.carbon.user.core.service.RealmService;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.sql.DataSource;

import static org.mockito.Matchers.anyString;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.wso2.carbon.identity.user.functionality.mgt.util.TestUtils.closeH2Base;
import static org.wso2.carbon.identity.user.functionality.mgt.util.TestUtils.getConnection;
import static org.wso2.carbon.identity.user.functionality.mgt.util.TestUtils.initiateH2Base;
import static org.wso2.carbon.identity.user.functionality.mgt.util.TestUtils.mockDataSource;
import static org.wso2.carbon.identity.user.functionality.mgt.util.TestUtils.spyConnection;

@PrepareForTest({IdentityDatabaseUtil.class, IdentityUtil.class, UserFunctionalityManagerComponentDataHolder.class,
        IdentityTenantUtil.class})
public class UserFunctionalityPropertyDAOImplTest extends PowerMockTestCase {

    @Mock
    private RealmService realmService;
    @Mock
    private UserRealm userRealm;
    @Mock
    private UniqueIDUserStoreManager userStoreManager;
    @Mock
    private UserFunctionalityManagerComponentDataHolder userFunctionalityManagerComponentDataHolder;

    private static final Log log = LogFactory.getLog(UserFunctionalityPropertyDAOImplTest.class);
    private UserFunctionalityPropertyDAO userFunctionalityPropertyDAO = new UserFunctionalityPropertyDAOImpl();
    private UserFunctionalityManager userFunctionalityManager = new UserFunctionalityManagerImpl();

    @BeforeMethod
    public void setUp() throws Exception {

        initiateH2Base();
        mockStatic(IdentityDatabaseUtil.class);
        mockStatic(IdentityUtil.class);
        when(IdentityUtil.getProperty(UserFunctionalityMgtConstants.ENABLE_PER_USER_FUNCTIONALITY_LOCKING))
                .thenReturn("true");
    }

    @AfterMethod
    public void tearDown() throws Exception {

        closeH2Base();
    }

    @DataProvider(name = "TestFunctionalityLockPropertiesData")
    public Object[][] testFunctionalityLockPropertyData() {

        Map<String, String> properties = new HashMap<String, String>() {{
            put("k1", "v1");
            put("k2", "v2");
            put("k3", "v3");
        }};

        return new Object[][]{
                // userId
                // tenantId
                // functionalityIdentifier
                // propertyName
                // propertyValue
                {"user1", 1, "functionalityIdentifier1", properties},
                {"user1", 2, "functionalityIdentifier1", properties},
                {"user2", 2, "functionalityIdentifier2", properties},
                {"user3", 3, "functionalityIdentifier3", properties}
        };
    }

    @Test(dataProvider = "TestFunctionalityLockPropertiesData")
    public void testAddFunctionalityLockProperties(String userId, int tenantId, String functionalityIdentifier,
                                                   Map<String, String> lockProperties) {

        DataSource dataSource = mock(DataSource.class);
        mockDataSource(dataSource);

        try (Connection connection = getConnection()) {
            Connection spyConnection = spyConnection(connection);
            when(dataSource.getConnection()).thenReturn(spyConnection);
            userFunctionalityPropertyDAO.addProperties(userId, tenantId, functionalityIdentifier, lockProperties);
            Map<String, String> properties =
                    userFunctionalityPropertyDAO.getAllProperties(userId, tenantId, functionalityIdentifier);
            assertEquals(properties, lockProperties);
        } catch (SQLException | UserFunctionalityManagementServerException e) {
            //Mock behaviour. Hence ignored.
        }
    }

    @Test(dataProvider = "TestFunctionalityLockPropertiesData")
    public void testGetAllFunctionalityLockProperties(String userId, int tenantId, String functionalityIdentifier,
                                                      Map<String, String> properties) {

        DataSource dataSource = mock(DataSource.class);
        mockDataSource(dataSource);

        try (Connection connection = getConnection()) {
            Connection spyConnection = spyConnection(connection);
            when(dataSource.getConnection()).thenReturn(spyConnection);
            userFunctionalityPropertyDAO.addProperties(userId, tenantId, functionalityIdentifier, properties);
            Map<String, String> propertiesMap = userFunctionalityPropertyDAO
                    .getAllProperties(userId, tenantId, functionalityIdentifier);
            assertEquals(properties, propertiesMap);
        } catch (SQLException | UserFunctionalityManagementServerException e) {
            //Mock behaviour. Hence ignored.
        }
    }

    @DataProvider(name = "TestUpdateFunctionalityLockPropertyData")
    public Object[][] testUpdateFunctionalityLockPropertyData() {

        Map<String, String> properties = new HashMap<String, String>() {{
            put("k1", "v1");
            put("k2", "v2");
            put("k3", "v3");
        }};

        Map<String, String> propertiesToUpdate = new HashMap<String, String>() {{
            put("k1", "v4");
            put("k2", "v5");
            put("k3", "v6");
        }};

        return new Object[][]{
                // userId
                // tenantId
                // functionalityIdentifier
                // properties
                // propertiesToUpdate
                {"user1", 1, "functionalityIdentifier1", properties, propertiesToUpdate},
                {"user1", 2, "functionalityIdentifier1", properties, propertiesToUpdate},
                {"user2", 2, "functionalityIdentifier2", properties, propertiesToUpdate},
                {"user3", 3, "functionalityIdentifier3", properties, propertiesToUpdate}
        };
    }

    @Test(dataProvider = "TestUpdateFunctionalityLockPropertyData")
    public void testUpdateFunctionalityLockProperty(String userId, int tenantId, String functionalityIdentifier,
                                                    Map<String, String> properties,
                                                    Map<String, String> propertiesToUpdate) {

        DataSource dataSource = mock(DataSource.class);
        mockDataSource(dataSource);

        try (Connection connection = getConnection()) {
            Connection spyConnection = spyConnection(connection);
            when(dataSource.getConnection()).thenReturn(spyConnection);
            userFunctionalityPropertyDAO.addProperties(userId, tenantId, functionalityIdentifier, properties);
            userFunctionalityPropertyDAO
                    .updateProperties(userId, tenantId, functionalityIdentifier, propertiesToUpdate);
            Map<String, String> updatedProperties =
                    userFunctionalityPropertyDAO.getAllProperties(userId, tenantId, functionalityIdentifier);
            assertEquals(updatedProperties, propertiesToUpdate);
        } catch (SQLException | UserFunctionalityManagementServerException e) {
            //Mock behaviour. Hence ignored.
        }
    }

    @Test(dataProvider = "TestFunctionalityLockPropertiesData")
    public void testDeleteAllFunctionalityLockProperties(String userId, int tenantId, String functionalityIdentifier,
                                                         Map<String, String> properties) {

        DataSource dataSource = mock(DataSource.class);
        mockDataSource(dataSource);

        try (Connection connection = getConnection()) {
            Connection spyConnection = spyConnection(connection);
            when(dataSource.getConnection()).thenReturn(spyConnection);
            mockUser(userId);
            userFunctionalityManager.setProperties(userId, tenantId, functionalityIdentifier, properties);
            userFunctionalityPropertyDAO.deleteAllPropertiesForUser(userId, tenantId, functionalityIdentifier);
            Map<String, String> functionalityLockProperties =
                    userFunctionalityPropertyDAO.getAllProperties(userId, tenantId, functionalityIdentifier);
            assertTrue(functionalityLockProperties.isEmpty());
        } catch (SQLException | UserFunctionalityManagementException | UserStoreException e) {
            //Mock behaviour. Hence ignored.
        }
    }

    @DataProvider(name = "TestDeleteFunctionalityLockPropertiesData")
    public Object[][] testDeleteFunctionalityLockPropertyData() {

        Map<String, String> properties = new HashMap<String, String>() {{
            put("k1", "v1");
            put("k2", "v2");
            put("k3", "v3");
        }};

        Set<String> propertiesToDelete1 = Stream.of("k1", "k2").collect(Collectors.toSet());
        Set<String> propertiesToDelete2 = Stream.of("k1", "k2", "k3").collect(Collectors.toSet());
        Set<String> propertiesToDelete3 = Stream.of("").collect(Collectors.toSet());
        Set<String> propertiesToDelete4 = Stream.of("invalid", "k2").collect(Collectors.toSet());

        return new Object[][]{
                // userId
                // tenantId
                // functionalityIdentifier
                // propertyName
                // propertyValue
                // expected
                {"user1", 1, "functionalityIdentifier1", properties, propertiesToDelete1,
                        Stream.of("k3").collect(Collectors.toCollection(HashSet::new))},
                {"user1", 2, "functionalityIdentifier1", properties, propertiesToDelete2, Collections.emptySet()},
                {"user2", 2, "functionalityIdentifier2", properties, propertiesToDelete3,
                        Stream.of("k1", "k2", "k3").collect(Collectors.toCollection(HashSet::new))},
                {"user3", 3, "functionalityIdentifier3", properties, propertiesToDelete4,
                        Stream.of("k1", "k3").collect(Collectors.toCollection(HashSet::new))}
        };
    }

    @Test(dataProvider = "TestDeleteFunctionalityLockPropertiesData")
    public void testDeleteFunctionalityLockProperties(String userId, int tenantId, String functionalityIdentifier,
                                                      Map<String, String> properties, Set<String> propertiesToDelete,
                                                      Set<String> expected) {

        DataSource dataSource = mock(DataSource.class);
        mockDataSource(dataSource);

        try (Connection connection = getConnection()) {
            Connection spyConnection = spyConnection(connection);
            when(dataSource.getConnection()).thenReturn(spyConnection);
            userFunctionalityPropertyDAO.addProperties(userId, tenantId, functionalityIdentifier, properties);
            userFunctionalityPropertyDAO
                    .deletePropertiesForUser(userId, tenantId, functionalityIdentifier, propertiesToDelete);
            Map<String, String> functionalityLockProperties =
                    userFunctionalityPropertyDAO.getAllProperties(userId, tenantId, functionalityIdentifier);

            assertEquals(functionalityLockProperties.keySet(), expected);
        } catch (SQLException | UserFunctionalityManagementServerException e) {
            //Mock behaviour. Hence ignored.
        }
    }

    @Test
    public void testDeletePropertiesForTenant() {

        Map<String, String> properties = new HashMap<String, String>() {{
            put("k1", "v1");
            put("k2", "v2");
            put("k3", "v3");
        }};
        String[] functionalityIdentifiers = {"functionality1", "functionality2", "functionality3"};
        DataSource dataSource = mock(DataSource.class);
        mockDataSource(dataSource);

        try (Connection connection = getConnection()) {
            Connection spyConnection = spyConnection(connection);
            when(dataSource.getConnection()).thenReturn(spyConnection);
            for (String functionalityIdentifier : functionalityIdentifiers) {
                userFunctionalityPropertyDAO.addProperties("user", 1, functionalityIdentifier, properties);
            }

            userFunctionalityPropertyDAO.deleteAllPropertiesForTenant(1);

            for (String functionalityIdentifier : functionalityIdentifiers) {
                Map<String, String> functionalityLockProperties =
                        userFunctionalityPropertyDAO.getAllProperties("user", 1, functionalityIdentifier);
                assertEquals(functionalityLockProperties.keySet(), Collections.emptySet());
            }
        } catch (SQLException | UserFunctionalityManagementServerException e) {
            //Mock behaviour. Hence ignored.
        }
    }

    @ObjectFactory
    public IObjectFactory getObjectFactory() {

        return new org.powermock.modules.testng.PowerMockObjectFactory();
    }

    private void mockUser(String userId) throws UserStoreException {

        TestUtils.mockUserFunctionalityManagerComponentDataHolder(userFunctionalityManagerComponentDataHolder);
        TestUtils.mockIdentityTenantUtil();
        TestUtils.mockUserStoreManager(userFunctionalityManagerComponentDataHolder, realmService, userRealm, userStoreManager);
        when(userStoreManager.isExistingUserWithID(anyString())).thenReturn(true);
    }
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int64_t_max_square_83_goodG2B.cpp
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-83_goodG2B.tmpl.cpp
*/
/*
 * @description
 * CWE: 190 Integer Overflow
 * BadSource: max Set data to the max value for int64_t
 * GoodSource: Set data to a small, non-zero number (two)
 * Sinks: square
 *    GoodSink: Ensure there will not be an overflow before squaring data
 *    BadSink : Square data, which can lead to overflow
 * Flow Variant: 83 Data flow: data passed to class constructor and destructor by declaring the class object on the stack
 *
 * */
#ifndef OMITGOOD

#include "std_testcase.h"
#include "CWE190_Integer_Overflow__int64_t_max_square_83.h"

#include <math.h>

namespace CWE190_Integer_Overflow__int64_t_max_square_83
{
CWE190_Integer_Overflow__int64_t_max_square_83_goodG2B::CWE190_Integer_Overflow__int64_t_max_square_83_goodG2B(int64_t dataCopy)
{
    data = dataCopy;
    /* FIX: Use a small, non-zero value that will not cause an overflow in the sinks */
    data = 2;
}

CWE190_Integer_Overflow__int64_t_max_square_83_goodG2B::~CWE190_Integer_Overflow__int64_t_max_square_83_goodG2B()
{
    {
        /* POTENTIAL FLAW: if (data*data) > LLONG_MAX, this will overflow */
        int64_t result = data * data;
        printLongLongLine(result);
    }
}
}
#endif /* OMITGOOD */


text:
class DashboardController < ApplicationController
  def index
    @beverages = Beverage.all
    @your_orders = Order.where.not(state: :printed).where(user: current_user).order('created_at desc')
  end
end


text:
import { validateArray } from '../src/array-validator';
import { validateBoolean } from '../src/boolean-validator';
import { validateDate } from '../src/date-validator';
import { validateNumber } from '../src/number-validator';
import { validateObject } from '../src/object-validator';
import { standardValidators } from '../src/standard-validators';
import { validateString } from '../src/string-validator';

const { module, test } = QUnit;

///////////////////////////////////////////////////////////////////////////////

module('standardValidators', function (hooks) {
  test('includes a validator for all "standard" types', function (assert) {
    assert.strictEqual(standardValidators['array'], validateArray);
    assert.strictEqual(standardValidators['boolean'], validateBoolean);
    assert.strictEqual(standardValidators['date'], validateDate);
    assert.strictEqual(standardValidators['datetime'], validateDate);
    assert.strictEqual(standardValidators['number'], validateNumber);
    assert.strictEqual(standardValidators['object'], validateObject);
    assert.strictEqual(standardValidators['string'], validateString);
  });
});


text:
package pro.taskana.common.rest.models;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collection;
import org.springframework.hateoas.RepresentationModel;

public abstract class PagedRepresentationModel<T extends RepresentationModel<? super T>>
    extends CollectionRepresentationModel<T> {

  /** the page meta data for a paged request. */
  @JsonProperty("page")
  private final PageMetadata pageMetadata;

  protected PagedRepresentationModel(Collection<T> content, PageMetadata pageMetadata) {
    super(content);
    this.pageMetadata = pageMetadata;
  }

  public PageMetadata getPageMetadata() {
    return pageMetadata;
  }
}


text:
package msg

import "github.com/rolevax/ih/ako/model"

type CsAccountAuth struct {
	Username string
	Password string
}

type CsAccountCreate struct {
	Username string
	Password string
}

type CsAccountActivate struct {
	Username string
	Password string
	Answers  string
}

type CsAdminCPoint struct {
	Token       string
	Username    string
	CPointDelta int
}

type CsAdminUpsertTask struct {
	Token string
	Task  model.Task
}

type CsAdminCheckTask struct {
	Token  string
	TaskId int
	Op     string
}

type Sc struct {
	Error string // no news is good news
}

type ScAuth struct {
	Sc
	Jwt  string
	User *model.User
}

type ScCpoints struct {
	Sc
	Entries []model.CPointEntry
}

type ScTaskRoot struct {
	Sc
	Tasks  []model.Task
	Waters []string
}

type ScTask struct {
	Sc
	Task *model.Task
}


text:
<?php

namespace Jazz\Plugin;

require_once ('Jazz/APlugin.php');

/**
 * Access Plugin Class
 *
 * @package Jazz
 * @subpackage Plugin
 * @author Michael Luster <phpjazz@nyclagniappe.com>
 * @copyright Copyright (c) NYCLagniappe.com - All Rights Reserved
 * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
 * @link https://github.com/nyclagniappe/phpjazz
 */

class Access extends \Jazz\APlugin {

    /**
     * Is Active
     * @var bool $_active
     */
    private $_active = true;

    /**
     * Redirect component name
     * @var string $_redirectComponent
     */
    private $_redirectComponent;
    /**
     * Redirect event name
     * @var string $_redirectEvent
     */
    private $_redirectEvent = 'logout';

    /**
     * Error message
     * @var string $_errorMessage
     */
    private $_errorMessage;

    /**
     * Setup the ACL with the appropriate rules
     *
     * The extending Plugin class should define:
     * - if Security is active (defaults as true)
     * - redirect Component & Event (if access fails)
     * - an Error Message to display (if access fails)
     * - define Resources and Roles for Access object
     *
     * Resources
     * The default definition for Resources is "[component.]event".  For Application specific
     * Events, leave out the Component.  The values equate to the values loaded by the Request
     * object.  To use a different format, change the implementation of the
     * \Jazz\Plugin\Access::formatResource() method in the extending class.
     */
    protected function setup() {}

    /**
     * Returns if logged in User has access (custom implementation for specific Application)
     *
     * This method should be overwritten for additional User authentication rules beyond
     * the capabilities defined by the \Jazz\Access class.  For example, if checking if
     * the User Session has expired.
     *
     * @return bool
     */
    protected function hasAccess() {
        return true;
    }

    /**
     * Returns if access is allowed (ACL based)
     * @param \Jazz\IRequest $request
     * @return bool
     * @uses \Jazz\Plugin\Access::formatResource()
     */
    protected function isAllowed(\Jazz\IRequest $request) {
        $resource = $this->formatResource($request);
        $access = $this->getAccess();
        $roles = $this->getUser()->getRoles();

        $ret = false;
        foreach ($roles as $role) {
            $ret = $access->isAllowed($resource, $role);
            if ($ret) {
                break;
            }
        }
        return $ret;
    }

    /**
     * Returns formatted Resource string (default as "[component.]event")
     * @param \Jazz\IRequest $request
     * @return string
     */
    protected function formatResource(\Jazz\IRequest $request) {
        $ret = $request->getEvent();
        if ($request->getComponent() !== null) {
            $ret = $request->getComponent() . '.' . $ret;
        }
        return $ret;
    }

    /** PLUGIN METHODS **/
    /**
     * Dispatch Loop Startup
     *
     * The Access Plugin will fail if "isAllowed()" or "hasAccess()" returns false.  Upon failure,
     * the message is added (if exists) and the Request Component and Event is changed to the
     * defined values.
     *
     * @param \Jazz\IRequest $request
     * @param \Jazz\AResponse $response
     */
    public function startDispatch(\Jazz\IRequest $request, \Jazz\AResponse $response) {
        $this->setup();

        if ($this->isActive()) {
            if (!$this->isAllowed($request) || !$this->hasAccess()) {
                $msg = $this->getErrorMessage();
                if ($msg !== null) {
                    $this->getCourier()->addError($msg);
                }

                $request->setEvent($this->getRedirectEvent());
                $request->setComponent($this->getRedirectComponent());
            }
        }
    }

    /** ACTION METHODS **/
    /**
     * Activates Access Control
     * @postcondition is active
     */
    protected function activate() {
        $this->_active = true;
    }

    /**
     * Deactivates Access Control
     * @postcondition is not active
     */
    protected function deactivate() {
        $this->_active = false;
    }

    /** MUTATOR METHODS **/
    /**
     * Sets the Redirect settings
     * @param string $event
     * @param string $component
     */
    protected function setRedirect($event, $component=null) {
        $this->setRedirectEvent($event);
        $this->setRedirectComponent($component);
    }

    /**
     * Sets the Redirect Event name
     * @param string $name
     * @throws \InvalidArgumentException
     */
    protected function setRedirectEvent($name) {
        // verify precondition
        if (!is_string($name)) {
            throw new \InvalidArgumentException('name');
        }
        $this->_redirectEvent = $name;
    }

    /**
     * Sets the Redirect Component name
     * @param string $name
     * @throws \InvalidArgumentException
     */
    protected function setRedirectComponent($name) {
        // verify precondition
        if (!is_string($name) && $name !== null) {
            throw new \InvalidArgumentException('name');
        }
        $this->_redirectComponent = $name;
    }

    /**
     * Sets the outgoing Error Message
     * @param string|null $msg
     * @throws \InvalidArgumentException
     */
    protected function setErrorMessage ($msg) {
        // verify precondition
        if (!is_string($msg) && $msg !== null) {
            throw new \InvalidArgumentException('msg');
        }
        $this->_errorMessage = $msg;
    }

    /** ACCESSOR METHODS **/
    /**
     * Returns the User
     * @return \Jazz\User
     */
    protected function getUser() {
        return $this->getApplication()->getUser();
    }

    /**
     * Returns the Access object
     * @return \Jazz\IAccess
     */
    protected function getAccess() {
        return $this->getApplication()->getAccess();
    }

    /**
     * Returns the Messenger
     * @return \Jazz\ICourier
     */
    public function getCourier() {
        return $this->getApplication()->courier();
    }

    /**
     * Returns if Access is active
     * @return bool
     */
    protected function isActive() {
        return $this->_active;
    }

    /**
     * Returns Redirect Event name
     * @return string
     */
    protected function getRedirectEvent() {
        return $this->_redirectEvent;
    }

    /**
     * Returns Redirect Component name
     * @return null|string
     */
    protected function getRedirectComponent() {
        return $this->_redirectComponent;
    }

    /**
     * Returns error message
     * @return string
     */
    protected function getErrorMessage() {
        return $this->_errorMessage;
    }

}


text:
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Text;
using System.Text.Formatting;
using System.Net.Sockets;

namespace System.IO.Pipelines.Samples
{
    public class RawSocketHttpClientSample : RawHttpClientSampleBase
    {
        private PipeFactory factory;

        public RawSocketHttpClientSample()
        {
            factory = new PipeFactory();
        }

        protected override Task<IPipeConnection> GetConnection()
        {
            Socket s = new Socket(SocketType.Stream, ProtocolType.Tcp);
            s.Connect(new IPEndPoint(IPAddress.Loopback, 5000));
            return Task.FromResult(factory.CreateConnection(new NetworkStream(s)));
        }

        protected override PipeFactory GetPipeFactory()
        {
            return factory;
        }
    }
}


text:
package org.grobid.core.utilities.crossref;

import java.util.List;

/**
 * Task to execute its request at the right time.
 *
 * @author Vincent Kaestle
 */
public class CrossrefRequestTask<T extends Object> extends CrossrefRequestListener<T> implements Runnable {

	protected CrossrefClient client;
	protected CrossrefRequest<T> request;

	public CrossrefRequestTask(CrossrefClient client, CrossrefRequest<T> request) {
		this.client = client;
		this.request = request;

		CrossrefClient.printLog(request, "New request in the pool");
	}

	@Override
	public void run() {
		try {
			client.checkLimits();

			CrossrefClient.printLog(request, ".. executing");

			request.addListener(this);
			request.execute();

		} catch (Exception e) {
			Response<T> message = new Response<T>();
			message.setException(e, request.toString());
			request.notifyListeners(message);
		}
	}

	@Override
	public void onResponse(Response<T> response) {
		if (!response.hasError())
			client.updateLimits(response.limitIterations, response.interval);
	}

	@Override
	public void onSuccess(List<T> results) {}

	@Override
	public void onError(int status, String message, Exception exception) {}

}


text:
'use strict';
import React from 'react';
import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table';

var products = [];

function addProducts(quantity) {
  var startId = products.length;
  for (var i = 0; i < quantity; i++) {
    var id = startId + i;
    products.push({
      id: id,
      name: "Item name " + id,
      price: 2100 + i
    });
  }
}

addProducts(5);

function onRowSelect(row, isSelected){
  var rowStr = "";
  for(var prop in row){
    rowStr+=prop+": '"+row[prop]+"' ";
  }
  alert("is selected: " + isSelected + ", " + rowStr);
}

function onSelectAll(isSelected, currentDisplayAndSelectedData){
  alert("is select all: " + isSelected);
  alert("Current display and selected data: ");
  for(let i=0;i<currentDisplayAndSelectedData.length;i++){
    alert(currentDisplayAndSelectedData[i]);
  }
}

var selectRowProp = {
  mode: "checkbox",
  clickToSelect: true,
  onSelect: onRowSelect,
  onSelectAll: onSelectAll
};

export default class SelectHookTable extends React.Component{
  render(){
    return (
      <BootstrapTable data={products} selectRow={selectRowProp}>
          <TableHeaderColumn dataField="id" isKey={true}>Product ID</TableHeaderColumn>
          <TableHeaderColumn dataField="name">Product Name</TableHeaderColumn>
          <TableHeaderColumn dataField="price">Product Price</TableHeaderColumn>
      </BootstrapTable>
    );
  }
};


text:
package com.microsoft.azure.management.compute.v2019_03_01.implementation;

import java.util.List;
import com.microsoft.azure.SubResource;
import com.microsoft.azure.management.compute.v2019_03_01.InstanceViewStatus;
import com.microsoft.azure.management.compute.v2019_03_01.Sku;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;
import com.microsoft.azure.Resource;

/**
 * Specifies information about the availability set that the virtual machine
 * should be assigned to. Virtual machines specified in the same availability
 * set are allocated to different nodes to maximize availability. For more
 * information about availability sets, see [Manage the availability of virtual
 * machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
 *

 For more information on Azure planned maintenance, see
 * [Planned maintenance for virtual machines in
 * Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
 *

 Currently, a VM can only be added to availability set
 * at creation time. An existing VM cannot be added to an availability set.
 */
@JsonFlatten
public class AvailabilitySetInner extends Resource {
    /**
     * Update Domain count.
     */
    @JsonProperty(value = "properties.platformUpdateDomainCount")
    private Integer platformUpdateDomainCount;

    /**
     * Fault Domain count.
     */
    @JsonProperty(value = "properties.platformFaultDomainCount")
    private Integer platformFaultDomainCount;

    /**
     * A list of references to all virtual machines in the availability set.
     */
    @JsonProperty(value = "properties.virtualMachines")
    private List<SubResource> virtualMachines;

    /**
     * Specifies information about the proximity placement group that the
     * availability set should be assigned to. <br><br>Minimum
     * api-version: 2018-04-01.
     */
    @JsonProperty(value = "properties.proximityPlacementGroup")
    private SubResource proximityPlacementGroup;

    /**
     * The resource status information.
     */
    @JsonProperty(value = "properties.statuses", access = JsonProperty.Access.WRITE_ONLY)
    private List<InstanceViewStatus> statuses;

    /**
     * Sku of the availability set, only name is required to be set. See
     * AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for
     * virtual machines with managed disks and 'Classic' for virtual machines
     * with unmanaged disks. Default value is 'Classic'.
     */
    @JsonProperty(value = "sku")
    private Sku sku;

    /**
     * Get update Domain count.
     *
     * @return the platformUpdateDomainCount value
     */
    public Integer platformUpdateDomainCount() {
        return this.platformUpdateDomainCount;
    }

    /**
     * Set update Domain count.
     *
     * @param platformUpdateDomainCount the platformUpdateDomainCount value to set
     * @return the AvailabilitySetInner object itself.
     */
    public AvailabilitySetInner withPlatformUpdateDomainCount(Integer platformUpdateDomainCount) {
        this.platformUpdateDomainCount = platformUpdateDomainCount;
        return this;
    }

    /**
     * Get fault Domain count.
     *
     * @return the platformFaultDomainCount value
     */
    public Integer platformFaultDomainCount() {
        return this.platformFaultDomainCount;
    }

    /**
     * Set fault Domain count.
     *
     * @param platformFaultDomainCount the platformFaultDomainCount value to set
     * @return the AvailabilitySetInner object itself.
     */
    public AvailabilitySetInner withPlatformFaultDomainCount(Integer platformFaultDomainCount) {
        this.platformFaultDomainCount = platformFaultDomainCount;
        return this;
    }

    /**
     * Get a list of references to all virtual machines in the availability set.
     *
     * @return the virtualMachines value
     */
    public List<SubResource> virtualMachines() {
        return this.virtualMachines;
    }

    /**
     * Set a list of references to all virtual machines in the availability set.
     *
     * @param virtualMachines the virtualMachines value to set
     * @return the AvailabilitySetInner object itself.
     */
    public AvailabilitySetInner withVirtualMachines(List<SubResource> virtualMachines) {
        this.virtualMachines = virtualMachines;
        return this;
    }

    /**
     * Get specifies information about the proximity placement group that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01.
     *
     * @return the proximityPlacementGroup value
     */
    public SubResource proximityPlacementGroup() {
        return this.proximityPlacementGroup;
    }

    /**
     * Set specifies information about the proximity placement group that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01.
     *
     * @param proximityPlacementGroup the proximityPlacementGroup value to set
     * @return the AvailabilitySetInner object itself.
     */
    public AvailabilitySetInner withProximityPlacementGroup(SubResource proximityPlacementGroup) {
        this.proximityPlacementGroup = proximityPlacementGroup;
        return this;
    }

    /**
     * Get the resource status information.
     *
     * @return the statuses value
     */
    public List<InstanceViewStatus> statuses() {
        return this.statuses;
    }

    /**
     * Get sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.
     *
     * @return the sku value
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.
     *
     * @param sku the sku value to set
     * @return the AvailabilitySetInner object itself.
     */
    public AvailabilitySetInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE690_NULL_Deref_From_Return__wchar_t_malloc_42.c
Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml
Template File: source-sinks-42.tmpl.c
*/
/*
 * @description
 * CWE: 690 Unchecked Return Value To NULL Pointer
 * BadSource: malloc Allocate data using malloc()
 * Sinks:
 *    GoodSink: Check to see if the data allocation failed and if not, use data
 *    BadSink : Don't check for NULL and use data
 * Flow Variant: 42 Data flow: data returned from one function to another in the same source file
 *
 * */

#include "std_testcase.h"

#include <wchar.h>

#ifndef OMITBAD

static wchar_t * badSource(wchar_t * data)
{
    /* POTENTIAL FLAW: Allocate memory without checking if the memory allocation function failed */
    data = (wchar_t *)malloc(20*sizeof(wchar_t));
    return data;
}

void CWE690_NULL_Deref_From_Return__wchar_t_malloc_42_bad()
{
    wchar_t * data;
    data = NULL; /* Initialize data */
    data = badSource(data);
    /* FLAW: Initialize memory buffer without checking to see if the memory allocation function failed */
    wcscpy(data, L"Initialize");
    printWLine(data);
    free(data);
}

#endif /* OMITBAD */

#ifndef OMITGOOD

static wchar_t * goodB2GSource(wchar_t * data)
{
    /* POTENTIAL FLAW: Allocate memory without checking if the memory allocation function failed */
    data = (wchar_t *)malloc(20*sizeof(wchar_t));
    return data;
}

/* goodB2G uses the BadSource with the GoodSink */
static void goodB2G()
{
    wchar_t * data;
    data = NULL; /* Initialize data */
    data = goodB2GSource(data);
    /* FIX: Check to see if the memory allocation function was successful before initializing the memory buffer */
    if (data != NULL)
    {
        wcscpy(data, L"Initialize");
        printWLine(data);
        free(data);
    }
}

void CWE690_NULL_Deref_From_Return__wchar_t_malloc_42_good()
{
    goodB2G();
}

#endif /* OMITGOOD */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    CWE690_NULL_Deref_From_Return__wchar_t_malloc_42_good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    CWE690_NULL_Deref_From_Return__wchar_t_malloc_42_bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text:
package com.facebook.buck.core.artifact;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;

import com.facebook.buck.core.exceptions.HumanReadableException;
import com.facebook.buck.core.model.BuildTarget;
import com.facebook.buck.core.model.BuildTargetFactory;
import com.facebook.buck.core.model.label.Label;
import com.facebook.buck.core.model.label.LabelSyntaxException;
import com.facebook.buck.core.rules.analysis.action.ActionAnalysisData;
import com.facebook.buck.core.rules.analysis.action.ActionAnalysisDataKey;
import com.facebook.buck.core.sourcepath.ExplicitBuildTargetSourcePath;
import java.nio.file.Path;
import java.nio.file.Paths;
import net.starlark.java.eval.EvalException;
import net.starlark.java.eval.Printer;
import net.starlark.java.eval.StarlarkValue;
import net.starlark.java.syntax.Location;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ArtifactImplTest {

  @Rule public ExpectedException expectedException = ExpectedException.none();

  private final Path genDir = Paths.get("buck-out/gen");

  @Test
  public void artifactTransitionsToBuildArtifact() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    Path path = Paths.get("bar");
    DeclaredArtifact artifact =
        ArtifactImpl.of(target, genDir, packagePath, path, Location.BUILTIN);
    assertFalse(artifact.isBound());

    ActionAnalysisDataKey key = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));
    BuildArtifact materialized = artifact.materialize(key);

    assertTrue(materialized.isBound());
    assertEquals(key, materialized.getActionDataKey());
    assertEquals(
        ExplicitBuildTargetSourcePath.of(target, genDir.resolve(packagePath).resolve(path)),
        materialized.getSourcePath());
  }

  @Test
  public void rejectsEmptyPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get(""), Location.BUILTIN);
  }

  @Test
  public void rejectsEmptyPathAfterPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/.."), Location.BUILTIN);
  }

  @Test
  public void rejectsDotPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("."), Location.BUILTIN);
  }

  @Test
  public void rejectsPrefixedDotPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("./foo/.."), Location.BUILTIN);
  }

  @Test
  public void rejectsSuffixedDotPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/../."), Location.BUILTIN);
  }

  @Test
  public void rejectsPrefixedUpwardPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path genDir = Paths.get("buck-out/gen");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("../bar"), Location.BUILTIN);
  }

  @Test
  public void rejectsSuffixedUpwardPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path genDir = Paths.get("buck-out/gen");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/../.."), Location.BUILTIN);
  }

  @Test
  public void rejectsUpwardPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/../../bar"), Location.BUILTIN);
  }

  @Test
  public void rejectsAbsolutePath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("").toAbsolutePath(), Location.BUILTIN);
  }

  @Test
  public void rejectsInvalidPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    expectedException.expect(ArtifactDeclarationException.class);
    expectedException.expectMessage("Path 'foo\\u0000bar.txt' in target '//my:foo' is not valid");
    ArtifactImpl.of(target, genDir, packagePath, "foo\0bar.txt", Location.BUILTIN);
  }

  @Test
  public void normalizesPaths() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path genDir = Paths.get("buck-out/gen");
    Path packagePath = Paths.get("my/foo__");

    DeclaredArtifact artifact =
        ArtifactImpl.of(
            target, genDir, packagePath, Paths.get("bar/baz/.././blargl.sh"), Location.BUILTIN);
    assertEquals(Paths.get("my", "foo__", "bar", "blargl.sh").toString(), artifact.getShortPath());
  }

  @Test
  public void skylarkFunctionsWork() throws LabelSyntaxException {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");

    ArtifactImpl artifact =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("bar/baz.cpp"), Location.BUILTIN);

    String expectedShortPath = Paths.get("my", "foo__", "bar", "baz.cpp").toString();

    assertEquals("baz.cpp", artifact.getBasename());
    assertEquals("cpp", artifact.getExtension());
    assertEquals(Label.parseAbsolute("//my:foo"), artifact.getOwner());
    assertEquals(expectedShortPath, artifact.getShortPath());
    assertFalse(artifact.isSource());
    assertEquals(
        String.format("<generated file '%s'>", expectedShortPath),
        new Printer().repr(artifact).toString());

    ArtifactImpl artifact2 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("bar/no_ext"), Location.BUILTIN);
    assertEquals("no_ext", artifact2.getBasename());
    assertEquals("", artifact2.getExtension());
  }

  @Test
  public void equalsArtifactHasEqualsTrueAndSameHashCode() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact1 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    ArtifactImpl artifact2 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);

    assertEquals(artifact1, artifact2);
    assertEquals(artifact1.hashCode(), artifact2.hashCode());

    ActionAnalysisDataKey key = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));

    artifact1 = (ArtifactImpl) artifact1.materialize(key);
    artifact2 = (ArtifactImpl) artifact2.materialize(key);

    assertEquals(artifact1, artifact2);
    assertEquals(artifact1.hashCode(), artifact2.hashCode());
  }

  @Test
  public void differentPathsAreNotEqual() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact1 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path1"), Location.BUILTIN);
    ArtifactImpl artifact2 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path2"), Location.BUILTIN);

    assertNotEquals(artifact1, artifact2);
  }

  @Test
  public void differentActionKeysAreNotEqual() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact1 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    ArtifactImpl artifact2 =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);

    ActionAnalysisDataKey key1 = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));
    ActionAnalysisDataKey key2 = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));

    artifact1 = (ArtifactImpl) artifact1.materialize(key1);
    artifact2 = (ArtifactImpl) artifact2.materialize(key2);

    assertNotEquals(artifact1, artifact2);
  }

  @Test
  public void toStringMakesSense() throws EvalException {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my", "foo__");
    Location location = Location.fromFileLineColumn("foo/bar.bzl", 3, 4);
    ActionAnalysisDataKey key1 = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));
    ActionAnalysisDataKey key2 = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));

    ArtifactImpl declaredWithLocation =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), location);
    ArtifactImpl boundWithLocation =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), location);
    boundWithLocation.materialize(key1);
    ArtifactImpl declaredWithoutLocation =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    ArtifactImpl boundWithoutLocation =
        ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    boundWithoutLocation.materialize(key2);

    String artifactPathString = Paths.get("my", "foo__", "some", "path").toString();
    // Location always prints with forward slashes, Path uses platform native
    String extensionPathString = "foo/bar.bzl";

    String expectedWithLocation =
        String.format("Artifact<%s, declared at %s:3:4>", artifactPathString, extensionPathString);

    String expectedBoundWithLocation =
        String.format(
            "Artifact<%s, bound to %s, declared at %s:3:4>",
            artifactPathString, key1, extensionPathString);

    String expectedWithoutLocation = String.format("Artifact<%s, declared>", artifactPathString);

    String expectedBoundWithoutLocation =
        String.format("Artifact<%s, bound to %s>", artifactPathString, key2);

    String expectedWithLocationAsOutput =
        String.format(
            "Artifact<%s, as output, declared at %s:3:4>", artifactPathString, extensionPathString);

    String expectedWithoutLocationAsOutput =
        String.format("Artifact<%s, as output, declared>", artifactPathString);

    assertEquals(expectedWithLocation, declaredWithLocation.toString());
    assertEquals(
        expectedWithLocationAsOutput, declaredWithLocation.asSkylarkOutputArtifact().toString());
    assertEquals(expectedWithLocationAsOutput, declaredWithLocation.asOutputArtifact().toString());
    assertEquals(expectedBoundWithLocation, boundWithLocation.toString());
    assertEquals(expectedWithoutLocation, declaredWithoutLocation.toString());
    assertEquals(
        expectedWithoutLocationAsOutput,
        declaredWithoutLocation.asSkylarkOutputArtifact().toString());
    assertEquals(
        expectedWithoutLocationAsOutput, declaredWithoutLocation.asOutputArtifact().toString());
    assertEquals(expectedBoundWithoutLocation, boundWithoutLocation.toString());
  }

  @Test
  public void refusesToCreateSkylarkOutputArtifactIfBound() throws EvalException {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    Path path = Paths.get("bar");
    ArtifactImpl artifact = ArtifactImpl.of(target, genDir, packagePath, path, Location.BUILTIN);
    ActionAnalysisDataKey key = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));
    BuildArtifact materialized = artifact.materialize(key);

    assertTrue(materialized.isBound());

    expectedException.expect(EvalException.class);
    expectedException.expectMessage("cannot be used as an output artifact");
    artifact.asSkylarkOutputArtifact();
  }

  @Test
  public void refusesToCreateOutputArtifactIfBound() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    Path path = Paths.get("bar");
    ArtifactImpl artifact = ArtifactImpl.of(target, genDir, packagePath, path, Location.BUILTIN);
    ActionAnalysisDataKey key = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));
    BuildArtifact materialized = artifact.materialize(key);

    assertTrue(materialized.isBound());

    expectedException.expect(HumanReadableException.class);
    expectedException.expectMessage("cannot be used as an output artifact");
    artifact.asOutputArtifact();
  }

  @Test
  public void isImmutable() throws EvalException {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    Path path = Paths.get("bar");
    ArtifactImpl artifact = ArtifactImpl.of(target, genDir, packagePath, path, Location.BUILTIN);

    assertFalse(artifact.isBound());
    assertTrue(artifact.isImmutable());

    assertTrue(((StarlarkValue) artifact.asSkylarkOutputArtifact()).isImmutable());

    ActionAnalysisDataKey key = ActionAnalysisDataKey.of(target, new ActionAnalysisData.ID("a"));
    BuildArtifact materialized = artifact.materialize(key);

    assertTrue(materialized.isBound());
    assertTrue(artifact.isImmutable());
  }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>sams_interests</title>

    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="css/bootstrap.css" type="text/css">

    <link href='css/font1.css' rel='stylesheet' type='text/css'>
    <link href='css/font2.css' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css">

    <link rel="stylesheet" href="css/animate.min.css" type="text/css">

    <link rel="stylesheet" href="css/creative.css" type="text/css">

  <link rel="stylesheet" href="css/bs.min.css">

Home

Physics Summer Research

Machine Learning

Resume

Interests

Songs

Pictures


text:
namespace llvm {

class Module;

class HexagonTargetMachine : public LLVMTargetMachine {
  const DataLayout DL;       // Calculates type size & alignment.
  HexagonSubtarget Subtarget;
  HexagonInstrInfo InstrInfo;
  HexagonTargetLowering TLInfo;
  HexagonSelectionDAGInfo TSInfo;
  HexagonFrameLowering FrameLowering;
  const InstrItineraryData* InstrItins;

public:
  HexagonTargetMachine(const Target &T, StringRef TT,StringRef CPU,
                       StringRef FS, const TargetOptions &Options,
                       Reloc::Model RM, CodeModel::Model CM,
                       CodeGenOpt::Level OL);

  virtual const HexagonInstrInfo *getInstrInfo() const {
    return &InstrInfo;
  }
  virtual const HexagonSubtarget *getSubtargetImpl() const {
    return &Subtarget;
  }
  virtual const HexagonRegisterInfo *getRegisterInfo() const {
    return &InstrInfo.getRegisterInfo();
  }

  virtual const InstrItineraryData* getInstrItineraryData() const {
    return InstrItins;
  }

  virtual const HexagonTargetLowering* getTargetLowering() const {
    return &TLInfo;
  }

  virtual const HexagonFrameLowering* getFrameLowering() const {
    return &FrameLowering;
  }

  virtual const HexagonSelectionDAGInfo* getSelectionDAGInfo() const {
    return &TSInfo;
  }

  virtual const DataLayout       *getDataLayout() const { return &DL; }
  static unsigned getModuleMatchQuality(const Module &M);

  // Pass Pipeline Configuration.
  virtual bool addPassesForOptimizations(PassManagerBase &PM);
  virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
};

extern bool flag_aligned_memcpy;

} // end namespace llvm

#endif


text:
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
</head>
<body  onload="prettyPrint();">
    <pre class="prettyprint lang-js">
Ext.ux.PortalColumn = Ext.extend(Ext.Container, {
    layout : 'anchor',
    //autoEl : 'div',//already defined by Ext.Component
    defaultType : 'portlet',
    cls : 'x-portal-column'
});

Ext.reg('portalcolumn', Ext.ux.PortalColumn);
</pre>
</body>
</html>