text:
[![Build Status](https://travis-ci.org/rust-leipzig/regex-performance.svg?branch=master)](https://travis-ci.org/rust-leipzig/regex-performance)

## Introduction
Regular expressions are commonly used in pattern search algorithms.
This tool is based on the work of John Maddock (See his own regex comparison [here](http://www.boost.org/doc/libs/1_41_0/libs/regex/doc/gcc-performance.html))
and the sljit project (See their regex comparison [here](http://sljit.sourceforge.net/regex_perf.html)).

## Requirements
| dependency | version  |
|------------|----------|
| Cmake      | >=3.0    |
| Ragel      | 6.9      |
| Python     | >=3.0    |
| Boost (*2)  | >=1.57   |
| Pcap       | >=0.8    |
| Autoconf   | 2.69 (*) |
| Automake   | 1.15 (*) |
| Autopoint  | 0.19.7 (*)|
| Gettext    | 0.19.7 (*)|
| Libtool    | 2.4.6 (*)|
| Git        | 2.11.0 (*)|

(*) Tested with named version only. Older versions may work too.
(*2) Needs boost-regex to be installed as a component

## Supported engines
The following regex engines are supported and covered by the tool:
- [CTRE](https://github.com/hanickadot/compile-time-regular-expressions)
- [Hyperscan](https://github.com/01org/hyperscan)
- [Oniguruma](https://github.com/kkos/oniguruma)
- [RE2](https://github.com/google/re2)
- [Tre](https://github.com/laurikari/tre)
- [PCRE2](http://www.pcre.org)
- [Rust regex crate](https://doc.rust-lang.org/regex/regex/index.html)
- [Regress regex crate](https://docs.rs/regress/)
- [Boost regex](https://www.boost.org/doc/libs/1_78_0/libs/regex/doc/html/index.html)
- [C++ Standard regex](https://en.cppreference.com/w/cpp/regex)
- [YARA](https://github.com/VirusTotal/yara)

The engines are built from their sources. In the case an installed engine should be used,
the corresponding cmake variable `INCLUDE_<name>` has to be set to `system`. The configuration script
tries to locate the library and uses the library for linking the benchmark.
The same variable can be set to `disabled` to exclude an engine.

The configuration script distinguishes between nightly and other Rust toolchains to enable the SIMD-feature
which is currently available in the nightly built only. The SIMD-feature improves the throughput of the
regex crate for defined expressions.

## Building the tool
The different engines have different requirements which are not described here.
Please see the related project documentations.

In the case all depencies are fulfilled, just configure and build the cmake based project:

```bash
mkdir build && cd build
cmake ..
make
```

The `make` command will build all engines and the test tool `regex_perf`.

To build the test tool or a library only, call `make` with corresponding target, i.e.:

```bash
make regex_perf
```

## Usage
The test tool calls each engine with a defined set of different regular expression on a given file.
The repository contains a ~16Mbyte large text file (3200.txt) which can be used for measuring.

```bash
./src/regex_perf -f ./3200.txt
```

By default, the tool repeats each test 5 times and prints the best time of each test.
The overall time to process each regular expression is measured and accounted.
The scoring algorithhm distributes the fastest engine 5 points, the second fastest 4 points and so on.
The score points help to limit the impact of a slow regular expression eninge test in comparision to
the absolut time value.

You can specify a file to write the test results per expression and engine:
```bash
./src/regex_perf -f ./3200.txt -o ./results.csv
```
The test tool writes the results in a csv-compatible format.

## Spreadsheet generator

We included a spreadsheet generator for easy visualization of the results.
Once you have ran the results and obtained the `results.csv` file, you can create a spreadsheet
with (assuming you are still in the build directory)
```bash
python3 ../genspreadsheet.py results.csv
```
It will save an Excel spreadsheet with the name `regex-results-YYYYMMDD-HHMMSS.xlsx` in the current
directory.

## Results

These results were obtained in an AMD Threadripper 3960X (Zen2) at 3.8 GHz running Ubuntu 20.04.5 LTS.

![Updated Performance Results](results_20221012.png "Performance Results")


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">SaveLoadDemo</string>
</resources>

redpajama_set_name: RedPajamaGithub


text:
/* eslint-env mocha */

var assert = require('assert')
var net = require('net')
var streamPair = require('stream-pair')

var thing = require('../')

describe('Handle Thing', function () {
  var handle
  var pair
  var socket;

  [ 'normal', 'lazy' ].forEach(function (mode) {
    describe(mode, function () {
      beforeEach(function () {
        pair = streamPair.create()
        handle = thing.create(mode === 'normal' ? pair.other : null)
        socket = new net.Socket({
          handle: handle,
          readable: true,
          writable: true
        })

        if (mode === 'lazy') {
          setTimeout(function () {
            handle.setStream(pair.other)
          }, 50)
        }
      })

      afterEach(function () {
        assert(handle._stream)
      })

      it('should write data to Socket', function (done) {
        pair.write('hello')
        pair.write(' world')
        pair.end('... ok')

        var chunks = ''
        socket.on('data', function (chunk) {
          chunks += chunk
        })
        socket.on('end', function () {
          assert.strictEqual(chunks, 'hello world... ok')

          // allowHalfOpen is `false`, so the `end` should be followed by `close`
          socket.once('close', function () {
            done()
          })
        })
      })

      it('should read data from Socket', function (done) {
        socket.write('hello')
        socket.write(' world')
        socket.end('... ok')

        var chunks = ''
        pair.on('data', function (chunk) {
          chunks += chunk
        })
        pair.on('end', function () {
          assert.strictEqual(chunks, 'hello world... ok')

          done()
        })
      })

      it('should invoke `close` callback', function (done) {
        handle._options.close = function (callback) {
          done()
          process.nextTick(callback)
        }

        pair.end('hello')
        socket.resume()
      })

      it('should kill pending requests', function (done) {
        handle._options.close = function () {
          setTimeout(done, 75)
        }

        socket.write('hello')
        socket.destroy()
      })

      if (mode === 'normal') {
        it('should invoke `getPeerName` callback', function () {
          handle._options.getPeerName = function () {
            return { address: 'ohai' }
          }

          assert.strictEqual(socket.remoteAddress, 'ohai')
        })

        it('should emit ECONNRESET at `close` event', function (done) {
          pair.other.emit('close')

          socket.on('error', function (err) {
            assert(/ECONNRESET/.test(err.message))
            done()
          })
        })
      }
    })
  })
})


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

<title>LiQueryConstant (li-android-sdk-core 1.2.5 API)</title>
<meta name="date" content="2018-02-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

lithium.community.android.sdk.utils

Class LiQueryConstant

java.lang.Object

lithium.community.android.sdk.utils.LiQueryConstant

public class LiQueryConstant
extends java.lang.Object

This class has LIQL, TYPE and other constants.
 Created by kunal.shrivastava on 12/7/16.

Field Summary

Fields

Modifier and Type
Field and Description

static java.lang.Integer
DEFAULT_LIQL_QUERY_LIMIT

static java.lang.String
LI_ACCEPT_SOLUTION_TYPE

static java.lang.String
LI_APPLICATION_TYPE

static java.lang.String
LI_ARTICLES_BROWSE_CLIENT_TYPE

static java.lang.String
LI_ARTICLES_BROWSE_QUERYSETTINGS_TYPE

static java.lang.String
LI_ARTICLES_CLIENT_TYPE

static java.lang.String
LI_ARTICLES_QUERYSETTINGS_TYPE

static java.lang.String
LI_BROWSE_BY_DEPTH_QUERYSETTINGS_TYPE

static java.lang.String
LI_BROWSE_CLIENT_BASE_LIQL

static java.lang.String
LI_BROWSE_CLIENT_TYPE

static java.lang.String
LI_BROWSE_QUERYSETTINGS_TYPE

static java.lang.String
LI_CATEGORY_CLIENT_BASE_LIQL

static java.lang.String
LI_CATEGORY_CLIENT_TYPE

static java.lang.String
LI_CATEGORY_QUERYSETTINGS_TYPE

static java.lang.String
LI_FLOATED_MESSAGE_CLIENT_BASE_LIQL

static java.lang.String
LI_FLOATED_MESSAGE_CLIENT_TYPE

static java.lang.String
LI_FLOATED_MESSAGE_QUERYSETTINGS_TYPE

static java.lang.String
LI_FOR_UI_SEARCH

static java.lang.String
LI_GENERIC_TYPE

static java.lang.String
LI_IMAGE_TYPE

static java.lang.String
LI_INSERT_IMAGE_MACRO

static java.lang.String
LI_KUDO_TYPE

static java.lang.String
LI_LINE_SEPARATOR

static java.lang.String
LI_MARK_ABUSE_TYPE

static java.lang.String
LI_MARK_AS_READ

static java.lang.String
LI_MARK_MESSAGE_CLIENT_TYPE

static java.lang.String
LI_MESSAGE_BY_IDS_QUERYSETTINGS_TYPE

static java.lang.String
LI_MESSAGE_CHILDREN_CLIENT_TYPE

static java.lang.String
LI_MESSAGE_CHILDREN_QUERYSETTINGS_TYPE

static java.lang.String
LI_MESSAGE_CLIENT_TYPE

static java.lang.String
LI_MESSAGE_CONVERSATION_BASE_LIQL

static java.lang.String
LI_MESSAGE_LIST_BASE_LIQL

static java.lang.String
LI_MESSAGE_QUERYSETTINGS_TYPE

static java.lang.String
LI_MESSAGE_TYPE

static java.lang.String
LI_POST_QUESTION_TYPE

static java.lang.String
LI_QUESTIONS_CLIENT_TYPE

static java.lang.String
LI_QUESTIONS_QUERYSETTINGS_TYPE

static java.lang.String
LI_REPLY_MESSAGE_TYPE

static java.lang.String
LI_SDK_SETTINGS_CLIENT_BASE_LIQL

static java.lang.String
LI_SDK_SETTINGS_CLIENT_TYPE

static java.lang.String
LI_SDK_SETTINGS_QUERYSETTINGS_TYPE

static java.lang.String
LI_SEARCH_CLIENT_TYPE

static java.lang.String
LI_SEARCH_QUERYSETTINGS_TYPE

static java.lang.String
LI_SUBSCRIPTION_TYPE

static java.lang.String
LI_SUBSCRIPTIONS_CLIENT_BASE_LIQL

static java.lang.String
LI_SUBSCRIPTIONS_CLIENT_TYPE

static java.lang.String
LI_SUBSCRIPTTION_QUERYSETTINGS_TYPE

static java.lang.String
LI_USER_DETAILS_CLIENT_BASE_LIQL

static java.lang.String
LI_USER_DETAILS_CLIENT_TYPE

static java.lang.String
LI_USER_DETAILS_QUERYSETTINGS_TYPE

static java.lang.String
LI_USER_DEVICE_ID_FETCH_TYPE

Constructor Summary

Constructors

Constructor and Description

LiQueryConstant()

Method Summary

Methods inherited from class java.lang.Object

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

Field Detail

LI_SUBSCRIPTIONS_CLIENT_BASE_LIQL

public static final java.lang.String LI_SUBSCRIPTIONS_CLIENT_BASE_LIQL

See Also:

Constant Field Values

LI_BROWSE_CLIENT_BASE_LIQL

public static final java.lang.String LI_BROWSE_CLIENT_BASE_LIQL

See Also:

Constant Field Values

LI_CATEGORY_CLIENT_BASE_LIQL

public static final java.lang.String LI_CATEGORY_CLIENT_BASE_LIQL

See Also:

Constant Field Values

LI_USER_DETAILS_CLIENT_BASE_LIQL

public static final java.lang.String LI_USER_DETAILS_CLIENT_BASE_LIQL

See Also:

Constant Field Values

LI_FLOATED_MESSAGE_CLIENT_BASE_LIQL

public static final java.lang.String LI_FLOATED_MESSAGE_CLIENT_BASE_LIQL

See Also:

Constant Field Values

LI_SDK_SETTINGS_CLIENT_BASE_LIQL

public static final java.lang.String LI_SDK_SETTINGS_CLIENT_BASE_LIQL

See Also:

Constant Field Values

LI_MESSAGE_LIST_BASE_LIQL

public static final java.lang.String LI_MESSAGE_LIST_BASE_LIQL

See Also:

Constant Field Values

LI_MESSAGE_CONVERSATION_BASE_LIQL

public static final java.lang.String LI_MESSAGE_CONVERSATION_BASE_LIQL

See Also:

Constant Field Values

LI_ACCEPT_SOLUTION_TYPE

public static final java.lang.String LI_ACCEPT_SOLUTION_TYPE

See Also:

Constant Field Values

LI_KUDO_TYPE

public static final java.lang.String LI_KUDO_TYPE

See Also:

Constant Field Values

LI_POST_QUESTION_TYPE

public static final java.lang.String LI_POST_QUESTION_TYPE

See Also:

Constant Field Values

LI_REPLY_MESSAGE_TYPE

public static final java.lang.String LI_REPLY_MESSAGE_TYPE

See Also:

Constant Field Values

LI_ARTICLES_CLIENT_TYPE

public static final java.lang.String LI_ARTICLES_CLIENT_TYPE

See Also:

Constant Field Values

LI_SUBSCRIPTIONS_CLIENT_TYPE

public static final java.lang.String LI_SUBSCRIPTIONS_CLIENT_TYPE

See Also:

Constant Field Values

LI_BROWSE_CLIENT_TYPE

public static final java.lang.String LI_BROWSE_CLIENT_TYPE

See Also:

Constant Field Values

LI_SEARCH_CLIENT_TYPE

public static final java.lang.String LI_SEARCH_CLIENT_TYPE

See Also:

Constant Field Values

LI_MESSAGE_CHILDREN_CLIENT_TYPE

public static final java.lang.String LI_MESSAGE_CHILDREN_CLIENT_TYPE

See Also:

Constant Field Values

LI_QUESTIONS_CLIENT_TYPE

public static final java.lang.String LI_QUESTIONS_CLIENT_TYPE

See Also:

Constant Field Values

LI_CATEGORY_CLIENT_TYPE

public static final java.lang.String LI_CATEGORY_CLIENT_TYPE

See Also:

Constant Field Values

LI_ARTICLES_BROWSE_CLIENT_TYPE

public static final java.lang.String LI_ARTICLES_BROWSE_CLIENT_TYPE

See Also:

Constant Field Values

LI_USER_DETAILS_CLIENT_TYPE

public static final java.lang.String LI_USER_DETAILS_CLIENT_TYPE

See Also:

Constant Field Values

LI_MESSAGE_CLIENT_TYPE

public static final java.lang.String LI_MESSAGE_CLIENT_TYPE

See Also:

Constant Field Values

LI_SDK_SETTINGS_CLIENT_TYPE

public static final java.lang.String LI_SDK_SETTINGS_CLIENT_TYPE

See Also:

Constant Field Values

LI_USER_DEVICE_ID_FETCH_TYPE

public static final java.lang.String LI_USER_DEVICE_ID_FETCH_TYPE

See Also:

Constant Field Values

LI_APPLICATION_TYPE

public static final java.lang.String LI_APPLICATION_TYPE

See Also:

Constant Field Values

LI_MARK_MESSAGE_CLIENT_TYPE

public static final java.lang.String LI_MARK_MESSAGE_CLIENT_TYPE

See Also:

Constant Field Values

LI_IMAGE_TYPE

public static final java.lang.String LI_IMAGE_TYPE

See Also:

Constant Field Values

LI_FLOATED_MESSAGE_CLIENT_TYPE

public static final java.lang.String LI_FLOATED_MESSAGE_CLIENT_TYPE

See Also:

Constant Field Values

LI_ARTICLES_QUERYSETTINGS_TYPE

public static final java.lang.String LI_ARTICLES_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_SUBSCRIPTTION_QUERYSETTINGS_TYPE

public static final java.lang.String LI_SUBSCRIPTTION_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_BROWSE_QUERYSETTINGS_TYPE

public static final java.lang.String LI_BROWSE_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_BROWSE_BY_DEPTH_QUERYSETTINGS_TYPE

public static final java.lang.String LI_BROWSE_BY_DEPTH_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_SEARCH_QUERYSETTINGS_TYPE

public static final java.lang.String LI_SEARCH_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_MESSAGE_CHILDREN_QUERYSETTINGS_TYPE

public static final java.lang.String LI_MESSAGE_CHILDREN_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_QUESTIONS_QUERYSETTINGS_TYPE

public static final java.lang.String LI_QUESTIONS_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_CATEGORY_QUERYSETTINGS_TYPE

public static final java.lang.String LI_CATEGORY_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_ARTICLES_BROWSE_QUERYSETTINGS_TYPE

public static final java.lang.String LI_ARTICLES_BROWSE_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_USER_DETAILS_QUERYSETTINGS_TYPE

public static final java.lang.String LI_USER_DETAILS_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_MESSAGE_QUERYSETTINGS_TYPE

public static final java.lang.String LI_MESSAGE_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_MESSAGE_BY_IDS_QUERYSETTINGS_TYPE

public static final java.lang.String LI_MESSAGE_BY_IDS_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_FLOATED_MESSAGE_QUERYSETTINGS_TYPE

public static final java.lang.String LI_FLOATED_MESSAGE_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_SDK_SETTINGS_QUERYSETTINGS_TYPE

public static final java.lang.String LI_SDK_SETTINGS_QUERYSETTINGS_TYPE

See Also:

Constant Field Values

LI_GENERIC_TYPE

public static final java.lang.String LI_GENERIC_TYPE

See Also:

Constant Field Values

LI_MARK_ABUSE_TYPE

public static final java.lang.String LI_MARK_ABUSE_TYPE

See Also:

Constant Field Values

LI_MARK_AS_READ

public static final java.lang.String LI_MARK_AS_READ

See Also:

Constant Field Values

LI_FOR_UI_SEARCH

public static final java.lang.String LI_FOR_UI_SEARCH

See Also:

Constant Field Values

LI_INSERT_IMAGE_MACRO

public static final java.lang.String LI_INSERT_IMAGE_MACRO

See Also:

Constant Field Values

LI_LINE_SEPARATOR

public static final java.lang.String LI_LINE_SEPARATOR

DEFAULT_LIQL_QUERY_LIMIT

public static final java.lang.Integer DEFAULT_LIQL_QUERY_LIMIT

LI_MESSAGE_TYPE

public static final java.lang.String LI_MESSAGE_TYPE

See Also:

Constant Field Values

LI_SUBSCRIPTION_TYPE

public static final java.lang.String LI_SUBSCRIPTION_TYPE

See Also:

Constant Field Values

Constructor Detail

LiQueryConstant

public LiQueryConstant()

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
import run from 'ember-runloop';
import EmberObject from 'ember-object';
import {
    describeModel,
    it
} from 'ember-mocha';

describeModel(
    'post',
    'Unit: Model: post',
    {
        needs: ['model:user', 'model:tag', 'model:role']
    },

    function () {
        it('has a validation type of "post"', function () {
            let model = this.subject();

            expect(model.validationType).to.equal('post');
        });

        it('isPublished, isDraft and isScheduled are correct', function () {
            let model = this.subject({
                status: 'published'
            });

            expect(model.get('isPublished')).to.be.ok;
            expect(model.get('isDraft')).to.not.be.ok;
            expect(model.get('isScheduled')).to.not.be.ok;

            run(function () {
                model.set('status', 'draft');

                expect(model.get('isPublished')).to.not.be.ok;
                expect(model.get('isDraft')).to.be.ok;
                expect(model.get('isScheduled')).to.not.be.ok;
            });

            run(function () {
                model.set('status', 'scheduled');

                expect(model.get('isScheduled')).to.be.ok;
                expect(model.get('isPublished')).to.not.be.ok;
                expect(model.get('isDraft')).to.not.be.ok;
            });
        });

        it('isAuthoredByUser is correct', function () {
            /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
            let model = this.subject({
                authorId: 15
            });
            /* jscs:enable requireCamelCaseOrUpperCaseIdentifiers */
            let user = EmberObject.create({id: '15'});

            expect(model.isAuthoredByUser(user)).to.be.ok;

            run(function () {
                model.set('authorId', 1);

                expect(model.isAuthoredByUser(user)).to.not.be.ok;
            });
        });

        it('updateTags removes and deletes old tags', function () {
            let model = this.subject();

            run(this, function () {
                let modelTags = model.get('tags');
                let tag1 = this.store().createRecord('tag', {id: '1'});
                let tag2 = this.store().createRecord('tag', {id: '2'});
                let tag3 = this.store().createRecord('tag');

                // During testing a record created without an explicit id will get
                // an id of 'fixture-n' instead of null
                tag3.set('id', null);

                modelTags.pushObject(tag1);
                modelTags.pushObject(tag2);
                modelTags.pushObject(tag3);

                expect(model.get('tags.length')).to.equal(3);

                model.updateTags();

                expect(model.get('tags.length')).to.equal(2);
                expect(model.get('tags.firstObject.id')).to.equal('1');
                expect(model.get('tags').objectAt(1).get('id')).to.equal('2');
                expect(tag1.get('isDeleted')).to.not.be.ok;
                expect(tag2.get('isDeleted')).to.not.be.ok;
                expect(tag3.get('isDeleted')).to.be.ok;
            });
        });
    }
);


text:
package mil.nga.giat.geowave.core.store.flatten;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

import mil.nga.giat.geowave.core.index.ByteArrayId;
import mil.nga.giat.geowave.core.store.adapter.DataAdapter;
import mil.nga.giat.geowave.core.store.dimension.NumericDimensionField;
import mil.nga.giat.geowave.core.store.index.CommonIndexModel;
import mil.nga.giat.geowave.core.store.index.CommonIndexValue;

/**
 * Utility methods when dealing with bitmasks in Accumulo
 *
 * @since 0.9.1
 */
public class BitmaskUtils
{
	public static byte[] generateANDBitmask(
			final byte[] bitmask1,
			final byte[] bitmask2 ) {
		final byte[] result = new byte[Math.min(
				bitmask1.length,
				bitmask2.length)];
		for (int i = 0; i < result.length; i++) {
			result[i] = bitmask1[i];
			result[i] &= bitmask2[i];
		}
		return result;
	}

	public static boolean isAnyBitSet(
			final byte[] array ) {
		for (final byte b : array) {
			if (b != 0) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Generates a composite bitmask given a list of field positions. The
	 * composite bitmask represents a true bit for every positive field position
	 *
	 * For example, given field 0, field 1, and field 2 this method will return
	 * 00000111
	 *
	 * @param fieldPositions
	 *            a list of field positions
	 * @return a composite bitmask
	 */
	public static byte[] generateCompositeBitmask(
			final SortedSet<Integer> fieldPositions ) {
		final byte[] retVal = new byte[(fieldPositions.last() / 8) + 1];
		for (final Integer fieldPosition : fieldPositions) {
			final int bytePosition = fieldPosition / 8;
			final int bitPosition = fieldPosition % 8;
			retVal[bytePosition] |= (1 << bitPosition);
		}
		return retVal;
	}

	/**
	 * Generates a composite bitmask given a single field position. The
	 * composite bitmask represents a true bit for this field position
	 *
	 * For example, given field 2 this method will return 00000100
	 *
	 * @param fieldPosition
	 *            a field position
	 * @return a composite bitmask
	 */
	public static byte[] generateCompositeBitmask(
			final Integer fieldPosition ) {
		return generateCompositeBitmask(new TreeSet<Integer>(
				Collections.singleton(fieldPosition)));
	}

	/**
	 * Iterates the set (true) bits within the given composite bitmask and
	 * generates a list of field positions.
	 *
	 * @param compositeBitmask
	 *            the composite bitmask
	 * @return a list of field positions
	 */
	public static List<Integer> getFieldPositions(
			final byte[] bitmask ) {
		final List<Integer> fieldPositions = new ArrayList<>();
		int currentByte = 0;
		for (final byte singleByteBitMask : bitmask) {
			for (int bit = 0; bit < 8; ++bit) {
				if (((singleByteBitMask >>> bit) & 0x1) == 1) {
					fieldPositions.add((currentByte * 8) + bit);
				}
			}
			currentByte++;
		}
		return fieldPositions;
	}

	/**
	 * Generates a field subset bitmask for the given index, adapter, and fields
	 *
	 * @param indexModel
	 *            the index's CommonIndexModel
	 * @param fieldIds
	 *            the fields to include in the subset, as Strings
	 * @param adapterAssociatedWithFieldIds
	 *            the adapter for the type whose fields are being subsetted
	 * @return the field subset bitmask
	 */
	public static byte[] generateFieldSubsetBitmask(
			final CommonIndexModel indexModel,
			final List<String> fieldIds,
			final DataAdapter<?> adapterAssociatedWithFieldIds ) {
		final SortedSet<Integer> fieldPositions = new TreeSet<Integer>();

		// dimension fields must also be included
		for (final NumericDimensionField<? extends CommonIndexValue> dimension : indexModel.getDimensions()) {
			fieldPositions.add(adapterAssociatedWithFieldIds.getPositionOfOrderedField(
					indexModel,
					dimension.getFieldId()));
		}

		for (final String fieldId : fieldIds) {
			fieldPositions.add(adapterAssociatedWithFieldIds.getPositionOfOrderedField(
					indexModel,
					new ByteArrayId(
							fieldId)));
		}
		return generateCompositeBitmask(fieldPositions);
	}

	/**
	 * Generates a new value byte array representing a subset of fields of the
	 * given value
	 *
	 * @param value
	 *            the original column value
	 * @param originalBitmask
	 *            the bitmask from the column qualifier
	 * @param newBitmask
	 *            the field subset bitmask
	 * @return the subsetted value as a byte[]
	 */
	public static byte[] constructNewValue(
			final byte[] value,
			final byte[] originalBitmask,
			final byte[] newBitmask ) {

		final ByteBuffer originalBytes = ByteBuffer.wrap(value);
		final List<byte[]> valsToKeep = new ArrayList<>();
		int totalSize = 0;
		final List<Integer> originalPositions = getFieldPositions(originalBitmask);
		// convert list to set for quick contains()
		final Set<Integer> newPositions = new HashSet<Integer>(
				getFieldPositions(newBitmask));
		if (originalPositions.size() > 1) {
			for (final Integer originalPosition : originalPositions) {
				final int len = originalBytes.getInt();
				final byte[] val = new byte[len];
				originalBytes.get(val);
				if (newPositions.contains(originalPosition)) {
					valsToKeep.add(val);
					totalSize += len;
				}
			}
		}
		else if (!newPositions.isEmpty()) {
			// this shouldn't happen because we should already catch the case
			// where the bitmask is unchanged
			return value;
		}
		else {
			// and this shouldn't happen because we should already catch the
			// case where the resultant bitmask is empty
			return null;
		}
		if (valsToKeep.size() == 1) {
			final ByteBuffer retVal = ByteBuffer.allocate(totalSize);
			retVal.put(valsToKeep.get(0));
			return retVal.array();
		}
		final ByteBuffer retVal = ByteBuffer.allocate((valsToKeep.size() * 4) + totalSize);
		for (final byte[] val : valsToKeep) {
			retVal.putInt(val.length);
			retVal.put(val);
		}
		return retVal.array();
	}

}


text:
using System;
using System.Linq;

namespace Microsoft.Azure.Management.Resources.Models
{
    /// <summary>
    /// Resource group information.
    /// </summary>
    public partial class ResourceGroupListParameters
    {
        private string _tagName;

        /// <summary>
        /// Optional. Filter the results based on a particular tag name.
        /// Optional.
        /// </summary>
        public string TagName
        {
            get { return this._tagName; }
            set { this._tagName = value; }
        }

        private string _tagValue;

        /// <summary>
        /// Optional. Filter the results for a tag name along with a particular
        /// tag value. Optional.
        /// </summary>
        public string TagValue
        {
            get { return this._tagValue; }
            set { this._tagValue = value; }
        }

        private int? _top;

        /// <summary>
        /// Optional. Number of records to return. Optional.
        /// </summary>
        public int? Top
        {
            get { return this._top; }
            set { this._top = value; }
        }

        /// <summary>
        /// Initializes a new instance of the ResourceGroupListParameters class.
        /// </summary>
        public ResourceGroupListParameters()
        {
        }
    }
}


text:
package org.apache.accumulo.storagehandler.predicate.compare;

/**
 *  Wraps type-specific comparison operations over a constant value.
 *  Methods take raw byte from incoming Accumulo values.
 *
 *  The CompareOpt instance in the iterator uses one or more methods
 *  from a PrimitiveCompare implementation to perform type-specific comparisons and
 *  determine acceptances.
 *
 *  Used by {@link org.apache.accumulo.storagehandler.predicate.PrimitiveComparisonFilter}.
 *  Works with {@link CompareOp}
 */
public interface PrimitiveCompare {

    public boolean isEqual(byte[] value);
    public boolean isNotEqual(byte[] value);
    public boolean greaterThanOrEqual(byte[] value);
    public boolean greaterThan(byte[] value);
    public boolean lessThanOrEqual(byte[] value);
    public boolean lessThan(byte[] value);
    public boolean like(byte[] value);
    public Object serialize(byte[] value);
    public void init(byte[] constant);
}


text:
import {NgModule} from '@angular/core';
import {BcContentAside} from './contentAside.component';

@NgModule({
  exports: [BcContentAside],
  declarations: [BcContentAside],
})
export class BcContentAsideModule {}


text:
import getLink from './getLink';

export default function loadCustomTheme(primary, secondary, hue, light) {
  const link = getLink('preview-link');

  link.href = `/themes/${primary.replace('-', '_')}-${secondary.replace('-', '_')}-${hue}${light ? '' : '-dark'}.css`;
}


text:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>

<link href="doc-style.css" type="text/css" rel="StyleSheet">

Managed Object Types	Data Object Types	All Properties	All Methods

Enum -
						HostLowLevelProvisioningManagerReloadTarget

Since

vSphere API 4.0

Enum Description

         The target of the disk reload.

Enum Constants

Name	Description

currentConfig
      Specifies the reload of the current config of the virtual machine.

snapshotConfig
      Specifies the reload of the snapshot config of the virtual machine.
  If the virtual machine has multiple snapshots, all of the snapshot's
  config will be reloaded.

Show WSDL type definition

<textarea cols="20" rows="10" name="wsdl-textarea" wrap="off" readonly="1" id="wsdl-textarea">         <simpleType xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vim25="urn:vim25" name="HostLowLevelProvisioningManagerReloadTarget">
            <restriction base="xsd:string">
               <enumeration value="currentConfig"/>
               <enumeration value="snapshotConfig"/>
            </restriction>
         </simpleType></textarea>

Top of page

Managed Object Types	Data Object Types	All Properties	All Methods


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vcella</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vbapzmove.html" title="vbapzmove" />
    <link rel="next" href="vco.html" title="vco" />

          vcella

          Prev
          Orchestra Opcodes and Operators
           Next

          vcella

vcella —
    Cellular Automata

Description

	Unidimensional Cellular Automata applied to Csound vectors

Syntax

vcella ktrig, kreinit, ioutFunc, initStateFunc, \
      iRuleFunc, ielements, irulelen [, iradius]

Initialization

       ioutFunc - number of the table where the state of each cell is stored

      initStateFunc  - number of a table containig the inital states of each cell

      iRuleFunc - number of a lookup table containing the rules

      ielements - total number of cells

      irulelen  - total number of rules

      iradius (optional) - radius of Cellular Automata. At present time CA radius can be 1 or 2 (1 is the default)

Performance

       ktrig - trigger signal. Each time it is non-zero, a new generation of cells is evaluated

      kreinit - trigger signal. Each time it is non-zero, state of all cells is forced to be that of initStateFunc.

      vcella supports unidimensional cellular automata, where the state of each cell is stored in ioutFunc. So ioutFunc is a vector containing current state of each cell. This variant vector can be used together with any other vector-based opcode, such as
      adsynt,
      vmap,
      vpowv etc.

initStateFunc is an input vector containing the inital value of the row of cells, while iRuleFunc is an input vector containing the rules in the form of a lookup table. Notice that initStateFunc and iRuleFunc can be updated during the performance by means of other vector-based opcodes (for example vcopy) in order to force to change rules and status at performance time.

A new generation of cells is evaluated each time ktrig contains a non-zero value. Also the status of all cells can be forced to assume the status corresponding to the contents of initStateFunc each time kreinit contains a non-zero value.

Radius of CA algorithm can be 1 or 2 (optional iradius arguement).

Examples

      Here is an example of the vcella opcode. It uses the file vcella.csd.

      The following example uses vcella

            Example 1013. Example of the vcella opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o vcella.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
; vcella.csd
; by Anthony Kozar

; This file demonstrates some of the new opcodes available in
; Csound 5 that come from Gabriel Maldonado's CsoundAV.

sr        = 44100
kr        = 4410
ksmps     = 10
nchnls    = 1

; Cellular automata-driven oscillator bank using vcella and adsynt
instr 1
  idur      = p3
  iCArate   = p4                                ; number of times per second the CA calculates new values

  ; f-tables for CA parameters
  iCAinit   = p5                                ; CA initial states
  iCArule   = p6                                ; CA rule values
  ; The rule is used as follows:
  ; the states (values) of each cell are summed with their neighboring cells within
  ; the specied radius (+/- 1 or 2 cells).  Each sum is used as an index to read a
  ; value from the rule table which becomes the new state value for its cell.
  ; All new states are calculated first, then the new values are all applied
  ; simultaneously.

  ielements = ftlen(iCAinit)
  inumrules = ftlen(iCArule)
  iradius   = 1

  ; create some needed tables
  iCAstate  ftgen     0, 0, ielements, -2, 0    ; will hold the current CA states
  ifreqs    ftgen     0, 0, ielements, -2, 0    ; will hold the oscillator frequency for each cell
  iamps     ftgen     0, 0, ielements, -2, 0    ; will hold the amplitude for each cell

  ; calculate cellular automata state
  ktrig     metro     iCArate                   ; trigger the CA to update iCArate times per second
            vcella    ktrig, 0, iCAstate, iCAinit, iCArule, ielements, inumrules, iradius

  ; scale CA state for use as amplitudes of the oscillator bank
            vcopy     iamps, iCAstate, ielements
            vmult     iamps, (1/3), ielements   ; divide by 3 since state values are 0-3

            vport     iamps, .01, ielements     ; need to smooth the amplitude changes for adsynt
  ; we could use adsynt2 instead of adsynt, but it does not seem to be working

  ; i-time loop for calculating frequencies
  index     =         0
  inew      =         1
  iratio    =         1.125                     ; just major second (creating a whole tone scale)
loop1:
            tableiw   inew, index, ifreqs, 0    ; 0 indicates integer indices
  inew      =         inew * iratio
  index     =         index + 1
  if (index < ielements) igoto loop1

  ; create sound with additive oscillator bank
  ifreqbase = 64
  iwavefn   = 1
  iphs      = 2                                 ; random oscillator phases

  kenv      linseg    0.0, 0.5, 1.0, idur - 1.0, 1.0, 0.5, 0.0
  aosc      adsynt    kenv, ifreqbase, iwavefn, ifreqs, iamps, ielements, iphs

            out       aosc * ampdb(68)
endin

</CsInstruments>
<CsScore>
f1 0 16384 10 1

; This example uses a 4-state cellular automata
; Possible state values are 0, 1, 2, and 3

; CA initial state
; We have 16 cells in our CA, so the initial state table is size 16
f10 0 16 -2  0 1 0 0  1 0 0 2  2 0 0 1  0 0 1 0

; CA rule
; The maximum sum with radius 1 (3 cells) is 9, so we need 10 values in the rule (0-9)
f11 0 16 -2  1 0 3 2 1  0 0 2 1 0

; Here is our one and only note!
i1 0  20  4  10  11

e

</CsScore>
</CsoundSynthesizer>

Credits

Written by: Gabriel Maldonado.

New in Csound 5 (Previously available only on CsoundAV)

Example by: Anthony Kozar

          Prev

            Up

           Next

          vbapzmove

            Home

           vco


text:
using System;

namespace Mepham.Forum.Models.Dtos.Topic
{
    /// <summary>
    /// Class to be used when only a brief description of the Topic is required.
    /// </summary>
    public class BasicTopicDto
    {
        public Guid Id { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
    }
}


text:
import cgt, numpy as np
from nose.tools import raises
from StringIO import StringIO
import sys

class CaptureStderr(object):
    def __init__(self):
        self.origstderr = sys.stderr
    def __enter__(self):
        self.s = StringIO()
        sys.stderr = self.s
        return self.s
    def __exit__(self, *args):
        self.stderr = self.origstderr

@raises(RuntimeError)
def test_shape_err():
    with CaptureStderr():
        with cgt.scoped_update_config(debug=True, backend="python"):
            x = cgt.vector()
            y = cgt.vector()
            f = cgt.function([x,y],x+y)
            f(np.zeros(3),np.zeros(4))

if __name__ == "__main__":
    import nose
    nose.runmodule()


text:
angular.module('SurgicorSpike.Controllers').controller('homeController', function ($scope, userService, $location, adminService, twilioService) {
    var user = userService.GetUser();
    if (!user) {
        $location.path("/login");
    }

    $scope.$parent.title = "Home";
    $scope.users = [];
    $scope.paginationPayload = { PageNumber: 1, PageSize: 20, Field: "Name" };
    $scope.sortCriteria = "";

    twilioService.getToken().then(function(response) {

        Twilio.Device.setup(response.token);

        Twilio.Device.ready(function (device) {
            $scope.status = "Waiting for a phone call...";
            $scope.$apply();
        });

        Twilio.Device.error(function (error) {
            $scope.status = "Error: " + error.message;
        });

        Twilio.Device.connect(function (conn) {
            $scope.status = "Successfully established call";
            $scope.$apply();
        });

        Twilio.Device.disconnect(function (conn) {
            $scope.status = "Call ended";
            $scope.$apply();
        });

        Twilio.Device.incoming(function (conn) {
            $scope.status = "Incoming connection from " + conn.parameters.From;

            $scope.incomingCall = true;
            $scope.inCall = false;
            $scope.$apply();

            $scope.acceptCall = function() {
                $scope.incomingCall = false;
                $scope.inCall = true;
                $scope.$apply();

                conn.accept();
            };

            $scope.hangup = function() {
                $scope.incomingCall = false;
                $scope.inCall = false;
                Twilio.Device.disconnectAll();
                $scope.status = "Waiting for a phone call...";
            };
        });
    });

    $scope.GetUsers = function (payload) {
        adminService.GetUsers(payload).then(function (data) {
            $scope.users = data.adminUsers;
        });
    };

    $scope.next = function() {
        $scope.paginationPayload.PageNumber += 1;
        $scope.GetUsers($scope.paginationPayload);
    };

    $scope.back = function () {
        $scope.paginationPayload.PageNumber -= 1;
        $scope.GetUsers($scope.paginationPayload);
    };

    $scope.sort = function (param) {
        $scope.sortCriteria = param;
        $scope.paginationPayload.Field = param;
        $scope.GetUsers($scope.paginationPayload);
    };

    $scope.EnableUser = function(payload) {
        adminService.EnableUser(payload).then(function () {
            $scope.GetUsers($scope.paginationPayload);
        });
    };

    $scope.GetUsers($scope.paginationPayload);
});


text:
namespace {

// FLags set in the mode_flags_ of a scope. If a bit is set, it applies
// recursively to all dependent scopes.
const unsigned kProcessingBuildConfigFlag = 1;
const unsigned kProcessingImportFlag = 2;

// Returns true if this variable name should be considered private. Private
// values start with an underscore, and are not imported from "gni" files
// when processing an import.
bool IsPrivateVar(const base::StringPiece& name) {
  return name.empty() || name[0] == '_';
}

}  // namespace

// Defaults to all false, which are the things least likely to cause errors.
Scope::MergeOptions::MergeOptions()
    : clobber_existing(false),
      skip_private_vars(false),
      mark_dest_used(false) {
}

Scope::MergeOptions::~MergeOptions() {
}

Scope::ProgrammaticProvider::~ProgrammaticProvider() {
  scope_->RemoveProvider(this);
}

Scope::Scope(const Settings* settings)
    : const_containing_(nullptr),
      mutable_containing_(nullptr),
      settings_(settings),
      mode_flags_(0),
      item_collector_(nullptr) {
}

Scope::Scope(Scope* parent)
    : const_containing_(nullptr),
      mutable_containing_(parent),
      settings_(parent->settings()),
      mode_flags_(0),
      item_collector_(nullptr) {
}

Scope::Scope(const Scope* parent)
    : const_containing_(parent),
      mutable_containing_(nullptr),
      settings_(parent->settings()),
      mode_flags_(0),
      item_collector_(nullptr) {
}

Scope::~Scope() {
}

const Value* Scope::GetValue(const base::StringPiece& ident,
                             bool counts_as_used) {
  // First check for programmatically-provided values.
  for (const auto& provider : programmatic_providers_) {
    const Value* v = provider->GetProgrammaticValue(ident);
    if (v)
      return v;
  }

  RecordMap::iterator found = values_.find(ident);
  if (found != values_.end()) {
    if (counts_as_used)
      found->second.used = true;
    return &found->second.value;
  }

  // Search in the parent scope.
  if (const_containing_)
    return const_containing_->GetValue(ident);
  if (mutable_containing_)
    return mutable_containing_->GetValue(ident, counts_as_used);
  return nullptr;
}

Value* Scope::GetMutableValue(const base::StringPiece& ident,
                              bool counts_as_used) {
  // Don't do programmatic values, which are not mutable.
  RecordMap::iterator found = values_.find(ident);
  if (found != values_.end()) {
    if (counts_as_used)
      found->second.used = true;
    return &found->second.value;
  }

  // Search in the parent mutable scope, but not const one.
  if (mutable_containing_)
    return mutable_containing_->GetMutableValue(ident, counts_as_used);
  return nullptr;
}

Value* Scope::GetValueForcedToCurrentScope(const base::StringPiece& ident,
                                           const ParseNode* set_node) {
  RecordMap::iterator found = values_.find(ident);
  if (found != values_.end())
    return &found->second.value;  // Already have in the current scope.

  // Search in the parent scope.
  if (containing()) {
    const Value* in_containing = containing()->GetValue(ident);
    if (in_containing) {
      // Promote to current scope.
      return SetValue(ident, *in_containing, set_node);
    }
  }
  return nullptr;
}

base::StringPiece Scope::GetStorageKey(const base::StringPiece& ident) const {
  RecordMap::const_iterator found = values_.find(ident);
  if (found != values_.end())
    return found->first;

  // Search in parent scope.
  if (containing())
    return containing()->GetStorageKey(ident);
  return base::StringPiece();
}

const Value* Scope::GetValue(const base::StringPiece& ident) const {
  RecordMap::const_iterator found = values_.find(ident);
  if (found != values_.end())
    return &found->second.value;
  if (containing())
    return containing()->GetValue(ident);
  return nullptr;
}

Value* Scope::SetValue(const base::StringPiece& ident,
                       const Value& v,
                       const ParseNode* set_node) {
  Record& r = values_[ident];  // Clears any existing value.
  r.value = v;
  r.value.set_origin(set_node);
  return &r.value;
}

void Scope::RemoveIdentifier(const base::StringPiece& ident) {
  RecordMap::iterator found = values_.find(ident);
  if (found != values_.end())
    values_.erase(found);
}

void Scope::RemovePrivateIdentifiers() {
  // Do it in two phases to avoid mutating while iterating. Our hash map is
  // currently backed by several different vendor-specific implementations and
  // I'm not sure if all of them support mutating while iterating. Since this
  // is not perf-critical, do the safe thing.
  std::vector<base::StringPiece> to_remove;
  for (const auto& cur : values_) {
    if (IsPrivateVar(cur.first))
      to_remove.push_back(cur.first);
  }

  for (const auto& cur : to_remove)
    values_.erase(cur);
}

bool Scope::AddTemplate(const std::string& name, const Template* templ) {
  if (GetTemplate(name))
    return false;
  templates_[name] = templ;
  return true;
}

const Template* Scope::GetTemplate(const std::string& name) const {
  TemplateMap::const_iterator found = templates_.find(name);
  if (found != templates_.end())
    return found->second.get();
  if (containing())
    return containing()->GetTemplate(name);
  return nullptr;
}

void Scope::MarkUsed(const base::StringPiece& ident) {
  RecordMap::iterator found = values_.find(ident);
  if (found == values_.end()) {
    NOTREACHED();
    return;
  }
  found->second.used = true;
}

void Scope::MarkAllUsed() {
  for (auto& cur : values_)
    cur.second.used = true;
}

void Scope::MarkUnused(const base::StringPiece& ident) {
  RecordMap::iterator found = values_.find(ident);
  if (found == values_.end()) {
    NOTREACHED();
    return;
  }
  found->second.used = false;
}

bool Scope::IsSetButUnused(const base::StringPiece& ident) const {
  RecordMap::const_iterator found = values_.find(ident);
  if (found != values_.end()) {
    if (!found->second.used) {
      return true;
    }
  }
  return false;
}

bool Scope::CheckForUnusedVars(Err* err) const {
  for (const auto& pair : values_) {
    if (!pair.second.used) {
      std::string help = "You set the variable \"" + pair.first.as_string() +
          "\" here and it was unused before it went\nout of scope.";

      const BinaryOpNode* binary = pair.second.value.origin()->AsBinaryOp();
      if (binary && binary->op().type() == Token::EQUAL) {
        // Make a nicer error message for normal var sets.
        *err = Err(binary->left()->GetRange(), "Assignment had no effect.",
                   help);
      } else {
        // This will happen for internally-generated variables.
        *err = Err(pair.second.value.origin(), "Assignment had no effect.",
                   help);
      }
      return false;
    }
  }
  return true;
}

void Scope::GetCurrentScopeValues(KeyValueMap* output) const {
  for (const auto& pair : values_)
    (*output)[pair.first] = pair.second.value;
}

bool Scope::NonRecursiveMergeTo(Scope* dest,
                                const MergeOptions& options,
                                const ParseNode* node_for_err,
                                const char* desc_for_err,
                                Err* err) const {
  // Values.
  for (const auto& pair : values_) {
    const base::StringPiece& current_name = pair.first;
    if (options.skip_private_vars && IsPrivateVar(current_name))
      continue;  // Skip this private var.
    if (!options.excluded_values.empty() &&
        options.excluded_values.find(current_name.as_string()) !=
            options.excluded_values.end()) {
      continue;  // Skip this excluded value.
    }

    const Value& new_value = pair.second.value;
    if (!options.clobber_existing) {
      const Value* existing_value = dest->GetValue(current_name);
      if (existing_value && new_value != *existing_value) {
        // Value present in both the source and the dest.
        std::string desc_string(desc_for_err);
        *err = Err(node_for_err, "Value collision.",
            "This " + desc_string + " contains \"" + current_name.as_string() +
            "\"");
        err->AppendSubErr(Err(pair.second.value, "defined here.",
            "Which would clobber the one in your current scope"));
        err->AppendSubErr(Err(*existing_value, "defined here.",
            "Executing " + desc_string + " should not conflict with anything "
            "in the current\nscope unless the values are identical."));
        return false;
      }
    }
    dest->values_[current_name] = pair.second;

    if (options.mark_dest_used)
      dest->MarkUsed(current_name);
  }

  // Target defaults are owning pointers.
  for (const auto& pair : target_defaults_) {
    const std::string& current_name = pair.first;
    if (!options.excluded_values.empty() &&
        options.excluded_values.find(current_name) !=
            options.excluded_values.end()) {
      continue;  // Skip the excluded value.
    }

    if (!options.clobber_existing) {
      if (dest->GetTargetDefaults(current_name)) {
        // TODO(brettw) it would be nice to know the origin of a
        // set_target_defaults so we can give locations for the colliding target
        // defaults.
        std::string desc_string(desc_for_err);
        *err = Err(node_for_err, "Target defaults collision.",
            "This " + desc_string + " contains target defaults for\n"
            "\"" + current_name + "\" which would clobber one for the\n"
            "same target type in your current scope. It's unfortunate that I'm "
            "too stupid\nto tell you the location of where the target defaults "
            "were set. Usually\nthis happens in the BUILDCONFIG.gn file.");
        return false;
      }
    }

    std::unique_ptr<Scope>& dest_scope = dest->target_defaults_[current_name];
    dest_scope = base::WrapUnique(new Scope(settings_));
    pair.second->NonRecursiveMergeTo(dest_scope.get(), options, node_for_err,
                                     "<SHOULDN'T HAPPEN>", err);
  }

  // Sources assignment filter.
  if (sources_assignment_filter_) {
    if (!options.clobber_existing) {
      if (dest->GetSourcesAssignmentFilter()) {
        // Sources assignment filter present in both the source and the dest.
        std::string desc_string(desc_for_err);
        *err = Err(node_for_err, "Assignment filter collision.",
            "The " + desc_string + " contains a sources_assignment_filter "
            "which\nwould clobber the one in your current scope.");
        return false;
      }
    }
    dest->sources_assignment_filter_.reset(
        new PatternList(*sources_assignment_filter_));
  }

  // Templates.
  for (const auto& pair : templates_) {
    const std::string& current_name = pair.first;
    if (options.skip_private_vars && IsPrivateVar(current_name))
      continue;  // Skip this private template.
    if (!options.excluded_values.empty() &&
        options.excluded_values.find(current_name) !=
            options.excluded_values.end()) {
      continue;  // Skip the excluded value.
    }

    if (!options.clobber_existing) {
      const Template* existing_template = dest->GetTemplate(current_name);
      // Since templates are refcounted, we can check if it's the same one by
      // comparing pointers.
      if (existing_template && pair.second.get() != existing_template) {
        // Rule present in both the source and the dest, and they're not the
        // same one.
        std::string desc_string(desc_for_err);
        *err = Err(node_for_err, "Template collision.",
            "This " + desc_string + " contains a template \"" +
            current_name + "\"");
        err->AppendSubErr(Err(pair.second->GetDefinitionRange(),
            "defined here.",
            "Which would clobber the one in your current scope"));
        err->AppendSubErr(Err(existing_template->GetDefinitionRange(),
            "defined here.",
            "Executing " + desc_string + " should not conflict with anything "
            "in the current\nscope."));
        return false;
      }
    }

    // Be careful to delete any pointer we're about to clobber.
    dest->templates_[current_name] = pair.second;
  }

  return true;
}

std::unique_ptr<Scope> Scope::MakeClosure() const {
  std::unique_ptr<Scope> result;
  if (const_containing_) {
    // We reached the top of the mutable scope stack. The result scope just
    // references the const scope (which will never change).
    result.reset(new Scope(const_containing_));
  } else if (mutable_containing_) {
    // There are more nested mutable scopes. Recursively go up the stack to
    // get the closure.
    result = mutable_containing_->MakeClosure();
  } else {
    // This is a standalone scope, just copy it.
    result.reset(new Scope(settings_));
  }

  // Want to clobber since we've flattened some nested scopes, and our parent
  // scope may have a duplicate value set.
  MergeOptions options;
  options.clobber_existing = true;

  // Add in our variables and we're done.
  Err err;
  NonRecursiveMergeTo(result.get(), options, nullptr, "<SHOULDN'T HAPPEN>",
                      &err);
  DCHECK(!err.has_error());
  return result;
}

Scope* Scope::MakeTargetDefaults(const std::string& target_type) {
  if (GetTargetDefaults(target_type))
    return nullptr;

  std::unique_ptr<Scope>& dest = target_defaults_[target_type];
  if (dest) {
    NOTREACHED();  // Already set.
    return dest.get();
  }
  dest = base::WrapUnique(new Scope(settings_));
  return dest.get();
}

const Scope* Scope::GetTargetDefaults(const std::string& target_type) const {
  NamedScopeMap::const_iterator found = target_defaults_.find(target_type);
  if (found != target_defaults_.end())
    return found->second.get();
  if (containing())
    return containing()->GetTargetDefaults(target_type);
  return nullptr;
}

const PatternList* Scope::GetSourcesAssignmentFilter() const {
  if (sources_assignment_filter_)
    return sources_assignment_filter_.get();
  if (containing())
    return containing()->GetSourcesAssignmentFilter();
  return nullptr;
}

void Scope::SetProcessingBuildConfig() {
  DCHECK((mode_flags_ & kProcessingBuildConfigFlag) == 0);
  mode_flags_ |= kProcessingBuildConfigFlag;
}

void Scope::ClearProcessingBuildConfig() {
  DCHECK(mode_flags_ & kProcessingBuildConfigFlag);
  mode_flags_ &= ~(kProcessingBuildConfigFlag);
}

bool Scope::IsProcessingBuildConfig() const {
  if (mode_flags_ & kProcessingBuildConfigFlag)
    return true;
  if (containing())
    return containing()->IsProcessingBuildConfig();
  return false;
}

void Scope::SetProcessingImport() {
  DCHECK((mode_flags_ & kProcessingImportFlag) == 0);
  mode_flags_ |= kProcessingImportFlag;
}

void Scope::ClearProcessingImport() {
  DCHECK(mode_flags_ & kProcessingImportFlag);
  mode_flags_ &= ~(kProcessingImportFlag);
}

bool Scope::IsProcessingImport() const {
  if (mode_flags_ & kProcessingImportFlag)
    return true;
  if (containing())
    return containing()->IsProcessingImport();
  return false;
}

const SourceDir& Scope::GetSourceDir() const {
  if (!source_dir_.is_null())
    return source_dir_;
  if (containing())
    return containing()->GetSourceDir();
  return source_dir_;
}

Scope::ItemVector* Scope::GetItemCollector() {
  if (item_collector_)
    return item_collector_;
  if (mutable_containing())
    return mutable_containing()->GetItemCollector();
  return nullptr;
}

void Scope::SetProperty(const void* key, void* value) {
  if (!value) {
    DCHECK(properties_.find(key) != properties_.end());
    properties_.erase(key);
  } else {
    properties_[key] = value;
  }
}

void* Scope::GetProperty(const void* key, const Scope** found_on_scope) const {
  PropertyMap::const_iterator found = properties_.find(key);
  if (found != properties_.end()) {
    if (found_on_scope)
      *found_on_scope = this;
    return found->second;
  }
  if (containing())
    return containing()->GetProperty(key, found_on_scope);
  return nullptr;
}

void Scope::AddProvider(ProgrammaticProvider* p) {
  programmatic_providers_.insert(p);
}

void Scope::RemoveProvider(ProgrammaticProvider* p) {
  DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end());
  programmatic_providers_.erase(p);
}


text:
#ifndef ewk_tiled_model_private_h
#define ewk_tiled_model_private_h

#include "ewk_tiled_backing_store_private.h"

#include <Evas.h>

/* model */
Ewk_Tile *ewk_tile_new(Evas *evas, Evas_Coord w, Evas_Coord h, float zoom, Evas_Colorspace cspace);
void ewk_tile_free(Ewk_Tile *t);
void ewk_tile_unused_cache_clear(Ewk_Tile_Unused_Cache *tuc);
void ewk_tile_show(Ewk_Tile *t);
void ewk_tile_hide(Ewk_Tile *t);
size_t ewk_tile_memory_size_get(const Ewk_Tile *t);
Eina_Bool ewk_tile_visible_get(Ewk_Tile *t);
void ewk_tile_update_full(Ewk_Tile *t);
void ewk_tile_update_area(Ewk_Tile *t, const Eina_Rectangle *r);
void ewk_tile_updates_process(Ewk_Tile *t, void (*cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *data);
void ewk_tile_updates_clear(Ewk_Tile *t);

/* cache of unused tiles */
Ewk_Tile_Unused_Cache *ewk_tile_unused_cache_new(size_t max);
void ewk_tile_unused_cache_lock_area(Ewk_Tile_Unused_Cache *tuc, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom);
void ewk_tile_unused_cache_unlock_area(Ewk_Tile_Unused_Cache *tuc);
Ewk_Tile_Unused_Cache *ewk_tile_unused_cache_ref(Ewk_Tile_Unused_Cache *tuc);
void ewk_tile_unused_cache_unref(Ewk_Tile_Unused_Cache *tuc);

void ewk_tile_unused_cache_dirty(Ewk_Tile_Unused_Cache *tuc);

void ewk_tile_unused_cache_freeze(Ewk_Tile_Unused_Cache *tuc);
void ewk_tile_unused_cache_thaw(Ewk_Tile_Unused_Cache *tuc);

Eina_Bool ewk_tile_unused_cache_tile_get(Ewk_Tile_Unused_Cache *tuc, Ewk_Tile *t);
Eina_Bool ewk_tile_unused_cache_tile_put(Ewk_Tile_Unused_Cache *tuc, Ewk_Tile *t, void (* tile_free_cb)(void *data, Ewk_Tile *t), const void *data);

#endif // ewk_tiled_model_private_h


text:
package net.runelite.client.plugins.loottracker;

import com.google.common.collect.ImmutableMap;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemComposition;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.api.IterableHashTable;
import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.WidgetID;
import net.runelite.client.account.SessionManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemStack;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.http.api.item.ItemPrice;
import net.runelite.http.api.loottracker.LootRecordType;
import net.runelite.http.api.loottracker.LootTrackerClient;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isNull;
import org.mockito.Mock;
import org.mockito.Mockito;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class LootTrackerPluginTest
{
	private static final Map<Integer, String> HERB_IDS_TO_NAMES = ImmutableMap.<Integer, String>builder()
		.put(ItemID.GRIMY_GUAM_LEAF, "Grimy guam leaf")
		.put(ItemID.GRIMY_MARRENTILL, "Grimy marrentill")
		.put(ItemID.GRIMY_TARROMIN, "Grimy tarromin")
		.put(ItemID.GRIMY_HARRALANDER, "Grimy harralander")
		.put(ItemID.GRIMY_RANARR_WEED, "Grimy ranarr weed")
		.put(ItemID.GRIMY_IRIT_LEAF, "Grimy irit leaf")
		.put(ItemID.GRIMY_AVANTOE, "Grimy avantoe")
		.put(ItemID.GRIMY_KWUARM, "Grimy kwuarm")
		.put(ItemID.GRIMY_SNAPDRAGON, "Grimy snapdragon")
		.put(ItemID.GRIMY_CADANTINE, "Grimy cadantine")
		.put(ItemID.GRIMY_LANTADYME, "Grimy lantadyme")
		.put(ItemID.GRIMY_DWARF_WEED, "Grimy dwarf weed")
		.put(ItemID.GRIMY_TORSTOL, "Grimy torstol")
		.build();

	@Mock
	@Bind
	private ScheduledExecutorService scheduledExecutorService;

	@Mock
	@Bind
	private Client client;

	@Mock
	@Bind
	private SpriteManager spriteManager;

	@Mock
	@Bind
	private InfoBoxManager infoBoxManager;

	@Inject
	private LootTrackerPlugin lootTrackerPlugin;

	@Mock
	@Bind
	private LootTrackerConfig lootTrackerConfig;

	@Mock
	@Bind
	private SessionManager sessionManager;

	@Mock
	@Bind
	private ItemManager itemManager;

	@Mock
	@Bind
	private ChatMessageManager chatMessageManager;

	@Mock
	@Bind
	private LootTrackerClient lootTrackerClient;

	@Before
	public void setUp()
	{
		Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);

		Player player = mock(Player.class);
		when(player.getWorldLocation()).thenReturn(new WorldPoint(0, 0, 0));
		when(client.getLocalPlayer()).thenReturn(player);
	}

	@Test
	public void testPickPocket()
	{
		ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You pick the hero's pocket.", "", 0);
		lootTrackerPlugin.onChatMessage(chatMessage);

		assertEquals("Hero", lootTrackerPlugin.eventType);
		assertEquals(LootRecordType.PICKPOCKET, lootTrackerPlugin.lootRecordType);
	}

	@Test
	public void testFirstClue()
	{
		ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You have completed 1 master Treasure Trail.", "", 0);
		lootTrackerPlugin.onChatMessage(chatMessage);

		assertEquals("Clue Scroll (Master)", lootTrackerPlugin.eventType);
		assertEquals(LootRecordType.EVENT, lootTrackerPlugin.lootRecordType);
	}

	private static ItemComposition mockItem(String name)
	{
		ItemComposition itemComposition = mock(ItemComposition.class);
		when(itemComposition.getName()).thenReturn(name);
		return itemComposition;
	}

	@Test
	public void testHerbiboarHerbSack()
	{
		when(client.getBoostedSkillLevel(Skill.HERBLORE)).thenReturn(42);

		for (Map.Entry<Integer, String> herb : HERB_IDS_TO_NAMES.entrySet())
		{
			final int id = herb.getKey();
			final String name = herb.getValue();
			final String herbMessage = String.format("You put the %s herb into your herb sack.", name);
			final String herbFullMessage = String.format("Your herb sack is too full to hold the %s herb.", name);

			final ItemPrice herbPrice = new ItemPrice();
			herbPrice.setId(id);
			herbPrice.setName(name);
			when(itemManager.search(name)).thenReturn(Collections.singletonList(herbPrice));

			MessageNode node = mock(MessageNode.class);
			when(node.getType()).thenReturn(ChatMessageType.SPAM);
			when(node.getValue()).thenReturn(herbMessage);

			MessageNode nodeFull = mock(MessageNode.class);
			when(nodeFull.getType()).thenReturn(ChatMessageType.SPAM);
			when(nodeFull.getValue()).thenReturn(herbFullMessage);

			IterableHashTable<MessageNode> messageTable = mock(IterableHashTable.class);
			Iterator<MessageNode> mockIterator = mock(Iterator.class);
			when(mockIterator.hasNext()).thenReturn(true, true, false);
			when(mockIterator.next()).thenReturn(node).thenReturn(nodeFull);
			when(messageTable.iterator()).thenReturn(mockIterator);
			when(client.getMessages()).thenReturn(messageTable);

			LootTrackerPlugin lootTrackerPluginSpy = spy(this.lootTrackerPlugin);
			doNothing().when(lootTrackerPluginSpy).addLoot(any(), anyInt(), any(), any(), any(Collection.class));

			ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", LootTrackerPlugin.HERBIBOAR_LOOTED_MESSAGE, "", 0);
			lootTrackerPluginSpy.onChatMessage(chatMessage);

			verify(lootTrackerPluginSpy).addLoot("Herbiboar", -1, LootRecordType.EVENT, 42, Arrays.asList(
				new ItemStack(id, 1, null),
				new ItemStack(id, 1, null)
			));
			// Check the event type is null, which means the plugin isn't waiting on an inventory change event
			assertNull(lootTrackerPlugin.eventType);
		}
	}

	@Test
	public void testCoXRaidsLootValue()
	{
		when(lootTrackerConfig.showRaidsLootValue()).thenReturn(true);
		when(lootTrackerConfig.priceType()).thenReturn(LootTrackerPriceType.GRAND_EXCHANGE);

		LootTrackerPlugin spyPlugin = Mockito.spy(lootTrackerPlugin);
		// Make sure we don't execute addLoot, so we don't have to mock LootTrackerPanel and everything else also
		doNothing().when(spyPlugin).addLoot(anyString(), anyInt(), any(LootRecordType.class), isNull(), anyCollection());

		ItemContainer itemContainer = mock(ItemContainer.class);
		when(itemContainer.getItems()).thenReturn(new Item[]{
			new Item(ItemID.TWISTED_BOW, 1),
			new Item(ItemID.PURE_ESSENCE, 42)
		});
		when(client.getItemContainer(InventoryID.CHAMBERS_OF_XERIC_CHEST)).thenReturn(itemContainer);

		when(itemManager.getItemPrice(ItemID.TWISTED_BOW)).thenReturn(1_100_000_000);
		when(itemManager.getItemPrice(ItemID.PURE_ESSENCE)).thenReturn(6);

		WidgetLoaded widgetLoaded = new WidgetLoaded();
		widgetLoaded.setGroupId(WidgetID.CHAMBERS_OF_XERIC_REWARD_GROUP_ID);
		spyPlugin.onWidgetLoaded(widgetLoaded);

		ArgumentCaptor<QueuedMessage> captor = ArgumentCaptor.forClass(QueuedMessage.class);
		verify(chatMessageManager).queue(captor.capture());

		QueuedMessage queuedMessage = captor.getValue();
		assertEquals("<colNORMAL>Your loot is worth around <colHIGHLIGHT>1,100,000,252<colNORMAL> coins.", queuedMessage.getRuneLiteFormattedMessage());
	}

	@Test
	public void testToBRaidsLootValue()
	{
		when(lootTrackerConfig.priceType()).thenReturn(LootTrackerPriceType.HIGH_ALCHEMY);
		when(lootTrackerConfig.showRaidsLootValue()).thenReturn(true);

		LootTrackerPlugin spyPlugin = Mockito.spy(lootTrackerPlugin);
		// Make sure we don't execute addLoot, so we don't have to mock LootTrackerPanel and everything else also
		doNothing().when(spyPlugin).addLoot(anyString(), anyInt(), any(LootRecordType.class), isNull(), anyCollection());

		ItemContainer itemContainer = mock(ItemContainer.class);
		when(itemContainer.getItems()).thenReturn(new Item[]{
			new Item(ItemID.SCYTHE_OF_VITUR, 1),
			new Item(ItemID.MAHOGANY_SEED, 10)
		});
		when(client.getItemContainer(InventoryID.THEATRE_OF_BLOOD_CHEST)).thenReturn(itemContainer);

		ItemComposition compScythe = mock(ItemComposition.class);
		when(itemManager.getItemComposition(ItemID.SCYTHE_OF_VITUR)).thenReturn(compScythe);
		when(compScythe.getHaPrice()).thenReturn(60_000_000);

		ItemComposition compSeed = mock(ItemComposition.class);
		when(itemManager.getItemComposition(ItemID.MAHOGANY_SEED)).thenReturn(compSeed);
		when(compSeed.getHaPrice()).thenReturn(2_102);

		when(client.getBaseX()).thenReturn(3232);
		when(client.getBaseY()).thenReturn(4320);
		LocalPoint localPoint = new LocalPoint(0, 0);
		when(client.getLocalPlayer().getLocalLocation()).thenReturn(localPoint);

		WidgetLoaded widgetLoaded = new WidgetLoaded();
		widgetLoaded.setGroupId(WidgetID.THEATRE_OF_BLOOD_GROUP_ID);
		spyPlugin.onWidgetLoaded(widgetLoaded);

		ArgumentCaptor<QueuedMessage> captor = ArgumentCaptor.forClass(QueuedMessage.class);
		verify(chatMessageManager).queue(captor.capture());

		QueuedMessage queuedMessage = captor.getValue();
		assertEquals("<colNORMAL>Your loot is worth around <colHIGHLIGHT>60,021,020<colNORMAL> coins.", queuedMessage.getRuneLiteFormattedMessage());
	}

	@Test
	public void testBirdhouses()
	{
		// No bird nests
		ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You dismantle and discard the trap, retrieving 10 dead birds, 30 feathers and 1140 Hunter XP.", "", 0);
		lootTrackerPlugin.onChatMessage(chatMessage);

		assertEquals("Magic Bird House", lootTrackerPlugin.eventType);
		assertEquals(LootRecordType.EVENT, lootTrackerPlugin.lootRecordType);

		// Single bird nest
		chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You dismantle and discard the trap, retrieving a nest, 10 dead birds, 50 feathers and 700 Hunter XP.", "", 0);
		lootTrackerPlugin.onChatMessage(chatMessage);

		assertEquals("Teak Bird House", lootTrackerPlugin.eventType);
		assertEquals(LootRecordType.EVENT, lootTrackerPlugin.lootRecordType);

		// Multiple nests
		chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You dismantle and discard the trap, retrieving 2 nests, 10 dead birds, 40 feathers and 280 Hunter XP.", "", 0);
		lootTrackerPlugin.onChatMessage(chatMessage);

		assertEquals("Regular Bird House", lootTrackerPlugin.eventType);
		assertEquals(LootRecordType.EVENT, lootTrackerPlugin.lootRecordType);
	}

	@Test
	public void testGrubbyChest()
	{
		Player player = mock(Player.class);
		when(player.getWorldLocation()).thenReturn(new WorldPoint(7323 >> 2, (7323 & 0xff) << 6, 0));
		when(client.getLocalPlayer()).thenReturn(player);

		LootTrackerPlugin lootTrackerPluginSpy = spy(this.lootTrackerPlugin);
		doNothing().when(lootTrackerPluginSpy).addLoot(any(), anyInt(), any(), any(), any(Collection.class));

		ItemContainer itemContainer = mock(ItemContainer.class);
		when(itemContainer.getItems()).thenReturn(new Item[]{
			new Item(ItemID.TWISTED_BOW, 1),
			new Item(ItemID.GRUBBY_KEY, 1)
		});
		when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(itemContainer);

		ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You unlock the chest with your key.", "", 0);
		lootTrackerPluginSpy.onChatMessage(chatMessage);

		when(itemContainer.getItems()).thenReturn(new Item[]{
			new Item(ItemID.TWISTED_BOW, 1)
		});
		lootTrackerPluginSpy.onItemContainerChanged(new ItemContainerChanged(InventoryID.INVENTORY.getId(), itemContainer));

		chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", "You have opened the Grubby Chest 2 times.", "", 0);
		lootTrackerPluginSpy.onChatMessage(chatMessage);

		when(itemContainer.getItems()).thenReturn(new Item[]{
			new Item(ItemID.TWISTED_BOW, 1),
			new Item(ItemID.SHARK, 42)
		});
		lootTrackerPluginSpy.onItemContainerChanged(new ItemContainerChanged(InventoryID.INVENTORY.getId(), itemContainer));

		verify(lootTrackerPluginSpy).addLoot("Grubby Chest", -1, LootRecordType.EVENT, null, Arrays.asList(
			new ItemStack(ItemID.SHARK, 42, null)
		));
	}
}


text:
redo
====

Todo list for re occuring tasks


text:
var moment = require('moment')
  , md5 = require('MD5')
  , request = require('request')
  , parser = require('xml2json')
  , randomstring = require("randomstring")

var SmsConnect = function(settings) {

  this.apiScript = 'http://api.smsbrana.cz/smsconnect/http.php?'
  this.login = settings['login']
  this.password = settings['password']

  this.salt = function(length) {

    return randomstring.generate(length)

  }

  this.getAuthData = function() {

    if (this.login === null || this.password === null) {
      return null
    } else {
      var result = {}
      var salt = this.salt(10)
      var time = moment().format('YYYYMMDD') + 'T' + moment().format('HHmmss')

      result.login = this.login
      result.sul = salt
      result.time = time
      result.hash = md5(this.password + time + salt)
      return result
    }

  }

  this.inbox = function(cb) {

    var data  = this.getAuthData()
    data.action = 'inbox'

    var get = []
    for (var key in data) {
      get.push(key + '=' + data[key])
    }
    var url = this.apiScript + get.join('&')
    request(url, function (error, response, body) {
      if (error) cb(false)
      cb(parser.toJson(response.body))
    })
  }

  this.send = function(number, text, cb) {

    var data  = this.getAuthData()
    data.action = 'send_sms'
    data.number = number
    data.message = text

    var get = []
    for (var key in data) {
      get.push(key + '=' + data[key])
    }
    var url = this.apiScript + get.join('&')
    request(url, function (error, response, body) {
      if (error) cb(false)
      cb(parser.toJson(response.body))
    })

  }

}

exports.SmsConnect = SmsConnect;


text:
package jingo.maps.result.geocode;

public enum Confidence {
    High, Medium, Low
}


text:
#pragma once
#include <aws/iam/IAM_EXPORTS.h>
#include <aws/iam/model/ServiceSpecificCredential.h>
#include <aws/iam/model/ResponseMetadata.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Xml
{
  class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace IAM
{
namespace Model
{
  class AWS_IAM_API ResetServiceSpecificCredentialResult
  {
  public:
    ResetServiceSpecificCredentialResult();
    ResetServiceSpecificCredentialResult(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
    ResetServiceSpecificCredentialResult& operator=(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);

    /**
     *
A structure with details about the updated service-specific credential,
     * including the new password.
 <important>
This is the only time that
     * you can access the password. You cannot recover the password later, but you can
     * reset it again.
 </important>
     */
    inline const ServiceSpecificCredential& GetServiceSpecificCredential() const{ return m_serviceSpecificCredential; }

    /**
     *
A structure with details about the updated service-specific credential,
     * including the new password.
 <important>
This is the only time that
     * you can access the password. You cannot recover the password later, but you can
     * reset it again.
 </important>
     */
    inline void SetServiceSpecificCredential(const ServiceSpecificCredential& value) { m_serviceSpecificCredential = value; }

    /**
     *
A structure with details about the updated service-specific credential,
     * including the new password.
 <important>
This is the only time that
     * you can access the password. You cannot recover the password later, but you can
     * reset it again.
 </important>
     */
    inline void SetServiceSpecificCredential(ServiceSpecificCredential&& value) { m_serviceSpecificCredential = std::move(value); }

    /**
     *
A structure with details about the updated service-specific credential,
     * including the new password.
 <important>
This is the only time that
     * you can access the password. You cannot recover the password later, but you can
     * reset it again.
 </important>
     */
    inline ResetServiceSpecificCredentialResult& WithServiceSpecificCredential(const ServiceSpecificCredential& value) { SetServiceSpecificCredential(value); return *this;}

    /**
     *
A structure with details about the updated service-specific credential,
     * including the new password.
 <important>
This is the only time that
     * you can access the password. You cannot recover the password later, but you can
     * reset it again.
 </important>
     */
    inline ResetServiceSpecificCredentialResult& WithServiceSpecificCredential(ServiceSpecificCredential&& value) { SetServiceSpecificCredential(std::move(value)); return *this;}

    inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }

    inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }

    inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }

    inline ResetServiceSpecificCredentialResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}

    inline ResetServiceSpecificCredentialResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}

  private:
    ServiceSpecificCredential m_serviceSpecificCredential;
    ResponseMetadata m_responseMetadata;
  };

} // namespace Model
} // namespace IAM
} // namespace Aws


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var Canvas_1 = require("./Canvas");
var EventListeners_1 = require("../Utils/EventListeners");
var Particles_1 = require("./Particles");
var Retina_1 = require("./Retina");
var PolygonMask_1 = require("../Plugins/PolygonMask");
var FrameManager_1 = require("./FrameManager");
var Options_1 = require("../Options/Classes/Options");
var Presets_1 = require("../Utils/Presets");
var CanvasUtils_1 = require("../Utils/CanvasUtils");
var Utils_1 = require("../Utils/Utils");
var ClickMode_1 = require("../Enums/Modes/ClickMode");
var Absorbers_1 = require("../Plugins/Absorbers");
var Emitters_1 = require("../Plugins/Emitters");
var Container = (function () {
    function Container(id, params) {
        var presets = [];
        for (var _i = 2; _i < arguments.length; _i++) {
            presets[_i - 2] = arguments[_i];
        }
        this.started = false;
        this.destroyed = false;
        this.id = id;
        this.paused = true;
        this.sourceOptions = params;
        this.lastFrameTime = 0;
        this.pageHidden = false;
        this.retina = new Retina_1.Retina(this);
        this.canvas = new Canvas_1.Canvas(this);
        this.particles = new Particles_1.Particles(this);
        this.drawer = new FrameManager_1.FrameManager(this);
        this.interactivity = {
            mouse: {},
        };
        this.bubble = {};
        this.repulse = { particles: [] };
        this.plugins = [];
        this.drawers = {};
        this.options = new Options_1.Options();
        for (var _a = 0, presets_1 = presets; _a < presets_1.length; _a++) {
            var preset = presets_1[_a];
            this.options.load(Presets_1.Presets.getPreset(preset));
        }
        if (this.sourceOptions) {
            this.options.load(this.sourceOptions);
        }
        this.eventListeners = new EventListeners_1.EventListeners(this);
    }
    Container.requestFrame = function (callback) {
        return window.customRequestAnimationFrame(callback);
    };
    Container.cancelAnimation = function (handle) {
        window.cancelAnimationFrame(handle);
    };
    Container.prototype.play = function () {
        var _this = this;
        if (this.paused) {
            this.paused = false;
            for (var _i = 0, _a = this.plugins; _i < _a.length; _i++) {
                var plugin = _a[_i];
                if (plugin.play) {
                    plugin.play();
                }
            }
            this.lastFrameTime = performance.now();
        }
        this.drawAnimationFrame = Container.requestFrame(function (t) { return _this.drawer.nextFrame(t); });
    };
    Container.prototype.pause = function () {
        if (this.drawAnimationFrame !== undefined) {
            Container.cancelAnimation(this.drawAnimationFrame);
            delete this.drawAnimationFrame;
        }
        if (!this.paused) {
            for (var _i = 0, _a = this.plugins; _i < _a.length; _i++) {
                var plugin = _a[_i];
                if (plugin.pause) {
                    plugin.pause();
                }
            }
            if (!this.pageHidden) {
                this.paused = true;
            }
        }
    };
    Container.prototype.getAnimationStatus = function () {
        return !this.paused;
    };
    Container.prototype.densityAutoParticles = function () {
        if (!(this.canvas.element && this.options.particles.number.density.enable)) {
            return;
        }
        var area = this.canvas.element.width * this.canvas.element.height / 1000;
        if (this.retina.isRetina) {
            area /= this.retina.pixelRatio * 2;
        }
        var optParticlesNumber = this.options.particles.number.value;
        var density = this.options.particles.number.density.area;
        var particlesNumber = area * optParticlesNumber / density;
        var particlesCount = this.particles.count;
        if (particlesCount < particlesNumber) {
            this.particles.push(Math.abs(particlesNumber - particlesCount));
        }
        else if (particlesCount > particlesNumber) {
            this.particles.removeQuantity(particlesCount - particlesNumber);
        }
    };
    Container.prototype.destroy = function () {
        this.stop();
        this.retina.reset();
        this.canvas.destroy();
        delete this.interactivity;
        delete this.options;
        delete this.retina;
        delete this.canvas;
        delete this.particles;
        delete this.bubble;
        delete this.repulse;
        delete this.drawer;
        delete this.eventListeners;
        for (var type in this.drawers) {
            var drawer = this.drawers[type];
            if (drawer.destroy !== undefined) {
                drawer.destroy(this);
            }
        }
        this.drawers = {};
        this.destroyed = true;
    };
    Container.prototype.exportImg = function (callback) {
        this.exportImage(callback);
    };
    Container.prototype.exportImage = function (callback, type, quality) {
        var _a;
        return (_a = this.canvas.element) === null || _a === void 0 ? void 0 : _a.toBlob(callback, type !== null && type !== void 0 ? type : "image/png", quality);
    };
    Container.prototype.exportConfiguration = function () {
        return JSON.stringify(this.options, undefined, 2);
    };
    Container.prototype.refresh = function () {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        this.stop();
                        return [4, this.start()];
                    case 1:
                        _a.sent();
                        return [2];
                }
            });
        });
    };
    Container.prototype.stop = function () {
        if (!this.started) {
            return;
        }
        this.started = false;
        this.eventListeners.removeListeners();
        this.pause();
        this.particles.clear();
        this.retina.reset();
        this.canvas.clear();
        for (var _i = 0, _a = this.plugins; _i < _a.length; _i++) {
            var plugin = _a[_i];
            if (plugin.stop !== undefined) {
                plugin.stop();
            }
        }
        this.plugins = [];
        delete this.particles.lineLinkedColor;
    };
    Container.prototype.start = function () {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var absorbers, loadAbsorbers, emitters, loadEmitters, _i, _a, plugin, _b, _c, type, type, _d, _e, _f, type, drawer;
            return tslib_1.__generator(this, function (_g) {
                switch (_g.label) {
                    case 0:
                        if (this.started) {
                            return [2];
                        }
                        if (this.options.polygon.enable) {
                            this.plugins.push(new PolygonMask_1.PolygonMask(this));
                        }
                        absorbers = this.options.absorbers;
                        loadAbsorbers = false;
                        if (absorbers instanceof Array) {
                            if (absorbers.length) {
                                loadAbsorbers = true;
                            }
                        }
                        else if (absorbers !== undefined) {
                            loadAbsorbers = true;
                        }
                        else if (Utils_1.Utils.isInArray(ClickMode_1.ClickMode.absorber, this.options.interactivity.events.onClick.mode)) {
                            loadAbsorbers = true;
                        }
                        if (loadAbsorbers) {
                            this.plugins.push(new Absorbers_1.Absorbers(this));
                        }
                        emitters = this.options.emitters;
                        loadEmitters = false;
                        if (emitters instanceof Array) {
                            if (emitters.length) {
                                loadEmitters = true;
                            }
                        }
                        else if (emitters !== undefined) {
                            loadEmitters = true;
                        }
                        else if (Utils_1.Utils.isInArray(ClickMode_1.ClickMode.absorber, this.options.interactivity.events.onClick.mode)) {
                            loadEmitters = true;
                        }
                        if (loadEmitters) {
                            this.plugins.push(new Emitters_1.Emitters(this));
                        }
                        this.started = true;
                        this.eventListeners.addListeners();
                        _i = 0, _a = this.plugins;
                        _g.label = 1;
                    case 1:
                        if (!(_i < _a.length)) return [3, 5];
                        plugin = _a[_i];
                        if (!(plugin.startAsync !== undefined)) return [3, 3];
                        return [4, plugin.startAsync()];
                    case 2:
                        _g.sent();
                        return [3, 4];
                    case 3:
                        if (plugin.start !== undefined) {
                            plugin.start();
                        }
                        _g.label = 4;
                    case 4:
                        _i++;
                        return [3, 1];
                    case 5:
                        if (this.options.particles.shape.type instanceof Array) {
                            for (_b = 0, _c = this.options.particles.shape.type; _b < _c.length; _b++) {
                                type = _c[_b];
                                this.drawers[type] = CanvasUtils_1.CanvasUtils.getShapeDrawer(type);
                            }
                        }
                        else {
                            type = this.options.particles.shape.type;
                            this.drawers[type] = CanvasUtils_1.CanvasUtils.getShapeDrawer(type);
                        }
                        _d = [];
                        for (_e in this.drawers)
                            _d.push(_e);
                        _f = 0;
                        _g.label = 6;
                    case 6:
                        if (!(_f < _d.length)) return [3, 9];
                        type = _d[_f];
                        drawer = this.drawers[type];
                        if (!(drawer.init !== undefined)) return [3, 8];
                        return [4, drawer.init(this)];
                    case 7:
                        _g.sent();
                        _g.label = 8;
                    case 8:
                        _f++;
                        return [3, 6];
                    case 9:
                        this.init();
                        this.play();
                        return [2];
                }
            });
        });
    };
    Container.prototype.init = function () {
        this.retina.init();
        this.canvas.init();
        this.particles.init();
        for (var _i = 0, _a = this.plugins; _i < _a.length; _i++) {
            var plugin = _a[_i];
            if (plugin.init !== undefined) {
                plugin.init();
            }
        }
        this.densityAutoParticles();
    };
    return Container;
}());
exports.Container = Container;


text:
using namespace mfem;

#include "sdl.hpp"
#include "gl/types.hpp"
#include "vsdata.hpp"

#include <map>

// Visualization header file

class VisualizationSceneSolution : public VisualizationSceneScalarData
{
protected:
   Vector *v_normals;
   GridFunction *rsol;

   int drawmesh, drawelems, drawnums, draworder;
   int drawbdr, draw_cp;

   int refine_func = 0;

   double minv_sol, maxv_sol;
   bool have_sol_range = false; // true when minv_sol and maxv_sol are set

   int TimesToRefine, EdgeRefineFactor;

   gl3::GlDrawable disp_buf;

   bool e_nums_buf_ready = false;
   bool v_nums_buf_ready = false;
   bool f_nums_buf_ready = false;
   gl3::GlDrawable e_nums_buf;
   gl3::GlDrawable v_nums_buf;
   gl3::GlDrawable f_nums_buf;

   gl3::GlDrawable lcurve_buf;
   gl3::GlDrawable line_buf;
   gl3::GlDrawable bdr_buf;
   gl3::GlDrawable cp_buf;

   gl3::GlDrawable order_buf;
   gl3::GlDrawable order_noarrow_buf;

   void Init();

   void FindNewBox(double rx[], double ry[], double rval[]);

   void DrawCPLine(gl3::GlBuilder& bld,
                   DenseMatrix &pointmat, Vector &values, Array<int> &ind);

   void GetRefinedDetJ(int i, const IntegrationRule &ir,
                       Vector &vals, DenseMatrix &tr);

   // redefined for vector solution
   virtual void GetRefinedValues(int i, const IntegrationRule &ir,
                                 Vector &vals, DenseMatrix &tr);
   virtual int GetRefinedValuesAndNormals(int i, const IntegrationRule &ir,
                                          Vector &vals, DenseMatrix &tr,
                                          DenseMatrix &normals);

   void DrawLevelCurves(gl3::GlBuilder& buf, Array<int> &RG, DenseMatrix &pointmat,
                        Vector &values, int sides, Array<double> &lvl,
                        int flat = 0);

   int GetAutoRefineFactor();

   // Used for drawing markers for element and vertex numbering
   double GetElementLengthScale(int k);

public:
   int shading;

   int attr_to_show, bdr_attr_to_show;
   Array<int> el_attr_to_show, bdr_el_attr_to_show;

   VisualizationSceneSolution();
   VisualizationSceneSolution(Mesh &m, Vector &s, Vector *normals = NULL);

   virtual ~VisualizationSceneSolution();

   virtual std::string GetHelpString() const;

   void SetGridFunction(GridFunction & u) { rsol = &u; }

   void NewMeshAndSolution(Mesh *new_m, Vector *new_sol,
                           GridFunction *new_u = NULL);

   virtual void SetNewScalingFromBox();
   virtual void FindNewBox(bool prepare);
   virtual void FindNewValueRange(bool prepare);
   virtual void FindNewBoxAndValueRange(bool prepare)
   { FindNewBox(prepare); }
   virtual void FindMeshBox(bool prepare);

   virtual void ToggleLogscale(bool print);
   virtual void EventUpdateBackground();
   virtual void EventUpdateColors();
   virtual void UpdateLevelLines() { PrepareLevelCurves(); }
   virtual void UpdateValueRange(bool prepare);

   void PrepareWithNormals();
   void PrepareFlat();
   void PrepareFlat2();

   virtual void PrepareLines();
   void PrepareLines2();
   void PrepareLines3();

   virtual void Prepare();
   void PrepareLevelCurves();
   void PrepareLevelCurves2();

   void PrepareBoundary();

   void PrepareOrderingCurve();
   void PrepareOrderingCurve1(gl3::GlDrawable& buf, bool arrows, bool color);

   void PrepareNumbering(bool invalidate = true);
   void PrepareElementNumbering();
   void PrepareElementNumbering1();
   void PrepareElementNumbering2();
   void PrepareVertexNumbering();
   void PrepareVertexNumbering1();
   void PrepareVertexNumbering2();
   void PrepareEdgeNumbering();

   void PrepareCP();

   virtual gl3::SceneInfo GetSceneObjs();

   void glTF_ExportBoundary(glTF_Builder &bld,
                            glTF_Builder::buffer_id buffer,
                            glTF_Builder::material_id black_mat);
   virtual void glTF_Export();

   void ToggleDrawBdr();

   virtual void ToggleDrawElems();

   void ToggleDrawMesh() { drawmesh = (drawmesh+1)%3; }

   // 0 - none, 1 - no arrows (color), 2 - with arrows (color),
   //           3 - no arrows (black), 4 - with arrows (black)
   void ToggleDrawOrdering() { draworder = (draworder+1)%5; }

   // 0 - none, 1 - elements, 2 - edges, 3 - vertices
   void ToggleDrawNumberings()
   {
      drawnums = (drawnums+1)%4;
      PrepareNumbering(false);
   }

   virtual void SetShading(int, bool);
   void ToggleShading();

   void ToggleDrawCP() { draw_cp = !draw_cp; PrepareCP(); }

   void ToggleRefinements();
   void ToggleRefinementFunction();

   virtual void SetRefineFactors(int, int);
   virtual void AutoRefine();
   virtual void ToggleAttributes(Array<int> &attr_list);

   virtual void SetDrawMesh(int i) { drawmesh = i % 3; }
   virtual int GetShading() { return shading; }
   virtual int GetDrawMesh() { return drawmesh; }
};

void DrawNumberedMarker(gl3::GlDrawable& buff, const double x[3], double dx,
                        int n);

#endif


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindUsages;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Remote;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.SymbolMapping;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.InheritanceMargin
{
    using SymbolAndLineNumberArray = ImmutableArray<(ISymbol symbol, int lineNumber)>;

    internal abstract partial class AbstractInheritanceMarginService : IInheritanceMarginService
    {
        /// <summary>
        /// Given the syntax nodes to search,
        /// get all the method, event, property and type declaration syntax nodes.
        /// </summary>
        protected abstract ImmutableArray<SyntaxNode> GetMembers(IEnumerable<SyntaxNode> nodesToSearch);

        /// <summary>
        /// Get the token that represents declaration node.
        /// e.g. Identifier for method/property/event and this keyword for indexer.
        /// </summary>
        protected abstract SyntaxToken GetDeclarationToken(SyntaxNode declarationNode);

        protected abstract string GlobalImportsTitle { get; }

        public async ValueTask<ImmutableArray<InheritanceMarginItem>> GetInheritanceMemberItemsAsync(
            Document document,
            TextSpan spanToSearch,
            bool includeGlobalImports,
            bool frozenPartialSemantics,
            CancellationToken cancellationToken)
        {
            var solution = document.Project.Solution;
            var remoteClient = await RemoteHostClient.TryGetClientAsync(solution.Workspace.Services, cancellationToken).ConfigureAwait(false);
            if (remoteClient != null)
            {
                // Also, make it clear to the remote side that they should be using frozen semantics, just like we are.
                // we want results quickly, without waiting for the entire source generator pass to run.  The user will still get
                // accurate results in the future because taggers are set to recompute when compilations are fully
                // available on the OOP side.
                var result = await remoteClient.TryInvokeAsync<IRemoteInheritanceMarginService, ImmutableArray<InheritanceMarginItem>>(
                    solution,
                    (service, solutionInfo, cancellationToken) =>
                        service.GetInheritanceMarginItemsAsync(solutionInfo, document.Id, spanToSearch, includeGlobalImports: includeGlobalImports, frozenPartialSemantics: frozenPartialSemantics, cancellationToken),
                    cancellationToken).ConfigureAwait(false);

                if (!result.HasValue)
                {
                    return ImmutableArray<InheritanceMarginItem>.Empty;
                }

                return result.Value;
            }
            else
            {
                return await GetInheritanceMarginItemsInProcessAsync(
                    document,
                    spanToSearch,
                    includeGlobalImports: includeGlobalImports,
                    frozenPartialSemantics: frozenPartialSemantics,
                    cancellationToken).ConfigureAwait(false);
            }
        }

        private static bool CanHaveInheritanceTarget(ISymbol symbol)
        {
            if (symbol is INamedTypeSymbol namedType)
            {
                return !symbol.IsStatic && namedType.TypeKind is TypeKind.Interface or TypeKind.Class or TypeKind.Struct;
            }

            if (symbol is IEventSymbol or IPropertySymbol
                or IMethodSymbol
                {
                    MethodKind: MethodKind.Ordinary or MethodKind.ExplicitInterfaceImplementation or MethodKind.UserDefinedOperator or MethodKind.Conversion
                })
            {
                return true;
            }

            return false;
        }
    }
}