text:
@interface NSString (Email)

- (BOOL)isEmail;

@end

redpajama_set_name: RedPajamaGithub


text:
const evente = require('../src/Evente');

const html =
    '
Items count is {{items.length}}!
' +
    '<select id="for" e-for="item in items key id">' +
    '   <option value="{{item.id}}">' +
    '      {{item.id}}' +
    '   </option>' +
    '</select>' +
    '
' +
    '
item {{item.id}}
' +
    '
' +
    '<input id="model" e-model="form.text">';

describe('Model class', () => {

    test('Expressions in text nodes', () => {
        document.body.innerHTML = html;
        let app = evente('body', { items: { 1: { id: 1 }, 3: { id: 3 } } });
        expect(document.getElementById('text').textContent).toBe('Items count is 2!');
    });

    test('Model object creation', () => {
        document.body.innerHTML = html;
        let app = evente('body', { form: { text: 'text' } });
        expect(document.getElementById('model').value).toBe('text');
    });

    test('Model change via variables', () => {
        document.body.innerHTML = html;
        let app = evente('body', { form: {} });
        app.model.set('form.text', 'text');
        expect(document.getElementById('model').value).toBe('text');
    });

    test('Model change via DOM', () => {
        document.body.innerHTML = html;
        let app = evente('body', { form: {} });
        let element = document.getElementById('model');
        element.value = 'text';
        let event = new Event('input');
        element.dispatchEvent(event);
        expect(app.model.get('form.text')).toBe('text');
    });

    test('Children creation in e-for', () => {
        document.body.innerHTML = html;
        let app = evente('body', { items: { 1: { id: 1 }, 3: { id: 3 } } });
        expect(document.getElementById('for').children.length).toBe(2);
    });

    test('Children delete in e-for', () => {
        document.body.innerHTML = html;
        let app = evente('body', { items: { 1: { id: 1 }, 3: { id: 3 } } });
        expect(document.getElementById('for').children.length).toBe(2);
        delete app.data.items[3];
        expect(document.getElementById('for').children.length).toBe(1);
    });

    test('Data linking in e-base', () => {
        document.body.innerHTML = html;
        let app = evente('body', { items: { 1: { id: 1 }, 3: { id: 3 } }, item_id: 1 });
        expect(document.getElementById('base').textContent).toBe('item 1');
    });

    test('Linked data changing', () => {
        document.body.innerHTML = html;
        let app = evente('body', { items: { 1: { id: 1 }, 3: { id: 3 } }, item_id: 1 });
        app.data.item_id = 3;
        expect(document.getElementById('base').textContent).toBe('item 3');
    });

});


text:
package de.hub.specificmodels.metamodelgenerator;

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

import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

public class Namespace<T extends NamedElement> extends NamedElement {

	private Multimap<String, T> names = HashMultimap.create();
	private Collection<T> collisions = new ArrayList<T>();
	private Collection<T> elements = new HashSet<T>();

	public void inherit(Namespace<T> otherNameSpace) {
		for (String key: otherNameSpace.names.keySet()) {
			names.get(key).addAll(otherNameSpace.names.get(key));
		}
	}

	public void addName(T namedElement) {
		elements.add(namedElement);
		names.put(namedElement.getName(), namedElement);
	}

	public Collection<String> getNames() {
		return names.keySet();
	}

	public Collection<T> getNamedElements(String name) {
		return names.get(name);
	}

	public final void handleCollisions() {
		for(String name: getNames()) {
			Collection<T> namedElements = names.get(name);
			for(T element: namedElements) {
				if (elements.contains(element)) {
					boolean hasCollision = false;
					for(T collidingElement: namedElements) {
						if (element != collidingElement) {
							element.addCollision(collidingElement);
							hasCollision = true;
						}
					}
					if (hasCollision) {
						collisions.add(element);
					}
				}
			}
		}
		for (T collision: collisions) {
			collision.resolveCollisions();
		}
	}

	@Override
	public void resolveCollisions() {

	}

	@Override
	public String getName() {
		return null;
	}

}


text:
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package eu.fayder.restcountries.domain;

public interface ICountryRestSymbols {
    public static final String SEMICOLON = ";";
}


text:
package org.ovirt.engine.ui.uicommonweb.models.storage;

import org.ovirt.engine.core.common.businessentities.StorageType;

@SuppressWarnings("unused")
public class FcpStorageModel extends SanStorageModel
{
    @Override
    public StorageType getType()
    {
        return StorageType.FCP;
    }

    @Override
    protected String getListName() {
        return "FcpStorageModel"; //$NON-NLS-1$
    }
}


text:
package com.google.caliper.cloud.server;

import com.google.caliper.cloud.client.Benchmark;
import com.google.caliper.cloud.client.BenchmarkSnapshotMeta;

public class BenchmarkSnapshot {
  private final Benchmark benchmark;
  private final BenchmarkSnapshotMeta metadata;

  public BenchmarkSnapshot(Benchmark benchmark, long created, long id) {
    this(benchmark, new BenchmarkSnapshotMeta(
        benchmark.getOwner(), benchmark.getName(), created, id));
  }

  public BenchmarkSnapshot(Benchmark benchmark, BenchmarkSnapshotMeta metadata) {
    this.benchmark = benchmark;
    this.metadata = metadata;
  }

  public Benchmark getBenchmark() {
    return benchmark;
  }

  public BenchmarkSnapshotMeta getMetadata() {
    return metadata;
  }
}


text:
module API
  class Scope
    attr_reader :name, :if

    def initialize(name, options = {})
      @name = name.to_sym
      @if = options[:if]
    end

    # Are the `scopes` passed in sufficient to adequately authorize the passed
    # request for the scope represented by the current instance of this class?
    def sufficient?(scopes, request)
      scopes.include?(self.name) && verify_if_condition(request)
    end

    private

    def verify_if_condition(request)
      self.if.nil? || self.if.call(request)
    end
  end
end


text:
import { PLAYER_ACTIONS } from '../constants';
import initialState from './initialState';
import playerModel from '../store/playerModel';

export default function newPlayerReducer(state = initialState.newPlayer, action){
	switch (action.type){
		case PLAYER_ACTIONS.NEW_PLAYER_EDIT:
			return {...initialState.newPlayer, editing: true};
		case PLAYER_ACTIONS.NEW_PLAYER_CHANGE:
			return state.hasOwnProperty(action.field) ?
				{...state, [action.field]: action.value}
				: {...state, stats: { ...state.stats, [action.field]: action.value}};
		case PLAYER_ACTIONS.NEW_PLAYER_SAVE:
			return initialState.newPlayer;
		case PLAYER_ACTIONS.EDIT_EXISTING_PLAYER:
			return {...playerModel, ...action.value, editing: true};
		default:
			return state;
	}
}