text:
require File.join(File.dirname(__FILE__), "hooks", "menu")
require File.join(File.dirname(__FILE__), "hooks", "view")
require File.join(File.dirname(__FILE__), "hooks", "events")
require File.join(File.dirname(__FILE__), "hooks", "formatters")
require File.join(File.dirname(__FILE__), "hooks", "routing")

module Feather
  module Hooks
    class << self
      ##
      # This returns true if the hook is within a plugin that is active, false otherwise
      def is_hook_valid?(hook)
        plugin = get_plugin(hook)
        !plugin.nil? && plugin.active
      end

      ##
      # This returns the plugin applicable for any given hook
      def get_plugin(hook)
        get_plugin_by_caller(eval("__FILE__", hook.binding))
      end

      ##
      # This returns the plugin applicable for the specified file
      def get_plugin_by_caller(file)
        Feather::Plugin.all.each do |plugin|
          return plugin if file[0..plugin.path.length - 1] == plugin.path
        end
        nil
      end

      ##
      # This removes all hooks for the specified plugin
      def remove_plugin_hooks(id)
        Feather::Hooks::Menu.remove_plugin_hooks(id)
        Feather::Hooks::View.remove_plugin_hooks(id)
      end

      ##
      # This returns the calling file that called the method that then called this helper method
      def get_caller
        caller[1].split(":")[0]
      end
    end
  end
end


text:
layout: post
date: '2015-09-22'
title: "Mori Lee Blu by 5206 Lace Mermaid Wedding Dress"
category: Mori Lee
tags: [Mori Lee]
---
### Mori Lee Blu by 5206 Lace Mermaid Wedding Dress
Just **$331.99**
###

Style 5206 Delicate Alencon Lace Appliques on Net

Sizes Available: 2-28.

Buy it: [https://www.eudances.com/en/mori-lee/684-blu-by-mori-lee-5206-lace-mermaid-wedding-dress.html](https://www.eudances.com/en/mori-lee/684-blu-by-mori-lee-5206-lace-mermaid-wedding-dress.html)

redpajama_set_name: RedPajamaGithub


text:
package automaton

import (
	"container/list"
	"github.com/balzaczyy/golucene/core/util"
	. "github.com/balzaczyy/golucene/test_framework/util"
	// "fmt"
	"math/rand"
	"testing"
	"unicode"
)

func TestRegExpToAutomaton(t *testing.T) {
	a := NewRegExp("[^ \t\r\n]+").ToAutomaton()
	assert(a.deterministic)
	assert(-1 == a.curState)
	assert(2 == a.numStates())
}

func TestMinusSimple(t *testing.T) {
	assert(sameLanguage(makeChar('b'), minus(makeCharRange('a', 'b'), makeChar('a'))))
	assert(sameLanguage(MakeEmpty(), minus(makeChar('a'), makeChar('a'))))
}

func TestComplementSimple(t *testing.T) {
	a := makeChar('a')
	assert(sameLanguage(a, complement(complement(a))))
}

func TestDeterminizeSimple(t *testing.T) {
	a1 := complement(NewRegExpWithFlag("-", NONE).ToAutomaton())
	a2 := NewRegExpWithFlag("ݖ|+", NONE).ToAutomaton()
	a := concatenate(a1, a2)
	a = removeDeadStates(a)
	a = determinize(a)
	assert(a.numStates() == 4)
}

// func TestStringUnion(t testing.T) {
// strings := make([]string, 0, 500)
// for i := NextInt(Random(), 0, 1000); i >= 0; i-- {
// 	strings = append(strings, RandomUnicodeString(Random()))
// }

// sort.Strings(strings)
// union := makeStringUnion(strings)
// assert(union.isDeterministic())
// assert(sameLanguage(union, naiveUnion(strings)))
// }

// util/automaton/AutomatonTestUtil.java
/*
Utilities for testing automata.

Capable of generating random regular expressions, and automata, and
also provides a number of very basic unoptimized implementations
(*slow) for testing.
*/

// Returns random string, including full unicode range.
func randomRegexp(r *rand.Rand) string {
	for i := 0; i < 500; i++ {
		regexp := randomRegexpString(r)
		// we will also generate some undefined unicode queries
		if !util.IsValidUTF16String([]rune(regexp)) {
			continue
		}
		if ok := func(regexp string) (ok bool) {
			ok = true
			defer func() {
				if r := recover(); r != nil {
					// log.Println("Recovered:", r)
					ok = false
				}
			}()
			// log.Println("Trying", regexp)
			NewRegExpWithFlag(regexp, NONE)
			return
		}(regexp); ok {
			// fmt.Println("Valid regexp found:", regexp)
			return regexp
		}
	}
	panic("should not be here")
}

func randomRegexpString(r *rand.Rand) string {
	end := r.Intn(20)
	if end == 0 {
		// allow 0 length
		return ""
	}
	buffer := make([]rune, 0, end)
	for i := 0; i < end; i++ {
		t := r.Intn(15)
		if 0 == t && i < end-1 {
			// Make a surrogate pair
			// High surrogate
			buffer = append(buffer, rune(NextInt(r, 0xd800, 0xdbff)))
			i++
			// Low surrogate
			buffer = append(buffer, rune(NextInt(r, 0xdc00, 0xdfff)))
		} else if t <= 1 {
			buffer = append(buffer, rune(r.Intn(0x80)))
		} else {
			switch t {
			case 2:
				buffer = append(buffer, rune(NextInt(r, 0x80, 0x800)))
			case 3:
				buffer = append(buffer, rune(NextInt(r, 0x800, 0xd7ff)))
			case 4:
				buffer = append(buffer, rune(NextInt(r, 0xe000, 0xffff)))
			case 5:
				buffer = append(buffer, '.')
			case 6:
				buffer = append(buffer, '?')
			case 7:
				buffer = append(buffer, '*')
			case 8:
				buffer = append(buffer, '+')
			case 9:
				buffer = append(buffer, '(')
			case 10:
				buffer = append(buffer, ')')
			case 11:
				buffer = append(buffer, '-')
			case 12:
				buffer = append(buffer, '[')
			case 13:
				buffer = append(buffer, ']')
			case 14:
				buffer = append(buffer, '|')
			}
		}
	}
	return string(buffer)
}

// L267
// Return a random NFA/DFA for testing
func randomAutomaton(r *rand.Rand) *Automaton {
	// get two random Automata from regexps
	a1 := NewRegExpWithFlag(randomRegexp(r), NONE).ToAutomaton()
	if r.Intn(2) == 0 {
		a1 = complement(a1)
	}

	a2 := NewRegExpWithFlag(randomRegexp(r), NONE).ToAutomaton()
	if r.Intn(2) == 0 {
		a2 = complement(a2)
	}

	// combine them in random ways
	switch r.Intn(4) {
	case 0:
		// fmt.Println("DEBUG way 0")
		return concatenate(a1, a2)
	case 1:
		// fmt.Println("DEBUG way 1")
		return union(a1, a2)
	case 2:
		// fmt.Println("DEBUG way 2")
		return intersection(a1, a2)
	default:
		// fmt.Println("DEBUG way 3")
		return minus(a1, a2)
	}
}

/**
 * below are original, unoptimized implementations of DFA operations for testing.
 * These are from brics automaton, full license (BSD) below:
 */

/*
 * dk.brics.automaton
 *
 * Copyright (c) 2001-2009 Anders Moeller
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
 * Simple, original brics implementation of Brzozowski minimize()
 */
func minimizeSimple(a *Automaton) *Automaton {
	var initialSet map[int]bool
	a, initialSet = reverse(a)
	a = determinizeSimple(a, initialSet)
	a, initialSet = reverse(a)
	a = determinizeSimple(a, initialSet)
	return a
}

/*
Simple original brics implementation of determinize()
Determinizes the given automaton using the given set of initial states.
*/
func determinizeSimple(a *Automaton, initialset map[int]bool) *Automaton {
	if a.numStates() == 0 {
		return a
	}
	points := a.startPoints()
	// subset construction
	sets := make(map[string]bool)
	hash := func(sets map[int]bool) string {
		n := util.NewOpenBitSet()
		for k, _ := range sets {
			n.Set(int64(k))
		}
		return n.String()
	}
	worklist := list.New()
	newstate := make(map[string]int)
	sets[hash(initialset)] = true
	worklist.PushBack(initialset)
	b := newAutomatonBuilder()
	b.createState()
	newstate[hash(initialset)] = 0
	t := newTransition()
	for worklist.Len() > 0 {
		s := worklist.Remove(worklist.Front()).(map[int]bool)
		r := newstate[hash(s)]
		for q, _ := range s {
			if a.IsAccept(q) {
				b.setAccept(r, true)
				break
			}
		}
		for n, point := range points {
			p := make(map[int]bool)
			for q, _ := range s {
				count := a.initTransition(q, t)
				for i := 0; i < count; i++ {
					a.nextTransition(t)
					if t.min <= point && point <= t.max {
						p[t.dest] = true
					}
				}
			}

			hashKey := hash(p)
			if _, ok := sets[hashKey]; !ok {
				sets[hashKey] = true
				worklist.PushBack(p)
				newstate[hashKey] = b.createState()
			}
			q := newstate[hashKey]
			min := point
			var max int
			if n+1 < len(points) {
				max = points[n+1] - 1
			} else {
				max = unicode.MaxRune
			}
			b.addTransitionRange(r, q, min, max)
		}
	}

	return removeDeadStates(b.finish())
}


text:
(function(){
	"use strict";
	_gaq.push(['_trackPageview']);

	var myVersion = chrome.runtime.getManifest().version;

	// Document ready
	$(document).on("ready", function(){
		// Show installed version
		$(".verNum").text(myVersion);

		// Load previously stored configs
		ConfigManager.load();
		KC3Meta.init("../../data/");
		KC3Translation.execute();

		// Set HTML language
		$("html").attr("lang", ConfigManager.language);

		// Load and show developer list
		//$.getJSON("+ConfigManager.language+"/developers.json", function(response){
		$.getJSON("../../data/developers.json", function(response){
			var sectionBox;
			for(var devTypeCode in response){
				// Add section header
				sectionBox = $("#factory .section").clone().appendTo("#wrapper .developers");
				$(".title", sectionBox).text( KC3Meta.term( devTypeCode ) );

				// Add settings boxes under this section
				for(var devCtr in response[devTypeCode]){
					addDeveloper( response[devTypeCode][devCtr] );
				}

				$("<div>").appendTo("#wrapper .developers").addClass("clear");
			}

			$("<div>").appendTo("#wrapper .developers").addClass("clear");
		});

	});

	// Show one of the developers
	function addDeveloper( info ){
		var devBox = $("#factory .devBox").clone().appendTo("#wrapper .developers");
		$(".devAvatar img", devBox).attr("src", info.avatar);
		$(".devName", devBox).text( info.name );
		if(typeof info.desc == "object"){
			var myRoles = [];
			$.each(info.desc, function(i,desc){
				myRoles.push( KC3Meta.term( desc ) );

			});
			$(".devDesc", devBox).append( myRoles.join(",") );
		}else{
			$(".devDesc", devBox).text( KC3Meta.term( info.desc ) );
		}

		var linkBox;
		for(var code in info.links){
			linkBox = $("#factory .devLink").clone();
			$("a", linkBox).attr("href", info.links[code] );
			$("img", linkBox).attr("src", "../../assets/img/social/"+code+".png");
			$(".devLinks", devBox).append(linkBox);
		}
	}

})();


text:
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/bootstrap.php';

/**
 * The return action controller. Updates the order status after being redirected
 * from EBANX.
 */
class EbanxExpressReturnModuleFrontController extends ModuleFrontController
{
  public function init()
  {
    parent::init();

    $cartId = (int) Tools::getValue('merchant_payment_code', 0);
    $hash   = Tools::getValue('hash');

    $response     = \Ebanx\Ebanx::doQuery(array('hash' => $hash));
    $redirectLink = 'index.php?controller=history&id_order=' . $response->payment->order_number;

    Tools::redirect($redirectLink);
  }
}


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

<title>N-Index</title>
<meta name="date" content="2016-10-25">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B C D E F G I L M N P R S T W

N

notifyLangChange() - Method in class spil.language.Dansk

Notifies of language change

notifyLangChange() - Method in class spil.language.English

Notifies of language change

notifyLangChange() - Method in interface spil.language.Language

Notifies of language change

notifyLangChange() - Method in class spil.language.LanguageHandler

Notifies of language change

A B C D E F G I L M N P R S T W

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
<?php

namespace Notadd\Foundation\Http\Middlewares;

use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Routing\Router;
use Illuminate\Support\Str;
use Notadd\Foundation\Setting\Contracts\SettingsRepository;

/**
 * Class CheckForCloseMode.
 */
class CheckForCloseMode
{
    /**
     * @var \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application
     */
    protected $application;

    /**
     * @var \Illuminate\Routing\Router
     */
    protected $router;

    /**
     * @var \Illuminate\Contracts\Routing\ResponseFactory
     */
    protected $response;

    /**
     * CheckForMaintenanceMode constructor.
     *
     * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application
     * @param \Illuminate\Contracts\Routing\ResponseFactory                               $response
     * @param \Illuminate\Routing\Router                                                  $router
     */
    public function __construct(Application $application, ResponseFactory $response, Router $router)
    {
        $this->application = $application;
        $this->response = $response;
        $this->router = $router;
    }

    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if ($this->application->isInstalled()) {
            if (!$this->application->make(SettingsRepository::class)->get('site.enabled', true) && !Str::is('admin*', $this->router->current()->uri()) && !Str::is('api*', $this->router->current()->uri())) {
                return $this->response->make('网站已经关闭!');
            }
        }

        return $next($request);
    }
}


text:
layout: post
microblog: true
audio:
photo:
date: 2018-02-17 09:55:53 -0700
guid: http://curt.micro.blog/2018/02/17/it-took-five.html
---
It took five people in two states, but we managed to cancel my mother-in-law's Amazon Prime membership.


text:
package com.arialyy.aria.sftp.download;

import com.arialyy.aria.core.TaskRecord;
import com.arialyy.aria.core.ThreadRecord;
import com.arialyy.aria.core.common.RecordHandler;
import com.arialyy.aria.core.common.RecordHelper;
import com.arialyy.aria.core.config.Configuration;
import com.arialyy.aria.core.download.DTaskWrapper;
import com.arialyy.aria.core.loader.IRecordHandler;
import com.arialyy.aria.core.wrapper.ITaskWrapper;
import com.arialyy.aria.util.RecordUtil;
import java.util.ArrayList;

/**
 * @author lyy
 * Date: 2019-09-19
 */
final class SFtpDRecordHandler extends RecordHandler {

  SFtpDRecordHandler(DTaskWrapper wrapper) {
    super(wrapper);
  }

  @Override public void handlerTaskRecord(TaskRecord record) {
    RecordHelper helper = new RecordHelper(getWrapper(), record);
    if (record.threadNum == 1) {
      helper.handleSingleThreadRecord();
    } else {
      if (getWrapper().isSupportBP()) {
        if (record.isBlock) {
          helper.handleBlockRecord();
        } else {
          helper.handleMultiRecord();
        }
      }
    }
  }

  @Override
  public ThreadRecord createThreadRecord(TaskRecord record, int threadId, long startL, long endL) {
    ThreadRecord tr;
    tr = new ThreadRecord();
    tr.taskKey = record.filePath;
    tr.threadId = threadId;
    tr.startLocation = startL;
    tr.isComplete = false;
    tr.threadType = record.taskType;
    //最后一个线程的结束位置即为文件的总长度
    if (threadId == (record.threadNum - 1)) {
      endL = getFileSize();
    }
    tr.endLocation = endL;
    tr.blockLen = RecordUtil.getBlockLen(getFileSize(), threadId, record.threadNum);
    return tr;
  }

  @Override public TaskRecord createTaskRecord(int threadNum) {
    TaskRecord record = new TaskRecord();
    record.fileName = getEntity().getFileName();
    record.filePath = getEntity().getFilePath();
    record.threadRecords = new ArrayList<>();
    record.threadNum = threadNum;
    record.isBlock = threadNum > 1;
    record.taskType = ITaskWrapper.D_SFTP;
    record.isGroupRecord = false;

    return record;
  }

  @Override public int initTaskThreadNum() {
    int threadNum = Configuration.getInstance().downloadCfg.getThreadNum();
    return getFileSize() <= IRecordHandler.SUB_LEN
        || threadNum == 1
        ? 1
        : threadNum;
  }
}


text:
define(
	['lib'],
	function (lib) {

		var dashboardCollection = lib.backbone.Collection.extend({
			comparator: "sortOrder"
		});

		var api = {
			loadDashboardList: function () {

				var defer = lib.$.Deferred();

				lib.$.getJSON('/api/uniui/dashboard/list')
					.done(function (items) {

						var collection = new dashboardCollection(items);
						defer.resolve(collection);
					})
					.fail(function () {

						defer.resolve(undefined);
					});

				return defer.promise();
			},

			createDashboard: function (title) {

				var rq = lib.$.post('/api/uniui/dashboard/create', { title: title });

				return rq.promise();
			},

			deleteDashboard: function (id) {

				var rq = lib.$.post('/api/uniui/dashboard/delete', { id: id });
				return rq.promise();
			}
		};

		return {
			loadDashboardList: api.loadDashboardList,
			createDashboard: api.createDashboard,
			deleteDashboard: api.deleteDashboard
		};
	});


text:
/*
 * A TCP RPC server serving multiple connections and using default GOB as wire format
*/

package main
import (
        "fmt"
        "net/rpc"
        "log"
        "net"
        "rpc_def"
)

type Arithmatic int

func (t *Arithmatic) Add(args rpc_def.Args, answer *int) error {
    fmt.Printf("\nProcedure Add called by the remote client")
    fmt.Printf("\nOperand 1 = %d", args.Operand1)
    fmt.Printf("\nOperand 2 = %d", args.Operand2)
    *answer = args.Operand1 + args.Operand2
    fmt.Printf("\nAnswer = %d\n", *answer)
    return nil
}

func main(){

    arithmatic := new(Arithmatic)
    //Create an object to listen on TCP
    addy, err := net.ResolveTCPAddr("tcp", "0.0.0.0:1234")
    if err != nil {
		log.Fatal(err)
    }
    //Listen on TCP
    inbound, err := net.ListenTCP("tcp", addy)
    if err != nil {
		log.Fatal(err)
    }
    //Register on RPC service
    rpc.Register(arithmatic)
    fmt.Printf("\nA TCP RPC server. Listening for requests on TCP layer ...")
    //Accept each connection and serve
    rpc.Accept(inbound)
}


text:
<md-content>
    <md-toolbar class="md-toolbar-tools">

Question App

            <md-button class="md-raised md-primary" ui-sref="startTest">
                Start Test
            </md-button>
            <md-button class="md-raised md-primary" ui-sref="ranking">
                Ranking
            </md-button>

    </md-toolbar>
</md-content>


text:
from openerp import tools, models, fields, api, exceptions

############################################################################################################################  Mozgásfej  ###
class LegrandMozgasfej(models.Model):
  _name               = 'legrand.mozgasfej'
  _order              = 'id desc'
  _rec_name           = 'id'
  state               = fields.Selection([('terv',u'Tervezet'),('szallit',u'Szállítás'),('elter',u'Átszállítva eltérésekkel'),('kesz',u'Átszállítva'),('konyvelt',u'Könyvelve')],
                        u'Állapot', default='terv', readonly=False )
  mozgasnem           = fields.Selection([('be',u'Alkatrész bevételezés'),('ki',u'Termék kiszállítás'),('belso',u'Belső szállítás'),
                                          ('helyesbit',u'Készlethelyesbítés'),('vissza',u'Alkatrész visszaszállítás'),('selejt',u'Selejt visszaszállítás')],
                                          u'Mozgásnem', required=True, default=lambda self: self.env.context.get('mozgasnem', ''))
  forrashely_id       = fields.Many2one('legrand.hely', u'Forráshely', index=True, auto_join=True)
  celallomas_id       = fields.Many2one('legrand.hely', u'Célállomás helye', index=True, auto_join=True)
  szallitas_ideje     = fields.Date(u'Szállítás ideje', default=fields.Date.today())
  kulso_dokumentum    = fields.Char(u'Külső dokumentum')
  forrasdokumentum    = fields.Char(u'Forrásdokumentum')
  megjegyzes          = fields.Char(u'Megjegyzés')
  # virtual fields
  mozgassor_irhato_e  = fields.Boolean(u'Tételek írható?', compute='_compute_mozgassor_irhato_e')
  mozgassor_ids       = fields.One2many('legrand.mozgassor', 'mozgasfej_id', u'Tételek', auto_join=True)

  @api.one
  @api.depends('state')
  def _compute_mozgassor_irhato_e(self):
    self.mozgassor_irhato_e = self.state == 'terv' or (self.state == 'elter' and self.env.user.has_group('legrand.group_legrand_user'))

  @api.model
  def create(self, vals):
    forrdict = {'be': 'legrand', 'ki': 'depo',    'vissza': 'depo',    'selejt': 'selejt'}
    celdict  = {'be': 'depo',    'ki': 'legrand', 'vissza': 'legrand', 'selejt': 'legrand'}
    if vals['mozgasnem']   == 'helyesbit':
      vals['forrashely_id'] = self.env['legrand.hely'].search([('azonosito', '=', 'legrand')]).id
    elif vals['mozgasnem'] != 'belso':
      forr_id = self.env['legrand.hely'].search([('azonosito', '=', forrdict[vals['mozgasnem']])]).id
      cel_id  = self.env['legrand.hely'].search([('azonosito', '=', celdict[vals['mozgasnem']])]).id
      vals['forrashely_id'], vals['celallomas_id'] = forr_id, cel_id
    new = super(LegrandMozgasfej, self).create(vals)
    return new

  # @api.multi
  # def write(self, vals):
  #   super(LegrandMozgasfej, self).write(vals)
  #   self.env.cr.execute('REFRESH MATERIALIZED VIEW legrand_keszlet')
  #   self.env.cr.execute('REFRESH MATERIALIZED VIEW legrand_vall_keszlet')
  #   return True

  @api.one
  def import_impex(self):
    for impex in self.env['legrand.impex'].search([]):
      sor_row = {
        'mozgasfej_id'      : self.id,
        'gyartasi_lap_id'   : impex.gyartasi_lap_id.id,
        'cikk_id'           : impex.cikk_id.id,
        'bom_id'            : impex.bom_id.id,
        'mennyiseg'         : impex.mennyiseg,
        'hibakod_id'        : impex.hibakod_id.id,
        'megjegyzes'        : impex.megjegyzes,
      }
      self.env['legrand.mozgassor'].create(sor_row)
    return True

  @api.one
  def export_impex(self):
    self.env['legrand.impex'].search([]).unlink()
    for sor in self.mozgassor_ids:
      beepules = 0
      if sor.gyartasi_lap_id and sor.cikk_id:
        bom_line_ids = sor.gyartasi_lap_id.bom_id.bom_line_ids.filtered(lambda r: r.cikk_id == sor.cikk_id)
        if len(bom_line_ids):
          beepules = bom_line_ids[0].beepules
      impex_row = {
        'sorszam'         : sor.gyartasi_lap_id.id,
        'gyartasi_lap_id' : sor.gyartasi_lap_id.id,
        'db'              : sor.gyartasi_lap_id.modositott_db,
        'cikk_id'         : sor.cikk_id.id,
        'bom_id'          : sor.bom_id.id,
        'mennyiseg'       : sor.mennyiseg,
        'hibakod_id'      : sor.hibakod_id.id,
        'rendelesszam'    : sor.gyartasi_lap_id.rendelesszam,
        'cikkszam'        : sor.gyartasi_lap_id.termekkod,
        'megjegyzes'      : sor.megjegyzes,
        'beepules'        : beepules,
        'szallito'        : sor.gyartasi_lap_id.szallito,
      }
      self.env['legrand.impex'].create(impex_row)
    return True

  @api.one
  def import_bevet(self):
    depo_id = self.env['legrand.hely'].search([('azonosito','=','depo')]).id
    for bevet in self.env['legrand.depobevetossz'].search([]):
      # Bevett alkatrészek felvétele a Mozgássor táblába
      sor_row = {
        'mozgasfej_id'      : self.id,
        'cikk_id'           : bevet.cikk_id.id,
        'mennyiseg'         : bevet.mennyiseg,
        'polcok'            : bevet.polcok,
      }
      self.env['legrand.mozgassor'].create(sor_row)

      # Bevett alkatrészek felvétele a Cikk-polc táblába
      cikk_ids = self.env['legrand.cikk_polc'].search([('cikk_id', '=', bevet.cikk_id.id), ('hely_id', '=', depo_id)])
      if cikk_ids:
        # cikk_ids.write({ 'van_e': True })
        pass
      else:
        self.env['legrand.cikk_polc'].create({ 'hely_id': depo_id, 'cikk_id': bevet.cikk_id.id, 'polc': 'Depó' })
    self.env['legrand.depobevet'].search([]).unlink()
    return True

  @api.one
  def veglegesites(self):
    if not self.mozgassor_ids:
      raise exceptions.Warning(u'Nincs véglegesíthető mozgás!')
    if self.forrashely_id == self.celallomas_id:
      raise exceptions.Warning(u'A forrás és célállomás helye megegyezik!')
    if self.mozgasnem == 'be':
      depo_id = self.env['legrand.hely'].search([('azonosito','=','depo')]).id
      ossz_uj_igeny_ids = self.env['legrand.anyagigeny'].search([('state', '=', 'uj'), ('forrashely_id', '=', depo_id)], order='id')
      for sor in self.mozgassor_ids:
        cikk_uj_igeny_ids = ossz_uj_igeny_ids.filtered(lambda r: r.cikk_id == sor.cikk_id)
        if cikk_uj_igeny_ids:
          mennyiseg = sor.mennyiseg
          for cikk_uj_igeny in cikk_uj_igeny_ids:
            hatralek = 0 if cikk_uj_igeny.mennyiseg - cikk_uj_igeny.erkezett <= 0 else cikk_uj_igeny.mennyiseg - cikk_uj_igeny.erkezett
            if hatralek == 0:
              continue
            erkezhet = mennyiseg if mennyiseg <= hatralek else hatralek
            cikk_uj_igeny.write({'erkezett': cikk_uj_igeny.erkezett + erkezhet})
            mennyiseg = mennyiseg - erkezhet
            if mennyiseg <= 0:
              break
    if self.mozgasnem == 'belso':
      ossz_uj_igeny_ids = self.env['legrand.anyagigeny'].search([('state', '=', 'uj'), ('forrashely_id', '=', self.forrashely_id.id), ('hely_id', '=', self.celallomas_id.id)], order='id')
      for sor in self.mozgassor_ids:
        cikk_uj_igeny_ids = ossz_uj_igeny_ids.filtered(lambda r: r.cikk_id == sor.cikk_id)
        if cikk_uj_igeny_ids:
          mennyiseg = sor.mennyiseg
          for cikk_uj_igeny in cikk_uj_igeny_ids:
            kuldheto = mennyiseg if mennyiseg <= cikk_uj_igeny.hatralek else cikk_uj_igeny.hatralek
            cikk_uj_igeny.write({'kuldott': cikk_uj_igeny.kuldott + kuldheto})
            mennyiseg = mennyiseg - kuldheto
            if mennyiseg <= 0:
              break
    self.state = 'szallit' if self.mozgasnem == 'belso' else 'kesz'
    return True

  @api.one
  def state2elter(self):
    self.state  = 'elter'
    return True

  @api.one
  def state2kesz(self):
    self.state  = 'kesz'
    return True

  @api.one
  def state2konyvelt(self):
    if self.mozgasnem == 'ki':
      for sor in self.mozgassor_ids:
        if sor.gyartasi_lap_id and sor.gyartasi_lap_id.state != 'konyvelt':
          sor.gyartasi_lap_id.teljesitett_db += sor.mennyiseg
          if sor.gyartasi_lap_id.teljesitett_db >= sor.gyartasi_lap_id.modositott_db:
            sor.gyartasi_lap_id.state = 'gykesz'
    self.state  = 'konyvelt'
    return True

############################################################################################################################  Mozgássor  ###
class LegrandMozgassor(models.Model):
  _name               = 'legrand.mozgassor'
  _order              = 'id'
  _rec_name           = 'cikk_id'
  mozgasfej_id        = fields.Many2one('legrand.mozgasfej',  u'Mozgásfej', index=True, readonly=True, auto_join=True)
#  cikk_id             = fields.Many2one('legrand.cikk', u'Cikkszám', domain="[('szefo_cikk_e', '=', False)]", index=True)
  cikk_id             = fields.Many2one('legrand.cikk', u'Cikkszám', index=True, auto_join=True)
  bom_id              = fields.Many2one('legrand.bom',  u'Anyagjegyzék', index=True, auto_join=True)
  gyartasi_lap_id     = fields.Many2one('legrand.gyartasi_lap',  u'Gyártási lap', auto_join=True)
  mennyiseg           = fields.Float(u'Mennyiség', digits=(16, 2), required=True)
  hibakod_id          = fields.Many2one('legrand.hibakod', u'Hibakód', auto_join=True)
  polcok              = fields.Char(u'Polc(ok)')
  megjegyzes          = fields.Char(u'Megjegyzés', default=lambda self: 'helyesbít' if self.env.context.get('mozgasnem', '') == 'helyesbit' else '')
  # forrashely_id       = fields.Many2one('legrand.hely', u'Forráshely',       related='mozgasfej_id.forrashely_id', readonly=True, store=True)
  # celallomas_id       = fields.Many2one('legrand.hely', u'Célállomás helye', related='mozgasfej_id.celallomas_id', readonly=True, store=True)
  forrashely_id       = fields.Many2one('legrand.hely', u'Forráshely', readonly=True)
  celallomas_id       = fields.Many2one('legrand.hely', u'Célállomás helye', readonly=True)
  # computed fields
  mozgasfej_sorszam   = fields.Integer(u'Sz.lev.')
  # virtual fields
  cikknev             = fields.Char(u'Cikknév', compute='_compute_cikknev', required=True)
  state               = fields.Selection([('terv',u'Tervezet'),('szallit',u'Szállítás'),('elter',u'Átszállítva eltérésekkel'),('kesz',u'Átszállítva'),('konyvelt',u'Könyvelve')],
                                        u'Állapot',  related='mozgasfej_id.state', readonly=True)
  mozgasnem           = fields.Selection([('be',u'Alkatrész bevételezés'),('ki',u'Termék kiszállítás'),('belso',u'Belső szállítás'),
                                          ('helyesbit',u'Készlethelyesbítés'),('vissza',u'Alkatrész visszaszállítás'),('selejt',u'Selejt visszaszállítás')],
                                          u'Mozgásnem',  related='mozgasfej_id.mozgasnem', readonly=True)
  forrashelyen        = fields.Float(u'Készlet', digits=(16, 2), compute='_compute_forrashelyen')
  szallito            = fields.Char(u'Szállító',    related='gyartasi_lap_id.szallito',   readonly=True)
  raktar              = fields.Char(u'Raktár',      related='gyartasi_lap_id.raktar',     readonly=True)
  raklap_min          = fields.Char(u'Raklap min',  related='gyartasi_lap_id.raklap_min', readonly=True)
  raklap_max          = fields.Char(u'Raklap max',  related='gyartasi_lap_id.raklap_max', readonly=True)

  @api.model
  def create(self, vals):
    new = super(LegrandMozgassor, self).create(vals)
    new.mozgasfej_sorszam = new.mozgasfej_id.id
    if new.mozgasnem == 'ki' and new.mennyiseg > new.forrashelyen:
      raise exceptions.Warning(u'A kiszállítás nagyobb mint a hátralék!')
    return new

  @api.multi
  def unlink(self):
    if self.state != 'terv':
      raise exceptions.Warning(u'Törölni csak Tervezet állapotban lehet!')
    return super(LegrandMozgassor, self).unlink()

  @api.one
  @api.depends('cikk_id', 'bom_id')
  def _compute_cikknev(self):
    self.cikknev = self.cikk_id.cikknev if self.cikk_id else self.bom_id.cikk_id.cikknev

  @api.onchange('gyartasi_lap_id')
  def onchange_gyartasi_lap_id(self):
    cikk_domain = [('alkatresz_e', '=', True)]
    bom_domain  = [('beepul_e', '=', True)]
    if self.mozgasfej_id.mozgasnem == 'be':
      self.bom_id = False
      cikk_domain = [('szefo_cikk_e', '=', False)]
    if self.mozgasfej_id.mozgasnem == 'ki':
      self.bom_id = self.gyartasi_lap_id.bom_id.id
      bom_domain  = [('id','=',self.bom_id.id)]
    else:
      self.cikk_id = False
      self.bom_id = False
      if self.gyartasi_lap_id:
        cikk_ids = self.gyartasi_lap_id.bom_id.bom_line_ids.mapped('cikk_id.id')
        bom_ids  = self.gyartasi_lap_id.bom_id.cikk_id.beepulok_ids.mapped('id')
        bom_ids.append(self.gyartasi_lap_id.bom_id.id)
        cikk_domain = [('id','in',cikk_ids)]
        bom_domain  = [('id','in',bom_ids)]
    return {'domain': {'cikk_id': cikk_domain, 'bom_id': bom_domain}}

  @api.onchange('cikk_id')
  def onchange_cikk_id(self):
    self.bom_id = False

  @api.onchange('bom_id')
  def onchange_bom_id(self):
    self.cikk_id = False

  @api.one
  @api.depends('cikk_id', 'forrashely_id', 'mozgasnem')
  def _compute_forrashelyen(self):
    if self.mozgasnem == 'ki':
      self.forrashelyen = self.gyartasi_lap_id.hatralek_db
    else:
      self.forrashelyen = self.env['legrand.keszlet'].search([('cikk_id', '=', self.cikk_id.id), ('hely_id', '=', self.forrashely_id.id)]).raktaron

############################################################################################################################  Kiszállítás  ###
class LegrandKiszallitas(models.Model):
  _name               = 'legrand.kiszallitas'
  _auto               = False
  _order              = 'id'
  mozgasfej_id        = fields.Many2one('legrand.mozgasfej',  u'Mozgásfej')
  bom_id              = fields.Many2one('legrand.bom',  u'Anyagjegyzék')
  gyartasi_lap_id     = fields.Many2one('legrand.gyartasi_lap',  u'Gyártási lap')
  mennyiseg           = fields.Float(u'Mennyiség', digits=(16, 2))
  ora                 = fields.Float(u'Óra', digits=(16, 2))
  termekcsoport       = fields.Char(u'Termékcsoport')
  gyartasi_hely_id    = fields.Many2one('legrand.hely', u'Fő gyártási hely')
  szallitas_ideje     = fields.Date(u'Szállítás ideje')

  def init(self, cr):
    tools.drop_view_if_exists(cr, self._table)
    cr.execute(
      """CREATE or REPLACE VIEW %s as (
        SELECT sor.*, fej.szallitas_ideje, gylap.termekcsoport, gylap.gyartasi_hely_id,
          gylap.rendelt_ora * sor.mennyiseg / gylap.modositott_db AS ora
        FROM legrand_mozgassor AS sor
        JOIN legrand_mozgasfej AS fej  ON fej.id = sor.mozgasfej_id
        JOIN legrand_gyartasi_lap AS gylap  ON gylap.id = sor.gyartasi_lap_id
        WHERE fej.mozgasnem = 'ki' AND fej.state != 'terv' AND gylap.active
      )"""
      % (self._table)
    )

############################################################################################################################  Cikk mozgás  ###
class LegrandCikkMozgas(models.Model):
  _name               = 'legrand.cikk_mozgas'
  _auto               = False
  _rec_name           = 'cikk_id'
  _order              = 'mozgasfej_id desc, datum'
  state               = fields.Selection([('terv',u'Tervezet'),('szallit',u'Szállítás'),('elter',u'Átszállítva eltérésekkel'),('kesz',u'Átszállítva'),('konyvelt',u'Könyvelve')],
                        u'Állapot', readonly=True)
  mozgasnem           = fields.Selection([('be',u'Alkatrész bevételezés'),('ki',u'Termék kiszállítás'),('belso',u'Belső szállítás'),
                                          ('helyesbit',u'Készlethelyesbítés'),('vissza',u'Alkatrész visszaszállítás'),('selejt',u'Selejt visszaszállítás')],
                                          u'Mozgásnem', readonly=True)
  mozgasfej_id        = fields.Integer(u'Mozgásfej')
  forrashely_id       = fields.Many2one('legrand.hely',       u'Forráshely',        readonly=True, auto_join=True)
  celallomas_id       = fields.Many2one('legrand.hely',       u'Célállomás helye',  readonly=True, auto_join=True)
  cikk_id             = fields.Many2one('legrand.cikk',       u'Cikkszám',          readonly=True, auto_join=True)
  bom_id              = fields.Many2one('legrand.bom',        u'Anyagjegyzék',      readonly=True, auto_join=True)
  gyartasi_lap_id     = fields.Many2one('legrand.gyartasi_lap', u'Gyártási lap',    readonly=True, auto_join=True)
  mennyiseg           = fields.Float(u'Mennyiség', digits=(16, 5), readonly=True)
  datum               = fields.Date(u'Létrehozás ideje', readonly=True)
  # virtual fields
  cikknev             = fields.Char(u'Cikknév', related='cikk_id.cikknev', readonly=True)

  def init(self, cr):
    tools.drop_view_if_exists(cr, self._table)
    cr.execute(
      """CREATE or REPLACE VIEW %s as (
        SELECT
          row_number() over() AS id,
          state,
          mozgasnem,
          mozgasfej_id,
          forrashely_id,
          celallomas_id,
          cikk_id,
          bom_id,
          gyartasi_lap_id,
          mennyiseg,
          datum
        FROM (
          SELECT fej.id AS mozgasfej_id, fej.forrashely_id, fej.celallomas_id, sor.cikk_id, sor.bom_id, sor.gyartasi_lap_id, sor.mennyiseg AS mennyiseg, fej.state, fej.mozgasnem, sor.create_date AS datum
          FROM legrand_mozgassor AS sor
          JOIN legrand_mozgasfej AS fej  ON fej.id  = sor.mozgasfej_id
          WHERE cikk_id > 0
          UNION ALL
          SELECT fej.id AS mozgasfej_id, fej.forrashely_id, fej.celallomas_id, line.cikk_id, sor.bom_id, sor.gyartasi_lap_id, sor.mennyiseg*line.beepules AS mennyiseg, fej.state, fej.mozgasnem, sor.create_date
          FROM legrand_mozgassor AS sor
          JOIN legrand_mozgasfej AS fej  ON fej.id  = sor.mozgasfej_id
          JOIN legrand_bom_line  AS line ON sor.bom_id = line.bom_id
          WHERE sor.bom_id > 0
        ) AS move
      )"""
      % (self._table)
    )


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <link href="/css/game.css" rel="stylesheet" type="text/css"/>
    <title>Polynomial</title>


text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

    <style name="SubredditImagesTheme" parent="SubredditImagesTheme.Base">

    </style>

    <style name="SubredditImagesTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>


text:
import LoadingBar from './lan-loadingBar.vue'
import Vue from 'vue'

LoadingBar.newInstance = properties => {

  const Instance = new Vue({
    data: properties,
    render (h) {
      return h(LoadingBar, {
        props: properties
      });
    }
  });

  const component = Instance.$mount();
  document.body.appendChild(component.$el);
  const loading_bar = Instance.$children[0];

  return {
    update (options) {
      if ('percent' in options) {
        loading_bar.percent = options.percent;
      }
      if (options.status) {
        loading_bar.status = options.status;
      }
      if ('visible' in options) {
        loading_bar.visible = options.visible;
      }
    },
    component: loading_bar,
    destroy () {
      document.body.removeChild(document.getElementsByClassName('lan-loadingBar')[0]);
    }
  };
};

export default LoadingBar


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

{% block body_class %}template-homepage{% endblock %}

{% block content %}

Welcome to your new Wagtail site!

You can access the admin interface here (make sure you have run "./manage.py createsuperuser" in the console first).

If you haven't already given the documentation a read, head over to http://docs.wagtail.io to start building on Wagtail

{% endblock %}


text:
/* Get Programming with JavaScript
 * Listing 9.02
 * Adding methods to our constructed object
 */

var buildPlanet = function (name, position, type) {
    var planet = {};

    planet.name = name;
    planet.position = position;
    planet.type = type;

    planet.showPlanet = function () {
        var info = planet.name;
        info += ": planet " + planet.position;
        info += " - " + planet.type;
        console.log(info);
    };

    return planet;
};

var planet1 = buildPlanet(
    "Jupiter",
    5,
    "Gas Giant"
);

planet1.showPlanet();

/* Further Adventures
 *
 * 1) Create a second planet.
 *    Use the buildPlanet function.
 *
 * 2) Call the showPlanet method on your
 *    new planet.
 *
 */


text: void setParameter(int Parameter, int Number_Of_Experiment, int Number_Of_Parameter);


text:
This is a project for 2.009, MIT's Product Engineering Processes capstone. See the course website [here](http://web.mit.edu/2.009/www/index.html)!

See our latest pitch:
[Video](https://vimeo.com/237051800) and [accompanying slide deck](http://web.mit.edu/2.009/www/grading/sketchModelReview/sketchModel_media/slides/yellowB2.pdf).

Read our project documentation [here](https://github.com/laurengulland/009yellow-beacon/tree/master/documentation)!


text:
<!DOCTYPE HTML>

<meta charset="UTF-8">
<title>Sparse covariance estimation for Gaussian variables</title>
<link rel="canonical" href="http://cvxr.com/cvx/examples/log_exp/html/sparse_covariance_est.html">
<link rel="stylesheet" href="../../examples.css" type="text/css">

Sparse covariance estimation for Gaussian variables

Jump to:
Source code
Text output

Plots
    Library index

% JoÃ«lle Skaf - 04/24/08
% (a figure is generated)
%
% Suppose y \in\reals^n is a Gaussian random variable with zero mean and
% covariance matrix R = \Expect(yy^T), with sparse inverse S = R^{-1}
% (S_ij = 0 means that y_i and y_j are conditionally independent).
% We want to estimate the covariance matrix R based on N independent
% samples y1,...,yN drawn from the distribution, and using prior knowledge
% that S is sparse
% A good heuristic for estimating R is to solve the problem
%           maximize    logdet(S) - tr(SY)
%           subject to  sum(sum(abs(S))) <= alpha
%                       S >= 0
% where Y is the sample covariance of y1,...,yN, and alpha is a sparsity
% parameter to be chosen or tuned.

% Input data
randn('state',0);
n = 10;
N = 100;
Strue = sprandsym(n,0.5,0.01,1);
R = inv(full(Strue));
y_sample = sqrtm(R)*randn(n,N);
Y = cov(y_sample');
alpha = 50;

% Computing sparse estimate of R^{-1}
cvx_begin sdp
    variable S(n,n) symmetric
    maximize log_det(S) - trace(S*Y)
    sum(sum(abs(S))) <= alpha
    S >= 0
cvx_end
R_hat = inv(S);

S(find(S<1e-4)) = 0;
figure;
subplot(121);
spy(Strue);
title('Inverse of true covariance matrix')
subplot(122);
spy(S)
title('Inverse of estimated covariance matrix')

Successive approximation method to be employed.
   sedumi will be called several times to refine the solution.
   Original size: 503 variables, 280 equality constraints
   1 exponentials add 8 variables, 5 equality constraints
-----------------------------------------------------------------
 Cones  |             Errors              |
Mov/Act | Centering  Exp cone   Poly cone | Status
--------+---------------------------------+---------
  1/  1 | 2.119e+00  3.337e-01  1.615e-08 | Solved
  1/  1 | 5.024e-03  1.815e-06  1.883e-08 | Solved
  1/  1 | 3.580e-04  2.791e-08  1.887e-08 | Solved
  0/  1 | 2.558e-05  1.891e-08  1.886e-08 | Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -31.2401


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

using ElmCommunicatorPortable.Commands;
using UnitsNet;

namespace ElmCommunicatorPortable.Responses.ObdIIResponses.ShowCurrentData
{
    public class EngineCoolantTemperatureResponse : ResponseMessage
    {
        private const int AdjustmentCoefficient = 40;

        public EngineCoolantTemperatureResponse()
        {
            Temperature = Temperature.FromDegreesCelsius(-40);
        }

        public Temperature Temperature { get; private set; }

        public override string ExpectedCommand
        {
            get
            {
                return "05";
            }
        }

        public override IReceiveMessage Parse(string message)
        {
            Command = GetCommand(ref message);
            if (!this.IsValid())
            {
                return null;
            }

            Data = message.Substring(4);
            double data = StringToByteArray(Data)[0] - AdjustmentCoefficient;
            Temperature = Temperature.FromDegreesCelsius(data);

            return this;
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace Structurizr
{

    /// <summary>
    /// Represents a deployment node, which is something like:
    ///  - Physical infrastructure (e.g. a physical server or device)
    ///  - Virtualised infrastructure (e.g. IaaS, PaaS, a virtual machine)
    ///  - Containerised infrastructure (e.g. a Docker container)
    ///  - Database server
    ///  - Java EE web/application server
    ///  - Microsoft IIS
    ///  - etc
    /// </summary>
    [DataContract]
    public sealed class DeploymentNode : DeploymentElement
    {

        private DeploymentNode _parent;

        /// <summary>
        /// The parent DeploymentNode, or null if there is no parent.
        /// </summary>
        public override Element Parent
        {
            get { return _parent; }
            set { _parent = value as DeploymentNode; }
        }

        [DataMember(Name = "technology", EmitDefaultValue = false)]
        public string Technology { get; set; }

        private int _instances = 1;

        [DataMember(Name = "instances", EmitDefaultValue = false)]
        public int Instances
        {
            get
            {
                return _instances;
            }

            set
            {
                if (value < 1)
                {
                    throw new ArgumentException("Number of instances must be a positive integer.");
                }

                _instances = value;
            }
        }

        private HashSet<DeploymentNode> _children;

        /// <summary>
        /// The set of child deployment nodes.
        /// </summary>
        [DataMember(Name = "children", EmitDefaultValue = false)]
        public ISet<DeploymentNode> Children
        {
            get
            {
                return new HashSet<DeploymentNode>(_children);
            }

            internal set
            {
                _children = new HashSet<DeploymentNode>(value);
            }
        }

        private HashSet<InfrastructureNode> _infrastructureNodes;

        /// <summary>
        /// The set of infrastructure nodes associated with this deployment node.
        /// </summary>
        [DataMember(Name = "infrastructureNodes", EmitDefaultValue = false)]
        public ISet<InfrastructureNode> InfrastructureNodes
        {
            get
            {
                return new HashSet<InfrastructureNode>(_infrastructureNodes);
            }

            internal set
            {
                _infrastructureNodes = new HashSet<InfrastructureNode>(value);
            }
        }

        private HashSet<SoftwareSystemInstance> _softwareSystemInstances;

        /// <summary>
        /// The set of software system instances associated with this deployment node.
        /// </summary>
        [DataMember(Name = "softwareSystemInstances", EmitDefaultValue = false)]
        public ISet<SoftwareSystemInstance> SoftwareSystemInstances
        {
            get
            {
                return new HashSet<SoftwareSystemInstance>(_softwareSystemInstances);
            }

            internal set
            {
                _softwareSystemInstances = new HashSet<SoftwareSystemInstance>(value);
            }
        }

        private HashSet<ContainerInstance> _containerInstances;

        /// <summary>
        /// The set of container instances associated with this deployment node.
        /// </summary>
        [DataMember(Name = "containerInstances", EmitDefaultValue = false)]
        public ISet<ContainerInstance> ContainerInstances
        {
            get
            {
                return new HashSet<ContainerInstance>(_containerInstances);
            }

            internal set
            {
                _containerInstances = new HashSet<ContainerInstance>(value);
            }
        }

        internal DeploymentNode()
        {
            Instances = 1;
            _children = new HashSet<DeploymentNode>();
            _infrastructureNodes = new HashSet<InfrastructureNode>();
            _softwareSystemInstances = new HashSet<SoftwareSystemInstance>();
            _containerInstances = new HashSet<ContainerInstance>();
            Environment = DefaultDeploymentEnvironment;
        }

        public override List<string> GetRequiredTags()
        {
            return new List<string>
            {
                Structurizr.Tags.Element,
                Structurizr.Tags.DeploymentNode
            };
        }

        public override string CanonicalName
        {
            get
            {
                return new CanonicalNameGenerator().Generate(this);
            }
        }

        /// <summary>
        /// Adds a software system instance to this deployment node, replicating relationships.
        /// </summary>
        /// <param name="softwareSystem">the SoftwareSystem to add an instance of</param>
        /// <returns>a SoftwareSystemInstance object</returns>
        public SoftwareSystemInstance Add(SoftwareSystem softwareSystem)
        {
            return Add(softwareSystem, DefaultDeploymentGroup);
        }

        /// <summary>
        /// Adds a software system instance to this deployment node, optionally replicating relationships.
        /// </summary>
        /// <param name="softwareSystem">the SoftwareSystem to add an instance of</param>
        /// <param name="deploymentGroup">the deployment group</param>
        /// <returns>a SoftwareSystemInstance object</returns>
        public SoftwareSystemInstance Add(SoftwareSystem softwareSystem, string deploymentGroup)
        {
            if (softwareSystem == null)
            {
                throw new ArgumentException("A software system must be specified.");
            }

            SoftwareSystemInstance softwareSystemInstance = Model.AddSoftwareSystemInstance(this, softwareSystem, deploymentGroup);
            _softwareSystemInstances.Add(softwareSystemInstance);

            return softwareSystemInstance;
        }

        /// <summary>
        /// Adds a container instance to this deployment node, replicating relationships.
        /// </summary>
        /// <param name="container">the Container to add an instance of</param>
        /// <returns>a ContainerInstance object</returns>
        public ContainerInstance Add(Container container)
        {
            return Add(container, DefaultDeploymentGroup);
        }

        /// <summary>
        /// Adds a container instance to this deployment node.
        /// </summary>
        /// <param name="container">the Container to add an instance of</param>
        /// <param name="deploymentGroup">the deployment group</param>
        /// <returns>a ContainerInstance object</returns>
        public ContainerInstance Add(Container container, string deploymentGroup)
        {
            if (container == null)
            {
                throw new ArgumentException("A container must be specified.");
            }

            ContainerInstance containerInstance = Model.AddContainerInstance(this, container, deploymentGroup);
            _containerInstances.Add(containerInstance);

            return containerInstance;
        }

        /// <summary>
        /// Adds a child deployment node.
        /// </summary>
        /// <param name="name">the name of the deployment node</param>
        /// <returns></returns>
        public DeploymentNode AddDeploymentNode(string name) {
            return AddDeploymentNode(name, null, null);
        }

        /// <summary>
        /// Adds a child deployment node.
        /// </summary>
        /// <param name="name">the name of the deployment node</param>
        /// <param name="description">a short description</param>
        /// <param name="technology">the technology</param>
        /// <returns></returns>
        public DeploymentNode AddDeploymentNode(string name, string description, string technology) {
            return AddDeploymentNode(name, description, technology, 1);
        }

        /// <summary>
        /// Adds a child deployment node.
        /// </summary>
        /// <param name="name">the name of the deployment node</param>
        /// <param name="description">a short description</param>
        /// <param name="technology">the technology</param>
        /// <param name="instances">the number of  instances</param>
        /// <returns></returns>
        public DeploymentNode AddDeploymentNode(string name, string description, string technology, int instances) {
            return AddDeploymentNode(name, description, technology, instances, null);
        }

        /// <summary>
        /// Adds a child deployment node.
        /// </summary>
        /// <param name="name">the name of the deployment node</param>
        /// <param name="description">a short description</param>
        /// <param name="technology">the technology</param>
        /// <param name="instances">the number of  instances</param>
        /// <param name="properties">a Dictionary (string,string) describing name=value properties</param>
        /// <returns></returns>
        public DeploymentNode AddDeploymentNode(string name, string description, string technology, int instances, Dictionary<string,string> properties) {
            DeploymentNode deploymentNode = Model.AddDeploymentNode(this, this.Environment, name, description, technology, instances, properties);
            if (deploymentNode != null) {
                _children.Add(deploymentNode);
            }

            return deploymentNode;
        }

        /// <summary>
        /// Gets the DeploymentNode with the specified name.
        /// </summary>
        /// <param name="name">the name of the deployment node</param>
        /// <returns>the DeploymentNode instance with the specified name (or null if it doesn't exist)</returns>
        public DeploymentNode GetDeploymentNodeWithName(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("A name must be specified.");
            }

            return _children.FirstOrDefault(dn => dn.Name.Equals(name));
        }

        /// <summary>
        /// Gets the InfrastructureNode with the specified name.
        /// </summary>
        /// <param name="name">the name of the infrastructure node</param>
        /// <returns>the InfrastructureNode instance with the specified name (or null if it doesn't exist)</returns>
        public InfrastructureNode GetInfrastructureNodeWithName(string name)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentException("A name must be specified.");
            }

            return _infrastructureNodes.FirstOrDefault(dn => dn.Name.Equals(name));
        }

        /// <summary>
        /// Adds a child infrastructure node.
        /// </summary>
        /// <param name="name">the name of the infrastructure node</param>
        /// <returns>an InfrastructureNode object</returns>
        public InfrastructureNode AddInfrastructureNode(string name)
        {
            return AddInfrastructureNode(name, null, null);
        }

        /// <summary>
        /// Adds a child infrastructure node.
        /// </summary>
        /// <param name="name">the name of the infrastructure node</param>
        /// <param name="description">a short description</param>
        /// <param name="technology">the technology</param>
        /// <returns>an InfrastructureNode object</returns>
        public InfrastructureNode AddInfrastructureNode(string name, string description, string technology)
        {
            return AddInfrastructureNode(name, description, technology, null);
        }

        /// <summary>
        /// Adds a child infrastructure node.
        /// </summary>
        /// <param name="name">the name of the infrastructure node</param>
        /// <param name="description">a short description</param>
        /// <param name="technology">the technology</param>
        /// <param name="properties">a Dictionary (string,string) describing name=value properties</param>
        /// <returns>an InfrastructureNode object</returns>
        public InfrastructureNode AddInfrastructureNode(string name, string description, string technology, Dictionary<string, string> properties)
        {
            InfrastructureNode infrastructureNode = Model.AddInfrastructureNode(this, name, description, technology, properties);
            if (infrastructureNode != null) {
                _infrastructureNodes.Add(infrastructureNode);
            }
            return infrastructureNode;
        }

        /// <summary>
        /// Adds a relationship between this and another deployment node.
        /// </summary>
        /// <param name="destination">the destination DeploymentNode</param>
        /// <param name="description">a short description of the relationship</param>
        /// <param name="technology">the technology</param>
        /// <returns>a Relationship object</returns>
        public Relationship Uses(DeploymentNode destination, string description, string technology)
        {
            return Model.AddRelationship(this, destination, description, technology);
        }

    }

}


text:
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <title>Blog</title>
</head>

<body>Hello, there! This is the blog!</body>

</html>


text: LOAD DATA LOCAL INFILE "absence.txt" INTO TABLE absence;


text:
  Wasselonne est
      une commune située dans le département de Bas-Rhin en Alsace. Elle comptait 5 566 habitants en 2008.

La localité dispose s'agissant de l'enseignement de un collège.
Pour les plus petits d'entre nous, la localité dispose de deux maternelles et une école primaire.
Wasselonne propose les équipements éducatifs permettant une vie àgréable.
Si vous avez un projet immobilier à Wasselonne, il est intéressant d' évaluer la qualité des équipements éducatifs

La ville offre de nombreux  équipements, elle dispose, entre autres, de un bassin de natation, un terrain de tennis, trois terrains de sport et une boucle de randonnée.

Le parc d'habitations, à Wasselonne, se décomposait en 2011 en 1 234 appartements et 1 406 maisons soit
 un marché plutôt équilibré.

À Wasselonne le salaire moyen mensuel par habitant est situé à environ 1 944 €  net. Ceci est inférieur à la moyenne nationale.

À coté de Wasselonne sont positionnées géographiquement les villes de
Wangen à 2 km, 693 habitants,
Cosswiller située à 3 km, 549 habitants,
Hohengoeft à 3 km, 517 habitants,
Crastatt à 2 km, 195 habitants,
Marlenheim située à 3 km, 3 477 habitants,
Zehnacker à 3 km, 229 habitants,
 entre autres. De plus, Wasselonne est située à seulement 22 km de Strasbourg.

À Wasselonne, le prix moyen à l'achat d'un appartement s'évalue à 2 003 € du m² en vente. la valorisation moyenne d'une maison à l'achat se situe à 1 724 € du m². À la location la valorisation moyenne se situe à 7,21 € du m² mensuel.


text:
<?xml version="1.0"?>
<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>hazelcastmq-parent</artifactId>
    <groupId>org.mpilone.hazelcastmq</groupId>
    <version>1.4.0</version>
  </parent>

  <artifactId>hazelcastmq-stomp</artifactId>
  <name>HazelcastMQ STOMP</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <!-- Compile -->
    <dependency>
      <groupId>org.mpilone.yeti</groupId>
      <artifactId>yeti</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.mpilone.hazelcastmq</groupId>
      <artifactId>hazelcastmq-core</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


text:
#ifndef SGX_SYSSELECT_T_H__
#define SGX_SYSSELECT_T_H__

#include <stdint.h>
#include <wchar.h>
#include <stddef.h>
#include "sgx_edger8r.h" /* for sgx_ocall etc. */

#include "struct/sgx_sysselect_struct.h"

#include <stdlib.h> /* for size_t */

#define SGX_CAST(type, item) ((type)(item))

#ifdef __cplusplus
extern "C" {
#endif

sgx_status_t SGX_CDECL ocall_select(int* retval, int __nfds, fd_set* __readfds, fd_set* __writefds, fd_set* __exceptfds, void* __timeout, int tvsize);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif


text:
date: 2015-12-18 13:19:16 -0800
summary: >
    Dynamic JPEG/WebP, improved LDAP support, central connection history,
    filterable connection/user lists.

binary-war:
    "guacamole-0.9.9.war" : "http://downloads.sourceforge.net/project/guacamole/current/binary/guacamole-0.9.9.war"

extensions:
    "Database Authentication"          : "http://downloads.sourceforge.net/project/guacamole/current/extensions/guacamole-auth-jdbc-0.9.9.tar.gz"
    "LDAP Authentication"              : "http://downloads.sourceforge.net/project/guacamole/current/extensions/guacamole-auth-ldap-0.9.9.tar.gz"
    "NoAuth (Disabled) Authentication" : "http://downloads.sourceforge.net/project/guacamole/current/extensions/guacamole-auth-noauth-0.9.9.tar.gz"

source-archives:
    "guacamole-client-0.9.9.tar.gz" : "http://downloads.sourceforge.net/project/guacamole/current/source/guacamole-client-0.9.9.tar.gz"
    "guacamole-server-0.9.9.tar.gz" : "http://downloads.sourceforge.net/project/guacamole/current/source/guacamole-server-0.9.9.tar.gz"

documentation:
    "Manual"              : "/doc/0.9.9/gug"
    "guacamole-common"    : "/doc/0.9.9/guacamole-common"
    "guacamole-common-js" : "/doc/0.9.9/guacamole-common-js"
    "guacamole-ext"       : "/doc/0.9.9/guacamole-ext"
    "libguac"             : "/doc/0.9.9/libguac"

---

The 0.9.9 release of Guacamole features improved performance due to dynamic use
of JPEG and WebP, as well as greatly improved LDAP support. The Guacamole
interface overall is now all but completely searchable/filterable, with
"Filter" fields available on every connection and user list. This interface-wide
availability of filtering includes the home screen, all user and
connection lists within the administration interface, as well as the completely
new and unified connection history screen.

Everything is searchable
------------------------

Just about every list in the Guacamole interface is now searchable, including
the list of connections on the home screen, all connection and user lists in
the admin interface, and the new connection history screen.

Users with large numbers of connections (and administrators managing large
numbers of users and connections) can now narrow their view by entering search
terms into any of the "Filter" fields. There is no longer any need to hop back
and forth through dozens of pages to find that one connection within a haystack
of several hundred connections.

 * [GUAC-1193] - Centralize usage statistics
 * [GUAC-1406] - Allow connection and user lists to be filtered

Dynamic JPEG/WebP compression
-----------------------------

Previous releases of Guacamole encoded images purely using PNG compression.
This was very efficient for typical remote desktop use, but anything involving
fast moving or photographic imagery would tend to slow down.

Thanks to the contributions and collaboration of Frode Langelo of [Skytap](http://www.skytap.com/), Guacamole will
now select between PNG, JPEG, and WebP depending on how fast parts of your
screen are changing, the content of those areas, and which encodings are
supported by your browser.

 * [GUAC-240] - Implement streaming of JPEG images
 * [GUAC-1305] - Implement support for WebP encoded images

LDAP improvements
-----------------

Guacamole's LDAP support can now be used with more complex directory
hierarchies, such as those used by Active Directory. In addition to directly
deriving a user's DN using a base DN and username attribute, Guacamole can now
search for and discover a user's DN when given the necessary credentials to do
so. This allows users to be mapped even if their DNs do not contain usernames.

Encrypted LDAP can now also be used. Past releases supported only unencrypted
LDAP connections, but communication with LDAP servers using SSL/TLS or STARTTLS
is now fully supported.

 * [GUAC-1115] - Support complex LDAP organizational structures
 * [GUAC-1166] - Support for LDAP over SSL/TLS
 * [GUAC-1342] - Passthrough authentication not working for LDAP in 0.9.8

Run commands via SSH
--------------------

The equivalent of the `ssh` command's `-c` option has now been implemented
within Guacamole. By specifying a value for the `command` parameter of an SSH
connection (or by entering a value within the appropriate field in the admin
interface), the SSH connection will run the specified command instead of simply
invoking the default shell.

 * [GUAC-1038] - Add parameter for running command via SSH

Sound, printing, and file transfer fixed on Windows 2012
--------------------------------------------------------

Windows Server 2012 suffers from a bug which requires both RDPDR (drive
redirection or printing) and RDPSND (audio) to be loaded for either to work,
even if both are not actually needed. Past releases of Guacamole had a workaround
for this which automatically loaded RDPDR if audio was enabled, but this
workaround did not apply in the other direction. If audio was disabled,
printing and file transfer would mysteriously not work.

As of Guacamole 0.9.9, both RDPSND and RDPDR will always be loaded if either is
enabled. File transfer, printing, and sound should all work under Windows
Server 2012, regardless of which combination of those features is enabled.

 * [GUAC-1196] - RDPSND and RDPDR must be loaded together

Linking Docker images to non-Docker databases
---------------------------------------------

The Guacamole Docker images previously required 100% Docker everything when
it Came to deployment. Both the web application and guacd needed to be within
Docker, and the database backing the web application (MySQL or PostgreSQL)
needed to be within Docker as well.

While all Guacamole components (the web application and guacd) still need to be
within Docker if Docker is going to be used, the requirement that the database
be within Docker has been removed. The hostname and port of your database can
now be specified when creating the Guacamole Docker container. The database
does not need to be specified with a Docker link.

 * [GUAC-1291] - Allow linking with non-Docker MySQL/PostgreSQL databases

Guacamole API and protocol changes
----------------------------------

In preparation for supporting real-time hardware encoding of complex grapics,
the Guacamole protocol and JavaScript client have been extended to allow
streaming of arbitrary video codecs. Developers using the Guacamole API can
associate the JavaScript client with codec implementations which will then be
used to decode and render video streams.

The Guacamole extension API has also been updated, allowing extensions to
automatically invalidate users' sessions by throwing specific exceptions which
by their own nature imply that the user's current session is invalid. These
exceptions are automatically caught and handled within the Guacamole web
application, invalidating the user's session and displaying a login dialog.

 * [GUAC-1354] - Add real-time video streaming support to Guacamole protocol
 * [GUAC-1364] - Allow extensions to invalidate user sessions

Minor improvements / bug fixes
------------------------------

In addition to the above major improvements, several minor improvements and bug
fixes are included in 0.9.9, including additional translations, changes to
interface layout and behavior, and improved support for Microsoft Edge.

 * [GUAC-554] - WebSocket connection errors not exposed
 * [GUAC-555] - WebSocket connection errors cannot be detected as required by connect()
 * [GUAC-799] - Guacamole.Status is undocumented
 * [GUAC-1250] - Display login page instead of "reconnect/home" when session expires
 * [GUAC-1314] - Support distinct keysyms for numeric keypad
 * [GUAC-1324] - "Currently in use" text overlaps connection name on mobile
 * [GUAC-1338] - Add German missing translations
 * [GUAC-1345] - Allow available languages to be restricted
 * [GUAC-1349] - File transfer dialog overflows screen
 * [GUAC-1361] - listen() need not be present in main loop
 * [GUAC-1374] - "guac_socket_alloc()" must initialize "__keep_alive_enabled"
 * [GUAC-1375] - JavaScript error in MS EDGE if HTML5 audio/video is disabled
 * [GUAC-1376] - Add "logout" action to disconnect/error notifications
 * [GUAC-1380] - Added missing Dutch translations
 * [GUAC-1404] - Active sessions list sometimes contains closed connections


text:
<!DOCTYPE HTML>

  <title>Web Storage</title>

storage_local_getItem


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/csZbarScannerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/csZbarScannerBackground" >

    <TextView android:id="@+id/csZbarScannerTitle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top|center_horizontal"
        android:paddingTop="15dp"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:gravity="center"
        android:text="@string/csZbarScannerTitle"
        android:textColor="@color/csZbarScannerTextColor"
        android:background="@color/csZbarScannerTextBackground"
        android:fontFamily="sans-serif-light"
        android:textSize="20pt" />

    <TextView android:id="@+id/csZbarScannerInstructions"
        android:layout_gravity="bottom|center_horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="5dp"
        android:paddingBottom="15dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:gravity="center"
        android:textSize="12pt"
        android:textColor="@color/csZbarScannerTextColor"
        android:background="@color/csZbarScannerTextBackground"
        android:fontFamily="sans-serif-light"
        android:text="@string/csZbarScannerInstructions" />

    <RelativeLayout android:id="@+id/csZbarScannerSightContainer"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <View android:id="@+id/csZbarScannerSight"
            android:layout_width="fill_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_centerInParent="true"
            android:gravity="center_vertical"
            android:background="#ff0000" />

    </RelativeLayout>

</FrameLayout>


text:
@interface PodsDummy_Pods_SwiftyKnobExample : NSObject
@end
@implementation PodsDummy_Pods_SwiftyKnobExample
@end


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

/**
 * @fileoverview Unit tests for the TextInput short response.
 */

import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HtmlEscaperService } from 'services/html-escaper.service';
import { ShortResponseTextInputComponent } from './oppia-short-response-text-input.component';
import { TruncateAtFirstLinePipe } from 'filters/string-utility-filters/truncate-at-first-line.pipe';

describe('ShortResponseTextInputComponent', () => {
  let component: ShortResponseTextInputComponent;
  let fixture: ComponentFixture<ShortResponseTextInputComponent>;

  let mockHtmlEscaperService = {
    escapedJsonToObj: function(answer) {
      return answer;
    }
  };

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ShortResponseTextInputComponent, TruncateAtFirstLinePipe],
      providers: [
        {
          provide: HtmlEscaperService,
          useValue: mockHtmlEscaperService
        }
      ],
      schemas: [NO_ERRORS_SCHEMA]
    }).compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(ShortResponseTextInputComponent);
    component = fixture.componentInstance;

    component.answerWithValue = 'answer';
  });

  it('should initialise when users submits answer', () => {
    component.ngOnInit();

    expect(component.answer).toBe('answer');
  });
});


text:
"""This file defines the entry points for typical installations."""

# Imports must be inline to stop argument pollution across the entry points.
# pylint: disable=g-import-not-at-top

import platform

from grr.lib import config_lib
from grr.lib import flags

# Set custom options for each distro here.
DISTRO_DEFAULTS = {
    "debian": {"flag_defaults": {"config": "/etc/grr/grr-server.yaml"},
               "config_opts": {"Config.writeback": "/etc/grr/server.local.yaml"}
              },
    "redhat": {"flag_defaults": {"config": "/etc/grr/grr-server.yaml"},
               "config_opts": {"Config.writeback": "/etc/grr/server.local.yaml"}
              },
}

def GetDistro():
  """Return the distro specific config to use."""
  if hasattr(platform, "linux_distribution"):
    distribution = platform.linux_distribution()[0].lower()
    if distribution in ["ubuntu", "debian"]:
      return "debian"
    if distribution in ["red hat enterprise linux server"]:
      return "redhat"
  raise RuntimeError("Missing distro specific config. Please update "
                     "distro_entry.py.")

def SetConfigOptions():
  """Set distro specific options."""
  distro = GetDistro()
  for option, value in DISTRO_DEFAULTS[distro]["config_opts"].items():
    config_lib.CONFIG.Set(option, value)
  flags.PARSER.set_defaults(**DISTRO_DEFAULTS[distro]["flag_defaults"])

def Console():
  from grr.tools import console
  SetConfigOptions()
  flags.StartMain(console.main)

def ConfigUpdater():
  from grr.tools import config_updater
  SetConfigOptions()
  flags.StartMain(config_updater.main)

def GrrServer():
  from grr.tools import grr_server
  SetConfigOptions()
  flags.StartMain(grr_server.main)

def EndToEndTests():
  from grr.tools import end_to_end_tests
  SetConfigOptions()
  flags.StartMain(end_to_end_tests.main)

def Export():
  from grr.tools import export
  export.AddPluginsSubparsers()
  SetConfigOptions()
  flags.StartMain(export.main)

def Enroller():
  from grr.worker import enroller
  SetConfigOptions()
  flags.StartMain(enroller.main)

def Worker():
  from grr.worker import worker
  SetConfigOptions()
  flags.StartMain(worker.main)

def GRRFuse():
  from grr.tools import fuse_mount
  SetConfigOptions()
  flags.StartMain(fuse_mount.main)

def Client():
  from grr.client import client
  # Note client doesn't call SetConfigOptions as this entry point is primarily
  # used for testing on the server.
  flags.StartMain(client.main)

def AdminUI():
  from grr.gui import admin_ui
  SetConfigOptions()
  flags.StartMain(admin_ui.main)


text:
#import "ORKRecorder_Private.h"

NS_ASSUME_NONNULL_BEGIN

@class ORKDataLogger;

@interface ORKRecorder ()

@property (nonatomic, strong, nullable) ORKStep *step;

@property (nonatomic, strong, nullable) ORKRecorderConfiguration *configuration;

@property (nonatomic) BOOL continuesInBackground;

@property (nonatomic, copy, nullable) NSDate *startDate;

- (NSString *)recorderType;

- (nullable ORKDataLogger *)makeJSONDataLoggerWithError:(NSError * _Nullable *)error NS_REQUIRES_SUPER;

- (void)reset NS_REQUIRES_SUPER;

- (void)reportFileResultWithFile:(nullable NSURL *)fileUrl error:(nullable NSError *)error;

- (nullable NSURL *)recordingDirectoryURL;

@end

NS_ASSUME_NONNULL_END


text:
package org.eclipse.jdt.internal.ui.browsing;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

import org.eclipse.core.resources.IResource;

import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;

import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IElementChangedListener;
import org.eclipse.jdt.core.IImportContainer;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaElementDelta;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IParent;
import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.IWorkingCopy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;

import org.eclipse.jdt.ui.StandardJavaElementContentProvider;

import org.eclipse.jdt.internal.ui.JavaPlugin;

class JavaBrowsingContentProvider extends StandardJavaElementContentProvider implements IElementChangedListener {

	private StructuredViewer fViewer;
	private Object fInput;
	private JavaBrowsingPart fBrowsingPart;
	private int fReadsInDisplayThread;

	public JavaBrowsingContentProvider(boolean provideMembers, JavaBrowsingPart browsingPart) {
		super(provideMembers);
		fBrowsingPart= browsingPart;
		fViewer= fBrowsingPart.getViewer();
		JavaCore.addElementChangedListener(this);
	}

	@Override
	public boolean hasChildren(Object element) {
		startReadInDisplayThread();
		try{
			return super.hasChildren(element);
		} finally {
			finishedReadInDisplayThread();
		}
	}

	@Override
	public Object[] getChildren(Object element) {
		if (!exists(element))
			return NO_CHILDREN;

		startReadInDisplayThread();
		try {
			if (element instanceof Collection) {
				Collection<?> elements= (Collection<?>)element;
				if (elements.isEmpty())
					return NO_CHILDREN;
				Object[] result= new Object[0];
				Iterator<?> iter= ((Collection<?>)element).iterator();
				while (iter.hasNext()) {
					Object[] children= getChildren(iter.next());
					if (children != NO_CHILDREN)
						result= concatenate(result, children);
				}
				return result;
			}
			if (element instanceof IPackageFragment)
				return getPackageContents((IPackageFragment)element);
			if (fProvideMembers && element instanceof IType)
				return getChildren((IType)element);
			if (fProvideMembers && element instanceof ISourceReference && element instanceof IParent)
				return removeImportAndPackageDeclarations(super.getChildren(element));
			if (element instanceof IJavaProject)
				return getPackageFragmentRoots((IJavaProject)element);
			return super.getChildren(element);
		} catch (JavaModelException e) {
			return NO_CHILDREN;
		} finally {
			finishedReadInDisplayThread();
		}
	}

	private Object[] getPackageContents(IPackageFragment fragment) throws JavaModelException {
		ISourceReference[] sourceRefs;
		if (fragment.getKind() == IPackageFragmentRoot.K_SOURCE) {
			sourceRefs= fragment.getCompilationUnits();
		}
		else {
			IClassFile[] classFiles= fragment.getClassFiles();
			List<IClassFile> topLevelClassFile= new ArrayList<IClassFile>();
			for (int i= 0; i < classFiles.length; i++) {
				IType type= classFiles[i].getType();
				if (type != null && type.getDeclaringType() == null && !type.isAnonymous() && !type.isLocal())
					topLevelClassFile.add(classFiles[i]);
			}
			sourceRefs= topLevelClassFile.toArray(new ISourceReference[topLevelClassFile.size()]);
		}

		Object[] result= new Object[0];
		for (int i= 0; i < sourceRefs.length; i++)
			result= concatenate(result, removeImportAndPackageDeclarations(getChildren(sourceRefs[i])));
		return concatenate(result, fragment.getNonJavaResources());
	}

	private Object[] removeImportAndPackageDeclarations(Object[] members) {
		ArrayList<Object> tempResult= new ArrayList<Object>(members.length);
		for (int i= 0; i < members.length; i++)
			if (!(members[i] instanceof IImportContainer) && !(members[i] instanceof IPackageDeclaration))
				tempResult.add(members[i]);
		return tempResult.toArray();
	}

	private Object[] getChildren(IType type) throws JavaModelException{
		IParent parent;
		if (type.isBinary())
			parent= type.getClassFile();
		else {
			parent= type.getCompilationUnit();
		}
		if (type.getDeclaringType() != null)
			return type.getChildren();

		// Add import declarations
		IJavaElement[] members= parent.getChildren();
		ArrayList<IJavaElement> tempResult= new ArrayList<IJavaElement>(members.length);
		for (int i= 0; i < members.length; i++)
			if ((members[i] instanceof IImportContainer))
				tempResult.add(members[i]);
		tempResult.addAll(Arrays.asList(type.getChildren()));
		return tempResult.toArray();
	}

	@Override
	protected Object[] getPackageFragmentRoots(IJavaProject project) throws JavaModelException {
		if (!project.getProject().isOpen())
			return NO_CHILDREN;

		IPackageFragmentRoot[] roots= project.getPackageFragmentRoots();
		List<IJavaElement> list= new ArrayList<IJavaElement>(roots.length);
		// filter out package fragments that correspond to projects and
		// replace them with the package fragments directly
		for (int i= 0; i < roots.length; i++) {
			IPackageFragmentRoot root= roots[i];
			if (!root.isExternal()) {
				IJavaElement[] children= root.getChildren();
				for (int k= 0; k < children.length; k++)
					list.add(children[k]);
			}
			else if (hasChildren(root)) {
				list.add(root);
			}
		}
		return concatenate(list.toArray(), project.getNonJavaResources());
	}

	// ---------------- Element change handling

	/* (non-Javadoc)
	 * Method declared on IContentProvider.
	 */
	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		super.inputChanged(viewer, oldInput, newInput);

		if (newInput instanceof Collection) {
			// Get a template object from the collection
			Collection<?> col= (Collection<?>)newInput;
			if (!col.isEmpty())
				newInput= col.iterator().next();
			else
				newInput= null;
		}
		fInput= newInput;
	}

	/* (non-Javadoc)
	 * Method declared on IContentProvider.
	 */
	@Override
	public void dispose() {
		super.dispose();
		JavaCore.removeElementChangedListener(this);
	}

	/* (non-Javadoc)
	 * Method declared on IElementChangedListener.
	 */
	public void elementChanged(final ElementChangedEvent event) {
		try {
			processDelta(event.getDelta());
		} catch(JavaModelException e) {
			JavaPlugin.log(e.getStatus());
		}
	}

	/**
	 * Processes a delta recursively. When more than two children are affected the
	 * tree is fully refreshed starting at this node. The delta is processed in the
	 * current thread but the viewer updates are posted to the UI thread.
	 */
	protected void processDelta(IJavaElementDelta delta) throws JavaModelException {
		int kind= delta.getKind();
		int flags= delta.getFlags();
		final IJavaElement element= delta.getElement();
		final boolean isElementValidForView= fBrowsingPart.isValidElement(element);

		if (!getProvideWorkingCopy() && element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy())
			return;

		if (element != null && element.getElementType() == IJavaElement.COMPILATION_UNIT && !isOnClassPath((ICompilationUnit)element))
			return;

		// handle open and closing of a solution or project
		if (((flags & IJavaElementDelta.F_CLOSED) != 0) || ((flags & IJavaElementDelta.F_OPENED) != 0)) {
			postRefresh(null);
			return;
		}

		if (kind == IJavaElementDelta.REMOVED) {
			Object parent= internalGetParent(element);
			if (isElementValidForView) {
				if (element instanceof IClassFile) {
					postRemove(((IClassFile)element).getType());
				} else if (element instanceof ICompilationUnit && !((ICompilationUnit)element).isWorkingCopy()) {
						postRefresh(null);
				} else if (element instanceof ICompilationUnit && ((ICompilationUnit)element).isWorkingCopy()) {
					if (getProvideWorkingCopy())
						postRefresh(null);
				} else if (parent instanceof ICompilationUnit && getProvideWorkingCopy() && !((ICompilationUnit)parent).isWorkingCopy()) {
					if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy()) {
						// working copy removed from system - refresh
						postRefresh(null);
					}
				} else if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy() && parent != null && parent.equals(fInput))
					// closed editor - removing working copy
					postRefresh(null);
				else
					postRemove(element);
			}

			if (fBrowsingPart.isAncestorOf(element, fInput)) {
				if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy()) {
					postAdjustInputAndSetSelection(((IJavaElement) fInput).getPrimaryElement());
				} else
					postAdjustInputAndSetSelection(null);
			}

			if (fInput != null && fInput.equals(element))
				postRefresh(null);

			if (parent instanceof IPackageFragment && fBrowsingPart.isValidElement(parent))  {
				// refresh if package gets empty (might be filtered)
				if (isPackageFragmentEmpty((IPackageFragment)parent) && fViewer.testFindItem(parent) != null)
						postRefresh(null);
			}

			return;
		}
		if (kind == IJavaElementDelta.ADDED && delta.getMovedFromElement() != null && element instanceof ICompilationUnit)
			return;

		if (kind == IJavaElementDelta.ADDED) {
			if (isElementValidForView) {
				Object parent= internalGetParent(element);
				if (element instanceof IClassFile) {
					postAdd(parent, ((IClassFile)element).getType());
				} else if (element instanceof ICompilationUnit && !((ICompilationUnit)element).isWorkingCopy()) {
						postAdd(parent, ((ICompilationUnit)element).getTypes());
				} else if (parent instanceof ICompilationUnit && getProvideWorkingCopy() && !((ICompilationUnit)parent).isWorkingCopy()) {
					//	do nothing
				} else if (element instanceof IWorkingCopy && ((IWorkingCopy)element).isWorkingCopy()) {
					// new working copy comes to live
					postRefresh(null);
				} else
					postAdd(parent, element);
			} else	if (fInput == null) {
				IJavaElement newInput= fBrowsingPart.findInputForJavaElement(element);
				if (newInput != null)
					postAdjustInputAndSetSelection(element);
			} else if (element instanceof IType && fBrowsingPart.isValidInput(element)) {
				IJavaElement cu1= element.getAncestor(IJavaElement.COMPILATION_UNIT);
				IJavaElement cu2= ((IJavaElement)fInput).getAncestor(IJavaElement.COMPILATION_UNIT);
				if  (cu1 != null && cu2 != null && cu1.equals(cu2))
					postAdjustInputAndSetSelection(element);
			}
			return;
		}

		if (kind == IJavaElementDelta.CHANGED) {
			if (fInput != null && fInput.equals(element) && (flags & IJavaElementDelta.F_CHILDREN) != 0 && (flags & IJavaElementDelta.F_FINE_GRAINED) != 0) {
				postRefresh(null, true);
				return;
			}
			if (isElementValidForView && (flags & IJavaElementDelta.F_MODIFIERS) != 0) {
					postUpdateIcon(element);
			}
		}

		if (isClassPathChange(delta))
			 // throw the towel and do a full refresh
			postRefresh(null);

		if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0 && fInput instanceof IJavaElement) {
			IPackageFragmentRoot pkgRoot= (IPackageFragmentRoot)element;
			IJavaElement inputsParent= ((IJavaElement)fInput).getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
			if (pkgRoot.equals(inputsParent))
				postRefresh(null);
		}

		// the source attachment of a JAR has changed
		if (element instanceof IPackageFragmentRoot && (((flags & IJavaElementDelta.F_SOURCEATTACHED) != 0 || ((flags & IJavaElementDelta.F_SOURCEDETACHED)) != 0)))
			postUpdateIcon(element);

		IJavaElementDelta[] affectedChildren= delta.getAffectedChildren();
		if (affectedChildren.length > 1) {
			// a package fragment might become non empty refresh from the parent
			if (element instanceof IPackageFragment) {
				IJavaElement parent= (IJavaElement)internalGetParent(element);
				// avoid posting a refresh to an invisible parent
				if (element.equals(fInput)) {
					postRefresh(element);
				} else {
					postRefresh(parent);
				}
			}
			// more than one child changed, refresh from here downwards
			if (element instanceof IPackageFragmentRoot && isElementValidForView) {
				postRefresh(skipProjectPackageFragmentRoot((IPackageFragmentRoot)element));
				return;
			}
		}
		for (int i= 0; i < affectedChildren.length; i++) {
			processDelta(affectedChildren[i]);
		}
	}

	private boolean isOnClassPath(ICompilationUnit element) throws JavaModelException {
		IJavaProject project= element.getJavaProject();
		if (project == null || !project.exists())
			return false;
		return project.isOnClasspath(element);
	}

	/**
	 * Updates the package icon
	 */
	 private void postUpdateIcon(final IJavaElement element) {
	 	postRunnable(new Runnable() {
			public void run() {
				Control ctrl= fViewer.getControl();
				if (ctrl != null && !ctrl.isDisposed())
					fViewer.update(element, new String[]{IBasicPropertyConstants.P_IMAGE});
			}
		});
	 }

	private void postRefresh(final Object root, final boolean updateLabels) {
		postRunnable(new Runnable() {
			public void run() {
				Control ctrl= fViewer.getControl();
				if (ctrl != null && !ctrl.isDisposed())
					fViewer.refresh(root, updateLabels);
			}
		});
	}

	private void postRefresh(final Object root) {
		postRefresh(root, false);
	}

	private void postAdd(final Object parent, final Object element) {
		postAdd(parent, new Object[] {element});
	}

	private void postAdd(final Object parent, final Object[] elements) {
		if (elements == null || elements.length <= 0)
			return;

		postRunnable(new Runnable() {
			public void run() {
				Control ctrl= fViewer.getControl();
				if (ctrl != null && !ctrl.isDisposed()) {
					Object[] newElements= getNewElements(elements);
					if (fViewer instanceof AbstractTreeViewer) {
						if (fViewer.testFindItem(parent) == null) {
							Object root= ((AbstractTreeViewer)fViewer).getInput();
							if (root != null)
								((AbstractTreeViewer)fViewer).add(root, newElements);
						}
						else
							((AbstractTreeViewer)fViewer).add(parent, newElements);
					}
					else if (fViewer instanceof ListViewer)
						((ListViewer)fViewer).add(newElements);
					else if (fViewer instanceof TableViewer)
						((TableViewer)fViewer).add(newElements);
					if (fViewer.testFindItem(elements[0]) != null)
						fBrowsingPart.adjustInputAndSetSelection(elements[0]);
				}
			}
		});
	}

	private Object[] getNewElements(Object[] elements) {
		int elementsLength= elements.length;
		ArrayList<Object> result= new ArrayList<Object>(elementsLength);
		for (int i= 0; i < elementsLength; i++) {
			Object element= elements[i];
			if (fViewer.testFindItem(element) == null)
				result.add(element);
		}
		return result.toArray();
	}

	private void postRemove(final Object element) {
		postRemove(new Object[] {element});
	}

	private void postRemove(final Object[] elements) {
		if (elements.length <= 0)
			return;

		postRunnable(new Runnable() {
			public void run() {
				Control ctrl= fViewer.getControl();
				if (ctrl != null && !ctrl.isDisposed()) {
					if (fViewer instanceof AbstractTreeViewer)
						((AbstractTreeViewer)fViewer).remove(elements);
					else if (fViewer instanceof ListViewer)
						((ListViewer)fViewer).remove(elements);
					else if (fViewer instanceof TableViewer)
						((TableViewer)fViewer).remove(elements);
				}
			}
		});
	}

	private void postAdjustInputAndSetSelection(final Object element) {
		postRunnable(new Runnable() {
			public void run() {
				Control ctrl= fViewer.getControl();
				if (ctrl != null && !ctrl.isDisposed()) {
					ctrl.setRedraw(false);
					fBrowsingPart.adjustInputAndSetSelection(element);
					ctrl.setRedraw(true);
				}
			}
		});
	}

	protected void startReadInDisplayThread() {
		if (isDisplayThread())
			fReadsInDisplayThread++;
	}

	protected void finishedReadInDisplayThread() {
		if (isDisplayThread())
			fReadsInDisplayThread--;
	}

	private boolean isDisplayThread() {
		Control ctrl= fViewer.getControl();
		if (ctrl == null)
			return false;

		Display currentDisplay= Display.getCurrent();
		return currentDisplay != null && currentDisplay.equals(ctrl.getDisplay());
	}

	private void postRunnable(final Runnable r) {
		Control ctrl= fViewer.getControl();
		if (ctrl != null && !ctrl.isDisposed()) {
			fBrowsingPart.setProcessSelectionEvents(false);
			try {
				if (isDisplayThread() && fReadsInDisplayThread == 0)
					ctrl.getDisplay().syncExec(r);
				else
					ctrl.getDisplay().asyncExec(r);
			} finally {
				fBrowsingPart.setProcessSelectionEvents(true);
			}
		}
	}

	/**
	 * Returns the parent for the element.
	 * <p>
	 * Note: This method will return a working copy if the
	 * parent is a working copy. The super class implementation
	 * returns the original element instead.
	 * </p>
	 */
	@Override
	protected Object internalGetParent(Object element) {
		if (element instanceof IJavaProject) {
			return ((IJavaProject)element).getJavaModel();
		}
		// try to map resources to the containing package fragment
		if (element instanceof IResource) {
			IResource parent= ((IResource)element).getParent();
			Object jParent= JavaCore.create(parent);
			if (jParent != null)
				return jParent;
			return parent;
		}

		// for package fragments that are contained in a project package fragment
		// we have to skip the package fragment root as the parent.
		if (element instanceof IPackageFragment) {
			IPackageFragmentRoot parent= (IPackageFragmentRoot)((IPackageFragment)element).getParent();
			return skipProjectPackageFragmentRoot(parent);
		}
		if (element instanceof IJavaElement)
			return ((IJavaElement)element).getParent();

		return null;
	}
}


text:
package com.daedafusion.knowledge.query.definition;

import com.daedafusion.sparql.Literal;
import org.apache.log4j.Logger;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by mphilpot on 12/12/14.
 */
public class ObjectPropertyDefinition
{
    private static final Logger log = Logger.getLogger(ObjectPropertyDefinition.class);

    public static final String CARDINALITY_MIN = "min";
    public static final String CARDINALITY_MAX = "max";
    public static final String CARDINALITY_EXACT = "exact";

    private String uri;
    private Set<String> range;
    private Set<Literal>          labels;
    private Set<Literal>          comments;
    private Map<String, Integer> cardinality;

    private String reification;

    public ObjectPropertyDefinition()
    {
        range = new HashSet<>();
        labels = new HashSet<>();
        comments = new HashSet<>();
        cardinality = new HashMap<>();
    }

    public ObjectPropertyDefinition(String uri)
    {
        this();
        this.uri = uri;
    }

    public String getUri()
    {
        return uri;
    }

    public void setUri(String uri)
    {
        this.uri = uri;
    }

    public Set<String> getRange()
    {
        return range;
    }

    public void setRange(Set<String> range)
    {
        this.range = range;
    }

    public Set<Literal> getLabels()
    {
        return labels;
    }

    public void setLabels(Set<Literal> labels)
    {
        this.labels = labels;
    }

    public Set<Literal> getComments()
    {
        return comments;
    }

    public void setComments(Set<Literal> comments)
    {
        this.comments = comments;
    }

    public Map<String, Integer> getCardinality()
    {
        return cardinality;
    }

    public void setCardinality(Map<String, Integer> cardinality)
    {
        this.cardinality = cardinality;
    }

    public String getReification()
    {
        return reification;
    }

    public void setReification(String reification)
    {
        this.reification = reification;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ObjectPropertyDefinition that = (ObjectPropertyDefinition) o;

        if (uri != null ? !uri.equals(that.uri) : that.uri != null) return false;
        if (range != null ? !range.equals(that.range) : that.range != null) return false;
        if (labels != null ? !labels.equals(that.labels) : that.labels != null) return false;
        if (comments != null ? !comments.equals(that.comments) : that.comments != null) return false;
        if (cardinality != null ? !cardinality.equals(that.cardinality) : that.cardinality != null) return false;
        return !(reification != null ? !reification.equals(that.reification) : that.reification != null);

    }

    @Override
    public int hashCode()
    {
        int result = uri != null ? uri.hashCode() : 0;
        result = 31 * result + (range != null ? range.hashCode() : 0);
        result = 31 * result + (labels != null ? labels.hashCode() : 0);
        result = 31 * result + (comments != null ? comments.hashCode() : 0);
        result = 31 * result + (cardinality != null ? cardinality.hashCode() : 0);
        result = 31 * result + (reification != null ? reification.hashCode() : 0);
        return result;
    }
}