text:
package org.hisp.dhis.cache;

import java.util.concurrent.TimeUnit;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.external.conf.ConfigurationKey;
import org.hisp.dhis.external.conf.DhisConfigurationProvider;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * A Builder class that helps in building Cache instances. Sensible defaults are
 * in place which can be modified with a fluent builder api.
 *
 * @author Ameen Mohamed
 *
 * @param <V> The Value type to be stored in cache
 */
public class CacheBuilder<V>
{
    private static final Log log = LogFactory.getLog( CacheBuilder.class );

    private DhisConfigurationProvider configurationProvider;

    private RedisTemplate<String, ?> redisTemplate;

    private long maximumSize;

    private String region;

    private boolean refreshExpiryOnAccess;

    private long expiryInSeconds;

    private V defaultValue;

    private boolean expiryEnabled;

    public CacheBuilder( RedisTemplate<String, ?> redisTemplate, DhisConfigurationProvider configurationProvider )
    {
        this.configurationProvider = configurationProvider;
        this.redisTemplate = redisTemplate;
        //Applying sensible defaults
        this.maximumSize = -1;
        this.region = "default";
        this.refreshExpiryOnAccess = false;
        this.expiryInSeconds = 0;
        this.defaultValue = null;
        this.expiryEnabled = false;
    }

    /**
     * Set the maximum size for the cache instance to be built. If set to 0, no
     * caching will take place. Cannot be a negative value.
     *
     * @param maximumSize The maximum size
     * @return The builder instance
     * @throws IllegalArgumentException if specified maximumSize is a negative
     *         value.
     */
    public CacheBuilder<V> withMaximumSize( long maximumSize )
    {
        if ( maximumSize < 0 )
        {
            throw new IllegalArgumentException( "MaximumSize cannot be negative" );
        }
        this.maximumSize = maximumSize;
        return this;
    }

    /**
     * Set the cacheRegion for the cache instance to be built. If not specified
     * default is "default" region.
     *
     * @param region The cache region name to be used.
     * @return The builder instance.
     * @throws IllegalArgumentException if specified region is null.
     */
    public CacheBuilder<V> forRegion( String region )
    {
        if ( region == null )
        {
            throw new IllegalArgumentException( "Region cannot be null" );
        }
        this.region = region;
        return this;
    }

    /**
     * Configure the cache instance to expire the keys, if the expiry duration
     * elapses after last access.
     *
     * @param duration The duration
     * @param timeUnit The time unit of the duration
     * @return The builder instance.
     * @throws IllegalArgumentException if specified timeUnit is null.
     */
    public CacheBuilder<V> expireAfterAccess( long duration, TimeUnit timeUnit )
    {
        if ( timeUnit == null )
        {
            throw new IllegalArgumentException( "TimeUnit cannot be null" );
        }
        this.expiryInSeconds = timeUnit.toSeconds( duration );
        this.refreshExpiryOnAccess = true;
        this.expiryEnabled = true;
        return this;
    }

    /**
     * Configure the cache instance to expire the keys, if the expiry duration
     * elapses after writing. The key expires irrespective of the last access.
     *
     * @param duration The duration
     * @param timeUnit The time unit of the duration
     * @return The builder instance.
     * @throws IllegalArgumentException if specified timeUnit is null.
     */
    public CacheBuilder<V> expireAfterWrite( long duration, TimeUnit timeUnit )
    {
        if ( timeUnit == null )
        {
            throw new IllegalArgumentException( "TimeUnit cannot be null" );
        }
        this.expiryInSeconds = timeUnit.toSeconds( duration );
        this.refreshExpiryOnAccess = false;
        this.expiryEnabled = true;
        return this;
    }

    /**
     * Configure the cache instance to have a default value if the key does not have an associated value in cache. The default value will not be stored in the cache.
     *
     * @param defaultValue The default value
     * @return The builder instance.
     */
    public CacheBuilder<V> withDefaultValue( V defaultValue )
    {
        this.defaultValue = defaultValue;
        return this;
    }

    /**
     * Creates and returns a cacheInstance based on the system configuration and
     * the cache builder parameters. If {@code maximumSize} is 0 then a
     * NoOpCache instance will be returned which does not cache anything. This
     * can be used during system testings where cache has to be disabled. If
     * {@code maximumSize} is greater than 0 than based on {@code redis.enabled}
     * property in dhis.conf, either Redis backed implementation
     * {@link RedisCache} will be returned or a Local Caffeine backed cache
     * implementation {@link LocalCache} will be returned. For Local cache,
     * every instance created using this method will be logically separate and
     * will not share any state. However, when using Redis Cache, every instance
     * created using this method will use the same redis store.
     *
     * @return A cache instance based on the system configuration and input
     *         parameters. Returns one of {@link RedisCache}, {@link LocalCache}
     *         or {@link NoOpCache}
     */
    public Cache<V> build()
    {
        if ( maximumSize == 0 )
        {
            log.info( String.format( "NoOp Cache instance created for region:'%s'", region ) );
            return new NoOpCache<V>( this );
        }
        else if ( configurationProvider.getProperty( ConfigurationKey.REDIS_ENABLED ).equalsIgnoreCase( "true" ) )
        {
            log.info( String.format( "Redis Cache instance created for region:'%s'", region ) );
            return new RedisCache<V>( this );
        }
        else
        {
            log.info( String.format( "Local Cache instance created for region:'%s'", region ) );
            return new LocalCache<V>( this );
        }
    }

    public long getMaximumSize()
    {
        return maximumSize;
    }

    public String getRegion()
    {
        return region;
    }

    public boolean isRefreshExpiryOnAccess()
    {
        return refreshExpiryOnAccess;
    }

    public boolean isExpiryEnabled()
    {
        return expiryEnabled;
    }

    public long getExpiryInSeconds()
    {
        return expiryInSeconds;
    }

    public V getDefaultValue()
    {
        return defaultValue;
    }

    public RedisTemplate<String, ?> getRedisTemplate()
    {
        return redisTemplate;
    }
}


text:
window.muplis = false;
window.nasezvafahi = 'No definition has been found, dude!';
window.bangudecomp = 'decomposing ...';
window.rimni="la rimni sutysisku";
window.bangubuild = 'Building index...';
window.xuzganalojudri = true;
window.judri = "http://jbovlaste.lojban.org/dict/";
window.cllnotci = 'The Reference Grammar on this topic:';
window.purc = "Last searched///: ";
window.bangu=".inglic.";
window.cll_url = "https://la-lojban.github.io/uncll/romoi/xhtml_section_chunks/";

redpajama_set_name: RedPajamaGithub


text:
package org.efaps.esjp.sales.report;

import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;

import org.efaps.admin.datamodel.Attribute;
import org.efaps.admin.event.Parameter;
import org.efaps.admin.event.Return;
import org.efaps.admin.event.Return.ReturnValues;
import org.efaps.admin.program.esjp.EFapsApplication;
import org.efaps.admin.program.esjp.EFapsUUID;
import org.efaps.db.CachedMultiPrintQuery;
import org.efaps.db.Instance;
import org.efaps.db.MultiPrintQuery;
import org.efaps.db.QueryBuilder;
import org.efaps.db.SelectBuilder;
import org.efaps.esjp.ci.CIContacts;
import org.efaps.esjp.ci.CIERP;
import org.efaps.esjp.ci.CIProducts;
import org.efaps.esjp.ci.CISales;
import org.efaps.esjp.common.jasperreport.AbstractDynamicReport;
import org.efaps.esjp.common.jasperreport.AbstractDynamicReport_Base.ExportType;
import org.efaps.esjp.common.properties.PropertiesUtil;
import org.efaps.esjp.erp.FilteredReport;
import org.efaps.esjp.erp.util.ERP;
import org.efaps.esjp.sales.util.Sales;
import org.efaps.util.EFapsException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.sf.dynamicreports.jasper.builder.JasperReportBuilder;
import net.sf.dynamicreports.report.base.expression.AbstractSimpleExpression;
import net.sf.dynamicreports.report.builder.DynamicReports;
import net.sf.dynamicreports.report.builder.column.ComponentColumnBuilder;
import net.sf.dynamicreports.report.builder.column.TextColumnBuilder;
import net.sf.dynamicreports.report.builder.component.SubreportBuilder;
import net.sf.dynamicreports.report.builder.group.ColumnGroupBuilder;
import net.sf.dynamicreports.report.constant.StretchType;
import net.sf.dynamicreports.report.definition.ReportParameters;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRRewindableDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

// TODO: Auto-generated Javadoc
/**
 * TODO comment!.
 *
 * @author The eFaps Team
 */
@EFapsUUID("14caf734-cf91-482e-acc5-837da9df78df")
@EFapsApplication("eFapsApp-Sales")
public abstract class PartialReport_Base
    extends FilteredReport
{

    /**
     * Logging instance used in this class.
     */
    private static final Logger LOG = LoggerFactory.getLogger(DocVsDocReport.class);

    /**
     * Generate report.
     *
     * @param _parameter Parameter as passed by the eFasp API
     * @return Return containing html snipplet
     * @throws EFapsException on error
     */
    public Return generateReport(final Parameter _parameter)
        throws EFapsException
    {
        final Return ret = new Return();
        final AbstractDynamicReport dyRp = getReport(_parameter);
        dyRp.setFileName(getDBProperty("FileName"));
        final String html = dyRp.getHtmlSnipplet(_parameter);
        ret.put(ReturnValues.SNIPLETT, html);
        return ret;
    }

    /**
     * Export report.
     *
     * @param _parameter Parameter as passed by the eFaps API
     * @return the return
     * @throws EFapsException on error
     */
    public Return exportReport(final Parameter _parameter)
        throws EFapsException
    {
        final Return ret = new Return();
        final String mime = getProperty(_parameter, "Mime", "pdf");
        final AbstractDynamicReport dyRp = getReport(_parameter);
        dyRp.setFileName(getDBProperty("FileName"));
        File file = null;
        if ("xls".equalsIgnoreCase(mime)) {
            file = dyRp.getExcel(_parameter);
        } else if ("pdf".equalsIgnoreCase(mime)) {
            file = dyRp.getPDF(_parameter);
        }
        ret.put(ReturnValues.VALUES, file);
        ret.put(ReturnValues.TRUE, true);
        return ret;
    }

    @Override
    protected Properties getProperties4TypeList(final Parameter _parameter,
                                                final String _fieldName)
        throws EFapsException
    {
        return Sales.REPORT_PARTIAL.get();
    }

    /**
     * Gets the report.
     *
     * @param _parameter Parameter as passed by the eFaps API
     * @return the report
     * @throws EFapsException on error
     */
    protected AbstractDynamicReport getReport(final Parameter _parameter)
        throws EFapsException
    {
        return new DynPartialReport(this);
    }

    /**
     * The Class DynSalesProductReport.
     *
     * @author The eFaps Team
     */
    public static class DynPartialReport
        extends AbstractDynamicReport
    {

        /** The filtered report. */
        private final PartialReport_Base filteredReport;

        /**
         * Instantiates a new dyn doc vs doc report.
         *
         * @param _filteredReport the filtered report
         */
        public DynPartialReport(final PartialReport_Base _filteredReport)
        {
            this.filteredReport = _filteredReport;
        }

        @Override
        protected JRDataSource createDataSource(final Parameter _parameter)
            throws EFapsException
        {
            final JRRewindableDataSource ret;
            if (getFilteredReport().isCached(_parameter)) {
                ret = getFilteredReport().getDataSourceFromCache(_parameter);
                try {
                    ret.moveFirst();
                } catch (final JRException e) {
                    throw new EFapsException("JRException", e);
                }
            } else {
                final Map<Instance, Set<Instance>> origin2partial = new HashMap<>();

                final QueryBuilder queryBldr = new QueryBuilder(CIERP.Document2DocumentAbstract);
                queryBldr.addWhereAttrEqValue(CIERP.Document2DocumentAbstract.Situation,
                                ERP.DocRelationSituation.PARTIAL);
                final MultiPrintQuery multi = queryBldr.getPrint();
                final SelectBuilder selFromInst = SelectBuilder.get().linkto(
                                CIERP.Document2DocumentAbstract.FromAbstractLink).instance();
                final SelectBuilder selToInst = SelectBuilder.get().linkto(
                                CIERP.Document2DocumentAbstract.ToAbstractLink).instance();
                multi.addSelect(selFromInst, selToInst);
                multi.execute();
                final Attribute fromLinkAttr = CIERP.Document2DocumentAbstract.getType().getAttribute(
                                CIERP.Document2DocumentAbstract.FromAbstractLink.name);
                while (multi.next()) {
                    final Instance relInst = multi.getCurrentInstance();
                    final Instance fromInst = multi.getSelect(selFromInst);
                    final Instance toInst = multi.getSelect(selToInst);
                    final Properties properties = PropertiesUtil.getProperties4Prefix(Sales.PARTIALCONFIG.get(), relInst
                                    .getType().getName());
                    final String origLink = properties.getProperty("RelationOriginLink");

                    final Instance origin;
                    final Instance partial;
                    if (fromLinkAttr.getSqlColNames().toString().equals(relInst.getType().getAttribute(origLink)
                                    .getSqlColNames().toString())) {
                        origin = fromInst;
                        partial = toInst;
                    } else {
                        origin = toInst;
                        partial = fromInst;
                    }
                    final Set<Instance> partials;
                    if (origin2partial.containsKey(origin)) {
                        partials = origin2partial.get(origin);
                    } else {
                        partials = new HashSet<>();
                        origin2partial.put(origin, partials);
                    }
                    partials.add(partial);
                }
                final List<DataBean> dataSource = new ArrayList<>();
                for (final Entry<Instance, Set<Instance>> entry : origin2partial.entrySet()) {
                    final List<DataBean> origins = getOriginBeans(_parameter, entry.getKey());
                    final List<PartialBean> partials = getPartialBeans(_parameter, entry.getValue().toArray());
                    for (final DataBean origin : origins) {
                        for (final PartialBean partial : partials) {
                            if (origin.getProdInst().equals(partial.getProdInst())) {
                                origin.addPartial(partial);
                            }
                        }
                    }
                    dataSource.addAll(origins);
                }

                ret = new JRBeanCollectionDataSource(dataSource);
                getFilteredReport().cache(_parameter, ret);
            }
            return ret;
        }

        /**
         * Gets the origin beans.
         *
         * @param _parameter Parameter as passed by the eFaps API
         * @param _originInst the origin inst
         * @return the origin beans
         * @throws EFapsException on error
         */
        protected List<DataBean> getOriginBeans(final Parameter _parameter,
                                                final Instance _originInst)
            throws EFapsException
        {
            final List<DataBean> ret = new ArrayList<>();
            final QueryBuilder queryBldr = new QueryBuilder(CISales.PositionAbstract);
            queryBldr.addWhereAttrEqValue(CISales.PositionAbstract.DocumentAbstractLink, _originInst);
            final CachedMultiPrintQuery multi = queryBldr.getCachedPrint4Request();

            final SelectBuilder selDoc = SelectBuilder.get().linkto(CISales.PositionAbstract.DocumentAbstractLink);
            final SelectBuilder selDocInst = new SelectBuilder(selDoc).instance();
            final SelectBuilder selDocName = new SelectBuilder(selDoc).attribute(CISales.DocumentAbstract.Name);
            final SelectBuilder selContactName = new SelectBuilder(selDoc).linkto(CIERP.DocumentAbstract.Contact)
                            .attribute(CIContacts.Contact.Name);

            final SelectBuilder selProdInst = SelectBuilder.get().linkto(CISales.PositionAbstract.Product).instance();
            final SelectBuilder selProdName = SelectBuilder.get().linkto(CISales.PositionAbstract.Product).attribute(
                            CIProducts.ProductAbstract.Name);
            multi.addSelect(selDocInst, selDocName, selContactName, selProdInst, selProdName);
            multi.addAttribute(CISales.PositionAbstract.Quantity, CISales.PositionAbstract.ProductDesc);
            multi.execute();
            while (multi.next()) {
                final DataBean bean = new DataBean()
                                .setContactName(multi.getSelect(selContactName))
                                .setDocName(multi.<Instance>getSelect(selDocInst).getType().getLabel()
                                                + " - " + multi.getSelect(selDocName))
                                .setQuantity(multi.getAttribute(CISales.PositionAbstract.Quantity))
                                .setProdInst(multi.getSelect(selProdInst))
                                .setProdName(multi.getSelect(selProdName))
                                .setProdDescr(multi.getAttribute(CISales.PositionAbstract.ProductDesc));
                ret.add(bean);
            }
            return ret;
        }

        /**
         * Gets the partial beans.
         *
         * @param _parameter Parameter as passed by the eFaps API
         * @param _partialInsts the partial insts
         * @return the partial beans
         * @throws EFapsException on error
         */
        protected List<PartialBean> getPartialBeans(final Parameter _parameter,
                                                    final Object... _partialInsts)
            throws EFapsException
        {
            final List<PartialBean> ret = new ArrayList<>();
            final QueryBuilder queryBldr = new QueryBuilder(CISales.PositionAbstract);
            queryBldr.addWhereAttrEqValue(CISales.PositionAbstract.DocumentAbstractLink, _partialInsts);
            final CachedMultiPrintQuery multi = queryBldr.getCachedPrint4Request();

            final SelectBuilder selDoc = SelectBuilder.get().linkto(CISales.PositionAbstract.DocumentAbstractLink);
            final SelectBuilder selDocInst = new SelectBuilder(selDoc).instance();
            final SelectBuilder selDocName = new SelectBuilder(selDoc).attribute(CISales.DocumentAbstract.Name);
            final SelectBuilder selProdInst = SelectBuilder.get().linkto(CISales.PositionAbstract.Product).instance();
            multi.addSelect(selDocName, selDocInst, selProdInst);
            multi.addAttribute(CISales.PositionAbstract.Quantity, CISales.PositionAbstract.ProductDesc);
            multi.execute();
            while (multi.next()) {
                final PartialBean bean = new PartialBean()
                                .setDocType(multi.<Instance>getSelect(selDocInst).getType().getLabel())
                                .setDocName(multi.getSelect(selDocName))
                                .setQuantity(multi.getAttribute(CISales.PositionAbstract.Quantity))
                                .setProdInst(multi.getSelect(selProdInst));
                ret.add(bean);
            }
            return ret;
        }

        @Override
        protected void addColumnDefinition(final Parameter _parameter,
                                          final JasperReportBuilder _builder)
            throws EFapsException
        {

            final TextColumnBuilder<String> contactNameColumn = DynamicReports.col.column(this.filteredReport
                            .getDBProperty("column.ContactName"), "contactName", DynamicReports.type.stringType());

            final TextColumnBuilder<String> docNameColumn = DynamicReports.col.column(this.filteredReport
                            .getDBProperty("column.originDocName"), "docName", DynamicReports.type.stringType());

            final TextColumnBuilder<BigDecimal> quantityColumn = DynamicReports.col.column(this.filteredReport
                            .getDBProperty("column.quantityColumn"), "quantity", DynamicReports.type.bigDecimalType());

            final TextColumnBuilder<String> prodNameColumn = DynamicReports.col.column(this.filteredReport
                            .getDBProperty("column.prodName"), "prodName", DynamicReports.type.stringType());

            final TextColumnBuilder<String> prodDescrColumn = DynamicReports.col.column(this.filteredReport
                            .getDBProperty("column.prodDescr"), "prodDescr", DynamicReports.type.stringType());

            final ColumnGroupBuilder contactGroup = DynamicReports.grp.group(contactNameColumn).groupByDataType();
            final ColumnGroupBuilder docNameGroup = DynamicReports.grp.group(docNameColumn).groupByDataType();

            final SubreportBuilder subReport = DynamicReports.cmp
                            .subreport(getSubreportDesign(_parameter, getExType()))
                            .setDataSource(getSubreportDataSource(_parameter))
                            .setStretchType(StretchType.CONTAINER_HEIGHT)
                            .setStyle(DynamicReports.stl.style().setBorder(DynamicReports.stl.pen1Point()));

            final ComponentColumnBuilder subReportColumn = DynamicReports.col.componentColumn(this.filteredReport
                            .getDBProperty("column.subReport"), subReport).setMinWidth(250);

            _builder.fields(DynamicReports.field("partials", List.class))
                .addGroup(contactGroup, docNameGroup)
                .addColumn(contactNameColumn, docNameColumn, quantityColumn, prodNameColumn, prodDescrColumn,
                                subReportColumn);
        }

        /**
         * Gets the contact inst.
         *
         * @param _parameter the _parameter
         * @return the contact inst
         * @throws EFapsException on error
         */
        protected Object[] getContactInsts(final Parameter _parameter)
            throws EFapsException
        {
            final Object[] ret;
            final Map<String, Object> filterMap = this.filteredReport.getFilterMap(_parameter);
            final InstanceSetFilterValue filter = (InstanceSetFilterValue) filterMap.get("contact");
            if (filter == null || (filter != null && filter.getObject() == null)) {
                ret = new Object[] {};
            } else {
                ret = filter.getObject().toArray();
            }
            return ret;
        }

        /**
         * Gets the subreport data source.
         *
         * @param _parameter Parameter as passed by the eFaps API
         * @return the subreport data source
         */
        protected SubreportDataSource getSubreportDataSource(final Parameter _parameter)
        {
            return new SubreportDataSource();
        }

        /**
         * Gets the subreport design.
         *
         * @param _parameter Parameter as passed by the eFaps API
         * @param _exType the ex type
         * @return the subreport design
         */
        protected SubreportDesign getSubreportDesign(final Parameter _parameter,
                                                     final ExportType _exType)
        {
            return new SubreportDesign(_exType);
        }

        /**
         * Getter method for the instance variable {@link #filteredReport}.
         *
         * @return value of instance variable {@link #filteredReport}
         */
        protected PartialReport_Base getFilteredReport()
        {
            return this.filteredReport;
        }
    }

    /**
     * The Class PartialBean.
     *
     * @author The eFaps Team
     */
    public static class PartialBean
    {
        /** The origin doc name. */
        private String docName;

        /** The doc type. */
        private String docType;

        /** The prod inst. */
        private Instance prodInst;

        /** The quantity. */
        private BigDecimal quantity;

        /**
         * Gets the origin doc name.
         *
         * @return the origin doc name
         */
        public String getDocName()
        {
            return this.docName;
        }

        /**
         * Sets the doc name.
         *
         * @param _docName the doc name
         * @return the partial bean
         */
        public PartialBean setDocName(final String _docName)
        {
            this.docName = _docName;
            return this;
        }

        /**
         * Gets the prod inst.
         *
         * @return the prod inst
         */
        public Instance getProdInst()
        {
            return this.prodInst;
        }

        /**
         * Sets the prod inst.
         *
         * @param _prodInst the prod inst
         * @return the partial bean
         */
        public PartialBean setProdInst(final Instance _prodInst)
        {
            this.prodInst = _prodInst;
            return this;
        }

        /**
         * Gets the quantity.
         *
         * @return the quantity
         */
        public BigDecimal getQuantity()
        {
            return this.quantity;
        }

        /**
         * Sets the quantity.
         *
         * @param _quantity the quantity
         * @return the partial bean
         */
        public PartialBean setQuantity(final BigDecimal _quantity)
        {
            this.quantity = _quantity;
            return this;
        }

        /**
         * Gets the doc type.
         *
         * @return the doc type
         */
        public String getDocType()
        {
            return this.docType;
        }

        /**
         * Sets the doc type.
         *
         * @param _docType the doc type
         * @return the partial bean
         */
        public PartialBean setDocType(final String _docType)
        {
            this.docType = _docType;
            return this;
        }
    }

    /**
     * The Class DataBean.
     *
     * @author The eFaps Team
     */
    public static class DataBean
    {

        /** The quantity. */
        private BigDecimal quantity;

        /** The prod inst. */
        private Instance prodInst;

        /** The prod name. */
        private String prodName;

        /** The prod descr. */
        private String prodDescr;

        /** The contact name. */
        private String contactName;

        /** The origin doc name. */
        private String docName;

        /** The partials. */
        private final List<PartialBean> partials = new ArrayList<>();;

        /**
         * Adds the partial.
         *
         * @param _bean the bean
         * @return the data bean
         */
        public DataBean addPartial(final PartialBean _bean)
        {
            this.partials.add(_bean);
            return this;
        }

        /**
         * Gets the partials.
         *
         * @return the partials
         */
        public List<PartialBean>getPartials()
        {
            return this.partials;
        }

        /**
         * Gets the contact name.
         *
         * @return the contact name
         */
        public String getContactName()
        {
            return this.contactName;
        }

        /**
         * Sets the contact name.
         *
         * @param _contactName the contact name
         * @return the data bean
         */
        public DataBean setContactName(final String _contactName)
        {
            this.contactName = _contactName;
            return this;
        }

        /**
         * Gets the origin doc name.
         *
         * @return the origin doc name
         */
        public String getDocName()
        {
            return this.docName;
        }

        /**
         * Sets the doc name.
         *
         * @param _originDocName the origin doc name
         * @return the data bean
         */
        public DataBean setDocName(final String _originDocName)
        {
            this.docName = _originDocName;
            return this;
        }

        /**
         * Gets the quantity.
         *
         * @return the quantity
         */
        public BigDecimal getQuantity()
        {
            return this.quantity;
        }

        /**
         * Sets the quantity.
         *
         * @param _quantity the quantity
         * @return the data bean
         */
        public DataBean setQuantity(final BigDecimal _quantity)
        {
            this.quantity = _quantity;
            return this;
        }

        /**
         * Gets the prod inst.
         *
         * @return the prod inst
         */
        public Instance getProdInst()
        {
            return this.prodInst;
        }

        /**
         * Sets the prod inst.
         *
         * @param _prodInst the prod inst
         * @return the data bean
         */
        public DataBean setProdInst(final Instance _prodInst)
        {
            this.prodInst = _prodInst;
            return this;
        }

        /**
         * Gets the prod name.
         *
         * @return the prod name
         */
        public String getProdName()
        {
            return this.prodName;
        }

        /**
         * Sets the prod name.
         *
         * @param _prodName the prod name
         * @return the data bean
         */
        public DataBean setProdName(final String _prodName)
        {
            this.prodName = _prodName;
            return this;
        }

        /**
         * Gets the prod descr.
         *
         * @return the prod descr
         */
        public String getProdDescr()
        {
            return this.prodDescr;
        }

        /**
         * Sets the prod descr.
         *
         * @param _prodDescr the prod descr
         * @return the data bean
         */
        public DataBean setProdDescr(final String _prodDescr)
        {
            this.prodDescr = _prodDescr;
            return this;
        }
    }

    /**
     * The Class SubreportDesign.
     *
     * @author The eFaps Team
     */
    public static class SubreportDesign
        extends AbstractSimpleExpression<JasperReportBuilder>
    {

        /** The Constant serialVersionUID. */
        private static final long serialVersionUID = 1L;

        /** The ex type. */
        private final ExportType exType;

        /**
         * Instantiates a new subreport design.
         *
         * @param _exType the ex type
         */
        public SubreportDesign(final ExportType _exType)
        {
            this.exType = _exType;
        }

        @Override
        public JasperReportBuilder evaluate(final ReportParameters _reportParameters)
        {
            final TextColumnBuilder<String> docTypeColumn = DynamicReports.col.column("docType",
                            DynamicReports.type.stringType());

            final TextColumnBuilder<String> docNameColumn = DynamicReports.col.column("docName",
                            DynamicReports.type.stringType());
            final TextColumnBuilder<BigDecimal> quantityColumn = DynamicReports.col.column("quantity",
                            DynamicReports.type.bigDecimalType());

            final JasperReportBuilder report = DynamicReports.report();

            if (ExportType.PDF.equals(this.exType)) {
                report.setColumnStyle(DynamicReports.stl.style().setPadding(DynamicReports.stl.padding(2))
                                .setLeftBorder(DynamicReports.stl.pen1Point())
                                .setRightBorder(DynamicReports.stl.pen1Point())
                                .setBottomBorder(DynamicReports.stl.pen1Point())
                                .setTopBorder(DynamicReports.stl.pen1Point()));
                docNameColumn.setWidth(17);
                quantityColumn.setWidth(49);

            } else if (ExportType.EXCEL.equals(this.exType)) {
                docNameColumn.setFixedWidth(60);
                quantityColumn.setFixedWidth(60);
            }
            report.columns(docTypeColumn, docNameColumn, quantityColumn)
                .subtotalsAtColumnFooter(DynamicReports.sbt.sum(quantityColumn));
            return report;
        }
    }

    /**
     * The Class SubreportDataSource.
     *
     * @author The eFaps Team
     */
    public static class SubreportDataSource
        extends AbstractSimpleExpression<JRDataSource>
    {

        /** The Constant serialVersionUID. */
        private static final long serialVersionUID = 1L;

        @Override
        public JRDataSource evaluate(final ReportParameters _reportParameters)
        {
            final Collection<PartialBean> value = _reportParameters.getValue("partials");
            return new JRBeanCollectionDataSource(value);
        }
    }

}


text:
TrainGate_t myTrainGate;

int main() {
	//printf("\n\n\n");
	//printf("\nTop: %20s   Size: %lu\n", "TrainGate", sizeof(myTrainGate));

	#ifdef PRINT_VALS
	printf("Simulation time,");
	#endif

	if(TrainGate_preinit(&myTrainGate) != 0) {
		printf("Failed to preinitialize.");
		return 1;
	}
	if(TrainGate_init(&myTrainGate) != 0) {
		printf("Failed to initialize.");
		return 1;
	}
	printf("\n");

	struct timeval tv1, tv2;
	gettimeofday(&tv1, NULL);

	int tickNum = 1;
	do {
		#ifdef PRINT_VALS
			printf("%f,",(double)tickNum*0.01);
		#endif
		TrainGate_syncOutputEvents(&myTrainGate);
		TrainGate_syncInputEvents(&myTrainGate);

		TrainGate_syncOutputData(&myTrainGate);
		TrainGate_syncInputData(&myTrainGate);

		TrainGate_run(&myTrainGate);
		#ifdef PRINT_VALS
			printf("\n");
		#endif
	} while(tickNum++ < MAX_TICKS);
	gettimeofday(&tv2, NULL);
	#ifdef PRINT_TIME
	printf ("Total time = %f seconds\n",
         (double) (tv2.tv_usec - tv1.tv_usec) / 1000000 +
         (double) (tv2.tv_sec - tv1.tv_sec));
	#endif
	return 0;
}


text:
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>jdom</groupId>
  <artifactId>jdom-</artifactId>
  <version>10</version>
</project>


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Diagnostics;

using Poderosa.ConnectionParam;
using Poderosa.View;
using Poderosa.Util;
using Poderosa.Plugins;
using Poderosa.MacroEngine;

namespace Poderosa.Terminal {
    //IShellSchemeDynamicChangeListenerに関しては、ShellSchemeを確定するときにListenする
    /// <summary>
    ///
    /// </summary>
    /// <exclude/>
    public class TerminalSettings : ITerminalSettings, IShellSchemeDynamicChangeListener {
        private EncodingType _encoding;
        private TerminalType _terminalType;
        private bool _localecho;
        private LineFeedRule _lineFeedRule;
        private NewLine _transmitnl;
        private RenderProfile _renderProfile;
        private IMultiLogSettings _multiLogSettings;
        private string _caption;
        private Image _icon;
        private IShellScheme _shellScheme;
        private string _shellSchemeName;
        private bool _enabledCharTriggerIntelliSense;

        private ListenerList<ITerminalSettingsChangeListener> _listeners;
        private bool _updating;

        public event ChangeHandler<string> ChangeCaption;
        public event ChangeHandler<RenderProfile> ChangeRenderProfile;
        public event ChangeHandler<EncodingType> ChangeEncoding;

        public TerminalSettings() {
            IPoderosaCulture culture = TerminalEmulatorPlugin.Instance.PoderosaWorld.Culture;
            if (culture.IsJapaneseOS || culture.IsSimplifiedChineseOS || culture.IsTraditionalChineseOS || culture.IsKoreanOS)
                _encoding = EncodingType.UTF8;
            else
                _encoding = EncodingType.ISO8859_1;

            _terminalType = TerminalType.XTerm;
            _localecho = false;
            _lineFeedRule = LineFeedRule.Normal;
            _transmitnl = NewLine.CR;
            _renderProfile = null;
            _shellSchemeName = ShellSchemeCollection.DEFAULT_SCHEME_NAME;
            _enabledCharTriggerIntelliSense = false;
            _multiLogSettings = new MultiLogSettings();

            _listeners = new ListenerList<ITerminalSettingsChangeListener>();
        }

        //Clone, でもIConeableではない。Listener類はコピーしない。
        public virtual ITerminalSettings Clone() {
            TerminalSettings t = new TerminalSettings();
            t.Import(this);
            return t;
        }
        //Listener以外を持ってくる
        public virtual void Import(ITerminalSettings src) {
            _encoding = src.Encoding;
            _terminalType = src.TerminalType;
            _localecho = src.LocalEcho;
            _lineFeedRule = src.LineFeedRule;
            _transmitnl = src.TransmitNL;
            _caption = src.Caption;
            _icon = src.Icon;
            TerminalSettings src_r = (TerminalSettings)src;
            _shellSchemeName = src_r._shellSchemeName; //ちょっとインチキ
            if (src_r._shellScheme != null) {
                _shellScheme = src_r._shellScheme;
                TerminalEmulatorPlugin.Instance.ShellSchemeCollection.AddDynamicChangeListener(this);
            }
            _enabledCharTriggerIntelliSense = src.EnabledCharTriggerIntelliSense;
            _renderProfile = src.RenderProfile == null ? null : (RenderProfile)src.RenderProfile.Clone();
            _multiLogSettings = src.LogSettings == null ? null : (IMultiLogSettings)_multiLogSettings.Clone();
        }

        public RenderProfile RenderProfile {
            get {
                return _renderProfile;
            }
            set {
                EnsureUpdating();
                _renderProfile = value;
                if (this.ChangeRenderProfile != null)
                    this.ChangeRenderProfile(value);
            }
        }
        public bool UsingDefaultRenderProfile {
            get {
                return _renderProfile == null;
            }
        }

        [MacroConnectionParameter]
        public EncodingType Encoding {
            get {
                return _encoding;
            }
            set {
                EnsureUpdating();
                _encoding = value;
                if (this.ChangeEncoding != null)
                    this.ChangeEncoding(value);
            }
        }

        [MacroConnectionParameter]
        public TerminalType TerminalType {
            get {
                return _terminalType;
            }
            set {
                EnsureUpdating();
                _terminalType = value;
            }
        }

        public IMultiLogSettings LogSettings {
            get {
                return _multiLogSettings;
            }
        }

        [MacroConnectionParameter]
        public NewLine TransmitNL {
            get {
                return _transmitnl;
            }
            set {
                EnsureUpdating();
                _transmitnl = value;
            }
        }

        [MacroConnectionParameter]
        public bool LocalEcho {
            get {
                return _localecho;
            }
            set {
                EnsureUpdating();
                _localecho = value;
            }
        }

        [MacroConnectionParameter]
        public LineFeedRule LineFeedRule {
            get {
                return _lineFeedRule;
            }
            set {
                EnsureUpdating();
                _lineFeedRule = value;
            }
        }

        [MacroConnectionParameter]
        public string Caption {
            get {
                return _caption;
            }
            set {
                EnsureUpdating();
                _caption = value;
                if (this.ChangeCaption != null)
                    this.ChangeCaption(value);
            }
        }

        public Image Icon {
            get {
                return _icon;
            }
            set {
                EnsureUpdating();
                _icon = value;
            }
        }
        public IShellScheme ShellScheme {
            get {
                //ShellSchemeNameはレイトバインド専用
                if (_shellScheme == null) {
                    _shellScheme = TerminalEmulatorPlugin.Instance.ShellSchemeCollection.FindShellSchemeOrDefault(_shellSchemeName);
                    TerminalEmulatorPlugin.Instance.ShellSchemeCollection.AddDynamicChangeListener(this);
                }

                return _shellScheme;
            }
            set {
                EnsureUpdating();
                _shellScheme = value;
            }
        }
        public bool EnabledCharTriggerIntelliSense {
            get {
                return _enabledCharTriggerIntelliSense;
            }
            set {
                EnsureUpdating();
                _enabledCharTriggerIntelliSense = value;
            }
        }

        public virtual IAdaptable GetAdapter(Type adapter) {
            return TerminalEmulatorPlugin.Instance.PoderosaWorld.AdapterManager.GetAdapter(this, adapter);
        }

        //
        public void BeginUpdate() {
            if (_updating)
                throw new InvalidOperationException("EndUpdate() was missed");
            _updating = true;
            if (!_listeners.IsEmpty) {
                foreach (ITerminalSettingsChangeListener l in _listeners)
                    l.OnBeginUpdate(this);
            }
        }
        public void EndUpdate() {
            if (!_updating)
                throw new InvalidOperationException("BeginUpdate() was missed");
            _updating = false;
            if (!_listeners.IsEmpty) {
                foreach (ITerminalSettingsChangeListener l in _listeners)
                    l.OnEndUpdate(this);
            }
        }

        public void AddListener(ITerminalSettingsChangeListener l) {
            _listeners.Add(l);
        }
        public void RemoveListener(ITerminalSettingsChangeListener l) {
            _listeners.Remove(l);
        }

        public void SetShellSchemeName(string value) {
            _shellSchemeName = value;
            _shellScheme = null;
        }

        private void EnsureUpdating() {
            if (!_updating)
                throw new InvalidOperationException("NOT UPDATE STATE");
        }

        //IShellSchemeDynamicChangeListener
        public void OnShellSchemeCollectionChanged(IShellScheme[] values, Poderosa.Util.Collections.TypedHashtable<IShellScheme, IShellScheme> table) {
            if (_shellScheme == null)
                return;

            IShellScheme ns = table[_shellScheme];
            Debug.Assert(ns != null);
            BeginUpdate();
            _shellScheme = ns;
            _shellSchemeName = ns.Name;
            EndUpdate(); //これで通知が出る。例えばShellScheme選択コンボボックス。
        }
    }

    internal class SimpleLogSettings : ISimpleLogSettings {
        private LogType _logtype;
        private string _logpath;
        private bool _logappend;

        public SimpleLogSettings() {
            _logtype = LogType.None;
        }
        public SimpleLogSettings(LogType lt, string path) {
            _logtype = lt;
            _logpath = path;
            _logappend = false;
        }

        public ILogSettings Clone() {
            SimpleLogSettings t = new SimpleLogSettings();
            t._logappend = _logappend;
            t._logpath = _logpath;
            t._logtype = _logtype;
            return t;
        }

        public LogType LogType {
            get {
                return _logtype;
            }
            set {
                _logtype = value;
            }
        }

        public string LogPath {
            get {
                return _logpath;
            }
            set {
                _logpath = value;
            }
        }

        public bool LogAppend {
            get {
                return _logappend;
            }
            set {
                _logappend = value;
            }
        }

        public IAdaptable GetAdapter(Type adapter) {
            return TerminalEmulatorPlugin.Instance.PoderosaWorld.AdapterManager.GetAdapter(this, adapter);
        }
    }
}


text:
require 'spec_helper'

describe "Entries" do

  def create_client
    fill_in "client_name", with: "Housing Corp"
    fill_in "client_city", with: "Los Angeles"
    select "California", from: "client_state"
    select "Apartments", from: "client_vertical"
    select "MultiDomainClient", from: "client_domain_type"

    fill_in "client_locations_attributes_0_name", with: "Oscar's Trash Can"
    fill_in "client_locations_attributes_0_domain", with: Faker::Internet.domain_name
    fill_in "client_locations_attributes_0_street_address_1", with: Faker::Address.street_address
    fill_in "client_locations_attributes_0_city", with: Faker::Address.city
    fill_in "client_locations_attributes_0_postal_code", with: Faker::Address.zip_code
    fill_in "client_locations_attributes_0_phone_number", with: Faker::PhoneNumber.phone_number

    select "California", from: "client_locations_attributes_0_state"

    click_button "Create Client"
  end

  describe "#index" do
    it "has Entry title" do
      visit entries_path
      expect(page).to have_content "Entries"
    end

    it "shows new client" do
      visit clients_path
      click_link "New Client"
      create_client
      click_link "Entries"
      expect(page).to have_content "Housing Corp"
      expect(page).to have_content "Apartments"
      expect(page).to have_content "MultiDomainClient"
      expect(page).to have_content "Oscar's Trash Can"
    end
  end

end


text:
package org.bubblecloud.zigbee.network.packet.zdo;

import org.bubblecloud.zigbee.network.packet.ZToolAddress16;
import org.bubblecloud.zigbee.network.packet.ZToolAddress64;
import org.bubblecloud.zigbee.network.packet.ZToolCMD;
import org.bubblecloud.zigbee.network.packet.ZToolPacket;
import org.bubblecloud.zigbee.util.DoubleByte;

/**
 * @author Alvaro Fides Valero
 * @version $LastChangedRevision: 799 $ ($LastChangedDate: 2013-08-06 19:00:05 +0300 (Tue, 06 Aug 2013) $)
 */
public class ZDO_END_DEVICE_ANNCE_IND extends ZToolPacket /*implements IRESPONSE_CALLBACK,IZDO*/ {
    /// <name>TI.ZPI2.ZDO_END_DEVICE_ANNCE_IND.Capabilities</name>
    /// Capabilities
    public int Capabilities;
    /// <name>TI.ZPI2.ZDO_END_DEVICE_ANNCE_IND.IEEEAddr</name>
    /// 64 bit IEEE address of source device
    public ZToolAddress64 IEEEAddr;
    /// <name>TI.ZPI2.ZDO_END_DEVICE_ANNCE_IND.NwkAddr</name>
    /// Network address
    public ZToolAddress16 NwkAddr;
    /// <name>TI.ZPI2.ZDO_END_DEVICE_ANNCE_IND.SrcAddr</name>
    /// Source address
    public ZToolAddress16 SrcAddr;

    /// <name>TI.ZPI2.ZDO_END_DEVICE_ANNCE_IND</name>
    /// Constructor
    public ZDO_END_DEVICE_ANNCE_IND() {
    }

    /// <name>TI.ZPI2.ZDO_END_DEVICE_ANNCE_IND</name>
    /// Constructor
    public ZDO_END_DEVICE_ANNCE_IND(int[] framedata) {
        this.SrcAddr = new ZToolAddress16(framedata[1], framedata[0]);
        this.NwkAddr = new ZToolAddress16(framedata[3], framedata[2]);
        byte[] bytes = new byte[8];
        for (int i = 0; i < 8; i++) {
            bytes[i] = (byte) framedata[11 - i];
        }
        this.IEEEAddr = new ZToolAddress64(bytes);
        this.Capabilities = framedata[12];
        super.buildPacket(new DoubleByte(ZToolCMD.ZDO_END_DEVICE_ANNCE_IND), framedata);
    }

}


text:
from django.utils.translation import ugettext_lazy as _

import horizon

class Search(horizon.Panel):
    name = _("Search")
    slug = 'search'
    permissions = ('openstack.services.search',)


text:
package gwt.material.design.client.base;

public interface HasHref {

    /**
     * Set the href parameter on material components.
     */
    void setHref(String href);

    String getHref();

    /**
     * Set the target of the href.
     */
    void setTarget(String target);

    String getTarget();
}


text:
VERSION=2.10
TAR=http://www.digip.org/jansson/releases/jansson-$VERSION.tar.gz

function recipe_version {
    echo "$VERSION"
    skip=1
}

function recipe_build {
    sysroot="$(realpath ../sysroot)"
    export LDFLAGS="-L$sysroot/lib"
    export CPPFLAGS="-I$sysroot/include"
    ./configure --build=${BUILD} --host=${HOST} --prefix=/
    "$REDOX_MAKE" -j"$($NPROC)"
    skip=1
}

function recipe_clean {
    "$REDOX_MAKE" clean
    skip=1
}

function recipe_stage {
    dest="$(realpath $1)"
    "$REDOX_MAKE" DESTDIR="$dest" install
    skip=1
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--

 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
    <testCase name="Magento\Sales\Test\TestCase\CreateInvoiceEntityTest" summary="Create Invoice for Offline Payment Methods" ticketId="MAGETWO-28209">
        <variation name="CreateInvoiceEntityTestVariation1">
            <data name="order/dataset" xsi:type="string">default</data>
            <data name="order/data/price/dataset" xsi:type="string">full_invoice</data>
            <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::default</data>
            <data name="order/data/total_qty_ordered/0" xsi:type="string">1</data>
            <data name="data/items_data/0/qty" xsi:type="string">-</data>
            <data name="data/form_data/do_shipment" xsi:type="string">Yes</data>
            <data name="data/form_data/comment_text" xsi:type="string">comments</data>
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceWithShipmentSuccessMessage" />
            <constraint name="Magento\Sales\Test\Constraint\AssertNoInvoiceButton" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesTab" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesGrid" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoicedAmountOnFrontend" />
            <constraint name="Magento\Shipping\Test\Constraint\AssertNoShipButton" />
            <constraint name="Magento\Shipping\Test\Constraint\AssertShipmentInShipmentsTab" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceItems" />
        </variation>
        <variation name="CreateInvoiceEntityTestVariation2">
            <data name="order/dataset" xsi:type="string">default</data>
            <data name="order/data/price/dataset" xsi:type="string">partial_invoice</data>
            <data name="order/data/entity_id/products" xsi:type="string">catalogProductSimple::product_100_dollar</data>
            <data name="order/data/total_qty_ordered/0" xsi:type="string">-</data>
            <data name="data/items_data/0/qty" xsi:type="string">1</data>
            <data name="data/form_data/do_shipment" xsi:type="string">No</data>
            <data name="data/form_data/comment_text" xsi:type="string">comments</data>
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceSuccessCreateMessage" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesTab" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceInInvoicesGrid" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoiceItems" />
            <constraint name="Magento\Sales\Test\Constraint\AssertInvoicedAmountOnFrontend" />
        </variation>
    </testCase>
</config>


text:
import { youtube } from 'googleapis';
import config from 'config';
import Promise from 'bluebird';
import { logger } from '../utils/logging';

// Shared client instance
let client = null;

/**
 * Get a YouTube API client.
 */
export function getYouTubeClient() {
  if (client !== null) return client;

  // Load API key and create client instance
  let auth = config.get('youTubeApiKey');
  logger.log('verbose', `YouTube API Key: ${auth}`);
  let c = youtube({ version: 'v3', auth });

  // Promisify methods we need
  Promise.promisifyAll(c.search);
  Promise.promisifyAll(c.playlistItems);

  // Save and return
  client = c;
  return client;
};


text:
package ch.waterbead.dto;

import java.io.Serializable;

public class ChaletDTO implements Serializable {
	private Long id;
	private String nom;
	private String description;

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
}


text:
package javassist.compiler.ast;

import javassist.compiler.CompileError;

/**
 * Keyword.
 */
public class Keyword extends ASTree {
    protected int tokenId;

    public Keyword(int token) {
        tokenId = token;
    }

    public int get() { return tokenId; }

    public String toString() { return "id:" + tokenId; }

    public void accept(Visitor v) throws CompileError { v.atKeyword(this); }
}


text:
@interface PainterView : UIView
{
	//正在绘的曲线
	NSMutableDictionary *squigglesDic;
	//已经完成的曲线
	NSMutableArray *finishSquiggles;
	UIColor *color;
	float lineWidth;
}
@property (nonatomic, retain) UIColor *color;
@property float lineWidth;
@property UIColor  *aBackgroundColor;

- (void)drawSquiggle:(Squiggle *)squiggle inContext:(CGContextRef)context;
- (void)re;
- (void)un;
- (void)changeBackground;
- (void)resetView;
- (void)erase;
- (void)setColor:(UIColor *)color;

@end


text:
class Solution {
    public ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null)
            return head;

        ListNode dummy = new ListNode(-1);
        dummy.next = head;
        ListNode pre = dummy, cur = head;

        while (cur != null && cur.next != null) {
            ListNode tmp = cur.next.next;
            pre.next = cur.next;
            cur.next.next = cur;
            cur.next = tmp;
            pre = cur;
            cur = cur.next;
        }

        return dummy.next;
    }
}

// w/o
public class Solution {
    public ListNode swapPairs(ListNode head) {
        if(head==null||head.next==null) return head;

        ListNode cur=head;
        ListNode newHead=head.next;
        ListNode pre=null;
        while (cur!=null&&cur.next!=null){
            ListNode temp=cur.next.next;
            if(pre!=null)   pre.next=cur.next;
            cur.next.next=cur;
            cur.next=temp;
            pre=cur;
            cur=temp;
        }
        return newHead;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace Azure.ResourceManager.Sql.Models
{
    /// <summary> Represents the response to a list recommended elastic pool request. </summary>
    internal partial class RecommendedElasticPoolListResult
    {
        /// <summary> Initializes a new instance of RecommendedElasticPoolListResult. </summary>
        /// <param name="value"> The list of recommended elastic pools hosted in the server. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        internal RecommendedElasticPoolListResult(IEnumerable<RecommendedElasticPool> value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Value = value.ToList();
        }

        /// <summary> Initializes a new instance of RecommendedElasticPoolListResult. </summary>
        /// <param name="value"> The list of recommended elastic pools hosted in the server. </param>
        internal RecommendedElasticPoolListResult(IReadOnlyList<RecommendedElasticPool> value)
        {
            Value = value;
        }

        /// <summary> The list of recommended elastic pools hosted in the server. </summary>
        public IReadOnlyList<RecommendedElasticPool> Value { get; }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="PublishConfigData">
    <serverData>
      <paths name="Bakerlien.com">
        <serverdata>
          <mappings>
            <mapping local="$PROJECT_DIR$" web="/" />
          </mappings>
        </serverdata>
      </paths>
      <paths name="Track5.me">
        <serverdata>
          <mappings>
            <mapping local="$PROJECT_DIR$" web="/" />
          </mappings>
        </serverdata>
      </paths>
      <paths name="USCustomCases.com">
        <serverdata>
          <mappings>
            <mapping local="$PROJECT_DIR$" web="/" />
          </mappings>
        </serverdata>
      </paths>
    </serverData>
  </component>
</project>


text:
package com.luciofm.ifican.app.ui;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.luciofm.ifican.app.BaseFragment;
import com.luciofm.ifican.app.R;
import com.luciofm.ifican.app.anim.XFractionProperty;
import com.luciofm.ifican.app.anim.YFractionProperty;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import pl.droidsonroids.gif.GifDrawable;
import pl.droidsonroids.gif.GifImageView;

/**
 * A simple {@link Fragment} subclass.
 *
 */
public class ContextFragment extends BaseFragment {

    @InjectView(R.id.gif1)
    GifImageView gif1;
    @InjectView(R.id.container2)
    View container2;

    int currentStep = 1;

    public ContextFragment() {
    }

    @Override
    public int getLayout() {
        return R.layout.fragment_context;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.inject(this, v);
        currentStep = 1;
        return v;
    }

    @Override
    public void onNextPressed() {
        switch (++currentStep) {
            case 2:
                gif1.setVisibility(View.VISIBLE);
                container2.setVisibility(View.VISIBLE);
                break;
            case 3:
                ((MainActivity) getActivity()).nextFragment();
        }
    }

    @OnClick(R.id.container)
    public void onClick() {
        onNextPressed();
    }

    @OnClick(R.id.gif1)
    public void onGifClick(GifImageView view) {
        GifDrawable drawable = (GifDrawable) view.getDrawable();
        if (drawable.isPlaying())
            drawable.stop();
        else
            drawable.start();
    }

    @Override
    public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
        if (transit == 0) {
            return null;
        }

        //Target will be filled in by the framework
        return enter ? ObjectAnimator.ofFloat(null, new YFractionProperty(), 1f, 0f)
                       : ObjectAnimator.ofFloat(null, new XFractionProperty(), 0f, -1f);
    }
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Api.SoapServer4 {
    using System.Runtime.Serialization;
    using System;

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.CollectionDataContractAttribute(Name="ArrayOfString", Namespace="http://tempuri.org/", ItemName="string")]
    [System.SerializableAttribute()]
    public class ArrayOfString : System.Collections.Generic.List<string> {
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="NewImagePart", Namespace="http://tempuri.org/")]
    [System.SerializableAttribute()]
    public partial class NewImagePart : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {

        [System.NonSerializedAttribute()]
        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

        [System.Runtime.Serialization.OptionalFieldAttribute()]
        private string ImagePartInfoField;

        [System.Runtime.Serialization.OptionalFieldAttribute()]
        private byte[] newImageField;

        [global::System.ComponentModel.BrowsableAttribute(false)]
        public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
            get {
                return this.extensionDataField;
            }
            set {
                this.extensionDataField = value;
            }
        }

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public string ImagePartInfo {
            get {
                return this.ImagePartInfoField;
            }
            set {
                if ((object.ReferenceEquals(this.ImagePartInfoField, value) != true)) {
                    this.ImagePartInfoField = value;
                    this.RaisePropertyChanged("ImagePartInfo");
                }
            }
        }

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false)]
        public byte[] newImage {
            get {
                return this.newImageField;
            }
            set {
                if ((object.ReferenceEquals(this.newImageField, value) != true)) {
                    this.newImageField = value;
                    this.RaisePropertyChanged("newImage");
                }
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="SoapServer4.ProcessingSoap")]
    public interface ProcessingSoap {

        // CODEGEN: Generating message contract since element name AccessKey from namespace http://tempuri.org/ is not marked nillable
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateDir", ReplyAction="*")]
        Api.SoapServer4.CreateDirResponse CreateDir(Api.SoapServer4.CreateDirRequest request);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateDir", ReplyAction="*")]
        System.Threading.Tasks.Task<Api.SoapServer4.CreateDirResponse> CreateDirAsync(Api.SoapServer4.CreateDirRequest request);

        // CODEGEN: Generating message contract since element name AccessKey from namespace http://tempuri.org/ is not marked nillable
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateXml", ReplyAction="*")]
        Api.SoapServer4.CreateXmlResponse CreateXml(Api.SoapServer4.CreateXmlRequest request);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateXml", ReplyAction="*")]
        System.Threading.Tasks.Task<Api.SoapServer4.CreateXmlResponse> CreateXmlAsync(Api.SoapServer4.CreateXmlRequest request);

        // CODEGEN: Generating message contract since element name AccessKey from namespace http://tempuri.org/ is not marked nillable
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/DownloadInstaPhotos", ReplyAction="*")]
        Api.SoapServer4.DownloadInstaPhotosResponse DownloadInstaPhotos(Api.SoapServer4.DownloadInstaPhotosRequest request);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/DownloadInstaPhotos", ReplyAction="*")]
        System.Threading.Tasks.Task<Api.SoapServer4.DownloadInstaPhotosResponse> DownloadInstaPhotosAsync(Api.SoapServer4.DownloadInstaPhotosRequest request);

        // CODEGEN: Generating message contract since element name AccessKey from namespace http://tempuri.org/ is not marked nillable
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImageGenerate", ReplyAction="*")]
        Api.SoapServer4.ImageGenerateResponse ImageGenerate(Api.SoapServer4.ImageGenerateRequest request);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImageGenerate", ReplyAction="*")]
        System.Threading.Tasks.Task<Api.SoapServer4.ImageGenerateResponse> ImageGenerateAsync(Api.SoapServer4.ImageGenerateRequest request);

        // CODEGEN: Generating message contract since element name AccessKey from namespace http://tempuri.org/ is not marked nillable
        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/XmlUpdate", ReplyAction="*")]
        Api.SoapServer4.XmlUpdateResponse XmlUpdate(Api.SoapServer4.XmlUpdateRequest request);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/XmlUpdate", ReplyAction="*")]
        System.Threading.Tasks.Task<Api.SoapServer4.XmlUpdateResponse> XmlUpdateAsync(Api.SoapServer4.XmlUpdateRequest request);
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class CreateDirRequest {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="CreateDir", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.CreateDirRequestBody Body;

        public CreateDirRequest() {
        }

        public CreateDirRequest(Api.SoapServer4.CreateDirRequestBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class CreateDirRequestBody {

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string AccessKey;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string UserName;

        public CreateDirRequestBody() {
        }

        public CreateDirRequestBody(string AccessKey, string UserName) {
            this.AccessKey = AccessKey;
            this.UserName = UserName;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class CreateDirResponse {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="CreateDirResponse", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.CreateDirResponseBody Body;

        public CreateDirResponse() {
        }

        public CreateDirResponse(Api.SoapServer4.CreateDirResponseBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class CreateDirResponseBody {

        [System.Runtime.Serialization.DataMemberAttribute(Order=0)]
        public bool CreateDirResult;

        public CreateDirResponseBody() {
        }

        public CreateDirResponseBody(bool CreateDirResult) {
            this.CreateDirResult = CreateDirResult;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class CreateXmlRequest {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="CreateXml", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.CreateXmlRequestBody Body;

        public CreateXmlRequest() {
        }

        public CreateXmlRequest(Api.SoapServer4.CreateXmlRequestBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class CreateXmlRequestBody {

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string AccessKey;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string UserName;

        public CreateXmlRequestBody() {
        }

        public CreateXmlRequestBody(string AccessKey, string UserName) {
            this.AccessKey = AccessKey;
            this.UserName = UserName;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class CreateXmlResponse {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="CreateXmlResponse", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.CreateXmlResponseBody Body;

        public CreateXmlResponse() {
        }

        public CreateXmlResponse(Api.SoapServer4.CreateXmlResponseBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class CreateXmlResponseBody {

        [System.Runtime.Serialization.DataMemberAttribute(Order=0)]
        public bool CreateXmlResult;

        public CreateXmlResponseBody() {
        }

        public CreateXmlResponseBody(bool CreateXmlResult) {
            this.CreateXmlResult = CreateXmlResult;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class DownloadInstaPhotosRequest {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="DownloadInstaPhotos", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.DownloadInstaPhotosRequestBody Body;

        public DownloadInstaPhotosRequest() {
        }

        public DownloadInstaPhotosRequest(Api.SoapServer4.DownloadInstaPhotosRequestBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class DownloadInstaPhotosRequestBody {

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string AccessKey;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string UserName;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
        public Api.SoapServer4.ArrayOfString photos;

        public DownloadInstaPhotosRequestBody() {
        }

        public DownloadInstaPhotosRequestBody(string AccessKey, string UserName, Api.SoapServer4.ArrayOfString photos) {
            this.AccessKey = AccessKey;
            this.UserName = UserName;
            this.photos = photos;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class DownloadInstaPhotosResponse {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="DownloadInstaPhotosResponse", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.DownloadInstaPhotosResponseBody Body;

        public DownloadInstaPhotosResponse() {
        }

        public DownloadInstaPhotosResponse(Api.SoapServer4.DownloadInstaPhotosResponseBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class DownloadInstaPhotosResponseBody {

        [System.Runtime.Serialization.DataMemberAttribute(Order=0)]
        public bool DownloadInstaPhotosResult;

        public DownloadInstaPhotosResponseBody() {
        }

        public DownloadInstaPhotosResponseBody(bool DownloadInstaPhotosResult) {
            this.DownloadInstaPhotosResult = DownloadInstaPhotosResult;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class ImageGenerateRequest {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="ImageGenerate", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.ImageGenerateRequestBody Body;

        public ImageGenerateRequest() {
        }

        public ImageGenerateRequest(Api.SoapServer4.ImageGenerateRequestBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class ImageGenerateRequestBody {

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string AccessKey;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string UserName;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
        public byte[] ImagePart;

        [System.Runtime.Serialization.DataMemberAttribute(Order=3)]
        public int x;

        [System.Runtime.Serialization.DataMemberAttribute(Order=4)]
        public int y;

        [System.Runtime.Serialization.DataMemberAttribute(Order=5)]
        public int width;

        [System.Runtime.Serialization.DataMemberAttribute(Order=6)]
        public int height;

        [System.Runtime.Serialization.DataMemberAttribute(Order=7)]
        public int PxFormat;

        public ImageGenerateRequestBody() {
        }

        public ImageGenerateRequestBody(string AccessKey, string UserName, byte[] ImagePart, int x, int y, int width, int height, int PxFormat) {
            this.AccessKey = AccessKey;
            this.UserName = UserName;
            this.ImagePart = ImagePart;
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.PxFormat = PxFormat;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class ImageGenerateResponse {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="ImageGenerateResponse", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.ImageGenerateResponseBody Body;

        public ImageGenerateResponse() {
        }

        public ImageGenerateResponse(Api.SoapServer4.ImageGenerateResponseBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class ImageGenerateResponseBody {

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public Api.SoapServer4.NewImagePart ImageGenerateResult;

        public ImageGenerateResponseBody() {
        }

        public ImageGenerateResponseBody(Api.SoapServer4.NewImagePart ImageGenerateResult) {
            this.ImageGenerateResult = ImageGenerateResult;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class XmlUpdateRequest {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="XmlUpdate", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.XmlUpdateRequestBody Body;

        public XmlUpdateRequest() {
        }

        public XmlUpdateRequest(Api.SoapServer4.XmlUpdateRequestBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class XmlUpdateRequestBody {

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string AccessKey;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string UserName;

        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
        public string key;

        [System.Runtime.Serialization.DataMemberAttribute(Order=3)]
        public int _Value;

        [System.Runtime.Serialization.DataMemberAttribute(Order=4)]
        public bool ValueArtir;

        public XmlUpdateRequestBody() {
        }

        public XmlUpdateRequestBody(string AccessKey, string UserName, string key, int _Value, bool ValueArtir) {
            this.AccessKey = AccessKey;
            this.UserName = UserName;
            this.key = key;
            this._Value = _Value;
            this.ValueArtir = ValueArtir;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class XmlUpdateResponse {

        [System.ServiceModel.MessageBodyMemberAttribute(Name="XmlUpdateResponse", Namespace="http://tempuri.org/", Order=0)]
        public Api.SoapServer4.XmlUpdateResponseBody Body;

        public XmlUpdateResponse() {
        }

        public XmlUpdateResponse(Api.SoapServer4.XmlUpdateResponseBody Body) {
            this.Body = Body;
        }
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
    public partial class XmlUpdateResponseBody {

        [System.Runtime.Serialization.DataMemberAttribute(Order=0)]
        public bool XmlUpdateResult;

        public XmlUpdateResponseBody() {
        }

        public XmlUpdateResponseBody(bool XmlUpdateResult) {
            this.XmlUpdateResult = XmlUpdateResult;
        }
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface ProcessingSoapChannel : Api.SoapServer4.ProcessingSoap, System.ServiceModel.IClientChannel {
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class ProcessingSoapClient : System.ServiceModel.ClientBase<Api.SoapServer4.ProcessingSoap>, Api.SoapServer4.ProcessingSoap {

        public ProcessingSoapClient() {
        }

        public ProcessingSoapClient(string endpointConfigurationName) :
                base(endpointConfigurationName) {
        }

        public ProcessingSoapClient(string endpointConfigurationName, string remoteAddress) :
                base(endpointConfigurationName, remoteAddress) {
        }

        public ProcessingSoapClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
                base(endpointConfigurationName, remoteAddress) {
        }

        public ProcessingSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
                base(binding, remoteAddress) {
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Api.SoapServer4.CreateDirResponse Api.SoapServer4.ProcessingSoap.CreateDir(Api.SoapServer4.CreateDirRequest request) {
            return base.Channel.CreateDir(request);
        }

        public bool CreateDir(string AccessKey, string UserName) {
            Api.SoapServer4.CreateDirRequest inValue = new Api.SoapServer4.CreateDirRequest();
            inValue.Body = new Api.SoapServer4.CreateDirRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            Api.SoapServer4.CreateDirResponse retVal = ((Api.SoapServer4.ProcessingSoap)(this)).CreateDir(inValue);
            return retVal.Body.CreateDirResult;
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<Api.SoapServer4.CreateDirResponse> Api.SoapServer4.ProcessingSoap.CreateDirAsync(Api.SoapServer4.CreateDirRequest request) {
            return base.Channel.CreateDirAsync(request);
        }

        public System.Threading.Tasks.Task<Api.SoapServer4.CreateDirResponse> CreateDirAsync(string AccessKey, string UserName) {
            Api.SoapServer4.CreateDirRequest inValue = new Api.SoapServer4.CreateDirRequest();
            inValue.Body = new Api.SoapServer4.CreateDirRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            return ((Api.SoapServer4.ProcessingSoap)(this)).CreateDirAsync(inValue);
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Api.SoapServer4.CreateXmlResponse Api.SoapServer4.ProcessingSoap.CreateXml(Api.SoapServer4.CreateXmlRequest request) {
            return base.Channel.CreateXml(request);
        }

        public bool CreateXml(string AccessKey, string UserName) {
            Api.SoapServer4.CreateXmlRequest inValue = new Api.SoapServer4.CreateXmlRequest();
            inValue.Body = new Api.SoapServer4.CreateXmlRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            Api.SoapServer4.CreateXmlResponse retVal = ((Api.SoapServer4.ProcessingSoap)(this)).CreateXml(inValue);
            return retVal.Body.CreateXmlResult;
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<Api.SoapServer4.CreateXmlResponse> Api.SoapServer4.ProcessingSoap.CreateXmlAsync(Api.SoapServer4.CreateXmlRequest request) {
            return base.Channel.CreateXmlAsync(request);
        }

        public System.Threading.Tasks.Task<Api.SoapServer4.CreateXmlResponse> CreateXmlAsync(string AccessKey, string UserName) {
            Api.SoapServer4.CreateXmlRequest inValue = new Api.SoapServer4.CreateXmlRequest();
            inValue.Body = new Api.SoapServer4.CreateXmlRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            return ((Api.SoapServer4.ProcessingSoap)(this)).CreateXmlAsync(inValue);
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Api.SoapServer4.DownloadInstaPhotosResponse Api.SoapServer4.ProcessingSoap.DownloadInstaPhotos(Api.SoapServer4.DownloadInstaPhotosRequest request) {
            return base.Channel.DownloadInstaPhotos(request);
        }

        public bool DownloadInstaPhotos(string AccessKey, string UserName, Api.SoapServer4.ArrayOfString photos) {
            Api.SoapServer4.DownloadInstaPhotosRequest inValue = new Api.SoapServer4.DownloadInstaPhotosRequest();
            inValue.Body = new Api.SoapServer4.DownloadInstaPhotosRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            inValue.Body.photos = photos;
            Api.SoapServer4.DownloadInstaPhotosResponse retVal = ((Api.SoapServer4.ProcessingSoap)(this)).DownloadInstaPhotos(inValue);
            return retVal.Body.DownloadInstaPhotosResult;
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<Api.SoapServer4.DownloadInstaPhotosResponse> Api.SoapServer4.ProcessingSoap.DownloadInstaPhotosAsync(Api.SoapServer4.DownloadInstaPhotosRequest request) {
            return base.Channel.DownloadInstaPhotosAsync(request);
        }

        public System.Threading.Tasks.Task<Api.SoapServer4.DownloadInstaPhotosResponse> DownloadInstaPhotosAsync(string AccessKey, string UserName, Api.SoapServer4.ArrayOfString photos) {
            Api.SoapServer4.DownloadInstaPhotosRequest inValue = new Api.SoapServer4.DownloadInstaPhotosRequest();
            inValue.Body = new Api.SoapServer4.DownloadInstaPhotosRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            inValue.Body.photos = photos;
            return ((Api.SoapServer4.ProcessingSoap)(this)).DownloadInstaPhotosAsync(inValue);
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Api.SoapServer4.ImageGenerateResponse Api.SoapServer4.ProcessingSoap.ImageGenerate(Api.SoapServer4.ImageGenerateRequest request) {
            return base.Channel.ImageGenerate(request);
        }

        public Api.SoapServer4.NewImagePart ImageGenerate(string AccessKey, string UserName, byte[] ImagePart, int x, int y, int width, int height, int PxFormat) {
            Api.SoapServer4.ImageGenerateRequest inValue = new Api.SoapServer4.ImageGenerateRequest();
            inValue.Body = new Api.SoapServer4.ImageGenerateRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            inValue.Body.ImagePart = ImagePart;
            inValue.Body.x = x;
            inValue.Body.y = y;
            inValue.Body.width = width;
            inValue.Body.height = height;
            inValue.Body.PxFormat = PxFormat;
            Api.SoapServer4.ImageGenerateResponse retVal = ((Api.SoapServer4.ProcessingSoap)(this)).ImageGenerate(inValue);
            return retVal.Body.ImageGenerateResult;
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<Api.SoapServer4.ImageGenerateResponse> Api.SoapServer4.ProcessingSoap.ImageGenerateAsync(Api.SoapServer4.ImageGenerateRequest request) {
            return base.Channel.ImageGenerateAsync(request);
        }

        public System.Threading.Tasks.Task<Api.SoapServer4.ImageGenerateResponse> ImageGenerateAsync(string AccessKey, string UserName, byte[] ImagePart, int x, int y, int width, int height, int PxFormat) {
            Api.SoapServer4.ImageGenerateRequest inValue = new Api.SoapServer4.ImageGenerateRequest();
            inValue.Body = new Api.SoapServer4.ImageGenerateRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            inValue.Body.ImagePart = ImagePart;
            inValue.Body.x = x;
            inValue.Body.y = y;
            inValue.Body.width = width;
            inValue.Body.height = height;
            inValue.Body.PxFormat = PxFormat;
            return ((Api.SoapServer4.ProcessingSoap)(this)).ImageGenerateAsync(inValue);
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Api.SoapServer4.XmlUpdateResponse Api.SoapServer4.ProcessingSoap.XmlUpdate(Api.SoapServer4.XmlUpdateRequest request) {
            return base.Channel.XmlUpdate(request);
        }

        public bool XmlUpdate(string AccessKey, string UserName, string key, int _Value, bool ValueArtir) {
            Api.SoapServer4.XmlUpdateRequest inValue = new Api.SoapServer4.XmlUpdateRequest();
            inValue.Body = new Api.SoapServer4.XmlUpdateRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            inValue.Body.key = key;
            inValue.Body._Value = _Value;
            inValue.Body.ValueArtir = ValueArtir;
            Api.SoapServer4.XmlUpdateResponse retVal = ((Api.SoapServer4.ProcessingSoap)(this)).XmlUpdate(inValue);
            return retVal.Body.XmlUpdateResult;
        }

        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<Api.SoapServer4.XmlUpdateResponse> Api.SoapServer4.ProcessingSoap.XmlUpdateAsync(Api.SoapServer4.XmlUpdateRequest request) {
            return base.Channel.XmlUpdateAsync(request);
        }

        public System.Threading.Tasks.Task<Api.SoapServer4.XmlUpdateResponse> XmlUpdateAsync(string AccessKey, string UserName, string key, int _Value, bool ValueArtir) {
            Api.SoapServer4.XmlUpdateRequest inValue = new Api.SoapServer4.XmlUpdateRequest();
            inValue.Body = new Api.SoapServer4.XmlUpdateRequestBody();
            inValue.Body.AccessKey = AccessKey;
            inValue.Body.UserName = UserName;
            inValue.Body.key = key;
            inValue.Body._Value = _Value;
            inValue.Body.ValueArtir = ValueArtir;
            return ((Api.SoapServer4.ProcessingSoap)(this)).XmlUpdateAsync(inValue);
        }
    }
}


text:
layout: model
title: Mapping ICD-9-CM Codes with Their Corresponding ICD-10-CM Codes
author: John Snow Labs
name: icd9_icd10_mapper
date: 2022-09-30
tags: [en, clinical, chunk_mapping, icd9, icd10, licensed]
task: Chunk Mapping
language: en
edition: Healthcare NLP 4.1.0
spark_version: 3.0
supported: true
annotator: ChunkMapperModel
article_header:
  type: cover
use_language_switcher: "Python-Scala-Java"
---

## Description

This pretrained model maps ICD-9-CM codes to corresponding ICD-10-CM codes

## Predicted Entities

`icd10_code`

{:.btn-box}
<button class="button button-orange" disabled>Live Demo</button>
[Open in Colab](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/Certification_Trainings/Healthcare/26.Chunk_Mapping.ipynb){:.button.button-orange.button-orange-trans.co.button-icon}
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/clinical/models/icd9_icd10_mapper_en_4.1.0_3.0_1664537323845.zip){:.button.button-orange.button-orange-trans.arr.button-icon}

## How to use

<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}
```python
document_assembler = DocumentAssembler()\
      .setInputCol("text")\
      .setOutputCol("doc")

chunk_assembler = Doc2Chunk()\
      .setInputCols(["doc"])\
      .setOutputCol("ner_chunk")

chunkerMapper = ChunkMapperModel\
    .pretrained("icd9_icd10_mapper", "en", "clinical/models")\
    .setInputCols(["ner_chunk"])\
    .setOutputCol("mappings")\
    .setRels(["icd10_code"])

mapper_pipeline = Pipeline(stages=[
    document_assembler,
    chunk_assembler,
    chunkerMapper
])

model = mapper_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))

light_pipeline= LightPipeline(model)

result = light_pipeline.fullAnnotate("00322")
```
```scala
val documentAssembler = new DocumentAssembler()
        .setInputCol("text")
        .setOutputCol("ner_chunk")

val chunk_assembler = new Doc2Chunk()
        .setInputCols(Array("doc"))
        .setOutputCol("ner_chunk")

val chunkerMapper = ChunkMapperModel.pretrained("icd9_icd10_mapper", "en","clinical/models")
        .setInputCols(Array("ner_chunk"))
        .setOutputCol("mappings")
        .setRels(Array("icd10_code"))

val pipeline = new Pipeline(stages = Array(
        documentAssembler,
        chunk_assembler,
        chunkerMapper))

val data = Seq("00322").toDS.toDF("text")

val result= pipeline.fit(data).transform(data)
```
</div>

## Results

```bash
+---------+-------------+
|icd9_code|icd10_mapping|
+---------+-------------+
|00322    |A0222        |
+---------+-------------+
```

{:.model-param}
## Model Information

{:.table-model}
|---|---|
|Model Name:|icd9_icd10_mapper|
|Compatibility:|Healthcare NLP 4.1.0+|
|License:|Licensed|
|Edition:|Official|
|Input Labels:|[ner_chunk]|
|Output Labels:|[mappings]|
|Language:|en|
|Size:|323.6 KB|