text:
package com.intellij.debugger.memory.ui;

import com.intellij.debugger.DebuggerManager;
import com.intellij.debugger.memory.component.MemoryViewDebugProcessData;
import com.intellij.xdebugger.memory.component.InstancesTracker;
import com.intellij.xdebugger.memory.event.InstancesTrackerListener;
import com.intellij.xdebugger.memory.tracking.TrackingType;
import com.intellij.debugger.memory.utils.StackFrameItem;
import com.intellij.debugger.ui.impl.watch.NodeDescriptorProvider;
import com.intellij.debugger.ui.tree.NodeDescriptor;
import com.intellij.debugger.ui.tree.ValueDescriptor;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.ui.JBSplitter;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.components.labels.ActionLink;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.frame.XValue;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import com.intellij.xdebugger.memory.ui.InstancesTree;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.Value;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.tree.TreePath;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

class InstancesWithStackFrameView {
  private static final float DEFAULT_SPLITTER_PROPORTION = 0.7f;
  private static final String EMPTY_TEXT_WHEN_ITEM_NOT_SELECTED = "Select instance to see stack frame";
  private static final String EMPTY_TEXT_WHEN_STACK_NOT_FOUND = "No stack frame for this instance";
  private static final String TEXT_FOR_ARRAYS = "Arrays could not be tracked";

  private float myHidedProportion;

  private final JBSplitter mySplitter = new JBSplitter(false, DEFAULT_SPLITTER_PROPORTION);
  private boolean myIsHided = false;

  InstancesWithStackFrameView(@NotNull XDebugSession debugSession, @NotNull InstancesTree tree,
                              @NotNull StackFrameList list, @NotNull String className) {
    mySplitter.setFirstComponent(new JBScrollPane(tree));

    final Project project = debugSession.getProject();
    list.setEmptyText(EMPTY_TEXT_WHEN_ITEM_NOT_SELECTED);
    JLabel stackTraceLabel;
    if (isArrayType(className)) {
      stackTraceLabel = new JBLabel(TEXT_FOR_ARRAYS, SwingConstants.CENTER);
    }
    else {
      ActionLink actionLink = new ActionLink("Enable tracking for new instances",
                                             AllIcons.Debugger.MemoryView.ClassTracked,
                                             new AnAction() {
                                               @Override
                                               public void actionPerformed(AnActionEvent e) {
                                                 final Project project = e.getProject();
                                                 if (project != null && !project.isDisposed()) {
                                                   InstancesTracker.getInstance(project).add(className, TrackingType.CREATION);
                                                 }
                                               }
                                             });

      actionLink.setHorizontalAlignment(SwingConstants.CENTER);
      actionLink.setPaintUnderline(false);
      stackTraceLabel = actionLink;
    }

    mySplitter.setSplitterProportionKey("InstancesWithStackFrameView.SplitterKey");

    JComponent stackComponent = new JBScrollPane(list);

    if (!project.isDisposed()) {
      final InstancesTracker tracker = InstancesTracker.getInstance(project);
      tracker.addTrackerListener(new InstancesTrackerListener() {
        @Override
        public void classChanged(@NotNull String name, @NotNull TrackingType type) {
          if (Objects.equals(className, name) && type == TrackingType.CREATION) {
            mySplitter.setSecondComponent(stackComponent);
          }
        }

        @Override
        public void classRemoved(@NotNull String name) {
          if (Objects.equals(name, className)) {
            mySplitter.setSecondComponent(stackTraceLabel);
          }
        }
      }, tree);

      mySplitter.setSecondComponent(tracker.isTracked(className) ? stackComponent : stackTraceLabel);
    }

    mySplitter.setHonorComponentsMinimumSize(false);
    myHidedProportion = DEFAULT_SPLITTER_PROPORTION;

    final MemoryViewDebugProcessData data =
      DebuggerManager.getInstance(project).getDebugProcess(debugSession.getDebugProcess().getProcessHandler())
        .getUserData(MemoryViewDebugProcessData.KEY);
    tree.addTreeSelectionListener(e -> {
      ObjectReference ref = getSelectedReference(tree);
      if (ref != null && data != null) {
        List<StackFrameItem> stack = data.getTrackedStacks().getStack(ref);
        if (stack != null) {
          list.setFrameItems(stack);
          if (mySplitter.getProportion() == 1.f) {
            mySplitter.setProportion(DEFAULT_SPLITTER_PROPORTION);
          }
          return;
        }
        list.setEmptyText(EMPTY_TEXT_WHEN_STACK_NOT_FOUND);
      }
      else {
        list.setEmptyText(EMPTY_TEXT_WHEN_ITEM_NOT_SELECTED);
      }

      list.setFrameItems(Collections.emptyList());
    });
  }
  @Nullable
  private static ObjectReference getSelectedReference(InstancesTree tree) {
    TreePath selectionPath = tree.getSelectionPath();
    Object selectedItem = selectionPath != null ? selectionPath.getLastPathComponent() : null;
    if (selectedItem instanceof XValueNodeImpl) {
      XValueNodeImpl xValueNode = (XValueNodeImpl)selectedItem;
      XValue valueContainer = xValueNode.getValueContainer();

      if (valueContainer instanceof NodeDescriptorProvider) {
        NodeDescriptor descriptor = ((NodeDescriptorProvider)valueContainer).getDescriptor();

        if (descriptor instanceof ValueDescriptor) {
          Value value = ((ValueDescriptor)descriptor).getValue();

          if (value instanceof ObjectReference) return (ObjectReference)value;
        }
      }
    }

    return null;
  }

  JComponent getComponent() {
    return mySplitter;
  }

  private static boolean isArrayType(@NotNull String className) {
    return className.contains("[]");
  }

  @SuppressWarnings("unused")
  private void hideStackFrame() {
    if (!myIsHided) {
      myHidedProportion = mySplitter.getProportion();
      mySplitter.getSecondComponent().setVisible(false);
      mySplitter.setProportion(1.f);
      myIsHided = true;
    }
  }

  @SuppressWarnings("unused")
  private void showStackFrame() {
    if (myIsHided) {
      mySplitter.getSecondComponent().setVisible(true);
      mySplitter.setProportion(myHidedProportion);
      myIsHided = false;
    }
  }
}


text:
/*
 * Simple implementation of shared_ptr.
 * Below code is non thread safe.
 *
 * (c) 2015 Raghavendra Nayak, All Rights Reserved.
 * http://www.openguru.com/
 */

#include <iostream>

namespace my {
    template <class T>
    class shared_ptr {
        T* ptr;
        int* ref_count;

        /**
         * Initializes the ref count used for tracking the usage.
         */
        void initialize_ref_count() {
            if (ref_count != nullptr)
                return;
            try {
                ref_count = new int;
                *ref_count = 1;
            }
            catch (std::bad_alloc& e) {
                std::cerr << "Memory allocation error: " << e.what();
            }
        }

    public:
        // Constructors
        shared_ptr()
            : ptr(nullptr), ref_count(nullptr) {}

        shared_ptr(nullptr_t ptr)
            : ptr(ptr), ref_count(nullptr) {
        }

        shared_ptr(T* ptr)
            : ptr(ptr), ref_count(nullptr) {
            initialize_ref_count();
        }

        // Destructor
        ~shared_ptr() {
            --(*ref_count);
            if (*ref_count == 0) {
                delete ref_count;
                ref_count = nullptr;
                delete ptr;
                ptr = nullptr;
            }
        }

        // Copy constructor
        shared_ptr(const shared_ptr& copy) {
            ptr = copy.ptr;
            ref_count = copy.ref_count;
            if (ref_count != nullptr) {
                ++(*ref_count);
            }
        }

        // Assignment operator
        shared_ptr& operator=(const shared_ptr& copy) {
            ptr = copy.ptr;
            ref_count = copy.ref_count;
            if (ref_count != nullptr) {
                ++(*ref_count);
            }
            return *this;
        }

        // Returns stored object reference
        T& operator*() const {
            return *ptr;
        }

        // Returns stored object pointer
        T* operator->() const {
            return ptr;
        }
    };
}

class Base
{
    int data;
public:
    Base() : data(0) { std::cout << "  Base::Base()\n"; }
    virtual ~Base() { std::cout << "  Base::~Base()\n"; }

    void set_data(int data) {
        this->data = data;
    }
    int get_data() const {
        return this->data;
    }
};

class Derived : public Base
{
public:
    Derived() { std::cout << "  Derived::Derived()\n"; }
    ~Derived() { std::cout << "  Derived::~Derived()\n"; }
};

my::shared_ptr<Base> function()
{
    my::shared_ptr<Base> ptr = new Derived();
    return ptr;
}

int main(int argc, char **argv)
{
    // Default constructor
    my::shared_ptr<Base> ptr1;

    {
        // Parameterized constructor
        my::shared_ptr<Base> ptr2 = function();

        // operator function call
        ptr2->set_data(100);

        // copy constructor call
        my::shared_ptr<Base> ptr3 = ptr2;

        // assignment operator call
        ptr1 = ptr3;
    }
    // operator function call
    std::cout << "  data set to: " << (*ptr1).get_data() << std::endl;

    return 0;
}

redpajama_set_name: RedPajamaGithub


text:
jQuery.fn.slideCtrl = function(options, configs) {

	opt = jQuery.extend({
		photo_list       : jQuery(this).find(".area li"),
		photo_list_left  : jQuery(this).find(".prev"),
		photo_list_right : jQuery(this).find(".next"),
		photo_list_play  : jQuery(this).find(".play"),
		photo_list_stop  : jQuery(this).find(".stop"),
		photo_list_current_p : 0,
		FXconfig:true,
		d_time:3000,
		debug:false
		},options);

	var photo_list = opt.photo_list;
	// console.log(photo_list)
	var photo_list_left=opt.photo_list_left;
	var photo_list_right = opt.photo_list_right;
	var photo_list_play=opt.photo_list_play;
	var photo_list_stop=opt.photo_list_stop;
	var photo_list_current_p=opt.photo_list_current_p;
	var FXconfig=opt.FXconfig;
	var d_time=opt.d_time;
	var debug=opt.debug;

	var photo_paging = jQuery(photo_list).length;
	var clearenter;
	// photo_list_play.hide();
	photo_list.find('.view').hide();
	jQuery(photo_list[0]).find('.view').show();
	for ( var i = 0 ; i < photo_paging ; i ++ )
	{
		// jQuery(photo_list[i]).show()
	}
	currentItem = jQuery(photo_list[photo_list_current_p]).find('.view')
	nextItem = jQuery(photo_list[photo_list_current_p]).find('.view')

	photo_list.find('.num').bind('click keyup mouseenter' , function(){ //팝업리스트 아이콘
		var i = photo_list_current_p
		photo_list_current_p = jQuery(photo_list).find('.num').index(this);
		if (photo_list_current_p != i){
		clearInterval(clearenter);
		ctrlStop();
		currentItem = $(this).parents('ul').find('.on .view');// 액션이전의 데이터
		nextItem=jQuery(photo_list[photo_list_current_p]).find('.view')
		CrossFade(currentItem,nextItem);
		// console.log(photo_list_current_p);
		}
		return false;
	})

	function leftViewPlay (argument) {
		clearInterval(clearenter)
		ctrlStop()
		if (photo_list_current_p <= 0)
		{
			photo_list_current_p = jQuery(photo_list).length-1
			currentItem = jQuery(photo_list[0]).find('.view')
			nextItem = jQuery(photo_list[jQuery(photo_list).length-1]).find('.view')
		}else{
			photo_list_current_p -= 1
			currentItem = jQuery(photo_list[photo_list_current_p+1]).find('.view')
			nextItem = jQuery(photo_list[photo_list_current_p]).find('.view')
		}
		CrossFade(currentItem,nextItem);
	}
	function rightViewPlay(){
		clearInterval(clearenter);
		ctrlStop()
		photo_list_current_p += 1
		if ( photo_list_current_p > photo_paging-1)
		{
			photo_list_current_p = 0
			currentItem = jQuery(photo_list[jQuery(photo_list).length-1]).find('.view')
			nextItem = jQuery(photo_list[0]).find('.view')
		}else{
			currentItem = jQuery(photo_list[photo_list_current_p-1]).find('.view')
			nextItem = jQuery(photo_list[photo_list_current_p]).find('.view')
		}
		CrossFade(currentItem,nextItem);
	}
	photo_list_right.bind('click' , function(){
		rightViewPlay();
	})
	photo_list_left.bind('click' , function(){
		leftViewPlay();
	})
	photo_list_play.bind('click',function(){
		clearInterval(clearenter);
		clearenter = setInterval(photolist_play,d_time);
		// jQuery(this).hide();
		// photo_list_stop.show();
		photo_list_stop.focus();
	})
	photo_list_stop.bind('click',function(){
		clearInterval(clearenter);
		ctrlStop();
		photo_list_play.focus();
	})
	function ctrlStop(){
		// photo_list_stop.hide();
		// photo_list_play.show();
	}
	function CrossFade(currentItem,nextItem){
		if (FXconfig)
		{
			if (debug) {console.log(currentItem.html(),nextItem.html())}
			jQuery(currentItem).css({
				display:'block',
				opacity:1,
				zIndex:51
			}).stop().animate({opacity: 0},1000,function(){
					$(this).hide();
				});
			jQuery(nextItem).stop().css({
				display:'block',
				opacity:1,
				zIndex:50
			})
		}else{
			jQuery(currentItem).stop().css({
				display:'none',
				opacity:1,
				zIndex:51
			});
			jQuery(nextItem).stop().css({
				display:'block',
				opacity:1,
				zIndex:50
			})
		}
		classCtrl();
	}
	function classCtrl(){
		photo_list.removeClass("on");
		jQuery(photo_list[photo_list_current_p]).addClass("on");
		// mobileVisualPosition();
	}
	function photolist_play(){
		if (photo_list_current_p < photo_paging-1)
		{
			photo_list_current_p +=1
			currentItem = jQuery(photo_list[photo_list_current_p-1]).find('.view')
			nextItem = jQuery(photo_list[photo_list_current_p]).find('.view')
		}else{
			photo_list_current_p = 0
			currentItem = jQuery(photo_list[photo_paging-1]).find('.view')
			nextItem = jQuery(photo_list[photo_list_current_p]).find('.view')
		}
		CrossFade(currentItem,nextItem);

	}
	// clearenter = setInterval(photolist_play,d_time)

	return {
			left: function() {
				leftViewPlay();
			},
			right:function(){
				rightViewPlay();
			}
		}
};


text:
<?php

declare (strict_types=1);
namespace Rector\Doctrine\NodeFactory;

use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Expression;
final class ValueAssignFactory
{
    public function createDefaultDateTimeAssign(string $propertyName) : \PhpParser\Node\Stmt\Expression
    {
        $propertyFetch = $this->createPropertyFetch($propertyName);
        $assign = new \PhpParser\Node\Expr\Assign($propertyFetch, $this->createNewDateTime());
        return new \PhpParser\Node\Stmt\Expression($assign);
    }
    public function createDefaultDateTimeWithValueAssign(string $propertyName, \PhpParser\Node\Expr $defaultExpr) : \PhpParser\Node\Stmt\Expression
    {
        $propertyFetch = $this->createPropertyFetch($propertyName);
        $newDateTime = $this->createNewDateTime();
        $this->addDateTimeArgumentIfNotDefault($defaultExpr, $newDateTime);
        $assign = new \PhpParser\Node\Expr\Assign($propertyFetch, $newDateTime);
        return new \PhpParser\Node\Stmt\Expression($assign);
    }
    private function createPropertyFetch(string $propertyName) : \PhpParser\Node\Expr\PropertyFetch
    {
        return new \PhpParser\Node\Expr\PropertyFetch(new \PhpParser\Node\Expr\Variable('this'), $propertyName);
    }
    private function createNewDateTime() : \PhpParser\Node\Expr\New_
    {
        return new \PhpParser\Node\Expr\New_(new \PhpParser\Node\Name\FullyQualified('DateTime'));
    }
    private function addDateTimeArgumentIfNotDefault(\PhpParser\Node\Expr $defaultExpr, \PhpParser\Node\Expr\New_ $dateTimeNew) : void
    {
        if ($defaultExpr instanceof \PhpParser\Node\Scalar\String_ && ($defaultExpr->value === 'now' || $defaultExpr->value === 'now()')) {
            return;
        }
        $dateTimeNew->args[] = new \PhpParser\Node\Arg($defaultExpr);
    }
}


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

package org.chromium.chrome.browser.feed.library.piet;

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

import static org.chromium.chrome.browser.feed.library.common.testing.RunnableSubject.assertThatRunnable;

import android.view.View;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.annotation.Config;

import org.chromium.chrome.browser.feed.library.piet.TemplateBinder.TemplateKey;
import org.chromium.components.feed.core.proto.ui.piet.BindingRefsProto.ChunkedTextBindingRef;
import org.chromium.components.feed.core.proto.ui.piet.BindingRefsProto.ParameterizedTextBindingRef;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.CustomElement;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.Element;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.ElementList;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.ElementStack;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.GridRow;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.ImageElement;
import org.chromium.components.feed.core.proto.ui.piet.ElementsProto.TextElement;
import org.chromium.components.feed.core.proto.ui.piet.PietProto.PietSharedState;
import org.chromium.components.feed.core.proto.ui.piet.PietProto.Template;
import org.chromium.components.feed.core.proto.ui.piet.TextProto.ChunkedText;
import org.chromium.components.feed.core.proto.ui.piet.TextProto.ParameterizedText;
import org.chromium.testing.local.LocalRobolectricTestRunner;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/** Tests for the ElementAdapterFactory. */
@RunWith(LocalRobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public class ElementAdapterFactoryTest {
    @Mock
    private FrameContext mFrameContext;

    @Mock
    private CustomElementAdapter mCustomElementAdapter;
    @Mock
    private ChunkedTextElementAdapter mChunkedTextElementAdapter;
    @Mock
    private ParameterizedTextElementAdapter mParameterizedTextElementAdapter;
    @Mock
    private ImageElementAdapter mImageElementAdapter;
    @Mock
    private GridRowAdapter mGridRowAdapter;
    @Mock
    private ElementListAdapter mElementListAdapter;
    @Mock
    private ElementAdapter<? extends View, ?> mTemplateAdapter;
    @Mock
    private ElementStackAdapter mElementStackAdapter;

    @Mock
    private AdapterFactory<CustomElementAdapter, CustomElement> mCustomElementFactory;

    @Mock
    private AdapterFactory<ChunkedTextElementAdapter, Element> mChunkedTextElementFactory;

    @Mock
    private AdapterFactory<ParameterizedTextElementAdapter, Element>
            mParameterizedTextElementFactory;

    @Mock
    private AdapterFactory<ImageElementAdapter, ImageElement> mImageElementFactory;

    @Mock
    private AdapterFactory<GridRowAdapter, GridRow> mGridRowFactory;

    @Mock
    private AdapterFactory<ElementListAdapter, ElementList> mElementListFactory;

    @Mock
    private AdapterFactory<ElementStackAdapter, ElementStack> mElementStackFactory;

    @Mock
    private KeyedRecyclerPool<ElementAdapter<? extends View, ?>> mTemplateRecyclerPool;

    private final List<AdapterFactory<?, ?>> mAdapterFactories = new ArrayList<>();

    private ElementAdapterFactory mAdapterFactory;

    @Before
    public void setUp() {
        initMocks(this);
        when(mFrameContext.reportMessage(anyInt(), any(), anyString()))
                .thenAnswer(invocation -> invocation.getArguments()[2]);
        mAdapterFactory = new ElementAdapterFactory(mCustomElementFactory,
                mChunkedTextElementFactory, mParameterizedTextElementFactory, mImageElementFactory,
                mGridRowFactory, mElementListFactory, mElementStackFactory, mTemplateRecyclerPool);
        when(mCustomElementFactory.get(any(CustomElement.class), eq(mFrameContext)))
                .thenReturn(mCustomElementAdapter);
        when(mChunkedTextElementFactory.get(any(Element.class), eq(mFrameContext)))
                .thenReturn(mChunkedTextElementAdapter);
        when(mParameterizedTextElementFactory.get(any(Element.class), eq(mFrameContext)))
                .thenReturn(mParameterizedTextElementAdapter);
        when(mImageElementFactory.get(any(ImageElement.class), eq(mFrameContext)))
                .thenReturn(mImageElementAdapter);
        when(mGridRowFactory.get(any(GridRow.class), eq(mFrameContext)))
                .thenReturn(mGridRowAdapter);
        when(mElementListFactory.get(any(ElementList.class), eq(mFrameContext)))
                .thenReturn(mElementListAdapter);
        when(mElementStackFactory.get(any(ElementStack.class), eq(mFrameContext)))
                .thenReturn(mElementStackAdapter);
        mAdapterFactories.add(mCustomElementFactory);
        mAdapterFactories.add(mChunkedTextElementFactory);
        mAdapterFactories.add(mParameterizedTextElementFactory);
        mAdapterFactories.add(mImageElementFactory);
        mAdapterFactories.add(mGridRowFactory);
        mAdapterFactories.add(mElementListFactory);
        mAdapterFactories.add(mElementStackFactory);
    }

    @Test
    public void testCreateAdapterForElement_customElement() {
        CustomElement model = CustomElement.getDefaultInstance();
        Element element = Element.newBuilder().setCustomElement(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mCustomElementAdapter);
        verify(mCustomElementFactory).get(model, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_chunkedTextElement() {
        TextElement model =
                TextElement.newBuilder().setChunkedText(ChunkedText.getDefaultInstance()).build();
        Element element = Element.newBuilder().setTextElement(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mChunkedTextElementAdapter);
        verify(mChunkedTextElementFactory).get(element, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_chunkedTextBindingElement() {
        TextElement model =
                TextElement.newBuilder()
                        .setChunkedTextBinding(ChunkedTextBindingRef.getDefaultInstance())
                        .build();
        Element element = Element.newBuilder().setTextElement(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mChunkedTextElementAdapter);
        verify(mChunkedTextElementFactory).get(element, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_parameterizedTextElement() {
        TextElement model = TextElement.newBuilder()
                                    .setParameterizedText(ParameterizedText.getDefaultInstance())
                                    .build();
        Element element = Element.newBuilder().setTextElement(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mParameterizedTextElementAdapter);
        verify(mParameterizedTextElementFactory).get(element, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_parameterizedTextBindingElement() {
        TextElement model = TextElement.newBuilder()
                                    .setParameterizedTextBinding(
                                            ParameterizedTextBindingRef.getDefaultInstance())
                                    .build();
        Element element = Element.newBuilder().setTextElement(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mParameterizedTextElementAdapter);
        verify(mParameterizedTextElementFactory).get(element, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_invalidTextElement() {
        TextElement model = TextElement.getDefaultInstance();
        Element element = Element.newBuilder().setTextElement(model).build();

        assertThatRunnable(() -> mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .throwsAnExceptionOfType(PietFatalException.class)
                .that()
                .hasMessageThat()
                .contains("Unsupported TextElement type");
    }

    @Test
    public void testCreateAdapterForElement_imageElement() {
        ImageElement model = ImageElement.getDefaultInstance();
        Element element = Element.newBuilder().setImageElement(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mImageElementAdapter);
        verify(mImageElementFactory).get(model, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_gridRow() {
        GridRow model = GridRow.getDefaultInstance();
        Element element = Element.newBuilder().setGridRow(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mGridRowAdapter);
        verify(mGridRowFactory).get(model, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_elementList() {
        ElementList model = ElementList.getDefaultInstance();
        Element element = Element.newBuilder().setElementList(model).build();
        assertThat(mAdapterFactory.createAdapterForElement(element, mFrameContext))
                .isSameInstanceAs(mElementListAdapter);
        verify(mElementListFactory).get(model, mFrameContext);
    }

    @Test
    public void testCreateAdapterForElement_unsupported() {
        assertThatRunnable(()
                                   -> mAdapterFactory.createAdapterForElement(
                                           Element.getDefaultInstance(), mFrameContext))
                .throwsAnExceptionOfType(PietFatalException.class)
                .that()
                .hasMessageThat()
                .contains("Unsupported Element type");
    }

    @Test
    public void testReleaseAdapter_template() {
        TemplateKey templateKey = new TemplateKey(Template.getDefaultInstance(), null, null);
        when(mTemplateAdapter.getKey()).thenReturn(templateKey);

        mAdapterFactory.releaseAdapter(mTemplateAdapter);

        // We unbind the adapter but do not release it so it can be created quickly again.
        verify(mTemplateAdapter).unbindModel();
        verify(mTemplateAdapter, never()).releaseAdapter();
        verify(mTemplateRecyclerPool).put(templateKey, mTemplateAdapter);
    }

    @Test
    public void testReleaseAdapter_custom() {
        mAdapterFactory.releaseAdapter(mCustomElementAdapter);
        verify(mCustomElementFactory).release(mCustomElementAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testReleaseAdapter_chunkedText() {
        mAdapterFactory.releaseAdapter(mChunkedTextElementAdapter);
        verify(mChunkedTextElementFactory).release(mChunkedTextElementAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testReleaseAdapter_parameterizedText() {
        mAdapterFactory.releaseAdapter(mParameterizedTextElementAdapter);
        verify(mParameterizedTextElementFactory).release(mParameterizedTextElementAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testReleaseAdapter_imageElement() {
        mAdapterFactory.releaseAdapter(mImageElementAdapter);
        verify(mImageElementFactory).release(mImageElementAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testReleaseAdapter_gridRow() {
        mAdapterFactory.releaseAdapter(mGridRowAdapter);
        verify(mGridRowFactory).release(mGridRowAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testReleaseAdapter_list() {
        mAdapterFactory.releaseAdapter(mElementListAdapter);
        verify(mElementListFactory).release(mElementListAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testReleaseAdapter_stacked() {
        mAdapterFactory.releaseAdapter(mElementStackAdapter);
        verify(mElementStackFactory).release(mElementStackAdapter);
        testNoOtherFactoryInteractions();
    }

    @Test
    public void testPurgeRecyclerPools() {
        mAdapterFactory.purgeRecyclerPools();
        for (AdapterFactory<?, ?> adapterFactory : mAdapterFactories) {
            verify(adapterFactory).purgeRecyclerPool();
        }
    }

    @Test
    public void testPurgeTemplateRecyclerPool() {
        Template template = Template.newBuilder()
                                    .setTemplateId("template")
                                    .setElement(Element.newBuilder().setElementList(
                                            ElementList.getDefaultInstance()))
                                    .build();
        List<PietSharedState> sharedStates = Collections.emptyList();
        when(mTemplateAdapter.getKey()).thenReturn(new TemplateKey(template, sharedStates, null));
        when(mFrameContext.getPietSharedStates()).thenReturn(sharedStates);

        // Release adapter to populate the recycler pool
        mAdapterFactory.releaseAdapter(mTemplateAdapter);

        verify(mTemplateRecyclerPool).put(mTemplateAdapter.getKey(), mTemplateAdapter);

        // Purge the recycler pools.
        mAdapterFactory.purgeRecyclerPools();

        verify(mTemplateRecyclerPool).clear();
    }

    private void testNoOtherFactoryInteractions() {
        for (AdapterFactory<?, ?> adapterFactory : mAdapterFactories) {
            verifyNoMoreInteractions(adapterFactory);
        }
    }
}


text:
#ifndef TENSORFLOW_LITE_SUPPORT_METADATA_CC_UTILS_ZIP_MEM_FILE_H_
#define TENSORFLOW_LITE_SUPPORT_METADATA_CC_UTILS_ZIP_MEM_FILE_H_

#include <cstdlib>

#include "absl/strings/string_view.h"  // from @com_google_absl
#include "third_party/zlib/contrib/minizip/ioapi.h"

namespace tflite {
namespace metadata {

// In-memory zip file implementation.
//
// Adapted from [1], with a few key differences:
// * backed by an `std::string` instead of malloc-ed C buffers,
// * supports opening the file for writing through `zipOpen2_64`.
//
// This class is NOT thread-safe.
//
// [1]:
// https://github.com/google/libkml/blob/master/third_party/zlib-1.2.3/contrib/minizip/iomem_simple.c
class ZipWritableMemFile {
 public:
  // Constructs an in-memory writable zip file from a buffer. The provided
  // buffer is copied.
  ZipWritableMemFile(const char* buffer, size_t size);
  // Provides access to the `zlib_filefunc64_def` implementation for the
  // in-memory zip file.
  zlib_filefunc64_def& GetFileFunc64Def();
  // Provides access to the file contents.
  absl::string_view GetFileContent() const;

 private:
  // The string backing the in-memory file.
  std::string data_;
  // The current offset in the file.
  ZPOS64_T offset_;
  // The `zlib_filefunc64_def` implementation for this in-memory zip file.
  zlib_filefunc64_def zlib_filefunc64_def_;

  // Convenience function to access the current data size.
  size_t Size() const { return data_.size(); }

  // The file function implementations used in the `zlib_filefunc64_def`.
  static voidpf OpenFile(voidpf opaque, const void* filename, int mode);
  static uLong ReadFile(voidpf opaque, voidpf stream, void* buf, uLong size);
  static uLong WriteFile(voidpf opaque,
                         voidpf stream,
                         const void* buf,
                         uLong size);
  static ZPOS64_T TellFile(voidpf opaque, voidpf stream);
  static long SeekFile  // NOLINT
      (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
  static int CloseFile(voidpf opaque, voidpf stream);
  static int ErrorFile(voidpf opaque, voidpf stream);
};

}  // namespace metadata
}  // namespace tflite

#endif  // TENSORFLOW_LITE_SUPPORT_METADATA_CC_UTILS_ZIP_MEM_FILE_H_


text:
namespace app {
namespace Fuse {
namespace Animations {

::uInterfaceType* IMixerHandle__double__typeof();

struct IMixerHandle__double
{
    void(*__fp_Set)(void*, double, float);
    void(*__fp_Unregister)(void*);

    static void Set(::uObject* __this, double value, float strength) { ((IMixerHandle__double*)uGetInterfacePtr(__this, IMixerHandle__double__typeof()))->__fp_Set((::uByte*)__this + (__this->__obj_type->TypeType == uTypeTypeStruct ? sizeof(::uObject) : 0), value, strength); }
    static void Unregister(::uObject* __this) { ((IMixerHandle__double*)uGetInterfacePtr(__this, IMixerHandle__double__typeof()))->__fp_Unregister((::uByte*)__this + (__this->__obj_type->TypeType == uTypeTypeStruct ? sizeof(::uObject) : 0)); }
};

}}}

#endif


text:
#include <algorithm>
#include <thrift/lib/cpp/EventHandlerBase.h>

using std::remove;
using std::shared_ptr;
using std::vector;

using RWMutex = folly::SharedMutex;
using RLock = RWMutex::ReadHolder;
using WLock = RWMutex::WriteHolder;

namespace apache {
namespace thrift {

void EventHandlerBase::addEventHandler(
    const std::shared_ptr<TProcessorEventHandler>& handler) {
  if (!handlers_) {
    handlers_ = std::make_shared<
        std::vector<std::shared_ptr<TProcessorEventHandler>>>();
  }
  handlers_->push_back(handler);
}

void EventHandlerBase::addNotNullEventHandler(
    const folly::not_null_shared_ptr<TProcessorEventHandler>& handler) {
  if (!handlers_) {
    handlers_ = std::make_shared<
        std::vector<std::shared_ptr<TProcessorEventHandler>>>();
  }

  handlers_->push_back(
      static_cast<const std::shared_ptr<TProcessorEventHandler>>(handler));
}

folly::Range<std::shared_ptr<TProcessorEventHandler>*>
EventHandlerBase::getEventHandlers() const {
  if (!handlers_) {
    return {};
  }
  return folly::range(*handlers_);
}

TProcessorBase::TProcessorBase() {
  RLock lock{getRWMutex()};

  for (auto factory : getFactories()) {
    auto handler = factory->getEventHandler();
    if (handler) {
      addEventHandler(handler);
    }
  }

  for (const auto& handler : getHandlers()) {
    addNotNullEventHandler(handler);
  }
}

void TProcessorBase::addProcessorEventHandler(
    std::shared_ptr<TProcessorEventHandler> handler) {
  if (!handler) {
    return;
  }
  WLock lock{getRWMutex()};
  assert(
      find(getHandlers().begin(), getHandlers().end(), handler) ==
      getHandlers().end());
  getHandlers().push_back(std::move(handler));
}

void TProcessorBase::removeProcessorEventHandler(
    std::shared_ptr<TProcessorEventHandler> handler) {
  WLock lock{getRWMutex()};
  assert(
      find(getHandlers().begin(), getHandlers().end(), handler) !=
      getHandlers().end());
  getHandlers().erase(
      remove(getHandlers().begin(), getHandlers().end(), handler),
      getHandlers().end());
}

void TProcessorBase::addProcessorEventHandlerFactory(
    std::shared_ptr<TProcessorEventHandlerFactory> factory) {
  WLock lock{getRWMutex()};
  assert(
      find(getFactories().begin(), getFactories().end(), factory) ==
      getFactories().end());
  getFactories().push_back(factory);
}

void TProcessorBase::removeProcessorEventHandlerFactory(
    std::shared_ptr<TProcessorEventHandlerFactory> factory) {
  WLock lock{getRWMutex()};
  assert(
      find(getFactories().begin(), getFactories().end(), factory) !=
      getFactories().end());
  getFactories().erase(
      remove(getFactories().begin(), getFactories().end(), factory),
      getFactories().end());
}

RWMutex& TProcessorBase::getRWMutex() {
  static auto* mutex = new RWMutex{};
  return *mutex;
}

vector<shared_ptr<TProcessorEventHandlerFactory>>&
TProcessorBase::getFactories() {
  static vector<shared_ptr<TProcessorEventHandlerFactory>> factories;
  return factories;
}
vector<folly::not_null_shared_ptr<TProcessorEventHandler>>&
TProcessorBase::getHandlers() {
  static vector<folly::not_null_shared_ptr<TProcessorEventHandler>> handlers;
  return handlers;
}

TClientBase::TClientBase() {
  // Automatically ask all registered factories to produce an event
  // handler, and attach the handlers
  RLock lock{getRWMutex()};

  auto& factories = getFactories();
  auto& handlers = getHandlers();
  size_t capacity = factories.size() + handlers.size();

  if (capacity != 0) {
    // Initialize the handlers_ in the ctor to be owner of vector object.
    handlers_ = std::make_shared<
        std::vector<std::shared_ptr<TProcessorEventHandler>>>();
    // production data suggests reserving capacity here.
    handlers_->reserve(capacity);

    for (const auto& factory : factories) {
      auto handler = factory->getEventHandler();
      if (handler) {
        addEventHandler(handler);
      }
    }

    for (const auto& handler : handlers) {
      addNotNullEventHandler(handler);
    }
  }
}

void TClientBase::addClientEventHandler(
    std::shared_ptr<TProcessorEventHandler> handler) {
  if (!handler) {
    return;
  }
  WLock lock{getRWMutex()};
  assert(
      find(getHandlers().begin(), getHandlers().end(), handler) ==
      getHandlers().end());
  getHandlers().push_back(std::move(handler));
}

void TClientBase::removeClientEventHandler(
    std::shared_ptr<TProcessorEventHandler> handler) {
  WLock lock{getRWMutex()};
  assert(
      find(getHandlers().begin(), getHandlers().end(), handler) !=
      getHandlers().end());
  getHandlers().erase(
      remove(getHandlers().begin(), getHandlers().end(), handler),
      getHandlers().end());
}
void TClientBase::addClientEventHandlerFactory(
    std::shared_ptr<TProcessorEventHandlerFactory> factory) {
  WLock lock{getRWMutex()};
  assert(
      find(getFactories().begin(), getFactories().end(), factory) ==
      getFactories().end());
  getFactories().push_back(factory);
}

void TClientBase::removeClientEventHandlerFactory(
    std::shared_ptr<TProcessorEventHandlerFactory> factory) {
  WLock lock{getRWMutex()};
  assert(
      find(getFactories().begin(), getFactories().end(), factory) !=
      getFactories().end());
  getFactories().erase(
      remove(getFactories().begin(), getFactories().end(), factory),
      getFactories().end());
}

RWMutex& TClientBase::getRWMutex() {
  static auto* mutex = new RWMutex{};
  return *mutex;
}
vector<shared_ptr<TProcessorEventHandlerFactory>>& TClientBase::getFactories() {
  static vector<shared_ptr<TProcessorEventHandlerFactory>> factories;
  return factories;
}
vector<folly::not_null_shared_ptr<TProcessorEventHandler>>&
TClientBase::getHandlers() {
  static vector<folly::not_null_shared_ptr<TProcessorEventHandler>> handlers;
  return handlers;
}

} // namespace thrift
} // namespace apache


text:
<?php
namespace Chamilo\Libraries\Mail\Mailer\PhpMailer\Package;

class Installer extends \Chamilo\Configuration\Package\Action\Installer
{
}


text:
package org.cavebeetle.blueprint;

public final class JavaFileInfo
{
    private final ProjectInfo projectInfo;
    private final String packageName;
    private final JavaFileType javaFileType;
    private final String entityName;
    private final IndefiniteArticle indefiniteArticle;
    private final Integer prime;

    public JavaFileInfo(final ProjectInfo projectInfo,
            final String packageName,
            final JavaFileType javaFileType,
            final String entityName,
            final IndefiniteArticle indefiniteArticle,
            final Integer prime)
    {
        this.projectInfo = projectInfo;
        this.packageName = packageName;
        this.javaFileType = javaFileType;
        this.entityName = entityName;
        this.indefiniteArticle = indefiniteArticle;
        this.prime = prime;
    }

    public ProjectInfo projectInfo()
    {
        return projectInfo;
    }

    public String packageName()
    {
        return packageName;
    }

    public String entityName()
    {
        return entityName;
    }

    public IndefiniteArticle indefiniteArticle()
    {
        return indefiniteArticle;
    }

    public Integer prime()
    {
        return prime;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:color="@color/secondaryText_DisabledColor" />
    <item android:color="@color/secondaryTextColor" />
</selector>


text:
module Gitosis
  class Group

    def initialize(&block)
      @groups = {}
      instance_eval(&block)
    end

    def method_missing(method, *args, &block)
      if args.length > 0
        @groups[method.to_sym] = args
      else
        raise UnknownGroup, "Unkown group '#{method}'" unless @groups[method]
        @groups[method].uniq.join(" ")
      end
    end

    def denormalize
      @groups.keys.each do |key|
        @groups[key] = @groups[key].collect do |member|
          @_refs = []
          denormalize_member(member)
        end.flatten
      end
      self
    end

    def [](name)
      send(name)
    end

    private

    def denormalize_member(member)
      case member
      when String then member
      when Symbol
        if @_refs.include?(member)
          raise SelfReferencingGroup, "Group '#{member}' cycle reference"
        end
        @_refs << member

        raise UnknownGroup, "Unkown group '#{member}'" unless @groups[member]

        @groups[member].collect { |a| denormalize_member(a) }
      else
        raise UnknownGroupType, "Group '#{member}' type not supported: #{member.class}"
      end
    end
  end
end


text:
$packageName = '{{PackageName}}'
$installerType = 'exe'
$silentArgs = '/S'
$url = '{{DownloadUrl}}'
$checksum = '{{Checksum}}'
$checksumType = 'sha1'
$validExitCodes = @(0)

$chocoTempDir = Join-Path $Env:Temp "chocolatey"
$pkgTempDir = Join-Path $chocoTempDir "$packageName"
if (![System.IO.Directory]::Exists($pkgTempDir)) {[System.IO.Directory]::CreateDirectory($pkgTempDir)}
$zipFile = Join-Path $pkgTempDir "$($packageName)Install.zip"
$installFile = Join-Path $pkgTempDir "BitMeterOSInstaller.exe"

Write-Debug "Downloading to $($zipFile)..."
Get-ChocolateyWebFile -PackageName "$packageName" `
                      -FileFullPath "$zipFile" `
                      -Url "$url" `
                      -Checksum "$checksum" `
                      -ChecksumType "$checksumType"

Write-Debug "Extracting $($zipFile) to $($pkgTempDir)..."
Get-ChocolateyUnzip -FileFullPath "$zipFile" `
                    -Destination "$pkgTempDir" `
                    -SpecificFolder "" `
                    -PackageName "$packageName"

Write-Verbose "Starting AutoHotKey for assistance in silent and/or automated install"
Write-Verbose "Actively using the computer while AutoHotKey is running may interfere with automation"
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$ahkFile = Join-Path $toolsDir "chocolateyInstall.ahk"
$ahkExe = 'AutoHotKey'
Start-Process $ahkExe $ahkFile

Write-Debug "Installing $($installFile)..."
Install-ChocolateyInstallPackage -PackageName "$packageName" `
                                 -FileType "$installerType" `
                                 -SilentArgs "$silentArgs" `
                                 -File "$installFile" `
                                 -ValidExitCodes $validExitCodes


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Austral. J. Bot. 13:115. 1965

#### Original name
Agati formosa F.Muell.

### Remarks
null


text:
/* global ApplePaySession */

/**
 * Braintree Apple Pay button
 **/
define([
  'uiComponent',
  'knockout',
  'jquery',
  'braintree',
  'braintreeApplePay',
  'mage/translate',
  'Magento_Checkout/js/model/payment/additional-validators',
], function (
  Component,
  ko,
  jQuery,
  braintree,
  applePay,
  $t,
  additionalValidators
) {
  'use strict';

  return {
    init: function (element, context) {
      // No element or context
      if (!element || !context) {
        return;
      }

      // Context must implement these methods
      if (typeof context.getClientToken !== 'function') {
        console.error(
          'Braintree ApplePay Context passed does not provide a getClientToken method',
          context
        );
        return;
      }
      if (typeof context.getPaymentRequest !== 'function') {
        console.error(
          'Braintree ApplePay Context passed does not provide a getPaymentRequest method',
          context
        );
        return;
      }
      if (typeof context.startPlaceOrder !== 'function') {
        console.error(
          'Braintree ApplePay Context passed does not provide a startPlaceOrder method',
          context
        );
        return;
      }

      if (this.deviceSupported() === false) {
        return;
      }

      // init braintree api
      braintree.create(
        {
          authorization: context.getClientToken(),
        },
        function (clientErr, clientInstance) {
          if (clientErr) {
            console.error('Error creating client:', clientErr);
            return;
          }

          applePay.create(
            {
              client: clientInstance,
            },
            function (applePayErr, applePayInstance) {
              // No instance
              if (applePayErr) {
                console.error(
                  'Braintree ApplePay Error creating applePayInstance:',
                  applePayErr
                );
                return;
              }

              // Create a button within the KO element, as apple pay can only be instantiated through
              // a valid on click event (ko onclick bind interferes with this).
              var el = document.createElement('div');
              el.className = 'braintree-apple-pay-button';
              el.title = $t('Pay with Apple Pay');
              el.alt = $t('Pay with Apple Pay');
              el.addEventListener('click', function (e) {
                e.preventDefault();

                if (!additionalValidators.validate()) {
                  return;
                }

                // Payment request object
                var paymentRequest = applePayInstance.createPaymentRequest(
                  context.getPaymentRequest()
                );
                if (!paymentRequest) {
                  alert(
                    $t(
                      'We\'re unable to take payments through Apple Pay at the moment. Please try an alternative payment method.'
                    )
                  );
                  console.error(
                    'Braintree ApplePay Unable to create paymentRequest',
                    paymentRequest
                  );
                  return;
                }

                // Show the loader
                jQuery('body').loader('show');

                // Init apple pay session
                try {
                  var session = new ApplePaySession(1, paymentRequest);
                }
                catch (err) {
                  jQuery('body').loader('hide');
                  console.error(
                    'Braintree ApplePay Unable to create ApplePaySession',
                    err
                  );
                  alert(
                    $t(
                      'We\'re unable to take payments through Apple Pay at the moment. Please try an alternative payment method.'
                    )
                  );
                  return false;
                }

                // Handle invalid merchant
                session.onvalidatemerchant = function (event) {
                  applePayInstance.performValidation(
                    {
                      validationURL: event.validationURL,
                      displayName: context.getDisplayName(),
                    },
                    function (validationErr, merchantSession) {
                      if (validationErr) {
                        session.abort();
                        console.error(
                          'Braintree ApplePay Error validating merchant:',
                          validationErr
                        );
                        alert(
                          $t(
                            'We\'re unable to take payments through Apple Pay at the moment. Please try an alternative payment method.'
                          )
                        );
                        return;
                      }

                      session.completeMerchantValidation(merchantSession);
                    }
                  );
                };

                // Attach payment auth event
                session.onpaymentauthorized = function (event) {
                  applePayInstance.tokenize(
                    {
                      token: event.payment.token,
                    },
                    function (tokenizeErr, payload) {
                      if (tokenizeErr) {
                        console.error(
                          'Error tokenizing Apple Pay:',
                          tokenizeErr
                        );
                        session.completePayment(ApplePaySession.STATUS_FAILURE);
                        return;
                      }

                      // Pass the nonce back to the payment method
                      context.startPlaceOrder(payload.nonce, event, session);
                    }
                  );
                };

                // Attach onShippingContactSelect method
                if (typeof context.onShippingContactSelect === 'function') {
                  session.onshippingcontactselected = function (event) {
                    return context.onShippingContactSelect(event, session);
                  };
                }

                // Attach onShippingMethodSelect method
                if (typeof context.onShippingMethodSelect === 'function') {
                  session.onshippingmethodselected = function (event) {
                    return context.onShippingMethodSelect(event, session);
                  };
                }

                // Hook
                if (typeof context.onButtonClick === 'function') {
                  context.onButtonClick(session, this, e);
                }
                else {
                  jQuery('body').loader('hide');
                  session.begin();
                }
              });
              element.appendChild(el);
            }
          );
        }
      );
    },

    /**
     * Check the site is using HTTPS & apple pay is supported on this device.
     * @return boolean
     */
    deviceSupported: function () {
      if (location.protocol != 'https:') {
        console.warn(
          'Braintree Apple Pay requires your checkout be served over HTTPS'
        );
        return false;
      }

      if (
        (window.ApplePaySession && ApplePaySession.canMakePayments()) !== true
      ) {
        console.warn(
          'Braintree Apple Pay is not supported on this device/browser'
        );
        return false;
      }

      return true;
    },
  };
});


text:
<?php
namespace empire\framework\tests\loader\interf;

use empire\framework\tests\loader\TestBaseInterface;

class Test1TestBaseInterface implements TestBaseInterface {

	public function testMethod() {
		return null;
	}

}


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.Reflection;
using System.Threading;

namespace AssemblyResolveTestApp
{
    public class Class1
    {
    }
}


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * @author  Peter Boros
 * @date    2004/08/20
 * @version $Id$
 * @file    base64.h
 * @brief   Definition of Base64 class
 *
 */

#pragma once

#include <string>

namespace fsa {

/**
 * @class Base64
 * @brief Base64 encoding and decoding.
 *
 * Encode and decode arbitrary binary strings to %Base64.
 */
class Base64 {
private:
  /** Encoing table */
  static const unsigned char _table[];
  /** Padding character */
  static const unsigned char _padding;

  /** Decode one symbol */
  static inline int b2n(int b);
  /** Encode one symbol */
  static inline int n2b(int n);

public:

  /**
   * @brief Decode a %Base64 encoded string.
   *
   * @param src Source %Base64 encoded string.
   * @param dest Destination to hold the decoded string.
   * @return Size of destination string.
   */
  static int decode(const std::string &src, std::string &dest);

  /**
   * @brief Decode a %Base64 encoded string.
   *
   * @param src Source string.
   * @param dest Destination to hold %Base64 encoded string.
   * @return Size of destination string.
   */
  static int encode(const std::string &src, std::string &dest);

};

} // namespace fsa


text:
module.exports = function(grunt) {
    "use strict";

    grunt.initConfig({

        // Metadata.
        pkg: grunt.file.readJSON('package.json'),

        concurrent: {
            dev: {
                tasks: ['nodemon', 'watch'],
                options: {
                    logConcurrentOutput: true
                }
            }
        },
        nodemon: {
            dev: {
                script: 'bin/www',
                options: {
                    args: ['dev'],
                    nodeArgs: ['--debug'],
                    ext: 'js pug json',
                    ignore: ['node_modules/**'],
                    legacyWatch: true
                }
            }
        },
        watch: {
            js: {
                files: ['*.js', 'routes/**/*.js', 'specs/**/*.js'],
                tasks: ['jshint', 'jasmine_node']
            }
        },
        jshint: {
            files: ['*js', 'routes/**/*.js', 'specs/**/*.js'],
            options: {
                globals: {
                    jQuery: true
                }
            }
        },
        jasmine_node: {
            options: {
                forceExit: true,
                match: '.',
                matchall: false,
                extensions: 'js',
                specNameMatcher: 'spec'
            },
            all: []
        }
    });

    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jasmine-node');

    // Run this by typing "grunt test" on the command line
    grunt.registerTask('test', ['jshint', 'jasmine_node']);

    // Run the default task by typing "grunt" on the command line
    grunt.registerTask('default', ['concurrent']);

};


text:
package jiguang.chat.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.HorizontalScrollView;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.android.api.callback.GetUserInfoCallback;
import cn.jpush.im.android.api.model.UserInfo;
import jiguang.chat.R;
import jiguang.chat.adapter.CreateGroupAdapter;
import jiguang.chat.adapter.StickyListAdapter;
import jiguang.chat.application.JGApplication;
import jiguang.chat.database.FriendEntry;
import jiguang.chat.database.UserEntry;
import jiguang.chat.utils.keyboard.utils.EmoticonsKeyboardUtils;
import jiguang.chat.utils.pinyin.PinyinComparator;
import jiguang.chat.utils.sidebar.SideBar;
import se.emilsjolander.stickylistheaders.StickyListHeadersListView;

/**
 * Created by ${chenyn} on 2017/5/3.
 */

public class CreateGroupActivity extends BaseActivity implements View.OnClickListener, TextWatcher {

    private ImageButton mCancelBtn;
    private EditText mSearchEt;
    private StickyListHeadersListView mListView;
    private SideBar mSideBar;
    private TextView mLetterHintTv;
    private LinearLayout mFinishBtn;
    private StickyListAdapter mAdapter;
    private List<FriendEntry> mData;
    private HorizontalScrollView scrollViewSelected;
    private GridView imageSelectedGridView;
    private CreateGroupAdapter mGroupAdapter;
    private Context mContext;
    private FriendEntry mFriendEntry;
    private TextView mTv_noFriend;
    private TextView mTv_noFilter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.mContext = this;
        setContentView(R.layout.activity_create_group);
        initView();
        initData();
    }

    private void initData() {
        UserEntry userEntry = JGApplication.getUserEntry();
        mData = userEntry.getFriends();
        Collections.sort(mData, new PinyinComparator());
        if (mData.size() > 0) {
            mTv_noFriend.setVisibility(View.GONE);
        } else {
            mTv_noFriend.setVisibility(View.VISIBLE);
        }
        mGroupAdapter = new CreateGroupAdapter(CreateGroupActivity.this);
        imageSelectedGridView.setAdapter(mGroupAdapter);
        mAdapter = new StickyListAdapter(CreateGroupActivity.this, mData, true, scrollViewSelected, imageSelectedGridView, mGroupAdapter);
        mListView.setAdapter(mAdapter);

    }

    private void initView() {
        mTv_noFriend = (TextView) findViewById(R.id.tv_noFriend);
        mTv_noFilter = (TextView) findViewById(R.id.tv_noFilter);
        mCancelBtn = (ImageButton) findViewById(R.id.jmui_cancel_btn);
        mFinishBtn = (LinearLayout) findViewById(R.id.finish_btn);
        mSearchEt = (EditText) findViewById(R.id.search_et);
        mListView = (StickyListHeadersListView) findViewById(R.id.sticky_list_view);
        mSideBar = (SideBar) findViewById(R.id.sidebar);
        mLetterHintTv = (TextView) findViewById(R.id.letter_hint_tv);
        mSideBar.setTextView(mLetterHintTv);
        scrollViewSelected = (HorizontalScrollView) findViewById(R.id.contact_select_area);
        imageSelectedGridView = (GridView) findViewById(R.id.contact_select_area_grid);

        mSideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
            @Override
            public void onTouchingLetterChanged(String s) {
                int position = mAdapter.getSectionForLetter(s);
                if (position != -1 && position < mAdapter.getCount()) {
                    mListView.setSelection(position - 1);
                }
            }
        });

        mSearchEt.addTextChangedListener(this);

        mListView.setDrawingListUnderStickyHeader(true);
        mListView.setAreHeadersSticky(true);
        mListView.setStickyHeaderTopOffset(0);
        mFinishBtn.setOnClickListener(this);
        mCancelBtn.setOnClickListener(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        if (forDelete != null && forDelete.size() > 0) {
            for (FriendEntry e : forDelete) {
                e.delete();
            }
            mAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.jmui_cancel_btn:
                EmoticonsKeyboardUtils.closeSoftKeyboard(this);
                finish();
                break;
            case R.id.finish_btn:
                //拿到所选择的userName
                if (JGApplication.selectedUser != null && JGApplication.selectedUser.size() > 0) {
                    JGApplication.selectedUser.clear();
                }
                JGApplication.selectedUser = mAdapter.getSelectedUser();
                Intent intent = new Intent(mContext, SelectCreateGroupTypeActivity.class);
                startActivity(intent);
                break;
        }
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        filterData(s.toString());
    }

    List<FriendEntry> filterDateList;

    private void filterData(final String filterStr) {
        filterDateList = new ArrayList<>();
        if (!TextUtils.isEmpty(filterStr)) {
            filterDateList.clear();
            //遍历好友集合进行匹配
            for (FriendEntry entry : mData) {
                String appKey = entry.appKey;

                String userName = entry.username;
                String noteName = entry.noteName;
                String nickName = entry.nickName;
                if (!userName.equals(filterStr) && userName.contains(filterStr) ||
                        !userName.equals(filterStr) && noteName.contains(filterStr) ||
                        !userName.equals(filterStr) && nickName.contains(filterStr) &&
                                appKey.equals(JMessageClient.getMyInfo().getAppKey())) {
                    filterDateList.add(entry);
                }
            }
        } else {
            if (mFriendEntry != null) {
                mFriendEntry.delete();
            }
            filterDateList = mData;
        }
        if (filterDateList.size() > 0) {
            mTv_noFilter.setVisibility(View.GONE);
        }
        // 根据a-z进行排序
        Collections.sort(filterDateList, new PinyinComparator());
        mAdapter.updateListView(filterDateList, true, filterStr);

        //当搜索的人不是好友时全局搜索
        //这个不能放在for中的else中,否则for循环了多少次就会添加多少次搜出来的user
        final UserEntry user = UserEntry.getUser(JMessageClient.getMyInfo().getUserName(),
                JMessageClient.getMyInfo().getAppKey());
        final List<FriendEntry> finalFilterDateList = filterDateList;
        JMessageClient.getUserInfo(filterStr, new GetUserInfoCallback() {
            @Override
            public void gotResult(int responseCode, String responseMessage, UserInfo info) {
                if (responseCode == 0) {
                    mFriendEntry = new FriendEntry(info.getUserID(), info.getUserName(), info.getNotename(), info.getNickname(), info.getAppKey(), info.getAvatar(),
                            info.getUserName(), filterStr.substring(0, 1).toUpperCase(), user);
                    mFriendEntry.save();
                    forDelete.add(mFriendEntry);
                    finalFilterDateList.add(mFriendEntry);
                    Collections.sort(finalFilterDateList, new PinyinComparator());
                    if (finalFilterDateList.size() > 0) {
                        mTv_noFilter.setVisibility(View.GONE);
                    }
                    mAdapter.updateListView(finalFilterDateList, true, filterStr);
                } else {
                    if (filterDateList.size() > 0) {
                        mTv_noFilter.setVisibility(View.GONE);
                    } else {
                        mTv_noFilter.setVisibility(View.VISIBLE);
                    }
                }
            }
        });

    }

    List<FriendEntry> forDelete = new ArrayList<>();

    @Override
    public void afterTextChanged(Editable s) {

    }
}


text:
package org.apache.river.test.impl.start;

import java.util.logging.Level;

import org.apache.river.test.share.BaseQATest;

import java.util.ArrayList;
import java.util.Properties;
import org.apache.river.qa.harness.QAConfig;
import org.apache.river.qa.harness.Test;
import org.apache.river.qa.harness.Test;

/**
 * This class is an abstract class that acts as the base class which
 * most, if not all, tests of the ServiceStarter utility
 * class should extend.
 *
 * This class provides an implementation of the construct method
 * which performs standard functions related to the initialization of the
 * system state necessary to execute the test.
 *
 * Any test class that extends this class is required to implement the
 * run method which defines the actual functions that must
 * be executed in order to verify the assertions addressed by that test.
 *
 */
abstract public class AbstractBaseTest extends BaseQATest implements Test {

    /** Performs actions necessary to prepare for execution of the
     *  current test
     */
    public Test construct(QAConfig  config) throws Exception {
        delayLookupStart = true;
        super.construct(config);
        return this;
    }
}