text:
package de.xants.capitalista;

import android.app.IntentService;
import android.content.Intent;

import de.xants.capitalista.model.Game;
import timber.log.Timber;

public class GameService extends IntentService {

    private boolean mRunning = true;
    private Game mGame = new Game();

    public GameService() {
        super("CapitalistaGameEngine");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        Timber.d("Starting GameService");
        long time = System.currentTimeMillis();
        //CM.getBus().register(this.mGame);
        while (this.mRunning) {
            this.mGame.tick();
        }
    }

    @Override
    public void onDestroy() {
        Timber.d("Stoping GameService");
        //CM.getBus().unregister(this.mGame);
        this.mRunning = false;
        super.onDestroy();
    }

}


text:
<?php

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

defined('MOODLE_INTERNAL') || die();

$string['commentadded'] = 'Комментарий добавлен';
$string['entryadded'] = 'Запись добавлена';
$string['entryapproved'] = 'Запись одобрена';
$string['entrydeleted'] = 'Запись удалена';
$string['entrydisapproved'] = 'Запись не одобрена';
$string['entryupdated'] = 'Запись обновлена';
$string['pluginname'] = 'Уведомление о событии';

redpajama_set_name: RedPajamaGithub


text:
export default function routes($stateProvider) {
  $stateProvider
    .state('app.authentication', {
      url: '/authentication',
      template: require('./authentication.html'),
      controller: 'AuthenticationController',
      controllerAs: 'vm',
      data: {
        requireLogin: false
      }
    });
}

routes.$inject = ['$stateProvider'];


text:
package master

const (
	DummyDeployment = `
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: dummy
  name: dummy
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dummy
  template:
    metadata:
      labels:
        app: dummy
    spec:
      containers:
      - image: {{ .ImageRepository }}/pause-{{ .Arch }}:3.0
        name: dummy
      hostNetwork: true
`
	KubeDiscoveryDeployment = `
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    k8s-app: kube-discovery
  name: kube-discovery
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: kube-discovery
  template:
    metadata:
      labels:
        k8s-app: kube-discovery
        # TODO: I guess we can remove all these cluster-service labels...
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
      - name: kube-discovery
        image: {{ .ImageRepository }}/kube-discovery-{{ .Arch }}:1.0
        imagePullPolicy: IfNotPresent
        command:
        - /usr/local/bin/kube-discovery
        ports:
        - containerPort: 9898
          hostPort: 9898
          name: http
        volumeMounts:
        - mountPath: /tmp/secret
          name: clusterinfo
          readOnly: true
      hostNetwork: true
      # TODO: Why doesn't the Decoder recognize this new field and decode it properly? Right now it's ignored
      # tolerations:
      # - key: {{ .MasterTaintKey }}
      #  effect: NoSchedule
      securityContext:
          seLinuxOptions:
            type: spc_t
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: beta.kubernetes.io/arch
                operator: In
                values:
                - {{ .Arch }}
      volumes:
      - name: clusterinfo
        secret:
          defaultMode: 420
          secretName: clusterinfo
`
)


text:
package com.intellij.ui.win;

import com.intellij.idea.StartupUtil;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.ex.ApplicationInfoEx;
import com.intellij.util.lang.UrlClassLoader;

import java.lang.ref.WeakReference;
import java.util.concurrent.atomic.AtomicBoolean;

public class RecentTasks {

  private static AtomicBoolean initialized =
    new AtomicBoolean(false);

  private final static WeakReference<Thread> openerThread =
    new WeakReference<Thread>(Thread.currentThread());

  private final static String openerThreadName =
    Thread.currentThread().getName();

  static {
    UrlClassLoader.loadPlatformLibrary("jumpListBridge");
  }

  private synchronized static void init() {
    if (initialized.get()) return;
    initialize(ApplicationInfoEx.getInstanceEx().getVersionName() + "." + PathManager.getConfigPath().hashCode());
    initialized.set(true);
  }

  /**
   * Com initialization should be invoked once per process.
   * All invocation should be made from the same thread.
   * @param applicationId
   */
  native private static void initialize (String applicationId);
  native private static void addTasksNativeForCategory (String category, Task [] tasks);
  native static String getShortenPath(String paths);
  native private static void clearNative();

  public synchronized static void clear() {
    init();
    checkThread();
    clearNative();
  }

  /**
   * Use #clearNative method instead of passing empty array of tasks.
   * @param tasks
   */
  public synchronized static void addTasks(final Task[] tasks) {
    if (tasks.length == 0) return;
    init();
    checkThread();
    addTasksNativeForCategory("Recent", tasks);
  }

  private static void checkThread() {
    Thread t = openerThread.get();
    if (t == null || !t.equals(Thread.currentThread()))
      throw new RuntimeException("Current thread is " + Thread.currentThread().getName() + "This class has to be used from " + openerThreadName + " thread");
  }
}


text:
sap.ui.define(['jquery.sap.global', "../core/RenderUtils"], function(jQuery, RenderUtils) {

	"use strict";

	/**
	 * Button renderer.
	 * @namespace
	 */
	var ButtonRenderer = {};

	ButtonRenderer.render = function(rm, oControl) {
		var size = oControl.getSize(),
			title = oControl.getTitle();

		rm.write("<button");

	    rm.writeControlData(oControl);

	    rm.addClass(oControl._getStyleClass());

	    rm.writeClasses();

	    if('' !== title){
	    	rm.writeAttribute('title', title);
	    }

		if(!oControl.getEnabled()){
			rm.writeAttribute("disabled", "disabled");
		}

		rm.write(">");

		RenderUtils.renderContent(rm, oControl);

		rm.write("</button>");

	    RenderUtils.renderTrail(rm, oControl);
	};

	return ButtonRenderer;

}, true);


text:
package org.sleuthkit.autopsy.testing;

import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JTextField;
import junit.framework.Test;
import junit.framework.TestCase;
import org.netbeans.jellytools.MainWindowOperator;
import org.netbeans.jellytools.NbDialogOperator;
import org.netbeans.jellytools.WizardOperator;
import org.netbeans.jemmy.Timeout;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JCheckBoxOperator;
import org.netbeans.jemmy.operators.JDialogOperator;
import org.netbeans.jemmy.operators.JFileChooserOperator;
import org.netbeans.jemmy.operators.JLabelOperator;
import org.netbeans.jemmy.operators.JTabbedPaneOperator;
import org.netbeans.jemmy.operators.JTableOperator;
import org.netbeans.jemmy.operators.JTextFieldOperator;
import org.netbeans.junit.NbModuleSuite;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.keywordsearch.*;

/**
 * This test expects the following system properties to be set: img_path: The
 * fully qualified path to the image file (if split, the first file) out_path:
 * The location where the case will be stored nsrl_path: Path to the nsrl
 * database known_bad_path: Path to a database of known bad hashes keyword_path:
 * Path to a keyword list xml file ignore_unalloc: Boolean whether to ignore
 * unallocated space or not
 *
 * Without these properties set, the test will fail to run correctly. To run
 * this test correctly, you should use the script 'regression.py' located in the
 * 'script' directory of the Testing module.
 */
public class RegressionTest extends TestCase {

    private static final Logger logger = Logger.getLogger(RegressionTest.class.getName());
    long start;

    /**
     * Constructor required by JUnit
     */
    public RegressionTest(String name) {
        super(name);
    }

    /**
     * Creates suite from particular test cases.
     */
    public static Test suite() {
        // run tests with specific configuration
        NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(RegressionTest.class).
                clusters(".*").
                enableModules(".*");
        conf = conf.addTest("testNewCaseWizardOpen",
                "testNewCaseWizard",
                "testStartAddDataSource",
                "testConfigureIngest1",
                "testConfigureHash",
                "testConfigureIngest2",
                "testConfigureSearch",
                "testAddSourceWizard1",
                "testIngest",
                "testGenerateReportToolbar",
                "testGenerateReportButton");
        return NbModuleSuite.create(conf);

    }

    /**
     * Method called before each test case.
     */
    @Override
    public void setUp() {

        logger.info("########  " + System.getProperty("img_path") + "  #######");
    }

    /**
     * Method called after each test case.
     */
    @Override
    public void tearDown() {
    }

    public void testNewCaseWizardOpen() {
        logger.info("New Case");
        NbDialogOperator nbdo = new NbDialogOperator("Welcome");
        JButtonOperator jbo = new JButtonOperator(nbdo, 0); // the "New Case" button
        jbo.pushNoBlock();
    }

    public void testNewCaseWizard() {
        logger.info("New Case Wizard");
        WizardOperator wo = new WizardOperator("New Case Information");
        JTextFieldOperator jtfo1 = new JTextFieldOperator(wo, 1);
        jtfo1.typeText("AutopsyTestCase"); // Name the case "AutopsyTestCase"
        JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0);
        jtfo0.typeText(System.getProperty("out_path"));
        wo.btNext().clickMouse();
        JTextFieldOperator jtfo2 = new JTextFieldOperator(wo, 0);
        jtfo2.typeText("000"); // Set the case number
        JTextFieldOperator jtfo3 = new JTextFieldOperator(wo, 1);
        jtfo3.typeText("Examiner 1"); // Set the case examiner
        start = System.currentTimeMillis();
        wo.btFinish().clickMouse();
    }

    public void testStartAddDataSource() {
        logger.info("Starting Add Image process");
        WizardOperator wo = new WizardOperator("Add Data");
        JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0);
        String img_path = System.getProperty("img_path");
        if (img_path.startsWith("\\")) {
            img_path = "\\" + img_path;
        }
        String imageDir = img_path;
        ((JTextField) jtfo0.getSource()).setText(imageDir);
        wo.btNext().clickMouse();
    }

    public void testAddSourceWizard1() {
        WizardOperator wo = new WizardOperator("Add Data");
        while (!wo.btFinish().isEnabled()) {
            new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
        }
        logger.info("Add image took " + (System.currentTimeMillis() - start) + "ms");
        wo.btFinish().clickMouse();
    }

    public void testConfigureIngest1() {
        logger.info("Ingest 1");
        WizardOperator wo = new WizardOperator("Add Data");
        JTableOperator jto = new JTableOperator(wo, 0);
        int row = jto.findCellRow("Hash Lookup", 1, 0);
        jto.clickOnCell(row, 1);
        JButtonOperator jbo1 = new JButtonOperator(wo, "Advanced");
        jbo1.pushNoBlock();
    }

    public void testConfigureHash() {
        logger.info("Hash Configure");
        JDialog hashMainDialog = JDialogOperator.waitJDialog("Hash Database Configuration", false, false);
        JDialogOperator hashMainDialogOperator = new JDialogOperator(hashMainDialog);
        List<String> databases = new ArrayList<String>();
        databases.add(System.getProperty("nsrl_path"));
        databases.add(System.getProperty("known_bad_path"));
        for (String database : databases) {
            JButtonOperator importButtonOperator = new JButtonOperator(hashMainDialogOperator, "Import");
            importButtonOperator.pushNoBlock();
            JDialog addDatabaseDialog = JDialogOperator.waitJDialog("Add Hash Database", false, false);
            JDialogOperator addDatabaseDialogOperator = new JDialogOperator(addDatabaseDialog);
            JButtonOperator browseButtonOperator = new JButtonOperator(addDatabaseDialogOperator, "Browse", 0);
            browseButtonOperator.pushNoBlock();
            JFileChooserOperator fileChooserOperator = new JFileChooserOperator();
            fileChooserOperator.chooseFile(database);
            JButtonOperator okButtonOperator = new JButtonOperator(addDatabaseDialogOperator, "OK", 0);
            okButtonOperator.pushNoBlock();
            new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
        }
        // Used if the database has no index
        //JDialog jd3 = JDialogOperator.waitJDialog("No Index Exists", false, false);
        //JDialogOperator jdo3 = new JDialogOperator(jd3);
        //JButtonOperator jbo3 = new JButtonOperator(jdo3, "Yes", 0);
        new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
        //jbo3.pushNoBlock();
        JButtonOperator jbo4 = new JButtonOperator(hashMainDialogOperator, "OK", 0);
        jbo4.pushNoBlock();
    }

    public void testConfigureIngest2() {
        logger.info("Ingest 2");
        WizardOperator wo = new WizardOperator("Add Data");
        JTableOperator jto = new JTableOperator(wo, 0);
        int row = jto.findCellRow("Keyword Search", 1, 0);
        jto.clickOnCell(row, 1);
        JButtonOperator jbo1 = new JButtonOperator(wo, "Advanced");
        jbo1.pushNoBlock();
    }

    public void testConfigureSearch() {
        logger.info("Search Configure");
        JDialog jd = JDialogOperator.waitJDialog("Advanced Keyword Search Configuration", false, false);
        JDialogOperator jdo = new JDialogOperator(jd);
        //setListForIngest();
        String words = System.getProperty("keyword_path");
        JButtonOperator jbo0 = new JButtonOperator(jdo, "Import List", 0);
        jbo0.pushNoBlock();
        JFileChooserOperator jfco0 = new JFileChooserOperator();
        jfco0.chooseFile(words);
        JTableOperator jto = new JTableOperator(jdo, 0);
        jto.clickOnCell(0, 0);
        JCheckBoxOperator jcbo = new JCheckBoxOperator(jdo, "Enable for ingest", 0);
        if (!jcbo.isSelected()) {
            jcbo.doClick();
        }
        new Timeout("pausing", 1000).sleep(); // give it a second to process
        if (Boolean.parseBoolean(System.getProperty("mugen_mode"))) {
            JTabbedPaneOperator jtpo = new JTabbedPaneOperator(jdo);
            jtpo.selectPage("String Extraction");
            JCheckBoxOperator jcbo0 = new JCheckBoxOperator(jtpo, "Arabic (Arabic)");
            jcbo0.doClick();
            JCheckBoxOperator jcbo1 = new JCheckBoxOperator(jtpo, "Han (Chinese, Japanese, Korean)");
            jcbo1.doClick();
            new Timeout("pausing", 1000).sleep(); // give it a second to process
        }
        JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0);
        jbo2.pushNoBlock();
        WizardOperator wo = new WizardOperator("Add Data");
        JCheckBoxOperator jbco0 = new JCheckBoxOperator(wo, "Process Unallocated Space");
        if (Boolean.parseBoolean(System.getProperty("ignore_unalloc"))) {
            jbco0.doClick();
        }
        wo.btNext().clickMouse();
    }

    public void testIngest() {
        logger.info("Ingest 3");
        long start = System.currentTimeMillis();
        IngestManager man = IngestManager.getDefault();
        while (man.isEnqueueRunning()) {
            new Timeout("pausing", 5000).sleep(); // give it a second (or five) to process
        }
        logger.info("Enqueue took " + (System.currentTimeMillis() - start) + "ms");
        while (man.isIngestRunning()) {

            new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
        }
        new Timeout("pausing", 15000).sleep(); // give it a second (or fifteen) to process
        boolean sleep = true;
        while (man.areModulesRunning()) {
            new Timeout("pausing", 5000).sleep(); // give it a second (or five) to process
        }
        logger.info("Ingest (including enqueue) took " + (System.currentTimeMillis() - start) + "ms");
        // allow keyword search to finish saving artifacts, just in case
        //   but randomize the timing so that we don't always get the same error
        //   consistently, making it seem like default behavior
        Random rand = new Random();
        new Timeout("pausing", 10000 + (rand.nextInt(15000) + 5000)).sleep();
        screenshot("Finished Ingest");

    }

    public void testGenerateReportToolbar() {

        logger.info("Generate Report Toolbars");
        // Force the action if necessary:
        //new Action("Tools|Generate Report", null).perform();
        //new Timeout("pausing", 1000).sleep();
        MainWindowOperator mwo = MainWindowOperator.getDefault();
        JButtonOperator jbo = new JButtonOperator(mwo, "Generate Report");
        jbo.pushNoBlock();
        new Timeout("pausing", 1000).sleep();
    }

    public void testGenerateReportButton() throws IOException {
        logger.info("Generate Report Button");
        JDialog reportDialog = JDialogOperator.waitJDialog("Generate Report", false, false);
        JDialogOperator reportDialogOperator = new JDialogOperator(reportDialog);
        JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Next");
        DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
        Date date = new Date();
        String datenotime = dateFormat.format(date);
        jbo0.pushNoBlock();
        new Timeout("pausing", 1000).sleep();
        JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator, "Finish");
        jbo1.pushNoBlock();
        new Timeout("pausing", 500).sleep();
        JDialog previewDialog = JDialogOperator.waitJDialog("Progress", false, false);
        screenshot("Progress");
        JDialogOperator previewDialogOperator = new JDialogOperator(previewDialog);
        JLabel waiter = JLabelOperator.waitJLabel(previewDialog, "Complete", false, false);
        JButtonOperator jbo2 = new JButtonOperator(previewDialogOperator, "Close");
        jbo2.pushNoBlock();
        new Timeout("pausing", 3000).sleep(); // Give the program a second to idle to be safe
        System.setProperty("ReportStr", datenotime);
        screenshot("Done Testing");
    }

    public void screenshot(String name) {
        logger.info("Taking screenshot.");
        try {
            Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
            BufferedImage capture = new Robot().createScreenCapture(screenRect);
            String outPath = System.getProperty("out_path");
            ImageIO.write(capture, "png", new File(outPath + "\\" + name + ".png"));
            new Timeout("pausing", 1000).sleep(); // give it a second to save
        } catch (IOException ex) {
            logger.log(Level.WARNING, "IOException taking screenshot.", ex);
        } catch (AWTException ex) {
            logger.log(Level.WARNING, "AWTException taking screenshot.", ex);

        }
    }

    private void setListForIngest() {
        KeywordSearchListsXML curr = KeywordSearchListsXML.getCurrent();
        curr.setUseForIngest("URLs", true);
    }
}


text: installBiocDataPackage.sh "bsgenome.osativa.msu.msu7-0.99.2"


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

package org.camunda.bpm.engine.rest.dto.migration;

import java.util.ArrayList;
import java.util.List;

import org.camunda.bpm.engine.migration.MigratingActivityInstanceValidationReport;

public class MigratingActivityInstanceValidationReportDto {

  protected MigrationInstructionDto migrationInstruction;
  protected String activityInstanceId;
  protected String sourceScopeId;
  protected List<String> failures;

  public MigrationInstructionDto getMigrationInstruction() {
    return migrationInstruction;
  }

  public void setMigrationInstruction(MigrationInstructionDto migrationInstruction) {
    this.migrationInstruction = migrationInstruction;
  }

  public String getActivityInstanceId() {
    return activityInstanceId;
  }

  public void setActivityInstanceId(String activityInstanceId) {
    this.activityInstanceId = activityInstanceId;
  }

  public List<String> getFailures() {
    return failures;
  }

  public void setFailures(List<String> failures) {
    this.failures = failures;
  }

  public String getSourceScopeId() {
    return sourceScopeId;
  }

  public void setSourceScopeId(String sourceScopeId) {
    this.sourceScopeId = sourceScopeId;
  }

  public static List<MigratingActivityInstanceValidationReportDto> from(List<MigratingActivityInstanceValidationReport> reports) {
    ArrayList<MigratingActivityInstanceValidationReportDto> dtos = new ArrayList<MigratingActivityInstanceValidationReportDto>();
    for (MigratingActivityInstanceValidationReport report : reports) {
      dtos.add(MigratingActivityInstanceValidationReportDto.from(report));
    }
    return dtos;
  }

  public static MigratingActivityInstanceValidationReportDto from(MigratingActivityInstanceValidationReport report) {
    MigratingActivityInstanceValidationReportDto dto = new MigratingActivityInstanceValidationReportDto();
    dto.setMigrationInstruction(MigrationInstructionDto.from(report.getMigrationInstruction()));
    dto.setActivityInstanceId(report.getActivityInstanceId());
    dto.setFailures(report.getFailures());
    dto.setSourceScopeId(report.getSourceScopeId());
    return dto;
  }

}


text:
/*
 * $Id: CartesianGraph.java,v 1.2 2006/01/19 14:45:48 luca Exp $
 *
 * This software is provided by NOAA for full, free and open release.  It is
 * understood by the recipient/user that NOAA assumes no liability for any
 * errors contained in the code.  Although this software is released without
 * conditions or restrictions in its use, it is expected that appropriate
 * credit be given to its author and to the National Oceanic and Atmospheric
 * Administration should the software be included by the recipient as an
 * element in other product development.
 */

package  gov.noaa.pmel.sgt;

import gov.noaa.pmel.sgt.dm.SGTData;

import gov.noaa.pmel.util.GeoDate;
import gov.noaa.pmel.util.Range2D;
import gov.noaa.pmel.util.Point2D;
import gov.noaa.pmel.util.Debug;
import gov.noaa.pmel.util.SoTRange;
import gov.noaa.pmel.util.SoTValue;
import gov.noaa.pmel.util.SoTPoint;

import java.util.Vector;
import java.util.Enumeration;
import java.awt.Graphics;
import java.awt.Event;
import java.awt.Rectangle;
import java.awt.Point;
import java.beans.PropertyChangeEvent;

/**
 * The CartesianGraph provides the transformation from user to
 * physical coordinates. A Cartesian graph has
 * horizontal and vertical transforms, from user to physical
 * coordinates, that are independent.
 * For example, yp = f(yu) and xp = g(xu), where
 * f() and g() are the vertical and horizontal transformations.
 * Multiple horizontal and vertical, X and Y, axes can be associated with
 * a CartesianGraph and their mapping of user to physical
 * coordinates is based on the AxisTransforms used.
 * The CartesianGraph also provide the support for
 * the rendering of data. The specific renderer is chosen based on
 * the type of SGTData and the data Attribute used.
 *

 * The following demonstrates how a CartesianGraph may be
 * used.
 *
 *

 *   // Create a CartesianGraph and transforms.
 *
 *    CartesianGraph graph;
 *    LinearTransform xt, yt;
 *    Range2D xPhysRange, xUserRange;
 *    Range2D yPhysRange, yUserRange;
 *    Point2D.Double origin;
 *
 *    graph = new CartesianGraph("Point Graph");
 *    layer.setGraph(graph);
 *    xt = new LinearTransform(xPhysRange, xUserRange);
 *    yt = new LinearTransform(yPhysRange, yUserRange);
 *    graph.setXTransform(xt);
 *    graph.setYTransform(yt);
 *    origin = new Point2D.Double(xUserRange.start,
 *                                yUserRange.start);
 *
 *     // Create the bottom axis, set its range in user units
 *     // and its origin. Add the axis to the graph.
 *
 *    PlainAxis xbot;
 *
 *    xbot = new PlainAxis("Botton Axis");
 *    xbot.setRangeU(xUserRange);
 *    xbot.setLocationU(origin);
 *    graph.addXAxis(xbot);
 *
 *     // Create the left axis, set its range in user units
 *     // and its origin. Add the axis to the graph.
 *
 *    PlainAxis yleft;
 *
 *    yleft = new PlainAxis("Left Axis");
 *    yleft.setRangeU(yUserRange);
 *    yleft.setLocationU(origin);
 *    graph.addYAxis(yleft);
 *
 *     // Create a PointAttribute for the display of the
 *     // Collection of points. The points will be marked
 *     // with a red triangle and labelled at the NE corner
 *     // in blue.
 *
 *    PointAttribute pattr;
 *
 *    pattr = new PointAttribute(10, Color.red);
 *
 *     // Associate the attribute and the point Collection
 *     // with the graph.
 *
 *    graph.setData(col, pattr);
 *

 *
 * @author Donald Denbo
 * @version $Revision: 1.2 $, $Date: 2006/01/19 14:45:48 $
 * @since 1.0
 */
public class CartesianGraph extends Graph {
  /**@associates Axis
   * @supplierCardinality 0..*
   * @clientRole xAxis_ */
  protected Vector xAxis_;
  /** @associates Axis
   * @clientRole yAxis_
   * @supplierCardinality 0..* */
  protected Vector yAxis_;
  /** @clientRole xTransform_
   * @link aggregation
   * @undirected */
  protected AxisTransform xTransform_;
  /** @clientRole tTransfrom_
   * @link aggregation
   * @undirected */
  protected AxisTransform yTransform_;
  protected boolean clipping_ = false;
  protected Range2D xClipRange_;
  protected Range2D yClipRange_;
  protected SoTRange.Time tClipRange_;
  /**@shapeType AggregationLink
   * @undirected
   * @clientCardinality 1
   * @supplierCardinality 1
   * @label renderer */
  private CartesianRenderer renderer_;
  /**
   * Default constructor.
   */
  public CartesianGraph() {
    this("");
  }
  /**
   * CartesianGraph constructor.
   * Creates default unity transforms.
   *
   * @param id CartesianGraph identifier
   */
  public CartesianGraph(String id) {
    this(id, new LinearTransform(0.0, 1.0, 0.0, 1.0),
         new LinearTransform(0.0, 1.0, 0.0, 1.0));
  }
  /**
   * Create a new CartesianGraph. Sets the identifier
   * and sets the x and y transforms.
   *
   * @param id identifier
   * @param xt x transform
   * @param yt y transform
   */
  public CartesianGraph(String id,AxisTransform xt,AxisTransform yt) {
    super(id);
    xAxis_ = new Vector(2,2);
    yAxis_ = new Vector(2,2);
    xTransform_ = xt;
    if(xTransform_ != null) xTransform_.addPropertyChangeListener(this);
    yTransform_ = yt;
    if(yTransform_ != null) yTransform_.addPropertyChangeListener(this);
  }
  /**
   * Create a copy of the CartesianGraph
   */
  public Graph copy() {
    throw new MethodNotImplementedError();
  }
  /**
   * Associates SGTData and Attribute with the
   * CartesianGraph.
   * A renderer is constucted based on the two arguements.
   *

   *

   *

   *
   *
SGTData
   *
   *
   *
Attribute
   *
   *
   *
CartesianRenderer
   *
   *

   *

   *            SGTPoint
   *            PontAttribute
   *            PointCartesianRenderer
   *

   *

   *            SGTLine
   *            LineAttribute
   *            LineCartesianRenderer
   *

   *

   *            SGTGrid
   *            GridAttribute
   *            GridCartesianRenderer
   *

   *

   *            SGTVector
   *            VectorAttribute
   *            VectorCartesianRenderer
   *

   *

   *            Collection
   *            PointAttribute
   *            PointCartesianRenderer
   *

   *

   *            Collection
   *            LineAttribute
   *            LineCartesianRenderer
   *

   *

   *            Collection
   *            VectorAttribute
   *            VectorCartesianRenderer
   *

   *

   *            Annotation
   *            n/a
   *            AnnotationCartesianRenderer
   *

   *

   *

   * @param data data to be rendered
   * @param attr rendering style information
   * @see CartesianRenderer#getRenderer
   */
  public void setData(SGTData data, Attribute attr) {
    renderer_ = CartesianRenderer.getRenderer(this, data, attr);
    data.addPropertyChangeListener(this);
  }
  /**
   * Get the renderer instance being used by the graph.
   *
   * @return renderer
   */
  public CartesianRenderer getRenderer() {
    return renderer_;
  }
  /**
   * Set the renderer used by the graph.
   *
   * @param rend a renderer object
   */
  public void setRenderer(CartesianRenderer rend) {
    renderer_ = rend;
  }
  /**
   * Draw the graph, axes, and render the data. This method should
   * not be directly called.
   *
   * @see Pane#draw
   */
  public void draw(Graphics g) {
    if(renderer_ != null) renderer_.draw(g);
    if(!xAxis_.isEmpty()) {
      for(Enumeration it = xAxis_.elements(); it.hasMoreElements();) {
        ((Axis)it.nextElement()).draw(g);
      }
    }
    if(!yAxis_.isEmpty()) {
      for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) {
        ((Axis)it.nextElement()).draw(g);
      }
    }
  }
  /**
   * Set the clipping rectangle in user coordinates.
   *
   * @param xmin minimum horizontal coordinate
   * @param xmax maximum horizontal coordinate
   * @param ymin minimum vertical coordinate
   * @param ymax maximum vertical coordinate
   */
  public void setClip(double xmin,double xmax,double ymin,double ymax) {
    if(xTransform_.isSpace() && yTransform_.isSpace()) {
      clipping_ = true;
      xClipRange_ = new Range2D(xmin, xmax);
      yClipRange_ = new Range2D(ymin, ymax);
    } else {
      clipping_ = false;
    }
  }
  /**
   * Set the clipping rectangle in user coordinates.
   *
   * @param tmin mimimum time
   * @param tmax maximum time
   * @param min miminum user coordinate
   * @param max maximum user coordinate
   */
  public void setClip(GeoDate tmin, GeoDate tmax, double min, double max) {
    if(xTransform_.isTime() || yTransform_.isTime()) {
      clipping_ = true;
      tClipRange_ = new SoTRange.Time(tmin.getTime(), tmax.getTime());
      if(xTransform_.isTime()) {
        yClipRange_ = new Range2D(min, max);
      } else {
        xClipRange_ = new Range2D(min, max);
      }
    } else {
      clipping_ = false;
    }
  }
  /**
   * Set the clipping rectangle in user coordinates.
   *
   * @since 3.0
   * @param tmin mimimum time
   * @param tmax maximum time
   * @param min miminum user coordinate
   * @param max maximum user coordinate
   */
  public void setClip(long tmin, long tmax, double min, double max) {
    if(xTransform_.isTime() || yTransform_.isTime()) {
      clipping_ = true;
      tClipRange_ = new SoTRange.Time(tmin, tmax);
      if(xTransform_.isTime()) {
        yClipRange_ = new Range2D(min, max);
      } else {
        xClipRange_ = new Range2D(min, max);
      }
    } else {
      clipping_ = false;
    }
  }
  /**
   * Set the clipping rectangle in user coordinates.
   * @since 2.0
   */
  public void setClip(SoTRange xr, SoTRange yr) {
    if(xr.isTime() || yr.isTime()) {
      SoTRange.Double dub;
      long tstart;
      long tend;
      if(xr.isTime()) {
        tstart = xr.getStart().getLongTime();
        tend = xr.getEnd().getLongTime();
        dub = (SoTRange.Double)yr;
      } else {
        tstart = yr.getStart().getLongTime();
        tend = yr.getEnd().getLongTime();
        dub = (SoTRange.Double)xr;
      }
      setClip(tstart, tend, dub.start, dub.end);
    } else {
      SoTRange.Double xrd = (SoTRange.Double)xr;
      SoTRange.Double yrd = (SoTRange.Double)yr;
      setClip(xrd.start, xrd.end, yrd.start, yrd.end);
    }
  }
  /**
   * Set the clipping property.
   *
   * @param clip clipping
   */
  public void setClipping(boolean clip) {
    clipping_ = clip;
  }
  /**
   * Test the clipping property.
   *
   * @return true if clipping is active
   */
  public boolean isClipping() {
    return clipping_;
  }
  /**
   * Add a X axis (Axis.HORIZONTAL) to the graph.
   *
   * @param id axis identifier
   * @param axis X axis
   * @see Axis
   * @see PlainAxis
   */
  public void addXAxis(String id,Axis axis) {
    if(id.length() != 0) axis.setId(id);
    addXAxis(axis);
  }
  /**
   * Add a X axis (Axis.HORIZONTAL) to the graph.
   * Uses the existing axis identifier.
   *
   * @param axis X axis
   * @see Axis
   * @see PlainAxis
   */
  public void addXAxis(Axis axis) {
    axis.setOrientation(Axis.HORIZONTAL);
    axis.setGraph(this);
    xAxis_.addElement(axis);
  }
  /**
   * Get a reference to an X axis.
   *
   * @param id axis identifier
   * @return axis found
   * @exception AxisNotFoundException An axis was not found with the correct identifier.
   * @see Axis
   * @see PlainAxis
   */
  public Axis getXAxis(String id) throws AxisNotFoundException  {
    if(!xAxis_.isEmpty()) {
      Axis ax;
      for(Enumeration it = xAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        if(ax.getId() == id) return ax;
      }
      throw new AxisNotFoundException();
    } else {
      throw new AxisNotFoundException();
    }
  }
  /**
   * Remove an X axis from the graph.
   *
   * @param id axis identifier
   * @exception AxisNotFoundException An axis was not found with the correct identifier.
   * @see Axis
   * @see PlainAxis
   */
  public void removeXAxis(String id) throws AxisNotFoundException  {
    if(!xAxis_.isEmpty()) {
      Axis ax;
      for(Enumeration it = xAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        if(ax.getId() == id) xAxis_.removeElement(ax);
      }
      throw new AxisNotFoundException();
    } else {
      throw new AxisNotFoundException();
    }
  }
  /**
   * Remove an X axis from the graph.
   *
   * @exception AxisNotFoundException An axis was not found with the correct identifier.
   * @see Axis
   * @see PlainAxis
   */
  public void removeXAxis(Axis axis) throws AxisNotFoundException  {
    if(!xAxis_.isEmpty()) {
      Axis ax;
      for(Enumeration it = xAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        if(ax.equals(axis)) xAxis_.removeElement(ax);
      }
      throw new AxisNotFoundException();
    } else {
      throw new AxisNotFoundException();
    }
  }
  /**
   * Remove all X axes from the graph.
   */
  public void removeAllXAxes() {
    xAxis_.removeAllElements();
  }
  /**
   * Get the number of X axes associated with the graph.
   *
   * @return number of axes
   * @see Axis
   * @see PlainAxis
   */
  public int getNumberXAxis() {
    return xAxis_.size();
  }
  /**
   * Get an Enumeration object for the X axes.
   *
   * @return enumeration
   */
  public Enumeration xAxisElements() {
    return xAxis_.elements();
  }
  /**
   * Add a Y axis (Axis.VERTICAL) to the graph.
   *
   * @param id axis identifier
   * @param axis Y axis
   * @see Axis
   * @see PlainAxis
   */
  public void addYAxis(String id,Axis axis) {
    if(id.length() != 0) axis.setId(id);
    addYAxis(axis);
  }
  /**
   * Add a Y axis (Axis.VERTICAL) to the graph.
   * Uses the existing axis identifier.
   *
   * @param axis Y axis
   * @see Axis
   * @see PlainAxis
   */
  public void addYAxis(Axis axis) {
    axis.setOrientation(Axis.VERTICAL);
    axis.setGraph(this);
    yAxis_.addElement(axis);
  }
  /**
   * Get a reference to an Y axis.
   *
   * @param id axis identifier
   * @return axis found
   * @exception AxisNotFoundException An axis was not found with the correct identifier.
   * @see Axis
   * @see PlainAxis
   */
  public Axis getYAxis(String id) throws AxisNotFoundException  {
    if(!yAxis_.isEmpty()) {
      Axis ax;
      for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        if(ax.getId() == id) return ax;
      }
      throw new AxisNotFoundException();
    } else {
      throw new AxisNotFoundException();
    }
  }
  /**
   * Remove an Y axis from the graph.
   *
   * @param id axis identifier
   * @exception AxisNotFoundException An axis was not found with the correct identifier.
   * @see Axis
   * @see PlainAxis
   */
  public void removeYAxis(String id) throws AxisNotFoundException  {
    if(!yAxis_.isEmpty()) {
      Axis ax;
      for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        if(ax.getId() == id) yAxis_.removeElement(ax);
      }
      throw new AxisNotFoundException();
    } else {
      throw new AxisNotFoundException();
    }
  }
  /**
   * Remove an Y axis from the graph.
   *
   * @exception AxisNotFoundException An axis was not found with the correct identifier.
   * @see Axis
   * @see PlainAxis
   */
  public void removeYAxis(Axis axis) throws AxisNotFoundException  {
    if(!yAxis_.isEmpty()) {
      Axis ax;
      for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        if(ax.equals(axis)) yAxis_.removeElement(ax);
      }
      throw new AxisNotFoundException();
    } else {
      throw new AxisNotFoundException();
    }
  }
  /**
   * Remove all Y axes from the graph.
   */
  public void removeAllYAxes() {
    yAxis_.removeAllElements();
  }
  /**
   * Get the number of Y axes associated with the graph.
   *
   * @return number of axes
   * @see Axis
   * @see PlainAxis
   */
  public int getNumberYAxis() {
    return yAxis_.size();
  }
  /**
   * Get an Enumeration object for the Y axes.
   *
   * @return enumeration
   */
  public Enumeration yAxisElements() {
    return yAxis_.elements();
  }
  /**
   * Set the X AxisTransform. This transform is used to convert
   * to and from user to physical coordinates.
   *
   * @param xfrm X transform
   * @see AxisTransform
   * @see LinearTransform
   */
  public void setXTransform(AxisTransform xfrm) {
    if(xTransform_ != null) xTransform_.removePropertyChangeListener(this);
    xTransform_ = xfrm;
    xTransform_.addPropertyChangeListener(this);
  }
  /**
   * Get the current X AxisTransform.
   *
   * @return X Transform
   * @see AxisTransform
   * @see LinearTransform
   */
  public AxisTransform getXTransform() {
    return xTransform_;
  }
  /**
   * Set the Y AxisTransform. This transform is used to convert
   * to and from user to physical coordinates.
   *
   * @param xfrm Y transform
   * @see AxisTransform
   * @see LinearTransform
   */
  public void setYTransform(AxisTransform xfrm) {
    if(yTransform_ != null) yTransform_.removePropertyChangeListener(this);
    yTransform_ = xfrm;
    yTransform_.addPropertyChangeListener(this);
  }
  /**
   * Get the current Y AxisTransform.
   *
   * @return Y Transform
   * @see AxisTransform
   * @see LinearTransform
   */
  public AxisTransform getYTransform() {
    return yTransform_;
  }
  //
  Object getObjectAt(Point pt) {
    Rectangle bnds;
    Axis ax;
    SGLabel lab;
    if(!xAxis_.isEmpty()) {
      for(Enumeration it = xAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        bnds = ax.getBounds();
        if(bnds.contains(pt)) {
          return ax;
        }
        lab = ax.getTitle();
        if((lab != null) && (lab.getLayer() != null)) {
          bnds = lab.getBounds();
          if(bnds.contains(pt)) {
            return lab;
          }
        }
      }
    }
    if(!yAxis_.isEmpty()) {
      for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) {
        ax = (Axis)it.nextElement();
        bnds = ax.getBounds();
        if(bnds.contains(pt)) {
          return ax;
        }
        lab = ax.getTitle();
        if(lab != null) {
          bnds = lab.getBounds();
          if(bnds.contains(pt)) {
            return lab;
          }
        }
      }
    }
    return (Object) null;
  }
  /**
   * Transform user X coordinate to physical coordinate.
   * @since 2.0
   */
  public double getXUtoP(double u) {
    return xTransform_.getTransP(u);
  }
  /**
   * Transform user X coordinate to device coordinate.
   * @since 2.0
   */
  public int getXUtoD(double u) {
    if(Double.isNaN(u)) return Integer.MIN_VALUE;
    return getLayer().getXPtoD(xTransform_.getTransP(u));
  }
  /**
   * Transform user X coordinate to device coordinate.
   * @since 3.0
   */
  public double getXUtoD2(double u) {
    if(Double.isNaN(u)) return u;
    return getLayer().getXPtoD2(xTransform_.getTransP(u));
  }
  /**
   * Transform GeoDate to physical coordinate.
   * @since 2.0
   */
  public double getXUtoP(GeoDate t) {
    return xTransform_.getTransP(t);
  }
  /**
   * Transform long to physical coordinate.
   * @since 3.0
   */
  public double getXUtoP(long t) {
    return xTransform_.getTransP(t);
  }
  /**
   * Transform GeoDate to device coordinate.
   * @since 2.0
   */
  public int getXUtoD(GeoDate t) {
    if(t == null) return Integer.MIN_VALUE;
    return getLayer().getXPtoD(xTransform_.getTransP(t));
  }
  /**
   * Transform long to device coordinate.
   * @since 3.0
   */
  public int getXUtoD(long t) {
    if(t == Long.MAX_VALUE) return Integer.MIN_VALUE;
    return getLayer().getXPtoD(xTransform_.getTransP(t));
  }
  /**
   * Transform GeoDate to device coordinate.
   * @since 3.0
   */
  public double getXUtoD2(GeoDate t) {
    if(t == null) return Double.NaN;
    return getLayer().getXPtoD2(xTransform_.getTransP(t));
  }
  /**
   * Transform long to device coordinate.
   * @since 3.0
   */
  public double getXUtoD2(long t) {
    if(t == Long.MAX_VALUE) return Double.NaN;
    return getLayer().getXPtoD2(xTransform_.getTransP(t));
  }
  /**
   * Transform X SoTValue to device coordinate.
   * @since 3.0
   */
  public int getXUtoD(SoTValue val) {
    if(val.isTime()) {
      return getXUtoD(val.getLongTime());
    } else {
      return getXUtoD(((SoTValue.Double)val).getValue());
    }
  }
  /**
   * Transform Y SoTValue to device coordinate.
   * @since 3.0
   */
  public int getYUtoD(SoTValue val) {
    if(val.isTime()) {
      return getYUtoD(val.getLongTime());
    } else {
      return getYUtoD(((SoTValue.Double)val).getValue());
    }
  }
  /**
   * Transform X SoTValue to device coordinate.
   * @since 3.0
   */
  public double getXUtoD2(SoTValue val) {
    if(val.isTime()) {
      return getXUtoD2(val.getLongTime());
    } else {
      return getXUtoD2(((SoTValue.Double)val).getValue());
    }
  }
  /**
   * Transform Y SoTValue to device coordinate.
   * @since 3.0
   */
  public double getYUtoD2(SoTValue val) {
    if(val.isTime()) {
      return getYUtoD2(val.getLongTime());
    } else {
      return getYUtoD2(((SoTValue.Double)val).getValue());
    }
  }
  /**
   * Transform X SoTValue to physical coordinate.
   * @since 3.0
   */
  public double getXUtoP(SoTValue val) {
    if(val.isTime()) {
      return getXUtoP(val.getLongTime());
    } else {
      return getXUtoP(((SoTValue.Double)val).getValue());
    }
  }
  /**
   * Transform Y SoTValue to physical coordinate.
   * @since 3.0
   */
  public double getYUtoP(SoTValue val) {
    if(val.isTime()) {
      return getYUtoP(val.getLongTime());
    } else {
      return getYUtoP(((SoTValue.Double)val).getValue());
    }
  }
  /**
   * Transform physical X coordinate to user coordinate using SoTValue
   * @param p physical coordinate
   * @return user coorindinate
   * @since 3.0
   */
  public SoTValue getXPtoSoT(double p) {
    if(xTransform_.isTime()) {
      return new SoTValue.Time(xTransform_.getLongTimeTransU(p));
    } else {
      return new SoTValue.Double(xTransform_.getTransU(p));
    }
  }
  /**
   * Transform physical X coordinate to user coordinate.
   *
   * @param p physical coorindate
   * @return user coordinate
   **/
  public double getXPtoU(double p) {
    return xTransform_.getTransU(p);
  }
  /**
   * Transform physical X coordinate to time.
   *
   * @param p physical coordinate
   * @return time
   **/
  public GeoDate getXPtoTime(double p) {
    return xTransform_.getTimeTransU(p);
  }
  /**
   * Transform physical X coordinate to time.
   *
   * @param p physical coordinate
   * @return time
   * @since 3.0
   **/
  public long getXPtoLongTime(double p) {
    return xTransform_.getLongTimeTransU(p);
  }
  /**
   * Transform physical coordinate to a SoTPoint
   *
   * @since 3.0
   * @param p physical coordinate
   * @return SoTPoint
   **/
  public SoTPoint getPtoU(Point2D.Double loc) {
    SoTValue xv;
    SoTValue yv;
    // x - transform
    if(xTransform_.isTime()) {
      xv = new SoTValue.Time(getXPtoLongTime(loc.x));
    } else {
      xv = new SoTValue.Double(getXPtoU(loc.x));
    }
    if(yTransform_.isTime()) {
      yv = new SoTValue.Time(getYPtoLongTime(loc.y));
    } else {
      yv = new SoTValue.Double(getYPtoU(loc.y));
    }
    return new SoTPoint(xv, yv);
  }
  /**
   * Transoform user Y coordinate to physical coordinate.
   * @since 2.0
   */
  public double getYUtoP(double u) {
    return yTransform_.getTransP(u);
  }
  /**
   * Transform user Y coordinate to device coordinate
   * @since 2.0
   */
  public int getYUtoD(double u) {
    if(Double.isNaN(u)) return Integer.MIN_VALUE;
    return getLayer().getYPtoD(yTransform_.getTransP(u));
  }
  /**
   * Transform user Y coordinate to device coordinate
   * @since 3.0
   */
  public double getYUtoD2(double u) {
    if(Double.isNaN(u)) return u;
    return getLayer().getYPtoD2(yTransform_.getTransP(u));
  }
  /**
   * Transform time to physical coordinate.
   * @since 2.0
   */
  public double getYUtoP(GeoDate t) {
    return yTransform_.getTransP(t);
  }
  /**
   * Transform time to physical coordinate.
   * @since 3.0
   */
  public double getYUtoP(long t) {
    if(t == Long.MAX_VALUE) return Double.NaN;
    return yTransform_.getTransP(t);
  }
  /**
   * Transform time to device coordinate.
   * @since 2.0
   */
  public int getYUtoD(GeoDate t) {
    if(t == null) return Integer.MIN_VALUE;
    return getLayer().getYPtoD(yTransform_.getTransP(t));
  }
  /**
   * Transform time to device coordinate.
   * @since 3.0
   */
  public int getYUtoD(long t) {
    if(t == Long.MAX_VALUE) return Integer.MIN_VALUE;
    return getLayer().getYPtoD(yTransform_.getTransP(t));
  }
  /**
   * Transform time to device coordinate.
   * @since 3.0
   */
  public double getYUtoD2(GeoDate t) {
    if(t == null) return Double.NaN;
    return getLayer().getYPtoD2(yTransform_.getTransP(t));
  }
  /**
   * Transform time to device coordinate.
   * @since 3.0
   */
  public double getYUtoD2(long t) {
    if(t == Long.MAX_VALUE) return Double.NaN;
    return getLayer().getYPtoD2(yTransform_.getTransP(t));
  }
  /**
   * Transform physical Y coordinate to user coordinate using SoTValue
   * @param p physical coordinate
   * @return user coorindinate
   * @since 3.0
   */
  public SoTValue getYPtoSoT(double p) {
    if(yTransform_.isTime()) {
      return new SoTValue.Time(yTransform_.getLongTimeTransU(p));
    } else {
      return new SoTValue.Double(yTransform_.getTransU(p));
    }
  }
  /**
   * Transform physical Y coordinate to user coordinate.
   *
   * @param p physical coorindate
   * @return user coordinate
   **/
  public double getYPtoU(double p) {
    return yTransform_.getTransU(p);
  }
  /**
   * Transform physical Y coordinate to time.
   *
   * @param p physical coordinate
   * @return time
   **/
  public GeoDate getYPtoTime(double p) {
    return yTransform_.getTimeTransU(p);
  }
  /**
   * Transform physical Y coordinate to time.
   *
   * @param p physical coordinate
   * @return time
   * @since 3.0
   **/
  public long getYPtoLongTime(double p) {
    return yTransform_.getLongTimeTransU(p);
  }

  public void propertyChange(PropertyChangeEvent evt) {
    //      if(Debug.EVENT) {
    //        System.out.println("CartesianGraph: " + evt);
    //        System.out.println("                " + evt.getPropertyName());
    //      }
    modified("CartesianGraph: propertyChange(" +
             evt.getSource().toString() + "[" +
             evt.getPropertyName() + "]" + ")");
  }
  /**
   * Find data at point
   * @since 3.0
   */
  public SGTData getDataAt(Point pt) {
    return renderer_.getDataAt(pt);
  }
}


text:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { throwError as observableThrowError, Observable } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { CURRENT_BASE_HREF } from "../../../../shared/units/utils";

export abstract class ScanApiRepository {
    abstract postSchedule(param): Observable<any>;

    abstract putSchedule(param): Observable<any>;

    abstract getSchedule(): Observable<any>;

}

@Injectable()
export class ScanApiDefaultRepository extends ScanApiRepository {
    constructor(
        private http: HttpClient,
    ) {
        super();
    }

    public postSchedule(param): Observable<any> {
        return this.http.post(`${CURRENT_BASE_HREF}/system/scanAll/schedule`, param)
            .pipe(catchError(error => observableThrowError(error)));
    }

    public putSchedule(param): Observable<any> {
        return this.http.put(`${CURRENT_BASE_HREF}/system/scanAll/schedule`, param)
            .pipe(catchError(error => observableThrowError(error)));
    }

    public getSchedule(): Observable<any> {
        return this.http.get(`${CURRENT_BASE_HREF}/system/scanAll/schedule`)
            .pipe(catchError(error => observableThrowError(error)));
    }

}


text:
namespace pxt {
    export let appTarget: TargetBundle;
    export let appTargetVariant: string;
    export let hwVariant: string;
}


text:
class Map:
    def __init__(self):
        self.collection=SkipList()

    def put(self,key,value):
        self.collection.insert(key,value)

    def get(self,key):
        return self.collection.search(key)


text:
<?php

final class PhabricatorRepositoryManagementRefsWorkflow
  extends PhabricatorRepositoryManagementWorkflow {

  protected function didConstruct() {
    $this
      ->setName('refs')
      ->setExamples('**refs** [__options__] __repository__ ...')
      ->setSynopsis(pht('Update refs in __repository__, named by callsign.'))
      ->setArguments(
        array(
          array(
            'name'        => 'verbose',
            'help'        => pht('Show additional debugging information.'),
          ),
          array(
            'name'        => 'repos',
            'wildcard'    => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $repos = $this->loadRepositories($args, 'repos');

    if (!$repos) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify one or more repositories to update refs for, '.
          'by callsign.'));
    }

    $console = PhutilConsole::getConsole();
    foreach ($repos as $repo) {
      $console->writeOut(
        "%s\n",
        pht("Updating refs in '%s'...", $repo->getCallsign()));

      $engine = id(new PhabricatorRepositoryRefEngine())
        ->setRepository($repo)
        ->setVerbose($args->getArg('verbose'))
        ->updateRefs();
    }

    $console->writeOut("%s\n", pht('Done.'));

    return 0;
  }

}


text:
//
//  Minimum Subarray.h
//  leetcodeInXcode
//
//  Created by Kaiqi on 6/7/15.
//  Copyright (c) 2015 edu.self. All rights reserved.
//

class Solution {
public:
    /**
     * @param nums: a list of integers
     * @return: A integer denote the sum of minimum subarray
     */
    int minSubArray(vector<int> nums) {
        // write your code here
        if (nums.empty()) return INT_MAX;
        int sum = 0, max_before = 0;
        int best = INT_MAX;
        for (int i = 0; i < nums.size(); i++) {
            sum += nums[i];
            best = min(best, sum - max_before);
            max_before = max(max_before, sum);
        }
        return best;
    }
};


text:
"""
Demo notification service.

For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.notify import BaseNotificationService

EVENT_NOTIFY = "notify"

def get_service(hass, config):
    """Get the demo notification service."""
    return DemoNotificationService(hass)

# pylint: disable=too-few-public-methods
class DemoNotificationService(BaseNotificationService):
    """Implement demo notification service."""

    def __init__(self, hass):
        """Initialize the service."""
        self.hass = hass

    @property
    def targets(self):
        """Return a dictionary of registered targets."""
        return {"test target name": "test target id"}

    def send_message(self, message="", **kwargs):
        """Send a message to a user."""
        kwargs['message'] = message
        self.hass.bus.fire(EVENT_NOTIFY, kwargs)


text:
package org.apache.hadoop.io.compress;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.compress.snappy.SnappyCompressor;
import org.apache.hadoop.io.compress.snappy.SnappyDecompressor;
import org.slf4j.LoggerFactory;

public class SnappyCodec extends AbstractCodec {

  static {
    LoggerFactory.getLogger(SnappyCodec.class).info("Using SDC Hadoop SnappyCodec");
  }

  public SnappyCodec() {
    super(SnappyCompressor.class, SnappyDecompressor.class, ".snappy");
  }

  @Override
  protected void init(Configuration conf) {
    int bufferSize = conf.getInt(CommonConfigurationKeys.IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY,
                             CommonConfigurationKeys.IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_DEFAULT);
    setBufferSize(bufferSize);
  }

  @Override
  protected int getCompressionOverhead() {
    return getBufferSize() / 6 + 32;
  }

  @Override
  public Compressor createCompressor() {
    return new SnappyCompressor(getBufferSize());
  }

  @Override
  public Decompressor createDecompressor() {
    return new SnappyDecompressor(getBufferSize());
  }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Pertusaria henricii var. subglobulifera Erichsen

### Remarks
null


text:
class Cms::Apis::CategoriesController < ApplicationController
  include Cms::ApiFilter

  model Cms::Node

  def index
    @items = @model.site(@cur_site).
      where(route: /^(category\/|opendata\/category)/).
      search(params[:s]).
      order_by(filename: 1).
      page(params[:page]).per(50)
  end
end


text:
sprockets-sassc
==============

**Integrate [Sassc](https://github.com/sass/sassc-ruby) with [Sprockets 2.x](https://github.com/rails/sprockets)**

Based on [Pete Browne's sprockets-sass](https://github.com/petebrowne/sprockets-sass) library and the official [SassC::Rails](https://github.com/sass/sassc-rails) project.

Copyright
---------

Copyright (c) 2015 [Widget Works](https://www.widgetworks.com.au). See LICENSE for details.


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SolidPrinciples.Model
{
    public class MenuItem
    {
        public virtual void GetPrerequisites()
        {
            //Getting Stuff
        }

        public virtual void Prepare()
        {
            //Preparing
        }

        public virtual void SendToService()
        {
            //Send to service
        }
    }
}


text:
from __future__ import print_function

# This Module collects bits and pieces from all over the place in one namespace
# to reduce import boilerplate.
# Purists may shake their fist and mutter angrily about the evils of 'from x import *'

__all__ = ['HTTPError', 'JSONRequestHandler', 'CORSAllRequestHandler', 'StaticFileHandler',
           'RequestHandler', 'http_handler', 'WSMsg', 'JSONMixin', 'CORSMixin', 'getLogger',
           'UrlDisplay', 'xhtml_escape', 'utf8', 'get_server','ExhibitionistRequestHandler']

# just a messy collection of everything you need
from tornado.web import StaticFileHandler, RequestHandler, HTTPError
from tornado.escape import xhtml_escape, utf8

from exhibitionist.decorators import http_handler, SUPER_CANARY
from exhibitionist.mixins.json import JSONMixin
from exhibitionist.mixins.cors import CORSMixin
from exhibitionist.providers.websocket import WSMsg

from exhibitionist.log import getLogger
from exhibitionist.util.common import UrlDisplay
from exhibitionist import get_server

class ExhibitionistRequestHandler(RequestHandler):
    """
    All views should use a RequestHandler derived from this class.
    This should enable us to introduce new behaviour in the future
    to be availabe with a package upgrade rather then rewriting views.
    Let's hope they remember to call super()

    """
    def __init__(self,*args,**kwds):
        super(ExhibitionistRequestHandler,self).__init__(*args,**kwds)
        # @http_handler checks for this and removes it before calling
        # the method. So we can issue a warning if the user
        # fails to call super().__init__
        setattr(self,SUPER_CANARY,True)

class JSONRequestHandler(JSONMixin(callback_arg="callback"), ExhibitionistRequestHandler):
    pass

class CORSAllRequestHandler(CORSMixin(allowed_domain="*"), JSONRequestHandler):
    pass


text:
from __future__ import unicode_literals

from django.db import migrations

from corehq.sql_db.operations import noop_migration

class Migration(migrations.Migration):

    dependencies = [
        ('cleanup', '0005_convert_mvp_checkpoints_to_sql'),
    ]

    operations = [
        noop_migration()
    ]


text:
package com.baidu.rigel.biplatform.tesseract.dataquery.udf;

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

import com.baidu.rigel.biplatform.ac.util.DeepcopyUtils;
import com.baidu.rigel.biplatform.parser.context.CompileContext;
import com.baidu.rigel.biplatform.parser.context.Condition;
import com.baidu.rigel.biplatform.parser.context.EmptyCondition;
import com.baidu.rigel.biplatform.parser.node.Node;
import com.baidu.rigel.biplatform.parser.node.impl.RateFunNode;
import com.baidu.rigel.biplatform.parser.node.impl.VariableNode;
import com.baidu.rigel.biplatform.tesseract.dataquery.udf.condition.RateCondition;
import com.baidu.rigel.biplatform.tesseract.dataquery.udf.condition.RateCondition.RateType;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

/**
 *
 * @author david.wang
 *
 */
abstract class TesseractRateFunction extends RateFunNode {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = -4597180338628840464L;

    public TesseractRateFunction() {
    }

    /**
     *
     * @param type
     * @return Map<Condition, Set<String>>
     */
    Map<Condition, Set<String>> collectVariableCondition(RateCondition.RateType type) {
        Set<String> variables = Sets.newHashSet();
        VariableNode variable = (VariableNode) this.getArgs().get(0);
        variables.add(variable.getVariableExp());
        Map<Condition, Set<String>> rs = Maps.newHashMap();
        Condition numeratorCondition = EmptyCondition.getInstance();//new RateCondition(true, type, variable.getVariableExp());
        rs.put(numeratorCondition, variables);
        Condition denominatorCondition = new RateCondition(false, type, variable.getVariableExp());
        rs.put(denominatorCondition, variables);
        return rs;
    }

    /* (non-Javadoc)
     * @see com.baidu.rigel.biplatform.parser.node.FunctionNode#preSetNodeResult(com.baidu.rigel.biplatform.parser.context.CompileContext)
     */
    @Override
    protected void preSetNodeResult(CompileContext context) {
        VariableNode variable = (VariableNode) this.getArgs().get(0);
        Condition condition = new RateCondition(false, getType(), variable.getVariableExp());
        variable.setResult(context.getVariablesResult().get(condition).get(variable.getVariableExp()));

        VariableNode numeratorNodeVar = DeepcopyUtils.deepCopy(variable);
        numeratorNodeVar.setResult(context.getVariablesResult().get(EmptyCondition.getInstance()).get(variable.getVariableExp()));
        this.getArgs().set(0, numeratorNodeVar);
        this.getArgs().add(variable);

//        super.preSetNodeResult(context);
    }

    abstract RateType getType();

    /*
     * (non-Javadoc)
     * @see com.baidu.rigel.biplatform.parser.node.impl.RateFunNode#check()
     */
    @Override
    public void check() {
//        super.check();
        if (this.getArgs() != null && this.getArgs().size() != 1) {
            throw new IllegalStateException("该函数必须包含并且只能包含一个参数");
        }
        Node node = this.getArgs().get(0);
        if (node == null || !(node instanceof VariableNode)) {
            throw new IllegalArgumentException("错误的参数类型,当前函数只接受Variable参数");
        }
    }

    @Override
    public int getArgsLength() {
        return 1;
    }
}


text:
package org.wso2.carbon.device.mgt.core.device.details.mgt;

import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;

import java.util.List;

/**
 * This class will manage the storing of device details related generic information such as cpu/memory utilization, battery level,
 * plugged in to a power source or operation on battery.
 * In CDM framework, we only keep the snapshot of the device information. So previous details are deleted as soon as new
 * data is arrived.
 */

public interface DeviceInformationManager {

    /**
     * This method will manage the storing of the device information as key value pairs.
     * @param deviceInfo - Device info object.
     * @throws DeviceDetailsMgtException
     */
    //void addDeviceInfo(DeviceInfo deviceInfo) throws DeviceDetailsMgtException;
    void addDeviceInfo(DeviceIdentifier deviceId, DeviceInfo deviceInfo) throws DeviceDetailsMgtException;

    /**
     * This method will return the device information.
     * @param deviceIdentifier - Device identifier, device type.
     * @return - Device information object.
     * @throws DeviceDetailsMgtException
     */
    DeviceInfo getDeviceInfo(DeviceIdentifier deviceIdentifier) throws DeviceDetailsMgtException;

    /**
     * This method will return device information for the supplied devices list.
     * @param deviceIdentifiers
     * @return List of device info objects
     * @throws DeviceDetailsMgtException
     */
    List<DeviceInfo> getDevicesInfo(List<DeviceIdentifier> deviceIdentifiers) throws DeviceDetailsMgtException;

    /**
     * This method will manage storing the device location as latitude, longitude, address, zip, country etc..
     * @param deviceLocation - Device location object.
     * @throws DeviceDetailsMgtException
     */
    void addDeviceLocation(DeviceLocation deviceLocation) throws DeviceDetailsMgtException;

    /**
     * This method will return the device location with latitude, longitude, address etc..
     * @param deviceIdentifier  - Device identifier, device type.
     * @return Device location object.
     * @throws DeviceDetailsMgtException
     */
    DeviceLocation getDeviceLocation(DeviceIdentifier deviceIdentifier) throws DeviceDetailsMgtException;

    /**
     * This method will return the device location with latitude, longitude, address etc.. of supplied devices.
     * @param deviceIdentifiers - List of Device identifier and device type.
     * @return Device Location list.
     * @throws DeviceDetailsMgtException
     */
    List<DeviceLocation> getDeviceLocations(List<DeviceIdentifier> deviceIdentifiers) throws DeviceDetailsMgtException;

//    /**
//     * This method will manage the storing of device application list.
//     * @param deviceApplication - Device application list.
//     * @throws DeviceDetailsMgtException
//     */
//    void addDeviceApplications(DeviceApplication deviceApplication) throws DeviceDetailsMgtException;
//
//    /**
//     * This method will return the application list of the device.
//     * @param deviceIdentifier - Device identifier, device type.
//     * @return - Device application list with device identifier.
//     * @throws DeviceDetailsMgtException
//     */
//    DeviceApplication getDeviceApplication(DeviceIdentifier deviceIdentifier) throws DeviceDetailsMgtException;
}


text:
namespace java.io
{
	[global::MonoJavaBridge.JavaClass()]
	public partial class EOFException : java.io.IOException
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		protected EOFException(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public EOFException() : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.io.EOFException._m0.native == global::System.IntPtr.Zero)
				global::java.io.EOFException._m0 = @__env.GetMethodIDNoThrow(global::java.io.EOFException.staticClass, "<init>", "()V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.io.EOFException.staticClass, global::java.io.EOFException._m0);
			Init(@__env, handle);
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public EOFException(java.lang.String arg0) : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::java.io.EOFException._m1.native == global::System.IntPtr.Zero)
				global::java.io.EOFException._m1 = @__env.GetMethodIDNoThrow(global::java.io.EOFException.staticClass, "<init>", "(Ljava/lang/String;)V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(java.io.EOFException.staticClass, global::java.io.EOFException._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
			Init(@__env, handle);
		}
		static EOFException()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::java.io.EOFException.staticClass = @__env.NewGlobalRef(@__env.FindClass("java/io/EOFException"));
		}
	}
}


text:
// Licensed to Cloudera, Inc. under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  Cloudera, Inc. licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import apiHelper from 'api/apiHelper';

const TIME_TO_LIVE_IN_MILLIS = 60000; // 1 minute

class HdfsAutocompleter {
  /**
   * @param {object} options
   * @param {string} options.user
   * @param {Number} options.timeout
   * @param {Snippet} options.snippet
   *
   * @constructor
   */
  constructor(options) {
    const self = this;
    self.user = options.user;
    self.snippet = options.snippet;
    self.timeout = options.timeout;
  }

  hasExpired(timestamp) {
    return new Date().getTime() - timestamp > TIME_TO_LIVE_IN_MILLIS;
  }

  extractFields(data) {
    const files = data.files.map(file => {
      return {
        name: file.name,
        type: file.type
      };
    });

    files.sort((a, b) => a.name.localeCompare(b.name));

    const result = [];
    files.forEach((field, idx) => {
      if (field.name !== '..' && field.name !== '.') {
        result.push({
          value: field.name,
          score: 1000 - idx,
          meta: field.type
        });
      }
    });
    return result;
  }

  autocomplete(beforeCursor, afterCursor, callback, editor) {
    const self = this;

    const onFailure = function () {
      callback([]);
    };

    if (beforeCursor.match(/["'](?:\/[^\/]*)+/)) {
      const parts = beforeCursor.split('/');
      // Drop the first " or '
      parts.shift();
      // Last one is either partial name or empty
      parts.pop();

      const successCallback = function (data) {
        if (!data.error) {
          callback(self.extractFields(data));
        } else {
          onFailure();
        }
      };

      apiHelper.fetchHdfsPath({
        pathParts: parts,
        successCallback: successCallback,
        silenceErrors: true,
        errorCallback: onFailure,
        timeout: self.timeout,
        editor: editor
      });
    } else {
      onFailure();
    }
  }

  getDocTooltip(item) {}
}

export default HdfsAutocompleter;


text:
class Test {
    /**
     *  @throws <warning>SomeClass</warning> asdfasd
     */
     public void foo() {}

     class SomeClass     {}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.indigenedroiddemo"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name="com.indigenedroiddemo.MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.indigenedroiddemo.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.indigenedroiddemo.MyListActivity"
            android:label="@string/title_activity_my_list" >
        </activity>
        <activity
            android:name="com.indigenedroiddemo.MyActivity"
            android:label="@string/title_activity_my" >
        </activity>
    </application>

</manifest>


text:
// Copyright (C) 2017 Viacheslav Shynkarenko.
// All Rights Reserved.

using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle( "Tests" )]
[assembly: AssemblyDescription( "Tests for the Rush library" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Viacheslav Shynkarenko" )]
[assembly: AssemblyProduct( "Tests" )]
[assembly: AssemblyCopyright( "Copyright © Viacheslav Shynkarenko 2017" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.

[assembly: ComVisible( false )]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid( "75f38a86-1826-4f70-ba33-5d87532f301f" )]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]


text:
package edu.ur.persistent;

import edu.ur.simple.type.DescriptionAware;
import edu.ur.simple.type.NameAware;

/**
 * Abstract class for many simple type classes.
 *
 * @author Nathan Sarr
 *
 */
public abstract class CommonPersistent extends BasePersistent
        implements DescriptionAware, NameAware
{

    /** eclipse generated serial id */
	private static final long serialVersionUID = -2896794034127562638L;

	/**  Name for the object. */
    protected String name;

    /**  Generic description. */
    protected String description;

    /**
     * Get the description
     *
     * @see edu.ur.simple.type.DescriptionAware#getDescription()
     */
    public String getDescription()
    {
        return description;
    }

    /**
     * Set the description.
     *
     * @param description
     */
    public void setDescription(String description)
    {
        this.description = description;
    }

    /**
     * Get the name
     *
     * @see edu.ur.simple.type.NameAware#getName()
     */
    public String getName()
    {
        return name;
    }

    /**
     * Set the name.  this performs a trim on the name
     *
     * @param name
     */
    public void setName(String name)
    {
        this.name = name.trim();
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="32dp"
        android:background="@drawable/genre"
        android:layout_margin="4dp"
        android:orientation="horizontal">

        <pasta.music.views.CircleImageView
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:src="#BDBDBD"
            android:id="@+id/image" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:paddingStart="8dp"
            android:paddingLeft="8dp"
            android:paddingEnd="12dp"
            android:paddingRight="12dp"
            android:ellipsize="end"
            android:lines="1"
            android:maxLines="1"
            android:singleLine="true"
            android:textColor="#8A000000"
            android:gravity="center"
            android:id="@+id/title"
            android:text="something" />

    </LinearLayout>

</FrameLayout>


text:
<?php

namespace lithium\tests\cases\console\command;

use lithium\console\command\Route;
use lithium\console\Request;
use lithium\net\http\Router;
use lithium\core\Libraries;

/**
 * The RouteTest class tests the "li3 route" command.
 */
class RouteTest extends \lithium\test\Unit {

	/**
	 * Holds config params.
	 *
	 * @var array
	 */
	protected $_config = array('routes' => null);

	/**
	 * Holds the temporary test path.
	 *
	 * @var string
	 */
	protected $_testPath = null;

	/**
	 * Set the testPath and check if it is writable (skip if not).
	 */
	public function skip() {
		$path = Libraries::get(true, 'resources');

		if (is_writable($path) && !is_dir("{$path}/tmp/tests")) {
			mkdir("{$path}/tmp/tests", 0777, true);
		}
		$this->_testPath = "{$path}/tmp/tests";
		$this->skipIf(!is_writable($this->_testPath), "Path `{$this->_testPath}` is not writable.");
	}

	/**
	 * Create a temporary routes.php file for testing and reset the router.
	 */
	public function setUp() {
		$this->_config['routes'] = "{$this->_testPath}/routes.php";

		$testParams = 'array("controller" => "lithium\test\Controller")';
		$content = array(
			'<?php',
			'use lithium\net\http\Router;',
			'use lithium\core\Environment;',
			'Router::connect("/", "Pages::view");',
			'Router::connect("/pages/{:args}", "Pages::view");',
			'if (!Environment::is("production")) {',
			'	Router::connect("/test/{:args}", ' . $testParams . ');',
			'	Router::connect("/test", ' . $testParams . ');',
			'}',
			'?>'
		);
		file_put_contents($this->_config['routes'], join("\n", $content));
	}

	/**
	 * Delete the temporary routes.php file.
	 */
	public function tearDown() {
		if (file_exists($this->_config['routes'])) {
			unlink($this->_config['routes']);
		}
		Router::reset();
	}

	/**
	 * Tests if the default environment is loaded correctly
	 * and if overriding works as expected.
	 */
	public function testEnvironment() {
		$command = new Route(array('routes' => $this->_config['routes']));
		$expected = 'development';
		$this->assertEqual($expected, $command->env);

		$request = new Request();
		$request->params['env'] = 'production';
		$command = new Route(compact('request') + array('routes' => $this->_config['routes']));
		$this->assertEqual('production', $command->env);
	}

	/**
	 * Test if the routes.php file is loaded correctly and the
	 * routes are connected to the router.
	 */
	public function testRouteLoading() {
		$this->assertEmpty(Router::get(null, true));
		$command = new Route(array('routes' => $this->_config['routes']));
		$this->assertCount(4, Router::get(null, true));

		Router::reset();

		$request = new Request();
		$request->params['env'] = 'production';
		$command = new Route(compact('request') + array('routes' => $this->_config['routes']));
		$this->assertCount(2, Router::get(null, true));
	}

	/**
	 * Tests the "all" command without an env param.
	 *
	 * Don't be confused if the expected output doesn't make sense here. We are
	 * stripping the whitespace away so that this source code is easier to read.
	 * Built-In methods are used for output formatting and are tested elsewhere.
	 */
	public function testAllWithoutEnvironment() {
		$command = new Route(array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
			'request' => new Request()
		));

		$command->all();

		$expected = 'TemplateParams--------------';
		$expected .= '/{"controller":"Pages","action":"view"}';
		$expected .= '/pages/{:args}{"controller":"Pages","action":"view"}';
		$expected .= '/test/{:args}{"controller":"lithium\\test\\\\Controller","action":"index"}';
		$expected .= '/test{"controller":"lithium\\test\\\\Controller","action":"index"}';
		$this->assertEqual($this->_strip($expected),$this->_strip($command->response->output));
	}

	/**
	 * Tests the "all" command with an env (production) param.
	 *
	 * Don't be confused if the expected output doesn't make sense here. We are
	 * stripping the whitespace away so that this source code is easier to read.
	 * Built-In methods are used for output formatting and are tested elsewhere.
	 */
	public function testAllWithEnvironment() {
		$request = new Request();
		$request->params = array(
			'env' => 'production'
		);
		$command = new Route(compact('request') + array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
		));

		$command->all();

		$expected = 'TemplateParams--------------';
		$expected .= '/{"controller":"Pages","action":"view"}';
		$expected .= '/pages/{:args}{"controller":"Pages","action":"view"}';
		$this->assertEqual($this->_strip($expected),$this->_strip($command->response->output));
	}

	/**
	 * Test the alias method for "all".
	 */
	public function testRun() {
		$command = new Route(array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
			'request' => new Request()
		));

		$command->run();

		$expected = 'TemplateParams--------------';
		$expected .= '/{"controller":"Pages","action":"view"}';
		$expected .= '/pages/{:args}{"controller":"Pages","action":"view"}';
		$expected .= '/test/{:args}{"controller":"lithium\\test\\\\Controller","action":"index"}';
		$expected .= '/test{"controller":"lithium\\test\\\\Controller","action":"index"}';
		$this->assertEqual($this->_strip($expected),$this->_strip($command->response->output));
	}

	/**
	 * Test the show command with no route.
	 */
	public function testShowWithNoRoute() {
		$command = new Route(array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse'),
			'request' => new Request()
		));

		$command->show();

		$expected = "Please provide a valid URL\n";
		$this->assertEqual($expected, $command->response->error);
	}

	/**
	 * Test the show command with an invalid route.
	 */
	public function testShowWithInvalidRoute() {
		$request = new Request();
		$request->params = array(
			'args' => array('/foobar')
		);
		$command = new Route(compact('request') + array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
		));
		$command->show();

		$expected = "No route found.\n";
		$this->assertEqual($expected, $command->response->output);
	}

	/**
	 * Test the show command with a valid route.
	 */
	public function testShowWithValidRoute() {
		$request = new Request();
		$request->params = array('args' => array('/'));
		$command = new Route(compact('request') + array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
		));
		$command->show();

		$expected = "{\"controller\":\"Pages\",\"action\":\"view\"}\n";
		$this->assertEqual($expected, $command->response->output);
	}

	/**
	 * Test the show command with a env param.
	 */
	public function testShowWithEnvironment() {
		$request = new Request();
		$request->params = array(
			'env' => 'production',
			'args' => array('/test')
		);
		$command = new Route(compact('request') + array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
		));

		$command->show();

		$expected = "No route found.\n";
		$this->assertEqual($expected, $command->response->output);
	}

	/**
	 * Test the show command with http method.
	 *
	 * This tests a call similar to "li3 route GET /".
	 */
	public function testShowWithHttpMethod() {
		$request = new Request();
		$request->params = array(
			'args' => array('post', '/')
		);
		$command = new Route(compact('request') + array(
			'routes' => $this->_config['routes'],
			'classes' => array('response' => 'lithium\tests\mocks\console\MockResponse')
		));

		$command->show();

		$expected = "{\"controller\":\"Pages\",\"action\":\"view\"}\n";
		$this->assertEqual($expected, $command->response->output);
	}

	/**
	 * Remove formatting whitespace, tabs and newlines for better sourcecode
	 * readability.
	 *
	 * @param string $str A string from which to strip spaces
	 * @return string Returns the value of `$str` with all whitespace removed.
	 */
	protected function _strip($str) {
		return preg_replace('/\s/', '', $str);
	}
}

?>


text:
<!-- Thanks for filing an issue! Before hitting the button, please answer these questions.
It's helpful to search the existing GitHub issues first. It's likely that another user
has already reported the issue you're facing, or it's a known issue that we're already aware of-->

**Is this a request for help?**:

---

**Is this a BUG REPORT or FEATURE REQUEST?** (choose one):

<!--
If this is a BUG REPORT, please:
  - Fill in as much of the template below as you can.  If you leave out
    information, we can't help you as well.

If this is a FEATURE REQUEST, please:
  - Describe *in detail* the feature/behavior/change you'd like to see.

In both cases, be ready for followup questions, and please respond in a timely
manner.  If we can't reproduce a bug or think a feature already exists, we
might close your issue.  If we're wrong, PLEASE feel free to reopen it and
explain why.
-->

**Version of Helm and Kubernetes**:

**Which chart**:

**What happened**:

**What you expected to happen**:

**How to reproduce it** (as minimally and precisely as possible):

**Anything else we need to know**:


text:
"""Pytest configuration."""

from __future__ import absolute_import, print_function

import os
import shutil
import tempfile

import pytest
from flask import Flask
from invenio_db import InvenioDB
from sqlalchemy_utils.functions import create_database, database_exists

from invenio_pidstore import InvenioPIDStore

@pytest.yield_fixture()
def app(request):
    """Flask application fixture."""
    # Set temporary instance path for sqlite
    instance_path = tempfile.mkdtemp()
    app = Flask('testapp', instance_path=instance_path)
    InvenioDB(app)
    InvenioPIDStore(app)

    app.config.update(
        SQLALCHEMY_DATABASE_URI=os.environ.get(
            'SQLALCHEMY_DATABASE_URI', 'sqlite:///test.db'),
        TESTING=True,
    )

    with app.app_context():
        yield app

    # Teardown instance path.
    shutil.rmtree(instance_path)

@pytest.yield_fixture()
def db(app):
    """Database fixture."""
    from invenio_db import db as db_
    if not database_exists(str(db_.engine.url)):
        create_database(str(db_.engine.url))
    db_.create_all()

    yield db_

    db_.session.remove()
    db_.drop_all()


text:
import json
from bson.objectid import ObjectId
import sys_modules.database as db
import sms as sms

def message_send(request):
    message_stuff = request.form#.getlist('l')[0]
    message = {
        'to':  message_stuff.getlist('to'),
        'from': message_stuff.getlist('from'),
        'content': message_stuff.getlist('content')
    }
    db.db_insert("messages",message)
    sms.send_sms("123456", message_stuff.getlist('content'))
    return "Message Sent"

def message_inbox(request):
    """Request needs a username, returns an array of messages"""
    username = request.args.getlist('username')[0]
    #The messages to a, the person requesting. The request should be in hte username header.
    all_messages = db.db_find("messages",{'to':username})

    for message in all_messages:
        message['_id'] = str(message['_id'])

    return json.dumps(all_messages)

def message_read(request):
    """Requires you to pass the message _id"""
    message_id = request.form.getlist('id')[0]

    db.db_update('messages', {'_id': ObjectId(message_id)}, {'$set': {'read': True}})
    return "done"