text:
Demo: https://cornips.github.io/getLocalIP

## Introduction

To identify clients in internal web systems it is sometimes useful to know its local IP address.
With this little JS (only 847 bytes gzipped), borrowed from [Daniel Roesler](https://github.com/diafygi/webrtc-ips), you can do this.

## Installation

```
npm install getlocalipjs
```

## Usage

Just make sure you have the following code in your HTML at the bottom:
```html
<!-- hidden iframe to bypass webrtc blocking -->
<iframe id="iframe" sandbox="allow-same-origin" style="display:none"></iframe>
<script src="dist/getlocalip.min.js"></script>
<script>
    getLocalIP(function(ip){
        console.log(ip);
    });
</script>
```


text:
package com.example.carlcastello.dosomethingapp.Controller;

import android.content.Context;

import com.example.carlcastello.dosomethingapp.Model.Place;
import com.example.carlcastello.dosomethingapp.Model.PlaceList;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;

/**
 * Created by carlcastello on 31/05/17.
 */

public class PlaceListController implements Serializable {

    protected PlaceList placeList;
    protected Context context;
    protected static final String FILENAME = "recent.sav";

    public PlaceListController(Context context) {
        this.context = context;
        loadFromFile();
    }

    public PlaceList getPlaceList() {
        return this.placeList;
    }

    public void addPlace(Place place) {
        this.placeList.add(place);
    }

    private void loadFromFile() {
        try {
            FileInputStream fis = context.openFileInput(FILENAME);
            BufferedReader in = new BufferedReader(new InputStreamReader(fis));

//            String message = org.apache.commons.io.IOUtils.toString(in);
//            System.out.println(message);

            Gson gson = new Gson();

            // Code from http://stackoverflow.com/questions/12384064/gson-convert-from-json-to-a-typed-arraylistt
            Type listType = new TypeToken<ArrayList<Place>>(){}.getType();
            ArrayList<Place> jsonList = gson.fromJson(in,listType);

//            System.out.println(jsonList.get(0));
            this.placeList = new PlaceList(jsonList);

            in.close();
            fis.close();
        } catch (FileNotFoundException e) {
            this.placeList = new PlaceList();
        } catch (IOException e) {
			/* Rethrow. */
            throw new RuntimeException(e);
        }
    }

    //This will save the data into a file
    public void save() {
        try {
            FileOutputStream fos = context.openFileOutput(FILENAME,0);
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos));

            Gson gson = new Gson();
            gson.toJson(this.placeList.getPlaceList(), out);
            out.flush();

//            out.close();
            fos.close();
        } catch (FileNotFoundException e) {
			/* Rethrow. */
            throw new RuntimeException(e);
        } catch (IOException e) {
			/* Rethrow. */
            throw new RuntimeException(e);
        }
    }

    public void replacePlace(Place place, int index) {
        this.placeList.replacePlace(place,index);
    }

    public int getSize() {
        return placeList.getSize();
    }
}

redpajama_set_name: RedPajamaGithub


text:
const path = require('path');

let templateResolver = {};

templateResolver.resolveModuleRegisterTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'modules.gen.tsx.hbs');
};

templateResolver.resolvePageRegisterTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'pages.gen.tsx.hbs');
};

templateResolver.resolveImportPartialTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'partials', 'import.hbs');
};

templateResolver.resolveModuleTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'module.hbs');
};

templateResolver.resolvePageTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'page.tsx.hbs');
};

templateResolver.resolvePageActionTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'page-actions.ts.hbs');
};

templateResolver.resolvePageReducerTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'page-reducer.ts.hbs');
};

templateResolver.resolvePageStateTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'page-state.ts.hbs');
};

templateResolver.resolvePageStyleTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'page-style.css.hbs');
};

templateResolver.resolvePageRequestsTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'page-requests.ts.hbs');
};

templateResolver.resolveComponentActionsTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'component', 'actions.ts.hbs');
};
templateResolver.resolveComponentStateTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'component', 'state.ts.hbs');
};
templateResolver.resolveComponentReducerTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'component', 'reducer.ts.hbs');
};
templateResolver.resolveComponentRequestsTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'component', 'requests.ts.hbs');
};
templateResolver.resolveComponentViewTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'component', 'view.tsx.hbs');
};
templateResolver.resolveComponentActionRegisterTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'componentregister', 'component.actions.ts.hbs');
};
templateResolver.resolveComponentStateRegisterTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'componentregister', 'component.states.ts.hbs');
};
templateResolver.resolveComponentReducerRegisterTemplatePath = function () {
    return path.join(__dirname, '..', 'templates', 'componentregister', 'component.reducer.ts.hbs');
};

module.exports = templateResolver;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;

namespace Nest
{
	[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
	public interface IGeoPolygonFilter : IFieldNameFilter
	{
		[JsonProperty("points")]
		IEnumerable<string> Points { get; set; }
	}

	public class GeoPolygonFilter : PlainFilter, IGeoPolygonFilter
	{
		protected internal override void WrapInContainer(IFilterContainer container)
		{
			container.GeoPolygon = this;
		}

		public PropertyPathMarker Field { get; set; }
		public IEnumerable<string> Points { get; set; }
	}

	public class GeoPolygonFilterDescriptor : FilterBase, IGeoPolygonFilter
	{
		bool IFilter.IsConditionless
		{
			get
			{
				var gf = ((IGeoPolygonFilter)this);
				return !gf.Points.HasAny() || gf.Points.All(p => p.IsNullOrEmpty());
			}

		}

		PropertyPathMarker IFieldNameFilter.Field { get; set; }
		IEnumerable<string> IGeoPolygonFilter.Points { get; set; }
	}
}


text:
#include "config.h"
#include "bindings/core/v8/V8EventTarget.h"

#include "bindings/core/v8/V8EventListenerList.h"
#include "bindings/core/v8/V8Window.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/UseCounter.h"

namespace blink {
namespace {

void addEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget*)
{
    if (info.Length() >= 3 && info[2]->IsObject()) {
        UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
            UseCounter::AddEventListenerThirdArgumentIsObject);
    }
}

void addEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
{
    if (info.Length() >= 2 && info[1]->IsObject() && !impl->toNode())
        addHiddenValueToArray(info.GetIsolate(), info.Holder(), info[1], V8EventTarget::eventListenerCacheIndex);
}

void removeEventListenerMethodPrologueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget*)
{
    if (info.Length() >= 3 && info[2]->IsObject()) {
        UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()),
            UseCounter::RemoveEventListenerThirdArgumentIsObject);
    }
}

void removeEventListenerMethodEpilogueCustom(const v8::FunctionCallbackInfo<v8::Value>& info, EventTarget* impl)
{
    if (info.Length() >= 2 && info[1]->IsObject() && !impl->toNode())
        removeHiddenValueFromArray(info.GetIsolate(), info.Holder(), info[1], V8EventTarget::eventListenerCacheIndex);
}

} // namespace

void V8EventTarget::addEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ExecutionContext, "addEventListener", "EventTarget", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 2)) {
        setMinimumArityTypeError(exceptionState, 2, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    EventTarget* impl = V8EventTarget::toImpl(info.Holder());
    if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
        exceptionState.throwIfNeeded();
        return;
    }
    V8StringResource<> type;
    RefPtrWillBeRawPtr<EventListener> listener;
    EventListenerOptionsOrBoolean options;
    {
        type = info[0];
        if (!type.prepare())
            return;
        listener = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[1], false, ListenerFindOrCreate);
        // TODO(dtapuska): This custom binding code can be eliminated once
        // EventListenerOptions runtime enabled feature is removed.
        // http://crbug.com/545163
        if (UNLIKELY(info.Length() <= 2) || isUndefinedOrNull(info[2])) {
            addEventListenerMethodPrologueCustom(info, impl);
            impl->addEventListener(type, listener);
            addEventListenerMethodEpilogueCustom(info, impl);
            return;
        }
        V8EventListenerOptionsOrBoolean::toImpl(info.GetIsolate(), info[2], options, UnionTypeConversionMode::NotNullable, exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
    }
    addEventListenerMethodPrologueCustom(info, impl);
    impl->addEventListener(type, listener, options);
    addEventListenerMethodEpilogueCustom(info, impl);
}

void V8EventTarget::removeEventListenerMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ExecutionContext, "removeEventListener", "EventTarget", info.Holder(), info.GetIsolate());
    if (UNLIKELY(info.Length() < 2)) {
        setMinimumArityTypeError(exceptionState, 2, info.Length());
        exceptionState.throwIfNeeded();
        return;
    }
    EventTarget* impl = V8EventTarget::toImpl(info.Holder());
    if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindow(info.GetIsolate()), impl, exceptionState)) {
        exceptionState.throwIfNeeded();
        return;
    }
    V8StringResource<> type;
    RefPtrWillBeRawPtr<EventListener> listener;
    EventListenerOptionsOrBoolean options;
    {
        type = info[0];
        if (!type.prepare())
            return;
        listener = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[1], false, ListenerFindOnly);
        // TODO(dtapuska): This custom binding code can be eliminated once
        // EventListenerOptions runtime enabled feature is removed.
        // http://crbug.com/545163
        if (UNLIKELY(info.Length() <= 2) || isUndefinedOrNull(info[2])) {
            removeEventListenerMethodPrologueCustom(info, impl);
            impl->removeEventListener(type, listener);
            removeEventListenerMethodEpilogueCustom(info, impl);
            return;
        }
        V8EventListenerOptionsOrBoolean::toImpl(info.GetIsolate(), info[2], options, UnionTypeConversionMode::NotNullable, exceptionState);
        if (exceptionState.throwIfNeeded())
            return;
    }
    removeEventListenerMethodPrologueCustom(info, impl);
    impl->removeEventListener(type, listener, options);
    removeEventListenerMethodEpilogueCustom(info, impl);
}

} // namespace blink


text:
package com.devzb.zufang.dao.mapper;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.devzb.zufang.dao.dto.ZufangItemDto;
import com.devzb.zufang.dao.model.ZufangItemExample;

@Repository
public interface ZufangItemMapperExt extends ZufangItemMapper {

	public List<ZufangItemDto> selectByExampleForDto(ZufangItemExample example);
}


text:
namespace Veritas {
    namespace GPU {
        namespace Textures {
            class Texture2D : public Texture {
                public:
                    Texture2D(uint32 width, uint32 height, ELEMENTS elements, TYPE type, const void* data = 0);

                    uint32 getWidth() const;
                    uint32 getHeight() const;
                private:
                    uint32 width, height;
            };
        }
    }
}


text:
package landmaster.landcore.api.item;

import net.minecraft.item.*;

public interface IEnergySetter {
	void setEnergyStored(ItemStack is, int energy);
}


text:
package org.marekasf.throughput;

import org.junit.Test;
import org.marekasf.troughput.ThroughputRunner;

import rx.Observable;

public class DaemonTest
{
	@Test
	public void daemon()
	{
		final ThroughputRunner.Daemon daemon = ThroughputRunner.Builder.create().testTimeInSeconds(0).threads(2).stress(false) //
				.action(() -> Observable.defer(() -> sleep())) //
				.graph(false).daemon();

		daemon.start();
		sleep();

		for (int i =0; i<10; ++i)
		{
			daemon.log();
			daemon.errors();
			daemon.histogram();
			daemon.stats();
			daemon.log();
			sleep();
		}

		daemon.stop();
	}

	private Observable<Boolean> sleep()
	{
		try
		{
			Thread.sleep(100);
		}
		catch (InterruptedException e)
		{
			throw new RuntimeException("Daemon interrupted", e);
		}
		return Observable.just(true);
	}
}


text:
package henfredemars;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

//Makes weekly summaries for each of the selected stations
//climate_data,stations.dat,stations.txt,output
public class CompounderTool {
	public static final int stationIncrement = 20;

	public static void main(String[] args) {
		String[] allStations = readStations(args[1]).toArray(new String[0]);
		ObjectOutputStream oos = prepareOutput(args[3]);
		StationLocator sl = new StationLocator(args[2]);
		int stationIndex = 0;
		while (true) {
			if (stationIndex >= allStations.length) break;
			int maxRange = stationIndex+stationIncrement-1;
			if (maxRange > allStations.length-1) {
				maxRange = allStations.length-1;
			}
			System.out.println("Processing stations " + stationIndex + " to " +
					String.valueOf(maxRange) + "...");
			ArrayList<String> curStationIds = new ArrayList<String>(stationIncrement);
			ArrayList<DataSample> dataSamples = new ArrayList<DataSample>(stationIncrement);
			for (int i = stationIndex; i<stationIndex+stationIncrement && i<allStations.length;i++) {
				curStationIds.add(allStations[i]);
			}
			stationIndex += stationIncrement;
			ObjectInputStream ois = readFileFromBeginning(args[0]);
			while (true) {
				DataSample ds = null;
				try {
					ds = (DataSample) ois.readObject();
				} catch (ClassNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					//EOF
					try {
						ois.close();
					} catch (IOException e1) {
						//Do nothing
					}
					break;
				}
				if (curStationIds.contains(ds.getStationId())) {
					dataSamples.add(ds);
				}
			}
			System.out.println("Compounding station data...");
			WeekCompounder wc = new WeekCompounder(dataSamples);
			Calendar start = Calendar.getInstance();
			start.set(Calendar.YEAR,2004);
			start.set(Calendar.MONTH,Calendar.JANUARY);
			start.set(Calendar.DAY_OF_MONTH,1);
			start.set(Calendar.HOUR_OF_DAY,0);
			start.set(Calendar.MINUTE,0);
			Calendar end = Calendar.getInstance();
			end.set(Calendar.YEAR,2014);
			end.set(Calendar.MONTH,Calendar.DECEMBER);
			end.set(Calendar.DAY_OF_MONTH,31);
			end.set(Calendar.HOUR_OF_DAY,23);
			end.set(Calendar.MINUTE,59);
			wc.compoundDataByWeek(start, end);
			ArrayList<Station> compoundedStations = wc.getStations();
			wc = null; //Free ASAP
			for (Station s: compoundedStations) {
				float[] latlon = sl.getLatLon(s.getStationId());
				s.setLatLon(latlon[0],latlon[1]);
				System.out.println("Writing " + s.getStationId() + ", " + s.getSamples().size() + " samples.");
				try {
					oos.writeObject(s);
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			try {
				oos.reset();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		try {
			oos.close();
		} catch (IOException e) {
			//Do nothing
		}
	}

	private static ObjectOutputStream prepareOutput(String fname) {
		ObjectOutputStream oos = null;
		GZIPOutputStream gos = null;
		FileOutputStream fos = null;
		try {
			fos = new FileOutputStream(new File(fname));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			gos = new GZIPOutputStream(fos);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			oos = new ObjectOutputStream(gos);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return oos;
	}

	@SuppressWarnings("unchecked")
	private static ArrayList<String> readStations(String fname) {
		FileInputStream fis = null;
		try {
			fis = new FileInputStream(new File(fname));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		ObjectInputStream ois = null;
		try {
			ois = new ObjectInputStream(fis);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			ArrayList<String> res = (ArrayList<String>)ois.readObject();
			ois.close();
			return res;
		} catch (ClassNotFoundException | IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null; //Should never happen
	}

	private static ObjectInputStream readFileFromBeginning(String fname) {
		FileInputStream fis = null;
		try {
			fis = new FileInputStream(new File(fname));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		GZIPInputStream gis = null;
		try {
			gis = new GZIPInputStream(new BufferedInputStream(fis));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			ObjectInputStream ois = new ObjectInputStream(gis);
			return ois;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null; //Should never happen
	}

}


text:
from __future__ import absolute_import, division, print_function

import numbers
import inspect

from pprint import pformat
from functools import reduce, partial

import numpy as np
import toolz
from toolz import unique, concat, first
import pandas as pd

from ..compatibility import _strtypes
from ..dispatch import dispatch
from ..utils import ordered_intersect

__all__ = ['Node', 'path', 'common_subexpression', 'eval_str']

base = (numbers.Number,) + _strtypes
arrtypes = np.ndarray, pd.core.generic.NDFrame

def isidentical(a, b):
    """ Strict equality testing

    Different from x == y -> Eq(x, y)

    >>> isidentical(1, 1)
    True

    >>> from blaze.expr import symbol
    >>> x = symbol('x', 'int')
    >>> isidentical(x, 1)
    False

    >>> isidentical(x + 1, x + 1)
    True

    >>> isidentical(x + 1, x + 2)
    False

    >>> isidentical((x, x + 1), (x, x + 1))
    True

    >>> isidentical((x, x + 1), (x, x + 2))
    False
    """
    if isinstance(a, base) and isinstance(b, base):
        return a == b
    if isinstance(a, arrtypes) and isinstance(b, arrtypes):
        return np.array_equal(a, b)
    if type(a) != type(b):
        return False
    if isinstance(a, Node):
        return all(map(isidentical, a._args, b._args))
    if isinstance(a, (list, tuple)) and isinstance(b, (list, tuple)):
        return len(a) == len(b) and all(map(isidentical, a, b))
    return a == b

class Node(object):
    """ Node in a tree

    This serves as the base class for ``Expr``.  This class holds all of the
    tree traversal functions that are independent of tabular or array
    computation.  This is everything that we can do independent of the problem
    domain.  Note that datashape is not imported.

    See Also
    --------

    blaze.expr.expressions.Expr
    """
    __slots__ = ()
    __inputs__ = '_child',

    def __init__(self, *args, **kwargs):
        slots = set(self.__slots__)
        if not frozenset(slots) <= slots:
            raise TypeError('Unknown keywords: %s' % (set(kwargs) - slots))

        assigned = set()
        for slot, arg in zip(self.__slots__[1:], args):
            assigned.add(slot)
            setattr(self, slot, arg)

        for key, value in kwargs.items():
            if key in assigned:
                raise TypeError(
                    '%s got multiple values for argument %r' % (
                        type(self).__name__,
                        key,
                    ),
                )
            assigned.add(key)
            setattr(self, key, value)

        for slot in slots - assigned:
            setattr(self, slot, None)

    @property
    def _args(self):
        return tuple(getattr(self, slot) for slot in self.__slots__[1:])

    _hashargs = _args

    @property
    def _inputs(self):
        return tuple(getattr(self, i) for i in self.__inputs__)

    def _leaves(self):
        """ Leaves of an expression tree

        All nodes without inputs.  Leaves are returned in order, left to right.

        >>> from blaze.expr import symbol, join, by

        >>> t = symbol('t', 'var * {id: int32, name: string}')
        >>> t._leaves()
        [t]
        >>> by(t.name, count=t.id.nunique())._leaves()
        [t]

        >>> v = symbol('v', 'var * {id: int32, city: string}')
        >>> join(t, v)._leaves()
        [t, v]
        """

        if not self._inputs:
            return [self]
        else:
            return list(unique(concat(i._leaves() for i in self._inputs if
                                      isinstance(i, Node))))

    isidentical = isidentical

    def __hash__(self):
        hash_ = self._hash
        if hash_ is None:
            hash_ = self._hash = hash((type(self), self._hashargs))
        return hash_

    def __str__(self):
        rep = [
            '%s=%s' % (slot, _str(arg))
            for slot, arg in zip(self.__slots__[1:], self._args)
        ]
        return '%s(%s)' % (type(self).__name__, ', '.join(rep))

    def __repr__(self):
        return str(self)

    def _traverse(self):
        """ Traverse over tree, yielding all subtrees and leaves """
        yield self
        traversals = (arg._traverse() if isinstance(arg, Node) else [arg]
                      for arg in self._args)
        for trav in traversals:
            for item in trav:
                yield item

    def _subs(self, d):
        """ Substitute terms in the tree

        >>> from blaze.expr import symbol
        >>> t = symbol('t', 'var * {name: string, amount: int, id: int}')
        >>> expr = t.amount + 3
        >>> expr._subs({3: 4, 'amount': 'id'}).isidentical(t.id + 4)
        True
        """
        return subs(self, d)

    def _resources(self):
        return toolz.merge([arg._resources() for arg in self._args
                            if isinstance(arg, Node)])

    def _subterms(self):
        return subterms(self)

    def __contains__(self, other):
        return other in set(self._subterms())

    def __getstate__(self):
        return tuple(self._args)

    def __setstate__(self, state):
        self.__init__(*state)

    def __eq__(self, other):
        ident = self.isidentical(other)
        if ident is True:
            return ident

        try:
            return self._eq(other)
        except AttributeError:
            # e.g., we can't compare whole tables to other things (yet?)
            pass
        return False

    def __ne__(self, other):
        return self._ne(other)

    def __lt__(self, other):
        return self._lt(other)

    def __le__(self, other):
        return self._le(other)

    def __gt__(self, other):
        return self._gt(other)

    def __ge__(self, other):
        return self._ge(other)

    def __add__(self, other):
        return self._add(other)

    def __radd__(self, other):
        return self._radd(other)

    def __mul__(self, other):
        return self._mul(other)

    def __rmul__(self, other):
        return self._rmul(other)

    def __div__(self, other):
        return self._div(other)

    def __rdiv__(self, other):
        return self._rdiv(other)

    __truediv__ = __div__
    __rtruediv__ = __rdiv__

    def __floordiv__(self, other):
        return self._floordiv(other)

    def __rfloordiv__(self, other):
        return self._rfloordiv(other)

    def __sub__(self, other):
        return self._sub(other)

    def __rsub__(self, other):
        return self._rsub(other)

    def __pow__(self, other):
        return self._pow(other)

    def __rpow__(self, other):
        return self._rpow(other)

    def __mod__(self, other):
        return self._mod(other)

    def __rmod__(self, other):
        return self._rmod(other)

    def __or__(self, other):
        return self._or(other)

    def __ror__(self, other):
        return self._ror(other)

    def __and__(self, other):
        return self._and(other)

    def __rand__(self, other):
        return self._rand(other)

    def __neg__(self):
        return self._neg()

    def __invert__(self):
        return self._invert()

    def __abs__(self):
        from .math import abs
        return abs(self)

def get_callable_name(o):
    """Welcome to str inception. Leave your kittens at home.
    """
    # special case partial objects
    if isinstance(o, partial):
        keywords = o.keywords
        kwds = (
            ', '.join('%s=%r' % item for item in keywords.items())
            if keywords else
            ''
        )
        args = ', '.join(map(repr, o.args))
        arguments = []
        if args:
            arguments.append(args)
        if kwds:
            arguments.append(kwds)
        return 'partial(%s, %s)' % (
            get_callable_name(o.func),
            ', '.join(arguments),
        )

    try:
        # python 3 makes builtins look nice
        return o.__qualname__
    except AttributeError:
        try:
            # show the module of the object, if we can
            return '%s.%s' % (inspect.getmodule(o).__name__, o.__name__)
        except AttributeError:
            try:
                # __self__ tells us the class the method is bound to
                return '%s.%s' % (o.__self__.__name__, o.__name__)
            except AttributeError:
                # exhausted all avenues of printing callables so just print the
                # name of the object
                return o.__name__

def _str(s):
    """ Wrap single quotes around strings """
    if isinstance(s, str):
        return repr(s)
    elif callable(s):
        return get_callable_name(s)
    elif isinstance(s, Node):
        return str(s)
    elif isinstance(s, (list, tuple)):
        body = ", ".join(_str(x) for x in s)
        return "({0})".format(body if len(s) > 1 else (body + ","))
    else:
        return pformat(s).rstrip()

@dispatch(Node)
def subterms(expr):
    return concat([[expr], concat(map(subterms, expr._inputs))])

@dispatch(object)
def subterms(x):
    yield x

def subs(o, d):
    """ Substitute values within data structure

    >>> subs(1, {1: 2})
    2

    >>> subs([1, 2, 3], {2: 'Hello'})
    [1, 'Hello', 3]
    """
    d = dict((k, v) for k, v in d.items() if k is not v)
    if not d:
        return o
    try:
        if o in d:
            d = d.copy()
            o = d.pop(o)
    except TypeError:
        pass
    return _subs(o, d)

@dispatch((tuple, list), dict)
def _subs(o, d):
    return type(o)([subs(arg, d) for arg in o])

@dispatch(Node, dict)
def _subs(o, d):
    """

    >>> from blaze.expr import symbol
    >>> t = symbol('t', 'var * {name: string, balance: int}')
    >>> subs(t, {'balance': 'amount'}).fields
    ['name', 'amount']
    """
    newargs = [subs(arg, d) for arg in o._args]
    return type(o)(*newargs)

@dispatch(object, dict)
def _subs(o, d):
    """ Private dispatched version of ``subs``

    >>> subs('Hello', {})
    'Hello'
    """
    return o

def path(a, b):
    """ A path of nodes from a to b

    >>> from blaze.expr import symbol
    >>> t = symbol('t', 'var * {name: string, amount: int, id: int}')
    >>> expr = t.amount.sum()
    >>> list(path(expr, t))
    [sum(t.amount), t.amount, t]
    """
    while not a.isidentical(b):
        yield a
        if not a._inputs:
            break
        for child in a._inputs:
            if any(b.isidentical(node) for node in child._traverse()):
                a = child
                break
    yield a

def common_subexpression(expr, *exprs):
    """ Common sub expression between subexpressions

    Examples
    --------

    >>> from blaze.expr import symbol
    >>> t = symbol('t', 'var * {x: int, y: int}')
    >>> common_subexpression(t.x, t.y)
    t
    """
    # only one expression has itself as a common subexpression
    if not exprs:
        return expr

    exprs = (expr,) + exprs

    # get leaves for every expression
    all_leaves = [expr._leaves() for expr in exprs]

    # leaves common to all expressions
    leaves = set.intersection(*map(set, all_leaves))

    # no common leaves therefore no common subexpression
    if not leaves:
        raise ValueError(
            'No common leaves found in expressions %s' % list(exprs)
        )

    # list of paths from each expr to each leaf
    pathlist = [list(path(expr, leaf)) for expr in exprs for leaf in leaves]

    # ordered intersection of paths
    common = reduce(ordered_intersect, pathlist)
    if not common:
        raise ValueError(
            'No common subexpression found in paths to leaf: %s' % list(
                map(set, pathlist)
            )
        )

    # the first expression is the deepest node in the tree that is an ancestor
    # of every expression in `exprs`
    return first(common)

def eval_str(expr):
    """ String suitable for evaluation

    >>> from blaze.expr import symbol, eval_str
    >>> x = symbol('x', 'real')
    >>> eval_str(2*x + 1)
    '(2 * x) + 1'

    >>> from datetime import date
    >>> eval_str(date(2000, 1, 20))
    'datetime.date(2000, 1, 20)'
    """
    from datetime import date, datetime
    if isinstance(expr, (date, datetime)):
        return repr(expr)
    return repr(expr) if isinstance(expr, _strtypes) else str(expr)

def parenthesize(s):
    """

    >>> parenthesize('1')
    '1'
    >>> parenthesize('1 + 2')
    '(1 + 2)'
    """
    if ' ' in s:
        return '(%s)' % s
    else:
        return s


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

<title>Uses of Package org.jsimpledb.kv.simple (Java Class Library API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Package
org.jsimpledb.kv.simple

Packages that use org.jsimpledb.kv.simple

Package
Description

org.jsimpledb.kv.simple

A simple in-memory implementation of the KVDatabase interface.

org.jsimpledb.spring

Spring Framework integration classes.

org.jsimpledb.util

General utility classes used with JSimpleDB.

Classes in org.jsimpledb.kv.simple used by org.jsimpledb.kv.simple

Class and Description

SimpleKVDatabase

Simple implementation of the KVDatabase interface that provides a concurrent, transactional view
 of an underlying KVStore with strong ACID semantics (Durability must be provided by the KVStore).

SimpleKVTransaction

KVTransaction implementation for SimpleKVDatabase.

XMLKVTransaction

Transaction associated with a XMLKVDatabase.

Classes in org.jsimpledb.kv.simple used by org.jsimpledb.spring

Class and Description

SimpleKVDatabase

Simple implementation of the KVDatabase interface that provides a concurrent, transactional view
 of an underlying KVStore with strong ACID semantics (Durability must be provided by the KVStore).

XMLKVDatabase

Simple persistent KVDatabase backed by an XML file stored in a StreamRepository.

Classes in org.jsimpledb.kv.simple used by org.jsimpledb.util

Class and Description

SimpleKVDatabase

Simple implementation of the KVDatabase interface that provides a concurrent, transactional view
 of an underlying KVStore with strong ACID semantics (Durability must be provided by the KVStore).

XMLKVDatabase

Simple persistent KVDatabase backed by an XML file stored in a StreamRepository.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
/**
 */
package COSEM.COSEMObjects;

import COSEM.InterfaceClasses.S_FSKReportingsystemlist;

/**
 *
 * A representation of the model object 'SFSK Reporting System List Object'.
 *
 *
 *
 * @see COSEM.COSEMObjects.COSEMObjectsPackage#getS_FSKReportingSystemListObject()
 * @model
 * @generated
 */
public interface S_FSKReportingSystemListObject extends S_FSKReportingsystemlist {
} // S_FSKReportingSystemListObject


text:
var editor;
var nytPopup;

var demos = [
    { source: 'pixelwise.hs'},
    { source: 'empty.hs' },
    { source: 'min.hs' },
    { source: 'get.hs' },
    { source: 'lena_misc.hs' }
];

window.onload = function() {
    editor = CodeMirror.fromTextArea(
        document.getElementById("editor"), {
            matchBrackets: true,
            indentWithTabs: false,
            indentUnit: 4,
            tabMode: "shift",
            lineNumbers: true,
            theme: "glossweb",
            onCursorActivity: function() {
                editor.setLineClass(hlLine, null);
                hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
                }
            }

        );

    var hlLine = editor.setLineClass(0, "activeline");

    var all = document.cookie;
    var list = all.split("; ");
    var found = false;
    for (var i = 0; i < list.length; i++)
    {
        var cookie = list[i];
        var p = cookie.indexOf("=");
        var name = cookie.substring(0,p);
        if (name == sourceCookie)
        {
            var value = decodeURIComponent(cookie.substring(p+1));
            editor.setValue(value);
            found = true;
            break;
        }
    }

    if (!found)
    {
        editor.setValue(initialSource);
    }

    //stop();
    editor.focus();

    if(popup) {
//        console.log("Opening popup viewer.");
        nytPopup = window.open("/viewerPopup");
//        console.log(nytPopup);
    }
    else {
        console.log("Constructing div viewer.");
        $("#image_container").append("

");
    }

    $("body").bind("keydown", keyDown);
    $("#runlink").button();
//    console.log("Ready!");

    addDemosToGallery();

};

function addDemosToGallery() {
    $(demos).each(function(i) {
        var demo = demos[i];
        var sourceFn = demo["source"];
        var preventCache = "?"+(new Date().getTime());
        $.get("/demos/"+sourceFn+preventCache, function(source) {
            $.post("/eval", { source : source }, function(data, status) {
                var response = parseResponse(data);
                if (response["status"] == "ok") {
                    $("#gallery").append("

");
                }
                else {
//                        console.log("Rendering a demo has failed! Reason: "+response["reason"]);
                }
            });
        });
    });
}

function activateDemo(sourceFn) {
    $.get("/demos/"+sourceFn+"?"+(new Date().getTime()), function(source) {
        editor.setValue(source);

        $("#code_title").fadeOut(300, function() {
            $(this).html(sourceFn).fadeIn();
        });
        $("#editor_body").fadeOut(300, function() {
            run();
            $("#editor_body").fadeIn();
        });

    });
}

function setDemo(i) {
    demo = demos[i];
    activateDemo(demo["source"]);
}

function run()
{
    var s = editor.getValue();
    document.cookie = sourceCookie + "=" + encodeURIComponent(s)
        + "; max-age = " + (1000 * 365 * 24 * 60 * 60);
    var nytDiv;
    if(popup) {
        nytDiv = nytPopup.document.getElementById("runBox");
    }
    else {
        nytDiv = $("#runBox");
//        console.log(nytDiv);
    }

    $.post("/eval", { source : s }, function(data, status) {
        var response = parseResponse(data);
        if (response["status"] == "ok") {
            $(nytDiv).empty();
            $(nytDiv).append("");
        }
        else {
            $(nytDiv).empty();
            $("#editor_body").effect('shake', {}, 80);
            $(nytDiv).append("
"+response["reason"]+"
");
        }
    });
}

function parseResponse(data) {
    return eval("["+data+"]")[0]; // FIXME: why doesn't work without array
}

function keyDown(e) {
    if (e.keyCode == 115) {  // 115 - F4
        $("#runbutton").click();
    }
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.12.05 at 01:12:38 PM EST
//

package org.slc.sli.sample.entitiesR1;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * This entity represents a parent or guardian of a student, such as mother, father, or caretaker.
 *
 *
Java class for Parent complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="Parent">
 *   <complexContent>
 *     <extension base="{http://ed-fi.org/0100}ComplexObjectType">
 *       <sequence>
 *         <element name="ParentUniqueStateId" type="{http://ed-fi.org/0100}UniqueStateIdentifier"/>
 *         <element name="Name" type="{http://ed-fi.org/0100}Name"/>
 *         <element name="OtherName" type="{http://ed-fi.org/0100}OtherName" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="Sex" type="{http://ed-fi.org/0100}SexType" minOccurs="0"/>
 *         <element name="Address" type="{http://ed-fi.org/0100}Address" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="Telephone" type="{http://ed-fi.org/0100}Telephone" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="ElectronicMail" type="{http://ed-fi.org/0100}ElectronicMail" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="LoginId" type="{http://ed-fi.org/0100}IdentificationCode" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Parent", propOrder = {
    "parentUniqueStateId",
    "name",
    "otherName",
    "sex",
    "address",
    "telephone",
    "electronicMail",
    "loginId"
})
public class Parent
    extends ComplexObjectType
{

    @XmlElement(name = "ParentUniqueStateId", required = true)
    protected String parentUniqueStateId;
    @XmlElement(name = "Name", required = true)
    protected Name name;
    @XmlElement(name = "OtherName")
    protected List<OtherName> otherName;
    @XmlElement(name = "Sex")
    protected SexType sex;
    @XmlElement(name = "Address")
    protected List<Address> address;
    @XmlElement(name = "Telephone")
    protected List<Telephone> telephone;
    @XmlElement(name = "ElectronicMail")
    protected List<ElectronicMail> electronicMail;
    @XmlElement(name = "LoginId")
    protected String loginId;

    /**
     * Gets the value of the parentUniqueStateId property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getParentUniqueStateId() {
        return parentUniqueStateId;
    }

    /**
     * Sets the value of the parentUniqueStateId property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setParentUniqueStateId(String value) {
        this.parentUniqueStateId = value;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link Name }
     *
     */
    public Name getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link Name }
     *
     */
    public void setName(Name value) {
        this.name = value;
    }

    /**
     * Gets the value of the otherName property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the otherName property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getOtherName().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link OtherName }
     *
     *
     */
    public List<OtherName> getOtherName() {
        if (otherName == null) {
            otherName = new ArrayList<OtherName>();
        }
        return this.otherName;
    }

    /**
     * Gets the value of the sex property.
     *
     * @return
     *     possible object is
     *     {@link SexType }
     *
     */
    public SexType getSex() {
        return sex;
    }

    /**
     * Sets the value of the sex property.
     *
     * @param value
     *     allowed object is
     *     {@link SexType }
     *
     */
    public void setSex(SexType value) {
        this.sex = value;
    }

    /**
     * Gets the value of the address property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the address property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getAddress().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Address }
     *
     *
     */
    public List<Address> getAddress() {
        if (address == null) {
            address = new ArrayList<Address>();
        }
        return this.address;
    }

    /**
     * Gets the value of the telephone property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the telephone property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getTelephone().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Telephone }
     *
     *
     */
    public List<Telephone> getTelephone() {
        if (telephone == null) {
            telephone = new ArrayList<Telephone>();
        }
        return this.telephone;
    }

    /**
     * Gets the value of the electronicMail property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the electronicMail property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getElectronicMail().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link ElectronicMail }
     *
     *
     */
    public List<ElectronicMail> getElectronicMail() {
        if (electronicMail == null) {
            electronicMail = new ArrayList<ElectronicMail>();
        }
        return this.electronicMail;
    }

    /**
     * Gets the value of the loginId property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getLoginId() {
        return loginId;
    }

    /**
     * Sets the value of the loginId property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setLoginId(String value) {
        this.loginId = value;
    }

}


text:
namespace net {
struct DnsConfig;
}

namespace chrome_browser_net {

class DnsProbeService : public net::NetworkChangeNotifier::IPAddressObserver {
 public:
  typedef base::Callback<void(chrome_common_net::DnsProbeResult result)>
      CallbackType;

  DnsProbeService();
  virtual ~DnsProbeService();

  void ProbeDns(const CallbackType& callback);

  // NetworkChangeNotifier::IPAddressObserver implementation:
  virtual void OnIPAddressChanged() OVERRIDE;

 protected:
  // This can be called by tests to pretend the cached reuslt has expired.
  void ExpireResults();

 private:
  enum State {
    STATE_NO_RESULTS,
    STATE_PROBE_RUNNING,
    STATE_RESULTS_CACHED,
  };

  void StartProbes();
  void OnProbesComplete();
  void CallCallbacks();

  void OnProbeJobComplete(DnsProbeJob* job, DnsProbeJob::Result result);
  chrome_common_net::DnsProbeResult EvaluateResults() const;
  void HistogramProbes() const;

  // These are expected to be overridden by tests to return mock jobs.
  virtual scoped_ptr<DnsProbeJob> CreateSystemProbeJob(
      const DnsProbeJob::CallbackType& job_callback);
  virtual scoped_ptr<DnsProbeJob> CreatePublicProbeJob(
      const DnsProbeJob::CallbackType& job_callback);

  scoped_ptr<DnsProbeJob> CreateProbeJob(
      const net::DnsConfig& dns_config,
      const DnsProbeJob::CallbackType& job_callback);
  void GetSystemDnsConfig(net::DnsConfig* config);
  void GetPublicDnsConfig(net::DnsConfig* config);
  bool ResultsExpired();

  scoped_ptr<DnsProbeJob> system_job_;
  scoped_ptr<DnsProbeJob> public_job_;
  DnsProbeJob::Result system_result_;
  DnsProbeJob::Result public_result_;
  std::vector<CallbackType> callbacks_;
  State state_;
  chrome_common_net::DnsProbeResult result_;
  base::Time probe_start_time_;
  // How many DNS request attempts the probe jobs will make before giving up
  // (Overrides the attempts field in the system DnsConfig.)
  const int dns_attempts_;
  // How many nameservers the system config has.
  int system_nameserver_count_;
  // Whether the only system nameserver is 127.0.0.1.
  bool system_is_localhost_;

  DISALLOW_COPY_AND_ASSIGN(DnsProbeService);
};

}  // namespace chrome_browser_net

#endif  // CHROME_BROWSER_NET_DNS_PROBE_SERVICE_H_


text:
{{ page.title }}

                    {{ content }}

                        Back to Top


text:
class UsersController < ApplicationController

  def login
    user = User.where("(username = ? OR number = ?) AND (password = ?)", params[:username], params[:username], params[:password])
               .first
    if user.present?
      render json: user
    else
      render json: [{:error => 'failure'}], status: 304
    end
  end

  def signup
    user = User.create(user_params)
    unless user.new_record?
      render json: user
    else
      render json: user.errors.messages, status: 304
    end
  end

  def user_params
    params.permit(:username, :number, :password)
  end
end


text:
package net.xylophones.planetoid.web.spring;

import net.xylophones.planetoid.game.PlanetoidsGameService;
import net.xylophones.planetoid.game.PlanetoidsGameServiceFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PlanetoidsGameServiceBeans {

    @Bean
    public PlanetoidsGameService planetoidsGameService() {
        return new PlanetoidsGameServiceFactory().create();
    }

}


text:
namespace RegexBot.Common;
/// <summary>
/// Helper class that holds an entity's name, ID, or both.
/// Meant to be used during configuration processing in cases where the configuration expects
/// an entity name to be defined in a certain way which may or may not include its snowflake ID.
/// </summary>
public class EntityName {
    /// <summary>
    /// The entity's type, as specified in configuration.
    /// </summary>
    public EntityType Type { get; private set; }

    private ulong? _id;
    /// <summary>
    /// Entity's unique ID value (snowflake). May be null if the value is not known.
    /// </summary>
    /// <remarks>
    /// This property may be updated during runtime if instructed to update the ID for persistence.
    /// </remarks>
    public ulong? Id {
        get => _id;
        internal set => _id ??= value;
    }

    /// <summary>
    /// Entity's name as specified in configuration. May be null if it was not specified.
    /// </summary>
    /// <remarks>This value is not updated during runtime.</remarks>
    public string? Name { get; private set; }

    /// <summary>
    /// Creates a new object instance from the given input string.
    /// Documentation for the EntityName format can be found elsewhere in this project's documentation.
    /// </summary>
    /// <param name="input">Input string in EntityName format.</param>
    /// <exception cref="ArgumentNullException">Input string is null or blank.</exception>
    /// <exception cref="ArgumentException">Input string cannot be resolved to an entity type.</exception>
    public EntityName(string input) {
        if (string.IsNullOrWhiteSpace(input))
            throw new ArgumentNullException(nameof(input), "Specified name is blank.");
        if (input.Length < 2) throw new ArgumentException("Input is not in a valid entity name format.");

        if (input[0] == '&') Type = EntityType.Role;
        else if (input[0] == '#') Type = EntityType.Channel;
        else if (input[0] == '@') Type = EntityType.User;
        else throw new ArgumentException("Entity type unable to be inferred by given input.");

        input = input[1..]; // Remove prefix

        // Input contains ID/Label separator?
        var separator = input.IndexOf("::");
        if (separator != -1) {
            Name = input[(separator + 2)..];
            if (ulong.TryParse(input.AsSpan(0, separator), out var parseOut)) {
                // Got an ID.
                Id = parseOut;
            } else {
                // It's not actually an ID. Assuming the entire string is a name.
                Name = input;
                Id = null;
            }
        } else {
            // No separator. Input is either entirely an ID or entirely a Name.
            if (ulong.TryParse(input, out var parseOut)) {
                // ID without name.
                Id = parseOut;
                Name = null;
            } else {
                // Name without ID.
                Name = input;
                Id = null;
            }
        }
    }

    /// <summary>
    /// Creates a new object instance from the given input string.
    /// Documentation for the EntityName format can be found elsewhere in this project's documentation.
    /// </summary>
    /// <param name="input">Input string in EntityName format.</param>
    /// <param name="expectedType">The <see cref="EntityType"/> expected for this instance.</param>
    /// <exception cref="ArgumentNullException">Input string is null or blank.</exception>
    /// <exception cref="ArgumentException">Input string cannot be resolved to an entity type.</exception>
    /// <exception cref="FormatException">Input string was resolved to a type other than specified.</exception>
    public EntityName(string input, EntityType expectedType) : this(input) {
        if (Type != expectedType) throw new FormatException("Resolved EntityType does not match expected type.");
    }

    /// <summary>
    /// Returns the appropriate prefix corresponding to an EntityType.
    /// </summary>
    public static char GetPrefix(EntityType t) => t switch {
        EntityType.Role => '&',
        EntityType.Channel => '#',
        EntityType.User => '@',
        _ => '\0',
    };

    /// <summary>
    /// Returns a string representation of this item in proper EntityName format.
    /// </summary>
    public override string ToString() {
        var pf = GetPrefix(Type);

        if (Id.HasValue && Name != null)
            return $"{pf}{Id.Value}::{Name}";
        else if (Id.HasValue)
            return $"{pf}{Id}";
        else
            return $"{pf}{Name}";
    }

    #region Helper methods
    // TODO convert all to extension methods
    /// <summary>
    /// Attempts to find the corresponding role within the given guild.
    /// </summary>
    /// <param name="guild">The guild in which to search for the role.</param>
    /// <param name="updateMissingID">
    /// Specifies if this EntityName instance should cache the snowflake ID of the
    /// corresponding role found in this guild if it is not already known by this instance.
    /// </param>
    public SocketRole? FindRoleIn(SocketGuild guild, bool updateMissingID = false) {
        if (Type != EntityType.Role)
            throw new ArgumentException("This EntityName instance must correspond to a Role.");

        var dirty = false; // flag for updating ID if possible regardless of updateMissingId setting
        if (Id.HasValue) {
            var role = guild.GetRole(Id.Value);
            if (role != null) return role;
            else dirty = true; // only set if ID already existed but is now invalid
        }

        var r = guild.Roles.FirstOrDefault(rq => string.Equals(rq.Name, Name, StringComparison.OrdinalIgnoreCase));
        if (r != null && (updateMissingID || dirty)) Id = r.Id;

        return r;
    }

    /// <summary>
    /// Attempts to find the corresponding user within the given guild.
    /// </summary>
    /// <param name="guild">The guild in which to search for the user.</param>
    /// <param name="updateMissingID">
    /// Specifies if this EntityName instance should cache the snowflake ID of the
    /// corresponding user found in this guild if it is not already known by this instance.
    /// </param>
    public SocketGuildUser? FindUserIn(SocketGuild guild, bool updateMissingID = false) {
        if (Type != EntityType.User)
            throw new ArgumentException("This EntityName instance must correspond to a User.");

        var dirty = false; // flag for updating ID if possible regardless of updateMissingId setting
        if (Id.HasValue) {
            var user = guild.GetUser(Id.Value);
            if (user != null) return user;
            else dirty = true; // only set if ID already existed but is now invalid
        }

        var u = guild.Users.FirstOrDefault(rq => string.Equals(rq.Username, Name, StringComparison.OrdinalIgnoreCase));
        if (u != null && (updateMissingID || dirty)) Id = u.Id;

        return u;
    }

    /// <summary>
    /// Attempts to find the corresponding channel within the given guild.
    /// </summary>
    /// <param name="guild">The guild in which to search for the channel.</param>
    /// <param name="updateMissingID">
    /// Specifies if this EntityName instance should cache the snowflake ID of the
    /// corresponding channel found in this guild if it is not already known by this instance.
    /// </param>
    public SocketTextChannel? FindChannelIn(SocketGuild guild, bool updateMissingID = false) {
        if (Type != EntityType.Channel)
            throw new ArgumentException("This EntityName instance must correspond to a Channel.");

        var dirty = false; // flag for updating ID if possible regardless of updateMissingId setting
        if (Id.HasValue) {
            var channel = guild.GetTextChannel(Id.Value);
            if (channel != null) return channel;
            else dirty = true; // only set if ID already existed but is now invalid
        }

        var c = guild.TextChannels.FirstOrDefault(rq => string.Equals(rq.Name, Name, StringComparison.OrdinalIgnoreCase));
        if (c != null && (updateMissingID || dirty)) Id = c.Id;

        return c;
    }
    #endregion
}


text:
#include "stdafx.h"
#include "ReparsePoint.h"
#include "ScopedHandle.h"
#include "typed_buffer.h"
#include <string>
#include <vector>

// Taken from ntifs.h
#define SYMLINK_FLAG_RELATIVE   1

typedef struct _REPARSE_DATA_BUFFER {
	ULONG  ReparseTag;
	USHORT ReparseDataLength;
	USHORT Reserved;
	union {
		struct {
			USHORT SubstituteNameOffset;
			USHORT SubstituteNameLength;
			USHORT PrintNameOffset;
			USHORT PrintNameLength;
			ULONG Flags;
			WCHAR PathBuffer[1];
		} SymbolicLinkReparseBuffer;
		struct {
			USHORT SubstituteNameOffset;
			USHORT SubstituteNameLength;
			USHORT PrintNameOffset;
			USHORT PrintNameLength;
			WCHAR PathBuffer[1];
		} MountPointReparseBuffer;
		struct {
			UCHAR  DataBuffer[1];
		} GenericReparseBuffer;
	} DUMMYUNIONNAME;
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;

#define REPARSE_DATA_BUFFER_HEADER_LENGTH FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer.DataBuffer)

#define IO_REPARSE_TAG_MOUNT_POINT              (0xA0000003L)       // winnt
#define IO_REPARSE_TAG_HSM                      (0xC0000004L)       // winnt
#define IO_REPARSE_TAG_DRIVE_EXTENDER           (0x80000005L)
#define IO_REPARSE_TAG_HSM2                     (0x80000006L)       // winnt
#define IO_REPARSE_TAG_SIS                      (0x80000007L)       // winnt
#define IO_REPARSE_TAG_WIM                      (0x80000008L)       // winnt
#define IO_REPARSE_TAG_CSV                      (0x80000009L)       // winnt
#define IO_REPARSE_TAG_DFS                      (0x8000000AL)       // winnt
#define IO_REPARSE_TAG_FILTER_MANAGER           (0x8000000BL)
#define IO_REPARSE_TAG_SYMLINK                  (0xA000000CL)       // winnt
#define IO_REPARSE_TAG_IIS_CACHE                (0xA0000010L)
#define IO_REPARSE_TAG_DFSR                     (0x80000012L)       // winnt
#define IO_REPARSE_TAG_DEDUP                    (0x80000013L)       // winnt
#define IO_REPARSE_TAG_APPXSTRM                 (0xC0000014L)
#define IO_REPARSE_TAG_NFS                      (0x80000014L)       // winnt
#define IO_REPARSE_TAG_FILE_PLACEHOLDER         (0x80000015L)       // winnt
#define IO_REPARSE_TAG_DFM                      (0x80000016L)
#define IO_REPARSE_TAG_WOF                      (0x80000017L)       // winnt

static int g_last_error = 0;

int ReparsePoint::GetLastError()
{
	return g_last_error;
}

ScopedHandle OpenReparsePoint(const std::wstring& path, bool writable)
{
	HANDLE h = CreateFile(path.c_str(),
		GENERIC_READ | (writable ? GENERIC_WRITE : 0),
		0,
		0,
		OPEN_EXISTING,
		FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
		0);

	if (h == INVALID_HANDLE_VALUE)
	{
		g_last_error = GetLastError();
	}

	return ScopedHandle(h, false);
}

static bool SetReparsePoint(const ScopedHandle& handle, typed_buffer_ptr<REPARSE_DATA_BUFFER>& reparse_buffer)
{
	DWORD cb;
	if (!handle.IsValid()) {
		return false;
	}

	bool ret = DeviceIoControl(handle, FSCTL_SET_REPARSE_POINT,
		reparse_buffer, reparse_buffer.size(), nullptr, 0, &cb, nullptr) == TRUE;
	if (!ret)
	{
		g_last_error = GetLastError();
	}

	return ret;
}

static bool DeleteReparsePoint(const ScopedHandle& handle, PREPARSE_GUID_DATA_BUFFER reparse_buffer)
{
	DWORD cb;
	if (!handle.IsValid()) {
		return false;
	}

	bool ret = DeviceIoControl(handle,
		FSCTL_DELETE_REPARSE_POINT,
		reparse_buffer,
		REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
		nullptr,
		0,
		&cb,
		0) == TRUE;

	if (!ret)
	{
		g_last_error = GetLastError();
	}

	return ret;
}

typed_buffer_ptr<REPARSE_DATA_BUFFER> BuildMountPoint(const std::wstring& target, const std::wstring& printname)
{
	const size_t target_byte_size = target.size() * 2;
	const size_t printname_byte_size = printname.size() * 2;
	const size_t path_buffer_size = target_byte_size + printname_byte_size + 8 + 4;
	const size_t total_size = path_buffer_size + REPARSE_DATA_BUFFER_HEADER_LENGTH;
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buffer(total_size);

	buffer->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
	buffer->ReparseDataLength = path_buffer_size;
	buffer->Reserved = 0;

	buffer->MountPointReparseBuffer.SubstituteNameOffset = 0;
	buffer->MountPointReparseBuffer.SubstituteNameLength = target_byte_size;
	memcpy(buffer->MountPointReparseBuffer.PathBuffer, target.c_str(), target_byte_size + 2);
	buffer->MountPointReparseBuffer.PrintNameOffset = target_byte_size + 2;
	buffer->MountPointReparseBuffer.PrintNameLength = printname_byte_size;
	memcpy(buffer->MountPointReparseBuffer.PathBuffer + target.size() + 1, printname.c_str(), printname_byte_size + 2);

	return buffer;
}

typed_buffer_ptr<REPARSE_DATA_BUFFER> BuildSymlink(const std::wstring& target, const std::wstring& printname, bool relative)
{
	const size_t target_byte_size = target.size() * 2;
	const size_t printname_byte_size = printname.size() * 2;
	const size_t path_buffer_size = target_byte_size + printname_byte_size + 12 + 4;
	const size_t total_size = path_buffer_size + REPARSE_DATA_BUFFER_HEADER_LENGTH;
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buffer(total_size);

	buffer->ReparseTag = IO_REPARSE_TAG_SYMLINK;
	buffer->ReparseDataLength = path_buffer_size;
	buffer->Reserved = 0;

	buffer->SymbolicLinkReparseBuffer.SubstituteNameOffset = 0;
	buffer->SymbolicLinkReparseBuffer.SubstituteNameLength = target_byte_size;
	memcpy(buffer->SymbolicLinkReparseBuffer.PathBuffer, target.c_str(), target_byte_size + 2);
	buffer->SymbolicLinkReparseBuffer.PrintNameOffset = target_byte_size + 2;
	buffer->SymbolicLinkReparseBuffer.PrintNameLength = printname_byte_size;
	memcpy(buffer->SymbolicLinkReparseBuffer.PathBuffer + target.size() + 1, printname.c_str(), printname_byte_size + 2);
	buffer->SymbolicLinkReparseBuffer.Flags = relative ? SYMLINK_FLAG_RELATIVE : 0;

	return buffer;
}

static bool CreateMountPointInternal(const std::wstring& path, typed_buffer_ptr<REPARSE_DATA_BUFFER>& buffer)
{
	ScopedHandle handle = OpenReparsePoint(path, true);

	if (!handle.IsValid())
	{
		return false;
	}

	return SetReparsePoint(handle, buffer);
}

static bool CreateMountPointInternal(const ScopedHandle& handle, typed_buffer_ptr<REPARSE_DATA_BUFFER>& buffer)
{
	return SetReparsePoint(handle, buffer);
}

std::wstring FixupPath(std::wstring str)
{
	if (str[0] != '\\')
	{
		return L"\\??\\" + str;
	}

	return str;
}

bool ReparsePoint::CreateMountPoint(const std::wstring& path, const std::wstring& target, const std::wstring& printname)
{
	if (target.length() == 0)
	{
		return false;
	}

	return CreateMountPointInternal(path, BuildMountPoint(FixupPath(target), printname));
}

bool ReparsePoint::CreateSymlink(const std::wstring& path, const std::wstring& target, const std::wstring& printname, bool relative)
{
	if (target.length() == 0)
	{
		return false;
	}

	return CreateMountPointInternal(path, BuildSymlink(!relative ? FixupPath(target) : target, printname, relative));
}

bool ReparsePoint::CreateSymlink(HANDLE h, const std::wstring& target, const std::wstring& printname, bool relative)
{
	ScopedHandle handle(h, true);

	if (!handle.IsValid())
	{
		return false;
	}

	return CreateMountPointInternal(handle, BuildSymlink(!relative ? FixupPath(target) : target, printname, relative));
}

bool ReparsePoint::DeleteMountPoint(const std::wstring& path)
{
	REPARSE_GUID_DATA_BUFFER reparse_buffer = { 0 };
	reparse_buffer.ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;

	ScopedHandle handle = OpenReparsePoint(path, true);

	return DeleteReparsePoint(handle, &reparse_buffer);
}

bool ReparsePoint::CreateRawMountPoint(const std::wstring& path, DWORD reparse_tag, const std::vector<BYTE>& buffer)
{
	typed_buffer_ptr<REPARSE_DATA_BUFFER> reparse_buffer(8 + buffer.size());

	reparse_buffer->ReparseTag = reparse_tag;
	reparse_buffer->ReparseDataLength = buffer.size();
	reparse_buffer->Reserved = 0;
	memcpy(reparse_buffer->GenericReparseBuffer.DataBuffer, &buffer[0], buffer.size());

	return CreateMountPointInternal(path, reparse_buffer);
}

static typed_buffer_ptr<REPARSE_DATA_BUFFER> GetReparsePointData(ScopedHandle handle)
{
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buf(MAXIMUM_REPARSE_DATA_BUFFER_SIZE);

	DWORD dwBytesReturned;
	if (!DeviceIoControl(handle,
		FSCTL_GET_REPARSE_POINT,
		NULL,
		0,
		(LPVOID)buf,
		buf.size(),
		&dwBytesReturned,
		0)
		)
	{
		g_last_error = GetLastError();
		buf.reset(0);
	}

	return buf;
}

std::wstring ReparsePoint::GetMountPointTarget(const std::wstring& path)
{
	ScopedHandle handle = OpenReparsePoint(path, false);
	if (!handle.IsValid())
	{
		return L"";
	}

	typed_buffer_ptr<REPARSE_DATA_BUFFER> buf = GetReparsePointData(handle);

	if (buf.size() == 0)
	{
		return L"";
	}

	if (buf->ReparseTag != IO_REPARSE_TAG_MOUNT_POINT)
	{
		g_last_error = ERROR_REPARSE_TAG_MISMATCH;
		return L"";
	}

	WCHAR* base = &buf->MountPointReparseBuffer.PathBuffer[buf->MountPointReparseBuffer.SubstituteNameOffset / 2];

	return std::wstring(base, base + (buf->MountPointReparseBuffer.SubstituteNameLength / 2));
}

bool ReparsePoint::IsReparsePoint(const std::wstring& path)
{
	ScopedHandle handle = OpenReparsePoint(path, false);
	BY_HANDLE_FILE_INFORMATION file_info = { 0 };

	return handle.IsValid() && GetFileInformationByHandle(handle, &file_info) && file_info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT;
}

static bool ReadReparsePoint(const std::wstring& path, typed_buffer_ptr<REPARSE_DATA_BUFFER>& reparse_buffer)
{
	ScopedHandle handle = OpenReparsePoint(path, false);
	reparse_buffer.reset(4096);
	DWORD dwSize;

	bool ret = DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, nullptr, 0, reparse_buffer, reparse_buffer.size(), &dwSize, nullptr) == TRUE;
	if (!ret)
	{
		g_last_error = GetLastError();
		return false;
	}
	else
	{
		reparse_buffer.resize(dwSize);
		return true;
	}
}

static bool IsReparseTag(const std::wstring& path, DWORD reparse_tag)
{
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buffer;

	if (ReadReparsePoint(path, buffer))
	{
		return buffer->ReparseTag == reparse_tag;
	}
	else
	{
		return false;
	}
}

bool ReparsePoint::IsMountPoint(const std::wstring& path)
{
	return IsReparseTag(path, IO_REPARSE_TAG_MOUNT_POINT);
}

bool ReparsePoint::IsSymlink(const std::wstring& path)
{
	return IsReparseTag(path, IO_REPARSE_TAG_SYMLINK);
}

bool ReparsePoint::ReadMountPoint(const std::wstring& path, std::wstring& target, std::wstring& printname)
{
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buffer;

	if (ReadReparsePoint(path, buffer) && buffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
	{
		WCHAR* target_name = &buffer->MountPointReparseBuffer.PathBuffer[buffer->MountPointReparseBuffer.SubstituteNameOffset / 2];
		WCHAR* display_name = &buffer->MountPointReparseBuffer.PathBuffer[buffer->MountPointReparseBuffer.PrintNameOffset / 2];
		target.assign(target_name, target_name + buffer->MountPointReparseBuffer.SubstituteNameLength / 2);
		printname.assign(display_name, display_name + buffer->MountPointReparseBuffer.PrintNameLength / 2);
		return true;
	}
	else
	{
		return false;
	}
}

bool ReparsePoint::ReadSymlink(const std::wstring& path, std::wstring& target, std::wstring& printname, unsigned int* flags)
{
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buffer;

	if (ReadReparsePoint(path, buffer) && buffer->ReparseTag == IO_REPARSE_TAG_SYMLINK)
	{
		WCHAR* target_name = &buffer->SymbolicLinkReparseBuffer.PathBuffer[buffer->SymbolicLinkReparseBuffer.SubstituteNameOffset / 2];
		WCHAR* display_name = &buffer->SymbolicLinkReparseBuffer.PathBuffer[buffer->SymbolicLinkReparseBuffer.PrintNameOffset / 2];
		target.assign(target_name, target_name + buffer->SymbolicLinkReparseBuffer.SubstituteNameLength / 2);
		printname.assign(display_name, display_name + buffer->SymbolicLinkReparseBuffer.PrintNameLength / 2);
		*flags = buffer->SymbolicLinkReparseBuffer.Flags;
		return true;
	}
	else
	{
		return false;
	}
}

bool ReparsePoint::ReadRaw(const std::wstring& path, unsigned int* reparse_tag, std::vector<BYTE>& raw_data)
{
	typed_buffer_ptr<REPARSE_DATA_BUFFER> buffer;

	if (ReadReparsePoint(path, buffer))
	{
		*reparse_tag = buffer->ReparseTag;
		raw_data.resize(buffer->ReparseDataLength);
		memcpy(&raw_data[0], buffer->GenericReparseBuffer.DataBuffer, buffer->ReparseDataLength);
		return true;
	}
	else
	{
		return false;
	}

	return false;
}


text:
({
	init: function(component, event, helper) {
		var concreteId = component.getConcreteComponent().getGlobalId();

		component.set("v.domId", concreteId);
	},

    handleMouseover: function(component, event, helper) {
        var concreteCmp = component.getConcreteComponent();
        var _helper = concreteCmp.getDef().getHelper();
        _helper.handleMouseover(concreteCmp);
    },

    handleMouseout: function(component, event, helper) {
        var concreteCmp = component.getConcreteComponent();
        var _helper = concreteCmp.getDef().getHelper();
        _helper.handleMouseout(concreteCmp);
    }
})// eslint-disable-line semi


text:
<?php
namespace Vivo\Router;

use Zend\Mvc\Router\Http\RouteInterface;
use Zend\Mvc\Router\Http\RouteMatch;
use Zend\Stdlib\RequestInterface as Request;

/**
 * Simple router, that is used in routerchain only for setting hostname in RouteMatch.
 */
class Hostname implements RouteInterface
{

    public function match(Request $request)
    {
        return new RouteMatch(array('host' => $request->getUri()->getHost()));
    }

    public static function factory($options = array())
    {
        return new static();
    }

    public function assemble(array $params = array(), array $options = array())
    {
        return '';
    }

    public function getAssembledParams()
    {
        return array ('host');
    }
}


text:
Rails.application.config.middleware.use 'Apartment::Elevators::Subdomain'

# This collection includes the models that are not scoped by the schema lookup by the Apartment gem
Apartment.excluded_models = ["Subscribem::Account",
							"Subscribem::Member",
							"Subscribem::User",
							"Subscribem::Plan"]

# give the Apartment gems a list of the schemas to migrate
# pluck will fetch all the subdomain values for the records in subscribem_accounts
# and return them in an array.  This array is used by apartment:migrate
Apartment.database_names = lambda{ Subscribem::Account.pluck(:subdomain) }


text:
<?php
/**
 * @author: gareth
 */

namespace SWCO\AppNexusAPI\Exceptions;

class BadServiceException extends AppNexusAPIException
{

}


text:
import http.server
from bombastik import serializers

STATUS_CODES = http.server.BaseHTTPRequestHandler.responses

class Response:
	DEFAULT_MIMETYPE = ".txt"

	def __init__(self, status, headers, data, mimetype=None,
						encoding="utf-8"):
		self._status = status
		self._headers = dict(headers)
		self._data = data
		self._mimetype = mimetype
		self._encoding = encoding
		self.serializer = None

	def __iter__(self):
		return iter((self._status, self._headers, self._data))

	def for_wsgi(self):
		self._headers["Content-Encoding"] = self._encoding
		content = self.serialize_data(self._data)
		return iter((
			"{} {}".format(self._status,
					STATUS_CODES[self._status][0]),
			list(self._headers.items()),
			content))

	def serialize_data(self, data):
		if self.serializer is None:
			datatype = type(data)
			mimetype = self._mimetype
			if mimetype is None:
				mimetype = serializers \
					.DATATYPE_TO_MIMETYPE_MAP.get(
						datatype,
						self.DEFAULT_MIMETYPE)
			self._headers["Content-Type"] = \
				serializers.MIMETYPE_TO_CONTENTTYPE_MAP[
							mimetype]
			self.serializer = serializers \
				.get_serializer_for_type(datatype)

		return self.serializer(data)


text:
package fpt.qa.additionalinformation.test;

import java.util.ArrayList;

import fpt.qa.additionalinformation.modifier.ConjunctionWithType;
import fpt.qa.mdnlib.struct.pair.Pair;

public class ConjunctionWithTypeTest{
    private static final String TEXT = "rạp dân chủ ở đâu?";
    private static final String TEXT2 = "rạp chủ dân ở đâu?";
    private static final String TEXT3 = "phim quái vật frankenstein chiếu mấy giờ?";
    private static final String TEXT4 = "trung tâm chiếu phim quốc gia ở đường nào ?";
    private static final String TEXT5 = "hôm nay có phim gì không lucy?";

    public static void main( String[] args ){

        ConjunctionWithType conjunctionWithType = new ConjunctionWithType( "SRC/MAIN/resources/" );
        //conjunctionWithType.loadConjunctionType( new File( "resources/conjunction/movies_infor.txt" ) );

        System.out.println( TEXT5 );
        for( Pair< String, String > element : conjunctionWithType.getOriginRelevantConjunctionsWithType( TEXT3 ) ){
            System.out.println( element.first + " " + element.second );
        }

//        for( Pair< ArrayList< String >, String > element : conjunctionWithType.getListRelevantConjunctionsWithType( TEXT5 ) ){
//            System.out.println( element.first + " " + element.second );
//        }
    }
}


text:
#ifndef FREEOMICRON_CELESTIALOBJECT_H
#define FREEOMICRON_CELESTIALOBJECT_H
#pragma once

#include <boost/variant.hpp>

#include <QObject>
#include <QJsonObject>
#include <QStringList>

#include "bluedot/utils/Enum.h"
#include "bluedot/utils/Flags.h"
#include "bluedot/Graph.h"
#include "bluedot/Namespace.h"

using namespace bluedot::flags_literals;

enum class CelestialType
{
	Unknown              = 0,
	Star                 = 1_bit,
	Body                 = 2_bit,
	Planet               = Body | 3_bit,
	DwarfPlanet          = Body | 4_bit,
	Satelite             = Body | 5_bit,
	SmallSolarSystemBody = Body | 6_bit,
	Comet                = SmallSolarSystemBody | 7_bit,
	Asteroid             = SmallSolarSystemBody | 8_bit
};

DECLARE_FLAGS(CelestialTypes, CelestialType)
DECLARE_ENUM_OPERATORS(CelestialType)

class CelestialObject : public bdt::Node
{
public:
	CelestialObject(CelestialType celestialType = CelestialType::Unknown);
	virtual ~CelestialObject() = 0;

	virtual void read(const QJsonObject &json);
	virtual const bluedot::instance_id_t &basePathId() const = 0;

	bool hasOrbit() const;

	inline bool equalIds(const QString &id) const
	{
		return _name == id;
	}

	// getters & setters

	inline CelestialTypes celestialType() const
	{
		return _celestialType;
	}
	void setCelestialType(const CelestialTypes &type);

	inline const QString &name() const
	{
		return _name;
	}
	void setName(const QString &name);

	QString largeImage() const;
	void setLargeImage(const QString &largeImage);

	QString description() const;
	void setDescription(const QString &description);

	CelestialObject *parentObject() const
	{
		return _parent->as<CelestialObject>();
	}
	void setParentObject(CelestialObject *parentObject);

	CelestialObject *childObject(size_t index);

	const QStringList &images() const;

	// static functions
	static CelestialType celestialTypeFromTypeName(const QString &name);

protected:
	CelestialTypes _celestialType;
	QString _name;
	QString _description;
	QString _largeImage;
	QStringList _images;
};

#endif // FREEOMICRON_CELESTIALOBJECT_H