text:
package one.util.streamex;

import java.text.BreakIterator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collectors;

import static one.util.streamex.StreamExInternals.*;

/**
 * An advanced implementation of joining {@link Collector}. This collector is
 * capable to join the input {@code CharSequence} elements with given delimiter
 * optionally wrapping into given prefix and suffix and optionally limiting the
 * length of the resulting string (in Unicode code units, code points or
 * grapheme clusters) adding the specified ellipsis sequence. This collector
 * supersedes the standard JDK
 * {@link Collectors#joining(CharSequence, CharSequence, CharSequence)}
 * collectors family.
 *
 *

 * This collector is short-circuiting when
 * the string length is limited in either of ways. Otherwise it's not
 * short-circuiting.
 *
 *

 * Every specific collector represented by this class is immutable, so you can
 * share it. A bunch of methods is provided to create a new collector based on
 * this one.
 *
 *

 * To create {@code Joining} collector use {@link #with(CharSequence)} static
 * method and specify the delimiter. For further setup use specific instance
 * methods which return new {@code Joining} objects like this:
 *
 *
{@code
 * StreamEx.of(source).collect(Joining.with(", ").wrap("[", "]")
 *         .maxCodePoints(100).cutAtWord());
 * }

 *
 *

 * The intermediate accumulation type of this collector is the implementation
 * detail and not exposed to the API. If you want to cast it to
 * {@code Collector} type, use ? as accumulator type variable:
 *
 *
{@code
 * Collector<CharSequence, ?, String> joining = Joining.with(", ");
 * }

 *
 * @author Tagir Valeev
 * @since 0.4.1
 */
public class Joining extends CancellableCollector<CharSequence, Joining.Accumulator, String> {
    static final class Accumulator {
        List<CharSequence> data = new ArrayList<>();
        int chars = 0, count = 0;
    }

    private static final int CUT_ANYWHERE = 0;
    private static final int CUT_CODEPOINT = 1;
    private static final int CUT_GRAPHEME = 2;
    private static final int CUT_WORD = 3;
    private static final int CUT_BEFORE_DELIMITER = 4;
    private static final int CUT_AFTER_DELIMITER = 5;

    private static final int LENGTH_CHARS = 0;
    private static final int LENGTH_CODEPOINTS = 1;
    private static final int LENGTH_GRAPHEMES = 2;

    private final String delimiter, ellipsis, prefix, suffix;
    private final int cutStrategy, lenStrategy, maxLength;
    private int limit, delimCount = -1;

    private Joining(String delimiter, String ellipsis, String prefix, String suffix, int cutStrategy, int lenStrategy,
            int maxLength) {
        this.delimiter = delimiter;
        this.ellipsis = ellipsis;
        this.prefix = prefix;
        this.suffix = suffix;
        this.cutStrategy = cutStrategy;
        this.lenStrategy = lenStrategy;
        this.maxLength = maxLength;
    }

    private void init() {
        if (delimCount == -1) {
            limit = maxLength - length(prefix) - length(suffix);
            delimCount = length(delimiter);
        }
    }

    private int length(CharSequence s) {
        switch (lenStrategy) {
        case LENGTH_CHARS:
            return s.length();
        case LENGTH_CODEPOINTS:
            if (s instanceof String)
                return ((String) s).codePointCount(0, s.length());
            return (int) s.codePoints().count();
        case LENGTH_GRAPHEMES:
            BreakIterator bi = BreakIterator.getCharacterInstance();
            bi.setText(s.toString());
            int count = 0;
            for (int end = bi.next(); end != BreakIterator.DONE; end = bi.next())
                count++;
            return count;
        default:
            throw new InternalError();
        }
    }

    private static int copy(char[] buf, int pos, String str) {
        str.getChars(0, str.length(), buf, pos);
        return pos + str.length();
    }

    private int copyCut(char[] buf, int pos, String str, int limit, int cutStrategy) {
        if (limit <= 0)
            return pos;
        int endPos = str.length();
        switch (lenStrategy) {
        case LENGTH_CHARS:
            if (limit < str.length())
                endPos = limit;
            break;
        case LENGTH_CODEPOINTS:
            if (limit < str.codePointCount(0, str.length()))
                endPos = str.offsetByCodePoints(0, limit);
            break;
        case LENGTH_GRAPHEMES:
            BreakIterator bi = BreakIterator.getCharacterInstance();
            bi.setText(str);
            int count = limit,
            end = 0;
            while (true) {
                end = bi.next();
                if (end == BreakIterator.DONE)
                    break;
                if (--count == 0) {
                    endPos = end;
                    break;
                }
            }
            break;
        default:
            throw new InternalError();
        }
        if (endPos < str.length()) {
            BreakIterator bi;
            switch (cutStrategy) {
            case CUT_BEFORE_DELIMITER:
            case CUT_AFTER_DELIMITER:
                endPos = 0;
                break;
            case CUT_WORD:
                bi = BreakIterator.getWordInstance();
                bi.setText(str);
                endPos = bi.preceding(endPos + 1);
                break;
            case CUT_GRAPHEME:
                bi = BreakIterator.getCharacterInstance();
                bi.setText(str);
                endPos = bi.preceding(endPos + 1);
                break;
            case CUT_ANYWHERE:
                break;
            case CUT_CODEPOINT:
                if (Character.isHighSurrogate(str.charAt(endPos - 1)) && Character.isLowSurrogate(str.charAt(endPos)))
                    endPos--;
                break;
            default:
                throw new InternalError();
            }
        }
        str.getChars(0, endPos, buf, pos);
        return pos + endPos;
    }

    private String finisherNoOverflow(Accumulator acc) {
        char[] buf = new char[acc.chars + prefix.length() + suffix.length()];
        int size = acc.data.size();
        int pos = copy(buf, 0, prefix);
        for (int i = 0; i < size; i++) {
            if (i > 0) {
                pos = copy(buf, pos, delimiter);
            }
            pos = copy(buf, pos, acc.data.get(i).toString());
        }
        copy(buf, pos, suffix);
        return new String(buf);
    }

    private Joining withLimit(int lenStrategy, int maxLength) {
        if (maxLength < 0)
            throw new IllegalArgumentException(maxLength + ": must be positive");
        return new Joining(delimiter, ellipsis, prefix, suffix, cutStrategy, lenStrategy, maxLength);
    }

    private Joining withCut(int cutStrategy) {
        return new Joining(delimiter, ellipsis, prefix, suffix, cutStrategy, lenStrategy, maxLength);
    }

    /**
     * Returns a {@code Collector} that concatenates the input elements,
     * separated by the specified delimiter, in encounter order.
     *
     *

     * This collector is similar to {@link Collectors#joining(CharSequence)},
     * but can be further set up in a flexible way, for example, specifying the
     * maximal allowed length of the resulting {@code String}.
     *
     * @param delimiter the delimiter to be used between each element
     * @return A {@code Collector} which concatenates CharSequence elements,
     *         separated by the specified delimiter, in encounter order
     * @see Collectors#joining(CharSequence)
     */
    public static Joining with(CharSequence delimiter) {
        return new Joining(delimiter.toString(), "...", "", "", CUT_GRAPHEME, LENGTH_CHARS, -1);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but
     * additionally wraps the result with the specified prefix and suffix.
     *
     *

     * The collector returned by
     * {@code Joining.with(delimiter).wrap(prefix, suffix)} is equivalent to
     * {@link Collectors#joining(CharSequence, CharSequence, CharSequence)}, but
     * can be further set up in a flexible way, for example, specifying the
     * maximal allowed length of the resulting {@code String}.
     *
     *

     * If length limit is specified for the collector, the prefix length and the
     * suffix length are also counted towards this limit. If the length of the
     * prefix and the suffix exceed the limit, the resulting collector will not
     * accumulate any elements and produce the same output. For example,
     * {@code stream.collect(Joining.with(",").wrap("prefix", "suffix").maxChars(9))}
     * will produce {@code "prefixsuf"} string regardless of the input stream
     * content.
     *
     *

     * You may wrap several times:
     * {@code Joining.with(",").wrap("[", "]").wrap("(", ")")} is equivalent to
     * {@code Joining.with(",").wrap("([", "])")}.
     *
     * @param prefix the sequence of characters to be used at the beginning of
     *        the joined result
     * @param suffix the sequence of characters to be used at the end of the
     *        joined result
     * @return a new {@code Collector} which wraps the result with the specified
     *         prefix and suffix.
     */
    public Joining wrap(CharSequence prefix, CharSequence suffix) {
        return new Joining(delimiter, ellipsis, prefix.toString().concat(this.prefix), this.suffix.concat(suffix
                .toString()), cutStrategy, lenStrategy, maxLength);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but uses
     * the specified ellipsis {@code CharSequence} instead of default
     * {@code "..."} when the string limit (if specified) is reached.
     *
     * @param ellipsis the sequence of characters to be used at the end of the
     *        joined result to designate that not all of the input elements are
     *        joined due to the specified string length restriction.
     * @return a new {@code Collector} which will use the specified ellipsis
     *         instead of current setting.
     */
    public Joining ellipsis(CharSequence ellipsis) {
        return new Joining(delimiter, ellipsis.toString(), prefix, suffix, cutStrategy, lenStrategy, maxLength);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but sets
     * the maximal length of the resulting string to the specified number of
     * UTF-16 characters (or Unicode code units). This setting overwrites any
     * limit previously set by {@link #maxChars(int)},
     * {@link #maxCodePoints(int)} or {@link #maxGraphemes(int)} call.
     *
     *

     * The {@code String} produced by the resulting collector is guaranteed to
     * have {@link String#length() length} which does not exceed the specified
     * limit. An ellipsis sequence (by default {@code "..."}) is used to
     * designate whether the limit was reached. Use
     * {@link #ellipsis(CharSequence)} to set custom ellipsis sequence.
     *
     *

     * The collector returned by this method is short-circuiting:
     * it may not process all the input elements if the limit is reached.
     *
     * @param limit the maximal number of UTF-16 characters in the resulting
     *        String.
     * @return a new {@code Collector} which will produce String no longer than
     *         given limit.
     */
    public Joining maxChars(int limit) {
        return withLimit(LENGTH_CHARS, limit);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but sets
     * the maximal number of Unicode code points of the resulting string. This
     * setting overwrites any limit previously set by {@link #maxChars(int)},
     * {@link #maxCodePoints(int)} or {@link #maxGraphemes(int)} call.
     *
     *

     * The {@code String} produced by the resulting collector is guaranteed to
     * have no more code points than the specified limit. An ellipsis sequence
     * (by default {@code "..."}) is used to designate whether the limit was
     * reached. Use {@link #ellipsis(CharSequence)} to set custom ellipsis
     * sequence.
     *
     *

     * The collector returned by this method is short-circuiting:
     * it may not process all the input elements if the limit is reached.
     *
     * @param limit the maximal number of code points in the resulting String.
     * @return a new {@code Collector} which will produce String no longer than
     *         given limit.
     */
    public Joining maxCodePoints(int limit) {
        return withLimit(LENGTH_CODEPOINTS, limit);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but sets
     * the maximal number of grapheme clusters. This setting overwrites any
     * limit previously set by {@link #maxChars(int)},
     * {@link #maxCodePoints(int)} or {@link #maxGraphemes(int)} call.
     *
     *

     * The grapheme cluster is defined in Unicode Text Segmentation technical report. Basically, it counts
     * base character and the following combining characters as single object.
     * The {@code String} produced by the resulting collector is guaranteed to
     * have no more grapheme clusters than the specified limit. An ellipsis
     * sequence (by default {@code "..."}) is used to designate whether the
     * limit was reached. Use {@link #ellipsis(CharSequence)} to set custom
     * ellipsis sequence.
     *
     *

     * The collector returned by this method is short-circuiting:
     * it may not process all the input elements if the limit is reached.
     *
     * @param limit the maximal number of grapheme clusters in the resulting
     *        String.
     * @return a new {@code Collector} which will produce String no longer than
     *         given limit.
     */
    public Joining maxGraphemes(int limit) {
        return withLimit(LENGTH_GRAPHEMES, limit);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but cuts
     * the resulting string at any point when limit is reached.
     *
     *

     * The resulting collector will produce {@code String} which length is
     * exactly equal to the specified limit if the limit is reached. If used
     * with {@link #maxChars(int)}, the resulting string may be cut in the
     * middle of surrogate pair.
     *
     * @return a new {@code Collector} which cuts the resulting string at any
     *         point when limit is reached.
     */
    public Joining cutAnywhere() {
        return withCut(CUT_ANYWHERE);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but cuts
     * the resulting string between any code points when limit is reached.
     *
     *

     * The resulting collector will not split the surrogate pair when used with
     * {@link #maxChars(int)} or {@link #maxCodePoints(int)}. However it may
     * remove the combining character which may result in incorrect rendering of
     * the last displayed grapheme.
     *
     * @return a new {@code Collector} which cuts the resulting string between
     *         code points.
     */
    public Joining cutAtCodePoint() {
        return withCut(CUT_CODEPOINT);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but cuts
     * the resulting string at grapheme cluster boundary when limit is reached.
     * This is the default behavior.
     *
     *

     * The grapheme cluster is defined in Unicode Text Segmentation technical report. Thus the resulting
     * collector will not split the surrogate pair and will preserve any
     * combining characters or remove them with the base character.
     *
     * @return a new {@code Collector} which cuts the resulting string at
     *         grapheme cluster boundary.
     */
    public Joining cutAtGrapheme() {
        return withCut(CUT_GRAPHEME);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but cuts
     * the resulting string at word boundary when limit is reached.
     *
     *

     * The beginning and end of every input stream element or delimiter is
     * always considered as word boundary, so the stream of
     * {@code "one", "two three"} collected with
     * {@code Joining.with("").maxChars(n).ellipsis("").cutAtWord()} may produce
     * the following strings depending on {@code n}:
     *
     *
{@code
     * ""
     * "one"
     * "onetwo"
     * "onetwo "
     * "onetwo three"
     * }

     *
     * @return a new {@code Collector} which cuts the resulting string at word
     *         boundary.
     */
    public Joining cutAtWord() {
        return withCut(CUT_WORD);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but cuts
     * the resulting string before the delimiter when limit is reached.
     *
     * @return a new {@code Collector} which cuts the resulting string at before
     *         the delimiter.
     */
    public Joining cutBeforeDelimiter() {
        return withCut(CUT_BEFORE_DELIMITER);
    }

    /**
     * Returns a {@code Collector} which behaves like this collector, but cuts
     * the resulting string after the delimiter when limit is reached.
     *
     * @return a new {@code Collector} which cuts the resulting string at after
     *         the delimiter.
     */
    public Joining cutAfterDelimiter() {
        return withCut(CUT_AFTER_DELIMITER);
    }

    @Override
    public Supplier<Accumulator> supplier() {
        return Accumulator::new;
    }

    @Override
    public BiConsumer<Accumulator, CharSequence> accumulator() {
        if (maxLength == -1)
            return (acc, str) -> {
                if (!acc.data.isEmpty())
                    acc.chars += delimiter.length();
                acc.chars += str.length();
                acc.data.add(str);
            };
        init();
        return (acc, str) -> {
            if (acc.count <= limit) {
                if (!acc.data.isEmpty()) {
                    acc.chars += delimiter.length();
                    acc.count += delimCount;
                }
                acc.chars += str.length();
                acc.count += length(str);
                acc.data.add(str);
            }
        };
    }

    @Override
    public BinaryOperator<Accumulator> combiner() {
        if (maxLength == -1)
            return (acc1, acc2) -> {
                if (acc1.data.isEmpty())
                    return acc2;
                if (acc2.data.isEmpty())
                    return acc1;
                acc1.chars += delimiter.length() + acc2.chars;
                acc1.data.addAll(acc2.data);
                return acc1;
            };
        init();
        BiConsumer<Accumulator, CharSequence> accumulator = accumulator();
        return (acc1, acc2) -> {
            if (acc1.data.isEmpty())
                return acc2;
            if (acc2.data.isEmpty())
                return acc1;
            int len = acc1.count + acc2.count + delimCount;
            if (len <= limit) {
                acc1.count = len;
                acc1.chars += delimiter.length() + acc2.chars;
                acc1.data.addAll(acc2.data);
            } else {
                for (CharSequence s : acc2.data) {
                    if (acc1.count > limit)
                        break;
                    accumulator.accept(acc1, s);
                }
            }
            return acc1;
        };
    }

    @Override
    public Function<Accumulator, String> finisher() {
        if (maxLength == -1) {
            return this::finisherNoOverflow;
        }
        init();
        if (limit <= 0) {
            char[] buf = new char[prefix.length() + suffix.length()];
            int pos = copyCut(buf, 0, prefix, maxLength, cutStrategy);
            pos = copyCut(buf, pos, suffix, maxLength - length(prefix), cutStrategy);
            String result = new String(buf, 0, pos);
            return acc -> result;
        }
        return acc -> {
            if (acc.count <= limit)
                return finisherNoOverflow(acc);
            char[] buf = new char[acc.chars + prefix.length() + suffix.length()];
            int size = acc.data.size();
            int pos = copy(buf, 0, prefix);
            int ellipsisCount = length(ellipsis);
            int rest = limit - ellipsisCount;
            if (rest < 0) {
                pos = copyCut(buf, pos, ellipsis, limit, CUT_ANYWHERE);
            } else {
                for (int i = 0; i < size; i++) {
                    String s = acc.data.get(i).toString();
                    int count = length(s);
                    if (i > 0) {
                        if (cutStrategy == CUT_BEFORE_DELIMITER && delimCount + count > rest) {
                            break;
                        }
                        if (delimCount > rest) {
                            pos = copyCut(buf, pos, delimiter, rest, cutStrategy);
                            break;
                        }
                        rest -= delimCount;
                        pos = copy(buf, pos, delimiter);
                    }
                    if (cutStrategy == CUT_AFTER_DELIMITER && delimCount + count > rest) {
                        break;
                    }
                    if (count > rest) {
                        pos = copyCut(buf, pos, s, rest, cutStrategy);
                        break;
                    }
                    pos = copy(buf, pos, s);
                    rest -= count;
                }
                pos = copy(buf, pos, ellipsis);
            }
            pos = copy(buf, pos, suffix);
            return new String(buf, 0, pos);
        };
    }

    @Override
    public Set<Characteristics> characteristics() {
        init();
        if (limit <= 0)
            return Collections.singleton(Characteristics.UNORDERED);
        return Collections.emptySet();
    }

    @Override
    Predicate<Accumulator> finished() {
        if (maxLength == -1)
            return null;
        init();
        if (limit <= 0)
            return acc -> true;
        return acc -> acc.count > limit;
    }
}


text:
define(['Format'], function(Format) {

  'use strict';

  var headerFormat = Format('chunk/winhelp', {which:'header'});
  var directoryHeaderFormat = Format('chunk/winhelp', {which:'directory-header'});

  function split(segment, entries) {
    var context = this;
    return segment.getStruct(headerFormat).then(function(header) {
      if (!header.hasValidSignature) {
        return Promise.reject('winhelp file signature not found');
      }
      return segment.getStruct(directoryHeaderFormat, header.internalDirectoryOffset)
      .then(function(internalDirectoryHeader) {

      });
    });
  }

  return {
    splitTo: Format('chunk/winhelp'),
    split: split,
  };

});

redpajama_set_name: RedPajamaGithub


text:
package org.terasology.world.chunks.event;

import org.terasology.entitySystem.event.Event;

/**
 * This {@link Event} is fired when the chunk provider purges
 * all chunks. This can be triggered using the "purgeWorld" world command.
 */
public class PurgeWorldEvent implements Event {
    // empty
}


text:
import { name as RatingAdd } from '../ratingAdd';
import { Ratings } from '../../../../api/ratings';
import 'angular-mocks';

describe('RatingAdd', () => {
	beforeEach(() => {
		window.module(RatingAdd);
	});

	describe('controller', () => {
		let controller;
		const rating = {
			UserID: 6,
			MovieID: 1,
			Rating: 4,
			Timestamp: 978300760
		};

		beforeEach(() => {
			inject(($rootScope, $componentController) => {
				controller = $componentController(RatingAdd, {
					$scope: $rootScope.$new(true)
				});
			});
		});

		describe('reset()', () => {
			it('should clean up rating object', () => {
				controller.rating = rating;
				controller.reset();

				expect(controller.rating).toEqual({});
			});
		});

		describe('submit()', () => {
			beforeEach(() => {
				spyOn(Ratings, 'insert');
				spyOn(controller, 'reset').and.callThrough();

				controller.rating = rating;

				controller.submit();
			});

			it('should insert a new rating', () => {
				expect(Ratings.insert).toHaveBeenCalledWith(rating);
			});

			it('should call reset()', () => {
				expect(controller.reset).toHaveBeenCalled();
			});
		});
	});
});


text:
package com.example;

import jakarta.inject.Inject;
import jakarta.ws.rs.DefaultValue;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.ext.Provider;

import org.minijax.Minijax;

public class HelloInjection {

    public interface MyService {

        String shout(String str);
    }

    @Provider
    public class MyServiceImpl implements MyService {

        @Override
        public String shout(final String str) {
            return str.toUpperCase();
        }
    }

    @Path("/")
    public class MyResource {

        @Inject
        private MyService service;

        @GET
        public String get(@QueryParam("name") @DefaultValue("friend") final String name) {
            return "Hello " + service.shout(name);
        }
    }

    public static void main(final String[] args) {
        new Minijax()
                .bind(MyServiceImpl.class, MyService.class)
                .register(MyResource.class)
                .start();
    }
}


text:
// Copyright 2020 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Unit tests for SuggestionsService.
 */

import { TestBed } from '@angular/core/testing';

import { SuggestionsService } from 'services/suggestions.service';

describe('SuggestionsService', () => {
  let suggestionService: SuggestionsService;

  beforeEach(() => {
    suggestionService = TestBed.get(SuggestionsService);
  });

  describe('getThreadIdFromSuggestionBackendDict', () => {
    it('should return the suggestion id of the backend dict', () => {
      expect(suggestionService.getThreadIdFromSuggestionBackendDict({
        suggestion_id: 'exploration.exp1.abc1',
        suggestion_type: 'exploration',
        target_type: 'state',
        target_id: '1',
        status: 'pending',
        author_name: 'someone',
        change: {
          state_name: 'State 1',
          new_value: {
            html: 'new value'
          },
          old_value: {
            html: 'old value'
          }
        },
        last_updated_msecs: 10000000
      })).toEqual('exploration.exp1.abc1');
    });
  });
});


text:
package edu.emory.bmi.datacafe.core.conf;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Core Configuration Reader
 */
public class CoreConfigReader {
    protected static Properties prop;
    private static Logger logger = LogManager.getLogger(CoreConfigReader.class.getName());
    private static String fileExtension;
    private static String delimiter;

    private static boolean loadProperties() {
        prop = new Properties();
        InputStream input;
        try {
            input = new FileInputStream(DatacafeConstants.DATACAFE_PROPERTIES_FILE);
        } catch (FileNotFoundException ex) {
            try {
                input = new FileInputStream(DatacafeConstants.DATACAFE_PROPERTIES_FILE_ALT);
            } catch (Exception e) {
                logger.error("Error in loading the properties file.. ", ex);
                return false;
            }
        }
        try {
            prop.load(input);
            return true;
        } catch (IOException e) {
            logger.error("IOException in opening the file", e);
            return false;
        } finally {
            try {
                input.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * Initiating Data Cafe from the configuration file.
     */
    protected static void readConfig() {
        boolean loaded = loadProperties();
        if (loaded) {
            logger.info("Initiating Data Cafe Core from the configurations file..");
            fileExtension = prop.getProperty("fileExtension");
            delimiter = prop.getProperty("delimiter");
        }
    }

    public static String getFileExtension() {
        return fileExtension;
    }

    public static String getDelimiter() {
        return delimiter;
    }
}


text:
<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

abstract class WC_Gateway_Komoju_Response {

	/**
	 * Get the order from the Komoju 'transaction' variable
	 *
	 * @param  WC_Gateway_Komoju_Webhook_Event $webhookEvent Webhook event data
	 * @param  string $invoice_prefix set as an option in Komoju plugin dashboard
	 * @return bool|WC_Order object
	 */
	protected function get_komoju_order( $webhookEvent, $invoice_prefix ) {
		// We have the data in the correct format, so get the order
		if ( is_string( $webhookEvent->external_order_num() ) ){
			$order_id = $webhookEvent->external_order_num();

			// Nothing was found
		} else {
			WC_Gateway_Komoju::log( 'Error: Order ID (external_order_num) was not found in "webhookEvent".' );
			return false;
		}

		if ( ! $order = wc_get_order( substr( $order_id, strlen( $invoice_prefix ), -7) ) ) {
			WC_Gateway_Komoju::log( 'Error: Cannot locate order in WC with order_id: .'.$order_id.' minus prefix: '.$invoice_prefix );
			return false;
		}

		return $order;
	}

	/**
	 * Complete order, add transaction ID and note
	 * @param  WC_Order $order
	 * @param  string $txn_id
	 * @param  string $note
	 */
	protected function payment_complete( $order, $txn_id = '', $note = '' ) {
		$order->add_order_note( $note );
		$order->payment_complete( $txn_id );
	}

	/**
	 * Hold order and add note
	 * @param  WC_Order $order
	 * @param  string $reason
	 */
	protected function payment_on_hold( $order, $reason = '' ) {
		$order->update_status( 'on-hold', $reason );
		$order->reduce_order_stock();
		WC()->cart->empty_cart();
	}
}


text:
var path = require('path'),
	fs = require('fs'),
	_ = require('../../../lib/alloy/underscore')._,
	uglifyjs = require('uglify-js'),
	logger = require('../../../logger'),
	U = require('../../../utils');

var EXCLUDE = ['backbone','CFG','underscore'];
var BUILTINS_PATH = path.join(__dirname,'..','..','..','builtins');
var loaded = [];

function appendExtension(file, extension) {
	extension = '.' + extension;
	file = U.trim(file);

	var len = extension.length;
	if (file.substring(file.length - extension.length) !== extension) {
		return file + extension;
	} else {
		return file;
	}
}

function loadBuiltin(source, name, dest) {
	if (!path.existsSync(source)) {
		return;
	}

	logger.debug('  - [' + name + '] --> "' + dest + '"');
	U.copyFileSync(source, dest);
	loaded = _.union(loaded, [name]);
}

function loadMomentLanguages(config) {
	// retrieve the languages of the project
	var i18nPath = path.join(config.dir.project, 'i18n');
	if (fs.existsSync(i18nPath)) {
		var languages = _.filter(fs.readdirSync(i18nPath), function(file) {
			return fs.statSync(path.join(i18nPath,file)).isDirectory();
		});

		// filter the momentjs translation files that match one of these languages
		var availableI18nPath = path.join(BUILTINS_PATH,'moment','lang');
		var fileNames = _.filter(fs.readdirSync(availableI18nPath), function(file) {
			return _.indexOf(languages, file.substr(0, 2)) !== -1;
		});

		// import these files
		_.each(fileNames, function(file) {
			var source = path.join(BUILTINS_PATH,'moment','lang',file);
			var dest = path.join(config.dir.resources,'alloy','moment','lang',file);
			loadBuiltin(source, file, dest);
		});
	}
}

exports.process = function(ast, config) {
	var rx = /^(alloy)\/(.+)$/;
	var match;

	ast.walk(new uglifyjs.TreeWalker(function(node) {
		if (node instanceof uglifyjs.AST_Call) {
			var theString = node.args[0];
			if (node.expression.name === 'require' &&            // Is this a require call?
				theString && _.isString(theString.value) &&      // Is the 1st param a literal string?
				(match = theString.value.match(rx)) !== null &&  // Is it an alloy module?
				!_.contains(EXCLUDE, match[2]) &&                // Make sure it's not excluded.
				!_.contains(loaded, match[2])                    // Make sure we didn't find it already
			) {
				// Make sure it hasn't already been copied to Resources
				var name = appendExtension(match[2], 'js');
				if (fs.existsSync(path.join(config.dir.resources,match[1],name))) {
					return;
				}

				// make sure the builtin exists
				var source = path.join(BUILTINS_PATH,name);
				var dest = path.join(config.dir.resources,'alloy',name);
				loadBuiltin(source, name, dest);

				if ('moment.js' === name) {
					// if momentjs is required in the project, also load the
					// localizations which may be used
					loadMomentLanguages(config);
				}
			}
		}
	}));
	return ast;
};


text:
var bookStoreDirectives= angular.module('bookStoreDirectives', []);

bookStoreDirectives.directive('bookStoreDirective_1', ['$scope', function($scope){

}]);


text:
@interface ZM_ProgressiveRingView : UIView

-(void)setPercent:(NSInteger)percent animated:(BOOL)animated;

@end


text:
<?php

namespace DvsaMotApi\Controller;

use DvsaCommonApi\Controller\AbstractDvsaRestfulController;
use DvsaCommonApi\Model\ApiResponse;
use DvsaMotApi\Service\MotTestOptionsService;

class MotTestOptionsController extends AbstractDvsaRestfulController
{
    public function __construct()
    {
        $this->setIdentifierName('motTestNumber');
    }

    public function get($motTestNumber)
    {
        $motTestOptionsDto = $this->getMotTestOptionsService()->getOptions($motTestNumber);

        return ApiResponse::jsonOk($motTestOptionsDto->toArray());
    }

    /** @return MotTestOptionsService */
    private function getMotTestOptionsService()
    {
        return $this->getServiceLocator()->get(MotTestOptionsService::class);
    }
}


text:
// Code generated by main. DO NOT EDIT.

package v3

import (
	"context"
	"time"

	"github.com/rancher/lasso/pkg/client"
	"github.com/rancher/lasso/pkg/controller"
	v3 "github.com/rancher/rancher/pkg/apis/project.cattle.io/v3"
	"github.com/rancher/wrangler/pkg/generic"
	"k8s.io/apimachinery/pkg/api/equality"
	"k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/types"
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
	"k8s.io/apimachinery/pkg/watch"
	"k8s.io/client-go/tools/cache"
)

type WorkloadHandler func(string, *v3.Workload) (*v3.Workload, error)

type WorkloadController interface {
	generic.ControllerMeta
	WorkloadClient

	OnChange(ctx context.Context, name string, sync WorkloadHandler)
	OnRemove(ctx context.Context, name string, sync WorkloadHandler)
	Enqueue(namespace, name string)
	EnqueueAfter(namespace, name string, duration time.Duration)

	Cache() WorkloadCache
}

type WorkloadClient interface {
	Create(*v3.Workload) (*v3.Workload, error)
	Update(*v3.Workload) (*v3.Workload, error)

	Delete(namespace, name string, options *metav1.DeleteOptions) error
	Get(namespace, name string, options metav1.GetOptions) (*v3.Workload, error)
	List(namespace string, opts metav1.ListOptions) (*v3.WorkloadList, error)
	Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error)
	Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (result *v3.Workload, err error)
}

type WorkloadCache interface {
	Get(namespace, name string) (*v3.Workload, error)
	List(namespace string, selector labels.Selector) ([]*v3.Workload, error)

	AddIndexer(indexName string, indexer WorkloadIndexer)
	GetByIndex(indexName, key string) ([]*v3.Workload, error)
}

type WorkloadIndexer func(obj *v3.Workload) ([]string, error)

type workloadController struct {
	controller    controller.SharedController
	client        *client.Client
	gvk           schema.GroupVersionKind
	groupResource schema.GroupResource
}

func NewWorkloadController(gvk schema.GroupVersionKind, resource string, namespaced bool, controller controller.SharedControllerFactory) WorkloadController {
	c := controller.ForResourceKind(gvk.GroupVersion().WithResource(resource), gvk.Kind, namespaced)
	return &workloadController{
		controller: c,
		client:     c.Client(),
		gvk:        gvk,
		groupResource: schema.GroupResource{
			Group:    gvk.Group,
			Resource: resource,
		},
	}
}

func FromWorkloadHandlerToHandler(sync WorkloadHandler) generic.Handler {
	return func(key string, obj runtime.Object) (ret runtime.Object, err error) {
		var v *v3.Workload
		if obj == nil {
			v, err = sync(key, nil)
		} else {
			v, err = sync(key, obj.(*v3.Workload))
		}
		if v == nil {
			return nil, err
		}
		return v, err
	}
}

func (c *workloadController) Updater() generic.Updater {
	return func(obj runtime.Object) (runtime.Object, error) {
		newObj, err := c.Update(obj.(*v3.Workload))
		if newObj == nil {
			return nil, err
		}
		return newObj, err
	}
}

func UpdateWorkloadDeepCopyOnChange(client WorkloadClient, obj *v3.Workload, handler func(obj *v3.Workload) (*v3.Workload, error)) (*v3.Workload, error) {
	if obj == nil {
		return obj, nil
	}

	copyObj := obj.DeepCopy()
	newObj, err := handler(copyObj)
	if newObj != nil {
		copyObj = newObj
	}
	if obj.ResourceVersion == copyObj.ResourceVersion && !equality.Semantic.DeepEqual(obj, copyObj) {
		return client.Update(copyObj)
	}

	return copyObj, err
}

func (c *workloadController) AddGenericHandler(ctx context.Context, name string, handler generic.Handler) {
	c.controller.RegisterHandler(ctx, name, controller.SharedControllerHandlerFunc(handler))
}

func (c *workloadController) AddGenericRemoveHandler(ctx context.Context, name string, handler generic.Handler) {
	c.AddGenericHandler(ctx, name, generic.NewRemoveHandler(name, c.Updater(), handler))
}

func (c *workloadController) OnChange(ctx context.Context, name string, sync WorkloadHandler) {
	c.AddGenericHandler(ctx, name, FromWorkloadHandlerToHandler(sync))
}

func (c *workloadController) OnRemove(ctx context.Context, name string, sync WorkloadHandler) {
	c.AddGenericHandler(ctx, name, generic.NewRemoveHandler(name, c.Updater(), FromWorkloadHandlerToHandler(sync)))
}

func (c *workloadController) Enqueue(namespace, name string) {
	c.controller.Enqueue(namespace, name)
}

func (c *workloadController) EnqueueAfter(namespace, name string, duration time.Duration) {
	c.controller.EnqueueAfter(namespace, name, duration)
}

func (c *workloadController) Informer() cache.SharedIndexInformer {
	return c.controller.Informer()
}

func (c *workloadController) GroupVersionKind() schema.GroupVersionKind {
	return c.gvk
}

func (c *workloadController) Cache() WorkloadCache {
	return &workloadCache{
		indexer:  c.Informer().GetIndexer(),
		resource: c.groupResource,
	}
}

func (c *workloadController) Create(obj *v3.Workload) (*v3.Workload, error) {
	result := &v3.Workload{}
	return result, c.client.Create(context.TODO(), obj.Namespace, obj, result, metav1.CreateOptions{})
}

func (c *workloadController) Update(obj *v3.Workload) (*v3.Workload, error) {
	result := &v3.Workload{}
	return result, c.client.Update(context.TODO(), obj.Namespace, obj, result, metav1.UpdateOptions{})
}

func (c *workloadController) Delete(namespace, name string, options *metav1.DeleteOptions) error {
	if options == nil {
		options = &metav1.DeleteOptions{}
	}
	return c.client.Delete(context.TODO(), namespace, name, *options)
}

func (c *workloadController) Get(namespace, name string, options metav1.GetOptions) (*v3.Workload, error) {
	result := &v3.Workload{}
	return result, c.client.Get(context.TODO(), namespace, name, result, options)
}

func (c *workloadController) List(namespace string, opts metav1.ListOptions) (*v3.WorkloadList, error) {
	result := &v3.WorkloadList{}
	return result, c.client.List(context.TODO(), namespace, result, opts)
}

func (c *workloadController) Watch(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
	return c.client.Watch(context.TODO(), namespace, opts)
}

func (c *workloadController) Patch(namespace, name string, pt types.PatchType, data []byte, subresources ...string) (*v3.Workload, error) {
	result := &v3.Workload{}
	return result, c.client.Patch(context.TODO(), namespace, name, pt, data, result, metav1.PatchOptions{}, subresources...)
}

type workloadCache struct {
	indexer  cache.Indexer
	resource schema.GroupResource
}

func (c *workloadCache) Get(namespace, name string) (*v3.Workload, error) {
	obj, exists, err := c.indexer.GetByKey(namespace + "/" + name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(c.resource, name)
	}
	return obj.(*v3.Workload), nil
}

func (c *workloadCache) List(namespace string, selector labels.Selector) (ret []*v3.Workload, err error) {

	err = cache.ListAllByNamespace(c.indexer, namespace, selector, func(m interface{}) {
		ret = append(ret, m.(*v3.Workload))
	})

	return ret, err
}

func (c *workloadCache) AddIndexer(indexName string, indexer WorkloadIndexer) {
	utilruntime.Must(c.indexer.AddIndexers(map[string]cache.IndexFunc{
		indexName: func(obj interface{}) (strings []string, e error) {
			return indexer(obj.(*v3.Workload))
		},
	}))
}

func (c *workloadCache) GetByIndex(indexName, key string) (result []*v3.Workload, err error) {
	objs, err := c.indexer.ByIndex(indexName, key)
	if err != nil {
		return nil, err
	}
	result = make([]*v3.Workload, 0, len(objs))
	for _, obj := range objs {
		result = append(result, obj.(*v3.Workload))
	}
	return result, nil
}


text:
namespace content {

class BrowserAccessibilityWin;
class WebAXPlatformTreeManagerDelegate;

using UiaRaiseActiveTextPositionChangedEventFunction =
    HRESULT(WINAPI*)(IRawElementProviderSimple*, ITextRangeProvider*);

// Manages a tree of BrowserAccessibilityWin objects.
class CONTENT_EXPORT BrowserAccessibilityManagerWin
    : public BrowserAccessibilityManager {
 public:
  BrowserAccessibilityManagerWin(const ui::AXTreeUpdate& initial_tree,
                                 WebAXPlatformTreeManagerDelegate* delegate);

  BrowserAccessibilityManagerWin(const BrowserAccessibilityManagerWin&) =
      delete;
  BrowserAccessibilityManagerWin& operator=(
      const BrowserAccessibilityManagerWin&) = delete;

  ~BrowserAccessibilityManagerWin() override;

  static ui::AXTreeUpdate GetEmptyDocument();
  static bool IsUiaActiveTextPositionChangedEventSupported();

  // Get the closest containing HWND.
  HWND GetParentHWND();

  // BrowserAccessibilityManager methods
  void UserIsReloading() override;
  BrowserAccessibility* GetFocus() const override;
  bool IsIgnoredChangedNode(const BrowserAccessibility* node) const;
  bool CanFireEvents() const override;

  void FireFocusEvent(ui::AXNode* node) override;
  void FireBlinkEvent(ax::mojom::Event event_type,
                      BrowserAccessibility* node,
                      int action_request_id) override;
  void FireGeneratedEvent(ui::AXEventGenerator::Event event_type,
                          const ui::AXNode* node) override;

  void FireWinAccessibilityEvent(LONG win_event, BrowserAccessibility* node);
  void FireUiaAccessibilityEvent(LONG uia_event, BrowserAccessibility* node);
  void FireUiaPropertyChangedEvent(LONG uia_property,
                                   BrowserAccessibility* node);
  void FireUiaStructureChangedEvent(StructureChangeType change_type,
                                    BrowserAccessibility* node);
  void FireUiaActiveTextPositionChangedEvent(BrowserAccessibility* node);

  // Do event pre-processing
  void BeforeAccessibilityEvents() override;

  // Do event post-processing
  void FinalizeAccessibilityEvents() override;

  // Track this object and post a VISIBLE_DATA_CHANGED notification when
  // its container scrolls.
  // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
  void TrackScrollingObject(BrowserAccessibilityWin* node);

  // Called when |accessible_hwnd_| is deleted by its parent.
  void OnAccessibleHwndDeleted();

 protected:
  // AXTreeObserver methods.
  void OnSubtreeWillBeDeleted(ui::AXTree* tree, ui::AXNode* node) override;
  void OnAtomicUpdateFinished(
      ui::AXTree* tree,
      bool root_changed,
      const std::vector<ui::AXTreeObserver::Change>& changes) override;

 private:
  struct SelectionEvents {
    std::vector<BrowserAccessibility*> added;
    std::vector<BrowserAccessibility*> removed;
    SelectionEvents();
    ~SelectionEvents();
  };

  using SelectionEventsMap = std::map<BrowserAccessibility*, SelectionEvents>;
  using IsSelectedPredicate =
      base::RepeatingCallback<bool(BrowserAccessibility*)>;
  using FirePlatformSelectionEventsCallback =
      base::RepeatingCallback<void(BrowserAccessibility*,
                                   BrowserAccessibility*,
                                   const SelectionEvents&)>;
  static bool IsIA2NodeSelected(BrowserAccessibility* node);
  static bool IsUIANodeSelected(BrowserAccessibility* node);

  void FireIA2SelectionEvents(BrowserAccessibility* container,
                              BrowserAccessibility* only_selected_child,
                              const SelectionEvents& changes);
  void FireUIASelectionEvents(BrowserAccessibility* container,
                              BrowserAccessibility* only_selected_child,
                              const SelectionEvents& changes);

  static void HandleSelectedStateChanged(
      SelectionEventsMap& selection_events_map,
      BrowserAccessibility* node,
      bool is_selected);

  static void FinalizeSelectionEvents(
      SelectionEventsMap& selection_events_map,
      IsSelectedPredicate is_selected_predicate,
      FirePlatformSelectionEventsCallback fire_platform_events_callback);

  // Retrieve UIA RaiseActiveTextPositionChangedEvent function if supported.
  static UiaRaiseActiveTextPositionChangedEventFunction
  GetUiaActiveTextPositionChangedEventFunction();

  void HandleAriaPropertiesChangedEvent(BrowserAccessibility& node);
  void EnqueueTextChangedEvent(BrowserAccessibility& node);
  void EnqueueSelectionChangedEvent(BrowserAccessibility& node);

  // Give BrowserAccessibilityManager::Create access to our constructor.
  friend class BrowserAccessibilityManager;

  // Since there could be multiple aria property changes on a node and we only
  // want to fire UIA_AriaPropertiesPropertyId once for that node, we use the
  // set here to keep track of the unique nodes that had aria property changes,
  // so we only fire the event once for every node.
  std::set<BrowserAccessibility*> aria_properties_events_;

  // Since there could be duplicate selection changed events on a node raised
  // from both EventType::DOCUMENT_SELECTION_CHANGED and
  // EventType::TEXT_SELECTION_CHANGED, we keep track of the unique
  // nodes so we only fire the event once for every node.
  std::set<BrowserAccessibility*> selection_changed_nodes_;

  // Since there could be duplicate text changed events on a node raised from
  // both FireBlinkEvent and FireGeneratedEvent, we use the set here to keep
  // track of the unique nodes that had UIA_Text_TextChangedEventId, so we only
  // fire the event once for every node.
  std::set<BrowserAccessibility*> text_changed_nodes_;

  // When the ignored state changes for a node, we only want to fire the
  // events relevant to the ignored state change (e.g. show / hide).
  // This set keeps track of what nodes should suppress superfluous events.
  std::set<BrowserAccessibility*> ignored_changed_nodes_;

  // Keep track of selection changes so we can optimize UIA event firing.
  // Pointers are only stored for the duration of |OnAccessibilityEvents|, and
  // the map is cleared in |FinalizeAccessibilityEvents|.
  SelectionEventsMap ia2_selection_events_;
  SelectionEventsMap uia_selection_events_;
};

}  // namespace content

#endif  // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_


text:
#ifndef INTHEORYH
#define INTHEORYH

/**
 * InTheory API
 */

enum loglevel_t {
  NONE,
  ERROR,
  GRAPH,
  NOTICE,
  INFO,
  TRACE,
};

// SET Flags
#define ASYNC_SEND 1
#define TIMEOUT 2
#define LOCK 4
#define UNLOCK 8
#define XMANAGE 16

// TODO:
// Optimization could be used to verify certain
// conditions in the local store before proceeding
// with a set LOCK.
// #define FAIL_EARLY 16

enum change_t {
  SLOT_CREATE,
  SLOT_UPDATE,
  SLOT_DELETE
};

enum xslots_t {
  XMANAGE_ENTER_MAINTENANCE_MODE,
  XMANAGE_SET_DEADLINE,
  XMANAGE_CHECKPOINT,
  XMANAGE_PRINT_STATES,
  XMANAGE_FSCK,
  XMANAGE_SHUTDOWN
};

typedef void (*slot_changed_cb)(int slot, long value, unsigned short op);
void start_intheory(int my_index, int node_count, char** allnodes);
void stop_intheory();
int set_it(int slot, long value, unsigned short flags);
int get_it(int slot, long*retval);
void register_changed_cb(int slot, slot_changed_cb cb);
void unregister_cb(int slot, slot_changed_cb cb);
int my_id();
int num_nodes();
void set_log_level(enum loglevel_t level);
void lock(int slot);
void unlock(int slot);
#endif


text:
#region License
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Philipp Bobek
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
#endregion

using System.Xml;

namespace BitmapFontLibrary.Loader.Parser.Xml
{
    /// <summary>
    /// Interface for builders of xml reader settings.
    /// </summary>
    public interface IXmlSettingsBuilder
    {
        /// <summary>
        /// Builds settings for xml readers.
        /// </summary>
        /// <param name="isXmlValidationEnabled">If true the reader will validate the xml with a xml schema</param>
        /// <returns>Settings for a xml reader</returns>
        XmlReaderSettings BuildXmlReaderSettings(bool isXmlValidationEnabled);
    }
}


text:
<?php

class DefaultInputAdapter extends AbstractHtmlInputAdapter
{
	// STATIC ATTRIBUTES

	public function useStandardHeaders()
	{
	}

	// HTML INPUT
	public function getInputTypes()
	{
		return array(
			Type::$TYPE_INTEGER,
			"ModelField",
			Type::$TYPE_STRING, Type::$TYPE_HIDDEN, Type::$TYPE_URL, Type::$TYPE_EMAIL,
			Type::$TYPE_DATE, Type::$TYPE_DATETIME, Type::$TYPE_TIME,
			Type::$TYPE_PASSWORD,
			Type::$TYPE_BUTTON, Type::$TYPE_SUBMIT, Type::$TYPE_RESET, Type::$TYPE_CANCEL,
			Type::$TYPE_SELECT,
			Type::$TYPE_RICHTEXT);
	}

	protected function getFieldValue($arg_field, $arg_value)
	{
		if ( is_null($arg_value) )
		{
			return $arg_field->getAttribute("default");
		}
		return is_null($arg_value) ? "" : $arg_value;
	}

	public function htmlInputModelField($arg_id, $arg_name, $arg_label, $arg_readonly, $arg_hidden, $arg_form_id, $arg_model_object, $arg_field_object, $arg_field_value, $arg_classes = "", $arg_opts = "")
	{
		$context = "DefaultInputAdapter.htmlInputModelField";

		// GET THE FIELD INFOS
		$field_name = $arg_field_object->getName();
		$field_id    = $arg_form_id."_".$field_name;
		$field_label = $arg_field_object->getLabel();
		$field_type  = $arg_field_object->getType();
		$field_is_primary_key = $arg_field_object->isPrimaryKey();
		$field_readonly = $arg_readonly or (! $arg_field_object->isEditable()) or $field_is_primary_key;
		$field_value = $this->getFieldValue($arg_field_object, $arg_field_value);
//		TRACE::trace_var($context, "field_name", $field_name, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
//		TRACE::trace_var($context, "field_readonly", $field_readonly, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
//		TRACE::trace_var($context, "field_value", $field_value, self::$TRACE_ABSTRACT_INPUT_ADAPTER);

		// HIDE THE HIDDEN FIELD COLUMN
		if ($arg_hidden)
		{
			return HTML::formInput($field_id, $field_name, $field_label, "Hidden", $field_value, $field_readonly, "", "");
		}

		// HIDE THE NOT VISIBLE FIELD COLUMN
		// TODO PASSWORD FIELD IS EDITABLE BUT NOT VISIBLE : DO NOT DISPLAY IN TABLE BUT DISPLAY IN FORM DIALOG
		// if ( ! $arg_field_object->isVisible() )
		// {
			// return HTML::formInput($field_id, $field_name, $field_label, "Hidden", $field_value, $field_readonly, "", "");
		// }

		// HIDE PRIMARY KEY FIELD COLUMN
		if ( $field_is_primary_key )
		{
			return HTML::formInput($field_id, $field_name, $field_label, "Hidden", $field_value, $field_readonly, "", "");
		}

		// DISPLAY THE FIELD COLUMN WITHOUT FOREIGN KEY
		if ( ! ($arg_field_object instanceof SQLField) or ! $arg_field_object->hasSQLForeignAttributes() )
		{
			return HTML::formInput($field_id, $field_name, $field_label, $field_type, $field_value, $field_readonly, "", "");
		}

		// DISPLAY THE FIELD COLUMN WITH FOREIGN KEY
		$distincts_records = $arg_model_object->fetchDistinctValuesForField($field_name, null, null, null, null);
		if ( is_null($distincts_records) )
		{
			TRACE::addErrorMsg($context, "distincts_records is null", self::$TRACE_ABSTRACT_INPUT_ADAPTER);
			return false;
		}

		$field_values = array();
		foreach($distincts_records as $key=>$record)
		{
			foreach($record as $keyr=>$value)
			{
				if ( ! is_null($value) && $value != "" )
				{
					$field_values[] = $value;
				}
			}
		}
//		TRACE::trace_var($context, "values", $field_values);
		HTML::formSelect($field_id, $field_name, $field_label, "Select", $field_values, $field_value, $field_readonly, "", " style='width=\"small\"';");

		return true;
	}

	public function htmlInput($arg_id, $arg_name, $arg_label, $arg_type, $arg_value, $arg_readonly, $arg_classes = "", $arg_opts = "")
	{
		$context = "DefaultInputAdapter::htmlInput";
		TRACE::enterWithArgs($context, "", self::$TRACE_ABSTRACT_INPUT_ADAPTER, $arg_id, $arg_name, $arg_label, $arg_type, $arg_value,  $arg_readonly, $arg_classes, $arg_opts);

		// CHECK TYPE AND NAME
		if ($arg_type === null or $arg_name === null or $arg_type == "" or $arg_name == "")
		{
			return TRACE::leaveko($context, "type or name is null or empty", false, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
		}

		// LABEL TAG
		if ($arg_id !== null && $arg_id != "" && $arg_label !== null && $arg_label != "")
		{
			if ($arg_type != Type::$TYPE_HIDDEN && $arg_type != Type::$TYPE_BUTTON
				&& $arg_type != Type::$TYPE_SUBMIT && $arg_type != Type::$TYPE_RESET && $arg_type != Type::$TYPE_CANCEL)
			{
				HTML::addBufferLine("<LABEL for='".$arg_id."'>".$arg_label."</LABEL>");
			}
		}

		// PROCESSING
		$result = false;
		switch($arg_type)
		{
			case Type::$TYPE_INTEGER:	$result = $this->htmlInputInteger	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_STRING:	$result = $this->htmlInputString	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_HIDDEN:	$result = $this->htmlInputHidden	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_DATE:		$result = $this->htmlInputDate		($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_DATETIME:	$result = $this->htmlInputDateTime	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_TIME:		$result = $this->htmlInputTime		($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_PASSWORD:	$result = $this->htmlInputPassword	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_BUTTON:	$result = $this->htmlInputButton	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_SUBMIT:	$result = $this->htmlInputSubmit	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_RESET:		$result = $this->htmlInputReset		($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_CANCEL:	$result = $this->htmlInputCancel	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_SELECT:	$result = $this->htmlInputSelect	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_URL:		$result = $this->htmlInputUrl		($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_EMAIL:		$result = $this->htmlInputEmail		($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			case Type::$TYPE_RICHTEXT:	$result = $this->htmlInputTextArea	($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts); break;
			default : return TRACE::leaveko($context, "type not processed [$arg_type]", false, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
		}

		// CHECK PROCESSING RESULT
		if ( ! $result )
		{
			return TRACE::leaveko($context, "error during type processing [$arg_type]", false, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
		}

		return TRACE::leaveok($context, "type processed [$arg_type]", true, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
	}

	// INTERNAL PROCESSING
	protected function htmlInputString($arg_id, $arg_name, $arg_label, $arg_value,  $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? " id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? " name='".$arg_name."'" : "";
		$str_type	= "type='TEXT'";
		$str_value	= ($arg_value !== null && $arg_value != "")	? " value='".$arg_value."'" : " value=''";
		$str_read	= ($arg_readonly !== null && Type::getBooleanValue($arg_readonly, false) )? " readonly" : "";

		$str = "<INPUT class='$arg_classes input-text' $str_id $str_type $str_name $str_value $str_read ".$arg_opts."/>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputInteger($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value,  $arg_readonly, $arg_classes." digits", $arg_opts);
	}

	protected function htmlInputNumber($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value,  $arg_readonly, $arg_classes." number", $arg_opts);
	}

	protected function htmlInputHidden($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? "id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? "name='".$arg_name."'" : "";
		$str_type	= "type='HIDDEN'";
		$str_value	= ($arg_value !== null && $arg_value != "")	? "value='".$arg_value."'" : " value=''";
		$str_read	= ($arg_readonly !== null && Type::getBooleanValue($arg_readonly, false) )? "readonly" : "";

		$str = "<INPUT class='$arg_classes input-text' $str_id $str_type $str_name $str_value $str_read ".$arg_opts."/>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputDate($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value,  $arg_readonly, $arg_classes." date", $arg_opts);
	}

	protected function htmlInputTime($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts);
	}

	protected function htmlInputDateTime($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts);
	}

	protected function htmlInputPassword($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$context = "DefaultInputAdapter::htmlInputPassword($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)";
		TRACE::enter($context, "", self::$TRACE_ABSTRACT_INPUT_ADAPTER);

		$str_id		= ($arg_id === null || $arg_id == "") ? "noid" : $arg_id;
		$str_name	= ($arg_name !== null && $arg_name != "") ? $arg_name : "noname";
		$str_value	= ($arg_value !== null && $arg_value != "") ? "value='".$arg_value."'" : " value=''";

		// IS A READ ONLY FIELD ?
		$is_readonly	= ($arg_readonly !== null) && Type::getBooleanValue($arg_readonly, false);

		// CREATE HTML BUFFER STRING
		$str = "";
		if ($is_readonly)
		{
			$str .= "<INPUT class='$arg_classes input-text' $str_id type='PASSWORD' $str_name $str_value readonly ".$arg_opts."/>";
		}
		else
		{
			$str_id_oldhash	= $str_id."_oldhash";
			$str_id_new		= $str_id."_new";
			$str_id_confirm	= $str_id."_confirm";
			$str_id_newhash	= $str_id;

			$str_name_oldhash	= $str_name."_oldhash";
			$str_name_new		= $str_name."_new";
			$str_name_confirm	= $str_name."_confirm";
			$str_name_newhash	= $str_name;

			$js_onchange	= "apt_form_password_onchange(\"$str_id_oldhash\", \"$str_id_new\", \"$str_id_confirm\", \"$str_id_newhash\");";

			$str .= "<INPUT class='$arg_classes input-text apt_password_oldhash' id='$str_id_oldhash' type='HIDDEN'   subtype='OLDHASH' name='$str_name_oldhash' $str_value readonly />";
			$str .= "<INPUT class='$arg_classes input-text apt_password_new'     id='$str_id_new'     type='PASSWORD' subtype='NEW'     name='$str_name_new'     value='' ".$arg_opts."/>";
			$str .= "<INPUT class='$arg_classes input-text apt_password_confirm' id='$str_id_confirm' type='PASSWORD' subtype='CONFIRM' name='$str_name_confirm' value='' ".$arg_opts." onchange='$js_onchange' />";
			$str .= "<INPUT class='$arg_classes input-text apt_password_newhash' id='$str_id_newhash' type='HIDDEN'   subtype='NEWHASH' name='$str_name_newhash' $str_value />";
		}

		// TODO OLD, NEW, CONFIRM
		HTML::addBufferLine($str);

		return TRACE::leaveok($context, "", true, self::$TRACE_ABSTRACT_INPUT_ADAPTER);
	}

	protected function htmlInputButton($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? "id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? "name='".$arg_name."'" : "";
		$str_type	= "";
		$str_value	= ($arg_value !== null && $arg_value != "")	? "value='".$arg_value."'" : " value=''";
		$str_read	= "";

		$str = "<BUTTON class='$arg_classes nice small radius blus button' $str_id $str_type $str_name $str_value $str_read ".$arg_opts.">$arg_label</BUTTON>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputSubmit($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? "id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? "name='".$arg_name."'" : "";
		$str_type	= "type='SUBMIT'";
		$str_value	= ($arg_value !== null && $arg_value != "")	? "value='".$arg_value."'" : " value=''";

		$str = "<BUTTON class='$arg_classes nice small radius blus button' $str_id $str_type $str_name $str_value ".$arg_opts.">$arg_label</BUTTON>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputReset($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? "id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? "name='".$arg_name."'" : "";
		$str_type	= "type='RESET'";
		$str_value	= ($arg_value !== null && $arg_value != "")	? "value='".$arg_value."'" : " value=''";

		$str = "<BUTTON class='$arg_classes nice small radius blus button' $str_id $str_type $str_name $str_value ".$arg_opts.">$arg_label</BUTTON>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputCancel($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? "id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? "name='".$arg_name."'" : "";
		$str_type	= "";
		$str_value	= ($arg_value !== null && $arg_value != "")	? "value='".$arg_value."'" : " value=''";

		$str = "<BUTTON class='$arg_classes nice small radius blus button' $str_id $str_type $str_name $str_value ".$arg_opts.">$arg_label</BUTTON>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputSelect($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? "id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? "name='".$arg_name."'" : "";
		$str_read	= ($arg_readonly !== null && Type::getBooleanValue($arg_readonly, false) ) ? "readonly" : "";
		$arg_values	= ( is_array($arg_value) && array_key_exists("values", $arg_value) ) ? $arg_value["values"] : null;
		$arg_selected_value = ( is_array($arg_value) && array_key_exists("selected", $arg_value) ) ? $arg_value["selected"] : "";

		// READONLY SELECT
		if ( Type::getBooleanValue($arg_readonly, false) )
		{
			return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_selected_value, true, $arg_classes, $arg_opts);
		}

		// CHECK VALUES
		if ( is_null($arg_values) or ! is_array($arg_values) )
		{
			return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_selected_value, true, $arg_classes, $arg_opts);
		}

		// NO READONLY SELECT
		$str = "<SELECT class='$arg_classes' $str_id $str_name $str_read $arg_opts />";
		HTML::addBufferLine($str);
		foreach($arg_values as $key=>$value)
		{
			$selected_str = ($value == $arg_selected_value) ? " SELECTED" : "";
			$str= "<OPTION value='".$value."'".$selected_str.">".$value."</OPTION>";
			HTML::addBufferLine($str);
		}

		$str = "</SELECT>";
		HTML::addBufferLine($str);
		return true;
	}

	protected function htmlInputUrl($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value,  $arg_readonly, $arg_classes." url", $arg_opts);
	}

	protected function htmlInputEmail($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		return $this->htmlInputString($arg_id, $arg_name, $arg_label, $arg_value,  $arg_readonly, $arg_classes." email", $arg_opts);
	}

	protected function htmlInputTextArea($arg_id, $arg_name, $arg_label, $arg_value, $arg_readonly, $arg_classes, $arg_opts)
	{
		$str_id		= ($arg_id !== null && $arg_id != "")		? " id='".$arg_id."'" : "";
		$str_name	= ($arg_name !== null && $arg_name != "")	? " name='".$arg_name."'" : "";
		$str_value	= ($arg_value !== null && $arg_value != "")	? " value='".$arg_value."'" : " value=''";
		$str_read	= ($arg_readonly !== null && Type::getBooleanValue($arg_readonly, false) )? " readonly" : "";

		$str = "<TEXTAREA class='$arg_classes input-text' $str_id $str_name $str_read ".$arg_opts.">$str_value</TEXTAREA>";
		HTML::addBufferLine($str);
		return true;
	}
}
?>


text:
import React from 'react';
import { createShallow } from '@material-ui/core/test-utils';
import { DropZone } from '../../components/MapTools/DropZone';
import DropZoneDialog from '../../components/MapTools/DropZoneDialog';
import DropZoneError from '../../components/MapTools/DropZoneError';

describe('DropZone component', () => {
    let shallow;

    beforeAll(() => {
        shallow = createShallow();
    });

    const props = {
        importGeom: {},
        showImportModal: false,
        setAllButtonsDefault: () => {},
        setImportModalState: () => {},
        processGeoJSONFile: () => {},
        resetGeoJSONFile: () => {},
        ...global.eventkit_test_props,
    };
    it('should render a div containing the dialog and error components', () => {
        const wrapper = shallow(<DropZone {...props} />);
        expect(wrapper.find(DropZoneDialog)).toHaveLength(1);
        expect(wrapper.find(DropZoneError)).toHaveLength(1);
    });
});


text:
using namespace std;

class JointManager
{
public:
	unsigned int addJoint(b2World* world, const b2JointDef* jointDef);
	b2Joint* getJoint(unsigned int id) {return joints[id-1];}

private:
	vector<b2Joint*> joints;
};


text:
import { DisplayAd } from "Components/Publishing/Display/DisplayAd"
import {
  FeatureArticle,
  SeriesArticle,
  SeriesArticleSponsored,
} from "Components/Publishing/Fixtures/Articles"
import { RelatedCanvas } from "Components/Publishing/Fixtures/Components"
import { Nav } from "Components/Publishing/Nav/Nav"
import { ArticleCardsBlock } from "Components/Publishing/RelatedArticles/ArticleCards/Block"
import { RelatedArticlesCanvas } from "Components/Publishing/RelatedArticles/Canvas/RelatedArticlesCanvas"
import { SeriesAbout } from "Components/Publishing/Series/SeriesAbout"
import { mount } from "enzyme"
import "jest-styled-components"
import { cloneDeep, extend } from "lodash"
import React from "react"
import { FeatureLayout } from "../FeatureLayout"

jest.mock(
  "Components/Publishing/Sections/FullscreenViewer/withFullScreen",
  () => ({
    withFullScreen: x => x,
  })
)

it("renders RelatedArticlesCanvas if article is not super or in a series", () => {
  const article = mount(
    <FeatureLayout
      article={FeatureArticle}
      relatedArticlesForCanvas={RelatedCanvas}
    />
  )
  expect(article.find(RelatedArticlesCanvas).length).toBe(1)
})

it("Does not render RelatedArticlesCanvas if article is super", () => {
  const article = mount(
    <FeatureLayout
      article={FeatureArticle}
      relatedArticlesForCanvas={RelatedCanvas}
      isSuper
    />
  )
  expect(article.find(RelatedArticlesCanvas).length).toBe(0)
})

it("Does not render RelatedArticlesCanvas if article is in a series", () => {
  const Article = extend(cloneDeep(FeatureArticle), {
    seriesArticle: SeriesArticle,
  })
  const article = mount(
    <FeatureLayout
      article={Article}
      relatedArticlesForCanvas={RelatedCanvas}
      isSuper
    />
  )
  expect(article.find(RelatedArticlesCanvas).length).toBe(0)
})

it("renders a nav if article is in a series", () => {
  const Article = extend(cloneDeep(FeatureArticle), {
    seriesArticle: SeriesArticle,
  })
  const article = mount(
    <FeatureLayout article={Article} relatedArticlesForCanvas={RelatedCanvas} />
  )
  expect(article.find(Nav).length).toBe(1)
})

it("renders display ads when feature ", () => {
  const article = mount(
    <FeatureLayout
      article={FeatureArticle}
      relatedArticlesForCanvas={RelatedCanvas}
    />
  )
  expect(article.find(DisplayAd).length).toBe(2)
})

it("does not render a nav if article has a non-fullscreen header", () => {
  const Article = extend(cloneDeep(FeatureArticle), {
    hero_section: {
      type: "basic",
    },
    seriesArticle: SeriesArticle,
  })
  const article = mount(
    <FeatureLayout article={Article} relatedArticlesForCanvas={RelatedCanvas} />
  )
  expect(article.find(Nav).length).toBe(0)
})

it("renders related article cards if in a series", () => {
  const Article = extend(cloneDeep(FeatureArticle), {
    seriesArticle: SeriesArticle,
    relatedArticles: [FeatureArticle],
  })
  const article = mount(
    <FeatureLayout article={Article} relatedArticlesForCanvas={RelatedCanvas} />
  )
  expect(article.find(ArticleCardsBlock).length).toBe(1)
})

it("renders sponsor info if in a sponsored series", () => {
  const Article = extend(cloneDeep(FeatureArticle), {
    seriesArticle: SeriesArticleSponsored,
  })
  const article = mount(
    <FeatureLayout article={Article} relatedArticlesForCanvas={RelatedCanvas} />
  )
  expect(article.find(SeriesAbout).length).toBe(1)
})


text:
<?php

namespace Oro\Bundle\SearchBundle\Tests\Functional\Controller\DataFixtures;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;

use Oro\Bundle\SearchBundle\Query\Query;
use Rhumsaa\Uuid\Uuid;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

use Oro\Bundle\TestFrameworkBundle\Entity\Item;

/**
 * Load customers
 *
 * Execute with "php app/console doctrine:fixtures:load"
 */
class LoadSearchItemData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
{
    const COUNT = 9;

    /**
     * @var ContainerInterface
     */
    protected $container;

    /**
     * {@inheritDoc}
     */
    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }

    /**
     * {@inheritDoc}
     */
    public function load(ObjectManager $manager)
    {
        $this->loadItems($manager);
        $this->ensureItemsLoaded();
    }

    /**
     * {@inheritdoc}
     */
    public function getOrder()
    {
        return 4;
    }

    /**
     * Load items
     *
     * @param ObjectManager $manager
     */
    public function loadItems($manager)
    {
        for ($ind = 1; $ind <= self::COUNT; $ind++) {
            //create item
            /** @var $item Item */
            $item = new Item();
            //string value
            $item->stringValue  = 'item' . $ind . '@mail.com';
            $item->integerValue = $ind * 1000;
            //decimal
            $item->decimalValue = $ind / 10.0;
            //float
            $item->floatValue = $ind / 10.0 + 10;
            //boolean
            $item->booleanValue = rand(0, 1) == true;
            //blob
            $item->blobValue = "blob-{$ind}";
            //array
            $item->arrayValue = [$ind];
            //datetime
            $date = new \DateTime('2014-12-01', new \DateTimeZone('UTC'));
            $date->add(new \DateInterval("P{$ind}Y"));
            $item->datetimeValue = $date;
            //guid
            $item->guidValue = Uuid::uuid4();
            //object
            $item->objectValue = new \stdClass();
            //phone
            $item->phone = sprintf($ind % 2 ? '123-456-%s00' : '%s00987654', $ind);

            $manager->persist($item);
        }

        $manager->flush();
    }

    /**
     * Ensure that items loaded to search index
     *
     * @throws \LogicException
     */
    protected function ensureItemsLoaded()
    {
        $query = new Query();
        $query->from('oro_test_item');

        $requestCounts = 20;
        do {
            $result = $this->container->get('oro_search.search.engine')->search($query);
            $isLoaded = $result->getRecordsCount() == self::COUNT;
            if (!$isLoaded) {
                $requestCounts++;
                sleep(1);
            }
        } while (!$isLoaded && $requestCounts > 0);

        if (!$isLoaded) {
            throw new \LogicException('Search items are not loaded');
        }
    }
}


text:
package com.googlecode.common.admin.client.ui.user;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.googlecode.common.admin.client.ui.company.CompanyService;
import com.googlecode.common.client.app.task.RequestTask;
import com.googlecode.common.client.http.RequestService;
import com.googlecode.common.client.task.TaskManager;
import com.googlecode.common.client.ui.panel.LoadablePanel;
import com.googlecode.common.client.util.StringHelpers;
import com.googlecode.common.admin.protocol.company.ContactDTO;
import com.googlecode.common.admin.protocol.company.ContactResponse;
import com.googlecode.common.admin.protocol.user.UserDTO;

/**
 * User contacts panel.
 */
public final class UserContactsPanel extends LoadablePanel {

    private final TextBox   firstNameText   = new TextBox();
    private final TextBox   middleNameText  = new TextBox();
    private final TextBox   secondNameText  = new TextBox();
    private final TextBox   emailText       = new TextBox();
    private final TextBox   phoneText       = new TextBox();

    private UserDTO         userDto;

    public UserContactsPanel() {
        Widget contentPanel = createFormPanel();
        contentPanel.setPixelSize(450, 250);

        initWidget(contentPanel);
    }

    private Widget createFormPanel() {
        FlexTable table = new FlexTable();

        firstNameText.setWidth("100%");
        firstNameText.setReadOnly(true);
        table.setHTML(0, 0, "First name:");
        table.setWidget(0, 1, firstNameText);

        middleNameText.setWidth("100%");
        middleNameText.setReadOnly(true);
        table.setHTML(1, 0, "Middle name:");
        table.setWidget(1, 1, middleNameText);

        secondNameText.setWidth("100%");
        secondNameText.setReadOnly(true);
        table.setHTML(2, 0, "Second name:");
        table.setWidget(2, 1, secondNameText);

        emailText.setWidth("100%");
        emailText.setReadOnly(true);
        table.setHTML(3, 0, "E-mail:");
        table.setWidget(3, 1, emailText);

        phoneText.setWidth("100%");
        phoneText.setReadOnly(true);
        table.setHTML(4, 0, "Phone:");
        table.setWidget(4, 1, phoneText);

        return table;
    }

    private void updateContacts(ContactDTO dto) {
        firstNameText.setText(dto != null ? dto.getFirstName() : "");
        middleNameText.setText(dto != null ? dto.getMiddleName() : "");
        secondNameText.setText(dto != null ? dto.getSecondName() : "");
        emailText.setText(dto != null ? dto.getEmail() : "");
        phoneText.setText(dto != null ?
                StringHelpers.str(dto.getPhone()) : "");
    }

    public void setUserDTO(UserDTO userDto) {
        this.userDto = userDto;
        setNeedLoad(true);
    }

    @Override
    public void onDeactivated() {
        setNeedLoad(false);
    }

    @Override
    public void onLoadData() {
        if (userDto != null) {
            TaskManager.INSTANCE.execute(new LoadContactsTask());
        }
    }

    private class LoadContactsTask extends RequestTask<ContactResponse> {

        public LoadContactsTask() {
            super("Fetching contacts...");
        }

        @Override
        protected void runTask() throws Exception {
            CompanyService service = GWT.create(CompanyService.class);
            RequestService.prepare(service).getContact(
                    userDto.safeGetContactId(), this);
        }

        @Override
        protected void processFailureResponse(ContactResponse response) {
            updateContacts(null);
            super.processFailureResponse(response);
        }

        @Override
        protected void processSuccessResponse(ContactResponse resp) {
            updateContacts(resp.getData());
        }
    }

}


text:
/**
 * @fileoverview A wrapper for multiple Expandable elements that will
 * allow them to operate coherently in an accordion type fashion.
 *
 * @author Matt Zaso <matt.zaso@odopod.com>
 */
import Settings from './settings';
import ExpandableItem from './expandable-item';

class ExpandableGroup {
  constructor(elements) {
    /** @type {Array.<!Element>} */
    this._elements = elements;

    /**
     * @type {Array.<!ExpandableItem>}
     * @protected
     */
    this.expandables = elements.map(trigger => new ExpandableItem(
      trigger.getAttribute(Settings.Attribute.TRIGGER),
      { groupedItem: true },
    ));

    this._onClick = this._onClickHandler.bind(this);
    document.body.addEventListener('click', this._onClick);
  }

  /**
   * Handler for clicks on the trigger.
   * @param {MouseEvent} evt Event object.
   * @private
   */
  _onClickHandler(evt) {
    const closest = evt.target.closest(`[${Settings.Attribute.TRIGGER}]`);

    if (this._elements.includes(closest)) {
      evt.preventDefault();
      this.toggleVisibility(closest.getAttribute(Settings.Attribute.TRIGGER));
    }
  }

  /**
   * Will iterate over all grouped items and toggle the selected one while collapsing all others.
   * @param {string} id The ID of the selected target to expand.
   * @private
   */
  toggleVisibility(id) {
    this.expandables.forEach((expandable) => {
      if (expandable.id === id) {
        expandable.toggle();
      } else {
        expandable.close();
      }
    });
  }

  /**
   * Dispose this instance and its handlers. Will also dispose all child
   * instances.
   * @public
   */
  dispose() {
    document.body.removeEventListener('click', this._onClick);
    this.expandables.forEach(item => item.dispose());
  }
}

Object.assign(ExpandableGroup, Settings);

export default ExpandableGroup;


text:
namespace rocksdb {
 class Slice;
}  // namespace rocksdb

namespace arangodb {
class RocksDBKey;
class RocksDBTransactionState;

struct ReadOptions : public rocksdb::ReadOptions {
  bool readOwnWrites = false;
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
  // only used to control whether we verify in NewIterator that we do not
  // create a read-own-write iterator with intermediate commits enabled.
  bool checkIntermediateCommits = true;
#endif
};

class RocksDBTransactionMethods : public RocksDBMethods {
 public:
  explicit RocksDBTransactionMethods(RocksDBTransactionState* state) : _state(state) {}
  virtual ~RocksDBTransactionMethods() = default;

  virtual Result beginTransaction() = 0;

  virtual Result commitTransaction() = 0;

  virtual Result abortTransaction() = 0;

  // Only relevant for RocksDBTrxMethods
  virtual Result checkIntermediateCommit(bool& hasPerformedIntermediateCommit) { return {}; }

  /// @returns tick of last operation in a transaction
  /// @note the value is guaranteed to be valid only after
  ///       transaction is committed
  virtual TRI_voc_tick_t lastOperationTick() const noexcept = 0;

  virtual uint64_t numCommits() const noexcept = 0;

  virtual rocksdb::ReadOptions iteratorReadOptions() const = 0; // TODO - remove later

  /// @brief acquire a database snapshot if we do not yet have one.
  /// Returns true if a snapshot was acquire
  virtual bool ensureSnapshot() = 0;

  virtual rocksdb::SequenceNumber GetSequenceNumber() const noexcept = 0;

  virtual bool hasOperations() const noexcept = 0;

  virtual uint64_t numOperations() const noexcept = 0;

  virtual void prepareOperation(DataSourceId cid, RevisionId rid, TRI_voc_document_operation_e operationType) = 0;

  /// @brief undo the effects of the previous prepareOperation call
  virtual void rollbackOperation(TRI_voc_document_operation_e operationType) = 0;

  /// @brief add an operation for a transaction collection
  /// sets hasPerformedIntermediateCommit to true if an intermediate commit was
  /// performed
  virtual Result addOperation(DataSourceId collectionId, RevisionId revisionId,
                              TRI_voc_document_operation_e opType) = 0;

  using ReadOptionsCallback = std::function<void(ReadOptions&)>;

  virtual std::unique_ptr<rocksdb::Iterator> NewIterator(rocksdb::ColumnFamilyHandle*,
                                                         ReadOptionsCallback) = 0;

  virtual bool iteratorMustCheckBounds(ReadOwnWrites) const = 0;

  virtual void SetSavePoint() = 0;
  virtual rocksdb::Status RollbackToSavePoint() = 0;
  virtual rocksdb::Status RollbackToWriteBatchSavePoint() = 0;
  virtual void PopSavePoint() = 0;

#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
  std::size_t countInBounds(RocksDBKeyBounds const& bounds, bool isElementInRange = false);
#endif

 protected:
  RocksDBTransactionState* _state;
};

}  // namespace arangodb


text:
using PackIt.Actions;
using PackIt.GUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace PackIt
{
    class Program
    {

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            InitialiseActions();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }

        private static void InitialiseActions()
        {
            new CopyAction();
            new DeleteAction();
            new ZipAction();
        }
    }
}