text:
import { shallowMount } from '@vue/test-utils'
import BDropdown from '@components/dropdown/Dropdown'

describe('BDropdown', () => {
    const val1 = 'val1'
    const val2 = 'val2'
    let wrapper

    beforeEach(() => {
        wrapper = shallowMount(BDropdown, {
            slots: {
                trigger: '<button class="trigger">trigger</button>'
            }
        })
    })

    it('is called', () => {
        expect(wrapper.name()).toBe('BDropdown')
        expect(wrapper.isVueInstance()).toBeTruthy()
    })

    it('render correctly', () => {
        expect(wrapper.html()).toMatchSnapshot()
    })

    it('manage props validator', () => {
        const position = wrapper.vm.$options.props.position

        expect(position.type).toBe(String)
        expect(position.validator && position.validator('is-top')).toBeFalsy()
        expect(position.validator && position.validator('is-top-left')).toBeTruthy()
        expect(position.validator && position.validator('is-top-right')).toBeTruthy()
        expect(position.validator && position.validator('is-bottom-left')).toBeTruthy()
    })

    it('react accordingly when changing v-model', () => {
        const value = 'value'
        wrapper.setProps({ value })
        expect(wrapper.vm.selected).toBe(value)
    })

    it('emit activity when it changes', async () => {
        wrapper.vm.updateAppendToBody = jest.fn(() => wrapper.vm.updateAppendToBody)
        wrapper.setProps({ appendToBody: true })

        wrapper.vm.isActive = true
        expect(wrapper.emitted()['active-change']).toBeTruthy()

        await wrapper.vm.$nextTick()
        expect(wrapper.vm.updateAppendToBody).toHaveBeenCalled()
    })

    it('react accordingly on mouse over', () => {
        const trigger = wrapper.find({ ref: 'trigger' })
        trigger.trigger('mouseenter')
        expect(wrapper.vm.isHoverable).toBeFalsy()

        wrapper.setProps({ triggers: ['hover'] })
        trigger.trigger('mouseenter')
        expect(wrapper.vm.isHoverable).toBeTruthy()
    })

    it('react accordingly when new item is selected', () => {
        jest.useFakeTimers()

        wrapper.vm.selectItem(val1)
        expect(wrapper.emitted().input).toHaveLength(1)
        expect(wrapper.emitted().input[0]).toEqual([val1])
        expect(wrapper.emitted().change).toHaveLength(1)
        expect(wrapper.emitted().change[0]).toEqual([val1])

        wrapper.setProps({
            hoverable: true,
            closeOnClick: true
        })

        wrapper.vm.selectItem(val2)
        expect(wrapper.emitted().input).toHaveLength(2)
        expect(wrapper.emitted().input[1]).toEqual([val2])
        expect(wrapper.emitted().change).toHaveLength(2)
        expect(wrapper.emitted().change[1]).toEqual([val2])

        expect(wrapper.vm.isHoverable).toBeFalsy()
    })

    it('react accordingly when same item is selected', () => {
        jest.useFakeTimers()

        // will emit only input event
        wrapper.setProps({ value: val1 })
        wrapper.vm.selectItem(val1)
        expect(wrapper.emitted().input).toHaveLength(1)
        expect(wrapper.emitted().input[0]).toEqual([val1])
        expect(wrapper.emitted().change).toBeUndefined()
    })

    it('react accordingly when an item is selected with multiple prop', () => {
        jest.useFakeTimers()
        wrapper.setProps({
            multiple: true
        })
        wrapper.vm.selected = null

        // no initial value, will return an array with the only selected option
        wrapper.vm.selectItem(val1)
        expect(wrapper.emitted().input).toHaveLength(1)
        expect(wrapper.emitted().input[0]).toEqual([[val1]])
        expect(wrapper.emitted().change).toHaveLength(1)
        expect(wrapper.emitted().change[0]).toEqual([[val1]])

        // will return an array with the new value appended
        wrapper.setProps({ value: [val1] })
        wrapper.vm.selectItem(val2)
        expect(wrapper.emitted().input).toHaveLength(2)
        expect(wrapper.emitted().input[1]).toEqual([[val1, val2]])
        expect(wrapper.emitted().change).toHaveLength(2)
        expect(wrapper.emitted().change[1]).toEqual([[val1, val2]])

        // will remove the last selection since it was part of the list
        wrapper.setProps({ value: [val1, val2] })
        wrapper.vm.selectItem(val2)
        expect(wrapper.emitted().input).toHaveLength(3)
        expect(wrapper.emitted().input[2]).toEqual([[val1]])
        expect(wrapper.emitted().change).toHaveLength(3)
        expect(wrapper.emitted().change[2]).toEqual([[val1]])
    })

    it('manage the whitelisted items accordingly', () => {
        let el = wrapper.vm.$refs.dropdownMenu
        expect(wrapper.vm.isInWhiteList(el)).toBeTruthy()

        el = wrapper.vm.$refs.dropdownMenu.querySelector('.dropdown-content')
        expect(wrapper.vm.isInWhiteList(el)).toBeTruthy()

        wrapper.vm.$refs.dropdownMenu = undefined

        el = wrapper.vm.$refs.trigger
        expect(wrapper.vm.isInWhiteList(el)).toBeTruthy()

        el = wrapper.vm.$refs.trigger.querySelector('.trigger')
        expect(wrapper.vm.isInWhiteList(el)).toBeTruthy()

        wrapper.vm.$refs.trigger = undefined

        el = document.createElement('div')
        expect(wrapper.vm.isInWhiteList(el)).toBeFalsy()
    })

    it('manage clicking outside accordingly', () => {
        const el = document.createElement('div')
        const event = {
            target: el
        }

        wrapper.vm.isActive = true
        wrapper.vm.clickedOutside(event)
        expect(wrapper.vm.isActive).toBeFalsy()

        wrapper.vm.isActive = true
        wrapper.vm.clickedOutside({
            target: wrapper.vm.$refs.trigger
        })
        expect(wrapper.vm.isActive).toBeTruthy()

        wrapper.vm.isActive = true
        wrapper.setProps({ inline: true })
        wrapper.vm.clickedOutside(event)
        expect(wrapper.vm.isActive).toBeTruthy()

        wrapper.vm.isActive = true
        wrapper.setProps({ canClose: false })
        wrapper.vm.clickedOutside(event)
        expect(wrapper.vm.isActive).toBeTruthy()
    })

    it('close on escape', () => {
        wrapper.vm.isActive = true
        const event = new KeyboardEvent('keyup', { 'key': 'Escape' })
        wrapper.vm.keyPress({})
        wrapper.vm.keyPress(event)
        expect(wrapper.vm.isActive).toBeFalsy()

        wrapper.vm.isActive = true
        wrapper.setProps({ canClose: ['click'] })
        wrapper.vm.keyPress(event)
        expect(wrapper.vm.isActive).toBeTruthy()
    })

    it('manage toggle function accordingly', (done) => {
        wrapper.vm.isActive = true
        wrapper.setProps({ disabled: true })
        wrapper.vm.toggle()
        expect(wrapper.vm.isActive).toBeTruthy()

        wrapper.setProps({ disabled: false })
        wrapper.vm.toggle()
        expect(wrapper.vm.isActive).toBeFalsy()

        jest.useFakeTimers()
        wrapper.vm.isActive = false
        wrapper.vm.toggle()
        wrapper.vm.$nextTick(() => {
            expect(setTimeout).toHaveBeenCalled()
            jest.advanceTimersByTime(1)
            expect(wrapper.vm.isActive).toBeTruthy()
            done()
        })
    })

    it('reset events before destroy', () => {
        document.removeEventListener = jest.fn()

        wrapper.destroy()

        expect(document.removeEventListener).toBeCalledWith('click', expect.any(Function))
        expect(document.removeEventListener).toBeCalledWith('keyup', expect.any(Function))
    })
})


text:
<?php

Route::group(['before' => 'ulogin-guest'], function()
{
    $uloginUri  = Config::get('ulogin-laravel::config.redirect_uri');
    $routeName  = 'ulogin-laravel.ulogin';
    $controller = 'Franzose\UloginLaravel\Controllers\AuthController';

    Route::get($uloginUri, [
        'as'   => $routeName,
        'uses' => $controller . '@getLogin'
    ]);

    Route::post($uloginUri, [
        'as'   => $routeName,
        'uses' => $controller . '@postLogin'
    ]);
});

redpajama_set_name: RedPajamaGithub


text:
<?php namespace October\Rain\Support\Facades;

use October\Rain\Support\Facade;

class Schema extends Facade
{
    /**
     * Get a schema builder instance for a connection.
     *
     * @param  string  $name
     * @return \October\Rain\Database\Schema\Builder
     */
    public static function connection($name)
    {
        $builder = static::$app['db']->connection($name)->getSchemaBuilder();

        static::$app['events']->fire('db.schema.getBuilder', [$builder]);

        return $builder;
    }

    /**
     * Get a schema builder instance for the default connection.
     *
     * @return \October\Rain\Database\Schema\Builder
     */
    protected static function getFacadeAccessor()
    {
        $builder = static::$app['db']->connection()->getSchemaBuilder();

        static::$app['events']->fire('db.schema.getBuilder', [$builder]);

        return $builder;
    }
}


text:
/**
 * @file addRole command
 * @author Sankarsan Kampa (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

exports.exec = async (Bastion, message, args) => {
  if (!args.length) {
    return Bastion.emit('commandUsage', message, this.help);
  }

  let user = message.mentions.users.first();
  let role;
  if (!user) {
    user = message.author;
    role = args.join(' ');
  }
  else {
    role = args.slice(1).join(' ');
  }
  role = message.guild.roles.find(r => r.name === role);
  if (role && message.author.id !== message.guild.ownerID && message.member.highestRole.comparePositionTo(role) <= 0) return Bastion.log.info(Bastion.i18n.error(message.guild.language, 'lowerRole'));
  else if (!role) {
    return Bastion.emit('error', '', Bastion.i18n.error(message.guild.language, 'roleNotFound'), message.channel);
  }

  let member = await Bastion.utils.fetchMember(message.guild, user.id);
  member.addRole(role);

  await message.channel.send({
    embed: {
      color: Bastion.colors.GREEN,
      description: Bastion.i18n.info(message.guild.language, 'addRole', message.author.tag, role.name, user.tag)
    }
  }).catch(e => {
    Bastion.log.error(e);
  });

  let reason = 'No reason given';

  Bastion.emit('moderationLog', message, this.help.name, user, reason, {
    role: role
  });
};

exports.config = {
  aliases: [ 'addr' ],
  enabled: true
};

exports.help = {
  name: 'addRole',
  description: 'Adds the specified role to a specified user of your Discord server.',
  botPermission: 'MANAGE_ROLES',
  userTextPermission: 'MANAGE_ROLES',
  userVoicePermission: '',
  usage: 'addRole [@user-mention] <Role Name>',
  example: [ 'addRole @user#001 Role Name', 'addRole Role Name' ]
};


text:
from django import template

register = template.Library()

@register.inclusion_tag("rg_number.html")
def redgreen(collection):
	""" {% redgreen collection %}
		render collection.value with a red or green text,
		depending on parameters, optionally with a link.

		collection.value value to be rendered
		collection.treshold : highest level for which one color apply, default 0.
				if callable threshold(value, collection) return True if the level is above threshold
		collection.red_is_low: Default False. If True red is used for values below
				or at the threshold, green for the rest, and vice versa if False
		collection.color: True if colors are to be displayed
		collection.link: If present contain a URL to be linked to
		"""
	if not collection:
		return {"valid":False}

	if not isinstance(collection,dict):
		return {"valid":True, "text":collection, "show_red":False, "debug":collection, "color":False}

	if not collection or "value" not in collection:
		return {"valid":False}

	value = collection["value"]
	treshold = collection.get("treshold", 0)
	low_is_red = collection.get("red_is_low", False)
	color = collection.get("color", True)

	if callable(treshold):
		above_treshold = treshold(value, collection)
	else:
		above_treshold = value > treshold

	if above_treshold:
		show_red = not low_is_red
	else:
		show_red = low_is_red

	args = {
			"valid":True,
			"text":value,
			"show_red":show_red,
			"color":color,
			"debug":(value, low_is_red, above_treshold, collection.get("values",None))
			}
	if "link" in collection:
		args["link"] = collection["link"];

	return args

@register.inclusion_tag("color_value.html")
def color_value(collection):
	""" {% color_value collection %}
		render collection.value with the assigned color
		depending on parameters, optionally with a link.

		collection.value value to be rendered
		collection.textcolor :  The color to be used
				if callable textcolor_fun(value, collection) return the text and color based on the value as (text, color)
		collection.link: If present contain a URL to be linked to
		"""

	if not collection:
		return {"valid":False}

	if not isinstance(collection,dict):
		return {"valid":True, "text":collection, "color":None, "debug":collection}

	if not collection or "value" not in collection:
		return {"valid":False}

	value = collection["value"]
	color = collection.get("textcolor", None)

	if callable(color):
		(value, color) = color(value, collection)

	args = {
			"valid":True,
			"text":value,
			"color":color,
			"debug":(value, color, collection.get("color", None), collection.get("values",None))
			}
	if "link" in collection:
		args["link"] = collection["link"];

	return args


text:
#include "jippi/config.hpp"

#include <libconfig.h++>    // support for configuration files
#include <unistd.h>         // stat
#include <algorithm>        // for_each

using namespace jippi;

Config::Config(const std::string configuration_file, const std::string configuration_path)
{
    this->configuration_file = configuration_path + configuration_file;
    this->configuration = new libconfig::Config;
    if (!foundConfigurationFile()) {
        storeDefaultConfigurationInFile();
    }
}

Config::~Config()
{
    delete this->configuration;
}

bool Config::foundConfigurationFile()
{
    return access(configuration_file.c_str(), 0) == F_OK;
}

void Config::storeDefaultConfigurationInFile()
{
    // Add all values from default Jira configuration
    StorePropertyFunction *store_property = new StorePropertyFunction(this, JIRA_GROUP);
    std::for_each(DEFAULT_JIRA_CONFIGURATION.begin(), DEFAULT_JIRA_CONFIGURATION.end(), *store_property);
    delete store_property;
    // Write configuration to the file
    writeConfigurationToFile();
}

void Config::readConfigurationFromFile()
{
    try {
        configuration->readFile(configuration_file.c_str());
    } catch(const libconfig::FileIOException &fioex) {
        std::cerr << "I/O error while reading configuration file " << configuration_file << std::endl;
        std::cerr << fioex.what();
    }
}

void Config::writeConfigurationToFile()
{
    try {
        if (configuration != NULL) {
            configuration->writeFile(configuration_file.c_str());
        }
    } catch (const libconfig::FileIOException &fioex) {
        std::cout << "I/O error while writing configuration file " << configuration_file << std::endl;
        std::cout << fioex.what() << std::endl;
    }
}

std::string Config::getProperty(const std::string &group, const std::string& key)
{
    libconfig::Setting &root = configuration->getRoot();
    if (root.exists(group)) {
        libconfig::Setting &config_group = root[group];
        if (config_group.exists(key)) {
            return config_group[key];
        }
    }
    return NULL;
}

void Config::storeProperty(const std::string &group, const std::string &key, const std::string &value)
{
    libconfig::Setting &root = configuration->getRoot();
    // Check if there is property with given name. If not then create one.
    if (!root.exists(group)) {
        root.add(group, libconfig::Setting::TypeGroup);
    }

    libconfig::Setting &config_group = root[group];
    if (!config_group.exists(key)) {
        config_group.add(key, libconfig::Setting::TypeString) = value;
    } else {
        config_group[key] = value;
    }
}

// Some getters
std::string Config::getFileName()
{
    return this->configuration_file;
}


text:
/**
 * Naive bayed classifier.
 *
 * Examples:
 *
 *  var bayes = classifier();
 *  bayes.train('weather is cold', 'weather');
 *  bayer.guess('what is the weathr?');
 *
 * @return {Object}
 * @api public
 */

module.exports = function() {

	/**
	 * Classifier instance.
	 */

  var that = {};

  /**
   * Number of trainings.
   */

  var total = 0;

  /**
   * Number of trainings
   * by category.
   */

  var categories = {};

  /**
   * Uniq array of words used
   * during the training.
   */

  var dictionary = [];

  /**
   * Number of training by
   * category.
   */

  var count = {};

  /**
   * Frequency of words
   * by category.
   */

  var frequency = {};

  /**
   * Train classifier.
   *
   * Classify array of words with category.
   *
   * @param {Array} arr
   * @param {String} category
   * @api public
   */

  that.train = function(arr, category) {
  	var l = arr.length;
  	update(category, l);
  	while(l--) {
  		var word = arr[l];
  		frequency[category][word] = ++frequency[category][word] || 1;
  		if(~!dictionary.indexOf(word)) dictionary.push(word);
  	}
  	return that;
  };

  /**
   * Probabily a word belongs to
   * a category.
   *
   * @param {String} word
   * @param {String} category
   * @api public
   */

  that.probability = function(word, category) {
  	return ((frequency[category][word] || 0) + 1) / (count[category] + dictionary.length);
  };

  /**
   * Guess category.
   *
   * Return a uniq category for
   * a list of tokens.
   *
   * @param {String}
   * @api public
   */

  that.guess = function(arr) {
  	var max = -Infinity;
  	var tokens = frequence(arr);
  	var choice;
  	for(var category in categories) {
  		var prob = Math.log(count[category] / total);
  		for(var token in tokens) {
  			prob += tokens[token] * Math.log(that.probability(token, category));
  		}
  		if (prob > max) {
  		   max = prob
  		   choice = category
  		 }
  	}
  	return choice;
  };

  /**
   * Return the frequencies of
   * a word in a sentence.
   * @note could be used in classify
   *
   * @param {Array} words
   * @param {Object}
   * @api private
   */

  function frequence(words) {
  	var obj = {};
  	for(var l = words.length; l--;) {
  		obj[words[l]] = ++obj[words[l]] || 1;
  	}
  	return obj;
  }

  /**
   * Update/initialize classifier
   * statistics.
   *
   * @param {String} category
   * @param {Number} length (number of words to classify)
   * @api private
   */

  function update(category, length) {
  	count[category] = (count[category] || 0) + length;
  	frequency[category] = frequency[category] || {};
  	categories[category] = ++categories[category] || 1;
  	total++;
  }

  return that;
};


text:
Recommendations AI (Beta) client library.

Note that we now highly recommend new customers to use Retail API, which incorporates the GA version of the Recommendations AI funtionalities. To enable Retail API, please visit https://console.cloud.google.com/apis/library/retail.googleapis.com. The Recommendations AI service enables customers to build end-to-end personalized recommendation systems without requiring a high level of expertise in machine learning, recommendation system, or Google Cloud.

## Installation

Install this package from [Hex](https://hex.pm) by adding
`google_api_recommendation_engine` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [{:google_api_recommendation_engine, "~> 0.4"}]
end
```

## For more information

Product documentation is available at [https://cloud.google.com/recommendations-ai/docs](https://cloud.google.com/recommendations-ai/docs).

Library reference documentation is published on Hexdocs at
[https://hexdocs.pm/google_api_recommendation_engine](https://hexdocs.pm/google_api_recommendation_engine).


text:
<?php

namespace Drupal\Tests\options\Kernel\Views;

use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;

/**
 * Test to ensure views data is properly created for the Options module.
 *
 * @group views
 */
class ViewsDataTest extends OptionsTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'options',
    'options_test',
    'entity_test',
    'views',
  ];

  /**
   * The field storage.
   *
   * @var \Drupal\Core\Field\FieldStorageDefinitionInterface
   */
  protected $fieldStorage;

  /**
   * @var int
   */
  protected $field;

  /**
   * {@inheritdoc}
   */
  protected function setUp($import_test_views = TRUE): void {
    parent::setUp();

    $this->installEntitySchema('entity_test');
    $field_name = 'test_options';
    $this->fieldStorage = FieldStorageConfig::create([
      'field_name' => $field_name,
      'entity_type' => 'entity_test',
      'type' => 'list_string',
      'cardinality' => 1,
      'settings' => [
        'allowed_values_function' => 'options_test_dynamic_values_callback',
      ],
    ]);
    $this->fieldStorage->save();

    $this->field = FieldConfig::create([
      'field_name' => $field_name,
      'entity_type' => 'entity_test',
      'bundle' => 'entity_test',
      'required' => TRUE,
    ])->save();
  }

  /**
   * Tests the option module's implementation of hook_field_views_data().
   */
  public function testOptionsFieldViewsData() {
    $field_data = \Drupal::service('views.views_data')->get('entity_test__test_options');

    // Check that the options module has properly overridden default views data.
    $test_options_field = $field_data['test_options_value'];
    $this->assertEquals('string_list_field', $test_options_field['argument']['id'], 'Argument handler is properly set for fields with allowed value callbacks.');
    $this->assertEquals('list_field', $test_options_field['filter']['id'], 'Filter handler is properly set for fields with allowed value callbacks.');
  }

}


text:
package org.zalando.opentracing.flowid;

import io.opentracing.Span;

import java.util.Optional;
import java.util.function.UnaryOperator;

interface Extractor {

    default Optional<FlowId> extract(final Span span) {
        return extract(span, unused -> null);
    }

    Optional<FlowId> extract(Span span, UnaryOperator<String> reader);

}


text:
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFramework.SerializableProperty;

namespace AssemblyToProcess
{
    /// <summary>
    /// Simple repository implementation.
    /// </summary>
    public static class Repository
    {
        /// <summary>
        /// Clears database
        /// </summary>
        public static void ClearOrders()
        {
            using (var ctx = new DatabaseContext())
            {
                ctx.Orders.RemoveRange(ctx.Orders.ToList());
                ctx.SaveChanges();
            }
        }

        /// <summary>
        /// Adds order to database
        /// </summary>
        public static void AddOrder(PurchaseOrder order)
        {
            using (var ctx = new DatabaseContext())
            {
                ctx.Orders.Add(order);
                ctx.SaveChanges();
            }
        }

        /// <summary>
        /// Gets all orders from database
        /// </summary>
        /// <returns></returns>
        public static List<PurchaseOrder> GetOrders()
        {
            using (var ctx = new DatabaseContext())
            {
                return ctx.Orders.ToList();
            }
        }
    }
}


text:
# A0139923X
###### /java/seedu/Tdoo/commons/util/StringUtil.java
``` java
	public static boolean equalsIgnoreCase(String source, String query) {
		String parsedQuery = query.replace("name/", "").trim();
		String finalParsedQuery = parsedQuery.replace("date/", "").trim();
		List<String> strings = Arrays.asList(source.toLowerCase());
		return strings.stream().filter(s -> s.contains(finalParsedQuery.toLowerCase())).count() > 0;
	}

	/**
	 * Returns a detailed message of the t, including the stack trace.
	 */
	public static String getDetails(Throwable t) {
		assert t != null;
		StringWriter sw = new StringWriter();
		t.printStackTrace(new PrintWriter(sw));
		return t.getMessage() + "\n" + sw.toString();
	}

	/**
	 * Returns true if s represents an unsigned integer e.g. 1, 2, 3, ... <br>
	 * Will return false for null, empty string, "-1", "0", "+1", and " 2 "
	 * (untrimmed) "3 0" (contains whitespace).
	 *
	 * @param s
	 *            Should be trimmed.
	 */
```
###### /java/seedu/Tdoo/commons/util/StringUtil.java
``` java
	public static boolean isUnsignedInteger(String s) {
		return s != null && s.matches("^\\d+$");
	}

	/**
	 * Returns true if s represents an unsigned string e.g. A, AB, ABC, ... <br>
	 * Will return false for null, empty string, numbers, " ABC " (untrimmed) "A
	 * B" (contains whitespace).
	 *
	 * @param s
	 *            Should be trimmed.
	 */
```
###### /java/seedu/Tdoo/commons/util/StringUtil.java
``` java
	public static boolean isUnsignedString(String s) {
		return s != null && s.matches("^[a-zA-Z]+$");
	}

```
###### /java/seedu/Tdoo/commons/util/StringUtil.java
``` java
	public static boolean isUnsignedDate(String s) {
		return s != null && s.matches("^(\\d{2}-\\d{2}-\\d{4})$");
	}
}
```
###### /java/seedu/Tdoo/logic/commands/FindCommand.java
``` java
	public FindCommand(String keywords, String dataType) {
		Set<String> keyword2 = new HashSet<String>();
		keyword2.add(keywords);
		this.keywords = keyword2;
		this.dataType = dataType;
	}

	/*
	 * If keyword cannot be found, the list will remain unchange.
	 */
```
###### /java/seedu/Tdoo/logic/commands/FindCommand.java
``` java
	@Override
	public CommandResult execute() {
		CommandResult result = new CommandResult(INVALID_DATA_TYPE_MESSAGE);
		;
		switch (dataType) {
		case "todo":
			model.updateFilteredTodoList(keywords);
			result = new CommandResult(getMessageFortaskListShownSummary(model.getFilteredTodoList().size()));
			if (model.getFilteredTodoList().size() == 0) {
				model.updateFilteredTodoListToShowAll();
			}
			break;
		case "event":
			model.updateFilteredEventList(keywords);
			result = new CommandResult(getMessageFortaskListShownSummary(model.getFilteredEventList().size()));
			if (model.getFilteredEventList().size() == 0) {
				model.updateFilteredEventListToShowAll();
			}
			break;
		case "deadline":
			model.updateFilteredDeadlineList(keywords);
			result = new CommandResult(getMessageFortaskListShownSummary(model.getFilteredDeadlineList().size()));
			if (model.getFilteredDeadlineList().size() == 0) {
				model.updateFilteredDeadlineListToShowAll();
			}
			break;
		case "all":
			model.updateFilteredTodoList(keywords);
			model.updateFilteredEventList(keywords);
			model.updateFilteredDeadlineList(keywords);
			int todoSize = model.getFilteredTodoList().size();
			int eventSize = model.getFilteredEventList().size();
			int deadlineSize = model.getFilteredDeadlineList().size();
			int totalSize = todoSize + eventSize + deadlineSize;
			result = new CommandResult(getMessageFortaskListShownSummary(totalSize));
			if (totalSize == 0) {
				model.updateFilteredTodoListToShowAll();
				model.updateFilteredEventListToShowAll();
				model.updateFilteredDeadlineListToShowAll();
			}
		}
		return result;
	}
}
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private static final Pattern task_DATA_ARGS_FORMAT = // '/' forward slashes
															// are reserved for
															// delimiter
															// prefixes
			Pattern.compile(
					"(?<name>.+)" + "( from/(?<date>[^/]+))?" + "( to/(?<endDate>[^/]+))?" + " p/(?<priority>[^/]+)");

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private static final Pattern event_DATA_ARGS_FORMAT = // '/' forward slashes
															// are reserved for
															// delimiter
															// prefixes
			Pattern.compile("(?<name>.+)" + " from/(?<date>[^/]+)" + " to/(?<endDate>[^/]+)" + " at/(?<startTime>[^/]+)"
					+ " to/(?<endTime>[^/]+)");

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private static final Pattern deadline_DATA_ARGS_FORMAT = // '/' forward
																// slashes are
																// reserved for
																// delimiter
																// prefixes
			Pattern.compile("(?<name>.+)" + " on/(?<date>[^/]+)" + " at/(?<endTime>[^/]+)");

	/*
	 * Edit Command,task,event,deadline pattern
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private static final Pattern task_EDIT_ARGS_FORMAT = // '/' forward slashes
															// are reserved for
															// delimiter
															// prefixes
			Pattern.compile("(?<dataType>.+)" + " (?<targetIndex>.+)" + " name/(?<name>.+)" + "( from/(?<date>[^/]+))?"
					+ "( to/(?<endDate>[^/]+))?" + " p/(?<priority>[^/]+)");

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private static final Pattern event_EDIT_ARGS_FORMAT = // '/' forward slashes
															// are reserved for
															// delimiter
															// prefixes
			Pattern.compile("(?<dataType>.+)" + " (?<targetIndex>.+)" + " name/(?<name>.+)" + " from/(?<date>[^/]+)"
					+ " to/(?<endDate>[^/]+)" + " at/(?<startTime>[^/]+)" + " to/(?<endTime>[^/]+)");

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private static final Pattern deadline_EDIT_ARGS_FORMAT = // '/' forward
																// slashes are
																// reserved for
																// delimiter
																// prefixes
			Pattern.compile("(?<dataType>.+)" + " (?<targetIndex>.+)" + " name/(?<name>.+)" + " on/(?<date>[^/]+)"
					+ " at/(?<endTime>[^/]+)");

	public Parser() {
	}

	/**
	 * Parses user input into command for execution.
	 *
	 * @param userInput
	 *            full user input string
	 * @return the command based on the user input
	 */
	public Command parseCommand(String userInput) {

		final Matcher matcher = BASIC_COMMAND_FORMAT.matcher(userInput.trim());
		if (!matcher.matches()) {
			return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, HelpCommand.MESSAGE_USAGE));
		}

		final String commandWord = matcher.group("commandWord");
		final String arguments = matcher.group("arguments");
		switch (commandWord) {

		case AddCommand.COMMAND_WORD:
			return prepareAdd(arguments);

		case DeleteCommand.COMMAND_WORD:
			return prepareDelete(arguments);

		case EditCommand.COMMAND_WORD:
			return prepareEdit(arguments);

		case DoneCommand.COMMAND_WORD:
			return prepareDone(arguments);

		case UndoneCommand.COMMAND_WORD:
			return prepareUndone(arguments);

		case ClearCommand.COMMAND_WORD:
			return prepareClear(arguments);

		case ClearDoneCommand.COMMAND_WORD:
			return prepareClearDone(arguments);

		case FindCommand.COMMAND_WORD:
			return prepareFind(arguments);

		case ListCommand.COMMAND_WORD:
			return prepareList(arguments);

		case ExitCommand.COMMAND_WORD:
			return new ExitCommand();

		case HelpCommand.COMMAND_WORD:
			return new HelpCommand();

		case StorageCommand.COMMAND_WORD:
			return new StorageCommand(arguments);

		case UndoCommand.COMMAND_WORD:
			return new UndoCommand();

		default:
			return new IncorrectCommand(MESSAGE_UNKNOWN_COMMAND);
		}
	}

	/**
	 * Parses arguments in the context of the add task command.
	 *
	 * @param args
	 *            full command args string
	 * @return the prepared command
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private Command prepareAdd(String args) {
		final Matcher matcher_Task = task_DATA_ARGS_FORMAT.matcher(args.trim());
		final Matcher matcher_Event = event_DATA_ARGS_FORMAT.matcher(args.trim());
		final Matcher matcher_Deadline = deadline_DATA_ARGS_FORMAT.matcher(args.trim());
		// Validate arg string format
		/*
		 * Check if input matches task, event or deadline
		 */
		try {
			if (matcher_Task.matches()) {
				return addTodo(matcher_Task);
			} else if (matcher_Event.matches()) {
				return addEvent(matcher_Event);
			} else if (matcher_Deadline.matches()) {
				return addDeadline(matcher_Deadline);
			} else {
				return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE));
			}
		} catch (IllegalValueException ive) {
			return new IncorrectCommand(ive.getMessage());
		}
	}

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private AddCommand addTodo(Matcher matcher_Task) throws IllegalValueException {
		return new AddCommand(matcher_Task.group("name").trim(), isInputPresent(matcher_Task.group("date"), 1).trim(),
				isInputPresent(matcher_Task.group("endDate"), 2).trim(), matcher_Task.group("priority").trim());
	}

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private AddCommand addEvent(Matcher matcher_Event) throws IllegalValueException {
		return new AddCommand(matcher_Event.group("name").trim(), matcher_Event.group("date").trim(),
				isInputPresent(matcher_Event.group("endDate"), 2).trim(), matcher_Event.group("startTime").trim(),
				matcher_Event.group("endTime").trim());
	}

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private AddCommand addDeadline(Matcher matcher_Deadline) throws IllegalValueException {
		return new AddCommand(matcher_Deadline.group("name").trim(), matcher_Deadline.group("date").trim(),
				matcher_Deadline.group("endTime").trim());
	}

	/**
	 * Parses arguments in the context of the delete task command.
	 *
	 * @param args
	 *            full command args string
	 * @return the prepared command
	 */
	private Command prepareDelete(String args) {
		Optional<String> dataType = parseDataType(args);
		Optional<Integer> index = parseIndex(args);
		if (!dataType.isPresent() || !((dataType.get().equals("todo")) || (dataType.get().equals("event"))
				|| (dataType.get().equals("deadline"))) || !index.isPresent()) {
			return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE));
		}

		return new DeleteCommand(dataType.get(), index.get());
	}

	/**
	 * Parses arguments in the context of the done task command.
	 *
	 * @param args
	 *            full command args string
	 * @return the prepared command
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private Command prepareUndone(String args) {
		Optional<String> dataType = parseDataType(args);
		Optional<Integer> index = parseIndex(args);
		if (!dataType.isPresent() || !((dataType.get().equals("todo")) || (dataType.get().equals("event"))
				|| (dataType.get().equals("deadline"))) || !index.isPresent()) {
			return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, UndoneCommand.MESSAGE_USAGE));
		}

		return new UndoneCommand(dataType.get(), index.get());
	}

	/**
	 * Parses arguments in the context of the list command.
	 *
	 * @param args
	 *            full command args string
	 * @return the prepared command
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private Command prepareEdit(String args) {
		final Matcher matcher_Task = task_EDIT_ARGS_FORMAT.matcher(args.trim());
		final Matcher matcher_Event = event_EDIT_ARGS_FORMAT.matcher(args.trim());
		final Matcher matcher_Deadline = deadline_EDIT_ARGS_FORMAT.matcher(args.trim());
		Optional<String> dataType = parseDataType(args);

		if (!dataType.isPresent()) {
			return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE));
		}

		try {
			// check user input to edit todolist
			if (dataType.get().equals("todo")) {
				if (matcher_Task.matches()) {
					return editTodo(matcher_Task, dataType);
				} else if (matcher_Event.matches()) {
					return editEvent(matcher_Event, dataType);
				} else if (matcher_Deadline.matches()) {
					return editDeadline(matcher_Deadline, dataType);
				} else {
					return new IncorrectCommand(
							String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE));
				}
				// check user input to edit eventlist
			} else if (dataType.get().equals("event")) {
				if (matcher_Task.matches()) {
					return editTodo(matcher_Task, dataType);
				} else if (matcher_Event.matches()) {
					return editEvent(matcher_Event, dataType);
				} else if (matcher_Deadline.matches()) {
					return editDeadline(matcher_Deadline, dataType);
				} else {
					return new IncorrectCommand(
							String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE));
				}

				// check user input to edit deadlinelist
			} else if (dataType.get().equals("deadline")) {
				if (matcher_Task.matches()) {
					return editTodo(matcher_Task, dataType);
				} else if (matcher_Event.matches()) {
					return editEvent(matcher_Event, dataType);
				} else if (matcher_Deadline.matches()) {
					return editDeadline(matcher_Deadline, dataType);
				} else {
					return new IncorrectCommand(
							String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE));
				}
			} else {
				return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE));
			}
		} catch (IllegalValueException ive) {
			return new IncorrectCommand(ive.getMessage());
		}
	}

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private EditCommand editTodo(Matcher matcher_Task, Optional<String> dataType) throws IllegalValueException {
		return new EditCommand(matcher_Task.group("name").trim(), isInputPresent(matcher_Task.group("date"), 1).trim(),
				isInputPresent(matcher_Task.group("endDate"), 2).trim(), matcher_Task.group("priority").trim(),
				Integer.parseInt(matcher_Task.group("targetIndex")), dataType.get().trim());

	}

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private EditCommand editEvent(Matcher matcher_Event, Optional<String> dataType) throws IllegalValueException {
		return new EditCommand(matcher_Event.group("name").trim(), matcher_Event.group("date").trim(),
				isInputPresent(matcher_Event.group("endDate"), 2).trim(), matcher_Event.group("startTime").trim(),
				matcher_Event.group("endTime").trim(), Integer.parseInt(matcher_Event.group("targetIndex")),
				dataType.get().trim());
	}

```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private EditCommand editDeadline(Matcher matcher_Deadline, Optional<String> dataType) throws IllegalValueException {
		return new EditCommand(matcher_Deadline.group("name").trim(), matcher_Deadline.group("date").trim(),
				matcher_Deadline.group("endTime").trim(), Integer.parseInt(matcher_Deadline.group("targetIndex")),
				dataType.get().trim());

	}

	/**
	 * Returns the specified dataType in the {@code command} Returns an
	 * {@code Optional.empty()} otherwise.
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private Optional<String> parseDataType(String command) {
		final Matcher matcher = task_DELETE_ARGS_FORMAT.matcher(command.trim());
		if (!matcher.matches()) {
			return Optional.empty();
		}

		String dataType = matcher.group("dataType");
		if (!StringUtil.isUnsignedString(dataType)) {
			return Optional.empty();
		}
		return Optional.of(dataType);
	}

	/**
	 * Parses arguments in the context of the find task command.
	 *
	 * @param args
	 *            full command args string
	 * @return the prepared command
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private Command prepareFind(String args) {
		String[] keywordArr = args.trim().split(" ", 2);
		if (keywordArr[0].equals("todo") || keywordArr[0].equals("event") || keywordArr[0].equals("deadline")
				|| keywordArr[0].equals("all")) {
			return new FindCommand(keywordArr[1], keywordArr[0]);
		} else {
			return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE));
		}
	}

	/*
	 * Check whether the attribute is set
	 */
```
###### /java/seedu/Tdoo/logic/parser/Parser.java
``` java
	private String isInputPresent(String input, int num) {
		switch (num) {
		case 1:
			if (input == null) {
				input = "No Start Date";
			}
			break;
		case 2:
			if (input == null) {
				input = "No End Date";
			}
			break;
		default:
			input = input;
		}
		return input;
	}
}
```
###### /java/seedu/Tdoo/model/ModelManager.java
``` java
	public synchronized void editTask(ReadOnlyTask target, String dataType, Task task, int targetIndex)
			throws IllegalValueException, TaskNotFoundException {

	    String type = "";
		/*
		 * Scenario: User wants to edit todo to change to event or deadline User
		 * enters edit todo 1 n/test d/01-01-2016 e/1000 This will remove index
		 * 1 of todolist and add into deadlinelist
		 *
		 * During edit process, example: edit todo 1 with parameters of deadline
		 * todolist will remove the task index 1 and deadlinelist will add the
		 * edited task
		 */
		if (task instanceof Todo) {
			if (dataType.equals("todo")) {
				todoList.addTaskWithIndex(task , targetIndex);
				todoList.removeTask(target);
				todoList.sortData();
			} else if (dataType.equals("event")) {
				todoList.addTaskWithIndex(task , targetIndex);
				todoList.sortData();
                type = "todo";
				eventList.removeTask(target);
			} else if (dataType.equals("deadline")) {
				todoList.addTaskWithIndex(task , targetIndex);
				todoList.sortData();
                type = "todo";
				deadlineList.removeTask(target);
			}
			updateFilteredTodoListToShowAll();
			indicateTodoListChanged();
			raise(new JumpTodoListRequestEvent(task));
		} else if (task instanceof Event) {
			if (dataType.equals("todo")) {
				eventList.addTaskWithIndex(task , targetIndex);
				eventList.sortData();
                type = "event";
				todoList.removeTask(target);
			} else if (dataType.equals("event")) {
				eventList.addTaskWithIndex(task , targetIndex);
				eventList.sortData();
				eventList.removeTask(target);
			} else if (dataType.equals("deadline")) {
				eventList.addTaskWithIndex(task , targetIndex);
				eventList.sortData();
                type = "event";
				deadlineList.removeTask(target);
			}
			updateFilteredEventListToShowAll();
			indicateEventListChanged();
			raise(new JumpEventListRequestEvent(task));
		} else if (task instanceof Deadline) {
			if (dataType.equals("todo")) {
				deadlineList.addTaskWithIndex(task , targetIndex);
				deadlineList.sortData();
	            type = "deadline";
				todoList.removeTask(target);
			} else if (dataType.equals("event")) {
				deadlineList.addTaskWithIndex(task , targetIndex);
				deadlineList.sortData();
	            type = "deadline";
				eventList.removeTask(target);
			} else if (dataType.equals("deadline")) {
				deadlineList.addTaskWithIndex(task , targetIndex);
				deadlineList.sortData();
		        deadlineList.removeTask(target);
			}
			updateFilteredDeadlineListToShowAll();
			indicateDeadlineListChanged();
			raise(new JumpDeadlineListRequestEvent(task));
		}
		if(!undoer.undoCommand()) {
			undoer.prepareUndoEdit(target, dataType, task , targetIndex , type);
		}
	}

```
###### /java/seedu/Tdoo/model/ModelManager.java
``` java
	public synchronized void undoneTask(ReadOnlyTask target, String dataType, int undoTarget) throws TaskNotFoundException {
		switch (dataType) {
		case "todo":
			todoList.undoneTask(target);
			indicateTodoListChanged();
			if(!undoer.undoCommand()) {
				undoer.prepareUndoUndone("todo", undoTarget);
			}
		case "event":
			eventList.undoneTask(target);
			indicateEventListChanged();
			if(!undoer.undoCommand()) {
				undoer.prepareUndoUndone("event", undoTarget);
			}
		case "deadline":
			deadlineList.undoneTask(target);
			indicateDeadlineListChanged();
			if(!undoer.undoCommand()) {
				undoer.prepareUndoUndone("deadline", undoTarget);
			}
		}
	}
```
###### /java/seedu/Tdoo/model/ModelManager.java
``` java
	public synchronized void addTaskWithIndex(Task task, int targetIndex) throws IllegalValueException, UniqueTaskList.DuplicatetaskException {
        if (task instanceof Todo) {
            todoList.addTaskWithIndex(task, targetIndex);
            updateFilteredTodoListToShowAll();
            indicateTodoListChanged();
            if(!undoer.undoCommand()) {
            	undoer.prepareUndoAdd(task, "todo");
			}
        } else if (task instanceof Event) {
            eventList.addTaskWithIndex(task, targetIndex);
            updateFilteredEventListToShowAll();
            indicateEventListChanged();
            if(!undoer.undoCommand()) {
            	undoer.prepareUndoAdd(task, "event");
			}
        } else if (task instanceof Deadline) {
            deadlineList.addTaskWithIndex(task, targetIndex);
            updateFilteredDeadlineListToShowAll();
            indicateDeadlineListChanged();
            if(!undoer.undoCommand()) {
            	undoer.prepareUndoAdd(task, "deadline");
			}
        } else {
            throw new IllegalValueException("Invalid data type for add");
        }
    }
```
###### /java/seedu/Tdoo/model/ModelManager.java
``` java
	private class NameQualifier implements Qualifier {
		private Set<String> nameKeyWords;

		NameQualifier(Set<String> nameKeyWords) {
			this.nameKeyWords = nameKeyWords;
		}

		@Override
		public boolean run(ReadOnlyTask task) {
			if (nameKeyWords.toString().contains("date/")) {
				return nameKeyWords.stream()
						.filter(keyword -> StringUtil.equalsIgnoreCase(task.getStartDate().date, keyword)).findAny()
						.isPresent();
			} else {
				return nameKeyWords.stream()
						.filter(keyword -> StringUtil.equalsIgnoreCase(task.getName().name, keyword)).findAny()
						.isPresent();
			}
		}
```
###### /java/seedu/Tdoo/model/task/Deadline.java
``` java
    public boolean checkEndDateTime() {
        // CHECK END DATE -------------------------------
        String endTaskDate = getStartDate().date;
        int month;
        String day;

        // CHECK END TIME -------------------------------
        String endTaskTime = getEndTime().endTime;
        int getHour, getMinute;
        // get hour
        String hour = (getEndTime().endTime).substring(0, 1);
        // get min
        String minute = (getEndTime().endTime).substring(3, 4);
        // get AM/PM
        String AM_PM = (getEndTime().endTime).substring(4, 6);

        // Date object-----------------------------------------
        DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
        Date dateobj = new Date();
        String[] dateArr = endTaskDate.split(" ");
        String[] curDate = df.format(dateobj).split("-");
        day = dateArr[0].substring(0, 2);

        // Time object-----------------------------------------
        DateFormat tf = new SimpleDateFormat("h:m:a");
        Date timeobj = new Date();
        String[] curTime = tf.format(timeobj).split(":");

        // Convert month to int value
        switch (dateArr[1]) {
        case "January":
            month = 1;
            break;
        case "Febuary":
            month = 2;
            break;
        case "March":
            month = 3;
            break;
        case "April":
            month = 4;
            break;
        case "May":
            month = 5;
            break;
        case "June":
            month = 6;
            break;
        case "July":
            month = 7;
            break;
        case "August":
            month = 8;
            break;
        case "September":
            month = 9;
            break;
        case "October":
            month = 10;
            break;
        case "November":
            month = 11;
            break;
        default:
            month = 12;
        }

        // Convert string hour to int
        switch (hour) {
        case "01":
            getHour = 1;
            break;
        case "02":
            getHour = 2;
            break;
        case "03":
            getHour = 3;
            break;
        case "04":
            getHour = 4;
            break;
        case "05":
            getHour = 5;
            break;
        case "06":
            getHour = 6;
            break;
        case "07":
            getHour = 7;
            break;
        case "08":
            getHour = 8;
            break;
        case "09":
            getHour = 9;
            break;
        case "10":
            getHour = 10;
            break;
        case "11":
            getHour = 11;
            break;
        default:
            getHour = Integer.parseInt(hour);
        }

        switch (minute) {
        case "00":
            getMinute = 0;
            break;
        case "01":
            getMinute = 1;
            break;
        case "02":
            getMinute = 2;
            break;
        case "03":
            getMinute = 3;
            break;
        case "04":
            getMinute = 4;
            break;
        case "05":
            getMinute = 5;
            break;
        case "06":
            getMinute = 6;
            break;
        case "07":
            getMinute = 7;
            break;
        case "08":
            getMinute = 8;
            break;
        case "09":
            getMinute = 9;
            break;
        default:
            getMinute = Integer.parseInt(minute);
        }

        // Check year or if same year, check month or if same year, same month , check day
        if ((Integer.parseInt(dateArr[2]) < Integer.parseInt(curDate[2]))
                || (Integer.parseInt(dateArr[2]) == Integer.parseInt(curDate[2])
                        && month < Integer.parseInt(curDate[1]))
                || (Integer.parseInt(dateArr[2]) == Integer.parseInt(curDate[2])
                        && month == Integer.parseInt(curDate[1])
                        && Integer.parseInt(day) < Integer.parseInt(curDate[0]))) {
            return false;
        // Same day so check time
        } else if (Integer.parseInt(dateArr[2]) == Integer.parseInt(curDate[2]) && month == Integer.parseInt(curDate[1])
                && Integer.parseInt(day) == Integer.parseInt(curDate[0])) {
            if ((AM_PM.equals("am") && curTime[2].equals("AM")) || (AM_PM.equals("pm") && curTime[2].equals("PM"))) {
                // Check if same hour then check minute difference
                if (getHour == Integer.parseInt(curTime[0]) && getMinute < Integer.parseInt(curTime[1])) {
                    return false;
                // Check if task end time is less than current time
                // Check if task is in morning or noon and 12 is suppose to
                // be lesser than current time (1am/pm is more than 12am/pm)
                } else if ((getHour < Integer.parseInt(curTime[0])) || ((AM_PM.equals("am") || AM_PM.equals("pm"))
                        && getHour == 12 && getHour > Integer.parseInt(curTime[0]))) {
                    return false;
                } else {
                    return true;
                }
            // Check if task end time is am(morning) while current time is pm(night)
            } else if ((AM_PM.equals("am") && curTime[2].equals("PM"))) {
                return false;
            } else {
                return true;
            }
        } else {
            return true;
        }
    }
```
###### /java/seedu/Tdoo/model/task/Event.java
``` java
    public boolean checkEndDateTime() {
        // CHECK END DATE -------------------------------
        String endTaskDate = getEndDate().endDate;
        int month;
        String day;

        // CHECK END TIME -------------------------------
        String endTaskTime = getEndTime().endTime;
        int getHour = 12, getMinute;
        // get hour
        String hour = (getEndTime().endTime).substring(0, 1);
        // get min
        String minute = (getEndTime().endTime).substring(3, 4);
        // get AM/PM
        String AM_PM = (getEndTime().endTime).substring(4, 6);

        // Date object-----------------------------------------
        DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
        Date dateobj = new Date();
        String[] dateArr = endTaskDate.split(" ");
        String[] curDate = df.format(dateobj).split("-");
        day = dateArr[0].substring(0, 2);

        // Time object-----------------------------------------
        DateFormat tf = new SimpleDateFormat("h:m:a");
        Date timeobj = new Date();
        String[] curTime = tf.format(timeobj).split(":");

        // Convert month to int value
        switch (dateArr[1]) {
        case "January":
            month = 1;
            break;
        case "Febuary":
            month = 2;
            break;
        case "March":
            month = 3;
            break;
        case "April":
            month = 4;
            break;
        case "May":
            month = 5;
            break;
        case "June":
            month = 6;
            break;
        case "July":
            month = 7;
            break;
        case "August":
            month = 8;
            break;
        case "September":
            month = 9;
            break;
        case "October":
            month = 10;
            break;
        case "November":
            month = 11;
            break;
        default:
            month = 12;
        }

        // Convert string hour to int
        switch (hour) {
        case "01":
            getHour = 1;
            break;
        case "02":
            getHour = 2;
            break;
        case "03":
            getHour = 3;
            break;
        case "04":
            getHour = 4;
            break;
        case "05":
            getHour = 5;
            break;
        case "06":
            getHour = 6;
            break;
        case "07":
            getHour = 7;
            break;
        case "08":
            getHour = 8;
            break;
        case "09":
            getHour = 9;
            break;
        case "10":
            getHour = 10;
            break;
        case "11":
            getHour = 11;
            break;
        default:
            getHour = Integer.parseInt(hour);
        }

        switch (minute) {
        case "00":
            getMinute = 0;
            break;
        case "01":
            getMinute = 1;
            break;
        case "02":
            getMinute = 2;
            break;
        case "03":
            getMinute = 3;
            break;
        case "04":
            getMinute = 4;
            break;
        case "05":
            getMinute = 5;
            break;
        case "06":
            getMinute = 6;
            break;
        case "07":
            getMinute = 7;
            break;
        case "08":
            getMinute = 8;
            break;
        case "09":
            getMinute = 9;
            break;
        default:
            getMinute = Integer.parseInt(minute);
        }

        // Check year or if same year, check month or if same year, same month , check day
        if ((Integer.parseInt(dateArr[2]) < Integer.parseInt(curDate[2]))
                || (Integer.parseInt(dateArr[2]) == Integer.parseInt(curDate[2])
                        && month < Integer.parseInt(curDate[1]))
                || (Integer.parseInt(dateArr[2]) == Integer.parseInt(curDate[2])
                        && month == Integer.parseInt(curDate[1])
                        && Integer.parseInt(day) < Integer.parseInt(curDate[0]))) {
            return false;
            // Same day so check time
        } else if (Integer.parseInt(dateArr[2]) == Integer.parseInt(curDate[2]) && month == Integer.parseInt(curDate[1])
                && Integer.parseInt(day) == Integer.parseInt(curDate[0])) {
            if ((AM_PM.equals("am") && curTime[2].equals("AM")) || (AM_PM.equals("pm") && curTime[2].equals("PM"))) {
                // Check if same hour then check minute difference
                if (getHour == Integer.parseInt(curTime[0]) && getMinute < Integer.parseInt(curTime[1])) {
                    return false;
                    // Check if task end time is less than current time
                    // Check if task is in morning or noon and 12 is suppose to
                    // be lesser than current time (1am/pm is more than 12am/pm)
                } else if ((getHour < Integer.parseInt(curTime[0])) || ((AM_PM.equals("am") || AM_PM.equals("pm"))
                        && getHour == 12 && getHour > Integer.parseInt(curTime[0]))) {
                    return false;
                } else {
                    return true;
                }
            // Check if task end time is am(morning) while current time is pm(night)
            } else if ((AM_PM.equals("am") && curTime[2].equals("PM"))) {
                return false;
            } else {
                return true;
            }
        } else {
            return true;
        }
    }
```
###### /java/seedu/Tdoo/model/task/UniqueTaskList.java
``` java
	 /**
     * Adds a task to the list at specific place
     *
     * @throws DuplicateTaskException if the task to add is a duplicate of an existing task in the list.
     */
    public void addAtSameIndex(Task toAdd, int index) throws DuplicatetaskException {
        assert toAdd != null;
        if (contains(toAdd)) {
            throw new DuplicatetaskException();
        }
        internalList.add(index,toAdd);
    }
```
###### /java/seedu/Tdoo/model/task/UniqueTaskList.java
``` java
	public boolean undoneTask(ReadOnlyTask key) throws UniqueTaskList.TaskNotFoundException {
		assert key != null;
		final boolean taskUpdated = internalList.contains(key);
		if (taskUpdated) {
			internalList.get(internalList.indexOf(key)).setDone("false");
			internalList.set(internalList.indexOf(key), internalList.get(internalList.indexOf(key)));
			return taskUpdated;
		} else {
			throw new UniqueTaskList.TaskNotFoundException();
		}
	}
}
```
###### /java/seedu/Tdoo/model/Undoer.java
``` java
	public void prepareUndoEdit(ReadOnlyTask original, String dataType, ReadOnlyTask toEdit , int targetIndex , String type) {
	    if(!type.equals("")){
	        undoStack.push(new UndoEditCommand(type, original, toEdit, targetIndex));
	        undoEdit = true;
		}else{
		    undoStack.push(new EditCommand(toEdit, dataType, original, targetIndex));
		}
	}
```
###### /java/seedu/Tdoo/ui/EventCard.java
``` java
	public void initialize() throws ParseException {
		name.setText(task.getName().name);
		id.setText(displayedIndex + ". ");
		startTime.setText("Start Time: " + task.getStartDate().date + " " + task.getStartTime().startTime);
		endTime.setText("End Time: " + task.getEndDate().endDate + " " + task.getEndTime().endTime);
		countdown.setText(task.getCountdown());
		if (task.checkEndDateTime() && this.task.getDone().equals("true")) {
			done.setText("Completed");
			cardPane.setStyle("-fx-background-color: #01DF01");
		} else if (!task.checkEndDateTime() && this.task.getDone().equals("false")) {
			done.setText("Overdue");
			cardPane.setStyle("-fx-background-color: #ff2002");
		} else {
			done.setText("Not Completed");
			cardPane.setStyle("-fx-background-color: #FFFFFF");
		}
	}

	public HBox getLayout() {
		return cardPane;
	}

	@Override
	public void setNode(Node node) {
		cardPane = (HBox) node;
	}

	@Override
	public String getFxmlPath() {
		return FXML;
	}
}
```


text:
using namespace std;
class FileManager
{
	ofstream outFile;
	bool fileExist(string filePath);
	string getValidFileName(string fileName);
	string extractFileName(string filePath);
	File *extractData(ifstream &inFile, string fileName);
public:
	FileManager();
	File *load(string filePath);
	File *load(string filePath, string fileName);
	void save(File *file);
	bool openOutput(string filePath);
	void closeOutput();
	bool append(char *data, size_t size);

	~FileManager();
	// usuniecie konstruktora kopiujacego i operatora przypisania
	FileManager(FileManager const&) = delete;
	FileManager& operator=(FileManager const&) = delete;
};


text:
module ActiveMerchant
  module Billing
    module Integrations
      module PaypalAdaptivePayment
        class Return < ActiveMerchant::Billing::Integrations::Return
        end
      end
    end
  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>AdminDesigns</title>
    <meta name="keywords" content="HTML5 Bootstrap 3 Admin Template UI Theme" />
    <meta name="description" content="AdminDesigns">
    <meta name="author" content="AdminDesigns">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800'>
    <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:400,500,700,300">

    <link rel="stylesheet" type="text/css" href="vendor/plugins/c3charts/c3.min.css">

    <link rel="stylesheet" type="text/css" href="assets/skin/default_skin/css/theme.css">

    <link rel="shortcut icon" href="assets/img/favicon.ico">

                 Theme Options

                        Navbar

                        Sidebar

                        Misc

                        <form id="toolbox-header-skin">

Header Skins

                                    <input type="radio" name="headerSkin" id="headerSkin8" checked value="bg-light">
                                    Light

                                    <input type="radio" name="headerSkin" id="headerSkin1" value="bg-primary">
                                    Primary

                                    <input type="radio" name="headerSkin" id="headerSkin3" value="bg-info">
                                    Info

                                    <input type="radio" name="headerSkin" id="headerSkin4" value="bg-warning">
                                    Warning

                                    <input type="radio" name="headerSkin" id="headerSkin5" value="bg-danger">
                                    Danger

                                    <input type="radio" name="headerSkin" id="headerSkin6" value="bg-alert">
                                    Alert

                                    <input type="radio" name="headerSkin" id="headerSkin7" value="bg-system">
                                    System

                                    <input type="radio" name="headerSkin" id="headerSkin2" value="bg-success">
                                    Success

                                    <input type="radio" name="headerSkin" id="headerSkin9" value="bg-dark">
                                    Dark

                        </form>

                        <form id="toolbox-sidebar-skin">

Sidebar Skins

                                    <input type="radio" name="sidebarSkin" checked id="sidebarSkin3" value="">
                                    Dark

                                    <input type="radio" name="sidebarSkin" id="sidebarSkin1" value="sidebar-light">
                                    Light

                                    <input type="radio" name="sidebarSkin" id="sidebarSkin2" value="sidebar-light light">
                                    Lighter

                        </form>

                        <form id="toolbox-settings-misc">

Layout Options

                                    <input type="checkbox" checked="" id="header-option">
                                    Fixed Header

                                    <input type="checkbox" id="sidebar-option">
                                    Fixed Sidebar

                                    <input type="checkbox" id="breadcrumb-option">
                                    Fixed Breadcrumbs

                                    <input type="checkbox" id="breadcrumb-hidden">
                                    Hide Breadcrumbs

Layout Options

                                    <input type="radio" id="fullwidth-option" checked name="layout-option">
                                    Fullwidth Layout

                                    <input type="radio" id="boxed-option" name="layout-option" disabled>
                                    Boxed Layout (Coming Soon)

                        </form>

                    Clear LocalStorage

                 AdminDesigns

                                 Reset LocalStorage

                                 Force Global Logout

                                 Run Cron Job

                                 Maintenance Mode

            <form class="navbar-form navbar-left navbar-search ml5" role="search">

                    <input type="text" class="form-control" placeholder="Search..." value="Search...">

            </form>

                             Notifications
                            12

Article - 08/16/22
 Last Updated 36 days ago by
                                     Max

Article - 08/16/22
 Last Updated 36 days ago by
                                     Max

Article - 08/16/22
 Last Updated 36 days ago by
                                     Max

Article - 08/16/22
 Last Updated 36 days ago by
                                     Max

                        US

                                 Hindu

                                 Turkish

                                 Spanish

                        John.Smith

                                <select id="user-status">
                                    <optgroup label="Current Status:">
                                        <option value="1-1">Away</option>
                                        <option value="1-2">Offline</option>
                                        <option value="1-3" selected="selected">Online</option>
                                    </optgroup>
                                </select>

                                <select id="user-role">
                                    <optgroup label="Logged in As:">
                                        <option value="1-1">Client</option>
                                        <option value="1-2">Editor</option>
                                        <option value="1-3" selected="selected">Admin</option>
                                    </optgroup>
                                </select>

                                 Messages
                                2

                                 Friends
                                6

                                 Account Settings

                                 Logout

Menu

                            Calendar

                            Documentation

                            Dashboard

Exclusive Tools

                            Admin Plugins

                                     Admin Panels

                                     Admin Modals

                                     Admin Dock

                            Admin Forms

                                     Admin Elements

                                     Admin Widgets

                                     Admin Layouts

                                     Admin Wizard

                                     Admin Validation

Systems

                            Ecommerce

                                     Dashboard New

                                     Products

                                     Orders

                                     Customers

                                     Store Settings

                            Email Templates

                                New

Elements

                            UI Elements

                                     Tour New

                                     Alerts

                                     Animations

                                     Buttons

                                     Portlets

                                     Progress Bars

                                     Tabs

                                     Tiles

                                     Widgets

                                     Icons

                            Form Elements

                                     Inputs

                                     Typography

                                     Editors

                                     Treeview

                                     Nestable

                                     Uploaders

                                     Editors

                                             Ckeditor

                                             Markdown

                                             Summernote

                                             X-Editable

                                     Notifications

                                     Content Sliders

                                     Grid

                            Plugins

                                     Maps

                                        Admin Maps

                                        Basic Maps

                                        Vector Maps

                                        Full Map

                                     Charts

                                        Highcharts

                                        D3 Charts

                                        Flot Charts

                                     Tables

                                         Basic Tables

                                         DataTables

                                         Editable Tables

                                         Pricing Tables

                            Pages

                                     Utility

                                         Landing Page New

                                         Login

                                         Register

                                         Screenlock

                                         Forgotten Password

                                         Coming Soon New

                                         404 Error

                                         500 Error

                                         404 Error Alt

                                         500 Error Alt

                                     Basic

                                         Calendar

                                         Profile

                                         Timeline Split

                                         Timeline Single

                                         FAQ Page

                                         Messages

                                         Messages Alt

                                         Gallery

                                     Misc

                                         Printable Invoice

                                         Blank

Projects

                            Website Redesign

                            Ecommerce Panel

                            Adobe Mockup

                            SSD Upgrades

User Stats

                            Email Storage
                            35%

                                    35% Complete

                            Bandwidth
                            58%

                                    58% Complete

Messages

Users

Support

Settings

Videos

Pictures

                            Dashboard

                            Home

Dashboard

                        Reporting Period
                        <select id="topbar-multiple" class="hidden" multiple="multiple">
                            <optgroup label="Filter By:">
                                <option value="1-1">Last 30 Days</option>
                                <option value="1-2" selected="selected">Last 60 Days</option>
                                <option value="1-3">Last Year</option>
                            </optgroup>
                        </select>

                            3

 HighCharts.js - "Your Data..Alive"

                                 Author: www.highcharts.com

                                 License: CC - NonCommercial 3.0

                                 Website:
                                www.highcharts.com

                                     Bar Chart

                                     Area Chart

                                     Step Chart

                                     Line Chart

                                     Spline Chart

                                     Scatter Plot Chart

                                     Sub Nav Chart

                                     MouseWheel Zoom Chart

                                     Donut Chart

                                     Pie Chart

                                     Guage Chart

                                     Combined Chart

                             Bar Chart

                             Area Chart

                             Step Chart

                             Line Chart

                             Spline Chart

                             Scatter Plot Chart

                             MouseWheel Zoom Chart

                             MouseWheel Zoom Chart

                             Donut Chart

                             Pie Chart

                             Combined Chart

                             Combined Chart

                            Tab 1

                            Tab 2

                            Tab 3

 Server Statistics  2013

                                    DB Request

                                    Server Load

                                    Server Connections

Traffic Margins

132

  13.2%

Database Request

212

  25.6%

Server Response

82.5

  17.9%

 Server Statistics USA


text:
package fi.ni.ifc2x3;
import fi.ni.ifc2x3.interfaces.*;
import fi.ni.*;
import java.util.*;

/*
 * IFC Java class
 * @author Jyrki Oraskari
 * @license This work is licensed under a Creative Commons Attribution 3.0 Unported License.
 * http://creativecommons.org/licenses/by/3.0/
 */

public class IfcNamedUnit extends Thing implements IfcUnit
{
 // The property attributes
 IfcDimensionalExponents   dimensions;
 String unitType;

 // Getters and setters of properties

 public IfcDimensionalExponents getDimensions() {
   return dimensions;

 }
 public void setDimensions(IfcDimensionalExponents value){
   this.dimensions=value;

 }

 public String getUnitType() {
   return unitType;
 }
 public void setUnitType(String value){
   this.unitType=value;

 }

}


text:
<!DOCTYPE html>

	<meta charset="UTF-8">
	<title>Document</title>
	<link href='https://fonts.googleapis.com/css?family=Playfair+Display' rel='stylesheet' type='text/css'>
	<link href='./css/article-stylesheet.css' rel='stylesheet' type='text/css'>

MotherHood

Children are memorable

Children are loving

by Geraldine Provenly Foss

	</sections>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
SSTRecord (POI API Documentation)
</TITLE>

<META NAME="date" CONTENT="2012-11-26">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.hssf.record

Class SSTRecord

java.lang.Object
  org.apache.poi.hssf.record.RecordBase
      org.apache.poi.hssf.record.Record
          org.apache.poi.hssf.record.cont.ContinuableRecord
              org.apache.poi.hssf.record.SSTRecord

public final class SSTRecord
extends ContinuableRecord

Title:        Static String Table Record (0x00FC)

 Description:  This holds all the strings for LabelSSTRecords.

 REFERENCE:    PG 389 Microsoft Excel 97 Developer's Kit (ISBN:
               1-57231-498-2)

Author:

Andrew C. Oliver (acoliver at apache dot org), Marc Johnson (mjohnson at apache dot org), Glen Stampoultzis (glens at apache.org)

See Also:
LabelSSTRecord,
ContinueRecord

Field Summary

static short
sid

Constructor Summary

SSTRecord()

SSTRecord(RecordInputStream in)

          Fill the fields from the data

Method Summary

 int
addString(UnicodeString string)

          Add a string.

 int
calcExtSSTRecordSize()

          Calculates the size in bytes of the EXTSST record as it would be if the
 record was serialized.

 ExtSSTRecord
createExtSSTRecord(int sstOffset)

          Creates an extended string record based on the current contents of
 the current SST record.

 int
getNumStrings()

 int
getNumUniqueStrings()

 short
getSid()

          return the non static version of the id for this record.

 UnicodeString
getString(int id)

          Get a particular string by its index

protected  void
serialize(ContinuableRecordOutput out)

          Serializes this record's content to the supplied data output.

 The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so
 only BIFF data should be written by this method.

 java.lang.String
toString()

          Return a debugging string representation

Methods inherited from class org.apache.poi.hssf.record.cont.ContinuableRecord

getRecordSize, serialize

Methods inherited from class org.apache.poi.hssf.record.Record

clone, cloneViaReserialise, serialize

Methods inherited from class java.lang.Object

equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

sid

public static final short sid

See Also:
Constant Field Values

Constructor Detail

SSTRecord

public SSTRecord()

SSTRecord

public SSTRecord(RecordInputStream in)

Fill the fields from the data

 The data consists of sets of string data. This string data is
 arranged as follows:

 short  string_length;   // length of string data
 byte   string_flag;     // flag specifying special string
                         // handling
 short  run_count;       // optional count of formatting runs
 int    extend_length;   // optional extension length
 char[] string_data;     // string data, can be byte[] or
                         // short[] (length of array is
                         // string_length)
 int[]  formatting_runs; // optional formatting runs (length of
                         // array is run_count)
 byte[] extension;       // optional extension (length of array
                         // is extend_length)

 The string_flag is bit mapped as follows:

      Bit number
      Meaning if 0
      Meaning if 1

      0
      string_data is byte[]
      string_data is short[]

      1
      Should always be 0
      string_flag is defective

      2
      extension is not included
      extension is included

      3
      formatting run data is not included
      formatting run data is included

      4
      Should always be 0
      string_flag is defective

      5
      Should always be 0
      string_flag is defective

      6
      Should always be 0
      string_flag is defective

      7
      Should always be 0
      string_flag is defective

 We can handle eating the overhead associated with bits 2 or 3
 (or both) being set, but we have no idea what to do with the
 associated data. The UnicodeString class can handle the byte[]
 vs short[] nature of the actual string data

Parameters:
in - the RecordInputstream to read the record from

Method Detail

addString

public int addString(UnicodeString string)

Add a string.

Parameters:
string - string to be added

Returns:
the index of that string in the table

getNumStrings

public int getNumStrings()

Returns:
number of strings

getNumUniqueStrings

public int getNumUniqueStrings()

Returns:
number of unique strings

getString

public UnicodeString getString(int id)

Get a particular string by its index

Parameters:
id - index into the array of strings

Returns:
the desired string

toString

public java.lang.String toString()

Return a debugging string representation

Overrides:
toString in class Record

Returns:
string representation

getSid

public short getSid()

Description copied from class: Record

return the non static version of the id for this record.

Specified by:
getSid in class Record

serialize

protected void serialize(ContinuableRecordOutput out)

Description copied from class: ContinuableRecord

Serializes this record's content to the supplied data output.

 The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so
 only BIFF data should be written by this method.  Simple data types can be written with the
 standard LittleEndianOutput methods.  Methods from ContinuableRecordOutput
 can be used to serialize strings (with ContinueRecords being written as required).
 If necessary, implementors can explicitly start ContinueRecords (regardless of the
 amount of remaining space).

Specified by:
serialize in class ContinuableRecord

Parameters:
out - a data output stream

createExtSSTRecord

public ExtSSTRecord createExtSSTRecord(int sstOffset)

Creates an extended string record based on the current contents of
 the current SST record.  The offset within the stream to the SST record
 is required because the extended string record points directly to the
 strings in the SST record.

 NOTE: THIS FUNCTION MUST ONLY BE CALLED AFTER THE SST RECORD HAS BEEN
       SERIALIZED.

Parameters:
sstOffset - The offset in the stream to the start of the
                      SST record.

Returns:
The new SST record.

calcExtSSTRecordSize

public int calcExtSSTRecordSize()

Calculates the size in bytes of the EXTSST record as it would be if the
 record was serialized.

Returns:
The size of the ExtSST record in bytes.

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2012 The Apache Software Foundation or
        its licensors, as applicable.


text:
import type { CurrentStoreApi } from './types'

const defineTable: CurrentStoreApi['defineTable'] = async (
  { inlineLedgerRunQuery, tablePrefix, escapeId },
  readModelName,
  tableName,
  tableDescription
) => {
  if (
    tableDescription == null ||
    tableDescription.constructor !== Object ||
    tableDescription.indexes == null ||
    tableDescription.indexes.constructor !== Object ||
    !Array.isArray(tableDescription.fields)
  ) {
    throw new Error(`Wrong table description ${tableDescription}`)
  }

  await inlineLedgerRunQuery(
    `CREATE TABLE ${escapeId(`${tablePrefix}${tableName}`)} (
    -- RESOLVE READ-MODEL ${escapeId(`${readModelName}`)} OWNED TABLE
      ${tableDescription.fields
        .concat(Object.keys(tableDescription.indexes))
        .map((columnName) => `${escapeId(columnName)} JSON`)
        .join(',\n')}
    )`,
    true
  )

  for (const [idx, indexName] of Object.entries(
    Object.keys(tableDescription.indexes)
  )) {
    const indexType = tableDescription.indexes[indexName]
    if (indexType !== 'string' && indexType !== 'number') {
      throw new Error(
        `Wrong index "${indexName}" type "${tableDescription.indexes[indexName]}"`
      )
    }

    const baseIndexName = (postfix: string): string =>
      escapeId(`${tablePrefix}${tableName}-${indexName}-${postfix}`)

    const indexCategory = +idx === 0 ? 'UNIQUE' : ''

    await inlineLedgerRunQuery(
      `CREATE ${indexCategory} INDEX ${baseIndexName('type-validation')}
        ON ${escapeId(`${tablePrefix}${tableName}`)}(
          CAST(json_extract(${escapeId(indexName)}, '$') AS ${
        indexType === 'number' ? 'NUMERIC' : 'TEXT'
      })
        )`,
      true
    )

    await inlineLedgerRunQuery(
      `CREATE ${indexCategory} INDEX ${baseIndexName('extracted-field')}
        ON ${escapeId(`${tablePrefix}${tableName}`)}(
          json_extract(${escapeId(indexName)}, '$')
        )`,
      true
    )

    await inlineLedgerRunQuery(
      `CREATE ${indexCategory} INDEX ${baseIndexName('full-field')}
        ON ${escapeId(`${tablePrefix}${tableName}`)}(
          ${escapeId(indexName)}
        )`,
      true
    )
  }
}

export default defineTable


text:
package org.intothedeep.ld48.client;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import org.intothedeep.ld48.IntoTheDeep;

public class HtmlLauncher extends GwtApplication {

        @Override
        public GwtApplicationConfiguration getConfig () {
                return new GwtApplicationConfiguration(480, 320);
        }

        @Override
        public ApplicationListener getApplicationListener () {
                return new IntoTheDeep();
        }
}


text:
class CreateElectronicServices < ActiveRecord::Migration
  def change
    create_table :electronic_services do |t|
      t.string :address
      t.string :integration_profile
      t.string :content_profile
      t.string :digital_certificate
      t.references :provider, index: true, null: true
      t.references :organization, index: true, null: true
      t.timestamps null: false
    end
  end
end


text:
'use strict';

var assert = require('assert');
var collectParallel = require('collect-parallel/array');

var Errors = require('./errors');

module.exports = BaseBackend;

function BaseBackend(options) {
    if (!(this instanceof BaseBackend)) {
        return new BaseBackend(options);
    }

    var self = this;

    assert(
        typeof self.log === 'function' &&
        self.log !== BaseBackend.prototype.log,
        '`log` method of BaseBackend must be overridden by function'
    );

    assert(
        typeof self.bootstrap === 'function',
        '`bootstrap` method of BaseBackend must be overridden by function'
    );

    assert(
        typeof self.destroy === 'function',
        '`destroy` method of BaseBackend must be overridden by function'
    );

    assert(
        typeof self.logMany === 'function',
        '`logMany` method of BaseBackend must be overriden by function'
    );
}

BaseBackend.prototype.log = function log(record, cb) {};

BaseBackend.prototype.bootstrap = function bootstrap(cb) {
    cb();
};

BaseBackend.prototype.destroy = function bootstrap(cb) {
    cb();
};

BaseBackend.prototype.logMany = function logMany(records, cb) {
    var self = this;

    collectParallel(records, eachRecord, logsDone);

    function eachRecord(record, i, recordCb) {
        self.log(record, recordCb);
    }

    function logsDone(ignored, results) {
        cb(Errors.resultArrayToError(results, 'larch.log-many.many-errors'));
    }
};


text:
package zipkin2.reporter.beans;

import com.rabbitmq.client.Address;
import java.util.Arrays;
import org.junit.After;
import org.junit.Test;
import zipkin2.codec.Encoding;
import zipkin2.reporter.amqp.RabbitMQSender;

import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;

public class RabbitMQSenderFactoryBeanTest {
  XmlBeans context;

  @After public void close() {
    if (context != null) context.close();
  }

  @Test public void addresses() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("addresses")
        .isEqualTo(asList(new Address("localhost")));
  }

  @Test public void queue() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "  <property name=\"queue\" value=\"zipkin2\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("queue")
        .isEqualTo("zipkin2");
  }

  @Test public void connectionTimeout() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "  <property name=\"connectionTimeout\" value=\"0\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("connectionFactory.connectionTimeout")
        .isEqualTo(0);
  }

  @Test public void virtualHost() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "  <property name=\"virtualHost\" value=\"zipkin3\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("connectionFactory.virtualHost")
        .isEqualTo("zipkin3");
  }

  @Test public void usernamePassword() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "  <property name=\"username\" value=\"foo\"/>\n"
        + "  <property name=\"password\" value=\"bar\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("connectionFactory.username", "connectionFactory.password")
        .isEqualTo(asList("foo", "bar"));
  }

  @Test public void messageMaxBytes() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "  <property name=\"messageMaxBytes\" value=\"1024\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("messageMaxBytes")
        .isEqualTo(1024);
  }

  @Test public void encoding() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "  <property name=\"encoding\" value=\"PROTO3\"/>\n"
        + "</bean>"
    );

    assertThat(context.getBean("sender", RabbitMQSender.class))
        .extracting("encoding")
        .isEqualTo(Encoding.PROTO3);
  }

  @Test(expected = IllegalStateException.class) public void close_closesSender() {
    context = new XmlBeans(""
        + "<bean id=\"sender\" class=\"zipkin2.reporter.beans.RabbitMQSenderFactoryBean\">\n"
        + "  <property name=\"addresses\" value=\"localhost\"/>\n"
        + "</bean>"
    );

    RabbitMQSender sender = context.getBean("sender", RabbitMQSender.class);
    context.close();

    sender.sendSpans(asList(new byte[] {'{', '}'}));
  }
}


text:
package org.spongepowered.api.data.manipulator.mutable;

import com.google.common.base.Optional;
import org.spongepowered.api.block.tileentity.CommandBlock;
import org.spongepowered.api.data.DataHolder;
import org.spongepowered.api.data.manipulator.DataManipulator;
import org.spongepowered.api.data.manipulator.immutable.ImmutableCommandData;
import org.spongepowered.api.data.value.mutable.OptionalValue;
import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.entity.vehicle.minecart.MinecartCommandBlock;
import org.spongepowered.api.text.Text;

/**
 * An {@link DataManipulator} handling all related {@link Value}s for command
 * related {@link DataHolder}s, such as {@link CommandBlock}s and
 * {@link MinecartCommandBlock}s.
 */
public interface CommandData extends DataManipulator<CommandData, ImmutableCommandData> {

    /**
     * Gets the currently stored command.
     *
     * @return The command
     */
    Value<String> storedCommand();

    /**
     * Gets the success count of the last executed command.
     *
     *
The success count is the number of times the most recently used
     * command of this command block succeeded. Most commands can only succeed
     * once per  execution, but certain commands (such as those which accept
     * players as arguments) can succeed multiple times, and this value will be
     * set accordingly. This success count can also be polled via a redstone
     * comparator.

     *
     * @return The last success count
     */
    Value<Integer> successCount();

    /**
     * Gets whether this command block will keep track of the output from the
     * last command it executed.
     *
     * @return Whether the command output is tracked
     */
    Value<Boolean> doesTrackOutput();

    /**
     * Gets the last command output.
     *
     *
This will only be available if {@link #doesTrackOutput()} is set to
     * true, otherwise {@link Optional#absent()} will be returned.

     *
     * @return The last command output, if available
     */
    OptionalValue<Text> lastOutput();

}


text:
/**
 * loading-bar.js
 * Created by anonymous on 03/01/16 2:42.
 */

(function() {
    'use strict';

    angular
        .module('app')
        .config(cfpLoadingBar);

    cfpLoadingBar.$inject = ['cfpLoadingBarProvider'];

    /* @ngInject */
    function cfpLoadingBar(cfpLoadingBarProvider) {
        cfpLoadingBarProvider.includeSpinner = false;
    }

})();


text:
(function(root, factory) {

    if (typeof define === 'function' && define.amd) {
        define(['marionette', 'backbone', 'underscore'], function(Marionette, Backbone, _) {
            return (root.Juggler = factory(root, Marionette, Backbone, _));
        });
    } else if (typeof exports !== 'undefined') {
        var Marionette = require('marionette');
        var Backbone = require('backbone');
        var _ = require('underscore');
        module.exports = factory(root, Marionette, Backbone, _);
    } else {
        root.Juggler = factory(root, root.Marionette, root.Backbone, root._);
    }

}(this, function(root, Marionette, Backbone, _) {

    'use strict';

    var previousJuggler = root.Juggler;

    var Juggler = Backbone.Juggler = new Marionette.Application();

    Juggler.VERSION = '0.1.1';

    Juggler.noConflict = function() {
        root.Juggler = previousJuggler;
        return this;
    };

    Backbone.Juggler = Juggler;

    // @include ./juggler.config.js

    // @include ./juggler.helpers.js

    // @include ./juggler.routers.js

    // @include ./juggler.controllers.js

    // @include ./juggler.templates.js

    // @include ./juggler.enities.js

    // @include ./juggler.views.js

    // @include ./juggler.widgets_notice.js

    // @include ./juggler.widgets_nav.js

    // @include ./juggler.widgets_button.js

    // @include ./juggler.editors.js

    // @include ./juggler.widgets_form.js

    // @include ./juggler.widgets_table.js

    // @include ./juggler.widgets_panel.js

    // @include ./juggler.widgets_layout.js

    // @include ./juggler.components.js

    // @include ./juggler.initializer.js

    // @include ./juggler.start.js

    return Juggler;
}));


text:
package io.opensec.oval.model.definitions;

import io.opensec.oval.model.ElementRef;
import io.opensec.oval.model.ElementType;
import io.opensec.oval.model.OvalEnumeration;
import io.opensec.oval.model.common.DatatypeEnumeration;

import java.util.Collection;
import java.util.Collections;

import org.mongodb.morphia.annotations.Entity;

/**
 * The OVAL Variable describes different sources
 * for obtaining a value(s) for the variable.
 * There are currently three types of variables;
 * local, external, and constant.
 *
 * @author	Akihito Nakamura, AIST
 * @see OVAL Language
 */
@Entity( "oval.def.variable" )
public class VariableType
    extends DefinitionsComponent
{

    public enum Type
    implements OvalEnumeration
    {
        CONSTANT,
        LOCAL,
        EXTERNAL;

        /**
         * A factory method.
         */
        public static Type fromValue(
                        final String value
                        )
        {
//            return valueOf( value.toUpperCase() );

            for (Type  e : Type.values()) {
                if (e.value.equals( value )) {
                    return e;
                }
            }

            throw new IllegalArgumentException( value );
        }

        private String  value = null;

        Type()
        {
            value = name().toLowerCase();
        }

        public String value()
        {
            return value;
        }

        @Override
        public String toString()
        {
            return value;
        }
    }
    //Type

    ////////////////////////////////////////////////////////////////

    private DatatypeEnumeration  datatype;
    //{required}

    /**
     * Constructor.
     */
    public VariableType()
    {
        this( null, 0 );
    }

    public VariableType(
                    final String id,
                    final int version
                    )
    {
        this( id, version, null );
    }

    public VariableType(
                    final String id,
                    final int version,
                    final String comment
                    )
    {
        this( id, version, comment, null );
    }

    public VariableType(
                    final String id,
                    final int version,
                    final String comment,
                    final DatatypeEnumeration datatype
                    )
    {
        super( id, version, comment );
        setDatatype( datatype );

//        _oval_entity_type = OvalEntityType.variable;
//        _definitions_element_type = DefinitionsElement.Type.variable;
    }

    /**
     */
    public void setDatatype(
                    final DatatypeEnumeration datatype
                    )
    {
        this.datatype = datatype;
    }

    public DatatypeEnumeration getDatatype()
    {
        return datatype;
    }

    //*********************************************************************
    //  Element
    //*********************************************************************

    @Override
    public final ElementType ovalGetType()
    {
        return ElementType.VARIABLE;
    }

    //*********************************************************************
    //  DefinitionsElement
    //*********************************************************************

//    @Override
//    public final DefinitionsElement.Type ovalGetElementType()
//    {
//        return DefinitionsElement.Type.VARIABLE;
//    }

    @Override
    public Collection<ElementRef> ovalGetElementRef()
    {
        return Collections.emptyList();
//        Collection<ElementRef>  ref_list = new ArrayList<ElementRef>();
//        return ref_list;
    }

    public VariableType.Type ovalGetVariableType()
    {
        throw new UnsupportedOperationException(
                        "concrete VariableType must return its type.");

//        return Type.LOCAL;
    }

    //**************************************************************
    //  java.lang.Object
    //**************************************************************

    @Override
    public String toString()
    {
        return super.toString()
                        + ", datatype=" + getDatatype();
    }

}
//