text:
import { sanitise, sortByAlpha } from './lib/utils';
import {
  Options,
  ClassNames,
  EventMap,
  ActionType,
  KeyCodeMap,
} from './interfaces';

export const DEFAULT_CLASSNAMES: ClassNames = {
  containerOuter: 'choices',
  containerInner: 'choices__inner',
  input: 'choices__input',
  inputCloned: 'choices__input--cloned',
  list: 'choices__list',
  listItems: 'choices__list--multiple',
  listSingle: 'choices__list--single',
  listDropdown: 'choices__list--dropdown',
  item: 'choices__item',
  itemSelectable: 'choices__item--selectable',
  itemDisabled: 'choices__item--disabled',
  itemChoice: 'choices__item--choice',
  placeholder: 'choices__placeholder',
  group: 'choices__group',
  groupHeading: 'choices__heading',
  button: 'choices__button',
  activeState: 'is-active',
  focusState: 'is-focused',
  openState: 'is-open',
  disabledState: 'is-disabled',
  highlightedState: 'is-highlighted',
  selectedState: 'is-selected',
  flippedState: 'is-flipped',
  loadingState: 'is-loading',
  noResults: 'has-no-results',
  noChoices: 'has-no-choices',
};

export const DEFAULT_CONFIG: Options = {
  items: [],
  choices: [],
  silent: false,
  renderChoiceLimit: -1,
  maxItemCount: -1,
  addItems: true,
  addItemFilter: null,
  removeItems: true,
  removeItemButton: false,
  editItems: false,
  duplicateItemsAllowed: true,
  delimiter: ',',
  paste: true,
  searchEnabled: true,
  searchChoices: true,
  searchFloor: 1,
  searchResultLimit: 4,
  searchFields: ['label', 'value'],
  position: 'auto',
  resetScrollPosition: true,
  shouldSort: true,
  shouldSortItems: false,
  sorter: sortByAlpha,
  placeholder: true,
  placeholderValue: null,
  searchPlaceholderValue: null,
  prependValue: null,
  appendValue: null,
  renderSelectedChoices: 'auto',
  loadingText: 'Loading...',
  noResultsText: 'No results found',
  noChoicesText: 'No choices to choose from',
  itemSelectText: 'Press to select',
  uniqueItemText: 'Only unique values can be added',
  customAddItemText: 'Only values matching specific conditions can be added',
  addItemText: value => `Press Enter to add <b>"${sanitise(value)}"</b>`,
  maxItemText: maxItemCount => `Only ${maxItemCount} values can be added`,
  valueComparer: (value1, value2) => value1 === value2,
  fuseOptions: {
    includeScore: true,
  },
  callbackOnInit: null,
  callbackOnCreateTemplates: null,
  classNames: DEFAULT_CLASSNAMES,
};

export const EVENTS: Record<keyof EventMap, keyof EventMap> = {
  showDropdown: 'showDropdown',
  hideDropdown: 'hideDropdown',
  change: 'change',
  choice: 'choice',
  search: 'search',
  addItem: 'addItem',
  removeItem: 'removeItem',
  highlightItem: 'highlightItem',
  highlightChoice: 'highlightChoice',
  unhighlightItem: 'unhighlightItem',
};

export const ACTION_TYPES: Record<ActionType, ActionType> = {
  ADD_CHOICE: 'ADD_CHOICE',
  FILTER_CHOICES: 'FILTER_CHOICES',
  ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',
  CLEAR_CHOICES: 'CLEAR_CHOICES',
  ADD_GROUP: 'ADD_GROUP',
  ADD_ITEM: 'ADD_ITEM',
  REMOVE_ITEM: 'REMOVE_ITEM',
  HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',
  CLEAR_ALL: 'CLEAR_ALL',
  RESET_TO: 'RESET_TO',
  SET_IS_LOADING: 'SET_IS_LOADING',
};

export const KEY_CODES: KeyCodeMap = {
  BACK_KEY: 46,
  DELETE_KEY: 8,
  ENTER_KEY: 13,
  A_KEY: 65,
  ESC_KEY: 27,
  UP_KEY: 38,
  DOWN_KEY: 40,
  PAGE_UP_KEY: 33,
  PAGE_DOWN_KEY: 34,
};

export const TEXT_TYPE: HTMLInputElement['type'] = 'text';
export const SELECT_ONE_TYPE: HTMLSelectElement['type'] = 'select-one';
export const SELECT_MULTIPLE_TYPE: HTMLSelectElement['type'] =
  'select-multiple';

export const SCROLLING_SPEED = 4;


text:
package ninja.websockets.jsr356;

import javax.websocket.CloseReason;
import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
import javax.websocket.Session;

/**
 * A valid JSR-356 endpoint that extracts out the real target endpoint from
 * the handshake stored as the UserPrincipal of the WebSocket session.
 *
 * @author jjlauer
 */
public class Jsr356DelegatingEndpoint extends Endpoint {

    private Jsr356Handshake handshake;

    public void verify(Session session) {
        if (this.handshake == null) {
            this.handshake = Jsr356HandshakePrincipal.unwrapHandshake(session)
                .orElse(null);
        }
        if (this.handshake == null) {
            throw new IllegalStateException("No websocket handshake exists. Something appears "
                + "to be broken in how your HTTP container handles websocket handshakes.");
        }
        if (this.handshake.getEndpoint() == null) {
            throw new IllegalStateException("No websocket endpoint exists to delegate to."
                + " An endpoint must have either not been created in Ninja or "
                + " your HTTP container failed to pass along the value during the websocket handshake process.");
        }
    }

    @Override
    public void onOpen(Session session, EndpointConfig config) {
        this.verify(session);
        this.handshake.getEndpoint().onOpen(session, config);
    }

    @Override
    public void onError(Session session, Throwable cause) {
        this.verify(session);
        this.handshake.getEndpoint().onError(session, cause);
    }

    @Override
    public void onClose(Session session, CloseReason close) {
        this.verify(session);
        this.handshake.getEndpoint().onClose(session, close);
    }

}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.samza.system.eventhub;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.microsoft.azure.eventhubs.EventHubClient;
import com.microsoft.azure.eventhubs.impl.ClientConstants;
import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
import com.microsoft.azure.eventhubs.impl.RetryExponential;
import com.microsoft.azure.eventhubs.RetryPolicy;
import com.microsoft.azure.eventhubs.EventHubException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.samza.SamzaException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

public class SamzaEventHubClientManager implements EventHubClientManager {
  private static final Logger LOG = LoggerFactory.getLogger(SamzaEventHubClientManager.class.getName());

  private static final String EVENTHUB_REMOTE_HOST_FORMAT = "%s.servicebus.windows.net";

  private static final Duration MIN_RETRY_BACKOFF = Duration.ofMillis(100);
  private static final Duration MAX_RETRY_BACKOFF = Duration.ofMillis(11000);
  private static final int MAX_RETRY_COUNT = 100;
  private static final String SAMZA_EVENTHUB_RETRY = "SAMZA_CONNECTOR_RETRY";
  private final int numClientThreads;

  private EventHubClient eventHubClient;

  private final String eventHubNamespace;
  private final String entityPath;
  private final String sasKeyName;
  private final String sasKey;
  private final RetryPolicy retryPolicy;
  private ExecutorService eventHubClientExecutor;

  public SamzaEventHubClientManager(String eventHubNamespace, String entityPath, String sasKeyName, String sasKey,
      Integer numClientThreads) {
    this(eventHubNamespace, entityPath, sasKeyName, sasKey,
            new RetryExponential(MIN_RETRY_BACKOFF, MAX_RETRY_BACKOFF, MAX_RETRY_COUNT, SAMZA_EVENTHUB_RETRY), numClientThreads);
  }

  public SamzaEventHubClientManager(String eventHubNamespace, String entityPath, String sasKeyName, String sasKey,
                                    RetryPolicy retryPolicy, int numClientThreads) {
    this.eventHubNamespace = eventHubNamespace;
    this.entityPath = entityPath;
    this.sasKeyName = sasKeyName;
    this.sasKey = sasKey;
    this.retryPolicy = retryPolicy;
    this.numClientThreads = numClientThreads;
  }

  @Override
  public void init() {
    String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace);
    LOG.info("Initializing SamzaEventHubClientManager for namespace: " + eventHubNamespace);
    try {
      ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder()
          .setNamespaceName(eventHubNamespace)
          .setEventHubName(entityPath)
          .setSasKeyName(sasKeyName)
          .setSasKey(sasKey);

      ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder().setNameFormat("Samza EventHubClient Thread-%d");
      eventHubClientExecutor = Executors.newFixedThreadPool(numClientThreads, threadFactoryBuilder.build());
      eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, eventHubClientExecutor);
    } catch (IOException | EventHubException e) {
      String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d",
              entityPath, remoteHost, ClientConstants.AMQPS_PORT);
      LOG.error(msg, e);
      throw new SamzaException(msg, e);
    }
    LOG.info("SamzaEventHubClientManager initialized for namespace: " + eventHubNamespace);
  }

  @Override
  public EventHubClient getEventHubClient() {
    return eventHubClient;
  }

  @Override
  public void close(long timeoutMS) {
    try {
      if (timeoutMS == EventHubClientManager.BLOCK_UNTIL_CLOSE) {
        eventHubClient.closeSync();
        eventHubClientExecutor.shutdown();
      } else {
        CompletableFuture<Void> future = eventHubClient.close();
        future.get(timeoutMS, TimeUnit.MILLISECONDS);
      }
    } catch (Exception e) {
      LOG.error("Closing the EventHub client failed", e);
    }
  }

}


text:
#include "ContainerChunk.h"

class CLtcdChunk : public CContainerChunk
{

};


text:
package com.deblox.docker.services;

import com.deblox.Config;
import com.deblox.docker.DebloxLogger;
import com.deblox.services.TransponderServiceConfig;
import org.vertx.java.busmods.BusModBase;
import org.vertx.java.core.AsyncResult;
import org.vertx.java.core.Handler;
import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.eventbus.EventBus;
import org.vertx.java.core.eventbus.Message;
import org.vertx.java.core.http.HttpServer;
import org.vertx.java.core.http.HttpServerRequest;
import org.vertx.java.core.http.RouteMatcher;
import org.vertx.java.core.json.DecodeException;
import org.vertx.java.core.json.JsonObject;

import javax.naming.ConfigurationException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Set;

/* A simple REST wrapper to the eventbus
 *
 * This HTTP service accepts json POST's and forwards most of those requests on to the dockermod cluster address.
 *
 * Messages that contain a id re-addressed to the specific topic for that container instance. 1
 *
 */

public class DockerHttpService extends BusModBase {
    private int SERVER_PORT;
    private DebloxLogger logger;
    protected EventBus eventBus;
    private RouteMatcher routeMatcher;
    protected JsonObject message = new JsonObject();

    private String clusterAddress;
    private String localAddress;
    private String hostname;
    private long taskTimeout;

    private DockerHttpServiceConfig config;
    private DockerServiceConfig dockerServiceConfig;
    private TransponderServiceConfig transponderServiceConfig;

    private Set<String> nodes;

    @Override
    public void start() {
        super.start();
        logger = new DebloxLogger("DockerHttpService");
        logger.info("starting up...");
        eventBus = vertx.eventBus();
        routeMatcher = new RouteMatcher();

        try {
            dockerServiceConfig = new DockerServiceConfig(Config.getAppConfig(container.config(), "DockerService"));
            transponderServiceConfig = new TransponderServiceConfig(Config.getAppConfig(container.config(), "TransponderService"));
            config = new DockerHttpServiceConfig(Config.getAppConfig(container.config(), this.getClass().getSimpleName()));
        } catch (ConfigurationException e) {
            e.printStackTrace();
        }

        // where we access info about the cluster  nodes
        nodes = vertx.sharedData().getSet(transponderServiceConfig.getNodeSetName());

        // Figure out the hostname so we can subscribe to the private QUEUE for this instance!
        try {
            hostname = getOptionalStringConfig("hostname", InetAddress.getLocalHost().getHostName());
            logger.info("hostname: " + hostname);
        } catch (UnknownHostException e) {
            logger.warning("unable to determine hostname, this is bad! either pass a config param for Hostname or fix getHostName method to support this OS");
            e.printStackTrace();
            super.stop();
        }

        // where to find the docker service on the cluster
        clusterAddress = transponderServiceConfig.getAddress() + "." + dockerServiceConfig.address;
        localAddress = clusterAddress + "." + hostname;
        SERVER_PORT = config.listenPort;
        taskTimeout = config.taskTimeout;
        logger.info("listening on port " + SERVER_PORT);

        routeMatcher.post("/", new Handler<HttpServerRequest>() {
            public void handle(final HttpServerRequest req) {
                req.bodyHandler(new Handler<Buffer>() {
                    @Override
                    public void handle(Buffer event) {

                        JsonObject document = new JsonObject();

                        try {
                            document = new JsonObject(event.toString());
                        } catch (DecodeException e) {
                            req.response().end(new JsonObject().putString("error", "bad json in request").toString());
                        }
                        String address = clusterAddress;

                        // if an id is in the request, direct the call to it
                        if (document.getString("id", null) != null) {
                            logger.info("setting queue to instance ID: " + document.getString("id"));
                            address = document.getString("id");
                        } else if (document.getString("action").equals("list-containers")) {
                            logger.info("list containers needs to go only to this node");
                            address = clusterAddress + "." + hostname;
                        }

                        logger.info("got rest request " + document.toString());
                        logger.info("forwarding request to cluster address: " + address + " with timeout: " + taskTimeout);

                        eventBus.sendWithTimeout(address, document, taskTimeout, new Handler<AsyncResult<Message<JsonObject>>>() {
                            public void handle(AsyncResult<Message<JsonObject>> message) {

                                if (message.succeeded()) {
                                    logger.info("got response from eventbus: " + message.result().body().toString());
                                    if (message.result().body().getString("status") != "error") {
                                        logger.info("got response");
                                        req.response().end(message.result().body().toString());
                                    } else {
                                        logger.warning("error in eventbus response");
                                        req.response().end(message.result().body().toString());
                                    }
                                } else {
                                    logger.warning("timeout on eventbus");
                                    req.response().end(new JsonObject().putString("status", "timeout or no such id").toString());
                                }

                            }
                        });
                    }
                });
            }
        });

        routeMatcher.get("/monitor", new Handler<HttpServerRequest>() {

            JsonObject jr = new JsonObject().putString("action", "monitor");

            public void handle(final HttpServerRequest request) {
                eventBus.sendWithTimeout(clusterAddress, jr, taskTimeout, new Handler<AsyncResult<Message<JsonObject>>>() {
                    @Override
                    public void handle(AsyncResult<Message<JsonObject>> event) {
                        if (event.succeeded()) {
                            request.response().end(event.result().body().toString());
                        } else {
                            logger.warning("timeout on eventbus");
                            request.response().end(new JsonObject().putString("status", "timeout or failure talking to eventbus").toString());
                        }
                    }
                });
            }
        });

        // BUILD should go here, since we need a TAR out of the message body. tar should then be packaged into a json object and sent along to the cluster for processing
//        routeMatcher.post("/build")

        routeMatcher.get("/", new Handler<HttpServerRequest>() {
            public void handle(final HttpServerRequest req) {
                logger.info("works on POST requests, there is no reason to GET this URL");
                req.response().end("DockerMod HttpService");
            }
        });

        HttpServer server = vertx.createHttpServer().requestHandler(routeMatcher).setAcceptBacklog(50000).listen(SERVER_PORT);

    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>mne.viz.plot_dipole_locations — MNE 0.16.1 documentation</title>
    <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/gallery.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />

    <link rel="stylesheet" href="../_static/style.css " type="text/css" />
    <link rel="stylesheet" href="../_static/font-awesome.css" type="text/css" />
    <link rel="stylesheet" href="../_static/flag-icon.css" type="text/css" />

  <link rel="canonical" href="https://mne.tools/stable/index.html" />

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

        0.16.1

Install

Documentation

API

Examples

Contribute

  Site

  <button type="button" class="btn btn-primary navbar-btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
    v0.16.1

  </button>

Development

v0.16 (stable)

v0.15

v0.14

v0.13

v0.12

v0.11

<form class="navbar-form navbar-right" action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.viz.plot_dipole_locations

Examples using mne.viz.plot_dipole_locations

<form action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.viz.plot_dipole_locations¶

mne.viz.plot_dipole_locations(dipoles, trans, subject, subjects_dir=None, mode='orthoview', coord_frame='mri', idx='gof', show_all=True, ax=None, block=False, show=True, verbose=None)[source]¶

Plot dipole locations.

If mode is set to 'cone' or 'sphere', only the location of the first
time point of each dipole is shown else use the show_all parameter.

The option mode='orthoview' was added in version 0.14.

<col class="field-name" />
<col class="field-body" />

Parameters:

dipoles : list of instances of Dipole | Dipole

The dipoles to plot.

trans : dict

The mri to head trans.

subject : str

The subject name corresponding to FreeSurfer environment
variable SUBJECT.

subjects_dir : None | str

The path to the freesurfer subjects reconstructions.
It corresponds to Freesurfer environment variable SUBJECTS_DIR.
The default is None.

mode : str

Currently only 'orthoview' is supported.

New in version 0.14.0.

coord_frame : str

Coordinate frame to use, 'head' or 'mri'. Defaults to 'mri'.

New in version 0.14.0.

idx : int | 'gof' | 'amplitude'

Index of the initially plotted dipole. Can also be 'gof' to plot the
dipole with highest goodness of fit value or 'amplitude' to plot the
dipole with the highest amplitude. The dipoles can also be browsed
through using up/down arrow keys or mouse scroll. Defaults to 'gof'.
Only used if mode equals 'orthoview'.

New in version 0.14.0.

show_all : bool

Whether to always plot all the dipoles. If True (default), the active
dipole is plotted as a red dot and it's location determines the shown
MRI slices. The the non-active dipoles are plotted as small blue dots.
If False, only the active dipole is plotted.
Only used if mode equals 'orthoview'.

New in version 0.14.0.

ax : instance of matplotlib Axes3D | None

Axes to plot into. If None (default), axes will be created.
Only used if mode equals 'orthoview'.

New in version 0.14.0.

block : bool

Whether to halt program execution until the figure is closed. Defaults
to False.
Only used if mode equals 'orthoview'.

New in version 0.14.0.

show : bool

Show figure if True. Defaults to True.
Only used if mode equals 'orthoview'.

New in version 0.14.0.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose()
and Logging documentation for more).

Returns:

fig : instance of mlab.Figure or matplotlib Figure

The mayavi figure or matplotlib Figure.

Notes

New in version 0.9.0.

Examples using mne.viz.plot_dipole_locations¶

Compute Rap-Music on evoked data

Compute a sparse inverse solution using the Gamma-Map empirical Bayesian method

Compute sparse inverse solution with mixed norm: MxNE and irMxNE

Compute MxNE with time-frequency sparse prior

GitHub

·

Mailing list

·

Gitter

·

What's new

·

Cite MNE

Back to top

© Copyright 2012-2018, MNE Developers. Last updated on 2018-06-24.


text:
<?php
/**
 * A date value in ISO 8601 date format.
 *
 * @see    http://schema.org/Date
*/
abstract class TypeDate extends TypeDataType
{
	/**
	 * The Schema.org Type Scope
	 *
	 * @var string
	 */
	protected static $scope = 'https://schema.org/Date';
}


text:
/* ****************************************************************
 ******************************************************************
 ******************************************************************
 *** COPYRIGHT (c) Eastman Kodak Company, 1997
 *** As  an unpublished  work pursuant to Title 17 of the United
 *** States Code.  All rights reserved.
 ******************************************************************
 ******************************************************************
 ******************************************************************/

package java.awt.image;
import java.awt.Rectangle;
import java.awt.Point;

/**
 * This class extends Raster to provide pixel writing capabilities.
 * Refer to the class comment for Raster for descriptions of how
 * a Raster stores pixels.
 *
 *
 The constructors of this class are protected.  To instantiate
 * a WritableRaster, use one of the createWritableRaster factory methods
 * in the Raster class.
 */
public class WritableRaster extends Raster {

    /**
     *  Constructs a WritableRaster with the given SampleModel.  The
     *  WritableRaster's upper left corner is origin and it is the
     *  same size as the  SampleModel.  A DataBuffer large enough to
     *  describe the WritableRaster is automatically created.
     *  @param sampleModel     The SampleModel that specifies the layout.
     *  @param origin          The Point that specifies the origin.
     *  @throws RasterFormatException if computing either
     *          origin.x + sampleModel.getWidth() or
     *          origin.y + sampleModel.getHeight() results
     *          in integer overflow
     */
    protected WritableRaster(SampleModel sampleModel,
                             Point origin) {
        this(sampleModel,
             sampleModel.createDataBuffer(),
             new Rectangle(origin.x,
                           origin.y,
                           sampleModel.getWidth(),
                           sampleModel.getHeight()),
             origin,
             null);
    }

    /**
     *  Constructs a WritableRaster with the given SampleModel and DataBuffer.
     *  The WritableRaster's upper left corner is origin and it is the same
     *  size as the SampleModel.  The DataBuffer is not initialized and must
     *  be compatible with SampleModel.
     *  @param sampleModel     The SampleModel that specifies the layout.
     *  @param dataBuffer      The DataBuffer that contains the image data.
     *  @param origin          The Point that specifies the origin.
     *  @throws RasterFormatException if computing either
     *          origin.x + sampleModel.getWidth() or
     *          origin.y + sampleModel.getHeight() results
     *          in integer overflow
     */
    protected WritableRaster(SampleModel sampleModel,
                             DataBuffer dataBuffer,
                             Point origin) {
        this(sampleModel,
             dataBuffer,
             new Rectangle(origin.x,
                           origin.y,
                           sampleModel.getWidth(),
                           sampleModel.getHeight()),
             origin,
             null);
    }

    /**
     * Constructs a WritableRaster with the given SampleModel, DataBuffer,
     * and parent.  aRegion specifies the bounding rectangle of the new
     * Raster.  When translated into the base Raster's coordinate
     * system, aRegion must be contained by the base Raster.
     * (The base Raster is the Raster's ancestor which has no parent.)
     * sampleModelTranslate specifies the sampleModelTranslateX and
     * sampleModelTranslateY values of the new Raster.
     *
     * Note that this constructor should generally be called by other
     * constructors or create methods, it should not be used directly.
     * @param sampleModel     The SampleModel that specifies the layout.
     * @param dataBuffer      The DataBuffer that contains the image data.
     * @param aRegion         The Rectangle that specifies the image area.
     * @param sampleModelTranslate  The Point that specifies the translation
     *                        from SampleModel to Raster coordinates.
     * @param parent          The parent (if any) of this raster.
     * @throws RasterFormatException if aRegion has width
     *         or height less than or equal to zero, or computing either
     *         aRegion.x + aRegion.width or
     *         aRegion.y + aRegion.height results in integer
     *         overflow
     */
    protected WritableRaster(SampleModel sampleModel,
                             DataBuffer dataBuffer,
                             Rectangle aRegion,
                             Point sampleModelTranslate,
                             WritableRaster parent){
        super(sampleModel,dataBuffer,aRegion,sampleModelTranslate,parent);
    }

    /** Returns the parent WritableRaster (if any) of this WritableRaster,
     *  or else null.
     *  @return the parent of this WritableRaster, or
     *          null.
     */
    public WritableRaster getWritableParent() {
        return (WritableRaster)parent;
    }

    /**
     * Create a WritableRaster with the same size, SampleModel and DataBuffer
     * as this one, but with a different location.  The new WritableRaster
     * will possess a reference to the current WritableRaster, accessible
     * through its getParent() and getWritableParent() methods.
     *
     * @param childMinX X coord of the upper left corner of the new Raster.
     * @param childMinY Y coord of the upper left corner of the new Raster.
     * @return a WritableRaster the same as this one except
     *         for the specified location.
     * @throws RasterFormatException if  computing either
     *         childMinX + this.getWidth() or
     *         childMinY + this.getHeight() results in integer
     *         overflow
     */
    public WritableRaster createWritableTranslatedChild(int childMinX,
                                                        int childMinY) {
        return createWritableChild(minX,minY,width,height,
                                   childMinX,childMinY,null);
    }

    /**
     * Returns a new WritableRaster which shares all or part of this
     * WritableRaster's DataBuffer.  The new WritableRaster will
     * possess a reference to the current WritableRaster, accessible
     * through its getParent() and getWritableParent() methods.
     *
     *
 The parentX, parentY, width and height parameters form a
     * Rectangle in this WritableRaster's coordinate space, indicating
     * the area of pixels to be shared.  An error will be thrown if
     * this Rectangle is not contained with the bounds of the current
     * WritableRaster.
     *
     *
 The new WritableRaster may additionally be translated to a
     * different coordinate system for the plane than that used by the current
     * WritableRaster.  The childMinX and childMinY parameters give
     * the new (x, y) coordinate of the upper-left pixel of the
     * returned WritableRaster; the coordinate (childMinX, childMinY)
     * in the new WritableRaster will map to the same pixel as the
     * coordinate (parentX, parentY) in the current WritableRaster.
     *
     *
 The new WritableRaster may be defined to contain only a
     * subset of the bands of the current WritableRaster, possibly
     * reordered, by means of the bandList parameter.  If bandList is
     * null, it is taken to include all of the bands of the current
     * WritableRaster in their current order.
     *
     *
 To create a new WritableRaster that contains a subregion of
     * the current WritableRaster, but shares its coordinate system
     * and bands, this method should be called with childMinX equal to
     * parentX, childMinY equal to parentY, and bandList equal to
     * null.
     *
     * @param parentX    X coordinate of the upper left corner in this
     *                   WritableRaster's coordinates.
     * @param parentY    Y coordinate of the upper left corner in this
     *                   WritableRaster's coordinates.
     * @param w          Width of the region starting at (parentX, parentY).
     * @param h          Height of the region starting at (parentX, parentY).
     * @param childMinX  X coordinate of the upper left corner of
     *                   the returned WritableRaster.
     * @param childMinY  Y coordinate of the upper left corner of
     *                   the returned WritableRaster.
     * @param bandList   Array of band indices, or null to use all bands.
     * @return a WritableRaster sharing all or part of the
     *         DataBuffer of this WritableRaster.
     * @exception RasterFormatException if the subregion is outside of the
     *                               raster bounds.
     * @throws RasterFormatException if w or
     *         h
     *         is less than or equal to zero, or computing any of
     *         parentX + w, parentY + h,
     *         childMinX + w, or
     *         childMinY + h results in integer
     *         overflow
     */
    public WritableRaster createWritableChild(int parentX, int parentY,
                                              int w, int h,
                                              int childMinX, int childMinY,
                                              int bandList[]) {
        if (parentX < this.minX) {
            throw new RasterFormatException("parentX lies outside raster");
        }
        if (parentY < this.minY) {
            throw new RasterFormatException("parentY lies outside raster");
        }
        if ((parentX+w < parentX) || (parentX+w > this.width + this.minX)) {
            throw new RasterFormatException("(parentX + width) is outside raster");
        }
        if ((parentY+h < parentY) || (parentY+h > this.height + this.minY)) {
            throw new RasterFormatException("(parentY + height) is outside raster");
        }

        SampleModel sm;
        // Note: the SampleModel for the child Raster should have the same
        // width and height as that for the parent, since it represents
        // the physical layout of the pixel data.  The child Raster's width
        // and height represent a "virtual" view of the pixel data, so
        // they may be different than those of the SampleModel.
        if (bandList != null) {
            sm = sampleModel.createSubsetSampleModel(bandList);
        }
        else {
            sm = sampleModel;
        }

        int deltaX = childMinX - parentX;
        int deltaY = childMinY - parentY;

        return new WritableRaster(sm,
                                  getDataBuffer(),
                                  new Rectangle(childMinX,childMinY,
                                                w, h),
                                  new Point(sampleModelTranslateX+deltaX,
                                            sampleModelTranslateY+deltaY),
                                  this);
    }

    /**
     * Sets the data for a single pixel from a
     * primitive array of type TransferType.  For image data supported by
     * the Java 2D(tm) API, this will be one of DataBuffer.TYPE_BYTE,
     * DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT,
     * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE.  Data in the array
     * may be in a packed format, thus increasing efficiency for data
     * transfers.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds, or if inData is not large enough to hold the pixel data.
     * However, explicit bounds checking is not guaranteed.
     * A ClassCastException will be thrown if the input object is not null
     * and references anything other than an array of TransferType.
     * @see java.awt.image.SampleModel#setDataElements(int, int, Object, DataBuffer)
     * @param x        The X coordinate of the pixel location.
     * @param y        The Y coordinate of the pixel location.
     * @param inData   An object reference to an array of type defined by
     *                 getTransferType() and length getNumDataElements()
     *                 containing the pixel data to place at x,y.
     *
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if inData is too small to hold the input.
     */
    public void setDataElements(int x, int y, Object inData) {
        sampleModel.setDataElements(x-sampleModelTranslateX,
                                    y-sampleModelTranslateY,
                                    inData, dataBuffer);
    }

    /**
     * Sets the data for a rectangle of pixels from an input Raster.
     * The input Raster must be compatible with this WritableRaster
     * in that they must have the same number of bands, corresponding bands
     * must have the same number of bits per sample, the TransferTypes
     * and NumDataElements must be the same, and the packing used by
     * the getDataElements/setDataElements must be identical.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the pixel location.
     * @param y        The Y coordinate of the pixel location.
     * @param inRaster Raster containing data to place at x,y.
     *
     * @throws NullPointerException if inRaster is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds.
     */
    public void setDataElements(int x, int y, Raster inRaster) {
        int dstOffX = x+inRaster.getMinX();
        int dstOffY = y+inRaster.getMinY();
        int width  = inRaster.getWidth();
        int height = inRaster.getHeight();
        if ((dstOffX < this.minX) || (dstOffY < this.minY) ||
            (dstOffX + width > this.minX + this.width) ||
            (dstOffY + height > this.minY + this.height)) {
            throw new ArrayIndexOutOfBoundsException
                ("Coordinate out of bounds!");
        }

        int srcOffX = inRaster.getMinX();
        int srcOffY = inRaster.getMinY();
        Object tdata = null;

        for (int startY=0; startY < height; startY++) {
            tdata = inRaster.getDataElements(srcOffX, srcOffY+startY,
                                             width, 1, tdata);
            setDataElements(dstOffX, dstOffY+startY,
                            width, 1, tdata);
        }
    }

    /**
     * Sets the data for a rectangle of pixels from a
     * primitive array of type TransferType.  For image data supported by
     * the Java 2D API, this will be one of DataBuffer.TYPE_BYTE,
     * DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT,
     * DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE.  Data in the array
     * may be in a packed format, thus increasing efficiency for data
     * transfers.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds, or if inData is not large enough to hold the pixel data.
     * However, explicit bounds checking is not guaranteed.
     * A ClassCastException will be thrown if the input object is not null
     * and references anything other than an array of TransferType.
     * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, Object, DataBuffer)
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param inData   An object reference to an array of type defined by
     *                 getTransferType() and length w*h*getNumDataElements()
     *                 containing the pixel data to place between x,y and
     *                 x+w-1, y+h-1.
     *
     * @throws NullPointerException if inData is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if inData is too small to hold the input.
     */
    public void setDataElements(int x, int y, int w, int h, Object inData) {
        sampleModel.setDataElements(x-sampleModelTranslateX,
                                    y-sampleModelTranslateY,
                                    w,h,inData,dataBuffer);
    }

    /**
     * Copies pixels from Raster srcRaster to this WritableRaster.  Each pixel
     * in srcRaster is copied to the same x,y address in this raster, unless
     * the address falls outside the bounds of this raster.  srcRaster
     * must have the same number of bands as this WritableRaster.  The
     * copy is a simple copy of source samples to the corresponding destination
     * samples.
     *

     * If all samples of both source and destination Rasters are of
     * integral type and less than or equal to 32 bits in size, then calling
     * this method is equivalent to executing the following code for all
     * x,y addresses valid in both Rasters.
     *

     *       Raster srcRaster;
     *       WritableRaster dstRaster;
     *       for (int b = 0; b < srcRaster.getNumBands(); b++) {
     *           dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b));
     *       }
     *

     * Thus, when copying an integral type source to an integral type
     * destination, if the source sample size is greater than the destination
     * sample size for a particular band, the high order bits of the source
     * sample are truncated.  If the source sample size is less than the
     * destination size for a particular band, the high order bits of the
     * destination are zero-extended or sign-extended depending on whether
     * srcRaster's SampleModel treats the sample as a signed or unsigned
     * quantity.
     *

     * When copying a float or double source to an integral type destination,
     * each source sample is cast to the destination type.  When copying an
     * integral type source to a float or double destination, the source
     * is first converted to a 32-bit int (if necessary), using the above
     * rules for integral types, and then the int is cast to float or
     * double.
     *

     * @param srcRaster  The  Raster from which to copy pixels.
     *
     * @throws NullPointerException if srcRaster is null.
     */
    public void setRect(Raster srcRaster) {
        setRect(0,0,srcRaster);
    }

    /**
     * Copies pixels from Raster srcRaster to this WritableRaster.
     * For each (x, y) address in srcRaster, the corresponding pixel
     * is copied to address (x+dx, y+dy) in this WritableRaster,
     * unless (x+dx, y+dy) falls outside the bounds of this raster.
     * srcRaster must have the same number of bands as this WritableRaster.
     * The copy is a simple copy of source samples to the corresponding
     * destination samples.  For details, see
     * {@link WritableRaster#setRect(Raster)}.
     *
     * @param dx        The X translation factor from src space to dst space
     *                  of the copy.
     * @param dy        The Y translation factor from src space to dst space
     *                  of the copy.
     * @param srcRaster The Raster from which to copy pixels.
     *
     * @throws NullPointerException if srcRaster is null.
     */
    public void setRect(int dx, int dy, Raster srcRaster) {
        int width  = srcRaster.getWidth();
        int height = srcRaster.getHeight();
        int srcOffX = srcRaster.getMinX();
        int srcOffY = srcRaster.getMinY();
        int dstOffX = dx+srcOffX;
        int dstOffY = dy+srcOffY;

        // Clip to this raster
        if (dstOffX < this.minX) {
            int skipX = this.minX - dstOffX;
            width -= skipX;
            srcOffX += skipX;
            dstOffX = this.minX;
        }
        if (dstOffY < this.minY) {
            int skipY = this.minY - dstOffY;
            height -= skipY;
            srcOffY += skipY;
            dstOffY = this.minY;
        }
        if (dstOffX+width > this.minX+this.width) {
            width = this.minX + this.width - dstOffX;
        }
        if (dstOffY+height > this.minY+this.height) {
            height = this.minY + this.height - dstOffY;
        }

        if (width <= 0 || height <= 0) {
            return;
        }

        switch (srcRaster.getSampleModel().getDataType()) {
        case DataBuffer.TYPE_BYTE:
        case DataBuffer.TYPE_SHORT:
        case DataBuffer.TYPE_USHORT:
        case DataBuffer.TYPE_INT:
            int[] iData = null;
            for (int startY=0; startY < height; startY++) {
                // Grab one scanline at a time
                iData =
                    srcRaster.getPixels(srcOffX, srcOffY+startY, width, 1,
                                        iData);
                setPixels(dstOffX, dstOffY+startY, width, 1, iData);
            }
            break;

        case DataBuffer.TYPE_FLOAT:
            float[] fData = null;
            for (int startY=0; startY < height; startY++) {
                fData =
                    srcRaster.getPixels(srcOffX, srcOffY+startY, width, 1,
                                        fData);
                setPixels(dstOffX, dstOffY+startY, width, 1, fData);
            }
            break;

        case DataBuffer.TYPE_DOUBLE:
            double[] dData = null;
            for (int startY=0; startY < height; startY++) {
                // Grab one scanline at a time
                dData =
                    srcRaster.getPixels(srcOffX, srcOffY+startY, width, 1,
                                        dData);
                setPixels(dstOffX, dstOffY+startY, width, 1, dData);
            }
            break;
        }
    }

    /**
     * Sets a pixel in the DataBuffer using an int array of samples for input.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x      The X coordinate of the pixel location.
     * @param y      The Y coordinate of the pixel location.
     * @param iArray The input samples in a int array.
     *
     * @throws NullPointerException if iArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if iArray is too small to hold the input.
     */
    public void setPixel(int x, int y, int iArray[]) {
        sampleModel.setPixel(x-sampleModelTranslateX,y-sampleModelTranslateY,
                             iArray,dataBuffer);
    }

    /**
     * Sets a pixel in the DataBuffer using a float array of samples for input.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x      The X coordinate of the pixel location.
     * @param y      The Y coordinate of the pixel location.
     * @param fArray The input samples in a float array.
     *
     * @throws NullPointerException if fArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if fArray is too small to hold the input.
     */
    public void setPixel(int x, int y, float fArray[]) {
        sampleModel.setPixel(x-sampleModelTranslateX,y-sampleModelTranslateY,
                             fArray,dataBuffer);
    }

    /**
     * Sets a pixel in the DataBuffer using a double array of samples for input.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x      The X coordinate of the pixel location.
     * @param y      The Y coordinate of the pixel location.
     * @param dArray The input samples in a double array.
     *
     * @throws NullPointerException if dArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if dArray is too small to hold the input.
     */
    public void setPixel(int x, int y, double dArray[]) {
        sampleModel.setPixel(x-sampleModelTranslateX,y-sampleModelTranslateY,
                             dArray,dataBuffer);
    }

    /**
     * Sets all samples for a rectangle of pixels from an int array containing
     * one sample per array element.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param iArray   The input int pixel array.
     *
     * @throws NullPointerException if iArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if iArray is too small to hold the input.
     */
    public void setPixels(int x, int y, int w, int h, int iArray[]) {
        sampleModel.setPixels(x-sampleModelTranslateX,y-sampleModelTranslateY,
                              w,h,iArray,dataBuffer);
    }

    /**
     * Sets all samples for a rectangle of pixels from a float array containing
     * one sample per array element.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param fArray   The input float pixel array.
     *
     * @throws NullPointerException if fArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if fArray is too small to hold the input.
     */
    public void setPixels(int x, int y, int w, int h, float fArray[]) {
        sampleModel.setPixels(x-sampleModelTranslateX,y-sampleModelTranslateY,
                              w,h,fArray,dataBuffer);
    }

    /**
     * Sets all samples for a rectangle of pixels from a double array containing
     * one sample per array element.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param dArray   The input double pixel array.
     *
     * @throws NullPointerException if dArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates are not
     * in bounds, or if dArray is too small to hold the input.
     */
    public void setPixels(int x, int y, int w, int h, double dArray[]) {
        sampleModel.setPixels(x-sampleModelTranslateX,y-sampleModelTranslateY,
                              w,h,dArray,dataBuffer);
    }

    /**
     * Sets a sample in the specified band for the pixel located at (x,y)
     * in the DataBuffer using an int for input.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the pixel location.
     * @param y        The Y coordinate of the pixel location.
     * @param b        The band to set.
     * @param s        The input sample.
     *
     * @throws ArrayIndexOutOfBoundsException if the coordinates or
     * the band index are not in bounds.
     */
    public void setSample(int x, int y, int b, int s) {
        sampleModel.setSample(x-sampleModelTranslateX,
                              y-sampleModelTranslateY, b, s,
                              dataBuffer);
    }

    /**
     * Sets a sample in the specified band for the pixel located at (x,y)
     * in the DataBuffer using a float for input.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the pixel location.
     * @param y        The Y coordinate of the pixel location.
     * @param b        The band to set.
     * @param s        The input sample as a float.
     *
     * @throws ArrayIndexOutOfBoundsException if the coordinates or
     * the band index are not in bounds.
     */
    public void setSample(int x, int y, int b, float s){
        sampleModel.setSample(x-sampleModelTranslateX,y-sampleModelTranslateY,
                              b,s,dataBuffer);
    }

    /**
     * Sets a sample in the specified band for the pixel located at (x,y)
     * in the DataBuffer using a double for input.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the pixel location.
     * @param y        The Y coordinate of the pixel location.
     * @param b        The band to set.
     * @param s        The input sample as a double.
     *
     * @throws ArrayIndexOutOfBoundsException if the coordinates or
     * the band index are not in bounds.
     */
    public void setSample(int x, int y, int b, double s){
        sampleModel.setSample(x-sampleModelTranslateX,y-sampleModelTranslateY,
                                    b,s,dataBuffer);
    }

    /**
     * Sets the samples in the specified band for the specified rectangle
     * of pixels from an int array containing one sample per array element.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param b        The band to set.
     * @param iArray   The input int sample array.
     *
     * @throws NullPointerException if iArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates or
     * the band index are not in bounds, or if iArray is too small to
     * hold the input.
     */
    public void setSamples(int x, int y, int w, int h, int b,
                           int iArray[]) {
        sampleModel.setSamples(x-sampleModelTranslateX,y-sampleModelTranslateY,
                               w,h,b,iArray,dataBuffer);
    }

    /**
     * Sets the samples in the specified band for the specified rectangle
     * of pixels from a float array containing one sample per array element.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param b        The band to set.
     * @param fArray   The input float sample array.
     *
     * @throws NullPointerException if fArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates or
     * the band index are not in bounds, or if fArray is too small to
     * hold the input.
     */
    public void setSamples(int x, int y, int w, int h, int b,
                           float fArray[]) {
        sampleModel.setSamples(x-sampleModelTranslateX,y-sampleModelTranslateY,
                               w,h,b,fArray,dataBuffer);
    }

    /**
     * Sets the samples in the specified band for the specified rectangle
     * of pixels from a double array containing one sample per array element.
     * An ArrayIndexOutOfBoundsException may be thrown if the coordinates are
     * not in bounds.
     * However, explicit bounds checking is not guaranteed.
     * @param x        The X coordinate of the upper left pixel location.
     * @param y        The Y coordinate of the upper left pixel location.
     * @param w        Width of the pixel rectangle.
     * @param h        Height of the pixel rectangle.
     * @param b        The band to set.
     * @param dArray   The input double sample array.
     *
     * @throws NullPointerException if dArray is null.
     * @throws ArrayIndexOutOfBoundsException if the coordinates or
     * the band index are not in bounds, or if dArray is too small to
     * hold the input.
     */
    public void setSamples(int x, int y, int w, int h, int b,
                           double dArray[]) {
        sampleModel.setSamples(x-sampleModelTranslateX,y-sampleModelTranslateY,
                              w,h,b,dArray,dataBuffer);
    }

}


text:
package com.kotcrab.vis.editor.ui.tab;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.Array;
import com.kotcrab.vis.editor.module.ModuleInjector;
import com.kotcrab.vis.editor.module.editor.QuickAccessModule;
import com.kotcrab.vis.editor.module.project.AssetsAnalyzerModule;
import com.kotcrab.vis.editor.module.project.AssetsUsages;
import com.kotcrab.vis.editor.module.project.SceneTabsModule;
import com.kotcrab.vis.editor.module.project.assetsmanager.FileItem;
import com.kotcrab.vis.editor.util.FileUtils;
import com.kotcrab.vis.editor.util.scene2d.VisChangeListener;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.util.dialog.Dialogs;
import com.kotcrab.vis.ui.util.dialog.Dialogs.OptionDialogType;
import com.kotcrab.vis.ui.util.dialog.OptionDialogAdapter;
import com.kotcrab.vis.ui.widget.VisLabel;
import com.kotcrab.vis.ui.widget.VisScrollPane;
import com.kotcrab.vis.ui.widget.VisTable;
import com.kotcrab.vis.ui.widget.VisTextButton;
import com.kotcrab.vis.ui.widget.tabbedpane.Tab;

/**
 * Used to display found usages of multiple files before delating them.
 * @author Kotcrab
 */
public class DeleteMultipleFilesTab extends Tab {
	private ModuleInjector injector;
	private final Array<FileItem> items;

	private AssetsAnalyzerModule usageAnalyzer;
	private SceneTabsModule tabsModule;
	private QuickAccessModule quickAccess;

	private VisTable table;
	private VisTable usagesTable;

	public DeleteMultipleFilesTab (ModuleInjector injector, Array<FileItem> items) {
		super(false, true);
		this.injector = injector;
		this.items = items;
		injector.injectModules(this);

		table = new VisTable();
		table.setBackground(VisUI.getSkin().getDrawable("window-bg"));
		table.defaults().left();

		usagesTable = new VisTable(true);
		rebuildUsagesTable();

		VisScrollPane scrollPane = new VisScrollPane(usagesTable);
		scrollPane.setFadeScrollBars(false);

		table.add(scrollPane).expandX().fillX().pad(3).row();
		table.add().expand().fill().row();
		table.addSeparator();
		table.add(createButtonPane()).pad(3);
	}

	private void rebuildUsagesTable () {
		usagesTable.clear();
		usagesTable.left();
		usagesTable.defaults().left();

		for (FileItem item : items) {

			FileHandle file = item.getFile();
			boolean canAnalyze = usageAnalyzer.canAnalyzeUsages(file);

			if (canAnalyze == false) {
				usagesTable.add(new VisLabel("Can't analyze usages for: '" + file.name() + "'"));
				usagesTable.row();
			} else {
				AssetsUsages usages = usageAnalyzer.analyzeUsages(file);
				usagesTable.add(new VisLabel(usages.toPrettyString()));

				if (usages.count() > 0) {
					VisTextButton viewUsages = new VisTextButton("View " + usages.file.name() + " Usages");
					usagesTable.add(viewUsages);

					viewUsages.addListener(new VisChangeListener((event, actor) -> openSpecificUsagesTab(usages)));
				}

				usagesTable.row();
			}
		}
	}

	private void openSpecificUsagesTab (AssetsUsages usages) {
		Tab tab = quickAccess.getAssetsUsagesTabForFile(usages.file);

		if (tab == null) {
			tab = new AssetsUsagesTab(injector, usages, false);
			quickAccess.addTab(tab);
		} else
			quickAccess.switchTab(tab);
	}

	private VisTable createButtonPane () {
		VisTable table = new VisTable(true);

		VisTextButton deleteAll = new VisTextButton("Delete All");
		VisTextButton reanalyze = new VisTextButton("Reanalyze");

		reanalyze.addListener(new VisChangeListener((event, actor) -> rebuildUsagesTable()));

		deleteAll.addListener(new ChangeListener() {
			@Override
			public void changed (ChangeEvent event, Actor actor) {
				Dialogs.showOptionDialog(event.getStage(), "Delete", "Are you sure?", OptionDialogType.YES_NO, new OptionDialogAdapter() {
					@Override
					public void yes () {
						for (FileItem item : items) {
							FileUtils.delete(item.getFile());
							quickAccess.closeAllUsagesTabForFile(item.getFile());
						}

						removeFromTabPane();
					}
				});
			}
		});

		table.add(deleteAll);
		table.add(reanalyze);

		return table;
	}

	@Override
	public String getTabTitle () {
		return "Delete Multiple Files";
	}

	@Override
	public Table getContentTable () {
		return table;
	}
}


text:
<?php

/**
 * PHPExcel_Worksheet_CellIterator
 *
 * Used to iterate rows in a PHPExcel_Worksheet
 *
 * @category   PHPExcel
 * @package    PHPExcel_Worksheet
 * @copyright  Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
 */
abstract class PHPExcel_Worksheet_CellIterator
{
	/**
	 * PHPExcel_Worksheet to iterate
	 *
	 * @var PHPExcel_Worksheet
	 */
	protected $_subject;

	/**
	 * Current iterator position
	 *
	 * @var mixed
	 */
	protected $_position = null;

	/**
	 * Iterate only existing cells
	 *
	 * @var boolean
	 */
	protected $_onlyExistingCells = false;

	/**
	 * Destructor
	 */
	public function __destruct() {
		unset($this->_subject);
	}

	/**
	 * Get loop only existing cells
	 *
	 * @return boolean
	 */
    public function getIterateOnlyExistingCells() {
    	return $this->_onlyExistingCells;
    }

	/**
	 * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
	 *
     * @throws PHPExcel_Exception
	 */
    abstract protected function adjustForExistingOnlyRange();

	/**
	 * Set the iterator to loop only existing cells
	 *
	 * @param	boolean		$value
     * @throws PHPExcel_Exception
	 */
    public function setIterateOnlyExistingCells($value = true) {
    	$this->_onlyExistingCells = (boolean) $value;

        $this->adjustForExistingOnlyRange();
    }
}


text:
import React from 'react';
import autobind from 'react-autobind';
import { connect } from 'react-redux';

import { createSelector } from 'reselect';

import profileEditingSelector from 'profileEditingSelector';

import styles from './styles.css';

class ProfilePageLeft extends React.Component {
    constructor() {
	super();
    }

    render() {

	const profileLeftState = this.props.profileEditing ? (

<input placeholder="Name"  className={styles.ProfileInputEdit}></input>

@KielanLemons

<input placeholder="Bio" className={styles.ProfileInputEdit}></input>

<input placeholder="Location" className={styles.ProfileInputEdit}></input>

<input placeholder="Website" className={styles.ProfileInputEdit}></input>

<button className={styles.userColorButton+" "+styles.userColor}>Theme color</button>

	) : (

Kielan Lemons

KielanLemons

a;lksdfjla;ksdjfla;ksdjflas;kdjflaskdfjsalkdfjaslkdfjasdl;kfj

Bangkok

Joined June 2013

	)

	return (

		{profileLeftState}

	)
    }
}

function mapDispatchToProps(dispatch) {
    return {
	_handleBioChange: () => {
	    console.log('faggot')
	},
	dispatch,
    };
}

export default connect(createSelector(
    profileEditingSelector,
    (profileEditing) => ({ profileEditing })
), mapDispatchToProps)(ProfilePageLeft);


text:
<?php
namespace Lonquan\TaobaoSDK\Top\Request;

use Lonquan\TaobaoSDK\Top\RequestCheckUtil;
use Lonquan\TaobaoSDK\Top\RequestInterface;

/**
 * TOP API: tmall.product.spec.add request
 *
 * @author auto create
 * @since  1.0, 2016.04.14
 */
class TmallProductSpecAddRequest implements RequestInterface
{
    /**
     * 产品二维码
     **/
    private $barcode;

    /**
     * 存放产品规格认证类型-认证图片url映射信息,格式为k:v;k:v;,其中key为认证类型数字id,value为调用tmall.product.spec.pic.upload返回的认证图片url文本
     **/
    private $certifiedPicStr;

    /**
     * 存放产品规格认证类型-认证文本映射信息,格式为k:v;k:v;,其中key为认证类型数字id,value为认证文本值
     **/
    private $certifiedTxtStr;

    /**
     * 产品基础色,数据格式为:pid:vid:rvid1,rvid2,rvid3;pid:vid:rvid1
     **/
    private $changeProp;

    /**
     * 用户自定义销售属性,结构:pid1:value1;pid2:value2。在
     **/
    private $customerSpecProps;

    /**
     * 产品图片
     **/
    private $image;

    /**
     * 产品规格吊牌价,以分为单位,无默认值,上限999999999
     **/
    private $labelPrice;

    /**
     * 产品上市时间
     **/
    private $marketTime;

    /**
     * 产品货号
     **/
    private $productCode;

    /**
     * 产品ID
     **/
    private $productId;

    /**
     * 产品的规格属性
     **/
    private $specProps;

    /**
     * 规格属性别名,只允许传颜色别名
     **/
    private $specPropsAlias;

    private $apiParas = [ ];

    public function setBarcode($barcode)
    {
        $this->barcode = $barcode;
        $this->apiParas["barcode"] = $barcode;
    }

    public function getBarcode()
    {
        return $this->barcode;
    }

    public function setCertifiedPicStr($certifiedPicStr)
    {
        $this->certifiedPicStr = $certifiedPicStr;
        $this->apiParas["certified_pic_str"] = $certifiedPicStr;
    }

    public function getCertifiedPicStr()
    {
        return $this->certifiedPicStr;
    }

    public function setCertifiedTxtStr($certifiedTxtStr)
    {
        $this->certifiedTxtStr = $certifiedTxtStr;
        $this->apiParas["certified_txt_str"] = $certifiedTxtStr;
    }

    public function getCertifiedTxtStr()
    {
        return $this->certifiedTxtStr;
    }

    public function setChangeProp($changeProp)
    {
        $this->changeProp = $changeProp;
        $this->apiParas["change_prop"] = $changeProp;
    }

    public function getChangeProp()
    {
        return $this->changeProp;
    }

    public function setCustomerSpecProps($customerSpecProps)
    {
        $this->customerSpecProps = $customerSpecProps;
        $this->apiParas["customer_spec_props"] = $customerSpecProps;
    }

    public function getCustomerSpecProps()
    {
        return $this->customerSpecProps;
    }

    public function setImage($image)
    {
        $this->image = $image;
        $this->apiParas["image"] = $image;
    }

    public function getImage()
    {
        return $this->image;
    }

    public function setLabelPrice($labelPrice)
    {
        $this->labelPrice = $labelPrice;
        $this->apiParas["label_price"] = $labelPrice;
    }

    public function getLabelPrice()
    {
        return $this->labelPrice;
    }

    public function setMarketTime($marketTime)
    {
        $this->marketTime = $marketTime;
        $this->apiParas["market_time"] = $marketTime;
    }

    public function getMarketTime()
    {
        return $this->marketTime;
    }

    public function setProductCode($productCode)
    {
        $this->productCode = $productCode;
        $this->apiParas["product_code"] = $productCode;
    }

    public function getProductCode()
    {
        return $this->productCode;
    }

    public function setProductId($productId)
    {
        $this->productId = $productId;
        $this->apiParas["product_id"] = $productId;
    }

    public function getProductId()
    {
        return $this->productId;
    }

    public function setSpecProps($specProps)
    {
        $this->specProps = $specProps;
        $this->apiParas["spec_props"] = $specProps;
    }

    public function getSpecProps()
    {
        return $this->specProps;
    }

    public function setSpecPropsAlias($specPropsAlias)
    {
        $this->specPropsAlias = $specPropsAlias;
        $this->apiParas["spec_props_alias"] = $specPropsAlias;
    }

    public function getSpecPropsAlias()
    {
        return $this->specPropsAlias;
    }

    public function getApiMethodName()
    {
        return "tmall.product.spec.add";
    }

    public function getApiParas()
    {
        return $this->apiParas;
    }

    public function check()
    {
        RequestCheckUtil::checkNotNull($this->image, "image");
        RequestCheckUtil::checkMaxValue($this->labelPrice, 999999999, "labelPrice");
        RequestCheckUtil::checkMinValue($this->labelPrice, 0, "labelPrice");
        RequestCheckUtil::checkNotNull($this->productId, "productId");
        RequestCheckUtil::checkMaxLength($this->specPropsAlias, 60, "specPropsAlias");
    }

    public function putOtherTextParam($key, $value)
    {
        $this->apiParas[ $key ] = $value;
        $this->$key = $value;
    }
}


text:
const React = require('react');
const Head = require('react-helmet');
const ReactRedux = require('react-redux');

/**
 * Resolve a file url to a relative url in current state
 * @param  {String} href
 * @param  {State} state
 * @return {String}
 */
function resolveForCurrentFile(href, state) {
    const { file } = state;
    return file.relative(href);
}

const ImportLink = ReactRedux.connect((state, {rel, href}) => {
    href = resolveForCurrentFile(href, state);

    return {
        link: [
            {
                rel,
                href
            }
        ]
    };
})(Head);

const ImportScript = ReactRedux.connect((state, {type, src}) => {
    src = resolveForCurrentFile(src, state);

    return {
        script: [
            {
                type,
                src
            }
        ]
    };
})(Head);

const ImportCSS = props => <ImportLink rel="stylesheet" {...props} />;

module.exports = {
    ImportLink,
    ImportScript,
    ImportCSS
};


text:
"""Learning rate schedules.

A thin wrapper over optax schedulers with a unifying constructing interface.
"""

from typing import Callable
import optax

Schedule = Callable[[int], float]

def constant(base_lr, num_train_steps) -> Schedule:
  del num_train_steps
  return lambda _: base_lr

def piecewise_constant(base_lr, num_train_steps, *,
                       rampup_thresh=0.15,
                       stages=((0.3, 0.1), (0.6, 0.1), (0.9, 0.1))) -> Schedule:
  """Piecewise constant learning rate with optional linear rampup.

  Args:
    base_lr: base learning rate.
    num_train_steps: total number of training steps.
    rampup_thresh: if not None, can specify a linear rampup.
    stages: a sequence of (step_ratio, scaling_factor). The step_ratio times
      the num_train_steps is the decaying boundary. The scaling factor for all
      the stages whose decaying boundary is less than the current step is
      multiplied to the base learning rate.

  Returns:
    A learning rate schedule.
  """
  lr_fn = optax.piecewise_constant_schedule(
      init_value=base_lr,
      boundaries_and_scales={int(r*num_train_steps): s for r, s in stages})
  if rampup_thresh is not None and rampup_thresh > 0:
    rampup_steps = int(rampup_thresh * num_train_steps)
    rampup_fn = optax.linear_schedule(
        init_value=0, end_value=base_lr, transition_steps=rampup_steps)
    lr_fn = optax.join_schedules(
        schedules=[rampup_fn, lr_fn], boundaries=[rampup_steps])
  return lr_fn


text:
package org.hamcrest.core;

import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.hamcrest.core.IsEqual.equalTo;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;

/**
 * Decorates another Matcher, retaining the behavior but allowing tests
 * to be slightly more expressive.
 *
 * eg. assertThat(cheese, equalTo(smelly))
 * vs  assertThat(cheese, is(equalTo(smelly)))
 */
public class Is<T> extends BaseMatcher<T> {

    private final Matcher<T> matcher;

    public Is(Matcher<T> matcher) {
        this.matcher = matcher;
    }

    public boolean matches(Object arg) {
        return matcher.matches(arg);
    }

    public void describeTo(Description description) {
        description.appendText("is ").appendDescriptionOf(matcher);
    }

    /**
     * Decorates another Matcher, retaining the behavior but allowing tests
     * to be slightly more expressive.
     *
     * eg. assertThat(cheese, equalTo(smelly))
     * vs  assertThat(cheese, is(equalTo(smelly)))
     */
    @Factory
    public static <T> Matcher<T> is(Matcher<T> matcher) {
        return new Is<T>(matcher);
    }

    /**
     * This is a shortcut to the frequently used is(equalTo(x)).
     *
     * eg. assertThat(cheese, is(equalTo(smelly)))
     * vs  assertThat(cheese, is(smelly))
     */
    @Factory
    public static <T> Matcher<T> is(T value) {
        return is(equalTo(value));
    }

    /**
     * This is a shortcut to the frequently used is(instanceOf(SomeClass.class)).
     *
     * eg. assertThat(cheese, is(instanceOf(Cheddar.class)))
     * vs  assertThat(cheese, is(Cheddar.class))
     */
    @Factory
    public static Matcher<Object> is(Class<?> type) {
        return is(instanceOf(type));
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class CardStickerCollection
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class CardStickerCollection
   ">
    <meta name="generator" content="docfx 2.43.2.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class CardStickerCollection

A collection of IStickers.

Inheritance

System.Object

ReadOnlyCollection<ISticker>

ReadOnlyStickerCollection

CardStickerCollection

Implements

ICardStickerCollection

IReadOnlyCollection<ISticker>

System.Collections.Generic.IEnumerable<ISticker>

System.Collections.IEnumerable

IRefreshable

Inherited Members

      ReadOnlyCollection<ISticker>.Limit

      ReadOnlyCollection<ISticker>.Item[Int32]

      ReadOnlyCollection<ISticker>.GetEnumerator()

      ReadOnlyCollection<ISticker>.Refresh(Boolean, CancellationToken)

      ReadOnlyCollection<ISticker>.IEnumerable.GetEnumerator()

      ReadOnlyCollection<ISticker>.IncorporateLimit()

      System.Object.Equals(System.Object)

      System.Object.Equals(System.Object, System.Object)

      System.Object.GetHashCode()

      System.Object.GetType()

      System.Object.MemberwiseClone()

      System.Object.ReferenceEquals(System.Object, System.Object)

      System.Object.ToString()

Namespace: Manatee.Trello

Assembly: Manatee.Trello.dll

Syntax

public class CardStickerCollection : ReadOnlyStickerCollection, IHandle<EntityDeletedEvent<IJsonSticker>>, IHandle, ICardStickerCollection, IReadOnlyCollection<ISticker>, IEnumerable<ISticker>, IEnumerable, IRefreshable

Methods

    |
    <a href="https://github.com/gregsdennis/Manatee.Trello/new/master/apiSpec/new?filename=Manatee_Trello_CardStickerCollection_Add_System_String_System_Double_System_Double_System_Int32_System_Int32_System_Threading_CancellationToken_.md&value=---%0Auid%3A%20Manatee.Trello.CardStickerCollection.Add(System.String%2CSystem.Double%2CSystem.Double%2CSystem.Int32%2CSystem.Int32%2CSystem.Threading.CancellationToken)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

    View Source

Add(String, Double, Double, Int32, Int32, CancellationToken)

Adds a ISticker to a ICard.

Declaration

public Task<ISticker> Add(string name, double left, double top, int zIndex = 0, int rotation = 0, CancellationToken ct = default(CancellationToken))

Parameters

        Type
        Name
        Description

        System.String
        name

The name of the sticker.

        System.Double
        left

The position of the left edge.

        System.Double
        top

The position of the top edge.

        System.Int32
        zIndex

The z-index. Default is 0.

        System.Int32
        rotation

The rotation. Default is 0.

        System.Threading.CancellationToken
        ct

(Optional) A cancellation token for async processing.

Returns

        Type
        Description

        System.Threading.Tasks.Task<ISticker>

The attachment generated by Trello.

Exceptions

        Type
        Condition

        ValidationException<T>

Thrown when name is null, empty, or whitespace.

        ValidationException<T>

Thrown when rotation is less than 0 or greater than 359.

    |
    <a href="https://github.com/gregsdennis/Manatee.Trello/new/master/apiSpec/new?filename=Manatee_Trello_CardStickerCollection_Remove_Manatee_Trello_Sticker_System_Threading_CancellationToken_.md&value=---%0Auid%3A%20Manatee.Trello.CardStickerCollection.Remove(Manatee.Trello.Sticker%2CSystem.Threading.CancellationToken)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc

    View Source

Remove(Sticker, CancellationToken)

Removes a ISticker from a ICard.

Declaration

public Task Remove(Sticker sticker, CancellationToken ct = default(CancellationToken))

Parameters

        Type
        Name
        Description

        Sticker
        sticker

The sticker to remove.

        System.Threading.CancellationToken
        ct

(Optional) A cancellation token for async processing.

Returns

        Type
        Description

        System.Threading.Tasks.Task

Implements

      ICardStickerCollection

      IReadOnlyCollection<T>

      System.Collections.Generic.IEnumerable<T>

      System.Collections.IEnumerable

      IRefreshable

                    Improve this Doc

                    View Source

              Back to top

            Generated by DocFX


text:
extern "C" {
    fn miri_start_panic(payload: *mut u8) -> !;
}

fn main() {
    unsafe { miri_start_panic(&mut 0) }
    //~^ ERROR: unwinding past a stack frame that does not allow unwinding
}


text:
package commands

import (
	cmds "github.com/ipfs/go-ipfs/commands"

	"gx/ipfs/QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky/go-ipfs-cmdkit"
)

var MountCmd = &cmds.Command{
	Helptext: cmdkit.HelpText{
		Tagline: "Mounts ipfs to the filesystem (disabled).",
		ShortDescription: `
This version of ipfs is compiled without fuse support, which is required
for mounting. If you'd like to be able to mount, please use a version of
ipfs compiled with fuse.

For the latest instructions, please check the project's repository:
  http://github.com/ipfs/go-ipfs
`,
	},
}