text:
#ifndef ROCKETCOREFONTDATABASE_H
#define ROCKETCOREFONTDATABASE_H

#include <Rocket/Core/StringUtilities.h>
#include <Rocket/Core/Header.h>
#include <Rocket/Core/Font.h>

namespace Rocket {
namespace Core {

class FontEffect;
class FontFamily;
class FontFaceHandle;
class PropertyDictionary;

/**
	The font database contains all font families currently in use by Rocket.

	@author Peter Curry
 */

class ROCKETCORE_API FontDatabase
{
public:
	static bool Initialise();
	static void Shutdown();

	/// Adds a new font face to the database. The face's family, style and weight will be determined from the face itself.
	/// @param[in] file_name The file to load the face from.
	/// @return True if the face was loaded successfully, false otherwise.
	static bool LoadFontFace(const String& file_name);
	/// Adds a new font face to the database, ignoring any family, style and weight information stored in the face itself.
	/// @param[in] file_name The file to load the face from.
	/// @param[in] family The family to add the face to.
	/// @param[in] style The style of the face (normal or italic).
	/// @param[in] weight The weight of the face (normal or bold).
	/// @return True if the face was loaded successfully, false otherwise.
	static bool LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight);
	/// Adds a new font face to the database, loading from memory.
	/// @param[in] data The font data.
	/// @param[in] data_length Length of the data.
	/// @param[in] family The family to add the face to.
	/// @param[in] style The style of the face (normal or italic).
	/// @param[in] weight The weight of the face (normal or bold).
	/// @return True if the face was loaded successfully, false otherwise.
	static bool LoadFontFace(const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight);

	/// Returns a handle to a font face that can be used to position and render text. This will return the closest match
	/// it can find, but in the event a font family is requested that does not exist, NULL will be returned instead of a
	/// valid handle.
	/// @param[in] family The family of the desired font handle.
	/// @param[in] charset The set of characters required in the font face, as a comma-separated list of unicode ranges.
	/// @param[in] style The style of the desired font handle.
	/// @param[in] weight The weight of the desired font handle.
	/// @param[in] size The size of desired handle, in points.
	/// @return A valid handle if a matching (or closely matching) font face was found, NULL otherwise.
	static FontFaceHandle* GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size);

	/// Returns a font effect, either a newly-instanced effect from the factory or an identical
	/// shared effect.
	/// @param[in] name The name of the desired font effect type.
	/// @param[in] properties The properties associated with the font effect.
	/// @return The requested font effect, or NULL if the font effect could not be found or instanced.
	static FontEffect* GetFontEffect(const String& name, const PropertyDictionary& properties);

	/// Removes a font effect from the font database's cache.
	/// @param[in] The effect to release.
	static void ReleaseFontEffect(const FontEffect* effect);

private:
	FontDatabase(void);
	~FontDatabase(void);

	// Adds a loaded face to the appropriate font family.
	bool AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream);
	// Loads a FreeType face.
	void* LoadFace(const String& file_name);
	// Loads a FreeType face from memory.
	void* LoadFace(const byte* data, int data_length, const String& source, bool local_data);

	typedef std::map< String, FontFamily*, StringUtilities::StringComparei > FontFamilyMap;
	FontFamilyMap font_families;

	static FontDatabase* instance;
};

}
}

#endif


text:
package net.shared.distributed.receptor;

import com.esotericsoftware.kryonet.Connection;
import com.esotericsoftware.kryonet.Listener;
import com.esotericsoftware.kryonet.Server;
import net.shared.distributed.CoreStart;
import net.shared.distributed.capabilities.CapabilityPacket;
import net.shared.distributed.core.Core;
import net.shared.distributed.distributor.Distributor;
import net.shared.distributed.event.NodeConnectedEvent;
import net.shared.distributed.event.NodeDisconnectedEvent;
import net.shared.distributed.api.logging.Logger;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.function.BiConsumer;

import static net.shared.distributed.Registry.RegisterKryoClasses;

/**
 * Created by Guy on 16/05/2017.
 */
public class Receptor {

    public final Core core;
    public final Distributor distributor;
    protected Map<Integer, Server> portSockets;
    protected Map<Server, Thread> serverThreads;

    public Receptor(Core core, Distributor distributor) {
        this.core = core;
        this.distributor = distributor;
        portSockets = new HashMap<>();
        serverThreads = new HashMap<>();
    }

    public void StartListening(int tcp, int udp, BiConsumer<Connection, Object> received) throws IOException {
        StartListening(tcp, udp, new Listener(){
            @Override
            public void received(Connection connection, Object object) {
                received.accept(connection, object);
            }
        });
    }

    public void StartListening(int tcp, int udp, Listener listener) throws IOException {
        Server server = new Server();
        RegisterKryoClasses(server.getKryo());
        server.start();
        server.bind(tcp);
        server.addListener(new Listener() {
            @Override
            public void connected(Connection connection) {
                Logger.instance().Info(connection.getID() + " connected");
                CoreStart.distributor.nodeSockets.put(connection.getID(), connection);
                CoreStart.distributor.nodeCapabilities.put(connection.getID(), new LinkedHashSet<>());
                listener.connected(connection);

                new NodeConnectedEvent(connection.getID()).Fire();

                CapabilityPacket.Request req = new CapabilityPacket.Request();
                connection.sendTCP(req);
            }

            @Override
            public void disconnected(Connection connection) {
                Logger.instance().Warn(connection.getID() + " disconnected");
                CoreStart.distributor.nodeSockets.remove(connection.getID());
                new NodeDisconnectedEvent(connection.getID()).Fire();
                listener.disconnected(connection);
            }

            @Override
            public void received(Connection connection, Object object) {
                listener.received(connection, object);
            }

            @Override
            public void idle(Connection connection) {
                listener.idle(connection);
            }
        });

        portSockets.put(tcp, server);
        serverThreads.put(server, server.getUpdateThread());
    }

    public void StopListening(int port) {
        if(!portSockets.containsKey(port)) return;
        Server s = portSockets.get(port);
        s.stop();
        portSockets.remove(port);
        serverThreads.remove(s);
    }

    public static class ServerSocketWrapper {
        public ServerSocket socket;
        public BiConsumer<Socket, Object> func;
        public boolean isAlive;
        public String name;
        public Thread thread;

        public ServerSocketWrapper(ServerSocket socket, BiConsumer<Socket, Object> func) {
            this(socket, func, "");
        }

        public ServerSocketWrapper(ServerSocket socket, BiConsumer<Socket, Object> func, String name) {
            this.socket = socket;
            this.func = func;
            this.name = name;
            this.thread = new Thread(this::Process, this.name);
            this.isAlive = true;
        }

        public ServerSocketWrapper Start() {
            this.thread.start();
            return this;
        }

        @Deprecated
        public void Process() {
//            ObjectOutputStream oos = null;
//            ObjectInputStream ois = null;
//            Socket skt = null;
//            while(this.isAlive) {
//                try {
//                    skt = socket.accept();
//                    if(skt == null) continue;
//                    Logger.instance().Debug("Socket connected: "+skt.getInetAddress());
//                    Distributor.NodeSocketKey key = new Distributor.NodeSocketKey(skt.getInetAddress(), skt.getPort());
//                    CoreStart.distributor.nodeSockets.put(key, skt);
//
//                    oos = new ObjectOutputStream(skt.getOutputStream());
//                    oos.flush();
//                    Logger.instance().Debug("Output stream constructed");
//                    oos.writeChars("NOTIFICATION:CONNECTED\n");
//
//                    ois = new ObjectInputStream(skt.getInputStream());
//                    Logger.instance().Debug("Input stream constructed");
//
//
//                    Object obj = ois.readObject();
//
//                    oos.writeChars("NOTIFICATION:RECEIVED\n");
//
//                    Logger.instance().Info("Received data from "+skt.getInetAddress()+":"+skt.getPort());
//                    Logger.instance().Debug(obj.toString());
//
//                    this.func.accept(skt, obj);
//                } catch (Exception e) {
//                    e.printStackTrace();
//                } finally {
//                    try {
//
//                        if(oos != null) {
//                            oos.flush();
//                            oos = null;
//                        }
//
//                        if(ois != null) {
//                            ois = null;
//                        }
//
//                        skt = null;
//
//                    } catch (IOException e) {
//                        e.printStackTrace();
//                    }
//                }
//            }
//            try {
//                this.socket.close();
//                this.socket = null;
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
        }

        public void Kill() {
            this.isAlive = false;
        }
    }

}

redpajama_set_name: RedPajamaGithub


text:
package org.sakaiproject.user.api;

/**
 * <p>
 * UserNotDefinedException is thrown whenever an attempt is made to access a user with an id that is not defined.
 * </p>
 */
public class UserNotDefinedException extends Exception
{
	private String m_id = null;

	public UserNotDefinedException(String id)
	{
		m_id = id;

	}

	public String getId()
	{
		return m_id;
	}

	public String toString()
	{
		return super.toString() + " id=" + m_id;
	}
}


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.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Shared.Collections;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.FindSymbols.Finders
{
    internal abstract partial class AbstractReferenceFinder : IReferenceFinder
    {
        public const string ContainingTypeInfoPropertyName = "ContainingTypeInfo";
        public const string ContainingMemberInfoPropertyName = "ContainingMemberInfo";

        public abstract Task<ImmutableArray<(ISymbol symbol, FindReferencesCascadeDirection cascadeDirection)>> DetermineCascadedSymbolsAsync(
            ISymbol symbol, Solution solution, IImmutableSet<Project>? projects,
            FindReferencesSearchOptions options, FindReferencesCascadeDirection cascadeDirection,
            CancellationToken cancellationToken);

        public abstract Task<ImmutableArray<Project>> DetermineProjectsToSearchAsync(ISymbol symbol, Solution solution, IImmutableSet<Project>? projects, CancellationToken cancellationToken);

        public abstract Task<ImmutableArray<Document>> DetermineDocumentsToSearchAsync(
            ISymbol symbol, Project project, IImmutableSet<Document>? documents, FindReferencesSearchOptions options, CancellationToken cancellationToken);

        public abstract ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            ISymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken);

        protected static bool TryGetNameWithoutAttributeSuffix(
            string name,
            ISyntaxFactsService syntaxFacts,
            [NotNullWhen(returnValue: true)] out string? result)
        {
            return name.TryGetWithoutAttributeSuffix(syntaxFacts.IsCaseSensitive, out result);
        }

        protected static async Task<ImmutableArray<Document>> FindDocumentsAsync(Project project, IImmutableSet<Document>? scope, Func<Document, CancellationToken, Task<bool>> predicateAsync, CancellationToken cancellationToken)
        {
            // special case for HR
            if (scope != null && scope.Count == 1)
            {
                var document = scope.First();
                if (document.Project == project)
                {
                    return scope.ToImmutableArray();
                }

                return ImmutableArray<Document>.Empty;
            }

            var documents = ArrayBuilder<Document>.GetInstance();
            foreach (var document in await project.GetAllRegularAndSourceGeneratedDocumentsAsync(cancellationToken).ConfigureAwait(false))
            {
                if (scope != null && !scope.Contains(document))
                {
                    continue;
                }

                if (await predicateAsync(document, cancellationToken).ConfigureAwait(false))
                {
                    documents.Add(document);
                }
            }

            return documents.ToImmutableAndFree();
        }

        /// <summary>
        /// Finds all the documents in the provided project that contain the requested string
        /// values
        /// </summary>
        protected static Task<ImmutableArray<Document>> FindDocumentsAsync(
            Project project,
            IImmutableSet<Document>? documents,
            bool findInGlobalSuppressions,
            CancellationToken cancellationToken,
            params string[] values)
        {
            return FindDocumentsAsync(project, documents, async (d, c) =>
            {
                var info = await SyntaxTreeIndex.GetRequiredIndexAsync(d, c).ConfigureAwait(false);
                if (findInGlobalSuppressions && info.ContainsGlobalAttributes)
                {
                    return true;
                }

                foreach (var value in values)
                {
                    if (!info.ProbablyContainsIdentifier(value))
                    {
                        return false;
                    }
                }

                return true;
            }, cancellationToken);
        }

        protected static Task<ImmutableArray<Document>> FindDocumentsAsync(
            Project project,
            IImmutableSet<Document>? documents,
            PredefinedType predefinedType,
            CancellationToken cancellationToken)
        {
            if (predefinedType == PredefinedType.None)
            {
                return SpecializedTasks.EmptyImmutableArray<Document>();
            }

            return FindDocumentsAsync(project, documents, async (d, c) =>
            {
                var info = await SyntaxTreeIndex.GetRequiredIndexAsync(d, c).ConfigureAwait(false);
                return info.ContainsPredefinedType(predefinedType);
            }, cancellationToken);
        }

        protected static Task<ImmutableArray<Document>> FindDocumentsAsync(
            Project project,
            IImmutableSet<Document>? documents,
            PredefinedOperator op,
            CancellationToken cancellationToken)
        {
            if (op == PredefinedOperator.None)
            {
                return SpecializedTasks.EmptyImmutableArray<Document>();
            }

            return FindDocumentsAsync(project, documents, async (d, c) =>
            {
                var info = await SyntaxTreeIndex.GetRequiredIndexAsync(d, c).ConfigureAwait(false);

                // NOTE: Predefined operators can be referenced in global suppression attributes.
                return info.ContainsPredefinedOperator(op) || info.ContainsGlobalAttributes;
            }, cancellationToken);
        }

        protected static bool IdentifiersMatch(ISyntaxFactsService syntaxFacts, string name, SyntaxToken token)
            => syntaxFacts.IsIdentifier(token) && syntaxFacts.TextMatch(token.ValueText, name);

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentUsingIdentifierAsync(
            ISymbol symbol,
            string identifier,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentUsingIdentifierAsync(
                symbol, identifier, document, semanticModel, findParentNode: null,
                cancellationToken: cancellationToken);
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentUsingIdentifierAsync(
            ISymbol symbol,
            string identifier,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, SyntaxNode>? findParentNode,
            CancellationToken cancellationToken)
        {
            var symbolsMatch = GetStandardSymbolsMatchFunction(symbol, findParentNode, document.Project.Solution, cancellationToken);
            return FindReferencesInDocumentUsingIdentifierAsync(
                symbol, identifier, document, semanticModel, symbolsMatch, cancellationToken);
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentUsingIdentifierAsync(
            ISymbol symbol,
            string identifier,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> symbolsMatchAsync,
            CancellationToken cancellationToken)
        {
            var findInGlobalSuppressions = ShouldFindReferencesInGlobalSuppressions(symbol, out var docCommentId);
            return FindReferencesInDocumentUsingIdentifierAsync(
                identifier, document, semanticModel, symbolsMatchAsync,
                docCommentId, findInGlobalSuppressions, cancellationToken);
        }

        [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", OftenCompletesSynchronously = true)]
        protected static async ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentUsingIdentifierAsync(
            string identifier,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> symbolsMatchAsync,
            string? docCommentId,
            bool findInGlobalSuppressions,
            CancellationToken cancellationToken)
        {
            var tokens = await GetIdentifierOrGlobalNamespaceTokensWithTextAsync(document, semanticModel, identifier, cancellationToken).ConfigureAwait(false);

            var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();

            var references = await FindReferencesInTokensAsync(
                document,
                semanticModel,
                tokens,
                t => IdentifiersMatch(syntaxFacts, identifier, t),
                symbolsMatchAsync,
                cancellationToken).ConfigureAwait(false);

            if (!findInGlobalSuppressions)
                return references;

            RoslynDebug.Assert(docCommentId != null);
            var referencesInGlobalSuppressions = await FindReferencesInDocumentInsideGlobalSuppressionsAsync(
                document, semanticModel, syntaxFacts, docCommentId, cancellationToken).ConfigureAwait(false);
            return references.AddRange(referencesInGlobalSuppressions);
        }

        protected static async Task<ImmutableArray<SyntaxToken>> GetIdentifierOrGlobalNamespaceTokensWithTextAsync(Document document, SemanticModel semanticModel, string identifier, CancellationToken cancellationToken)
        {
            // It's very costly to walk an entire tree.  So if the tree is simple and doesn't contain
            // any unicode escapes in it, then we do simple string matching to find the tokens.
            var info = await SyntaxTreeIndex.GetRequiredIndexAsync(document, cancellationToken).ConfigureAwait(false);
            if (!info.ProbablyContainsIdentifier(identifier))
                return ImmutableArray<SyntaxToken>.Empty;

            var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
            if (syntaxFacts == null)
                return ImmutableArray<SyntaxToken>.Empty;

            var root = await semanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);

            SourceText? text = null;
            if (!info.ProbablyContainsEscapedIdentifier(identifier))
                text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);

            return FindReferenceCache.GetIdentifierOrGlobalNamespaceTokensWithText(
                syntaxFacts, semanticModel, root, text, identifier, cancellationToken);
        }

        protected static Func<SyntaxToken, SyntaxNode>? GetNamedTypeOrConstructorFindParentNodeFunction(Document document, ISymbol searchSymbol)
        {
            // delegates don't have exposed symbols for their constructors.  so when you do `new MyDel()`, that's only a
            // reference to a type (as we don't have any real constructor symbols that can actually cascade to).  So
            // don't do any special finding in that case.
            if (searchSymbol.IsDelegateType())
                return null;

            var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
            return t => syntaxFacts.TryGetBindableParent(t) ?? t.Parent!;
        }

        protected static Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> GetStandardSymbolsMatchFunction(
            ISymbol symbol, Func<SyntaxToken, SyntaxNode>? findParentNode, Solution solution, CancellationToken cancellationToken)
        {
            var nodeMatchAsync = GetStandardSymbolsNodeMatchFunction(symbol, solution, cancellationToken);
            findParentNode ??= t => t.Parent!;
            return (token, model) => nodeMatchAsync(findParentNode(token), model);
        }

        protected static Func<SyntaxNode, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> GetStandardSymbolsNodeMatchFunction(
            ISymbol searchSymbol, Solution solution, CancellationToken cancellationToken)
        {
            return async (node, model) =>
            {
                var symbolInfoToMatch = FindReferenceCache.GetSymbolInfo(model, node, cancellationToken);

                var symbolToMatch = symbolInfoToMatch.Symbol;
                var symbolToMatchCompilation = model.Compilation;

                if (await SymbolFinder.OriginalSymbolsMatchAsync(solution, searchSymbol, symbolInfoToMatch.Symbol, cancellationToken).ConfigureAwait(false))
                {
                    return (matched: true, CandidateReason.None);
                }
                else if (await symbolInfoToMatch.CandidateSymbols.AnyAsync(static (s, arg) => SymbolFinder.OriginalSymbolsMatchAsync(arg.solution, arg.searchSymbol, s, arg.cancellationToken), (solution, searchSymbol, cancellationToken)).ConfigureAwait(false))
                {
                    return (matched: true, symbolInfoToMatch.CandidateReason);
                }
                else
                {
                    return (matched: false, CandidateReason.None);
                }
            };
        }

        protected static async ValueTask<ImmutableArray<FinderLocation>> FindReferencesInTokensAsync(
            Document document,
            SemanticModel semanticModel,
            IEnumerable<SyntaxToken> tokens,
            Func<SyntaxToken, bool> tokensMatch,
            Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> symbolsMatchAsync,
            CancellationToken cancellationToken)
        {
            var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
            var semanticFacts = document.GetRequiredLanguageService<ISemanticFactsService>();

            var locations = ArrayBuilder<FinderLocation>.GetInstance();
            foreach (var token in tokens)
            {
                cancellationToken.ThrowIfCancellationRequested();

                if (tokensMatch(token))
                {
                    var (matched, reason) = await symbolsMatchAsync(token, semanticModel).ConfigureAwait(false);
                    if (matched)
                    {
                        RoslynDebug.Assert(token.Parent != null);

                        var alias = FindReferenceCache.GetAliasInfo(semanticFacts, semanticModel, token, cancellationToken);

                        var location = token.GetLocation();
                        var symbolUsageInfo = GetSymbolUsageInfo(token.Parent, semanticModel, syntaxFacts, semanticFacts, cancellationToken);

                        locations.Add(new FinderLocation(token.Parent, new ReferenceLocation(
                            document, alias, location, isImplicit: false,
                            symbolUsageInfo, GetAdditionalFindUsagesProperties(token.Parent, semanticModel, syntaxFacts), candidateReason: reason)));
                    }
                }
            }

            return locations.ToImmutableAndFree();
        }

        private static IAliasSymbol? GetAliasSymbol(
            Document document,
            SemanticModel semanticModel,
            SyntaxNode node,
            CancellationToken cancellationToken)
        {
            var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
            if (syntaxFacts.IsRightSideOfQualifiedName(node))
                node = node.GetRequiredParent();

            if (syntaxFacts.IsUsingDirectiveName(node))
            {
                var directive = node.GetRequiredParent();

                // In the case of a same-named alias.  i.e. `using Console = System.Console;` we don't actually want
                // search for the alias.  We'll already be checking any references called 'Console' and will find them
                // as matches.
                if (semanticModel.GetDeclaredSymbol(directive, cancellationToken) is IAliasSymbol aliasSymbol &&
                    !syntaxFacts.StringComparer.Equals(aliasSymbol.Name, aliasSymbol.Target.Name))
                {
                    return aliasSymbol;
                }
            }

            return null;
        }

        protected static Task<ImmutableArray<FinderLocation>> FindAliasReferencesAsync(
            ImmutableArray<FinderLocation> nonAliasReferences,
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindAliasReferencesAsync(
                nonAliasReferences, symbol, document, semanticModel,
                findParentNode: null, cancellationToken: cancellationToken);
        }

        protected static async Task<ImmutableArray<FinderLocation>> FindAliasReferencesAsync(
            ImmutableArray<FinderLocation> nonAliasReferences,
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, SyntaxNode>? findParentNode,
            CancellationToken cancellationToken)
        {
            var aliasSymbols = GetAliasSymbols(document, semanticModel, nonAliasReferences, cancellationToken);
            return aliasSymbols.IsDefaultOrEmpty
                ? ImmutableArray<FinderLocation>.Empty
                : await FindReferencesThroughAliasSymbolsAsync(symbol, document, semanticModel, aliasSymbols, findParentNode, cancellationToken).ConfigureAwait(false);
        }

        protected static async Task<ImmutableArray<FinderLocation>> FindAliasReferencesAsync(
            ImmutableArray<FinderLocation> nonAliasReferences,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> symbolsMatchAsync,
            CancellationToken cancellationToken)
        {
            var aliasSymbols = GetAliasSymbols(document, semanticModel, nonAliasReferences, cancellationToken);
            return aliasSymbols.IsDefaultOrEmpty
                ? ImmutableArray<FinderLocation>.Empty
                : await FindReferencesThroughAliasSymbolsAsync(document, semanticModel, aliasSymbols, symbolsMatchAsync, cancellationToken).ConfigureAwait(false);
        }

        private static ImmutableArray<IAliasSymbol> GetAliasSymbols(
            Document document,
            SemanticModel semanticModel,
            ImmutableArray<FinderLocation> nonAliasReferences,
            CancellationToken cancellationToken)
        {
            using var aliasSymbols = TemporaryArray<IAliasSymbol>.Empty;
            foreach (var reference in nonAliasReferences)
            {
                var symbol = GetAliasSymbol(document, semanticModel, reference.Node, cancellationToken);
                if (symbol != null)
                    aliasSymbols.Add(symbol);
            }

            return aliasSymbols.ToImmutableAndClear();
        }

        private static async Task<ImmutableArray<FinderLocation>> FindReferencesThroughAliasSymbolsAsync(
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            ImmutableArray<IAliasSymbol> aliasSymbols,
            Func<SyntaxToken, SyntaxNode>? findParentNode,
            CancellationToken cancellationToken)
        {
            var syntaxFactsService = document.GetRequiredLanguageService<ISyntaxFactsService>();
            var allAliasReferences = ArrayBuilder<FinderLocation>.GetInstance();
            foreach (var aliasSymbol in aliasSymbols)
            {
                var aliasReferences = await FindReferencesInDocumentUsingIdentifierAsync(
                    symbol, aliasSymbol.Name, document, semanticModel, findParentNode, cancellationToken).ConfigureAwait(false);
                allAliasReferences.AddRange(aliasReferences);
                // the alias may reference an attribute and the alias name may end with an "Attribute" suffix. In this case search for the
                // shortened name as well (e.g. using GooAttribute = MyNamespace.GooAttribute; [Goo] class C1 {})
                if (TryGetNameWithoutAttributeSuffix(aliasSymbol.Name, syntaxFactsService, out var simpleName))
                {
                    aliasReferences = await FindReferencesInDocumentUsingIdentifierAsync(
                        symbol, simpleName, document, semanticModel, cancellationToken).ConfigureAwait(false);
                    allAliasReferences.AddRange(aliasReferences);
                }
            }

            return allAliasReferences.ToImmutableAndFree();
        }

        private static async Task<ImmutableArray<FinderLocation>> FindReferencesThroughAliasSymbolsAsync(
            Document document,
            SemanticModel semanticModel,
            ImmutableArray<IAliasSymbol> aliasSymbols,
            Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> symbolsMatchAsync,
            CancellationToken cancellationToken)
        {
            var syntaxFactsService = document.GetRequiredLanguageService<ISyntaxFactsService>();
            var allAliasReferences = ArrayBuilder<FinderLocation>.GetInstance();
            foreach (var aliasSymbol in aliasSymbols)
            {
                var findInGlobalSuppressions = ShouldFindReferencesInGlobalSuppressions(aliasSymbol, out var docCommentId);

                var aliasReferences = await FindReferencesInDocumentUsingIdentifierAsync(
                    aliasSymbol.Name, document, semanticModel, symbolsMatchAsync,
                    docCommentId, findInGlobalSuppressions, cancellationToken).ConfigureAwait(false);
                allAliasReferences.AddRange(aliasReferences);
                // the alias may reference an attribute and the alias name may end with an "Attribute" suffix. In this case search for the
                // shortened name as well (e.g. using GooAttribute = MyNamespace.GooAttribute; [Goo] class C1 {})
                if (TryGetNameWithoutAttributeSuffix(aliasSymbol.Name, syntaxFactsService, out var simpleName))
                {
                    aliasReferences = await FindReferencesInDocumentUsingIdentifierAsync(
                        simpleName, document, semanticModel, symbolsMatchAsync,
                        docCommentId, findInGlobalSuppressions, cancellationToken).ConfigureAwait(false);
                    allAliasReferences.AddRange(aliasReferences);
                }
            }

            return allAliasReferences.ToImmutableAndFree();
        }

        protected static Task<ImmutableArray<Document>> FindDocumentsWithPredicateAsync(Project project, IImmutableSet<Document>? documents, Func<SyntaxTreeIndex, bool> predicate, CancellationToken cancellationToken)
        {
            return FindDocumentsAsync(project, documents, async (d, c) =>
            {
                var info = await SyntaxTreeIndex.GetRequiredIndexAsync(d, c).ConfigureAwait(false);
                return predicate(info);
            }, cancellationToken);
        }

        protected static Task<ImmutableArray<Document>> FindDocumentsWithForEachStatementsAsync(Project project, IImmutableSet<Document>? documents, CancellationToken cancellationToken)
            => FindDocumentsWithPredicateAsync(project, documents, predicate: sti => sti.ContainsForEachStatement, cancellationToken);

        protected static Task<ImmutableArray<Document>> FindDocumentsWithDeconstructionAsync(Project project, IImmutableSet<Document>? documents, CancellationToken cancellationToken)
            => FindDocumentsWithPredicateAsync(project, documents, predicate: sti => sti.ContainsDeconstruction, cancellationToken);

        protected static Task<ImmutableArray<Document>> FindDocumentsWithAwaitExpressionAsync(Project project, IImmutableSet<Document>? documents, CancellationToken cancellationToken)
            => FindDocumentsWithPredicateAsync(project, documents, predicate: sti => sti.ContainsAwait, cancellationToken);

        protected static Task<ImmutableArray<Document>> FindDocumentsWithImplicitObjectCreationExpressionAsync(Project project, IImmutableSet<Document>? documents, CancellationToken cancellationToken)
            => FindDocumentsWithPredicateAsync(project, documents, predicate: sti => sti.ContainsImplicitObjectCreation, cancellationToken);

        /// <summary>
        /// If the `node` implicitly matches the `symbol`, then it will be added to `locations`.
        /// </summary>
        protected delegate void CollectMatchingReferences(ISymbol symbol, SyntaxNode node,
            ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder<FinderLocation> locations);

        protected static async Task<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            ISymbol symbol,
            Document document,
            Func<SyntaxTreeIndex, bool> isRelevantDocument,
            CollectMatchingReferences collectMatchingReferences,
            CancellationToken cancellationToken)
        {
            var syntaxTreeInfo = await SyntaxTreeIndex.GetRequiredIndexAsync(document, cancellationToken).ConfigureAwait(false);
            if (isRelevantDocument(syntaxTreeInfo))
            {
                var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
                var semanticFacts = document.GetRequiredLanguageService<ISemanticFactsService>();
                var syntaxRoot = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

                using var _ = ArrayBuilder<FinderLocation>.GetInstance(out var locations);

                var originalUnreducedSymbolDefinition = symbol.GetOriginalUnreducedDefinition();

                foreach (var node in syntaxRoot.DescendantNodesAndSelf())
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    collectMatchingReferences(originalUnreducedSymbolDefinition, node, syntaxFacts, semanticFacts, locations);
                }

                return locations.ToImmutable();
            }

            return ImmutableArray<FinderLocation>.Empty;
        }

        protected Task<ImmutableArray<FinderLocation>> FindReferencesInForEachStatementsAsync(
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentAsync(symbol, document, IsRelevantDocument, CollectMatchingReferences, cancellationToken);

            static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo)
                => syntaxTreeInfo.ContainsForEachStatement;

            void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node,
                ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder<FinderLocation> locations)
            {
                var info = semanticFacts.GetForEachSymbols(semanticModel, node);

                if (Matches(info.GetEnumeratorMethod, originalUnreducedSymbolDefinition) ||
                    Matches(info.MoveNextMethod, originalUnreducedSymbolDefinition) ||
                    Matches(info.CurrentProperty, originalUnreducedSymbolDefinition) ||
                    Matches(info.DisposeMethod, originalUnreducedSymbolDefinition))
                {
                    var location = node.GetFirstToken().GetLocation();
                    var symbolUsageInfo = GetSymbolUsageInfo(node, semanticModel, syntaxFacts, semanticFacts, cancellationToken);

                    locations.Add(new FinderLocation(node, new ReferenceLocation(
                        document,
                        alias: null,
                        location: location,
                        isImplicit: true,
                        symbolUsageInfo,
                        GetAdditionalFindUsagesProperties(node, semanticModel, syntaxFacts),
                        candidateReason: CandidateReason.None)));
                }
            }
        }

        protected Task<ImmutableArray<FinderLocation>> FindReferencesInDeconstructionAsync(
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentAsync(symbol, document, IsRelevantDocument, CollectMatchingReferences, cancellationToken);

            static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo)
                => syntaxTreeInfo.ContainsDeconstruction;

            void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node,
                ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder<FinderLocation> locations)
            {
                var deconstructMethods = semanticFacts.GetDeconstructionAssignmentMethods(semanticModel, node);
                if (deconstructMethods.IsEmpty)
                {
                    // This was not a deconstruction assignment, it may still be a deconstruction foreach
                    deconstructMethods = semanticFacts.GetDeconstructionForEachMethods(semanticModel, node);
                }

                if (deconstructMethods.Any(m => Matches(m, originalUnreducedSymbolDefinition)))
                {
                    var location = syntaxFacts.GetDeconstructionReferenceLocation(node);
                    var symbolUsageInfo = GetSymbolUsageInfo(node, semanticModel, syntaxFacts, semanticFacts, cancellationToken);

                    locations.Add(new FinderLocation(node, new ReferenceLocation(
                        document, alias: null, location, isImplicit: true, symbolUsageInfo, GetAdditionalFindUsagesProperties(node, semanticModel, syntaxFacts), CandidateReason.None)));
                }
            }
        }

        protected Task<ImmutableArray<FinderLocation>> FindReferencesInAwaitExpressionAsync(
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentAsync(symbol, document, IsRelevantDocument, CollectMatchingReferences, cancellationToken);

            static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo)
                => syntaxTreeInfo.ContainsAwait;

            void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node,
                ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder<FinderLocation> locations)
            {
                var awaitExpressionMethod = semanticFacts.GetGetAwaiterMethod(semanticModel, node);

                if (Matches(awaitExpressionMethod, originalUnreducedSymbolDefinition))
                {
                    var location = node.GetFirstToken().GetLocation();
                    var symbolUsageInfo = GetSymbolUsageInfo(node, semanticModel, syntaxFacts, semanticFacts, cancellationToken);

                    locations.Add(new FinderLocation(node, new ReferenceLocation(
                        document, alias: null, location, isImplicit: true, symbolUsageInfo, GetAdditionalFindUsagesProperties(node, semanticModel, syntaxFacts), CandidateReason.None)));
                }
            }
        }

        protected Task<ImmutableArray<FinderLocation>> FindReferencesInImplicitObjectCreationExpressionAsync(
            ISymbol symbol,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentAsync(symbol, document, IsRelevantDocument, CollectMatchingReferences, cancellationToken);

            static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo)
                => syntaxTreeInfo.ContainsImplicitObjectCreation;

            void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node,
                ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder<FinderLocation> locations)
            {
                if (!syntaxFacts.IsImplicitObjectCreation(node))
                {
                    // Avoid binding unrelated nodes
                    return;
                }

                var constructor = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol;

                if (Matches(constructor, originalUnreducedSymbolDefinition))
                {
                    var location = node.GetFirstToken().GetLocation();
                    var symbolUsageInfo = GetSymbolUsageInfo(node, semanticModel, syntaxFacts, semanticFacts, cancellationToken);

                    locations.Add(new FinderLocation(node, new ReferenceLocation(
                        document, alias: null, location, isImplicit: true, symbolUsageInfo, GetAdditionalFindUsagesProperties(node, semanticModel, syntaxFacts), CandidateReason.None)));
                }
            }
        }

        protected static bool Matches(ISymbol? symbol1, ISymbol notNulloriginalUnreducedSymbol2)
        {
            return symbol1 != null && SymbolEquivalenceComparer.Instance.Equals(
                symbol1.GetOriginalUnreducedDefinition(),
                notNulloriginalUnreducedSymbol2);
        }

        protected static SymbolUsageInfo GetSymbolUsageInfo(
            SyntaxNode node,
            SemanticModel semanticModel,
            ISyntaxFactsService syntaxFacts,
            ISemanticFactsService semanticFacts,
            CancellationToken cancellationToken)
        {
            if (syntaxFacts.IsInNamespaceOrTypeContext(node))
            {
                var typeOrNamespaceUsageInfo = GetTypeOrNamespaceUsageInfo();
                return SymbolUsageInfo.Create(typeOrNamespaceUsageInfo);
            }

            return GetSymbolUsageInfoCommon();

            // Local functions.
            TypeOrNamespaceUsageInfo GetTypeOrNamespaceUsageInfo()
            {
                var usageInfo = IsNodeOrAnyAncestorLeftSideOfDot(node, syntaxFacts) || syntaxFacts.IsLeftSideOfExplicitInterfaceSpecifier(node)
                    ? TypeOrNamespaceUsageInfo.Qualified
                    : TypeOrNamespaceUsageInfo.None;

                if (semanticFacts.IsNamespaceDeclarationNameContext(semanticModel, node.SpanStart, cancellationToken))
                {
                    usageInfo |= TypeOrNamespaceUsageInfo.NamespaceDeclaration;
                }
                else if (node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFactsService>((node, syntaxFacts) => syntaxFacts.IsUsingOrExternOrImport(node), syntaxFacts) != null)
                {
                    usageInfo |= TypeOrNamespaceUsageInfo.Import;
                }

                while (syntaxFacts.IsQualifiedName(node.Parent))
                {
                    node = node.Parent;
                }

                if (syntaxFacts.IsTypeArgumentList(node.Parent))
                {
                    usageInfo |= TypeOrNamespaceUsageInfo.TypeArgument;
                }
                else if (syntaxFacts.IsTypeConstraint(node.Parent))
                {
                    usageInfo |= TypeOrNamespaceUsageInfo.TypeConstraint;
                }
                else if (syntaxFacts.IsBaseTypeList(node.Parent) ||
                    syntaxFacts.IsBaseTypeList(node.Parent?.Parent))
                {
                    usageInfo |= TypeOrNamespaceUsageInfo.Base;
                }
                else if (syntaxFacts.IsObjectCreationExpressionType(node))
                {
                    usageInfo |= TypeOrNamespaceUsageInfo.ObjectCreation;
                }

                return usageInfo;
            }

            SymbolUsageInfo GetSymbolUsageInfoCommon()
            {
                if (semanticFacts.IsInOutContext(semanticModel, node, cancellationToken))
                {
                    return SymbolUsageInfo.Create(ValueUsageInfo.WritableReference);
                }
                else if (semanticFacts.IsInRefContext(semanticModel, node, cancellationToken))
                {
                    return SymbolUsageInfo.Create(ValueUsageInfo.ReadableWritableReference);
                }
                else if (semanticFacts.IsInInContext(semanticModel, node, cancellationToken))
                {
                    return SymbolUsageInfo.Create(ValueUsageInfo.ReadableReference);
                }
                else if (semanticFacts.IsOnlyWrittenTo(semanticModel, node, cancellationToken))
                {
                    return SymbolUsageInfo.Create(ValueUsageInfo.Write);
                }
                else
                {
                    var operation = semanticModel.GetOperation(node, cancellationToken);
                    switch (operation?.Parent)
                    {
                        case INameOfOperation _:
                        case ITypeOfOperation _:
                        case ISizeOfOperation _:
                            return SymbolUsageInfo.Create(ValueUsageInfo.Name);
                    }

                    if (node.IsPartOfStructuredTrivia())
                    {
                        return SymbolUsageInfo.Create(ValueUsageInfo.Name);
                    }

                    var symbolInfo = semanticModel.GetSymbolInfo(node, cancellationToken);
                    if (symbolInfo.Symbol != null)
                    {
                        switch (symbolInfo.Symbol.Kind)
                        {
                            case SymbolKind.Namespace:
                                var namespaceUsageInfo = TypeOrNamespaceUsageInfo.None;
                                if (semanticFacts.IsNamespaceDeclarationNameContext(semanticModel, node.SpanStart, cancellationToken))
                                {
                                    namespaceUsageInfo |= TypeOrNamespaceUsageInfo.NamespaceDeclaration;
                                }

                                if (IsNodeOrAnyAncestorLeftSideOfDot(node, syntaxFacts))
                                {
                                    namespaceUsageInfo |= TypeOrNamespaceUsageInfo.Qualified;
                                }

                                return SymbolUsageInfo.Create(namespaceUsageInfo);

                            case SymbolKind.NamedType:
                                var typeUsageInfo = TypeOrNamespaceUsageInfo.None;
                                if (IsNodeOrAnyAncestorLeftSideOfDot(node, syntaxFacts))
                                {
                                    typeUsageInfo |= TypeOrNamespaceUsageInfo.Qualified;
                                }

                                return SymbolUsageInfo.Create(typeUsageInfo);

                            case SymbolKind.Method:
                            case SymbolKind.Property:
                            case SymbolKind.Field:
                            case SymbolKind.Event:
                            case SymbolKind.Parameter:
                            case SymbolKind.Local:
                                var valueUsageInfo = ValueUsageInfo.Read;
                                if (semanticFacts.IsWrittenTo(semanticModel, node, cancellationToken))
                                {
                                    valueUsageInfo |= ValueUsageInfo.Write;
                                }

                                return SymbolUsageInfo.Create(valueUsageInfo);
                        }
                    }

                    return SymbolUsageInfo.None;
                }
            }
        }

        private static bool IsNodeOrAnyAncestorLeftSideOfDot(SyntaxNode node, ISyntaxFactsService syntaxFacts)
        {
            if (syntaxFacts.IsLeftSideOfDot(node))
            {
                return true;
            }

            if (syntaxFacts.IsRightSideOfQualifiedName(node) ||
                syntaxFacts.IsNameOfSimpleMemberAccessExpression(node) ||
                syntaxFacts.IsNameOfMemberBindingExpression(node))
            {
                return syntaxFacts.IsLeftSideOfDot(node.Parent);
            }

            return false;
        }

        internal static ImmutableDictionary<string, string> GetAdditionalFindUsagesProperties(SyntaxNode node, SemanticModel semanticModel, ISyntaxFactsService syntaxFacts)
        {
            var additionalProperties = ImmutableDictionary.CreateBuilder<string, string>();

            if (TryGetAdditionalProperty(
                    syntaxFacts.GetContainingTypeDeclaration(node, node.SpanStart),
                    ContainingTypeInfoPropertyName,
                    semanticModel,
                    out var containingTypeProperty))
            {
                additionalProperties.Add(containingTypeProperty);
            }

            if (TryGetAdditionalProperty(
                    syntaxFacts.GetContainingMemberDeclaration(node, node.SpanStart),
                    ContainingMemberInfoPropertyName,
                    semanticModel,
                    out var containingMemberProperty))
            {
                additionalProperties.Add(containingMemberProperty);
            }

            return additionalProperties.ToImmutable();
        }

        internal static ImmutableDictionary<string, string> GetAdditionalFindUsagesProperties(ISymbol definition)
        {
            var additionalProperties = ImmutableDictionary.CreateBuilder<string, string>();

            var containingType = definition.ContainingType;
            if (containingType != null &&
                TryGetAdditionalProperty(ContainingTypeInfoPropertyName, containingType, out var containingTypeProperty))
            {
                additionalProperties.Add(containingTypeProperty);
            }

            var containingSymbol = definition.ContainingSymbol;

            // Containing member should only include fields, properties, methods, or events.  Since ContainingSymbol can return other types, use the return value of GetMemberType to restrict to members only.)
            if (containingSymbol != null &&
                containingSymbol.GetMemberType() != null &&
                TryGetAdditionalProperty(ContainingMemberInfoPropertyName, containingSymbol, out var containingMemberProperty))
            {
                additionalProperties.Add(containingMemberProperty);
            }

            return additionalProperties.ToImmutable();
        }

        protected static bool TryGetAdditionalProperty(SyntaxNode? node, string name, SemanticModel semanticModel, out KeyValuePair<string, string> additionalProperty)
        {
            if (node != null)
            {
                var symbol = semanticModel.GetDeclaredSymbol(node);
                if (symbol != null &&
                    TryGetAdditionalProperty(name, symbol, out additionalProperty))
                {
                    return true;
                }
            }

            additionalProperty = default;
            return false;
        }

        private static bool TryGetAdditionalProperty(string propertyName, ISymbol symbol, out KeyValuePair<string, string> additionalProperty)
        {
            if (symbol == null)
            {
                additionalProperty = default;
                return false;
            }

            additionalProperty = new KeyValuePair<string, string>(propertyName, symbol.Name);
            return true;
        }
    }

    internal abstract partial class AbstractReferenceFinder<TSymbol> : AbstractReferenceFinder
        where TSymbol : ISymbol
    {
        protected abstract bool CanFind(TSymbol symbol);

        protected abstract Task<ImmutableArray<Document>> DetermineDocumentsToSearchAsync(
            TSymbol symbol, Project project, IImmutableSet<Document>? documents,
            FindReferencesSearchOptions options, CancellationToken cancellationToken);

        protected abstract ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            TSymbol symbol, Document document, SemanticModel semanticModel,
            FindReferencesSearchOptions options, CancellationToken cancellationToken);

        public override Task<ImmutableArray<Project>> DetermineProjectsToSearchAsync(ISymbol symbol, Solution solution, IImmutableSet<Project>? projects, CancellationToken cancellationToken)
        {
            return symbol is TSymbol typedSymbol && CanFind(typedSymbol)
                ? DetermineProjectsToSearchAsync(typedSymbol, solution, projects, cancellationToken)
                : SpecializedTasks.EmptyImmutableArray<Project>();
        }

        public override Task<ImmutableArray<Document>> DetermineDocumentsToSearchAsync(
            ISymbol symbol, Project project, IImmutableSet<Document>? documents,
            FindReferencesSearchOptions options, CancellationToken cancellationToken)
        {
            return symbol is TSymbol typedSymbol && CanFind(typedSymbol)
                ? DetermineDocumentsToSearchAsync(typedSymbol, project, documents, options, cancellationToken)
                : SpecializedTasks.EmptyImmutableArray<Document>();
        }

        public override ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            ISymbol symbol, Document document, SemanticModel semanticModel,
            FindReferencesSearchOptions options, CancellationToken cancellationToken)
        {
            return symbol is TSymbol typedSymbol && CanFind(typedSymbol)
                ? FindReferencesInDocumentAsync(typedSymbol, document, semanticModel, options, cancellationToken)
                : new ValueTask<ImmutableArray<FinderLocation>>(ImmutableArray<FinderLocation>.Empty);
        }

        public override Task<ImmutableArray<(ISymbol symbol, FindReferencesCascadeDirection cascadeDirection)>> DetermineCascadedSymbolsAsync(
            ISymbol symbol, Solution solution, IImmutableSet<Project>? projects,
            FindReferencesSearchOptions options, FindReferencesCascadeDirection cascadeDirection,
            CancellationToken cancellationToken)
        {
            if (options.Cascade &&
                symbol is TSymbol typedSymbol &&
                CanFind(typedSymbol))
            {
                return DetermineCascadedSymbolsAsync(
                    typedSymbol, solution, projects, options, cascadeDirection, cancellationToken);
            }

            return SpecializedTasks.EmptyImmutableArray<(ISymbol symbol, FindReferencesCascadeDirection cascadeDirection)>();
        }

        protected virtual Task<ImmutableArray<Project>> DetermineProjectsToSearchAsync(
            TSymbol symbol, Solution solution, IImmutableSet<Project>? projects, CancellationToken cancellationToken)
        {
            return DependentProjectsFinder.GetDependentProjectsAsync(
                solution, symbol, projects, cancellationToken);
        }

        protected virtual Task<ImmutableArray<(ISymbol symbol, FindReferencesCascadeDirection cascadeDirection)>> DetermineCascadedSymbolsAsync(
            TSymbol symbol, Solution solution, IImmutableSet<Project>? projects,
            FindReferencesSearchOptions options, FindReferencesCascadeDirection cascadeDirection,
            CancellationToken cancellationToken)
        {
            return SpecializedTasks.EmptyImmutableArray<(ISymbol symbol, FindReferencesCascadeDirection cascadeDirection)>();
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentUsingSymbolNameAsync(
            TSymbol symbol,
            Document document,
            SemanticModel semanticModel,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentUsingIdentifierAsync(
                symbol, symbol.Name, document, semanticModel, cancellationToken: cancellationToken);
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInTokensAsync(
            TSymbol symbol,
            Document document,
            SemanticModel semanticModel,
            IEnumerable<SyntaxToken> tokens,
            Func<SyntaxToken, bool> tokensMatch,
            CancellationToken cancellationToken)
        {
            return FindReferencesInTokensAsync(
                symbol, document, semanticModel, tokens, tokensMatch,
                findParentNode: null, cancellationToken: cancellationToken);
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInTokensAsync(
            TSymbol symbol,
            Document document,
            SemanticModel semanticModel,
            IEnumerable<SyntaxToken> tokens,
            Func<SyntaxToken, bool> tokensMatch,
            Func<SyntaxToken, SyntaxNode>? findParentNode,
            CancellationToken cancellationToken)
        {
            var symbolsMatchAsync = GetStandardSymbolsMatchFunction(symbol, findParentNode, document.Project.Solution, cancellationToken);

            return FindReferencesInTokensAsync(
                document,
                semanticModel,
                tokens,
                tokensMatch,
                symbolsMatchAsync,
                cancellationToken);
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            TSymbol symbol,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, bool> tokensMatch,
            CancellationToken cancellationToken)
        {
            return FindReferencesInDocumentAsync(
                symbol, document, semanticModel, tokensMatch,
                findParentNode: null, cancellationToken: cancellationToken);
        }

        protected static ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            TSymbol symbol,
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, bool> tokensMatch,
            Func<SyntaxToken, SyntaxNode>? findParentNode,
            CancellationToken cancellationToken)
        {
            var findInGlobalSuppressions = ShouldFindReferencesInGlobalSuppressions(symbol, out var docCommentId);
            var symbolsMatchAsync = GetStandardSymbolsMatchFunction(symbol, findParentNode, document.Project.Solution, cancellationToken);
            return FindReferencesInDocumentAsync(document, semanticModel, tokensMatch,
                symbolsMatchAsync, docCommentId, findInGlobalSuppressions, cancellationToken);
        }

        protected static async ValueTask<ImmutableArray<FinderLocation>> FindReferencesInDocumentAsync(
            Document document,
            SemanticModel semanticModel,
            Func<SyntaxToken, bool> tokensMatch,
            Func<SyntaxToken, SemanticModel, ValueTask<(bool matched, CandidateReason reason)>> symbolsMatchAsync,
            string? docCommentId,
            bool findInGlobalSuppressions,
            CancellationToken cancellationToken)
        {
            var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

            // Now that we have Doc Comments in place, We are searching for References in the Trivia as well by setting descendIntoTrivia: true
            var tokens = root.DescendantTokens(descendIntoTrivia: true);
            var references = await FindReferencesInTokensAsync(document, semanticModel, tokens, tokensMatch, symbolsMatchAsync, cancellationToken).ConfigureAwait(false);

            if (!findInGlobalSuppressions)
                return references;

            RoslynDebug.Assert(docCommentId != null);
            var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>();
            var referencesInGlobalSuppressions = await FindReferencesInDocumentInsideGlobalSuppressionsAsync(
                document, semanticModel, syntaxFacts, docCommentId, cancellationToken).ConfigureAwait(false);
            return references.AddRange(referencesInGlobalSuppressions);
        }
    }
}


text:
package dls

import "github.com/200sc/klangsynthese/font/riff"

// The DLS is the major struct we care about in this package
// DLS files contain instrument and wave sample information, and
// a bunch of other things users probably don't care about.
type DLS struct {
	Dlid      ID     `riff:"dlid"`
	Colh      uint32 `riff:"colh"`
	Vers      int64  `riff:"vers"`
	Lins      []Ins  `riff:"lins"`
	Ptbl      []byte `riff:"ptbl"` //PoolTable
	Wvpl      []Wave `riff:"wvpl"`
	riff.INFO `riff:"INFO"`
}

// PoolTable is a goofy name for a thing that redirects references
// between instruments and waves, I think.
type PoolTable struct {
	CbSize uint32
	CCues  uint32
	// CCues size
	PoolCues []uint32
}

// An ID is a unique identifer for a dls file or instrument (or wave).
// This could just be written as a complex128.
type ID struct {
	UlData1 uint32
	UlData2 uint16
	UlData3 uint16
	AbData4 [8]byte
}

// Wave is the underlying struct you'd also find in WAV files. It stores raw
// audio information and headers describing how to play that information. The
// DLS Wave struct can also have a DLSID. Todo: Consider moving this out of this
// file entirely and into the WAV package, the downside of which would be that
// if a user wanted access to a DLSID it would no longer be there to get.
type Wave struct {
	Dlid ID        `riff:"dlid"`
	Guid []byte    `riff:"guid"`
	Wavu []byte    `riff:"wavu"`
	Fmt  PCMFormat `riff:"fmt "`
	Wavh []byte    `riff:"wavh"`
	Smpl []byte    `riff:"smpl"`
	Wsmp []byte    `riff:"wsmp"`
	// Data is the stuff you actually care about
	Data      []byte `riff:"data"`
	riff.INFO `riff:"INFO"`
}

// PCMFormat is a wave format that just know how many bits per sample a wave
// takes, beyond common format fields
// Really, there are two formats a Wave can take, this is just the one we hope
// to see. Todo: Fix that
type PCMFormat struct {
	AudioFormat   uint16
	NumChannels   uint16
	SampleRate    uint32
	ByteRate      uint32
	BlockAlign    uint16
	BitsPerSample uint16
	WhoKnows      uint16 // Test files show there are buffer bytes here?
}

// An Ins holds instrument data
type Ins struct {
	Dlid      ID        `riff:"dlid"`
	Insh      InsHeader `riff:"insh"`
	Lrgn      []Rgn     `riff:"lrgn"`
	Lart      Art       `riff:"lart"`
	riff.INFO `riff:"INFO"`
}

// InsHeader stores header information for an instrument, notably the number
// of regions and the internal instrument bank and number
type InsHeader struct {
	CRegions uint32
	Locale   MIDILOCALE
}

// MIDILOCALE stores two of the fields in an instrument header
type MIDILOCALE struct {
	UlBank       uint32
	UlInstrument uint32
}

// An Art is something we need to look more into
type Art struct {
	// Todo: art1 doesn't fit our unmarshaler's expectations, because
	// it's basically its own type of subchunk with two sizes following
	// 'art1' then a number of structs based on the second size
	Art1 []byte `riff:"art1"`
	// This []byte is really:
	// cbSize uint32
	// cConnectionBlocks uint32
	// ConnectionBlocks []ConnectionBlock
	// Also Art2, which is equivalent to Art1
}

// Rgn is a region linking instruments to waves
type Rgn struct {
	Rgnh RgnHeader `riff:"rgnh"`
	Wsmp []byte    `riff:"wsmp"`
	Wlnk WaveLink  `riff:"wlnk"`
	Lart Art       `riff:"lart"`
}

// An RgnHeader stores header information for regions, notably for one the valid range
// of notes an instrument should be applied to
// Todo: figure out how to distinguish between rgnhs with and without ulLayer
type RgnHeader struct {
	RangeKey      RGNRANGE
	RangeVelocity RGNRANGE
	FusOptions    uint16
	UsKeyGroup    uint16
	UsLayer       uint16 // This field is optional
}

// An RGNRANGE just stores a low and a high value
type RGNRANGE struct {
	UsLow  uint16
	UsHigh uint16
}

// WaveLink stores things I don't know about
type WaveLink struct {
	FusOptions   uint16
	UsPhaseGroup uint16
	UlChannel    uint32
	UlTableIndex uint32
}

// WaveSample also stores things I don't know about
type WaveSample struct {
	CbSize      uint32
	UsUnityNote uint16
	SFineTune   int16
	LGain       int32
	FulOptions  uint32
	// As for art, WaveSampleLoop is CSampleLoops long
	CSampleLoops   uint32
	WaveSampleLoop []WaveSampleLoop
}

// WaveSampleLoop also stores things I don't know about
type WaveSampleLoop struct {
	CbSize       uint32
	UlLoopType   uint32
	UlLoopStart  uint32
	UlLoopLength uint32
}


text:
<?php $this->load->view('thread/header');?>

	<?php $this->load->view('thread/menu');?>

            <?php foreach($query as $post):?>

<?php echo $post->field1;?>

<?php echo mdate("%h:%i %a, %d.%m.%Y",mysql_to_unix($post->entry_date));?>

<?php echo $post->field2;?>

						<?php if($total_comments > 1)
								{echo $total_comments.' comments';}
								else if($total_comments === 1)
								{echo $total_comments.' comment';}
								else{ echo 'No comment yet!';}?>

            <?php endforeach; ?>

					<?=$formated_comments?>

					<?php if(validation_errors()){echo validation_errors('
','
');} ?>
					<?php if($this->session->flashdata('message')){echo '
'.$this->session->flashdata('message').'
';}?>

Leave your comment

					<?php echo form_open('post/'.$post_id);?>

Comment:

					<textarea rows="6" cols="80%" style="resize:none;" name="comment"> <?php echo $post->field2;?> </textarea>

					<input type="hidden" name="post_id" value="<?php echo $post_id;?>" />
					<input class = "parent_id" type="hidden" name="parent_id" value="0" />
					<input type="submit" value="Submit" />
					<?php echo form_close();?>

        <?php $this->load->view('thread/footer');?>


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82.h
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml
Template File: sources-sink-82.tmpl.h
*/
/*
 * @description
 * CWE: 122 Heap Based Buffer Overflow
 * BadSource:  Initialize data as a large string
 * GoodSource: Initialize data as a small string
 * Sinks: memmove
 *    BadSink : Copy data to string using memmove
 * Flow Variant: 82 Data flow: data passed in a parameter to a virtual method called via a pointer
 *
 * */

#include "std_testcase.h"

#include <wchar.h>

namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82
{

class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82_base
{
public:
    /* pure virtual function */
    virtual void action(char * data) = 0;
};

#ifndef OMITBAD

class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82_bad : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82_base
{
public:
    void action(char * data);
};

#endif /* OMITBAD */

#ifndef OMITGOOD

class CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82_goodG2B : public CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_memmove_82_base
{
public:
    void action(char * data);
};

#endif /* OMITGOOD */

}


text:
namespace chrono {
namespace fea {

/// @addtogroup fea_nodes
/// @{

/// Class for a generic 3D finite element node, with x,y,z displacement, direction, and one curvature vector OR
/// additional direction.
/// The variable DD represents the derivative of a gradient vector or an additional gradient, to be used in ANCF
/// elements.
class ChApi ChNodeFEAxyzDD : public ChNodeFEAxyzD {
  public:
    ChNodeFEAxyzDD(ChVector<> initial_pos = VNULL, ChVector<> initial_dir = VECT_X, ChVector<> initial_curv = VNULL);
    ChNodeFEAxyzDD(const ChNodeFEAxyzDD& other);
    ~ChNodeFEAxyzDD();

    ChNodeFEAxyzDD& operator=(const ChNodeFEAxyzDD& other);

    /// Set the direction
    void SetDD(ChVector<> mDD) { DD = mDD; }
    /// Get the direction
    const ChVector<>& GetDD() const { return DD; }

    /// Set the direction speed
    void SetDD_dt(ChVector<> mDD) { DD_dt = mDD; }
    /// Get the direction speed
    const ChVector<>& GetDD_dt() const { return DD_dt; }

    /// Set the direction acceleration
    void SetDD_dtdt(ChVector<> mDD) { DD_dtdt = mDD; }
    /// Get the direction acceleration
    const ChVector<>& GetDD_dtdt() const { return DD_dtdt; }

    ChVariables& Variables_DD() { return *variables_DD; }

    /// Reset to no speed and acceleration.
    virtual void SetNoSpeedNoAcceleration() override;

    /// Get mass of the node (for DD variables).
    virtual ChVectorDynamic<>& GetMassDiagonalDD() { return variables_DD->GetMassDiagonal(); }
    /// Sets the 'fixed' state of the node. If true, it does not move
    /// respect to the absolute world, despite constraints, forces, etc.
    virtual void SetFixed(bool mev) override;

    /// Gets the 'fixed' state of the node.
    virtual bool GetFixed() override { return variables_DD->IsDisabled(); }

    /// Get the number of degrees of freedom
    virtual int Get_ndof_x() const override { return 9; }

    //
    // Functions for interfacing to the state bookkeeping
    //

    virtual void NodeIntStateGather(const unsigned int off_x,
                                    ChState& x,
                                    const unsigned int off_v,
                                    ChStateDelta& v,
                                    double& T) override;
    virtual void NodeIntStateScatter(const unsigned int off_x,
                                     const ChState& x,
                                     const unsigned int off_v,
                                     const ChStateDelta& v,
                                     const double T) override;
    virtual void NodeIntStateGatherAcceleration(const unsigned int off_a, ChStateDelta& a) override;
    virtual void NodeIntStateScatterAcceleration(const unsigned int off_a, const ChStateDelta& a) override;
    virtual void NodeIntStateIncrement(const unsigned int off_x,
                                       ChState& x_new,
                                       const ChState& x,
                                       const unsigned int off_v,
                                       const ChStateDelta& Dv) override;
    virtual void NodeIntLoadResidual_F(const unsigned int off, ChVectorDynamic<>& R, const double c) override;
    virtual void NodeIntLoadResidual_Mv(const unsigned int off,
                                        ChVectorDynamic<>& R,
                                        const ChVectorDynamic<>& w,
                                        const double c) override;
    virtual void NodeIntToDescriptor(const unsigned int off_v,
                                     const ChStateDelta& v,
                                     const ChVectorDynamic<>& R) override;
    virtual void NodeIntFromDescriptor(const unsigned int off_v, ChStateDelta& v) override;

    //
    // Functions for interfacing to the solver
    //

    virtual void InjectVariables(ChSystemDescriptor& mdescriptor) override;
    virtual void VariablesFbReset() override;
    virtual void VariablesFbLoadForces(double factor = 1) override;
    virtual void VariablesQbLoadSpeed() override;
    virtual void VariablesQbSetSpeed(double step = 0) override;
    virtual void VariablesFbIncrementMq() override;
    virtual void VariablesQbIncrementPosition(double step) override;

    //
    // INTERFACE to ChLoadable
    //

    /// Gets the number of DOFs affected by this element (position part)
    virtual int LoadableGet_ndof_x() override { return 9; }

    /// Gets the number of DOFs affected by this element (speed part)
    virtual int LoadableGet_ndof_w() override { return 9; }

    /// Gets all the DOFs packed in a single vector (position part)
    virtual void LoadableGetStateBlock_x(int block_offset, ChState& mDD) override {
        mDD.PasteVector(pos, block_offset, 0);
        mDD.PasteVector(D, block_offset + 3, 0);
        mDD.PasteVector(DD, block_offset + 6, 0);
    }

    /// Gets all the DOFs packed in a single vector (speed part)
    virtual void LoadableGetStateBlock_w(int block_offset, ChStateDelta& mDD) override {
        mDD.PasteVector(pos_dt, block_offset, 0);
        mDD.PasteVector(D_dt, block_offset + 3, 0);
        mDD.PasteVector(DD_dt, block_offset + 6, 0);
    }

    /// Increment all DOFs using a delta.
    virtual void LoadableStateIncrement(const unsigned int off_x, ChState& x_new, const ChState& x, const unsigned int off_v, const ChStateDelta& Dv) override {
        this->NodeIntStateIncrement(off_x, x_new, x, off_v, Dv);
    }

    /// Number of coordinates in the interpolated field, ex=3 for a
    /// tetrahedron finite element or a cable, etc. Here is 9: xyz displ + 2 gradients or 1 gradient + 1 curv. vector
    virtual int Get_field_ncoords() override { return 9; }

    /// Get the size of the i-th sub-block of DOFs in global vector
    virtual unsigned int GetSubBlockSize(int nblock) override { return 9; }

    /// Get the pointers to the contained ChVariables, appending to the mvars vector.
    virtual void LoadableGetVariables(std::vector<ChVariables*>& mvars) override {
        mvars.push_back(&Variables());
        mvars.push_back(&Variables_D());
        mvars.push_back(&Variables_DD());
    }

    /// Evaluate Q=N'*F , for Q generalized lagrangian load, where N is some type of matrix
    /// evaluated at point P(U,V,W) assumed in absolute coordinates, and
    /// F is a load assumed in absolute coordinates.
    /// The det[J] is unused.
    virtual void ComputeNF(
        const double U,              ///< x coordinate of application point in absolute space
        const double V,              ///< y coordinate of application point in absolute space
        const double W,              ///< z coordinate of application point in absolute space
        ChVectorDynamic<>& Qi,       ///< Return result of N'*F  here, maybe with offset block_offset
        double& detJ,                ///< Return det[J] here
        const ChVectorDynamic<>& F,  ///< Input F vector, containing Force xyz in absolute coords and a 'pseudo' torque.
        ChVectorDynamic<>* state_x,  ///< if != 0, update state (pos. part) to this, then evaluate Q
        ChVectorDynamic<>* state_w   ///< if != 0, update state (speed part) to this, then evaluate Q
        ) override;

    //
    // SERIALIZATION
    //

    virtual void ArchiveOUT(ChArchiveOut& marchive) override;
    virtual void ArchiveIN(ChArchiveIn& marchive) override;

  private:
    /// 3D node variable - the direction part: Dx,Dy,Dz (the position part is in parent class)
    ChVariablesGenericDiagonalMass* variables_DD;

  public:
    ChVector<> DD;
    ChVector<> DD_dt;
    ChVector<> DD_dtdt;
};

/// @} fea_nodes

}  // end namespace fea
}  // end namespace chrono

#endif


text:
triggered scripts: xpLayout
#PURPOSE set the layout status field with the layout that triggers this script when it loads
#
#
If [ Get ( SystemPlatform ) = -2 ]
Go to Layout [ "01SortAndScheduleXP" (brainstate) ]
Exit Script [ ]
End If
#
Go to Layout [ "01SortAndSchedule" (brainstate) ]
January 6, 平成26 1:04:03 ActionLog.fp7 - xpLayout -1-


text:
#ifndef OPENSIM_GEOMETRY_PATH_H_
#define OPENSIM_GEOMETRY_PATH_H_

// INCLUDE
#include <OpenSim/Simulation/osimSimulationDLL.h>
#include "OpenSim/Simulation/Model/ModelComponent.h"
#include <OpenSim/Common/ScaleSet.h>
#include <OpenSim/Common/VisibleObject.h>
#include "PathPointSet.h"
#include <OpenSim/Simulation/Wrap/PathWrapSet.h>
#include <OpenSim/Simulation/MomentArmSolver.h>

#ifdef SWIG
	#ifdef OSIMSIMULATION_API
		#undef OSIMSIMULATION_API
		#define OSIMSIMULATION_API
	#endif
#endif

namespace OpenSim {

class Coordinate;
class WrapResult;
class WrapObject;
class PointForceDirection;

//=============================================================================
//=============================================================================
/**
 * A base class representing a path (muscle, ligament, etc.).
 *
 * @author Peter Loan
 * @version 1.0
 */
class OSIMSIMULATION_API GeometryPath : public ModelComponent {
OpenSim_DECLARE_CONCRETE_OBJECT(GeometryPath, ModelComponent);

//=============================================================================
// DATA
//=============================================================================
private:
	OpenSim_DECLARE_UNNAMED_PROPERTY(PathPointSet, "The set of points defining the path");

	OpenSim_DECLARE_PROPERTY(display, VisibleObject, "Used to display the path in the 3D window");

	OpenSim_DECLARE_UNNAMED_PROPERTY(PathWrapSet, "The wrap objecs that are associated with this path");

	OpenSim_DECLARE_OPTIONAL_PROPERTY(default_color, SimTK::Vec3, "Used to initialize the colour cache variable");

	// used for scaling tendon and fiber lengths
	double _preScaleLength;

	// object that owns this GeometryPath object
	SimTK::ReferencePtr<Object> _owner;

	// solver used to compute moment-arms
	mutable SimTK::ReferencePtr<MomentArmSolver> _maSolver;

//=============================================================================
// METHODS
//=============================================================================
	//--------------------------------------------------------------------------
	// CONSTRUCTION
	//--------------------------------------------------------------------------
public:
	GeometryPath();
	virtual ~GeometryPath();

	const PathPointSet& getPathPointSet() const { return get_PathPointSet(); }
	PathPointSet& updPathPointSet() { return upd_PathPointSet(); }
	const PathWrapSet& getWrapSet() const { return get_PathWrapSet(); }
	void addPathWrap(WrapObject& aWrapObject);

	//--------------------------------------------------------------------------
	// UTILITY
	//--------------------------------------------------------------------------
	PathPoint* addPathPoint(const SimTK::State& s, int aIndex, OpenSim::Body& aBody);
	PathPoint* appendNewPathPoint(const std::string& proposedName,
								OpenSim::Body& aBody, const SimTK::Vec3& aPositionOnBody);
	bool canDeletePathPoint( int aIndex);
	bool deletePathPoint(const SimTK::State& s, int aIndex);

	void moveUpPathWrap(const SimTK::State& s, int aIndex);
	void moveDownPathWrap(const SimTK::State& s, int aIndex);
	void deletePathWrap(const SimTK::State& s, int aIndex);
	bool replacePathPoint(const SimTK::State& s, PathPoint* aOldPathPoint, PathPoint* aNewPathPoint);

    //--------------------------------------------------------------------------
    // GET
    //--------------------------------------------------------------------------
	Object* getOwner() const { return _owner; }
	void setOwner(Object *anObject) {_owner = anObject; };

    /** If you call this prior to addToSystem() it will be used to initialize
    the color cache variable. Otherwise %GeometryPath will choose its own
    default which will be some boring shade of gray. **/
	void setDefaultColor(const SimTK::Vec3& color) {set_default_color(color); };
    /** Returns the color that will be used to initialize the color cache
    at the next addToSystem() call. The actual color used to draw the path
    will be taken from the cache variable, so may have changed. **/
	const SimTK::Vec3& getDefaultColor() const { return get_default_color(); }

    /** Set the value of the color cache variable owned by this %GeometryPath
    object, in the cache of the given state. The value of this variable is used
    as the color when the path is drawn, which occurs with the state realized
    to Stage::Dynamics. So you must call this method during realizeDynamics() or
    earlier in order for it to have any effect. **/
	void setColor(const SimTK::State& s, const SimTK::Vec3& color) const;

    /** Get the current value of the color cache entry owned by this
    %GeometryPath object in the given state. You can access this value any time
    after the state is initialized, at which point it will have been set to
    the default color value specified in a call to setDefaultColor() earlier,
    or it will have the default default color value chosen by %GeometryPath.
    @see setDefaultColor() **/
	SimTK::Vec3 getColor(const SimTK::State& s) const;

	double getLength( const SimTK::State& s) const;
	void setLength( const SimTK::State& s, double length) const;
	double getPreScaleLength( const SimTK::State& s) const;
	void setPreScaleLength( const SimTK::State& s, double preScaleLength);
	const Array<PathPoint*>& getCurrentPath( const SimTK::State& s) const;

	const Array<PathPoint*>& getCurrentDisplayPath(const SimTK::State& s) const;

	double getLengtheningSpeed(const SimTK::State& s) const;
	void setLengtheningSpeed( const SimTK::State& s, double speed ) const;

	/** get the the path as PointForceDirections directions, which can be used
	    to apply tension to bodies the points are connected to.*/
	void getPointForceDirections(const SimTK::State& s,
		OpenSim::Array<PointForceDirection*> *rPFDs) const;

	/** add in the equivalent body and generalized forces to be applied to the
	    multibody system resulting from a tension along the GeometryPath
	@param state	state used to evaluate forces
	@param[in]  tension      scalar (double) of the applied (+ve) tensile force
	@param[in,out] bodyForces   Vector of SpatialVec's (torque, force) on bodies
	@param[in,out] mobilityForces  Vector of generalized forces, one per mobility
	*/
	void addInEquivalentForces(const SimTK::State& state,
							   const double& tension,
						       SimTK::Vector_<SimTK::SpatialVec>& bodyForces,
							   SimTK::Vector& mobilityForces) const;

	//--------------------------------------------------------------------------
	// COMPUTATIONS
	//--------------------------------------------------------------------------
	virtual double computeMomentArm(const SimTK::State& s, const Coordinate& aCoord) const;

	//--------------------------------------------------------------------------
	// SCALING
	//--------------------------------------------------------------------------
	void preScale(const SimTK::State& s, const ScaleSet& aScaleSet);
	void scale(const SimTK::State& s, const ScaleSet& aScaleSet);
	void postScale(const SimTK::State& s, const ScaleSet& aScaleSet);

	//--------------------------------------------------------------------------
	// Visible Object Support
	//--------------------------------------------------------------------------
	virtual const VisibleObject* getDisplayer() const {
		return &get_display();
	}

	void updateDisplayer(const SimTK::State& s) const OVERRIDE_11;

    // Update the geometry attached to the path (location of path points and connecting segments
	//  all in global/interial frame)
	virtual void updateGeometry(const SimTK::State& s) const;

protected:
    // ModelComponent interface.
	void connectToModel(Model& aModel) OVERRIDE_11;
	void initStateFromProperties(SimTK::State& s) const OVERRIDE_11;
	void addToSystem(SimTK::MultibodySystem& system) const OVERRIDE_11;

	// Visual support GeometryPath drawing in SimTK visualizer.
	void generateDecorations(
			bool 									    fixed,
			const ModelDisplayHints&				    hints,
			const SimTK::State&						    state,
			SimTK::Array_<SimTK::DecorativeGeometry>&	appendToThis) const
            OVERRIDE_11;

private:

	void computePath(const SimTK::State& s ) const;
	void computeLengtheningSpeed(const SimTK::State& s) const;
	void applyWrapObjects(const SimTK::State& s, Array<PathPoint*>& path ) const;
	double calcPathLengthChange(const SimTK::State& s, const WrapObject& wo,
                                const WrapResult& wr,
                                const Array<PathPoint*>& path) const;
	double calcLengthAfterPathComputation
       (const SimTK::State& s, const Array<PathPoint*>& currentPath) const;

	void setNull();
	void constructProperties();
	void updateDisplayPath(const SimTK::State& s) const;
	void updateGeometrySize(const SimTK::State& ) const;
	void updateGeometryLocations(const SimTK::State& s) const;
	void namePathPoints(int aStartingIndex);
    void placeNewPathPoint(const SimTK::State& s, SimTK::Vec3& aOffset,
                           int aIndex, const OpenSim::Body& aBody);

//=============================================================================
};	// END of class GeometryPath
//=============================================================================
//=============================================================================

} // end of namespace OpenSim

#endif // OPENSIM_GEOMETRY_PATH_H_


text:
Rails.application.routes.draw do
  root  'videos#index'
  resources :videos
  resources :sounds
  resources :minisounds
  post 'get_minisound' => 'videos#get_minisound'
  post 'get_sound' => 'videos#get_sound'
  get 'sounds/:id/download' => 'sounds#download'
  get 'minisounds_reset' => 'minisounds#reset'
  get 'sounds_reset' => 'sounds#reset'
end


text:
package main

import (
	"database/sql"
	"log"

	mgo "gopkg.in/mgo.v2-unstable"

	"github.com/gohxs/hqi"
	"github.com/gohxs/hqi/drv/mgodrv"
	"github.com/gohxs/hqi/drv/slicedrv"
	"github.com/gohxs/hqi/drv/sqldrv"
	_ "github.com/lib/pq"
	_ "github.com/mattn/go-sqlite3"
)

/*type Details struct {
	Key   string
	Value string
}*/
type UserAccount struct {
	Kind string
	Data map[string]string
}
type User struct {
	Name        string
	Description string
	Account     []UserAccount
}

var coll = []User{}

func main() {

	// Init driver
	drv := driverMGO()
	//drv := driverSLICE()
	q := hqi.NewQuery(drv)

	q.Insert(&User{"admin", "Administration account", []UserAccount{{"email", map[string]string{"email": "admin@domain.tld", "pwd": "1q2w3e"}}}})
	q.Insert(&User{"user", "Regular user", []UserAccount{{"email", map[string]string{"email": "user@domain.tld", "pwd": "1q2w3e"}}}})

	// Lets say user login with email and passwd

	var email = "admin@domain.tld"
	var pwd = "1q2w3e"

	var res []User

	q.Find(hqi.M{
		"Account": hqi.M{
			"Kind": "email",
			"Data": hqi.M{
				"email": email,
				"pwd":   pwd,
			},
		},
	}).List(&res)
	if len(res) > 0 {
		log.Println("Result:", res)
	} else {
		log.Println("Invalid ogin")
	}
}

var (
	postgreDSN = "user=admin dbname=hqitest sslmode=disable"
	sqliteDSN  = "tmp.sqlite3"
)

func driverSQL(sqldriver string, dsn string) *sqldrv.Driver {

	db, err := sql.Open(sqldriver, dsn)
	if err != nil {
		return nil
	}
	_, err = db.Exec("DROP TABLE IF EXISTS hqitest")
	if err != nil {
		return nil
	}
	db.Exec("DROP TABLE IF EXISTS hqitest")
	//Schema this
	driver := &sqldrv.Driver{db, "hqitest"}

	q := hqi.NewQuery(driver)
	err = q.Schema(User{})
	if err != nil {
		panic(err)
	}
	return driver
}

func driverSLICE() *slicedrv.Driver {
	return &slicedrv.Driver{&coll}
}
func driverMGO() *mgodrv.Driver {
	session, err := mgo.Dial("mongodb://localhost/mgo-test")
	if err != nil {
		return nil
	}
	coll := session.DB("mgo-test").C("hqitest")
	coll.DropCollection()

	return &mgodrv.Driver{coll}

}


text:
function [X y w] = inputdata (spc, N, d)

  % Loops until we find negative and positive examples
  while (1)

    % N random examples
    X = unifrnd (spc(1), spc(2), N, d);

    % Introduces the synthetic dimension x0
    X = [ones(N, 1) X];

    % Weight vector that represents the target function f
    w = unifrnd (spc(1), spc(2), size (X, 2), 1);

    % Uses the target function to set the desired labels
    y = sign (X * w);

    pos = find (y > 0);
    neg = find (y < 0);

    % Make sure we have both positive and negative examples
    if (any (pos) && any (neg))
      break;
    end
  end
end


text:
load_dir = File.expand_path(File.dirname(__FILE__))
$:.unshift(load_dir) unless $:.include?(load_dir)

require 'plotbox/version.rb'
require 'yaml'
require 'sinatra'

module Plotbox
  # Load data files into instance variables.
  @characters       = YAML.load_file('data/characters.yml')
  @conflicts        = YAML.load_file('data/conflicts.yml')
  @settings         = YAML.load_file('data/settings.yml')

  # Load routes from files.
  routes = Dir['routes/*.rb'].sort
  routes.each do |file|
    load file
  end

  # Add instance variables as accessors on module.
  class << self
    attr_reader :characters,:conflicts,:settings

    # Randomize
    def character_one
      @character_one  = @characters.shuffle.sample
      @character_one
    end

    def character_two
      @character_two    = @characters.shuffle.sample
      while @character_two == @character_one do
        @character_two  = @characters.shuffle.sample
      end
      @character_two
    end

    def setting
      @setting      = @settings.shuffle.sample
    end

    def conflict
      @conflict     = @conflicts.shuffle.sample
    end
  end

  # Define constants.
  SiteTitle = 'PlotBox'
  SiteDesc  = 'A Plot Generator in a Box'

  class App < Sinatra::Base
    include Plotbox::Routes
  end
end


text:
/* This is the single file included by all MPC8xx build options.
 * Since there are many different boards and no standard configuration,
 * we have a unique include file for each.  Rather than change every
 * file that has to include MPC8xx configuration, they all include
 * this one and the configuration switching is done here.
 */
#ifdef __KERNEL__
#ifndef __CONFIG_8xx_DEFS
#define __CONFIG_8xx_DEFS

#include <linux/config.h>

#ifdef CONFIG_8xx

#ifdef CONFIG_MBX
#include <platforms/mbx.h>
#endif

#ifdef CONFIG_FADS
#include <platforms/fads.h>
#endif

#ifdef CONFIG_RPXLITE
#include <platforms/rpxlite.h>
#endif

#ifdef CONFIG_BSEIP
#include <platforms/bseip.h>
#endif

#ifdef CONFIG_RPXCLASSIC
#include <platforms/rpxclassic.h>
#endif

#if defined(CONFIG_TQM8xxL)
#include <platforms/tqm8xx.h>
#endif

#if defined(CONFIG_IVMS8) || defined(CONFIG_IVML24)
#include <platforms/ivms8.h>
#endif

#if defined(CONFIG_HERMES_PRO)
#include <platforms/hermes.h>
#endif

#if defined(CONFIG_IP860)
#include <platforms/ip860.h>
#endif

#if defined(CONFIG_LWMON)
#include <platforms/lwmon.h>
#endif

#if defined(CONFIG_PCU_E)
#include <platforms/pcu_e.h>
#endif

#if defined(CONFIG_CCM)
#include <platforms/ccm.h>
#endif

#if defined(CONFIG_LANTEC)
#include <platforms/lantec.h>
#endif

#if defined(CONFIG_MPC885ADS)
#include <platforms/mpc885ads.h>
#endif

/* Currently, all 8xx boards that support a processor to PCI/ISA bridge
 * use the same memory map.
 */
#if 0
#if defined(CONFIG_PCI) && defined(PCI_ISA_IO_ADDR)
#define	_IO_BASE PCI_ISA_IO_ADDR
#define	_ISA_MEM_BASE PCI_ISA_MEM_ADDR
#define PCI_DRAM_OFFSET 0x80000000
#else
#define _IO_BASE        0
#define _ISA_MEM_BASE   0
#define PCI_DRAM_OFFSET 0
#endif
#else
#if !defined(_IO_BASE)  /* defined in board specific header */
#define _IO_BASE        0
#endif
#define _ISA_MEM_BASE   0
#define PCI_DRAM_OFFSET 0
#endif

#ifndef __ASSEMBLY__
/* The "residual" data board information structure the boot loader
 * hands to us.
 */
extern unsigned char __res[];

struct pt_regs;

enum ppc_sys_devices {
	MPC8xx_CPM_FEC1,
	MPC8xx_CPM_FEC2,
	MPC8xx_CPM_I2C,
	MPC8xx_CPM_SCC1,
	MPC8xx_CPM_SCC2,
	MPC8xx_CPM_SCC3,
	MPC8xx_CPM_SCC4,
	MPC8xx_CPM_SPI,
	MPC8xx_CPM_MCC1,
	MPC8xx_CPM_MCC2,
	MPC8xx_CPM_SMC1,
	MPC8xx_CPM_SMC2,
	MPC8xx_CPM_USB,
};

#ifndef BOARD_CHIP_NAME
#define BOARD_CHIP_NAME ""
#endif

#endif /* !__ASSEMBLY__ */
#endif /* CONFIG_8xx */
#endif /* __CONFIG_8xx_DEFS */
#endif /* __KERNEL__ */


text:
<?php

namespace eXpansion\Framework\PlayersBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class eXpansionFrameworkPlayersBundle extends Bundle
{
}