text:
package io.mattcarroll.hover.content.toolbar;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;

import java.util.Stack;

import io.mattcarroll.hover.Content;
import io.mattcarroll.hover.R;
import io.mattcarroll.hover.content.Navigator;
import io.mattcarroll.hover.content.NavigatorContent;

/**
 * A {@link Navigator} that offers a {@code Toolbar}.
 */
public class ToolbarNavigator extends Navigator implements Content {

    private Toolbar mToolbar;
    private Drawable mBackArrowDrawable;
    private Stack<NavigatorContent> mContentStack; // TODO: if we extend Navigator then we don't need to implement our own stack
    private FrameLayout mContentContainer;
    private LinearLayout.LayoutParams mContentLayoutParams;

    public ToolbarNavigator(Context context) {
        this(context, null);
    }

    public ToolbarNavigator(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init() {
        LayoutInflater.from(getContext()).inflate(R.layout.view_toolbar_navigator, this, true);
        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                popContent();
            }
        });
        mBackArrowDrawable = createBackArrowDrawable();

        mContentContainer = (FrameLayout) findViewById(R.id.content_container);
        mContentLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        mContentStack = new Stack<>();
    }

    private Drawable createBackArrowDrawable() {
        // Load the desired back-arrow color from the theme that we're using.
        int[] attrIds = new int[] { R.attr.colorControlNormal };
        TypedArray attrs = getContext().obtainStyledAttributes(attrIds);
        int backArrowColor = attrs.getColor(attrs.getIndex(0), 0xFF000000);
        attrs.recycle();

        // Apply the desired color to the back-arrow icon and return it.
        Drawable backArrowDrawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_arrow_back);
        backArrowDrawable.setColorFilter(backArrowColor, PorterDuff.Mode.SRC_ATOP);
        return backArrowDrawable;
    }

    public Toolbar getToolbar() {
        return mToolbar;
    }

    @Override
    public void pushContent(@NonNull NavigatorContent content) {
        // Remove the currently visible content (if there is any).
        if (!mContentStack.isEmpty()) {
            mContentContainer.removeView(mContentStack.peek().getView());
            mContentStack.peek().onHidden();
        }

        // Push and display the new page.
        mContentStack.push(content);
        showContent(content);

        updateToolbarBackButton();
    }

    @Override
    public boolean popContent() {
        if (mContentStack.size() > 1) {
            // Remove the currently visible content.
            removeCurrentContent();

            // Add back the previous content (if there is any).
            if (!mContentStack.isEmpty()) {
                showContent(mContentStack.peek());
            }

            updateToolbarBackButton();

            return true;
        } else {
            return false;
        }
    }

    @Override
    public void clearContent() {
        if (mContentStack.isEmpty()) {
            // Nothing to clear.
            return;
        }

        // Pop every content View that we can.
        boolean didPopContent = popContent();
        while (didPopContent) {
            didPopContent = popContent();
        }

        // Clear the root View.
        removeCurrentContent();
    }

    private void showContent(@NonNull NavigatorContent content) {
        mContentContainer.addView(content.getView(), mContentLayoutParams);
        content.onShown(this);
    }

    private void removeCurrentContent() {
        NavigatorContent visibleContent = mContentStack.pop();
        mContentContainer.removeView(visibleContent.getView());
        visibleContent.onHidden();
    }

    private void updateToolbarBackButton() {
        if (mContentStack.size() >= 2) {
            // Show the back button.
            mToolbar.setNavigationIcon(mBackArrowDrawable);
        } else {
            // Hide the back button.
            mToolbar.setNavigationIcon(null);
        }
    }

    @NonNull
    @Override
    public View getView() {
        return this;
    }

    @Override
    public boolean isFullscreen() {
        return true;
    }

    @Override
    public void onShown() {
        // Do nothing.
    }

    @Override
    public void onHidden() {
        // Do nothing.
    }

}

redpajama_set_name: RedPajamaGithub


text:
package vcl

import (
    . "github.com/ying32/govcl/vcl/api"
    . "github.com/ying32/govcl/vcl/types"
    "unsafe"
)

type TReplaceDialog struct {
    IComponent
    instance uintptr
    // 特殊情况下使用,主要应对Go的GC问题,与LCL没有太多关系。
    ptr unsafe.Pointer
}

// 创建一个新的对象。
//
// Create a new object.
func NewReplaceDialog(owner IComponent) *TReplaceDialog {
    r := new(TReplaceDialog)
    r.instance = ReplaceDialog_Create(CheckPtr(owner))
    r.ptr = unsafe.Pointer(r.instance)
    return r
}

// 动态转换一个已存在的对象实例。
//
// Dynamically convert an existing object instance.
func AsReplaceDialog(obj interface{}) *TReplaceDialog {
    instance, ptr := getInstance(obj)
    if instance == 0 { return nil }
    return &TReplaceDialog{instance: instance, ptr: ptr}
}

// -------------------------- Deprecated begin --------------------------
// 新建一个对象来自已经存在的对象实例指针。
//
// Create a new object from an existing object instance pointer.
// Deprecated: use AsReplaceDialog.
func ReplaceDialogFromInst(inst uintptr) *TReplaceDialog {
    return AsReplaceDialog(inst)
}

// 新建一个对象来自已经存在的对象实例。
//
// Create a new object from an existing object instance.
// Deprecated: use AsReplaceDialog.
func ReplaceDialogFromObj(obj IObject) *TReplaceDialog {
    return AsReplaceDialog(obj)
}

// 新建一个对象来自不安全的地址。注意:使用此函数可能造成一些不明情况,慎用。
//
// Create a new object from an unsecured address. Note: Using this function may cause some unclear situations and be used with caution..
// Deprecated: use AsReplaceDialog.
func ReplaceDialogFromUnsafePointer(ptr unsafe.Pointer) *TReplaceDialog {
    return AsReplaceDialog(ptr)
}

// -------------------------- Deprecated end --------------------------
// 释放对象。
//
// Free object.
func (r *TReplaceDialog) Free() {
    if r.instance != 0 {
        ReplaceDialog_Free(r.instance)
        r.instance, r.ptr = 0, nullptr
    }
}

// 返回对象实例指针。
//
// Return object instance pointer.
func (r *TReplaceDialog) Instance() uintptr {
    return r.instance
}

// 获取一个不安全的地址。
//
// Get an unsafe address.
func (r *TReplaceDialog) UnsafeAddr() unsafe.Pointer {
    return r.ptr
}

// 检测地址是否为空。
//
// Check if the address is empty.
func (r *TReplaceDialog) IsValid() bool {
    return r.instance != 0
}

// 检测当前对象是否继承自目标对象。
//
// Checks whether the current object is inherited from the target object.
func (r *TReplaceDialog) Is() TIs {
    return TIs(r.instance)
}

// 动态转换当前对象为目标对象。
//
// Dynamically convert the current object to the target object.
//func (r *TReplaceDialog) As() TAs {
//    return TAs(r.instance)
//}

// 获取类信息指针。
//
// Get class information pointer.
func TReplaceDialogClass() TClass {
    return ReplaceDialog_StaticClassType()
}

func (r *TReplaceDialog) CloseDialog() {
    ReplaceDialog_CloseDialog(r.instance)
}

// 执行。
func (r *TReplaceDialog) Execute() bool {
    return ReplaceDialog_Execute(r.instance)
}

// 查找指定名称的组件。
//
// Find the component with the specified name.
func (r *TReplaceDialog) FindComponent(AName string) *TComponent {
    return AsComponent(ReplaceDialog_FindComponent(r.instance, AName))
}

// 获取类名路径。
//
// Get the class name path.
func (r *TReplaceDialog) GetNamePath() string {
    return ReplaceDialog_GetNamePath(r.instance)
}

// 是否有父容器。
//
// Is there a parent container.
func (r *TReplaceDialog) HasParent() bool {
    return ReplaceDialog_HasParent(r.instance)
}

// 复制一个对象,如果对象实现了此方法的话。
//
// Copy an object, if the object implements this method.
func (r *TReplaceDialog) Assign(Source IObject) {
    ReplaceDialog_Assign(r.instance, CheckPtr(Source))
}

// 获取类的类型信息。
//
// Get class type information.
func (r *TReplaceDialog) ClassType() TClass {
    return ReplaceDialog_ClassType(r.instance)
}

// 获取当前对象类名称。
//
// Get the current object class name.
func (r *TReplaceDialog) ClassName() string {
    return ReplaceDialog_ClassName(r.instance)
}

// 获取当前对象实例大小。
//
// Get the current object instance size.
func (r *TReplaceDialog) InstanceSize() int32 {
    return ReplaceDialog_InstanceSize(r.instance)
}

// 判断当前类是否继承自指定类。
//
// Determine whether the current class inherits from the specified class.
func (r *TReplaceDialog) InheritsFrom(AClass TClass) bool {
    return ReplaceDialog_InheritsFrom(r.instance, AClass)
}

// 与一个对象进行比较。
//
// Compare with an object.
func (r *TReplaceDialog) Equals(Obj IObject) bool {
    return ReplaceDialog_Equals(r.instance, CheckPtr(Obj))
}

// 获取类的哈希值。
//
// Get the hash value of the class.
func (r *TReplaceDialog) GetHashCode() int32 {
    return ReplaceDialog_GetHashCode(r.instance)
}

// 文本类信息。
//
// Text information.
func (r *TReplaceDialog) ToString() string {
    return ReplaceDialog_ToString(r.instance)
}

func (r *TReplaceDialog) ReplaceText() string {
    return ReplaceDialog_GetReplaceText(r.instance)
}

func (r *TReplaceDialog) SetReplaceText(value string) {
    ReplaceDialog_SetReplaceText(r.instance, value)
}

func (r *TReplaceDialog) SetOnReplace(fn TNotifyEvent) {
    ReplaceDialog_SetOnReplace(r.instance, fn)
}

// 获取左边位置。
//
// Get Left position.
func (r *TReplaceDialog) Left() int32 {
    return ReplaceDialog_GetLeft(r.instance)
}

// 设置左边位置。
//
// Set Left position.
func (r *TReplaceDialog) SetLeft(value int32) {
    ReplaceDialog_SetLeft(r.instance, value)
}

func (r *TReplaceDialog) Position() TPoint {
    return ReplaceDialog_GetPosition(r.instance)
}

func (r *TReplaceDialog) SetPosition(value TPoint) {
    ReplaceDialog_SetPosition(r.instance, value)
}

// 获取顶边位置。
//
// Get Top position.
func (r *TReplaceDialog) Top() int32 {
    return ReplaceDialog_GetTop(r.instance)
}

// 设置顶边位置。
//
// Set Top position.
func (r *TReplaceDialog) SetTop(value int32) {
    ReplaceDialog_SetTop(r.instance, value)
}

func (r *TReplaceDialog) FindText() string {
    return ReplaceDialog_GetFindText(r.instance)
}

func (r *TReplaceDialog) SetFindText(value string) {
    ReplaceDialog_SetFindText(r.instance, value)
}

func (r *TReplaceDialog) Options() TFindOptions {
    return ReplaceDialog_GetOptions(r.instance)
}

func (r *TReplaceDialog) SetOptions(value TFindOptions) {
    ReplaceDialog_SetOptions(r.instance, value)
}

func (r *TReplaceDialog) SetOnFind(fn TNotifyEvent) {
    ReplaceDialog_SetOnFind(r.instance, fn)
}

// 获取控件句柄。
//
// Get Control handle.
func (r *TReplaceDialog) Handle() HWND {
    return ReplaceDialog_GetHandle(r.instance)
}

func (r *TReplaceDialog) SetOnClose(fn TNotifyEvent) {
    ReplaceDialog_SetOnClose(r.instance, fn)
}

// 设置显示事件。
func (r *TReplaceDialog) SetOnShow(fn TNotifyEvent) {
    ReplaceDialog_SetOnShow(r.instance, fn)
}

// 获取组件总数。
//
// Get the total number of components.
func (r *TReplaceDialog) ComponentCount() int32 {
    return ReplaceDialog_GetComponentCount(r.instance)
}

// 获取组件索引。
//
// Get component index.
func (r *TReplaceDialog) ComponentIndex() int32 {
    return ReplaceDialog_GetComponentIndex(r.instance)
}

// 设置组件索引。
//
// Set component index.
func (r *TReplaceDialog) SetComponentIndex(value int32) {
    ReplaceDialog_SetComponentIndex(r.instance, value)
}

// 获取组件所有者。
//
// Get component owner.
func (r *TReplaceDialog) Owner() *TComponent {
    return AsComponent(ReplaceDialog_GetOwner(r.instance))
}

// 获取组件名称。
//
// Get the component name.
func (r *TReplaceDialog) Name() string {
    return ReplaceDialog_GetName(r.instance)
}

// 设置组件名称。
//
// Set the component name.
func (r *TReplaceDialog) SetName(value string) {
    ReplaceDialog_SetName(r.instance, value)
}

// 获取对象标记。
//
// Get the control tag.
func (r *TReplaceDialog) Tag() int {
    return ReplaceDialog_GetTag(r.instance)
}

// 设置对象标记。
//
// Set the control tag.
func (r *TReplaceDialog) SetTag(value int) {
    ReplaceDialog_SetTag(r.instance, value)
}

// 获取指定索引组件。
//
// Get the specified index component.
func (r *TReplaceDialog) Components(AIndex int32) *TComponent {
    return AsComponent(ReplaceDialog_GetComponents(r.instance, AIndex))
}


text:
using Microsoft.Azure.CognitiveServices.Vision.Face;
using Microsoft.Azure.CognitiveServices.Vision.Face.Models;
using Microsoft.Azure.Test.HttpRecorder;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using Xunit;

namespace FaceSDK.Tests
{
    public class FaceIdentifyTests : BaseTests
    {
        private static readonly string recognitionModel = RecognitionModel.Recognition02;

        [Fact]
        public void FaceIdentificationPersonGroupPositive()
        {
            using (MockContext context = MockContext.Start(this.GetType().FullName))
            {
                HttpMockServer.Initialize(this.GetType().FullName, "FaceIdentificationPersonGroupPositive");

                IFaceClient client = GetFaceClient(HttpMockServer.CreateInstance());
                Guid? faceId1 = null;
                string personGroupId = "person-group-id";
                client.PersonGroup.CreateAsync(personGroupId, "fakePersonGroup", recognitionModel: recognitionModel).Wait();
                try
                {
                    Person satyaPerson = client.PersonGroupPerson.CreateAsync(personGroupId, "Satya").Result;
                    Person gatesPerson = client.PersonGroupPerson.CreateAsync(personGroupId, "Gates").Result;
                    AddPersonGroupPersonFace(client, personGroupId, satyaPerson.PersonId, "Satya");
                    AddPersonGroupPersonFace(client, personGroupId, gatesPerson.PersonId, "Gates");
                    client.PersonGroup.TrainAsync(personGroupId).Wait();

                    var trainingStatus = WaitForPersonGroupTraining(client, personGroupId);
                    Assert.Equal(TrainingStatusType.Succeeded, trainingStatus.Status);

                    using (FileStream stream = new FileStream(Path.Combine("TestImages", "Satya4.jpg"), FileMode.Open))
                    {
                        faceId1 = client.Face.DetectWithStreamAsync(stream, true, recognitionModel: recognitionModel).Result[0].FaceId;
                        Assert.NotNull(faceId1);
                    }

                    IList<IdentifyResult> identificationResults = client.Face.IdentifyAsync(new List<Guid> { faceId1.Value }, personGroupId).Result;
                    Assert.Equal(1, identificationResults.Count);
                    Assert.Equal(satyaPerson.PersonId, identificationResults[0].Candidates[0].PersonId);
                    Assert.True(identificationResults[0].Candidates[0].Confidence > 0.5);
                }
                finally
                {
                    client.PersonGroup.DeleteAsync(personGroupId).Wait();
                }
            }
        }

        [Fact]
        public void FaceIdentificationLargePersonGroupPositive()
        {
            using (MockContext context = MockContext.Start(this.GetType().FullName))
            {
                HttpMockServer.Initialize(this.GetType().FullName, "FaceIdentificationLargePersonGroupPositive");

                IFaceClient client = GetFaceClient(HttpMockServer.CreateInstance());
                Guid? faceId1 = null;
                string largePersonGroupId = "large-person-group-id";
                client.LargePersonGroup.CreateAsync(largePersonGroupId, "fakeLargePersonGroup", recognitionModel: recognitionModel).Wait();
                try
                {
                    Person satyaPerson = client.LargePersonGroupPerson.CreateAsync(largePersonGroupId, "Satya").Result;
                    Person gatesPerson = client.LargePersonGroupPerson.CreateAsync(largePersonGroupId, "Gates").Result;
                    AddLargePersonGroupPersonFace(client, largePersonGroupId, satyaPerson.PersonId, "Satya");
                    AddLargePersonGroupPersonFace(client, largePersonGroupId, gatesPerson.PersonId, "Gates");
                    client.LargePersonGroup.TrainAsync(largePersonGroupId).Wait();

                    var trainingStatus = WaitForLargePersonGroupTraining(client, largePersonGroupId);
                    Assert.Equal(TrainingStatusType.Succeeded, trainingStatus.Status);

                    using (FileStream stream = new FileStream(Path.Combine("TestImages", "Satya4.jpg"), FileMode.Open))
                    {
                        faceId1 = client.Face.DetectWithStreamAsync(stream, true, recognitionModel: recognitionModel).Result[0].FaceId;
                        Assert.NotNull(faceId1);
                    }

                    IList<IdentifyResult> identificationResults = client.Face.IdentifyAsync(new List<Guid> { faceId1.Value }, largePersonGroupId: largePersonGroupId).Result;
                    Assert.Equal(1, identificationResults.Count);
                    Assert.Equal(satyaPerson.PersonId, identificationResults[0].Candidates[0].PersonId);
                    Assert.True(identificationResults[0].Candidates[0].Confidence > 0.5);
                }
                finally
                {
                    client.LargePersonGroup.DeleteAsync(largePersonGroupId).Wait();
                }
            }
        }

        private void AddPersonGroupPersonFace(IFaceClient client, string personGroupId, Guid personId, string fileName)
        {
            for (int i = 1; i < 4; i++)
            {
                DetectedFace face = null;
                using (FileStream stream = new FileStream(Path.Combine("TestImages", fileName + i + ".jpg"), FileMode.Open))
                {
                    face = client.Face.DetectWithStreamAsync(stream, true, recognitionModel: recognitionModel).Result[0];
                }

                using (FileStream stream = new FileStream(Path.Combine("TestImages", fileName + i + ".jpg"), FileMode.Open))
                {
                    client.PersonGroupPerson.AddFaceFromStreamAsync(personGroupId, personId, stream, null, new List<int>{
                        face.FaceRectangle.Left,
                        face.FaceRectangle.Top,
                        face.FaceRectangle.Width,
                        face.FaceRectangle.Height }).Wait();
                }
            }
        }

        private void AddLargePersonGroupPersonFace(IFaceClient client, string largePersonGroupId, Guid personId, string fileName)
        {
            for (int i = 1; i < 4; i++)
            {
                DetectedFace face = null;
                using (FileStream stream = new FileStream(Path.Combine("TestImages", fileName + i + ".jpg"), FileMode.Open))
                {
                    face = client.Face.DetectWithStreamAsync(stream, true, recognitionModel: recognitionModel).Result[0];
                }

                using (FileStream stream = new FileStream(Path.Combine("TestImages", fileName + i + ".jpg"), FileMode.Open))
                {
                    client.LargePersonGroupPerson.AddFaceFromStreamAsync(largePersonGroupId, personId, stream, null, new List<int>{
                        face.FaceRectangle.Left,
                        face.FaceRectangle.Top,
                        face.FaceRectangle.Width,
                        face.FaceRectangle.Height }).Wait();
                }
            }
        }

        private TrainingStatus WaitForLargePersonGroupTraining(
            IFaceClient client,
            string largePersonGroupId,
            int timeIntervalInMilliSeconds = 1000)
        {
            var trainingStatus = client.LargePersonGroup.GetTrainingStatusAsync(largePersonGroupId).Result;

            while (trainingStatus?.Status != null
                   && !trainingStatus.Status.Equals(TrainingStatusType.Succeeded)
                   && !trainingStatus.Status.Equals(TrainingStatusType.Failed))
            {
                Thread.Sleep(timeIntervalInMilliSeconds);

                trainingStatus = client.LargePersonGroup.GetTrainingStatusAsync(largePersonGroupId).Result;
            }

            return trainingStatus;
        }

        private TrainingStatus WaitForPersonGroupTraining(
            IFaceClient client,
            string personGroupId,
            int timeIntervalInMilliSeconds = 1000)
        {
            var trainingStatus = client.PersonGroup.GetTrainingStatusAsync(personGroupId).Result;

            while (trainingStatus?.Status != null
                   && !trainingStatus.Status.Equals(TrainingStatusType.Succeeded)
                   && !trainingStatus.Status.Equals(TrainingStatusType.Failed))
            {
                Thread.Sleep(timeIntervalInMilliSeconds);

                trainingStatus = client.PersonGroup.GetTrainingStatusAsync(personGroupId).Result;
            }

            return trainingStatus;
        }
    }
}


text:
package ch.pantas.billsplitter.dataaccess;

import android.test.suitebuilder.annotation.SmallTest;

import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;

import org.mockito.Mock;

import java.util.LinkedList;
import java.util.List;

import ch.pantas.billsplitter.dataaccess.rowmapper.UserRowMapper;
import ch.pantas.billsplitter.framework.BaseMockitoInstrumentationTest;
import ch.pantas.billsplitter.model.User;

import static ch.pantas.billsplitter.dataaccess.db.BillSplitterDatabaseOpenHelper.UserTable.NAME;
import static ch.pantas.billsplitter.framework.CustomMatchers.hasSize;
import static java.util.Arrays.asList;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.hasEntry;
import static org.mockito.Matchers.anyMap;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class UserStoreTest extends BaseMockitoInstrumentationTest {

    private static final List<User> EMPTY_LIST = new LinkedList<User>();

    @Mock
    private User user;

    @Mock
    private UserRowMapper mapper;

    @Mock
    private GenericStore<User> genericStore;

    @Inject
    private UserStore store;

    @Override
    protected Module getDefaultModule() {
        return new AbstractModule() {
            @Override
            protected void configure() {
                bind(new TypeLiteral<GenericStore<User>>() {
                }).toInstance(genericStore);
            }
        };
    }

    @SmallTest
    public void testGetUserWithNameThrowsNullPointerExceptionIfNoNameProvided() {
        try {
            store.getUserWithName(null);
            fail("No exception has been thrown");
        } catch (NullPointerException e) {
            assertNotNull(e);
        }
    }

    @SmallTest
    public void testGetUserWithNameThrowsIllegalArgumentExceptionIfEmptyNameProvided() {
        try {
            store.getUserWithName("");
            fail("No exception has been thrown");
        } catch (IllegalArgumentException e) {
            assertNotNull(e);
        }
    }

    @SmallTest
    public void testGetUserWithNameReturnsNullIfNoUserWithThatNameExists() {
        // Given
        when(genericStore.getModelsByQuery(anyMap())).thenReturn(EMPTY_LIST);

        // When
        User result = store.getUserWithName("Joe");

        // Then
        assertNull(result);
    }

    @SmallTest
    public void testGetUserWithNameReturnsUserIfItExists() {
        // Given
        when(genericStore.getModelsByQuery(anyMap())).thenReturn(asList(user));

        // When
        User result = store.getUserWithName("Joe");

        // Then
        assertEquals(user, result);
    }

    @SmallTest
    public void testGetUserWithNameHasCorrectWhereArgument() {
        // Given
        String name = "Joe";

        // When
        store.getUserWithName(name);

        // Then
        verify(genericStore, times(1)).getModelsByQuery(argThat(allOf(hasSize(1), hasEntry(NAME, name))));
    }

    @SmallTest
    public void testGetUsersWithNameLikeThrowsNullPointerExceptionIfNoNameProvided() {
        try {
            store.getUsersWithNameLike(null);
            fail("No exception has been thrown");
        } catch (NullPointerException e) {
            assertNotNull(e);
        }
    }

    @SmallTest
    public void testGetUserWithNameLikeReturnsResultOfGenericStore() {
        // Given
        when(genericStore.getModelsByQuery(anyMap())).thenReturn(EMPTY_LIST);

        // When
        List<User> users = store.getUsersWithNameLike("A");

        // Then
        assertEquals(EMPTY_LIST, users);
    }

    @SmallTest
    public void testGetUserWithNameLikeSendsQueryWithCorrectWhereClause() {
        // Given
        String nameFilter = "A";

        // When
        store.getUsersWithNameLike(nameFilter);

        // Then
        verify(genericStore, times(1)).getModelsByQueryWithLike(argThat(allOf(hasSize(1), hasEntry(NAME, nameFilter))));
    }
}


text:
<div bs-button-group>
    <button bs-button="icon-left"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Website</button>
    <button bs-button="icon-left"><svg bs-svg-icon><use xlink:href="#svg-twitter"></use></svg> Twitter</button>
    <button bs-button="icon-right"><svg bs-svg-icon><use xlink:href="#svg-github"></use></svg> Github</button>
    <button bs-button="icon" disabled><svg bs-svg-icon><use xlink:href="#svg-target"></use></svg></button>
</div>
<div bs-button-group>
    <button bs-button="icon"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg></button>
    <button bs-button="icon"><svg bs-svg-icon><use xlink:href="#svg-twitter"></use></svg></button>
    <button bs-button="icon"><svg bs-svg-icon><use xlink:href="#svg-github"></use></svg></button>
    <button bs-button="icon"><svg bs-svg-icon><use xlink:href="#svg-target"></use></svg></button>
</div>
<div bs-button-group>
    <button bs-button="">Button</button>
    <button bs-button="icon"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg></button>
    <button bs-button="icon-left"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Button Small</button>
    <button bs-button disabled>n/a</button>
    <button bs-button="icon-right"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Button Small</button>
</div>
<div bs-button-group>
    <button bs-button="subtle-alt">Button</button>
    <button bs-button="subtle-alt icon"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg></button>
    <button bs-button="subtle-alt icon-left"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Button Small</button>
    <button bs-button="subtle-alt" disabled>n/a</button>
    <button bs-button="subtle-alt icon-right"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Button Small</button>
</div>
<div bs-button-group>
    <button bs-button="size-small subtle-alt">Button</button>
    <button bs-button="size-small subtle-alt icon"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg></button>
    <button bs-button="size-small subtle-alt icon-left"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Button Small</button>
    <button bs-button="size-small subtle-alt" disabled>n/a</button>
    <button bs-button="size-small subtle-alt icon-right"><svg bs-svg-icon><use xlink:href="#svg-globe"></use></svg> Button Small</button>
</div>


text:
import Board from "../entities/board";
import Column from "../entities/column";
import Card from "../entities/card";
import HttpClient from "../infra/http/http-client";
import BoardService, { SaveCardInput, SaveColumnInput, UpdateCardInput } from "./board-service";

export default class BoardServiceHttp implements BoardService {

    constructor(readonly httpClient: HttpClient, readonly baseUrl: string) {
    }

    async getBoard(idBoard: number): Promise<Board> {
        const boardData: GetBoardDTO = await this.httpClient.get(`${this.baseUrl}/boards/${idBoard}`);
        const board = new Board(boardData.idBoard, boardData.name);
        for (const columnData of boardData.columns) {
            const column = new Column(columnData.name, columnData.estimate);
            column.idColumn = columnData.idColumn;
            board.columns.push(column);
            for (const cardData of columnData.cards) {
                const card = new Card(cardData.title, cardData.estimate);
                card.idCard = cardData.idCard;
                column.cards.push(card);
            }
        }
        return board;
    }

    async saveColumn(column: SaveColumnInput): Promise<number> {
        const idColumn = await this.httpClient.post(
            `${this.baseUrl}/boards/${column.idBoard}/columns`,
            column
        );
        return idColumn;
    }

    async saveCard(card: SaveCardInput): Promise<number> {
        const idCard = await this.httpClient.post(
            `${this.baseUrl}/boards/${card.idBoard}/columns/${card.idColumn}/cards`,
            card
        );
        return idCard;
    }

    async deleteColumn(idBoard: number, idColumn: number): Promise<void> {
        await this.httpClient.delete(
            `${this.baseUrl}/boards/${idBoard}/columns/${idColumn}`
        );
    }

    async deleteCard(idBoard: number, idColumn: number, idCard: number): Promise<void> {
        await this.httpClient.delete(
            `${this.baseUrl}/boards/${idBoard}/columns/${idColumn}/cards/${idCard}`
        );
    }
    async updateCard(card: UpdateCardInput): Promise<void> {
        // console.log(card);
        await this.httpClient.put(
            `${this.baseUrl}/boards/${card.idBoard}/columns/${card.idColumn}/cards/${card.idCard}`,
            card
        );
    }
}

// DTO = Data Transfer Object
type GetBoardDTO = {
    idBoard: number,
    name: string,
    columns: ColumnDTO[]
}

type ColumnDTO = {
    idColumn: number,
    name: string,
    estimate: boolean,
    cards: CardDTO[]
}

type CardDTO = {
    idCard: number,
    title: string,
    estimate: number
}


text:
package org.onosproject.pce.pcestore.api;

import java.util.List;

import org.onosproject.incubator.net.resource.label.LabelResourceId;
import org.onosproject.incubator.net.tunnel.TunnelId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;
import org.onosproject.net.resource.ResourceConsumer;
import org.onosproject.pce.pcestore.PceccTunnelInfo;
import org.onosproject.pce.pcestore.PcePathInfo;

import java.util.Map;

/**
 * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
 */
public interface PceStore {
    /**
     * Checks whether device id is present in global node label store.
     *
     * @param id device id
     * @return success of failure
     */
    boolean existsGlobalNodeLabel(DeviceId id);

    /**
     * Checks whether link is present in adjacency label store.
     *
     * @param link link between devices
     * @return success of failure
     */
    boolean existsAdjLabel(Link link);

    /**
     * Checks whether tunnel id is present in tunnel info store.
     *
     * @param tunnelId tunnel id
     * @return success of failure
     */
    boolean existsTunnelInfo(TunnelId tunnelId);

    /**
     * Checks whether path info is present in failed path info list.
     *
     * @param failedPathInfo failed path information
     * @return success or failure
     */
    boolean existsFailedPathInfo(PcePathInfo failedPathInfo);

    /**
     * Retrieves the node label count.
     *
     * @return node label count
     */
    int getGlobalNodeLabelCount();

    /**
     * Retrieves the adjacency label count.
     *
     * @return adjacency label count
     */
    int getAdjLabelCount();

    /**
     * Retrieves the tunnel info count.
     *
     * @return tunnel info count
     */
    int getTunnelInfoCount();

    /**
     * Retrieves the failed path info count.
     *
     * @return failed path info count
     */
    int getFailedPathInfoCount();

    /**
     * Retrieves device id and label pairs collection from global node label store.
     *
     * @return collection of device id and label pairs
     */
    Map<DeviceId, LabelResourceId> getGlobalNodeLabels();

    /**
     * Retrieves link and label pairs collection from adjacency label store.
     *
     * @return collection of link and label pairs
     */
    Map<Link, LabelResourceId> getAdjLabels();

    /**
     * Retrieves tunnel id and pcecc tunnel info pairs collection from tunnel info store.
     *
     * @return collection of tunnel id and pcecc tunnel info pairs
     */
    Map<TunnelId, PceccTunnelInfo> getTunnelInfos();

    /**
     * Retrieves path info collection from failed path info store.
     *
     * @return collection of failed path info
     */
    Iterable<PcePathInfo> getFailedPathInfos();

    /**
     * Retrieves node label for specified device id.
     *
     * @param id device id
     * @return node label
     */
    LabelResourceId getGlobalNodeLabel(DeviceId id);

    /**
     * Retrieves adjacency label for specified link.
     *
     * @param link between devices
     * @return adjacency label
     */
    LabelResourceId getAdjLabel(Link link);

    /**
     * Retrieves local label info with tunnel consumer id from tunnel info store.
     *
     * @param tunnelId tunnel id
     * @return pcecc tunnel info
     */
    PceccTunnelInfo getTunnelInfo(TunnelId tunnelId);

    /**
     * Stores node label into global node label store.
     *
     * @param deviceId device id
     * @param labelId node label id
     */
    void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId);

    /**
     * Stores adjacency label into adjacency label store.
     *
     * @param link link between nodes
     * @param labelId link label id
     */
    void addAdjLabel(Link link, LabelResourceId labelId);

    /**
     * Stores local label info with tunnel consumer id into tunnel info store for specified tunnel id.
     *
     * @param tunnelId tunnel id
     * @param pceccTunnelInfo local label info
     */
    void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo);

    /**
     * Stores path information into failed path info store.
     *
     * @param failedPathInfo failed path information
     */
    void addFailedPathInfo(PcePathInfo failedPathInfo);

    /**
     * Updates local label info. The first entry is created with TunnelId and TunnelConsumerId.
     * Later this entry may be updated to store label information if it is basic PCECC case.
     *
     * @param tunnelId tunnel id
     * @param lspLocalLabelInfoList list of local labels
     * @return success or failure
     */
    boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList);

    /**
     * Updates tunnel info map with tunnel consumer id.
     *
     * @param tunnelId tunnel id
     * @param tunnelConsumerId tunnel consumer id
     * @return success or failure
     */
    boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId);

    /**
     * Removes device label from global node label store for specified device id.
     *
     * @param id device id
     * @return success or failure
     */
    boolean removeGlobalNodeLabel(DeviceId id);

    /**
     * Removes adjacency label from adjacency label store for specified link information.
     *
     * @param link between nodes
     * @return success or failure
     */
    boolean removeAdjLabel(Link link);

    /**
     * Removes local label info with tunnel consumer id from tunnel info store for specified tunnel id.
     *
     * @param tunnelId tunnel id
     * @return success or failure
     */
    boolean removeTunnelInfo(TunnelId tunnelId);

    /**
     * Removes path info from failed path info store.
     *
     * @param failedPathInfo failed path information
     * @return success or failure
     */
    boolean removeFailedPathInfo(PcePathInfo failedPathInfo);

    /**
     * Adds lsrid to device id mapping.
     *
     * @param lsrId lsrId of the device
     * @param deviceId device id
     * @return success or failure
     */
    boolean addLsrIdDevice(String lsrId, DeviceId deviceId);

    /**
     * Removes lsrid to device id mapping.
     *
     * @param lsrId lsrId of the device
     * @return success or failure
     */
    boolean removeLsrIdDevice(String lsrId);

    /**
     * Gets lsrid to device id mapping.
     *
     * @param lsrId lsrId of the device
     * @return device id of the lsrId
     */
    DeviceId getLsrIdDevice(String lsrId);

    /**
     * Adds lsrId of the PCC in form of device id for the PCC for which sync is pending due to non-availability of BGP.
     * device.
     *
     * @param lsrId LSR id of the PCC in form of device id
     * @return success or failure
     */
    public boolean addPccLsr(DeviceId lsrId);

    /**
     * Removes lsrId of the PCC in form of device id for the PCC for which pending sync is done.
     *
     * @param lsrId LSR id of the PCC in form of device id
     * @return success or failure
     */
    public boolean removePccLsr(DeviceId lsrId);

    /**
     * Gets lsrId of the PCC in form of device id.
     *
     * @param lsrId LSR id of the PCC in form of device id
     * @return success or failure
     */
    public boolean hasPccLsr(DeviceId lsrId);
}


text:
<?php
namespace PayPal\Api;

use PayPal\Common\PPModel;

class HyperSchema extends PPModel {
	/**
	 *
	 * @array
	 * @param PayPal\Api\Links $links
	 */
	public function setLinks($links) {
		$this->links = $links;
		return $this;
	}

	/**
	 *
	 * @return PayPal\Api\Links
	 */
	public function getLinks() {
		return $this->links;
	}

	/**
	 *
	 * @param string $fragmentResolution
	 */
	public function setFragmentResolution($fragmentResolution) {
		$this->fragmentResolution = $fragmentResolution;
		return $this;
	}

	/**
	 *
	 * @return string
	 */
	public function getFragmentResolution() {
		return $this->fragmentResolution;
	}

	/**
	 *
	 * @param boolean $readonly
	 */
	public function setReadonly($readonly) {
		$this->readonly = $readonly;
		return $this;
	}

	/**
	 *
	 * @return boolean
	 */
	public function getReadonly() {
		return $this->readonly;
	}

	/**
	 *
	 * @param string $contentEncoding
	 */
	public function setContentEncoding($contentEncoding) {
		$this->contentEncoding = $contentEncoding;
		return $this;
	}

	/**
	 *
	 * @return string
	 */
	public function getContentEncoding() {
		return $this->contentEncoding;
	}

	/**
	 *
	 * @param string $pathStart
	 */
	public function setPathStart($pathStart) {
		$this->pathStart = $pathStart;
		return $this;
	}

	/**
	 *
	 * @return string
	 */
	public function getPathStart() {
		return $this->pathStart;
	}

	/**
	 *
	 * @param string $mediaType
	 */
	public function setMediaType($mediaType) {
		$this->mediaType = $mediaType;
		return $this;
	}

	/**
	 *
	 * @return string
	 */
	public function getMediaType() {
		return $this->mediaType;
	}

}


text:
package org.apache.geode.internal.cache.wan.parallel;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyLong;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import org.apache.geode.internal.cache.BucketRegion;
import org.apache.geode.internal.cache.BucketRegionQueue;
import org.apache.geode.internal.cache.PartitionedRegion;
import org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor;
import org.apache.geode.internal.cache.wan.WaitUntilGatewaySenderFlushedCoordinatorJUnitTest;
import org.apache.geode.internal.cache.wan.parallel.WaitUntilParallelGatewaySenderFlushedCoordinator.WaitUntilBucketRegionQueueFlushedCallable;
import org.apache.geode.test.junit.categories.WanTest;

@Category({WanTest.class})
public class WaitUntilParallelGatewaySenderFlushedCoordinatorJUnitTest
    extends WaitUntilGatewaySenderFlushedCoordinatorJUnitTest {

  private PartitionedRegion region;
  private BucketRegionQueue brq;

  protected void createGatewaySender() {
    super.createGatewaySender();
    ConcurrentParallelGatewaySenderQueue queue =
        (ConcurrentParallelGatewaySenderQueue) spy(getQueue());
    doReturn(queue).when(this.sender).getQueue();
    this.region = mock(PartitionedRegion.class);
    doReturn(this.region).when(queue).getRegion();
    this.brq = mock(BucketRegionQueue.class);
  }

  protected AbstractGatewaySenderEventProcessor getEventProcessor() {
    ConcurrentParallelGatewaySenderEventProcessor processor =
        spy(new ConcurrentParallelGatewaySenderEventProcessor(this.sender, null));
    return processor;
  }

  @Test
  public void testWaitUntilParallelGatewaySenderFlushedSuccessfulNotInitiator() throws Throwable {
    long timeout = 5000;
    TimeUnit unit = TimeUnit.MILLISECONDS;
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinator =
        new WaitUntilParallelGatewaySenderFlushedCoordinator(this.sender, timeout, unit, false);
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinatorSpy = spy(coordinator);
    doReturn(getLocalBucketRegions()).when(coordinatorSpy).getLocalBucketRegions(any());
    doReturn(getCallableResult(true)).when(coordinatorSpy)
        .createWaitUntilBucketRegionQueueFlushedCallable(any(), anyLong(), any());
    boolean result = coordinatorSpy.waitUntilFlushed();
    assertTrue(result);
  }

  @Test
  public void waitUntilFlushShouldExitEarlyIfTimeoutElapses() throws Throwable {
    long timeout = 500;
    TimeUnit unit = TimeUnit.MILLISECONDS;
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinator =
        new WaitUntilParallelGatewaySenderFlushedCoordinator(this.sender, timeout, unit, false);
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinatorSpy = spy(coordinator);

    Set<BucketRegion> bucketRegions = new HashSet<>();
    for (int i = 0; i < 5000; i++) {
      bucketRegions.add(mock(BucketRegionQueue.class));
    }
    doReturn(bucketRegions).when(coordinatorSpy).getLocalBucketRegions(any());

    WaitUntilBucketRegionQueueFlushedCallable callable =
        mock(WaitUntilBucketRegionQueueFlushedCallable.class);
    when(callable.call()).then(invocation -> {
      Thread.sleep(100);
      return true;
    });
    doReturn(callable).when(coordinatorSpy).createWaitUntilBucketRegionQueueFlushedCallable(any(),
        anyLong(), any());
    boolean result = coordinatorSpy.waitUntilFlushed();
    assertFalse(result);

    verify(callable, atMost(50)).call();
  }

  @Test
  public void testWaitUntilParallelGatewaySenderFlushedUnsuccessfulNotInitiator() throws Throwable {
    long timeout = 5000;
    TimeUnit unit = TimeUnit.MILLISECONDS;
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinator =
        new WaitUntilParallelGatewaySenderFlushedCoordinator(this.sender, timeout, unit, false);
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinatorSpy = spy(coordinator);
    doReturn(getLocalBucketRegions()).when(coordinatorSpy).getLocalBucketRegions(any());
    doReturn(getCallableResult(false)).when(coordinatorSpy)
        .createWaitUntilBucketRegionQueueFlushedCallable(any(), anyLong(), any());
    boolean result = coordinatorSpy.waitUntilFlushed();
    assertFalse(result);
  }

  @Test
  public void testWaitUntilParallelGatewaySenderFlushedSuccessfulInitiator() throws Throwable {
    long timeout = 5000;
    TimeUnit unit = TimeUnit.MILLISECONDS;
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinator =
        new WaitUntilParallelGatewaySenderFlushedCoordinator(this.sender, timeout, unit, true);
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinatorSpy = spy(coordinator);
    doReturn(getLocalBucketRegions()).when(coordinatorSpy).getLocalBucketRegions(any());
    doReturn(getCallableResult(true)).when(coordinatorSpy)
        .createWaitUntilBucketRegionQueueFlushedCallable(any(), anyLong(), any());
    boolean result = coordinatorSpy.waitUntilFlushed();
    assertTrue(result);
  }

  @Test
  public void testWaitUntilParallelGatewaySenderFlushedUnsuccessfulInitiator() throws Throwable {
    long timeout = 5000;
    TimeUnit unit = TimeUnit.MILLISECONDS;
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinator =
        new WaitUntilParallelGatewaySenderFlushedCoordinator(this.sender, timeout, unit, true);
    WaitUntilParallelGatewaySenderFlushedCoordinator coordinatorSpy = spy(coordinator);
    doReturn(getLocalBucketRegions()).when(coordinatorSpy).getLocalBucketRegions(any());
    doReturn(getCallableResult(false)).when(coordinatorSpy)
        .createWaitUntilBucketRegionQueueFlushedCallable(any(), anyLong(), any());
    boolean result = coordinatorSpy.waitUntilFlushed();
    assertFalse(result);
  }

  private WaitUntilBucketRegionQueueFlushedCallable getCallableResult(boolean expectedResult)
      throws Exception {
    WaitUntilBucketRegionQueueFlushedCallable callable =
        mock(WaitUntilBucketRegionQueueFlushedCallable.class);
    when(callable.call()).thenReturn(expectedResult);
    return callable;
  }

  private Set<BucketRegionQueue> getLocalBucketRegions() {
    Set<BucketRegionQueue> localBucketRegions = new HashSet<BucketRegionQueue>();
    localBucketRegions.add(this.brq);
    return localBucketRegions;
  }
}


text:
import nativeMathDate from './base/engines/nativeMathDate';
import uniqueGenerator from './base/uniqueGenerator';

export default function dates(size, start, end) {
    return uniqueGenerator(nativeMathDate)(size, { start, end });
}


text:
<?php

namespace Cosa\PageBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Page
 */
class Page
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $title;

    /**
     * @var string
     */
    private $content;

    /**
     * @var boolean
     */
    private $status;

    /**
     * @var boolean
     */
    private $commentStatus;

    /**
     * @var string
     */
    private $metaUrl;

    /**
     * @var string
     */
    private $metaTitle;

    /**
     * @var string
     */
    private $metaDescription;

    /**
     * @var string
     */
    private $metaKeywords;

    /**
     * @var \DateTime
     */
    private $createdAt;

    /**
     * @var \DateTime
     */
    private $updatedAt;

    /**
     * @var \Doctrine\Common\Collections\Collection
     */
    private $categories;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->categories = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set title
     *
     * @param string $title
     * @return Page
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set content
     *
     * @param string $content
     * @return Page
     */
    public function setContent($content)
    {
        $this->content = $content;

        return $this;
    }

    /**
     * Get content
     *
     * @return string
     */
    public function getContent()
    {
        return $this->content;
    }

    /**
     * Set status
     *
     * @param boolean $status
     * @return Page
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

    /**
     * Get status
     *
     * @return boolean
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Set commentStatus
     *
     * @param boolean $commentStatus
     * @return Page
     */
    public function setCommentStatus($commentStatus)
    {
        $this->commentStatus = $commentStatus;

        return $this;
    }

    /**
     * Get commentStatus
     *
     * @return boolean
     */
    public function getCommentStatus()
    {
        return $this->commentStatus;
    }

    /**
     * Set metaUrl
     *
     * @param string $metaUrl
     * @return Page
     */
    public function setMetaUrl($metaUrl)
    {
        $this->metaUrl = $metaUrl;

        return $this;
    }

    /**
     * Get metaUrl
     *
     * @return string
     */
    public function getMetaUrl()
    {
        return $this->metaUrl;
    }

    /**
     * Set metaTitle
     *
     * @param string $metaTitle
     * @return Page
     */
    public function setMetaTitle($metaTitle)
    {
        $this->metaTitle = $metaTitle;

        return $this;
    }

    /**
     * Get metaTitle
     *
     * @return string
     */
    public function getMetaTitle()
    {
        return $this->metaTitle;
    }

    /**
     * Set metaDescription
     *
     * @param string $metaDescription
     * @return Page
     */
    public function setMetaDescription($metaDescription)
    {
        $this->metaDescription = $metaDescription;

        return $this;
    }

    /**
     * Get metaDescription
     *
     * @return string
     */
    public function getMetaDescription()
    {
        return $this->metaDescription;
    }

    /**
     * Set metaKeywords
     *
     * @param string $metaKeywords
     * @return Page
     */
    public function setMetaKeywords($metaKeywords)
    {
        $this->metaKeywords = $metaKeywords;

        return $this;
    }

    /**
     * Get metaKeywords
     *
     * @return string
     */
    public function getMetaKeywords()
    {
        return $this->metaKeywords;
    }

    /**
     * Set createdAt
     *
     * @param \DateTime $createdAt
     * @return Page
     */
    public function setCreatedAt($createdAt)
    {
        $this->createdAt = $createdAt;

        return $this;
    }

    /**
     * Get createdAt
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

    /**
     * Set updatedAt
     *
     * @param \DateTime $updatedAt
     * @return Page
     */
    public function setUpdatedAt($updatedAt)
    {
        $this->updatedAt = $updatedAt;

        return $this;
    }

    /**
     * Get updatedAt
     *
     * @return \DateTime
     */
    public function getUpdatedAt()
    {
        return $this->updatedAt;
    }

    /**
     * Add categories
     *
     * @param \Cosa\CategoryBundle\Entity\Category $categories
     * @return Page
     */
    public function addCategory(\Cosa\CategoryBundle\Entity\Category $categories)
    {
        $this->categories[] = $categories;

        return $this;
    }

    /**
     * Remove categories
     *
     * @param \Cosa\CategoryBundle\Entity\Category $categories
     */
    public function removeCategory(\Cosa\CategoryBundle\Entity\Category $categories)
    {
        $this->categories->removeElement($categories);
    }

    /**
     * Get categories
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getCategories()
    {
        return $this->categories;
    }
    /**
     * @var boolean
     */
    private $isHidden;

    /**
     * Set isHidden
     *
     * @param boolean $isHidden
     * @return Page
     */
    public function setIsHidden($isHidden)
    {
        $this->isHidden = $isHidden;

        return $this;
    }

    /**
     * Get isHidden
     *
     * @return boolean
     */
    public function getIsHidden()
    {
        return $this->isHidden;
    }
}


text:
title: Обмен онлайн
inshort: не определено
translator: Microsoft Cognitive Services
---


text:
<?php

/**
 * StepIn Solutions venture
 *
 *
 * @package stepone
 */
class siCommon extends mySql {

    //Constructer
    public function __construct($sDbHost = "", $sDbUser = "", $sDbPassword = "", $sDbName = "") {
        parent::__construct($sDbHost, $sDbUser, $sDbPassword, $sDbName);
    }

    /**
     * To get records
     * @param type $sQuery
     * @param type $aLimit
     * @param type $aGroupBy
     * @param type $aSearch
     * @param type $aSort
     * @param type $sMode
     * @param type $aHaving
     * @return type
     */
    public function getList($sQuery, $aLimit = array(), $aGroupBy = array(), $aSearch = array(), $aSort = array(), $sMode = '', $aHaving = array()) {
        $ssSearch = '';
        $ssGroupBy = '';
        $ssSort = '';
        $limit = '';
        $ssHaving = '';
        if (count($aLimit) && is_array($aLimit)) {
            foreach ($aLimit as $sLimit) {
                foreach ($sLimit as $sLimitValue => $limitValue) {
                    $limit = $limitValue;
                }
            }
        }
        if (count($aSearch) && is_array($aSearch)) {
            switch ($sMode) {
                case 'LIKE':
                    if ($aSearch != '') {
                        foreach ($aSearch as $sSearch => $sSearchValue) {
                            $ssSearch .= $sSearch . ' ' . 'LIKE' . ' ' . '"%' . $sSearchValue . '%"' . ' ';
                        }
                    }
                    break;
                case 'IN':
                    if ($aSearch != '') {
                        foreach ($aSearch as $sSearch => $sSearchValue) {
                            $ssSearch = $sSearch . ' IN ' . "('" . '' . $sSearchValue . "') ";
                        }
                    }
                    break;
                case '=':
                    if ($aSearch != '') {
                        foreach ($aSearch as $sSearch => $sSearchValue) {
                            $ssSearch .= $sSearch . ' = ' . "'" . '' . $sSearchValue . "' ";
                        }
                    }
                    break;
                case '!=':
                    if ($aSearch != '') {
                        foreach ($aSearch as $sSearch => $sSearchValue) {
                            $ssSearch = $sSearch . ' != ' . "'" . '' . $sSearchValue . "' ";
                        }
                    }
                    break;
                case '>=':
                    if ($aSearch != '') {
                        foreach ($aSearch as $sSearch => $sSearchValue) {
                            $ssSearch = $sSearch . ' >= ' . "'" . '' . $sSearchValue . "' ";
                        }
                    }
                    break;
                case '<=':
                    if ($aSearch != '') {
                        foreach ($aSearch as $sSearch => $sSearchValue) {
                            $ssSearch = $sSearch . ' <= ' . "'" . '' . $sSearchValue . "' ";
                        }
                    }
                    break;
            }
        }

        if (count($aSort) && is_array($aSort)) {
            foreach ($aSort as $sSort) {
                foreach ($sSort as $sSortValues => $sSortRow) {
                    $ssSort = $sSortValues;
                    foreach ($sSortRow as $sSortValue) {
                        $ssSort.= $sSortValue;
                    }
                }
            }
        }
        if (count($aGroupBy) && is_array($aGroupBy)) {
            foreach ($aGroupBy as $sGroupBy => $eValue) {
                $ssGroupBy = $sGroupBy;
                $ssGroupBy .= $eValue;
            }
        }
        if (count($aHaving) && is_array($aHaving)) {
            foreach ($aHaving as $sHaving => $eValue) {
                $ssHaving = $sHaving;
                $ssHaving .= $eValue;
            }
        }
        $aQuery = $sQuery . $ssSearch . $ssGroupBy . $ssHaving . $ssSort . $limit;
        return $this->executeQuery($aQuery);
    }

    /**
     * To delete records
     * @param type $sTableName
     * @param type $aFieldId
     * @param type $bPhDelete
     * @param type $aFieldName
     * @return type
     */
    public function deleteRecordById($sTableName, $aFieldId, $bPhDelete, $sFieldName) {
        if ($bPhDelete) {
            $sDelete = "DELETE FROM " . $sTableName . " WHERE " . $sFieldName . " IN (" . implode(",", $aFieldId[0]).")";
            return $this->executeQuery($sDelete);
        } else {
            $sUpdate = "UPDATE " . $sTableName . " SET deleted = " . "'" . "1" . "'" . " WHERE " . $sFieldName . " IN (" . implode(",", $aFieldId[0]) . ")";
            return $this->executeQuery($sUpdate);
        }
    }
    /**
     * To take validations
     * @param type $aValidation
     * @return boolean
     */
    public function validateData($aValidation) {
        global $oSession;
        $bIsValid = true;
        foreach ($aValidation as $aValidationDetails) {
            if ($aValidationDetails['validation'] == "required") {
                if (trim($aValidationDetails['value']) == "") {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "email") {
                if (!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $aValidationDetails['value'])) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "fileType") {
                $mType = isset($aValidationDetails['value']['type']) ? $aValidationDetails['value']['type'] : '';
                $validTypes = $aValidationDetails['validTypes'];
                if (!in_array($mType, $validTypes)) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "unique") {
                $sQuery = " SELECT "
                        . $aValidationDetails['table_field_name'] .
                        " FROM "
                        . $aValidationDetails['table_name'] .
                        " WHERE "
                        . $aValidationDetails['table_field_name'] . " = '" . $aValidationDetails['value'] . "' AND " . $aValidationDetails['table_field_id'] . "!= '" . $aValidationDetails['id'] . "' AND deleted = '0' " . " LIMIT 1";
                $mQueryHandler = $this->executeQuery($sQuery);
                $aInfo = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aInfo);
                if ($nCountRecord != '') {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "uniqueentity") {
                $sWhere = " 1 ";
                if (isset($aValidationDetails['table_field_id']) && !empty($aValidationDetails['table_field_id'])) {
                    $sWhere .= " AND " . $aValidationDetails['table_field_id'] . " != '" . $aValidationDetails['id'] . "'";
                }

                if (isset($aValidationDetails['table_field_name']) && !empty($aValidationDetails['table_field_name'])) {
                    $sWhere .= " AND " . $aValidationDetails['table_field_name'] . " = '" . $aValidationDetails['value'] . "'";
                }

                if (isset($aValidationDetails['table_field_name2']) && !empty($aValidationDetails['table_field_name2'])) {
                    $sWhere .= " AND " . $aValidationDetails['table_field_name2'] . " = '" . $aValidationDetails['value2'] . "'";
                }

                $sWhere .= " AND deleted = '0' ";

                $sQuery = " SELECT "
                        . $aValidationDetails['table_field_name'] .
                        " FROM "
                        . $aValidationDetails['table_name'] .
                        " WHERE " . $sWhere
                        . " LIMIT 1";
                $mQueryHandler = $this->executeQuery($sQuery);
                $aInfo = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aInfo);
                if ($nCountRecord != '') {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "alphanumeric") {
                if (!preg_match('/^[\w_]+$/', $aValidationDetails['value'])) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "confirm") {
                if ($aValidationDetails['value'][0] != $aValidationDetails['value'][1]) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);

                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "currentPass") {

                $sSql = "SELECT
                                      password
                                FROM " . $aValidationDetails['tableName'] . "
                                WHERE " . $aValidationDetails['idField'] . "
                                = " . $aValidationDetails['idValue'];

                $mQueryHandler = $this->executeQuery($sSql);
                $aUserInfo = $this->getData($mQueryHandler, "ARRAY");

                $sPassword = $aUserInfo[0]['password'];
                $sCurrentPassword = md5($aValidationDetails['value']);

                if ($sPassword != $sCurrentPassword) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }

            if ($aValidationDetails['validation'] == "currentPassword") {
                 $sSql = "SELECT
                                      salt,password
                                FROM " . $aValidationDetails['tableName'] . "
                                WHERE " . $aValidationDetails['idField'] . "
                                = " . $aValidationDetails['idValue'];

                $mQueryHandler = $this->executeQuery($sSql);
                $aInfo = $this->getData($mQueryHandler, "ARRAY");

                $sPassword = $aInfo[0]['password'];
                $sCurrentPassword = sha1($aInfo[0]['salt'] . $aValidationDetails['value']);

                if ($sPassword != $sCurrentPassword) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                } else {

                    $bIsValid = $aInfo;
                }

            }
            if ($aValidationDetails['validation'] == "minimumlength") {

                if (strlen($aValidationDetails['value'][0]) < $aValidationDetails['value'][1]) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "maximumlength") {

                if (strlen($aValidationDetails['value'][0]) > $aValidationDetails['value'][1]) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "isValidUrl") {
                if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $aValidationDetails['value'])) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            if ($aValidationDetails['validation'] == "isSpecialCharacter") {
                if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $aValidationDetails['value'])) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
            //Captcha validation changes
            if ($aValidationDetails['validation'] == "isCaptcha") {
                $sCaptchaSession = $oSession->getSession('captcha');
                if (empty($sCaptchaSession) || trim(strtolower($aValidationDetails['value'])) != $sCaptchaSession) {
                    $oSession->setError('captchaError', $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }

            if ($aValidationDetails['validation'] == "isLoggedin") {
                $sAndWhere = '1 = 1';
                $sAndWhere .= ' AND ' . $aValidationDetails['aCredentials'][0] . '="' . $aValidationDetails['value'][0] . '"';
                $sAndWhere .= ' AND activated = 1 AND deleted = 0';

                $sSql = "SELECT
                                    salt,password," . implode(",", $aValidationDetails['aDataForSession']) .
                        " FROM "
                        . $aValidationDetails['tableName'] .
                        " WHERE " . $sAndWhere;
                $mQueryHandler = $this->executeQuery($sSql);
                $aUserInfo = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aUserInfo);
                if (!$nCountRecord || sha1($aUserInfo[0]['salt'] . $aValidationDetails['value'][1]) != $aUserInfo[0]['password']) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                } else {
                    unset($aUserInfo[0]['salt']);
                    unset($aUserInfo[0]['password']);
                    $bIsValid = $aUserInfo;
                }
            }
            if ($aValidationDetails['validation'] == "isClientLoggedin") {
                $sAndWhere = '1 = 1';

                $sAndWhere .= ' AND ' . $aValidationDetails['aCredentials'][0] . '="' . $aValidationDetails['value'][0] . '"';
                //$sAndWhere .= ' AND '.$aValidationDetails['aCredentials'][2].'="'.$aValidationDetails['value'][2].'"';
                $sAndWhere .= ' AND activated = 1 AND deleted = 0';
                $sSql = "SELECT
                                                salt,password," . implode(",", $aValidationDetails['aDataForSession']) .
                        " FROM "
                        . $aValidationDetails['tableName'] .
                        " WHERE " . $sAndWhere;
                $mQueryHandler = $this->executeQuery($sSql);

                $aUserInfo = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aUserInfo);
                if (!$nCountRecord || sha1($aUserInfo[0]['salt'] . $aValidationDetails['value'][1]) != $aUserInfo[0]['password']) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                } else {
                    unset($aUserInfo[0]['salt']);
                    unset($aUserInfo[0]['password']);
                    $bIsValid = $aUserInfo;
                }
            }
            if ($aValidationDetails['validation'] == "isVerified") {
                $sAndWhere = '1 = 1';

                $sAndWhere .= ' AND ' . $aValidationDetails['aCredentials'][0] . '="' . $aValidationDetails['value'][0] . '"';
                $sAndWhere .= ' AND ' . $aValidationDetails['aCredentials'][2] . '="' . $aValidationDetails['value'][2] . '"';
                $sAndWhere .= ' AND activated = 1 AND deleted = 0';

                $sSql = "SELECT
                                    salt,password," . implode(",", $aValidationDetails['aDataForSession']) .
                        " FROM "
                        . $aValidationDetails['tableName'] .
                        " WHERE " . $sAndWhere;

                $mQueryHandler = $this->executeQuery($sSql);

                $aUserInfo = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aUserInfo);

                if (!$nCountRecord || sha1($aUserInfo[0]['salt'] . $aValidationDetails['value'][1]) != $aUserInfo[0]['password']) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                } else {
                    unset($aUserInfo[0]['salt']);
                    unset($aUserInfo[0]['password']);
                    $bIsValid = $aUserInfo;
                }
            }
            if ($aValidationDetails['validation'] == "isLogged") {
                $sAndWhere = '1 = 1';

                $sAndWhere .= ' AND ' . $aValidationDetails['aCredentials'][0] . '="' . $aValidationDetails['value'][0] . '"';
                //$sAndWhere .= ' AND '.$aValidationDetails['aCredentials'][1].'="'.$aValidationDetails['value'][1].'"';
                //$sAndWhere .= ' AND activated = 1 AND deleted = 0';

                $sSql = "SELECT
                                    password," . implode(",", $aValidationDetails['aDataForSession']) .
                        " FROM "
                        . $aValidationDetails['tableName'] .
                        " WHERE " . $sAndWhere;

                $mQueryHandler = $this->executeQuery($sSql);

                $aUserInfo = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aUserInfo);

                if (!$nCountRecord || md5($aValidationDetails['value'][1]) != $aUserInfo[0]['password']) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                } else {
                    $bIsValid = $aUserInfo;
                }
            }
            if ($aValidationDetails['validation'] == "isUniqueSlug") {

                $sAndWhere = " 1 = 1";
                foreach ($aValidationDetails['table_fields_and_values'] as $sName => $sValue) {
                    !empty($sValue) ? $sAndWhere .= " AND " . $sName . "='" . $sValue . "'" : '';
                 }
                !empty($aValidationDetails['table_field_value']) ? $sAndWhere .= " AND ". $aValidationDetails['table_field_id']."!=".$aValidationDetails['table_field_value'] : '';
                $sAndWhere .= " LIMIT 1";
                $sQuery = " SELECT "
                        . $aValidationDetails['table_field_name'] .
                        " FROM "
                        . $aValidationDetails['table_name'] .
                        " WHERE ".$sAndWhere;
                $mQueryHandler = $this->executeQuery($sQuery);
                $aQueryResult = $this->getData($mQueryHandler, "ARRAY");
                $nCountRecord = count($aQueryResult);
                if ($nCountRecord) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
            }
             if ($aValidationDetails['validation'] == "checkMaxWords") {
                     $nCount =  str_word_count(strip_tags($aValidationDetails['value']));
                  if (!($aValidationDetails['min_length'] <= $nCount && $aValidationDetails['max_length'] >= $nCount)) {
                    $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                    $bIsValid = false;
                }
             }
             if ($aValidationDetails['validation'] == "fileSize") {
                    if (!empty($aValidationDetails['value'][0]) && ($aValidationDetails['value'][0] < $aValidationDetails['validSize']['width'] || $aValidationDetails['value'][1] < $aValidationDetails['validSize']['height'])) {
                        $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                        $bIsValid = false;
                    }
            }
            if ($aValidationDetails['validation'] == "fixedFileSize") {
                    if (!empty($aValidationDetails['value'][0]) && ($aValidationDetails['value'][0] != $aValidationDetails['validSize']['width'] || $aValidationDetails['value'][1] != $aValidationDetails['validSize']['height'])) {
                        $oSession->setError($aValidationDetails['field'], $aValidationDetails['message']);
                        $bIsValid = false;
                    }
            }
        }
        return $bIsValid;
    }
    /**
     * To insert/update records
     * @param type $sTableName
     * @param type $aFields
     * @param type $aData
     * @return type
     */
    public function saveRecords($sTableName, $aFields, $aData) {

        $sInsertQuery = "INSERT INTO " . $sTableName . "(" . implode(",", $aFields) . ") VALUES ";
        foreach ($aData as $aValues) {
            $sInsertQuery .= "('" . implode("','", $aValues) . "'),";
        }

        $sInsertQuery = trim($sInsertQuery, ",") . " ON DUPLICATE KEY UPDATE ";

        foreach ($aFields as $sField) {
            $sInsertQuery .= $sField . " = VALUES(" . $sField . "),";
        }
        $sInsertQuery = trim($sInsertQuery, ",");
        return $this->executeQuery($sInsertQuery);
    }
}


text:
package org.apache.pirk.querier.wideskies.encrypt;

import java.math.BigInteger;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.Callable;

import org.apache.pirk.encryption.Paillier;
import org.apache.pirk.utils.PIRException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Runnable class for multithreaded PIR encryption
 */
final class EncryptQueryTask implements Callable<SortedMap<Integer,BigInteger>>
{
  private static final Logger logger = LoggerFactory.getLogger(EncryptQueryTask.class);

  private final int dataPartitionBitSize;
  private final int start; // start of computing range for the runnable
  private final int stop; // stop, inclusive, of the computing range for the runnable

  private final Paillier paillier;
  private final Map<Integer,Integer> selectorQueryVecMapping;

  public EncryptQueryTask(int dataPartitionBitSizeInput, Paillier paillierInput, Map<Integer,Integer> selectorQueryVecMappingInput, int startInput,
      int stopInput)
  {
    dataPartitionBitSize = dataPartitionBitSizeInput;

    paillier = paillierInput;
    selectorQueryVecMapping = selectorQueryVecMappingInput;

    start = startInput;
    stop = stopInput;
  }

  @Override
  public SortedMap<Integer,BigInteger> call() throws PIRException
  {
    // holds the ordered encrypted values to pull after thread computation is complete
    SortedMap<Integer,BigInteger> encryptedValues = new TreeMap<>();
    for (int i = start; i <= stop; i++)
    {
      Integer selectorNum = selectorQueryVecMapping.get(i);
      BigInteger valToEnc = (selectorNum == null) ? BigInteger.ZERO : (BigInteger.valueOf(2)).pow(selectorNum * dataPartitionBitSize);
      BigInteger encVal = paillier.encrypt(valToEnc);
      encryptedValues.put(i, encVal);
      logger.debug("selectorNum = " + selectorNum + " valToEnc = " + valToEnc + " encVal = " + encVal);
    }

    return encryptedValues;
  }
}


text:
function ARIACheckBox(element) {
    element.aria = this;
    this.element = element;
    this.input = this.getInput();
    element.addEventListener('click', this.onClick.bind(this));
    element.addEventListener('keydown', this.onKeyDown.bind(this));
    element.addEventListener('keyup', this.onKeyUp.bind(this));
}

Object.defineProperty(ARIACheckBox.prototype, 'checked', {
    enumerable : true,
    get : function() {
        return this.element.getAttribute('aria-checked') || '';
    },
    set : function(value) {
        var element = this.element,
            checked = String(value);
        element.setAttribute('aria-checked', checked);
        checked === 'true'?
            element.appendChild(this.input) :
            element.removeChild(this.input);
    }
});

Object.defineProperty(ARIACheckBox.prototype, 'disabled', {
    enumerable : true,
    get : function() {
        return this.element.getAttribute('aria-disabled') || '';
    },
    set : function(value) {
        var element = this.element,
            disabled = String(value);
        element.setAttribute('aria-disabled', disabled);
        if(this.input.disabled = disabled === 'true') {
            element.removeAttribute('tabindex');
        }
        else element.tabIndex = 0;
    }
});

Object.defineProperty(ARIACheckBox.prototype, 'value', {
    enumerable : true,
    get : function() {
        return this.input.value;
    },
    set : function(value) {
        this.input.value = value;
    }
});

ARIACheckBox.prototype.getInput = function() {
    var element = this.element,
        input = element.querySelector('input');
    if(!input) {
        var dataset = element.dataset;
        input = document.createElement('input');
        input.type = 'hidden';
        input.name = dataset.name || '';
        input.value = dataset.value || '';
        if(this.checked) element.appendChild(input);
    }
    return input;
}

ARIACheckBox.prototype.onKeyDown = function(event) {
    if(event.keyCode === 32 && !event.repeat) {
        event.preventDefault(); // prevent page scrolling
        this.element.classList.add('active');
    }
}

ARIACheckBox.prototype.onKeyUp = function(event) {
    if(event.keyCode === 32) {
        var element = this.element;
        element.classList.remove('active');
        element.dispatchEvent(new Event('click'));
    }
}

ARIACheckBox.prototype.onClick = function(event) {
    if(this.disabled === 'true') {
        event.stopImmediatePropagation();
    } else {
        this.checked = this.checked === 'true'? 'false' : 'true';
        this.element.dispatchEvent(new Event('change'));
    }
}

ARIACheckBox.role = 'checkbox';

ARIACheckBox.getCheckBox = function(element) {
    return element && element.role === this.role?
        element.aria || new this(element) :
        null;
}

ARIACheckBox.attachToDocument = function() {
    document.addEventListener('focus', function(event) {
        this.getCheckBox(event.target);
    }.bind(this), true);
}


text:
@implementation SKMRAIDUtil

+ (NSString *)processRawHtml:(NSString *)rawHtml
{
    NSString *processedHtml = rawHtml;
    NSRange range;

    // Remove the mraid.js script tag.
    // We expect the tag to look like this:
    //
    // But we should also be to handle additional attributes and whitespace like this:
    //

    NSString *pattern = @"\\n*";
    NSError *error = NULL;

    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern
                                                                           options:NSRegularExpressionCaseInsensitive
                                                                             error:&error];
    processedHtml = [regex stringByReplacingMatchesInString:processedHtml
                                                    options:0
                                                      range:NSMakeRange(0, [processedHtml length])
                                               withTemplate:@""];

    // Add html, head, and/or body tags as needed.
    range = [rawHtml rangeOfString:@"<html"];
    BOOL hasHtmlTag = (range.location != NSNotFound);
    range = [rawHtml rangeOfString:@"<head"];
    BOOL hasHeadTag = (range.location != NSNotFound);
    range = [rawHtml rangeOfString:@"<body"];
    BOOL hasBodyTag = (range.location != NSNotFound);

    // basic sanity checks
    if ((!hasHtmlTag && (hasHeadTag || hasBodyTag)) ||
        (hasHtmlTag && !hasBodyTag)) {
        return nil;
    }

    if (!hasHtmlTag) {
        processedHtml = [NSString stringWithFormat:
                         @"\n"
                         "\n"
                         "\n"
                         "\n"
                         "
\n"
                         "%@"
                         "
\n"
                         "\n"
                         "",
                         processedHtml
                         ];
    } else if (!hasHeadTag) {
        // html tag exists, head tag doesn't, so add it
        pattern = @"]*>";
        error = NULL;
        regex = [NSRegularExpression regularExpressionWithPattern:pattern
                                                          options:NSRegularExpressionCaseInsensitive
                                                            error:&error];
        processedHtml = [regex stringByReplacingMatchesInString:processedHtml
                                                        options:0
                                                          range:NSMakeRange(0, [processedHtml length])
                                                   withTemplate:@"$0\n\n"];
    }

    // Add meta and style tags to head tag.
    NSString *metaTag =
    @"<meta name='viewport' content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no' />";

    NSString *styleTag =
    @"";

    pattern = @"]*>";
    error = NULL;
    regex = [NSRegularExpression regularExpressionWithPattern:pattern
                                                      options:NSRegularExpressionCaseInsensitive
                                                        error:&error];
    processedHtml = [regex stringByReplacingMatchesInString:processedHtml
                                                    options:0
                                                      range:NSMakeRange(0, [processedHtml length])
                                               withTemplate:[NSString stringWithFormat:@"$0\n%@\n%@", metaTag, styleTag]];

    return processedHtml;
}

@end


text:
define(["./ng-not-allowed"], function($__0) {
  "use strict";
  if (!$__0 || !$__0.__esModule)
    $__0 = {default: $__0};
  var NgNotAllowed = $__0.NgNotAllowed;
  var NgAfterError = (function($__super) {
    function NgAfterError(node, pattern) {
      var nodeLocal = node.toXML();
      $traceurRuntime.superConstructor(NgAfterError).call(this, ("Missing content at node: " + nodeLocal), node, pattern);
      this.instanceOf(NgAfterError);
      this.errorClassName = 'NgAfterError';
    }
    return ($traceurRuntime.createClass)(NgAfterError, {}, {}, $__super);
  }(NgNotAllowed));
  return {
    get NgAfterError() {
      return NgAfterError;
    },
    __esModule: true
  };
});


text:
#ifndef __COMPILER_H
#define __COMPILER_H

#ifndef __ASSEMBLY__

#if __GNUC__
#define likely(x)       __builtin_expect(!!(x), 1)
#define unlikely(x)     __builtin_expect(!!(x), 0)
#define __UNUSED __attribute__((__unused__))
#define __PACKED __attribute__((packed))
#define __ALIGNED(x) __attribute__((aligned(x)))
#define __PRINTFLIKE(__fmt,__varargs) __attribute__((__format__ (__printf__, __fmt, __varargs)))
#define __SCANFLIKE(__fmt,__varargs) __attribute__((__format__ (__scanf__, __fmt, __varargs)))
#define __SECTION(x) __attribute((section(x)))
#define __PURE __attribute((pure))
#define __CONST __attribute((const))
#define __NO_RETURN __attribute__((noreturn))
#define __MALLOC __attribute__((malloc))
#define __WEAK __attribute__((weak))
#define __GNU_INLINE __attribute__((gnu_inline))
#define __GET_CALLER(x) __builtin_return_address(0)
#define __GET_FRAME(x) __builtin_frame_address(0)
#define __NAKED __attribute__((naked))
#define __ISCONSTANT(x) __builtin_constant_p(x)
#define __NO_INLINE __attribute((noinline))
#define __SRAM __NO_INLINE __SECTION(".sram.text")
#define __CONSTRUCTOR __attribute__((constructor))
#define __DESTRUCTOR __attribute__((destructor))

#define INCBIN(symname, sizename, filename, section)                    \
    __asm__ (".section " section "; .align 4; .globl "#symname);        \
    __asm__ (""#symname ":\n.incbin \"" filename "\"");                 \
    __asm__ (".section " section "; .align 1;");                        \
    __asm__ (""#symname "_end:");                                       \
    __asm__ (".section " section "; .align 4; .globl "#sizename);       \
    __asm__ (""#sizename ": .long "#symname "_end - "#symname " - 1");  \
    extern unsigned char symname[];                                     \
    extern unsigned int sizename

#define INCFILE(symname, sizename, filename) INCBIN(symname, sizename, filename, ".rodata")

/* look for gcc 3.0 and above */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 0)
#define __ALWAYS_INLINE __attribute__((always_inline))
#else
#define __ALWAYS_INLINE
#endif

/* look for gcc 3.1 and above */
#if !defined(__DEPRECATED) // seems to be built in in some versions of the compiler
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define __DEPRECATED __attribute((deprecated))
#else
#define __DEPRECATED
#endif
#endif

/* look for gcc 3.3 and above */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
/* the may_alias attribute was introduced in gcc 3.3; before that, there
 * was no way to specify aliasiang rules on a type-by-type basis */
#define __MAY_ALIAS __attribute__((may_alias))

/* nonnull was added in gcc 3.3 as well */
#define __NONNULL(x) __attribute((nonnull x))
#else
#define __MAY_ALIAS
#define __NONNULL(x)
#endif

/* look for gcc 3.4 and above */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define __WARN_UNUSED_RESULT __attribute((warn_unused_result))
#else
#define __WARN_UNUSED_RESULT
#endif

#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#define __EXTERNALLY_VISIBLE __attribute__((externally_visible))
#else
#define __EXTERNALLY_VISIBLE
#endif

#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define __UNREACHABLE __builtin_unreachable()
#else
#define __UNREACHABLE
#endif

#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#define STATIC_ASSERT(e) _Static_assert(e, #e)
#else
#define STATIC_ASSERT(e) extern char (*ct_assert(void)) [sizeof(char[1 - 2*!(e)])]
#endif

/* compiler fence */
#define CF do { __asm__ volatile("" ::: "memory"); } while(0)

#define __WEAK_ALIAS(x) __attribute__((weak, alias(x)))
#define __ALIAS(x) __attribute__((alias(x)))

#undef __EXPORT
#define __EXPORT __attribute__ ((visibility("default")))
#define __LOCAL  __attribute__ ((visibility("hidden")))

#define __THREAD __thread

#define __offsetof(type, field) __builtin_offsetof(type, field)

#else

#define likely(x)       (x)
#define unlikely(x)     (x)
#define __UNUSED
#define __PACKED
#define __ALIGNED(x)
#define __PRINTFLIKE(__fmt,__varargs)
#define __SCANFLIKE(__fmt,__varargs)
#define __SECTION(x)
#define __PURE
#define __CONST
#define __NONNULL(x)
#define __DEPRECATED
#define __WARN_UNUSED_RESULT
#define __ALWAYS_INLINE
#define __MAY_ALIAS
#define __NO_RETURN
#endif

#endif

/* TODO: add type check */
#define countof(a) (sizeof(a) / sizeof((a)[0]))

/* macro-expanding concat */
#define concat(a, b) __ex_concat(a, b)
#define __ex_concat(a, b) a ## b

/* CPP header guards */
#ifdef __cplusplus
#define __BEGIN_CDECLS  extern "C" {
#define __END_CDECLS    }
#else
#define __BEGIN_CDECLS
#define __END_CDECLS
#endif

#endif