text:
using System;
using System.Text;

namespace Umbraco.Core.Media.Exif
{
    /// <summary>
    /// Represents the abstract base class for an Exif property.
    /// </summary>
    internal abstract class ExifProperty
    {
        protected ExifTag mTag;
        protected IFD mIFD;
        protected string mName;

        /// <summary>
        /// Gets the Exif tag associated with this property.
        /// </summary>
        public ExifTag Tag { get { return mTag; } }
        /// <summary>
        /// Gets the IFD section contaning this property.
        /// </summary>
        public IFD IFD { get { return mIFD; } }
        /// <summary>
        /// Gets or sets the name of this property.
        /// </summary>
        public string Name
        {
            get
            {
                if (mName == null || mName.Length == 0)
                    return ExifTagFactory.GetTagName(mTag);
                else
                    return mName;
            }
            set
            {
                mName = value;
            }
        }
        protected abstract object _Value { get; set; }
        /// <summary>
        /// Gets or sets the value of this property.
        /// </summary>
        public object Value { get { return _Value; } set { _Value = value; } }
        /// <summary>
        /// Gets interoperability data for this property.
        /// </summary>
        public abstract ExifInterOperability Interoperability { get; }

        public ExifProperty(ExifTag tag)
        {
            mTag = tag;
            mIFD = ExifTagFactory.GetTagIFD(tag);
        }
    }

    /// <summary>
    /// Represents an 8-bit unsigned integer. (EXIF Specification: BYTE)
    /// </summary>
    internal class ExifByte : ExifProperty
    {
        protected byte mValue;
        protected override object _Value { get { return Value; } set { Value = Convert.ToByte(value); } }
        public new byte Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator byte(ExifByte obj) { return obj.mValue; }

        public override string ToString() { return mValue.ToString(); }

        public ExifByte(ExifTag tag, byte value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 1, 1, new byte[] { mValue });
            }
        }
    }

    /// <summary>
    /// Represents an array of 8-bit unsigned integers. (EXIF Specification: BYTE with count > 1)
    /// </summary>
    internal class ExifByteArray : ExifProperty
    {
        protected byte[] mValue;
        protected override object _Value { get { return Value; } set { Value = (byte[])value; } }
        public new byte[] Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator byte[](ExifByteArray obj) { return obj.mValue; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (byte b in mValue)
            {
                sb.Append(b);
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        public ExifByteArray(ExifTag tag, byte[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 1, (uint)mValue.Length, mValue);
            }
        }
    }

    /// <summary>
    /// Represents an ASCII string. (EXIF Specification: ASCII)
    /// </summary>
    internal class ExifAscii : ExifProperty
    {
        protected string mValue;
        protected override object _Value { get { return Value; } set { Value = (string)value; } }
        public new string Value { get { return mValue; } set { mValue = value; } }

        public Encoding Encoding { get; private set; }

        static public implicit operator string(ExifAscii obj) { return obj.mValue; }

        public override string ToString() { return mValue; }

        public ExifAscii(ExifTag tag, string value, Encoding encoding)
            : base(tag)
        {
            mValue = value;
            Encoding = encoding;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 2, (uint)mValue.Length + 1, ExifBitConverter.GetBytes(mValue, true, Encoding));
            }
        }
    }

    /// <summary>
    /// Represents a 16-bit unsigned integer. (EXIF Specification: SHORT)
    /// </summary>
    internal class ExifUShort : ExifProperty
    {
        protected ushort mValue;
        protected override object _Value { get { return Value; } set { Value = Convert.ToUInt16(value); } }
        public new ushort Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator ushort(ExifUShort obj) { return obj.mValue; }

        public override string ToString() { return mValue.ToString(); }

        public ExifUShort(ExifTag tag, ushort value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 3, 1, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents an array of 16-bit unsigned integers.
    /// (EXIF Specification: SHORT with count > 1)
    /// </summary>
    internal class ExifUShortArray : ExifProperty
    {
        protected ushort[] mValue;
        protected override object _Value { get { return Value; } set { Value = (ushort[])value; } }
        public new ushort[] Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator ushort[](ExifUShortArray obj) { return obj.mValue; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (ushort b in mValue)
            {
                sb.Append(b);
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        public ExifUShortArray(ExifTag tag, ushort[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 3, (uint)mValue.Length, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents a 32-bit unsigned integer. (EXIF Specification: LONG)
    /// </summary>
    internal class ExifUInt : ExifProperty
    {
        protected uint mValue;
        protected override object _Value { get { return Value; } set { Value = Convert.ToUInt32(value); } }
        public new uint Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator uint(ExifUInt obj) { return obj.mValue; }

        public override string ToString() { return mValue.ToString(); }

        public ExifUInt(ExifTag tag, uint value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 4, 1, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents an array of 16-bit unsigned integers.
    /// (EXIF Specification: LONG with count > 1)
    /// </summary>
    internal class ExifUIntArray : ExifProperty
    {
        protected uint[] mValue;
        protected override object _Value { get { return Value; } set { Value = (uint[])value; } }
        public new uint[] Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator uint[](ExifUIntArray obj) { return obj.mValue; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (uint b in mValue)
            {
                sb.Append(b);
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        public ExifUIntArray(ExifTag tag, uint[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 3, (uint)mValue.Length, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents a rational number defined with a 32-bit unsigned numerator
    /// and denominator. (EXIF Specification: RATIONAL)
    /// </summary>
    internal class ExifURational : ExifProperty
    {
        protected MathEx.UFraction32 mValue;
        protected override object _Value { get { return Value; } set { Value = (MathEx.UFraction32)value; } }
        public new MathEx.UFraction32 Value { get { return mValue; } set { mValue = value; } }

        public override string ToString() { return mValue.ToString(); }
        public float ToFloat() { return (float)mValue; }

        static public explicit operator float(ExifURational obj) { return (float)obj.mValue; }

        public uint[] ToArray()
        {
            return new uint[] { mValue.Numerator, mValue.Denominator };
        }

        public ExifURational(ExifTag tag, uint numerator, uint denominator)
            : base(tag)
        {
            mValue = new MathEx.UFraction32(numerator, denominator);
        }

        public ExifURational(ExifTag tag, MathEx.UFraction32 value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 5, 1, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents an array of unsigned rational numbers.
    /// (EXIF Specification: RATIONAL with count > 1)
    /// </summary>
    internal class ExifURationalArray : ExifProperty
    {
        protected MathEx.UFraction32[] mValue;
        protected override object _Value { get { return Value; } set { Value = (MathEx.UFraction32[])value; } }
        public new MathEx.UFraction32[] Value { get { return mValue; } set { mValue = value; } }

        static public explicit operator float[](ExifURationalArray obj)
        {
            float[] result = new float[obj.mValue.Length];
            for (int i = 0; i < obj.mValue.Length; i++)
                result[i] = (float)obj.mValue[i];
            return result;
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (MathEx.UFraction32 b in mValue)
            {
                sb.Append(b.ToString());
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        public ExifURationalArray(ExifTag tag, MathEx.UFraction32[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 5, (uint)mValue.Length, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents a byte array that can take any value. (EXIF Specification: UNDEFINED)
    /// </summary>
    internal class ExifUndefined : ExifProperty
    {
        protected byte[] mValue;
        protected override object _Value { get { return Value; } set { Value = (byte[])value; } }
        public new byte[] Value { get { return mValue; } set { mValue = value; } }

        static public implicit operator byte[](ExifUndefined obj) { return obj.mValue; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (byte b in mValue)
            {
                sb.Append(b);
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        public ExifUndefined(ExifTag tag, byte[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 7, (uint)mValue.Length, mValue);
            }
        }
    }

    /// <summary>
    /// Represents a 32-bit signed integer. (EXIF Specification: SLONG)
    /// </summary>
    internal class ExifSInt : ExifProperty
    {
        protected int mValue;
        protected override object _Value { get { return Value; } set { Value = Convert.ToInt32(value); } }
        public new int Value { get { return mValue; } set { mValue = value; } }

        public override string ToString() { return mValue.ToString(); }

        static public implicit operator int(ExifSInt obj) { return obj.mValue; }

        public ExifSInt(ExifTag tag, int value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 9, 1, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents an array of 32-bit signed integers.
    /// (EXIF Specification: SLONG with count > 1)
    /// </summary>
    internal class ExifSIntArray : ExifProperty
    {
        protected int[] mValue;
        protected override object _Value { get { return Value; } set { Value = (int[])value; } }
        public new int[] Value { get { return mValue; } set { mValue = value; } }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (int b in mValue)
            {
                sb.Append(b);
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        static public implicit operator int[](ExifSIntArray obj) { return obj.mValue; }

        public ExifSIntArray(ExifTag tag, int[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 9, (uint)mValue.Length, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents a rational number defined with a 32-bit signed numerator
    /// and denominator. (EXIF Specification: SRATIONAL)
    /// </summary>
    internal class ExifSRational : ExifProperty
    {
        protected MathEx.Fraction32 mValue;
        protected override object _Value { get { return Value; } set { Value = (MathEx.Fraction32)value; } }
        public new MathEx.Fraction32 Value { get { return mValue; } set { mValue = value; } }

        public override string ToString() { return mValue.ToString(); }
        public float ToFloat() { return (float)mValue; }

        static public explicit operator float(ExifSRational obj) { return (float)obj.mValue; }

        public int[] ToArray()
        {
            return new int[] { mValue.Numerator, mValue.Denominator };
        }

        public ExifSRational(ExifTag tag, int numerator, int denominator)
            : base(tag)
        {
            mValue = new MathEx.Fraction32(numerator, denominator);
        }

        public ExifSRational(ExifTag tag, MathEx.Fraction32 value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 10, 1, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }

    /// <summary>
    /// Represents an array of signed rational numbers.
    /// (EXIF Specification: SRATIONAL with count > 1)
    /// </summary>
    internal class ExifSRationalArray : ExifProperty
    {
        protected MathEx.Fraction32[] mValue;
        protected override object _Value { get { return Value; } set { Value = (MathEx.Fraction32[])value; } }
        public new MathEx.Fraction32[] Value { get { return mValue; } set { mValue = value; } }

        static public explicit operator float[](ExifSRationalArray obj)
        {
            float[] result = new float[obj.mValue.Length];
            for (int i = 0; i < obj.mValue.Length; i++)
                result[i] = (float)obj.mValue[i];
            return result;
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append('[');
            foreach (MathEx.Fraction32 b in mValue)
            {
                sb.Append(b.ToString());
                sb.Append(' ');
            }
            sb.Remove(sb.Length - 1, 1);
            sb.Append(']');
            return sb.ToString();
        }

        public ExifSRationalArray(ExifTag tag, MathEx.Fraction32[] value)
            : base(tag)
        {
            mValue = value;
        }

        public override ExifInterOperability Interoperability
        {
            get
            {
                return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 10, (uint)mValue.Length, ExifBitConverter.GetBytes(mValue, BitConverterEx.SystemByteOrder));
            }
        }
    }
}


text:
package org.apache.tez.dag.app.dag.event;

import org.apache.tez.dag.app.RecoveryParser.RecoveredTaskData;
import org.apache.tez.dag.records.TezTaskID;

public class TaskEventRecoverTask extends TaskEvent {

  private RecoveredTaskData recoverdTaskData;

  public TaskEventRecoverTask(TezTaskID taskID, RecoveredTaskData recoveredTaskData) {
    super(taskID, TaskEventType.T_RECOVER);
    this.recoverdTaskData = recoveredTaskData;
  }

  public RecoveredTaskData getRecoverdTaskData() {
    return recoverdTaskData;
  }

}

redpajama_set_name: RedPajamaGithub


text:
package sun.invoke.util;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.invoke.MethodType;
import jdk.internal.vm.annotation.Stable;

public class ValueConversions {
    private static final Class<?> THIS_CLASS = ValueConversions.class;
    private static final Lookup IMPL_LOOKUP = MethodHandles.lookup();

    /**
     * Thread-safe canonicalized mapping from Wrapper to MethodHandle
     * with unsynchronized reads and synchronized writes.
     * It's safe to publish MethodHandles by data race because they are immutable.
     */
    private static class WrapperCache {
        @Stable
        private final MethodHandle[] map = new MethodHandle[Wrapper.COUNT];

        public MethodHandle get(Wrapper w) {
            return map[w.ordinal()];
        }
        public synchronized MethodHandle put(final Wrapper w, final MethodHandle mh) {
            MethodHandle prev = map[w.ordinal()];
            if (prev != null) {
                return prev;
            } else {
                map[w.ordinal()] = mh;
                return mh;
            }
        }
    }

    private static WrapperCache[] newWrapperCaches(int n) {
        WrapperCache[] caches = new WrapperCache[n];
        for (int i = 0; i < n; i++)
            caches[i] = new WrapperCache();
        return caches;
    }

    /// Converting references to values.

    // There are several levels of this unboxing conversions:
    //   no conversions:  exactly Integer.valueOf, etc.
    //   implicit conversions sanctioned by JLS 5.1.2, etc.
    //   explicit conversions as allowed by explicitCastArguments

    static int unboxInteger(Integer x) {
        return x;
    }
    static int unboxInteger(Object x, boolean cast) {
        if (x instanceof Integer)
            return (Integer) x;
        return primitiveConversion(Wrapper.INT, x, cast).intValue();
    }

    static byte unboxByte(Byte x) {
        return x;
    }
    static byte unboxByte(Object x, boolean cast) {
        if (x instanceof Byte)
            return (Byte) x;
        return primitiveConversion(Wrapper.BYTE, x, cast).byteValue();
    }

    static short unboxShort(Short x) {
        return x;
    }
    static short unboxShort(Object x, boolean cast) {
        if (x instanceof Short)
            return (Short) x;
        return primitiveConversion(Wrapper.SHORT, x, cast).shortValue();
    }

    static boolean unboxBoolean(Boolean x) {
        return x;
    }
    static boolean unboxBoolean(Object x, boolean cast) {
        if (x instanceof Boolean)
            return (Boolean) x;
        return (primitiveConversion(Wrapper.BOOLEAN, x, cast).intValue() & 1) != 0;
    }

    static char unboxCharacter(Character x) {
        return x;
    }
    static char unboxCharacter(Object x, boolean cast) {
        if (x instanceof Character)
            return (Character) x;
        return (char) primitiveConversion(Wrapper.CHAR, x, cast).intValue();
    }

    static long unboxLong(Long x) {
        return x;
    }
    static long unboxLong(Object x, boolean cast) {
        if (x instanceof Long)
            return (Long) x;
        return primitiveConversion(Wrapper.LONG, x, cast).longValue();
    }

    static float unboxFloat(Float x) {
        return x;
    }
    static float unboxFloat(Object x, boolean cast) {
        if (x instanceof Float)
            return (Float) x;
        return primitiveConversion(Wrapper.FLOAT, x, cast).floatValue();
    }

    static double unboxDouble(Double x) {
        return x;
    }
    static double unboxDouble(Object x, boolean cast) {
        if (x instanceof Double)
            return (Double) x;
        return primitiveConversion(Wrapper.DOUBLE, x, cast).doubleValue();
    }

    private static MethodType unboxType(Wrapper wrap, int kind) {
        if (kind == 0)
            return MethodType.methodType(wrap.primitiveType(), wrap.wrapperType());
        return MethodType.methodType(wrap.primitiveType(), Object.class, boolean.class);
    }

    private static final WrapperCache[] UNBOX_CONVERSIONS = newWrapperCaches(4);

    private static MethodHandle unbox(Wrapper wrap, int kind) {
        // kind 0 -> strongly typed with NPE
        // kind 1 -> strongly typed but zero for null,
        // kind 2 -> asType rules: accept multiple box types but only widening conversions with NPE
        // kind 3 -> explicitCastArguments rules: allow narrowing conversions, zero for null
        WrapperCache cache = UNBOX_CONVERSIONS[kind];
        MethodHandle mh = cache.get(wrap);
        if (mh != null) {
            return mh;
        }
        // slow path
        switch (wrap) {
            case OBJECT:
            case VOID:
                throw new IllegalArgumentException("unbox "+wrap);
        }
        // look up the method
        String name = "unbox" + wrap.wrapperSimpleName();
        MethodType type = unboxType(wrap, kind);
        try {
            mh = IMPL_LOOKUP.findStatic(THIS_CLASS, name, type);
        } catch (ReflectiveOperationException ex) {
            mh = null;
        }
        if (mh != null) {
            if (kind > 0) {
                boolean cast = (kind != 2);
                mh = MethodHandles.insertArguments(mh, 1, cast);
            }
            if (kind == 1) {  // casting but exact (null -> zero)
                mh = mh.asType(unboxType(wrap, 0));
            }
            return cache.put(wrap, mh);
        }
        throw new IllegalArgumentException("cannot find unbox adapter for " + wrap
                + (kind <= 1 ? " (exact)" : kind == 3 ? " (cast)" : ""));
    }

    /** Return an exact unboxer for the given primitive type. */
    public static MethodHandle unboxExact(Wrapper type) {
        return unbox(type, 0);
    }

    /** Return an exact unboxer for the given primitive type, with optional null-to-zero conversion.
     *  The boolean says whether to throw an NPE on a null value (false means unbox a zero).
     *  The type of the unboxer is of a form like (Integer)int.
     */
    public static MethodHandle unboxExact(Wrapper type, boolean throwNPE) {
        return unbox(type, throwNPE ? 0 : 1);
    }

    /** Return a widening unboxer for the given primitive type.
     *  Widen narrower primitive boxes to the given type.
     *  Do not narrow any primitive values or convert null to zero.
     *  The type of the unboxer is of a form like (Object)int.
     */
    public static MethodHandle unboxWiden(Wrapper type) {
        return unbox(type, 2);
    }

    /** Return a casting unboxer for the given primitive type.
     *  Widen or narrow primitive values to the given type, or convert null to zero, as needed.
     *  The type of the unboxer is of a form like (Object)int.
     */
    public static MethodHandle unboxCast(Wrapper type) {
        return unbox(type, 3);
    }

    private static final Integer ZERO_INT = 0, ONE_INT = 1;

    /// Primitive conversions
    /**
     * Produce a Number which represents the given value {@code x}
     * according to the primitive type of the given wrapper {@code wrap}.
     * Caller must invoke intValue, byteValue, longValue (etc.) on the result
     * to retrieve the desired primitive value.
     */
    public static Number primitiveConversion(Wrapper wrap, Object x, boolean cast) {
        // Maybe merge this code with Wrapper.convert/cast.
        Number res;
        if (x == null) {
            if (!cast)  return null;
            return ZERO_INT;
        }
        if (x instanceof Number) {
            res = (Number) x;
        } else if (x instanceof Boolean) {
            res = ((boolean)x ? ONE_INT : ZERO_INT);
        } else if (x instanceof Character) {
            res = (int)(char)x;
        } else {
            // this will fail with the required ClassCastException:
            res = (Number) x;
        }
        Wrapper xwrap = Wrapper.findWrapperType(x.getClass());
        if (xwrap == null || !cast && !wrap.isConvertibleFrom(xwrap))
            // this will fail with the required ClassCastException:
            return (Number) wrap.wrapperType().cast(x);
        return res;
    }

    /**
     * The JVM verifier allows boolean, byte, short, or char to widen to int.
     * Support exactly this conversion, from a boxed value type Boolean,
     * Byte, Short, Character, or Integer.
     */
    public static int widenSubword(Object x) {
        if (x instanceof Integer)
            return (int) x;
        else if (x instanceof Boolean)
            return fromBoolean((boolean) x);
        else if (x instanceof Character)
            return (char) x;
        else if (x instanceof Short)
            return (short) x;
        else if (x instanceof Byte)
            return (byte) x;
        else
            // Fail with a ClassCastException.
            return (int) x;
    }

    /// Converting primitives to references

    static Integer boxInteger(int x) {
        return x;
    }

    static Byte boxByte(byte x) {
        return x;
    }

    static Short boxShort(short x) {
        return x;
    }

    static Boolean boxBoolean(boolean x) {
        return x;
    }

    static Character boxCharacter(char x) {
        return x;
    }

    static Long boxLong(long x) {
        return x;
    }

    static Float boxFloat(float x) {
        return x;
    }

    static Double boxDouble(double x) {
        return x;
    }

    private static MethodType boxType(Wrapper wrap) {
        // be exact, since return casts are hard to compose
        Class<?> boxType = wrap.wrapperType();
        return MethodType.methodType(boxType, wrap.primitiveType());
    }

    private static final WrapperCache[] BOX_CONVERSIONS = newWrapperCaches(1);

    public static MethodHandle boxExact(Wrapper wrap) {
        WrapperCache cache = BOX_CONVERSIONS[0];
        MethodHandle mh = cache.get(wrap);
        if (mh != null) {
            return mh;
        }
        // look up the method
        String name = "box" + wrap.wrapperSimpleName();
        MethodType type = boxType(wrap);
        try {
            mh = IMPL_LOOKUP.findStatic(THIS_CLASS, name, type);
        } catch (ReflectiveOperationException ex) {
            mh = null;
        }
        if (mh != null) {
            return cache.put(wrap, mh);
        }
        throw new IllegalArgumentException("cannot find box adapter for " + wrap);
    }

    /// Constant functions

    static void ignore(Object x) {
        // no value to return; this is an unbox of null
    }

    static void empty() {
    }

    static Object zeroObject() {
        return null;
    }

    static int zeroInteger() {
        return 0;
    }

    static long zeroLong() {
        return 0;
    }

    static float zeroFloat() {
        return 0;
    }

    static double zeroDouble() {
        return 0;
    }

    private static final WrapperCache[] CONSTANT_FUNCTIONS = newWrapperCaches(2);

    public static MethodHandle zeroConstantFunction(Wrapper wrap) {
        WrapperCache cache = CONSTANT_FUNCTIONS[0];
        MethodHandle mh = cache.get(wrap);
        if (mh != null) {
            return mh;
        }
        // slow path
        MethodType type = MethodType.methodType(wrap.primitiveType());
        switch (wrap) {
            case VOID:
                mh = Handles.EMPTY;
                break;
            case OBJECT:
            case INT: case LONG: case FLOAT: case DOUBLE:
                try {
                    mh = IMPL_LOOKUP.findStatic(THIS_CLASS, "zero"+wrap.wrapperSimpleName(), type);
                } catch (ReflectiveOperationException ex) {
                    mh = null;
                }
                break;
        }
        if (mh != null) {
            return cache.put(wrap, mh);
        }

        // use zeroInt and cast the result
        if (wrap.isSubwordOrInt() && wrap != Wrapper.INT) {
            mh = MethodHandles.explicitCastArguments(zeroConstantFunction(Wrapper.INT), type);
            return cache.put(wrap, mh);
        }
        throw new IllegalArgumentException("cannot find zero constant for " + wrap);
    }

    private static class Handles {
        static final MethodHandle CAST_REFERENCE, IGNORE, EMPTY;
        static {
            try {
                MethodType idType = MethodType.genericMethodType(1);
                MethodType ignoreType = idType.changeReturnType(void.class);
                CAST_REFERENCE = IMPL_LOOKUP.findVirtual(Class.class, "cast", idType);
                IGNORE = IMPL_LOOKUP.findStatic(THIS_CLASS, "ignore", ignoreType);
                EMPTY = IMPL_LOOKUP.findStatic(THIS_CLASS, "empty", ignoreType.dropParameterTypes(0, 1));
            } catch (NoSuchMethodException | IllegalAccessException ex) {
                throw newInternalError("uncaught exception", ex);
            }
        }
    }

    public static MethodHandle ignore() {
        return Handles.IGNORE;
    }

    /** Return a method that casts its second argument (an Object) to the given type (a Class). */
    public static MethodHandle cast() {
        return Handles.CAST_REFERENCE;
    }

    /// Primitive conversions.
    // These are supported directly by the JVM, usually by a single instruction.
    // In the case of narrowing to a subword, there may be a pair of instructions.
    // In the case of booleans, there may be a helper routine to manage a 1-bit value.
    // This is the full 8x8 matrix (minus the diagonal).

    // narrow double to all other types:
    static float doubleToFloat(double x) {  // bytecode: d2f
        return (float) x;
    }
    static long doubleToLong(double x) {  // bytecode: d2l
        return (long) x;
    }
    static int doubleToInt(double x) {  // bytecode: d2i
        return (int) x;
    }
    static short doubleToShort(double x) {  // bytecodes: d2i, i2s
        return (short) x;
    }
    static char doubleToChar(double x) {  // bytecodes: d2i, i2c
        return (char) x;
    }
    static byte doubleToByte(double x) {  // bytecodes: d2i, i2b
        return (byte) x;
    }
    static boolean doubleToBoolean(double x) {
        return toBoolean((byte) x);
    }

    // widen float:
    static double floatToDouble(float x) {  // bytecode: f2d
        return x;
    }
    // narrow float:
    static long floatToLong(float x) {  // bytecode: f2l
        return (long) x;
    }
    static int floatToInt(float x) {  // bytecode: f2i
        return (int) x;
    }
    static short floatToShort(float x) {  // bytecodes: f2i, i2s
        return (short) x;
    }
    static char floatToChar(float x) {  // bytecodes: f2i, i2c
        return (char) x;
    }
    static byte floatToByte(float x) {  // bytecodes: f2i, i2b
        return (byte) x;
    }
    static boolean floatToBoolean(float x) {
        return toBoolean((byte) x);
    }

    // widen long:
    static double longToDouble(long x) {  // bytecode: l2d
        return x;
    }
    static float longToFloat(long x) {  // bytecode: l2f
        return x;
    }
    // narrow long:
    static int longToInt(long x) {  // bytecode: l2i
        return (int) x;
    }
    static short longToShort(long x) {  // bytecodes: f2i, i2s
        return (short) x;
    }
    static char longToChar(long x) {  // bytecodes: f2i, i2c
        return (char) x;
    }
    static byte longToByte(long x) {  // bytecodes: f2i, i2b
        return (byte) x;
    }
    static boolean longToBoolean(long x) {
        return toBoolean((byte) x);
    }

    // widen int:
    static double intToDouble(int x) {  // bytecode: i2d
        return x;
    }
    static float intToFloat(int x) {  // bytecode: i2f
        return x;
    }
    static long intToLong(int x) {  // bytecode: i2l
        return x;
    }
    // narrow int:
    static short intToShort(int x) {  // bytecode: i2s
        return (short) x;
    }
    static char intToChar(int x) {  // bytecode: i2c
        return (char) x;
    }
    static byte intToByte(int x) {  // bytecode: i2b
        return (byte) x;
    }
    static boolean intToBoolean(int x) {
        return toBoolean((byte) x);
    }

    // widen short:
    static double shortToDouble(short x) {  // bytecode: i2d (implicit 's2i')
        return x;
    }
    static float shortToFloat(short x) {  // bytecode: i2f (implicit 's2i')
        return x;
    }
    static long shortToLong(short x) {  // bytecode: i2l (implicit 's2i')
        return x;
    }
    static int shortToInt(short x) {  // (implicit 's2i')
        return x;
    }
    // narrow short:
    static char shortToChar(short x) {  // bytecode: i2c (implicit 's2i')
        return (char)x;
    }
    static byte shortToByte(short x) {  // bytecode: i2b (implicit 's2i')
        return (byte)x;
    }
    static boolean shortToBoolean(short x) {
        return toBoolean((byte) x);
    }

    // widen char:
    static double charToDouble(char x) {  // bytecode: i2d (implicit 'c2i')
        return x;
    }
    static float charToFloat(char x) {  // bytecode: i2f (implicit 'c2i')
        return x;
    }
    static long charToLong(char x) {  // bytecode: i2l (implicit 'c2i')
        return x;
    }
    static int charToInt(char x) {  // (implicit 'c2i')
        return x;
    }
    // narrow char:
    static short charToShort(char x) {  // bytecode: i2s (implicit 'c2i')
        return (short)x;
    }
    static byte charToByte(char x) {  // bytecode: i2b (implicit 'c2i')
        return (byte)x;
    }
    static boolean charToBoolean(char x) {
        return toBoolean((byte) x);
    }

    // widen byte:
    static double byteToDouble(byte x) {  // bytecode: i2d (implicit 'b2i')
        return x;
    }
    static float byteToFloat(byte x) {  // bytecode: i2f (implicit 'b2i')
        return x;
    }
    static long byteToLong(byte x) {  // bytecode: i2l (implicit 'b2i')
        return x;
    }
    static int byteToInt(byte x) {  // (implicit 'b2i')
        return x;
    }
    static short byteToShort(byte x) {  // bytecode: i2s (implicit 'b2i')
        return (short)x;
    }
    static char byteToChar(byte x) {  // bytecode: i2b (implicit 'b2i')
        return (char)x;
    }
    // narrow byte to boolean:
    static boolean byteToBoolean(byte x) {
        return toBoolean(x);
    }

    // widen boolean to all types:
    static double booleanToDouble(boolean x) {
        return fromBoolean(x);
    }
    static float booleanToFloat(boolean x) {
        return fromBoolean(x);
    }
    static long booleanToLong(boolean x) {
        return fromBoolean(x);
    }
    static int booleanToInt(boolean x) {
        return fromBoolean(x);
    }
    static short booleanToShort(boolean x) {
        return fromBoolean(x);
    }
    static char booleanToChar(boolean x) {
        return (char)fromBoolean(x);
    }
    static byte booleanToByte(boolean x) {
        return fromBoolean(x);
    }

    // helpers to force boolean into the conversion scheme:
    static boolean toBoolean(byte x) {
        // see javadoc for MethodHandles.explicitCastArguments
        return ((x & 1) != 0);
    }
    static byte fromBoolean(boolean x) {
        // see javadoc for MethodHandles.explicitCastArguments
        return (x ? (byte)1 : (byte)0);
    }

    private static final WrapperCache[] CONVERT_PRIMITIVE_FUNCTIONS = newWrapperCaches(Wrapper.COUNT);

    public static MethodHandle convertPrimitive(Wrapper wsrc, Wrapper wdst) {
        WrapperCache cache = CONVERT_PRIMITIVE_FUNCTIONS[wsrc.ordinal()];
        MethodHandle mh = cache.get(wdst);
        if (mh != null) {
            return mh;
        }
        // slow path
        Class<?> src = wsrc.primitiveType();
        Class<?> dst = wdst.primitiveType();
        MethodType type = MethodType.methodType(dst, src);
        if (wsrc == wdst) {
            mh = MethodHandles.identity(src);
        } else {
            assert(src.isPrimitive() && dst.isPrimitive());
            try {
                mh = IMPL_LOOKUP.findStatic(THIS_CLASS, src.getSimpleName()+"To"+capitalize(dst.getSimpleName()), type);
            } catch (ReflectiveOperationException ex) {
                mh = null;
            }
        }
        if (mh != null) {
            assert(mh.type() == type) : mh;
            return cache.put(wdst, mh);
        }

        throw new IllegalArgumentException("cannot find primitive conversion function for " +
                                           src.getSimpleName()+" -> "+dst.getSimpleName());
    }

    public static MethodHandle convertPrimitive(Class<?> src, Class<?> dst) {
        return convertPrimitive(Wrapper.forPrimitiveType(src), Wrapper.forPrimitiveType(dst));
    }

    private static String capitalize(String x) {
        return Character.toUpperCase(x.charAt(0))+x.substring(1);
    }

    // handy shared exception makers (they simplify the common case code)
    private static InternalError newInternalError(String message, Throwable cause) {
        return new InternalError(message, cause);
    }
    private static InternalError newInternalError(Throwable cause) {
        return new InternalError(cause);
    }
}


text:
<!DOCTYPE html>
<html lang="en">
<head>
  <!-- Hack to redirect SPA routes back to the index.html -->
  <meta http-equiv="refresh" content="0;URL='https://react.shengnian.org'" />
  <script>sessionStorage.redirect = location.href</script>
</head>
<body></body>
</html>


text:
/*
	This file is part of cpp-ethereum.

	cpp-ethereum 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.

	cpp-ethereum 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 cpp-ethereum.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file QBasicNodeDefinition.cpp
 * @author Yann yann@ethdev.com
 * @date 2014
 */

#include "QBasicNodeDefinition.h"
#include <libsolidity/AST.h>

namespace dev
{
namespace mix
{

QBasicNodeDefinition::QBasicNodeDefinition(QObject* _parent, solidity::Declaration const* _d):
	QObject(_parent), m_name(QString::fromStdString(_d->getName())), m_location(_d->getLocation())
{
}

QBasicNodeDefinition::QBasicNodeDefinition(QObject* _parent, std::string const& _name):
	QObject(_parent), m_name(QString::fromStdString(_name))
{
}

}
}


text:
//
// Copyright (c) Microsoft.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

using System.Collections.Generic;
using Newtonsoft.Json;

namespace Microsoft.Azure.Commands.Network.Models
{
    public class PSApplicationGateway : PSTopLevelResource
     {
         public PSApplicationGatewaySku Sku { get; set; }

         public List<PSApplicationGatewayIpConfiguration> GatewayIpConfigurations { get; set; }

         public List<PSApplicationGatewaySslCertificate> SslCertificates { get; set; }

         public List<PSApplicationGatewayFrontendIpConfiguration> FrontendIpConfigurations { get; set; }

         public List<PSApplicationGatewayFrontendPort> FrontendPorts { get; set; }

         public List<PSApplicationGatewayBackendAddressPool> BackendAddressPools { get; set; }

         public List<PSApplicationGatewayBackendHttpSettings> BackendHttpSettingsCollection { get; set; }

         public List<PSApplicationGatewayHttpListener> HttpListeners { get; set; }

         public List<PSApplicationGatewayRequestRoutingRule> RequestRoutingRules { get; set; }

         public string OperationalState { get; private set; }

         public string ProvisioningState { get; set; }

         [JsonIgnore]
         public string GatewayIpConfigurationsText
         {
             get { return JsonConvert.SerializeObject(GatewayIpConfigurations, Formatting.Indented); }
         }

         [JsonIgnore]
         public string SslCertificatesText
         {
             get { return JsonConvert.SerializeObject(SslCertificates, Formatting.Indented); }
         }

         [JsonIgnore]
         public string FrontendIpConfigurationsText
         {
             get { return JsonConvert.SerializeObject(FrontendIpConfigurations, Formatting.Indented); }
         }

         [JsonIgnore]
         public string FrontendPortsText
         {
             get { return JsonConvert.SerializeObject(FrontendPorts, Formatting.Indented); }
         }

         [JsonIgnore]
         public string BackendAddressPoolsText
         {
             get { return JsonConvert.SerializeObject(BackendAddressPools, Formatting.Indented); }
         }

         [JsonIgnore]
         public string BackendHttpSettingsListText
         {
             get { return JsonConvert.SerializeObject(BackendHttpSettingsCollection, Formatting.Indented); }
         }

         [JsonIgnore]
         public string HttpListenersText
         {
             get { return JsonConvert.SerializeObject(HttpListeners, Formatting.Indented); }
         }

         [JsonIgnore]
         public string RequestRoutingRulesText
         {
             get { return JsonConvert.SerializeObject(RequestRoutingRules, Formatting.Indented); }
         }
     }
}


text:
<!DOCTYPE html>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

<link rel="stylesheet" href="css/styles.css"></script>

    <map zoom="11" center="[40.74, -74.18]">
      <marker position="Toronto Canada" title="You are here" animation="Animation.BOUNCE" centered="true"></marker>
    </map>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Sitzungber. K. bohm. Ges. Wiss. , 1910 18 (1911)

#### Original name
Saccharomyces conomeli-limbati Šulc

### Remarks
null


text:
> The awesome package manager for AdvPL!

NeedIt is a fast and simple and concise package manager for TOTVS AdvPL written in Haskell with support for submodules. It is made to run concurrently with a big focus on performance. Transform your applications in libraries and host them on Github. Import them and compile on your environment!

## Usage

`needit`

It'll look for a `DEPENDENCIES` file on your root and install its packages

![Example](./image.png)

## Meta-syntax

NeedIt provides a small DSL to create your packages, like:

```haskell
PACKAGE example
FROM https://github.com/

NEEDS nginformatica/prelude-advpl
NEEDS nginformatica/advpl-string-builder
NEEDS nginformatica/json-advpl
```

You can also use the module `NeedIt.hs` to write your own integration.


text:
namespace TUVienna.CS_CUP
{
	using System;
	using System.Collections;
	using System.IO;

	/** This class serves as the main driver for the JavaCup system.
	 *  It accepts user options and coordinates overall control flow.
	 *  The main flow of control includes the following activities:
	 *

	 *
 Parse user supplied arguments and options.
	 *
 Open output files.
	 *
 Parse the specification from standard input.
	 *
 Check for unused terminals, non-terminals, and productions.
	 *
 Build the state machine, tables, etc.
	 *
 Output the generated code.
	 *
 Close output files.
	 *
 Print a summary if requested.
	 *

	 *
	 *  Options to the main program include:

	 *
 -package name
	 *
 specify package generated classes go in [default none]
	 *
 -parser name
	 *
 specify parser class name [default "parser"]
	 *
 -symbols name
	 *
 specify name for symbol constant class [default "sym"]
	 *
 -interface
	 *
 emit symbol constant interface, rather than class
	 *
 -nonterms
	 *
 put non terminals in symbol constant class
	 *
 -expect #
	 *
 number of conflicts expected/allowed [default 0]
	 *
 -compact_red
	 *
 compact tables by defaulting to most frequent reduce
	 *
 -nowarn
	 *
 don't warn about useless productions, etc.
	 *
 -nosummary
	 *
 don't print the usual summary of parse states, etc.
	 *
 -progress
	 *
 print messages to indicate progress of the system
	 *
 -time
	 *
 print time usage summary
	 *
 -dump_grammar
	 *
 produce a dump of the symbols and grammar
	 *
 -dump_states
	 *
 produce a dump of parse state machine
	 *
 -dump_tables
	 *
 produce a dump of the parse tables
	 *
 -dump
	 *
 produce a dump of all of the above
	 *
 -debug
	 *
 turn on debugging messages within JavaCup
	 *
 -nopositions
	 *
 don't generate the positions code
	 *
 -noscanner
	 *
 don't refer to java_cup.runtime.Scanner in the parser
	 *        (for compatibility with old runtimes)
	 *
 -version
	 *
 print version information for JavaCUP and halt.
	 *

	 *
	 * @version last updated: 7/3/96
	 * @author  Frank Flannery
     * translated to C# 08.09.2003 by Samuel Imriska
	 */

	public class CSCup
	{

		/*-----------------------------------------------------------*/
		/*--- Constructor(s) ----------------------------------------*/
		/*-----------------------------------------------------------*/
		/** Only constructor is private, so we do not allocate any instances of this
			class. */
		private CSCup() { }

		/*-------------------------*/
		/* Options Set by the user */
		/*-------------------------*/
		/** User option -- do we print progress messages. */
		protected static bool print_progress   = true;
		/** User option -- do we produce a dump of the state machine */
		protected static bool opt_dump_states  = false;
		/** User option -- do we produce a dump of the parse tables */
		protected static bool opt_dump_tables  = false;
		/** User option -- do we produce a dump of the grammar */
		protected static bool opt_dump_grammar = false;
		/** User option -- do we show timing information as a part of the summary */
		protected static bool opt_show_timing  = false;
		/** User option -- do we run produce extra debugging messages */
		protected static bool opt_do_debug     = false;
		/** User option -- do we compact tables by making most common reduce the
			default action */
		protected static bool opt_compact_red  = false;
		/** User option -- should we include non terminal symbol numbers in the
			symbol constant class. */
		protected static bool include_non_terms = false;
		/** User option -- do not print a summary. */
		protected static bool no_summary = false;
		/** User option -- number of conflicts to expect */
		protected static int expect_conflicts = 0;

		/* frankf added this 6/18/96 */
		/** User option -- should generator generate code for left/right values? */
		protected static bool lr_values = true;

		/** User option -- should symbols be put in a class or an interface? [CSA]*/
		protected static bool sym_interface = false;

		/** User option -- should generator suppress references to
		 *  java_cup.runtime.Scanner for compatibility with old runtimes? */
		protected static bool suppress_scanner = false;

		/*----------------------------------------------------------------------*/
		/* Timing data (not all of these time intervals are mutually exclusive) */
		/*----------------------------------------------------------------------*/
		/** Timing data -- when did we start */
		protected static long start_time       = 0;
		/** Timing data -- when did we end preliminaries */
		protected static long prelim_end       = 0;
		/** Timing data -- when did we end parsing */
		protected static long parse_end        = 0;
		/** Timing data -- when did we end checking */
		protected static long check_end        = 0;
		/** Timing data -- when did we end dumping */
		protected static long dump_end         = 0;
		/** Timing data -- when did we end state and table building */
		protected static long build_end        = 0;
		/** Timing data -- when did we end nullability calculation */
		protected static long nullability_end  = 0;
		/** Timing data -- when did we end first Set calculation */
		protected static long first_end        = 0;
		/** Timing data -- when did we end state machine construction */
		protected static long machine_end      = 0;
		/** Timing data -- when did we end table construction */
		protected static long table_end        = 0;
		/** Timing data -- when did we end checking for non-reduced productions */
		protected static long reduce_check_end = 0;
		/** Timing data -- when did we finish emitting code */
		protected static long emit_end         = 0;
		/** Timing data -- when were we completely done */
		protected static long final_time       = 0;

		/* Additional timing information is also collected in emit */

		/*-----------------------------------------------------------*/
		/*--- Main Program ------------------------------------------*/
		/*-----------------------------------------------------------*/

		/** The main driver for the system.
		 * @param argv an array of strings containing command line arguments.
		 */
		public static void Main(string[] argv)
		{
			bool did_output = false;

			try
			{
                //Test phase
				start_time = DateTime.Now.Ticks;

				/* process user options and arguments */
				parse_args(argv);

				/* frankf 6/18/96
			   hackish, yes, but works */
				emit.set_lr_values(lr_values);
				/* open output files */
				if (print_progress) System.Console.Error.WriteLine("Opening files...");
				/* use a buffered version of standard input */
           //    System.Console.SetIn(new StreamReader("c:\\parser.cup"));
				input_file = System.Console.In;

				prelim_end = DateTime.Now.Ticks;

				/* parse spec into internal data structures */
				if (print_progress)
					System.Console.Error.WriteLine("Parsing specification from standard input...");
				parse_grammar_spec();

				parse_end = DateTime.Now.Ticks;

				/* don't proceed unless we are error free */
				if (lexer.error_count == 0)
				{
					/* check for unused bits */
					if (print_progress) System.Console.Error.WriteLine("Checking specification...");
					check_unused();

					check_end = DateTime.Now.Ticks;

					/* build the state machine and parse tables */
					if (print_progress) System.Console.Error.WriteLine("Building parse tables...");
					build_parser();

					build_end = DateTime.Now.Ticks;

					/* output the generated code, if # of conflicts permits */
					if (lexer.error_count != 0)
					{
						// conflicts! don't emit code, don't dump tables.
						opt_dump_tables = false;
					}
					else
					{ // everything's okay, emit parser.
						if (print_progress) System.Console.WriteLine("Writing parser...");
						open_files();
						emit_parser();
						did_output = true;
					}
				}
				/* fix up the times to make the summary easier */
				emit_end = DateTime.Now.Ticks;

				/* do requested dumps */
				if (opt_dump_grammar) dump_grammar();
				if (opt_dump_states)  dump_machine();
				if (opt_dump_tables)  dump_tables();

				dump_end = DateTime.Now.Ticks;

				/* close input/output files */
				if (print_progress) System.Console.Error.WriteLine("Closing files...");
				close_files();

				/* produce a summary if desired */
				if (!no_summary) emit_summary(did_output);

				/* If there were errors during the run,
				 * exit with non-zero status (makefile-friendliness). --CSA */
				if (lexer.error_count != 0)
					System.Environment.Exit(100);
			}
			catch(System.Exception e)
			{
				System.Console.WriteLine(e.Message);
			}
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Print a "usage message" that described possible command line options,
		 *  then exit.
		 * @param message a specific error message to preface the usage message by.
		 */
		protected static void usage(string message)
		{
			System.Console.Error.WriteLine();
			System.Console.Error.WriteLine(message);
			System.Console.Error.WriteLine();
			System.Console.Error.WriteLine(
				"Usage: " + version.program_name + " [options] [filename]\n" +
				"  and expects a specification file on standard input if no filename is given.\n" +
				"  Legal options include:\n" +
				"    -namespace name  specify package generated classes go in [default none]\n" +
				"    -parser name   specify parser class name [default \"parser\"]\n" +
				"    -symbols name  specify name for symbol constant class [default \"sym\"]\n"+
				"    -interface     put symbols in an interface, rather than a class\n" +
				"    -nonterms      put non terminals in symbol constant class\n" +
				"    -expect #      number of conflicts expected/allowed [default 0]\n" +
				"    -compact_red   compact tables by defaulting to most frequent reduce\n" +
				"    -nowarn        don't warn about useless productions, etc.\n" +
				"    -nosummary     don't print the usual summary of parse states, etc.\n" +
				"    -nopositions   don't propagate the left and right token position values\n" +
				"    -noscanner     don't refer to java_cup.runtime.Scanner\n" +
				"    -progress      print messages to indicate progress of the system\n" +
				"    -time          print time usage summary\n" +
				"    -dump_grammar  produce a human readable dump of the symbols and grammar\n"+
				"    -dump_states   produce a dump of parse state machine\n"+
				"    -dump_tables   produce a dump of the parse tables\n"+
				"    -dump          produce a dump of all of the above\n"+
				"    -version       print the version information for CUP and exit\n"
				);
			System.Environment.Exit(1);
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Parse command line options and arguments to Set various user-option
		 *  flags and variables.
		 * @param argv the command line arguments to be parsed.
		 */
		protected static void parse_args(string[] argv)
		{
			int len = argv.Length;
			int i;

			/* parse the options */
			for (i=0; i<len; i++)
			{
				/* try to get the various options */
				if (argv[i].Equals("-namespace"))
				{
					/* must have an arg */
					if (++i >= len || argv[i].StartsWith("-") ||
						argv[i].EndsWith(".cup"))
						usage("-package must have a name argument");

					/* record the name */
					emit.package_name = argv[i];
				}
				else if (argv[i].Equals("-parser"))
				{
					/* must have an arg */
					if (++i >= len || argv[i].StartsWith("-") ||
						argv[i].EndsWith(".cup"))
						usage("-parser must have a name argument");

					/* record the name */
					emit.parser_class_name = argv[i];
				}
				else if (argv[i].Equals("-symbols"))
				{
					/* must have an arg */
					if (++i >= len || argv[i].StartsWith("-") ||
						argv[i].EndsWith(".cup"))
						usage("-symbols must have a name argument");

					/* record the name */
					emit.symbol_const_class_name = argv[i];
				}
				else if (argv[i].Equals("-nonterms"))
				{
					include_non_terms = true;
				}
				else if (argv[i].Equals("-expect"))
				{
					/* must have an arg */
					if (++i >= len || argv[i].StartsWith("-") ||
						argv[i].EndsWith(".cup"))
						usage("-expect must have a name argument");

					/* record the number */
					try
					{
						expect_conflicts = Int32.Parse(argv[i]);
					}
					catch
					{
						usage("-expect must be followed by a decimal integer");
					}
				}
				else if (argv[i].Equals("-compact_red"))  opt_compact_red = true;
				else if (argv[i].Equals("-nosummary"))    no_summary = true;
				else if (argv[i].Equals("-nowarn"))       emit.nowarn = true;
				else if (argv[i].Equals("-dump_states"))  opt_dump_states = true;
				else if (argv[i].Equals("-dump_tables"))  opt_dump_tables = true;
				else if (argv[i].Equals("-progress"))     print_progress = true;
				else if (argv[i].Equals("-dump_grammar")) opt_dump_grammar = true;
				else if (argv[i].Equals("-dump"))
					opt_dump_states = opt_dump_tables = opt_dump_grammar = true;
				else if (argv[i].Equals("-time"))         opt_show_timing = true;
				else if (argv[i].Equals("-debug"))        opt_do_debug = true;
					/* frankf 6/18/96 */
				else if (argv[i].Equals("-nopositions"))  lr_values = false;
					/* CSA 12/21/97 */
				else if (argv[i].Equals("-interface"))    sym_interface = true;
					/* CSA 23-Jul-1999 */
				else if (argv[i].Equals("-noscanner"))    suppress_scanner = true;
					/* CSA 23-Jul-1999 */
				else if (argv[i].Equals("-version"))
				{
					System.Console.WriteLine(version.title_str);
					System.Environment.Exit(1);
				}
					/* CSA 24-Jul-1999; suggestion by Jean Vaucher */
				else if (!argv[i].StartsWith("-") && i==len-1)
				{
					/* use input from file. */
					try
					{
                        input_redirected=true;
						System.Console.SetIn(new StreamReader(argv[i]));
					}
					catch
					{
						usage("Unable to open \"" + argv[i] +"\" for input");
					}
				}
				else
				{
					usage("Unrecognized option \"" + argv[i] + "\"");
				}
			}
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/*-------*/
		/* Files */
		/*-------*/

		/** Input file.  This is a buffered version of System.in. */
		protected static TextReader input_file;

        protected static bool input_redirected = false;

		/** Output file for the parser class. */
		protected static TextWriter parser_class_file;

		/** Output file for the symbol constant class. */
		protected static TextWriter symbol_class_file;

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Open various files used by the system. */
		protected static void open_files()
		{
			string out_name;

			/* open each of the output files */

			/* parser class */
			out_name = emit.parser_class_name + ".cs";
			try
			{
				parser_class_file = new StreamWriter(out_name);
			}
			catch
			{
				System.Console.Error.WriteLine("Can't open \"" + out_name + "\" for output");
				System.Environment.Exit(3);
			}

			/* symbol constants class */
			out_name = emit.symbol_const_class_name + ".cs";
			try
			{
				symbol_class_file = new StreamWriter(out_name);
			}
			catch
			{
				System.Console.Error.WriteLine("Can't open \"" + out_name + "\" for output");
				System.Environment.Exit(4);
			}
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Close various files used by the system. */
		protected static void close_files()
		{
			if (input_redirected) input_file.Close();
            if (parser_class_file != null)
            {
                parser_class_file.Flush();
                parser_class_file.Close();
            }
            if (symbol_class_file != null)
            {
                symbol_class_file.Flush();
                symbol_class_file.Close();
            }
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Parse the grammar specification from standard input.  This produces
		 *  sets of terminal, non-terminals, and productions which can be accessed
		 *  via static variables of the respective classes, as well as the setting
		 *  of various variables (mostly in the emit class) for small user supplied
		 *  items such as the code to scan with.
		 */
		protected static void parse_grammar_spec()
		{
			parser parser_obj;

			// create a parser and parse with it
			parser_obj = new parser();
			try
			{
				if (opt_do_debug)
					parser_obj.debug_parse();
				else
					parser_obj.parse();
			}
			catch (Exception e)
			{
				// something threw an exception.  catch it and emit a message so we
				 //  have a line number to work with, then re-throw it
				lexer.emit_error("Internal error: Unexpected exception");
				throw e;
			}
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Check for unused symbols.  Unreduced productions get checked when
		 *  tables are created.
		 */
		protected static void check_unused()
		{
			terminal term;
			non_terminal nt;

			/* check for unused terminals */
			IEnumerator t = terminal.all();
			while ( t.MoveNext() )
			{
				term = (terminal)t.Current;

				/* don't issue a message for EOF */
				if (term == terminal.EOF) continue;

				/* or error */
				if (term == terminal.error) continue;

				/* is this one unused */
				if (term.use_count() == 0)
				{
					/* count it and warn if we are doing warnings */
					emit.unused_term++;
					if (!emit.nowarn)
					{
						System.Console.Error.WriteLine("Warning: Terminal \"" + term.name() +
							"\" was declared but never used");
						lexer.warning_count++;
					}
				}
			}

			/* check for unused non terminals */
			IEnumerator n = non_terminal.all();
			while ( n.MoveNext() )
			{
				nt = (non_terminal)n.Current;

				/* is this one unused */
				if (nt.use_count() == 0)
				{
					/* count and warn if we are doing warnings */
					emit.unused_term++;
					if (!emit.nowarn)
					{
						System.Console.Error.WriteLine("Warning: Non terminal \"" + nt.name() +
							"\" was declared but never used");
						lexer.warning_count++;
					}
				}
			}

		}

		/* . . . . . . . . . . . . . . . . . . . . . . . . .*/
		/* . . Internal Results of Generating the Parser . .*/
		/* . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Start state in the overall state machine. */
		protected static lalr_state start_state;

		/** Resulting parse action table. */
		protected static parse_action_table action_table;

		/** Resulting reduce-goto table. */
		protected static parse_reduce_table reduce_table;

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Build the (internal) parser from the previously parsed specification.
		 *  This includes:

		 *
 Computing nullability of non-terminals.
		 *
 Computing first sets of non-terminals and productions.
		 *
 Building the viable prefix recognizer machine.
		 *
 Filling in the (internal) parse tables.
		 *
 Checking for unreduced productions.
		 *

		 */
		protected static void build_parser()
		{
			/* compute nullability of all non terminals */
			if (opt_do_debug || print_progress)
				System.Console.Error.WriteLine("  Computing non-terminal nullability...");
			non_terminal.compute_nullability();

			nullability_end = DateTime.Now.Ticks;

			/* compute first sets of all non terminals */
			if (opt_do_debug || print_progress)
				System.Console.Error.WriteLine("  Computing first sets...");
			non_terminal.compute_first_sets();

			first_end = DateTime.Now.Ticks;

			/* build the LR viable prefix recognition machine */
			if (opt_do_debug || print_progress)
				System.Console.Error.WriteLine("  Building state machine...");
			start_state = lalr_state.build_machine(emit.start_production);

			machine_end = DateTime.Now.Ticks;

			/* build the LR parser action and reduce-goto tables */
			if (opt_do_debug || print_progress)
				System.Console.Error.WriteLine("  Filling in tables...");
			action_table = new parse_action_table();
			reduce_table = new parse_reduce_table();
			IEnumerator st = lalr_state.all();
			while ( st.MoveNext() )
			{
				lalr_state lst = (lalr_state)st.Current;
				lst.build_table_entries(
					action_table, reduce_table);
			}

			table_end = DateTime.Now.Ticks;

			/* check and warn for non-reduced productions */
			if (opt_do_debug || print_progress)
				System.Console.Error.WriteLine("  Checking for non-reduced productions...");
			action_table.check_reductions();

			reduce_check_end = DateTime.Now.Ticks;

			/* if we have more conflicts than we expected issue a message and die */
			if (emit.num_conflicts > expect_conflicts)
			{
				System.Console.Error.WriteLine("*** More conflicts encountered than expected " +
					"-- parser generation aborted");
				lexer.error_count++; // indicate the problem.
				// we'll die on return, after clean up.
			}
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Call the emit routines necessary to write out the generated parser. */
		protected static void emit_parser()
		{
			emit.symbols(symbol_class_file, include_non_terms, sym_interface);
			emit.parser(parser_class_file, action_table, reduce_table,
				start_state.index(), emit.start_production, opt_compact_red,
				suppress_scanner);
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Helper routine to optionally return a plural or non-plural ending.
		 * @param val the numerical value determining plurality.
		 */
		protected static string plural(int val)
		{
			if (val == 1)
				return "";
			else
				return "s";
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Emit a long summary message to standard error (System.err) which
		 *  summarizes what was found in the specification, how many states were
		 *  produced, how many conflicts were found, etc.  A detailed timing
		 *  summary is also produced if it was requested by the user.
		 * @param output_produced did the system get far enough to generate code.
		 */
		protected static void emit_summary(bool output_produced)
		{
			final_time = DateTime.Now.Ticks;

			if (no_summary) return;

			System.Console.Error.WriteLine("------- " + version.title_str +
				" Parser Generation Summary -------");

			/* error and warning count */
			System.Console.Error.WriteLine("  " + lexer.error_count + " error" +
				plural(lexer.error_count) + " and " + lexer.warning_count +
				" warning" + plural(lexer.warning_count));

			/* basic stats */
			System.Console.Error.Write("  " + terminal.number() + " terminal" +
				plural(terminal.number()) + ", ");
			System.Console.Error.Write(non_terminal.number() + " non-terminal" +
				plural(non_terminal.number()) + ", and ");
			System.Console.Error.WriteLine(production.number() + " production" +
				plural(production.number()) + " declared, ");
			System.Console.Error.WriteLine("  producing " + lalr_state.number() +
				" unique parse states.");

			/* unused symbols */
			System.Console.Error.WriteLine("  " + emit.unused_term + " terminal" +
				plural(emit.unused_term) + " declared but not used.");
			System.Console.Error.WriteLine("  " + emit.unused_non_term + " non-terminal" +
				plural(emit.unused_term) + " declared but not used.");

			/* productions that didn't reduce */
			System.Console.Error.WriteLine("  " + emit.not_reduced + " production" +
				plural(emit.not_reduced) + " never reduced.");

			/* conflicts */
			System.Console.Error.WriteLine("  " + emit.num_conflicts + " conflict" +
				plural(emit.num_conflicts) + " detected" +
				" (" + expect_conflicts + " expected).");

			/* code location */
			if (output_produced)
				System.Console.Error.WriteLine("  Code written to \"" + emit.parser_class_name +
					".cs\", and \"" + emit.symbol_const_class_name + ".cs\".");
			else
				System.Console.Error.WriteLine("  No code produced.");

			if (opt_show_timing) show_times();

			System.Console.Error.WriteLine(
				"---------------------------------------------------- (" +
				version.version_str + ")");
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Produce the optional timing summary as part of an overall summary. */
		protected static void show_times()
		{
			long total_time = final_time - start_time;

			System.Console.Error.WriteLine(". . . . . . . . . . . . . . . . . . . . . . . . . ");
			System.Console.Error.WriteLine("  Timing Summary");
			System.Console.Error.WriteLine("    Total time       "
				+ timestr(final_time-start_time, total_time));
			System.Console.Error.WriteLine("      Startup        "
				+ timestr(prelim_end-start_time, total_time));
			System.Console.Error.WriteLine("      Parse          "
				+ timestr(parse_end-prelim_end, total_time) );
			if (check_end != 0)
				System.Console.Error.WriteLine("      Checking       "
					+ timestr(check_end-parse_end, total_time));
			if (check_end != 0 && build_end != 0)
				System.Console.Error.WriteLine("      Parser Build   "
					+ timestr(build_end-check_end, total_time));
			if (nullability_end != 0 && check_end != 0)
				System.Console.Error.WriteLine("        Nullability  "
					+ timestr(nullability_end-check_end, total_time));
			if (first_end != 0 && nullability_end != 0)
				System.Console.Error.WriteLine("        First sets   "
					+ timestr(first_end-nullability_end, total_time));
			if (machine_end != 0 && first_end != 0)
				System.Console.Error.WriteLine("        State build  "
					+ timestr(machine_end-first_end, total_time));
			if (table_end != 0 && machine_end != 0)
				System.Console.Error.WriteLine("        Table build  "
					+ timestr(table_end-machine_end, total_time));
			if (reduce_check_end != 0 && table_end != 0)
				System.Console.Error.WriteLine("        Checking     "
					+ timestr(reduce_check_end-table_end, total_time));
			if (emit_end != 0 && build_end != 0)
				System.Console.Error.WriteLine("      Code Output    "
					+ timestr(emit_end-build_end, total_time));
			if (emit.symbols_time != 0)
				System.Console.Error.WriteLine("        Symbols      "
					+ timestr(emit.symbols_time, total_time));
			if (emit.parser_time != 0)
				System.Console.Error.WriteLine("        Parser class "
					+ timestr(emit.parser_time, total_time));
			if (emit.action_code_time != 0)
				System.Console.Error.WriteLine("          Actions    "
					+ timestr(emit.action_code_time, total_time));
			if (emit.production_table_time != 0)
				System.Console.Error.WriteLine("          Prod table "
					+ timestr(emit.production_table_time, total_time));
			if (emit.action_table_time != 0)
				System.Console.Error.WriteLine("          Action tab "
					+ timestr(emit.action_table_time, total_time));
			if (emit.goto_table_time != 0)
				System.Console.Error.WriteLine("          Reduce tab "
					+ timestr(emit.goto_table_time, total_time));

			System.Console.Error.WriteLine("      Dump Output    "
				+ timestr(dump_end-emit_end, total_time));
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Helper routine to format a decimal based display of seconds and
		 *  percentage of total time given counts of milliseconds.   Note: this
		 *  is broken for use with some instances of negative time (since we don't
		 *  use any negative time here, we let if be for now).
		 * @param time_val   the value being formatted (in ms).
		 * @param total_time total time percentages are calculated against (in ms).
		 */
		protected static string timestr(long time_val, long total_time)
		{
			bool neg;
			long    ms = 0;
			long    sec = 0;
			long    percent10;
			string  pad;

			/* work with positives only */
			neg = time_val < 0;
			if (neg) time_val = -time_val;

			/* pull out seconds and ms */
			ms = time_val % 1000;
			sec = time_val / 1000;

			/* construct a pad to blank fill seconds out to 4 places */
			if (sec < 10)
				pad = "   ";
			else if (sec < 100)
				pad = "  ";
			else if (sec < 1000)
				pad = " ";
			else
				pad = "";

			/* calculate 10 times the percentage of total */
			percent10 = (time_val*1000)/total_time;

			/* build and return the output string */
			return (neg ? "-" : "") + pad + sec + "." +
				((ms%1000)/100) + ((ms%100)/10) + (ms%10) + "sec" +
				" (" + percent10/10 + "." + percent10%10 + "%)";
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Produce a human readable dump of the grammar. */
		public static void dump_grammar()
		{
			System.Console.Error.WriteLine("===== Terminals =====");
			for (int tidx=0, cnt=0; tidx < terminal.number(); tidx++, cnt++)
			{
				System.Console.Error.Write("["+tidx+"]"+terminal.find(tidx).name()+" ");
				if ((cnt+1) % 5 == 0) System.Console.Error.WriteLine();
			}
			System.Console.Error.WriteLine();
			System.Console.Error.WriteLine();

			System.Console.Error.WriteLine("===== Non terminals =====");
			for (int nidx=0, cnt=0; nidx < non_terminal.number(); nidx++, cnt++)
			{
				System.Console.Error.Write("["+nidx+"]"+non_terminal.find(nidx).name()+" ");
				if ((cnt+1) % 5 == 0) System.Console.Error.WriteLine();
			}
			System.Console.Error.WriteLine();
			System.Console.Error.WriteLine();

			System.Console.Error.WriteLine("===== Productions =====");
			for (int pidx=0; pidx < production.number(); pidx++)
			{
				production prod = production.find(pidx);
				System.Console.Error.Write("["+pidx+"] "+prod.lhs().the_symbol().name() + " ::= ");
				for (int i=0; i<prod.rhs_length(); i++)
					if (prod.rhs(i).is_action())
						System.Console.Error.Write("{action} ");
					else
						System.Console.Error.Write(
							((symbol_part)prod.rhs(i)).the_symbol().name() + " ");
				System.Console.Error.WriteLine();
			}
			System.Console.Error.WriteLine();
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Produce a (semi-) human readable dump of the complete viable prefix
		 *  recognition state machine.
		 */
		public static void dump_machine()
		{
			lalr_state[] ordered = new lalr_state[lalr_state.number()];

				/* put the states in sorted order for a nicer display */
				IEnumerator s = lalr_state.all();
				while ( s.MoveNext() )
				{
					lalr_state st = (lalr_state)s.Current;
					ordered[st.index()] = st;
				}

			System.Console.Error.WriteLine("===== Viable Prefix Recognizer =====");
			for (int i = 0; i<lalr_state.number(); i++)
			{
				if (ordered[i] == start_state) System.Console.Error.Write("START ");
				System.Console.Error.WriteLine(ordered[i]);
				System.Console.Error.WriteLine("-------------------");
			}
		}

		/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

		/** Produce a (semi-) human readable dumps of the parse tables */
		public static void dump_tables()
		{
			System.Console.Error.WriteLine(action_table);
			System.Console.Error.WriteLine(reduce_table);
		}

		/*-----------------------------------------------------------*/

	}
}


text:
package com.microsoft.azure.batch;

import com.microsoft.azure.batch.protocol.models.*;
import org.junit.*;

import java.util.List;

public class JobTests extends BatchIntegrationTestBase {
    private static CloudPool livePool;
    static String poolId;

    @BeforeClass
    public static void setup() throws Exception {
        poolId = getStringIdWithUserNamePrefix("-testpool");
        if(isRecordMode()) {
            createClient(AuthMode.SharedKey);
            livePool = createIfNotExistPaaSPool(poolId);
            Assert.assertNotNull(livePool);
        }
    }

    @AfterClass
    public static void cleanup() throws Exception {
        try {
            //batchClient.poolOperations().deletePool(livePool.id());
        }
        catch (Exception e) {
            // ignore any clean up exception
        }
    }

    @Test
    public void canCRUDJob() throws Exception {
        // CREATE
        String jobId = getStringIdWithUserNamePrefix("-Job-canCRUD");

        PoolInformation poolInfo = new PoolInformation();
        poolInfo.withPoolId(poolId);
        batchClient.jobOperations().createJob(jobId, poolInfo);

        try {
            // GET
            CloudJob job = batchClient.jobOperations().getJob(jobId);
            Assert.assertNotNull(job);
            Assert.assertEquals(jobId, job.id());
            Assert.assertEquals((Integer) 0, job.priority());

            // LIST
            List<CloudJob> jobs = batchClient.jobOperations().listJobs();
            Assert.assertNotNull(jobs);
            Assert.assertTrue(jobs.size() > 0);

            boolean found = false;
            for (CloudJob j : jobs) {
                if (j.id().equals(jobId)) {
                    found = true;
                    break;
                }
            }

            Assert.assertTrue(found);

            // UPDATE
            batchClient.jobOperations().updateJob(jobId, poolInfo, 1, null, null, null);
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals((Integer) 1, job.priority());

            // DELETE
            batchClient.jobOperations().deleteJob(jobId);
            try {
                batchClient.jobOperations().getJob(jobId);
                Assert.assertTrue("Shouldn't be here, the job should be deleted", true);
            } catch (BatchErrorException err) {
                if (!err.body().code().equals(BatchErrorCodeStrings.JobNotFound)) {
                    throw err;
                }
            }

            Thread.sleep(1 * 1000);
        }
        finally {
            try {
                batchClient.jobOperations().deleteJob(jobId);
            }
            catch (Exception e) {
                // Ignore here
            }
        }
    }

    @Test
    public void canUpdateJobState() throws Exception {
        // CREATE
        String jobId = getStringIdWithUserNamePrefix("-Job-CanUpdateState");
        PoolInformation poolInfo = new PoolInformation();
        poolInfo.withPoolId(poolId);

        batchClient.jobOperations().createJob(jobId, poolInfo);

        try {
            // GET
            CloudJob job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(JobState.ACTIVE, job.state());

            batchClient.jobOperations().disableJob(jobId, DisableJobOption.REQUEUE.REQUEUE);
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(JobState.DISABLING, job.state());

            Thread.sleep(5 * 1000);
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(JobState.DISABLED, job.state());

            Assert.assertEquals(OnAllTasksComplete.NO_ACTION, job.onAllTasksComplete());
            batchClient.jobOperations().patchJob(jobId, OnAllTasksComplete.TERMINATE_JOB);
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(OnAllTasksComplete.TERMINATE_JOB, job.onAllTasksComplete());

            batchClient.jobOperations().enableJob(jobId);
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(JobState.ACTIVE, job.state());

            batchClient.jobOperations().terminateJob(jobId, "myreason");
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(JobState.TERMINATING, job.state());

            Thread.sleep(2 * 1000);
            job = batchClient.jobOperations().getJob(jobId);
            Assert.assertEquals(JobState.COMPLETED, job.state());
        }
        finally {
            try {
                batchClient.jobOperations().deleteJob(jobId);
            }
            catch (Exception e) {
                // Ignore here
            }
        }
    }

}


text:
using System;
using System.Threading;

class TimerExample
{
    static void Main()
    {
        AutoResetEvent autoEvent = new AutoResetEvent(false);
        StatusChecker statusChecker = new StatusChecker(10);

        // Create the delegate that invokes methods for the timer.
        TimerCallback timerDelegate =
            new TimerCallback(statusChecker.CheckStatus);

        TimeSpan delayTime = new TimeSpan(0, 0, 1);
        TimeSpan intervalTime = new TimeSpan(0, 0, 0, 0, 250);

        // Create a timer that signals the delegate to invoke
        // CheckStatus after one second, and every 1/4 second
        // thereafter.
        Console.WriteLine("{0} Creating timer.",
            DateTime.Now.ToString("h:mm:ss.fff"));

        Timer stateTimer = new Timer(
            timerDelegate, autoEvent, delayTime, intervalTime);

        // When autoEvent signals, change the period to every
        // 1/2 second.
        autoEvent.WaitOne(5000, false);
        stateTimer.Change(new TimeSpan(0),
            intervalTime + intervalTime);
        Console.WriteLine("Changing period.");

        // When autoEvent signals the second time, dispose of
        // the timer.
        autoEvent.WaitOne(5000, false);
        stateTimer.Dispose();
        Console.WriteLine("Destroying timer.");
    }
}

class StatusChecker
{
    public int invokeCount, maxCount;

    public StatusChecker(int count)
    {
        invokeCount = 0;
        maxCount = count;
    }

    // This method is called by the timer delegate.
    public void CheckStatus(Object stateInfo)
    {
        AutoResetEvent autoEvent = (AutoResetEvent)stateInfo;
        Console.WriteLine("{0} Checking status {1,2}.",
            DateTime.Now.ToString("h:mm:ss.fff"),
            (++invokeCount).ToString());

        if (invokeCount == maxCount)
        {
            // Reset the counter and signal Main.
            invokeCount = 0;
            autoEvent.Set();
        }
    }
}


text:
<title>dlib C++ Library - pyassert.h</title>

// Copyright (C) 2013  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#ifndef DLIB_PYaSSERT_Hh_
#define DLIB_PYaSSERT_Hh_

#include <boost/python.hpp>

#define pyassert(_exp,_message)                                             \
    {if ( !(_exp) )                                                         \
    {                                                                       \
        PyErr_SetString( PyExc_ValueError, _message );                      \
        boost::python::throw_error_already_set();                           \
    }}

#endif // DLIB_PYaSSERT_Hh_


text:
<?php

namespace ORM\MainBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\ORM\EntityRepository as ER;

class MainController extends Controller
{
    public function indexAction()
    {
        return $this->render('ORMMainBundle:Main:index.html.twig');
    }

    public function countAction()
    {
        $persRepo = $this->getDoctrine()->getRepository('ORMMainBundle:Person')->CountAll()[0][1];

        $addRepo = $this->getDoctrine()->getRepository('ORMMainBundle:Address')->CountAll()[0][1];

        $citiesRepo = $this->getDoctrine()->getRepository('ORMMainBundle:GdCities')->CountAll()[0][1];

        $countriesRepo = $this->getDoctrine()->getRepository('ORMMainBundle:GdCountries')->CountAll()[0][1];

        $regionsRepo = $this->getDoctrine()->getRepository('ORMMainBundle:GdRegions')->CountAll()[0][1];

        return $this->render('ORMMainBundle:Main:count.html.twig',
            array(
                'person' => $persRepo,
                'address' => $addRepo,
                'cities' => $citiesRepo,
                'countries' => $countriesRepo,
                'regions' => $regionsRepo,
            ));
    }

    public function getbydateAction()
    {
        $detail = "Compte le nombre de personnes nées le 01/01/1940";

        $start = round(microtime(true) * 1000);

        $repository = $this->getDoctrine()->getRepository('ORMMainBundle:Person');

        $person = $repository->CountByBirthDate("01/01/1940");

        if($person === null)
        {
            throw $this->createNotFoundException('Person does not exist.');
        }

        return $this->render('ORMMainBundle:Main:getbydate.html.twig',
            array(
                'person' => $person[0][1],
                'time' => round(microtime(true) * 1000) - $start,
                'details' => $detail,
            ));
    }
}


text:
package parameter

trait ExtensionMethod {
  extension (i: Int)
    def typeParameter[A]: Unit = ???

  extension (i: Int)
    def typeParameters[A, B]: Unit = ???

  extension (i: Int)
    def valueParameter(x: Int): Unit

  extension (i: Int)
    def valueParameters(x: Int, y: Long): Unit

  extension (i: Int)
    def noClause: Unit

  extension (i: Int)
    def emptyClause(): Unit

  extension (i: Int)
    def multipleClauses(x: Int)(y: Long): Unit

  extension (i: Int)
    def typeAndValueParameters[A](x: Int): Unit
}


text:
<?php

/**
 * DataSource that provides access to an XML (in an extremely simplified manner)
 *
 * TODO explain the structure and possible options
 *
 * @package    DspLib
 * @subpackage DataSource
 * @author     Pierre Feyssaguet <pfeyssaguet@gmail.com>
 * @since      20 oct. 2011 22:57:38
 */

namespace DspLib\DataSource;

/**
 * DataSource that provides access to an XML (in an extremely simplified manner)
 *
 * TODO explain the structure and possible options
 *
 * @package    DspLib
 * @subpackage DataSource
 * @author     Pierre Feyssaguet <pfeyssaguet@gmail.com>
 * @since      20 oct. 2011 22:57:38
 */
class DataSourceXML extends DataSource
{

    private $sPath;

    private $aKeys;

    private $sNode;

    private $oDoc;

    private $oElement;

    private $oNodeList;

    private $aCurrentRow;

    private $iIndex = 0;

    public function __construct($sPath)
    {
        $this->sPath = $sPath;
        $this->oDoc = new \DOMDocument();
        $this->oDoc->load($this->sPath);
        $this->oElement = $this->oDoc->documentElement;
        $this->oNodeList = $this->oDoc->getElementsByTagName($this->oElement->nodeName);
    }

    public function setNode($sNode)
    {
        $this->sNode = $sNode;
        $this->iIndex = 0;
        $this->aKeys = null;
        $this->oNodeList = $this->oDoc->getElementsByTagName($this->sNode);
        $this->oElement = $this->oNodeList->item($this->iIndex);
    }

    protected function getTitles()
    {
        if (!isset($this->aKeys)) {
            $this->aKeys = array();
            for ($i = 0; $i < $this->oElement->childNodes->length; $i++) {
                $oElement = $this->oElement->childNodes->item($i);
                if ($oElement instanceof \DOMElement) {
                    $this->aKeys[] = $oElement->nodeName;
                }
            }
        }
        return $this->aKeys;
    }

    public function count()
    {
        return $this->oNodeList->length;
    }

    protected function getCurrentElement()
    {
        return $this->aCurrentRow;
    }

    public function key()
    {
        return $this->iIndex;
    }

    public function next()
    {
        $this->iIndex++;
        $this->extractRow();
    }

    public function rewind()
    {
        $this->iIndex = 0;
        $this->extractRow();
    }

    public function valid()
    {
        return $this->iIndex < $this->oNodeList->length && isset($this->aCurrentRow);
    }

    private function extractRow()
    {
        if ($this->iIndex >= $this->oNodeList->length) {
            return false;
        }
        $this->oElement = $this->oNodeList->item($this->iIndex);
        $this->aCurrentRow = array();
        for ($i = 0; $i < $this->oElement->childNodes->length; $i++) {
            $oElement = $this->oElement->childNodes->item($i);
            if ($oElement instanceof \DOMElement) {
                $this->aCurrentRow[$oElement->nodeName] = $oElement->nodeValue;
            }
        }
    }

    /**
     * Ajoute une ligne dans le DataSource
     *
     * @param array $aRow Ligne à ajouter
     * @throws \Exception
     */
    public function writeRow(array $aRow)
    {
        throw new \Exception('Method writeRow is not implemented yet in ' . __CLASS__);
    }
}


text:
describe RenameParams::Converters::ProcConverter do

  subject(:converter) { RenameParams::Converters::ProcConverter.new(->(value) { value.to_i * 100 }) }

  describe '#convert' do
    it { expect(converter.convert(1)).to eq 100 }
    it { expect(converter.convert(2)).to eq 200 }
  end
end


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using XenAdmin.ServerDBs;

namespace XenAdmin.Core
{
    public static class SimpleProxyMethodParser
    {
        public static ProxyMethodInfo ParseTypeAndNameOnly(string proxyMethodName)
        {
            string typeName = GetTypeName(proxyMethodName);
            MethodType fakeMethodType = proxyMethodName.StartsWith(String.Format("{0}_", typeName)) ? MethodType.Sync : MethodType.Async;
            string methodName = fakeMethodType == MethodType.Sync ? proxyMethodName.Substring(typeName.Length + 1) : proxyMethodName.Substring(7 + typeName.Length);
            return new ProxyMethodInfo(methodName, typeName);
        }

        private static string GetTypeName(string proxyMethodName)
        {
            // This only works because DbProxy.AllTypes has longest names first,
            // so we never accidentally match a substring.
            foreach (string type in AllTypes)
            {
                if (proxyMethodName.StartsWith(string.Format("{0}_", type)) || proxyMethodName.StartsWith(string.Format("async_{0}_", type)))
                {
                    return type;
                }
            }
            return null;
        }
        // Find all XenObject types. Actually the ones we want are those with
        // associated Proxy_ types (basically, the ones in the public API).
        private static readonly object XenApiTypesLock = new object();
        private static ReadOnlyCollection<string> _xenApiTypeNames;
        public static ReadOnlyCollection<string> AllTypes
        {
            get
            {
                lock (XenApiTypesLock)
                {
                    if (_xenApiTypeNames == null)
                    {
                        List<string> names = new List<string>();

                        foreach (Type type in Assembly.Load(new AssemblyName("XenModel")).GetTypes())
                        {
                            if (type.Namespace == "XenAPI" && type.Name.StartsWith("Proxy_"))
                                names.Add(type.Name.Substring(6).ToLower());
                        }

                        // We sort the names in reverse alphabetical order, so that later in
                        // ProxyMethodNameParser.GetTypeName(), we find the longest matching name.
                        names.Sort((x, y) => -x.CompareTo(y));
                        _xenApiTypeNames = new ReadOnlyCollection<string>(names);
                    }
                    return _xenApiTypeNames;
                }
            }
        }
    }
}


text:
layout: api
title: "v2.2.1 JavaScript Library: L.mapbox.config.FORCE_HTTPS"
categories: api
version: v2.2.1
permalink: /api/v2.2.1/l-mapbox-config-force_https
---

L.mapbox.config.FORCE_HTTPS

By default, this is false. Mapbox.js auto-detects whether the page your map
is embedded in is using HTTPS or SSL, and matches: if you use HTTPS on your site,
it uses HTTPS resources.

Setting FORCE_HTTPS to true makes Mapbox.js always require HTTPS resources,
regardless of the host page's scheme.

Example:

L.mapbox.config.FORCE_HTTPS = true;