text:
package org.apache.pdfbox.pdmodel.graphics.color;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.COSNull;
import org.apache.pdfbox.pdmodel.common.COSArrayList;
import org.apache.pdfbox.pdmodel.common.function.PDFunction;

/**
 * DeviceN colour spaces may contain an arbitrary number of colour components.
 * DeviceN represents a colour space containing multiple components that correspond to colorants
 * of some target device. As with Separation colour spaces, readers are able to approximate the
 * colorants if they are not available on the current output device, such as a display
 *
 * @author John Hewson
 * @author Ben Litchfield
 */
public class PDDeviceN extends PDSpecialColorSpace
{
    // array indexes
    private static final int COLORANT_NAMES = 1;
    private static final int ALTERNATE_CS = 2;
    private static final int TINT_TRANSFORM = 3;
    private static final int DEVICEN_ATTRIBUTES = 4;

    // fields
    private PDColorSpace alternateColorSpace = null;
    private PDFunction tintTransform = null;
    private PDDeviceNAttributes attributes;
    private PDColor initialColor;

    // color conversion cache
    private int numColorants;
    private int[] colorantToComponent;
    private PDColorSpace processColorSpace;
    private PDSeparation[] spotColorSpaces;

    /**
     * Creates a new DeviceN color space.
     */
    public PDDeviceN()
    {
        array = new COSArray();
        array.add(COSName.DEVICEN);

        // empty placeholder
        array.add(COSNull.NULL);
        array.add(COSNull.NULL);
        array.add(COSNull.NULL);
    }

    /**
     * Creates a new DeviceN color space from the given COS array.
     * @param deviceN an array containing the color space information
     */
    public PDDeviceN(COSArray deviceN) throws IOException
    {
        array = deviceN;
        alternateColorSpace = PDColorSpace.create(array.getObject(ALTERNATE_CS));
        tintTransform = PDFunction.create(array.getObject(TINT_TRANSFORM));

        if (array.size() > DEVICEN_ATTRIBUTES)
        {
            attributes = new PDDeviceNAttributes((COSDictionary)array.getObject(DEVICEN_ATTRIBUTES));
        }
        initColorConversionCache();

        // set initial color space
        int n = getNumberOfComponents();
        float[] initial = new float[n];
        for (int i = 0; i < n; i++)
        {
            initial[i] = 1;
        }
        initialColor = new PDColor(initial, this);
    }

    // initializes the color conversion cache
    private void initColorConversionCache() throws IOException
    {
        // there's nothing to cache for non-attribute spaces
        if (attributes == null)
        {
            return;
        }

        // colorant names
        List<String> colorantNames = getColorantNames();
        numColorants = colorantNames.size();

        // process components
        colorantToComponent = new int[numColorants];
        for (int c = 0; c < numColorants; c++)
        {
            colorantToComponent[c] = -1;
        }

        if (attributes.getProcess() != null)
        {
            List<String> components = attributes.getProcess().getComponents();

            // map each colorant to the corresponding process component (if any)
            for (int c = 0; c < numColorants; c++)
            {
                colorantToComponent[c] = components.indexOf(colorantNames.get(c));
            }

            // process color space
            processColorSpace = attributes.getProcess().getColorSpace();
        }

        // spot colorants
        spotColorSpaces = new PDSeparation[numColorants];
        if (attributes.getColorants() != null)
        {
            // spot color spaces
            Map<String, PDSeparation> spotColorants = attributes.getColorants();

            // map each colorant to the corresponding spot color space
            for (int c = 0; c < numColorants; c++)
            {
                String name = colorantNames.get(c);
                PDSeparation spot = spotColorants.get(name);
                if (spot != null)
                {
                    // spot colorant
                    spotColorSpaces[c] = spot;

                    // spot colors may replace process colors with same name
                    // providing that the subtype is not NChannel.
                    if (!isNChannel())
                    {
                        colorantToComponent[c] = -1;
                    }
                }
                else
                {
                    // process colorant
                    spotColorSpaces[c] = null;
                }
            }
        }
    }

    @Override
    public BufferedImage toRGBImage(WritableRaster raster) throws IOException
    {
        if (attributes != null)
        {
            return toRGBWithAttributes(raster);
        }
        else
        {
            return toRGBWithTintTransform(raster);
        }
    }

    //
    // WARNING: this method is performance sensitive, modify with care!
    //
    private BufferedImage toRGBWithAttributes(WritableRaster raster) throws IOException
    {
        int width = raster.getWidth();
        int height = raster.getHeight();

        BufferedImage rgbImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        WritableRaster rgbRaster = rgbImage.getRaster();

        // white background
        Graphics2D g = rgbImage.createGraphics();
        g.setBackground(Color.WHITE);
        g.clearRect(0, 0, width, height);
        g.dispose();

        // look up each colorant
        for (int c = 0; c < numColorants; c++)
        {
            PDColorSpace componentColorSpace;
            if (colorantToComponent[c] >= 0)
            {
                // process color
                componentColorSpace = processColorSpace;
            }
            else if (spotColorSpaces[c] == null)
            {
                // TODO this happens in the Altona Visual test, is there a better workaround?
                // missing spot color, fallback to using tintTransform
                return toRGBWithTintTransform(raster);
            }
            else
            {
                // spot color
                componentColorSpace = spotColorSpaces[c];
            }

            // copy single-component to its own raster in the component color space
            WritableRaster componentRaster = Raster.createBandedRaster(DataBuffer.TYPE_BYTE,
                width, height, componentColorSpace.getNumberOfComponents(), new Point(0, 0));

            int[] samples = new int[numColorants];
            int[] componentSamples = new int[componentColorSpace.getNumberOfComponents()];
            boolean isProcessColorant = colorantToComponent[c] >= 0;
            int componentIndex = colorantToComponent[c];
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    raster.getPixel(x, y, samples);
                    if (isProcessColorant)
                    {
                        // process color
                        componentSamples[componentIndex] = samples[c];
                    }
                    else
                    {
                        // spot color
                        componentSamples[0] = samples[c];
                    }
                    componentRaster.setPixel(x, y, componentSamples);
                }
            }

            // convert single-component raster to RGB
            BufferedImage rgbComponentImage = componentColorSpace.toRGBImage(componentRaster);
            WritableRaster rgbComponentRaster = rgbComponentImage.getRaster();

            // combine the RGB component with the RGB composite raster
            int[] rgbChannel = new int[3];
            int[] rgbComposite = new int[3];
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    rgbComponentRaster.getPixel(x, y, rgbChannel);
                    rgbRaster.getPixel(x, y, rgbComposite);

                    // multiply (blend mode)
                    rgbChannel[0] = rgbChannel[0] * rgbComposite[0] >> 8;
                    rgbChannel[1] = rgbChannel[1] * rgbComposite[1] >> 8;
                    rgbChannel[2] = rgbChannel[2] * rgbComposite[2] >> 8;

                    rgbRaster.setPixel(x, y, rgbChannel);
                }
            }
        }

        return rgbImage;
    }

    //
    // WARNING: this method is performance sensitive, modify with care!
    //
    private BufferedImage toRGBWithTintTransform(WritableRaster raster) throws IOException
    {
        int width = raster.getWidth();
        int height = raster.getHeight();

        // use the tint transform to convert the sample into
        // the alternate color space (this is usually 1:many)
        BufferedImage rgbImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        WritableRaster rgbRaster = rgbImage.getRaster();
        int[] rgb = new int[3];
        int numSrcComponents = getColorantNames().size();
        float[] src = new float[numSrcComponents];
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                raster.getPixel(x, y, src);

                int[] intSrc = new int[numSrcComponents];
                raster.getPixel(x, y, intSrc);

                // scale to 0..1
                for (int s = 0; s < numSrcComponents; s++)
                {
                    src[s] = src[s] / 255;
                }

                // convert to alternate color space via tint transform
                float[] result = tintTransform.eval(src);

                // convert from alternate color space to RGB
                float[] rgbFloat = alternateColorSpace.toRGB(result);

                for (int s = 0; s < 3; s++)
                {
                    // scale to 0..255
                    rgb[s] = (int) (rgbFloat[s] * 255f);
                }

                rgbRaster.setPixel(x, y, rgb);
            }
        }
        return rgbImage;
    }

    @Override
    public float[] toRGB(float[] value) throws IOException
    {
        if (attributes != null)
        {
            return toRGBWithAttributes(value);
        }
        else
        {
            return toRGBWithTintTransform(value);
        }
    }

    private float[] toRGBWithAttributes(float[] value) throws IOException
    {
        float[] rgbValue = new float[] { 1, 1, 1 };

        // look up each colorant
        for (int c = 0; c < numColorants; c++)
        {
            PDColorSpace componentColorSpace;
            if (colorantToComponent[c] >= 0)
            {
                // process color
                componentColorSpace = processColorSpace;
            }
            else if (spotColorSpaces[c] == null)
            {
                // TODO this happens in the Altona Visual test, is there a better workaround?
                // missing spot color, fallback to using tintTransform
                return toRGBWithTintTransform(value);
            }
            else
            {
                // spot color
                componentColorSpace = spotColorSpaces[c];
            }

            // get the single component
            boolean isProcessColorant = colorantToComponent[c] >= 0;
            float[] componentSamples = new float[componentColorSpace.getNumberOfComponents()];
            int componentIndex = colorantToComponent[c];

            if (isProcessColorant)
            {
                // process color
                componentSamples[componentIndex] = value[c];
            }
            else
            {
                // spot color
                componentSamples[0] = value[c];
            }

            // convert single component to RGB
            float[] rgbComponent = componentColorSpace.toRGB(componentSamples);

            // combine the RGB component value with the RGB composite value

            // multiply (blend mode)
            rgbValue[0] *= rgbComponent[0];
            rgbValue[1] *= rgbComponent[1];
            rgbValue[2] *= rgbComponent[2];
        }

        return rgbValue;
    }

    private float[] toRGBWithTintTransform(float[] value) throws IOException
    {
        // use the tint transform to convert the sample into
        // the alternate color space (this is usually 1:many)
        float[] altValue = tintTransform.eval(value);

        // convert the alternate color space to RGB
        return alternateColorSpace.toRGB(altValue);
    }

    /**
     * Returns true if this color space has the NChannel subtype.
     * @return true if subtype is NChannel
     */
    public boolean isNChannel()
    {
        return attributes != null && attributes.isNChannel();
    }

    @Override
    public String getName()
    {
        return COSName.DEVICEN.getName();
    }

    @Override
    public final int getNumberOfComponents()
    {
        return getColorantNames().size();
    }

    @Override
    public float[] getDefaultDecode(int bitsPerComponent)
    {
        int n = getNumberOfComponents();
        float[] decode = new float[n * 2];
        for (int i = 0; i < n; i++)
        {
            decode[i * 2 + 1] = 1;
        }
        return decode;
    }

    @Override
    public PDColor getInitialColor()
    {
        return initialColor;
    }

    /**
     * Returns the list of colorants.
     * @return the list of colorants
     */
    public List<String> getColorantNames()
    {
        COSArray names = (COSArray)array.getObject(COLORANT_NAMES);
        return COSArrayList.convertCOSNameCOSArrayToList(names);
    }

    /**
     * Returns the attributes associated with the DeviceN color space.
     * @return the DeviceN attributes
     */
    public PDDeviceNAttributes getAttributes()
    {
        return attributes;
    }

    /**
     * Sets the list of colorants
     * @param names the list of colorants
     */
    public void setColorantNames(List<String> names)
    {
        COSArray namesArray = COSArrayList.convertStringListToCOSNameCOSArray(names);
        array.set(COLORANT_NAMES, namesArray);
    }

    /**
     * Sets the color space attributes.
     * If null is passed in then all attribute will be removed.
     * @param attributes the color space attributes, or null
     */
    public void setAttributes(PDDeviceNAttributes attributes)
    {
        this.attributes = attributes;
        if (attributes == null)
        {
            array.remove(DEVICEN_ATTRIBUTES);
        }
        else
        {
            // make sure array is large enough
            while (array.size() <= DEVICEN_ATTRIBUTES)
            {
                array.add(COSNull.NULL);
            }
            array.set(DEVICEN_ATTRIBUTES, attributes.getCOSDictionary());
        }
    }

    /**
     * This will get the alternate color space for this separation.
     *
     * @return The alternate color space.
     *
     * @throws IOException If there is an error getting the alternate color
     * space.
     */
    public PDColorSpace getAlternateColorSpace() throws IOException
    {
        if (alternateColorSpace == null)
        {
            alternateColorSpace = PDColorSpace.create(array.getObject(ALTERNATE_CS));
        }
        return alternateColorSpace;
    }

    /**
     * This will set the alternate color space.
     *
     * @param cs The alternate color space.
     */
    public void setAlternateColorSpace(PDColorSpace cs)
    {
        alternateColorSpace = cs;
        COSBase space = null;
        if (cs != null)
        {
            space = cs.getCOSObject();
        }
        array.set(ALTERNATE_CS, space);
    }

    /**
     * This will get the tint transform function.
     *
     * @return The tint transform function.
     *
     * @throws IOException if there is an error creating the function.
     */
    public PDFunction getTintTransform() throws IOException
    {
        if (tintTransform == null)
        {
            tintTransform = PDFunction.create(array.getObject(TINT_TRANSFORM));
        }
        return tintTransform;
    }

    /**
     * This will set the tint transform function.
     *
     * @param tint The tint transform function.
     */
    public void setTintTransform(PDFunction tint)
    {
        tintTransform = tint;
        array.set(TINT_TRANSFORM, tint);
    }

    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder(getName());
        sb.append('{');
        for (String col : getColorantNames())
        {
            sb.append('\"');
            sb.append(col);
            sb.append("\" ");
        }
        sb.append(alternateColorSpace.getName());
        sb.append(' ');
        sb.append(tintTransform);
        sb.append(' ');
        if (attributes != null)
        {
            sb.append(attributes);
        }
        sb.append('}');
        return sb.toString();
    }
}


text:
package net.opengis.gml.impl;
/**
 * An XML DirectPositionListType(@http://www.opengis.net/gml).
 *
 * This is a list type whose items are org.apache.xmlbeans.XmlDouble.
 */
public class DirectPositionListTypeImpl extends org.apache.xmlbeans.impl.values.XmlListImpl implements net.opengis.gml.DirectPositionListType
{
    private static final long serialVersionUID = 1L;

    public DirectPositionListTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType, true);
    }

    protected DirectPositionListTypeImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
    {
        super(sType, b);
    }

    private static final javax.xml.namespace.QName SRSNAME$0 =
        new javax.xml.namespace.QName("", "srsName");
    private static final javax.xml.namespace.QName SRSDIMENSION$2 =
        new javax.xml.namespace.QName("", "srsDimension");
    private static final javax.xml.namespace.QName AXISLABELS$4 =
        new javax.xml.namespace.QName("", "axisLabels");
    private static final javax.xml.namespace.QName UOMLABELS$6 =
        new javax.xml.namespace.QName("", "uomLabels");
    private static final javax.xml.namespace.QName COUNT$8 =
        new javax.xml.namespace.QName("", "count");

    /**
     * Gets the "srsName" attribute
     */
    public java.lang.String getSrsName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SRSNAME$0);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "srsName" attribute
     */
    public org.apache.xmlbeans.XmlAnyURI xgetSrsName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(SRSNAME$0);
            return target;
        }
    }

    /**
     * True if has "srsName" attribute
     */
    public boolean isSetSrsName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(SRSNAME$0) != null;
        }
    }

    /**
     * Sets the "srsName" attribute
     */
     public void setSrsName(java.lang.String srsName)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SRSNAME$0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(SRSNAME$0);
            }
            target.setStringValue(srsName);
        }
    }

    /**
     * Sets (as xml) the "srsName" attribute
     */
    public void xsetSrsName(org.apache.xmlbeans.XmlAnyURI srsName)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlAnyURI target = null;
            target = (org.apache.xmlbeans.XmlAnyURI)get_store().find_attribute_user(SRSNAME$0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlAnyURI)get_store().add_attribute_user(SRSNAME$0);
            }
            target.set(srsName);
        }
    }

    /**
     * Unsets the "srsName" attribute
     */
    public void unsetSrsName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(SRSNAME$0);
        }
    }

    /**
     * Gets the "srsDimension" attribute
     */
    public java.math.BigInteger getSrsDimension()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SRSDIMENSION$2);
            if (target == null)
            {
                return null;
            }
            return target.getBigIntegerValue();
        }
    }

    /**
     * Gets (as xml) the "srsDimension" attribute
     */
    public org.apache.xmlbeans.XmlPositiveInteger xgetSrsDimension()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlPositiveInteger target = null;
            target = (org.apache.xmlbeans.XmlPositiveInteger)get_store().find_attribute_user(SRSDIMENSION$2);
            return target;
        }
    }

    /**
     * True if has "srsDimension" attribute
     */
    public boolean isSetSrsDimension()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(SRSDIMENSION$2) != null;
        }
    }

    /**
     * Sets the "srsDimension" attribute
     */
     public void setSrsDimension(java.math.BigInteger srsDimension)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SRSDIMENSION$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(SRSDIMENSION$2);
            }
            target.setBigIntegerValue(srsDimension);
        }
    }

    /**
     * Sets (as xml) the "srsDimension" attribute
     */
    public void xsetSrsDimension(org.apache.xmlbeans.XmlPositiveInteger srsDimension)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlPositiveInteger target = null;
            target = (org.apache.xmlbeans.XmlPositiveInteger)get_store().find_attribute_user(SRSDIMENSION$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlPositiveInteger)get_store().add_attribute_user(SRSDIMENSION$2);
            }
            target.set(srsDimension);
        }
    }

    /**
     * Unsets the "srsDimension" attribute
     */
    public void unsetSrsDimension()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(SRSDIMENSION$2);
        }
    }

    /**
     * Gets the "axisLabels" attribute
     */
    public java.util.List getAxisLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(AXISLABELS$4);
            if (target == null)
            {
                return null;
            }
            return target.getListValue();
        }
    }

    /**
     * Gets (as xml) the "axisLabels" attribute
     */
    public net.opengis.gml.NCNameList xgetAxisLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.opengis.gml.NCNameList target = null;
            target = (net.opengis.gml.NCNameList)get_store().find_attribute_user(AXISLABELS$4);
            return target;
        }
    }

    /**
     * True if has "axisLabels" attribute
     */
    public boolean isSetAxisLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(AXISLABELS$4) != null;
        }
    }

    /**
     * Sets the "axisLabels" attribute
     */
     public void setAxisLabels(java.util.List axisLabels)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(AXISLABELS$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(AXISLABELS$4);
            }
            target.setListValue(axisLabels);
        }
    }

    /**
     * Sets (as xml) the "axisLabels" attribute
     */
    public void xsetAxisLabels(net.opengis.gml.NCNameList axisLabels)
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.opengis.gml.NCNameList target = null;
            target = (net.opengis.gml.NCNameList)get_store().find_attribute_user(AXISLABELS$4);
            if (target == null)
            {
                target = (net.opengis.gml.NCNameList)get_store().add_attribute_user(AXISLABELS$4);
            }
            target.set(axisLabels);
        }
    }

    /**
     * Unsets the "axisLabels" attribute
     */
    public void unsetAxisLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(AXISLABELS$4);
        }
    }

    /**
     * Gets the "uomLabels" attribute
     */
    public java.util.List getUomLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(UOMLABELS$6);
            if (target == null)
            {
                return null;
            }
            return target.getListValue();
        }
    }

    /**
     * Gets (as xml) the "uomLabels" attribute
     */
    public net.opengis.gml.NCNameList xgetUomLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.opengis.gml.NCNameList target = null;
            target = (net.opengis.gml.NCNameList)get_store().find_attribute_user(UOMLABELS$6);
            return target;
        }
    }

    /**
     * True if has "uomLabels" attribute
     */
    public boolean isSetUomLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(UOMLABELS$6) != null;
        }
    }

    /**
     * Sets the "uomLabels" attribute
     */
     public void setUomLabels(java.util.List uomLabels)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(UOMLABELS$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(UOMLABELS$6);
            }
            target.setListValue(uomLabels);
        }
    }

    /**
     * Sets (as xml) the "uomLabels" attribute
     */
    public void xsetUomLabels(net.opengis.gml.NCNameList uomLabels)
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.opengis.gml.NCNameList target = null;
            target = (net.opengis.gml.NCNameList)get_store().find_attribute_user(UOMLABELS$6);
            if (target == null)
            {
                target = (net.opengis.gml.NCNameList)get_store().add_attribute_user(UOMLABELS$6);
            }
            target.set(uomLabels);
        }
    }

    /**
     * Unsets the "uomLabels" attribute
     */
    public void unsetUomLabels()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(UOMLABELS$6);
        }
    }

    /**
     * Gets the "count" attribute
     */
    public java.math.BigInteger getCount()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(COUNT$8);
            if (target == null)
            {
                return null;
            }
            return target.getBigIntegerValue();
        }
    }

    /**
     * Gets (as xml) the "count" attribute
     */
    public org.apache.xmlbeans.XmlPositiveInteger xgetCount()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlPositiveInteger target = null;
            target = (org.apache.xmlbeans.XmlPositiveInteger)get_store().find_attribute_user(COUNT$8);
            return target;
        }
    }

    /**
     * True if has "count" attribute
     */
    public boolean isSetCount()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(COUNT$8) != null;
        }
    }

    /**
     * Sets the "count" attribute
     */
     public void setCount(java.math.BigInteger count)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(COUNT$8);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(COUNT$8);
            }
            target.setBigIntegerValue(count);
        }
    }

    /**
     * Sets (as xml) the "count" attribute
     */
    public void xsetCount(org.apache.xmlbeans.XmlPositiveInteger count)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlPositiveInteger target = null;
            target = (org.apache.xmlbeans.XmlPositiveInteger)get_store().find_attribute_user(COUNT$8);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlPositiveInteger)get_store().add_attribute_user(COUNT$8);
            }
            target.set(count);
        }
    }

    /**
     * Unsets the "count" attribute
     */
    public void unsetCount()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(COUNT$8);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;
using NetHierarchy.Serialization;

namespace NetHierarchy
{
    /// <summary>
    /// Represents a point on a hierarchy and defines methods to manipulate hierarchies.
    /// </summary>
    /// <typeparam name="T">The type of data that will be stored in the <see cref="Node{T}"/> </typeparam>
    public class Node<T>
    {
        #region Public Properties

        /// <summary>
        /// Get or set that data that belongs to the node.
        /// </summary>
        public T Data { get; set; }

        /// <summary>
        /// Get or set an <see cref="ICollection{T}"/> of nodes that are a child to the node.
        /// </summary>
        public ICollection<Node<T>> Children { get; set; }

        /// <summary>
        /// Gets or sets the parent node of this node.
        /// </summary>
        public Node<T> Parent { get; set; }

        /// <summary>
        /// Gets a value indicating if the node is a leaf-node. A leaf-node has no children.
        /// </summary>
        public bool IsLeaf
        {
            get { return Children.Count == 0; }
        }

        /// <summary>
        /// Gets a value indicating if the node is a root-node. A root-node is at the top of hierarchy and has no parents.
        /// </summary>
        public bool IsRoot
        {
            get { return Parent == null; }
        }

        #endregion

        #region Constructors

        #region Without Children

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/>.
        /// </summary>
        public Node()
        {
            this.Children = new List<Node<T>>();
        }

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/>.
        /// </summary>
        /// <param name="Data">The data that the node will hold.</param>
        public Node(T Data) : this()
        {
            this.Data = Data;
        }

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/> and create and map a parent <see cref="Node{T}"/>.
        /// </summary>
        /// <param name="Data">The data that the node will hold.</param>
        /// <param name="Parent">The Parent <see cref="Node{T}"/> of this node.</param>
        public Node(T Data, Node<T> Parent) : this(Data)
        {
            this.Parent = Parent;

            if (!Parent.Children.Contains(this))
                Parent.AddChild(this);
        }

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/> and create and map a parent <see cref="Node{T}"/>.
        /// </summary>
        /// <param name="Data">The data that the node will hold.</param>
        /// <param name="ParentData">The data that the node's parent <see cref="Node{T}"/> will hold. A new <see cref="Node{T}"/> will be created with this value.</param>
        public Node(T Data, T ParentData) : this(Data)
        {
            var parentNode = new Node<T>(ParentData);
            parentNode.AddChild(this);
        }

        #endregion

        #region With Children
        /// <summary>
        /// Initialize a new <see cref="Node{T}"/> and add a collection of Children under the new <see cref="Node{T}"/> .
        /// </summary>
        /// <param name="Children">Collection of Child nodes that belong to this node.</param>
        public Node(ICollection<Node<T>> Children)
        {
            Children.ArgumentNullCheck(nameof(Children));
            this.Children = Children;
            foreach (var child in this.Children)
                if (child.Parent != this)
                    child.Parent = this;
        }

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/> and add a collection of Children under the new <see cref="Node{T}"/> .
        /// </summary>
        /// <param name="Data">The data that the node will hold.</param>
        /// <param name="Children">Collection of Child nodes that belong to this node.</param>
        public Node(T Data, ICollection<Node<T>> Children) : this(Children)
        {
            this.Data = Data;
        }

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/>. Adds a collection of Children under the new <see cref="Node{T}"/>.
        /// Adds the newly created node under an existing parent <see cref="Node{T}"/>.
        /// </summary>
        /// <param name="Data">The data that the node will hold.</param>
        /// <param name="Children">Collection of Child nodes that belong to this node.</param>
        /// <param name="Parent">The Parent <see cref="Node{T}"/> of this node.</param>
        public Node(T Data, ICollection<Node<T>> Children, Node<T> Parent) :this(Data, Children)
        {
            this.Parent = Parent;
            if (!Parent.Children.Contains(this))
                Parent.AddChild(this);
        }

        /// <summary>
        /// Initialize a new <see cref="Node{T}"/>. Adds a collection of Children under the new <see cref="Node{T}"/>.
        /// Adds the newly created node under an existing parent <see cref="Node{T}"/>.
        /// </summary>
        /// <param name="Data">The data that the node will hold.</param>
        /// <param name="Children">Collection of Child nodes that belong to this node.</param>
        /// <param name="Parent">The data that the node's parent <see cref="Node{T}"/> will hold. A new <see cref="Node{T}"/> will be created with this value.</param>
        public Node(T Data, ICollection<Node<T>> Children, T Parent) : this(Data, Children, new Node<T>(Parent))
        {

        }
        #endregion

        #endregion

        #region Hierarchy Methods
        /// <summary>
        /// Add a child to this node and creates the parent/child relationship between the nodes.
        /// </summary>
        /// <param name="ChildNode">The child item to add.</param>
        public void AddChild(Node<T> ChildNode)
        {
            ChildNode.ArgumentNullCheck(nameof(ChildNode));

            this.Children.Add(ChildNode);
            ChildNode.Parent = this;
        }

        /// <summary>
        /// Add a child with data to this node and create a parent/child relationship between the nodes.
        /// </summary>
        /// <param name="ChildData">The data that the child <see cref="Node{T}"/> will hold.</param>
        public void AddChild(T ChildData)
        {
            var childNode = new Node<T>(ChildData);

            this.Children.Add(childNode);
            childNode.Parent = this;
        }

        /// <summary>
        /// Add a collection of children to this node and create a parent/child relationship between the nodes.
        /// </summary>
        /// <param name="ChildNodes">A collection of <see cref="Node{T}"/> to add.</param>
        public void AddChild(params Node<T>[] ChildNodes)
        {
            ChildNodes.ArgumentNullCheck(nameof(ChildNodes));

            foreach(var node in ChildNodes)
            {
                this.Children.Add(node);
                node.Parent = this;
            }
        }

        /// <summary>
        /// Creates an <see cref="IEnumerable{T}"/> of all of the nodes underneath and including this node.
        /// </summary>
        public IEnumerable<Node<T>> GetDescendants()
        {
            yield return this;

            foreach(var node in Children)
            {
                foreach(var childAll in node.GetDescendants())
                {
                    yield return childAll;
                }
            }
        }

        /// <summary>
        /// Get all of the ancestors of the <see cref="Node{T}"/>.
        /// </summary>
        public IEnumerable<Node<T>> GetAncestors()
        {
            if(this.Parent != null)
            {
                yield return this.Parent;

                foreach (var ancestor in this.Parent.GetAncestors())
                    yield return ancestor;
            }
        }

        /// <summary>
        /// Checks to see if the <see cref="Node{T}"/> is a child of the given <see cref="Node{T}"/>.
        /// Checks are done with reference checks.
        /// </summary>
        /// <param name="Check">The <see cref="Node{T}"/> to check under.</param>
        public bool IsDescendantOf(Node<T> Check)
        {
            Check.ArgumentNullCheck(nameof(Check));

            //No parent then it is not a descendant of anything.
            if (this.Parent == null)
                return false;

            //If Check is immediate parent, then true.
            if(object.ReferenceEquals(this.Parent, Check))
            {
                return true;
            }
            //Else begin walking up the hierarchy.
            else
            {
                return this.Parent.IsDescendantOf(Check);
            }
        }
        #endregion

        #region SerializableNode Casts
        /// <summary>
        /// Convert the hierarchy, starting at this node, into an object that can be serialized without circular dependency errors.
        /// The hierarchy under this node will be copied into a new <see cref="SerializableNode{T}"/>.
        /// </summary>
        /// <returns>A <see cref="SerializableNode{T}"/> populated with children.</returns>
        public SerializableNode<T> AsSerializable()
        {
            var serNode = new SerializableNode<T>(this.Data);
            foreach (var child in this.Children)
                serNode.AddChild(child.AsSerializable());

            return serNode;
        }

        /// <summary>
        /// Convert the <see cref="Node{T}"/> into a <see cref="SerializableNode{T}"/>. The Parent field will be lost in this conversion.
        /// </summary>
        /// <param name="Node">The <see cref="Node{T}"/> to cast.</param>
        public static explicit operator SerializableNode<T>(Node<T> Node)
        {
            return Node.AsSerializable();
        }

        #endregion

        #region Object Overrides
        /// <summary>
        /// Returns a string that represents the object.
        /// </summary>
        public override string ToString()
        {
            return this.Data.ToString();
        }

        /// <summary>
        /// Determines if the supplied object is equal to the current object.
        /// </summary>
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;

            Node<T> n = obj as Node<T>;
            if ((object)n == null)
                return false;

            return this.Data.Equals(n.Data);
        }

        /// <summary>
        /// Returns the hash code of the Node's data.
        /// </summary>
        public override int GetHashCode()
        {
            return this.Data.GetHashCode();
        }
        #endregion
    }
}


text:
package org.knowm.xchange.examples.dsx.trade;

import java.io.IOException;
import java.util.Map;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.currency.CurrencyPair;
import org.knowm.xchange.dsx.DSXExchange;
import org.knowm.xchange.dsx.dto.trade.DSXTradeHistoryResult;
import org.knowm.xchange.dsx.service.DSXTradeService;
import org.knowm.xchange.dsx.service.trade.params.DSXTradeHistoryParams;
import org.knowm.xchange.dto.trade.UserTrades;
import org.knowm.xchange.examples.dsx.DSXExamplesUtils;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.service.trade.TradeService;

/** @author Mikhail Wall */
public class DSXUserTradeHistoryDemo {

  public static void main(String[] args) throws IOException {
    Exchange dsx = DSXExamplesUtils.createExchange(DSXExchange.class);
    generic(dsx);
    raw(dsx);
  }

  private static void generic(Exchange exchange) throws IOException {

    TradeService tradeService = exchange.getTradeService();
    try {
      DSXTradeHistoryParams params = new DSXTradeHistoryParams();
      params.setCurrencyPair(CurrencyPair.BTC_USD);
      UserTrades trades = tradeService.getTradeHistory(params);

      System.out.println(trades.toString());
    } catch (ExchangeException e) {
      System.out.println(e.getMessage());
    }
  }

  private static void raw(Exchange exchange) throws IOException {
    DSXTradeService tradeService = (DSXTradeService) exchange.getTradeService();
    Map<Long, DSXTradeHistoryResult> trades = null;
    try {
      trades = tradeService.getDSXTradeHistory(null, null, null, null, null, null, null);
      for (Map.Entry<Long, DSXTradeHistoryResult> entry : trades.entrySet()) {
        System.out.println("ID: " + entry.getKey() + ", Trade:" + entry.getValue());
      }
      System.out.println(trades.toString());
    } catch (ExchangeException e) {
      System.out.println(e.getMessage());
    }
  }
}


text:
package com.google.collide.client.plugin;

import com.google.collide.client.AppContext;
import com.google.collide.client.history.Place;
import com.google.collide.client.ui.panel.MultiPanel;
import com.google.collide.shared.plugin.PublicService;
import com.google.collide.shared.plugin.PublicServices;
import xapi.fu.Out1;
import xapi.inject.X_Inject;

public class ClientPluginService {

  protected ClientPluginService() {
  }

  private static final Out1<ClientPluginService> SINGLETON = X_Inject.singletonLazy(ClientPluginService.class);

  public static ClientPluginService initialize(AppContext appContext, MultiPanel<?,?> masterPanel
    , Place workspacePlace) {

    ClientPluginService plugins = SINGLETON.out1();
    plugins.init(appContext, masterPanel, workspacePlace);

    return plugins;
  }

  @SuppressWarnings({"unchecked","rawtypes"})
  protected void init(AppContext appContext, MultiPanel<?, ?> masterPanel, Place workspacePlace) {
    for (ClientPlugin<?> plugin : plugins()) {
      plugin.initializePlugin(appContext, masterPanel, workspacePlace);
      PublicService<?>[] services = plugin.getPublicServices();
      if (services != null)
      for (PublicService service : plugin.getPublicServices()) {
        PublicServices.registerService(service.classKey(), service);
      }
    }
  }

  public static ClientPlugin<?>[] getPlugins() {
    return SINGLETON.out1().plugins();
  }
  @SuppressWarnings("unchecked")
  public static <T extends ClientPlugin<?>> T getPlugin(Class<T> cls) {
    for (ClientPlugin<?> plugin : getPlugins()) {
      if (cls.isAssignableFrom(plugin.getClass())) {
        return (T)plugin;
      }
    }
    return null;
  }
  public ClientPlugin<?>[] plugins() {
    return new ClientPlugin[0];
  }

  public void cleanup() {
    //notify any of our plugins that require cleanup.
  }

}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.highj.data.transformer.stream_arrow;

import java.util.function.Function;

import org.derive4j.hkt.__;
import org.derive4j.hkt.__2;
import org.highj.data.Stream;
import org.highj.data.transformer.StreamArrow;
import org.highj.data.tuple.T2;
import org.highj.typeclass2.arrow.Arrow;

import static org.highj.Hkt.asStreamArrow;

/**
 *
 * @author clintonselke
 */
public interface StreamArrowArrow<A> extends StreamArrowCategory<A>, Arrow<__<StreamArrow.µ,A>> {

    @Override
    public Arrow<A> a();

    @Override
    public default <B, C> StreamArrow<A, B, C> arr(Function<B, C> fn) {
        return StreamArrow.streamArrow(
            a().arr((Stream<B> x) -> x.map(fn))
        );
    }

    @Override
    public default <B, C, D> StreamArrow<A, T2<B, D>, T2<C, D>> first(__2<__<StreamArrow.µ, A>, B, C> x) {
        return StreamArrow.streamArrow(
            a().dot(
                a().arr((T2<Stream<C>,Stream<D>> x2) -> Stream.zip(x2._1(), x2._2())),
                a().dot(
                    a().first(asStreamArrow(x).unstreamArrow()),
                    a().arr((Stream<T2<B,D>> x2) -> Stream.unzip(x2))
                )
            )
        );
    }
}


text:
<?php

/*
 * This file is part of JoliTypo - a project by JoliCode.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license.
 */

namespace JoliTypo;

use JoliTypo\Exception\BadRuleSetException;
use JoliTypo\Exception\InvalidMarkupException;

class Fixer
{
    /**
     * DOMDocument does not like all the HTML entities; sometimes they are double encoded.
     * So the entities here are plain utf8 and DOCDocument::saveHTML transform them to entity.
     */
    public const NO_BREAK_THIN_SPACE = "\xE2\x80\xAF"; //
    public const NO_BREAK_SPACE = "\xC2\xA0"; //
    public const ELLIPSIS = '…';
    public const LAQUO = '«'; // «
    public const RAQUO = '»'; // »
    public const RSQUO = '''; // ’
    public const TIMES = '×'; // ×
    public const NDASH = '–'; // – or –
    public const MDASH = '—'; // — or —
    public const LDQUO = '"'; // “ or “
    public const RDQUO = '"'; // ” or ”
    public const BDQUO = '"'; // „ or „
    public const SHY = "\xC2\xAD"; //
    public const TRADE = '™'; // ™
    public const REG = '®'; // ®
    public const COPY = '©'; // ©
    public const ALL_SPACES = "\xE2\x80\xAF|\xC2\xAD|\xC2\xA0|\\s"; // All supported spaces, used in regexps. Better than \s

    public const RECOMMENDED_RULES_BY_LOCALE = [
        'en_GB' => ['Ellipsis', 'Dimension', 'Unit', 'Dash', 'SmartQuotes', 'NoSpaceBeforeComma', 'CurlyQuote', 'Hyphen', 'Trademark'],
        'fr_FR' => ['Ellipsis', 'Dimension', 'Unit', 'Dash', 'SmartQuotes', 'FrenchNoBreakSpace', 'NoSpaceBeforeComma', 'CurlyQuote', 'Hyphen', 'Trademark'],
        'fr_CA' => ['Ellipsis', 'Dimension', 'Unit', 'Dash', 'SmartQuotes', 'NoSpaceBeforeComma', 'CurlyQuote', 'Hyphen', 'Trademark'],
        'de_DE' => ['Ellipsis', 'Dimension', 'Unit', 'Dash', 'SmartQuotes', 'NoSpaceBeforeComma', 'CurlyQuote', 'Hyphen', 'Trademark'],
    ];

    /**
     * @var array HTML Tags to bypass
     */
    protected $protectedTags = ['head', 'link', 'pre', 'code', 'script', 'style'];

    /**
     * @var string The default locale (used by some Fixer)
     */
    protected $locale = 'en_GB';

    /**
     * @var array<FixerInterface> The rules Fixer instances to apply on each DOMText
     */
    protected $_rules = [];

    /**
     * @var StateBag
     */
    protected $stateBag;

    /**
     * @param array $rules Array of Fixer
     */
    public function __construct($rules)
    {
        $this->compileRules($rules);
    }

    /**
     * @param string $content HTML content to fix
     *
     * @return string Fixed content
     *
     * @throws Exception\BadRuleSetException
     */
    public function fix($content)
    {
        $trimmed = trim($content);
        if (empty($trimmed)) {
            return $content;
        }

        // Get a clean new StateBag
        $this->stateBag = new StateBag();

        $dom = $this->loadDOMDocument($trimmed);

        $this->processDOM($dom, $dom);

        return $this->exportDOMDocument($dom);
    }

    /**
     * @param string $content Basic content to fix
     *
     * @return string
     */
    public function fixString($content)
    {
        foreach ($this->_rules as $fixer) {
            $content = $fixer->fix($content, $this->stateBag);
        }

        return $content;
    }

    /**
     * Change the list of rules for a given locale.
     *
     * @param array $rules Array of Fixer
     *
     * @throws Exception\BadRuleSetException
     */
    public function setRules($rules)
    {
        $this->compileRules($rules);
    }

    /**
     * Customize the list of protected tags.
     *
     * @param array $protectedTags
     *
     * @throws \InvalidArgumentException
     */
    public function setProtectedTags($protectedTags)
    {
        if (!\is_array($protectedTags)) {
            throw new \InvalidArgumentException('Protected tags must be an array (empty array for no protection).');
        }

        $this->protectedTags = $protectedTags;
    }

    /**
     * Get the current Locale tag.
     *
     * @return string
     */
    public function getLocale()
    {
        return $this->locale;
    }

    /**
     * Change the locale of the Fixer.
     *
     * @param string $locale An IETF language tag
     *
     * @throws \InvalidArgumentException
     */
    public function setLocale($locale)
    {
        if (!\is_string($locale) || empty($locale)) {
            throw new \InvalidArgumentException('Locale must be an IETF language tag.');
        }

        // Set the Locale on Fixer that needs it
        foreach ($this->_rules as $rule) {
            if ($rule instanceof LocaleAwareFixerInterface) {
                $rule->setLocale($locale);
            }
        }

        $this->locale = $locale;
    }

    /**
     * Get language part of a Locale string (fr_FR => fr).
     *
     * @return string
     */
    public static function getLanguageFromLocale($locale)
    {
        if (strpos($locale, '_')) {
            $parts = explode('_', $locale);

            return strtolower($parts[0]);
        }

        return $locale;
    }

    /**
     * Build the _rules array of Fixer.
     *
     * @throws Exception\BadRuleSetException
     */
    private function compileRules($rules)
    {
        if (!\is_array($rules) || empty($rules)) {
            throw new BadRuleSetException('Rules must be an array of Fixer');
        }

        $this->_rules = [];
        foreach ($rules as $rule) {
            if (\is_object($rule)) {
                $fixer = $rule;
                $className = \get_class($rule);
            } else {
                $className = class_exists($rule) ? $rule : (class_exists(
                    'JoliTypo\\Fixer\\' . $rule
                ) ? 'JoliTypo\\Fixer\\' . $rule : false);
                if (!$className) {
                    throw new BadRuleSetException(sprintf('Fixer %s not found', $rule));
                }

                $fixer = new $className($this->getLocale());
            }

            if (!$fixer instanceof FixerInterface) {
                throw new BadRuleSetException(sprintf('%s must implement FixerInterface', $className));
            }

            $this->_rules[$className] = $fixer;
        }

        if (empty($this->_rules)) {
            throw new BadRuleSetException("No rules configured, can't fix the content!");
        }
    }

    /**
     * Loop over all the DOMNode recursively.
     */
    private function processDOM(\DOMNode $node, \DOMDocument $dom)
    {
        if ($node->hasChildNodes()) {
            $nodes = [];
            foreach ($node->childNodes as $childNode) {
                if ($childNode instanceof \DOMElement && $childNode->tagName) {
                    if (\in_array($childNode->tagName, $this->protectedTags)) {
                        continue;
                    }
                }

                $nodes[] = $childNode;
            }

            $depth = $this->stateBag->getCurrentDepth();

            foreach ($nodes as $childNode) {
                if ($childNode instanceof \DOMText && !$childNode->isWhitespaceInElementContent()) {
                    $this->stateBag->setCurrentDepth($depth);
                    $this->doFix($childNode, $node, $dom);
                } else {
                    $this->stateBag->setCurrentDepth($this->stateBag->getCurrentDepth() + 1);
                    $this->processDOM($childNode, $dom);
                }
            }
        }
    }

    /**
     * Run the Fixers on a DOMText content.
     *
     * @param \DOMText     $childNode The node to fix
     * @param \DOMNode     $node      The parent node where to replace the current one
     * @param \DOMDocument $dom       The Document
     */
    private function doFix(\DOMText $childNode, \DOMNode $node, \DOMDocument $dom)
    {
        $content = $childNode->wholeText;
        $current_node = new StateNode($childNode, $node, $dom);

        $this->stateBag->setCurrentNode($current_node);

        // run the string on all the fixers
        foreach ($this->_rules as $fixer) {
            $content = $fixer->fix($content, $this->stateBag);
        }

        // update the DOM only if the node has changed
        if ($childNode->wholeText !== $content) {
            $new_node = $dom->createTextNode($content);
            $node->replaceChild($new_node, $childNode);

            // As the node is replaced, we also update it in the StateNode
            $current_node->replaceNode($new_node);
        }
    }

    /**
     * @return \DOMDocument
     *
     * @throws Exception\InvalidMarkupException
     */
    private function loadDOMDocument($content)
    {
        $dom = new \DOMDocument('1.0', 'UTF-8');
        $dom->encoding = 'UTF-8';

        $dom->strictErrorChecking = false;
        $dom->substituteEntities = false;
        $dom->formatOutput = false;

        // Change libxml config
        $libxmlCurrent = libxml_use_internal_errors(true);

        $loaded = $dom->loadHTML($this->fixContentEncoding($content));

        // Restore libxml config
        libxml_use_internal_errors($libxmlCurrent);

        if (!$loaded) {
            throw new InvalidMarkupException("Can't load the given HTML via DomDocument");
        }

        return $dom;
    }

    /**
     * Convert the content encoding properly and add Content-Type meta if HTML document.
     *
     * @see http://php.net/manual/en/domdocument.loadhtml.php#91513
     * @see https://github.com/jolicode/JoliTypo/issues/7
     *
     * @return string
     */
    private function fixContentEncoding($content)
    {
        if (!empty($content)) {
            // Little hack to force UTF-8
            if (false === strpos($content, '<?xml encoding')) {
                $hack = false === strpos(
                    $content,
                    '<body'
                ) ? '<?xml encoding="UTF-8">' : '<?xml encoding="UTF-8">';
                $content = $hack . $content;
            }

            $encoding = null;
            foreach (['UTF-8', 'ASCII', 'ISO-8859-1', 'windows-1252', 'iso-8859-15'] as $testedEncoding) {
                if (mb_detect_encoding($content, $testedEncoding, true)) {
                    $encoding = $testedEncoding;

                    break;
                }
            }

            $headPos = mb_strpos($content, '');

            // Add a meta to the  section
            if (false !== $headPos) {
                $headPos += 6;
                $content = mb_substr($content, 0, $headPos) .
                    '<meta http-equiv="Content-Type" content="text/html; charset=' . $encoding . '">' .
                    mb_substr($content, $headPos);
            }

            if ('UTF-8' !== $encoding) {
                $content = mb_convert_encoding($content, 'UTF-8', $encoding);
            }
        }

        return $content;
    }

    /**
     * @return string
     */
    private function exportDOMDocument(\DOMDocument $dom)
    {
        // Remove added body & doctype
        $content = preg_replace(
            [
                '/^\\<\\!DOCTYPE.*?.*?/si',
                '!\n?$!si',
            ],
            '',
            $dom->saveHTML()
        );

        return trim($content);
    }
}


text:
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ("lastfm", "0001_initial"),
    ]

    operations = [
        migrations.AlterField(
            model_name="scrobble",
            name="account",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="scrobbles",
                to="lastfm.Account",
            ),
        ),
    ]


text:
swapsize="<%SWAP_FILE_SIZE%>"

fallocate -l $swapsize /swapfile;
chmod 600 /swapfile;
mkswap /swapfile;
swapon /swapfile;
 echo "/swapfile   none    swap    sw    0   0" >> /etc/fstab;


text:
package com.qulice.checkstyle;

import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import java.util.Arrays;

/**
 * Checks method bodies for comments. All comments in method bodies are
 * prohibited.
 *
 * <p>We believe that in-code comments and empty lines are evil. If you
 * need to use
 * a comment inside a method - your code needs refactoring. Either move that
 * comment to a method javadoc block or add a logging mechanism with the same
 * text.
 *
 * @author Dmitry Bashkin (dmitry.bashkin@qulice.com)
 * @author Yegor Bugayenko (yegor@tpc2.com)
 * @version $Id$
 * @todo #260 Add handling of multiple anonymous classes inside methods by
 *  looking at the recursive tree.
 */
public final class MethodBodyCommentsCheck extends Check {

    @Override
    public int[] getDefaultTokens() {
        return new int[] {
            TokenTypes.CTOR_DEF,
            TokenTypes.METHOD_DEF,
        };
    }

    @Override
    public void visitToken(final DetailAST ast) {
        final DetailAST start = ast.findFirstToken(TokenTypes.SLIST);
        final String[] lines = Arrays.copyOf(
            this.getLines(), this.getLines().length
        );
        if (start != null) {
            DetailAST ostart = start.findFirstToken(TokenTypes.VARIABLE_DEF);
            final int[] tokens = {
                TokenTypes.ASSIGN, TokenTypes.EXPR,
                TokenTypes.LITERAL_NEW, TokenTypes.OBJBLOCK,
            };
            for (final int token : tokens) {
                if (ostart != null) {
                    ostart = ostart.findFirstToken(token);
                }
            }
            if ((ostart != null)
                && (ostart.getType() == tokens[tokens.length - 1])) {
                Arrays.fill(
                    lines, ostart.getLineNo(),
                    ostart.findFirstToken(TokenTypes.RCURLY).getLineNo(), ""
                );
            }
            this.checkMethod(
                lines,
                start.getLineNo(),
                start.findFirstToken(TokenTypes.RCURLY).getLineNo() - 1
            );
        }
    }

    /**
     * Checks method body for comments.
     * @param lines Array of lines, containing code to check.
     * @param start Start line of the method body.
     * @param end End line of the method body.
     */
    private void checkMethod(final String[] lines, final int start,
        final int end) {
        final boolean oneliner = start == end - 1;
        for (int pos = start; pos < end; ++pos) {
            final String line = lines[pos].trim();
            if (line.startsWith("//")) {
                final String comment = line.substring(2).trim();
                if (!comment.startsWith("@checkstyle") && !oneliner) {
                    this.log(pos + 1, "Comments in method body are prohibited");
                }
            }
        }
    }
}


text:
@interface ALImageSourceCamera () <UIImagePickerControllerDelegate, UINavigationControllerDelegate>

@end

@implementation ALImageSourceCamera

#pragma mark - Appearance -

@synthesize localizedTitle = _localizedTitle;
@synthesize icon = _icon;

- (NSString*)localizedTitle
{
	if (!_localizedTitle) {
		_localizedTitle = NSLocalizedString(@"CAMERA", @"ImageSource");
	}
	return _localizedTitle;
}

- (UIImage*)icon
{
	if (!_icon) {
		_icon = [UIImage imageNamed:@"icon_take_a_picture_normal"];
	}
	return _icon;
}

#pragma mark - Main -

- (BOOL)available
{
	return [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
}

- (void)presentUsingViewController:(UIViewController *)viewController
{
	UIImagePickerController *picker = [[UIImagePickerController alloc] init];
	picker.delegate = self;
	picker.sourceType = UIImagePickerControllerSourceTypeCamera;

	[viewController presentViewController:picker
								 animated:YES
							   completion:NULL];
}

#pragma mark - Image Picker Delegate -

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
	UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
	NSString *unique = nil;
	NSDictionary *d = [info valueForKey:UIImagePickerControllerMediaMetadata];
	unique = [d valueForKeyPath:@"{Exif}.DateTimeDigitized"];

	self.completionBlock(image, unique, nil);
}

@end


text:
<?php
/**
 * This interface is used by actions that want a model auto-instantiated and populated with
 * values from request parameters (or after a redirect from failed validation, the session).
 * The action must expose a public $model property which will hold the populated
 * model.
 *
 * For a model to be instantiated and populated, the ModelInterceptor must be
 * configured for the action, and the action must provide the name (or object) of the model
 * to use. This can be done either by setting a default value on the $model property like so:
 *
 *     public $model = 'ModelName';
 *
 * Or, if a model with inner models should be created:
 *
 *     public $model = array('MainModelName', 'propertyInModel' => array('AnotherModelName'));
 *
 * Alternatively, you can return an already instantiated model by implementing a
 * getModel() method. If present, this takes precedence over names specified in
 * $model.
 */
interface ModelAware {}
?>


text:
package org.codehaus.groovy.groovydoc;

public interface GroovyMemberDoc extends GroovyProgramElementDoc {
    boolean isSynthetic();
}


text:
package org.apache.flink.connector.hbase2;

import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.configuration.ReadableConfig;
import org.apache.flink.connector.hbase.options.HBaseLookupOptions;
import org.apache.flink.connector.hbase.options.HBaseWriteOptions;
import org.apache.flink.connector.hbase.util.HBaseTableSchema;
import org.apache.flink.connector.hbase2.sink.HBaseDynamicTableSink;
import org.apache.flink.connector.hbase2.source.HBaseDynamicTableSource;
import org.apache.flink.table.api.TableSchema;
import org.apache.flink.table.connector.sink.DynamicTableSink;
import org.apache.flink.table.connector.source.DynamicTableSource;
import org.apache.flink.table.factories.DynamicTableSinkFactory;
import org.apache.flink.table.factories.DynamicTableSourceFactory;
import org.apache.flink.table.factories.FactoryUtil.TableFactoryHelper;

import org.apache.hadoop.conf.Configuration;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static org.apache.flink.connector.hbase.options.HBaseOptions.LOOKUP_ASYNC;
import static org.apache.flink.connector.hbase.options.HBaseOptions.LOOKUP_CACHE_MAX_ROWS;
import static org.apache.flink.connector.hbase.options.HBaseOptions.LOOKUP_CACHE_TTL;
import static org.apache.flink.connector.hbase.options.HBaseOptions.LOOKUP_MAX_RETRIES;
import static org.apache.flink.connector.hbase.options.HBaseOptions.NULL_STRING_LITERAL;
import static org.apache.flink.connector.hbase.options.HBaseOptions.PROPERTIES_PREFIX;
import static org.apache.flink.connector.hbase.options.HBaseOptions.SINK_BUFFER_FLUSH_INTERVAL;
import static org.apache.flink.connector.hbase.options.HBaseOptions.SINK_BUFFER_FLUSH_MAX_ROWS;
import static org.apache.flink.connector.hbase.options.HBaseOptions.SINK_BUFFER_FLUSH_MAX_SIZE;
import static org.apache.flink.connector.hbase.options.HBaseOptions.TABLE_NAME;
import static org.apache.flink.connector.hbase.options.HBaseOptions.ZOOKEEPER_QUORUM;
import static org.apache.flink.connector.hbase.options.HBaseOptions.ZOOKEEPER_ZNODE_PARENT;
import static org.apache.flink.connector.hbase.options.HBaseOptions.getHBaseConfiguration;
import static org.apache.flink.connector.hbase.options.HBaseOptions.getHBaseLookupOptions;
import static org.apache.flink.connector.hbase.options.HBaseOptions.getHBaseWriteOptions;
import static org.apache.flink.connector.hbase.options.HBaseOptions.validatePrimaryKey;
import static org.apache.flink.table.factories.FactoryUtil.SINK_PARALLELISM;
import static org.apache.flink.table.factories.FactoryUtil.createTableFactoryHelper;

/** HBase connector factory. */
public class HBase2DynamicTableFactory
        implements DynamicTableSourceFactory, DynamicTableSinkFactory {

    private static final String IDENTIFIER = "hbase-2.2";

    @Override
    public DynamicTableSource createDynamicTableSource(Context context) {
        TableFactoryHelper helper = createTableFactoryHelper(this, context);
        helper.validateExcept(PROPERTIES_PREFIX);

        final ReadableConfig tableOptions = helper.getOptions();

        TableSchema tableSchema = context.getCatalogTable().getSchema();
        Map<String, String> options = context.getCatalogTable().getOptions();

        validatePrimaryKey(tableSchema);

        String tableName = tableOptions.get(TABLE_NAME);
        Configuration hbaseConf = getHBaseConfiguration(options);
        HBaseLookupOptions lookupOptions = getHBaseLookupOptions(tableOptions);
        String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
        HBaseTableSchema hbaseSchema = HBaseTableSchema.fromTableSchema(tableSchema);

        return new HBaseDynamicTableSource(
                hbaseConf, tableName, hbaseSchema, nullStringLiteral, lookupOptions);
    }

    @Override
    public DynamicTableSink createDynamicTableSink(Context context) {
        TableFactoryHelper helper = createTableFactoryHelper(this, context);
        helper.validateExcept(PROPERTIES_PREFIX);

        final ReadableConfig tableOptions = helper.getOptions();

        TableSchema tableSchema = context.getCatalogTable().getSchema();
        Map<String, String> options = context.getCatalogTable().getOptions();

        validatePrimaryKey(tableSchema);

        String tableName = tableOptions.get(TABLE_NAME);
        Configuration hbaseConf = getHBaseConfiguration(options);
        HBaseWriteOptions hBaseWriteOptions = getHBaseWriteOptions(tableOptions);
        String nullStringLiteral = tableOptions.get(NULL_STRING_LITERAL);
        HBaseTableSchema hbaseSchema = HBaseTableSchema.fromTableSchema(tableSchema);

        return new HBaseDynamicTableSink(
                tableName, hbaseSchema, hbaseConf, hBaseWriteOptions, nullStringLiteral);
    }

    @Override
    public String factoryIdentifier() {
        return IDENTIFIER;
    }

    @Override
    public Set<ConfigOption<?>> requiredOptions() {
        Set<ConfigOption<?>> set = new HashSet<>();
        set.add(TABLE_NAME);
        return set;
    }

    @Override
    public Set<ConfigOption<?>> optionalOptions() {
        Set<ConfigOption<?>> set = new HashSet<>();
        set.add(ZOOKEEPER_ZNODE_PARENT);
        set.add(ZOOKEEPER_QUORUM);
        set.add(NULL_STRING_LITERAL);
        set.add(SINK_BUFFER_FLUSH_MAX_SIZE);
        set.add(SINK_BUFFER_FLUSH_MAX_ROWS);
        set.add(SINK_BUFFER_FLUSH_INTERVAL);
        set.add(SINK_PARALLELISM);
        set.add(LOOKUP_ASYNC);
        set.add(LOOKUP_CACHE_MAX_ROWS);
        set.add(LOOKUP_CACHE_TTL);
        set.add(LOOKUP_MAX_RETRIES);
        return set;
    }
}


text:
<?php
namespace Payum\Request;

use Payum\Security\TokenInterface;

class SecuredCaptureRequest extends CaptureRequest implements SecuredRequestInterface
{
    /**
     * @var TokenInterface
     */
    protected $token;

    /**
     * @param TokenInterface $token
     */
    public function __construct(TokenInterface $token)
    {
        $this->token = $token;

        $this->setModel($token);
    }

    /**
     * {@inheritDoc}
     */
    public function getToken()
    {
        return $this->token;
    }
}


text:
module Bosh::Director
  module CloudcheckHelper
    # Helper functions that come in handy for
    # cloudcheck:
    # 1. VM/agent interactions
    # 2. VM lifecycle operations (from cloudcheck POV)
    # 3. Error handling

    # This timeout has been made pretty short mainly
    # to avoid long cloudchecks, however 10 seconds should
    # still be pretty generous interval for agent to respond.
    DEFAULT_AGENT_TIMEOUT = 10

    def reboot_vm(instance)
      vm = instance.active_vm

      cloud = CloudFactory.create.get(vm.cpi)
      cloud.reboot_vm(vm.cid)

      begin
        agent_client(instance.agent_id).wait_until_ready
      rescue Bosh::Director::RpcTimeout
        handler_error('Agent still unresponsive after reboot')
      rescue Bosh::Director::TaskCancelled
        handler_error('Task was cancelled')
      end
    end

    def delete_vm(instance)
      # Paranoia: don't blindly delete VMs with persistent disk
      disk_list = agent_timeout_guard(instance.vm_cid, instance.agent_id, &:list_disk)

      handler_error('VM has persistent disk attached') unless disk_list.empty?

      vm_deleter.delete_for_instance(instance)
    end

    def delete_vm_reference(instance)
      vm_model = instance.active_vm
      instance.active_vm = nil
      vm_model&.destroy
    end

    def delete_vm_from_cloud(instance_model)
      @logger.debug("Deleting Vm: #{instance_model})")

      validate_spec(instance_model.spec)
      validate_env(instance_model.vm_env)

      vm_deleter.delete_for_instance(instance_model)
    end

    def recreate_vm_skip_post_start(instance_model)
      recreate_vm(instance_model, false)
    end

    def recreate_vm(instance_model, run_post_start = true)
      @logger.debug("Recreating Vm: #{instance_model})")
      delete_vm_from_cloud(instance_model)

      deployment_model = instance_model.deployment
      factory = Bosh::Director::DeploymentPlan::PlannerFactory.create(@logger)
      planner = factory.create_from_model(deployment_model)
      dns_encoder = LocalDnsEncoderManager.create_dns_encoder(planner.use_short_dns_addresses?)

      instance_plan_to_create = create_instance_plan(instance_model)

      Bosh::Director::Core::Templates::TemplateBlobCache.with_fresh_cache do |template_cache|
        vm_creator(template_cache, dns_encoder).create_for_instance_plan(
          instance_plan_to_create,
          planner.ip_provider,
          Array(instance_model.managed_persistent_disk_cid),
          instance_plan_to_create.tags,
          true,
        )

        powerdns_manager = PowerDnsManagerProvider.create
        local_dns_manager = LocalDnsManager.create(Config.root_domain, @logger)
        dns_names_to_ip = {}

        root_domain = Config.root_domain

        apply_spec = instance_plan_to_create.existing_instance.spec
        apply_spec['networks'].each do |network_name, network|
          index_dns_name = Bosh::Director::DnsNameGenerator.dns_record_name(
            instance_model.index,
            instance_model.job,
            network_name,
            instance_model.deployment.name,
            root_domain,
          )
          dns_names_to_ip[index_dns_name] = network['ip']

          id_dns_name = Bosh::Director::DnsNameGenerator.dns_record_name(
            instance_model.uuid,
            instance_model.job,
            network_name,
            instance_model.deployment.name,
            root_domain,
          )
          dns_names_to_ip[id_dns_name] = network['ip']
        end

        @logger.debug("Updating DNS record for instance: #{instance_model.inspect}; to: #{dns_names_to_ip.inspect}")
        powerdns_manager.update_dns_record_for_instance(instance_model, dns_names_to_ip)
        local_dns_manager.update_dns_record_for_instance(instance_model)

        powerdns_manager.flush_dns_cache

        cloud_check_procedure = lambda do
          blobstore_client = App.instance.blobstores.blobstore

          cleaner = RenderedJobTemplatesCleaner.new(instance_model, blobstore_client, @logger)
          templates_persister = RenderedTemplatesPersister.new(blobstore_client, @logger)

          templates_persister.persist(instance_plan_to_create)

          # for backwards compatibility with instances that don't have update config
          update_config = apply_spec['update'].nil? ? nil : DeploymentPlan::UpdateConfig.new(apply_spec['update'])

          InstanceUpdater::StateApplier.new(
            instance_plan_to_create,
            agent_client(instance_model.agent_id),
            cleaner,
            @logger,
            {}
          ).apply(update_config, run_post_start)
        end

        InstanceUpdater::InstanceState.with_instance_update(instance_model, &cloud_check_procedure)
      end
    end

    private

    def create_instance_plan(instance_model)
      stemcell = DeploymentPlan::Stemcell.parse(instance_model.spec['stemcell'])
      stemcell.add_stemcell_models
      stemcell.deployment_model = instance_model.deployment
      # FIXME: cpi is not passed here (otherwise, we would need to parse the
      # CPI using the cloud config & cloud manifest parser) it is not a
      # problem, since all interactions with cpi go over cloud factory (which
      # uses only az name) but still, it is ugly and dangerous...
      availability_zone = DeploymentPlan::AvailabilityZone.new(
        instance_model.availability_zone,
        instance_model.cloud_properties_hash,
        nil,
      )

      instance_from_model = DeploymentPlan::Instance.new(
        instance_model.job,
        instance_model.index,
        instance_model.state,
        instance_model.cloud_properties_hash,
        stemcell,
        DeploymentPlan::Env.new(instance_model.vm_env),
        false,
        instance_model.deployment,
        instance_model.spec,
        availability_zone,
        @logger,
      )
      instance_from_model.bind_existing_instance_model(instance_model)

      DeploymentPlan::ResurrectionInstancePlan.new(
        existing_instance: instance_model,
        instance: instance_from_model,
        desired_instance: DeploymentPlan::DesiredInstance.new,
        recreate_deployment: true,
        tags: instance_from_model.deployment_model.tags,
      )
    end

    def handler_error(message)
      raise Bosh::Director::ProblemHandlerError, message
    end

    def agent_client(agent_id, timeout = DEFAULT_AGENT_TIMEOUT, retries = 0)
      options = {
        timeout: timeout,
        retry_methods: { get_state: retries },
      }
      @clients ||= {}
      @clients[agent_id] ||= AgentClient.with_agent_id(agent_id, options)
    end

    def agent_timeout_guard(vm_cid, agent_id)
      yield agent_client(agent_id)
    rescue Bosh::Director::RpcTimeout
      handler_error("VM '#{vm_cid}' is not responding")
    end

    def vm_deleter
      @vm_deleter ||= VmDeleter.new(@logger, false, Config.enable_virtual_delete_vms)
    end

    def vm_creator(template_cache, dns_encoder)
      agent_broadcaster = AgentBroadcaster.new
      @vm_creator ||= VmCreator.new(@logger, template_cache, dns_encoder, agent_broadcaster)
    end

    def validate_spec(spec)
      handler_error('Unable to look up VM apply spec') unless spec

      handler_error('Invalid apply spec format') unless spec.is_a?(Hash)
    end

    def validate_env(env)
      handler_error('Invalid VM environment format') unless env.is_a?(Hash)
    end

    def generate_agent_id
      SecureRandom.uuid
    end
  end
end


text:
The MarkupConverter has been build from this repository:
https://github.com/mmanela/MarkupConverter


text:
package com.example.idea.retrofitdemo.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.idea.retrofitdemo.R;
import com.example.idea.retrofitdemo.base.BaseFragment;

/**
 * Created by IDEA on 2016/5/29.
 */

public class GankFragment extends BaseFragment {
    @Override
    public View inflaterRootView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return View.inflate(getActivity(),R.layout.fra_girl, null);
    }

    @Override
    public void initView(View rootView) {

    }

    @Override
    public void initData() {

    }
}


text:
namespace TheXDS.MCART.Component;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using TheXDS.MCART.Resources;

/// <summary>
/// Expone la información de ensamblado de una aplicación de WPF.
/// </summary>
public class ApplicationInfo : IExposeExtendedGuiInfo<UIElement?>
{
    private readonly AssemblyInfo _infoExposer;

    private static UIElement InferIcon(Assembly asm)
    {
        UriBuilder? uri = new(asm.Location ?? string.Empty);
        string? path = Uri.UnescapeDataString(uri.Path);
        using System.Drawing.Icon? sysicon = System.Drawing.Icon.ExtractAssociatedIcon(path) ?? throw new Exception();
        return new Image
        {
            Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon(
                sysicon.Handle,
                Int32Rect.Empty,
                BitmapSizeOptions.FromEmptyOptions())
        };
    }

    /// <summary>
    /// Inicializa una nueva instancia de la clase
    /// <see cref="ApplicationInfo" />.
    /// </summary>
    /// <param name="application">
    /// Aplicación de la cual se mostrará la información.
    /// </param>
    public ApplicationInfo(Application application) : this(application, null) { }

    /// <summary>
    /// Inicializa una nueva instancia de la clase
    /// <see cref="ApplicationInfo" />.
    /// </summary>
    /// <param name="application">
    /// Aplicación de la cual se mostrará la información.
    /// </param>
    /// <param name="inferIcon">
    /// <see langword="true"/> para intentar determinar el ícono de la
    /// aplicación, <see langword="false"/> para no mostrar un ícono.
    /// </param>
    public ApplicationInfo(Application application, bool inferIcon) : this(application, inferIcon ? InferIcon(application.GetType().Assembly) : null) { }

    /// <summary>
    /// Inicializa una nueva instancia de la clase
    /// <see cref="ApplicationInfo"/>.
    /// </summary>
    /// <param name="application">
    /// Aplicación de la cual se mostrará la información.
    /// </param>
    /// <param name="icon">Ícono a mostrar de la aplicación.</param>
    public ApplicationInfo(Application application, UIElement? icon)
        : this(application.GetType().Assembly, icon) { }

    /// <summary>
    /// Inicializa una nueva instancia de la clase
    /// <see cref="ApplicationInfo"/>
    /// </summary>
    /// <param name="assembly">
    /// Ensamblado del cual se mostrará la información.
    /// </param>
    /// <param name="icon">Ícono a mostrar del ensamblado.</param>
    public ApplicationInfo(Assembly assembly, UIElement? icon)
    {
        _infoExposer = new AssemblyInfo(assembly);
        Icon = icon;
    }

    /// <summary>
    /// Inicializa una nueva instancia de la clase
    /// <see cref="ApplicationInfo" />.
    /// </summary>
    /// <param name="assembly">
    /// Ensamblado del cual se mostrará la información.
    /// </param>
    /// <param name="inferIcon">
    /// <see langword="true"/> para intentar determinar el ícono del
    /// ensamblado, <see langword="false"/> para no mostrar un ícono.
    /// </param>
    public ApplicationInfo(Assembly assembly, bool inferIcon) : this(assembly, inferIcon ? InferIcon(assembly) : null) { }

    /// <summary>
    /// Obtiene el nombre del elemento.
    /// </summary>
    public string Name => _infoExposer.Name;

    /// <summary>
    /// Obtiene la descripción del elemento.
    /// </summary>
    public string Description => _infoExposer.Description ?? string.Empty;

    /// <summary>
    /// Obtiene un ícono opcional a mostrar que describe al elemento.
    /// </summary>
    public virtual UIElement? Icon { get; }

    /// <summary>
    /// Devuelve el autor del <see cref="IExposeInfo" />
    /// </summary>
    public IEnumerable<string>? Authors => _infoExposer.Authors;

    /// <summary>
    /// Devuelve el Copyright del <see cref="IExposeInfo" />
    /// </summary>
    public string? Copyright => _infoExposer.Copyright;

    /// <summary>
    /// Devuelve la licencia del <see cref="IExposeInfo" />
    /// </summary>
    public License? License => _infoExposer.License;

    /// <summary>
    /// Devuelve la versión del <see cref="IExposeInfo" />
    /// </summary>
    public Version? Version => _infoExposer.Version;

    /// <summary>
    /// Obtiene un valor que determina si este <see cref="IExposeInfo" />
    /// contiene información de licencia.
    /// </summary>
    public bool HasLicense => _infoExposer.HasLicense;

    /// <summary>
    /// Obtiene un valor que indica si este <see cref="IExposeInfo" />
    /// cumple con el Common Language Standard (CLS)
    /// </summary>
    public bool ClsCompliant => _infoExposer.ClsCompliant;

    /// <summary>
    /// Referencia al ensamblado del cual se expone la información.
    /// </summary>
    public Assembly Assembly => _infoExposer.Assembly;

    /// <summary>
    /// Obtiene la versión informacional de este
    /// <see cref="IExposeInfo"/>.
    /// </summary>
    public string? InformationalVersion => _infoExposer.InformationalVersion ?? Version?.ToString();

    /// <summary>
    /// Obtiene un valor que indica si este
    /// <see cref="IExposeExtendedInfo"/> es considerado una versión
    /// beta.
    /// </summary>
    public bool Beta => _infoExposer.Beta;

    /// <summary>
    /// Obtiene un valor que indica si este
    /// <see cref="IExposeExtendedInfo"/> podría contener código
    /// utilizado en contexto inseguro.
    /// </summary>
    public bool Unmanaged => _infoExposer.Unmanaged;

    /// <summary>
    /// Obtiene una colección con el contenido de licencias de terceros
    /// para el objeto.
    /// </summary>
    public IEnumerable<License>? ThirdPartyLicenses => _infoExposer.ThirdPartyLicenses;

    /// <summary>
    /// Obtiene un valor que indica si este <see cref="IExposeInfo"/>
    /// contiene información de licencias de terceros.
    /// </summary>
    public bool Has3rdPartyLicense => _infoExposer.Has3rdPartyLicense;
}


text:
<!DOCTYPE html>

	<meta charset="utf-8" />
	<title>atomantic/jquery.codeassist @ GitHub</title>

	<link rel="stylesheet" type="text/css" media="all" href="jquery.codeassist.css"/>

This is a demo of the jquery.codeassist plugin, written by Adam Eivy and hosted on GitHub

Basic (Defaults)

Enter some text and type a % character to bring up the menu.

	<textarea id="default"></textarea>

Dollar Sign

Enter some text and type a $ character to bring up the menu.

	<textarea id="dollar"></textarea>

Square Brackets

Enter some text and type a [ character to bring up the menu.

	<textarea id="brackets"></textarea>

HTML Brackets

Enter some text and type a < character to bring up the menu.

	<textarea id="htmlbrackets"></textarea>

HTML Open/Close

This is NOT meant to be an HTML helper (there are other libraries for that)--but by a sort of request:

Enter some text and type a < character to bring up the menu.

Next enter the html value and type </.

	<textarea id="html"></textarea>


text:
require 'locus/resources/component'
require 'locus/resources/site'

module Locus
  class Resources
    def self.classes
      [
        Locus::Component,
        Locus::Site
      ]
    end

    def self.find_class(name)
      self.classes.find(Proc.new { Locus::Resource }) { |c| c.resource_name == name }
    end
  end
end