text:
package com.hmsonline.storm.cassandra.bolt.mapper;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import storm.trident.tuple.TridentTuple;

import com.hmsonline.storm.cassandra.exceptions.TupleMappingException;

/**
 * Interface for mapping Trident storm.trident.tuple.TridentTuple
 * objects to Cassandra rows.
 *
 * @author tgoetz
 *
 * @param <K> - the Cassandra row key type
 * @param <C> - the Cassandra column key/name type
 * @param <V> - the Cassandra column value type
 */
/* TODO tgoetz: This interface is suffering from serious growing pains,
 * which is a good indication that the API needs to be rethought.
 */
public interface TridentTupleMapper<K, C, V> extends Serializable {
    /**
     * Given a storm.trident.tuple.TridentTuple object,
     * return the name of the column family that data should be
     * written to.
     *
     * @param tuple
     * @return the column family name
     */
    String mapToColumnFamily(TridentTuple tuple) throws TupleMappingException;

    /**
     * Given a backtype.storm.tuple.Tuple object, map the keyspace to write to.
     *
     * @param tuple
     * @return
     */
    String mapToKeyspace(TridentTuple tuple);

    /**
     * Given a storm.trident.tuple.TridentTuple object,
     * return an object representing the Cassandra row key.
     *
     * @param tuple
     * @return
     * @throws TupleMappingException
     */
    K mapToRowKey(TridentTuple tuple) throws TupleMappingException;

    /**
     * Given a storm.trident.tuple.TridentTuple object,
     * return a java.util.Map object representing the
     * column names/values to persist to Cassandra.
     *
     * @param tuple
     * @return
     * @throws TupleMappingException
     */
    Map<C, V> mapToColumns(TridentTuple tuple) throws TupleMappingException;

    /**
     * Given a storm.trident.tuple.TridentTuple object,
     * return a list of column name (column key) objects in order to execute a
     * slice query against a particular row.
     *
     * The row key will be determined by the return value of mapToRowKey().
     *
     *
     * @param tuple
     * @return
     * @throws TupleMappingException
     */
    List<C> mapToColumnsForLookup(TridentTuple tuple) throws TupleMappingException;

    /**
     * Map a storm.trident.tuple.TridentTuple object
     * to a an end key in order to perform a Cassandra column range query.
     *
     * The row key will be determined by the return value of mapToRowKey().
     *
     * The start key/column will be determined by the value of mapToStartKey().
     *
     * @param tuple
     * @return
     * @throws TupleMappingException
     */
    C mapToEndKey(TridentTuple tuple) throws TupleMappingException;

    /**
     *
     * @param tuple
     * @return
     * @throws TupleMappingException
     */
    C mapToStartKey(TridentTuple tuple) throws TupleMappingException;

    boolean shouldDelete(TridentTuple tuple);

    /**
     * Returns the row key class.
     *
     * @return
     */
    Class<K> getKeyClass();

    /**
     * Returns the coulumn name(key) class.
     *
     * @return
     */
    Class<C> getColumnNameClass();

    /**
     * Returns the column value class.
     *
     * @return
     */
    Class<V> getColumnValueClass();
}

redpajama_set_name: RedPajamaGithub


text:
/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.managedidentities.v1beta1.model;

/**
 * OnPremDomainDetails is the message which contains details of on-prem domain which is trusted and
 * needs to be migrated.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Managed Service for Microsoft Active Directory API.
 * For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class OnPremDomainSIDDetails extends com.google.api.client.json.GenericJson {

  /**
   * FQDN of the on-prem domain being migrated.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String name;

  /**
   * Current SID filtering state.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String sidFilteringState;

  /**
   * FQDN of the on-prem domain being migrated.
   * @return value or {@code null} for none
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * FQDN of the on-prem domain being migrated.
   * @param name name or {@code null} for none
   */
  public OnPremDomainSIDDetails setName(java.lang.String name) {
    this.name = name;
    return this;
  }

  /**
   * Current SID filtering state.
   * @return value or {@code null} for none
   */
  public java.lang.String getSidFilteringState() {
    return sidFilteringState;
  }

  /**
   * Current SID filtering state.
   * @param sidFilteringState sidFilteringState or {@code null} for none
   */
  public OnPremDomainSIDDetails setSidFilteringState(java.lang.String sidFilteringState) {
    this.sidFilteringState = sidFilteringState;
    return this;
  }

  @Override
  public OnPremDomainSIDDetails set(String fieldName, Object value) {
    return (OnPremDomainSIDDetails) super.set(fieldName, value);
  }

  @Override
  public OnPremDomainSIDDetails clone() {
    return (OnPremDomainSIDDetails) super.clone();
  }

}


text:
<bill session="111" type="h" number="1034" updated="2009-03-07T11:50:22-05:00">
	<status><introduced date="1234414800" datetime="2009-02-12"/></status>

	<introduced date="1234414800" datetime="2009-02-12"/>
	<titles>
		<title type="official" as="introduced">To amend title 36, United States Code, to designate the Honor and Remember Flag created by Honor and Remember, Inc., as an official symbol to recognize and honor members of the Armed Forces who died in the line of duty, and for other purposes.</title>
	</titles>
	<sponsor id="400137"/>
	<cosponsors>

	</cosponsors>
	<actions>
		<action date="1234414800" datetime="2009-02-12"><text>Referred to the House Committee on the Judiciary.</text></action>
	</actions>
	<committees>
		<committee name="House Judiciary" subcommittee="" activity="Referral, In Committee" />
	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>

	2/12/2009--Introduced.
Designates the Honor and Remember Flag, created by Honor and Remember, Inc., as the official symbol of our country's concern and commitment to honoring and remembering all members of the Armed Forces who lost their lives in the line of duty. Provides days of the year, and memorials and other locations, on or at which the Flag shall be displayed.

</bill>


text:
layout: null
---

{{ jekyll.environment }}
{{ page }}

{% comment %}

{{ site.courses.size }}
{% for course in site.courses %}
{{ course.slug }} - {{ course.title }}
{% endfor %}

{% for group in site.data.courses-order %}
  {% assign items = group | split: ' - ' %}
  {{ items | inspect }}

{{ items | first }}

    {% for item in items %}{% if forloop.index != 1 %}{% assign title = item %}{% include course-list-item.html %}{% endif %}{% endfor %}

{% endfor %}

{% endcomment %}


text:
package org.elasticsearch.index.mapper;

import org.apache.lucene.search.MultiTermQuery.RewriteMethod;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.lucene.BytesRefs;
import org.elasticsearch.common.time.DateMathParser;
import org.elasticsearch.common.unit.Fuzziness;
import org.elasticsearch.index.fielddata.StringScriptFieldData;
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.script.CompositeFieldScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.StringFieldScript;
import org.elasticsearch.search.lookup.SearchLookup;
import org.elasticsearch.search.runtime.StringScriptFieldExistsQuery;
import org.elasticsearch.search.runtime.StringScriptFieldFuzzyQuery;
import org.elasticsearch.search.runtime.StringScriptFieldPrefixQuery;
import org.elasticsearch.search.runtime.StringScriptFieldRangeQuery;
import org.elasticsearch.search.runtime.StringScriptFieldRegexpQuery;
import org.elasticsearch.search.runtime.StringScriptFieldTermQuery;
import org.elasticsearch.search.runtime.StringScriptFieldTermsQuery;
import org.elasticsearch.search.runtime.StringScriptFieldWildcardQuery;

import java.time.ZoneId;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;

import static java.util.stream.Collectors.toSet;

public final class KeywordScriptFieldType extends AbstractScriptFieldType<StringFieldScript.LeafFactory> {

    public static final RuntimeField.Parser PARSER = new RuntimeField.Parser(Builder::new);

    private static class Builder extends AbstractScriptFieldType.Builder<StringFieldScript.Factory> {
        Builder(String name) {
            super(name, StringFieldScript.CONTEXT);
        }

        @Override
        AbstractScriptFieldType<?> createFieldType(
            String name,
            StringFieldScript.Factory factory,
            Script script,
            Map<String, String> meta
        ) {
            return new KeywordScriptFieldType(name, factory, script, meta);
        }

        @Override
        StringFieldScript.Factory getParseFromSourceFactory() {
            return StringFieldScript.PARSE_FROM_SOURCE;
        }

        @Override
        StringFieldScript.Factory getCompositeLeafFactory(Function<SearchLookup, CompositeFieldScript.LeafFactory> parentScriptFactory) {
            return StringFieldScript.leafAdapter(parentScriptFactory);
        }
    }

    public static RuntimeField sourceOnly(String name) {
        return new Builder(name).createRuntimeField(StringFieldScript.PARSE_FROM_SOURCE);
    }

    public KeywordScriptFieldType(String name, StringFieldScript.Factory scriptFactory, Script script, Map<String, String> meta) {
        super(
            name,
            searchLookup -> scriptFactory.newFactory(name, script.getParams(), searchLookup),
            script,
            scriptFactory.isResultDeterministic(),
            meta
        );
    }

    @Override
    public String typeName() {
        return KeywordFieldMapper.CONTENT_TYPE;
    }

    @Override
    public Object valueForDisplay(Object value) {
        if (value == null) {
            return null;
        }
        // keywords are internally stored as utf8 bytes
        BytesRef binaryValue = (BytesRef) value;
        return binaryValue.utf8ToString();
    }

    @Override
    public StringScriptFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
        return new StringScriptFieldData.Builder(name(), leafFactory(searchLookup.get()));
    }

    @Override
    public Query existsQuery(SearchExecutionContext context) {
        applyScriptContext(context);
        return new StringScriptFieldExistsQuery(script, leafFactory(context), name());
    }

    @Override
    public Query fuzzyQuery(
        Object value,
        Fuzziness fuzziness,
        int prefixLength,
        int maxExpansions,
        boolean transpositions,
        SearchExecutionContext context
    ) {
        applyScriptContext(context);
        return StringScriptFieldFuzzyQuery.build(
            script,
            leafFactory(context),
            name(),
            BytesRefs.toString(Objects.requireNonNull(value)),
            fuzziness.asDistance(BytesRefs.toString(value)),
            prefixLength,
            transpositions
        );
    }

    @Override
    public Query prefixQuery(String value, RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context) {
        applyScriptContext(context);
        return new StringScriptFieldPrefixQuery(script, leafFactory(context), name(), value, caseInsensitive);
    }

    @Override
    public Query rangeQuery(
        Object lowerTerm,
        Object upperTerm,
        boolean includeLower,
        boolean includeUpper,
        ZoneId timeZone,
        DateMathParser parser,
        SearchExecutionContext context
    ) {
        applyScriptContext(context);
        return new StringScriptFieldRangeQuery(
            script,
            leafFactory(context),
            name(),
            lowerTerm == null ? null : BytesRefs.toString(lowerTerm),
            upperTerm == null ? null : BytesRefs.toString(upperTerm),
            includeLower,
            includeUpper
        );
    }

    @Override
    public Query regexpQuery(
        String value,
        int syntaxFlags,
        int matchFlags,
        int maxDeterminizedStates,
        RewriteMethod method,
        SearchExecutionContext context
    ) {
        applyScriptContext(context);
        if (matchFlags != 0) {
            throw new IllegalArgumentException("Match flags not yet implemented [" + matchFlags + "]");
        }
        return new StringScriptFieldRegexpQuery(
            script,
            leafFactory(context),
            name(),
            value,
            syntaxFlags,
            matchFlags,
            maxDeterminizedStates
        );
    }

    @Override
    public Query termQueryCaseInsensitive(Object value, SearchExecutionContext context) {
        applyScriptContext(context);
        return new StringScriptFieldTermQuery(
            script,
            leafFactory(context),
            name(),
            BytesRefs.toString(Objects.requireNonNull(value)),
            true
        );
    }

    @Override
    public Query termQuery(Object value, SearchExecutionContext context) {
        applyScriptContext(context);
        return new StringScriptFieldTermQuery(
            script,
            leafFactory(context),
            name(),
            BytesRefs.toString(Objects.requireNonNull(value)),
            false
        );
    }

    @Override
    public Query termsQuery(Collection<?> values, SearchExecutionContext context) {
        applyScriptContext(context);
        Set<String> terms = values.stream().map(v -> BytesRefs.toString(Objects.requireNonNull(v))).collect(toSet());
        return new StringScriptFieldTermsQuery(script, leafFactory(context), name(), terms);
    }

    @Override
    public Query wildcardQuery(String value, RewriteMethod method, boolean caseInsensitive, SearchExecutionContext context) {
        applyScriptContext(context);
        return new StringScriptFieldWildcardQuery(script, leafFactory(context), name(), value, caseInsensitive);
    }

    @Override
    public Query normalizedWildcardQuery(String value, RewriteMethod method, SearchExecutionContext context) {
        applyScriptContext(context);
        return new StringScriptFieldWildcardQuery(script, leafFactory(context), name(), value, false);
    }
}


text:
package research.registry.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import research.registry.model.Account;

public interface AccountRepository extends JpaRepository<Account, Integer> {

    int findIdByUsername(String username);

    Account findByUsername(String username);

    /*@Query(value = "select a from accounts a where a.username = ?1", nativeQuery = true)
    Account testAccount(String username);*/
}


text:
Application created with the goal to helping children learn programming logic using **block programming** (Blockly)
to solve the challenge problem.

The game now contains 10 challenges and can be found in [Era Uma Vez](https://eraumavez.herokuapp.com/).

This is part of my final paper in university and you can read the [final report](https://www.dropbox.com/s/qgmp3jsyo17aomf/Final.pdf?dl=0) (in portuguese).

This was one of my first projects and I know that have lot of things to change and improve.


text:
package org.apache.vxquery.types;

public enum JsonItemKind {
    ANY,
    OBJECT,
    ARRAY
}


text:
package org.spongepowered.api.entity.projectile.source;

import com.flowpowered.math.vector.Vector3d;
import org.spongepowered.api.entity.projectile.Projectile;

/**
 * Represents a {@link ProjectileSource} that is not part of the API, such
 * as a plugin or mod spawning a Projectile.
 */
public final class UnknownProjectileSource implements ProjectileSource {

    @Override
    public <T extends Projectile> T launchProjectile(Class<T> projectileClass) {
        return null;
    }

    @Override
    public <T extends Projectile> T launchProjectile(Class<T> projectileClass, Vector3d velocity) {
        return null;
    }
}


text:
using Newtonsoft.Json;

namespace jamiewest.ChartJs.Data
{
    public class RadarDataset : Dataset
    {
        /// <summary>
        ///     If true, fill the area under the line.
        /// </summary>
        [JsonProperty(PropertyName = "fill")]
        public bool Fill { get; set; }

        /// <summary>
        ///     Bezier curve tension of the line. Set to 0 to draw straightlines.
        ///     Note This was renamed from 'tension' but the old name still works.
        /// </summary>
        [JsonProperty(PropertyName = "lineTension")]
        public int LineTension { get; set; }

        /// <summary>
        ///     The fill color under the line.
        /// </summary>
        [JsonProperty(PropertyName = "backgroundColor")]
        public string[] BackgroundColor { get; set; }

        /// <summary>
        ///     The color of the line.
        /// </summary>
        [JsonProperty(PropertyName = "borderColor")]
        public string[] BorderColor { get; set; }

        /// <summary>
        ///     The width of the line in pixels.
        /// </summary>
        [JsonProperty(PropertyName = "borderWidth")]
        public int BorderWidth { get; set; }

        /// <summary>
        ///     Cap style of the line.
        /// </summary>
        [JsonProperty(PropertyName = "borderCapStyle")]
        public int BorderCapStyle { get; set; }

        /// <summary>
        ///     Length and spacing of dashes.
        /// </summary>
        [JsonProperty(PropertyName = "borderDash")]
        public int[] BorderDash { get; set; }

        /// <summary>
        ///     Offset for line dashes.
        /// </summary>
        [JsonProperty(PropertyName = "borderDashOffset")]
        public int BorderDashOffset { get; set; }

        /// <summary>
        ///     Line joint style.
        /// </summary>
        [JsonProperty(PropertyName = "borderJoinStyle")]
        public string BorderJoinStyle { get; set; }

        /// <summary>
        ///     The border color for points.
        /// </summary>
        [JsonProperty(PropertyName = "pointBorderColor")]
        public string[] PointBorderColor { get; set; }

        /// <summary>
        ///     The fill color for points.
        /// </summary>
        [JsonProperty(PropertyName = "pointBackgroundColor")]
        public string[] PointBackgroundColor { get; set; }

        /// <summary>
        ///     The width of the point border in pixels.
        /// </summary>
        [JsonProperty(PropertyName = "pointBorderWidth")]
        public int PointBorderWidth { get; set; }

        /// <summary>
        ///     The radius of the point shape. If set to 0, nothing is rendered.
        /// </summary>
        [JsonProperty(PropertyName = "pointRadius")]
        public int PointRadius { get; set; }

        /// <summary>
        ///     The radius of the point when hovered.
        /// </summary>
        [JsonProperty(PropertyName = "pointHoverRadius")]
        public int PointHoverRadius { get; set; }

        /// <summary>
        ///     The pixel size of the non-displayed point that reacts to mouse events.
        /// </summary>
        [JsonProperty(PropertyName = "pointHitRadius")]
        public int PointHitRadius { get; set; }

        /// <summary>
        ///     Point background color when hovered.
        /// </summary>
        [JsonProperty(PropertyName = "pointHoverBackgroundColor")]
        public string[] PointHoverBackgroundColor { get; set; }

        /// <summary>
        ///     Point border color when hovered.
        /// </summary>
        [JsonProperty(PropertyName = "pointHoverBorderColor")]
        public string[] PointHoverBorderColor { get; set; }

        /// <summary>
        ///     Border width of point when hovered.
        /// </summary>
        [JsonProperty(PropertyName = "pointHoverBorderWidth")]
        public int PointHoverBorderWidth { get; set; }

        /// <summary>
        ///     The style of point. Options include 'circle', 'triangle', 'rect', 'rectRounded', 'rectRot', 'cross', 'crossRot', 'star', 'line', and 'dash'.
        /// </summary>
        [JsonProperty(PropertyName = "pointStyle")]
        public string PointStyle { get; set; }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class ResumeNextActivitySignal
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class ResumeNextActivitySignal
   ">
    <meta name="generator" content="docfx 2.43.2.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
                Toggle navigation

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class ResumeNextActivitySignal

Signal indicating that the current activity, which terminated with an exception,
should be aborted and the execution should continue with the next activity in the pipeline.

Inheritance

System.Object

System.Exception

ResumeNextActivitySignal

Implements

System.Runtime.Serialization.ISerializable

ISignal

ISeverityQualifiedException

Inherited Members

      System.Exception.GetBaseException()

      System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)

      System.Exception.GetType()

      System.Exception.ToString()

      System.Exception.Data

      System.Exception.HelpLink

      System.Exception.HResult

      System.Exception.InnerException

      System.Exception.Message

      System.Exception.Source

      System.Exception.StackTrace

      System.Exception.TargetSite

      System.Exception.SerializeObjectState

      System.Object.Equals(System.Object)

      System.Object.Equals(System.Object, System.Object)

      System.Object.GetHashCode()

      System.Object.MemberwiseClone()

      System.Object.ReferenceEquals(System.Object, System.Object)

Namespace: Kephas.Workflow.Interaction

Assembly: Kephas.Workflow.dll

Syntax

public class ResumeNextActivitySignal : Exception, ISerializable, ISignal, ISeverityQualifiedException

Constructors

    |
    Improve this Doc

    View Source

ResumeNextActivitySignal()

Initializes a new instance of the ResumeNextActivitySignal class.

Declaration

public ResumeNextActivitySignal()

    |
    Improve this Doc

    View Source

ResumeNextActivitySignal(String)

Initializes a new instance of the ResumeNextActivitySignal class.

Declaration

public ResumeNextActivitySignal(string message)

Parameters

        Type
        Name
        Description

        System.String
        message

The message.

    |
    Improve this Doc

    View Source

ResumeNextActivitySignal(String, Exception)

Initializes a new instance of the ResumeNextActivitySignal class.

Declaration

public ResumeNextActivitySignal(string message, Exception inner)

Parameters

        Type
        Name
        Description

        System.String
        message

The message.

        System.Exception
        inner

The inner exception.

Properties

    |
    Improve this Doc

    View Source

Severity

Gets the severity.

Declaration

public SeverityLevel Severity { get; }

Property Value

        Type
        Description

        SeverityLevel

The severity.

Implements

      System.Runtime.Serialization.ISerializable

      ISignal

      ISeverityQualifiedException

Extension Methods

      DynamicObjectExtensions.SetPropertyValue(Object, String, Object)

      DynamicObjectExtensions.TrySetPropertyValue(Object, String, Object)

      DynamicObjectExtensions.GetPropertyValue(Object, String)

      DynamicObjectExtensions.TryGetPropertyValue(Object, String, out Object)

      DynamicObjectExtensions.GetRuntimeTypeInfo(Object)

      DynamicObjectExtensions.ToDynamic(Object)

      DynamicObjectExtensions.ToExpando(Object)

      BehaviorValue.ToBehaviorValue<TValue>(TValue)

      CollectionExtensions.AddRange<T, TItem>(T, IEnumerable<TItem>)

      LoggerExtensions.GetLogLevel(Exception)

      LoggingExtensions.GetLogger(Object, IContext)

      TypeExtensions.GetAbstractType(Object)

      TypeExtensions.GetAbstractTypeInfo(Object)

      ReflectionHelper.GetTypeInfo(Object)

      EntityEntryExtensions.TryGetAttachedEntityEntry(Object)

                    Improve this Doc

                    View Source

              Back to top

            Generated by DocFX


text:
package com.google.cloud.devtools.cloudbuild.v1;

import com.google.api.core.BetaApi;
import com.google.cloudbuild.v1.ApproveBuildRequest;
import com.google.cloudbuild.v1.Build;
import com.google.cloudbuild.v1.BuildTrigger;
import com.google.cloudbuild.v1.CancelBuildRequest;
import com.google.cloudbuild.v1.CloudBuildGrpc.CloudBuildImplBase;
import com.google.cloudbuild.v1.CreateBuildRequest;
import com.google.cloudbuild.v1.CreateBuildTriggerRequest;
import com.google.cloudbuild.v1.CreateWorkerPoolRequest;
import com.google.cloudbuild.v1.DeleteBuildTriggerRequest;
import com.google.cloudbuild.v1.DeleteWorkerPoolRequest;
import com.google.cloudbuild.v1.GetBuildRequest;
import com.google.cloudbuild.v1.GetBuildTriggerRequest;
import com.google.cloudbuild.v1.GetWorkerPoolRequest;
import com.google.cloudbuild.v1.ListBuildTriggersRequest;
import com.google.cloudbuild.v1.ListBuildTriggersResponse;
import com.google.cloudbuild.v1.ListBuildsRequest;
import com.google.cloudbuild.v1.ListBuildsResponse;
import com.google.cloudbuild.v1.ListWorkerPoolsRequest;
import com.google.cloudbuild.v1.ListWorkerPoolsResponse;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookRequest;
import com.google.cloudbuild.v1.ReceiveTriggerWebhookResponse;
import com.google.cloudbuild.v1.RetryBuildRequest;
import com.google.cloudbuild.v1.RunBuildTriggerRequest;
import com.google.cloudbuild.v1.UpdateBuildTriggerRequest;
import com.google.cloudbuild.v1.UpdateWorkerPoolRequest;
import com.google.cloudbuild.v1.WorkerPool;
import com.google.longrunning.Operation;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Empty;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated;

@BetaApi
@Generated("by gapic-generator-java")
public class MockCloudBuildImpl extends CloudBuildImplBase {
  private List<AbstractMessage> requests;
  private Queue<Object> responses;

  public MockCloudBuildImpl() {
    requests = new ArrayList<>();
    responses = new LinkedList<>();
  }

  public List<AbstractMessage> getRequests() {
    return requests;
  }

  public void addResponse(AbstractMessage response) {
    responses.add(response);
  }

  public void setResponses(List<AbstractMessage> responses) {
    this.responses = new LinkedList<Object>(responses);
  }

  public void addException(Exception exception) {
    responses.add(exception);
  }

  public void reset() {
    requests = new ArrayList<>();
    responses = new LinkedList<>();
  }

  @Override
  public void createBuild(CreateBuildRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method CreateBuild, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void getBuild(GetBuildRequest request, StreamObserver<Build> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Build) {
      requests.add(request);
      responseObserver.onNext(((Build) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method GetBuild, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Build.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void listBuilds(
      ListBuildsRequest request, StreamObserver<ListBuildsResponse> responseObserver) {
    Object response = responses.poll();
    if (response instanceof ListBuildsResponse) {
      requests.add(request);
      responseObserver.onNext(((ListBuildsResponse) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method ListBuilds, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  ListBuildsResponse.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void cancelBuild(CancelBuildRequest request, StreamObserver<Build> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Build) {
      requests.add(request);
      responseObserver.onNext(((Build) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method CancelBuild, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Build.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void retryBuild(RetryBuildRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method RetryBuild, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void approveBuild(
      ApproveBuildRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method ApproveBuild, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void createBuildTrigger(
      CreateBuildTriggerRequest request, StreamObserver<BuildTrigger> responseObserver) {
    Object response = responses.poll();
    if (response instanceof BuildTrigger) {
      requests.add(request);
      responseObserver.onNext(((BuildTrigger) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method CreateBuildTrigger, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  BuildTrigger.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void getBuildTrigger(
      GetBuildTriggerRequest request, StreamObserver<BuildTrigger> responseObserver) {
    Object response = responses.poll();
    if (response instanceof BuildTrigger) {
      requests.add(request);
      responseObserver.onNext(((BuildTrigger) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method GetBuildTrigger, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  BuildTrigger.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void listBuildTriggers(
      ListBuildTriggersRequest request,
      StreamObserver<ListBuildTriggersResponse> responseObserver) {
    Object response = responses.poll();
    if (response instanceof ListBuildTriggersResponse) {
      requests.add(request);
      responseObserver.onNext(((ListBuildTriggersResponse) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method ListBuildTriggers, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  ListBuildTriggersResponse.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void deleteBuildTrigger(
      DeleteBuildTriggerRequest request, StreamObserver<Empty> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Empty) {
      requests.add(request);
      responseObserver.onNext(((Empty) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method DeleteBuildTrigger, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Empty.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void updateBuildTrigger(
      UpdateBuildTriggerRequest request, StreamObserver<BuildTrigger> responseObserver) {
    Object response = responses.poll();
    if (response instanceof BuildTrigger) {
      requests.add(request);
      responseObserver.onNext(((BuildTrigger) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method UpdateBuildTrigger, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  BuildTrigger.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void runBuildTrigger(
      RunBuildTriggerRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method RunBuildTrigger, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void receiveTriggerWebhook(
      ReceiveTriggerWebhookRequest request,
      StreamObserver<ReceiveTriggerWebhookResponse> responseObserver) {
    Object response = responses.poll();
    if (response instanceof ReceiveTriggerWebhookResponse) {
      requests.add(request);
      responseObserver.onNext(((ReceiveTriggerWebhookResponse) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method ReceiveTriggerWebhook, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  ReceiveTriggerWebhookResponse.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void createWorkerPool(
      CreateWorkerPoolRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method CreateWorkerPool, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void getWorkerPool(
      GetWorkerPoolRequest request, StreamObserver<WorkerPool> responseObserver) {
    Object response = responses.poll();
    if (response instanceof WorkerPool) {
      requests.add(request);
      responseObserver.onNext(((WorkerPool) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method GetWorkerPool, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  WorkerPool.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void deleteWorkerPool(
      DeleteWorkerPoolRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method DeleteWorkerPool, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void updateWorkerPool(
      UpdateWorkerPoolRequest request, StreamObserver<Operation> responseObserver) {
    Object response = responses.poll();
    if (response instanceof Operation) {
      requests.add(request);
      responseObserver.onNext(((Operation) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method UpdateWorkerPool, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  Operation.class.getName(),
                  Exception.class.getName())));
    }
  }

  @Override
  public void listWorkerPools(
      ListWorkerPoolsRequest request, StreamObserver<ListWorkerPoolsResponse> responseObserver) {
    Object response = responses.poll();
    if (response instanceof ListWorkerPoolsResponse) {
      requests.add(request);
      responseObserver.onNext(((ListWorkerPoolsResponse) response));
      responseObserver.onCompleted();
    } else if (response instanceof Exception) {
      responseObserver.onError(((Exception) response));
    } else {
      responseObserver.onError(
          new IllegalArgumentException(
              String.format(
                  "Unrecognized response type %s for method ListWorkerPools, expected %s or %s",
                  response == null ? "null" : response.getClass().getName(),
                  ListWorkerPoolsResponse.class.getName(),
                  Exception.class.getName())));
    }
  }
}


text:
<?php

declare(strict_types=1);

/*
 * This file is part of the SkeletonDancer package.
 *
 * (c) Sebastiaan Stok <s.stok@rollerscapes.net>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace SkeletonDancer\Tests;

use Dance\Questioner\NameQuestioner;
use Dance\Questioner\NamespaceQuestioner;
use Dance\Questioner\OptionalPathQuestioner;
use PHPUnit\Framework\TestCase;
use SkeletonDancer\Dance;
use SkeletonDancer\InteractiveQuestionInteractor;
use SkeletonDancer\Test\ContainerCreator;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
use Webmozart\Console\IO\BufferedIO;

final class InteractiveQuestionerTest extends TestCase
{
    use ContainerCreator;

    private $input;
    private $output;

    /**
     * @test
     */
    public function it_iterates_all_configurators()
    {
        $profile = new Dance('test/test', '', [NameQuestioner::class, NamespaceQuestioner::class], []);
        $answers = $this->createQuestioner(['Dancer', 'Rollerworks\Something'])->interact($profile)->getAnswers();

        self::assertSame(['name' => 'Dancer', 'namespace' => 'Rollerworks\Something'], $answers);
    }

    /**
     * @test
     */
    public function it_skips_optional_questions()
    {
        $profile = new Dance('test/test', '', [NameQuestioner::class, OptionalPathQuestioner::class], []);
        $answers = $this->createQuestioner(['Dancer', ''])->interact($profile)->getAnswers();

        self::assertSame(['name' => 'Dancer', 'path' => '/'], $answers);
    }

    /**
     * @test
     */
    public function it_asks_optional_questions_when_needed()
    {
        $profile = new Dance('test/test', '', [NameQuestioner::class, OptionalPathQuestioner::class], []);
        $answers = $this->createQuestioner(['Dancer', 'src/'])->interact($profile, false)->getAnswers();

        self::assertSame(['name' => 'Dancer', 'path' => 'src/'], $answers);
    }

    /**
     * @test
     */
    public function it_provides_defaults_for_the_user()
    {
        // NB. "\n" means confirm as-is (the current default value).
        $profile = new Dance('test/test', '', [NameQuestioner::class, OptionalPathQuestioner::class], []);
        $answers = $this->createQuestioner(['Dancer', "\n"])->interact($profile)->getAnswers();

        self::assertSame(['name' => 'Dancer', 'path' => '/'], $answers);
    }

    /**
     * @param array $input
     *
     * @return SymfonyStyle
     */
    private function createStyle(array $input)
    {
        $this->input = new ArrayInput([]);
        $this->input->setStream($this->getInputStream($input));
        $this->input->setInteractive(true);

        $this->output = new StreamOutput(fopen('php://memory', 'w', false));
        $this->output->setDecorated(false);

        return new SymfonyStyle($this->input, $this->output);
    }

    private function getInputStream($input)
    {
        $input = implode(PHP_EOL, $input);

        $stream = fopen('php://memory', 'r+', false);
        fwrite($stream, $input);
        rewind($stream);

        return $stream;
    }

    private function createQuestioner(array $input): InteractiveQuestionInteractor
    {
        $style = $this->createStyle($input);
        $this->setUpContainer();

        return new InteractiveQuestionInteractor($style, new BufferedIO(), $this->container['class_initializer']);
    }
}


text: <Instance Key="Red" Type="Color"><Property Name="Color" Value="Red" /></Instance>


text:
<?php

namespace OpenCFP\Infrastructure\Persistence;

use OpenCFP\Domain\Entity\User;
use OpenCFP\Domain\EntityNotFoundException;
use OpenCFP\Domain\Speaker\SpeakerRepository;
use Spot\Mapper;

class SpotSpeakerRepository implements SpeakerRepository
{
    /**
     * @var Mapper
     */
    protected $mapper;

    public function __construct(Mapper $mapper)
    {
        $this->mapper = $mapper;
    }

    /**
     * {@inheritdoc}
     */
    public function findById($speakerId)
    {
        $speaker = $this->mapper->get($speakerId);

        if (false === $speaker) {
            throw new EntityNotFoundException;
        }

        return $speaker;
    }

    /**
     * {@inheritdoc}
     */
    public function persist(User $speaker)
    {
    }
}


text:
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F1xx_HAL_FLASH_H
#define __STM32F1xx_HAL_FLASH_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal_def.h"

/** @addtogroup STM32F1xx_HAL_Driver
  * @{
  */

/** @addtogroup FLASH
  * @{
  */

/** @addtogroup FLASH_Private_Constants
  * @{
  */
#define FLASH_TIMEOUT_VALUE   ((uint32_t)50000)/* 50 s */
/**
  * @}
  */

/** @addtogroup FLASH_Private_Macros
  * @{
  */

#define IS_FLASH_TYPEPROGRAM(VALUE)  (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
                                      ((VALUE) == FLASH_TYPEPROGRAM_WORD)     || \
                                      ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))

#if   defined(FLASH_ACR_LATENCY)
#define IS_FLASH_LATENCY(__LATENCY__) (((__LATENCY__) == FLASH_LATENCY_0) || \
                                       ((__LATENCY__) == FLASH_LATENCY_1) || \
                                       ((__LATENCY__) == FLASH_LATENCY_2))

#else
#define IS_FLASH_LATENCY(__LATENCY__)   ((__LATENCY__) == FLASH_LATENCY_0)
#endif /* FLASH_ACR_LATENCY */
/**
  * @}
  */

/* Exported types ------------------------------------------------------------*/
/** @defgroup FLASH_Exported_Types FLASH Exported Types
  * @{
  */

/**
  * @brief  FLASH Procedure structure definition
  */
typedef enum
{
  FLASH_PROC_NONE              = 0,
  FLASH_PROC_PAGEERASE         = 1,
  FLASH_PROC_MASSERASE         = 2,
  FLASH_PROC_PROGRAMHALFWORD   = 3,
  FLASH_PROC_PROGRAMWORD       = 4,
  FLASH_PROC_PROGRAMDOUBLEWORD = 5
} FLASH_ProcedureTypeDef;

/**
  * @brief  FLASH handle Structure definition
  */
typedef struct
{
  __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /*!< Internal variable to indicate which procedure is ongoing or not in IT context */

  __IO uint32_t               DataRemaining;    /*!< Internal variable to save the remaining pages to erase or half-word to program in IT context */

  __IO uint32_t               Address;          /*!< Internal variable to save address selected for program or erase */

  __IO uint64_t               Data;             /*!< Internal variable to save data to be programmed */

  HAL_LockTypeDef             Lock;             /*!< FLASH locking object                */

  __IO uint32_t               ErrorCode;        /*!< FLASH error code
                                                     This parameter can be a value of @ref FLASH_Error_Codes  */
} FLASH_ProcessTypeDef;

/**
  * @}
  */

/* Exported constants --------------------------------------------------------*/
/** @defgroup FLASH_Exported_Constants FLASH Exported Constants
  * @{
  */

/** @defgroup FLASH_Error_Codes FLASH Error Codes
  * @{
  */

#define HAL_FLASH_ERROR_NONE      ((uint32_t)0x00)  /*!< No error */
#define HAL_FLASH_ERROR_PROG      ((uint32_t)0x01)  /*!< Programming error */
#define HAL_FLASH_ERROR_WRP       ((uint32_t)0x02)  /*!< Write protection error */
#define HAL_FLASH_ERROR_OPTV      ((uint32_t)0x04)

/**
  * @}
  */

/** @defgroup FLASH_Type_Program FLASH Type Program
  * @{
  */
#define FLASH_TYPEPROGRAM_HALFWORD   ((uint32_t)0x01)  /*!<Program a half-word (16-bit) at a specified address.*/
#define FLASH_TYPEPROGRAM_WORD       ((uint32_t)0x02)  /*!<Program a word (32-bit) at a specified address.*/
#define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03)  /*!<Program a double word (64-bit) at a specified address*/

/**
  * @}
  */

#if   defined(FLASH_ACR_LATENCY)
/** @defgroup FLASH_Latency FLASH Latency
  * @{
  */
#define FLASH_LATENCY_0            ((uint32_t)0x00000000)    /*!< FLASH Zero Latency cycle */
#define FLASH_LATENCY_1            FLASH_ACR_LATENCY_0       /*!< FLASH One Latency cycle */
#define FLASH_LATENCY_2            FLASH_ACR_LATENCY_1       /*!< FLASH Two Latency cycles */

/**
  * @}
  */

#else
/** @defgroup FLASH_Latency FLASH Latency
  * @{
  */
#define FLASH_LATENCY_0            ((uint32_t)0x00000000)    /*!< FLASH Zero Latency cycle */

/**
  * @}
  */

#endif /* FLASH_ACR_LATENCY */
/**
  * @}
  */

/* Exported macro ------------------------------------------------------------*/

/** @defgroup FLASH_Exported_Macros FLASH Exported Macros
 *  @brief macros to control FLASH features
 *  @{
 */

/** @defgroup FLASH_Half_Cycle FLASH Half Cycle
 *  @brief macros to handle FLASH half cycle
 * @{
 */

/**
  * @brief  Enable the FLASH half cycle access.
  * @note   half cycle access can only be used with a low-frequency clock of less than
            8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
  * @retval None
  */
#define __HAL_FLASH_HALF_CYCLE_ACCESS_ENABLE()  (FLASH->ACR |= FLASH_ACR_HLFCYA)

/**
  * @brief  Disable the FLASH half cycle access.
  * @note   half cycle access can only be used with a low-frequency clock of less than
            8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
  * @retval None
  */
#define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA))

/**
  * @}
  */

#if defined(FLASH_ACR_LATENCY)
/** @defgroup FLASH_EM_Latency FLASH Latency
 *  @brief macros to handle FLASH Latency
 * @{
 */

/**
  * @brief  Set the FLASH Latency.
  * @param  __LATENCY__: FLASH Latency
  *         The value of this parameter depend on device used within the same series
  * @retval None
  */
#define __HAL_FLASH_SET_LATENCY(__LATENCY__)    (FLASH->ACR = (FLASH->ACR&(~FLASH_ACR_LATENCY)) | (__LATENCY__))

/**
  * @brief  Get the FLASH Latency.
  * @retval FLASH Latency
  *          The value of this parameter depend on device used within the same series
  */
#define __HAL_FLASH_GET_LATENCY()     (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))

/**
  * @}
  */

#endif /* FLASH_ACR_LATENCY */
/** @defgroup FLASH_Prefetch FLASH Prefetch
 *  @brief macros to handle FLASH Prefetch buffer
 * @{
 */
/**
  * @brief  Enable the FLASH prefetch buffer.
  * @retval None
  */
#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE()    (FLASH->ACR |= FLASH_ACR_PRFTBE)

/**
  * @brief  Disable the FLASH prefetch buffer.
  * @retval None
  */
#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE()   (FLASH->ACR &= (~FLASH_ACR_PRFTBE))

/**
  * @}
  */

/**
  * @}
  */

/* Include FLASH HAL Extended module */
#include "stm32f1xx_hal_flash_ex.h"

/* Exported functions --------------------------------------------------------*/
/** @addtogroup FLASH_Exported_Functions
  * @{
  */

/** @addtogroup FLASH_Exported_Functions_Group1
  * @{
  */
/* IO operation functions *****************************************************/
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);

/* FLASH IRQ handler method */
void       HAL_FLASH_IRQHandler(void);
/* Callbacks in non blocking modes */
void       HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
void       HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);

/**
  * @}
  */

/** @addtogroup FLASH_Exported_Functions_Group2
  * @{
  */
/* Peripheral Control functions ***********************************************/
HAL_StatusTypeDef HAL_FLASH_Unlock(void);
HAL_StatusTypeDef HAL_FLASH_Lock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);

/**
  * @}
  */

/** @addtogroup FLASH_Exported_Functions_Group3
  * @{
  */
/* Peripheral State and Error functions ***************************************/
uint32_t HAL_FLASH_GetError(void);

/**
  * @}
  */

/**
  * @}
  */

/* Private function -------------------------------------------------*/
/** @addtogroup FLASH_Private_Functions
 * @{
 */
void                    FLASH_PageErase(uint32_t PageAddress);
HAL_StatusTypeDef       FLASH_WaitForLastOperation(uint32_t Timeout);
#if defined(FLASH_BANK2_END)
HAL_StatusTypeDef       FLASH_WaitForLastOperationBank2(uint32_t Timeout);
#endif /* FLASH_BANK2_END */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* __STM32F1xx_HAL_FLASH_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/


text:
class Beaneater
  # Beanstalk tube which contains jobs which can be inserted, reserved, et al.
  class Tube

    # @!attribute name
    #   @return [String] name of the tube
    # @!attribute client
    #   @return [Beaneater] returns the client instance
    attr_reader :name, :client

    # Fetches the specified tube.
    #
    # @param [Beaneater] client The beaneater client instance.
    # @param [String] name The name for this tube.
    # @example
    #  Beaneater::Tube.new(@client, 'tube-name')
    #
    def initialize(client, name)
      @client = client
      @name = name.to_s
      @mutex = Mutex.new
    end

    # Delegates transmit to the connection object.
    #
    # @see Beaneater::Connection#transmit
    def transmit(command, options={})
      client.connection.transmit(command, **options)
    end

    # Inserts job with specified body onto tube.
    #
    # @param [String] body The data to store with this job.
    # @param [Hash{String => Integer}] options The settings associated with this job.
    # @option options [Integer] pri priority for this job
    # @option options [Integer] ttr time to respond for this job
    # @option options [Integer] delay delay for this job
    # @return [Hash{String => String, Number}] beanstalkd command response
    # @example
    #   @tube.put "data", :pri => 1000, :ttr => 10, :delay => 5
    #
    # @api public
    def put(body, options={})
      safe_use do
        serialized_body = config.job_serializer.call(body)

        options = {
          :pri   => config.default_put_pri,
          :delay => config.default_put_delay,
          :ttr   => config.default_put_ttr
        }.merge(options)

        cmd_options = "#{options[:pri]} #{options[:delay]} #{options[:ttr]} #{serialized_body.bytesize}"
        transmit("put #{cmd_options}\r\n#{serialized_body}")
      end
    end

    # Peek at next job within this tube in given `state`.
    #
    # @param [String] state The job state to peek at (`ready`, `buried`, `delayed`)
    # @return [Beaneater::Job] The next job within this tube.
    # @example
    #  @tube.peek(:ready) # => <Beaneater::Job id=5 body=foo>
    #
    # @api public
    def peek(state)
      safe_use do
        res = transmit("peek-#{state}")
        Job.new(client, res)
      end
    rescue Beaneater::NotFoundError
      # Return nil if not found
      nil
    end

    # Reserves the next job from tube.
    #
    # @param [Integer] timeout Number of seconds before timing out
    # @param [Proc] block Callback to perform on reserved job
    # @yield [job] Job that was reserved.
    # @return [Beaneater::Job] Job that was reserved.
    # @example
    #  @tube.reserve # => <Beaneater::Job id=5 body=foo>
    #
    # @api public
    def reserve(timeout=nil, &block)
      client.tubes.watch!(self.name)
      client.tubes.reserve(timeout, &block)
    end

    # Kick specified number of jobs from buried to ready state.
    #
    # @param [Integer] bounds The number of jobs to kick.
    # @return [Hash{String => String, Number}] Beanstalkd command response
    # @example
    #   @tube.kick(5)
    #
    # @api public
    def kick(bounds=1)
      safe_use { transmit("kick #{bounds}") }
    end

    # Returns related stats for this tube.
    #
    # @return [Beaneater::StatStruct] Struct of tube related values
    # @example
    #  @tube.stats.current_jobs_delayed # => 24
    #
    # @api public
    def stats
      res = transmit("stats-tube #{name}")
      StatStruct.from_hash(res[:body])
    end

    # Pause the execution of this tube for specified `delay`.
    #
    # @param [Integer] delay Number of seconds to delay tube execution
    # @return [Array<Hash{String => String, Number}>] Beanstalkd command response
    # @example
    #   @tube.pause(10)
    #
    # @api public
    def pause(delay)
      transmit("pause-tube #{name} #{delay}")
    end

    # Clears all unreserved jobs in all states from the tube
    #
    # @example
    #   @tube.clear
    #
    def clear
      client.tubes.watch!(self.name)
      %w(delayed buried ready).each do |state|
        while job = self.peek(state.to_sym)
          begin
            job.delete
          rescue Beaneater::UnexpectedResponse, Beaneater::NotFoundError
            # swallow any issues
          end
        end
      end
      client.tubes.ignore(name)
    rescue Beaneater::NotIgnoredError
      # swallow any issues
    end

    # String representation of tube.
    #
    # @return [String] Representation of tube including name.
    # @example
    #  @tube.to_s # => "#<Beaneater::Tube name=foo>"
    #
    def to_s
      "#<Beaneater::Tube name=#{name.inspect}>"
    end
    alias :inspect :to_s

    protected

    # Transmits a beanstalk command that requires this tube to be set as used.
    #
    # @param [Proc] block Beanstalk command to transmit.
    # @return [Object] Result of block passed
    # @example
    #  safe_use { transmit("kick 1") }
    #    # => "Response to kick command"
    #
    def safe_use(&block)
      @mutex.lock
      client.tubes.use(self.name)
      yield
    ensure
      @mutex.unlock
    end

    # Returns configuration options for beaneater
    #
    # @return [Beaneater::Configuration] configuration object
    def config
      Beaneater.configuration
    end
  end # Tube
end # Beaneater


text:
import Component from "./mozart.js";

let dropdown_button = new Component("dropdown_button");

export default dropdown_button;


text:
!-------------------------------------------------------------
! Copyright (c) 2013-2013 Kawai Yuta. All rights reserved.
!-------------------------------------------------------------
!> @brief a template module
!!
!! @author Kawai Yuta
!!
!!
module HydroBouEqSolverSelfStart_mod

  ! モジュール引用; Use statements
  !
  use dc_types, only: &
       & DP, STRING

  use dc_message, only: &
       & MessageNotify

  use VectorSpace_mod, only: &
       & Vector3d

  use PolyMesh_mod, only: &
       & PolyMesh

  use GeometricField_mod, only: &
       & volScalarField, pointScalarField, surfaceScalarField, &
       & GeometricField_Init, GeometricField_Final, &
       & assignment(=), operator(+), operator(-), operator(*), operator(/), &
       & DeepCopy

  use fvCalculus_mod, only: &
       & curl, grad, div

  use Constants_mod, only: &
       & Omega, Grav

  use GridSet_mod, only: &
       & GridSet_getLocalMeshInfo, &
       & nVzLyr, nVrLyr, vHaloSize

  use EOSDriver_mod, only: &
       & EOSDriver_Eval

  use CGridFieldDataUtil_mod, only: &
       & e_c, ToTangentVel

  use VGridFieldDataUtil_mod, only: &
       & z_r, r_z, verticalInt

  use VariableSet_mod, only: &
       & VariableSet, &
       & SaltTracerID, PTempTracerID, TracerNum, &
       & refDens

  use HydroBouEqSolver_mod, only: &
       & diagnosePress, diagnosevNormVel

  use HydroBouEqSolverRHS_mod, only: &
       & HydroBouEqSolverRHS_Init, HydroBouEqSolverRHS_Final, &
       & calc_RHShNormVel, calc_RHSTracer, calc_RHSLyrThick

  ! 宣言文; Declareration statements
  !
  implicit none
  private

  ! 公開手続き
  ! Public procedure
  !
  public :: HydroBouEqSolverSelfStart_Init, HydroBouEqSolverSelfStart_Final
  public :: HydroBouEqSolverSelfStart_AdvanceTStep

  ! 非公開手続き
  ! Private procedure
  !

  ! 非公開変数
  ! Private variable
  !
  character(*), parameter:: module_name = 'HydroBouEqSolverSelfStart_mod' !< Module Name
  type(PolyMesh), pointer :: mesh

contains

  !>
  !!
  !!
  subroutine HydroBouEqSolverSelfStart_Init(plMesh)

    ! モジュール引用; Use statement
    !

    ! 宣言文; Declaration statement
    !
    type(PolyMesh), intent(in), target :: plMesh

    ! 実行文; Executable statements
    !

    mesh => plMesh

  end subroutine HydroBouEqSolverSelfStart_Init

  !>
  !!
  !!
  subroutine HydroBouEqSolverSelfStart_AdvanceTStep(var)

    ! モジュール引用; Use statements
    !
    use TemporalIntegSet_mod, only: &
       & DelTime, SubCycleNum, &
       & Al, Nl, Bl, &
       & As, Ns, Bs

    ! 宣言文; Declaration statement
    !
    type(VariableSet), intent(inout) :: var

    ! 局所変数
    ! Local variables
    !

    real(DP) :: dt
    integer :: n

    type(surfaceScalarField) :: ze_hNormVel, ze_hNormVelTmp, ze_hNormVel0, ze_RHShNormVel
    type(volScalarField) :: zc_lyrThick, zc_lyrThickTmp, zc_lyrThick0, zc_RHSlyrThick
    type(surfaceScalarField) :: ze_massHFluxTmp
    type(volScalarField) :: zc_TracersTmp(TracerNum), zc_Tracers0(TracerNum), zc_Tracers(TracerNum), &
         & zc_RHSTracers(TracerNum)

    integer :: nIntrnalLoop
    integer :: internalStep

    ! 実行文; Executable statements
    !

    nIntrnalLoop = SubCycleNum*2
    dt = DelTime/dble(nIntrnalLoop)

    call GeometricField_Init(ze_hNormVel0, mesh, "ze_hNormVel0", vHaloSize=vHaloSize)
    call GeometricField_Init(ze_RHShNormVel, mesh, "ze_RHShNormVel", vHaloSize=vHaloSize)
    ze_hNormVel = var%ze_hNormVel(Nl)

    call GeometricField_Init(zc_lyrThick0, mesh, "zc_lyrThick0", vHaloSize=vHaloSize)
    call GeometricField_Init(zc_RHSlyrThick, mesh, "zc_RHSlyrThick", vHaloSize=vHaloSize)
    zc_lyrThick = var%zc_lyrThick(Nl)

    do n=1, TracerNum
       call GeometricField_Init(zc_Tracers0(n), mesh, "zc_Tracers0", vHaloSize=vHaloSize)
       call GeometricField_Init(zc_RHSTracers(n), mesh, "zc_RHSTracers", vHaloSize=vHaloSize)
       zc_Tracers(n) = var%zc_Tracers(n,Nl)
    end do

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    do internalStep=1, nIntrnalLoop
       call MessageNotify("M", module_name, "Self starting.. %d/%d", i=(/ internalStep, nIntrnalLoop /))
       call advanceIntrnalStep()
    end do

    var%ze_hNormVel(Al) = ze_hNormVel
    var%zc_lyrThick(Al) = zc_lyrThick
    do n=1, TracerNum
       var%zc_Tracers(n,Al) = zc_Tracers(n)
    end do

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    call GeometricField_Final(ze_RHShNormVel)
    call GeometricField_Final(ze_hNormVel)
    call GeometricField_Final(ze_hNormVel0)
    call GeometricField_Final(ze_hNormVelTmp)

    call GeometricField_Final(zc_RHSlyrThick)
    call GeometricField_Final(zc_lyrThick)
    call GeometricField_Final(zc_lyrThick0)
    call GeometricField_Final(zc_lyrThickTmp)

    call GeometricField_Final(ze_massHFluxTmp)

    do n=1, TracerNum
       call GeometricField_Final(zc_Tracers0(n))
       call GeometricField_Final(zc_TracersTmp(n))
       call GeometricField_Final(zc_Tracers(n))
       call GeometricField_Final(zc_RHSTracers(n))
    end do

  contains
    subroutine advanceIntrnalStep()
      integer :: RKStep
      real(DP), parameter :: RKCoef(4) = (/ 1d0, 2d0, 2d0, 1d0 /)
      integer :: tmpBl

      ze_RHShNormVel = 0d0
      call DeepCopy(ze_hNormVel0, ze_hNormVel)

      zc_RHSlyrThick = 0d0
      do n=1, TracerNum
         zc_RHSTracers(n) = 0d0
      end do

      do RKStep=1, size(RKCoef)

           ze_hNormVelTmp = ze_hNormVel0 + (dt/RKCoef(RKStep))*ze_RHShNormVel
           zc_lyrThickTmp = zc_lyrThick0 + (dt/RKCoef(RKStep))*zc_RHSlyrThick

           do n=1, TracerNum
              zc_TracersTmp(n) = zc_Tracers0(n) + (-dt/RKCoef(RKStep))*zc_RHSTracers(n)
           end do

           call EOSDriver_Eval( rho=var%zc_Dens, &
                & theta=zc_TracersTmp(PTempTracerID), S=zc_TracersTmp(SaltTracerID), p=var%zc_Press)

           call diagnosePress( var%zc_Press, &
                & var%zc_Dens, zc_lyrThickTmp, var%c_surfPress)

           call calc_RHShNormVel( ze_RHShNormVel, &
                & ze_hNormVelTmp, var%rc_vNormVel, zc_lyrThickTmp, var%zc_ZMid, var%zc_Press, var%zc_Dens )

           ze_massHFluxTmp = ze_hNormVelTmp*e_c(zc_lyrThickTmp)
           call calc_RHSLyrThick( zc_RHSlyrThick, &
                & ze_massHFluxTmp, var%rc_vNormVel )

           do n=1, TracerNum
              call calc_RHSTracer( zc_RHSTracers(n), &
                   & zc_TracersTmp(n), ze_massHFluxTmp, var%rc_vNormVel )
           end do

           var%ze_hNormVel(Al) = var%ze_hNormVel(Al) + (dt/RKCoef(RKStep))*ze_RHShNormVel
           var%zc_lyrThick(Al) = var%zc_lyrThick(Al) + (dt/RKCoef(RKStep))*zc_RHSlyrThick
           do n=1, TracerNum
              var%zc_Tracers(n,Al) = var%zc_Tracers(n,Al) + (dt/RKCoef(RKStep))*zc_RHSTracers(n)
           end do

        end do

        tmpBl = Bl
        Bl = Nl
        Nl = Al
        Al = tmpBl

      end subroutine advanceIntrnalStep

  end subroutine HydroBouEqSolverSelfStart_AdvanceTStep

  !>
  !!
  !!
  subroutine HydroBouEqSolverSelfStart_Final()

    ! 実行文; Executable statements
    !

    mesh => null()

  end subroutine HydroBouEqSolverSelfStart_Final

end module HydroBouEqSolverSelfStart_mod


text:
{-# LANGUAGE DeriveDataTypeable #-}
-- |
-- Abstract syntax tree for protobuf file
--
-- Message and enum names are represented as their name and path to
-- the name in global namespace.
module Data.Protobuf.Internal.AST (
    -- * Protobuf AST
    Protobuf(..)
    -- ** Enums
  , EnumDecl(..)
  , EnumField(..)
    -- ** Messages
  , Message(..)
  , MessageField(..)
  , Extension(..)
  , Field(..)
    -- * Basic types
  , QIdentifier(..)
  , FieldTag(..)
    -- * Protobuf types
  , Modifier(..)
  , Type(..)
  , PrimType(..)
  , TypeLabel(..)
  , typeLabel
    -- * Options
  , Option(..)
  , OptionVal(..)
  , lookupOption
  , lookupOptionStr
  ) where

import Data.Data
import Data.Protobuf.Internal.Names

-- | Top level declarations
data Protobuf =
    Import      String
    -- ^ Import declaration
  | Package     (QualifiedId TagType)
    -- ^ Specify package for module
  | TopMessage  Message
    -- ^ Message type
  | Extend      QIdentifier [MessageField]
    -- ^ Extend message. NOT IMPLEMENTED
  | TopEnum     EnumDecl
    -- ^ Enumeration
  | TopOption   Option
    -- ^ Top level option
  deriving (Show,Typeable,Data)

-- | Enumeration declaration. Parameters are
--
--   * Enum name
--
--   * Fields of enumeration
data EnumDecl = EnumDecl
                (QualifiedId TagType)
                [EnumField]
                deriving (Show,Typeable,Data)

-- | Enumeration field
data EnumField
  = EnumField  (Identifier TagType) Integer
  | EnumOption Option
  deriving (Show,Typeable,Data)

-- | Message declaration
--
--   * Message name
--
--   * Message fields
data Message = Message
               (QualifiedId TagType)
               [MessageField]
               deriving (Show,Typeable,Data)

-- | Single field in message body. Note that groups are not supported.
data MessageField
  = MessageField Field
    -- ^ Message field
  | MessageEnum EnumDecl
    -- ^ Enumeration declaration
  | Nested Message
    -- ^ Nested message
  | MsgExtend -- FIXME
    -- ^ Extend other type
  | Extensions Extension
    -- ^ Tag range for extensions
  | MsgOption Option
    -- ^ Options for message
  deriving (Show,Typeable,Data)

-- | Tag interval for extensions
data Extension
  = Extension     Int Int
  | ExtensionOpen Int
  deriving (Show,Typeable,Data)

-- | Sinlge field of message
data Field = Field Modifier Type (Identifier TagField) FieldTag [Option]
           deriving (Show,Typeable,Data)

----------------------------------------------------------------
-- Basic types
----------------------------------------------------------------

-- | Data type identifier
data QIdentifier
  = QualId     (QualifiedId TagType) -- ^ Qualified identifier
  | FullQualId (QualifiedId TagType) -- ^ Fully qualified identifier
  deriving (Typeable,Data)

instance Show QIdentifier where
  show (QualId     n) = show n
  show (FullQualId n) = '.' : show n

-- | Field tag
newtype FieldTag = FieldTag Integer
                 deriving (Show,Typeable,Data)

-- | Modifier for data
data Modifier = Required
              | Optional
              | Repeated
              deriving (Show,Eq,Typeable,Data)

-- | Type of the field
data Type
  = SomeType QIdentifier        -- ^ Identifier of unknown type
  | MsgType  QIdentifier        -- ^ Message type
  | EnumType QIdentifier        -- ^ Enumeration type
  | BaseType PrimType           -- ^ Built-in type
  deriving (Show,Typeable,Data)

-- | Primitive types
data PrimType
  = PbDouble   -- ^ Double
  | PbFloat    -- ^ Float
  | PbInt32    -- ^ 32-bit signed integer (inefficient encoding for negative integers)
  | PbInt64    -- ^ 64-bit signed integer (inefficient encoding for negative integers)
  | PbUInt32   -- ^ 32-bit unsigned integer
  | PbUInt64   -- ^ 64-bit unsigned integer
  | PbSInt32   -- ^ 32-bit signed integer (uses zig-zag encoding)
  | PbSInt64   -- ^ 64-bit signed integer (uses zig-zag encoding)
  | PbFixed32  -- ^ Fixed size 32-bit number
  | PbFixed64  -- ^ Fixed size 64-bit number
  | PbSFixed32 -- ^ Fixed size 32-bit number
  | PbSFixed64 -- ^ Fixed size 64-bit number
  | PbBool     -- ^ Boolean
  | PbString   -- ^ UTF8 encoded string
  | PbBytes    -- ^ Byte sequence
  deriving (Show,Eq,Typeable,Data)

-- | Type label which is used in encoding
data TypeLabel
  = LAB_VARINT
  | LAB_FIXED64
  | LAB_LENDELIM
  | LAB_STARTGR
  | LAB_ENDGR
  | LAB_FIXED32
  deriving (Show,Eq,Enum,Typeable,Data)

typeLabel :: PrimType -> TypeLabel
typeLabel PbDouble   = LAB_FIXED64
typeLabel PbFloat    = LAB_FIXED32
typeLabel PbInt32    = LAB_VARINT
typeLabel PbInt64    = LAB_VARINT
typeLabel PbUInt32   = LAB_VARINT
typeLabel PbUInt64   = LAB_VARINT
typeLabel PbSInt32   = LAB_VARINT
typeLabel PbSInt64   = LAB_VARINT
typeLabel PbFixed32  = LAB_FIXED32
typeLabel PbFixed64  = LAB_FIXED64
typeLabel PbSFixed32 = LAB_FIXED32
typeLabel PbSFixed64 = LAB_FIXED64
typeLabel PbBool     = LAB_VARINT
typeLabel PbString   = LAB_LENDELIM
typeLabel PbBytes    = LAB_LENDELIM

data Option = Option (QualifiedId TagOption) OptionVal
            deriving (Show,Typeable,Data)

lookupOption :: QualifiedId TagOption -> [Option] -> Maybe OptionVal
lookupOption _ [] = Nothing
lookupOption q (Option qi v : opts)
  | q == qi   = Just v
  | otherwise = lookupOption q opts

lookupOptionStr :: String -> [Option] -> Maybe OptionVal
lookupOptionStr = lookupOption . Qualified [] . Identifier

data OptionVal
  = OptString String
  | OptBool   Bool
  | OptInt    Integer
  | OptReal   Rational
  deriving (Show,Eq,Typeable,Data)


text:
#include <zephyr/kernel.h>
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
#include <zephyr/arch/arm/aarch32/cortex_m/fpu.h>

/**
 * @file @brief Helper functions for saving and restoring the FP context.
 *
 */

void z_arm_save_fp_context(struct fpu_ctx_full *buffer)
{
#if defined(CONFIG_FPU_SHARING)
	__ASSERT_NO_MSG(buffer != NULL);

	uint32_t CONTROL = __get_CONTROL();

	if (CONTROL & CONTROL_FPCA_Msk) {
		/* Store caller-saved and callee-saved FP registers. */
		__asm__ volatile(
			"vstmia %0, {s0-s15}\n"
			"vstmia %1, {s16-s31}\n"
			:: "r" (buffer->caller_saved), "r" (buffer->callee_saved) :
		);

		buffer->fpscr = __get_FPSCR();
		buffer->ctx_saved = true;

		/* Disable FPCA so no stacking of FP registers happens in TFM. */
		__set_CONTROL(CONTROL & ~CONTROL_FPCA_Msk);

		/* ISB is recommended after setting CONTROL. It's not needed
		 * here though, since FPCA should have no impact on instruction
		 * fetching.
		 */
	}
#endif
}

void z_arm_restore_fp_context(const struct fpu_ctx_full *buffer)
{
#if defined(CONFIG_FPU_SHARING)
	if (buffer->ctx_saved) {
		/* Set FPCA first so it is set even if an interrupt happens
		 * during restoration.
		 */
		__set_CONTROL(__get_CONTROL() | CONTROL_FPCA_Msk);

		/* Restore FP state. */
		__set_FPSCR(buffer->fpscr);

		__asm__ volatile(
			"vldmia %0, {s0-s15}\n"
			"vldmia %1, {s16-s31}\n"
			:: "r" (buffer->caller_saved), "r" (buffer->callee_saved) :
		);
	}
#endif
}


text:
- (instancetype)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        <#statements#>
    }
    return self;
}


text:
#include <iostream>
#include <fstream>

namespace Platformer
{
	void PlatformerScene::editorInit()
	{
		editorChosenItem = '8';
		peekEnabled = false;

		editorItemsMenu = Menu::create();
		addChild(editorItemsMenu);

		game->state = GameStates::Editor;

		auto touch = EventListenerTouchOneByOne::create();
		touch->onTouchBegan = CC_CALLBACK_2(PlatformerScene::editorTouchBegan, this);
		touch->onTouchMoved = CC_CALLBACK_2(PlatformerScene::editorTouchMoved, this);
		touch->onTouchEnded = CC_CALLBACK_2(PlatformerScene::editorTouchEnded, this);
		touch->onTouchCancelled = CC_CALLBACK_2(PlatformerScene::editorTouchEnded, this);
		getEventDispatcher()->addEventListenerWithSceneGraphPriority(touch, this);

		auto keyboard = EventListenerKeyboard::create();
		keyboard->onKeyPressed = CC_CALLBACK_2(PlatformerScene::editorKeyboardPressed, this);
		keyboard->onKeyReleased = CC_CALLBACK_2(PlatformerScene::editorKeyboardReleased, this);
		getEventDispatcher()->addEventListenerWithSceneGraphPriority(keyboard, this);
		_shift = _ctrl = _alt = false;

		vbar->addChild(btnItem = MAKEBUTTON("Platformer_itemsup", "Platformer_itemsdn", PlatformerScene::editorBtnItemsPressed));
		editorPickChar('8');

		vbar->addChild(MAKEBUTTON("Platformer_refup", "Platformer_refdn", PlatformerScene::editorBtnOpenPressed));
		vbar->addChild(MAKEBUTTON("Platformer_saveup", "Platformer_savedn", PlatformerScene::editorBtnSavePressed));

		{
			string sprite = game->state != GameStates::Editor ? "Platformer_play" : "Platformer_pause";
			string psprite = sprite + "dn";
			//sprite += "up";
			sprite = psprite;
			btnPlay = MAKEBUTTON(sprite, psprite, PlatformerScene::editorBtnPlayPressed);
			vbar->addChild(btnPlay);
		}

		{
			string sprite = peekEnabled ? "Platformer_move" : "Platformer_plus";
			string psprite = sprite + "dn";
			//sprite += "up";
			sprite = psprite;
			btnPeek = MAKEBUTTON(sprite, psprite, PlatformerScene::editorBtnPeekPressed);
			auto disabledImg = MAKESPRITE("Platformer_plusup");
			disabledImg->setOpacity(100);
			btnPeek->setDisabledImage(disabledImg);
			if (game->state != GameStates::Editor) btnPeek->setEnabled(false);
			vbar->addChild(btnPeek);
		}

		game->player->immortal = true;
		vbar->addChild(btnGod = MAKEBUTTON("Platformer_goddn", "Platformer_goddn", PlatformerScene::editorBtnGodPressed));
	}

	bool PlatformerScene::editorTouchBegan(Touch* touch, Event*)
	{
		if (game->state != GameStates::Editor) return false;

		if (peekEnabled)
		{
			return true; //enable grabbing move events
		}
		else
		{
			//paste mode
			editorPasteItem(touch->getLocation() - game->getPosition());
			return true;
		}

		return false;
	}

	void PlatformerScene::editorTouchMoved(Touch* touch, Event*)
	{
		if (peekEnabled)
		{
			//peek mode
			auto dv = touch->getLocation() - touch->getPreviousLocation() + game->getPosition();
			log("Current Cam: " + nToString(game->getPosition()) + " dv: " + nToString(dv));
			moveCamera(dv.x, dv.y);
		}
		else
		{
			//paste mode
			//editorPasteItem(game->convertToNodeSpace(touch->getLocation()));
		}
	}

	void PlatformerScene::editorTouchEnded(Touch* touch, Event*)
	{

	}

	void PlatformerScene::editorKeyboardPressed(Key_t k, Event*)
	{
		if (k == Key_t::KEY_SHIFT) _shift = true;
		if (k == Key_t::KEY_CTRL) _ctrl = true;
		if (k == Key_t::KEY_ALT) _alt = true;
		if (k == Key_t::KEY_F1) editorGenerateRandomMap();
		if (k == Key_t::KEY_F2) editorUndo();
		if (k == Key_t::KEY_F3) editorRedo();
		if (k == Key_t::KEY_F4)
		{
			editorSaveMap();
			editorGenerateRandomMap();
		}

		char c = getCharForKeyCode(k, _shift);
		if (c) editorPickChar(c);
	}

	void PlatformerScene::editorKeyboardReleased(Key_t k, Event*)
	{
		if (k == Key_t::KEY_SHIFT) _shift = false;
		if (k == Key_t::KEY_CTRL) _ctrl = false;
		if (k == Key_t::KEY_ALT) _alt = false;
	}

	void PlatformerScene::editorGenerateRandomMap()
	{
		//generate random map
		auto gen = MapGenerator::Generate(MAPMETA_Platformer);
		if (GameSettings::LastWins % 2 == 0)
		{
			auto pos = MapGenerator::AddItem('g', gen, 4);
			log(nToString(pos.x) + "," + nToString(pos.y));
			log(nToString(gen[pos]));
		}
		auto level = MapGenerator::Flatten(gen);

		level.push_back("noscroll");
		level.push_back("scale 0.7");
		editorLoadMap(level);
	}

	void PlatformerScene::editorUndo()
	{
		if (editorUndoList.empty())
		{
			log("Undo stack empty.");
			return;
		}

		editorRedoList.push(levelData);
		editorLoadMap(editorUndoList.top(), false);
		editorUndoList.pop();
	}

	void PlatformerScene::editorRedo()
	{
		if (editorRedoList.empty())
		{
			log("Redo stack empty.");
			return;
		}

		editorLoadMap(editorRedoList.top());
		editorRedoList.pop();
	}

	void PlatformerScene::editorLoadMap(vector<string> level, bool addToUndoStack)
	{
		Director::getInstance()->replaceScene(PlatformerScene::createScene(level));
	}

	void PlatformerScene::editorSaveMap()
	{
		//not implemented
	}

	void PlatformerScene::editorPickChar(char c)
	{
		auto e = Entity::MakeEntity(c);
		if (e && e->sprite)
		{
			auto s = Sprite::createWithSpriteFrame(e->sprite->getSpriteFrame());
			s->setColor(e->sprite->getColor());
			btnItem->setNormalImage(s);
			btnItem->setSelectedImage(Sprite::createWithSpriteFrame(e->sprite->getSpriteFrame()));
		}
		editorChosenItem = c;
	}

	void PlatformerScene::editorPasteItem(Point p)
	{
		p.x = (int) ((p.x) / game->blockSize) * game->blockSize;
		if (p.x > 0) p.x += game->blockSize;
		p.y = (int) ((p.y) / game->blockSize) * game->blockSize;
		if (p.y >= 0) p.y += game->blockSize;

		Entity* e = game->ParseAddEntity(editorChosenItem, Position{ -1, -1 });
		if (e)
		{
			e->setPosition(p);
			game->initEntity(e);
		}
		log("Pasted item " + nToString(editorChosenItem) + " @xy: " + nToString(p));
	}

	void PlatformerScene::editorBtnPlayPressed(Ref*)
	{
		if (game->state == GameStates::Editor)
		{
			game->state = GameStates::Ready;
			btnPeek->setEnabled(false);
		}
		else
		{
			game->state = GameStates::Editor;
			btnPeek->setEnabled(true);
		}

		string sprite = game->state != GameStates::Editor ? "Platformer_play" : "Platformer_pause";
		string psprite = sprite + "dn";
		//sprite += "up";
		sprite = psprite;
		btnPlay->setNormalImage(MAKESPRITE(sprite));
		btnPlay->setSelectedImage(MAKESPRITE(psprite));
	}

	void PlatformerScene::editorBtnItemsPressed(Ref*)
	{

	}

	void PlatformerScene::editorBtnGodPressed(Ref*)
	{
		game->player->immortal = !game->player->immortal;
		string sprite = "Platformer_god";
		if (game->player->immortal) sprite += "dn";
		else sprite += "up";
		btnGod->setNormalImage(MAKESPRITE(sprite));
	}

	void PlatformerScene::editorBtnSavePressed(Ref*)
	{
		FileScene::Caption = "Save level as";
		FileScene::Action = CC_CALLBACK_1(PlatformerScene::editorBtnSavePressed_callback, this);
		Director::getInstance()->pushScene(FileScene::createScene());
	}

	void PlatformerScene::editorBtnSavePressed_callback(string filename)
	{
		string dump = game->dumpLevel();
		GameSettings::Set("LevelData_" + filename, dump);
		log("Level data saved as " + filename);
		Ooze::InstantSend({{ "Event", "LevelSave" }, { "Data", dump }});
		GameSettings::SaveSettings();
	}

	void PlatformerScene::editorBtnOpenPressed(Ref*)
	{
		FileScene::Caption = "Load level from";
		FileScene::Action = CC_CALLBACK_1(PlatformerScene::editorBtnOpenPressed_callback, this);
		Director::getInstance()->pushScene(FileScene::createScene());
	}

	void PlatformerScene::editorBtnOpenPressed_callback(string filename)
	{
		string level = GameSettings::GetStr("LevelData_" + filename);
		if (level == "")
		{
			log("Level [" + filename + "] does not exist. Cannot load.");
			return;
		}
		editorLoadMap(ReadLines(level));
	}

	void PlatformerScene::editorBtnPeekPressed(Ref*)
	{
		peekEnabled = !peekEnabled;

		string sprite = peekEnabled ? "Platformer_move" : "Platformer_plus";
		string psprite = sprite + "dn";
		//sprite += "up";
		sprite = psprite;
		btnPeek->setNormalImage(MAKESPRITE(sprite));
		btnPeek->setSelectedImage(MAKESPRITE(psprite));
	}
}


text:
> Diff checker

![](https://appheim.github.io/diffusive/main.png)

[https://appheim.github.io/diffusive/](https://appheim.github.io/diffusive/)

### Develop
Install dependencies
```
npm install
```
Run
```
npm start
```

### License
[MIT](https://tldrlegal.com/license/mit-license)


text:
function Bowling(){
  this.framesTally = []; //record of all scores
  this.playing = true;
  this.framesNumber = 0; //number of frames played
  this.bonusTally = [];
  this.gameTotal = 0;
  this.secondLastFrameTotal = 0;
  this.thirdLastFrameTotal = 0;
  this.bonusFlattenedTotal = 0;
}

//if roll 9 times, then strike, then one more game then
//playing = !playing

Bowling.prototype.checkPlaying = function(){

  lastFrame = this.framesTally[this.framesTally.length-1];

  if (this.framesNumber === 10){
    if ((lastFrame[0] + lastFrame[1]) < 10){
      this.playing = false;
      // return 'Last frame played'
    }
  }

  if (this.framesNumber === 11){
    if ((lastFrame[0] + lastFrame[1]) < 10){
      this.playing = false;
      // return 'Last frame played'
    }
  }

  if (this.framesNumber === 12){
    if ((lastFrame[0] + lastFrame[1]) < 10){
      this.playing = false;
      // return 'Last frame played'
    }
  }

  if (this.framesNumber === 13){
    this.playing = false;
    // return 'Last frame played'
  }
};

Bowling.prototype.total = function(){

//flatten array of arrays.  concat function needed due to array of array.
    var flattenedFirstTime = this.framesTally.reduce(function(x,y){
      return x.concat(y);
    });

    console.log(flattenedFirstTime);
  //this is to sum the flattened array
    var flattenedFinal = flattenedFirstTime.reduce(function(c,d){
      return c + d;
    });

    console.log(flattenedFinal);

  //flatten bonus array

    this.bonus_review();

    if (this.bonusTally.length > 0){

      var bonusFlattened = this.bonusTally.reduce(function(p,q){
        return p.concat(q);
      });

      this.bonusFlattenedTotal = bonusFlattened.reduce(function(f,g){
        return f + g;
      });
    }

    gameTotal = flattenedFinal+this.bonusFlattenedTotal;

    return gameTotal;
};

Bowling.prototype.roll = function(bowlOne,bowlTwo){

  if(this.playing === false){
    throw new Error('The game has ended');
  } else if ((bowlOne + bowlTwo) > 10) {
    throw new Error('Maximum pins are 10');
  }

  this.framesTally.push([bowlOne,bowlTwo]); //this pushes the next two bowls onto an array

  this.framesNumber += 1;

  this.checkPlaying();
};

Bowling.prototype.bonus_review = function(){
  var framesTally = this.framesTally;
  //if a strike occured in second last frame, repeat the last frame in bonusTally
  if (this.framesNumber > 1){
    if((framesTally[framesTally.length - 2][0]) === 10){
      this.bonusTally.push(framesTally[framesTally.length-1]);
    //if a spare happend in second last frame, push another array with the first bowl of last frame repeated
    } else if ((framesTally[framesTally.length - 2][0])+(framesTally[framesTally.length - 2][1]) === 10){
      this.bonusTally.push([framesTally[framesTally.length-1][0],0]);
    }
  }

  if (this.framesNumber > 2){
    if ((framesTally[framesTally.length - 1][0]) === 10  && (framesTally[framesTally.length - 2][0]) === 10 && (framesTally[framesTally.length - 3][0]) === 10 ){
        this.thirdLastFrameTotal = 30;
        this.bonusTally.push(10);
        console.log(this.bonusTally);

        console.log("3 tens occured");
    }
  }
};

//code to identify individual frame and sum
Bowling.prototype.frameSum = function(frame){

  var frameNo = frame-1;

  var selectedFrame = this.framesTally[frameNo];

  //calculates the 2nd last frame it was a strike or spare
  if (frameNo >= 1){
    if ((this.framesTally[frameNo-1][0])===10){
      this.secondLastFrameTotal = 10 + selectedFrame[0] + selectedFrame[1];

    } else if ((this.framesTally[frameNo-1][0]+this.framesTally[frameNo-1][1])===10){
      this.secondLastFrameTotal = 10 + selectedFrame[0];
      console.log(this.secondLastFrameTotal);
    } else {
      this.secondLastFrameTotal = this.framesTally[frameNo-1][0] + this.framesTally[frameNo-1][1];
    }
  }

  //result is sum of frame just bowled - does not call bonus

  var result = selectedFrame.reduce(function(x,y){
    return x + y;
  });

  return result;
};


text:
/*
 * CreateObjectsFromInput.c++
 *
 *  Created on: Nov 6, 2013
 *      Author: Johno
 */

// JSON parser headers:
#include <autolink.h>
#include <config.h>
#include <features.h>
#include <forwards.h>
#include <json.h>
#include <reader.h>
#include <value.h>
#include <writer.h>

// Standard C++ Library components:
#include <unordered_map>
#include <list>
#include <stdio.h>

// File reading components
#include <iostream>
#include <fstream>

using namespace std;

struct network_components {
	list<Link> *links;
	list<Host> *hosts;
	list<Router> *routers;
};

/* TODO: figure out required router and host parameters and fix required link
 * parameters.
 */
const string REQUIRED_HOST_PARAMETERS [ ] = { /* TODO */ };
const string REQUIRED_ROUTER_PARAMETERS [ ] = { /* TODO */ };
const string REQUIRED_LINK_PARAMETERS [ ] = {"buffer_size", "prop_delay",
		"queue_size", "queue_delay", "capacity", "queue_time", "end_points"};

network_components create_network_from_input(string inputFilePath) {
	// Create file stream from input file to pass to JsonReader
	ifstream is (inputFilePath, ifstream::in);

	/* If unable to open specified input file path, output error messages
	 * and return NULL.
	 */
	if (! is.is_open()) {
		// TODO : handle error messages.
		return NULL;
	}

	// Let's parse the input.
	Json::Value root; // Contains the entire input dictionary, searchable by key.
	Json::Reader reader;

	/* Parse the input file stream, loading the contents into the
	 * "root" Json::Value. The false parameter tells the reader to ignore any
	 * comments. reader.parse() outputs false if it failed to read the stream.
	 * If this happens, give error and return NULL.
	 */
	if (! reader.parse(is, root, false)) {
		// TODO: write error messages and return null.
		return NULL;
	}

	/* Initialize links. Start by collecting defaults. */
	list<Link> links;
	const Json::Value input_links = root["links"];
	const Json::Value link_defaults = root["link_defaults"];

	// Parse the input links.
	for (unsigned int i = 0; i < input_links.size(); ++i) {
		float buffer_size, prop_delay, queue_size, queue_delay, capacity;
		Device *node1, *node2;

		Link current_link = new Link;
		Json::Value current_settings = input_links[i];

		/* Iterate through each of the settings enumerated in REQUIRED_LINK_SETTINGS.
		 * For each required setting, check whether this setting has been defined
		 * on the per-link level. If not, check whether the setting has been
		 * given a default (where applicable). If not, return an error.
		 */
		for (unsigned int s = 0; s < sizeof(REQUIRED_LINK_SETTINGS); ++s) {
			// Name of the current setting
			string setting_name = REQUIRED_LINK_SETTINGS[s];
			// Offset of the setting within the link class.
			int offset = -1;

			/* If the user has failed to specify a required setting for both the
			 * current link and as a default, output an insufficient input error
			 * message and return NULL.
			 */
			if ( !current_settings[setting_name] && !link_defaults[setting_name]) {
				// TODO: output error messages.
				return NULL;
			}

			/* Update our blank link by searching through the JSON input to find
			 * the value for each setting.
			 */
			hash<string> setting_hash, test_hash;
			switch ( setting_hash (setting_name) )
			{
				/* Float/Double settings: */
				case test_hash ("buffer_size"):
						offset = offsetof(Link, buffer_size);
						goto numeric_setting;
				case test_hash("prop_delay"):
						offset = offsetof(Link, prop_delay);
						goto numeric_setting;
				case test_hash("queue_size"):
						offset = offsetof(Link, queue_size);
						goto numeric_setting;
				case test_hash("queue_delay"):
						offset = offsetof(Link, queue_delay);
						goto numeric_setting;
				case test_hash("capacity"):
						offset = offsetof(Link, capacity);
						goto numeric_setting;
				case test_hash("queue_time"):
						offset = offsetof(Link, queue_time);
						goto numeric_setting;

				/* All numeric settings have to be cast from Json::Value to a
				 * numeric type. */
				case numeric_setting:
					float value = current_settings[setting_name].asDouble();
					break;

				/* The "endpoints" setting is handled differently. */
				case test_hash ("endpoint")

				case test_hash ("buffer_size"):
					if ( current_settings[setting_name] )
						current_link.buffer_size =
								current_settings[setting_name].asDouble();
					else
						current_link.buffer_size =
								link_defaults[setting_name].asDouble();
					break;

				case test_hash (prop_delay):
				case test_hash (queue_size):
				case test_hash ()
			}
		}
	}

}


text:
package br.com.caelum.tubaina.gists;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

public class GistFilesDeserializer implements JsonDeserializer<GistedFiles> {

	public GistedFiles deserialize(JsonElement json, Type typeOfT,
			JsonDeserializationContext context) throws JsonParseException {

		List<GistedFile> files = new ArrayList<GistedFile>();

		Set<Entry<String, JsonElement>> filesAtJson = json.getAsJsonObject()
				.entrySet();

		for (Entry<String, JsonElement> f : filesAtJson) {
			JsonElement element = f.getValue();
			String content = element.getAsJsonObject().get("content")
					.getAsString();
			String language = element.getAsJsonObject().get("language")
					.isJsonNull() ? "" : element.getAsJsonObject()
					.get("language").getAsString();
			String filename = f.getKey();
			GistedFile file = new GistedFile(filename, language, content);
			files.add(file);
		}

		return new GistedFiles(files);

	}
}


text:
// Copyright 2020 Google LLC
//
// 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
//
//     https://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.

using CloudNative.CloudEvents;
using Google.Cloud.Functions.Testing;
using Google.Events;
using Google.Events.Protobuf.Cloud.PubSub.V1;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
using Xunit;

namespace Concepts.Tests
{
    public class TimeBoundedRetriesTest : FunctionTestBase<TimeBoundedRetries.Function>
    {
        // Note: In real code I'd use an IClock dependency to make this more reliably testable,
        // but I don't want to add that complexity into a sample.

        [Theory]
        [InlineData("Recent message", 1, "Processing PubSub message 'Recent message'")]
        [InlineData("Old message", 12, "Dropping PubSub message 'Old message'")]
        public async Task Processing(string textData, int ageInSeconds, string expectedLog)
        {
            var cloudEvent = new CloudEvent
            {
                Type = MessagePublishedData.MessagePublishedCloudEventType,
                Source = new Uri("//pubsub.googleapis.com", UriKind.RelativeOrAbsolute),
                Id = "1234",
                Time = DateTimeOffset.UtcNow.AddSeconds(-ageInSeconds),
                Data = new MessagePublishedData { Message = new PubsubMessage { TextData = textData } }
            };

            await ExecuteCloudEventRequestAsync(cloudEvent);
            var logEntry = Assert.Single(GetFunctionLogEntries());
            Assert.Equal(LogLevel.Information, logEntry.Level);
            Assert.Equal(expectedLog, logEntry.Message);
        }
    }
}


text:
<?php

/**
 * BaseBlog
 *
 * This class has been auto-generated by the Doctrine ORM Framework
 *
 * @property string $title
 * @property clob $body
 * @property Doctrine_Collection $Products
 *
 * @method string              getTitle()    Returns the current record's "title" value
 * @method clob                getBody()     Returns the current record's "body" value
 * @method Doctrine_Collection getProducts() Returns the current record's "Products" collection
 * @method Blog                setTitle()    Sets the current record's "title" value
 * @method Blog                setBody()     Sets the current record's "body" value
 * @method Blog                setProducts() Sets the current record's "Products" collection
 *
 * @package    ##PROJECT_NAME##
 * @subpackage model
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseBlog extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('blog');
        $this->hasColumn('title', 'string', 255, array(
             'type' => 'string',
             'length' => '255',
             ));
        $this->hasColumn('body', 'clob', null, array(
             'type' => 'clob',
             ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('Product as Products', array(
             'refClass' => 'BlogProduct',
             'local' => 'blog_id',
             'foreign' => 'product_id'));

        $sfinlineobjectcontainertemplate0 = new sfInlineObjectContainerTemplate(array(
             'relations' =>
             array(
              0 => 'Products',
             ),
             ));
        $this->actAs($sfinlineobjectcontainertemplate0);
    }
}