text:
import React from 'react';
import { Grid, Row, Col, Form, FormGroup, ControlLabel, FormControl, HelpBlock, Button, Checkbox } from 'react-bootstrap';
import { browserHistory, Link } from 'react-router';
import axios from 'axios';

class EditProfile extends React.Component {
  constructor(props){
		super(props)
		this.state = {
      name: props.currentUser.name,
      email: props.currentUser.email,
      tech: props.currentUser.tech,
      prompt: 'Tech Skills (separate by commas)',
      location: props.currentUser.location || '',
      otherHunters: props.currentUser.otherHunters || false
		}
	}

  commaCount() {
    let commas = 0;
    for (var i = 0; i<this.state.tech.length; i++) {
      if (this.state.tech[i] === ',') {
        commas++;
      }
    };
    if (commas === 1) {
      this.setState({
        prompt: "Cool, what else can you do?"
      })
    } else if (commas === 2) {
      this.setState({
        prompt: "Terrific, keep going!"
      })
    } else if (commas >= 3) {
      this.setState({
        prompt: "Wow, you've got skills!"
      })
    }
  }

  handleAllowChange (event) {
    this.setState({
      otherHunters: !this.state.otherHunters
    })
  }

  handleNameChange (event) {
    this.setState({
      name: event.target.value
    })
  }

  handleEmailChange (event) {
    this.setState({
      email: event.target.value
    })
  }

  handleSkillsChange (event) {
    this.setState({
      tech: event.target.value
    });
    this.commaCount();
  }

  handleZipcodeChange (event) {
    this.setState({
      location: event.target.value
    })
  }

  // getValidationState () {
  //   const length = this.state.location.length;
  //   const nump = isNaN(this.state.location);
  //   if (!nump && length === 5) return 'success';
  //   else if (nump || length!== 5) return 'error';
  // }

	render() {
    let otherHuntersBox = this.state.otherHunters ?
      <Checkbox onChange={this.handleAllowChange.bind(this)} checked>Allow Other Hunters to Find Me?</Checkbox>
      :
      <Checkbox onChange={this.handleAllowChange.bind(this)}>Allow Other Hunters to Find Me?</Checkbox>

		return (

	      <Form>

Edit Your Profile

	        <FormGroup controlId="formBasicText">
            <ControlLabel>Name</ControlLabel>
            <FormControl
              type="text"
              className="edit-profile-input"
              value={this.state.name}
              placeholder="Enter your name."
              onChange={this.handleNameChange.bind(this)}
            />
          </FormGroup>

          <FormGroup controlId="formBasicText">
            <ControlLabel>E-mail</ControlLabel>
            <FormControl
              type="text"
              className="edit-profile-input"
              value={this.state.email}
              placeholder="Enter your email."
              onChange={this.handleEmailChange.bind(this)}
            />
          </FormGroup>

          <FormGroup controlId="formBasicText">
            <ControlLabel>{this.state.prompt}</ControlLabel>
            <FormControl
              type="text"
              className="edit-profile-input"
              value={this.state.tech}
              placeholder="List your tech skills."
              onChange={this.handleSkillsChange.bind(this)}
            />
          </FormGroup>
          <FormGroup
            controlId="formBasicText"
          >
            <ControlLabel>Zipcode</ControlLabel>
            <FormControl
              type="text"
              className="edit-profile-input"
              value={this.state.location}
              placeholder="Enter your zipcode, if you wish."
              onChange={this.handleZipcodeChange.bind(this)}
            />
          </FormGroup>
          {otherHuntersBox}
          <HelpBlock className='edit-profile-help'>If this box is checked and you enter your zipcode, other hunters in your area will be shown your name, email address, and tech skills in our Connect with Other Hunters page. Connect with others in your area and get networking!</HelpBlock>
          <Button
            className='search-btn'
            onClick={() => this.props.submitProfile({
              name: this.state.name,
              email: this.state.email,
              tech: this.state.tech,
              location: this.state.location,
              otherHunters: this.state.otherHunters
            })}
          >
            Submit Profile</Button>
	      </Form>

		)
	}
}

module.exports = EditProfile;


text:
require "spec_helper"

describe StringMetric::Levenshtein::IterativeWithTwoMatrixRowsOptimized do
  it_behaves_like "Levenshtein Distance", { strategy: :two_matrix_rows_v2 }
end

redpajama_set_name: RedPajamaGithub


text:
from django.conf.urls import url, include
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
]
admin.site.site_header = _('Smart and Active Classroom')


text:
package qmaze.Environment;

import java.util.ArrayList;

/**
 *TODO: consistently do x,y or coordinates
 * @author katharine
 * The Maze knows:
 *  - It's size
 *  - The rooms it contains
 *  - Where the start and end (goal) is
 * The Maze does not know:
 *  - About the agent
 * Through the Maze we can ask:
 *  - Questions about state for specific locations in the maze.
 * Through the Maze we can control:
 *  - Locations that are opened or closed
 * Shouldn't do:
 *  - Reveal rooms.
 *
 * COLUMN IS X
 * ROW IS Y
 */
public class Maze {

    private final ArrayList<Room> rooms;
    private Room goal;

    public Maze(int rows, int columns) {
        this.rooms = new ArrayList();
        buildMaze(rows, columns);
    }

    private Room getRoom(Coordinates state) {

        Room roomToFind = new Room(state);
        for (Room room: rooms) {
            if (room.hasSameLocation(roomToFind)) {
                return room;
            }
        }
        return null;
    }

    public void setOpen(Coordinates state, boolean open) {

        Room r = getRoom(state);
        r.open(open);
    }

    public void setGoalState(Coordinates state, int reward) {
        goal = getRoom(state);
        goal.setReward(reward);
    }

    public boolean isGoalState(Coordinates state) {
        Room room = getRoom(state);
        return room.equals(goal);
    }

    public double getReward(Coordinates action) {
        Room r = getRoom(action);
        return r.getReward();
    }

    private void buildMaze(int rows, int columns) {
        for (int row=0; row<rows; row++) {
            for (int column=0; column<columns; column++) {
                Room r = new Room(column, row);
                rooms.add(r);
            }
        }
    }

    public ArrayList<Coordinates> getAdjoiningStates(Coordinates state) {
        Room r = getRoom(state);
        ArrayList<Coordinates> adjoiningRooms = new ArrayList();
        rooms.stream().filter((otherRoom) -> (otherRoom.isOpen() && otherRoom.adjoins(r))).forEachOrdered((otherRoom) -> {
            adjoiningRooms.add(new Coordinates(otherRoom.getXCoordinate(), otherRoom.getYCoordinate()));
        });
        return adjoiningRooms;
   }
}


text:
package org.citydb.gui.operation.exporter.view;

import org.citydb.config.Config;
import org.citydb.config.geometry.BoundingBox;
import org.citydb.config.i18n.Language;
import org.citydb.config.project.exporter.*;
import org.citydb.config.project.global.LogLevel;
import org.citydb.config.project.query.QueryConfig;
import org.citydb.config.project.query.filter.counter.CounterFilter;
import org.citydb.config.project.query.simple.SimpleAttributeFilter;
import org.citydb.config.project.query.simple.SimpleFeatureVersionFilter;
import org.citydb.config.project.query.simple.SimpleFeatureVersionFilterMode;
import org.citydb.core.database.DatabaseController;
import org.citydb.core.file.output.OutputFileFactory;
import org.citydb.core.operation.exporter.CityGMLExportException;
import org.citydb.core.operation.exporter.CityGMLExportException.ErrorCode;
import org.citydb.core.operation.exporter.controller.Exporter;
import org.citydb.core.registry.ObjectRegistry;
import org.citydb.core.util.Util;
import org.citydb.gui.components.dialog.ConfirmationCheckDialog;
import org.citydb.gui.components.dialog.ExportStatusDialog;
import org.citydb.gui.components.popup.PopupMenuDecorator;
import org.citydb.gui.plugin.util.DefaultViewComponent;
import org.citydb.gui.plugin.view.ViewController;
import org.citydb.gui.util.GuiUtil;
import org.citydb.util.event.EventDispatcher;
import org.citydb.util.event.global.InterruptEvent;
import org.citydb.util.log.Logger;

import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.xml.datatype.DatatypeConstants;
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.locks.ReentrantLock;

public class ExportPanel extends DefaultViewComponent implements DropTargetListener {
	private final ReentrantLock mainLock = new ReentrantLock();
	private final Logger log = Logger.getInstance();
	private final ViewController viewController;
	private final DatabaseController databaseController;
	private final Config config;

	private JTextField browseText;
	private JButton browseButton;
	private FilterPanel filterPanel;
	private JButton exportButton;
	private JToggleButton simpleFilterButton;
	private JToggleButton xmlQueryButton;

	public ExportPanel(ViewController viewController, Config config) {
		this.viewController = viewController;
		this.config = config;

		databaseController = ObjectRegistry.getInstance().getDatabaseController();
		initGui();
	}

	private void initGui() {
		browseText = new JTextField();
		browseButton = new JButton();
		filterPanel = new FilterPanel(viewController, config);
		exportButton = new JButton();
		simpleFilterButton = new JToggleButton();
		xmlQueryButton = new JToggleButton();

		JToolBar toolBar = new JToolBar();
		toolBar.setBorder(BorderFactory.createEmptyBorder());
		toolBar.add(simpleFilterButton);
		toolBar.add(xmlQueryButton);

		ButtonGroup buttonGroup = new ButtonGroup();
		buttonGroup.add(simpleFilterButton);
		buttonGroup.add(xmlQueryButton);

		browseButton.addActionListener(e -> saveFile(Language.I18N.getString("main.tabbedPane.export")));

		PopupMenuDecorator.getInstance().decorate(browseText);

		exportButton.addActionListener(e -> new SwingWorker<Void, Void>() {
			protected Void doInBackground() {
				doExport();
				return null;
			}
		}.execute());

		setLayout(new GridBagLayout());

		JPanel filePanel = new JPanel();
		filePanel.setLayout(new GridBagLayout());
		filePanel.add(browseText, GuiUtil.setConstraints(0, 0, 1, 1, GridBagConstraints.BOTH, 0, 0, 0, 5));
		filePanel.add(browseButton, GuiUtil.setConstraints(1, 0, 0, 0, GridBagConstraints.NONE, 0, 5, 0, 0));

		JPanel view = new JPanel();
		view.setLayout(new GridBagLayout());
		view.add(filterPanel, GuiUtil.setConstraints(0, 0, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, 0, 10, 0, 10));

		JPanel buttonPanel = new JPanel();
		buttonPanel.setLayout(new GridBagLayout());
		buttonPanel.add(exportButton, GuiUtil.setConstraints(0, 0, 2, 1, 1, 0, GridBagConstraints.NONE, 5, 5, 5, 5));
		buttonPanel.add(toolBar, GuiUtil.setConstraints(1, 0, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, 5, 5, 5, 0));

		add(filePanel, GuiUtil.setConstraints(0, 0, 1, 0, GridBagConstraints.HORIZONTAL, 15, 10, 15, 10));
		add(view, GuiUtil.setConstraints(0, 1, 1, 1, GridBagConstraints.BOTH, 0, 0, 0, 0));
		add(buttonPanel, GuiUtil.setConstraints(0, 2, 1, 0, GridBagConstraints.HORIZONTAL, 5, 10, 5, 10));

		DropTarget dropTarget = new DropTarget(browseText, this);
		browseText.setDropTarget(dropTarget);
		setDropTarget(dropTarget);

		simpleFilterButton.addActionListener(e -> switchFilterMode());
		xmlQueryButton.addActionListener(e -> switchFilterMode());
	}

	private void switchFilterMode() {
		filterPanel.showFilterDialog(simpleFilterButton.isSelected());
	}

	@Override
	public void switchLocale(Locale locale) {
		browseButton.setText(Language.I18N.getString("common.button.browse"));
		exportButton.setText(Language.I18N.getString("export.button.export"));
		simpleFilterButton.setText(Language.I18N.getString("filter.button.mode.simple"));
		xmlQueryButton.setText(Language.I18N.getString("filter.button.mode.xml"));
		filterPanel.switchLocale(locale);
	}

	@Override
	public void loadSettings() {
		filterPanel.loadSettings();
		boolean useSimpleFilter = config.getExportConfig().isUseSimpleQuery();
		simpleFilterButton.setSelected(useSimpleFilter);
		xmlQueryButton.setSelected(!useSimpleFilter);
		filterPanel.showFilterDialog(useSimpleFilter);
	}

	@Override
	public void setSettings() {
		config.getExportConfig().setUseSimpleQuery(simpleFilterButton.isSelected());

		try {
			Paths.get(browseText.getText());
		} catch (InvalidPathException e) {
			log.error("The provided output file '" + browseText.getText() + "' is not a valid file.");
			browseText.setText("");
		}

		filterPanel.setSettings();
	}

	private void doExport() {
		final ReentrantLock lock = this.mainLock;
		lock.lock();

		try {
			viewController.clearConsole();
			setSettings();

			int tileAmount = 0;

			if (browseText.getText().trim().isEmpty()) {
				viewController.errorMessage(Language.I18N.getString("export.dialog.error.incompleteData"),
						Language.I18N.getString("export.dialog.error.incompleteData.dataset"));
				return;
			}

			boolean useTiling = false;

			if (config.getExportConfig().isUseSimpleQuery()) {
				SimpleQuery query = config.getExportConfig().getSimpleQuery();

				// feature version filter
				if (query.isUseFeatureVersionFilter()) {
					SimpleFeatureVersionFilter featureVersionFilter = query.getFeatureVersionFilter();

					if (featureVersionFilter.getMode() == SimpleFeatureVersionFilterMode.AT
							|| featureVersionFilter.getMode() == SimpleFeatureVersionFilterMode.TERMINATED_AT) {
						if (!featureVersionFilter.isSetStartDate()) {
							viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
									Language.I18N.getString("export.dialog.error.featureVersion.date"));
							return;
						}
					} else if (featureVersionFilter.getMode() == SimpleFeatureVersionFilterMode.BETWEEN) {
						if (!featureVersionFilter.isSetStartDate()) {
							viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
									Language.I18N.getString("export.dialog.error.featureVersion.startDate"));
							return;
						} else if (!featureVersionFilter.isSetEndDate()) {
							viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
									Language.I18N.getString("export.dialog.error.featureVersion.endDate"));
							return;
						} else if (featureVersionFilter.getStartDate().compare(featureVersionFilter.getEndDate()) != DatatypeConstants.LESSER) {
							viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
									Language.I18N.getString("export.dialog.error.featureVersion.range"));
							return;
						}
					}
				}

				// attribute filter
				if (query.isUseAttributeFilter()) {
					SimpleAttributeFilter attributeFilter = query.getAttributeFilter();
					if (!attributeFilter.getResourceIdFilter().isSetResourceIds()
							&& !attributeFilter.getNameFilter().isSetLiteral()
							&& !attributeFilter.getLineageFilter().isSetLiteral()) {
						viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
								Language.I18N.getString("common.dialog.error.incorrectData.attributes"));
						return;
					}
				}

				// SQL filter
				if (query.isUseSQLFilter()
						&& !query.getSQLFilter().isSetValue()) {
					viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
							Language.I18N.getString("export.dialog.error.incorrectData.sql"));
					return;
				}

				// lod filter
				if (query.isUseLodFilter() && !query.getLodFilter().isSetAnyLod()) {
					viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
							Language.I18N.getString("export.dialog.error.lod.noneSelected"));
					return;
				}

				// counter filter
				if (query.isUseCountFilter()) {
					CounterFilter counterFilter = query.getCounterFilter();
					if ((!counterFilter.isSetCount() && !counterFilter.isSetStartIndex())
							|| (counterFilter.isSetCount() && counterFilter.getCount() < 0)
							|| (counterFilter.isSetStartIndex() && counterFilter.getStartIndex() < 0)) {
						viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
								Language.I18N.getString("export.dialog.error.incorrectData.counter"));
						return;
					}
				}

				// tiled bounding box
				if (query.isUseBboxFilter()) {
					SimpleTiling bboxFilter = query.getBboxFilter();

					BoundingBox bbox = query.getBboxFilter().getExtent();
					Double xMin = bbox.getLowerCorner().getX();
					Double yMin = bbox.getLowerCorner().getY();
					Double xMax = bbox.getUpperCorner().getX();
					Double yMax = bbox.getUpperCorner().getY();

					if (xMin == null || yMin == null || xMax == null || yMax == null) {
						viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
								Language.I18N.getString("common.dialog.error.incorrectData.bbox"));
						return;
					}

					if (bboxFilter.getMode() == SimpleTilingMode.TILING) {
						tileAmount = bboxFilter.getRows() * bboxFilter.getColumns();
						useTiling = true;
					}
				}

				// feature types
				if (query.isUseTypeNames() && query.getFeatureTypeFilter().getTypeNames().isEmpty()) {
					viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
							Language.I18N.getString("common.dialog.error.incorrectData.featureClass"));
					return;
				}
			} else {
				QueryConfig query = config.getExportConfig().getQuery();
				if (query.hasLocalProperty("unmarshallingFailed")) {
					viewController.errorMessage(Language.I18N.getString("common.dialog.error.incorrectFilter"),
							Language.I18N.getString("common.dialog.error.incorrectData.xmlQuery"));
					return;
				}

				if (query.isSetTiling()) {
					// copy tiling options if required
					if (!(query.getTiling().getTilingOptions() instanceof SimpleTilingOptions)) {
						query.getTiling().setTilingOptions(config.getExportConfig().getSimpleQuery().getBboxFilter().getTilingOptions());
						tileAmount = query.getTiling().getRows() * query.getTiling().getColumns();
					}

					useTiling = true;
				}
			}

			// affine transformation
			if (config.getExportConfig().getAffineTransformation().isEnabled()
					&& config.getGuiConfig().getExportGuiConfig().isShowAffineTransformationWarning()) {
				ConfirmationCheckDialog dialog = ConfirmationCheckDialog.defaults()
						.withParentComponent(viewController.getTopFrame())
						.withMessageType(JOptionPane.WARNING_MESSAGE)
						.withOptionType(JOptionPane.YES_NO_OPTION)
						.withTitle(Language.I18N.getString("common.dialog.warning.title"))
						.addMessage(Language.I18N.getString("export.dialog.warn.affineTransformation"));

				int result = dialog.show();
				config.getGuiConfig().getExportGuiConfig().setShowAffineTransformationWarning(dialog.keepShowingDialog());
				if (result != JOptionPane.YES_OPTION) {
					return;
				}
			}

			Path outputFile = Paths.get(browseText.getText());
			if (!useTiling
					&& OutputFileFactory.getOutputFormat(outputFile, config) == OutputFormat.CITYJSON
					&& config.getGuiConfig().getExportGuiConfig().isShowCityJSONTilingWarning()) {
				ConfirmationCheckDialog dialog = ConfirmationCheckDialog.defaults()
						.withParentComponent(viewController.getTopFrame())
						.withMessageType(JOptionPane.WARNING_MESSAGE)
						.withOptionType(JOptionPane.YES_NO_OPTION)
						.withTitle(Language.I18N.getString("export.dialog.warn.cityjson.title"))
						.addMessage(Language.I18N.getString("export.dialog.warn.cityjson.msg"));

				int result = dialog.show();
				config.getGuiConfig().getExportGuiConfig().setShowCityJSONTilingWarning(dialog.keepShowingDialog());
				if (result != JOptionPane.YES_OPTION) {
					return;
				}
			}

			if (!databaseController.connect()) {
				return;
			}

			viewController.setStatusText(Language.I18N.getString("main.status.export.label"));
			log.info("Initializing database export...");

			Exporter exporter = new Exporter();

			// initialize event dispatcher
			EventDispatcher eventDispatcher = ObjectRegistry.getInstance().getEventDispatcher();
			ExportStatusDialog exportDialog = new ExportStatusDialog(viewController.getTopFrame(),
					Language.I18N.getString("export.dialog.window"),
					Language.I18N.getString("export.dialog.msg"),
					tileAmount > 1);

			SwingUtilities.invokeLater(() -> {
				exportDialog.setLocationRelativeTo(viewController.getTopFrame());
				exportDialog.setVisible(true);
			});

			exportDialog.getCancelButton().addActionListener(e ->
					SwingUtilities.invokeLater(() -> eventDispatcher.triggerEvent(new InterruptEvent(
							"User abort of database export.",
							LogLevel.WARN,
							exporter.getEventChannel()))));

			boolean success = false;
			try {
				success = exporter.doExport(Paths.get(browseText.getText()));
			} catch (CityGMLExportException e) {
				log.error(e.getMessage(), e.getCause());
				if (e.getErrorCode() == ErrorCode.SPATIAL_INDEXES_NOT_ACTIVATED) {
					log.error("Please use the database tab to activate the spatial indexes.");
				}
			}

			SwingUtilities.invokeLater(exportDialog::dispose);
			viewController.setStatusText(Language.I18N.getString("main.status.ready.label"));

			if (success) {
				log.info("Database export successfully finished.");
			} else {
				log.warn("Database export aborted.");
			}
		} finally {
			lock.unlock();
		}
	}

	private void saveFile(String title) {
		JFileChooser chooser = new JFileChooser();
		chooser.setDialogTitle(title);

		FileNameExtensionFilter filter = new FileNameExtensionFilter("CityGML Files (*.gml, *.xml, *.json, *.zip, *.gz, *.gzip)",
				"gml", "xml", "json", "zip", "gz", "gzip");
		chooser.addChoosableFileFilter(filter);
		chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityGML GML Files (*.gml, *.xml)", "gml", "xml"));
		chooser.addChoosableFileFilter(new FileNameExtensionFilter("CityJSON Files (*.json)", "json"));
		chooser.addChoosableFileFilter(new FileNameExtensionFilter("ZIP Files (*.zip)", "zip"));
		chooser.addChoosableFileFilter(new FileNameExtensionFilter("Compressed Files (*.gz, *.gzip)", "gz", "gzip"));
		chooser.addChoosableFileFilter(chooser.getAcceptAllFileFilter());
		chooser.setFileFilter(filter);

		if (browseText.getText().trim().isEmpty()) {
			chooser.setCurrentDirectory(config.getExportConfig().getPath().isSetLastUsedMode() ?
					new File(config.getExportConfig().getPath().getLastUsedPath()) :
					new File(config.getExportConfig().getPath().getStandardPath()));
		} else {
			File file = new File(browseText.getText().trim());
			if (!file.isDirectory())
				file = file.getParentFile();

			chooser.setCurrentDirectory(file);
		}

		int result = chooser.showSaveDialog(getTopLevelAncestor());
		if (result == JFileChooser.CANCEL_OPTION) return;
		try {
			String exportString = chooser.getSelectedFile().getAbsolutePath();
			if (Util.getFileExtension(exportString).isEmpty()) {
				exportString += ".gml";
			}

			browseText.setText(exportString);
			config.getExportConfig().getPath().setLastUsedPath(chooser.getCurrentDirectory().getAbsolutePath());
		} catch (Exception e) {
			//
		}
	}

	@Override
	public void dragEnter(DropTargetDragEvent dtde) {
		dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
	}

	@Override
	public void dragExit(DropTargetEvent dte) {
		// nothing to do here
	}

	@Override
	public void dragOver(DropTargetDragEvent dtde) {
		// nothing to do here
	}

	@SuppressWarnings("unchecked")
	@Override
	public void drop(DropTargetDropEvent dtde) {
		for (DataFlavor dataFlover : dtde.getCurrentDataFlavors()) {
			if (dataFlover.isFlavorJavaFileListType()) {
				try {
					dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);

					for (File file : (List<File>)dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor)) {
						if (file.isFile() && file.canRead()) {
							browseText.setText(file.getCanonicalPath());
							break;
						}
					}

					dtde.getDropTargetContext().dropComplete(true);
				} catch (UnsupportedFlavorException | IOException e) {
					//
				}
			}
		}
	}

	@Override
	public void dropActionChanged(DropTargetDragEvent dtde) {
		// nothing to do here
	}
}


text:
import * as types from '../actions/actionTypes';
import initialState from './initialState';

export default function LandingPage(state = initialState.LandingPage, action) {
  switch (action.type) {
    case types.PUBLIC_GET_TICKER:
      return [
        ...state, Object.assign({}, action.state)
      ];
    case types.PUBLIC_GET_GLOBAL:
      return [
        ...state, Object.assign({}, action.state)
      ];
    default:
      return state;
  }
}


text:
#include <regex>

using namespace std;

class Property
{
public:
	explicit Property();
	explicit Property(string, string);
	virtual ~Property();
	virtual string getName() const;
	virtual string getValue() const;
	virtual bool operator==(const Property&) const;

private:
	string name;
	string value;
};

#endif


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 io.prestodb.benchto.driver.execution;

import com.google.common.util.concurrent.ListeningExecutorService;
import io.prestodb.benchto.driver.Benchmark;
import io.prestodb.benchto.driver.concurrent.ExecutorServiceFactory;
import io.prestodb.benchto.driver.listeners.benchmark.BenchmarkStatusReporter;
import io.prestodb.benchto.driver.macro.MacroService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyList;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class BenchmarkExecutionDriverTest
{
    @Mock
    MacroService macroService;

    @Mock
    ExecutorServiceFactory executorServiceFactory;

    @Mock
    ListeningExecutorService executorService;

    @Mock
    BenchmarkStatusReporter statusReporter;

    @Mock
    ExecutionSynchronizer executionSynchronizer;

    @InjectMocks
    BenchmarkExecutionDriver driver;

    @Before
    public void setUp()
    {
        when(executorServiceFactory.create(anyInt())).thenReturn(executorService);
    }

    @Test
    public void successfulRun()
    {
        BenchmarkExecutionResult benchmarkExecutionResult = driver.execute(mock(Benchmark.class), 0, 0, Optional.empty());

        assertThat(benchmarkExecutionResult.getFailureCauses()).isEmpty();
        assertThat(benchmarkExecutionResult.isSuccessful()).isTrue();
    }

    @Test
    public void afterMacroFailureCausesBenchmarkExecutionToFail()
    {
        RuntimeException afterMacroException = new RuntimeException();
        doNothing().doThrow(afterMacroException)
                .when(macroService).runBenchmarkMacros(anyList(), any(Benchmark.class));

        BenchmarkExecutionResult benchmarkExecutionResult = driver.execute(mock(Benchmark.class), 0, 0, Optional.empty());

        assertThat(benchmarkExecutionResult.isSuccessful()).isFalse();
        assertThat(benchmarkExecutionResult.getFailureCauses()).containsExactly(afterMacroException);
    }

    @Test
    public void afterMacroFailureCausesDoNotOverrideBenchmarkExecutionFailure()
    {
        IllegalStateException afterMacroException = new IllegalStateException();
        IllegalArgumentException executorServiceException = new IllegalArgumentException();
        doThrow(executorServiceException)
                .when(executorServiceFactory).create(anyInt());
        doNothing().doThrow(afterMacroException)
                .when(macroService).runBenchmarkMacros(anyList());

        BenchmarkExecutionResult benchmarkExecutionResult = driver.execute(mock(Benchmark.class), 0, 0, Optional.empty());

        assertThat(benchmarkExecutionResult.isSuccessful()).isFalse();
        assertThat(benchmarkExecutionResult.getFailureCauses()).containsExactly(executorServiceException);
    }
}


text:
using namespace boost;

int main()
{
    typedef property< edge_name_t, char > edge_property;
    typedef property< vertex_name_t, char, property< vertex_index_t, int > >
        vertex_property;

    // Using a vecS graphs => the index maps are implicit.
    typedef adjacency_list< vecS, vecS, bidirectionalS, vertex_property,
        edge_property >
        graph_type;

    // Build graph1
    graph_type graph1;

    add_vertex(vertex_property('a'), graph1);
    add_vertex(vertex_property('a'), graph1);
    add_vertex(vertex_property('a'), graph1);

    add_edge(0, 1, edge_property('b'), graph1);
    add_edge(0, 1, edge_property('b'), graph1);
    add_edge(0, 1, edge_property('d'), graph1);

    add_edge(1, 2, edge_property('s'), graph1);

    add_edge(2, 2, edge_property('l'), graph1);
    add_edge(2, 2, edge_property('l'), graph1);

    // Build graph2
    graph_type graph2;

    add_vertex(vertex_property('a'), graph2);
    add_vertex(vertex_property('a'), graph2);
    add_vertex(vertex_property('a'), graph2);
    add_vertex(vertex_property('a'), graph2);
    add_vertex(vertex_property('a'), graph2);
    add_vertex(vertex_property('a'), graph2);

    add_edge(0, 1, edge_property('a'), graph2);
    add_edge(0, 1, edge_property('a'), graph2);
    add_edge(0, 1, edge_property('b'), graph2);

    add_edge(1, 2, edge_property('s'), graph2);

    add_edge(2, 3, edge_property('b'), graph2);
    add_edge(2, 3, edge_property('d'), graph2);
    add_edge(2, 3, edge_property('b'), graph2);

    add_edge(3, 4, edge_property('s'), graph2);

    add_edge(4, 4, edge_property('l'), graph2);
    add_edge(4, 4, edge_property('l'), graph2);

    add_edge(4, 5, edge_property('c'), graph2);
    add_edge(4, 5, edge_property('c'), graph2);
    add_edge(4, 5, edge_property('c'), graph2);

    add_edge(5, 0, edge_property('s'), graph2);

    // create predicates
    typedef property_map< graph_type, vertex_name_t >::type vertex_name_map_t;
    typedef property_map_equivalent< vertex_name_map_t, vertex_name_map_t >
        vertex_comp_t;
    vertex_comp_t vertex_comp = make_property_map_equivalent(
        get(vertex_name, graph1), get(vertex_name, graph2));

    typedef property_map< graph_type, edge_name_t >::type edge_name_map_t;
    typedef property_map_equivalent< edge_name_map_t, edge_name_map_t >
        edge_comp_t;
    edge_comp_t edge_comp = make_property_map_equivalent(
        get(edge_name, graph1), get(edge_name, graph2));

    // Create callback
    vf2_print_callback< graph_type, graph_type > callback(graph1, graph2);

    // Print out all subgraph isomorphism mappings between graph1 and graph2.
    // Function vertex_order_by_mult is used to compute the order of
    // vertices of graph1. This is the order in which the vertices are examined
    // during the matching process.
    vf2_subgraph_iso(graph1, graph2, callback, vertex_order_by_mult(graph1),
        edges_equivalent(edge_comp).vertices_equivalent(vertex_comp));

    return 0;
}


text:
import os
from setuptools import setup

setup(
    name = "django-improved-inlines",
    version = "0.2.2",
    url = 'http://github.com/issackelly/django-improved-inlines',
    license = 'BSD',
    description = "Inline object rendering for django, based on django-basic-apps + filters + templates",
    long_description=open("README.rst").read(),
    author = 'Issac Kelly',
    author_email = 'issac@kellycreativetech.com',
    packages = [
        'improved_inlines',
        'improved_inlines.templatetags',
    ],
    requires = [
        'BeautifulSoup',
    ],
    classifiers = [
        'Development Status :: 4 - Beta',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP',
    ],

    install_requires=['beautifulsoup>=3.2.0',],

)


text:
[![Build status](https://badge.buildkite.com/098023d2f6cea6cc1d8645e99d8924901284b5551b6eb55bd2.svg)](https://buildkite.com/bazel/rules-gwt-postsubmit)

# GWT Rules for Bazel

Rules

gwt_application

## Overview

These build rules are used for building [GWT](http://www.gwtproject.org/)
applications with Bazel. Applications are compiled as `.war` files containing
compiled JavaScript and other resources. GWT applications can also be run in
[Development Mode](http://www.gwtproject.org/doc/latest/DevGuideCompilingAndDebugging.html)
via `bazel run`.

## Setup

To be able to use the GWT rules, you must provide bindings for the GWT jars and
everything it depends on. The easiest way to do so is to add the following to
your `WORKSPACE` file, which will give you default versions for GWT and each
dependency:

```python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
  name = "io_bazel_rules_gwt",
  url = "https://github.com/bazelbuild/rules_gwt/archive/0.1.3.tar.gz",
  sha256 = "3f017bd2f7734e259535da0bcc75398b883dda6da6b657dfa84bd02fab0a6916",
  strip_prefix = "rules_gwt-0.1.3",
)
load("@io_bazel_rules_gwt//gwt:gwt.bzl", "gwt_repositories")
gwt_repositories()
```

If you want to use a different version of GWT or any of its dependencies, you
must provide your own bindings. Remove the `gwt_repositories()` line above and
add a `bind` rule for each of the following in your `WORKSPACE`:

  * `//external:gwt-dev` (defaults to [`com.google.gwt:gwt-dev:2.8.0`](https://mvnrepository.com/artifact/com.google.gwt/gwt-dev/2.8.0))
  * `//external:gwt-user` (defaults to [`com.google.gwt:gwt-user:2.8.0`](https://mvnrepository.com/artifact/com.google.gwt/gwt-user/2.8.0))
  * `//external:gwt_ant` (defaults to [`org.apache.ant:ant:1.9.7`](https://mvnrepository.com/artifact/org.apache.ant/ant/1.9.7))
  * `//external:gwt_asm` (defaults to [`org.ow2.asm:asm:5.0.3`](https://mvnrepository.com/artifact/org.ow2.asm/asm/5.0.3))
  * `//external:gwt_colt` (defaults to [`colt:colt:1.2.0`](https://mvnrepository.com/artifact/colt/colt/1.2.0))
  * `//external:gwt_commons-io` (defaults to [`commons-io:commons-io:2.4`](https://mvnrepository.com/artifact/commons-io/commons-io/2.4))
  * `//external:gwt_gson` (defaults to [`com.google.code.gson:gson:2.6.2`](https://mvnrepository.com/artifact/com.google.code.gson/gson/2.6.2))
  * `//external:gwt_javax-servlet` (defaults to [`javax.servlet:javax.servlet-api:3.1.0`](https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/3.1.0))
  * `//external:gwt_javax-validation` (defaults to [`javax.validation:validation-api:1.0.0.GA`](https://mvnrepository.com/artifact/javax.validation/validation-api/1.0.0.GA))
  * `//external:gwt_java-validation-src` (defaults to [`javax.validation:validation-api:sources:1.0.0.GA`](https://mvnrepository.com/artifact/javax.validation/validation-api/1.0.0.GA))
  * `//external:gwt_jetty-annotations` (defaults to [`org.eclipse.jetty:jetty-annotations:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-annotations/9.2.14.v20151106))
  * `//external:gwt_jetty-http` (defaults to [`org.eclipse.jetty:jetty-http:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-http/9.2.14.v20151106))
  * `//external:gwt_jetty-io` (defaults to [`org.eclipse.jetty:jetty-io:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-io/9.2.14.v20151106))
  * `//external:gwt_jetty-jndi` (defaults to [`org.eclipse.jetty:jetty-jndi:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-jndi/9.2.14.v20151106))
  * `//external:gwt_jetty-plus` (defaults to [`org.eclipse.jetty:jetty-plus:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-plus/9.2.14.v20151106))
  * `//external:gwt_jetty-security` (defaults to [`org.eclipse.jetty:jetty-security:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-security/9.2.14.v20151106))
  * `//external:gwt_jetty-server` (defaults to [`org.eclipse.jetty:jetty-server:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server/9.2.14.v20151106))
  * `//external:gwt_jetty-servlet` (defaults to [`org.eclipse.jetty:jetty-servlet:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlet/9.2.14.v20151106))
  * `//external:gwt_jetty-servlets` (defaults to [`org.eclipse.jetty:jetty-servlets:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-servlets/9.2.14.v20151106))
  * `//external:gwt_jetty-util` (defaults to [`org.eclipse.jetty:jetty-util:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-util/9.2.14.v20151106))
  * `//external:gwt_jetty-webapp` (defaults to [`org.eclipse.jetty:jetty-io:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-webapp/9.2.14.v20151106))
  * `//external:gwt_jetty-xml` (defaults to [`org.eclipse.jetty:jetty-io:9.2.14.v20151106`](https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-xml/9.2.14.v20151106))
  * `//external:gwt_jsinterop` (defaults to [`com.google.jsinterop:jsinterop-annotations:1.0.0`](https://mvnrepository.com/artifact/com.google.jsinterop/jsinterop-annotations/1.0.0))
  * `//external:gwt_jsinterop-src` (defaults to [`com.google.jsinterop:jsinterop-annotations:sources:1.0.0`](https://mvnrepository.com/artifact/com.google.jsinterop/jsinterop-annotations/1.0.0))
  * `//external:gwt_jsr-250-api` (defaults to [`javax.annotation:jsr250-api:1.0`](https://mvnrepository.com/artifact/javax.annotation/jsr250-api/1.0))
  * `//external:gwt_sac` (defaults to [`org.w3c.css:sac:1.3`](https://mvnrepository.com/artifact/org.w3c.css/sac/1.3))
  * `//external:gwt_tapestry` (defaults to [`tapestry:tapestry:4.0.2`](https://mvnrepository.com/artifact/tapestry/tapestry/4.0.2))

## Basic Example

Suppose you have the following directory structure for a simple GWT application:

```
[workspace]/
    WORKSPACE
    src/main/java/
        app/
            BUILD
            MyApp.java
            MyApp.gwt.xml
        lib/
            BUILD
            MyLib.java
        public/
            index.html
```

Here, `MyApp.java` defines the entry point to a GWT application specified by
`MyApp.gwt.xml` which depends on another Java library `MyLib.java`. `index.html`
defines the HTML page that links in the GWT application. To build this app, your
`src/main/java/app/BUILD` can look like this:

```python
load("@io_bazel_rules_gwt//gwt:gwt.bzl", "gwt_application")

gwt_application(
  name = "MyApp",
  srcs = glob(["*.java"]),
  resources = glob(["*.gwt.xml"]),
  modules = ["app.MyApp"],
  pubs = glob(["public/*"]),
  deps = [
    "//src/main/java/lib",
  ],
)
```

Now, you can build the GWT application by running
`bazel build src/main/java/app:MyApp`. This will run the GWT compiler and place
all of its output as well as `index.html` into
`bazel-bin/src/main/java/app/MyApp.war`. You can also run
`bazel run src/main/java/app:MyApp-dev` to run GWT development mode for the
application. Once development mode has started, you can see the app by opening
http://127.0.0.1:8888/index.html in a browser. Note that development mode assumes
that all of your `.java` files are located under `java/` or `src/main/java/` - see
details on the `java_roots` flag below if this is not the case.

For a complete example, see the
[`example/`](https://github.com/bazelbuild/rules_gwt/tree/master/example/src/main/java/io/bazel/sample)
directory in this repository.

## gwt_application

```python
gwt_application(name, srcs, resources, modules, pubs, deps, output_root, java_roots, compiler_flags, compiler_jvm_flags, dev_flags, dev_jvm_flags):
```

### Implicit output targets

 * `<name>.war`: archive containing GWT compiler output and any files passed
   in via pubs.
 * `<name>-dev`: script that can be run via `bazel run` to launch the app in
   development mode.

  <colgroup>
    <col class="col-param" />
    <col class="param-description" />
  </colgroup>

      Attributes

      name

        Name, required

A unique name for this rule.

      srcs

        List of labels, optional

          List of .java source files that will be compiled and passed on the
          classpath to the GWT compiler.

      resources

        List of labels, optional

          List of resource files that will be passed on the classpath to the GWT
          compiler, e.g. .gwt.xml, .ui.xml, and
          .css files.

      modules

        List of strings, required

          List of fully-qualified names of modules that will be passed to the GWT
          compiler. Usually contains a single module name corresponding to the
          application's .gwt.xml file.

      pubs

        List of labels, optional

          Files that will be copied directly to the output war, such as static
          HTML or image resources. Not interpreted by the GWT compiler.

      deps

        List of labels, optional

          List of other java_libraries on which the application depends. Both the
          class jars and the source jars corresponding to each library as well as
          their transitive dependencies will be passed to the GWT compiler's
          classpath. These libraries may contain other .gwt.xml,
          .ui.xml, etc. files as resources.

      output_root

        String, optional

          Directory in the output war in which all outputs will be placed. By
          default outputs are placed at the root of the war file.

      java_roots

        List of strings, optional

          Directories relative to the workspace root that form roots of the
          Java package hierarchy (e.g. they contain com directories).
          By default this includes java, javatests,
          src/main/java and src/test/java. If your Java
          files aren't under these directories, you must set this property in order
          for development mode to work correctly. Otherwise GWT won't be able to
          see your source files, so you will not see any changes reflected when
          refreshing dev mode.

      compiler_flags

        List of strings, optional

          Additional flags that will be passed to the GWT compiler. See
          here
          for a list of available flags.

      compiler_jvm_flags

        List of strings, optional

          Additional JVM flags that will be passed to the GWT compiler, such as
          -Xmx4G to increase the amount of available memory.

      dev_flags

        List of strings, optional

          Additional flags that will be passed to development mode. See
          here
          for a list of available flags.

      dev_jvm_flags

        List of strings, optional

          Additional JVM flags that will be passed to development mode, such as
          -Xmx4G to increase the amount of available memory.


text:
package net.chrisrichardson.foodToGo.domain;

import java.io.Serializable;

public class MenuItem implements Serializable {

    private int id = -1;

    private int version;

    private String name;

    private double price;

    public MenuItem() {
    }

    public MenuItem(String name, double price) {
        this.name = name;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    // Extra setters

    public void setId(int id) {
      this.id = id;
    }

    public void setVersion(int version) {
      this.version = version;
    }

    public void setName(String name) {
      this.name = name;
    }

    public void setPrice(double price) {
      this.price = price;
    }

}


text:
.class public Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;
.super Lcom/xiaomi/infra/galaxy/common/model/Request;

# instance fields
.field private accessToken:Ljava/lang/String;

.field private appId:Ljava/lang/String;

.field private oauthAppId:Ljava/lang/String;

.field private oauthProvider:Ljava/lang/String;

.field private oauthVersion:Ljava/lang/String;

# direct methods
.method public constructor <init>()V
    .locals 0

    invoke-direct {p0}, Lcom/xiaomi/infra/galaxy/common/model/Request;-><init>()V

    return-void
.end method

# virtual methods
.method public equals(Ljava/lang/Object;)Z
    .locals 4

    const/4 v1, 0x1

    const/4 v2, 0x0

    if-ne p0, p1, :cond_1

    move v2, v1

    :cond_0
    :goto_0
    return v2

    :cond_1
    if-eqz p1, :cond_0

    instance-of v0, p1, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;

    if-eqz v0, :cond_0

    check-cast p1, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_7

    move v0, v1

    :goto_1
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_8

    move v3, v1

    :goto_2
    xor-int/2addr v0, v3

    if-nez v0, :cond_0

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_2

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    :cond_2
    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_9

    move v0, v1

    :goto_3
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_a

    move v3, v1

    :goto_4
    xor-int/2addr v0, v3

    if-nez v0, :cond_0

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_3

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    :cond_3
    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_b

    move v0, v1

    :goto_5
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_c

    move v3, v1

    :goto_6
    xor-int/2addr v0, v3

    if-nez v0, :cond_0

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_4

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    :cond_4
    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_d

    move v0, v1

    :goto_7
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_e

    move v3, v1

    :goto_8
    xor-int/2addr v0, v3

    if-nez v0, :cond_0

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_5

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    :cond_5
    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_f

    move v0, v1

    :goto_9
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v3

    if-nez v3, :cond_10

    move v3, v1

    :goto_a
    xor-int/2addr v0, v3

    if-nez v0, :cond_0

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_6

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_0

    :cond_6
    move v2, v1

    goto/16 :goto_0

    :cond_7
    move v0, v2

    goto/16 :goto_1

    :cond_8
    move v3, v2

    goto/16 :goto_2

    :cond_9
    move v0, v2

    goto/16 :goto_3

    :cond_a
    move v3, v2

    goto/16 :goto_4

    :cond_b
    move v0, v2

    goto :goto_5

    :cond_c
    move v3, v2

    goto :goto_6

    :cond_d
    move v0, v2

    goto :goto_7

    :cond_e
    move v3, v2

    goto :goto_8

    :cond_f
    move v0, v2

    goto :goto_9

    :cond_10
    move v3, v2

    goto :goto_a
.end method

.method public getAccessToken()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->accessToken:Ljava/lang/String;

    return-object v0
.end method

.method public getAppId()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->appId:Ljava/lang/String;

    return-object v0
.end method

.method public getOauthAppId()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthAppId:Ljava/lang/String;

    return-object v0
.end method

.method public getOauthProvider()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthProvider:Ljava/lang/String;

    return-object v0
.end method

.method public getOauthVersion()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthVersion:Ljava/lang/String;

    return-object v0
.end method

.method public hashCode()I
    .locals 3

    const/4 v1, 0x0

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_0

    move v0, v1

    :goto_0
    add-int/lit8 v0, v0, 0x1f

    mul-int/lit8 v2, v0, 0x1f

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_1

    move v0, v1

    :goto_1
    add-int/2addr v0, v2

    mul-int/lit8 v2, v0, 0x1f

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_2

    move v0, v1

    :goto_2
    add-int/2addr v0, v2

    mul-int/lit8 v2, v0, 0x1f

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v0

    if-nez v0, :cond_3

    move v0, v1

    :goto_3
    add-int/2addr v0, v2

    mul-int/lit8 v0, v0, 0x1f

    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v2

    if-nez v2, :cond_4

    :goto_4
    add-int/2addr v0, v1

    return v0

    :cond_0
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAppId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->hashCode()I

    move-result v0

    goto :goto_0

    :cond_1
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthAppId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->hashCode()I

    move-result v0

    goto :goto_1

    :cond_2
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getAccessToken()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->hashCode()I

    move-result v0

    goto :goto_2

    :cond_3
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthProvider()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->hashCode()I

    move-result v0

    goto :goto_3

    :cond_4
    invoke-virtual {p0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->getOauthVersion()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->hashCode()I

    move-result v1

    goto :goto_4
.end method

.method public internalGetGalaxyRequest(Ljava/lang/String;Lcom/xiaomi/infra/galaxy/common/constants/APILevel;)Lcom/xiaomi/infra/galaxy/common/BasicGalaxyRequest;
    .locals 3

    new-instance v0, Lcom/xiaomi/infra/galaxy/common/BasicGalaxyRequest;

    const-string v1, "Galaxy"

    invoke-direct {v0, p0, v1}, Lcom/xiaomi/infra/galaxy/common/BasicGalaxyRequest;-><init>(Lcom/xiaomi/infra/galaxy/common/model/Request;Ljava/lang/String;)V

    new-instance v1, Lcom/xiaomi/infra/galaxy/common/TargetAction;

    invoke-direct {v1}, Lcom/xiaomi/infra/galaxy/common/TargetAction;-><init>()V

    invoke-static {}, Lcom/xiaomi/infra/galaxy/common/GalaxyVersion;->getVersion()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/xiaomi/infra/galaxy/common/TargetAction;->setApiVersion(Ljava/lang/String;)V

    sget-object v2, Lcom/xiaomi/infra/galaxy/common/constants/APILevel;->User:Lcom/xiaomi/infra/galaxy/common/constants/APILevel;

    invoke-virtual {v1, v2}, Lcom/xiaomi/infra/galaxy/common/TargetAction;->setLevel(Lcom/xiaomi/infra/galaxy/common/constants/APILevel;)V

    sget-object v2, Lcom/xiaomi/infra/galaxy/common/constants/Operation;->Auth:Lcom/xiaomi/infra/galaxy/common/constants/Operation;

    invoke-virtual {v1, v2}, Lcom/xiaomi/infra/galaxy/common/TargetAction;->setOperation(Lcom/xiaomi/infra/galaxy/common/constants/Operation;)V

    const-string v2, "Galaxy"

    invoke-virtual {v1, v2}, Lcom/xiaomi/infra/galaxy/common/TargetAction;->setServiceName(Ljava/lang/String;)V

    const-string v2, "X-XiaoMi-Action"

    invoke-virtual {v1}, Lcom/xiaomi/infra/galaxy/common/TargetAction;->format()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v2, v1}, Lcom/xiaomi/infra/galaxy/common/BasicGalaxyRequest;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    invoke-super {p0, v0, p1}, Lcom/xiaomi/infra/galaxy/common/model/Request;->setRequestContent(Lcom/xiaomi/infra/galaxy/common/BasicGalaxyRequest;Ljava/lang/String;)V

    return-object v0
.end method

.method public setAccessToken(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->accessToken:Ljava/lang/String;

    return-void
.end method

.method public setAppId(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->appId:Ljava/lang/String;

    return-void
.end method

.method public setOauthAppId(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthAppId:Ljava/lang/String;

    return-void
.end method

.method public setOauthProvider(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthProvider:Ljava/lang/String;

    return-void
.end method

.method public setOauthVersion(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthVersion:Ljava/lang/String;

    return-void
.end method

.method public validate()V
    .locals 1

    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->appId:Ljava/lang/String;

    invoke-static {v0}, Lcom/xiaomi/infra/galaxy/common/util/StringUtils;->isBlank(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_0

    :cond_0
    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthAppId:Ljava/lang/String;

    invoke-static {v0}, Lcom/xiaomi/infra/galaxy/common/util/StringUtils;->isBlank(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_1

    :cond_1
    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->accessToken:Ljava/lang/String;

    invoke-static {v0}, Lcom/xiaomi/infra/galaxy/common/util/StringUtils;->isBlank(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_2

    :cond_2
    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthProvider:Ljava/lang/String;

    invoke-static {v0}, Lcom/xiaomi/infra/galaxy/common/util/StringUtils;->isBlank(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_3

    :cond_3
    iget-object v0, p0, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->oauthVersion:Ljava/lang/String;

    invoke-static {v0}, Lcom/xiaomi/infra/galaxy/common/util/StringUtils;->isBlank(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_4

    :cond_4
    return-void
.end method

.method public withAccessToken(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;
    .locals 0

    invoke-virtual {p0, p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->setAccessToken(Ljava/lang/String;)V

    return-object p0
.end method

.method public withAppId(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;
    .locals 0

    invoke-virtual {p0, p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->setAppId(Ljava/lang/String;)V

    return-object p0
.end method

.method public withOauthAppId(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;
    .locals 0

    invoke-virtual {p0, p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->setOauthAppId(Ljava/lang/String;)V

    return-object p0
.end method

.method public withOauthProvider(Lcom/xiaomi/infra/galaxy/common/model/OAuthProvider;)Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;
    .locals 1

    invoke-virtual {p1}, Lcom/xiaomi/infra/galaxy/common/model/OAuthProvider;->name()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->setOauthProvider(Ljava/lang/String;)V

    return-object p0
.end method

.method public withOauthVersion(Ljava/lang/String;)Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;
    .locals 0

    invoke-virtual {p0, p1}, Lcom/xiaomi/infra/galaxy/common/model/StorageAccessTokenRequest;->setOauthVersion(Ljava/lang/String;)V

    return-object p0
.end method


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <declare-styleable name="MaterialFavoriteButton">
    <attr name="mfb_state" format="boolean" />
    <attr name="mfb_size" format="integer" />
    <attr name="mfb_animate_favorite" format="boolean" />
    <attr name="mfb_animate_unfavorite" format="boolean" />
    <attr name="mfb_padding" format="integer" />
    <attr name="mfb_favorite_image" format="integer" />
    <attr name="mfb_not_favorite_image" format="integer" />
    <attr name="mfb_rotation_duration" format="integer" />
    <attr name="mfb_rotation_angle" format="integer" />
    <attr name="mfb_bounce_duration" format="integer" />
    <attr name="mfb_color" format="enum">
      <enum name="black" value="0" />
      <enum name="white" value="1" />
    </attr>
    <attr name="mfb_type" format="enum">
      <enum name="star" value="0" />
      <enum name="heart" value="1" />
    </attr>
  </declare-styleable>
</resources>


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="white">#FFFFFF</color>

    <color name="hint">#999</color>
    <color name="baseFont">#333</color>
    <color name="emerald">#2db329</color>
    <color name="emerald_deep">#00733a</color>
    <color name="azure_deep">#0086d4</color>
    <color name="amber_deep">#ffd15300</color>
    <color name="ruby_deep">#b3000c</color>
</resources>


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use mihaildev\ckeditor\CKEditor;

/* @var $this yii\web\View */
/* @var $model common\models\Advices */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>
    <?php $model->button_title_ru = 'Больше информации' ?>
    <?= $form->field($model, 'button_title_ru')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'main_title_ru')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'sub_title_ru')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'excerpt_ru')->textarea(['rows' => 6]) ?>

    <?= $form->field($model, 'full_content_ru')->widget(CKEditor::className()) ?>

    <?= $form->field($model, 'order')->textInput(['type'=>'number'])?>

    <?= $form->field($model, 'show')->checkbox() ?>

        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

    <?php ActiveForm::end(); ?>


text:
{% extends "base.html" %}

{% block navbar %}
  {%include "navbar.html" %}
{% endblock %}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDBSample.Entities;

namespace MongoDBSample.DataLayer
{
    public interface IContext
    {
        IMongoCollection<User> AppUsers();
    }
}


text:
package org.orange.familylink.util;

import org.orange.familylink.data.Settings;
import org.orange.familylink.location.LocationService;
import org.orange.familylink.sms.SmsReceiverService;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.preference.PreferenceManager;

/**
 * 这个广播接收器用于开机启动Service
 * @author Orange Team
 *
 */
public class StartServiceReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context arg0, Intent arg1) {
		if(arg1.getAction().equals(Intent.ACTION_BOOT_COMPLETED)
				|| arg1.getAction().equals(Intent.ACTION_REBOOT)){

			PreferenceManager.getDefaultSharedPreferences(arg0).edit()
			.putBoolean(Settings.PREF_KEY_START_LOCATION_SERVICE, true).commit();
			//启动locationService
			Intent locationIntent = new Intent(arg0, LocationService.class);
			arg0.startService(locationIntent);
			//启动SmsReceiverservice
			Intent smsIntent = new Intent(arg0, SmsReceiverService.class);
			smsIntent.setAction(SmsReceiverService.ACTION_FOREGROUND);
			arg0.startService(smsIntent);
		}
	}

}


text:
<?php

namespace Magento\Sales\Block\Adminhtml\Order\View\Tab;

/**
 * Order Shipments grid
 */
class Shipments extends \Magento\Framework\View\Element\Text\ListText implements
    \Magento\Backend\Block\Widget\Tab\TabInterface
{
    /**
     * Core registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry = null;

    /**
     * Collection factory
     *
     * @param \Magento\Framework\View\Element\Context $context
     * @param \Magento\Framework\Registry $coreRegistry
     * @param array $data
     */
    public function __construct(
        \Magento\Framework\View\Element\Context $context,
        \Magento\Framework\Registry $coreRegistry,
        array $data = []
    ) {
        $this->_coreRegistry = $coreRegistry;
        parent::__construct($context, $data);
    }

    /**
     * Retrieve order model instance
     *
     * @return \Magento\Sales\Model\Order
     */
    public function getOrder()
    {
        return $this->_coreRegistry->registry('current_order');
    }

    /**
     * {@inheritdoc}
     */
    public function getTabLabel()
    {
        return __('Shipments');
    }

    /**
     * {@inheritdoc}
     */
    public function getTabTitle()
    {
        return __('Order Shipments');
    }

    /**
     * {@inheritdoc}
     */
    public function canShowTab()
    {
        if ($this->getOrder()->getIsVirtual()) {
            return false;
        }
        return true;
    }

    /**
     * {@inheritdoc}
     */
    public function isHidden()
    {
        return false;
    }
}


text:
package net.ontopia.topicmaps.utils.jtm;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import net.ontopia.infoset.impl.basic.URILocator;
import net.ontopia.topicmaps.core.TopicMapIF;
import net.ontopia.utils.TestFileUtils;
import org.junit.Assert;
import org.junit.Test;

public class JTMTopicMapReaderTest {

  private final File file;
  private final URILocator locator;

  public JTMTopicMapReaderTest() throws IOException {
    file = TestFileUtils.getTransferredTestInputFile("jtm", "in", "topic.xtm2.jtm");
    locator = new URILocator(file);
  }

  @Test
  public void testReadFromURL() throws IOException {
    TopicMapIF tm = new JTMTopicMapReader(TestFileUtils.getTestInputURL("jtm", "in", "topic.xtm2.jtm")).read();
    Assert.assertNotNull(tm);
    Assert.assertEquals(1, tm.getTopics().size());
  }

  @Test
  public void testReadFromFile() throws IOException {
    TopicMapIF tm = new JTMTopicMapReader(file).read();
    Assert.assertNotNull(tm);
    Assert.assertEquals(1, tm.getTopics().size());
  }

  @Test
  public void testReadFromInputStream() throws IOException {
    TopicMapIF tm = new JTMTopicMapReader(new FileInputStream(file), locator).read();
    Assert.assertNotNull(tm);
    Assert.assertEquals(1, tm.getTopics().size());
  }

  @Test
  public void testReadFromReader() throws IOException {
    TopicMapIF tm = new JTMTopicMapReader(new FileReader(file), locator).read();
    Assert.assertNotNull(tm);
    Assert.assertEquals(1, tm.getTopics().size());
  }
}


text: export function f() { return 1; };


text:
module Azure::Labservices::Mgmt::V2018_10_15
  module Models
    #
    # Details of a Reference Vm
    #
    class ReferenceVmFragment

      include MsRestAzure

      # @return [String] The username of the virtual machine
      attr_accessor :user_name

      # @return [String] The password of the virtual machine. This will be set
      # to null in GET resource API
      attr_accessor :password

      #
      # Mapper for ReferenceVmFragment class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ReferenceVmFragment',
          type: {
            name: 'Composite',
            class_name: 'ReferenceVmFragment',
            model_properties: {
              user_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'userName',
                type: {
                  name: 'String'
                }
              },
              password: {
                client_side_validation: true,
                required: false,
                serialized_name: 'password',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:duration="@android:integer/config_shortAnimTime" android:fromXDelta="0.0" android:toXDelta="-100.0%p" />
</set>


text:
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-main-collapse" aria-expanded="false">

            </button>
            {% if page.section-type == "index" %}

            {% else %}

            {% endif %}

  {{ site.title }}

                {% for p in site.pages_list %}

                    {% if p[0] == "Home" %}
                     {{ p[0] }}
                    {% else %}
                     {{ p[0] }}
                    {% endif %}

                {% endfor %}


text:
import { describe, it, beforeAll, afterAll, beforeEach, afterEach } from 'vitest';
import { strict as assert } from 'assert';
import { createWriteStream } from 'fs';
import { join } from 'path';
import { gunzipSync } from 'zlib';
import { stat, readFile } from 'fs/promises';
import urllib from '../src';
import { startServer } from './fixtures/server';
import { createTempfile, sleep } from './utils';

describe('options.writeStream.test.ts', () => {
  let close: any;
  let _url: string;
  let tmpfile: string;
  let cleanup: any;
  beforeAll(async () => {
    const { closeServer, url } = await startServer();
    close = closeServer;
    _url = url;
  });
  afterAll(async () => {
    await close();
  });

  beforeEach(async () => {
    const item = await createTempfile();
    tmpfile = item.tmpfile;
    cleanup = item.cleanup;
  });
  afterEach(async () => {
    await cleanup();
  });

  it('should save response to writeStream', async () => {
    const writeStream = createWriteStream(tmpfile);
    const response = await urllib.request(`${_url}mock-bytes?size=1024123`, {
      writeStream,
    });
    assert.equal(response.status, 200);
    assert.equal(response.headers['content-type'], undefined);
    assert.equal(response.data, null);
    // console.log(response.headers);
    assert.equal(response.headers['content-length'], '1024123');
    const stats = await stat(tmpfile);
    assert.equal(stats.size, 1024123);
  });

  it('should work with compressed=true/false', async () => {
    let writeStream = createWriteStream(tmpfile);
    let response = await urllib.request(`${_url}gzip`, {
      writeStream,
      compressed: true,
    });
    assert.equal(response.status, 200);
    assert.equal(response.headers['content-type'], undefined);
    assert.equal(response.data, null);
    // console.log(response.headers);
    // writeStream is decompressed
    let data = await readFile(tmpfile, 'utf-8');
    assert.match(data, /export async function startServer/);

    writeStream = createWriteStream(tmpfile);
    response = await urllib.request(`${_url}gzip`, {
      writeStream,
      compressed: false,
    });
    assert.equal(response.status, 200);
    assert.equal(response.headers['content-type'], undefined);
    assert.equal(response.data, null);
    // console.log(response.headers);
    // writeStream is not decompressed
    data = gunzipSync(await readFile(tmpfile)).toString();
    assert.match(data, /export async function startServer/);
  });

  it('should close writeStream when request timeout', async () => {
    const writeStream = createWriteStream(tmpfile);
    assert.equal(writeStream.destroyed, false);
    let writeStreamClosed = false;
    writeStream.on('close', () => {
      writeStreamClosed = true;
      // console.log('writeStreamClosed');
    });
    await assert.rejects(async () => {
      await urllib.request(`${_url}mock-bytes?size=1024&timeout=200`, {
        writeStream,
        timeout: 100,
      });
    }, (err: any) => {
      assert.equal(err.name, 'HttpClientRequestTimeoutError');
      assert.equal(err.message, 'Request timeout for 100 ms');
      // writeStream should be close before request error fire
      assert.equal(writeStream.destroyed, true);
      return true;
    });
    await sleep(30);
    // writeStream close
    assert.equal(writeStream.destroyed, true);
    assert.equal(writeStreamClosed, true);
  });

  // writeStream only work with error handle on Node.js >= 18
  if (!process.version.startsWith('v14.') && !process.version.startsWith('v16.')) {
    it('should throw request error when writeStream error', async () => {
      const tmpfile = join(__dirname, 'not-exists-dir', 'foo.txt');
      const writeStream = createWriteStream(tmpfile);
      let writeStreamError = false;
      writeStream.on('error', () => {
        writeStreamError = true;
      });
      await assert.rejects(async () => {
        await urllib.request(_url, {
          writeStream,
        });
      }, (err: any) => {
        // console.error(err);
        assert.equal(err.name, 'Error');
        assert.equal(err.code, 'ENOENT');
        assert.match(err.message, /no such file or directory/);
        assert.equal(writeStream.destroyed, true);
        return true;
      });
      assert.equal(writeStream.destroyed, true);
      assert.equal(writeStreamError, true);
    });
  }

  it('should end writeStream when server error', async () => {
    const writeStream = createWriteStream(tmpfile);
    await assert.rejects(async () => {
      await urllib.request(`${_url}error`, {
        writeStream,
      });
    }, (err: any) => {
      // console.error(err);
      assert.equal(err.name, 'SocketError');
      assert.equal(err.code, 'UND_ERR_SOCKET');
      assert.equal(err.message, 'other side closed');
      return true;
    });
  });
});


text:
highcharts-element
=========

See the [highcharts page](http://www.highcharts.com/download) for more information. This element produces several charts receiving data as html attributes.


text:
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
import RIO
import RIO.Orphans
import Pantry hiding (Package (..))
import RIO.Directory
import RIO.FilePath
import qualified RIO.Map as Map
import qualified RIO.HashMap as HM
import RIO.Process
import Data.Yaml (Value (..), decodeEither')
import Options.Applicative.Simple hiding (header, value)
import qualified Paths_mega_sdist as Paths (version)
import qualified RIO.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.Char8 as BL8
import qualified RIO.Text as T
import qualified RIO.List as L
import Path (parseAbsDir)
import Path.IO (resolveFile')

#if MIN_VERSION_aeson(2, 0, 0)
import qualified Data.Aeson.KeyMap
#endif

data App = App
  { appLogFunc :: !LogFunc
  , appProcessContext :: !ProcessContext
  , appResourceMap :: !ResourceMap
  , appPantryConfig :: !PantryConfig
  }
instance HasLogFunc App where
  logFuncL = lens appLogFunc (\x y -> x { appLogFunc = y })
instance HasProcessContext App where
  processContextL = lens appProcessContext (\x y -> x { appProcessContext = y })
instance HasResourceMap App where
  resourceMapL = lens appResourceMap (\x y -> x { appResourceMap = y })
instance HasPantryConfig App where
  pantryConfigL = lens appPantryConfig (\x y -> x { appPantryConfig = y })

getPaths :: MonadIO m => Value -> m [FilePath]
getPaths value = maybe (error $ "getPaths failed: " ++ show value) return $ do
    Object top <- return value
    Object locals <- mylookup "locals" top
    forM (toList locals) $ \l -> do
        Object o <- return l
        String path <- mylookup "path" o
        return $ T.unpack path
  where
#if MIN_VERSION_aeson(2, 0, 0)
  mylookup = Data.Aeson.KeyMap.lookup
#else
  mylookup = HM.lookup
#endif

data Args = Args
    { toTag :: !Bool
    , getDiffs :: !Bool
    , rawDirs :: ![FilePath]
    , verbose :: !Bool
    }

main :: IO ()
main = do
    (args@Args {..}, ()) <- simpleOptions
        $(simpleVersion Paths.version)
        "Check Haskell cabal package versions in a mega-repo"
        "Determines if the code present in this repo is the most current with Hackage"
        (Args
            <$> switch
                    ( long "gittag"
                   <> help "Call 'git tag' if all versions are ready for release"
                    )
            <*> switch
                    ( long "get-diffs"
                   <> help "Display the diffs between old and new version"
                    )
            <*> many
                    ( strArgument (metavar "DIR")
                    )
            <*> switch
                    ( long "verbose"
                   <> help "Enable verbose output"
                    )
        )
        empty

    lo <- logOptionsHandle stdout verbose
    pc <- mkDefaultProcessContext
    stack <- liftIO $ getAppUserDataDirectory "stack"
    root <- liftIO $ parseAbsDir $ stack </> "pantry"
    withLogFunc lo $ \lf -> withResourceMap $ \rm ->
      runRIO lf $
      withPantryConfig
        root
        defaultPackageIndexConfig
        HpackBundled
        8
        defaultCasaRepoPrefix
        defaultCasaMaxPerRequest
#if MIN_VERSION_pantry(0, 5, 3)
        defaultSnapshotLocation
#endif
        $ \pantryConfig -> do
            let app = App
                  { appLogFunc = lf
                  , appProcessContext = pc
                  , appResourceMap = rm
                  , appPantryConfig = pantryConfig
                  }
            runRIO app $ main2 args

main2 :: Args -> RIO App ()
main2 Args {..} = do
    (queryBS, _) <- proc "stack" ["query"] readProcess_
    queryValue <-
        case decodeEither' (BL.toStrict queryBS) of
            Left e -> error $ "Could not parse 'stack query': " ++ show e
            Right x -> return x
    allDirs <- getPaths queryValue
    dirs <-
      if null rawDirs
        then return allDirs
        else do
          myPaths <- mapM (fmap addTrailingPathSeparator . canonicalizePath) rawDirs
          return $ filter (\y -> any (\x -> (x `L.isPrefixOf` y)) myPaths) (map addTrailingPathSeparator allDirs)

    whenM (doesDirectoryExist "tarballs") $ removeDirectoryRecursive "tarballs"
    createDirectoryIfMissing True "tarballs"

    tarballs <- forM dirs $ \dir -> do
        output <- proc "stack" ["--no-terminal", "sdist", dir] readProcessStderr_
        case decodeUtf8' $ BL.toStrict output of
          Left e -> error $ "Invalid non-UTF8 output: " ++ show e
          Right text -> case fmap T.unpack $ filter (".tar.gz" `T.isSuffixOf`) $ T.words text of
            fp:_ -> do
                let dest = "tarballs" </> takeFileName fp
                renameFile fp dest
                return dest
            [] -> error $ "Unexpected 'stack sdist' output in dir: " ++ dir ++ "\n\n" ++ T.unpack text

    m <- Map.unionsWith mappend <$> mapM (go getDiffs) tarballs

    case Map.lookup NoChanges m of
        Nothing -> return ()
        Just s -> do
            logInfo "The following packages from Hackage have not changed:"
            mapM_ sayPackage $ Map.keys s
            mapM_ (removeFile . packageFile) $ Map.keys s

    toColor <- hIsTerminalDevice stdout

    case Map.lookup DoesNotExist m of
        Nothing -> return ()
        Just s -> do
            logInfo "\nThe following new packages exist locally:"
            forM_ (Map.toList s) $ \(name, mdiff) -> do
                sayPackage name
                sayDiff toColor mdiff

    case Map.lookup NeedsVersionBump m of
        Nothing -> do
            logInfo "\nNo version bumps required, good to go!"
            when toTag $ forM_ (maybe [] Map.keys $ Map.lookup DoesNotExist m)
              $ \(Package _fp name version) ->
                let ident = packageIdentifierString $ PackageIdentifier name version
                    msg = "Release: " <> ident
                 in proc "git" ["tag", "-s", ident, "-m", msg] $ \pc -> do
                      logInfo $ display pc
                      runProcess_ pc
        Just s -> do
            logInfo "\nThe following packages require a version bump:"
            forM_ (Map.toList s) $ \(name, mdiff) -> do
                sayPackage name
                sayDiff toColor mdiff

sayDiff :: Bool -- ^ use color?
        -> Maybe Diff -> RIO App ()
sayDiff toColor = mapM_ $ BL.hPut stdout . (if toColor then colorize else id)

data Status = DoesNotExist | NoChanges | NeedsVersionBump
    deriving (Show, Eq, Ord)

type Diff = LByteString

go :: Bool -- ^ get diffs
   -> FilePath
   -> RIO App (Map Status (Map Package (Maybe Diff)))
go getDiffs fp = do
    package <- parsePackage fp
    (status, mdiff) <- compareTGZ getDiffs (packageName package) (packageVersion package) fp
    return $ Map.singleton status $ Map.singleton package mdiff

data Package = Package
    { packageFile :: !FilePath
    , packageName :: !PackageName
    , packageVersion :: !Version
    }
    deriving (Show, Eq, Ord)

parsePackage :: MonadThrow m => FilePath -> m Package
parsePackage fp =
    case T.stripSuffix ".tar.gz" $ T.pack $ takeFileName fp of
        Nothing -> error $ "Does not end with .tar.gz: " ++ fp
        Just s ->
            case parsePackageIdentifier $ T.unpack s of
                Nothing -> error $ "Invalid package identifier: " ++ T.unpack s
                Just (PackageIdentifier name version) -> pure $ Package fp name version

sayPackage :: Package -> RIO App ()
sayPackage (Package _ name version) =
  logInfo $ fromString $ packageIdentifierString $ PackageIdentifier name version

compareTGZ :: Bool -- ^ get diffs?
           -> PackageName
           -> Version
           -- ^ version
           -> FilePath
           -- ^ new tarball
           -> RIO App (Status, Maybe Diff)
compareTGZ getDiffs pn v b = withSystemTempDirectory "diff" $ \diff -> do
    oldDest <- parseAbsDir $ diff </> "old"
    newDest <- parseAbsDir $ diff </> "new"
    bAbs <- resolveFile' b

    let pirOrig = PackageIdentifierRevision pn v (CFIRevision (Revision 0))
    let mkPli pir = RPLIHackage pir Nothing
    exists <- (True <$ unpackPackageLocationRaw oldDest (mkPli pirOrig)) `catch` \e ->
      case e of
        UnknownHackagePackage{} -> do
          mpir <- getLatestHackageVersion YesRequireHackageIndex pn UsePreferredVersions
          for_ mpir $ unpackPackageLocationRaw oldDest . mkPli
          pure False
        _ -> throwIO e

    unpackPackageLocationRaw newDest $ RPLIArchive
      RawArchive
        { raLocation = ALFilePath $ ResolvedPath (RelFilePath $ fromString b) bAbs
        , raHash = Nothing
        , raSize = Nothing
        , raSubdir = ""
        }
      RawPackageMetadata
        { rpmName = Nothing
        , rpmVersion = Nothing
        , rpmTreeKey = Nothing
        }

    (ec, out) <- withWorkingDir diff $ proc "diff"
      [ "-ruNw"
      , "old"
      , "new"
      ]
      readProcessStdout
    let status
          | ec == ExitSuccess = NoChanges
          | exists = NeedsVersionBump
          | otherwise = DoesNotExist
        mdiff
          | getDiffs && ec /= ExitSuccess = Just out
          | otherwise = Nothing
    return (status, mdiff)

colorize :: LByteString -> LByteString
colorize =
    BL.intercalate "\n" . map colorLine . BL.split 10
  where
    colorLine :: LByteString -> LByteString
    colorLine l =
      case fst <$> BL8.uncons l of
        Just '-' -> add "31" l
        Just '+' -> add "32" l
        Just '@' -> add "34" l
        _ -> l

    add :: LByteString -> LByteString -> LByteString
    add color l = mconcat
      [ "\x1b["
      , color
      , "m"
      , l
      , "\x1b[0m"
      ]


text:
This repository contains **Dockerfile** of [ElasticSearch](http://www.elasticsearch.org/) for [Docker](https://www.docker.com/)'s [automated build](https://registry.hub.docker.com/u/sisays/elasticsearch-docker/) published to the public [Docker Hub Registry](https://registry.hub.docker.com/).

### Base Docker Image

* [dockerfile/java:oracle-java8](http://dockerfile.github.io/#/java)

### Installation

1. Install [Docker](https://www.docker.com/).

2. Download [automated build](https://registry.hub.docker.com/u/sisays/elasticsearch-docker/) from public [Docker Hub Registry](https://registry.hub.docker.com/): `docker pull sisays/elasticsearch-docker`

   (alternatively, you can build an image from Dockerfile: `docker build -t="sisays/elasticsearch-docker" github.com/simonbahuchet/elasticsearch-docker`)

### Usage1: Run one node

```sh
docker run -d -p 9200:9200 -p 9300:9300 sisays/elasticsearch-docker
```

#### Get the corresponding IP

```sh
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <CONTAINER_ID>
```

#### After a few seconds, use the REST API to retrieve the cluster state

```sh
curl -XGET http://<IP>:9200/_cluster/state?pretty=true
```

### Usage2: Run a 3-nodes cluster (unicast)

1. Create a <data-dir>/config directory

2. Configure a <data-dir>/config/elasticsearch.yml with:

```yml
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["es_node1", "es_node2", "es_node3"]
path:
   logs: /data/log
   data: /data/data
```

3. and then start up 3 nodes:

```sh
docker run -d \
	-h es_node1 \
	--name=es_node1 \
	-p 9200:9200 -p 9300:9300 \
	-v <data-dir>:/data \
	sisays/elasticsearch-docker \
	/elasticsearch/bin/elasticsearch -Des.config=/data/config/elasticsearch.yml
```

```sh
docker run -d \
	-h es_node2 \
	--name=es_node2 \
	--link es_node1:es_node1 \
	-p 9201:9200 -p 9301:9300 \
	-v <data-dir>:/data \
	sisays/elasticsearch-docker \
	/elasticsearch/bin/elasticsearch -Des.config=/data/config/elasticsearch.yml
```

```sh
docker run -d \
	-h es_node3 \
	--name=es_node3 \
	--link es_node1:es_node1 --link es_node2:es_node2 \
	-p 9202:9200 -p 9302:9300 \
	-v <data-dir>:/data \
	sisays/elasticsearch-docker \
	/elasticsearch/bin/elasticsearch -Des.config=/data/config/elasticsearch.yml
```

#### Get the IP of one the nodes

```sh
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <CONTAINER1_ID>
```

#### After a few seconds, use the REST API to retrieve the cluster state

```sh
curl -XGET http://<IP1>:9200/_cluster/state?pretty=true
```


text:
html {
	-ms-text-size-adjust:100%;
	-webkit-text-size-adjust:100%
}
body {
	line-height:1.6;
	font-family:"Microsoft YaHei","微软雅黑",Helvetica,"黑体",Arial,Tahoma;
	color:#222;
	font-size:14px
}
input,textarea,button,a {
	outline:0
}
body,h1,h2,h3,h4,h5,h6,p,ul,ol,dl,dd,fieldset,textarea {
	margin:0
}
fieldset,legend,textarea,input {
	padding:0
}
textarea,input {
	color:#666
}
textarea::-webkit-input-placeholder,input::-webkit-input-placeholder {
	color:#a3a3a3
}
textarea:-moz-placeholder,input:-moz-placeholder {
	color:#a3a3a3
}
textarea::-moz-placeholder,input::-moz-placeholder {
	color:#a3a3a3
}
textarea:-ms-input-placeholder,input:-ms-input-placeholder {
	color:#a3a3a3
}
textarea {
	resize:none;
	overflow-y:scroll
}
ul,ol {
	padding-left:0;
	list-style-type:none
}
a img,fieldset {
	border:0
}
a {
	color:#555;
	text-decoration:none
}
a:hover {
	text-decoration:none
}
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary {
	display:block
}
audio,canvas,video {
	display:inline-block
}
audio:not([controls]) {
	display:none;
	height:0
}
[hidden] {
	display:none
}
svg:not(:root) {
	overflow:hidden
}
figure {
	margin:0
}
button,input,select,textarea {
	font-family:inherit;
	font-size:100%;
	margin:0;
	*font-family:"Microsoft YaHei","微软雅黑",Helvetica,"黑体",Arial,Tahoma
}
button,select {
	text-transform:none
}
button,html input[type="button"],input[type="reset"],input[type="submit"] {
	cursor:pointer;
	-webkit-appearance:button
}
button[disabled],html input[disabled] {
	cursor:default
}
input[type="checkbox"],input[type="radio"] {
	box-sizing:border-box;
	padding:0
}
input[type="search"] {
	box-sizing:content-box;
	-moz-box-sizing:content-box;
	-webkit-appearance:textfield;
	-webkit-box-sizing:content-box
}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration {
	-webkit-appearance:none
}
button::-moz-focus-inner,input::-moz-focus-inner {
	border:0;
	padding:0
}
textarea {
	overflow:auto;
	vertical-align:top
}

.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 1px;
}

.r{float: right;}
.l{float: left;}
.pr{position:relative;}
.pa{position:absolute;}

*{margin:0;padding:0;}
.blur {
    filter: url(blur.svg#blur); /* FireFox, Chrome, Opera */

    -webkit-filter: blur(1.5px); /* Chrome, Opera */
       -moz-filter: blur(1.5px);
        -ms-filter: blur(1.5px);
            filter: blur(1.5px);

    filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius=1.5, MakeShadow=false); /* IE6~IE9 */
}

*::selection {
	background: none;
}
input::selection {
	background: #CCC;
}


text:
<?php

namespace CsvMigrations\Aggregator;

use Cake\Datasource\EntityInterface;
use Cake\ORM\Table;
use CsvMigrations\Exception\MissingJoinException;
use InvalidArgumentException;

/**
 * This class is used as a storage object for aggregator configuration.
 */
final class Configuration
{
    /**
     * Aggregation table.
     *
     * @var \Cake\ORM\Table
     */
    private $table;

    /**
     * Aggregation field.
     *
     * @var string
     */
    private $field;

    /**
     * Join table instance. Optional as it is used only in limited mode.
     *
     * @var \Cake\ORM\Table|null
     */
    private $joinTable = null;

    /**
     * Field used for displaying purposes,
     *
     * @var string
     */
    private $displayField = '';

    /**
     * Entity instance. This is only required if aggregation is in limited mode.
     *
     * @var \Cake\Datasource\EntityInterface|null
     */
    private $entity = null;

    /**
     * Constructor method.
     *
     * Mostly used for properties assignment and data validation.
     *
     * @param \Cake\ORM\Table $table Aggregate table instance
     * @param string $field Aggregate field name
     */
    public function __construct(Table $table, string $field)
    {
        $this->table = $table;
        $this->field = $field;
    }

    /**
     * Running on join mode if join table is defined.
     *
     * @return bool
     */
    public function joinMode(): bool
    {
        return null !== $this->joinTable;
    }

    /**
     * Aggregate table getter.
     *
     * @return \Cake\ORM\Table
     */
    public function getTable(): Table
    {
        return $this->table;
    }

    /**
     * Aggregate field getter.
     *
     * @return string
     */
    public function getField(): string
    {
        return $this->field;
    }

    /**
     * Display field getter.
     *
     * @return string
     */
    public function getDisplayField(): string
    {
        if ('' === trim($this->displayField)) {
            return $this->field;
        }

        return $this->displayField;
    }

    /**
     * Display field setter.
     *
     * @param string $displayField Display field name
     * @return self
     */
    public function setDisplayField(string $displayField): self
    {
        $this->displayField = $displayField;

        return $this;
    }

    /**
     * Join table getter.
     *
     * @return \Cake\ORM\Table
     */
    public function getJoinTable(): Table
    {
        if ($this->joinTable instanceof Table) {
            return $this->joinTable;
        }

        throw new MissingJoinException('No join table has been defined');
    }

    /**
     * Entity getter.
     *
     * @return \Cake\Datasource\EntityInterface
     */
    public function getEntity(): EntityInterface
    {
        if ($this->entity instanceof EntityInterface) {
            return $this->entity;
        }

        throw new MissingJoinException('No join table has been defined');
    }

    /**
     * Join data setter.
     *
     * @param \Cake\ORM\Table $table Join table intsance
     * @param \Cake\Datasource\EntityInterface $entity Entity instance from join table
     * @return self
     */
    public function setJoinData(Table $table, EntityInterface $entity): self
    {
        $entityClass = $table->getEntityClass();
        if (! $entity instanceof $entityClass) {
            throw new InvalidArgumentException(sprintf(
                'Entity must be an instance of "%s". Instead, instance of "%s" was provided.',
                $table->getEntityClass(),
                get_class($entity)
            ));
        }

        $this->joinTable = $table;
        $this->entity = $entity;

        return $this;
    }
}