text:
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<book xmlns:xi="http://www.w3.org/2001/XInclude">
  <info>
    <title>Gnip4j Reference Documentation</title>
    <productname>Gnup4j</productname>
    <releaseinfo>0.0</releaseinfo>

    <authorgroup>
      <author>
        <personname>Juan F. Codagnone</personname>
      </author>
      <author>
        <personname>Guido Marucci Blas</personname>
      </author>
    </authorgroup>

    <legalnotice>
      <para>Copyright 2011 Zauber S.A. All Rights Reserved.</para>

      <para>Copies of this document may be made for your own use and for
      distribution to others, provided that you do not charge any fee for such
      copies and further provided that each copy contains this Copyright
      Notice, whether distributed in print or electronically.</para>
    </legalnotice>
  </info>

  <toc></toc>

  <part xml:id="welcome">
    <title>Welcome to Gnip4j</title>

    <partintro>
      <para>Welcome to gnip4j! In this part of the reference guide we
      will explore everything you need to know in order to use gnip4j
      effectively.</para>
    </partintro>
    <xi:include href="intro.xml"/>
    <xi:include href="usage.xml"/>
    <xi:include href="monitoring.xml"/>
    <xi:include href="mule.xml"/>
  </part>
</book>


text:
var locationSocket;
// list of all registered callbacks
var callbacks = new Object();

require('net').createServer(function(socket) {

	// Stores socket of the location-server for future use (e.g., exports.artifact_conneced and exports.artifact_disconneced).
	locationSocket = socket;
	console.log("Connected to location-server at " + socket.remoteAddress + ":" + socket.remotePort);

	socket.on('data', function(data) {
		var locationChanges = JSON.parse(data.toString());
		for(var i in locationChanges) {
			// Invokes the callback to the server if data from the location-server is received.
			callbacks[location_events.artifact_event](locationChanges[i]);
		}
	});

	socket.on('close', function(data) {
		console.log("Disconnected from location-server.");
	});

	socket.on('error', function(data) {
		console.log("Error on TCP connection to location-server.");
	});
}).listen(8081);

// The server can register callbacks here.
exports.on = function(type, callback) {
	callbacks[type] = callback;
}

// WAMS has detected a new artifact.
exports.artifact_conneced = function(user) {
	if (typeof locationSocket !== 'undefined') {
		locationSocket.write(JSON.stringify( { event: location_events.artifact_conneced, uuid: user.uuid } ));
	}
}

// WAMS has detected that an existing artifact was removed.
exports.user_disconneced = function(user) {
	if (typeof locationSocket !== 'undefined') {
		locationSocket.write(JSON.stringify( { event: location_events.artifact_disconneced, uuid: user.uuid } ));
	}
}

// list of all possible location events
var location_events = exports.when = {
	artifact_conneced: "ART_CON",
	artifact_disconneced: "ART_DIS",
	artifact_event: "ART_EVT"
};

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_PRIVATE_H_
#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_PRIVATE_H_

#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h"
#include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registrar.h"

G_BEGIN_DECLS

/**
 * fl_plugin_registrar_new:
 * @view: (allow-none): the #FlView that is being plugged into or %NULL for
 * headless mode.
 * @messenger: the #FlBinaryMessenger to communicate with.
 *
 * Creates a new #FlPluginRegistrar.
 *
 * Returns: a new #FlPluginRegistrar.
 */
FlPluginRegistrar* fl_plugin_registrar_new(FlView* view,
                                           FlBinaryMessenger* messenger);

G_END_DECLS

#endif  // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_PRIVATE_H_


text:
Website hub - All my online presences together
Also reachable at [git.io/lolei](https://git.io/lolei)

## Info
Powered by [Hugo](https://gohugo.io/) and [one of these themes](https://github.com/LoLei/hugo/tree/master/hub/themes).

### Hugo
[Hugo content repo](https://github.com/LoLei/hugo)


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Saccardoa 2: 226 (1963)

#### Original name
Xystozukalia capsici Bat., A.F. Vital & Cif.

### Remarks
null


text:
package org.jboss.jbossts.qa.astests.taskdefs;

import java.util.Collection;
import java.util.ArrayList;

public class ServerTaskException extends Exception
{
    Collection<String> errors = new ArrayList<String> ();
    Exception cause;

    public ServerTaskException()
    {
    }

    public ServerTaskException(String message)
    {
        super(message);
    }

    public ServerTaskException(String message, Throwable cause)
    {
        super(message, cause);
    }

    public ServerTaskException(Throwable cause)
    {
        super(cause);
    }

    public void addError(String error)
    {
        errors.add(error);
    }

    public void setCause(Exception cause)
    {
        this.cause = cause;
    }

    public ServerTaskException getServerTaskException()
    {
        if (cause == null && errors.size() == 0)
            return this;

        StringBuilder msg = new StringBuilder();
        String nl = System.getProperty("line.separator");

        for (String error : errors)
        {
            msg.append(error).append(nl);
        }

        //noinspection ThrowableInstanceNeverThrown
        return new ServerTaskException(msg.toString(), cause);
    }
}


text:
from util.matrix import mult

class Transform:

    def __init__(self):

        self.trans_matrix = None

    def multipli(self, matrix):

    	m = mult(self.trans_matrix, matrix)
    	self.trans_matrix = m
    	return self


text:
using System;

namespace UnityEngine.EventSystems
{
    [AddComponentMenu("Event/Standalone Input Module")]
    public class StandaloneInputModule : PointerInputModule
    {
        private float m_NextAction;

        private Vector2 m_LastMousePosition;
        private Vector2 m_MousePosition;

        protected StandaloneInputModule()
        { }

        [Obsolete("Mode is no longer needed on input module as it handles both mouse and keyboard simultaneously.", false)]
        public enum InputMode
        {
            Mouse,
            Buttons
        }

        [Obsolete("Mode is no longer needed on input module as it handles both mouse and keyboard simultaneously.", false)]
        public InputMode inputMode
        {
            get { return InputMode.Mouse; }
        }

        [SerializeField]
        private string m_HorizontalAxis = "Horizontal";

        /// <summary>
        /// Name of the vertical axis for movement (if axis events are used).
        /// </summary>
        [SerializeField]
        private string m_VerticalAxis = "Vertical";

        /// <summary>
        /// Name of the submit button.
        /// </summary>
        [SerializeField]
        private string m_SubmitButton = "Submit";

        /// <summary>
        /// Name of the submit button.
        /// </summary>
        [SerializeField]
        private string m_CancelButton = "Cancel";

        [SerializeField]
        private float m_InputActionsPerSecond = 10;

        [SerializeField]
        private bool m_AllowActivationOnMobileDevice;

        public bool allowActivationOnMobileDevice
        {
            get { return m_AllowActivationOnMobileDevice; }
            set { m_AllowActivationOnMobileDevice = value; }
        }

        public float inputActionsPerSecond
        {
            get { return m_InputActionsPerSecond; }
            set { m_InputActionsPerSecond = value; }
        }

        /// <summary>
        /// Name of the horizontal axis for movement (if axis events are used).
        /// </summary>
        public string horizontalAxis
        {
            get { return m_HorizontalAxis; }
            set { m_HorizontalAxis = value; }
        }

        /// <summary>
        /// Name of the vertical axis for movement (if axis events are used).
        /// </summary>
        public string verticalAxis
        {
            get { return m_VerticalAxis; }
            set { m_VerticalAxis = value; }
        }

        public string submitButton
        {
            get { return m_SubmitButton; }
            set { m_SubmitButton = value; }
        }

        public string cancelButton
        {
            get { return m_CancelButton; }
            set { m_CancelButton = value; }
        }

        public override void UpdateModule()
        {
            m_LastMousePosition = m_MousePosition;
            m_MousePosition = Input.mousePosition;
        }

        public override bool IsModuleSupported()
        {
            // Check for mouse presence instead of whether touch is supported,
            // as you can connect mouse to a tablet and in that case we'd want
            // to use StandaloneInputModule for non-touch input events.
            return m_AllowActivationOnMobileDevice || Input.mousePresent;
        }

        public override bool ShouldActivateModule()
        {
            if (!base.ShouldActivateModule())
                return false;

            var shouldActivate = Input.GetButtonDown(m_SubmitButton);
            shouldActivate |= Input.GetButtonDown(m_CancelButton);
            shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_HorizontalAxis), 0.0f);
            shouldActivate |= !Mathf.Approximately(Input.GetAxisRaw(m_VerticalAxis), 0.0f);
            shouldActivate |= (m_MousePosition - m_LastMousePosition).sqrMagnitude > 0.0f;
            shouldActivate |= Input.GetMouseButtonDown(0);
            return shouldActivate;
        }

        public override void ActivateModule()
        {
            base.ActivateModule();
            m_MousePosition = Input.mousePosition;
            m_LastMousePosition = Input.mousePosition;

            var toSelect = eventSystem.currentSelectedGameObject;
            if (toSelect == null)
                toSelect = eventSystem.lastSelectedGameObject;
            if (toSelect == null)
                toSelect = eventSystem.firstSelectedGameObject;

            eventSystem.SetSelectedGameObject(toSelect, GetBaseEventData());
        }

        public override void DeactivateModule()
        {
            base.DeactivateModule();
            ClearSelection();
        }

        public override void Process()
        {
            bool usedEvent = SendUpdateEventToSelectedObject();

            if (eventSystem.sendNavigationEvents)
            {
                if (!usedEvent)
                    usedEvent |= SendMoveEventToSelectedObject();

                if (!usedEvent)
                    SendSubmitEventToSelectedObject();
            }

            ProcessMouseEvent();
        }

        /// <summary>
        /// Process submit keys.
        /// </summary>
        private bool SendSubmitEventToSelectedObject()
        {
            if (eventSystem.currentSelectedGameObject == null)
                return false;

            var data = GetBaseEventData();
            if (Input.GetButtonDown(m_SubmitButton))
                ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.submitHandler);

            if (Input.GetButtonDown(m_CancelButton))
                ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.cancelHandler);
            return data.used;
        }

        private bool AllowMoveEventProcessing(float time)
        {
            bool allow = Input.GetButtonDown(m_HorizontalAxis);
            allow |= Input.GetButtonDown(m_VerticalAxis);
            allow |= (time > m_NextAction);
            return allow;
        }

        private Vector2 GetRawMoveVector()
        {
            Vector2 move = Vector2.zero;
            move.x = Input.GetAxisRaw(m_HorizontalAxis);
            move.y = Input.GetAxisRaw(m_VerticalAxis);

            if (Input.GetButtonDown(m_HorizontalAxis))
            {
                if (move.x < 0)
                    move.x = -1f;
                if (move.x > 0)
                    move.x = 1f;
            }
            if (Input.GetButtonDown(m_VerticalAxis))
            {
                if (move.y < 0)
                    move.y = -1f;
                if (move.y > 0)
                    move.y = 1f;
            }
            return move;
        }

        /// <summary>
        /// Process keyboard events.
        /// </summary>
        private bool SendMoveEventToSelectedObject()
        {
            float time = Time.unscaledTime;

            if (!AllowMoveEventProcessing(time))
                return false;

            Vector2 movement = GetRawMoveVector();
            // Debug.Log(m_ProcessingEvent.rawType + " axis:" + m_AllowAxisEvents + " value:" + "(" + x + "," + y + ")");
            var axisEventData = GetAxisEventData(movement.x, movement.y, 0.6f);
            if (!Mathf.Approximately(axisEventData.moveVector.x, 0f)
                || !Mathf.Approximately(axisEventData.moveVector.y, 0f))
            {
                ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
            }
            m_NextAction = time + 1f / m_InputActionsPerSecond;
            return axisEventData.used;
        }

        /// <summary>
        /// Process all mouse events.
        /// </summary>
        private void ProcessMouseEvent()
        {
            var mouseData = GetMousePointerEventData();

            var pressed = mouseData.AnyPressesThisFrame();
            var released = mouseData.AnyReleasesThisFrame();

            var leftButtonData = mouseData.GetButtonState(PointerEventData.InputButton.Left).eventData;

            if (!UseMouse(pressed, released, leftButtonData.buttonData))
                return;

            // Process the first mouse button fully
            ProcessMousePress(leftButtonData);
            ProcessMove(leftButtonData.buttonData);
            ProcessDrag(leftButtonData.buttonData);

            // Now process right / middle clicks
            ProcessMousePress(mouseData.GetButtonState(PointerEventData.InputButton.Right).eventData);
            ProcessDrag(mouseData.GetButtonState(PointerEventData.InputButton.Right).eventData.buttonData);
            ProcessMousePress(mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData);
            ProcessDrag(mouseData.GetButtonState(PointerEventData.InputButton.Middle).eventData.buttonData);

            if (!Mathf.Approximately(leftButtonData.buttonData.scrollDelta.sqrMagnitude, 0.0f))
            {
                var scrollHandler = ExecuteEvents.GetEventHandler<IScrollHandler>(leftButtonData.buttonData.pointerCurrentRaycast.gameObject);
                ExecuteEvents.ExecuteHierarchy(scrollHandler, leftButtonData.buttonData, ExecuteEvents.scrollHandler);
            }
        }

        private static bool UseMouse(bool pressed, bool released, PointerEventData pointerData)
        {
            if (pressed || released || pointerData.IsPointerMoving() || pointerData.IsScrolling())
                return true;

            return false;
        }

        private bool SendUpdateEventToSelectedObject()
        {
            if (eventSystem.currentSelectedGameObject == null)
                return false;

            var data = GetBaseEventData();
            ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, data, ExecuteEvents.updateSelectedHandler);
            return data.used;
        }

        /// <summary>
        /// Process the current mouse press.
        /// </summary>
        private void ProcessMousePress(MouseButtonEventData data)
        {
            var pointerEvent = data.buttonData;
            var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;

            // PointerDown notification
            if (data.PressedThisFrame())
            {
                pointerEvent.eligibleForClick = true;
                pointerEvent.delta = Vector2.zero;
                pointerEvent.dragging = false;
                pointerEvent.useDragThreshold = true;
                pointerEvent.pressPosition = pointerEvent.position;
                pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;

                DeselectIfSelectionChanged(currentOverGo, pointerEvent);

                // search for the control that will receive the press
                // if we can't find a press handler set the press
                // handler to be what would receive a click.
                var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);

                // didnt find a press handler... search for a click handler
                if (newPressed == null)
                    newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);

                // Debug.Log("Pressed: " + newPressed);

                float time = Time.unscaledTime;

                if (newPressed == pointerEvent.lastPress)
                {
                    var diffTime = time - pointerEvent.clickTime;
                    if (diffTime < 0.3f)
                        ++pointerEvent.clickCount;
                    else
                        pointerEvent.clickCount = 1;

                    pointerEvent.clickTime = time;
                }
                else
                {
                    pointerEvent.clickCount = 1;
                }

                pointerEvent.pointerPress = newPressed;
                pointerEvent.rawPointerPress = currentOverGo;

                pointerEvent.clickTime = time;

                // Save the drag handler as well
                pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(currentOverGo);

                if (pointerEvent.pointerDrag != null)
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
            }

            // PointerUp notification
            if (data.ReleasedThisFrame())
            {
                // Debug.Log("Executing pressup on: " + pointer.pointerPress);
                ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);

                // Debug.Log("KeyCode: " + pointer.eventData.keyCode);

                // see if we mouse up on the same element that we clicked on...
                var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);

                // PointerClick and Drop events
                if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
                {
                    ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
                }
                else if (pointerEvent.pointerDrag != null)
                {
                    ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
                }

                pointerEvent.eligibleForClick = false;
                pointerEvent.pointerPress = null;
                pointerEvent.rawPointerPress = null;

                if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
                    ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);

                pointerEvent.dragging = false;
                pointerEvent.pointerDrag = null;

                // redo pointer enter / exit to refresh state
                // so that if we moused over somethign that ignored it before
                // due to having pressed on something else
                // it now gets it.
                if (currentOverGo != pointerEvent.pointerEnter)
                {
                    HandlePointerExitAndEnter(pointerEvent, null);
                    HandlePointerExitAndEnter(pointerEvent, currentOverGo);
                }
            }
        }
    }
}


text:
require_relative 'generic'
require_relative '../data'

module Discordrb::Events
  # Raised when a role is deleted from a server
  class GuildRoleDeleteEvent
    attr_reader :id, :server

    def initialize(data, bot)
      # The role should already be deleted from the server's list
      # by the time we create this event, so we'll create a temporary
      # role object for event consumers to use.
      @id = data['role_id'].to_i
      server_id = data['guild_id'].to_i
      @server = bot.server(server_id)
    end
  end

  # EventHandler for GuildRoleDeleteEvent
  class GuildRoleDeleteEventHandler < EventHandler
    def matches?(event)
      # Check for the proper event type
      return false unless event.is_a? GuildRoleDeleteEvent

      [
        matches_all(@attributes[:name], event.name) do |a, e|
          if a.is_a? String
            a == e.to_s
          else
            a == e
          end
        end
      ].reduce(true, &:&)
    end
  end
end


text:
package com.google.gerrit.gpg;

import static com.google.gerrit.gpg.PublicKeyStore.keyIdToString;
import static com.google.gerrit.gpg.PublicKeyStore.keyToString;
import static com.google.gerrit.gpg.testing.TestKeys.expiredKey;
import static com.google.gerrit.gpg.testing.TestKeys.validKeyWithExpiration;
import static com.google.gerrit.gpg.testing.TestKeys.validKeyWithoutExpiration;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;

import com.google.gerrit.gpg.testing.TestKey;
import com.google.gerrit.testing.GerritBaseTests;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPSignatureGenerator;
import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder;
import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
import org.eclipse.jgit.lib.CommitBuilder;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.PushCertificate;
import org.eclipse.jgit.transport.PushCertificateIdent;
import org.eclipse.jgit.transport.PushCertificateParser;
import org.eclipse.jgit.transport.SignedPushConfig;
import org.junit.Before;
import org.junit.Test;

public class PushCertificateCheckerTest extends GerritBaseTests {
  private InMemoryRepository repo;
  private PublicKeyStore store;
  private SignedPushConfig signedPushConfig;
  private PushCertificateChecker checker;

  @Before
  public void setUp() throws Exception {
    TestKey key1 = validKeyWithoutExpiration();
    TestKey key3 = expiredKey();
    repo = new InMemoryRepository(new DfsRepositoryDescription("repo"));
    store = new PublicKeyStore(repo);
    store.add(key1.getPublicKeyRing());
    store.add(key3.getPublicKeyRing());

    PersonIdent ident = new PersonIdent("A U Thor", "author@example.com");
    CommitBuilder cb = new CommitBuilder();
    cb.setAuthor(ident);
    cb.setCommitter(ident);
    assertEquals(RefUpdate.Result.NEW, store.save(cb));

    signedPushConfig = new SignedPushConfig();
    signedPushConfig.setCertNonceSeed("sekret");
    signedPushConfig.setCertNonceSlopLimit(60 * 24);
    checker = newChecker(true);
  }

  private PushCertificateChecker newChecker(boolean checkNonce) {
    PublicKeyChecker keyChecker = new PublicKeyChecker().setStore(store);
    return new PushCertificateChecker(keyChecker) {
      @Override
      protected Repository getRepository() {
        return repo;
      }

      @Override
      protected boolean shouldClose(Repository repo) {
        return false;
      }
    }.setCheckNonce(checkNonce);
  }

  @Test
  public void validCert() throws Exception {
    PushCertificate cert = newSignedCert(validNonce(), validKeyWithoutExpiration());
    assertNoProblems(cert);
  }

  @Test
  public void invalidNonce() throws Exception {
    PushCertificate cert = newSignedCert("invalid-nonce", validKeyWithoutExpiration());
    assertProblems(cert, "Invalid nonce");
  }

  @Test
  public void invalidNonceNotChecked() throws Exception {
    checker = newChecker(false);
    PushCertificate cert = newSignedCert("invalid-nonce", validKeyWithoutExpiration());
    assertNoProblems(cert);
  }

  @Test
  public void missingKey() throws Exception {
    TestKey key2 = validKeyWithExpiration();
    PushCertificate cert = newSignedCert(validNonce(), key2);
    assertProblems(cert, "No public keys found for key ID " + keyIdToString(key2.getKeyId()));
  }

  @Test
  public void invalidKey() throws Exception {
    TestKey key3 = expiredKey();
    PushCertificate cert = newSignedCert(validNonce(), key3);
    assertProblems(
        cert, "Invalid public key " + keyToString(key3.getPublicKey()) + ":\n  Key is expired");
  }

  @Test
  public void signatureByExpiredKeyBeforeExpiration() throws Exception {
    TestKey key3 = expiredKey();
    Date now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse("2005-07-10 12:00:00 -0400");
    PushCertificate cert = newSignedCert(validNonce(), key3, now);
    assertNoProblems(cert);
  }

  private String validNonce() {
    return signedPushConfig
        .getNonceGenerator()
        .createNonce(repo, System.currentTimeMillis() / 1000);
  }

  private PushCertificate newSignedCert(String nonce, TestKey signingKey) throws Exception {
    return newSignedCert(nonce, signingKey, null);
  }

  private PushCertificate newSignedCert(String nonce, TestKey signingKey, Date now)
      throws Exception {
    PushCertificateIdent ident =
        new PushCertificateIdent(signingKey.getFirstUserId(), System.currentTimeMillis(), -7 * 60);
    String payload =
        "certificate version 0.1\n"
            + "pusher "
            + ident.getRaw()
            + "\n"
            + "pushee test://localhost/repo.git\n"
            + "nonce "
            + nonce
            + "\n"
            + "\n"
            + "0000000000000000000000000000000000000000"
            + " deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
            + " refs/heads/master\n";
    PGPSignatureGenerator gen =
        new PGPSignatureGenerator(
            new BcPGPContentSignerBuilder(signingKey.getPublicKey().getAlgorithm(), PGPUtil.SHA1));

    if (now != null) {
      PGPSignatureSubpacketGenerator subGen = new PGPSignatureSubpacketGenerator();
      subGen.setSignatureCreationTime(false, now);
      gen.setHashedSubpackets(subGen.generate());
    }

    gen.init(PGPSignature.BINARY_DOCUMENT, signingKey.getPrivateKey());
    gen.update(payload.getBytes(UTF_8));
    PGPSignature sig = gen.generate();

    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    try (BCPGOutputStream out = new BCPGOutputStream(new ArmoredOutputStream(bout))) {
      sig.encode(out);
    }

    String cert = payload + new String(bout.toByteArray(), UTF_8);
    Reader reader = new InputStreamReader(new ByteArrayInputStream(cert.getBytes(UTF_8)), UTF_8);
    PushCertificateParser parser = new PushCertificateParser(repo, signedPushConfig);
    return parser.parse(reader);
  }

  private void assertProblems(PushCertificate cert, String first, String... rest) throws Exception {
    List<String> expected = new ArrayList<>();
    expected.add(first);
    expected.addAll(Arrays.asList(rest));
    CheckResult result = checker.check(cert).getCheckResult();
    assertEquals(expected, result.getProblems());
  }

  private void assertNoProblems(PushCertificate cert) {
    CheckResult result = checker.check(cert).getCheckResult();
    assertEquals(Collections.emptyList(), result.getProblems());
  }
}


text:
package br.mil.mar.casnav.mclm.misc;

import java.util.List;

import br.mil.mar.casnav.mclm.persistence.entity.Postgres;
import br.mil.mar.casnav.mclm.persistence.entity.PostgresTable;

public class PostgresSourcesCollection {
	private List<Postgres> servers;
	private int totalCount;

	public PostgresSourcesCollection( List<Postgres> servers ) {

		for ( Postgres server : servers ) {
			for ( PostgresTable table : server.getTables() ) {
				table.setServer( null );
			}
		}

		this.servers = servers;
		totalCount = servers.size();
	}

	public int getTotalCount() {
		return totalCount;
	}

	public List<Postgres> getServers() {
		return servers;
	}
}


text:
package org.rapidoid.util;

import org.junit.jupiter.api.Test;
import org.rapidoid.annotation.Authors;
import org.rapidoid.annotation.Since;
import org.rapidoid.commons.Str;
import org.rapidoid.data.JSON;
import org.rapidoid.test.TestCommons;
import org.rapidoid.u.U;

import java.util.Arrays;
import java.util.Set;

@Authors("Nikolche Mihajlovski")
@Since("5.3.0")
public class TUUIDTest extends TestCommons {

    @Test
    public void testTUUIDs() {
        int total = 100000;

        Set<TUUID> ids = U.set();

        for (int i = 0; i < total; i++) {
            TUUID id = new TUUID();
            byte[] bytes = id.toBytes();

            TUUID id2 = TUUID.fromBytes(bytes);
            byte[] bytes2 = id2.toBytes();

            eq(id, id2);
            eq(bytes.length, 24);
            isTrue(Arrays.equals(bytes, bytes2));

            String s1 = id.toString();
            String s2 = id2.toString();

            eq(s1, s2);

            TUUID id3 = TUUID.fromString(s1);
            eq(id, id3);

            ids.add(id);
        }

        eq(ids.size(), total);

        eq(new TUUID(0, 0, 0).toString(), "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
        eq(new TUUID(100000000000L, 200000000L, 3000000L).toString(), "AAAAF0h26AAAAAAAC-vCAAAAAAAALcbA");

        for (String chr : U.list("-", "_", "0", "6", "9", "A", "F", "K", "M", "X")) {
            String id = Str.mul(chr, 32);
            eq(TUUID.fromString(id).toString(), id);
        }
    }

    @Test
    public void testTUUIDasJSON() {
        String json = "{\"x\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}";
        eq(JSON.stringify(U.map("x", new TUUID(0, 0, 0))), json);
        eq(JSON.parse(json), U.map("x", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
        eq(JSON.parse(json, BeanWithId.class).x, new TUUID(0, 0, 0));
    }

    public static class BeanWithId {
        public TUUID x;
    }
}


text:
from __future__ import print_function
from ..Pipette import Pipette
from acq4.util import Qt
from ...Manager import getManager

class PatchPipette(Pipette):
    """Represents a single patch pipette, manipulator, and headstage.

    This class extends from the Pipette device class to provide automation and visual feedback
    on the status of the patch:

        * Whether a cell is currently patched
        * Input resistance, access resistance, and holding levels

    This is also a good place to implement pressure control, autopatching, slow voltage clamp, etc.
    """
    sigStateChanged = Qt.Signal(object)

    def __init__(self, deviceManager, config, name):
        self.pressures = {
            'out': 'atmosphere',
            'bath': 0.5,
            'approach': 0.5,
            'seal': 'user',
        }

        self._clampName = config.pop('clampDevice', None)
        self._clampDevice = None

        Pipette.__init__(self, deviceManager, config, name)
        self.state = "out"
        self.active = False

        self.pressureDevice = None
        if 'pressureDevice' in config:
            self.pressureDevice = PressureControl(config['pressureDevice'])

    def getPatchStatus(self):
        """Return a dict describing the status of the patched cell.

        Includes keys:
        * state ('bath', 'sealing', 'on-cell', 'whole-cell', etc..)
        * resting potential
        * resting current
        * input resistance
        * access resistance
        * capacitance
        * clamp mode ('ic' or 'vc')
        * timestamp of last measurement

        """
        # maybe 'state' should be available via a different method?

    def getPressure(self):
        pass

    def setPressure(self, pressure):
        if self.pressureDevice is None:
            return
        self.pressureDevice.setPressure(pressure)

    def setSelected(self):
        pass

    def approach(self):
        """Prepare pipette to enter tissue and patch a cell.

        - Move pipette to diagonal approach position
        - Auto-correct pipette offset
        - May increase pressure
        - Automatically hide tip/target markers when the tip is near the target
        """

    def seal(self):
        """Attempt to seal onto a cell.

        * switches to VC holding after passing 100 MOhm
        * increase suction if seal does not form
        """

    def setState(self, state):
        """out, bath, approach, seal, attached, breakin, wholecell
        """
        if self.pressureDevice is not None and state in self.pressures:
            p = self.pressures[state]
            if isinstance(p, str):
                self.pressureDevice.setSource(p)
                self.pressureDevice.setPressure(0)
            else:
                self.pressureDevice.setPressure(p)
                self.pressureDevice.setSource('regulator')

        self.state = state
        self.sigStateChanged.emit(self)

    def getState(self):
        return self.state

    def breakIn(self):
        """Rupture the cell membrane using negative current pulses.

        * -2 psi for 3 sec or until rupture
        * -4, -6, -8 psi if needed
        * longer wait time if needed
        """

    def setActive(self, active):
        self.active = active

    def clampDevice(self):
        if self._clampDevice is None:
            if self._clampName is None:
                return None
            self._clampDevice = getManager().getDevice(self._clampName)
        return self._clampDevice

    def autoPipetteOffset(self):
        clamp = self.clampDevice()
        if clamp is not None:
            clamp.autoPipetteOffset()

class PressureControl(Qt.QObject):
    def __init__(self, deviceName):
        Qt.QObject.__init__(self)
        man = getManager()
        self.device = man.getDevice(deviceName)

    def setPressure(self, p):
        """Set the regulated output pressure to the pipette.

        Note: this does _not_ change the configuration of any values.
        """
        self.device.setChanHolding('pressure_out', p)

    def setSource(self, mode):
        """Configure valves for the specified pressure source: "atmosphere", "user", or "regulator"
        """
        if mode == 'atmosphere':
            self.device.setChanHolding('user_valve', 0)
            self.device.setChanHolding('regulator_valve', 0)
        elif mode == 'user':
            self.device.setChanHolding('user_valve', 1)
            self.device.setChanHolding('regulator_valve', 0)
        elif mode == 'regulator':
            self.device.setChanHolding('regulator_valve', 1)
        else:
            raise ValueError("Unknown pressure source %r" % mode)


text:
<?php
// This file is part of Oauth2 authentication plugin for Moodle.
//
// Oauth2 authentication plugin for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Oauth2 authentication plugin for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Oauth2 authentication plugin for Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Unit tests for auth/googleoauth2/lib.php.
 *
 * @package    auth_googleoauth2
 * @category   phpunit
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

defined('MOODLE_INTERNAL') || die();

global $CFG;
require_once($CFG->dirroot . '/auth/googleoauth2/lib.php');

class auth_googleoauth2_lib_testcase extends advanced_testcase {

    /*
     * Test auth_googleoauth2_display_buttons()
     */
    public function test_auth_googleoauth2_display_buttons() {
        // A total fake test for checking that travis-ci works.
        $this->assertEquals(1, 1);
    }

}


text:
package gov.hhs.onc.dcdt.mail.smtp;

import gov.hhs.onc.dcdt.beans.ToolIdentifier;
import io.netty.buffer.ByteBuf;

public interface SmtpMessage<T extends Enum<T> & ToolIdentifier> {
    public ByteBuf toBuffer();

    public T getType();

    public void setType(T type);
}


text:
package mx.com.gapsi.eventos.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "INVITADO")
public class Invitado implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INVITADO_SEQ")
	@SequenceGenerator(name = "INVITADO_SEQ", sequenceName = "INVITADO_SEQ", allocationSize = 1)
	@Column(name = "ID_INVITADO")
	private Integer id;
	@ManyToOne(optional = false)
	@JoinColumn(name = "ID_TIPO_INVITADO")
	private TipoInvitado tipoInvitado;
	private String nombre;
	@Column(name = "AP_PATERNO")
	private String apPaterno;
	@Column(name = "AP_MATERNO")
	private String apMaterno;
	private String email;
	private String invitador;
	private String empresa;

	private transient String idEventoInvitado;

	//bi-directional many-to-one association to EventoInvitado
	//@OneToMany(mappedBy="invitado", fetch=FetchType.EAGER)
	@OneToMany(mappedBy="invitado", fetch=FetchType.LAZY)
	private List<EventoInvitado> eventoInvitados;

	@ManyToMany(mappedBy = "invitados", fetch = FetchType.EAGER)
	private List<Evento> eventos;

	public Invitado() {
	}

	public Invitado(Integer id, TipoInvitado tipoInvitado, String nombre, String apPaterno, String apMaterno,
			String email, String invitador, String empresa) {
		super();
		this.id = id;
		this.tipoInvitado = tipoInvitado;
		this.nombre = nombre;
		this.apPaterno = apPaterno;
		this.apMaterno = apMaterno;
		this.email = email;
		this.invitador = invitador;
		this.empresa = empresa;
	}

	public Invitado(TipoInvitado tipoInvitado, String nombre, String apPaterno, String apMaterno, String email,
			String invitador, String empresa) {
		this.tipoInvitado = tipoInvitado;
		this.nombre = nombre;
		this.apPaterno = apPaterno;
		this.apMaterno = apMaterno;
		this.email = email;
		this.invitador = invitador;
		this.empresa = empresa;
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the tipoInvitado
	 */
	public TipoInvitado getTipoInvitado() {
		return tipoInvitado;
	}

	/**
	 * @param tipoInvitado
	 *            the tipoInvitado to set
	 */
	public void setTipoInvitado(TipoInvitado tipoInvitado) {
		this.tipoInvitado = tipoInvitado;
	}

	/**
	 * @return the nombre
	 */
	public String getNombre() {
		return nombre;
	}

	/**
	 * @param nombre
	 *            the nombre to set
	 */
	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	/**
	 * @return the apPaterno
	 */
	public String getApPaterno() {
		return apPaterno;
	}

	/**
	 * @param apPaterno
	 *            the apPaterno to set
	 */
	public void setApPaterno(String apPaterno) {
		this.apPaterno = apPaterno;
	}

	/**
	 * @return the apMaterno
	 */
	public String getApMaterno() {
		return apMaterno;
	}

	/**
	 * @param apMaterno
	 *            the apMaterno to set
	 */
	public void setApMaterno(String apMaterno) {
		this.apMaterno = apMaterno;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email
	 *            the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the invitador
	 */
	public String getInvitador() {
		return invitador;
	}

	/**
	 * @param invitador
	 *            the invitador to set
	 */
	public void setInvitador(String invitador) {
		this.invitador = invitador;
	}

	/**
	 * @return the empresa
	 */
	public String getEmpresa() {
		return empresa;
	}

	/**
	 * @param empresa
	 *            the empresa to set
	 */
	public void setEmpresa(String empresa) {
		this.empresa = empresa;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Invitado)) {
			return false;
		}
		Invitado other = (Invitado) obj;
		if (id == null) {
			if (other.id != null) {
				return false;
			}
		} else if (!id.equals(other.id)) {
			return false;
		}
		return true;
	}

	/**
	 * @return the eventos
	 */
	public List<Evento> getEventos() {
		return eventos;
	}

	/**
	 * @param eventos
	 *            the eventos to set
	 */
	public void setEventos(List<Evento> eventos) {
		this.eventos = eventos;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Invitado [id=" + id + ", tipoInvitado=" + tipoInvitado + ", nombre=" + nombre + ", apPaterno="
				+ apPaterno + ", apMaterno=" + apMaterno + ", email=" + email + ", invitador=" + invitador
				+ ", eventos=" + eventos + "]";
	}
	public List<EventoInvitado> getEventoInvitados() {
		return this.eventoInvitados;
	}

	public EventoInvitado getEventoInvitado() {
		for (EventoInvitado eventoInvitado : eventoInvitados) {
			if (eventoInvitado!=null && eventoInvitado.getEstatus()!=null){
				return eventoInvitado;
			}
		}
		return new EventoInvitado();
	}

	public void setEventoInvitados(List<EventoInvitado> eventoInvitados) {
		this.eventoInvitados = eventoInvitados;
	}

	public EventoInvitado addEventoInvitado(EventoInvitado eventoInvitado) {
		getEventoInvitados().add(eventoInvitado);
		eventoInvitado.setInvitado(this);

		return eventoInvitado;
	}

	public EventoInvitado removeEventoInvitado(EventoInvitado eventoInvitado) {
		getEventoInvitados().remove(eventoInvitado);
		eventoInvitado.setInvitado(null);

		return eventoInvitado;
	}

	/**
	 * @return the nombreFull
	 */
//	@Transient
	public String getNombreFull() {
		return nombre+" "+apPaterno+" "+apMaterno;
	}

	/**
	 * @param nombreFull the nombreFull to set
	 */
//	@Transient
	public void setNombreFull(String nombreFull) {

	}

	public String getIdEventoInvitado() {
		return idEventoInvitado;
	}

	public void setIdEventoInvitado(String idEventoInvitado) {
		this.idEventoInvitado = idEventoInvitado;
	}
}


text:
class Choice < ActiveRecord::Base
  belongs_to :question

  validates :option, :question_id, presence: true
end


text:
import genusTypes         from '../../../../constants/genus_types';
import imageSequence      from './image_sequence';

describe('imageSequence', () => {

  let item;

  beforeEach(() => {
    item = {
      id: '1234',
      genusTypeId: 'item-genus-type%3Aqti-order-interaction-object-manipulation%40ODL.MIT.EDU',
      bankId: 'myBank',
      displayName: {
        text: 'displayYourText',
      },
      answers: [{
        id: '1',
        feedback: { text: '
Howdy
' },
        genusTypeId: genusTypes.answer.rightAnswer,
        fileIds: {},
        choiceIds: []
      }, {
        id: '2',
        feedback: { text: '
hiya
' },
        genusTypeId: genusTypes.answer.wrongAnswer,
        fileIds: {}
      }],
      question: {
        shuffle: 'This is true',
        id: 'questionId',
        fileIds: {},
        texts: {},
        text: {
          text: 'this is your text.text',
        }
      }
    };
  });

  it('should deserialize feedback', () => {
    const expectedFeedback = {
      answerId: '1',
      text: '
Howdy
',
      fileIds: {},
    };
    const result = imageSequence(item);
    expect(result.question.correctFeedback).toEqual(expectedFeedback);
  });
});


text:
// Configuration for Wiredep task(s)
// Injects Bower packages into your source code.
'use strict';

var taskConfig = function(grunt) {

  grunt.config.set('wiredep', {
    app: {
      options: {
        ignorePath: /client\/|\.\.\//g,
        // Make sure everything has an absolute path (starts with '/')
        fileTypes: {
          html: {
            replace: {
              js: '<script src="/{{filePath}}"></script>',
              css: '<link rel="stylesheet" href="/{{filePath}}" />'
            }
          }
        },
        // packages to ignore
        exclude: [
          'bower_components/html5shiv/',
          'bower_components/consolelog/',
          'bower_components/modernizr/',
          'bower_components/es5-shim/'
        ],
        overrides: {
        }
      },
      src: [
        '<%= yeogurt.client %>/index.html'
      ]
    },
    styles: {
      src: ['<%= yeogurt.client %>/styles/**/*.{scss,sass}'],
      ignorePath: /client/g,
    }
  });

};

module.exports = taskConfig;


text:
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import {
  Contents, Kernel
} from '@jupyterlab/services';

import {
  ArrayExt, ArrayIterator, IIterator, each, empty, find, map
} from '@phosphor/algorithm';

import {
  Token
} from '@phosphor/coreutils';

import {
  IDisposable, DisposableDelegate
} from '@phosphor/disposable';

import {
  ISignal, Signal
} from '@phosphor/signaling';

import {
  Widget
} from '@phosphor/widgets';

import {
  IClientSession
} from '@jupyterlab/apputils';

import {
  CodeEditor
} from '@jupyterlab/codeeditor';

import {
  IChangedArgs as IChangedArgsGeneric, PathExt, IModelDB
} from '@jupyterlab/coreutils';

/* tslint:disable */
/**
 * The document registry token.
 */
export
const IDocumentRegistry = new Token<IDocumentRegistry>('jupyter.services.document-registry');
/* tslint:enable */

/**
 * The interface for a document registry.
 */
export
interface IDocumentRegistry extends DocumentRegistry {}

/**
 * The document registry.
 */
export
class DocumentRegistry implements IDisposable {
  /**
   * A signal emitted when the registry has changed.
   */
  get changed(): ISignal<this, DocumentRegistry.IChangedArgs> {
    return this._changed;
  }

  /**
   * Get whether the document registry has been disposed.
   */
  get isDisposed(): boolean {
    return this._widgetFactories === null;
  }

  /**
   * Dispose of the resources held by the document registery.
   */
  dispose(): void {
    if (this._widgetFactories === null) {
      return;
    }
    let widgetFactories = this._widgetFactories;
    let modelFactories = this._modelFactories;
    let extenders = this._extenders;
    this._widgetFactories = null;
    this._modelFactories = null;
    this._extenders = null;

    for (let modelName in modelFactories) {
      modelFactories[modelName].dispose();
    }
    for (let widgetName in widgetFactories) {
      widgetFactories[widgetName].dispose();
    }
    for (let widgetName in extenders) {
      extenders[widgetName].length = 0;
    }

    this._fileTypes.length = 0;
    this._creators.length = 0;
    Signal.clearData(this);
  }

  /**
   * Add a widget factory to the registry.
   *
   * @param factory - The factory instance to register.
   *
   * @returns A disposable which will unregister the factory.
   *
   * #### Notes
   * If a factory with the given `'displayName'` is already registered,
   * a warning will be logged, and this will be a no-op.
   * If `'*'` is given as a default extension, the factory will be registered
   * as the global default.
   * If an extension or global default is already registered, this factory
   * will override the existing default.
   */
  addWidgetFactory(factory: DocumentRegistry.WidgetFactory): IDisposable {
    let name = factory.name.toLowerCase();
    if (this._widgetFactories[name]) {
      console.warn(`Duplicate registered factory ${name}`);
      return new DisposableDelegate(null);
    }
    this._widgetFactories[name] = factory;
    for (let ext of factory.defaultFor) {
      if (factory.fileExtensions.indexOf(ext) === -1) {
        continue;
      }
      if (ext === '*') {
        this._defaultWidgetFactory = name;
      } else {
        this._defaultWidgetFactories[ext] = name;
      }
    }
    // For convenience, store a mapping of ext -> name
    for (let ext of factory.fileExtensions) {
      if (!this._widgetFactoryExtensions[ext]) {
        this._widgetFactoryExtensions[ext] = [];
      }
      this._widgetFactoryExtensions[ext].push(name);
    }
    this._changed.emit({
      type: 'widgetFactory',
      name,
      change: 'added'
    });
    return new DisposableDelegate(() => {
      delete this._widgetFactories[name];
      if (this._defaultWidgetFactory === name) {
        this._defaultWidgetFactory = '';
      }
      for (let ext of Object.keys(this._defaultWidgetFactories)) {
        if (this._defaultWidgetFactories[ext] === name) {
          delete this._defaultWidgetFactories[ext];
        }
      }
      for (let ext of Object.keys(this._widgetFactoryExtensions)) {
        ArrayExt.removeFirstOf(this._widgetFactoryExtensions[ext], name);
        if (this._widgetFactoryExtensions[ext].length === 0) {
          delete this._widgetFactoryExtensions[ext];
        }
      }
      this._changed.emit({
        type: 'widgetFactory',
        name,
        change: 'removed'
      });
    });
  }

  /**
   * Add a model factory to the registry.
   *
   * @param factory - The factory instance.
   *
   * @returns A disposable which will unregister the factory.
   *
   * #### Notes
   * If a factory with the given `name` is already registered, or
   * the given factory is already registered, a warning will be logged
   * and this will be a no-op.
   */
  addModelFactory(factory: DocumentRegistry.ModelFactory): IDisposable {
    let name = factory.name.toLowerCase();
    if (this._modelFactories[name]) {
      console.warn(`Duplicate registered factory ${name}`);
      return new DisposableDelegate(null);
    }
    this._modelFactories[name] = factory;
    this._changed.emit({
      type: 'modelFactory',
      name,
      change: 'added'
    });
    return new DisposableDelegate(() => {
      delete this._modelFactories[name];
      this._changed.emit({
        type: 'modelFactory',
        name,
        change: 'removed'
      });
    });
  }

  /**
   * Add a widget extension to the registry.
   *
   * @param widgetName - The name of the widget factory.
   *
   * @param extension - A widget extension.
   *
   * @returns A disposable which will unregister the extension.
   *
   * #### Notes
   * If the extension is already registered for the given
   * widget name, a warning will be logged and this will be a no-op.
   */
  addWidgetExtension(widgetName: string, extension: DocumentRegistry.WidgetExtension): IDisposable {
    widgetName = widgetName.toLowerCase();
    if (!(widgetName in this._extenders)) {
      this._extenders[widgetName] = [];
    }
    let extenders = this._extenders[widgetName];
    let index = ArrayExt.firstIndexOf(extenders, extension);
    if (index !== -1) {
      console.warn(`Duplicate registered extension for ${widgetName}`);
      return new DisposableDelegate(null);
    }
    this._extenders[widgetName].push(extension);
    this._changed.emit({
      type: 'widgetExtension',
      name: null,
      change: 'added'
    });
    return new DisposableDelegate(() => {
      ArrayExt.removeFirstOf(this._extenders[widgetName], extension);
      this._changed.emit({
        type: 'widgetExtension',
        name: null,
        change: 'removed'
      });
    });
  }

  /**
   * Add a file type to the document registry.
   *
   * @params fileType - The file type object to register.
   *
   * @returns A disposable which will unregister the command.
   *
   * #### Notes
   * These are used to populate the "Create New" dialog.
   */
  addFileType(fileType: DocumentRegistry.IFileType): IDisposable {
    this._fileTypes.push(fileType);
    this._changed.emit({
      type: 'fileType',
      name: fileType.name,
      change: 'added'
    });
    return new DisposableDelegate(() => {
      ArrayExt.removeFirstOf(this._fileTypes, fileType);
      this._changed.emit({
        type: 'fileType',
        name: fileType.name,
        change: 'removed'
      });
    });
  }

  /**
   * Add a creator to the registry.
   *
   * @params creator - The file creator object to register.
   *
   * @returns A disposable which will unregister the creator.
   */
  addCreator(creator: DocumentRegistry.IFileCreator): IDisposable {
    let index = ArrayExt.findFirstIndex(this._creators, (value) => {
      return value.name.localeCompare(creator.name) > 0;
    });
    if (index !== -1) {
      ArrayExt.insert(this._creators, index, creator);
    } else {
      this._creators.push(creator);
    }
    this._changed.emit({
      type: 'fileCreator',
      name: creator.name,
      change: 'added'
    });
    return new DisposableDelegate(() => {
      ArrayExt.removeFirstOf(this._creators, creator);
      this._changed.emit({
        type: 'fileCreator',
        name: creator.name,
        change: 'removed'
      });
    });
  }

  /**
   * Get a list of the preferred widget factories.
   *
   * @param ext - An optional file extension to filter the results.
   *
   * @returns A new array of widget factories.
   *
   * #### Notes
   * Only the widget factories whose associated model factory have
   * been registered will be returned.
   * The first item is considered the default. The returned iterator
   * has widget factories in the following order:
   * - extension-specific default factory
   * - global default factory
   * - all other extension-specific factories
   * - all other global factories
   */
  preferredWidgetFactories(ext: string = '*'): DocumentRegistry.WidgetFactory[] {
    let factories = new Set<string>();
    ext = Private.normalizeExtension(ext);
    let last = '.' + ext.split('.').pop();

    // Start with the extension-specific default factory.
    if (ext.length > 1) {
      if (ext in this._defaultWidgetFactories) {
        factories.add(this._defaultWidgetFactories[ext]);
      }
    }

    // Handle multi-part extension default factories.
    if (last !== ext) {
      if (last in this._defaultWidgetFactories) {
        factories.add(this._defaultWidgetFactories[last]);
      }
    }

    // Add the global default factory.
    if (this._defaultWidgetFactory) {
      factories.add(this._defaultWidgetFactory);
    }

    // Add the extension-specific factories in registration order.
    if (ext.length > 1) {
      if (ext in this._widgetFactoryExtensions) {
        each(this._widgetFactoryExtensions[ext], n => {
          factories.add(n);
        });
      }
    }

    // Handle multi-part extension-specific factories.
    if (last !== ext) {
      if (last in this._widgetFactoryExtensions) {
        each(this._widgetFactoryExtensions[last], n => {
          factories.add(n);
        });
      }
    }

    // Add the rest of the global factories, in registration order.
    if ('*' in this._widgetFactoryExtensions) {
      each(this._widgetFactoryExtensions['*'], n => {
        factories.add(n);
      });
    }

    // Construct the return list, checking to make sure the corresponding
    // model factories are registered.
    let factoryList: DocumentRegistry.WidgetFactory[] = [];
    factories.forEach(name => {
      if (this._widgetFactories[name].modelName in this._modelFactories) {
        factoryList.push(this._widgetFactories[name]);
      }
    });

    return factoryList;
  }

  /**
   * Get the default widget factory for an extension.
   *
   * @param ext - An optional file extension to filter the results.
   *
   * @returns The default widget factory for an extension.
   *
   * #### Notes
   * This is equivalent to the first value in [[preferredWidgetFactories]].
   */
  defaultWidgetFactory(ext: string = '*'): DocumentRegistry.WidgetFactory {
    return this.preferredWidgetFactories(ext)[0];
  }

  /**
   * Create an iterator over the widget factories that have been registered.
   *
   * @returns A new iterator of widget factories.
   */
  widgetFactories(): IIterator<DocumentRegistry.WidgetFactory> {
    return map(Object.keys(this._widgetFactories), name => {
      return this._widgetFactories[name];
    });
  }

  /**
   * Create an iterator over the model factories that have been registered.
   *
   * @returns A new iterator of model factories.
   */
  modelFactories(): IIterator<DocumentRegistry.ModelFactory> {
    return map(Object.keys(this._modelFactories), name => {
      return this._modelFactories[name];
    });
  }

  /**
   * Create an iterator over the registered extensions for a given widget.
   *
   * @param widgetName - The name of the widget factory.
   *
   * @returns A new iterator over the widget extensions.
   */
  widgetExtensions(widgetName: string): IIterator<DocumentRegistry.WidgetExtension> {
    widgetName = widgetName.toLowerCase();
    if (!(widgetName in this._extenders)) {
      return empty<DocumentRegistry.WidgetExtension>();
    }
    return new ArrayIterator(this._extenders[widgetName]);
  }

  /**
   * Create an iterator over the file types that have been registered.
   *
   * @returns A new iterator of file types.
   */
  fileTypes(): IIterator<DocumentRegistry.IFileType> {
    return new ArrayIterator(this._fileTypes);
  }

  /**
   * Create an iterator over the file creators that have been registered.
   *
   * @returns A new iterator of file creatores.
   */
  creators(): IIterator<DocumentRegistry.IFileCreator> {
    return new ArrayIterator(this._creators);
  }

  /**
   * Get a widget factory by name.
   *
   * @param widgetName - The name of the widget factory.
   *
   * @returns A widget factory instance.
   */
  getWidgetFactory(widgetName: string): DocumentRegistry.WidgetFactory {
    return this._widgetFactories[widgetName.toLowerCase()];
  }

  /**
   * Get a model factory by name.
   *
   * @param name - The name of the model factory.
   *
   * @returns A model factory instance.
   */
  getModelFactory(name: string): DocumentRegistry.ModelFactory {
    return this._modelFactories[name.toLowerCase()];
  }

  /**
   * Get a file type by name.
   */
  getFileType(name: string): DocumentRegistry.IFileType {
    name = name.toLowerCase();
    return find(this._fileTypes, fileType => {
      return fileType.name.toLowerCase() === name;
    });
  }

  /**
   * Get a creator by name.
   */
  getCreator(name: string): DocumentRegistry.IFileCreator {
    name = name.toLowerCase();
    return find(this._creators, creator => {
      return creator.name.toLowerCase() === name;
    });
  }

  /**
   * Get a kernel preference.
   *
   * @param ext - The file extension.
   *
   * @param widgetName - The name of the widget factory.
   *
   * @param kernel - An optional existing kernel model.
   *
   * @returns A kernel preference.
   */
  getKernelPreference(ext: string, widgetName: string, kernel?: Kernel.IModel): IClientSession.IKernelPreference {
    ext = Private.normalizeExtension(ext);
    widgetName = widgetName.toLowerCase();
    let widgetFactory = this._widgetFactories[widgetName];
    if (!widgetFactory) {
      return void 0;
    }
    let modelFactory = this.getModelFactory(widgetFactory.modelName);
    if (!modelFactory) {
      return void 0;
    }
    let language = modelFactory.preferredLanguage(ext);
    let name = kernel && kernel.name;
    let id = kernel && kernel.id;
    return {
      id,
      name,
      language,
      shouldStart: widgetFactory.preferKernel,
      canStart: widgetFactory.canStartKernel
    };
  }

  private _modelFactories: { [key: string]: DocumentRegistry.ModelFactory } = Object.create(null);
  private _widgetFactories: { [key: string]: DocumentRegistry.WidgetFactory } = Object.create(null);
  private _defaultWidgetFactory = '';
  private _defaultWidgetFactories: { [key: string]: string } = Object.create(null);
  private _widgetFactoryExtensions: {[key: string]: string[] } = Object.create(null);
  private _fileTypes: DocumentRegistry.IFileType[] = [];
  private _creators: DocumentRegistry.IFileCreator[] = [];
  private _extenders: { [key: string] : DocumentRegistry.WidgetExtension[] } = Object.create(null);
  private _changed = new Signal<this, DocumentRegistry.IChangedArgs>(this);
}

/**
 * The namespace for the `DocumentRegistry` class statics.
 */
export
namespace DocumentRegistry {
  /**
   * The interface for a document model.
   */
  export
  interface IModel extends IDisposable {
    /**
     * A signal emitted when the document content changes.
     */
    contentChanged: ISignal<this, void>;

    /**
     * A signal emitted when the model state changes.
     */
    stateChanged: ISignal<this, IChangedArgsGeneric<any>>;

    /**
     * The dirty state of the model.
     *
     * #### Notes
     * This should be cleared when the document is loaded from
     * or saved to disk.
     */
    dirty: boolean;

    /**
     * The read-only state of the model.
     */
    readOnly: boolean;

    /**
     * The default kernel name of the document.
     */
    readonly defaultKernelName: string;

    /**
     * The default kernel language of the document.
     */
    readonly defaultKernelLanguage: string;

    /**
     * The underlying `IModelDB` instance in which model
     * data is stored.
     *
     * ### Notes
     * Making direct edits to the values stored in the`IModelDB`
     * is not recommended, and may produce unpredictable results.
     */
    readonly modelDB: IModelDB;

    /**
     * Serialize the model to a string.
     */
    toString(): string;

    /**
     * Deserialize the model from a string.
     *
     * #### Notes
     * Should emit a [contentChanged] signal.
     */
    fromString(value: string): void;

    /**
     * Serialize the model to JSON.
     */
    toJSON(): any;

    /**
     * Deserialize the model from JSON.
     *
     * #### Notes
     * Should emit a [contentChanged] signal.
     */
    fromJSON(value: any): void;
  }

  /**
   * The interface for a document model that represents code.
   */
  export
  interface ICodeModel extends IModel, CodeEditor.IModel { }

  /**
   * The document context object.
   */
  export
  interface IContext<T extends IModel> extends IDisposable {
    /**
     * A signal emitted when the path changes.
     */
    pathChanged: ISignal<this, string>;

    /**
     * A signal emitted when the contentsModel changes.
     */
    fileChanged: ISignal<this, Contents.IModel>;

    /**
     * A signal emitted when the context is disposed.
     */
    disposed: ISignal<this, void>;

    /**
     * Get the model associated with the document.
     */
    readonly model: T;

    /**
     * The client session object associated with the context.
     */
    readonly session: IClientSession;

    /**
     * The current path associated with the document.
     */
    readonly path: string;

    /**
     * The current contents model associated with the document
     *
     * #### Notes
     * The model will have an empty `contents` field.
     * It will be `null` until the context is ready.
     */
    readonly contentsModel: Contents.IModel;

    /**
     * Whether the context is ready.
     */
    readonly isReady: boolean;

    /**
     * A promise that is fulfilled when the context is ready.
     */
    readonly ready: Promise<void>;

    /**
     * Save the document contents to disk.
     */
    save(): Promise<void>;

    /**
     * Save the document to a different path chosen by the user.
     */
    saveAs(): Promise<void>;

    /**
     * Revert the document contents to disk contents.
     */
    revert(): Promise<void>;

    /**
     * Create a checkpoint for the file.
     *
     * @returns A promise which resolves with the new checkpoint model when the
     *   checkpoint is created.
     */
    createCheckpoint(): Promise<Contents.ICheckpointModel>;

    /**
     * Delete a checkpoint for the file.
     *
     * @param checkpointID - The id of the checkpoint to delete.
     *
     * @returns A promise which resolves when the checkpoint is deleted.
     */
    deleteCheckpoint(checkpointID: string): Promise<void>;

    /**
     * Restore the file to a known checkpoint state.
     *
     * @param checkpointID - The optional id of the checkpoint to restore,
     *   defaults to the most recent checkpoint.
     *
     * @returns A promise which resolves when the checkpoint is restored.
     */
    restoreCheckpoint(checkpointID?: string): Promise<void>;

    /**
     * List available checkpoints for the file.
     *
     * @returns A promise which resolves with a list of checkpoint models for
     *    the file.
     */
    listCheckpoints(): Promise<Contents.ICheckpointModel[]>;

    /**
     * Resolve a relative url to a correct server path.
     */
    resolveUrl(url: string): Promise<string>;

    /**
     * Get the download url of a given absolute server path.
     */
    getDownloadUrl(path: string): Promise<string>;

    /**
     * Add a sibling widget to the document manager.
     *
     * @param widget - The widget to add to the document manager.
     *
     * @returns A disposable used to remove the sibling if desired.
     *
     * #### Notes
     * It is assumed that the widget has the same model and context
     * as the original widget.
     */
    addSibling(widget: Widget): IDisposable;
  }

  /**
   * A type alias for a context.
   */
  export
  type Context = IContext<IModel>;

  /**
   * A type alias for a code context.
   */
  export
  type CodeContext = IContext<ICodeModel>;

  /**
   * The options used to initialize a widget factory.
   */
  export
  interface IWidgetFactoryOptions {
    /**
     * The file extensions the widget can view.
     *
     * #### Notes
     * Use "*" to denote all files. Specific file extensions must be preceded
     * with '.', like '.png', '.txt', etc.  They may themselves contain a
     * period (e.g. .table.json).
     */
    readonly fileExtensions: string[];

    /**
     * The name of the widget to display in dialogs.
     */
    readonly name: string;

    /**
     * The file extensions for which the factory should be the default.
     *
     * #### Notes
     * Use "*" to denote all files. Specific file extensions must be preceded
     * with '.', like '.png', '.txt', etc. Entries in this attribute must also
     * be included in the fileExtensions attribute.
     * The default is an empty array.
     *
     * **See also:** [[fileExtensions]].
     */
    readonly defaultFor?: string[];

    /**
     * The registered name of the model type used to create the widgets.
     */
    readonly modelName?: string;

    /**
     * Whether the widgets prefer having a kernel started.
     */
    readonly preferKernel?: boolean;

    /**
     * Whether the widgets can start a kernel when opened.
     */
    readonly canStartKernel?: boolean;
  }

  /**
   * The interface for a widget factory.
   */
  export
  interface IWidgetFactory<T extends Widget, U extends IModel> extends IDisposable, IWidgetFactoryOptions {
    /**
     * A signal emitted when a widget is created.
     */
    widgetCreated: ISignal<IWidgetFactory<T, U>, T>;

    /**
     * Create a new widget given a context.
     *
     * #### Notes
     * It should emit the [widgetCreated] signal with the new widget.
     */
    createNew(context: IContext<U>): T;
  }

  /**
   * A type alias for a standard widget factory.
   */
  export
  type WidgetFactory = IWidgetFactory<Widget, IModel>;

  /**
   * An interface for a widget extension.
   */
  export
  interface IWidgetExtension<T extends Widget, U extends IModel> {
    /**
     * Create a new extension for a given widget.
     */
    createNew(widget: T, context: IContext<U>): IDisposable;
  }

  /**
   * A type alias for a standard widget extension.
   */
  export
  type WidgetExtension = IWidgetExtension<Widget, IModel>;

  /**
   * The interface for a model factory.
   */
  export
  interface IModelFactory<T extends IModel> extends IDisposable {
    /**
     * The name of the model.
     */
    readonly name: string;

    /**
     * The content type of the file (defaults to `"file"`).
     */
    readonly contentType: Contents.ContentType;

    /**
     * The format of the file (defaults to `"text"`).
     */
    readonly fileFormat: Contents.FileFormat;

    /**
     * Create a new model for a given path.
     *
     * @param languagePreference - An optional kernel language preference.
     *
     * @returns A new document model.
     */
    createNew(languagePreference?: string, modelDB?: IModelDB): T;

    /**
     * Get the preferred kernel language given an extension.
     */
    preferredLanguage(ext: string): string;
  }

  /**
   * A type alias for a standard model factory.
   */
  export
  type ModelFactory = IModelFactory<IModel>;

  /**
   * A type alias for a code model factory.
   */
  export
  type CodeModelFactory = IModelFactory<ICodeModel>;

  /**
   * An interface for a file type.
   */
  export
  interface IFileType {
    /**
     * The name of the file type.
     */
    readonly name: string;

    /**
     * The extension of the file type (e.g. `".txt"`).  Can be a compound
     * extension (e.g. `".table.json:`).
     */
    readonly extension: string;

    /**
     * The optional mimetype of the file type.
     */
    readonly mimetype?: string;

    /**
     * The optional icon class to use for the file type.
     */
    readonly icon?: string;

    /**
     * The content type of the new file (defaults to `"file"`).
     */
    readonly contentType?: Contents.ContentType;

    /**
     * The format of the new file (default to `"text"`).
     */
    readonly fileFormat?: Contents.FileFormat;
  }

  /**
   * An interface for a "Create New" item.
   */
  export
  interface IFileCreator {
    /**
     * The name of the file creator.
     */
    readonly name: string;

    /**
     * The filetype name associated with the creator.
     */
    readonly fileType: string;

    /**
     * The optional widget name.
     */
    readonly widgetName?: string;

    /**
     * The optional kernel name.
     */
    readonly kernelName?: string;
  }

  /**
   * An arguments object for the `changed` signal.
   */
  export
  interface IChangedArgs {
    /**
     * The type of the changed item.
     */
    readonly type: 'widgetFactory' | 'modelFactory' | 'widgetExtension' | 'fileCreator' | 'fileType';

    /**
     * The name of the item.
     */
    readonly name: string;

    /**
     * Whether the item was added or removed.
     */
    readonly change: 'added' | 'removed';
  }

  /**
   * Get the extension name of a path.
   *
   * @param file - string.
   *
   * #### Notes
   * Dotted filenames (e.g. `".table.json"` are allowed.
   */
  export
  function extname(path: string): string {
    let parts = PathExt.basename(path).split('.');
    parts.shift();
    return '.' + parts.join('.');
  }
}

/**
 * A private namespace for DocumentRegistry data.
 */
namespace Private {
  /**
   * Normalize a file extension to be of the type `'.foo'`.
   *
   * Adds a leading dot if not present and converts to lower case.
   */
  export
  function normalizeExtension(extension: string): string {
    if (extension === '*') {
      return extension;
    }
    if (extension === '.*') {
      return '*';
    }
    if (extension.indexOf('.') !== 0) {
      extension = `.${extension}`;
    }
    return extension.toLowerCase();
  }
}


text:
using System;
using System.Linq;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Moq;
using SonarLint.VisualStudio.Integration.UnitTests;
using SonarLint.VisualStudio.IssueVisualization.Editor.SelectedIssueTagging;
using SonarLint.VisualStudio.IssueVisualization.Editor.SelectedIssueTagging.Adornment;
using static SonarLint.VisualStudio.IssueVisualization.Editor.SelectedIssueTagging.Adornment.IssueLocationAdornmentTagger;
using static SonarLint.VisualStudio.IssueVisualization.UnitTests.Editor.Common.TaggerTestHelper;

namespace SonarLint.VisualStudio.IssueVisualization.UnitTests.Editor.SelectedIssueTagging.Adornment
{
    [TestClass]
    public class IssueLocationAdornmentTaggerTests
    {
        private static readonly IWpfTextView ValidTextView = CreateWpfTextView();

        [TestInitialize]
        public void TestInitialize()
        {
            ThreadHelper.SetCurrentThreadAsUIThread();
        }

        [TestMethod]
        public void Ctor_SubscribesToEvents()
        {
            var aggregatorMock = new Mock<ITagAggregator<ISelectedIssueLocationTag>>();
            aggregatorMock.SetupAdd(x => x.BatchedTagsChanged += (sender, args) => { });

            // Act
            var testSubject = new IssueLocationAdornmentTagger(aggregatorMock.Object, ValidTextView);

            var expectedCallCount = Times.Exactly(2); // once for our class, once for the base class
            aggregatorMock.VerifyAdd(x => x.BatchedTagsChanged += It.IsAny<EventHandler<BatchedTagsChangedEventArgs>>(), expectedCallCount);
        }

        [TestMethod]
        public void Dispose_UnsubscribesFromEvents()
        {
            var aggregatorMock = new Mock<ITagAggregator<ISelectedIssueLocationTag>>();
            aggregatorMock.SetupRemove(x => x.BatchedTagsChanged -= (sender, args) => { });

            var testSubject = new IssueLocationAdornmentTagger(aggregatorMock.Object, ValidTextView);

            // Act
            testSubject.Dispose();

            var expectedCallCount = Times.Exactly(2); // once for our class, once for the base class
            aggregatorMock.VerifyRemove(x => x.BatchedTagsChanged -= It.IsAny<EventHandler<BatchedTagsChangedEventArgs>>(), expectedCallCount);
        }

        [TestMethod]
        public void OnBatchedTagsChanged_CacheCleanupIsCalled()
        {
            var cacheMock = new Mock<ICachingAdornmentFactory>();

            var snapshot = CreateSnapshot(length: 123);
            var textView = CreateWpfTextView(snapshot);
            var locViz1 = CreateLocationViz();
            var locViz2 = CreateLocationViz();

            // The setup for the aggregator is different for this test since we're using a different
            // overload of "GetTags" from all of the other tests.
            // Here, we're expecting a SnapshotSpan covering the whole snapshot to be passed in
            var wholeSnapshotSpan = new SnapshotSpan(snapshot, 0, snapshot.Length);

            var mappingSpan1 = CreateMappingTagSpan(snapshot, new SelectedIssueLocationTag(locViz1));
            var mappingSpan2 = CreateMappingTagSpan(snapshot, new SelectedIssueLocationTag(locViz2));
            var aggregatorMock = new Mock<ITagAggregator<ISelectedIssueLocationTag>>();
            aggregatorMock.Setup(x => x.GetTags(wholeSnapshotSpan))
                .Returns(new[] { mappingSpan1, mappingSpan2 });

            var testSubject = new IssueLocationAdornmentTagger(aggregatorMock.Object, textView, cacheMock.Object);
            cacheMock.Invocations.Count.Should().Be(0);

            // Act
            RaiseBatchedTagsChanged(aggregatorMock);
            aggregatorMock.Verify(x => x.GetTags(wholeSnapshotSpan), Times.Once);
            cacheMock.Verify(x => x.Refresh(new[] { locViz1, locViz2 }), Times.Once);
        }

        [TestMethod]
        public void GetTags_NoSelectedIssueLocationTags_ReturnsEmpty()
        {
            var snapshot = CreateSnapshot(length: 50);
            var inputSpans = CreateSpanCollectionSpanningWholeSnapshot(snapshot);

            var aggregator = CreateSelectedIssueAggregator();
            var viewMock = CreateWpfTextView(snapshot);

            var testSubject = new IssueLocationAdornmentTagger(aggregator, viewMock);

            // Act
            testSubject.GetTags(inputSpans)
                .Should().BeEmpty();
        }

        [TestMethod]
        public void GetTags_HasSelectedIssueLocationTags_ReturnsExpectedAdornmentTags()
        {
            var snapshot = CreateSnapshot(length: 50);
            var inputSpans = CreateSpanCollectionSpanningWholeSnapshot(snapshot);

            var selectedLoc1 = CreateLocationViz(snapshot, new Span(1, 5), "selection 1");
            var selectedLoc2 = CreateLocationViz(snapshot, new Span(20, 25), "selection 2");
            var aggregator = CreateSelectedIssueAggregator(selectedLoc1, selectedLoc2);

            var viewMock = CreateWpfTextView(snapshot);

            var testSubject = new IssueLocationAdornmentTagger(aggregator, viewMock);

            // Act
            var actual = testSubject.GetTags(inputSpans).ToArray();

            actual.Length.Should().Be(2);
            actual[0].Span.Span.Start.Should().Be(selectedLoc1.Span.Value.Span.Start);
            actual[1].Span.Span.Start.Should().Be(selectedLoc2.Span.Value.Span.Start);

            actual[0].Span.Span.Length.Should().Be(0);
            actual[1].Span.Span.Length.Should().Be(0);

            var adornment1 = actual[0].Tag.Adornment as IssueLocationAdornment;
            adornment1.Should().NotBeNull();
            adornment1.LocationViz.Should().Be(selectedLoc1);

            var adornment2 = actual[1].Tag.Adornment as IssueLocationAdornment;
            adornment2.Should().NotBeNull();
            adornment2.LocationViz.Should().Be(selectedLoc2);
        }
    }
}


text:
<?php

class view
{
	public $_view = null;
	public $displayed = false;
	public $_extfuncs;
	public $_view_engine = array('teamplate','saemplate','smarty');

	public function __construct($config)
	{
		$engine = $config['engine']?$config['engine']:'teamplate';
		if(!in_array($engine,$this->_view_engine))
		{
			debug::error('View Engine Error',"View Engine <b>$engine</b> not no support.");
		}
		if($engine == 'smarty') $engine = "smarty.smarty";
		$this->_view = load::classes('lib.view.'.$engine,TEA_PATH);
		if($config['config'] && is_array($config['config'])){
			foreach( $config['config'] as $key => $value ){
				$this->_view->{$key} = $value;
			}
		}
	}

	public function regfuncs()
	{
		if( is_array($this->_extfuncs) ){
			foreach( $this->_extfuncs as $alias => $func )
			{
				$this->_view->register_function($alias, $func);
			}
		}
	}

	function __call($method,$args=array())
	{
		return call_user_func_array(array($this->_view,$method),$args);
	}

}


text:
package org.apache.cassandra.simulator.cluster;

import org.apache.cassandra.simulator.Actions.ReliableAction;

import static org.apache.cassandra.simulator.Action.Modifiers.NONE;
import static org.apache.cassandra.simulator.Action.Modifiers.RELIABLE_NO_TIMEOUTS;

class OnInstanceSendShutdownToAll extends ReliableAction
{
    OnInstanceSendShutdownToAll(ClusterActions actions, int from)
    {
        super("Send Shutdown from " + from + " to all", NONE, RELIABLE_NO_TIMEOUTS,
              () -> actions.sendShutdownToAll(from));
    }
}