text:
package gui;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JTextField;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.PlainDocument;

public class JNumberTextField extends JTextField implements MouseListener {
	/**
	 *
	 */
	private static final long serialVersionUID = -1592348797907332103L;
	private static final char DOT = '.';
	private static final char NEGATIVE = '-';
	private static final String BLANK = "";
	private static final int DEF_PRECISION = 2;

	public static final int NUMERIC = 2;
	public static final int DECIMAL = 3;

	public static final String FM_NUMERIC = "123456789";
	public static final String FM_DECIMAL = FM_NUMERIC + DOT;

	private int maxLength = 0;
	private int format = NUMERIC;
	private String negativeChars = BLANK;
	private String allowedChars = null;
	private boolean allowNegative = false;
	private int precision = 0;

	private int x = -1;
	private int y = -1;
	JNumberTextField jf[][];

	protected PlainDocument numberFieldFilter;

	public JNumberTextField(int i, int j, JNumberTextField[][] jf) {
		this(10, NUMERIC, i, j, jf);
	}

	public JNumberTextField(int maxLen, int i, int j, JNumberTextField[][] jf) {
		this(maxLen, NUMERIC, i, j, jf);
	}

	public JNumberTextField(int maxLen, int format, int i, int j,
			JNumberTextField[][] jf) {
		setAllowNegative(false);
		setMaxLength(maxLen);
		setFormat(format);
		this.addMouseListener(this);
		numberFieldFilter = new JNumberFieldFilter();
		super.setDocument(numberFieldFilter);
		this.x = i;
		this.y = j;
		this.jf = jf;

	}

	public void setMaxLength(int maxLen) {
		if (maxLen > 0)
			maxLength = maxLen;
		else
			maxLength = 0;
	}

	public int getMaxLength() {
		return maxLength;
	}

	public void setPrecision(int precision) {
		if (format == NUMERIC)
			return;

		if (precision >= 0)
			this.precision = precision;
		else
			this.precision = DEF_PRECISION;
	}

	public int getPrecision() {
		return precision;
	}

	public Number getNumber() {
		Number number = null;

		if (format == NUMERIC)
			number = new Integer(getText());
		else
			number = new Double(getText());

		return number;
	}

	public void setNumber(Number value) {
		setText(String.valueOf(value));
	}

	public int getInt() {
		return Integer.parseInt(getText());
	}

	public void setInt(int value) {
		setText(String.valueOf(value));
	}

	public float getFloat() {
		return (new Float(getText())).floatValue();
	}

	public void setFloat(float value) {
		setText(String.valueOf(value));
	}

	public double getDouble() {
		return (new Double(getText())).doubleValue();
	}

	public void setDouble(double value) {
		setText(String.valueOf(value));
	}

	public int getFormat() {
		return format;
	}

	public void setFormat(int format) {
		switch (format) {
		case NUMERIC:
		default:
			this.format = NUMERIC;
			this.precision = 0;
			this.allowedChars = FM_NUMERIC;
			break;

		case DECIMAL:
			this.format = DECIMAL;
			this.precision = DEF_PRECISION;
			this.allowedChars = FM_DECIMAL;
			break;
		}
	}

	public void setAllowNegative(boolean value) {
		allowNegative = value;

		if (value)
			negativeChars = "" + NEGATIVE;
		else
			negativeChars = BLANK;
	}

	public boolean isAllowNegative() {
		return allowNegative;
	}

	public void setDocument(Document document) {
	}

	class JNumberFieldFilter extends PlainDocument {
		/**
		 *
		 */
		private static final long serialVersionUID = 4235161939309358477L;

		public JNumberFieldFilter() {
			super();
		}

		public void insertString(int offset, String str, AttributeSet attr)
				throws BadLocationException {
			String text = getText(0, offset) + str
					+ getText(offset, (getLength() - offset));

			if (str == null || text == null)
				return;

			for (int i = 0; i < str.length(); i++) {
				if ((allowedChars + negativeChars).indexOf(str.charAt(i)) == -1)
					return;
			}

			int precisionLength = 0, dotLength = 0, minusLength = 0;
			int textLength = text.length();

			try {
				if (format == NUMERIC) {
					if (!((text.equals(negativeChars)) && (text.length() == 1)))
						new Long(text);
				} else if (format == DECIMAL) {
					if (!((text.equals(negativeChars)) && (text.length() == 1)))
						new Double(text);

					int dotIndex = text.indexOf(DOT);
					if (dotIndex != -1) {
						dotLength = 1;
						precisionLength = textLength - dotIndex - dotLength;

						if (precisionLength > precision)
							return;
					}
				}
			} catch (Exception ex) {
				return;
			}

			if (text.startsWith("" + NEGATIVE)) {
				if (!allowNegative)
					return;
				else
					minusLength = 1;
			}

			if (maxLength < (textLength - dotLength - precisionLength - minusLength))
				return;

			super.insertString(offset, str, attr);
		}
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseClicked(MouseEvent e) {

	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
	 */
	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseEntered(MouseEvent e) {

		int LigneDeZone = (x / (9 / 3)) * 9 / 3;

		int LigneDeZone2 = LigneDeZone + 9 / 3;

		int ColoneDeZone = (y / (9 / 3)) * 9 / 3;

		int ColoneDeZone2 = ColoneDeZone + 9 / 3;
		// TODO Auto-generated method stub
		for (int k = LigneDeZone; k < LigneDeZone2; k++) {
			for (int j = ColoneDeZone; j < ColoneDeZone2; j++) {
				jf[k][j].setBackground(Color.cyan);
			}
		}
		for (int g = 0; g < 9; g++) {
			for (int h = 0; h < 9; h++) {
				if (g == x) {
					jf[g][h].setBackground(Color.red);

				}
			}
		}
		for (int b = 0; b < 9; b++) {
			for (int c = 0; c < 9; c++) {
				if (c == y) {
					jf[b][c].setBackground(Color.yellow);

				}
			}
		}
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
	 */
	@Override
	public void mouseExited(MouseEvent e) {
		int LigneDeZone = (x / (9 / 3)) * 9 / 3;

		int LigneDeZone2 = LigneDeZone + 9 / 3;

		int ColoneDeZone = (y / (9 / 3)) * 9 / 3;

		int ColoneDeZone2 = ColoneDeZone + 9 / 3;
		// TODO Auto-generated method stub
		for (int k = LigneDeZone; k < LigneDeZone2; k++) {
			for (int j = ColoneDeZone; j < ColoneDeZone2; j++) {
				jf[k][j].setBackground(Color.white);
			}
		}
		for (int g = 0; g < 9; g++) {
			for (int h = 0; h < 9; h++) {
				if (g == x) {
					jf[g][h].setBackground(Color.white);

				}
			}
		}
		for (int b = 0; b < 9; b++) {
			for (int c = 0; c < 9; c++) {
				if (c == y) {
					jf[b][c].setBackground(Color.white);

				}
			}
		}

	}
}


text: require 'cctv/tracker'

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<geo:GeodesyML xsi:schemaLocation="urn:xml-gov-au:icsm:egeodesy:0.3" xmlns:geo="urn:xml-gov-au:icsm:egeodesy:0.3" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ns9="http://www.w3.org/1999/xlink" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:om="http://www.opengis.net/om/2.0" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" gml:id="GeodesyMLType_332">
   <geo:siteLog gml:id="SiteLogType_332">
      <geo:formInformation>
         <geo:preparedBy>Ryan Ruddick</geo:preparedBy>
         <geo:datePrepared>2011-07-25T14:00:00Z</geo:datePrepared>
         <geo:reportType>Update</geo:reportType>
      </geo:formInformation>
      <geo:siteIdentification>
         <geo:siteName>Lord Howe Island</geo:siteName>
         <geo:fourCharacterID>LORD</geo:fourCharacterID>
         <geo:monumentInscription>AU077</geo:monumentInscription>
         <geo:iersDOMESNumber>59998M001</geo:iersDOMESNumber>
         <geo:cdpNumber>not available</geo:cdpNumber>
         <geo:monumentDescription>PILLAR</geo:monumentDescription>
         <geo:heightOfTheMonument>1.0</geo:heightOfTheMonument>
         <geo:monumentFoundation>STEEL RODS / CONCRETE BLOCK</geo:monumentFoundation>
         <geo:foundationDepth>5.0</geo:foundationDepth>
         <geo:markerDescription>STAINLESS STEEL PLATE, THREADED SPIGOT</geo:markerDescription>
         <geo:dateInstalled>2009-06-22T14:00:00Z</geo:dateInstalled>
         <geo:geologicCharacteristic>BEDROCK</geo:geologicCharacteristic>
         <geo:bedrockType>SEDIMENTARY</geo:bedrockType>
         <geo:bedrockCondition>WEATHERED</geo:bedrockCondition>
         <geo:faultZonesNearby>NO</geo:faultZonesNearby>
      </geo:siteIdentification>
      <geo:siteLocation>
         <geo:city>Lord Howe Island</geo:city>
         <geo:state>New South Wales</geo:state>
         <geo:countryCodeISO>AUS</geo:countryCodeISO>
         <geo:tectonicPlate codeSpace="">Australia</geo:tectonicPlate>
         <geo:approximatePositionITRF>
            <geo:xCoordinateInMeters>-5082755.848</geo:xCoordinateInMeters>
            <geo:yCoordinateInMeters>1944860.8753</geo:yCoordinateInMeters>
            <geo:zCoordinateInMeters>-3315204.7672</geo:zCoordinateInMeters>
            <geo:latitude-North>-31.519891958333335679753872682340443134307861328125</geo:latitude-North>
            <geo:longitude-East>159.061197588888916243377025239169597625732421875</geo:longitude-East>
            <geo:elevation-m_ellips.>00071.4980</geo:elevation-m_ellips.>
         </geo:approximatePositionITRF>
      </geo:siteLocation>
      <geo:gnssReceivers>
         <geo:gnssReceiver gml:id="GnssReceiverType_1511">
            <geo:manufacturerSerialNumber>356491</geo:manufacturerSerialNumber>
            <geo:receiverType codeList="codelist" codeListValue="codeListValue" codeSpace="DummyCodeSpace">LEICA GRX1200GGPRO</geo:receiverType>
            <geo:satelliteSystem>GPS+GLO</geo:satelliteSystem>
            <geo:serialNumber>356491</geo:serialNumber>
            <geo:firmwareVersion>7.50/3.019</geo:firmwareVersion>
            <geo:elevationCutoffSetting>0.0</geo:elevationCutoffSetting>
            <geo:dateInstalled>2010-05-03T03:00:00Z</geo:dateInstalled>
            <geo:dateRemoved>2011-03-30T00:00:00Z</geo:dateRemoved>
            <geo:temperatureStabilization>0.0</geo:temperatureStabilization>
            <geo:notes>ME upgrade due to GLONASS tracking problem</geo:notes>
         </geo:gnssReceiver>
         <geo:dateInserted>2010-05-03T03:00:00Z</geo:dateInserted>
      </geo:gnssReceivers>
      <geo:gnssReceivers>
         <geo:gnssReceiver gml:id="GnssReceiverType_1512">
            <geo:manufacturerSerialNumber>356491</geo:manufacturerSerialNumber>
            <geo:receiverType codeList="codelist" codeListValue="codeListValue" codeSpace="DummyCodeSpace">LEICA GRX1200GGPRO</geo:receiverType>
            <geo:satelliteSystem>GPS+GLO</geo:satelliteSystem>
            <geo:serialNumber>356491</geo:serialNumber>
            <geo:firmwareVersion>7.50</geo:firmwareVersion>
            <geo:elevationCutoffSetting>0.0</geo:elevationCutoffSetting>
            <geo:dateInstalled>2009-06-26T00:00:00Z</geo:dateInstalled>
            <geo:dateRemoved>2010-05-03T03:00:00Z</geo:dateRemoved>
            <geo:temperatureStabilization>0.0</geo:temperatureStabilization>
            <geo:notes>The tracking was changed from C2 or P2, to P2 only at 2009-08-06T00 The tracking was changed to track all SVs in view at 2009-09-24T01</geo:notes>
         </geo:gnssReceiver>
         <geo:dateInserted>2009-06-26T00:00:00Z</geo:dateInserted>
      </geo:gnssReceivers>
      <geo:gnssReceivers>
         <geo:gnssReceiver gml:id="GnssReceiverType_1513">
            <geo:manufacturerSerialNumber>356491</geo:manufacturerSerialNumber>
            <geo:receiverType codeList="codelist" codeListValue="codeListValue" codeSpace="DummyCodeSpace">LEICA GRX1200GGPRO</geo:receiverType>
            <geo:satelliteSystem>GPS+GLO</geo:satelliteSystem>
            <geo:serialNumber>356491</geo:serialNumber>
            <geo:firmwareVersion>8.20/3.019</geo:firmwareVersion>
            <geo:elevationCutoffSetting>0.0</geo:elevationCutoffSetting>
            <geo:dateInstalled>2011-07-26T00:00:00Z</geo:dateInstalled>
            <geo:dateRemoved></geo:dateRemoved>
            <geo:temperatureStabilization>0.0</geo:temperatureStabilization>
         </geo:gnssReceiver>
         <geo:dateInserted>2011-07-26T00:00:00Z</geo:dateInserted>
      </geo:gnssReceivers>
      <geo:gnssReceivers>
         <geo:gnssReceiver gml:id="GnssReceiverType_1514">
            <geo:manufacturerSerialNumber>356491</geo:manufacturerSerialNumber>
            <geo:receiverType codeList="codelist" codeListValue="codeListValue" codeSpace="DummyCodeSpace">LEICA GRX1200GGPRO</geo:receiverType>
            <geo:satelliteSystem>GPS+GLO</geo:satelliteSystem>
            <geo:serialNumber>356491</geo:serialNumber>
            <geo:firmwareVersion>8.10/3.019</geo:firmwareVersion>
            <geo:elevationCutoffSetting>0.0</geo:elevationCutoffSetting>
            <geo:dateInstalled>2011-03-30T00:00:00Z</geo:dateInstalled>
            <geo:dateRemoved>2011-07-26T00:00:00Z</geo:dateRemoved>
            <geo:temperatureStabilization>0.0</geo:temperatureStabilization>
         </geo:gnssReceiver>
         <geo:dateInserted>2011-03-30T00:00:00Z</geo:dateInserted>
      </geo:gnssReceivers>
      <geo:gnssAntennas>
         <geo:gnssAntenna gml:id="GnssAntennaType_674">
            <geo:manufacturerSerialNumber>200702</geo:manufacturerSerialNumber>
            <geo:antennaType codeList="codelist" codeListValue="codeListValue" codeSpace="codespace">LEIAT504GG      NONE</geo:antennaType>
            <geo:serialNumber>200702</geo:serialNumber>
            <geo:antennaReferencePoint codeSpace="">BPA</geo:antennaReferencePoint>
            <geo:marker-arpUpEcc.>0.0</geo:marker-arpUpEcc.>
            <geo:marker-arpNorthEcc.>0.0</geo:marker-arpNorthEcc.>
            <geo:marker-arpEastEcc.>0.0</geo:marker-arpEastEcc.>
            <geo:alignmentFromTrueNorth>0.0</geo:alignmentFromTrueNorth>
            <geo:antennaRadomeType codeSpace="CodeSpaceAttr">NONE</geo:antennaRadomeType>
            <geo:radomeSerialNumber></geo:radomeSerialNumber>
            <geo:antennaCableType>RG58</geo:antennaCableType>
            <geo:antennaCableLength>10.0</geo:antennaCableLength>
            <geo:dateInstalled>2009-06-26T00:00:00Z</geo:dateInstalled>
            <geo:dateRemoved></geo:dateRemoved>
         </geo:gnssAntenna>
         <geo:dateInserted>2009-06-26T00:00:00Z</geo:dateInserted>
      </geo:gnssAntennas>
      <geo:surveyedLocalTies>
         <geo:surveyedLocalTies gml:id="SurveyedLocalTiesType_169">
            <geo:tiedMarkerName>RM4</geo:tiedMarkerName>
            <geo:tiedMarkerUsage>Local Control</geo:tiedMarkerUsage>
            <geo:tiedMarkerCDPNumber></geo:tiedMarkerCDPNumber>
            <geo:tiedMarkerDOMESNumber></geo:tiedMarkerDOMESNumber>
            <geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
               <geo:dx>0.2607</geo:dx>
               <geo:dy>12.7827</geo:dy>
               <geo:dz>12.2042</geo:dz>
            </geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
            <geo:localSiteTiesAccuracy>1.0</geo:localSiteTiesAccuracy>
            <geo:surveyMethod>TRIANGULATION</geo:surveyMethod>
            <geo:dateMeasured>2010-06-07T14:00:00Z</geo:dateMeasured>
            <geo:notes>Deep Driven stainless steel rod</geo:notes>
         </geo:surveyedLocalTies>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:surveyedLocalTies>
      <geo:surveyedLocalTies>
         <geo:surveyedLocalTies gml:id="SurveyedLocalTiesType_170">
            <geo:tiedMarkerName>RM1</geo:tiedMarkerName>
            <geo:tiedMarkerUsage>Local Control</geo:tiedMarkerUsage>
            <geo:tiedMarkerCDPNumber></geo:tiedMarkerCDPNumber>
            <geo:tiedMarkerDOMESNumber></geo:tiedMarkerDOMESNumber>
            <geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
               <geo:dx>-21.6509</geo:dx>
               <geo:dy>-17.5224</geo:dy>
               <geo:dz>13.2886</geo:dz>
            </geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
            <geo:localSiteTiesAccuracy>1.0</geo:localSiteTiesAccuracy>
            <geo:surveyMethod>TRIANGULATION</geo:surveyMethod>
            <geo:dateMeasured>2010-06-07T14:00:00Z</geo:dateMeasured>
            <geo:notes>Deep Driven stainless steel rod</geo:notes>
         </geo:surveyedLocalTies>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:surveyedLocalTies>
      <geo:surveyedLocalTies>
         <geo:surveyedLocalTies gml:id="SurveyedLocalTiesType_171">
            <geo:tiedMarkerName>RM2</geo:tiedMarkerName>
            <geo:tiedMarkerUsage>Local Control</geo:tiedMarkerUsage>
            <geo:tiedMarkerCDPNumber></geo:tiedMarkerCDPNumber>
            <geo:tiedMarkerDOMESNumber></geo:tiedMarkerDOMESNumber>
            <geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
               <geo:dx>-4.3761</geo:dx>
               <geo:dy>-27.8679</geo:dy>
               <geo:dz>-6.6772</geo:dz>
            </geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
            <geo:localSiteTiesAccuracy>1.0</geo:localSiteTiesAccuracy>
            <geo:surveyMethod>TRIANGULATION</geo:surveyMethod>
            <geo:dateMeasured>2010-06-07T14:00:00Z</geo:dateMeasured>
            <geo:notes>Deep Driven stainless steel rod</geo:notes>
         </geo:surveyedLocalTies>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:surveyedLocalTies>
      <geo:surveyedLocalTies>
         <geo:surveyedLocalTies gml:id="SurveyedLocalTiesType_172">
            <geo:tiedMarkerName>RM3</geo:tiedMarkerName>
            <geo:tiedMarkerUsage>Local Control</geo:tiedMarkerUsage>
            <geo:tiedMarkerCDPNumber></geo:tiedMarkerCDPNumber>
            <geo:tiedMarkerDOMESNumber></geo:tiedMarkerDOMESNumber>
            <geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
               <geo:dx>13.9815</geo:dx>
               <geo:dy>-2.962</geo:dy>
               <geo:dz>-12.6621</geo:dz>
            </geo:differentialComponentsGNSSMarkerToTiedMonumentITRS>
            <geo:localSiteTiesAccuracy>1.0</geo:localSiteTiesAccuracy>
            <geo:surveyMethod>TRIANGULATION</geo:surveyMethod>
            <geo:dateMeasured>2010-06-07T14:00:00Z</geo:dateMeasured>
            <geo:notes>Deep Driven stainless steel rod</geo:notes>
         </geo:surveyedLocalTies>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:surveyedLocalTies>
      <geo:frequencyStandards>
         <geo:frequencyStandard gml:id="FrequencyStandardType_516">
            <geo:standardType codeSpace="">QUARTZ/INTERNAL</geo:standardType>
            <geo:inputFrequency>5.0</geo:inputFrequency>
            <gml:validTime nilReason="">
               <gml:TimePeriod gml:id="TimePeriodType_803">
                  <gml:beginPosition>2009-06-29T00:00:00Z</gml:beginPosition>
                  <gml:endPosition></gml:endPosition>
               </gml:TimePeriod>
            </gml:validTime>
         </geo:frequencyStandard>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:frequencyStandards>
      <geo:humiditySensors>
         <geo:humiditySensor gml:id="HumiditySensorType_131">
            <geo:type codeSpace="">PAROSCIENTIFIC MET4</geo:type>
            <geo:manufacturer>PAROSCIENTIFIC</geo:manufacturer>
            <geo:serialNumber>DQ107099</geo:serialNumber>
            <geo:heightDiffToAntenna>0.0</geo:heightDiffToAntenna>
            <geo:calibrationDate></geo:calibrationDate>
            <gml:validTime nilReason="">
               <gml:TimePeriod gml:id="TimePeriodType_804">
                  <gml:beginPosition>2009-06-26T00:00:00Z</gml:beginPosition>
                  <gml:endPosition></gml:endPosition>
               </gml:TimePeriod>
            </gml:validTime>
            <geo:dataSamplingInterval>30.0</geo:dataSamplingInterval>
            <geo:accuracy-percentRelativeHumidity>2.0</geo:accuracy-percentRelativeHumidity>
            <geo:aspiration>UNASPIRATED</geo:aspiration>
         </geo:humiditySensor>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:humiditySensors>
      <geo:pressureSensors>
         <geo:pressureSensor gml:id="PressureSensorType_131">
            <geo:type codeSpace="">PAROSCIENTIFIC MET4</geo:type>
            <geo:manufacturer>PAROSCIENTIFIC</geo:manufacturer>
            <geo:serialNumber>DQ107099</geo:serialNumber>
            <geo:heightDiffToAntenna>0.0</geo:heightDiffToAntenna>
            <geo:calibrationDate></geo:calibrationDate>
            <gml:validTime nilReason="">
               <gml:TimePeriod gml:id="TimePeriodType_805">
                  <gml:beginPosition>2009-06-26T00:00:00Z</gml:beginPosition>
                  <gml:endPosition></gml:endPosition>
               </gml:TimePeriod>
            </gml:validTime>
            <geo:dataSamplingInterval>30.0</geo:dataSamplingInterval>
            <geo:accuracy-hPa>0.08</geo:accuracy-hPa>
         </geo:pressureSensor>
         <geo:dateInserted>2016-04-14T00:03:10Z</geo:dateInserted>
      </geo:pressureSensors>
      <geo:siteContact gml:id="AgencyPropertyType_664">
         <gmd:MD_SecurityConstraints id="MDSecurityConstraintsType_664">
            <gmd:classification>
               <gmd:MD_ClassificationCode codeList="codelist" codeListValue="codeListValue"/>
            </gmd:classification>
         </gmd:MD_SecurityConstraints>
         <gmd:CI_ResponsibleParty id="CIResponsiblePartyType_664">
            <gmd:individualName>
               <gco:CharacterString>Michael Moore</gco:CharacterString>
            </gmd:individualName>
            <gmd:organisationName>
               <gco:CharacterString>Geoscience Australia</gco:CharacterString>
            </gmd:organisationName>
            <gmd:contactInfo>
               <gmd:CI_Contact id="CIContactType_664">
                  <gmd:phone>
                     <gmd:CI_Telephone id="CITelephoneType_256">
                        <gmd:voice>
                           <gco:CharacterString>+61 2 6249 9052</gco:CharacterString>
                        </gmd:voice>
                        <gmd:facsimile>
                           <gco:CharacterString>+61 2 6249 9929</gco:CharacterString>
                        </gmd:facsimile>
                     </gmd:CI_Telephone>
                  </gmd:phone>
                  <gmd:address>
                     <gmd:CI_Address id="CIAddressType_664">
                        <gmd:deliveryPoint>
                           <gco:CharacterString>Geoscience Australia</gco:CharacterString>
                        </gmd:deliveryPoint>
                        <gmd:electronicMailAddress>
                           <gco:CharacterString>Michael.Moore@ga.gov.au</gco:CharacterString>
                        </gmd:electronicMailAddress>
                     </gmd:CI_Address>
                  </gmd:address>
               </gmd:CI_Contact>
            </gmd:contactInfo>
            <gmd:role>
               <gmd:CI_RoleCode codeList="codelist" codeListValue="codeListValue"/>
            </gmd:role>
         </gmd:CI_ResponsibleParty>
      </geo:siteContact>
      <geo:siteMetadataCustodian gml:id="AgencyPropertyType_665">
         <gmd:MD_SecurityConstraints id="MDSecurityConstraintsType_665">
            <gmd:classification>
               <gmd:MD_ClassificationCode codeList="codelist" codeListValue="codeListValue"/>
            </gmd:classification>
         </gmd:MD_SecurityConstraints>
         <gmd:CI_ResponsibleParty id="CIResponsiblePartyType_665">
            <gmd:organisationName>
               <gco:CharacterString>Geoscience Australia</gco:CharacterString>
            </gmd:organisationName>
            <gmd:contactInfo>
               <gmd:CI_Contact id="CIContactType_665">
                  <gmd:address>
                     <gmd:CI_Address id="CIAddressType_665"/>
                  </gmd:address>
               </gmd:CI_Contact>
            </gmd:contactInfo>
            <gmd:role>
               <gmd:CI_RoleCode codeList="codelist" codeListValue="codeListValue"/>
            </gmd:role>
         </gmd:CI_ResponsibleParty>
      </geo:siteMetadataCustodian>
      <geo:moreInformation>
         <geo:dataCenter></geo:dataCenter>
         <geo:urlForMoreInformation></geo:urlForMoreInformation>
         <geo:siteMap></geo:siteMap>
         <geo:siteDiagram>X</geo:siteDiagram>
         <geo:horizonMask>X</geo:horizonMask>
         <geo:monumentDescription></geo:monumentDescription>
         <geo:sitePictures>Y</geo:sitePictures>
         <geo:antennaGraphicsWithDimensions></geo:antennaGraphicsWithDimensions>
         <geo:insertTextGraphicFromAntenna></geo:insertTextGraphicFromAntenna>
         <geo:DOI codeSpace="CodeSpaceTODO">CodeTypeTODO</geo:DOI>
      </geo:moreInformation>
   </geo:siteLog>
</geo:GeodesyML>


text:
package com.apicloud.moduleDemo;

import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Vibrator;
import android.view.Gravity;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.uzmap.pkg.uzcore.UZWebView;
import com.uzmap.pkg.uzcore.uzmodule.UZModule;
import com.uzmap.pkg.uzcore.uzmodule.UZModuleContext;

/**
 * 该类映射至Javascript中moduleDemo对象

 * Js Example:

 * var module = api.require('moduleDemo');

 * module.xxx();
 * @author APICloud
 *
 */
public class APIModuleDemo extends UZModule {

	static final int ACTIVITY_REQUEST_CODE_A = 100;

	private AlertDialog.Builder mAlert;
	private Vibrator mVibrator;
	private UZModuleContext mJsCallback;
	private MyTextView mMyTextView;

	public APIModuleDemo(UZWebView webView) {
		super(webView);
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的showAlert函数

	 * JS Example:

	 * moduleDemo.showAlert(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_showAlert(final UZModuleContext moduleContext){
		if(null != mAlert){
			return;
		}
		String showMsg = moduleContext.optString("msg");
		mAlert = new AlertDialog.Builder(mContext);
		mAlert.setTitle("这是标题");
		mAlert.setMessage(showMsg);
		mAlert.setCancelable(false);
		mAlert.setPositiveButton("确定", new OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				mAlert = null;
				JSONObject ret = new JSONObject();
				try {
					ret.put("buttonIndex", 1);
				} catch (JSONException e) {
					e.printStackTrace();
				}
				moduleContext.success(ret, true);
			}
		});
		mAlert.show();
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的startActivity函数

	 * JS Example:

	 * moduleDemo.startActivity(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_startActivity(UZModuleContext moduleContext){
		Intent intent = new Intent(getContext(), DemoActivity.class);
		intent.putExtra("appParam", moduleContext.optString("appParam"));
		startActivity(intent);
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的startActivityForResult函数

	 * JS Example:

	 * moduleDemo.startActivityForResult(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_startActivityForResult(UZModuleContext moduleContext){
		mJsCallback = moduleContext;
		Intent intent = new Intent(getContext(), DemoActivity.class);
		intent.putExtra("appParam", moduleContext.optString("appParam"));
		intent.putExtra("needResult", true);
		startActivityForResult(intent, ACTIVITY_REQUEST_CODE_A);
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的vibrate函数

	 * JS Example:

	 * moduleDemo.vibrate(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_vibrate(UZModuleContext moduleContext){
		try {
			if (null == mVibrator) {
				mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
			}
			mVibrator.vibrate(moduleContext.optLong("milliseconds"));
		} catch (SecurityException e) {
			Toast.makeText(mContext, "no vibrate permisson declare", Toast.LENGTH_SHORT).show();
		}
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的stopVibrate函数

	 * JS Example:

	 * moduleDemo.stopVibrate(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_stopVibrate(UZModuleContext moduleContext){
		if (null != mVibrator) {
			try {
				mVibrator.cancel();
				mVibrator = null;
			} catch (SecurityException e) {
				e.printStackTrace();
			}
		}
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的addView函数

	 * JS Example:

	 * moduleDemo.addView(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_addView(UZModuleContext moduleContext){
		int x = moduleContext.optInt("x");
		int y = moduleContext.optInt("y");
		int w = moduleContext.optInt("w");
		int h = moduleContext.optInt("h");
		if(w == 0){
			w = ViewGroup.LayoutParams.MATCH_PARENT;
		}
		if(h == 0){
			h = ViewGroup.LayoutParams.MATCH_PARENT;
		}
		if(null == mMyTextView){
			mMyTextView = new MyTextView(mContext);
		}
		int FROM_TYPE = Animation.RELATIVE_TO_PARENT;
		Animation anim = new TranslateAnimation(FROM_TYPE, 1.0f, FROM_TYPE, 0.0f, FROM_TYPE, 0.0f, FROM_TYPE, 0.0f);
		anim.setDuration(500);
		mMyTextView.setAnimation(anim);
		RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(w, h);
		rlp.leftMargin = x;
		rlp.topMargin = y;
		insertViewToCurWindow(mMyTextView, rlp);
	}

	/**
	 * 函数

	 * 该函数映射至Javascript中moduleDemo对象的removeView函数

	 * JS Example:

	 * moduleDemo.removeView(argument);
	 *
	 * @param moduleContext  (Required)
	 */
	public void jsmethod_removeView(UZModuleContext moduleContext){
		if(null != mMyTextView){

			removeViewFromCurWindow(mMyTextView);
		}
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		if(resultCode == Activity.RESULT_OK && requestCode == ACTIVITY_REQUEST_CODE_A){
			String result = data.getStringExtra("result");
			if(null != result && null != mJsCallback){
				try {
					JSONObject ret = new JSONObject(result);
					mJsCallback.success(ret, true);
					mJsCallback = null;
				} catch (JSONException e) {
					e.printStackTrace();
				}
			}
		}
	}

	@Override
	protected void onClean() {
		if(null != mAlert){
			mAlert = null;
		}
		if(null != mJsCallback){
			mJsCallback = null;
		}
	}

	class MyTextView extends TextView{

		public MyTextView(Context context) {
			super(context);
			setBackgroundColor(0xFFF0CFD0);
			setText("我是自定义View");
			setTextColor(0xFF000000);
			setGravity(Gravity.CENTER);
		}
	}
}


text:
import { describe, it } from 'mocha'
import { eq, fail } from '@briancavalier/assert'

import { zipArrayValues, withArrayValues } from '../../src/combinator/withArrayValues'
import { empty } from '../../src/source/empty'

import { collectEventsFor, makeEvents } from '../helper/testEnv'

describe('withArrayValues', () => {
  describe('zipArrayValues', () => {
    it('should be empty for empty array', () => {
      const s = zipArrayValues(fail, [], makeEvents(1, 1))
      return collectEventsFor(1, s).then(eq([]))
    })

    it('should be empty for empty stream', () => {
      const s = zipArrayValues(fail, [1, 2, 3], empty())
      return collectEventsFor(1, s).then(eq([]))
    })

    it('should contain zipped values when more events than values', () => {
      const a = ['a', 'b', 'c']
      const n = a.length + 1
      const s = zipArrayValues((a, b) => a + String(b), a, makeEvents(1, n))

      return collectEventsFor(n, s)
        .then(eq([
          { time: 0, value: 'a0' },
          { time: 1, value: 'b1' },
          { time: 2, value: 'c2' }
        ]))
    })

    it('should contain zipped values when more values than events', () => {
      const a = ['a', 'b', 'c']
      const n = a.length - 1
      const s = zipArrayValues((a, b) => a + String(b), a, makeEvents(1, n))

      return collectEventsFor(a.length, s)
        .then(eq([
          { time: 0, value: 'a0' },
          { time: 1, value: 'b1' }
        ]))
    })
  })

  describe('withArrayValues', () => {
    it('should be empty for empty array', () => {
      const s = withArrayValues([], makeEvents(1, 1))
      return collectEventsFor(1, s).then(eq([]))
    })

    it('should be empty for empty stream', () => {
      const s = withArrayValues([1, 2, 3], empty())
      return collectEventsFor(1, s).then(eq([]))
    })

    it('should contain array values when more events than values', () => {
      const a = ['a', 'b', 'c']
      const n = a.length + 1
      const s = withArrayValues(a, makeEvents(1, n))

      return collectEventsFor(n, s)
        .then(eq([
          { time: 0, value: 'a' },
          { time: 1, value: 'b' },
          { time: 2, value: 'c' }
        ]))
    })

    it('should contain array values when more values than events', () => {
      const a = ['a', 'b', 'c']
      const n = a.length - 1
      const s = withArrayValues(a, makeEvents(1, n))

      return collectEventsFor(a.length, s)
        .then(eq([
          { time: 0, value: 'a' },
          { time: 1, value: 'b' }
        ]))
    })
  })
})


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 331908 $ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="imagickpixel.getcolorvalue">
 <refnamediv>
  <refname>ImagickPixel::getColorValue</refname>
  <refpurpose>Gets the normalized value of the provided color channel</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>float</type><methodname>ImagickPixel::getColorValue</methodname>
   <methodparam><type>int</type><parameter>color</parameter></methodparam>
  </methodsynopsis>
  <para>
   Retrieves the value of the color channel specified, as a floating-point
   number between 0 and 1.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>color</parameter></term>
     <listitem>
      <para>
       The color to get the value of, specified as one of the Imagick color
       constants. This can be one of the RGB colors, CMYK colors, alpha and
       opacity e.g (Imagick::COLOR_BLUE, Imagick::COLOR_MAGENTA).
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The value of the channel, as a normalized floating-point number, throwing
   ImagickPixelException on error.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Basic <function>Imagick::getColorValue</function> usage</title>
    <programlisting role="php">
<![CDATA[
<?php

$color = new ImagickPixel('rgba(90%, 20%, 20%, 0.75)');

echo "Alpha value is ".$color->getColorValue(Imagick::COLOR_ALPHA).PHP_EOL;
echo "".PHP_EOL;
echo "Red value is ".$color->getColorValue(Imagick::COLOR_RED).PHP_EOL;
echo "Green value is ".$color->getColorValue(Imagick::COLOR_GREEN).PHP_EOL;
echo "Blue value is ".$color->getColorValue(Imagick::COLOR_BLUE).PHP_EOL;
echo "".PHP_EOL;
echo "Cyan value is ".$color->getColorValue(Imagick::COLOR_CYAN).PHP_EOL;
echo "Magenta value is ".$color->getColorValue(Imagick::COLOR_MAGENTA).PHP_EOL;
echo "Yellow value is ".$color->getColorValue(Imagick::COLOR_YELLOW).PHP_EOL;
echo "Black value is ".$color->getColorValue(Imagick::COLOR_BLACK).PHP_EOL;

?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
Alpha value is 0.74999618524453

Red value is 0.90000762951095
Green value is 0.2
Blue value is 0.2

Cyan value is 0.90000762951095
Magenta value is 0.2
Yellow value is 0.2
Black value is 0
]]>
    </screen>
   </example>
  </para>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->


text:
import React from 'react';
import PropTypes from 'prop-types';
import Button from '../../Backoffice/Button';
import TextLink from '../../Backoffice/TextLink';

const ActionButton = ({children, onClick, type, link}) => {
  const commonProps = {
    dataHook: 'notification-cta-button',
    onClick: e => onClick(e)
  };

  if (type === 'textLink') {
    return (
      <TextLink underlineStyle="always" darkBackground link={link} {...commonProps} >
        {children}
      </TextLink>
    );
  } else {
    return (
      <Button height="small" theme="transparent" {...commonProps}>
        {children}
      </Button>
    );
  }
};

ActionButton.propTypes = {
  children: PropTypes.any,
  onClick: PropTypes.func,
  link: PropTypes.string,
  type: PropTypes.string
};

ActionButton.defaultProps = {
  onClick: e => e.preventDefault(),
  type: 'button'
};

ActionButton.displayName = 'Notification.ActionButton';

export default ActionButton;


text:
<?php

class Moneyers extends Pas_Db_Table_Abstract {

    /** The table name
     * @access protected
     * @var string
     */
    protected $_name = 'moneyers';

    /** The primary key
     * @access protected
     * @var integer
     */
    protected $_primary = 'id';

    /** Retrieve moneyer list with concatenated names and dates
     * @access public
     * @return array
     * @todo add caching
     */
    public function getMoneyers() {
        $moneyers = $this->getAdapter();
        $select = $moneyers->select()
                ->from($this->_name, array(
                    'id',
                    'term' => 'CONCAT(name,"(", IFNULL(date_1,""), " " , IFNULL(date_2, ""), ")")'
                    ))
                ->order('name ASC');
        return $moneyers->fetchAll($select);
    }

    /** Retrieve moneyer list with concatenated names and dates in key value
     * pair array
     * @access public
     * @return array
     * @todo add caching
     */
    public function getRepublicMoneyers() {
	$moneyers = $this->getAdapter();
	$select = $moneyers->select()
		->from($this->_name, array(
                    'id',
                    'term' => 'CONCAT(name,"(", IFNULL(date_1,""), " " , IFNULL(date_2, ""), ")")'
                    ))
		->order('name ASC');
	return $moneyers->fetchPairs($select);
    }

    /** Retrieve paginated moneyer list
     * @access public
     * @param array $params
     * @return array
     */
    public function getValidMoneyers($params) {
	$moneyers = $this->getAdapter();
	$select = $moneyers->select()
                ->from($this->_name)
                ->where('valid = ?',(int)1);
	$paginator = Zend_Paginator::factory($select);
	$paginator->setItemCountPerPage(30)
		->setPageRange(10);
	if(isset($params['page']) && ($params['page'] != "")) {
            $paginator->setCurrentPageNumber($params['page']);
	}
	return $paginator;
    }

    /** Retrieve moneyer by ID number
     * @param integer $id
     * @return array
     * @todo change to fetchrow?
     * @todo add caching?
     */
    public function getMoneyer($id) {
	$moneyers = $this->getAdapter();
	$select = $moneyers->select()
		->from($this->_name)
		->where($this->_primary . ' = ?',(int)$id);
	return $moneyers->fetchAll($select);
    }
}


text:
package io.github.kimkr.presentation.view;

/**
 * Created by kkr on 2017. 10. 21..
 */

public class BaseFragment {
}


text:
<?php
namespace Xopn\PhpRamlParser\Parser;

use Xopn\PhpRamlParser\Domain\Response;

class ResponseParser extends AbstractParser {

	protected $className = '\\Xopn\\PhpRamlParser\\Domain\\Response';

	/**
	 * @var NamedParameterParser
	 */
	protected $namedParameterParser;

	public function __construct() {
		// @TODO: DI
		$this->namedParameterParser = new NamedParameterParser();
	}

	/**
	 * @param array $data
	 * @param string $objectKey
	 * @return Response
	 */
	public function parse($data, $objectKey = NULL) {
		return parent::parse($data, $objectKey);
	}

	public function setHeaders(Response $response, $data) {
		foreach($data as $key => $dat) {
			$parameter = $this->namedParameterParser->parse($dat, $key);
			$response->addHeader($parameter, $key);
		}
	}
}


text:
#ifndef _BALLTREE_H__
#define _BALLTREE_H__

#include <shogun/lib/config.h>

#include <shogun/multiclass/tree/NbodyTree.h>

namespace shogun
{

/** @brief This class implements Ball tree. The ball tree is contructed using the top-down approach.
 * cf. ftp://ftp.icsi.berkeley.edu/pub/techreports/1989/tr-89-063.pdf
 */
class BallTree : public CNbodyTree
{
public:
	/** constructor
	 *
	 * @param leaf_size min number of samples in any node
	 * @param d distance type
	 */
	BallTree(int32_t leaf_size=1, EDistanceType d=D_EUCLIDEAN);

	/** Destructor */
	virtual ~BallTree() { };

	/** get name
	 * @return class of the tree
	 */
	virtual const char* get_name() const { return "BallTree"; }

private:
	/** find minimum distance between node and a query vector
	 *
	 * @param node present node
	 * @param feat query vector
	 * @param dim dimensions of query vector
	 * @return min distance
	 */
	float64_t min_dist(std::shared_ptr<bnode_t> node,float64_t* feat, int32_t dim);

	/** find minimum distance between 2 nodes
	 *
	 * @param nodeq node containing active query vectors
	 * @param noder node containing active training vectors
	 * @return min distance between 2 nodes
	 */
	virtual float64_t min_dist_dual(std::shared_ptr<bnode_t> nodeq, std::shared_ptr<bnode_t> noder);

	/** find max distance between 2 nodes
	 *
	 * @param nodeq node containing active query vectors
	 * @param noder node containing active training vectors
	 * @return max distance between 2 nodes
	 */
	virtual float64_t max_dist_dual(std::shared_ptr<bnode_t> nodeq, std::shared_ptr<bnode_t> noder);

	/** get min as well as max distance of a node from a point
	 *
	 * @param pt point whose distance is to be calculated
	 * @param node node from which distances are to be calculated
	 * @param lower lower bound of distance
	 * @param upper upper bound of distance
	 * @param dim dimension of point vector
	 */
	void min_max_dist(float64_t* pt, std::shared_ptr<bnode_t> node, float64_t &lower,float64_t &upper, int32_t dim);

	/** initialize node
	 *
	 * @param node node to be initialized
	 * @param start start index of index vector
	 * @param end end index of index vector
	 */
	void init_node(std::shared_ptr<bnode_t> node, index_t start, index_t end);

};
} /* namespace shogun */

#endif /* _BALLTREE_H__ */


text:
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fn_ObjectCanUpdateOrDelete]'))
DROP FUNCTION [dbo].[fn_ObjectCanUpdateOrDelete]
GO

CREATE FUNCTION [dbo].[fn_ObjectCanUpdateOrDelete](
    @State INT
)
RETURNS BIT
AS
BEGIN
    DECLARE @ReturnValue AS BIT;
    -- 0x1: Deleted, 0x4: readonly
    IF @State IS NOT NULL AND NOT ((@State & 0x1 = 0x1) OR (@State & 0x4 = 0x4))
        SET @ReturnValue = 1;
    ELSE
        SET @ReturnValue = 0;

    RETURN @ReturnValue;
END
GO


text:
'use strict';

var RelayRoute = require.requireActual('RelayRoute');

RelayRoute.genMock = jest.genMockFunction().mockImplementation(() => {
  class MockRoute extends RelayRoute {}
  MockRoute.routeName = 'MockRoute';
  MockRoute.path = '/jest';
  return MockRoute;
});

RelayRoute.genMockInstance = jest.genMockFunction().mockImplementation(
  () => new (RelayRoute.genMock())()
);

module.exports = RelayRoute;


text:
 /**
  * @typedef object
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
  */

 /**
  * @typedef function
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function
  */

 /**
  * @typedef array
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
  */

 /**
  * @typedef string
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
  */

 /**
  * @typedef boolean
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
  */

 /**
  * @typedef any
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
  */

 /**
  * @typedef undefined
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined
  */

/**
 * @typedef number
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
 */

/**
 * @typedef Promise
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
 */

/**
 * @typedef PromiseResolve
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve
 */

/**
 * @typedef PromiseReject
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject
 */

/**
 * @typedef RegExp
 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
 */


text:
<select class='titleselect' name='title' id='title'>
    <option value='0'></option>
    <option value='1'>Mr.</option>
    <option value='3'>Miss</option>
    <option value='4'>Mrs.</option>
    <option value='5'>Mx.</option>
</select>

    Address example:

    Salutation example:


text:
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="capital_on">"ВКЛУЧЕНО"</string>
    <string name="capital_off">"ИСКЛУЧЕНО"</string>
    <string name="ringtone_default">"Стандардна мелодија"</string>
    <string name="ringtone_default_with_actual">"Стандардна (<xliff:g id="ACTUAL_RINGTONE">%1$s</xliff:g>)"</string>
    <string name="ringtone_silent">"Ниедна"</string>
    <string name="ringtone_picker_title">"Мелодии"</string>
    <string name="ringtone_picker_title_alarm">"Звуци за аларм"</string>
    <string name="ringtone_picker_title_notification">"Звуци за известување"</string>
    <string name="ringtone_unknown">"Непозната"</string>
</resources>


text:
/*
 * Server
 *
 * Author: Mingli Yuan (mingli.yuan@gmail.com)
 * Author: Kai Chen (chenk85@gmail.com)
 *
 * MIT License
 */

var logger = require('./logger'),
    Builder = require("./route_builder"),
    weblogger = require("./middleware").weblogger;

var step = require('step'),
    connect = require('connect');

exports.start = function (root) {
    var env = {
        path: root,
        logger: logger
    };

    step(
      function () {
          require('./config').load(env, this);
      },
      function () {
          require('./subapps').detect(env, this);
      },
      function () {
          require('./template').load(env, this);
      },
      function () {
          require('./controller').load(env, this);
      },
      function () {
          require('./resource').clear(env, this);
      },
      function () {
          require('./resource').load(env, this);
      },
      function (err) {
          if (err) {
              throw err;
          }

          var loadHandler = function (name) {
                  logger.info("loading controller " + name);
                  var path = env.controllers[name];
                  return require(path)(env);
              },
              authenticate = function (realm) {
                  return function (user, pass) {
                      u = env.auths.users[user];
                      return u && u.password === pass
                               && u.realms.some(function (el) {
                                   return el === realm;
                               });
                  };
              },
              withRealm = function (realm, handler) {
                  return function (req, res) {
                      connect.basicAuth(authenticate(realm))(
                          req, res, function () { handler(req,res) }
                      );
                  };
              };

          var builder = new Builder(),
              routes = function (app) {
                  eval(builder.build(env.routes));
              },
              server = connect.createServer(
                  weblogger({
                      format:env.log.format,
                      logfile: [env.path, 'log', 'app.log'].join('/')
                  }),
                  connect.staticProvider(env.path + 'public'),
                  connect.bodyDecoder(),
                  connect.methodOverride(),
                  connect.conditionalGet(),
                  connect.router(routes)
              );

          logger.info("starting on http://" + env.server.host + ":" + env.server.port);
          server.listen(env.server.port, env.server.host);
      }
    );
}


text:
var events = require('events');
var Path = require('./Path.js');
var Event = require('./Event.js');

function WatcherManager() {
    this.dataWatchers = {};
    this.childWatchers = {};
    this.existenceWatchers = {};
}

function registerWatcher(self, type, path, watcher) {
    var watchers = self[type + 'Watchers'];

    Path.validate(path);

    if (typeof watcher !== 'function') {
        throw new Error('watcher must be a valid function.');
    }

    watchers[path] = watchers[path] || new events.EventEmitter();

    if (watchers[path].listeners('notification').indexOf(watcher) === -1) {
        watchers[path].once('notification', watcher);
    }
}

function getWatcherPaths(self, type) {
    var watchers = self[type + 'Watchers'],
        result = [];

    Object.keys(watchers).forEach(function (path) {
        if (watchers[path].listeners('notification').length > 0) {
            result.push(path);
        }
    });

    return result;
}

WatcherManager.prototype.registerDataWatcher = function (path, watcher) {
    registerWatcher(this, 'data', path, watcher);
};

WatcherManager.prototype.getDataWatcherPaths = function () {
    return getWatcherPaths(this, 'data');
};

WatcherManager.prototype.registerChildWatcher = function (path, watcher) {
    registerWatcher(this, 'child', path, watcher);
};

WatcherManager.prototype.getChildWatcherPaths = function () {
    return getWatcherPaths(this, 'child');
};

WatcherManager.prototype.registerExistenceWatcher = function (path, watcher) {
    registerWatcher(this, 'existence', path, watcher);
};

WatcherManager.prototype.getExistenceWatcherPaths = function () {
    return getWatcherPaths(this, 'existence');
};

WatcherManager.prototype.emit = function (watcherEvent) {
    if (!watcherEvent) {
        throw new Error('watcherEvent must be a valid object.');
    }

    var emitters = [],
        event;

    switch (watcherEvent.type) {
    case Event.NODE_DATA_CHANGED:
    case Event.NODE_CREATED:
        if (this.dataWatchers[watcherEvent.path]) {
            emitters.push(this.dataWatchers[watcherEvent.path]);
        }

        if (this.existenceWatchers[watcherEvent.path]) {
            emitters.push(this.existenceWatchers[watcherEvent.path]);
        }
        break;
    case Event.NODE_CHILDREN_CHANGED:
        if (this.childWatchers[watcherEvent.path]) {
            emitters.push(this.childWatchers[watcherEvent.path]);
        }
        break;
    case Event.NODE_DELETED:
        if (this.dataWatchers[watcherEvent.path]) {
            emitters.push(this.dataWatchers[watcherEvent.path]);
        }
        if (this.childWatchers[watcherEvent.path]) {
            emitters.push(this.childWatchers[watcherEvent.path]);
        }
        break;
    default:
        throw new Error('Unknown event type: ' + watcherEvent.type);
    }

    if (emitters.length < 1) {
        return;
    }

    event = Event.create(watcherEvent);

    emitters.forEach(function (emitter) {
        emitter.emit('notification', event);
    });
};

WatcherManager.prototype.isEmpty = function () {
    var empty = true,
        watchers,
        paths,
        i,
        j;

    watchers = [this.dataWatchers, this.existenceWatchers, this.childWatchers];

    for (i = 0; i < watchers.length; i += 1) {
        paths = Object.keys(watchers[i]);

        for (j = 0; j < paths.length; j += 1) {
            if (watchers[i][paths[j]].listeners('notification').length > 0) {
                empty = false;
                break;
            }
        }
    }

    return empty;
};

module.exports = WatcherManager;


text:
package org.msgpack.unpacker;

import org.msgpack.MessageTypeException;

final class IntAccept extends Accept {
    int value;

    IntAccept() {
        super("integer");
    }

    @Override
    void acceptInteger(byte v) {
        this.value = (int) v;
    }

    @Override
    void acceptInteger(short v) {
        this.value = (int) v;
    }

    @Override
    void acceptInteger(int v) {
        this.value = v;
    }

    @Override
    void acceptInteger(long v) {
        if (v < (long) Integer.MIN_VALUE || v > (long) Integer.MAX_VALUE) {
            throw new MessageTypeException(); // TODO message
        }
        this.value = (int) v;
    }

    @Override
    void acceptUnsignedInteger(byte v) {
        this.value = v & 0xff;
    }

    @Override
    void acceptUnsignedInteger(short v) {
        this.value = v & 0xffff;
    }

    @Override
    void acceptUnsignedInteger(int v) {
        if (v < 0) {
            throw new MessageTypeException(); // TODO message
        }
        this.value = v;
    }

    @Override
    void acceptUnsignedInteger(long v) {
        if (v < 0 || v > (long) Integer.MAX_VALUE) {
            throw new MessageTypeException(); // TODO message
        }
        this.value = (int) v;
    }
}


text:
<?php
declare(strict_types = 1);

namespace Tests\Innmind\Crawler\Parser\Http;

use Innmind\Crawler\{
    Parser,
    Parser\Http\CharsetParser,
    HttpResource\Attribute,
};
use Innmind\Http\{
    Message\Request,
    Message\Response,
    Headers,
    Header,
    Header\ContentType,
    Header\Parameter,
};
use Innmind\Immutable\Map;
use PHPUnit\Framework\TestCase;

class CharsetParserTest extends TestCase
{
    public function testInterface()
    {
        $this->assertInstanceOf(
            Parser::class,
            new CharsetParser
        );
    }

    public function testKey()
    {
        $this->assertSame('charset', CharsetParser::key());
    }

    public function testDoesntParseWhenNoContentType()
    {
        $parse = new CharsetParser;
        $request = $this->createMock(Request::class);
        $response = $this->createMock(Response::class);
        $response
            ->expects($this->once())
            ->method('headers')
            ->willReturn(Headers::of());
        $expected = Map::of('string', Attribute::class);

        $attributes = $parse($request, $response, $expected);

        $this->assertSame($expected, $attributes);
    }

    public function testDoesntParseWhenContentTypeNotFullyParsed()
    {
        $parse = new CharsetParser;
        $request = $this->createMock(Request::class);
        $response = $this->createMock(Response::class);
        $response
            ->expects($this->exactly(2))
            ->method('headers')
            ->willReturn(
                Headers::of(
                    new Header\Header('Content-Type'),
                )
            );
        $expected = Map::of('string', Attribute::class);

        $attributes = $parse($request, $response, $expected);

        $this->assertSame($expected, $attributes);
    }

    public function testDoesntParseWhenNoCharset()
    {
        $parse = new CharsetParser;
        $request = $this->createMock(Request::class);
        $response = $this->createMock(Response::class);
        $response
            ->expects($this->exactly(2))
            ->method('headers')
            ->willReturn(
                Headers::of(
                    ContentType::of('foo', 'bar')
                )
            );
        $expected = Map::of('string', Attribute::class);

        $attributes = $parse($request, $response, $expected);

        $this->assertSame($expected, $attributes);
    }

    public function testParse()
    {
        $parse = new CharsetParser;
        $request = $this->createMock(Request::class);
        $response = $this->createMock(Response::class);
        $response
            ->expects($this->exactly(2))
            ->method('headers')
            ->willReturn(
                Headers::of(
                    ContentType::of(
                        'foo',
                        'bar',
                        new Parameter\Parameter('charset', 'utf-8')
                    )
                )
            );
        $expected = Map::of('string', Attribute::class);

        $attributes = $parse($request, $response, $expected);

        $this->assertNotSame($expected, $attributes);
        $this->assertCount(1, $attributes);
        $this->assertTrue($attributes->contains('charset'));
        $this->assertSame('charset', $attributes->get('charset')->name());
        $this->assertSame('utf-8', $attributes->get('charset')->content());
    }
}


text:
Migration Guides
================

## Migrating to Version 2

### Path

Previously it was not possible to specify a dot path where a key itself contains a dot. In v2 it is now possible with the escape sequence `~1`. For example, given the JSON doc `{"foo":{"bar.baz":10}}`, the path `foo.bar~1baz` would return `10`. This escape sequence means the character `~` is also a special case, therefore it must also be escaped to the sequence `~0`.

### Consume

Calls to `Consume(root interface{}) (*Container, error)` should be replaced with `Wrap(root interface{}) *Container`.

The error response was removed in order to avoid unnecessary duplicate type checks on `root`. This also allows shorthand chained queries like `gabs.Wrap(foo).S("bar","baz").Data()`.

### Search Across Arrays

All query functions (`Search`, `Path`, `Set`, `SetP`, etc) now attempt to resolve a specific index when they encounter an array. This means path queries must specify an integer index at the level of arrays within the content.

For example, given the sample document:

``` json
{
  "foo": [
    {
      "bar": {
        "baz": 45
      }
    }
  ]
}
```

In v1 the query `Search("foo", "bar", "baz")` would propagate the array in the result giving us `[45]`. In v2 we can access the field directly with `Search("foo", "0", "bar", "baz")`. The index is _required_, otherwise the query fails.

In query functions that do not set a value it is possible to specify `*` instead of an index in order to obtain all elements of the array, this produces the equivalent result as the behaviour from v1. For example, in v2 the query `Search("foo", "*", "bar", "baz")` would return `[45]`.

### Children and ChildrenMap

The `Children` and `ChildrenMap` methods no longer return errors. Instead, in the event of the underlying value being invalid (not an array or object), a `nil` slice and empty map are returned respectively. If explicit type checking is required the recommended approach would be casting on the value, e.g. `foo, ok := obj.Data().([]interface)`.

### Serialising Invalid Types

In v1 attempting to serialise with `Bytes`, `String`, etc, with an invalid structure would result in an empty object `{}`. This behaviour was unintuitive and in v2 `null` will be returned instead. If explicit marshalling is required with proper error propagation it is still recommended to use the `json` package directly on the underlying value.


text:
package org.pentaho.di.trans.steps.fuzzymatch;

import java.util.List;

import org.pentaho.di.core.CheckResult;
import org.pentaho.di.core.CheckResultInterface;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.core.exception.KettleXMLException;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.core.row.value.ValueMetaInteger;
import org.pentaho.di.core.row.value.ValueMetaNumber;
import org.pentaho.di.core.row.value.ValueMetaString;
import org.pentaho.di.core.variables.VariableSpace;
import org.pentaho.di.core.xml.XMLHandler;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.repository.ObjectId;
import org.pentaho.di.repository.Repository;
import org.pentaho.di.shared.SharedObjectInterface;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStepMeta;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepIOMeta;
import org.pentaho.di.trans.step.StepIOMetaInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
import org.pentaho.di.trans.step.errorhandling.Stream;
import org.pentaho.di.trans.step.errorhandling.StreamIcon;
import org.pentaho.di.trans.step.errorhandling.StreamInterface;
import org.pentaho.di.trans.step.errorhandling.StreamInterface.StreamType;
import org.pentaho.metastore.api.IMetaStore;
import org.w3c.dom.Node;

public class FuzzyMatchMeta extends BaseStepMeta implements StepMetaInterface {
  private static Class<?> PKG = FuzzyMatchMeta.class; // for i18n purposes, needed by Translator2!!

  public static final String DEFAULT_SEPARATOR = ",";
  /** Algorithms type */
  private int algorithm;

  /**
   * The algorithms description
   */
  public static final String[] algorithmDesc = {
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.Levenshtein" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.DamerauLevenshtein" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.NeedlemanWunsch" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.Jaro" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.JaroWinkler" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.PairSimilarity" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.Metaphone" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.DoubleMetaphone" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.SoundEx" ),
    BaseMessages.getString( PKG, "FuzzyMatchMeta.algorithm.RefinedSoundEx" ) };

  /**
   * The algorithms type codes
   */
  public static final String[] algorithmCode = {
    "levenshtein", "dameraulevenshtein", "needlemanwunsch", "jaro", "jarowinkler", "pairsimilarity",
    "metaphone", "doublemataphone", "soundex", "refinedsoundex" };

  public static final int OPERATION_TYPE_LEVENSHTEIN = 0;

  public static final int OPERATION_TYPE_DAMERAU_LEVENSHTEIN = 1;

  public static final int OPERATION_TYPE_NEEDLEMAN_WUNSH = 2;

  public static final int OPERATION_TYPE_JARO = 3;

  public static final int OPERATION_TYPE_JARO_WINKLER = 4;

  public static final int OPERATION_TYPE_PAIR_SIMILARITY = 5;

  public static final int OPERATION_TYPE_METAPHONE = 6;

  public static final int OPERATION_TYPE_DOUBLE_METAPHONE = 7;

  public static final int OPERATION_TYPE_SOUNDEX = 8;

  public static final int OPERATION_TYPE_REFINED_SOUNDEX = 9;

  /** field in lookup stream with which we look up values */
  private String lookupfield;

  /** field in input stream for which we lookup values */
  private String mainstreamfield;

  /** output match fieldname **/
  private String outputmatchfield;

  /** ouput value fieldname **/
  private String outputvaluefield;

  /** case sensitive **/
  private boolean caseSensitive;

  /** minimal value, distance for levenshtein, similarity, ... **/
  private String minimalValue;

  /** maximal value, distance for levenshtein, similarity, ... **/
  private String maximalValue;

  /** values separator ... **/
  private String separator;

  /** get closer matching value **/
  private boolean closervalue;

  /** return these field values from lookup */
  private String[] value;

  /** rename to this after lookup */
  private String[] valueName;

  public FuzzyMatchMeta() {
    super(); // allocate BaseStepMeta
  }

  /**
   * @return Returns the value.
   */
  public String[] getValue() {
    return value;
  }

  /**
   * @param value
   *          The value to set.
   */
  public void setValue( String[] value ) {
    this.value = value;
  }

  public void allocate( int nrvalues ) {
    value = new String[nrvalues];
    valueName = new String[nrvalues];
  }

  public Object clone() {
    FuzzyMatchMeta retval = (FuzzyMatchMeta) super.clone();

    int nrvalues = value.length;

    retval.allocate( nrvalues );

    System.arraycopy( value, 0, retval.value, 0, nrvalues );
    System.arraycopy( valueName, 0, retval.valueName, 0, nrvalues );

    return retval;
  }

  /**
   * @return Returns the mainstreamfield.
   */
  public String getMainStreamField() {
    return mainstreamfield;
  }

  /**
   * @param mainstreamfield
   *          The mainstreamfield to set.
   */
  public void setMainStreamField( String mainstreamfield ) {
    this.mainstreamfield = mainstreamfield;
  }

  /**
   * @return Returns the lookupfield.
   */
  public String getLookupField() {
    return lookupfield;
  }

  /**
   * @param lookupfield
   *          The lookupfield to set.
   */
  public void setLookupField( String lookupfield ) {
    this.lookupfield = lookupfield;
  }

  /**
   * @return Returns the outputmatchfield.
   */
  public String getOutputMatchField() {
    return outputmatchfield;
  }

  /**
   * @param outputmatchfield
   *          The outputmatchfield to set.
   */
  public void setOutputMatchField( String outputmatchfield ) {
    this.outputmatchfield = outputmatchfield;
  }

  /**
   * @return Returns the outputmatchfield.
   */
  public String getOutputValueField() {
    return outputvaluefield;
  }

  /**
   * @param outputvaluefield
   *          The outputvaluefield to set.
   */
  public void setOutputValueField( String outputvaluefield ) {
    this.outputvaluefield = outputvaluefield;
  }

  /**
   * @return Returns the closervalue.
   */
  public boolean isGetCloserValue() {
    return closervalue;
  }

  /**
   * @return Returns the valueName.
   */
  public String[] getValueName() {
    return valueName;
  }

  /**
   * @param valueName
   *          The valueName to set.
   */
  public void setValueName( String[] valueName ) {
    this.valueName = valueName;
  }

  /**
   * @param closervalue
   *          The closervalue to set.
   */
  public void setGetCloserValue( boolean closervalue ) {
    this.closervalue = closervalue;
  }

  /**
   * @return Returns the caseSensitive.
   */
  public boolean isCaseSensitive() {
    return caseSensitive;
  }

  /**
   * @param caseSensitive
   *          The caseSensitive to set.
   */
  public void setCaseSensitive( boolean caseSensitive ) {
    this.caseSensitive = caseSensitive;
  }

  /**
   * @return Returns the minimalValue.
   */
  public String getMinimalValue() {
    return minimalValue;
  }

  /**
   * @param minimalValue
   *          The minimalValue to set.
   */
  public void setMinimalValue( String minimalValue ) {
    this.minimalValue = minimalValue;
  }

  /**
   * @return Returns the minimalValue.
   */
  public String getMaximalValue() {
    return maximalValue;
  }

  /**
   * @param maximalValue
   *          The maximalValue to set.
   */
  public void setMaximalValue( String maximalValue ) {
    this.maximalValue = maximalValue;
  }

  /**
   * @return Returns the separator.
   */
  public String getSeparator() {
    return separator;
  }

  /**
   * @param separator
   *          The separator to set.
   */
  public void setSeparator( String separator ) {
    this.separator = separator;
  }

  public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException {
    readData( stepnode, databases );
  }

  public int getAlgorithmType() {
    return algorithm;
  }

  public void setAlgorithmType( int algorithm ) {
    this.algorithm = algorithm;
  }

  public static String getAlgorithmTypeDesc( int i ) {
    if ( i < 0 || i >= algorithmDesc.length ) {
      return algorithmDesc[0];
    }
    return algorithmDesc[i];
  }

  public static int getAlgorithmTypeByDesc( String tt ) {
    if ( tt == null ) {
      return 0;
    }

    for ( int i = 0; i < algorithmDesc.length; i++ ) {
      if ( algorithmDesc[i].equalsIgnoreCase( tt ) ) {
        return i;
      }
    }
    // If this fails, try to match using the code.
    return getAlgorithmTypeByCode( tt );
  }

  private static int getAlgorithmTypeByCode( String tt ) {
    if ( tt == null ) {
      return 0;
    }

    for ( int i = 0; i < algorithmCode.length; i++ ) {
      if ( algorithmCode[i].equalsIgnoreCase( tt ) ) {
        return i;
      }
    }
    return 0;
  }

  private void readData( Node stepnode, List<? extends SharedObjectInterface> databases ) throws KettleXMLException {
    try {

      String lookupFromStepname = XMLHandler.getTagValue( stepnode, "from" );
      StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
      infoStream.setSubject( lookupFromStepname );

      lookupfield = XMLHandler.getTagValue( stepnode, "lookupfield" );
      mainstreamfield = XMLHandler.getTagValue( stepnode, "mainstreamfield" );

      caseSensitive = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "caseSensitive" ) );
      closervalue = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "closervalue" ) );
      minimalValue = XMLHandler.getTagValue( stepnode, "minimalValue" );
      maximalValue = XMLHandler.getTagValue( stepnode, "maximalValue" );
      separator = XMLHandler.getTagValue( stepnode, "separator" );

      outputmatchfield = XMLHandler.getTagValue( stepnode, "outputmatchfield" );
      outputvaluefield = XMLHandler.getTagValue( stepnode, "outputvaluefield" );

      algorithm = getAlgorithmTypeByCode( Const.NVL( XMLHandler.getTagValue( stepnode, "algorithm" ), "" ) );

      Node lookup = XMLHandler.getSubNode( stepnode, "lookup" );
      int nrvalues = XMLHandler.countNodes( lookup, "value" );

      allocate( nrvalues );

      for ( int i = 0; i < nrvalues; i++ ) {
        Node vnode = XMLHandler.getSubNodeByNr( lookup, "value", i );

        value[i] = XMLHandler.getTagValue( vnode, "name" );
        valueName[i] = XMLHandler.getTagValue( vnode, "rename" );
        if ( valueName[i] == null ) {
          valueName[i] = value[i]; // default: same name to return!
        }
      }

    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString(
        PKG, "FuzzyMatchMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
    }
  }

  private static String getAlgorithmTypeCode( int i ) {
    if ( i < 0 || i >= algorithmCode.length ) {
      return algorithmCode[0];
    }
    return algorithmCode[i];
  }

  public void setDefault() {
    value = null;
    valueName = null;
    separator = DEFAULT_SEPARATOR;
    closervalue = true;
    minimalValue = "0";
    maximalValue = "1";
    caseSensitive = false;
    lookupfield = null;
    mainstreamfield = null;
    outputmatchfield = BaseMessages.getString( PKG, "FuzzyMatchMeta.OutputMatchFieldname" );
    outputvaluefield = BaseMessages.getString( PKG, "FuzzyMatchMeta.OutputValueFieldname" );

    int nrvalues = 0;

    allocate( nrvalues );

    for ( int i = 0; i < nrvalues; i++ ) {
      value[i] = "value" + i;
      valueName[i] = "valuename" + i;
    }

  }

  public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
    // Add match field
    ValueMetaInterface v =
      new ValueMetaString( space.environmentSubstitute( getOutputMatchField() ) );
    v.setOrigin( name );
    v.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );
    inputRowMeta.addValueMeta( v );

    String mainField = space.environmentSubstitute( getOutputValueField() );
    if ( !Const.isEmpty( mainField ) && isGetCloserValue() ) {
      switch ( getAlgorithmType() ) {
        case FuzzyMatchMeta.OPERATION_TYPE_DAMERAU_LEVENSHTEIN:
        case FuzzyMatchMeta.OPERATION_TYPE_LEVENSHTEIN:
          v = new ValueMetaInteger( mainField );
          v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH );
          break;
        case FuzzyMatchMeta.OPERATION_TYPE_JARO:
        case FuzzyMatchMeta.OPERATION_TYPE_JARO_WINKLER:
        case FuzzyMatchMeta.OPERATION_TYPE_PAIR_SIMILARITY:
          v = new ValueMetaNumber( mainField );
          break;
        default:
          // Phonetic algorithms
          v = new ValueMetaString( mainField );
          break;
      }
      v.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );
      v.setOrigin( name );
      inputRowMeta.addValueMeta( v );
    }

    boolean activateAdditionalFields =
      isGetCloserValue()
        || ( getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_DOUBLE_METAPHONE )
        || ( getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_SOUNDEX )
        || ( getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_REFINED_SOUNDEX )
        || ( getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_METAPHONE );

    if ( activateAdditionalFields ) {
      if ( info != null && info.length == 1 && info[0] != null ) {
        for ( int i = 0; i < valueName.length; i++ ) {
          v = info[0].searchValueMeta( value[i] );
          if ( v != null ) {
            // Configuration error/missing resources...

            v.setName( valueName[i] );
            v.setOrigin( name );
            v.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); // Only normal storage goes into the cache
            inputRowMeta.addValueMeta( v );
          } else {
            throw new KettleStepException( BaseMessages.getString(
              PKG, "FuzzyMatchMeta.Exception.ReturnValueCanNotBeFound", value[i] ) );
          }
        }
      } else {
        for ( int i = 0; i < valueName.length; i++ ) {
          v = new ValueMetaString( valueName[i] );
          v.setOrigin( name );
          inputRowMeta.addValueMeta( v );
        }
      }
    }
  }

  public String getXML() {
    StringBuilder retval = new StringBuilder();

    StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
    retval.append( "    " + XMLHandler.addTagValue( "from", infoStream.getStepname() ) );
    retval.append( "    " + XMLHandler.addTagValue( "lookupfield", lookupfield ) );
    retval.append( "    " + XMLHandler.addTagValue( "mainstreamfield", mainstreamfield ) );
    retval.append( "    " + XMLHandler.addTagValue( "outputmatchfield", outputmatchfield ) );
    retval.append( "    " + XMLHandler.addTagValue( "outputvaluefield", outputvaluefield ) );

    retval.append( "    " + XMLHandler.addTagValue( "caseSensitive", caseSensitive ) );
    retval.append( "    " + XMLHandler.addTagValue( "closervalue", closervalue ) );
    retval.append( "    " + XMLHandler.addTagValue( "minimalValue", minimalValue ) );
    retval.append( "    " + XMLHandler.addTagValue( "maximalValue", maximalValue ) );
    retval.append( "    " + XMLHandler.addTagValue( "separator", separator ) );

    retval.append( "    " ).append( XMLHandler.addTagValue( "algorithm", getAlgorithmTypeCode( algorithm ) ) );

    retval.append( "    <lookup>" + Const.CR );
    for ( int i = 0; i < value.length; i++ ) {
      retval.append( "      <value>" + Const.CR );
      retval.append( "        " + XMLHandler.addTagValue( "name", value[i] ) );
      retval.append( "        " + XMLHandler.addTagValue( "rename", valueName[i] ) );
      retval.append( "      </value>" + Const.CR );
    }
    retval.append( "    </lookup>" + Const.CR );

    return retval.toString();
  }

  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
    try {
      String lookupFromStepname = rep.getStepAttributeString( id_step, "lookup_from_step" );
      StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
      infoStream.setSubject( lookupFromStepname );
      lookupfield = rep.getStepAttributeString( id_step, "lookupfield" );
      mainstreamfield = rep.getStepAttributeString( id_step, "mainstreamfield" );
      outputmatchfield = rep.getStepAttributeString( id_step, "outputmatchfield" );
      outputvaluefield = rep.getStepAttributeString( id_step, "outputvaluefield" );

      caseSensitive = rep.getStepAttributeBoolean( id_step, "caseSensitive" );
      closervalue = rep.getStepAttributeBoolean( id_step, "closervalue" );
      minimalValue = rep.getStepAttributeString( id_step, "minimalValue" );
      maximalValue = rep.getStepAttributeString( id_step, "maximalValue" );
      separator = rep.getStepAttributeString( id_step, "separator" );

      algorithm = getAlgorithmTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "algorithm" ), "" ) );

      int nrvalues = rep.countNrStepAttributes( id_step, "return_value_name" );
      allocate( nrvalues );

      for ( int i = 0; i < nrvalues; i++ ) {
        value[i] = rep.getStepAttributeString( id_step, i, "return_value_name" );
        valueName[i] = rep.getStepAttributeString( id_step, i, "return_value_rename" );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "FuzzyMatchMeta.Exception.UnexpecteErrorReadingStepInfoFromRepository" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
    try {
      StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
      rep.saveStepAttribute( id_transformation, id_step, "lookup_from_step", infoStream.getStepname() );
      rep.saveStepAttribute( id_transformation, id_step, "lookupfield", lookupfield );
      rep.saveStepAttribute( id_transformation, id_step, "mainstreamfield", mainstreamfield );
      rep.saveStepAttribute( id_transformation, id_step, "outputmatchfield", outputmatchfield );
      rep.saveStepAttribute( id_transformation, id_step, "outputvaluefield", outputvaluefield );

      rep.saveStepAttribute( id_transformation, id_step, "caseSensitive", caseSensitive );
      rep.saveStepAttribute( id_transformation, id_step, "closervalue", closervalue );
      rep.saveStepAttribute( id_transformation, id_step, "minimalValue", minimalValue );
      rep.saveStepAttribute( id_transformation, id_step, "maximalValue", maximalValue );
      rep.saveStepAttribute( id_transformation, id_step, "separator", separator );
      rep.saveStepAttribute( id_transformation, id_step, "algorithm", getAlgorithmTypeCode( algorithm ) );

      for ( int i = 0; i < value.length; i++ ) {
        rep.saveStepAttribute( id_transformation, id_step, i, "return_value_name", value[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, "return_value_rename", valueName[i] );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "FuzzyMatchMeta.Exception.UnableToSaveStepInfoToRepository" )
        + id_step, e );
    }
  }

  public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ) {
    CheckResult cr;

    if ( prev != null && prev.size() > 0 ) {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.StepReceivingFields", prev.size() + "" ), stepMeta );
      remarks.add( cr );

      // Starting from selected fields in ...
      // Check the fields from the previous stream!
      String mainField = transMeta.environmentSubstitute( getMainStreamField() );
      int idx = prev.indexOfValue( mainField );
      if ( idx < 0 ) {
        cr =
          new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
            PKG, "FuzzyMatchMeta.CheckResult.MainFieldNotFound", mainField ), stepMeta );
      } else {
        cr =
          new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
            PKG, "FuzzyMatchMeta.CheckResult.MainFieldFound", mainField ), stepMeta );
      }
      remarks.add( cr );

    } else {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.CouldNotFindFieldsFromPreviousSteps" ), stepMeta );
      remarks.add( cr );
    }

    if ( info != null && info.size() > 0 ) {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.StepReceivingLookupData", info.size() + "" ), stepMeta );
      remarks.add( cr );

      // Check the fields from the lookup stream!
      String lookupField = transMeta.environmentSubstitute( getLookupField() );

      int idx = info.indexOfValue( lookupField );
      if ( idx < 0 ) {
        cr =
          new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
            PKG, "FuzzyMatchMeta.CheckResult.FieldNotFoundInLookupStream", lookupField ), stepMeta );
      } else {
        cr =
          new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
            PKG, "FuzzyMatchMeta.CheckResult.FieldFoundInTheLookupStream", lookupField ), stepMeta );
      }
      remarks.add( cr );

      String error_message = "";
      boolean error_found = false;

      // Check the values to retrieve from the lookup stream!
      for ( int i = 0; i < value.length; i++ ) {
        idx = info.indexOfValue( value[i] );
        if ( idx < 0 ) {
          error_message += "\t\t" + value[i] + Const.CR;
          error_found = true;
        }
      }
      if ( error_found ) {
        error_message =
          BaseMessages.getString( PKG, "FuzzyMatchMeta.CheckResult.FieldsNotFoundInLookupStream2" )
            + Const.CR + Const.CR + error_message;
        cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
      } else {
        cr =
          new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
            PKG, "FuzzyMatchMeta.CheckResult.AllFieldsFoundInTheLookupStream2" ), stepMeta );
      }
      remarks.add( cr );
    } else {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.FieldsNotFoundFromInLookupSep" ), stepMeta );
      remarks.add( cr );
    }

    // See if the source step is filled in!
    StreamInterface infoStream = getStepIOMeta().getInfoStreams().get( 0 );
    if ( infoStream.getStepMeta() == null ) {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.SourceStepNotSelected" ), stepMeta );
      remarks.add( cr );
    } else {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.SourceStepIsSelected" ), stepMeta );
      remarks.add( cr );

      // See if the step exists!
      //
      if ( info != null ) {
        cr =
          new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
            PKG, "FuzzyMatchMeta.CheckResult.SourceStepExist", infoStream.getStepname() + "" ), stepMeta );
        remarks.add( cr );
      } else {
        cr =
          new CheckResult(
            CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
              PKG, "FuzzyMatchMeta.CheckResult.SourceStepDoesNotExist", infoStream.getStepname() + "" ),
            stepMeta );
        remarks.add( cr );
      }
    }

    // See if we have input streams leading to this step!
    if ( input.length >= 2 ) {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.StepReceivingInfoFromInputSteps", input.length + "" ), stepMeta );
      remarks.add( cr );
    } else {
      cr =
        new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "FuzzyMatchMeta.CheckResult.NeedAtLeast2InputStreams", Const.CR, Const.CR ), stepMeta );
      remarks.add( cr );
    }
  }

  @Override
  public void searchInfoAndTargetSteps( List<StepMeta> steps ) {
    for ( StreamInterface stream : getStepIOMeta().getInfoStreams() ) {
      stream.setStepMeta( StepMeta.findStep( steps, (String) stream.getSubject() ) );
    }
  }

  public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
    TransMeta transMeta, Trans trans ) {
    return new FuzzyMatch( stepMeta, stepDataInterface, cnr, transMeta, trans );
  }

  public StepDataInterface getStepData() {
    return new FuzzyMatchData();
  }

  public boolean excludeFromRowLayoutVerification() {
    return true;
  }

  public boolean supportsErrorHandling() {
    return true;
  }

  /**
   * Returns the Input/Output metadata for this step. The generator step only produces output, does not accept input!
   */
  public StepIOMetaInterface getStepIOMeta() {
    if ( ioMeta == null ) {

      ioMeta = new StepIOMeta( true, true, false, false, false, false );

      StreamInterface stream =
        new Stream(
          StreamType.INFO, null, BaseMessages.getString( PKG, "FuzzyMatchMeta.InfoStream.Description" ),
          StreamIcon.INFO, null );
      ioMeta.addStream( stream );
    }

    return ioMeta;
  }

  public void resetStepIoMeta() {
    // Do nothing, don't reset as there is no need to do this.
  }
}