text:
from decimal import *

from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *

# TODO fix to proper rpc_msgs after special card will be fixed.
validation_inputs_with_funds = [
    ('valid_denom_101', 101),
    ('valid_denom_400', 400),
    ('valid_denom_1000_exceed_limit', 1000),
    ('valid_denom_1', 1),
    ('valid_denom_1.0', 1.0),
    ('ivalid_input_string', 'string'),
    ('valid_input_string_with_num', '1'),
    ('ivalid_input_empty', None),
    ('valid_denom_1_account', (1, '')),
    ('valid_denom_1_invalid_account', (1, 'InvalidAccount')),
    ('invalid_denom_invalid_account', (10000000000000, 'InvalidAccount')),
]

post_outputs_with_funds = [
    (None, None),
    (None, None),
    (-4, 'Required amount exceed value spend limit'),
    (None, None),
    (None, None),
    (-3, 'Invalid amount'),
    (None, None),
    (-3, 'Amount is not a number or string'),
    (None, None),
    (-6, 'Account has insufficient funds'),
    (-6, 'Account has insufficient funds'),
]

class SigmaSpendValidationWithFundsTest(BitcoinTestFramework):
    def __init__(self):
        super().__init__()
        self.num_nodes = 4
        self.setup_clean_chain = False

    def setup_nodes(self):
        # This test requires mocktime
        enable_mocktime()
        return start_nodes(self.num_nodes, self.options.tmpdir)

    def run_test(self):
        # Decimal formating: 6 digits for balance will be enought 000.000
        getcontext().prec = 6
        self.nodes[0].generate(150)
        self.sync_all()
        self.nodes[0].mint(240.8)
        self.nodes[0].mint(2000)

        self.nodes[0].generate(10)
        self.sync_all()
        for input_data, exp_err in zip(validation_inputs_with_funds, post_outputs_with_funds):
            case_name, denom = input_data
            exp_code, exp_msg = exp_err
            msg = None
            code = None
            print('Current case: {}'.format(case_name))
            try:
                # With address
                if isinstance(denom, tuple):
                    val = {'THAYjKnnCsN5xspnEcb1Ztvw4mSPBuwxzU': denom[0]}
                    res = self.nodes[0].spendmany(denom[1], val)
                else:
                    val = {'THAYjKnnCsN5xspnEcb1Ztvw4mSPBuwxzU': denom}
                    res = self.nodes[0].spendmany("", val)
            except JSONRPCException as ex:
                msg = ex.error['message']
                code = ex.error['code']
                assert msg == exp_msg, \
                    'Unexpected error raised to RPC:{}, but should:{}'.format(msg, exp_msg)
                assert code == exp_code, \
                    'Unexpected error raised to RPC: {}, but should {}.'.format(code, exp_code)
            assert exp_msg == msg, 'Unexpected exception appeared {}, but should be {}'.format(msg, exp_msg)

if __name__ == '__main__':
    SigmaSpendValidationWithFundsTest().main()


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
        android:id="@+id/bubble_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="bold" />
    <TextView
        android:id="@+id/bubble_category"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/bubble_title" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="italic"
        android:text="@string/tap_to_view_details"
        android:layout_below="@+id/bubble_rating"
        android:layout_centerInParent="true" />
	<TextView
	    android:id="@+id/bubble_rating"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:layout_below="@+id/bubble_category" />
</RelativeLayout>

redpajama_set_name: RedPajamaGithub


text:
**NPM**

`npm install @cerebral/storage --save`

**YARN**

`yarn add @cerebral/storage`

## description
This module exposes local storage or session storage as a provider,
where it by default parses and serializes to JSON.

## API

### instantiate

```js
import {Controller} from 'cerebral'
import StorageProvider from '@cerebral/storage'

const controller = Controller({
  providers: [StorageProvider({
    // instance of storage, can be window.localStorage / localStorage
    // or window.sessionStorage / sessionStorage
    target: localStorage
    // Serializes and parses to JSON by default
    json: true,
    // Synchronize state when it changes
    sync: {
      'someStorageKey': 'some.state.path'
    },
    // Set prefix for storagekey "somePrefix.someStorageKey"
    prefix: 'somePrefix'
  })]
})
```

### set
Write data to storage.

*action*
```javascript
function someAction({storage}) {
  storage.set('someKey', {foo: 'bar'})
}
```

*factory*
```javascript
import {state, props} from 'cerebral/tags'
import {setStorage} from '@cerebral/storage/operators'

export default [
  setStorage(state`currentStorageKey`, props`someData`)
]
```

### get
Get data from storage.

*action*
```javascript
function someAction({storage}) {
  const data = storage.get('someKey')
}
```

*factory*
```javascript
import {state, props} from 'cerebral/tags'
import {getStorage} from '@cerebral/storage/operators'

export default [
  getStorage('someKey'),
  function someAction ({props}) {
    props.value // Whatever was on "someKey"
  }
]
```

### remove
Remove data from storage.

*action*
```javascript
function someAction({storage}) {
  storage.remove('someKey')
}
```

*factory*
```javascript
import {state} from 'cerebral/tags'
import {removeStorage} from '@cerebral/storage/operators'

export default [
  removeStorage(state`currentStorageKey`)
]
```


text:
namespace ChoiceNet {
namespace Eco {

ClockServerException::ClockServerException(const std::string& msg, int code):
	Poco::Exception(std::string("[CLock Server]: ") + msg, code)
{
}

ClockServerException::ClockServerException(const ClockServerException& exc):
	Poco::Exception(exc)
{
}

ClockServerException::~ClockServerException() throw()
{
}

} } // namespace ChoiceNet::Eco


text:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="0.1.1" rim:header="RIM-Widget:rim/widget">
  <name>Sample Barcode App</name>
  <description>This is a sample application</description>
  <author rim:copyright="2012" href="www.blackberry.com/developers">The WAAsome Team</author>
  <license>This application is provided as a sample, but is functional and used for instruction.</license>
  <feature id="blackberry.app" required="true" version="1.0.0.0"/>
  <feature id="blackberry.app.event" required="true" version="1.0.0.0"/>
  <feature id="blackberry.system" required="true" version="1.0.0.0"/>
  <feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
  <feature id="webworks.media.barcode" required="true" version="1.0.0.0"/>
  <icon rim:hover="false" src="images/appicon.png"/>
  <content src="index.html"/>
  <rim:cache maxCacheSizeTotal="2048"/>
</widget>


text:
import { ILoggerConfig } from '../models/logger-config.model';
import { LoggerService } from '../services/logger.service';
import { LoggerConfig } from '../models/logger.config';
import { MissingTranslationHandler, MissingTranslationHandlerParams } from '@ngx-translate/core';
import { Inject, Injectable } from '@angular/core';

@Injectable()
export class MissingTranslationLogging implements MissingTranslationHandler {
	constructor(public logger: LoggerService,
				@Inject(LoggerConfig) public loggerConfig: ILoggerConfig) {

	}

	handle(params: MissingTranslationHandlerParams) {
		if (this.loggerConfig.showTranslationWarnings) {
			this.logger.warn(`Can't find translation for ${ params.key }`, 'TRANSLATION');
		}
		return params.key;
	}
}


text:
import math

# This is a fairly naive implementation of the algorithm described in
# "Effective Computation of Biased Quantiles over Data Streams"

class Quantiles(object):
    def __init__(self, f=None):
        self.points = None
        self.n = 0
        self.f = f or biased_quantiles_f

    def insert(self, val):
        if self.points is None or val < self.points.val:
            # less than first
            self.points = _point(val, 1, 0, self.points)
            return
        prev = self.points
        cur = self.points.next
        r = 0
        while cur and cur.next:
            if val < cur.val:
                break
            r += cur.delta
            prev = cur
            cur = cur.next
        else:  # ran off the end
            (cur or prev).next = _point(val, 1, 0, None)
            return
        new = _point(val, 1, max(int(self.f(r, self.n)) - 1, 0), cur)
        prev.next = new
        self.n += 1
        if self.n % COMPRESS_INTERVAL == 0:
            self.compress()

    def compress(self):
        pointlist = []
        cur = self.points
        r = [0]
        while cur:
            pointlist.append(cur)
            r.append(r[-1] + cur.delta)
            cur = cur.next
        for i in range(len(pointlist) - 2, 0, -1):
            if pointlist[i].delta + pointlist[i + 1].delta + pointlist[i + 1].width <= self.f(r[i], self.n):
                # merge
                pointlist[i].next = pointlist[i + 1].next
                pointlist[i].val = pointlist[i + 1].val
                pointlist[i].delta += pointlist[i + 1].delta
                pointlist[i].width = pointlist[i + 1].width

    def query(self, p):
        cur_r = 0
        cur_point = self.points
        while cur_point:
            cur_r += cur_point.delta
            if (cur_r + cur_point.next.delta + cur_point.next.width >
                        self.n * p + self.f(self.n * p, self.n) / 2):
                return cur_point, (cur_r + cur_point.delta, cur_r + cur_point.delta + cur_point.width)
            cur_point = cur_point.next

    def get_pointlist(self):
        if not self.points:
            return []
        p = [self.points]
        while p[-1].next:
            p.append(p[-1].next)
        return p

import math

class DistributedQuantiles(object):
    def __init__(self, error):
        self.size = math.ceil(1 / error)
        self.inbuf = []
        self.qs = []
        self.n = 0

    def insert(self, val):
        self.inbuf.append(val)
        if len(self.inbuf) >= self.size:
            self.inbuf.sort()
            i, j = 0, 0
            new_qs = []
            if self.inbuf[0] < self.qs[0][0]:
                while self.inbuf[i] < self.qs[j][0]:
                    new_qs.append((self.inbuf[i], i, i))
            while i < len(self.inbuf) and j < len(self.qs):
                nxtmin = i + self.qs[j][1]
                nxtmax = i + self.qs[j][2] - 1
                if self.inbuf[i] < self.qs[j][0]:
                    nxtval = self.inbuf[i]
                    i += 1
                elif self.qs[j] < self.inbuf[i]:
                    nxtval = self.qs[j]
                    j += 1
                else:
                    val = self.inbuf[i]
                    if len(inbuf) > i + 1 and inbuf[i + 1] == val:
                        if len(self.qs) > j + 1 and self.qs[j + 1] == val:
                            new_qs.append((val, ))
                    # the paper does not cover this case so a supplemental
                    # proof is provided
                    pass
                new_qs.append((nxtval, nxtmin, nxtmax))
            self.qs = new_qs
            self.prune()

    def prune(self):
        pass

'''
Supplemental proof of correctness of equal value element case.
(notation is kept as close as possible to the original paper
within the limitations of ASCII)

MOTIVATION:
The error bound as given in the paper is dependent that
when merging any Q' and Q'', the next-lowest y_s of Q'' and
next-highest y_t of Q'' to any x of Q' must be consecutive.

However, in the general case there may be many elements whose
value are equal.  Consider
Q' = [...,-1,0,1,...]
Q'' = [...,-1,0,0,1,...]

For x of Q' = 0, y_s = -1 and y_t = 1.
y_s and y_t are not consecutive.
The merge operation is no longer correct, because inductively
rmax_Q''(y_s) - rmin_Q''(y_t) <= 3 eps n'' ; which is not <= 2 eps n''

We therefore define a new merge operation for elements of Q' and Q''
which are equal.

This merge operation will also inductively guarantee that only
two consecutive elements may share the same value.

INTUITION:
The intuitive explanation of the meaning of multiple elements
with the same value is that it represents an unbroken
sequence of observations with that same value.  The first
element represents the rank of the beginning of this sequence.
The second element represents the rank of the end of this
sequence.

Because of this, there should never be more than two elements
with the same value.  (If there is a third element, it can be
discarded keeping only the maximum and minimum.)

This also means that if there are two elements with the same
value, rmin may be set to rmax for the lower ranked element,
and rmax may be set to rmin for the higher ranked element.

Because every rank between the two elements of the same
value is known to also be of that value, the top-most rank
in the range of the first value and bottom-most rank in the
range of the second value are known to be the exact locations
of an element of the given value.

NEW MERGE OPERATION:

The proposed new merge operation considers 4 points at a time:

x_r, x_r+1, y_t, y_t+1

where x_r is the minimum un-merged element of Q'
      x_r+1 is the next consecutive element of Q'
      y_t is the minimum un-merged element of Q''
      y_t+1 is the next consecutive element of Q''

in order to generate z_i of Q

all points whose value are equal are consumed in a single step

there are four cases:

for notation convenience,
define the ADD operation of x of Q' and y of Q''
be z of Q:
    rmax_Q(z) = rmax_Q'(x) + rmax_Q''(y)
    rmin_Q(z) = rmin_Q'(x) + rmin_Q''(y)

CASE I:
    x_r != y_t:
        apply the merge operation as in the original paper
CASE II:
    x_r = y_t, and x_r != x_r+1, and y_t != y_t+1:
        z_i = ADD(x_r, y_t)
        move on to x_r+1, y_t+1
case III:
    x_r = y_t = x_r+1 != y_t+1:
        generate two points, z_i and z_i'
        z_i = ADD(x_r, y_t)
        z_i' = ADD(x_r+1, y_t)
        apply SHRINK to the pair of points,
        append the result (either one or two points) to Q,
        move on to x_r+2 and y_t+1
case IV:
    x_r = y_t = y_t+1 != x_r+1:
        generate two points z_i and z_i'
        z_i = ADD(x_r, y_t)
        z_i' = ADD(x_r, y_t+1)
        apply SHRINK to the pair of points,
        append the result (either one or two points) to Q,
        move on to x_r+1, y_t+2
case V:
    x_r = y_t = x_r+1 = y_t+1:
        this means that there are two runs of the same value
        in each of the merging sequences.

        generate two points z_i, z_i':
        z_i = ADD(x_r, y_t)
        z_i' = ADD(x_r+1, y_t+1)
        append both to Q
        move on to x_r+2, y_t+2

PROOF:
Let eps be the error bound.
Let Q' and Q'' be two quantile summaries being merged, each of
which inductively have error <= eps.
Let x be an element of Q' and y be an element of Q'' such that.
Let n' be the number of observations covered by Q' and
n'' be the number of observations covered by Q''.

The proposed merge operation is:
rmax_Q(z_i) = rmax_Q'(x) + rmax_Q''(y)
rmin_Q(z_i) = rmin_Q'(x) + rmin_Q''(y)

We wish to show that rmax_Q(z_i+1) - rmin_Q(z_i) <= 2 eps (n' + n'')

let r be the index of x in Q'
let s by the index of y in Q''

Several things must be proven about the new MERGE:
1- that z_i and z_i+1 are within the error bounds when z_i is the
        result of CASE II, II, IV, or V, and z_i+1 is the result of CASE I
2- that z_i and z_i+1 are within the error bounds when z_i is the
        result of CASE I, and z_i+1 is the result of CASE II, III, IV, or V
3- that z_i and z_i+1 are within the error bound

There are 3 cases:

case I:

case I: z_i+1 was merged using the new merge operation
case II: z_i+1 was merged using the merge operation defined in the paper
case IIA: z_i+1 came from x_r+1 of Q'
case IIAi: z_i+1 = z_i
case IIAii: z_i+1 > z_i
case IIB: z_i+1 came from y_s+1 of Q''
case IIBi: z_i+1 = z_i
case IIBii: z_i+1 > z_i

(Note, if x_r+1 = x_r and y_s+1 = y_s, this is back to case I)

case I:
    rmax_Q(z_i+1) - rmin_Q(z_i) = rmax_Q'(x_r+1) + rmax_Q''(y_s+1)
                                   - rmin_Q'(x_r) - rmin_Q''(y_s)
                                = rmax_Q'(x_r+1) - rmin_Q'(x_r)
                                   + rmax_Q''(y_s+1) - rmin_Q''(y_s)
    by inductive property of Q' and Q''
                                <= 2 n' eps + 2 n'' eps
                                <= 2 eps (n' + n'')

case IIAi:
    if x_r = x_r+1:
        by consecutive element contraction lemma:
            if x_r and x_r+1 overlap, combine them
            and there is no z_i, only z_i+1

            otherwise, rmin_S(x_r) = rmax_S(x_r)
            and rmin_S(x_r+1) = rmax_S(x_r+1)

            rmax_Q(z_i+1) - rmin_Q(z_i)
            =

consecutive elment contraction lemma:
    let s and s' be consecutive elements of summary S,
    such that s = s'
    CASE I:
    if rmin_S(s') < rmax_S(s):
        maximum rank of s' = rmax_S(s)
        minimum rank of s = rmin_S(s')
        [s and s' are now identical, discard one]
    CASE II:
    if rmin_S(s') >= rmax_S(s):
        maximum rank of s' = rmin_S(s')
        minimum rank of s = rmax_S(s)

    let '[' represent rmin_S, and ']' represent rmax_S:
        [  x_r  ]
             [  x_r+1 ]
    let a = the value of x_r and x_r+1;
    We know that somewhere between rmax_S(x_r) and rmin_S(x_r+1)
    there is a sequence of consecutive 'a' values in the data
    set.  Therefore, there is at least one a in that interval.

-----------------------
Notation:
for readability, everything after a "_" should be read as a subscript
For example, z_i+1 should be read z sub(i+1), not z sub(i) + 1

x of Q, should be read "x element of Q"

Also, the original paper assumes that every element is unique.
Therefore, rmin(v) is a function that takes value v and returns
the minimum rank.  Because we allow two elements to have the same
value, v must be considered to be a tuple.  rmin(v) is selecting
one item from that tuple, rmax(v) is selecting another element.

This does not affect the correctness of any of the proofs from the
original paper.

'''

class _point(object):
    def __init__(self, val, delta, width, next):
        self.val, self.delta, self.width, self.next = val, delta, width, next

    def __repr__(self):
        return "_point(val={0}, delta={1}, width={2})".format(self.val, self.delta, self.width)

def biased_quantiles_f(r_i, n):
    return 2 * ERROR_RATE * r_i

def targeted_quantiles_f(percentiles_errors):
    def f(r_i, n):
        bounds = []
        for p, e in percentiles_errors:
            if r_i < p * n:
                bounds.append(2 * e * (n - r_i) / (1 - e))
            else:
                bounds.append(2 * e * r_i / p)
        return min(bounds)
    return f

ERROR_RATE = 0.001
COMPRESS_INTERVAL = 10 # int(1 / ERROR_RATE)

# val is the current (approximate) value

# delta is the difference between the lowest possible rank of the current
# point/value and the previous point

# width is the differencet between the lowest and highest possible rank
# of the current point/value

# this data structure ensures that new points can be inserted into
# the middle of the linked list

# performance of naive algorithm is very bad -- 300 - 700 microseconds
# (0.3 to 0.7 ms).  this is about 20-40x slower than python piece-wise
# parabolic algorithm;  ~300x slower than C piece-wise parabolic
def test(q=None):
    import random, time

    data = [random.normalvariate(1.0, 1.0) for i in range(int(1e4))]
    q = q or Quantiles()
    start = time.time()
    for d in data:
        q.insert(d)
    print (time.time() - start) * 1e6 / len(data), "microseconds per point"
    return q

# about 400 microseconds per point
def test_targeted():
    TARGETS = ((0.25, 0.001), (0.5, 0.001), (0.75, 0.001), (0.9, 0.001), (0.95, 0.001), (0.99, 0.001))
    f = targeted_quantiles_f(TARGETS)
    return test(q=Quantiles(f))

if __name__ == "__main__":
    print 'biased quantile condition'
    test()
    print 'targeted quantile condition'
    test_targeted()


text:
package net.estinet.gFeatures.Feature.MinigameAssister;

public class MGServer {
	private String name, category;
	public MGServer(String name, String category){
		this.name = name;
		this.category = category;
	}
	public String getName(){
		return name;
	}
	public String getCategory(){
		return category;
	}
}


text:
using System;
using CoreGraphics;
using Xamarin.Examples.Demo.Data;
using SciChart.iOS.Charting;

namespace Xamarin.Examples.Demo.iOS
{
    [ExampleDefinition("Mountain Chart", description: "Creates a simple Mountain/Area chart", icon: ExampleIcon.MountainChart)]
    public class MountainChartViewController : SingleChartViewController<SCIChartSurface>
    {
        protected override void InitExample()
        {
            var xAxis = new SCIDateAxis { GrowBy = new SCIDoubleRange(0.1, 0.1) };
            var yAxis = new SCINumericAxis { GrowBy = new SCIDoubleRange(0.1, 0.1) };

            var priceData = DataManager.Instance.GetPriceDataIndu();
			var dataSeries = new XyDataSeries<DateTime, double>();
            dataSeries.Append(priceData.TimeData, priceData.CloseData);

            var rSeries = new SCIFastMountainRenderableSeries
            {
                DataSeries = dataSeries,
                StrokeStyle = new SCISolidPenStyle(0xAAFFC9A8, 2f),
                AreaStyle = new SCILinearGradientBrushStyle(new CGPoint(0.5, 0), new CGPoint(0.5, 1), 0xAAFF8D42, 0x88090E11),
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(rSeries);
				Surface.ChartModifiers.Add(CreateDefaultModifiers());

				SCIAnimations.SweepSeries(rSeries, 3, new SCICubicEase());
			}
		}
    }
}


text:
import * as React from 'react';
import * as PropTypes from 'prop-types';
import RcSelect, { Option, OptGroup } from 'rc-select';
import classNames from 'classnames';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale-provider/default';
import warning from 'warning';
import Icon from '../icon';

export interface AbstractSelectProps {
  prefixCls?: string;
  className?: string;
  size?: 'default' | 'large' | 'small';
  notFoundContent?: React.ReactNode | null;
  transitionName?: string;
  choiceTransitionName?: string;
  showSearch?: boolean;
  allowClear?: boolean;
  disabled?: boolean;
  showArrow?: boolean;
  style?: React.CSSProperties;
  tabIndex?: number;
  placeholder?: string | React.ReactNode;
  defaultActiveFirstOption?: boolean;
  dropdownClassName?: string;
  dropdownStyle?: React.CSSProperties;
  dropdownMenuStyle?: React.CSSProperties;
  dropdownMatchSelectWidth?: boolean;
  onSearch?: (value: string) => any;
  getPopupContainer?: (triggerNode: Element) => HTMLElement;
  filterOption?: boolean | ((inputValue: string, option: React.ReactElement<OptionProps>) => any);
  id?: string;
  defaultOpen?: boolean;
  open?: boolean;
  onDropdownVisibleChange?: (open: boolean) => void;
}

export interface LabeledValue {
  key: string;
  label: React.ReactNode;
}

export type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[];

export interface SelectProps extends AbstractSelectProps {
  value?: SelectValue;
  defaultValue?: SelectValue;
  mode?: 'default' | 'multiple' | 'tags' | 'combobox' | string;
  optionLabelProp?: string;
  firstActiveValue?: string | string[];
  onChange?: (value: SelectValue, option: React.ReactElement<any> | React.ReactElement<any>[]) => void;
  onSelect?: (value: SelectValue, option: React.ReactElement<any>) => any;
  onDeselect?: (value: SelectValue) => any;
  onBlur?: () => any;
  onFocus?: () => any;
  onPopupScroll?: () => any;
  onInputKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
  onMouseEnter?: (e: React.MouseEvent<HTMLInputElement>) => any;
  onMouseLeave?: (e: React.MouseEvent<HTMLInputElement>) => any;
  maxTagCount?: number;
  maxTagPlaceholder?: React.ReactNode | ((omittedValues: SelectValue[]) => React.ReactNode);
  optionFilterProp?: string;
  labelInValue?: boolean;
  tokenSeparators?: string[];
  getInputElement?: () => React.ReactElement<any>;
  autoFocus?: boolean;
}

export interface OptionProps {
  disabled?: boolean;
  value?: string | number;
  title?: string;
  children?: React.ReactNode;
}

export interface OptGroupProps {
  label?: React.ReactNode;
}

export interface SelectLocale {
  notFoundContent?: string;
}

const SelectPropTypes = {
  prefixCls: PropTypes.string,
  className: PropTypes.string,
  size: PropTypes.oneOf(['default', 'large', 'small']),
  notFoundContent: PropTypes.any,
  showSearch: PropTypes.bool,
  optionLabelProp: PropTypes.string,
  transitionName: PropTypes.string,
  choiceTransitionName: PropTypes.string,
  id: PropTypes.string,
};

// => It is needless to export the declaration of below two inner components.
// export { Option, OptGroup };

export default class Select extends React.Component<SelectProps, {}> {
  static Option = Option as React.ClassicComponentClass<OptionProps>;
  static OptGroup = OptGroup as React.ClassicComponentClass<OptGroupProps>;

  static SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';

  static defaultProps = {
    prefixCls: 'ant-select',
    showSearch: false,
    transitionName: 'slide-up',
    choiceTransitionName: 'zoom',
  };

  static propTypes = SelectPropTypes;

  private rcSelect: any;

  constructor(props: SelectProps) {
    super(props);

    warning(
      props.mode !== 'combobox',
      'The combobox mode of Select is deprecated,' +
      'it will be removed in next major version,' +
      'please use AutoComplete instead',
    );
  }

  focus() {
    this.rcSelect.focus();
  }

  blur() {
    this.rcSelect.blur();
  }

  saveSelect = (node: any) => {
    this.rcSelect = node;
  }

  getNotFoundContent(locale: SelectLocale) {
    const { notFoundContent } = this.props;
    if (this.isCombobox()) {
      // AutoComplete don't have notFoundContent defaultly
      return notFoundContent === undefined ? null : notFoundContent;
    }
    return notFoundContent === undefined ? locale.notFoundContent : notFoundContent;
  }

  isCombobox() {
    const { mode } = this.props;
    return mode === 'combobox' || mode === Select.SECRET_COMBOBOX_MODE_DO_NOT_USE;
  }

  renderSelect = (locale: SelectLocale) => {
    const {
      prefixCls,
      className = '',
      size,
      mode,
      ...restProps
    } = this.props;
    const cls = classNames({
      [`${prefixCls}-lg`]: size === 'large',
      [`${prefixCls}-sm`]: size === 'small',
    }, className);

    let { optionLabelProp } = this.props;
    if (this.isCombobox()) {
      // children 带 dom 结构时,无法填入输入框
      optionLabelProp = optionLabelProp || 'value';
    }

    const modeConfig = {
      multiple: mode === 'multiple',
      tags: mode === 'tags',
      combobox: this.isCombobox(),
    };

    const inputIcon = (
      <Icon type="down" className={`${prefixCls}-arrow-icon`} />
    );

    const removeIcon = (
      <Icon type="close" className={`${prefixCls}-remove-icon`} />
    );

    const clearIcon = (
      <Icon type="close-circle" theme="filled" className={`${prefixCls}-clear-icon`} />
    );

    const menuItemSelectedIcon = (
      <Icon type="check" className={`${prefixCls}-selected-icon`} />
    );

    return (
      <RcSelect
        inputIcon={inputIcon}
        removeIcon={removeIcon}
        clearIcon={clearIcon}
        menuItemSelectedIcon={menuItemSelectedIcon}
        {...restProps}
        {...modeConfig}
        prefixCls={prefixCls}
        className={cls}
        optionLabelProp={optionLabelProp || 'children'}
        notFoundContent={this.getNotFoundContent(locale)}
        ref={this.saveSelect}
      />
    );
  }

  render() {
    return (
      <LocaleReceiver
        componentName="Select"
        defaultLocale={defaultLocale.Select}
      >
        {this.renderSelect}
      </LocaleReceiver>
    );
  }
}


text:
package java.util;

import static javaemul.internal.InternalPreconditions.checkArgument;
import static javaemul.internal.InternalPreconditions.checkElement;
import static javaemul.internal.InternalPreconditions.checkNotNull;
import static javaemul.internal.InternalPreconditions.checkState;

import org.jspecify.nullness.NullMarked;
import org.jspecify.nullness.Nullable;

/**
 * Skeletal implementation of the Queue interface. <a
 * href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractQueue.html">[Sun docs]</a>
 *
 * @param <E> element type.
 */
@NullMarked
public abstract class AbstractQueue<E extends @Nullable Object> extends AbstractCollection<E>
    implements Queue<E> {

  // Should not be instantiated directly.
  protected AbstractQueue() {
  }

  @Override
  public boolean add(E o) {
    checkState(offer(o), "Unable to add element to queue");
    return true;
  }

  @Override
  public boolean addAll(Collection<? extends E> c) {
    checkNotNull(c);
    checkArgument(c != this, "Can't add a queue to itself");

    return super.addAll(c);
  }

  @Override
  public void clear() {
    while (poll() != null) {
      // empty loop
    }
  }

  @Override
  public E element() {
    E e = peek();
    checkElement(e != null, "Queue is empty");
    return e;
  }

  @Override
  public E remove() {
    E e = poll();
    checkElement(e != null, "Queue is empty");
    return e;
  }

}


text:
from antlr4 import *

# This class defines a complete generic visitor for a parse tree produced by STIXPatternParser.

class STIXPatternVisitor(ParseTreeVisitor):

    # Visit a parse tree produced by STIXPatternParser#pattern.
    def visitPattern(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressions.
    def visitObservationExpressions(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionOr.
    def visitObservationExpressionOr(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionAnd.
    def visitObservationExpressionAnd(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionRepeated.
    def visitObservationExpressionRepeated(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionSimple.
    def visitObservationExpressionSimple(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionCompound.
    def visitObservationExpressionCompound(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionWithin.
    def visitObservationExpressionWithin(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#observationExpressionStartStop.
    def visitObservationExpressionStartStop(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#comparisonExpression.
    def visitComparisonExpression(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#comparisonExpressionAnd.
    def visitComparisonExpressionAnd(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestEqual.
    def visitPropTestEqual(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestOrder.
    def visitPropTestOrder(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestSet.
    def visitPropTestSet(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestLike.
    def visitPropTestLike(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestRegex.
    def visitPropTestRegex(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestIsSubset.
    def visitPropTestIsSubset(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestIsSuperset.
    def visitPropTestIsSuperset(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestParen.
    def visitPropTestParen(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#propTestExists.
    def visitPropTestExists(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#startStopQualifier.
    def visitStartStopQualifier(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#withinQualifier.
    def visitWithinQualifier(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#repeatedQualifier.
    def visitRepeatedQualifier(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#objectPath.
    def visitObjectPath(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#objectType.
    def visitObjectType(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#firstPathComponent.
    def visitFirstPathComponent(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#indexPathStep.
    def visitIndexPathStep(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#pathStep.
    def visitPathStep(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#keyPathStep.
    def visitKeyPathStep(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#setLiteral.
    def visitSetLiteral(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#primitiveLiteral.
    def visitPrimitiveLiteral(self, ctx):
        return self.visitChildren(ctx)

    # Visit a parse tree produced by STIXPatternParser#orderableLiteral.
    def visitOrderableLiteral(self, ctx):
        return self.visitChildren(ctx)


text:
"""
Sets the forecast location by providing a keyboard prompt
to the user. The name entered by the user is searched in
site list. All matches are presented as a select list to
the user. On successful selection internal addon setting
is set.
"""
import sys
from datetime import datetime, timedelta
from operator import itemgetter
from itertools import ifilter
import json
import urlcache, utilities
from utilities import gettext as _

from constants import API_KEY, ADDON_DATA_PATH, GEOIP_PROVIDER, KEYBOARD, DIALOG, ADDON, FORECAST_SITELIST_URL,\
                        OBSERVATION_SITELIST_URL, REGIONAL_SITELIST_URL, LONG_REGIONAL_NAMES, GEOLOCATION

@utilities.xbmcbusy
def getsitelist(location, text=""):
    with urlcache.URLCache(ADDON_DATA_PATH) as cache:
        url = {'ForecastLocation' : FORECAST_SITELIST_URL,
               'ObservationLocation': OBSERVATION_SITELIST_URL,
               'RegionalLocation': REGIONAL_SITELIST_URL}[location]
        filename = cache.get(url, lambda x: datetime.now()+timedelta(weeks=1))
        data = json.load(open(filename))
        sitelist = data['Locations']['Location']
        if location == 'RegionalLocation':
            #fix datapoint bug where keys start with @ in Regional Sitelist
            for site in sitelist:
                for key in site:
                    if key.startswith('@'):
                        site[key[1:]] = site.pop(key)
                #Change regional names to long versions. Untouched otherwise.
                site['name'] = LONG_REGIONAL_NAMES.get(site['name'], site['name'])
        if text:
            sitelist[:] = ifilter(lambda x: x['name'].lower().find(text.lower()) >= 0, sitelist)

        if GEOLOCATION == 'true':
            url = GEOIP_PROVIDER['url']
            filename = cache.get(url, lambda x: datetime.now()+timedelta(hours=1))
            data = json.load(open(filename))
            geoip_lat = float(data[GEOIP_PROVIDER['latitude']])
            geoip_long = float(data[GEOIP_PROVIDER['longitude']])

            for site in sitelist:
                try:
                    site['distance'] = int(utilities.haversine_distance(geoip_lat, geoip_long, float(site['latitude']), float(site['longitude'])))
                    site['display'] = "{0} ({1}km)".format(site['name'].encode('utf-8'),site['distance'])
                except KeyError:
                    site['display'] = site['name']
            try:
                sitelist = sorted(sitelist,key=itemgetter('distance'))
            except KeyError:
                sitelist = sorted(sitelist,key=itemgetter('name'))
        else:
            for site in sitelist:
                site['display'] = site['name']
            sitelist = sorted(sitelist,key=itemgetter('name'))
        return sitelist

@utilities.failgracefully
def main(location):
    if not API_KEY:
        raise Exception(_("No API Key."), _("Enter your Met Office API Key under settings."))

    KEYBOARD.doModal()#@UndefinedVariable
    text= KEYBOARD.isConfirmed() and KEYBOARD.getText()#@UndefinedVariable
    sitelist = getsitelist(location, text)
    if sitelist == []:
        DIALOG.ok(_("No Matches"), _("No locations found containing")+" {0}".format(text))#@UndefinedVariable
        utilities.log("No locations found containing '%s'" % text)
    else:
        display_list = [site['display'] for site in sitelist]
        selected = DIALOG.select(_("Matching Sites"), display_list)#@UndefinedVariable
        if selected != -1:
            ADDON.setSetting(location, sitelist[selected]['name'])#@UndefinedVariable
            ADDON.setSetting("%sID" % location, sitelist[selected]['id'])#@UndefinedVariable
            ADDON.setSetting("%sLatitude" % location, str(sitelist[selected].get('latitude')))#@UndefinedVariable
            ADDON.setSetting("%sLongitude" % location, str(sitelist[selected].get('longitude')))#@UndefinedVariable
            utilities.log("Setting '{location}' to '{name} ({distance})'".format(location=location,
                                                                         name=sitelist[selected]['name'].encode('utf-8'),
                                                                         distance=sitelist[selected]['id']))

if __name__ == '__main__':
    #check sys.argv
    main(sys.argv[1])


text:
package org.joyrest.model.request;

import java.security.Principal;
import java.util.Map;
import java.util.Optional;

import org.joyrest.model.http.HeaderName;
import org.joyrest.model.http.HttpMethod;
import org.joyrest.model.http.PathParam;

/**
 * Request's object abstraction shows which method are available in API in {@link org.joyrest.routing.RouteAction}.
 *
 * @param <E> type of a provider object
 * @see InternalRequest
 * @see ImmutableRequest
 * @author pbouda
 */
public interface Request<E> {

    /**
     * Returns authenticated user
     *
     * @return authenticated user
     **/
    Optional<Principal> getPrincipal();

    /**
     * Returns all headers in a provider object
     *
     * @return all headers
     */
    Map<HeaderName, String> getHeaders();

    /**
     * Returns a concrete header according to {@code name} value
     *
     * @param name header's name
     * @return header value in {@link Optional} object
     */
    Optional<String> getHeader(HeaderName name);

    /**
     * Returns a concrete header according to {@code name} value
     *
     * @param name header's name
     * @return header value in {@link Optional} object
     */
    Optional<String> getHeader(String name);

    /**
     * Returns all query params in a provider object
     *
     * @return all query params
     */
    Map<String, String[]> getQueryParams();

    /**
     * Returns a concrete query param array according to {@code name} value
     *
     * @param name query's param name
     * @return query param value in {@link Optional} object
     */
    Optional<String[]> getQueryParams(String name);

    /**
     * Returns a concrete query param according to {@code name} value
     *
     * @param name query's param name
     * @return query param value in {@link Optional} object
     */
    Optional<String> getQueryParam(String name);

    /**
     * Returns all path params in a provider object
     *
     * @return all path params
     */
    Map<String, PathParam> getPathParams();

    /**
     * Returns a concrete path param according to {@code name} value
     *
     * @param name path's param name
     * @return path param value
     */
    String getPathParam(String name);

    /**
     * Returns an http method value
     *
     * @return http method
     */
    HttpMethod getMethod();

    /**
     * Returns a provider's path value
     *
     * @return path value
     */
    String getPath();

    /**
     * Returns an incoming entity
     *
     * @return entity
     */
    E getEntity();

}


text:
addpath('../');
addpath('../util/');

date = datetime();

train = importTVBData(strcat(pwd(), '/data/2016-07-11_12-12_TimeSeriesRegion.h5'));
test = importTVBData(strcat(pwd(), '/data/2016-07-11_12-13_TimeSeriesRegion.h5'));

[r2, weights, residuals, lamda, likelihood] = duchessFit(train, test);

dlmwrite(strcat('temp/', datestr(datetime(), 'mm-dd-yy_HHMMSS'), '.r2'), r2)
dlmwrite(strcat('temp/', datestr(datetime(), 'mm-dd-yy_HHMMSS'), '.weights'), weights)
dlmwrite(strcat('temp/', datestr(datetime(), 'mm-dd-yy_HHMMSS'), '.residuals'), residuals)
dlmwrite(strcat('temp/', datestr(datetime(), 'mm-dd-yy_HHMMSS'), '.lamda'), lamda)
dlmwrite(strcat('temp/', datestr(datetime(), 'mm-dd-yy_HHMMSS'), '.likelihood'), likelihood)


text:
<?php

namespace Symfony\Component\Form\Tests\Extension\Csrf\CsrfProvider;

use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider;

class SessionCsrfProviderTest extends \PHPUnit_Framework_TestCase
{
    protected $provider;
    protected $session;

    protected function setUp()
    {
        $this->session = $this->getMock(
            'Symfony\Component\HttpFoundation\Session\Session',
            array(),
            array(),
            '',
            false // don't call constructor
        );
        $this->provider = new SessionCsrfProvider($this->session, 'SECRET');
    }

    protected function tearDown()
    {
        $this->provider = null;
        $this->session = null;
    }

    public function testGenerateCsrfToken()
    {
        $this->session->expects($this->once())
                ->method('getId')
                ->will($this->returnValue('ABCDEF'));

        $token = $this->provider->generateCsrfToken('foo');

        $this->assertEquals(sha1('SECRET'.'foo'.'ABCDEF'), $token);
    }

    public function testIsCsrfTokenValidSucceeds()
    {
        $this->session->expects($this->once())
                ->method('getId')
                ->will($this->returnValue('ABCDEF'));

        $token = sha1('SECRET'.'foo'.'ABCDEF');

        $this->assertTrue($this->provider->isCsrfTokenValid('foo', $token));
    }

    public function testIsCsrfTokenValidFails()
    {
        $this->session->expects($this->once())
                ->method('getId')
                ->will($this->returnValue('ABCDEF'));

        $token = sha1('SECRET'.'bar'.'ABCDEF');

        $this->assertFalse($this->provider->isCsrfTokenValid('foo', $token));
    }
}


text:
package com.b2international.snowowl.snomed.datastore.request;

import javax.annotation.OverridingMethodsMustInvokeSuper;

import com.b2international.snowowl.snomed.core.domain.InactivationProperties;

/**
 * @since 4.5
 */
public abstract class BaseSnomedComponentUpdateRequestBuilder<B extends BaseSnomedComponentUpdateRequestBuilder<B, R>, R extends SnomedComponentUpdateRequest>
		extends SnomedComponentUpdateRequestBuilderBase<B, R> {

	private InactivationProperties inactivationProperties;
	private String moduleId;
	private Boolean active;
	private String effectiveTime;

	protected BaseSnomedComponentUpdateRequestBuilder(String componentId) {
		super(componentId);
	}

	public final B setActive(Boolean active) {
		this.active = active;
		return getSelf();
	}

	public final B setModuleId(String moduleId) {
		this.moduleId = moduleId;
		return getSelf();
	}

	public final B setEffectiveTime(String effectiveTime) {
		this.effectiveTime = effectiveTime;
		return getSelf();
	}

	public final B setInactivationProperties(InactivationProperties inactivationProperties) {
		this.inactivationProperties = inactivationProperties;
		return getSelf();
	}

	@OverridingMethodsMustInvokeSuper
	@Override
	protected void init(R req) {
		super.init(req);
		req.setActive(active);
		req.setModuleId(moduleId);
		req.setInactivationProperties(inactivationProperties);
		req.setEffectiveTime(effectiveTime);
	}

}


text:
:title: Port Command
:description: Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
:keywords: port, docker, container, documentation

=========================================================================
``port`` -- Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
=========================================================================

::

    Usage: docker port [OPTIONS] CONTAINER PRIVATE_PORT

    Lookup the public-facing port which is NAT-ed to PRIVATE_PORT


text:
require 'treetop'

Treetop.load File.join(File.dirname(__FILE__), '..', '..', 'lib', 'TDL')

parser = TDLParser.new

describe TDLParser do
  describe "#parse" do
    specify { parser.parse('test').should be     }

    specify { parser.parse('t1st').should be     }
    specify { parser.parse('t11t').should be     }
    specify { parser.parse('tes1').should be     }
    specify { parser.parse('te11').should be     }
    specify { parser.parse('1est').should_not be }

    specify { parser.parse('t_st').should be     }
    specify { parser.parse('t__t').should be     }
    specify { parser.parse('tes_').should be     }
    specify { parser.parse('te__').should be     }
    specify { parser.parse('t_s_').should be     }
    specify { parser.parse('_est').should_not be }

    specify { parser.parse('t_1t').should be     }
    specify { parser.parse('t1_t').should be     }
    specify { parser.parse('t1__').should be     }
    specify { parser.parse('t__1').should be     }
    specify { parser.parse('t_1_').should be     }

    specify { parser.parse('test?').should be    }
    specify { parser.parse('tes_?').should be    }
    specify { parser.parse('te1_?').should be    }
    specify { parser.parse('te_1?').should be    }
    specify { parser.parse('?test').should_not be }
    specify { parser.parse('te?st').should_not be }

    specify { parser.parse('test!').should_not be }
    specify { parser.parse('te!st').should_not be }

    specify { parser.parse('a' ).should be }
    specify { parser.parse('A' ).should be }
    specify { parser.parse('Ab').should be }
    specify { parser.parse('aB').should be }
  end
end


text:
Watson-Cache
============

A collection of cache storage mechanisms that act like a dict.

Currently supporting:

-   Memory
-   File
-   Memcache

Also contains a decorator that can be used within the `watson-framework`
package.

For full documentation please see [Read The
Docs](http://watson-cache.readthedocs.org/).

Build Status
------------

[![Build
Status](https://img.shields.io/travis/watsonpy/watson-cache.svg?maxAge=2592000)](https://travis-ci.org/watsonpy/watson-cache)
[![Coverage
Status](https://img.shields.io/coveralls/watsonpy/watson-cache.svg?maxAge=2592000)](https://coveralls.io/r/watsonpy/watson-cache)
[![Version](https://img.shields.io/pypi/v/watson-cache.svg?maxAge=2592000)](https://pypi.python.org/pypi/watson-cache/)

### Installation

`pip install watson-cache`

### Dependencies

-   watson-common
-   watson-di (for test coverage, and decorator usage)
-   python3-memcached

### Todo

-   Add SqlAlchemy based storage
-   Add Redis based storage


text:
/* global describe, expect, test */

const Reader = require('../../src/reader');
const Maybe = require('../../src/maybe');

const ReaderT = Reader.T(Maybe);

describe('ReaderT', () => {
  describe('ReaderT.map', () => {
    test('it should apply a regular function and return a new ReaderT with the result', () => {
      const reader = ReaderT.of('foo');
      const toBaz = () => 'baz';

      expect(ReaderT.map(toBaz, reader).run('bar').value).toBe('baz');
    });
  });

  describe('ReaderT#map', () => {
    test('it should apply a regular function and return a new ReaderT with the result', () => {
      const reader = ReaderT.of('foo');
      const toBaz = () => 'baz';

      expect(reader.map(toBaz).run('bar').value).toBe('baz');
    });
  });
});


text:
<xml>

	<include name="${HXCPP}/build-tool/BuildCommon.xml"/>

	<files id="src">

		<compilerflag value="-Iinclude"/>

		<include name="${haxelib:duell_duellbuildios}/native/native.xml" />

		<file name="src/Logger.mm"/>

	</files>

	<target id="NDLL" output="${LIBPREFIX}loggerios${DBG}${LIBEXTRA}" tool="linker" toolid="${STD_MODULE_LINK}">

		<outdir name="../ndll/${BINDIR}"/>
		<files id="src"/>

	</target>

	<target id="default">

		<target id="NDLL"/>

	</target>

</xml>


text:
peanoclaw::records::VertexDescription::PersistentRecords::PersistentRecords() {

}

peanoclaw::records::VertexDescription::PersistentRecords::PersistentRecords(const tarch::la::Vector<TWO_POWER_D,int>& indicesOfAdjacentCellDescriptions, const bool& touched):
_indicesOfAdjacentCellDescriptions(indicesOfAdjacentCellDescriptions),
_touched(touched) {

}

peanoclaw::records::VertexDescription::VertexDescription() {

}

peanoclaw::records::VertexDescription::VertexDescription(const PersistentRecords& persistentRecords):
_persistentRecords(persistentRecords._indicesOfAdjacentCellDescriptions, persistentRecords._touched) {

}

peanoclaw::records::VertexDescription::VertexDescription(const tarch::la::Vector<TWO_POWER_D,int>& indicesOfAdjacentCellDescriptions, const bool& touched):
_persistentRecords(indicesOfAdjacentCellDescriptions, touched) {

}

peanoclaw::records::VertexDescription::~VertexDescription() { }

std::string peanoclaw::records::VertexDescription::toString(const IterationParity& param) {
   switch (param) {
      case EVEN: return "EVEN";
      case ODD: return "ODD";
   }
   return "undefined";
}

std::string peanoclaw::records::VertexDescription::getIterationParityMapping() {
   return "IterationParity(EVEN=0,ODD=1)";
}

std::string peanoclaw::records::VertexDescription::toString() const {
   std::ostringstream stringstr;
   toString(stringstr);
   return stringstr.str();
}

void peanoclaw::records::VertexDescription::toString (std::ostream& out) const {
   out << "(";
   out << "indicesOfAdjacentCellDescriptions:[";
   for (int i = 0; i < TWO_POWER_D-1; i++) {
      out << getIndicesOfAdjacentCellDescriptions(i) << ",";
   }
   out << getIndicesOfAdjacentCellDescriptions(TWO_POWER_D-1) << "]";
   out << ",";
   out << "touched:" << getTouched();
   out <<  ")";
}

peanoclaw::records::VertexDescription::PersistentRecords peanoclaw::records::VertexDescription::getPersistentRecords() const {
   return _persistentRecords;
}

peanoclaw::records::VertexDescriptionPacked peanoclaw::records::VertexDescription::convert() const{
   return VertexDescriptionPacked(
      getIndicesOfAdjacentCellDescriptions(),
      getTouched()
   );
}

#ifdef Parallel
   tarch::logging::Log peanoclaw::records::VertexDescription::_log( "peanoclaw::records::VertexDescription" );

   MPI_Datatype peanoclaw::records::VertexDescription::Datatype = 0;
   MPI_Datatype peanoclaw::records::VertexDescription::FullDatatype = 0;

   void peanoclaw::records::VertexDescription::initDatatype() {
      {
         VertexDescription dummyVertexDescription[2];

         const int Attributes = 3;
         MPI_Datatype subtypes[Attributes] = {
            MPI_INT,		 //indicesOfAdjacentCellDescriptions
            MPI_CHAR,		 //touched
            MPI_UB		 // end/displacement flag
         };

         int blocklen[Attributes] = {
            TWO_POWER_D,		 //indicesOfAdjacentCellDescriptions
            1,		 //touched
            1		 // end/displacement flag
         };

         MPI_Aint     disp[Attributes];

         MPI_Aint base;
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescription[0]))), &base);
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescription[0]._persistentRecords._indicesOfAdjacentCellDescriptions[0]))), 		&disp[0] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescription[0]._persistentRecords._touched))), 		&disp[1] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyVertexDescription[1]._persistentRecords._indicesOfAdjacentCellDescriptions[0])), 		&disp[2] );

         for (int i=1; i<Attributes; i++) {
            assertion1( disp[i] > disp[i-1], i );
         }
         for (int i=0; i<Attributes; i++) {
            disp[i] -= base;
         }
         MPI_Type_struct( Attributes, blocklen, disp, subtypes, &VertexDescription::Datatype );
         MPI_Type_commit( &VertexDescription::Datatype );

      }
      {
         VertexDescription dummyVertexDescription[2];

         const int Attributes = 3;
         MPI_Datatype subtypes[Attributes] = {
            MPI_INT,		 //indicesOfAdjacentCellDescriptions
            MPI_CHAR,		 //touched
            MPI_UB		 // end/displacement flag
         };

         int blocklen[Attributes] = {
            TWO_POWER_D,		 //indicesOfAdjacentCellDescriptions
            1,		 //touched
            1		 // end/displacement flag
         };

         MPI_Aint     disp[Attributes];

         MPI_Aint base;
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescription[0]))), &base);
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescription[0]._persistentRecords._indicesOfAdjacentCellDescriptions[0]))), 		&disp[0] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescription[0]._persistentRecords._touched))), 		&disp[1] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyVertexDescription[1]._persistentRecords._indicesOfAdjacentCellDescriptions[0])), 		&disp[2] );

         for (int i=1; i<Attributes; i++) {
            assertion1( disp[i] > disp[i-1], i );
         }
         for (int i=0; i<Attributes; i++) {
            disp[i] -= base;
         }
         MPI_Type_struct( Attributes, blocklen, disp, subtypes, &VertexDescription::FullDatatype );
         MPI_Type_commit( &VertexDescription::FullDatatype );

      }

   }

   void peanoclaw::records::VertexDescription::shutdownDatatype() {
      MPI_Type_free( &VertexDescription::Datatype );
      MPI_Type_free( &VertexDescription::FullDatatype );

   }

   void peanoclaw::records::VertexDescription::send(int destination, int tag, bool exchangeOnlyAttributesMarkedWithParallelise, int communicateSleep) {
      if (communicateSleep<0) {

         const int result = MPI_Send(this, 1, exchangeOnlyAttributesMarkedWithParallelise ? Datatype : FullDatatype, destination, tag, tarch::parallel::Node::getInstance().getCommunicator());
         if  (result!=MPI_SUCCESS) {
            std::ostringstream msg;
            msg << "was not able to send message peanoclaw::records::VertexDescription "
            << toString()
            << " to node " << destination
            << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "send(int)",msg.str() );
         }

      }
      else {

         MPI_Request* sendRequestHandle = new MPI_Request();
         MPI_Status   status;
         int          flag = 0;
         int          result;

         clock_t      timeOutWarning   = -1;
         clock_t      timeOutShutdown  = -1;
         bool         triggeredTimeoutWarning = false;

         if (exchangeOnlyAttributesMarkedWithParallelise) {
            result = MPI_Isend(
               this, 1, Datatype, destination,
               tag, tarch::parallel::Node::getInstance().getCommunicator(),
               sendRequestHandle
            );

         }
         else {
            result = MPI_Isend(
               this, 1, FullDatatype, destination,
               tag, tarch::parallel::Node::getInstance().getCommunicator(),
               sendRequestHandle
            );

         }
         if  (result!=MPI_SUCCESS) {
            std::ostringstream msg;
            msg << "was not able to send message peanoclaw::records::VertexDescription "
            << toString()
            << " to node " << destination
            << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "send(int)",msg.str() );
         }
         result = MPI_Test( sendRequestHandle, &flag, &status );
         while (!flag) {
            if (timeOutWarning==-1)   timeOutWarning   = tarch::parallel::Node::getInstance().getDeadlockWarningTimeStamp();
            if (timeOutShutdown==-1)  timeOutShutdown  = tarch::parallel::Node::getInstance().getDeadlockTimeOutTimeStamp();
            result = MPI_Test( sendRequestHandle, &flag, &status );
            if (result!=MPI_SUCCESS) {
               std::ostringstream msg;
               msg << "testing for finished send task for peanoclaw::records::VertexDescription "
               << toString()
               << " sent to node " << destination
               << " failed: " << tarch::parallel::MPIReturnValueToString(result);
               _log.error("send(int)", msg.str() );
            }

            // deadlock aspect
            if (
               tarch::parallel::Node::getInstance().isTimeOutWarningEnabled() &&
               (clock()>timeOutWarning) &&
               (!triggeredTimeoutWarning)
            ) {
               tarch::parallel::Node::getInstance().writeTimeOutWarning(
               "peanoclaw::records::VertexDescription",
               "send(int)", destination,tag,1
               );
               triggeredTimeoutWarning = true;
            }
            if (
               tarch::parallel::Node::getInstance().isTimeOutDeadlockEnabled() &&
               (clock()>timeOutShutdown)
            ) {
               tarch::parallel::Node::getInstance().triggerDeadlockTimeOut(
               "peanoclaw::records::VertexDescription",
               "send(int)", destination,tag,1
               );
            }
            tarch::parallel::Node::getInstance().receiveDanglingMessages();
            usleep(communicateSleep);

         }

         delete sendRequestHandle;
         #ifdef Debug
         _log.debug("send(int,int)", "sent " + toString() );
         #endif

      }

   }

   void peanoclaw::records::VertexDescription::receive(int source, int tag, bool exchangeOnlyAttributesMarkedWithParallelise, int communicateSleep) {
      if (communicateSleep<0) {

         MPI_Status  status;
         const int   result = MPI_Recv(this, 1, exchangeOnlyAttributesMarkedWithParallelise ? Datatype : FullDatatype, source, tag, tarch::parallel::Node::getInstance().getCommunicator(), &status);
         if ( result != MPI_SUCCESS ) {
            std::ostringstream msg;
            msg << "failed to start to receive peanoclaw::records::VertexDescription from node "
            << source << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "receive(int)", msg.str() );
         }

      }
      else {

         MPI_Request* sendRequestHandle = new MPI_Request();
         MPI_Status   status;
         int          flag = 0;
         int          result;

         clock_t      timeOutWarning   = -1;
         clock_t      timeOutShutdown  = -1;
         bool         triggeredTimeoutWarning = false;

         if (exchangeOnlyAttributesMarkedWithParallelise) {
            result = MPI_Irecv(
               this, 1, Datatype, source, tag,
               tarch::parallel::Node::getInstance().getCommunicator(), sendRequestHandle
            );

         }
         else {
            result = MPI_Irecv(
               this, 1, FullDatatype, source, tag,
               tarch::parallel::Node::getInstance().getCommunicator(), sendRequestHandle
            );

         }
         if ( result != MPI_SUCCESS ) {
            std::ostringstream msg;
            msg << "failed to start to receive peanoclaw::records::VertexDescription from node "
            << source << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "receive(int)", msg.str() );
         }

         result = MPI_Test( sendRequestHandle, &flag, &status );
         while (!flag) {
            if (timeOutWarning==-1)   timeOutWarning   = tarch::parallel::Node::getInstance().getDeadlockWarningTimeStamp();
            if (timeOutShutdown==-1)  timeOutShutdown  = tarch::parallel::Node::getInstance().getDeadlockTimeOutTimeStamp();
            result = MPI_Test( sendRequestHandle, &flag, &status );
            if (result!=MPI_SUCCESS) {
               std::ostringstream msg;
               msg << "testing for finished receive task for peanoclaw::records::VertexDescription failed: "
               << tarch::parallel::MPIReturnValueToString(result);
               _log.error("receive(int)", msg.str() );
            }

            // deadlock aspect
            if (
               tarch::parallel::Node::getInstance().isTimeOutWarningEnabled() &&
               (clock()>timeOutWarning) &&
               (!triggeredTimeoutWarning)
            ) {
               tarch::parallel::Node::getInstance().writeTimeOutWarning(
               "peanoclaw::records::VertexDescription",
               "receive(int)", source,tag,1
               );
               triggeredTimeoutWarning = true;
            }
            if (
               tarch::parallel::Node::getInstance().isTimeOutDeadlockEnabled() &&
               (clock()>timeOutShutdown)
            ) {
               tarch::parallel::Node::getInstance().triggerDeadlockTimeOut(
               "peanoclaw::records::VertexDescription",
               "receive(int)", source,tag,1
               );
            }
            tarch::parallel::Node::getInstance().receiveDanglingMessages();
            usleep(communicateSleep);

         }

         delete sendRequestHandle;

         #ifdef Debug
         _log.debug("receive(int,int)", "received " + toString() );
         #endif

      }

   }

   bool peanoclaw::records::VertexDescription::isMessageInQueue(int tag, bool exchangeOnlyAttributesMarkedWithParallelise) {
      MPI_Status status;
      int  flag        = 0;
      MPI_Iprobe(
         MPI_ANY_SOURCE, tag,
         tarch::parallel::Node::getInstance().getCommunicator(), &flag, &status
      );
      if (flag) {
         int  messageCounter;
         if (exchangeOnlyAttributesMarkedWithParallelise) {
            MPI_Get_count(&status, Datatype, &messageCounter);
         }
         else {
            MPI_Get_count(&status, FullDatatype, &messageCounter);
         }
         return messageCounter > 0;
      }
      else return false;

   }

#endif

peanoclaw::records::VertexDescriptionPacked::PersistentRecords::PersistentRecords() {

}

peanoclaw::records::VertexDescriptionPacked::PersistentRecords::PersistentRecords(const tarch::la::Vector<TWO_POWER_D,int>& indicesOfAdjacentCellDescriptions, const bool& touched):
_indicesOfAdjacentCellDescriptions(indicesOfAdjacentCellDescriptions),
_touched(touched) {

}

peanoclaw::records::VertexDescriptionPacked::VertexDescriptionPacked() {

}

peanoclaw::records::VertexDescriptionPacked::VertexDescriptionPacked(const PersistentRecords& persistentRecords):
_persistentRecords(persistentRecords._indicesOfAdjacentCellDescriptions, persistentRecords._touched) {

}

peanoclaw::records::VertexDescriptionPacked::VertexDescriptionPacked(const tarch::la::Vector<TWO_POWER_D,int>& indicesOfAdjacentCellDescriptions, const bool& touched):
_persistentRecords(indicesOfAdjacentCellDescriptions, touched) {

}

peanoclaw::records::VertexDescriptionPacked::~VertexDescriptionPacked() { }

std::string peanoclaw::records::VertexDescriptionPacked::toString(const IterationParity& param) {
   return peanoclaw::records::VertexDescription::toString(param);
}

std::string peanoclaw::records::VertexDescriptionPacked::getIterationParityMapping() {
   return peanoclaw::records::VertexDescription::getIterationParityMapping();
}

std::string peanoclaw::records::VertexDescriptionPacked::toString() const {
   std::ostringstream stringstr;
   toString(stringstr);
   return stringstr.str();
}

void peanoclaw::records::VertexDescriptionPacked::toString (std::ostream& out) const {
   out << "(";
   out << "indicesOfAdjacentCellDescriptions:[";
   for (int i = 0; i < TWO_POWER_D-1; i++) {
      out << getIndicesOfAdjacentCellDescriptions(i) << ",";
   }
   out << getIndicesOfAdjacentCellDescriptions(TWO_POWER_D-1) << "]";
   out << ",";
   out << "touched:" << getTouched();
   out <<  ")";
}

peanoclaw::records::VertexDescriptionPacked::PersistentRecords peanoclaw::records::VertexDescriptionPacked::getPersistentRecords() const {
   return _persistentRecords;
}

peanoclaw::records::VertexDescription peanoclaw::records::VertexDescriptionPacked::convert() const{
   return VertexDescription(
      getIndicesOfAdjacentCellDescriptions(),
      getTouched()
   );
}

#ifdef Parallel
   tarch::logging::Log peanoclaw::records::VertexDescriptionPacked::_log( "peanoclaw::records::VertexDescriptionPacked" );

   MPI_Datatype peanoclaw::records::VertexDescriptionPacked::Datatype = 0;
   MPI_Datatype peanoclaw::records::VertexDescriptionPacked::FullDatatype = 0;

   void peanoclaw::records::VertexDescriptionPacked::initDatatype() {
      {
         VertexDescriptionPacked dummyVertexDescriptionPacked[2];

         const int Attributes = 3;
         MPI_Datatype subtypes[Attributes] = {
            MPI_INT,		 //indicesOfAdjacentCellDescriptions
            MPI_CHAR,		 //touched
            MPI_UB		 // end/displacement flag
         };

         int blocklen[Attributes] = {
            TWO_POWER_D,		 //indicesOfAdjacentCellDescriptions
            1,		 //touched
            1		 // end/displacement flag
         };

         MPI_Aint     disp[Attributes];

         MPI_Aint base;
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescriptionPacked[0]))), &base);
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescriptionPacked[0]._persistentRecords._indicesOfAdjacentCellDescriptions[0]))), 		&disp[0] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescriptionPacked[0]._persistentRecords._touched))), 		&disp[1] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyVertexDescriptionPacked[1]._persistentRecords._indicesOfAdjacentCellDescriptions[0])), 		&disp[2] );

         for (int i=1; i<Attributes; i++) {
            assertion1( disp[i] > disp[i-1], i );
         }
         for (int i=0; i<Attributes; i++) {
            disp[i] -= base;
         }
         MPI_Type_struct( Attributes, blocklen, disp, subtypes, &VertexDescriptionPacked::Datatype );
         MPI_Type_commit( &VertexDescriptionPacked::Datatype );

      }
      {
         VertexDescriptionPacked dummyVertexDescriptionPacked[2];

         const int Attributes = 3;
         MPI_Datatype subtypes[Attributes] = {
            MPI_INT,		 //indicesOfAdjacentCellDescriptions
            MPI_CHAR,		 //touched
            MPI_UB		 // end/displacement flag
         };

         int blocklen[Attributes] = {
            TWO_POWER_D,		 //indicesOfAdjacentCellDescriptions
            1,		 //touched
            1		 // end/displacement flag
         };

         MPI_Aint     disp[Attributes];

         MPI_Aint base;
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescriptionPacked[0]))), &base);
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescriptionPacked[0]._persistentRecords._indicesOfAdjacentCellDescriptions[0]))), 		&disp[0] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyVertexDescriptionPacked[0]._persistentRecords._touched))), 		&disp[1] );
         MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyVertexDescriptionPacked[1]._persistentRecords._indicesOfAdjacentCellDescriptions[0])), 		&disp[2] );

         for (int i=1; i<Attributes; i++) {
            assertion1( disp[i] > disp[i-1], i );
         }
         for (int i=0; i<Attributes; i++) {
            disp[i] -= base;
         }
         MPI_Type_struct( Attributes, blocklen, disp, subtypes, &VertexDescriptionPacked::FullDatatype );
         MPI_Type_commit( &VertexDescriptionPacked::FullDatatype );

      }

   }

   void peanoclaw::records::VertexDescriptionPacked::shutdownDatatype() {
      MPI_Type_free( &VertexDescriptionPacked::Datatype );
      MPI_Type_free( &VertexDescriptionPacked::FullDatatype );

   }

   void peanoclaw::records::VertexDescriptionPacked::send(int destination, int tag, bool exchangeOnlyAttributesMarkedWithParallelise, int communicateSleep) {
      if (communicateSleep<0) {

         const int result = MPI_Send(this, 1, exchangeOnlyAttributesMarkedWithParallelise ? Datatype : FullDatatype, destination, tag, tarch::parallel::Node::getInstance().getCommunicator());
         if  (result!=MPI_SUCCESS) {
            std::ostringstream msg;
            msg << "was not able to send message peanoclaw::records::VertexDescriptionPacked "
            << toString()
            << " to node " << destination
            << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "send(int)",msg.str() );
         }

      }
      else {

         MPI_Request* sendRequestHandle = new MPI_Request();
         MPI_Status   status;
         int          flag = 0;
         int          result;

         clock_t      timeOutWarning   = -1;
         clock_t      timeOutShutdown  = -1;
         bool         triggeredTimeoutWarning = false;

         if (exchangeOnlyAttributesMarkedWithParallelise) {
            result = MPI_Isend(
               this, 1, Datatype, destination,
               tag, tarch::parallel::Node::getInstance().getCommunicator(),
               sendRequestHandle
            );

         }
         else {
            result = MPI_Isend(
               this, 1, FullDatatype, destination,
               tag, tarch::parallel::Node::getInstance().getCommunicator(),
               sendRequestHandle
            );

         }
         if  (result!=MPI_SUCCESS) {
            std::ostringstream msg;
            msg << "was not able to send message peanoclaw::records::VertexDescriptionPacked "
            << toString()
            << " to node " << destination
            << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "send(int)",msg.str() );
         }
         result = MPI_Test( sendRequestHandle, &flag, &status );
         while (!flag) {
            if (timeOutWarning==-1)   timeOutWarning   = tarch::parallel::Node::getInstance().getDeadlockWarningTimeStamp();
            if (timeOutShutdown==-1)  timeOutShutdown  = tarch::parallel::Node::getInstance().getDeadlockTimeOutTimeStamp();
            result = MPI_Test( sendRequestHandle, &flag, &status );
            if (result!=MPI_SUCCESS) {
               std::ostringstream msg;
               msg << "testing for finished send task for peanoclaw::records::VertexDescriptionPacked "
               << toString()
               << " sent to node " << destination
               << " failed: " << tarch::parallel::MPIReturnValueToString(result);
               _log.error("send(int)", msg.str() );
            }

            // deadlock aspect
            if (
               tarch::parallel::Node::getInstance().isTimeOutWarningEnabled() &&
               (clock()>timeOutWarning) &&
               (!triggeredTimeoutWarning)
            ) {
               tarch::parallel::Node::getInstance().writeTimeOutWarning(
               "peanoclaw::records::VertexDescriptionPacked",
               "send(int)", destination,tag,1
               );
               triggeredTimeoutWarning = true;
            }
            if (
               tarch::parallel::Node::getInstance().isTimeOutDeadlockEnabled() &&
               (clock()>timeOutShutdown)
            ) {
               tarch::parallel::Node::getInstance().triggerDeadlockTimeOut(
               "peanoclaw::records::VertexDescriptionPacked",
               "send(int)", destination,tag,1
               );
            }
            tarch::parallel::Node::getInstance().receiveDanglingMessages();
            usleep(communicateSleep);

         }

         delete sendRequestHandle;
         #ifdef Debug
         _log.debug("send(int,int)", "sent " + toString() );
         #endif

      }

   }

   void peanoclaw::records::VertexDescriptionPacked::receive(int source, int tag, bool exchangeOnlyAttributesMarkedWithParallelise, int communicateSleep) {
      if (communicateSleep<0) {

         MPI_Status  status;
         const int   result = MPI_Recv(this, 1, exchangeOnlyAttributesMarkedWithParallelise ? Datatype : FullDatatype, source, tag, tarch::parallel::Node::getInstance().getCommunicator(), &status);
         if ( result != MPI_SUCCESS ) {
            std::ostringstream msg;
            msg << "failed to start to receive peanoclaw::records::VertexDescriptionPacked from node "
            << source << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "receive(int)", msg.str() );
         }

      }
      else {

         MPI_Request* sendRequestHandle = new MPI_Request();
         MPI_Status   status;
         int          flag = 0;
         int          result;

         clock_t      timeOutWarning   = -1;
         clock_t      timeOutShutdown  = -1;
         bool         triggeredTimeoutWarning = false;

         if (exchangeOnlyAttributesMarkedWithParallelise) {
            result = MPI_Irecv(
               this, 1, Datatype, source, tag,
               tarch::parallel::Node::getInstance().getCommunicator(), sendRequestHandle
            );

         }
         else {
            result = MPI_Irecv(
               this, 1, FullDatatype, source, tag,
               tarch::parallel::Node::getInstance().getCommunicator(), sendRequestHandle
            );

         }
         if ( result != MPI_SUCCESS ) {
            std::ostringstream msg;
            msg << "failed to start to receive peanoclaw::records::VertexDescriptionPacked from node "
            << source << ": " << tarch::parallel::MPIReturnValueToString(result);
            _log.error( "receive(int)", msg.str() );
         }

         result = MPI_Test( sendRequestHandle, &flag, &status );
         while (!flag) {
            if (timeOutWarning==-1)   timeOutWarning   = tarch::parallel::Node::getInstance().getDeadlockWarningTimeStamp();
            if (timeOutShutdown==-1)  timeOutShutdown  = tarch::parallel::Node::getInstance().getDeadlockTimeOutTimeStamp();
            result = MPI_Test( sendRequestHandle, &flag, &status );
            if (result!=MPI_SUCCESS) {
               std::ostringstream msg;
               msg << "testing for finished receive task for peanoclaw::records::VertexDescriptionPacked failed: "
               << tarch::parallel::MPIReturnValueToString(result);
               _log.error("receive(int)", msg.str() );
            }

            // deadlock aspect
            if (
               tarch::parallel::Node::getInstance().isTimeOutWarningEnabled() &&
               (clock()>timeOutWarning) &&
               (!triggeredTimeoutWarning)
            ) {
               tarch::parallel::Node::getInstance().writeTimeOutWarning(
               "peanoclaw::records::VertexDescriptionPacked",
               "receive(int)", source,tag,1
               );
               triggeredTimeoutWarning = true;
            }
            if (
               tarch::parallel::Node::getInstance().isTimeOutDeadlockEnabled() &&
               (clock()>timeOutShutdown)
            ) {
               tarch::parallel::Node::getInstance().triggerDeadlockTimeOut(
               "peanoclaw::records::VertexDescriptionPacked",
               "receive(int)", source,tag,1
               );
            }
            tarch::parallel::Node::getInstance().receiveDanglingMessages();
            usleep(communicateSleep);

         }

         delete sendRequestHandle;

         #ifdef Debug
         _log.debug("receive(int,int)", "received " + toString() );
         #endif

      }

   }

   bool peanoclaw::records::VertexDescriptionPacked::isMessageInQueue(int tag, bool exchangeOnlyAttributesMarkedWithParallelise) {
      MPI_Status status;
      int  flag        = 0;
      MPI_Iprobe(
         MPI_ANY_SOURCE, tag,
         tarch::parallel::Node::getInstance().getCommunicator(), &flag, &status
      );
      if (flag) {
         int  messageCounter;
         if (exchangeOnlyAttributesMarkedWithParallelise) {
            MPI_Get_count(&status, Datatype, &messageCounter);
         }
         else {
            MPI_Get_count(&status, FullDatatype, &messageCounter);
         }
         return messageCounter > 0;
      }
      else return false;

   }

#endif