text:
var Twixt = (function () {

	/*
	-------------------
	Twixt: tween engine
	-------------------

	Modifiers:
		ease	[Default: linear]
		delay	[Default: 0]
		onStart
		onComplete
		onUpdate
		onStartParams
		onCompleteParams
		onUpdateParams
		useInt(TBI)

	Special properties:

	Expected suffixes:
		%
		em, ex, ch, rem
		px, cm, mm, in, pt, pc
		deg, rad, grad, turn
		s, ms
		Hz, kHz
		dpi, dpcm, dppx
		vw, vh, vmin, vmax

	*/

	//Private props and methods//
	/////////////////////////////

	//var jobDict = {};					//Provides look-up for jobs
	var jobs = [];						//List of active (or pending) jobs
	var onEventFunctions = [];			//Function refs added here to be executed with each update or after completing
	var onEventParams = [];				//Function params added here to be executed with each update or after completing

	var animating = false;				//No new frames processed except while tween jobs are in the list
	var updateMethod = "";				//ID for means of updating frames, determined at runtime
	var frameRate = 60;					//Frames per second, if requestAnimationFrame unavailable
	var frameInterval = 1000/frameRate;	//Interval between frames

	var addedTime = 0;					//Last time at which new jobs were added
	var currentFrameTime = 0;			//Time at processing of current frame
	var lastFrameTime = 0;				//Time when last frame came round, if requestAnimationFrame unavailable

	var nums = "1234567890.";			//For separating numerals and suffix
	var defaultEase = "linear";			//Default tween easing function

	var easeFunctions = {				//Range of easing functions, with arguments: current time, starting value, delta value and total time
		linear: function (ct, sv, dv, tt) { return dv*ct/tt + sv; },
		quadIn: function (ct, sv, dv, tt) { ct /= tt;	return dv*ct*ct + sv; },
		quadOut: function (ct, sv, dv, tt) { ct /= tt; return -dv * ct*(ct-2) + sv; },
		quadInOut: function (ct, sv, dv, tt) { ct /= tt/2; if (ct < 1) return dv/2*ct*ct + sv; ct--; return -dv/2 * (ct*(ct-2) - 1) + sv; },
		cubicIn: function (ct, sv, dv, tt) { ct /= tt; return dv*ct*ct*ct + sv; },
		cubicOut: function (ct, sv, dv, tt) { ct /= tt; ct--; return dv*(ct*ct*ct + 1) + sv; },
		cubicInOut: function (ct, sv, dv, tt) { ct /= tt/2; if (ct < 1) return dv/2*ct*ct*ct + sv; ct -= 2; return dv/2*(ct*ct*ct + 2) + sv; },
		quartIn: function (ct, sv, dv, tt) { ct /= tt; return dv*ct*ct*ct*ct + sv; },
		quartOut: function (ct, sv, dv, tt) { ct /= tt; ct--; return -dv * (ct*ct*ct*ct - 1) + sv; },
		quartInOut: function (ct, sv, dv, tt) { ct /= tt/2; if (ct < 1) return dv/2*ct*ct*ct*ct + sv; ct -= 2; return -dv/2 * (ct*ct*ct*ct - 2) + sv; },
		quintIn: function (ct, sv, dv, tt) { ct /= tt; return dv*ct*ct*ct*ct*ct + sv; },
		quintOut: function (ct, sv, dv, tt) { ct /= tt; ct--; return dv*(ct*ct*ct*ct*ct + 1) + sv; },
		quintInOut: function (ct, sv, dv, tt) { ct /= tt/2; if (ct < 1) return dv/2*ct*ct*ct*ct*ct + sv; ct -= 2; return dv/2*(ct*ct*ct*ct*ct + 2) + sv; },
		sineIn: function (ct, sv, dv, tt) { return -dv * Math.cos(ct/tt * (Math.PI/2)) + dv + sv; },
		sineOut: function (ct, sv, dv, tt) { return dv * Math.sin(ct/tt * (Math.PI/2)) + sv; },
		sineInOut: function (ct, sv, dv, tt) { return -dv/2 * (Math.cos(Math.PI*ct/tt) - 1) + sv; },
		expoIn: function (ct, sv, dv, tt) { return dv * Math.pow( 2, 10 * (ct/tt - 1) ) + sv; },
		expoOut: function (ct, sv, dv, tt) { return dv * ( -Math.pow( 2, -10 * ct/tt ) + 1 ) + sv; },
		expoInOut: function (ct, sv, dv, tt) { ct /= tt/2; if (ct < 1) return dv/2 * Math.pow( 2, 10 * (ct - 1) ) + sv; ct--; return dv/2 * ( -Math.pow( 2, -10 * ct) + 2 ) + sv; },
		circIn: function (ct, sv, dv, tt) { ct /= tt; return -dv * (Math.sqrt(1 - ct*ct) - 1) + sv; },
		circOut: function (ct, sv, dv, tt) { ct /= tt; ct--; return dv * Math.sqrt(1 - ct*ct) + sv; },
		circInOut: function (ct, sv, dv, tt) { ct /= tt/2; if (ct < 1) return -dv/2 * (Math.sqrt(1 - ct*ct) - 1) + sv; ct -= 2; return dv/2 * (Math.sqrt(1 - ct*ct) + 1) + sv; },
		backIn: function (ct, sv, dv, tt) { var s = 1.70158; return dv*(ct/=tt)*ct*((s+1)*ct - s) + sv; },
		backOut: function (ct, sv, dv, tt) { var s = 1.70158; return dv*((ct=ct/tt-1)*ct*((s+1)*ct + s) + 1) + sv; },
		backInOut: function (ct, sv, dv, tt) { var s = 1.70158; if ((ct/=tt/2) < 1) return dv/2*(ct*ct*(((s*=(1.525))+1)*ct - s)) + sv; return dv/2*((ct-=2)*ct*(((s*=(1.525))+1)*ct + s) + 2) + sv; }
	}

	function animation_start() {
		if (updateMethod == "") updateMethod_select();

		currentFrameTime = addedTime;
		animating = true;
		engine_update();
	}

	function updateMethod_select() {
		//TBI...//
		updateMethod = "FALLBACK";
	}

	function frame_requestNext() {
		//Perform next frame request appropriate to the update method//
		if (updateMethod == "FALLBACK") {
			var targetInterval = Math.max(frameInterval - (currentFrameTime - lastFrameTime), 0);
			setTimeout(engine_update, targetInterval);
			lastFrameTime = currentFrameTime + targetInterval;
		} else {
			//TBI
		}
	}

	function engine_update() {
		//Capture new time//
		currentFrameTime = new Date().getTime();

		//Update all jobs//
		var numJobs = jobs.length;
		for (var i = 0; i < numJobs; i++) {
			job_update(jobs[i]);
		}

		//Execute on update / complete functions, if supplied, then clear list//
		var numFuncs = onEventFunctions.length;
		for (var i2 = 0; i2 < numFuncs; i2++) {
			onEventFunctions[i2].apply(null, onEventParams[i2]);
		}
		onEventFunctions = [];
		onEventParams = [];

		//Remove any finished jobs//
		for (var i3 = numJobs-1; i3 > -1; i3--) {
			if (jobs[i3].finished) {
				jobs.splice(i3, 1);
			}
		}

		//Request another frame only if there is more work to do//
		if (jobs.length != 0) {
			frame_requestNext();
		} else {
			animating = false;
		}
	}

	function job_update(job) {
		//Calculate current time, no higher than the total time//
		cT = Math.min(currentFrameTime - job.sT, job.tT);

		//If tween isn't due to start yet, abort without updating//
		if (cT < 0) return;

		//Set new property value based on progress through tween and selected ease function//
		if (job.tT == 0) {
			job.target[job.property] = job.sV + job.dV + job.suffix;
		} else {
			job.target[job.property] = easeFunctions[job.ease](cT, job.sV, job.dV, job.tT) + job.suffix;
		}

		//If present, add onStart function to the array for execution after all updates have been made, then remove so not called twice//
		if (job.onStart) {
			onEventFunctions.push(job.onStart);
			onEventParams.push(job.onStartParams);
			job.onStart = undefined;
			job.onStartParams = undefined;
		}

		//If present, add onUpdate function to the array for execution after all updates have been made//
		if (job.onUpdate) {
			onEventFunctions.push(job.onUpdate);
			onEventParams.push(job.onUpdateParams);
		}

		//If the tween has finished, mark the job for removal, if present, add onComplete function to array for subsequnt execution//
		if (cT >= job.tT) {
			job.finished = true;
			if (job.onComplete) {
				onEventFunctions.push(job.onComplete);
				onEventParams.push(job.onCompleteParams);
			}
		}
	}

	function job_add(target, property, sT, tT, sV, eV, ease, onStart, onUpdate, onComplete, onStartParams, onUpdateParams, onCompleteParams) {
		//Record and remove any suffixes//
		var suffix = suffix_detect(sV);
		sV = parseFloat(sV);
		eV = parseFloat(eV);

		//Record delta value//
		var dV = eV - sV;

		//Process for special properties//
		//...

		//Set up job object / jobject//
		var job = {
			target:target,
			property:property,
			sT:sT,
			tT:tT,
			sV:sV,
			dV:dV,
			suffix:suffix,
			ease:ease,
			finished:false,
			onStart:onStart,
			onUpdate:onUpdate,
			onComplete:onComplete,
			onStartParams:onStartParams,
			onUpdateParams:onUpdateParams,
			onCompleteParams:onCompleteParams
		}

		//Add job to dictionary, overwriting any existing//
		var numJobs = jobs.length;
		for (var i = 0; i < numJobs; i++) {
			if ((jobs[i].target === job.target) && (jobs[i].property === job.property)) {
				jobs.splice(i, 1);
				break;
			}
		}
		jobs.push(job);

	}

	function suffix_detect(value) {
		//Return empty suffix if value is of a numeric type or otherwise not a string//
		if (typeof value != "string") return "";

		var suffStart = 0;
		var hasSuffix = false;

		//Check where in the string the numerals end and suffix begins, if present//
		for (var i = value.length - 1; i > -1; i--) {
			if (nums.indexOf(value.charAt(i)) != -1) {
				suffStart = i + 1;
				break;
			} else {
				hasSuffix = true;
			}
		}

		//Return trimmed suffix if present//
		if (hasSuffix) return value.substr(suffStart);
		else return "";
	}

	function object_duplicate(properties) {
		var duplicate = {};
		for (var property in properties) {
			duplicate[property] = properties[property];
		}
		return duplicate;
	}

	function to(target, duration, properties) {
		properties = object_duplicate(properties);

		//Capture delay prop or set 0//
		var delay = 0;
		if ("delay" in properties) {
			if (properties.delay > 0) delay = properties.delay * 1000;
			delete properties.delay;
		}

		//Initialise start and end time props//
		addedTime = new Date().getTime();
		var sT = addedTime + delay;
		var tT = duration * 1000;

		//Capture ease or set default//
		var ease = defaultEase;
		if ("ease" in properties) {
			if (properties.ease in easeFunctions) ease = properties.ease;
			else console.log("Unknown ease function supplied");
			delete properties.ease;
		}

		//Capture any function modifiers//
		var onStart;
		var onUpdate;
		var onComplete;
		var onStartParams = [];
		var onUpdateParams = [];
		var onCompleteParams = [];
		if ("onStart" in properties) {
			onStart = properties.onStart;
			delete properties.onStart;
		}
		if ("onUpdate" in properties) {
			onUpdate = properties.onUpdate;
			delete properties.onUpdate;
		}
		if ("onComplete" in properties) {
			onComplete = properties.onComplete;
			delete properties.onComplete;
		}
		if ("onStartParams" in properties) {
			onStartParams = properties.onStartParams;
			delete properties.onStartParams;
		}
		if ("onUpdateParams" in properties) {
			onUpdateParams = properties.onUpdateParams;
			delete properties.onUpdateParams;
		}
		if ("onCompleteParams" in properties) {
			onCompleteParams = properties.onCompleteParams;
			delete properties.onCompleteParams;
		}

		//Create jobs for all non-modifier properties//
		var addedFunctions = false;
		for (var property in properties) {
			if (! addedFunctions) {
				job_add(target, property, sT, tT, target[property], properties[property], ease, onStart, onUpdate, onComplete, onStartParams, onUpdateParams, onCompleteParams);
				addedFunctions = true;
			} else {
				job_add(target, property, sT, tT, target[property], properties[property], ease);
			}
		}

		//If not animating currently, start//
		if (! animating) animation_start();
	}

	//Public interface//
	////////////////////

	return {
		to:to
	};

})();


text:
package org.jboss.resteasy.test.providers.custom.resource;

public class ReaderWriterCustomer {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.rapportive.storm.amqp;

import java.io.IOException;

import com.rabbitmq.client.AMQP.Queue;

import com.rabbitmq.client.Channel;

/**
 * Declares a named, durable queue and binds it to an existing exchange.  This
 * is a good choice for production use as the queue will survive spout
 * restarts, so you won't miss messages if your spout crashes.
 *
 *
N.B. this could be risky under some circumstances. e.g.
 * if while prototyping you set a development topology consuming from a
 * production AMQP server, then kill your topology and go home for the night;
 * messages will continue to be queued up, which could threaten the stability
 * of the AMQP server if the exchange is high-volume.  For prototyping consider
 * {@link ExclusiveQueueWithBinding}.

 *
 *
This queue is safe for multiple parallel spout tasks: as they all consume
 * the same named queue, the AMQP broker will round-robin messages between
 * them, so each message will get processed only once (barring redelivery due
 * to outages).

 */
public class SharedQueueWithBinding implements QueueDeclaration {
    private static final long serialVersionUID = 2364833412534518859L;

    private final String queueName;
    private final String exchange;
    private final String routingKey;

    /**
     * Create a declaration of a named, durable, non-exclusive queue bound to
     * the specified exchange.
     *
     * @param queueName  name of the queue to be declared.
     * @param exchange  exchange to bind the queue to.
     * @param routingKey  routing key for the exchange binding.  Use "#" to
     *                    receive all messages published to the exchange.
     */
    public SharedQueueWithBinding(String queueName, String exchange, String routingKey) {
        this.queueName = queueName;
        this.exchange = exchange;
        this.routingKey = routingKey;
    }

    /**
     * Verifies the exchange exists, creates the named queue if it does not
     * exist, and binds it to the exchange.
     *
     * @return the server's response to the successful queue declaration.
     *
     * @throws IOException  if the exchange does not exist, the queue could not
     *                      be declared, or if the AMQP connection drops.
     */
    @Override
    public Queue.DeclareOk declare(Channel channel) throws IOException {
        channel.exchangeDeclarePassive(exchange);

        final Queue.DeclareOk queue = channel.queueDeclare(
                queueName,
                /* durable */ true,
                /* non-exclusive */ false,
                /* non-auto-delete */ false,
                /* no arguments */ null);

        channel.queueBind(queue.getQueue(), exchange, routingKey);

        return queue;
    }

    /**
     * Returns <tt>true</tt> as this queue is safe for parallel consumers.
     */
    @Override
    public boolean isParallelConsumable() {
        return true;
    }
}


text:
001
020
021    package org.apache.hadoop.metrics.spi;
022
023    import java.util.Collections;
024    import java.util.Set;
025    import org.apache.hadoop.classification.InterfaceAudience;
026    import org.apache.hadoop.classification.InterfaceStability;
027    import org.apache.hadoop.metrics.spi.AbstractMetricsContext.MetricMap;
028    import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap;
029
030    /**
031     * Represents a record of metric data to be sent to a metrics system.
032     */
033    @InterfaceAudience.Public
034    @InterfaceStability.Evolving
035    public class OutputRecord {
036
037      private TagMap tagMap;
038      private MetricMap metricMap;
039
040      /** Creates a new instance of OutputRecord */
041      OutputRecord(TagMap tagMap, MetricMap metricMap) {
042        this.tagMap = tagMap;
043        this.metricMap = metricMap;
044      }
045
046      /**
047       * Returns the set of tag names
048       */
049      public Set<String> getTagNames() {
050        return Collections.unmodifiableSet(tagMap.keySet());
051      }
052
053      /**
054       * Returns a tag object which is can be a String, Integer, Short or Byte.
055       *
056       * @return the tag value, or null if there is no such tag
057       */
058      public Object getTag(String name) {
059        return tagMap.get(name);
060      }
061
062      /**
063       * Returns the set of metric names.
064       */
065      public Set<String> getMetricNames() {
066        return Collections.unmodifiableSet(metricMap.keySet());
067      }
068
069      /**
070       * Returns the metric object which can be a Float, Integer, Short or Byte.
071       */
072      public Number getMetric(String name) {
073        return metricMap.get(name);
074      }
075
076
077      /**
078       * Returns a copy of this record's tags.
079       */
080      public TagMap getTagsCopy() {
081        return new TagMap(tagMap);
082      }
083
084      /**
085       * Returns a copy of this record's metrics.
086       */
087      public MetricMap getMetricsCopy() {
088        return new MetricMap(metricMap);
089      }
090    }


text:
#ifndef OBOE_STREAM_BUFFERED_H
#define OBOE_STREAM_BUFFERED_H

#include <cstring>
#include <cassert>
#include "common/OboeDebug.h"
#include "oboe/AudioStream.h"
#include "oboe/AudioStreamCallback.h"
#include "fifo/FifoBuffer.h"

namespace oboe {

// A stream that contains a FIFO buffer.
// This is used to implement blocking reads and writes.
class AudioStreamBuffered : public AudioStream {
public:

    AudioStreamBuffered();
    explicit AudioStreamBuffered(const AudioStreamBuilder &builder);

    void allocateFifo();

    ResultWithValue<int32_t> write(const void *buffer,
                  int32_t numFrames,
                  int64_t timeoutNanoseconds) override;

    ResultWithValue<int32_t> read(void *buffer,
                 int32_t numFrames,
                 int64_t timeoutNanoseconds) override;

    ResultWithValue<int32_t> setBufferSizeInFrames(int32_t requestedFrames) override;

    int32_t getBufferCapacityInFrames() const override;

    ResultWithValue<int32_t> getXRunCount() const override {
        return ResultWithValue<int32_t>(mXRunCount);
    }

    bool isXRunCountSupported() const override;

protected:

    DataCallbackResult onDefaultCallback(void *audioData, int numFrames) override;

    // If there is no callback then we need a FIFO between the App and OpenSL ES.
    bool usingFIFO() const { return !isDataCallbackSpecified(); }

    virtual Result updateServiceFrameCounter() = 0;

    void updateFramesRead() override;
    void updateFramesWritten() override;

private:

    int64_t predictNextCallbackTime();

    void markCallbackTime(int32_t numFrames);

    // Read or write to the FIFO.
    // Only pass one pointer and set the other to nullptr.
    ResultWithValue<int32_t> transfer(void *readBuffer,
            const void *writeBuffer,
            int32_t numFrames,
            int64_t timeoutNanoseconds);

    void incrementXRunCount() {
        ++mXRunCount;
    }

    std::unique_ptr<FifoBuffer>   mFifoBuffer{};

    int64_t mBackgroundRanAtNanoseconds = 0;
    int32_t mLastBackgroundSize = 0;
    int32_t mXRunCount = 0;
};

} // namespace oboe

#endif //OBOE_STREAM_BUFFERED_H


text:
package org.jikesrvm.compilers.opt.mir2mc.ppc;

import org.jikesrvm.VM;
import org.jikesrvm.classloader.InterfaceMethodSignature;
import org.jikesrvm.classloader.RVMMethod;
import org.jikesrvm.compilers.opt.OptimizingCompilerException;
import org.jikesrvm.compilers.opt.ir.MIR_Binary;
import org.jikesrvm.compilers.opt.ir.MIR_Branch;
import org.jikesrvm.compilers.opt.ir.MIR_Call;
import org.jikesrvm.compilers.opt.ir.MIR_CondBranch;
import org.jikesrvm.compilers.opt.ir.MIR_CondBranch2;
import org.jikesrvm.compilers.opt.ir.MIR_CondCall;
import org.jikesrvm.compilers.opt.ir.MIR_DataLabel;
import org.jikesrvm.compilers.opt.ir.MIR_Load;
import org.jikesrvm.compilers.opt.ir.MIR_LoadUpdate;
import org.jikesrvm.compilers.opt.ir.MIR_LowTableSwitch;
import org.jikesrvm.compilers.opt.ir.MIR_Move;
import org.jikesrvm.compilers.opt.ir.MIR_Unary;
import org.jikesrvm.compilers.opt.ir.BasicBlock;
import org.jikesrvm.compilers.opt.ir.IR;
import org.jikesrvm.compilers.opt.ir.IRTools;
import org.jikesrvm.compilers.opt.ir.Instruction;
import static org.jikesrvm.compilers.opt.ir.Operators.BBEND_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.LABEL_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.MIR_LOWTABLESWITCH_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_ADD;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_ADDI;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_ADDIS;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BCL;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BCOND;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BCOND2_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BCTR;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BCTRL;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BCTRL_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BL;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_BLRL_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_CMPI;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_DATA_LABEL;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_LAddr;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_LDI;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_LDIS;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_LInt;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_LIntUX;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_MFSPR;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_MTSPR;
import static org.jikesrvm.compilers.opt.ir.Operators.PPC_SLWI;
import static org.jikesrvm.compilers.opt.ir.Operators.RESOLVE_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.UNINT_BEGIN_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.UNINT_END_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.YIELDPOINT_BACKEDGE_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.YIELDPOINT_EPILOGUE_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.YIELDPOINT_OSR_opcode;
import static org.jikesrvm.compilers.opt.ir.Operators.YIELDPOINT_PROLOGUE_opcode;
import org.jikesrvm.compilers.opt.ir.Register;
import org.jikesrvm.compilers.opt.ir.operand.MethodOperand;
import org.jikesrvm.compilers.opt.ir.operand.RegisterOperand;
import org.jikesrvm.compilers.opt.ir.operand.ppc.PowerPCConditionOperand;
import org.jikesrvm.compilers.opt.ir.ppc.PhysicalRegisterSet;
import static org.jikesrvm.compilers.opt.regalloc.ppc.PhysicalRegisterConstants.LAST_SCRATCH_GPR;
import org.jikesrvm.compilers.opt.util.Bits;
import org.jikesrvm.runtime.Entrypoints;
import org.jikesrvm.scheduler.RVMThread;
import org.vmmagic.unboxed.Offset;

/**
 * Final acts of MIR expansion for the PowerPC architecture.
 * Things that are expanded here (immediately before final assembly)
 * should only be those sequences that cannot be expanded earlier
 * due to difficulty in keeping optimizations from interfering with them.
 */
public abstract class FinalMIRExpansion extends IRTools {

  /**
   * @param ir the IR to expand
   * @return upperbound on number of machine code instructions
   * that will be generated for this IR
   */
  public static int expand(IR ir) {
    int instructionCount = 0;
    int conditionalBranchCount = 0;
    int machinecodeLength = 0;

    PhysicalRegisterSet phys = ir.regpool.getPhysicalRegisterSet();
    for (Instruction p = ir.firstInstructionInCodeOrder(); p != null; p = p.nextInstructionInCodeOrder()) {
      p.setmcOffset(-1);
      p.scratchObject = null;
      switch (p.getOpcode()) {
        case MIR_LOWTABLESWITCH_opcode: {

          BasicBlock tableBlock = p.getBasicBlock();
          BasicBlock nextBlock = tableBlock.splitNodeWithLinksAt(p.prevInstructionInCodeOrder(), ir);
          nextBlock.firstInstruction().setmcOffset(-1);
          Register regI = MIR_LowTableSwitch.getIndex(p).getRegister();
          int NumTargets = MIR_LowTableSwitch.getNumberOfTargets(p);
          tableBlock.appendInstruction(MIR_Call.create0(PPC_BL, null, null, nextBlock.makeJumpTarget()));

          for (int i = 0; i < NumTargets; i++) {
            tableBlock.appendInstruction(MIR_DataLabel.create(PPC_DATA_LABEL, MIR_LowTableSwitch.getClearTarget(p, i)));
          }
          Register temp = phys.getGPR(0);
          p.insertBefore(MIR_Move.create(PPC_MFSPR, A(temp), A(phys.getLR())));
          p.insertBefore(MIR_Binary.create(PPC_SLWI, I(regI), I(regI), IC(2)));
          p.insertBefore(MIR_LoadUpdate.create(PPC_LIntUX, I(temp), I(regI), A(temp)));
          p.insertBefore(MIR_Binary.create(PPC_ADD, A(regI), A(regI), I(temp)));
          p.insertBefore(MIR_Move.create(PPC_MTSPR, A(phys.getCTR()), A(regI)));
          MIR_Branch.mutate(p, PPC_BCTR);
          instructionCount += NumTargets + 7;
        }
        break;
        case PPC_BCOND2_opcode: {
          RegisterOperand cond = MIR_CondBranch2.getClearValue(p);
          p.insertAfter(MIR_CondBranch.create(PPC_BCOND,
                                              cond.copyU2U(),
                                              MIR_CondBranch2.getClearCond2(p),
                                              MIR_CondBranch2.getClearTarget2(p),
                                              MIR_CondBranch2.getClearBranchProfile2(p)));
          MIR_CondBranch.mutate(p,
                                PPC_BCOND,
                                cond,
                                MIR_CondBranch2.getClearCond1(p),
                                MIR_CondBranch2.getClearTarget1(p),
                                MIR_CondBranch2.getClearBranchProfile1(p));
          conditionalBranchCount++;
        }
        break;
        case PPC_BLRL_opcode:
        case PPC_BCTRL_opcode: {
          // indirect calls.  Second part of fast interface invoker expansion
          // See also ConvertToLowlevelIR.java
          if (VM.BuildForIMTInterfaceInvocation) {
            if (MIR_Call.hasMethod(p)) {
              MethodOperand mo = MIR_Call.getMethod(p);
              if (mo.isInterface()) {
                InterfaceMethodSignature sig = InterfaceMethodSignature.findOrCreate(mo.getMemberRef());
                int signatureId = sig.getId();
                Instruction s;
                if (Bits.fits(signatureId, 16)) {
                  s = MIR_Unary.create(PPC_LDI, I(phys.getGPR(LAST_SCRATCH_GPR)), IC(signatureId));
                  p.insertBefore(s);
                  instructionCount++;
                } else {
                  s =
                      MIR_Unary.create(PPC_LDIS,
                                       I(phys.getGPR(LAST_SCRATCH_GPR)),
                                       IC(Bits.PPCMaskUpper16(signatureId)));
                  p.insertBefore(s);
                  s =
                      MIR_Binary.create(PPC_ADDI,
                                        I(phys.getGPR(LAST_SCRATCH_GPR)),
                                        I(phys.getGPR(LAST_SCRATCH_GPR)),
                                        IC(Bits.PPCMaskLower16(signatureId)));
                  p.insertBefore(s);
                  instructionCount += 2;
                }
              }
            }
          }
          instructionCount++;
        }
        break;
        case LABEL_opcode:
        case BBEND_opcode:
        case UNINT_BEGIN_opcode:
        case UNINT_END_opcode:
          // These generate no code, so don't count them.
          break;
        case RESOLVE_opcode: {
          Register zero = phys.getGPR(0);
          Register JTOC = phys.getJTOC();
          Register CTR = phys.getCTR();
          if (VM.VerifyAssertions) {
            VM._assert(p.bcIndex >= 0 && p.position != null);
          }
          Offset offset = Entrypoints.optResolveMethod.getOffset();
          if (Bits.fits(offset, 16)) {
            p.insertBefore(MIR_Load.create(PPC_LAddr, A(zero), A(JTOC), IC(Bits.PPCMaskLower16(offset))));
          } else {
            if (VM.VerifyAssertions) VM._assert(Bits.fits(offset, 32)); //not implemented
            p.insertBefore(MIR_Binary.create(PPC_ADDIS, A(zero), A(JTOC), IC(Bits.PPCMaskUpper16(offset))));
            p.insertBefore(MIR_Load.create(PPC_LAddr, A(zero), A(zero), IC(Bits.PPCMaskLower16(offset))));
            instructionCount += 1;
          }
          p.insertBefore(MIR_Move.create(PPC_MTSPR, A(CTR), A(zero)));
          instructionCount += 3;
          // Because the GC Map code holds a reference to the original
          // instruction, it is important that we mutate the last instruction
          // because this will be the GC point.
          MIR_Call.mutate0(p, PPC_BCTRL, null, null);
          break;
        }
        case YIELDPOINT_PROLOGUE_opcode: {
          Register TSR = phys.getTSR();
          BasicBlock yieldpoint = findOrCreateYieldpointBlock(ir, RVMThread.PROLOGUE);
          // Because the GC Map code holds a reference to the original
          // instruction, it is important that we mutate the last instruction
          // because this will be the GC point.
          MIR_CondCall.mutate0(p,
                               PPC_BCL,
                               null,
                               null,
                               I(TSR),
                               PowerPCConditionOperand.NOT_EQUAL(),
                               yieldpoint.makeJumpTarget());
          p.getBasicBlock().insertOut(yieldpoint);
          conditionalBranchCount++;
        }
        break;
        case YIELDPOINT_BACKEDGE_opcode: {
          BasicBlock yieldpoint = findOrCreateYieldpointBlock(ir, RVMThread.BACKEDGE);
          Register zero = phys.getGPR(0);
          Register TSR = phys.getTSR();
          Register PR = phys.getPR();
          Offset offset = Entrypoints.takeYieldpointField.getOffset();
          if (VM.VerifyAssertions) VM._assert(Bits.fits(offset, 16));
          p.insertBefore(MIR_Load.create(PPC_LInt, I(zero), A(PR), IC(Bits.PPCMaskLower16(offset))));
          p.insertBefore(MIR_Binary.create(PPC_CMPI, I(TSR), I(zero), IC(0)));
          instructionCount += 2;
          // Because the GC Map code holds a reference to the original
          // instruction, it is important that we mutate the last instruction
          // because this will be the GC point.
          MIR_CondCall.mutate0(p,
                               PPC_BCL,
                               null,
                               null,
                               I(TSR),
                               PowerPCConditionOperand.GREATER(),
                               yieldpoint.makeJumpTarget());
          p.getBasicBlock().insertOut(yieldpoint);
          conditionalBranchCount++;
        }
        break;
        case YIELDPOINT_EPILOGUE_opcode: {
          BasicBlock yieldpoint = findOrCreateYieldpointBlock(ir, RVMThread.EPILOGUE);
          Register zero = phys.getGPR(0);
          Register TSR = phys.getTSR();
          Register PR = phys.getPR();
          Offset offset = Entrypoints.takeYieldpointField.getOffset();
          if (VM.VerifyAssertions) VM._assert(Bits.fits(offset, 16));
          p.insertBefore(MIR_Load.create(PPC_LInt, I(zero), A(PR), IC(Bits.PPCMaskLower16(offset))));
          p.insertBefore(MIR_Binary.create(PPC_CMPI, I(TSR), I(zero), IC(0)));
          instructionCount += 2;
          // Because the GC Map code holds a reference to the original
          // instruction, it is important that we mutate the last instruction
          // because this will be the GC point.
          MIR_CondCall.mutate0(p,
                               PPC_BCL,
                               null,
                               null,
                               I(TSR),
                               PowerPCConditionOperand.NOT_EQUAL(),
                               yieldpoint.makeJumpTarget());
          p.getBasicBlock().insertOut(yieldpoint);
          conditionalBranchCount++;
        }
        break;
        case YIELDPOINT_OSR_opcode: {
          // unconditionally branch to yield point.
          BasicBlock yieldpoint = findOrCreateYieldpointBlock(ir, RVMThread.OSROPT);
          // Because the GC Map code holds a reference to the original
          // instruction, it is important that we mutate the last instruction
          // because this will be the GC point.
          MIR_Call.mutate0(p, PPC_BL, null, null, yieldpoint.makeJumpTarget());
          p.getBasicBlock().insertOut(yieldpoint);
        }
        instructionCount++;
        break;

        default:
          if (p.operator().isConditionalBranch()) {
            conditionalBranchCount++;
          } else {
            instructionCount++;
          }
          break;
      }
    }

    // this is conservative but pretty close, especially for
    // reasonably sized methods
    if ((instructionCount + conditionalBranchCount) > AssemblerOpt.MAX_COND_DISPL) {
      machinecodeLength = instructionCount + 2 * conditionalBranchCount;
    } else {
      machinecodeLength = instructionCount + conditionalBranchCount;
    }

    if ((machinecodeLength & ~AssemblerOpt.MAX_24_BITS) != 0) {
      throw new OptimizingCompilerException("CodeGen", "method too large to compile:", AssemblerOpt.MAX_24_BITS);
    }
    return machinecodeLength;
  }

  /**
   * Return a basic block holding the call to a runtime yield service.
   * Create a new basic block at the end of the code order if necessary.
   *
   * @param ir the governing IR
   * @param whereFrom is this yieldpoint from the PROLOGUE, EPILOGUE, or a
   * BACKEDGE?
   */
  static BasicBlock findOrCreateYieldpointBlock(IR ir, int whereFrom) {
    RVMMethod meth = null;
    PhysicalRegisterSet phys = ir.regpool.getPhysicalRegisterSet();
    Register zero = phys.getGPR(0);

    // first see if the requested block exists. If not, set up some
    // state for creating the block
    if (whereFrom == RVMThread.PROLOGUE) {
      if (ir.MIRInfo.prologueYieldpointBlock != null) {
        return ir.MIRInfo.prologueYieldpointBlock;
      } else {
        meth = Entrypoints.optThreadSwitchFromPrologueMethod;
      }
    } else if (whereFrom == RVMThread.BACKEDGE) {
      if (ir.MIRInfo.backedgeYieldpointBlock != null) {
        return ir.MIRInfo.backedgeYieldpointBlock;
      } else {
        meth = Entrypoints.optThreadSwitchFromBackedgeMethod;
      }
    } else if (whereFrom == RVMThread.EPILOGUE) {
      if (ir.MIRInfo.epilogueYieldpointBlock != null) {
        return ir.MIRInfo.epilogueYieldpointBlock;
      } else {
        meth = Entrypoints.optThreadSwitchFromEpilogueMethod;
      }
    } else if (whereFrom == RVMThread.OSROPT) {
      if (ir.MIRInfo.osrYieldpointBlock != null) {
        return ir.MIRInfo.osrYieldpointBlock;
      } else {
        meth = Entrypoints.optThreadSwitchFromOsrOptMethod;
      }
    }

    // Not found.  create new basic block holding the requested yieldpoint
    // method
    BasicBlock result = new BasicBlock(-1, null, ir.cfg);
    ir.cfg.addLastInCodeOrder(result);
    Register JTOC = phys.getJTOC();
    Register CTR = phys.getCTR();
    Offset offset = meth.getOffset();
    if (Bits.fits(offset, 16)) {
      result.appendInstruction(MIR_Load.create(PPC_LAddr, A(zero), A(JTOC), IC(Bits.PPCMaskLower16(offset))));
    } else {
      if (VM.VerifyAssertions) VM._assert(Bits.fits(offset, 32)); //not implemented
      result.appendInstruction(MIR_Binary.create(PPC_ADDIS, A(zero), A(JTOC), IC(Bits.PPCMaskUpper16(offset))));
      result.appendInstruction(MIR_Load.create(PPC_LAddr, A(zero), A(zero), IC(Bits.PPCMaskLower16(offset))));
    }
    result.appendInstruction(MIR_Move.create(PPC_MTSPR, A(CTR), A(zero)));
    result.appendInstruction(MIR_Branch.create(PPC_BCTR));

    // cache the create block and then return it
    if (whereFrom == RVMThread.PROLOGUE) {
      ir.MIRInfo.prologueYieldpointBlock = result;
    } else if (whereFrom == RVMThread.BACKEDGE) {
      ir.MIRInfo.backedgeYieldpointBlock = result;
    } else if (whereFrom == RVMThread.EPILOGUE) {
      ir.MIRInfo.epilogueYieldpointBlock = result;
    } else if (whereFrom == RVMThread.OSROPT) {
      ir.MIRInfo.osrYieldpointBlock = result;
    }

    return result;
  }
}


text:
.class Lcom/thoughtworks/xstream/io/xml/StaxDriver$2;
.super Lcom/thoughtworks/xstream/io/ReaderWrapper;
.source ""

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/thoughtworks/xstream/io/xml/StaxDriver;->createReader(Ljava/io/File;)Lcom/thoughtworks/xstream/io/HierarchicalStreamReader;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/thoughtworks/xstream/io/xml/StaxDriver;

.field final synthetic val$stream:Ljava/io/InputStream;

# direct methods
.method constructor <init>(Lcom/thoughtworks/xstream/io/xml/StaxDriver;Lcom/thoughtworks/xstream/io/HierarchicalStreamReader;Ljava/io/InputStream;)V
    .locals 0

    .line 136
    iput-object p1, p0, Lcom/thoughtworks/xstream/io/xml/StaxDriver$2;->this$0:Lcom/thoughtworks/xstream/io/xml/StaxDriver;

    iput-object p3, p0, Lcom/thoughtworks/xstream/io/xml/StaxDriver$2;->val$stream:Ljava/io/InputStream;

    invoke-direct {p0, p2}, Lcom/thoughtworks/xstream/io/ReaderWrapper;-><init>(Lcom/thoughtworks/xstream/io/HierarchicalStreamReader;)V

    return-void
.end method

# virtual methods
.method public close()V
    .locals 1

    .line 139
    invoke-super {p0}, Lcom/thoughtworks/xstream/io/ReaderWrapper;->close()V

    .line 141
    :try_start_0
    iget-object v0, p0, Lcom/thoughtworks/xstream/io/xml/StaxDriver$2;->val$stream:Ljava/io/InputStream;

    invoke-virtual {v0}, Ljava/io/InputStream;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 144
    return-void

    .line 142
    .line 145
    :catch_0
    return-void
.end method


text:
NOptFunc
========

Overview
--------

NOptFunc is a command line parser for C# which uses reflection to generate a specification of command line positional and option arguments. It is inspired by Simon Willison's [optfunc][optfunc] written in Python.

NOptFunc uses the default parameter value feature of C# 4.0 to specify optional command line arguments. The parameters of a function are used to specify both positional and optional arguments, and at runtime the arguments supplied on the command line are parsed and then passed as parameters to the function. In this example filename specifies a required argument and verbose specifies an option.

    using System;
    using CookComputing;

    class Program
    {
      static void Main(string[] args)
      {
        try
        {
          NOptFunc.Run(typeof(Program).GetMethod("Run"), args);
        }
        catch (Exception ex)
        {
          Console.Error.WriteLine(ex.Message);
        }
      }

      public static void Run(string filename, bool verbose = false)
      {
        // application code here
      }
    }

Run() specifies that there is one required argument &ndash filename &ndash and one option which is used on the command line as either -v or --verbose.

To use NOptFunc simply include [NOptFunc.cs][code] in your project.

Positional and Option Arguments
-------------------------------

Arguments passed on a command can be divided into the arguments the program always requires and those that optionally alter the way the program runs.

The standard parameters in the function passed to NOptFunc are treated as required arguments, known as positional arguments. NOptFunc.Run verifies that the correct number of positional arguments have been supplied.

The parameters with default values in the function passed to NOptFunc are treated as option arguments, the default value specified in the function declaration being the default value for the optional argument.

The following types are supported:

* bool
* string
* int
* long
* double

Value types, those other than string in this list, can be specified as Nullable<T> with null being the default value of the argument, which allows the default value of the type to be a valid value of the option (for example use Nullable<int> to allow the user to specify zero as the value of the option).

Consider this example:

    public static void Run(string s, string apiKey = null,
      string geocoder="google", bool list_geocoders = false)
    {
      // ...
    }

's' is a required positional argument. api_key, geocoder and list_geocoders are all options with defaults provided.

The command line options generated from the parameter names look like this:

    Options:
      -h, --help            shows this help message and exit
      -l, --list-geocoders
      -a API_KEY, --api-key=API_KEY
      -g GEOCODER, --geocoder=GEOCODER

Note that the boolean --list-geocoders is a flag and does not have an associated value on the command line.

The short option is derived from the first letter of the parameter. If that character is already in use, the second character will be used and so on.

The long option is the full name of the parameter with underscores converted to hyphens.

The Option attribute is used to customize the long and short names, for example:

    public static void Run(
      [Option(Long="filename", Short='f')] string s)
    {
      // ...
    }

This results in a short option of -f and a long option of --filename.

A variable number of positional parameters can be specified by using an array type, for example:

    public static void Run(string[] filenames)
    {
      // ...
    }

There can only be one array type positional argument and any other positional arguments must precede it.

ToDo
----

* Improve error handling using custom exceptions
* Support for option descriptions
* Support for --help
* Support for --version
* Support for other argument types (DateTime)
* Sub-commands

[optfunc]: http://github.com/simonw/optfunc

[code]: https://raw.github.com/charlescook/noptfunc/master/src/NOptFunc.cs


text:
package sgdisk

import (
	"fmt"
	"os/exec"

	"github.com/coreos/ignition/internal/log"
)

const sgdiskPath = "/sbin/sgdisk"

type Operation struct {
	logger *log.Logger
	dev    string
	wipe   bool
	parts  []Partition
}

type Partition struct {
	Number   int
	Offset   uint64 // 512-byte sectors
	Length   uint64 // 512-byte sectors
	Label    string
	TypeGUID string
}

// Begin begins an sgdisk operation
func Begin(logger *log.Logger, dev string) *Operation {
	return &Operation{logger: logger, dev: dev}
}

// CreatePartition adds the supplied partition to the list of partitions to be created as part of an operation.
func (op *Operation) CreatePartition(p Partition) {
	// XXX(vc): no checking is performed here, since we perform checking at json parsing, Commit() will just fail on badness.
	op.parts = append(op.parts, p)
}

// WipeTable toggles if the table is to be wiped first when commiting this operation.
func (op *Operation) WipeTable(wipe bool) {
	op.wipe = wipe
}

// Commit commits an partitioning operation.
func (op *Operation) Commit() error {
	if op.wipe {
		cmd := exec.Command(sgdiskPath, "--zap-all", op.dev)
		if err := op.logger.LogCmd(cmd, "wiping table on %q", op.dev); err != nil {
			op.logger.Info("potential error encountered while wiping table... retrying")
			cmd = exec.Command(sgdiskPath, "--zap-all", op.dev)
			if err := op.logger.LogCmd(cmd, "wiping table on %q", op.dev); err != nil {
				return fmt.Errorf("wipe failed: %v", err)
			}
		}
	}

	if len(op.parts) != 0 {
		opts := []string{}
		for _, p := range op.parts {
			opts = append(opts, fmt.Sprintf("--new=%d:%d:+%d", p.Number, p.Offset, p.Length))
			opts = append(opts, fmt.Sprintf("--change-name=%d:%s", p.Number, p.Label))
			if p.TypeGUID != "" {
				opts = append(opts, fmt.Sprintf("--typecode=%d:%s", p.Number, p.TypeGUID))
			}
		}
		opts = append(opts, op.dev)
		cmd := exec.Command(sgdiskPath, opts...)
		if err := op.logger.LogCmd(cmd, "creating %d partitions on %q", len(op.parts), op.dev); err != nil {
			return fmt.Errorf("create partitions failed: %v", err)
		}
	}

	return nil
}


text:
package org.jenkinsci.plugins.vs_code_metrics;

import hudson.model.AbstractBuild;

import org.jenkinsci.plugins.vs_code_metrics.bean.Module;
import org.jenkinsci.plugins.vs_code_metrics.bean.Namespace;

public final class ModuleReport extends AbstractReport {

   /**
    *
    * @param build
    * @param result
    * @param tokens
    */
   public ModuleReport(AbstractBuild<?, ?> build, Module result) {
       super(build, result.getName(), result);
       setBuildTokens(getName(), null);
   }

   @Override
   public Object getReport(String token) {
       if ((getChildren() != null) && getChildren().containsKey(token))
           return new NamespaceReport(getBuild(), (Namespace)getChildren().get(token), getBuildTokens());
       else
           return this;
   }

}


text:
namespace {

// Path to recursively copy into the replacemment hives.  These are needed
// to make sure certain win32 APIs continue to run correctly once the real
// hives are replaced.
const wchar_t kHKLMAccessProviders[] =
    L"System\\CurrentControlSet\\Control\\Lsa\\AccessProviders";

struct RegistryValue {
  base::string16 name;
  DWORD type;
  std::vector<uint8> data;
};

struct RegistryKeyData {
  std::vector<RegistryValue> values;
  std::map<base::string16, RegistryKeyData> keys;
};

void ReadRegistryTree(const base::win::RegKey& src, RegistryKeyData* data) {
  // First read values.
  {
    base::win::RegistryValueIterator i(src.Handle(), L"");
    data->values.clear();
    data->values.reserve(i.ValueCount());
    for (; i.Valid(); ++i) {
      RegistryValue& value = *data->values.insert(data->values.end(),
                                                  RegistryValue());
      const uint8* data = reinterpret_cast<const uint8*>(i.Value());
      value.name.assign(i.Name());
      value.type = i.Type();
      value.data.assign(data, data + i.ValueSize());
    }
  }

  // Next read subkeys recursively.
  for (base::win::RegistryKeyIterator i(src.Handle(), L"");
       i.Valid(); ++i) {
    ReadRegistryTree(base::win::RegKey(src.Handle(), i.Name(), KEY_READ),
                     &data->keys[base::string16(i.Name())]);
  }
}

void WriteRegistryTree(const RegistryKeyData& data, base::win::RegKey* dest) {
  // First write values.
  for (size_t i = 0; i < data.values.size(); ++i) {
    const RegistryValue& value = data.values[i];
    dest->WriteValue(value.name.c_str(),
                     value.data.size() ? &value.data[0] : NULL,
                     static_cast<DWORD>(value.data.size()),
                     value.type);
  }

  // Next write values recursively.
  for (std::map<base::string16, RegistryKeyData>::const_iterator iter =
           data.keys.begin();
       iter != data.keys.end(); ++iter) {
    base::win::RegKey key(dest->Handle(), iter->first.c_str(), KEY_ALL_ACCESS);
    WriteRegistryTree(iter->second, &key);
  }
}

// Initialize temporary HKLM/HKCU registry hives used for testing.
// Testing RLZ requires reading and writing to the Windows registry.  To keep
// the tests isolated from the machine's state, as well as to prevent the tests
// from causing side effects in the registry, HKCU and HKLM are overridden for
// the duration of the tests. RLZ tests don't expect the HKCU and KHLM hives to
// be empty though, and this function initializes the minimum value needed so
// that the test will run successfully.
void InitializeRegistryOverridesForTesting(
    registry_util::RegistryOverrideManager* override_manager) {
  // For the moment, the HKCU hive requires no initialization.
  const bool do_copy = (base::win::GetVersion() >= base::win::VERSION_WIN7);
  RegistryKeyData data;

  if (do_copy) {
    // Copy the following HKLM subtrees to the temporary location so that the
    // win32 APIs used by the tests continue to work:
    //
    //    HKLM\System\CurrentControlSet\Control\Lsa\AccessProviders
    //
    // This seems to be required since Win7.
    ReadRegistryTree(base::win::RegKey(HKEY_LOCAL_MACHINE,
                                       kHKLMAccessProviders,
                                       KEY_READ), &data);
  }

  override_manager->OverrideRegistry(HKEY_LOCAL_MACHINE, L"rlz_temp_hklm");
  override_manager->OverrideRegistry(HKEY_CURRENT_USER, L"rlz_temp_hkcu");

  if (do_copy) {
    base::win::RegKey key(
        HKEY_LOCAL_MACHINE, kHKLMAccessProviders, KEY_ALL_ACCESS);
    WriteRegistryTree(data, &key);
  }
}

}  // namespace

#endif  // defined(OS_WIN)

void RlzLibTestNoMachineState::SetUp() {
#if defined(OS_WIN)
  InitializeRegistryOverridesForTesting(&override_manager_);
#elif defined(OS_MACOSX)
  base::mac::ScopedNSAutoreleasePool pool;
#endif  // defined(OS_WIN)
#if defined(OS_POSIX)
  ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
  rlz_lib::testing::SetRlzStoreDirectory(temp_dir_.path());
#endif  // defined(OS_POSIX)
}

void RlzLibTestNoMachineState::TearDown() {
#if defined(OS_POSIX)
  rlz_lib::testing::SetRlzStoreDirectory(base::FilePath());
#endif  // defined(OS_POSIX)
}

void RlzLibTestBase::SetUp() {
  RlzLibTestNoMachineState::SetUp();
#if defined(OS_WIN)
  rlz_lib::CreateMachineState();
#endif  // defined(OS_WIN)
}


text:
from future.utils import viewvalues, viewkeys

from qiita_db.metadata_template import (load_template_to_dataframe,
                                        SampleTemplate, PrepTemplate,
                                        PREP_TEMPLATE_COLUMNS,
                                        PREP_TEMPLATE_COLUMNS_TARGET_GENE,
                                        CONTROLLED_COLS,
                                        TARGET_GENE_DATA_TYPES)
from qiita_db.util import convert_from_id
from qiita_ware.exceptions import QiitaWareError

def create_templates_from_qiime_mapping_file(fp, study, data_type):
    """Creates a sample template and a prep template from qiime mapping file

    Parameters
    ----------
    fp : str or file-like object
        Path to the QIIME mapping file
    study : Study
        The study to which the sample template belongs to
    data_type : str or int
        The data_type of the prep_template

    Returns
    -------
    (SampleTemplate, PrepTemplate)
        The templates created from the QIIME mapping file
    """
    qiime_map = load_template_to_dataframe(fp, index='#SampleID')

    # There are a few columns in the QIIME mapping file that are special and
    # we know how to deal with them
    rename_cols = {
        'BarcodeSequence': 'barcode',
        'LinkerPrimerSequence': 'primer',
        'Description': 'description',
    }

    if 'ReverseLinkerPrimer' in qiime_map:
        rename_cols['ReverseLinkerPrimer'] = 'reverselinkerprimer'

    missing = set(rename_cols).difference(qiime_map.columns)
    if missing:
        raise QiitaWareError(
            "Error generating the templates from the QIIME mapping file. "
            "Missing QIIME mapping file columns: %s" % ', '.join(missing))

    qiime_map.rename(columns=rename_cols, inplace=True)

    # Fix the casing in the columns that we control
    qiime_map.columns = [c.lower() if c.lower() in CONTROLLED_COLS else c
                         for c in qiime_map.columns]

    # Figure out which columns belong to the prep template
    def _col_iterator(restriction_set):
        for restriction in viewvalues(restriction_set):
            for cols in viewkeys(restriction.columns):
                yield cols

    pt_cols = set(col for col in _col_iterator(PREP_TEMPLATE_COLUMNS))

    data_type_str = (convert_from_id(data_type, "data_type")
                     if isinstance(data_type, (int, long)) else data_type)

    if data_type_str in TARGET_GENE_DATA_TYPES:
        pt_cols.update(
            col for col in _col_iterator(PREP_TEMPLATE_COLUMNS_TARGET_GENE))
        pt_cols.add('reverselinkerprimer')

    qiime_cols = set(qiime_map.columns)
    pt_cols = qiime_cols.intersection(pt_cols)
    st_cols = qiime_cols.difference(pt_cols)

    st_md = qiime_map.ix[:, st_cols]
    pt_md = qiime_map.ix[:, pt_cols]

    return (SampleTemplate.create(st_md, study),
            PrepTemplate.create(pt_md, study, data_type))


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php');
require_once(dirname(__FILE__).'/lib.php');
require_once(dirname(__FILE__).'/edit_form.php');
require_once($CFG->dirroot.'/grade/grading/lib.php');

$areaid = required_param('areaid', PARAM_INT);

$manager = get_grading_manager($areaid);

list($context, $course, $cm) = get_context_info_array($manager->get_context()->id);

require_login($course, true, $cm);
require_capability('moodle/grade:managegradingforms', $context);

$controller = $manager->get_controller('rubric');

$PAGE->set_url(new moodle_url('/grade/grading/form/rubric/edit.php', array('areaid' => $areaid)));
$PAGE->set_title(get_string('definerubric', 'gradingform_rubric'));
$PAGE->set_heading(get_string('definerubric', 'gradingform_rubric'));

$mform = new gradingform_rubric_editrubric(null, array('areaid' => $areaid, 'context' => $context, 'allowdraft' => !$controller->has_active_instances()), 'post', '', array('class' => 'gradingform_rubric_editform'));
$data = $controller->get_definition_for_editing(true);
$returnurl = optional_param('returnurl', $manager->get_management_url(), PARAM_LOCALURL);
$data->returnurl = $returnurl;
$mform->set_data($data);
if ($mform->is_cancelled()) {
    redirect($returnurl);
} else if ($mform->is_submitted() && $mform->is_validated() && !$mform->need_confirm_regrading($controller)) {
    // Everything ok, validated, re-grading confirmed if needed. Make changes to the rubric.
    $data = $mform->get_data();
    $controller->update_definition($data);

    // If we do not go back to management url and the minscore warning needs to be displayed, display it during redirection.
    $warning = null;
    if (!empty($data->returnurl)) {
        if (($scores = $controller->get_min_max_score()) && $scores['minscore'] <> 0) {
            $warning = get_string('zerolevelsabsent', 'gradingform_rubric').'<br>'.
                html_writer::link($manager->get_management_url(), get_string('back'));
        }
    }
    redirect($returnurl, $warning, null, \core\output\notification::NOTIFY_ERROR);
}

echo $OUTPUT->header();
$mform->display();
echo $OUTPUT->footer();


text:
package es.bsc.mobile.types.messages.comm;

import es.bsc.comm.Connection;
import es.bsc.mobile.node.P2PNode;
import es.bsc.mobile.types.comm.NodeAndHash;
import es.bsc.mobile.types.messages.Message;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class JoinRequest extends Message {

    private static final long serialVersionUID = 1L;

    private NodeAndHash node;
    private boolean responsible;

    public JoinRequest() {

    }

    public JoinRequest(NodeAndHash newNode, boolean takeResponsibilities) {
        node = newNode;
        responsible = takeResponsibilities;
    }

    public NodeAndHash getNodeAndHash() {
        return node;
    }

    public boolean isResponsible() {
        return responsible;
    }

    @Override
    public void handleMessage(Connection c, P2PNode handler) {
        completeSource(node.getNode(), c);
        c.finishConnection();
        handler.joinP2P(this);
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeObject(node);
        out.writeBoolean(responsible);
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        node = (NodeAndHash) in.readObject();
        responsible = in.readBoolean();
    }

}


text:
nCore -- an artificial neural network research library
======================================================

This library is currently under continuous development.  The goal is to create artificial neural network algorithms that generalize extremely well and learn relatively quickly -- by using a combination of flocking (i.e., a form of clustering) and backpropagation of both (1) output error and (2) flocking error.  It is hoped that such algorithms will be particularly useful for training deep neural networks (i.e., multiple hidden layers).

The study of the most fundamental processes involved in the formation of analogies is also a particularly optimistic goal for this project.

Flocking forms the core of the self-organization methods used in these algorithms.  Initial work in this area was conducted by Matt Potter and Mark White.  More information can be obtained from [Matt Potter's MS Thesis](http://repository.lib.ncsu.edu/ir/bitstream/1840.16/148/2/etd.pdf)

I would be very interested in discussing or collaborating with anyone interested in these aspects of neural network learning, and machine learning in general.  My email address is mark@markwhite.name

Mark White
Mark@MarkWhite.name


text:
class CsCommand::StatsCommand
  include Commands::Dsl
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="common/css/reset.css" type="text/css">
    <link rel="stylesheet" href="common/css/fonts-min.css" type="text/css">
    <link rel="stylesheet" href="common/css/default.css" type="text/css">
    <link rel="stylesheet" href="common/css/frame.css" type="text/css">
    <link rel="stylesheet" href="index/css/index.css" type="text/css">

    <title></title>

Credits

Android Open Source Project

        Apache Software License, Version 2.0

MaterialDesignLibrary

        Apache Software License, Version 2.0

RippleEffect

        The MIT License (MIT)

Calligraphy

        Apache Software License, Version 2.0

Material Dialogs

        The MIT License (MIT)


text:
from setuptools import setup

long_description = open('README.rst').read()

setup(
    name="celery-redbeat",
    description="A Celery Beat Scheduler using Redis for persistent storage",
    long_description=long_description,
    version="2.0.0",
    url="https://github.com/sibson/redbeat",
    license="Apache License, Version 2.0",
    author="Marc Sibson",
    author_email="sibson+redbeat@gmail.com",
    keywords="python celery beat redis".split(),
    packages=["redbeat"],
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'License :: OSI Approved :: Apache Software License',
        'Topic :: System :: Distributed Computing',
        'Topic :: Software Development :: Object Brokering',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.7',
        'Programming Language :: Python :: 3.8',
        'Programming Language :: Python :: 3.9',
        'Programming Language :: Python :: 3.10',
        'Programming Language :: Python :: Implementation :: CPython',
        'Operating System :: OS Independent',
    ],
    install_requires=['redis>=3.2', 'celery>=4.2', 'python-dateutil', 'tenacity'],
    tests_require=['pytest'],
)