text:
package org.jetbrains.idea.svn.history;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import org.jetbrains.idea.svn.SvnBaseContentRevision;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.properties.PropertyData;
import org.tmatesoft.svn.core.SVNURL;

import java.util.List;

import static org.jetbrains.idea.svn.actions.ShowPropertiesDiffAction.getPropertyList;
import static org.jetbrains.idea.svn.actions.ShowPropertiesDiffAction.toSortedStringPresentation;

public class SvnLazyPropertyContentRevision extends SvnBaseContentRevision implements PropertyRevision {
  private final VcsRevisionNumber myNumber;
  private final SVNURL myUrl;
  private List<PropertyData> myContent;

  public SvnLazyPropertyContentRevision(@Nonnull SvnVcs vcs, @Nonnull FilePath file, VcsRevisionNumber number, SVNURL url) {
    super(vcs, file);
    myNumber = number;
    myUrl = url;
  }

  @Nullable
  @Override
  public List<PropertyData> getProperties() throws VcsException {
    if (myContent == null) {
      myContent = loadContent();
    }
    return myContent;
  }

  @Override
  public String getContent() throws VcsException {
    return toSortedStringPresentation(getProperties());
  }

  private List<PropertyData> loadContent() throws VcsException {
    final Ref<List<PropertyData>> ref = new Ref<>();
    final Ref<VcsException> exceptionRef = new Ref<>();
    final Runnable runnable = () -> {
      try {
        ref.set(getPropertyList(myVcs, myUrl, ((SvnRevisionNumber)myNumber).getRevision()));
      }
      catch (VcsException e) {
        exceptionRef.set(e);
      }
    };
    if (ApplicationManager.getApplication().isDispatchThread()) {
      boolean completed = ProgressManager.getInstance()
        .runProcessWithProgressSynchronously(runnable, SvnBundle.message("progress.title.loading.file.properties"), true,
                                             myVcs.getProject());
      if (!completed) {
        throw new VcsException("Properties load for revision " + getRevisionNumber().asString() + " was canceled.");
      }
    }
    else {
      runnable.run();
    }
    if (!exceptionRef.isNull()) throw exceptionRef.get();
    return ref.get();
  }

  @Nonnull
  @Override
  public VcsRevisionNumber getRevisionNumber() {
    return myNumber;
  }
}


text:
import React from 'react';
import DatePicker from '../DatePicker';
import { mount } from 'enzyme';

describe('DatePicker', () => {
  describe('Renders as expected', () => {
    const wrapper = mount(
      <DatePicker onChange={() => {}} className="extra-class">

      </DatePicker>
    );
    const datepicker = wrapper.childAt(0);

    it('has the expected classes', () => {
      expect(datepicker.children().hasClass('bx--date-picker')).toBe(true);
    });

    it('should add extra classes that are passed via className', () => {
      expect(datepicker.children().hasClass('extra-class')).toBe(true);
    });

    it('should add the date picker type as expected', () => {
      expect(wrapper.props().datePickerType).toEqual(undefined);
      wrapper.setProps({ datePickerType: 'simple' });
      expect(wrapper.props().datePickerType).toEqual('simple');
    });

    it('should specify short date picker as expected', () => {
      expect(wrapper.props().short).toEqual(false);
      wrapper.setProps({ short: true });
      expect(wrapper.props().short).toEqual(true);
    });

    it('should add the date format as expected', () => {
      expect(wrapper.props().dateFormat).toEqual('m/d/Y');
      wrapper.setProps({ dateFormat: 'd/m/Y' });
      expect(wrapper.props().dateFormat).toEqual('d/m/Y');
    });

    it('has the value as expected', () => {
      expect(wrapper.props().value).toEqual(undefined);
      wrapper.setProps({ value: '11/08/2017' });
      expect(wrapper.props().value).toEqual('11/08/2017');
    });

    it('should render the children as expected', () => {
      expect(wrapper.props().children.length).toEqual(2);
    });
  });

  describe('Simple date picker', () => {
    const wrapper = mount(
      <DatePicker datePickerType="simple" className="extra-class">

      </DatePicker>
    );
    const datepicker = wrapper.childAt(0);

    it('has the simple date picker class', () => {
      expect(datepicker.children().hasClass('bx--date-picker--simple')).toBe(
        true
      );
    });

    it('has the value as expected', () => {
      expect(wrapper.props().value).toEqual(undefined);
      wrapper.setProps({ value: '11/08/2017' });
      expect(wrapper.props().value).toEqual('11/08/2017');
    });

    it('should not initalize a calendar', () => {
      expect(wrapper.cal).toEqual(undefined);
    });
  });

  describe('Single date picker', () => {
    const wrapper = mount(
      <DatePicker
        onChange={() => {}}
        datePickerType="single"
        className="extra-class">

          <input type="text" className="bx--date-picker__input" />

      </DatePicker>
    );
    const datepicker = wrapper.childAt(0);
    const input = wrapper.find('.bx--date-picker__input');
    const icon = wrapper.find('svg');

    it('has the single date picker class', () => {
      expect(datepicker.children().hasClass('bx--date-picker--single')).toBe(
        true
      );
    });

    it('should initalize a calendar', () => {
      expect(wrapper.instance().cal).toBeDefined();
    });

    it('should update the classnames', () => {
      expect(
        wrapper
          .instance()
          .cal.calendarContainer.classList.contains('bx--date-picker__calendar')
      ).toBe(true);
    });

    it('has the value as expected', () => {
      expect(wrapper.props().value).toEqual(undefined);
      wrapper.setProps({ value: '11/08/2017' });
      expect(wrapper.props().value).toEqual('11/08/2017');
    });

    it('should not render an icon', () => {
      expect(icon.length).toEqual(0);
    });
  });

  describe('Range date picker', () => {
    const wrapper = mount(
      <DatePicker
        onChange={() => {}}
        datePickerType="range"
        className="extra-class">

          <input
            type="text"
            className="bx--date-picker__input"
            id="input-from"
          />

          <input type="text" className="bx--date-picker__input" id="input-to" />

      </DatePicker>
    );
    const datepicker = wrapper.childAt(0);
    const icon = wrapper.find('svg');

    it('has the range date picker class', () => {
      expect(datepicker.children().hasClass('bx--date-picker--range')).toBe(
        true
      );
    });

    it('should initalize a calendar', () => {
      expect(wrapper.instance().cal).toBeDefined();
    });

    it('should update the classnames', () => {
      expect(
        wrapper
          .instance()
          .cal.calendarContainer.classList.contains('bx--date-picker__calendar')
      ).toBe(true);
    });

    it('has the value as expected', () => {
      expect(wrapper.props().value).toEqual(undefined);
      wrapper.setProps({ value: '11/08/2017' });
      expect(wrapper.props().value).toEqual('11/08/2017');
    });

    it('should render an icon', () => {
      expect(icon.length).toEqual(1);
    });
  });
});

redpajama_set_name: RedPajamaGithub


text:
/**
 * @class Jii.widgets.form.Button
 * @extends Joints.StickyView
 */
Joints.defineClass('Jii.widgets.form.Button', Joints.StickyView, {

    template: _.template("<input type='button' value='<%- label %>' tabindex='<%- index %>' />"),

    _coreTypes: {
        'htmlButton': 'htmlButton',
        'htmlSubmit': 'htmlButton',
        'htmlReset': 'htmlButton',
        'button': 'button',
        'submit': 'submitButton',
        'reset': 'resetButton',
        'image': 'imageButton',
        'link': 'linkButton'
    },

    onRender: function() {
        this.$el.on('click', _.bind(this.onClick, this));
    },

    onClick: function() {
        if (this.options.type === 'submit') {
            this.parentView().trigger('submit', this);
        }

        if (_.isFunction(this.options.click)) {
            this.options.click.call(this);
        }
    },

    getTemplateData: function() {
        return _.extend(this._super(), {
            label: this.options.label || 'Submit',
            index: Jii.widgets.form.FormWidget.getNextIndex()
        });
    }
});


text:
<?php

namespace Google\Service\CloudNaturalLanguage;

class Token extends \Google\Model
{
  protected $dependencyEdgeType = DependencyEdge::class;
  protected $dependencyEdgeDataType = '';
  /**
   * @var string
   */
  public $lemma;
  protected $partOfSpeechType = PartOfSpeech::class;
  protected $partOfSpeechDataType = '';
  protected $textType = TextSpan::class;
  protected $textDataType = '';

  /**
   * @param DependencyEdge
   */
  public function setDependencyEdge(DependencyEdge $dependencyEdge)
  {
    $this->dependencyEdge = $dependencyEdge;
  }
  /**
   * @return DependencyEdge
   */
  public function getDependencyEdge()
  {
    return $this->dependencyEdge;
  }
  /**
   * @param string
   */
  public function setLemma($lemma)
  {
    $this->lemma = $lemma;
  }
  /**
   * @return string
   */
  public function getLemma()
  {
    return $this->lemma;
  }
  /**
   * @param PartOfSpeech
   */
  public function setPartOfSpeech(PartOfSpeech $partOfSpeech)
  {
    $this->partOfSpeech = $partOfSpeech;
  }
  /**
   * @return PartOfSpeech
   */
  public function getPartOfSpeech()
  {
    return $this->partOfSpeech;
  }
  /**
   * @param TextSpan
   */
  public function setText(TextSpan $text)
  {
    $this->text = $text;
  }
  /**
   * @return TextSpan
   */
  public function getText()
  {
    return $this->text;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Token::class, 'Google_Service_CloudNaturalLanguage_Token');


text:
package com.powerdata.openpa.tools.psmfmt;

public enum GeneratingUnit implements VersionedDoc
{
	ID,Name,MinOperatingMW,MaxOperatingMW,GeneratingUnitType,GenControlMode;

	@Override
	public String getVersion() {return "1.10";}
}


text:
package io.requery.cache;

import io.requery.EntityCache;
import io.requery.meta.Attribute;
import io.requery.meta.EntityModel;
import io.requery.meta.Type;
import io.requery.proxy.CompositeKey;
import io.requery.util.ClassMap;

import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheManager;
import javax.cache.configuration.Factory;
import javax.cache.configuration.MutableConfiguration;
import javax.cache.expiry.EternalExpiryPolicy;
import javax.cache.expiry.ExpiryPolicy;
import java.util.Map;
import java.util.Set;

/**
 * Cache using the JSR-107 API.
 *
 * @author Nikhil Purushe
 */
@SuppressWarnings("unchecked")
public class SerializableEntityCache implements EntityCache {

    private final EntityModel model;
    private final CacheManager cacheManager;
    private final ClassMap<Cache<?, ?>> caches;
    private final Factory<ExpiryPolicy> expiryPolicyFactory;

    public SerializableEntityCache(EntityModel model, CacheManager cacheManager) {
        if (cacheManager == null) {
            throw new IllegalArgumentException();
        }
        this.model = model;
        this.cacheManager = cacheManager;
        this.expiryPolicyFactory = EternalExpiryPolicy.factoryOf();
        this.caches = new ClassMap<>();
    }

    protected String getCacheName(Type<?> type) {
        return type.getName();
    }

    protected <K, V> void configure(MutableConfiguration<K, V> configuration) {
        configuration.setExpiryPolicyFactory(expiryPolicyFactory);
    }

    private <T> Class getKeyClass(Type<T> type) {
        Set<Attribute<T, ?>> keys = type.getKeyAttributes();
        Class keyClass;
        if (keys.isEmpty()) {
            // use hash code
            return Integer.class;
        }
        if (keys.size() == 1) {
            Attribute<?, ?> attribute = keys.iterator().next();
            if (attribute.isAssociation()) {
                attribute = attribute.getReferencedAttribute().get();
            }
            keyClass = attribute.getClassType();
            if (keyClass.isPrimitive()) {
                if (keyClass == int.class) {
                    keyClass = Integer.class;
                } else if (keyClass == long.class) {
                    keyClass = Long.class;
                }
            }
        } else {
            keyClass = CompositeKey.class;
        }
        return keyClass;
    }

    protected <K, T> Cache<K, SerializedEntity<T>> createCache(String cacheName, Type<T> type) {
        Class keyClass = getKeyClass(type);
        if (keyClass == null) {
            throw new IllegalStateException();
        }
        MutableConfiguration<K, SerializedEntity<T>> configuration =
                new MutableConfiguration<>();

        configuration.setTypes(keyClass, (Class) SerializedEntity.class);
        configure(configuration);
        return cacheManager.createCache(cacheName, configuration);
    }

    private <K, T> Cache<K, SerializedEntity<T>> tryCreateCache(Class<T> type) {
        Type<T> declaredType = model.typeOf(type);
        String cacheName = getCacheName(declaredType);
        Cache<K, SerializedEntity<T>> cache = cacheManager.getCache(cacheName);
        if (cache == null) {
            // try creating it, if failed see if it was already created
            try {
                cache = createCache(cacheName, declaredType);
            } catch (CacheException ce) {
                cache = cacheManager.getCache(cacheName);
                if (cache == null) {
                    throw ce;
                }
            }
        }
        return cache;
    }

    private Cache getCache(Class<?> type) {
        Cache cache;
        synchronized (caches) {
            cache = caches.get(type);
            if (cache == null) {
                Type declaredType = model.typeOf(type);
                String cacheName = getCacheName(declaredType);
                Class keyClass = getKeyClass(declaredType);
                cache = cacheManager.getCache(cacheName, keyClass, SerializedEntity.class);
            }
        }
        return cache;
    }

    @Override
    public <T> T get(Class<T> type, Object key) {
        Cache cache = getCache(type);
        if (cache != null && cache.isClosed()) {
            cache = null;
        }
        if (cache != null) {
            SerializedEntity container = (SerializedEntity) cache.get(key);
            if (container != null) {
                return type.cast(container.getEntity());
            }
        }
        return null;
    }

    @Override
    public <T> void put(Class<T> type, Object key, T value) {
        Cache<Object, SerializedEntity<T>> cache;
        synchronized (caches) {
            cache = getCache(type);
            if (cache == null) {
                cache = tryCreateCache(type);
            }
        }
        cache.put(key, new SerializedEntity<>(type, value));
    }

    @Override
    public boolean contains(Class<?> type, Object key) {
        Cache cache = getCache(type);
        return cache != null && !cache.isClosed() && cache.containsKey(key);
    }

    @Override
    public void invalidate(Class<?> type) {
        Cache cache = getCache(type);
        if (cache != null) {
            cache.clear();
            String cacheName = getCacheName(model.typeOf(type));
            cacheManager.destroyCache(cacheName);
            synchronized (caches) {
                caches.remove(type);
            }
            cache.close();
        }
    }

    @Override
    public void invalidate(Class<?> type, Object key) {
        Cache cache = getCache(type);
        if (cache != null && !cache.isClosed()) {
            cache.remove(key);
        }
    }

    @Override
    public void clear() {
        synchronized (caches) {
            for (Map.Entry<Class<?>, Cache<?, ?>> entry : caches.entrySet()) {
                invalidate(entry.getKey());
            }
        }
    }
}


text:
package com.baidu.oped.apm.profiler.modifier.redis.interceptor;

import java.util.HashMap;
import java.util.Map;

import com.baidu.oped.apm.bootstrap.interceptor.SimpleAroundInterceptor;
import com.baidu.oped.apm.bootstrap.interceptor.TargetClassLoader;
import com.baidu.oped.apm.bootstrap.interceptor.tracevalue.MapTraceValue;
import com.baidu.oped.apm.bootstrap.logging.PLogger;
import com.baidu.oped.apm.bootstrap.logging.PLoggerFactory;

/**
 * Jedis pipeline (redis client) setClient method interceptor
 *
 * @author jaehong.kim
 *
 */
public class JedisPipelineSetClientMethodInterceptor implements SimpleAroundInterceptor, TargetClassLoader {
    private final PLogger logger = PLoggerFactory.getLogger(this.getClass());
    private final boolean isDebug = logger.isDebugEnabled();

    @Override
    public void before(Object target, Object[] args) {
        if (isDebug) {
            logger.beforeInterceptor(target, args);
        }

        // check trace endPoint
        if (!(target instanceof MapTraceValue) || !(args[0] instanceof MapTraceValue)) {
            return;
        }

        // first arg is redis.clients.jedis.Client
        final Map<String, Object> clientTraceValue = ((MapTraceValue) args[0]).__getTraceBindValue();
        if (clientTraceValue == null) {
            return;
        }

        final Map<String, Object> traceValue = new HashMap<String, Object>();
        traceValue.put("endPoint", clientTraceValue.get("endPoint"));
        ((MapTraceValue) target).__setTraceBindValue(traceValue);
    }

    @Override
    public void after(Object target, Object[] args, Object result, Throwable throwable) {
    }
}


text:
package com.app.gmm.mobileplyer.activity;

import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.widget.FrameLayout;
import android.widget.RadioGroup;

import com.app.gmm.mobileplyer.R;
import com.app.gmm.mobileplyer.basepager.BasePager;
import com.app.gmm.mobileplyer.fragment.AudioFragment;
import com.app.gmm.mobileplyer.fragment.NetAudioFragment;
import com.app.gmm.mobileplyer.fragment.NetVideoFragment;
import com.app.gmm.mobileplyer.fragment.VideoFragment;
import com.app.gmm.mobileplyer.pager.AudioPager;
import com.app.gmm.mobileplyer.pager.NetAudioPager;
import com.app.gmm.mobileplyer.pager.NetVideoPager;
import com.app.gmm.mobileplyer.pager.VideoPager;

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

/**
 * Created by gmm on 2017/2/16.
 * 主页面
 */

public class MainActivity extends FragmentActivity {
    private FrameLayout fl_main_content;

    private RadioGroup mRadioGroup;

    private List<Fragment> mPagers;

    private int position; // 选中的位置
    private BasePager mBasePager;

    /**
     * 上次切换的Fragment
     */
    private Fragment mContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        fl_main_content = (FrameLayout) findViewById(R.id.fl_main_content);
        mRadioGroup = (RadioGroup) findViewById(R.id.rg_bottom_tag);

        mPagers = new ArrayList<>();
        mPagers.add(new VideoFragment(new VideoPager(this)));
        mPagers.add(new AudioFragment(new AudioPager(this)));
        mPagers.add(new NetVideoFragment(new NetVideoPager(this)));
        mPagers.add(new NetAudioFragment(new NetAudioPager(this)));

        // 设置radioGroup的监听
        mRadioGroup.setOnCheckedChangeListener(new MyOnCheckedChangeListener());
        mRadioGroup.check(R.id.rb_video); // 默认选中页面
    }

    class MyOnCheckedChangeListener implements RadioGroup.OnCheckedChangeListener {

        @Override
        public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
            switch (checkedId) {
                default:
                    position = 0;
                    break;
                case R.id.rb_video:
                    position = 0;
                    break;
                case R.id.rb_audio:
                    position = 1;
                    break;
                case R.id.rb_netvideo:
                    position = 2;
                    break;
                case R.id.rb_netaudio:
                    position = 3;
                    break;
            }
            // 设置Fragment
//            setFragment();
            //根据位置得到对应的Fragment
            Fragment to = getFragment();
            //替换
            switchFrament(mContent, to);
        }
    }

    /**
     * 根据位置得到对应的Fragment
     *
     * @return
     */
    private Fragment getFragment() {
        Fragment fragment = mPagers.get(position);
        return fragment;
    }

    /**
     * 设置Fragment
     */
   /* private void setFragment() {
        FragmentManager manager = getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        transaction.replace(R.id.fl_main_content, mPagers.get(position));
        transaction.commit();
    }*/

    /**
     * @param from 刚显示的Fragment,马上就要被隐藏了
     * @param to   马上要切换到的Fragment,一会要显示
     */
    private void switchFrament(Fragment from, Fragment to) {
        if (from != to) {
            mContent = to;
            FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
            //才切换
            //判断有没有被添加
            if (!to.isAdded()) {
                //to没有被添加
                //from隐藏
                if (from != null) {
                    ft.hide(from);
                }
                //添加to
                if (to != null) {
                    ft.add(R.id.fl_main_content, to).commit();
                }
            } else {
                //to已经被添加
                // from隐藏
                if (from != null) {
                    ft.hide(from);
                }
                //显示to
                if (to != null) {
                    ft.show(to).commit();
                }
            }
        }
    }
}


text:
import { inject, TestBed } from '@angular/core/testing';
import { FeedbackService } from './feedback.service';

describe('User', () => {
  beforeEach(() => TestBed.configureTestingModule({
    providers: [
      FeedbackService
    ]}));

});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Problem_1_PHP_Variables
{
    class Program
    {
        static void Main()
        {
            string phpCode = ReadInput();
            List<string> variables = FindVariables(phpCode);
            WriteVariables(variables);
        }

        static string ReadInput()
        {
            StringBuilder inputData = new StringBuilder();
            while (true)
            {
                string line = Console.ReadLine().Trim(); // optimization: trimming redundant whitespace characters
                inputData.AppendLine(line);
                if (line == "?>") break; // Last line
            }
            return inputData.ToString();
        }

        static bool isValidVariableChar(char c)
        {
            if (c >= 'a' && c <= 'z') return true;
            if (c >= 'A' && c <= 'Z') return true;
            if (c >= '0' && c <= '9') return true;
            if (c == '_') return true;
            return false;
        }

        static List<string> FindVariables(string phpCode)
        {
            List<string> variables = new List<string>();

            bool isInOneLineComment = false;
            bool isInMultiLineComment = false;
            bool isInSingleQuoteString = false;
            bool isInDoubleQuoteString = false;
            bool isInVariableName = false;
            StringBuilder variableName = new StringBuilder();

            char ch;
            for (int i = 0; i < phpCode.Length; i++)
			{
                ch = phpCode[i];
                if (isInMultiLineComment)
                {
                    // End of multi-line comment
                    if (ch == '*' && phpCode[i + 1] == '/')
                    {
                        isInMultiLineComment = false;
                        i++;
                        continue;
                    }
                    else
                    {
                        // Comment continues, the code is ignored
                        continue;
                    }
                }
                if (isInOneLineComment)
                {
                    // End of one-line comment
                    if (ch == '\n')
                    {
                        isInOneLineComment = false;
                        continue;
                    }
                    else
                    {
                        // Comment continues, the code is ignored
                        continue;
                    }
                }
                if (isInVariableName)
                {
                    if (isValidVariableChar(ch))
                    {
                        // continuing with the current variable
                        variableName.Append(ch);
                    }
                    else
                    {
                        // the variable name ends here
                        string newVariable = variableName.ToString();
                        if (newVariable.Length > 0 && !variables.Contains(newVariable))
                        {
                            // adding only if unique name
                            variables.Add(newVariable);
                        }
                        isInVariableName = false;
                        variableName.Clear();
                    }
                }
                if (isInSingleQuoteString)
                {
                    if (ch == '\'')
                    {
                        // End of the single quoted string
                        isInSingleQuoteString = false;
                        continue;
                    }
                }
                if (isInDoubleQuoteString)
                {
                    if (ch == '\"')
                    {
                        // End of the double quoted string
                        isInDoubleQuoteString = false;
                        continue;
                    }
                }
                if (!isInDoubleQuoteString && !isInSingleQuoteString) // not in a string
                {
                    if (ch == '#')
                    {
                        isInOneLineComment = true;
                        continue;
                        // Start one-line comment (#...)
                    }
                    if (ch == '/' && phpCode[i + 1] == '/')
                    {
                        // Start one-line comment (//...)
                        i++;
                        isInOneLineComment = true;
                        continue;
                    }
                    if (ch == '/' && phpCode[i + 1] == '*')
                    {
                        // Start multi-line comment
                        i++;
                        isInMultiLineComment = true;
                        continue;
                    }
                }
                else // in a string
                {
                    if (ch == '\\')
                    {
                        // Escaping character and moving to the next.
                        // We actually don't need it so we are moving on with i++
                        i++;
                        continue;
                    }
                }
                if (ch == '\"')
                {
                    isInDoubleQuoteString = true;
                    continue;
                }
                if (ch == '\'')
                {
                    isInSingleQuoteString = true;
                    continue;
                }
                if (ch == '$')
                {
                    // We are here only when we really have a variable starting here
                    isInVariableName = true;
                    continue;
                }
            }

            return variables;
        }

        static void WriteVariables(List<string> variables)
        {
            Console.WriteLine(variables.Count);
            variables.Sort(StringComparer.Ordinal);
            foreach (string variable in variables)
            {
                Console.WriteLine(variable);
            }
        }
    }
}


text:
<?php
class Kwc_List_ChildPages_Teaser_Trl_Controller extends Kwc_List_ChildPages_Teaser_Controller
{
    protected $_model = 'Kwc_List_ChildPages_Teaser_Trl_AdminModel';

    public function preDispatch()
    {
        parent::preDispatch();
        $this->_getModel()->setComponentId($this->_getParam('componentId'));
    }

    protected function _getSelect()
    {
        $ret = Kwf_Controller_Action_Auto_Kwc_Grid::_getSelect();
        return $ret;
    }
}


text:
class NameData
	attr_reader :name

	def initialize
		@name = "Caitlin"
	end

end

class Greeting
	def initialize
		@first_name = NameData.new
	end

	def print_greeting
			puts "Welcome, #{@first_name.name}, to DBC!"
		end
end

greeting = Greeting.new
greeting.print_greeting

# # Reflection
# Release 1
# What are these methods doing?
# Starting with initialize the program runs through defined methods so that the game will present the information.
# How are they modifying or returning the value of instance variables?
# the methods use instance variables to return a profile for Kim.

# Release 2
# What changed between the last release and this release?
# what_is_age is used in release_1 and not in release_2
# What was replaced?
# In release 2 is it not used.
# Is this code simpler than the last?
# Release 2 is easier to read because a method was eliminated so the code is shorter and more concise.

# Release 3
# What changed between the last release and this release?
# attr_reader :age and attr_writer :age are used in release 3.
# What was replaced?
# They replaced what_is_age and change_my_age.
# Is this code simpler than the last?
# the two methods that were replaced are much shorter so the code looks simpler and more concise.

# Reflect
# What is a reader method?
# A reader method looks up information.
# What is a writer method?
# A writer method can change a method but does not return the new information.
# What do the attr methods do for you?
# The attr methods eliminate the need to write defined variables out which shortens the code and makes it easier toread.
# Should you always use an accessor to cover your bases? Why or why not?
# Accessor is not necessary if you only want to read information.
# What is confusing to you about these methods?
# I think these methods are great and seem to simplify coding which makes it easier for a beginner like me to read and understand.


text:
package net.tacks_a.ankicard.entity;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;

/**
 * master.xmlのデータ
 *
 * @author tacks_a
 */
@Data
@DatabaseTable(tableName = PointAllocation.TABLE_NAME)
public class PointAllocation implements Serializable {
    public static final String
            TABLE_NAME = "point_allocation",
            ID_COLUMN = "_id",
            NAME_COLUMN = "name",
            FORMULA_COLUMN = "formula",
            POINT_COLUMN = "point",
            ORDER_NO_COLUMN = "order_no",
            UPDATE_DATE_COLUMN = "update_date";
    private static final long serialVersionUID = -3259675166077469144L;
    @DatabaseField(generatedId = true, columnName = ID_COLUMN)
    private int id;
    @DatabaseField(columnName = NAME_COLUMN)
    private String name;
    @DatabaseField(columnName = FORMULA_COLUMN)
    private String formula;
    @DatabaseField(columnName = POINT_COLUMN)
    private int point;
    @DatabaseField(columnName = ORDER_NO_COLUMN)
    private int orderNo;
    @DatabaseField(columnName = UPDATE_DATE_COLUMN)
    private Date updateDate;

}


text:
var PageTransitions = function() {

  var $main, $pages, pagesCount,
    isAnimating = false,
    endCurrPage = false,
    endNextPage = false,
    animEndEventNames = {
      'WebkitAnimation': 'webkitAnimationEnd',
      'MozAnimation': 'animationend', // mozAnimationEnd
      'OAnimation': 'oAnimationEnd',
      'msAnimation': 'MSAnimationEnd',
      'animation': 'animationend'
    },
    // animation end event name
    animEndEventName = animEndEventNames[Modernizr.prefixed('animation')],
    // support css animations
    support = Modernizr.cssanimations;

  function init(main) {
    $main = $(main);
    $pages = $main.children('.pt-page');
    pagesCount = $pages.length;

    $pages.removeClass('pt-page-current').each(function() {
      var $page = $(this);
      $page.data('originalClassList', $page.attr('class'));
    }).eq(0).addClass('pt-page-current');

    $main.get(0).className = $main.get(0).className.replace(/\s*pt-item-\d+\s*/ig, ' ');
    $main.addClass('pt-item-1');
    $main.addClass('pt-first');
    if (pagesCount == 1) {
      $main.addClass('pt-last');
    }
  }

  function gotoPage(animation, page) {
    if (isAnimating) {
      return false;
    }

    isAnimating = true;

    var $currPage = $pages.filter('.pt-page-current');

    if (page == 'prev') {
      page = $currPage.index() - 1;
    } else if (typeof(page) != 'number') {
      page = $currPage.index() + 1;
    }

    if (page < 0) {
      page = pagesCount - 1;
    } else if (page >= pagesCount) {
      page = 0;
    }

    $main.get(0).className = $main.get(0).className.replace(/\s?pt-item-\d+\s?/ig, ' ');
    $main.addClass('pt-item-'+(page+1));

    $main.removeClass('pt-first pt-last');
    if (page == 0) {
      $main.addClass('pt-first');
    }
    if (page == (pagesCount - 1)) {
      $main.addClass('pt-last');
    }

    var $nextPage = $pages.eq(page).addClass('pt-page-current'),
      outClass = '',
      inClass = '';

    switch (animation) {
    case 1:
      outClass = 'pt-page-moveToLeft';
      inClass = 'pt-page-moveFromRight';
      break;
    case 2:
      outClass = 'pt-page-moveToRight';
      inClass = 'pt-page-moveFromLeft';
      break;
    case 3:
      outClass = 'pt-page-moveToTop';
      inClass = 'pt-page-moveFromBottom';
      break;
    case 4:
      outClass = 'pt-page-moveToBottom';
      inClass = 'pt-page-moveFromTop';
      break;
    case 5:
      outClass = 'pt-page-fade';
      inClass = 'pt-page-moveFromRight pt-page-ontop';
      break;
    case 6:
      outClass = 'pt-page-fade';
      inClass = 'pt-page-moveFromLeft pt-page-ontop';
      break;
    case 7:
      outClass = 'pt-page-fade';
      inClass = 'pt-page-moveFromBottom pt-page-ontop';
      break;
    case 8:
      outClass = 'pt-page-fade';
      inClass = 'pt-page-moveFromTop pt-page-ontop';
      break;
    case 9:
      outClass = 'pt-page-moveToLeftFade';
      inClass = 'pt-page-moveFromRightFade';
      break;
    case 10:
      outClass = 'pt-page-moveToRightFade';
      inClass = 'pt-page-moveFromLeftFade';
      break;
    case 11:
      outClass = 'pt-page-moveToTopFade';
      inClass = 'pt-page-moveFromBottomFade';
      break;
    case 12:
      outClass = 'pt-page-moveToBottomFade';
      inClass = 'pt-page-moveFromTopFade';
      break;
    case 13:
      outClass = 'pt-page-moveToLeftEasing pt-page-ontop';
      inClass = 'pt-page-moveFromRight';
      break;
    case 14:
      outClass = 'pt-page-moveToRightEasing pt-page-ontop';
      inClass = 'pt-page-moveFromLeft';
      break;
    case 15:
      outClass = 'pt-page-moveToTopEasing pt-page-ontop';
      inClass = 'pt-page-moveFromBottom';
      break;
    case 16:
      outClass = 'pt-page-moveToBottomEasing pt-page-ontop';
      inClass = 'pt-page-moveFromTop';
      break;
    case 17:
      outClass = 'pt-page-scaleDown';
      inClass = 'pt-page-moveFromRight pt-page-ontop';
      break;
    case 18:
      outClass = 'pt-page-scaleDown';
      inClass = 'pt-page-moveFromLeft pt-page-ontop';
      break;
    case 19:
      outClass = 'pt-page-scaleDown';
      inClass = 'pt-page-moveFromBottom pt-page-ontop';
      break;
    case 20:
      outClass = 'pt-page-scaleDown';
      inClass = 'pt-page-moveFromTop pt-page-ontop';
      break;
    case 21:
      outClass = 'pt-page-scaleDown';
      inClass = 'pt-page-scaleUpDown pt-page-delay300';
      break;
    case 22:
      outClass = 'pt-page-scaleDownUp';
      inClass = 'pt-page-scaleUp pt-page-delay300';
      break;
    case 23:
      outClass = 'pt-page-moveToLeft pt-page-ontop';
      inClass = 'pt-page-scaleUp';
      break;
    case 24:
      outClass = 'pt-page-moveToRight pt-page-ontop';
      inClass = 'pt-page-scaleUp';
      break;
    case 25:
      outClass = 'pt-page-moveToTop pt-page-ontop';
      inClass = 'pt-page-scaleUp';
      break;
    case 26:
      outClass = 'pt-page-moveToBottom pt-page-ontop';
      inClass = 'pt-page-scaleUp';
      break;
    case 27:
      outClass = 'pt-page-scaleDownCenter';
      inClass = 'pt-page-scaleUpCenter pt-page-delay400';
      break;
    case 28:
      outClass = 'pt-page-rotateRightSideFirst';
      inClass = 'pt-page-moveFromRight pt-page-delay200 pt-page-ontop';
      break;
    case 29:
      outClass = 'pt-page-rotateLeftSideFirst';
      inClass = 'pt-page-moveFromLeft pt-page-delay200 pt-page-ontop';
      break;
    case 30:
      outClass = 'pt-page-rotateTopSideFirst';
      inClass = 'pt-page-moveFromTop pt-page-delay200 pt-page-ontop';
      break;
    case 31:
      outClass = 'pt-page-rotateBottomSideFirst';
      inClass = 'pt-page-moveFromBottom pt-page-delay200 pt-page-ontop';
      break;
    case 32:
      outClass = 'pt-page-flipOutRight';
      inClass = 'pt-page-flipInLeft pt-page-delay500';
      break;
    case 33:
      outClass = 'pt-page-flipOutLeft';
      inClass = 'pt-page-flipInRight pt-page-delay500';
      break;
    case 34:
      outClass = 'pt-page-flipOutTop';
      inClass = 'pt-page-flipInBottom pt-page-delay500';
      break;
    case 35:
      outClass = 'pt-page-flipOutBottom';
      inClass = 'pt-page-flipInTop pt-page-delay500';
      break;
    case 36:
      outClass = 'pt-page-rotateFall pt-page-ontop';
      inClass = 'pt-page-scaleUp';
      break;
    case 37:
      outClass = 'pt-page-rotateOutNewspaper';
      inClass = 'pt-page-rotateInNewspaper pt-page-delay500';
      break;
    case 38:
      outClass = 'pt-page-rotatePushLeft';
      inClass = 'pt-page-moveFromRight';
      break;
    case 39:
      outClass = 'pt-page-rotatePushRight';
      inClass = 'pt-page-moveFromLeft';
      break;
    case 40:
      outClass = 'pt-page-rotatePushTop';
      inClass = 'pt-page-moveFromBottom';
      break;
    case 41:
      outClass = 'pt-page-rotatePushBottom';
      inClass = 'pt-page-moveFromTop';
      break;
    case 42:
      outClass = 'pt-page-rotatePushLeft';
      inClass = 'pt-page-rotatePullRight pt-page-delay180';
      break;
    case 43:
      outClass = 'pt-page-rotatePushRight';
      inClass = 'pt-page-rotatePullLeft pt-page-delay180';
      break;
    case 44:
      outClass = 'pt-page-rotatePushTop';
      inClass = 'pt-page-rotatePullBottom pt-page-delay180';
      break;
    case 45:
      outClass = 'pt-page-rotatePushBottom';
      inClass = 'pt-page-rotatePullTop pt-page-delay180';
      break;
    case 46:
      outClass = 'pt-page-rotateFoldLeft';
      inClass = 'pt-page-moveFromRightFade';
      break;
    case 47:
      outClass = 'pt-page-rotateFoldRight';
      inClass = 'pt-page-moveFromLeftFade';
      break;
    case 48:
      outClass = 'pt-page-rotateFoldTop';
      inClass = 'pt-page-moveFromBottomFade';
      break;
    case 49:
      outClass = 'pt-page-rotateFoldBottom';
      inClass = 'pt-page-moveFromTopFade';
      break;
    case 50:
      outClass = 'pt-page-moveToRightFade';
      inClass = 'pt-page-rotateUnfoldLeft';
      break;
    case 51:
      outClass = 'pt-page-moveToLeftFade';
      inClass = 'pt-page-rotateUnfoldRight';
      break;
    case 52:
      outClass = 'pt-page-moveToBottomFade';
      inClass = 'pt-page-rotateUnfoldTop';
      break;
    case 53:
      outClass = 'pt-page-moveToTopFade';
      inClass = 'pt-page-rotateUnfoldBottom';
      break;
    case 54:
      outClass = 'pt-page-rotateRoomLeftOut pt-page-ontop';
      inClass = 'pt-page-rotateRoomLeftIn';
      break;
    case 55:
      outClass = 'pt-page-rotateRoomRightOut pt-page-ontop';
      inClass = 'pt-page-rotateRoomRightIn';
      break;
    case 56:
      outClass = 'pt-page-rotateRoomTopOut pt-page-ontop';
      inClass = 'pt-page-rotateRoomTopIn';
      break;
    case 57:
      outClass = 'pt-page-rotateRoomBottomOut pt-page-ontop';
      inClass = 'pt-page-rotateRoomBottomIn';
      break;
    case 58:
      outClass = 'pt-page-rotateCubeLeftOut pt-page-ontop';
      inClass = 'pt-page-rotateCubeLeftIn';
      break;
    case 59:
      outClass = 'pt-page-rotateCubeRightOut pt-page-ontop';
      inClass = 'pt-page-rotateCubeRightIn';
      break;
    case 60:
      outClass = 'pt-page-rotateCubeTopOut pt-page-ontop';
      inClass = 'pt-page-rotateCubeTopIn';
      break;
    case 61:
      outClass = 'pt-page-rotateCubeBottomOut pt-page-ontop';
      inClass = 'pt-page-rotateCubeBottomIn';
      break;
    case 62:
      outClass = 'pt-page-rotateCarouselLeftOut pt-page-ontop';
      inClass = 'pt-page-rotateCarouselLeftIn';
      break;
    case 63:
      outClass = 'pt-page-rotateCarouselRightOut pt-page-ontop';
      inClass = 'pt-page-rotateCarouselRightIn';
      break;
    case 64:
      outClass = 'pt-page-rotateCarouselTopOut pt-page-ontop';
      inClass = 'pt-page-rotateCarouselTopIn';
      break;
    case 65:
      outClass = 'pt-page-rotateCarouselBottomOut pt-page-ontop';
      inClass = 'pt-page-rotateCarouselBottomIn';
      break;
    case 66:
      outClass = 'pt-page-rotateSidesOut';
      inClass = 'pt-page-rotateSidesIn pt-page-delay200';
      break;
    case 67:
      outClass = 'pt-page-rotateSlideOut';
      inClass = 'pt-page-rotateSlideIn';
      break;
    case 68:
        outClass = 'pt-page-fade-out';
        inClass = 'pt-page-fade-in pt-page-delay400';
        break;
    default:
      outClass = 'pt-page-moveToLeft';
      inClass = 'pt-page-moveFromRight';
      break;
    }

    $currPage.addClass(outClass).on(animEndEventName, function() {
      $currPage.off(animEndEventName);
      endCurrPage = true;
      if (endNextPage) {
        onEndAnimation($currPage, $nextPage);
      }
    });

    $nextPage.addClass(inClass).on(animEndEventName, function() {
      $nextPage.off(animEndEventName);
      endNextPage = true;
      if (endCurrPage) {
        onEndAnimation($currPage, $nextPage);
      }
    });

    if (!support) {
      onEndAnimation($currPage, $nextPage);
    }
  }

  function onEndAnimation($outpage, $inpage) {
    endCurrPage = false;
    endNextPage = false;
    resetPage($outpage, $inpage);
    isAnimating = false;
  }

  function resetPage($outpage, $inpage) {
    $outpage.attr('class', $outpage.data('originalClassList'));
    $inpage.attr('class', $inpage.data('originalClassList') + ' pt-page-current');
  }

  return {
    init: init,
    gotoPage: gotoPage
  };

};


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.10.22 at 03:51:28 PM IST
//

package com.pacificmetrics.saaif.item1;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

/**
 *
 *     Define the Event type.
 *     Visual effects applied to the region when a specific mouse event occurs.
 *
 *
 *
Java class for EventType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="EventType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="Styles" type="{http://www.smarterapp.org/xsd/saaif/v1p0/assessmentitem_v1p0.xsd}StylesType"/>
 *         <element name="Image" type="{http://www.smarterapp.org/xsd/saaif/v1p0/assessmentitem_v1p0.xsd}ImageType"/>
 *       </sequence>
 *       <attribute name="name" use="required">
 *         <simpleType>
 *           <restriction base="{http://www.w3.org/2001/XMLSchema}token">
 *             <enumeration value="select"/>
 *             <enumeration value="unselect"/>
 *             <enumeration value="hover"/>
 *           </restriction>
 *         </simpleType>
 *       </attribute>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EventType", propOrder = {
    "styles",
    "image"
})
public class EventType {

    @XmlElement(name = "Styles", required = true)
    protected StylesType styles;
    @XmlElement(name = "Image", required = true)
    protected ImageType image;
    @XmlAttribute(name = "name", required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String name;

    /**
     * Gets the value of the styles property.
     *
     * @return
     *     possible object is
     *     {@link StylesType }
     *
     */
    public StylesType getStyles() {
        return styles;
    }

    /**
     * Sets the value of the styles property.
     *
     * @param value
     *     allowed object is
     *     {@link StylesType }
     *
     */
    public void setStyles(StylesType value) {
        this.styles = value;
    }

    /**
     * Gets the value of the image property.
     *
     * @return
     *     possible object is
     *     {@link ImageType }
     *
     */
    public ImageType getImage() {
        return image;
    }

    /**
     * Sets the value of the image property.
     *
     * @param value
     *     allowed object is
     *     {@link ImageType }
     *
     */
    public void setImage(ImageType value) {
        this.image = value;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

}


text:
create unique index	CUSTOMER_NK		ON DIMENSIONS.CUSTOMER(C_NAME);
create index		DATE_DIM_FULL_DATE	ON DIMENSIONS.DATE_DIM(FULL_DATE);
create unique index	EVENT_TYPE_NK		ON DIMENSIONS.EVENT_TYPE(EVENT_TYPE);
create unique index	NAMED_FILTER_UNIQUE	ON APPLICATION.NAMED_FILTER(NAME, MODEL);
create unique index	NAMED_FILTER_USERS_UNIQUE ON APPLICATION.NAMED_FILTER_USERS(USERNAME);
create unique index	NATION_PK		ON DIMENSIONS.NATION(N_NATIONKEY);
create unique index	OBJECT_NK		ON DIMENSIONS.OBJECT(OBJECT_TYPE, OBJECT_ID_NAME, OBJECT_ID_VALUE);
create unique index	PART_NK			ON DIMENSIONS.PART(P_NAME);
create unique index	REGION_NK		ON DIMENSIONS.REGION(R_NAME);
create unique index	SUPPLIER_NK		ON DIMENSIONS.SUPPLIER(S_NAME);
create index		ZION_NATKEY_INDEX	ON DIMENSIONS.ZIONTRACKING(BANK, ACCOUNT, TRANSACTIONTYPE, DATESTAMP);


text:
The web module of [Fractal](http://github.com/frctl/fractal).

[![NPM Version](https://img.shields.io/npm/v/@frctl/web)](https://www.npmjs.com/package/@frctl/web)

## License

[MIT](https://github.com/frctl/fractal/blob/main/LICENSE)


text:
package org.grub4android.grubmanager;

public class Pointer<E> {
    public E val;

    public Pointer(E e) {
        val = e;
    }
}


text:
package forces;

import java.io.File;

import jboxGlue.PhysicalObject;

import parser.EnvironmentParser;

/**
 * Abstract superclass for all types of forces; the applyForce(PhysicalObject o)
 * method is to be implemented by each subclass as per the nature of that subclass.
 *
 * This class also initiates the environment.xml parser file, which subclasses
 * use to extract information relevant to them, and includes several useful
 * mathematical functions, and sets a scaling double for the magnitudes of the
 * forces used (for testing purposes).
 *
 * I also chose to refrain from making toggleForce() an inherited method for all
 * subclasses to use, because each subclass has its own private static myApplyForce
 * boolean variable, and creating an inherited toggleForce() method would have
 * made toggleForce toggle all subclass booleans at once.
 *
 * @author Grace
 *
 */

public abstract class Force {

	private static float scale = 1f;	//can be changed; this scale factor was used
										//to test forces

	protected File myFile = new File("environment.xml");
	EnvironmentParser myEnvironmentParser = new EnvironmentParser(myFile);

	public double convertDegreesToRadians(double degree) {
		return degree * (Math.PI/180d);
	}

	public double calcDistance(double x1, double x2, double y1, double y2) {
		return Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));
	}

	/**
	 * calculate the distance between point x and point y.
	 * @param x starting point
	 * @param y ending point
	 * @return distance
	 */
	public double calcDistance(double x, double y) {
		return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
	}

	public static double getScale() {
		return scale;
	}

	/**
	 * The abstract method applyForce, which takes in a PhysicalObject
	 * as a parameter, will calculate a force vector of the respective
	 * force using distance, speed, direction, and/or magnitude,
	 * and will apply the resulting vector of that respective force
	 * on the PhysicalObject.
	 *
	 * @param PhysicalObject o
	 */
	public abstract void applyForce(PhysicalObject o);

}


text:
{% extends "base.html" %}
{% load staticfiles %}

{% block title %}<title>Login page</title>{% endblock title %}

{% block blog_title %}

Login page

Hint username: admin; password: 1

{% endblock %}

{% block content %}
<form action="/login/" method="post">
    {% csrf_token %}
    {{ form.non_field_errors }}

        {{ form.username.errors }}
        Username
        {{ form.username }}

        {{ form.password.errors }}
        Password
        {{ form.password }}

    <button type="submit" class="btn btn-default">Login</button>
</form>
{% endblock %}


text:
require 'spec_helper'

describe 'hiera' do
  let(:facts) do
    { :puppet_version => '3.7.1', }
  end
  describe 'default params' do
    it { should compile.with_all_deps }
  end
  describe 'eyaml param' do
    let(:params) { { :eyaml => true }}
    it { should contain_class("hiera::eyaml") }
  end
end


text:
package restaurant.restaurant_jerryweb;

import java.util.ArrayList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Semaphore;

import restaurant.intermediate.RestaurantCookRole;
import restaurant.restaurant_jerryweb.gui.Menu;
import restaurant.restaurant_jerryweb.interfaces.Market;
import restaurant.restaurant_jerryweb.interfaces.Waiter;
import base.BaseRole;
import base.ContactList;
import base.Item;
import base.Item.EnumItemType;
import base.Location;
import base.interfaces.Person;
import city.gui.trace.AlertTag;

/**
 * Restaurant Cook Agent
 */
public class JerrywebCookRole extends BaseRole {
	public RestaurantCookRole mRole;
	static final int semaphoreCerts = 0;
	public List<Order> Orders= Collections.synchronizedList(new ArrayList<Order>());
	public List<Order>  RevolvingStandOrders = Collections.synchronizedList(new ArrayList<Order>());
	public List<Food> foodItems= new ArrayList<Food>();
	//public Map<EnumItemType, Integer> mItemsDesired = new HashMap<EnumItemType, Integer>();
	Timer cookingTimer = new Timer();
	private Timer checkRevolvingStand = new Timer();
	public List<Waiter> Waiters = new ArrayList<Waiter>();
	public Menu m = new Menu();
	public Map<String,Food> foodMap = new HashMap<String,Food>(4);
	public Map<EnumItemType,Integer> mCookTimes = new HashMap<EnumItemType, Integer>();
	public List<Market> markets = new ArrayList<Market>();
	int selection = 0;
	private boolean orderSent = false;
	int baseNeed = 10;

	public class Order{
		Waiter w;

		String choice;
		int table;
		OrderState s;
		public Order(Waiter waiter, String custOrder, int t, OrderState orderS){
			w = waiter;
			choice = custOrder;
			table = t;
			s = orderS;
		}

	}

	public enum OrderState
	{pending, cooking, done, waitingForWaiter, giveToWaiter, served, needToRestock, restocking}

	public class Food {
		String type;
		int cookingTimes;
		int amount;
		int low;
		int capacity;
		FoodState s;

		public Food(String foodType, FoodState state, int timeToCook, int cap, int quantity, int l){
			type = foodType;
			cookingTimes = timeToCook;
			amount = quantity;
			low = l;
			capacity = cap;
			s = state;
		}
	}

	public enum FoodState
	{ordered, delivered}

	private String name;
	@SuppressWarnings("unused")
	private Semaphore atTable = new Semaphore(semaphoreCerts,true);

	public JerrywebCookRole(Person p, RestaurantCookRole r){
		super(p);
		mRole = r;
		this.name = "JerrywebCook";

        mCookTimes.put(EnumItemType.STEAK,17000);
        mCookTimes.put(EnumItemType.CHICKEN,12000);
        mCookTimes.put(EnumItemType.SALAD,2000);
        mCookTimes.put(EnumItemType.PIZZA,14000);

        checkRevolvingStand.scheduleAtFixedRate(checkRS, 15000, 10000);
	}

	TimerTask checkRS = new TimerTask(){
		public void run(){
			if(mPerson != null){
				moveRevlovingStandOrders();
			}
		}
	};

	public String getMaitreDName() {
		return name;
	}

	public String getName() {
		return name;
	}

	public void addWaiter(Waiter w){
		Waiters.add(w);
	}

	// Messages
	public void msgOutOfStock(Market market, String choice){
		synchronized(Orders){
		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).choice.equals(choice) && Orders.get(i).s == OrderState.needToRestock){

				if(selection == 2){
					//print("Iterated through all the markets...");
					selection = 0;
				}
				selection++;
				//Orders.remove(i);

			}
		}
		}
		stateChanged();
	}

	public void msgHereIsOrder(String choice, Map<String, Food> fm){
		synchronized(Orders){
		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).choice.equals(choice) && Orders.get(i).s == OrderState.restocking){
				foodMap = fm;

				Orders.remove(i);
				stateChanged();
				orderSent = false;
				break;
			}
		}
		}
	}

	public void msgCookThis(Waiter w, String choice, int table){
		//Orders.choice = m.menuItems.get(choice);
		if(choice.equals("nothing")){

		}
		else{
			Orders.add(new Order(w, choice, table, OrderState.pending));

		stateChanged();}

	}

	public void msgfoodDone(Order order){

		order.s = OrderState.done;
		stateChanged();
	}

	public void msgGiveMeOrder(int t){
		synchronized(Orders){
		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).table == t){
				Orders.get(i).s = OrderState.giveToWaiter;
				stateChanged();
			}
		}
		}
	}
	/**
	 * Scheduler.  Determine what action is called for, and do it.
	 */
	public boolean pickAndExecuteAnAction() {
		try{
		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).s == OrderState.needToRestock){
				OrderFood(i);
				return true;
			}

		}

		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).s == OrderState.pending){
				TryToCookIt(Orders.get(i), i);
				return true;
			}

		}

		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).s == OrderState.done){
				plateIt(Orders.get(i));
				return true;
			}
		}

		for(int i=0; i<Orders.size(); i++){
			if(Orders.get(i).s == OrderState.giveToWaiter){
				giveFoodToWaiter(Orders.get(i), i);//cookIt(Orders.get(i));
				return true;
			}

		}

		checkInventory();//comment this out to prevent the cook from checking his inventory
		return false;
		}
		catch (ConcurrentModificationException e) {

			return false;
		}
	}

	// Actions

	public void moveRevlovingStandOrders(){
		for(int i = 0; i < RevolvingStandOrders.size(); i++){
			Orders.add(RevolvingStandOrders.get(i));
			RevolvingStandOrders.remove(i);
		}
	}

	public void checkInventory(){//This checks the inventory while the waiter is idle
		//print("my inventory " + foodMap.foodMap.get("steak").amount)
		/*for(int i = 0; i <4; i++){
			if(mItemInventory.get(i) <= mItemInventory.get(i){
				markets.get(selection).msgGiveMeOrder(m.menuItems.get(i), foodMap);
				break;
			}

		}
		if(selection == 2){
			selection = 0;
		}
		selection++;*/
	}

	public void OrderFood(int x){
		if(!orderSent){
			orderSent = true;
			markets.get(selection).msgGiveMeOrder(Orders.get(x).choice, foodMap);
			Orders.get(x).s = OrderState.restocking;
		//Orders.remove(x);
			//print("Ordering food");
		}
	}

	private void plateIt(Order order) {
		//print("" + order.choice + " is ready");
		order.w.msgOrderReady(order.choice, order.table);
		order.s = OrderState.waitingForWaiter;
	}

	public void giveFoodToWaiter(Order order, int x){
		//print("Here is the " + order.choice + " for table " + order.table);
		order.s = OrderState.served;
		order.w.msgTakeFood(order.choice, order.table);
	}

	public void TryToCookIt(Order order, int orderLocation){
		EnumItemType food = Item.stringToEnum(order.choice);
		print("" + food);
		if(mRole.mItemInventory.get(food) == 0){
			//Do("Out of choice " + order.choice);
			Orders.get(orderLocation).w.msgOutOfFood(Orders.get(orderLocation).choice, Orders.get(orderLocation).table);
			//Orders.get(orderLocation).s = OrderState.needToRestock;
			Orders.remove(order);
			mRole.mItemsDesired.put(food,baseNeed);
			 return;
		}

		else{
			int cookTime = 0;
			final int  orderLocationFinal = orderLocation;
			cookTime = mCookTimes.get(food);
			mRole.decreaseInventory(food);

			cookingTimer.schedule(new TimerTask() {
				public void run() {
					//DoCooking(order); // animation for cooking
					cookingTimes(orderLocationFinal);
					}
				},
				cookTime);
			Orders.get(orderLocationFinal).s = OrderState.cooking;
			//foodMap.get(Orders.get(orderLocation)
		}
	}

	public void cookingTimes(final int orderLoc){//calls the food done message to change the state of the corresponding order
		//print("the ordering list is of size: " + Orders.size());
		this.msgfoodDone(Orders.get(orderLoc));

	}
	/*
	public void addMarketOutOfItem(Market m) {
        outOfItem.add(m);
	}*/

	// The animation DoXYZ() routines

	//utilities

	public void addToRevolvingStand(Waiter w,String custOrder, int t, OrderState orderS){
		RevolvingStandOrders.add(new Order(w, custOrder,  t, orderS));
	}

	public void addMarket(Market market){
		//print("Adding " + market.getName());
		markets.add(market);
	}

	@Override
	public Location getLocation() {
		return ContactList.cRESTAURANT_LOCATIONS.get(2);
	}

	public void Do(String msg) {
		super.Do(msg, AlertTag.R2);
	}

	public void print(String msg) {
		super.print(msg, AlertTag.R2);
	}

	public void print(String msg, Throwable e) {
		super.print(msg, AlertTag.R2, e);
	}
}


text:
<?php

namespace mageekguy\atoum\tests\units\asserters;

use
	mageekguy\atoum,
	mageekguy\atoum\asserter,
	mageekguy\atoum\tools\variable
;

require_once __DIR__ . '/../../runner.php';

class error extends atoum\test
{
	public function testClass()
	{
		$this->testedClass->extends('mageekguy\atoum\asserter');
	}

	public function test__construct()
	{
		$this
			->given($this->newTestedInstance)
			->then
				->object($this->testedInstance->getGenerator())->isEqualTo(new asserter\generator())
				->object($this->testedInstance->getAnalyzer())->isEqualTo(new variable\analyzer())
				->object($this->testedInstance->getLocale())->isEqualTo(new atoum\locale())
				->object($this->testedInstance->getScore())->isInstanceOf('mageekguy\atoum\test\score')
				->variable($this->testedInstance->getMessage())->isNull()
				->variable($this->testedInstance->getType())->isNull()

			->given($this->newTestedInstance($generator = new asserter\generator(), $score = new atoum\test\score(), $locale = new atoum\locale()))
			->then
				->object($this->testedInstance->getGenerator())->isIdenticalTo($generator)
				->object($this->testedInstance->getAnalyzer())->isEqualTo(new variable\analyzer())
				->object($this->testedInstance->getLocale())->isIdenticalTo($locale)
				->object($this->testedInstance->getScore())->isIdenticalTo($score)
				->variable($this->testedInstance->getMessage())->isNull()
				->variable($this->testedInstance->getType())->isNull()
		;
	}

	public function testInitWithTest()
	{
		$this
			->if($this->newTestedInstance)
			->then
				->object($this->testedInstance->setWithTest($this))->isTestedInstance
				->object($this->testedInstance->getScore())->isIdenticalTo($this->getScore())
		;
	}

	public function testGetAsString()
	{
		$this
			->string(atoum\asserters\error::getAsString(E_ERROR))->isEqualTo('E_ERROR')
			->string(atoum\asserters\error::getAsString(E_WARNING))->isEqualTo('E_WARNING')
			->string(atoum\asserters\error::getAsString(E_PARSE))->isEqualTo('E_PARSE')
			->string(atoum\asserters\error::getAsString(E_NOTICE))->isEqualTo('E_NOTICE')
			->string(atoum\asserters\error::getAsString(E_CORE_ERROR))->isEqualTo('E_CORE_ERROR')
			->string(atoum\asserters\error::getAsString(E_CORE_WARNING))->isEqualTo('E_CORE_WARNING')
			->string(atoum\asserters\error::getAsString(E_COMPILE_ERROR))->isEqualTo('E_COMPILE_ERROR')
			->string(atoum\asserters\error::getAsString(E_COMPILE_WARNING))->isEqualTo('E_COMPILE_WARNING')
			->string(atoum\asserters\error::getAsString(E_USER_ERROR))->isEqualTo('E_USER_ERROR')
			->string(atoum\asserters\error::getAsString(E_USER_WARNING))->isEqualTo('E_USER_WARNING')
			->string(atoum\asserters\error::getAsString(E_USER_NOTICE))->isEqualTo('E_USER_NOTICE')
			->string(atoum\asserters\error::getAsString(E_STRICT))->isEqualTo('E_STRICT')
			->string(atoum\asserters\error::getAsString(E_RECOVERABLE_ERROR))->isEqualTo('E_RECOVERABLE_ERROR')
			->string(atoum\asserters\error::getAsString(E_DEPRECATED))->isEqualTo('E_DEPRECATED')
			->string(atoum\asserters\error::getAsString(E_USER_DEPRECATED))->isEqualTo('E_USER_DEPRECATED')
			->string(atoum\asserters\error::getAsString(E_ALL))->isEqualTo('E_ALL')
			->string(atoum\asserters\error::getAsString('unknown error'))->isEqualTo('UNKNOWN')
		;
	}

	public function testSetWith()
	{
		$this
			->if($this->newTestedInstance)
			->then
				->object($this->testedInstance->setWith(null, null))->isTestedInstance
				->variable($this->testedInstance->getMessage())->isNull()
				->variable($this->testedInstance->getType())->isNull()

				->object($this->testedInstance->setWith($message = uniqid(), null))->isTestedInstance
				->string($this->testedInstance->getMessage())->isEqualTo($message)
				->variable($this->testedInstance->getType())->isNull()

				->object($this->testedInstance->setWith($message = uniqid(), $type = rand(0, PHP_INT_MAX)))->isTestedInstance
				->string($this->testedInstance->getMessage())->isEqualTo($message)
				->integer($this->testedInstance->getType())->isEqualTo($type)
		;
	}

	public function testExists()
	{
		$this
			->given($asserter = $this->newTestedInstance)

			->if(
				$asserter->setLocale($locale = new \mock\atoum\locale()),
				$this->calling($locale)->_ = $errorNotExists = uniqid()
			)
			->then
				->exception(function() use (& $line, $asserter) { $asserter->exists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorNotExists)
				->mock($locale)->call('_')->withArguments('error does not exist')->once
				->exception(function() use (& $line, $asserter) { $asserter->exists; })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorNotExists)
				->mock($locale)->call('_')->withArguments('error does not exist')->twice

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(0, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->object($asserter->exists())->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(0, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->object($asserter->exists)->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()

			->if($asserter->setWith($message = uniqid(), null))
			->then
				->exception(function() use (& $line, $asserter) { $asserter->exists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorNotExists)
				->mock($locale)->call('_')->withArguments('error with message \'%s\' does not exist', $message)->once

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(0, PHP_INT_MAX), $message, uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->object($asserter->exists())->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()

			->if($asserter->setWith($message = uniqid(), $type = E_USER_ERROR))
			->then
				->exception(function() use (& $line, $asserter) { $line = __LINE__; $asserter->exists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorNotExists)
				->mock($locale)->call('_')->withArguments('error of type %s with message \'%s\' does not exist', atoum\asserters\error::getAsString($type), $message)->once

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type, $message, uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->object($asserter->exists())->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()

			->if($asserter->setWith(null, $type = E_USER_ERROR))
			->then
				->exception(function() use (& $line, $asserter) { $line = __LINE__; $asserter->exists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorNotExists)
				->mock($locale)->call('_')->withArguments('error of type %s does not exist', atoum\asserters\error::getAsString($type))->once

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->object($asserter->exists())->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), $message = uniqid() . 'FOO' . uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->and($asserter->withPattern('/FOO/')->withType(null))
			->then
				->object($asserter->exists())->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()
		;
	}

	public function testNotExists()
	{
		$this
			->given($asserter = $this->newTestedInstance)

			->if(
				$asserter->setLocale($locale = new \mock\atoum\locale()),
				$this->calling($locale)->_ = $errorExists = uniqid()
			)
			->then
				->object($asserter->notExists())->isTestedInstance
				->object($asserter->notExists)->isTestedInstance
				->array($asserter->getScore()->getErrors())->isEmpty()

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(0, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->exception(function() use (& $line, $asserter) { $asserter->notExists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error exists')->once
				->exception(function() use (& $line, $asserter) { $asserter->notExists; })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error exists')->twice

			->if($asserter->setWith($message = uniqid(), null))
			->then
				->exception(function() use (& $line, $asserter) { $asserter->exists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error with message \'%s\' does not exist', $message)->once

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(0, PHP_INT_MAX), $message, uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->exception(function() use (& $line, $asserter) { $asserter->notExists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error with message \'%s\' exists')->once
				->exception(function() use (& $line, $asserter) { $asserter->notExists; })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error with message \'%s\' exists')->twice
				->array($asserter->getScore()->getErrors())->isNotEmpty()

			->if($asserter->setWith($message = uniqid(), $type = E_USER_ERROR))
			->then
				->object($asserter->notExists())->isTestedInstance
				->object($asserter->notExists)->isTestedInstance
				->array($asserter->getScore()->getErrors())->isNotEmpty()

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type, $message, uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->exception(function() use (& $line, $asserter) { $line = __LINE__; $asserter->notExists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error of type %s with message \'%s\' exists', atoum\asserters\error::getAsString($type), $message)->once

			->if($asserter->setWith(null, $type = E_USER_ERROR))
			->then
				->exception(function() use (& $line, $asserter) { $line = __LINE__; $asserter->notExists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error of type %s exists', atoum\asserters\error::getAsString($type))->once

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->exception(function() use (& $line, $asserter) { $asserter->notExists(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error of type %s with message \'%s\' exists')->once
				->array($asserter->getScore()->getErrors())->isNotEmpty()

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), $type, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->then
				->exception(function() use (& $line, $asserter) { $asserter->notExists; })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage($errorExists)
				->mock($locale)->call('_')->withArguments('error of type %s with message \'%s\' exists')->once
				->array($asserter->getScore()->getErrors())->isNotEmpty()

			->if($asserter->getScore()->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), $message = uniqid() . 'FOO' . uniqid(), uniqid(), rand(1, PHP_INT_MAX)))
			->and($asserter->withPattern('/FOO/')->withType(null))
			->then
				->object($asserter->exists())->isTestedInstance
				->array($asserter->getScore()->getErrors())->isNotEmpty()
		;
	}

	public function testWithType()
	{
		$this
			->given($this->newTestedInstance)
			->then
				->object($this->testedInstance->withType($type = rand(1, PHP_INT_MAX)))->isTestedInstance
				->integer($this->testedInstance->getType())->isEqualTo($type)
		;
	}

	public function testWithAnyType()
	{
		$this
			->given($this->newTestedInstance->withType(rand(1, PHP_INT_MAX)))
			->then
				->object($this->testedInstance->withAnyType())->isTestedInstance
				->variable($this->testedInstance->getType())->isNull()
			->given($this->newTestedInstance->withType(rand(1, PHP_INT_MAX)))
			->then
				->object($this->testedInstance->withAnyType)->isTestedInstance
				->variable($this->testedInstance->getType())->isNull()
		;
	}

	public function testWithMessage()
	{
		$this
			->given($this->newTestedInstance)
			->then
				->object($this->testedInstance->withMessage($message = uniqid()))->isTestedInstance
				->string($this->testedInstance->getMessage())->isEqualTo($message)
				->boolean($this->testedInstance->messageIsPattern())->isFalse()
		;
	}

	public function testWithPattern()
	{
		$this
			->given($this->newTestedInstance)
			->then
				->object($this->testedInstance->withPattern($pattern = uniqid()))->isTestedInstance
				->string($this->testedInstance->getMessage())->isEqualTo($pattern)
				->boolean($this->testedInstance->messageIsPattern())->isTrue()
		;
	}

	public function testWithAnyMessage()
	{
		$this
			->given($this->newTestedInstance->withMessage(uniqid()))
			->then
				->object($this->testedInstance->withAnyMessage())->isTestedInstance
				->variable($this->testedInstance->getMessage())->isNull()
				->boolean($this->testedInstance->messageIsPattern())->isFalse()

			->given($this->newTestedInstance->withMessage(uniqid()))
			->then
				->object($this->testedInstance->withAnyMessage)->isTestedInstance
				->variable($this->testedInstance->getMessage())->isNull()
				->boolean($this->testedInstance->messageIsPattern())->isFalse()

			->if($this->testedInstance->withPattern(uniqid()))
			->then
				->object($this->testedInstance->withAnyMessage())->isTestedInstance
				->variable($this->testedInstance->getMessage())->isNull()
				->boolean($this->testedInstance->messageIsPattern())->isFalse()
		;
	}

	public function testSetScore()
	{
		$this
			->given($this->newTestedInstance)
			->then
				->object($this->testedInstance->setScore($score = new atoum\test\score()))->isTestedInstance
				->object($this->testedInstance->getScore())->isIdenticalTo($score)
				->object($this->testedInstance->setScore())->isTestedInstance
				->object($this->testedInstance->getScore())
					->isNotIdenticalTo($score)
					->isInstanceOf('mageekguy\atoum\score')
		;
	}
}


text:
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component, Input, Output, EventEmitter, ElementRef, ChangeDetectionStrategy } from '@angular/core';
import { select } from 'd3-selection';
import { id } from '../utils/id';
var HeatMapCellComponent = /** @class */ (function () {
    function HeatMapCellComponent(element) {
        this.gradient = false;
        this.animations = true;
        this.select = new EventEmitter();
        this.element = element.nativeElement;
    }
    HeatMapCellComponent.prototype.ngOnChanges = function (changes) {
        this.transform = "translate(" + this.x + " , " + this.y + ")";
        this.startOpacity = 0.3;
        this.gradientId = 'grad' + id().toString();
        this.gradientUrl = "url(#" + this.gradientId + ")";
        this.gradientStops = this.getGradientStops();
        if (this.animations) {
            this.loadAnimation();
        }
    };
    HeatMapCellComponent.prototype.getGradientStops = function () {
        return [
            {
                offset: 0,
                color: this.fill,
                opacity: this.startOpacity
            },
            {
                offset: 100,
                color: this.fill,
                opacity: 1
            }
        ];
    };
    HeatMapCellComponent.prototype.loadAnimation = function () {
        var node = select(this.element).select('.cell');
        node.attr('opacity', 0);
        this.animateToCurrentForm();
    };
    HeatMapCellComponent.prototype.animateToCurrentForm = function () {
        var node = select(this.element).select('.cell');
        node.transition().duration(750)
            .attr('opacity', 1);
    };
    HeatMapCellComponent.prototype.onClick = function () {
        this.select.emit(this.data);
    };
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "fill", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "x", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "y", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "width", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "height", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "data", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "label", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], HeatMapCellComponent.prototype, "gradient", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], HeatMapCellComponent.prototype, "animations", void 0);
    __decorate([
        Output(),
        __metadata("design:type", Object)
    ], HeatMapCellComponent.prototype, "select", void 0);
    HeatMapCellComponent = __decorate([
        Component({
            selector: 'g[ngx-charts-heat-map-cell]',
            template: "\n    <svg:g [attr.transform]=\"transform\" class=\"cell\">\n      <defs *ngIf=\"gradient\">\n        <svg:g ngx-charts-svg-linear-gradient\n          orientation=\"vertical\"\n          [name]=\"gradientId\"\n          [stops]=\"gradientStops\"\n        />\n      </defs>\n      <svg:rect\n        [attr.fill]=\"gradient ? gradientUrl : fill\"\n        rx=\"3\"\n        [attr.width]=\"width\"\n        [attr.height]=\"height\"\n        class=\"cell\"\n        style=\"cursor: pointer\"\n        (click)=\"onClick()\"\n      />\n    </svg:g>\n  ",
            changeDetection: ChangeDetectionStrategy.OnPush
        }),
        __metadata("design:paramtypes", [ElementRef])
    ], HeatMapCellComponent);
    return HeatMapCellComponent;
}());
export { HeatMapCellComponent };
//# sourceMappingURL=heat-map-cell.component.js.map


text:
[![Build Status](https://img.shields.io/travis/fortunejs/fortune/master.svg?style=flat-square)](https://travis-ci.org/fortunejs/fortune)
[![npm Version](https://img.shields.io/npm/v/fortune.svg?style=flat-square)](https://www.npmjs.com/package/fortune)
[![License](https://img.shields.io/npm/l/fortune.svg?style=flat-square)](https://raw.githubusercontent.com/fortunejs/fortune/master/LICENSE)

Fortune is a high-level I/O library for web applications. It provides an implementation of [entity-relationship modelling](https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model), is agnostic about data storage, and can be used to power real-time ([WebSocket](http://fortunejs.com/api/#net-websocket)) and [hypermedia](https://en.wikipedia.org/wiki/Hypermedia) applications ([REST Level 3](http://martinfowler.com/articles/richardsonMaturityModel.html)).

[View the website](http://fortunejs.com) for documentation. Get it from `npm`:

```sh
$ npm install fortune --save
```

## Example

Let's build an API that models Twitter's basic functionality:

```js
import fortune from 'fortune'
import http from 'http'

const store = fortune.create()

// The `net.http` function returns a listener function which does content
// negotiation, parses headers, and maps the response to an HTTP response.
const server = http.createServer(fortune.net.http(store))

store.defineType('user', {
  name: { type: String },

  // Following and followers are inversely related (many-to-many).
  following: { link: 'user', inverse: 'followers', isArray: true },
  followers: { link: 'user', inverse: 'following', isArray: true },

  // Many-to-one relationship of user posts to post author.
  posts: { link: 'post', inverse: 'author', isArray: true }
})

store.defineType('post', {
  message: { type: String },

  // One-to-many relationship of post author to user posts.
  author: { link: 'user', inverse: 'posts' }
})

store.connect().then(() => server.listen(1337))
```

This yields an *ad hoc* HTTP API. There are serializers for [Micro API](https://github.com/fortunejs/fortune-micro-api) (hypermedia) and [JSON API](https://github.com/fortunejs/fortune-json-api).

By default, the data is persisted in memory. There are adapters for databases such as [MongoDB](https://github.com/fortunejs/fortune-mongodb), [Postgres](https://github.com/fortunejs/fortune-postgres), and [NeDB](https://github.com/fortunejs/fortune-nedb).

See the [plugins page](http://fortunejs.com/plugins/) for more details.

## License

This software is licensed under the [MIT license](https://raw.githubusercontent.com/fortunejs/fortune/master/LICENSE).


text:
(function() {

  'use strict';

  describe('experiments.views.view1 module', function() {

    beforeEach(module('experiments.views.view1'));

    describe('view1 controller', function(){

      it('should ....', inject(function($controller) {
        //spec body
        var view1Ctrl = $controller('View1Ctrl');
        expect(view1Ctrl).toBeDefined();
      }));

    });
  });

})();


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use backend\models\Permission;
use backend\models\AuthRule;

/* @var $this yii\web\View */
/* @var $model common\models\Permission */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'parent')->dropDownList(
        ArrayHelper::map(Permission::findParents(), 'name', 'name'),
        ['prompt' => Yii::t('app', 'LBL_NO_PARENT')]
    ) ?>

    <?php if ($model->isNewRecord): ?>
    <?= $form->field($model, 'name')->textInput() ?>
    <?php endif; ?>

    <?= $form->field($model, 'description')->textInput() ?>

    <?= $form->field($model, 'rule_name')->dropDownList(
        ArrayHelper::map(AuthRule::find()->all(), 'name', 'name'),
        ['prompt' => Yii::t('app', 'LBL_NO_RULE')]
    ) ?>

        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'BTN_CREATE') : Yii::t('app', 'BTN_UPDATE'), ['class' => $model->isNewRecord ? 'btn btn-success btn-flat' : 'btn btn-primary btn-flat']) ?>

    <?php ActiveForm::end(); ?>