text:
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

package net.sourceforge.ganttproject.io;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringReader;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Locale;

import javax.swing.tree.DefaultMutableTreeNode;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import net.sourceforge.ganttproject.GanttExportSettings;
import net.sourceforge.ganttproject.GanttGraphicArea;
import net.sourceforge.ganttproject.GanttProject;
import net.sourceforge.ganttproject.GanttTree;
import net.sourceforge.ganttproject.IGanttProject;
import net.sourceforge.ganttproject.PrjInfos;
import net.sourceforge.ganttproject.ResourceLoadGraphicArea;
import net.sourceforge.ganttproject.export.FontRecord;
import net.sourceforge.ganttproject.export.FontTriplet;
import net.sourceforge.ganttproject.export.JDKFontLocator;
import net.sourceforge.ganttproject.language.GanttLanguage;
import net.sourceforge.ganttproject.resource.HumanResource;
import net.sourceforge.ganttproject.resource.HumanResourceManager;
import net.sourceforge.ganttproject.task.ResourceAssignment;
import net.sourceforge.ganttproject.task.Task;

import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.Options;
import org.apache.fop.image.FopImageFactory;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;

public class GanttPDFExport {

	private static GanttLanguage language = GanttLanguage.getInstance();
    private static SAXTransformerFactory ourTransformerFactory;

    private static String getHexaColor(java.awt.Color color) {
		StringBuffer out = new StringBuffer();
	    out.append("#");
        if (color.getRed() <= 15) {
          out.append("0");
        }
        out.append(Integer.toHexString(color.getRed()));
        if (color.getGreen() <= 15) {
          out.append("0");
        }
        out.append(Integer.toHexString(color.getGreen()));
        if (color.getBlue() <= 15) {
          out.append("0");
        }
        out.append(Integer.toHexString(color.getBlue()));

		return out.toString();
	}

	/** Write the tasks */
	private static String writeTasks(GanttTree tree) {
		StringBuffer out = new StringBuffer();
		ArrayList lot=tree.getAllTasks();
		for(int i=0, k=lot.size(); i < k; i++) {
			Task t = (Task) ((DefaultMutableTreeNode)lot.get(i)).getUserObject();
			if(t!=t.getManager().getRootTask()) {
				out.append("\t\t<ganttproject:task>\n");
				out.append("\t\t\t<name>" + correct(t.toString())  + "</name>\n");
				out.append("\t\t\t<begin>" + t.getStart()  + "</begin>\n");
				out.append("\t\t\t<end>" + t.getEnd()  + "</end>\n");
				out.append("\t\t\t<milestone>" + (t.isMilestone() ? "true" : "false")  + "</milestone>\n");
				out.append("\t\t\t<progress>" + t.getCompletionPercentage()  + "</progress>\n");
				// list all assigned users
                StringBuffer usersS = new StringBuffer();
                ResourceAssignment[] assignments = t.getAssignments();
				if (assignments.length>0) {
                    for(int j=0;j<assignments.length;j++) {
                        usersS.append(assignments[j].getResource().getName() + "\n");
                    }
                }
                else {
                    usersS.append(" ");
                }
				out.append("\t\t\t<assigned-to>" + usersS.toString()  + "</assigned-to>\n");
				out.append("\t\t\t<notes><![CDATA[" + ((t.getNotes() == null || t.getNotes().length() == 0) ? " " : t.getNotes())  + "]]></notes>\n");
				out.append("\t\t\t<color>"+getHexaColor(t.getColor())+"</color>\n");
				out.append("\t\t</ganttproject:task>\n");
			}
		}
		return out.toString();
	}

	/** Write the resources */
	private static String writeResources(HumanResourceManager resMan)
	{
		StringBuffer out = new StringBuffer();

        ArrayList lor=resMan.getResources();

//		String []function=RoleManager.Access.getInstance().getRoleNames();
		for(int i=0, j=lor.size(); i < j; i++) {
			HumanResource p = (HumanResource)lor.get(i);
			out.append("\t\t<ganttproject:resource>\n");
			out.append("\t\t\t<name>" + correct(p.toString()) + "</name>\n");
			out.append("\t\t\t<role>" + correct(p.getRole().getName()) + "</role>\n");
			out.append("\t\t\t<mail>" + (p.getMail()==null || p.getMail().length() == 0 ? " " : correct(p.getMail())) + "</mail>\n");
			out.append("\t\t\t<phone>" + (p.getPhone()==null || p.getPhone().length() == 0 ? " " : correct(p.getPhone())) + "</phone>\n");
			out.append("\t\t</ganttproject:resource>\n");
		}
		return out.toString();
	}

	/**Save the project in HTML
	 * @throws TransformerException
	 * @throws IOException*/
	public static void save(File pdffile,
			IGanttProject ganttProject,
		HumanResourceManager resourceManager, GanttTree tree, GanttGraphicArea area, ResourceLoadGraphicArea rarea,
		GanttExportSettings bool, String xslfo)	throws IOException, TransformerException {

			String path=new File(xslfo).getParent();

			DateFormat df =java.text.DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM,Locale.getDefault() );

			//write the image of the calendar
			//area.fitWholeProject(true);
			area.export(new File(System.getProperty("java.io.tmpdir")+"/"+"ganttchart.jpg"), bool,"jpg");
			//rarea.fitWholeProject(true);
			rarea.export(new File(System.getProperty("java.io.tmpdir")+"/"+"resourceschart.jpg"), "jpg", bool);

			//create XML for xslt
			StringBuffer ganttXML = new StringBuffer();
			ganttXML.append("<?xml version=\"1.0\" encoding=\"utf-8\"?> \n");
			ganttXML.append("<xsl:stylesheet\n\txmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n\txmlns:ganttproject=\"http://ganttproject.sf.net/\"\n\tversion=\"1.0\">\n\n");
			ganttXML.append("<ganttproject:report xslfo-path=\""+path+"\">\n\n");

			//Project Informations
			ganttXML.append("\t<ganttproject:project xslfo-path=\""+path+"\"\n");
			ganttXML.append("\t\ttitle=\""+language.getText("ganttReport")+"\"\n");
		    ganttXML.append("\t\tname=\""+GanttProject.correctLabel(language.getText("project"))+"\"\n");
			ganttXML.append("\t\tnameValue=\""+ ((ganttProject.getProjectName().length()==0)?" ":correct(ganttProject.getProjectName())) +"\"\n");
			ganttXML.append("\t\torganisation=\""+GanttProject.correctLabel(language.getText("organization"))+"\"\n");
			ganttXML.append("\t\torganisationValue=\""+ ((ganttProject.getOrganization().length()==0)?" ":correct(ganttProject.getOrganization())) +"\"\n");
			ganttXML.append("\t\twebLink=\""+GanttProject.correctLabel(language.getText("webLink"))+"\"\n");
			ganttXML.append("\t\twebLinkValue=\""+ ((ganttProject.getWebLink().length()==0)?" ":correct(ganttProject.getWebLink())) +"\"\n");
			ganttXML.append("\t\tcurrentDateTimeValue=\"" +df.format( new java.util.Date() ) +"\"\n");
			ganttXML.append("\t\tdescription=\""+GanttProject.correctLabel(language.getText("shortDescription"))+"\">\n");
			ganttXML.append("\t\t<desctiptionValue><![CDATA[\n");
			ganttXML.append("\t\t\t"+ ((ganttProject.getDescription().length()==0)?" ":correct(ganttProject.getDescription())) +"\n");
			ganttXML.append("\t\t]]></desctiptionValue>\n");
			ganttXML.append("\t</ganttproject:project>\n\n");

			//Gantt chart
			ganttXML.append("\t<ganttproject:ganttchart xslfo-path=\""+path+"\" title=\""+language.getText("ganttChart")+"\" src=\""+System.getProperty("java.io.tmpdir")+"/"+"ganttchart.jpg"+"\">\n");
			ganttXML.append("\t</ganttproject:ganttchart>\n\n");

			//Resources chart
			ganttXML.append("\t<ganttproject:resourceschart xslfo-path=\""+path+"\" title=\""+language.getText("resourcesChart")+"\" src=\""+System.getProperty("java.io.tmpdir")+"/"+"resourceschart.jpg"+"\">\n");
			ganttXML.append("\t</ganttproject:resourceschart>\n\n");

			//List of tasks
			ganttXML.append("\t<ganttproject:tasks xslfo-path=\""+path+"\" title=\""+language.getText("tasksList")+"\"\n");
			ganttXML.append("\t\tname=\""+language.getText("name")+"\"\n");
			ganttXML.append("\t\tbegin=\""+language.getText("start")+"\"\n");
			ganttXML.append("\t\tend=\""+language.getText("end")+"\"\n");
			ganttXML.append("\t\tmilestone=\""+language.getText("meetingPoint")+"\"\n");
			ganttXML.append("\t\tprogress=\"%\"\n");
			ganttXML.append("\t\tassigned-to=\"Res.\"\n");
			ganttXML.append("\t\tnotes=\""+language.getText("notes")+"\">\n\n");
			ganttXML.append(writeTasks(tree));
			ganttXML.append("\n\t</ganttproject:tasks>\n\n");

			//list of resources
			ganttXML.append("\t<ganttproject:resources xslfo-path=\""+path+"\" title=\""+language.getText("resourcesList")+"\"\n");
			ganttXML.append("\t\tname=\""+language.getText("colName")+"\"\n");
			ganttXML.append("\t\trole=\""+language.getText("colRole")+"\"\n");
			ganttXML.append("\t\tmail=\""+language.getText("colMail")+"\"\n");
			ganttXML.append("\t\tphone=\""+language.getText("colPhone")+"\">\n\n");
			ganttXML.append(writeResources(resourceManager));
			ganttXML.append("\t</ganttproject:resources>\n\n");

			ganttXML.append("</ganttproject:report>\n\n");
			ganttXML.append("</xsl:stylesheet>\n");

//	==================================================================================================================
			//Uncomment this line to write the temporary xml file on the console
			//System.out.println(ganttXML);
//	==================================================================================================================

			System.out.println("PDF Creation...");
			convert2PDF(ganttXML, pdffile, xslfo);
			System.out.println("Success!\n");

	}

		/** Correct the charcters to be compatible with xml format */
  public static String correct(String s) {
    String res;
    res = s.replaceAll("&", "&");
    res = res.replaceAll("<", "<");
    res = res.replaceAll(">", ">");
    res = res.replaceAll("/", "/");
    res = res.replaceAll("\"", """);
    return res;
  }

	public static void convert2PDF(StringBuffer ganttXML, File pdf, String xslfo)
                throws IOException, /*FOPException,*/ TransformerException {

	    System.out.println("XSL : "+xslfo);
		System.out.println("PDF : "+pdf);
        //System.out.println("text:\n"+ganttXML.toString());

	    //Construct driver
        Driver driver = new Driver();

        //Setup logger
        Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
       // driver.setLogger(logger);
        //MessageHandler.setScreenLogger(logger);

        //Setup Renderer (output format)
        driver.setRenderer(Driver.RENDER_PDF);

        //Setup output
        OutputStream out = new java.io.FileOutputStream(pdf);

        try {
            FopImageFactory.resetCache();
            Options o = createOptions();
            driver.setOutputStream(out);
            //Setup XSLT
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(new StreamSource(xslfo));

            //Setup input for XSLT transformation
            Source src = new StreamSource(new StringReader(ganttXML.toString()));

            //Resulting SAX events (the generated FO) must be piped through to FOP
            Result res = new SAXResult(driver.getContentHandler());
            //Result res = new StreamResult(new File("report.fo"));

            //Start XSLT transformation and FOP processing
            transformer.transform(src, res);
        }
        catch (FOPException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }
        catch (TransformerException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }
        finally {
            out.close();
        }
    }

    private static Options createOptions() throws FOPException {
        JDKFontLocator locator = new JDKFontLocator();
        FontRecord[] fontRecords = locator.getFontRecords();
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        StreamResult output = new StreamResult(outputStream);
        try {
            TransformerHandler handler = getTransformerFactory().newTransformerHandler();
            handler.setResult(output);
            //just for nifty debugging :)
            //handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "yes");
            createConfiguration(handler, fontRecords);
        }
        catch (TransformerConfigurationException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }
        catch (SAXException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }
        Options result = new Options(new ByteArrayInputStream(outputStream.toByteArray()));

        //return result;
        System.err.println(outputStream.toString());
        return result;
    }

    private static void createConfiguration(TransformerHandler handler, FontRecord[] fontRecords) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        handler.startDocument();
        handler.startElement("", "configuration", "configuration", attrs);
        handler.startElement("", "fonts", "fonts", attrs);

        for (int i=0; i<fontRecords.length; i++) {
            FontRecord nextRecord = fontRecords[i];
            attrs.clear();
            attrs.addAttribute("", "metrics-file", "metrics-file", "CDATA", nextRecord.getMetricsLocation().toString());
            attrs.addAttribute("", "kerning", "kerning", "CDATA", "yes");
            attrs.addAttribute("", "embed-file", "embed-file", "CDATA", nextRecord.getFontLocation().getPath());
            handler.startElement("", "font", "font", attrs);
            writeTriplets(handler, nextRecord.getFontTriplets());
            handler.endElement("", "font", "font");
        }
        handler.endElement("", "fonts", "fonts");
        handler.endElement("", "configuration", "configuration");
        handler.endDocument();
    }

    private static void writeTriplets(TransformerHandler handler, FontTriplet[] fontTriplets) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        for (int i=0; i<fontTriplets.length; i++) {
            FontTriplet next = fontTriplets[i];
            attrs.clear();
            attrs.addAttribute("", "name", "name", "CDATA", next.getName());
            attrs.addAttribute("", "style", "style", "CDATA", next.isItalic() ? "italic" : "normal");
            attrs.addAttribute("", "weight", "weight", "CDATA", next.isBold() ? "bold" : "normal");
            handler.startElement("", "font-triplet", "font-triplet", attrs);
            handler.endElement("", "font-triplet", "font-triplet");
        }
    }

    private static SAXTransformerFactory getTransformerFactory() {
        if (ourTransformerFactory==null) {
            ourTransformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
        }
        return ourTransformerFactory;
    }

}


text:
FROM alpine:3.7
CMD echo "hello"

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>HurryBee</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

	<link href="css/main_style.css" rel="stylesheet">
	<link href="css/nav_style.css" rel="stylesheet">

	<link href="https://fonts.googleapis.com/css?family=Dancing+Script" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Nunito:400,700" rel="stylesheet">

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

    </button>
    hurrybee

Good Morning!

						Drag and Drop the activities to change the order you want to do them in this morning.

						Delete any activites you don't want to do.

						Adjust the times as needed, and check the estimated time to see if you'll be ready on time.

Choose Your Activities

				This morning (in this order), I want to...

					Add your own activity to your morning routine.

					Rearrange the list to set the right order.

Add a Custom Activity

				Add as many as you need!

				<input type="text" id="customActName" value="Do a dance" class="activityLength list-group-item">
				<input type="number" class="activityLength list-group-item" placeholder="0" id="customActTime"  value="1" min=1 max=60>
				<button type="button" class="btn btn-outline-primary" id="addNewAct" onclick="buttonAdd()">Add to List </button>

				Adjust the times in the list above if you need.

				When you press go, your custom activites and times will be saved!

On track?

						Your estimated time in minutes:

						It's , so you'll be ready to go at:

9:12

			<button type="button" id="startGame" class="btn btn-outline-primary  btn-block btn-lg round">Let's Go!</button>

			<button class="btn btn-outline-primary" id="resetList">Reset to Default</button>

  				<input type="checkbox" id="audioSwitch">

			Audio


text:
cask 'pdf-expert-beta' do
  version '2.5.3,669'
  sha256 '14c2085130e1f28ea62bf06c5347355f125dd62db2dd55f464bacd47ed332a07'

  # d1ke680phyeohy.cloudfront.net was verified as official when first introduced to the cask
  url "https://d1ke680phyeohy.cloudfront.net/versions/#{version.after_comma}/PDFExpert.dmg"
  appcast 'https://d1ke680phyeohy.cloudfront.net/beta/appcast.xml'
  name 'PDF Expert'
  homepage 'https://pdfexpert.com/'

  auto_updates true
  conflicts_with cask: 'pdf-expert'
  depends_on macos: '>= :sierra'

  app 'PDF Expert.app'
end


text:
using System;

namespace DotMaysWind.Office
{
    public interface IWordFile
    {
        String ParagraphText { get; }

        String HeaderAndFooterText { get; }

        String CommentText { get; }

        String FootnoteText { get; }

        String EndnoteText { get; }
    }
}


text:
namespace base {
class TaskRunner;
}

namespace offline_pages {
class OfflinePageModel;
enum class AddPageResult;
struct OfflinePageItem;

// The implementation of PrefetchImporter.
class PrefetchImporterImpl : public PrefetchImporter {
 public:
  PrefetchImporterImpl(PrefetchDispatcher* dispatcher,
                       OfflinePageModel* context,
                       scoped_refptr<base::TaskRunner> background_task_runner);

  PrefetchImporterImpl(const PrefetchImporterImpl&) = delete;
  PrefetchImporterImpl& operator=(const PrefetchImporterImpl&) = delete;

  ~PrefetchImporterImpl() override;

  // PrefetchImporter implementation.
  void ImportArchive(const PrefetchArchiveInfo& archive) override;
  void MarkImportCompleted(int64_t offline_id) override;
  std::set<int64_t> GetOutstandingImports() const override;

 private:
  void OnMoveFileDone(const OfflinePageItem& offline_page, bool success);
  void OnPageAdded(AddPageResult result, int64_t offline_id);

  raw_ptr<OfflinePageModel> offline_page_model_;
  scoped_refptr<base::TaskRunner> background_task_runner_;
  std::set<int64_t> outstanding_import_offline_ids_;
  base::WeakPtrFactory<PrefetchImporterImpl> weak_ptr_factory_{this};
};

}  // namespace offline_pages

#endif  // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_IMPORTER_IMPL_H_


text:
package io.atomix.primitive.event;

import io.atomix.utils.misc.ArraySizeHashPrinter;

import java.util.Arrays;
import java.util.Objects;

import static com.google.common.base.MoreObjects.toStringHelper;

/**
 * Raft event.
 */
public class PrimitiveEvent {

  /**
   * Creates a new primitive event.
   *
   * @param eventType the event type
   * @return the primitive event
   */
  public static PrimitiveEvent event(EventType eventType) {
    return event(eventType, null);
  }

  /**
   * Creates a new primitive event.
   *
   * @param eventType the event type
   * @param value     the event value
   * @return the primitive event
   */
  public static PrimitiveEvent event(EventType eventType, byte[] value) {
    return new PrimitiveEvent(EventType.canonical(eventType), value);
  }

  private final EventType type;
  private final byte[] value;

  protected PrimitiveEvent() {
    this.type = null;
    this.value = null;
  }

  public PrimitiveEvent(EventType type, byte[] value) {
    this.type = type;
    this.value = value;
  }

  /**
   * Returns the event type identifier.
   *
   * @return the event type identifier
   */
  public EventType type() {
    return type;
  }

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

  @Override
  public int hashCode() {
    return Objects.hash(getClass(), type, value);
  }

  @Override
  public boolean equals(Object object) {
    if (object instanceof PrimitiveEvent) {
      PrimitiveEvent event = (PrimitiveEvent) object;
      return Objects.equals(event.type, type) && Arrays.equals(event.value, value);
    }
    return false;
  }

  @Override
  public String toString() {
    return toStringHelper(this)
        .add("type", type)
        .add("value", ArraySizeHashPrinter.of(value))
        .toString();
  }
}


text:
'use strict';
var sysPath = require('path');
var Stamper = require('filestamp');
var extend = require('extend');
var urljoin = require('urljoin');
var fs = require('fs-extra');

//It's not useful when changeFileName is set to true
var sgDefaultStampName = 't';

module.exports = function(grunt) {

  var globalPattern = {
    'u': {
      pattern: /\burl\(\s*(['"])?(\s*\S+?\.(gif|bmp|jpe?g|ico|png|webp)\b(\?[^\)"']*)?\s*)\1?\s*\)/img,
      index: 2,
      whole: false
    },
    'l': {
      pattern: /<link[^>]*? href\s*=((['"])?(\s*\S+?\.css\b(\?[^\)"']*)?\s*)\2?)/img,
      index: 3,
      whole: false
    },
    's': {
      pattern: /<script[^>]*? src\s*=((['"])?(\s*\S+?\.js\b(\?[^\)"']*)?\s*)\2?)/img,
      index: 3,
      whole: false
    },
    'i': {
      pattern: /<img[^>]*? src\s*=((['"])?(\s*\S+?\.(gif|bmp|jpe?g|ico|png|webp)\b(\?[^\)"']*)?\s*)\2?)/img,
      index: 3,
      whole: false
    }
  };

  Object.freeze(globalPattern);

  grunt.registerMultiTask('stamp', 'Handle static resource timestamp in css&html', function() {

    var options = this.options({
      prefix: '', //final path prefix
      baseDir: '.', //basic directory of target resources
      pattern: 'u|l|s|i', //url&link&script&img
      stampName: sgDefaultStampName, //p.png?{stampName}=876677,not useful when changFileName is set to true
      algorithm: 'md5', //digest/sha1/sha256/sha512
      crypto: null, //alias for algorithm
      changeFileName: false, //main.css => main_be65d0.css
      regex: {},
      fileStamp: null, //Function
      doCopy: false,
      buildFileName: function(filename, ext, stamp) {
        return filename + '_' + stamp + "." + ext;
      }
    });

    if ('string' !== typeof options.stampName || !/^\w+$/.test(options.stampName)) {
      grunt.log.warn(options.stampName + ' is not a valid stamp name,"' + sgDefaultStampName + '" is used.');
      options.stampName = sgDefaultStampName;
    }

    var regexes = extend({}, globalPattern, options.regex || {});

    var stamper = new Stamper({
      algorithm: options.algorithm || options.crypto,
      baseDir: options.baseDir,
      ignoreError: true
    }); //Stamper has to be singleton in one task

    //Using options for future more parameters
    var Replacer = function(options) {
      this.options = options; //{patternName}
    };

    Replacer.prototype = {
      /**
       * Merge stamp into filename
       * @param  {String} path
       * @param  {String} stamp
       */
      changeFileName: function(path, stamp) {
        var name = sysPath.basename(path);
        var ext = sysPath.extname(name);
        var stub = path.slice(0, name ? (-name.length) : path.length - 1);
        if (ext.length) {
          name = name.slice(0, -ext.length);
        }

        //Ignore leading dot
        if ('.' === ext[0]) {
          ext = ext.slice(1);
        }

        return urljoin(stub, options.buildFileName(name, ext, stamp));
      },
      replace: function(content) {

        var regex = regexes[this.options.patternName];
        var reg = regex.pattern;
        var index = regex.index;
        var whole = regex.whole;

        var matches, url, start, end;

        while (matches = reg.exec(content)) {
          url = matches[whole ? 0 : index];
          start = matches.index + matches[0].indexOf(url);
          end = start + url.length;
          content = content.slice(0, start) + this._stamp(matches[index]) + content.slice(end);
        }

        return content;
      },
      _stamp: function(url) {
        var digest, aliasName, fileName, prefix = options.prefix,
          isRelative = false;

        //Do trim
        url = String.prototype.trim.call(url);

        var parsedUrl = require('url').parse(url, true);

        //search is used instead of query when formatting
        delete parsedUrl.search;

        if (parsedUrl.protocol || /^(?:#|\/\/)/i.test(url)) {
          //we ignore illegal urls or urls with protocol
          //we see '//' as a dynamic protocol
          return url;
        }

        if (!/^\//.test(parsedUrl.pathname)) {
          isRelative = true;
          fileName = sysPath.join(sysPath.dirname(this.options.filepath), parsedUrl.pathname);
        } else {
          fileName = sysPath.join(options.baseDir, parsedUrl.pathname);
        }

        digest = 'function' === typeof options.fileStamp ? options.fileStamp(fileName) : stamper.compute(parsedUrl.pathname, isRelative ? sysPath.dirname(this.options.filepath) : null);

        if ('function' === typeof prefix) {
          prefix = prefix(parsedUrl.pathname);
        }

        //Never prepend prefix to relative paths
        if (isRelative) {
          prefix = '';
        }

        //Do not override the existing timestamp
        if (parsedUrl.query[options.stampName] && !options.changeFileName) {
          //If a stamp name does exist,just prepend a prefix
          return urljoin(prefix, url);
        }

        if (!digest) {
          grunt.log.warn('Cannot stamp key:"' + url + '" in ' + this.options.filepath);
          //If we do not ignore missing files,just prepend a prefix
          return urljoin(prefix, url);
        }

        if (options.changeFileName) {
          aliasName = this.changeFileName(url, digest);
          if (fs.existsSync(fileName)) {
            (options.doCopy ? fs.copySync : fs.renameSync).call(fs, fileName, this.changeFileName(fileName, digest));
          }

          return urljoin(prefix, aliasName);
        }

        parsedUrl.query[options.stampName] = digest;

        return urljoin(prefix, require('url').format(parsedUrl));

      }
    };

    // Iterate over all specified file groups.
    this.files.forEach(function(f) {
      // Concat specified files.
      var src = f.src.filter(function(filepath) {
        // Warn on and remove invalid source files (if nonull was set).
        if (!grunt.file.exists(filepath)) {
          grunt.log.warn('Source file "' + filepath + '" not found.');
          return false;
        } else {
          return true;
        }
      }).map(function(filepath) {
        // Read file source.
        var content = grunt.file.read(filepath);
        var pattern;

        for (var key in regexes) {
          if ('function' === typeof options.pattern) {
            pattern = String(options.pattern(filepath));
          } else {
            pattern = String(options.pattern);
          }

          if (pattern.split('|').indexOf(key) > -1) {
            var r = new Replacer({
              patternName: key,
              filepath: filepath
            });
            content = r.replace(content);
          }
        }

        return content;
      }).join('');

      // Write the destination file.
      grunt.file.write(f.dest, src);

      // Print a success message.
      grunt.log.writeln('File "' + f.dest + '" stamped.');
    });
  });

};


text:
package com.gplucky.common.mybatis.model;

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

public class StockNewExample {
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    protected String orderByClause;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    protected boolean distinct;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    protected List<Criteria> oredCriteria;

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public StockNewExample() {
        oredCriteria = new ArrayList<Criteria>();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public void setOrderByClause(String orderByClause) {
        this.orderByClause = orderByClause;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public String getOrderByClause() {
        return orderByClause;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public void setDistinct(boolean distinct) {
        this.distinct = distinct;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public boolean isDistinct() {
        return distinct;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public List<Criteria> getOredCriteria() {
        return oredCriteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }

    /**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<Criterion>();
        }

        public boolean isValid() {
            return criteria.size() > 0;
        }

        public List<Criterion> getAllCriteria() {
            return criteria;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }

        public Criteria andIdIsNull() {
            addCriterion("id is null");
            return (Criteria) this;
        }

        public Criteria andIdIsNotNull() {
            addCriterion("id is not null");
            return (Criteria) this;
        }

        public Criteria andIdEqualTo(Integer value) {
            addCriterion("id =", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdNotEqualTo(Integer value) {
            addCriterion("id <>", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdGreaterThan(Integer value) {
            addCriterion("id >", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
            addCriterion("id >=", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdLessThan(Integer value) {
            addCriterion("id <", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdLessThanOrEqualTo(Integer value) {
            addCriterion("id <=", value, "id");
            return (Criteria) this;
        }

        public Criteria andIdIn(List<Integer> values) {
            addCriterion("id in", values, "id");
            return (Criteria) this;
        }

        public Criteria andIdNotIn(List<Integer> values) {
            addCriterion("id not in", values, "id");
            return (Criteria) this;
        }

        public Criteria andIdBetween(Integer value1, Integer value2) {
            addCriterion("id between", value1, value2, "id");
            return (Criteria) this;
        }

        public Criteria andIdNotBetween(Integer value1, Integer value2) {
            addCriterion("id not between", value1, value2, "id");
            return (Criteria) this;
        }

        public Criteria andCodeIsNull() {
            addCriterion("code is null");
            return (Criteria) this;
        }

        public Criteria andCodeIsNotNull() {
            addCriterion("code is not null");
            return (Criteria) this;
        }

        public Criteria andCodeEqualTo(String value) {
            addCriterion("code =", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeNotEqualTo(String value) {
            addCriterion("code <>", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeGreaterThan(String value) {
            addCriterion("code >", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeGreaterThanOrEqualTo(String value) {
            addCriterion("code >=", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeLessThan(String value) {
            addCriterion("code <", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeLessThanOrEqualTo(String value) {
            addCriterion("code <=", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeLike(String value) {
            addCriterion("code like", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeNotLike(String value) {
            addCriterion("code not like", value, "code");
            return (Criteria) this;
        }

        public Criteria andCodeIn(List<String> values) {
            addCriterion("code in", values, "code");
            return (Criteria) this;
        }

        public Criteria andCodeNotIn(List<String> values) {
            addCriterion("code not in", values, "code");
            return (Criteria) this;
        }

        public Criteria andCodeBetween(String value1, String value2) {
            addCriterion("code between", value1, value2, "code");
            return (Criteria) this;
        }

        public Criteria andCodeNotBetween(String value1, String value2) {
            addCriterion("code not between", value1, value2, "code");
            return (Criteria) this;
        }

        public Criteria andSymbolIsNull() {
            addCriterion("symbol is null");
            return (Criteria) this;
        }

        public Criteria andSymbolIsNotNull() {
            addCriterion("symbol is not null");
            return (Criteria) this;
        }

        public Criteria andSymbolEqualTo(String value) {
            addCriterion("symbol =", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolNotEqualTo(String value) {
            addCriterion("symbol <>", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolGreaterThan(String value) {
            addCriterion("symbol >", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolGreaterThanOrEqualTo(String value) {
            addCriterion("symbol >=", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolLessThan(String value) {
            addCriterion("symbol <", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolLessThanOrEqualTo(String value) {
            addCriterion("symbol <=", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolLike(String value) {
            addCriterion("symbol like", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolNotLike(String value) {
            addCriterion("symbol not like", value, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolIn(List<String> values) {
            addCriterion("symbol in", values, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolNotIn(List<String> values) {
            addCriterion("symbol not in", values, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolBetween(String value1, String value2) {
            addCriterion("symbol between", value1, value2, "symbol");
            return (Criteria) this;
        }

        public Criteria andSymbolNotBetween(String value1, String value2) {
            addCriterion("symbol not between", value1, value2, "symbol");
            return (Criteria) this;
        }

        public Criteria andNameIsNull() {
            addCriterion("name is null");
            return (Criteria) this;
        }

        public Criteria andNameIsNotNull() {
            addCriterion("name is not null");
            return (Criteria) this;
        }

        public Criteria andNameEqualTo(String value) {
            addCriterion("name =", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotEqualTo(String value) {
            addCriterion("name <>", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameGreaterThan(String value) {
            addCriterion("name >", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameGreaterThanOrEqualTo(String value) {
            addCriterion("name >=", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLessThan(String value) {
            addCriterion("name <", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLessThanOrEqualTo(String value) {
            addCriterion("name <=", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLike(String value) {
            addCriterion("name like", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotLike(String value) {
            addCriterion("name not like", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameIn(List<String> values) {
            addCriterion("name in", values, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotIn(List<String> values) {
            addCriterion("name not in", values, "name");
            return (Criteria) this;
        }

        public Criteria andNameBetween(String value1, String value2) {
            addCriterion("name between", value1, value2, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotBetween(String value1, String value2) {
            addCriterion("name not between", value1, value2, "name");
            return (Criteria) this;
        }

        public Criteria andScoreIsNull() {
            addCriterion("score is null");
            return (Criteria) this;
        }

        public Criteria andScoreIsNotNull() {
            addCriterion("score is not null");
            return (Criteria) this;
        }

        public Criteria andScoreEqualTo(Integer value) {
            addCriterion("score =", value, "score");
            return (Criteria) this;
        }

        public Criteria andScoreNotEqualTo(Integer value) {
            addCriterion("score <>", value, "score");
            return (Criteria) this;
        }

        public Criteria andScoreGreaterThan(Integer value) {
            addCriterion("score >", value, "score");
            return (Criteria) this;
        }

        public Criteria andScoreGreaterThanOrEqualTo(Integer value) {
            addCriterion("score >=", value, "score");
            return (Criteria) this;
        }

        public Criteria andScoreLessThan(Integer value) {
            addCriterion("score <", value, "score");
            return (Criteria) this;
        }

        public Criteria andScoreLessThanOrEqualTo(Integer value) {
            addCriterion("score <=", value, "score");
            return (Criteria) this;
        }

        public Criteria andScoreIn(List<Integer> values) {
            addCriterion("score in", values, "score");
            return (Criteria) this;
        }

        public Criteria andScoreNotIn(List<Integer> values) {
            addCriterion("score not in", values, "score");
            return (Criteria) this;
        }

        public Criteria andScoreBetween(Integer value1, Integer value2) {
            addCriterion("score between", value1, value2, "score");
            return (Criteria) this;
        }

        public Criteria andScoreNotBetween(Integer value1, Integer value2) {
            addCriterion("score not between", value1, value2, "score");
            return (Criteria) this;
        }

        public Criteria andTradeIsNull() {
            addCriterion("trade is null");
            return (Criteria) this;
        }

        public Criteria andTradeIsNotNull() {
            addCriterion("trade is not null");
            return (Criteria) this;
        }

        public Criteria andTradeEqualTo(String value) {
            addCriterion("trade =", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeNotEqualTo(String value) {
            addCriterion("trade <>", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeGreaterThan(String value) {
            addCriterion("trade >", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeGreaterThanOrEqualTo(String value) {
            addCriterion("trade >=", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeLessThan(String value) {
            addCriterion("trade <", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeLessThanOrEqualTo(String value) {
            addCriterion("trade <=", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeLike(String value) {
            addCriterion("trade like", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeNotLike(String value) {
            addCriterion("trade not like", value, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeIn(List<String> values) {
            addCriterion("trade in", values, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeNotIn(List<String> values) {
            addCriterion("trade not in", values, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeBetween(String value1, String value2) {
            addCriterion("trade between", value1, value2, "trade");
            return (Criteria) this;
        }

        public Criteria andTradeNotBetween(String value1, String value2) {
            addCriterion("trade not between", value1, value2, "trade");
            return (Criteria) this;
        }

        public Criteria andPricechangeIsNull() {
            addCriterion("pricechange is null");
            return (Criteria) this;
        }

        public Criteria andPricechangeIsNotNull() {
            addCriterion("pricechange is not null");
            return (Criteria) this;
        }

        public Criteria andPricechangeEqualTo(String value) {
            addCriterion("pricechange =", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeNotEqualTo(String value) {
            addCriterion("pricechange <>", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeGreaterThan(String value) {
            addCriterion("pricechange >", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeGreaterThanOrEqualTo(String value) {
            addCriterion("pricechange >=", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeLessThan(String value) {
            addCriterion("pricechange <", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeLessThanOrEqualTo(String value) {
            addCriterion("pricechange <=", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeLike(String value) {
            addCriterion("pricechange like", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeNotLike(String value) {
            addCriterion("pricechange not like", value, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeIn(List<String> values) {
            addCriterion("pricechange in", values, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeNotIn(List<String> values) {
            addCriterion("pricechange not in", values, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeBetween(String value1, String value2) {
            addCriterion("pricechange between", value1, value2, "pricechange");
            return (Criteria) this;
        }

        public Criteria andPricechangeNotBetween(String value1, String value2) {
            addCriterion("pricechange not between", value1, value2, "pricechange");
            return (Criteria) this;
        }

        public Criteria andChangepercentIsNull() {
            addCriterion("changepercent is null");
            return (Criteria) this;
        }

        public Criteria andChangepercentIsNotNull() {
            addCriterion("changepercent is not null");
            return (Criteria) this;
        }

        public Criteria andChangepercentEqualTo(String value) {
            addCriterion("changepercent =", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentNotEqualTo(String value) {
            addCriterion("changepercent <>", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentGreaterThan(String value) {
            addCriterion("changepercent >", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentGreaterThanOrEqualTo(String value) {
            addCriterion("changepercent >=", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentLessThan(String value) {
            addCriterion("changepercent <", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentLessThanOrEqualTo(String value) {
            addCriterion("changepercent <=", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentLike(String value) {
            addCriterion("changepercent like", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentNotLike(String value) {
            addCriterion("changepercent not like", value, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentIn(List<String> values) {
            addCriterion("changepercent in", values, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentNotIn(List<String> values) {
            addCriterion("changepercent not in", values, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentBetween(String value1, String value2) {
            addCriterion("changepercent between", value1, value2, "changepercent");
            return (Criteria) this;
        }

        public Criteria andChangepercentNotBetween(String value1, String value2) {
            addCriterion("changepercent not between", value1, value2, "changepercent");
            return (Criteria) this;
        }

        public Criteria andBuyIsNull() {
            addCriterion("buy is null");
            return (Criteria) this;
        }

        public Criteria andBuyIsNotNull() {
            addCriterion("buy is not null");
            return (Criteria) this;
        }

        public Criteria andBuyEqualTo(String value) {
            addCriterion("buy =", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyNotEqualTo(String value) {
            addCriterion("buy <>", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyGreaterThan(String value) {
            addCriterion("buy >", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyGreaterThanOrEqualTo(String value) {
            addCriterion("buy >=", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyLessThan(String value) {
            addCriterion("buy <", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyLessThanOrEqualTo(String value) {
            addCriterion("buy <=", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyLike(String value) {
            addCriterion("buy like", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyNotLike(String value) {
            addCriterion("buy not like", value, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyIn(List<String> values) {
            addCriterion("buy in", values, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyNotIn(List<String> values) {
            addCriterion("buy not in", values, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyBetween(String value1, String value2) {
            addCriterion("buy between", value1, value2, "buy");
            return (Criteria) this;
        }

        public Criteria andBuyNotBetween(String value1, String value2) {
            addCriterion("buy not between", value1, value2, "buy");
            return (Criteria) this;
        }

        public Criteria andSellIsNull() {
            addCriterion("sell is null");
            return (Criteria) this;
        }

        public Criteria andSellIsNotNull() {
            addCriterion("sell is not null");
            return (Criteria) this;
        }

        public Criteria andSellEqualTo(String value) {
            addCriterion("sell =", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellNotEqualTo(String value) {
            addCriterion("sell <>", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellGreaterThan(String value) {
            addCriterion("sell >", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellGreaterThanOrEqualTo(String value) {
            addCriterion("sell >=", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellLessThan(String value) {
            addCriterion("sell <", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellLessThanOrEqualTo(String value) {
            addCriterion("sell <=", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellLike(String value) {
            addCriterion("sell like", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellNotLike(String value) {
            addCriterion("sell not like", value, "sell");
            return (Criteria) this;
        }

        public Criteria andSellIn(List<String> values) {
            addCriterion("sell in", values, "sell");
            return (Criteria) this;
        }

        public Criteria andSellNotIn(List<String> values) {
            addCriterion("sell not in", values, "sell");
            return (Criteria) this;
        }

        public Criteria andSellBetween(String value1, String value2) {
            addCriterion("sell between", value1, value2, "sell");
            return (Criteria) this;
        }

        public Criteria andSellNotBetween(String value1, String value2) {
            addCriterion("sell not between", value1, value2, "sell");
            return (Criteria) this;
        }

        public Criteria andSettlementIsNull() {
            addCriterion("settlement is null");
            return (Criteria) this;
        }

        public Criteria andSettlementIsNotNull() {
            addCriterion("settlement is not null");
            return (Criteria) this;
        }

        public Criteria andSettlementEqualTo(String value) {
            addCriterion("settlement =", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementNotEqualTo(String value) {
            addCriterion("settlement <>", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementGreaterThan(String value) {
            addCriterion("settlement >", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementGreaterThanOrEqualTo(String value) {
            addCriterion("settlement >=", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementLessThan(String value) {
            addCriterion("settlement <", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementLessThanOrEqualTo(String value) {
            addCriterion("settlement <=", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementLike(String value) {
            addCriterion("settlement like", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementNotLike(String value) {
            addCriterion("settlement not like", value, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementIn(List<String> values) {
            addCriterion("settlement in", values, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementNotIn(List<String> values) {
            addCriterion("settlement not in", values, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementBetween(String value1, String value2) {
            addCriterion("settlement between", value1, value2, "settlement");
            return (Criteria) this;
        }

        public Criteria andSettlementNotBetween(String value1, String value2) {
            addCriterion("settlement not between", value1, value2, "settlement");
            return (Criteria) this;
        }

        public Criteria andOpenIsNull() {
            addCriterion("open is null");
            return (Criteria) this;
        }

        public Criteria andOpenIsNotNull() {
            addCriterion("open is not null");
            return (Criteria) this;
        }

        public Criteria andOpenEqualTo(String value) {
            addCriterion("open =", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenNotEqualTo(String value) {
            addCriterion("open <>", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenGreaterThan(String value) {
            addCriterion("open >", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenGreaterThanOrEqualTo(String value) {
            addCriterion("open >=", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenLessThan(String value) {
            addCriterion("open <", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenLessThanOrEqualTo(String value) {
            addCriterion("open <=", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenLike(String value) {
            addCriterion("open like", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenNotLike(String value) {
            addCriterion("open not like", value, "open");
            return (Criteria) this;
        }

        public Criteria andOpenIn(List<String> values) {
            addCriterion("open in", values, "open");
            return (Criteria) this;
        }

        public Criteria andOpenNotIn(List<String> values) {
            addCriterion("open not in", values, "open");
            return (Criteria) this;
        }

        public Criteria andOpenBetween(String value1, String value2) {
            addCriterion("open between", value1, value2, "open");
            return (Criteria) this;
        }

        public Criteria andOpenNotBetween(String value1, String value2) {
            addCriterion("open not between", value1, value2, "open");
            return (Criteria) this;
        }

        public Criteria andHighIsNull() {
            addCriterion("high is null");
            return (Criteria) this;
        }

        public Criteria andHighIsNotNull() {
            addCriterion("high is not null");
            return (Criteria) this;
        }

        public Criteria andHighEqualTo(String value) {
            addCriterion("high =", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighNotEqualTo(String value) {
            addCriterion("high <>", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighGreaterThan(String value) {
            addCriterion("high >", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighGreaterThanOrEqualTo(String value) {
            addCriterion("high >=", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighLessThan(String value) {
            addCriterion("high <", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighLessThanOrEqualTo(String value) {
            addCriterion("high <=", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighLike(String value) {
            addCriterion("high like", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighNotLike(String value) {
            addCriterion("high not like", value, "high");
            return (Criteria) this;
        }

        public Criteria andHighIn(List<String> values) {
            addCriterion("high in", values, "high");
            return (Criteria) this;
        }

        public Criteria andHighNotIn(List<String> values) {
            addCriterion("high not in", values, "high");
            return (Criteria) this;
        }

        public Criteria andHighBetween(String value1, String value2) {
            addCriterion("high between", value1, value2, "high");
            return (Criteria) this;
        }

        public Criteria andHighNotBetween(String value1, String value2) {
            addCriterion("high not between", value1, value2, "high");
            return (Criteria) this;
        }

        public Criteria andLowIsNull() {
            addCriterion("low is null");
            return (Criteria) this;
        }

        public Criteria andLowIsNotNull() {
            addCriterion("low is not null");
            return (Criteria) this;
        }

        public Criteria andLowEqualTo(String value) {
            addCriterion("low =", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowNotEqualTo(String value) {
            addCriterion("low <>", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowGreaterThan(String value) {
            addCriterion("low >", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowGreaterThanOrEqualTo(String value) {
            addCriterion("low >=", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowLessThan(String value) {
            addCriterion("low <", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowLessThanOrEqualTo(String value) {
            addCriterion("low <=", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowLike(String value) {
            addCriterion("low like", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowNotLike(String value) {
            addCriterion("low not like", value, "low");
            return (Criteria) this;
        }

        public Criteria andLowIn(List<String> values) {
            addCriterion("low in", values, "low");
            return (Criteria) this;
        }

        public Criteria andLowNotIn(List<String> values) {
            addCriterion("low not in", values, "low");
            return (Criteria) this;
        }

        public Criteria andLowBetween(String value1, String value2) {
            addCriterion("low between", value1, value2, "low");
            return (Criteria) this;
        }

        public Criteria andLowNotBetween(String value1, String value2) {
            addCriterion("low not between", value1, value2, "low");
            return (Criteria) this;
        }

        public Criteria andVolumeIsNull() {
            addCriterion("volume is null");
            return (Criteria) this;
        }

        public Criteria andVolumeIsNotNull() {
            addCriterion("volume is not null");
            return (Criteria) this;
        }

        public Criteria andVolumeEqualTo(Long value) {
            addCriterion("volume =", value, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeNotEqualTo(Long value) {
            addCriterion("volume <>", value, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeGreaterThan(Long value) {
            addCriterion("volume >", value, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeGreaterThanOrEqualTo(Long value) {
            addCriterion("volume >=", value, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeLessThan(Long value) {
            addCriterion("volume <", value, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeLessThanOrEqualTo(Long value) {
            addCriterion("volume <=", value, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeIn(List<Long> values) {
            addCriterion("volume in", values, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeNotIn(List<Long> values) {
            addCriterion("volume not in", values, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeBetween(Long value1, Long value2) {
            addCriterion("volume between", value1, value2, "volume");
            return (Criteria) this;
        }

        public Criteria andVolumeNotBetween(Long value1, Long value2) {
            addCriterion("volume not between", value1, value2, "volume");
            return (Criteria) this;
        }

        public Criteria andAmountIsNull() {
            addCriterion("amount is null");
            return (Criteria) this;
        }

        public Criteria andAmountIsNotNull() {
            addCriterion("amount is not null");
            return (Criteria) this;
        }

        public Criteria andAmountEqualTo(Long value) {
            addCriterion("amount =", value, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountNotEqualTo(Long value) {
            addCriterion("amount <>", value, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountGreaterThan(Long value) {
            addCriterion("amount >", value, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountGreaterThanOrEqualTo(Long value) {
            addCriterion("amount >=", value, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountLessThan(Long value) {
            addCriterion("amount <", value, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountLessThanOrEqualTo(Long value) {
            addCriterion("amount <=", value, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountIn(List<Long> values) {
            addCriterion("amount in", values, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountNotIn(List<Long> values) {
            addCriterion("amount not in", values, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountBetween(Long value1, Long value2) {
            addCriterion("amount between", value1, value2, "amount");
            return (Criteria) this;
        }

        public Criteria andAmountNotBetween(Long value1, Long value2) {
            addCriterion("amount not between", value1, value2, "amount");
            return (Criteria) this;
        }

        public Criteria andTicktimeIsNull() {
            addCriterion("ticktime is null");
            return (Criteria) this;
        }

        public Criteria andTicktimeIsNotNull() {
            addCriterion("ticktime is not null");
            return (Criteria) this;
        }

        public Criteria andTicktimeEqualTo(String value) {
            addCriterion("ticktime =", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeNotEqualTo(String value) {
            addCriterion("ticktime <>", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeGreaterThan(String value) {
            addCriterion("ticktime >", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeGreaterThanOrEqualTo(String value) {
            addCriterion("ticktime >=", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeLessThan(String value) {
            addCriterion("ticktime <", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeLessThanOrEqualTo(String value) {
            addCriterion("ticktime <=", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeLike(String value) {
            addCriterion("ticktime like", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeNotLike(String value) {
            addCriterion("ticktime not like", value, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeIn(List<String> values) {
            addCriterion("ticktime in", values, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeNotIn(List<String> values) {
            addCriterion("ticktime not in", values, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeBetween(String value1, String value2) {
            addCriterion("ticktime between", value1, value2, "ticktime");
            return (Criteria) this;
        }

        public Criteria andTicktimeNotBetween(String value1, String value2) {
            addCriterion("ticktime not between", value1, value2, "ticktime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeIsNull() {
            addCriterion("create_time is null");
            return (Criteria) this;
        }

        public Criteria andCreateTimeIsNotNull() {
            addCriterion("create_time is not null");
            return (Criteria) this;
        }

        public Criteria andCreateTimeEqualTo(Date value) {
            addCriterion("create_time =", value, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeNotEqualTo(Date value) {
            addCriterion("create_time <>", value, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeGreaterThan(Date value) {
            addCriterion("create_time >", value, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
            addCriterion("create_time >=", value, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeLessThan(Date value) {
            addCriterion("create_time <", value, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
            addCriterion("create_time <=", value, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeIn(List<Date> values) {
            addCriterion("create_time in", values, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeNotIn(List<Date> values) {
            addCriterion("create_time not in", values, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeBetween(Date value1, Date value2) {
            addCriterion("create_time between", value1, value2, "createTime");
            return (Criteria) this;
        }

        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
            addCriterion("create_time not between", value1, value2, "createTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeIsNull() {
            addCriterion("update_time is null");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeIsNotNull() {
            addCriterion("update_time is not null");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeEqualTo(Date value) {
            addCriterion("update_time =", value, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeNotEqualTo(Date value) {
            addCriterion("update_time <>", value, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeGreaterThan(Date value) {
            addCriterion("update_time >", value, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
            addCriterion("update_time >=", value, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeLessThan(Date value) {
            addCriterion("update_time <", value, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
            addCriterion("update_time <=", value, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeIn(List<Date> values) {
            addCriterion("update_time in", values, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeNotIn(List<Date> values) {
            addCriterion("update_time not in", values, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeBetween(Date value1, Date value2) {
            addCriterion("update_time between", value1, value2, "updateTime");
            return (Criteria) this;
        }

        public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
            addCriterion("update_time not between", value1, value2, "updateTime");
            return (Criteria) this;
        }
    }

    /**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table stock_new
     *
     * @mbggenerated do_not_delete_during_merge
     */
    public static class Criteria extends GeneratedCriteria {

        protected Criteria() {
            super();
        }
    }

    /**
     * This class was generated by MyBatis Generator.
     * This class corresponds to the database table stock_new
     *
     * @mbggenerated
     */
    public static class Criterion {
        private String condition;

        private Object value;

        private Object secondValue;

        private boolean noValue;

        private boolean singleValue;

        private boolean betweenValue;

        private boolean listValue;

        private String typeHandler;

        public String getCondition() {
            return condition;
        }

        public Object getValue() {
            return value;
        }

        public Object getSecondValue() {
            return secondValue;
        }

        public boolean isNoValue() {
            return noValue;
        }

        public boolean isSingleValue() {
            return singleValue;
        }

        public boolean isBetweenValue() {
            return betweenValue;
        }

        public boolean isListValue() {
            return listValue;
        }

        public String getTypeHandler() {
            return typeHandler;
        }

        protected Criterion(String condition) {
            super();
            this.condition = condition;
            this.typeHandler = null;
            this.noValue = true;
        }

        protected Criterion(String condition, Object value, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.typeHandler = typeHandler;
            if (value instanceof List<?>) {
                this.listValue = true;
            } else {
                this.singleValue = true;
            }
        }

        protected Criterion(String condition, Object value) {
            this(condition, value, null);
        }

        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.secondValue = secondValue;
            this.typeHandler = typeHandler;
            this.betweenValue = true;
        }

        protected Criterion(String condition, Object value, Object secondValue) {
            this(condition, value, secondValue, null);
        }
    }
}


text:
<?php

use Twig\Node\Expression\Binary\DivBinary;

class_exists('Twig\Node\Expression\Binary\DivBinary');

if (\false) {
    class Twig_Node_Expression_Binary_Div extends DivBinary
    {
    }
}


text:
class LogUploadsController < ApplicationController
  def new
    @log_upload = link_log_upload_to_reservation
    log_file = find_log_file(params[:file_name].to_s)
    @log_upload.file_name = log_file.fetch(:file_name)
  end

  def create
    respond_to do |format|
      format.html do
        @log_upload = LogUpload.new(upload_params)
        link_log_upload_to_reservation
        log_file = find_log_file(upload_params[:file_name].to_s)
        @log_upload.file_name = log_file.fetch(:file_name)

        if @log_upload.save
          @log_upload.upload
          flash[:notice] = 'Logfile uploaded to logs.tf'
          redirect_to(reservation_log_uploads_path(reservation))
        else
          render :new, status: :unprocessable_entity
        end
      end
    end
  end

  def index
    @logs         = logs
    @log_uploads  = log_uploads
  end

  def show_log
    file = find_log_file(params[:file_name].to_s)
    file_content = File.read(file[:file_name_and_path])
    @log_file = ActiveSupport::Multibyte::Chars.new(file_content).tidy_bytes
  end

  private

  def link_log_upload_to_reservation
    @log_upload ||= LogUpload.new
    @log_upload.reservation_id = reservation.id
    @log_upload
  end

  def reservation
    @reservation ||= if params[:reservation_id].to_i.positive?
                       if current_admin
                         Reservation.find(params[:reservation_id].to_i)
                       else
                         current_user.reservations.find(params[:reservation_id].to_i)
                       end
                     end
  end
  helper_method :reservation

  def logs
    @logs ||= LogUpload.find_log_files(reservation.id)
  end

  def find_log_file(file_name)
    logs.find { |log| log[:file_name] == file_name } || { file_name: nil }
  end

  def log_uploads
    @log_uploads ||= reservation.log_uploads.order('created_at DESC')
  end

  def upload_params
    params.require(:log_upload).permit(:file_name, :title, :map_name)
  end
end


text:
package bstest

import (
	. "github.com/djbarber/ipfs-hack/blockservice"
	bitswap "github.com/djbarber/ipfs-hack/exchange/bitswap"
	tn "github.com/djbarber/ipfs-hack/exchange/bitswap/testnet"
	mockrouting "github.com/djbarber/ipfs-hack/routing/mock"
	delay "github.com/djbarber/ipfs-hack/thirdparty/delay"
)

// Mocks returns |n| connected mock Blockservices
func Mocks(n int) []*BlockService {
	net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
	sg := bitswap.NewTestSessionGenerator(net)

	instances := sg.Instances(n)

	var servs []*BlockService
	for _, i := range instances {
		servs = append(servs, New(i.Blockstore(), i.Exchange))
	}
	return servs
}


text:
namespace
{

const int LINE_MAX_LENGTH = 10000;

} // namespace

using namespace std;

SuffixArray::SuffixArray()
  : m_array(NULL),
    m_index(NULL),
    m_buffer(NULL),
    m_wordInSentence(NULL),
    m_sentence(NULL),
    m_sentenceLength(NULL),
    m_document(NULL),
    m_documentName(NULL),
    m_documentNameLength(0),
    m_documentCount(0),
    m_useDocument(false),
    m_vcb(),
    m_size(0),
    m_sentenceCount(0) { }

SuffixArray::~SuffixArray()
{
  free(m_array);
  free(m_index);
  free(m_wordInSentence);
  free(m_sentence);
  free(m_sentenceLength);
  free(m_document);
  free(m_documentName);
}

void SuffixArray::Create(const string& fileName )
{
  m_vcb.StoreIfNew( "<uNk>" );
  m_endOfSentence = m_vcb.StoreIfNew( "<s>" );

  ifstream textFile;
  char line[LINE_MAX_LENGTH];

  // count the number of words first;
  textFile.open(fileName.c_str());

  if (!textFile) {
    cerr << "Error: no such file or directory " << fileName << endl;
    exit(1);
  }

  // first pass through data: get size
  istream *fileP = &textFile;
  m_size = 0;
  m_sentenceCount = 0;
  m_documentCount = 0;
  while(!fileP->eof()) {
    SAFE_GETLINE((*fileP), line, LINE_MAX_LENGTH, '\n');
    if (fileP->eof()) break;
    if (m_useDocument && ProcessDocumentLine(line,0)) continue;
    vector< WORD_ID > words = m_vcb.Tokenize( line );
    m_size += words.size() + 1;
    m_sentenceCount++;
  }
  textFile.close();
  cerr << m_size << " words (incl. sentence boundaries)" << endl;
  if (m_useDocument) {
    cerr << m_documentCount << " documents" << endl;
    if (m_documentCount == 0) {
      cerr << "Error: no documents found, aborting." << endl;
      exit(1);
    }
  }

  // allocate memory
  m_array = (WORD_ID*) calloc( sizeof( WORD_ID ), m_size );
  m_index = (INDEX*) calloc( sizeof( INDEX ), m_size );
  m_wordInSentence = (char*) calloc( sizeof( char ), m_size );
  m_sentence = (INDEX*) calloc( sizeof( INDEX ), m_size );
  m_sentenceLength = (char*) calloc( sizeof( char ), m_sentenceCount );
  CheckAllocation(m_array != NULL, "m_array");
  CheckAllocation(m_index != NULL, "m_index");
  CheckAllocation(m_wordInSentence != NULL, "m_wordInSentence");
  CheckAllocation(m_sentence != NULL, "m_sentence");
  CheckAllocation(m_sentenceLength != NULL, "m_sentenceLength");
  if (m_useDocument) {
    m_document = (INDEX*) calloc( sizeof( INDEX ), m_documentCount );
    m_documentName = (INDEX*) calloc( sizeof( INDEX ), m_documentCount );
    m_documentNameBuffer = (char*) calloc( sizeof( char ), m_documentNameLength );
    CheckAllocation(m_document != NULL, "m_document");
    CheckAllocation(m_documentName != NULL, "m_documentName");
    CheckAllocation(m_documentNameBuffer != NULL, "m_documentNameBuffer");
  }

  // second pass through data: fill the arrays
  int wordIndex = 0;
  int sentenceId = 0;
  m_documentNameLength = 0; // re-use as counter
  m_documentCount = 0;      // re-use as counter
  textFile.open(fileName.c_str());
  fileP = &textFile;
  while(!fileP->eof()) {
    SAFE_GETLINE((*fileP), line, LINE_MAX_LENGTH, '\n');
    if (fileP->eof()) break;
    if (m_useDocument && ProcessDocumentLine(line,sentenceId)) continue;
    vector< WORD_ID > words = m_vcb.Tokenize( line );
    vector< WORD_ID >::const_iterator i;

    for( i=words.begin(); i!=words.end(); i++) {
      m_index[ wordIndex ] = wordIndex;
      m_sentence[ wordIndex ] = sentenceId;
      m_wordInSentence[ wordIndex ] = i-words.begin();
      m_array[ wordIndex++ ] = *i;
    }
    m_index[ wordIndex ] = wordIndex;
    m_array[ wordIndex++ ] = m_endOfSentence;
    m_sentenceLength[ sentenceId++ ] = words.size();
  }
  textFile.close();
  cerr << "done reading " << wordIndex << " words, " << sentenceId << " sentences." << endl;
  // List(0,9);

  // sort
  m_buffer = (INDEX*) calloc( sizeof( INDEX ), m_size );

  if (m_buffer == NULL) {
    cerr << "Error: cannot allocate memory to m_buffer" << endl;
    exit(1);
  }

  Sort( 0, m_size-1 );
  free( m_buffer );
  cerr << "done sorting" << endl;
}

// very specific code to deal with common crawl document ids
bool SuffixArray::ProcessDocumentLine( const char *line, const size_t sentenceId )
{
  size_t i;
  // first 32 characters are hex-hash
  for(i=0; i<32; i++) {
    if ((line[i] < '0' || line[i] > '9') && (line[i] < 'a' || line[i] > 'f')) {
      return false;
    }
  }
  if (line[i++] != ' ') return false;

  // second token is float
  for (; line[i] != ' ' && line[i] != 0; i++) {
    if (line[i] != '.' && (line[i] < '0' || line[i] > '9')) {
      return false;
    }
  }
  i++;

  // last token is url (=name)
  size_t startName = i;
  for (; line[i] != ' ' && line[i] != 0; i++) {}
  if (line[i] == ' ') return false;
  size_t endName = i+1; // include '\0'

  // second pass: record name and sentence number
  if (m_document != NULL) {
    m_documentName[m_documentCount] = m_documentNameLength;
    for(size_t i=startName; i<endName; i++) {
      m_documentNameBuffer[m_documentNameLength + i-startName] = line[i];
    }
    m_document[m_documentCount] = sentenceId;
  }
  m_documentNameLength += endName-startName;
  m_documentCount++;
  return true;
}

// good ol' quick sort
void SuffixArray::Sort(INDEX start, INDEX end)
{
  if (start == end) return;
  INDEX mid = (start+end+1)/2;
  Sort( start, mid-1 );
  Sort( mid, end );

  // merge
  INDEX i = start;
  INDEX j = mid;
  INDEX k = 0;
  INDEX length = end-start+1;
  while( k<length ) {
    if (i == mid ) {
      m_buffer[ k++ ] = m_index[ j++ ];
    } else if (j > end ) {
      m_buffer[ k++ ] = m_index[ i++ ];
    } else {
      if (CompareIndex( m_index[i], m_index[j] ) < 0) {
        m_buffer[ k++ ] = m_index[ i++ ];
      } else {
        m_buffer[ k++ ] = m_index[ j++ ];
      }
    }
  }

  memcpy( ((char*)m_index) + sizeof( INDEX ) * start,
          ((char*)m_buffer), sizeof( INDEX ) * (end-start+1) );
}

int SuffixArray::CompareIndex( INDEX a, INDEX b ) const
{
  // skip over identical words
  INDEX offset = 0;
  while( a+offset < m_size &&
         b+offset < m_size &&
         m_array[ a+offset ] == m_array[ b+offset ] ) {
    offset++;
  }

  if( a+offset == m_size ) return -1;
  if( b+offset == m_size ) return 1;
  return CompareWord( m_array[ a+offset ], m_array[ b+offset ] );
}

inline int SuffixArray::CompareWord( WORD_ID a, WORD_ID b ) const
{
  return m_vcb.GetWord(a).compare( m_vcb.GetWord(b) );
}

int SuffixArray::Count( const vector< WORD > &phrase )
{
  INDEX dummy;
  return LimitedCount( phrase, m_size, dummy, dummy, 0, m_size-1 );
}

bool SuffixArray::MinCount( const vector< WORD > &phrase, INDEX min )
{
  INDEX dummy;
  return (INDEX)LimitedCount( phrase, min, dummy, dummy, 0, m_size-1 ) >= min;
}

bool SuffixArray::Exists( const vector< WORD > &phrase )
{
  INDEX dummy;
  return LimitedCount( phrase, 1, dummy, dummy, 0, m_size-1 ) == 1;
}

int SuffixArray::FindMatches( const vector< WORD > &phrase, INDEX &firstMatch, INDEX &lastMatch, INDEX search_start, INDEX search_end )
{
  return LimitedCount( phrase, m_size, firstMatch, lastMatch, search_start, search_end );
}

int SuffixArray::LimitedCount( const vector< WORD > &phrase, INDEX min, INDEX &firstMatch, INDEX &lastMatch, INDEX search_start, INDEX search_end )
{
  // cerr << "FindFirst\n";
  INDEX start = search_start;
  INDEX end = (search_end == (INDEX)-1) ? (m_size-1) : search_end;
  INDEX mid = FindFirst( phrase, start, end );
  // cerr << "done\n";
  if (mid == m_size) return 0; // no matches
  if (min == 1) return 1;      // only existance check

  int matchCount = 1;

  //cerr << "before...\n";
  firstMatch = FindLast( phrase, mid, start, -1 );
  matchCount += mid - firstMatch;

  //cerr << "after...\n";
  lastMatch = FindLast( phrase, mid, end, 1 );
  matchCount += lastMatch - mid;

  return matchCount;
}

SuffixArray::INDEX SuffixArray::FindLast( const vector< WORD > &phrase, INDEX start, INDEX end, int direction )
{
  end += direction;
  while(true) {
    INDEX mid = ( start + end + (direction>0 ? 0 : 1) )/2;

    int match = Match( phrase, mid );
    int matchNext = Match( phrase, mid+direction );
    //cerr << "\t" << start << ";" << mid << ";" << end << " -> " << match << "," << matchNext << endl;

    if (match == 0 && matchNext != 0) return mid;

    if (match == 0) // mid point is a match
      start = mid;
    else
      end = mid;
  }
}

SuffixArray::INDEX SuffixArray::FindFirst( const vector< WORD > &phrase, INDEX &start, INDEX &end )
{
  while(true) {
    INDEX mid = ( start + end + 1 )/2;
    //cerr << "FindFirst(" << start << ";" << mid << ";" << end << ")\n";
    int match = Match( phrase, mid );

    if (match == 0) return mid;
    if (start >= end && match != 0 ) return m_size;

    if (match > 0)
      start = mid+1;
    else
      end = mid-1;
  }
}

int SuffixArray::Match( const vector< WORD > &phrase, INDEX index )
{
  INDEX pos = m_index[ index ];
  for(INDEX i=0; i<phrase.size() && i+pos<m_size; i++) {
    int match = CompareWord( m_vcb.GetWordID( phrase[i] ), m_array[ pos+i ] );
    // cerr << "{" << index << "+" << i << "," << pos+i << ":" << match << "}" << endl;
    if (match != 0)
      return match;
  }
  return 0;
}

void SuffixArray::List(INDEX start, INDEX end)
{
  for(INDEX i=start; i<=end; i++) {
    INDEX pos = m_index[ i ];
    // cerr << i << ":" << pos << "\t";
    for(int j=0; j<5 && j+pos<m_size; j++) {
      cout << " " << m_vcb.GetWord( m_array[ pos+j ] );
    }
    // cerr << "\n";
  }
}

void SuffixArray::PrintSentenceMatches( const std::vector< WORD > &phrase )
{
  cout << "QUERY\t";
  for(size_t i=0; i<phrase.size(); i++) {
    if (i>0) cout << " ";
    cout <<  phrase[i];
  }
  cout << '\t';
  INDEX start = 0;
  INDEX end = m_size-1;
  INDEX mid = FindFirst( phrase, start, end );
  if (mid == m_size) { // no matches
    cout << "0 matches" << endl;
    return;
  }

  INDEX firstMatch = FindLast( phrase, mid, start, -1 );
  INDEX lastMatch = FindLast( phrase, mid, end, 1 );

  // loop through all matches
  cout << (lastMatch-firstMatch+1) << " matches" << endl;
  for(INDEX i=firstMatch; i<=lastMatch; i++) {
    // get sentence information
    INDEX pos = GetPosition( i );
    INDEX start = pos - GetWordInSentence( pos );
    char length = GetSentenceLength( GetSentence( pos ) );
    // print document name
    if (m_useDocument) {
      INDEX sentence = GetSentence( pos );
      INDEX document = GetDocument( sentence );
      PrintDocumentName( document );
      cout << '\t';
    }
    // print sentence
    for(char i=0; i<length; i++) {
      if (i>0) cout << " ";
      cout << GetWord( start + i );
    }
    cout << endl;
  }
}

SuffixArray::INDEX SuffixArray::GetDocument( INDEX sentence ) const
{
  // binary search
  INDEX min = 0;
  INDEX max = m_documentCount-1;
  if (sentence >= m_document[max]) {
    return max;
  }
  while(true) {
    INDEX mid = (min + max) / 2;
    if (sentence >= m_document[mid] && sentence < m_document[mid+1]) {
      return mid;
    }
    if (sentence < m_document[mid]) {
      max = mid-1;
    } else {
      min = mid+1;
    }
  }
}

void SuffixArray::Save(const string& fileName ) const
{
  FILE *pFile = fopen ( fileName.c_str() , "w" );
  if (pFile == NULL) Error("cannot open",fileName);

  fwrite( &m_size, sizeof(INDEX), 1, pFile );
  fwrite( m_array, sizeof(WORD_ID), m_size, pFile ); // corpus
  fwrite( m_index, sizeof(INDEX), m_size, pFile );   // suffix array
  fwrite( m_wordInSentence, sizeof(char), m_size, pFile); // word index
  fwrite( m_sentence, sizeof(INDEX), m_size, pFile); // sentence index

  fwrite( &m_sentenceCount, sizeof(INDEX), 1, pFile );
  fwrite( m_sentenceLength, sizeof(char), m_sentenceCount, pFile); // sentence length

  char useDocument = m_useDocument; // not sure if that is needed
  fwrite( &useDocument, sizeof(char), 1, pFile );
  if (m_useDocument) {
    fwrite( &m_documentCount, sizeof(INDEX), 1, pFile );
    fwrite( m_document, sizeof(INDEX), m_documentCount, pFile );
    fwrite( m_documentName, sizeof(INDEX), m_documentCount, pFile );
    fwrite( &m_documentNameLength, sizeof(INDEX), 1, pFile );
    fwrite( m_documentNameBuffer, sizeof(char), m_documentNameLength, pFile );
  }
  fclose( pFile );

  m_vcb.Save( fileName + ".src-vcb" );
}

void SuffixArray::Load(const string& fileName )
{
  FILE *pFile = fopen ( fileName.c_str() , "r" );
  if (pFile == NULL) Error("no such file or directory", fileName);

  cerr << "loading from " << fileName << endl;

  fread( &m_size, sizeof(INDEX), 1, pFile )
  || Error("could not read m_size from", fileName);
  cerr << "words in corpus: " << m_size << endl;

  m_array = (WORD_ID*) calloc( sizeof( WORD_ID ), m_size );
  m_index = (INDEX*) calloc( sizeof( INDEX ), m_size );
  m_wordInSentence = (char*) calloc( sizeof( char ), m_size );
  m_sentence = (INDEX*) calloc( sizeof( INDEX ), m_size );
  CheckAllocation(m_array != NULL, "m_array");
  CheckAllocation(m_index != NULL, "m_index");
  CheckAllocation(m_wordInSentence != NULL, "m_wordInSentence");
  CheckAllocation(m_sentence != NULL, "m_sentence");
  fread( m_array, sizeof(WORD_ID), m_size, pFile ) // corpus
  || Error("could not read m_array from", fileName);
  fread( m_index, sizeof(INDEX), m_size, pFile )   // suffix array
  || Error("could not read m_index from", fileName);
  fread( m_wordInSentence, sizeof(char), m_size, pFile) // word index
  || Error("could not read m_wordInSentence from", fileName);
  fread( m_sentence, sizeof(INDEX), m_size, pFile ) // sentence index
  || Error("could not read m_sentence from", fileName);

  fread( &m_sentenceCount, sizeof(INDEX), 1, pFile )
  || Error("could not read m_sentenceCount from", fileName);
  cerr << "sentences in corpus: " << m_sentenceCount << endl;

  m_sentenceLength = (char*) calloc( sizeof( char ), m_sentenceCount );
  CheckAllocation(m_sentenceLength != NULL, "m_sentenceLength");
  fread( m_sentenceLength, sizeof(char), m_sentenceCount, pFile) // sentence length
  || Error("could not read m_sentenceLength from", fileName);

  if (m_useDocument) { // do not read it when you do not need it
    char useDocument;
    fread( &useDocument, sizeof(char), 1, pFile )
    || Error("could not read m_useDocument from", fileName);
    if (!useDocument) {
      cerr << "Error: stored suffix array does not have a document index\n";
      exit(1);
    }
    fread( &m_documentCount, sizeof(INDEX), 1, pFile )
    || Error("could not read m_documentCount from", fileName);
    m_document = (INDEX*) calloc( sizeof( INDEX ), m_documentCount );
    m_documentName = (INDEX*) calloc( sizeof( INDEX ), m_documentCount );
    CheckAllocation(m_document != NULL, "m_document");
    CheckAllocation(m_documentName != NULL, "m_documentName");
    fread( m_document, sizeof(INDEX), m_documentCount, pFile )
    || Error("could not read m_document from", fileName);
    fread( m_documentName, sizeof(INDEX), m_documentCount, pFile )
    || Error("could not read m_documentName from", fileName);
    fread( &m_documentNameLength, sizeof(INDEX), 1, pFile )
    || Error("could not read m_documentNameLength from", fileName);
    m_documentNameBuffer = (char*) calloc( sizeof( char ), m_documentNameLength );
    CheckAllocation(m_documentNameBuffer != NULL, "m_documentNameBuffer");
    fread( m_documentNameBuffer, sizeof(char), m_documentNameLength, pFile )
    || Error("could not read m_document from", fileName);
  }

  fclose( pFile );

  m_vcb.Load( fileName + ".src-vcb" );
}

void SuffixArray::CheckAllocation( bool check, const char *dataStructure ) const
{
  if (check) return;
  cerr << "Error: could not allocate memory for " << dataStructure << endl;
  exit(1);
}

bool SuffixArray::Error( const char *message, const string &fileName) const
{
  cerr << "Error: " << message << " " << fileName << endl;
  exit(1);
  return true; // yeah, i know.
}


text:
<?php
namespace Kartenmacherei\RestFramework\RestResource;

use Kartenmacherei\RestFramework\Action\Command;
use Kartenmacherei\RestFramework\Request\PutRequest;

interface SupportsPutRequests
{
    /**
     * @param PutRequest $request
     *
     * @return Command
     */
    public function getPutCommand(PutRequest $request): Command;
}


text:
Medicinalia API
=================

Endpoint:
http://medicinalia.geton.ro/api/


text:
package com.swayzetrain.inventory.test.common.builder;

import java.sql.Timestamp;

import com.swayzetrain.inventory.common.model.Item;
import com.swayzetrain.inventory.common.service.CommonService;

public class ItemBuilder {

	CommonService commonService = new CommonService();

	private String itemName = "Item";
	private Integer categoryId = 1;
	private Integer instanceId = 1;
	private Integer creationUserId = 1;
	private Timestamp dateCreated = commonService.setTimestamp();
	private Timestamp dateModified = commonService.setTimestamp();

	public ItemBuilder addItemName(String itemName) {

		this.itemName = itemName;
		return this;

	}

	public ItemBuilder addCategoryId(Integer categoryId) {

		this.categoryId = categoryId;
		return this;

	}

	public ItemBuilder addInstanceId(Integer instanceId) {

		this.instanceId = instanceId;
		return this;

	}

	public ItemBuilder addCreationUserId(Integer userId) {

		this.creationUserId = userId;
		return this;

	}

	public ItemBuilder addDateCreated(Timestamp date) {

		this.dateCreated = date;
		return this;

	}

	public ItemBuilder addDateModified(Timestamp date) {

		this.dateModified = date;
		return this;

	}

	public Item build() {

		return new Item(itemName, categoryId, instanceId, creationUserId, dateCreated, dateModified);

	}

}