text:
// $Id$

#include "DecodeStepTranslation.h"
#include "TranslationOption.h"
#include "TranslationOptionCollection.h"
#include "PartialTranslOptColl.h"
#include "FactorCollection.h"
#include "util/exception.hh"

using namespace std;

namespace Moses
{
DecodeStepTranslation::DecodeStepTranslation(PhraseDictionary* pdf,
    const DecodeStep* prev,
    const std::vector<FeatureFunction*> &features)
  : DecodeStep(pdf, prev, features)
{
  // don't apply feature functions that are from current phrase table.It should already have been
  // dont by the phrase table.
  const std::vector<FeatureFunction*> &pdfFeatures = pdf->GetFeaturesToApply();
  for (size_t i = 0; i < pdfFeatures.size(); ++i) {
    FeatureFunction *ff = pdfFeatures[i];
    RemoveFeature(ff);
  }
}

void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslOpt
                                    , const DecodeStep &decodeStep
                                    , PartialTranslOptColl &outputPartialTranslOptColl
                                    , TranslationOptionCollection *toc
                                    , bool adhereTableLimit
                                    , TargetPhraseCollection::shared_ptr phraseColl) const
{
  if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) {
    // word deletion
    outputPartialTranslOptColl.Add(new TranslationOption(inputPartialTranslOpt));
    return;
  }

  // normal trans step
  const Range &sourceWordsRange        = inputPartialTranslOpt.GetSourceWordsRange();
  const InputPath &inputPath = inputPartialTranslOpt.GetInputPath();
  const PhraseDictionary* phraseDictionary  =
    decodeStep.GetPhraseDictionaryFeature();
  const TargetPhrase &inPhrase = inputPartialTranslOpt.GetTargetPhrase();
  const size_t currSize = inPhrase.GetSize();
  const size_t tableLimit = phraseDictionary->GetTableLimit();

  if (phraseColl != NULL) {
    TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
    iterEnd = (!adhereTableLimit || tableLimit == 0 || phraseColl->GetSize() < tableLimit) ? phraseColl->end() : phraseColl->begin() + tableLimit;

    for (iterTargetPhrase = phraseColl->begin(); iterTargetPhrase != iterEnd; ++iterTargetPhrase) {
      const TargetPhrase& targetPhrase = **iterTargetPhrase;
      // const ScoreComponentCollection &transScores = targetPhrase.GetScoreBreakdown();
      // skip if the
      if (targetPhrase.GetSize() != currSize) continue;

      TargetPhrase outPhrase(inPhrase);

      if (IsFilteringStep()) {
        if (!inputPartialTranslOpt.IsCompatible(targetPhrase, m_conflictFactors))
          continue;
      }

      outPhrase.Merge(targetPhrase, m_newOutputFactors);
      outPhrase.EvaluateInIsolation(inputPath.GetPhrase(), m_featuresToApply); // need to do this as all non-transcores would be screwed up

      TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase);
      assert(newTransOpt != NULL);

      newTransOpt->SetInputPath(inputPath);

      outputPartialTranslOptColl.Add(newTransOpt );

    }
  } else if (sourceWordsRange.GetNumWordsCovered() == 1) {
    // unknown handler
    //toc->ProcessUnknownWord(sourceWordsRange.GetStartPos(), factorCollection);
  }
}

void
DecodeStepTranslation::
ProcessInitialTranslation(InputType const& source,
                          PartialTranslOptColl &outputPartialTranslOptColl,
                          size_t startPos, size_t endPos,
                          bool adhereTableLimit,
                          InputPath const& inputPath,
                          TargetPhraseCollection::shared_ptr phraseColl) const
{
  const PhraseDictionary* phraseDictionary = GetPhraseDictionaryFeature();
  const size_t tableLimit = phraseDictionary->GetTableLimit();

  const Range range(startPos, endPos);

  if (phraseColl != NULL) {
    IFVERBOSE(3) {
      if(source.GetType() == SentenceInput)
        TRACE_ERR("[" << source.GetSubString(range) << "; "
                  << startPos << "-" << endPos << "]\n");
      else
        TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
    }

    TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
    iterEnd = (!adhereTableLimit || tableLimit == 0 || phraseColl->GetSize() < tableLimit) ? phraseColl->end() : phraseColl->begin() + tableLimit;

    for (iterTargetPhrase = phraseColl->begin() ; iterTargetPhrase != iterEnd ; ++iterTargetPhrase) {
      const TargetPhrase	&targetPhrase = **iterTargetPhrase;
      TranslationOption *transOpt = new TranslationOption(range, targetPhrase);

      transOpt->SetInputPath(inputPath);

      outputPartialTranslOptColl.Add (transOpt);

      VERBOSE(3,"\t" << targetPhrase << "\n");
    }
    VERBOSE(3,std::endl);
  }
}

void
DecodeStepTranslation::
ProcessInitialTransLEGACY(InputType const& source,
                          PartialTranslOptColl &outputPartialTranslOptColl,
                          size_t startPos, size_t endPos,
                          bool adhereTableLimit,
                          InputPathList const& inputPathList) const
{
  const PhraseDictionary* phraseDictionary = GetPhraseDictionaryFeature();
  const size_t tableLimit = phraseDictionary->GetTableLimit();

  const Range range(startPos, endPos);
  TargetPhraseCollectionWithSourcePhrase::shared_ptr phraseColl
  = phraseDictionary->GetTargetPhraseCollectionLEGACY(source,range);

  if (phraseColl != NULL) {
    IFVERBOSE(3) {
      if(source.GetType() == SentenceInput)
        TRACE_ERR("[" << source.GetSubString(range) << "; "
                  << startPos << "-" << endPos << "]\n");
      else
        TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
    }

    const std::vector<Phrase> &sourcePhrases = phraseColl->GetSourcePhrases();

    TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
    std::vector<Phrase>::const_iterator iterSourcePhrase;
    iterEnd = (!adhereTableLimit || tableLimit == 0 || phraseColl->GetSize() < tableLimit) ? phraseColl->end() : phraseColl->begin() + tableLimit;

    for (iterTargetPhrase = phraseColl->begin(), iterSourcePhrase =  sourcePhrases.begin()
         ; iterTargetPhrase != iterEnd
         ; ++iterTargetPhrase, ++iterSourcePhrase) {
      assert(iterSourcePhrase != sourcePhrases.end());

      const TargetPhrase	&targetPhrase = **iterTargetPhrase;
      const Phrase			&sourcePhrase = *iterSourcePhrase;

      const InputPath &inputPath = GetInputPathLEGACY(targetPhrase, sourcePhrase, inputPathList);

      TranslationOption *transOpt = new TranslationOption(range, targetPhrase);
      transOpt->SetInputPath(inputPath);

      outputPartialTranslOptColl.Add (transOpt);

      VERBOSE(3,"\t" << targetPhrase << "\n");
    }
    VERBOSE(3,std::endl);
  }
}

const InputPath &DecodeStepTranslation::GetInputPathLEGACY(
  const TargetPhrase targetPhrase,
  const Phrase sourcePhrase,
  const InputPathList &inputPathList) const
{
  const Word &wordFromPt =  sourcePhrase.GetWord(0);

  InputPathList::const_iterator iter;
  for (iter = inputPathList.begin(); iter != inputPathList.end(); ++iter) {
    const InputPath &inputPath = **iter;
    const Phrase &phraseFromIP = inputPath.GetPhrase();

    const Word *wordIP = NULL;
    for (size_t i = 0; i < phraseFromIP.GetSize(); ++i) {
      const Word &tempWord =  phraseFromIP.GetWord(i);
      if (!tempWord.IsEpsilon()) {
        wordIP = &tempWord;
        break;
      }
    }

    // const Range &range = inputPath.GetWordsRange();

    if (wordIP && *wordIP == wordFromPt) {
      return inputPath;
    }
  }

  UTIL_THROW(util::Exception, "Input path not found");
}

void
DecodeStepTranslation::
ProcessLEGACY(TranslationOption const& in,
              DecodeStep const& decodeStep,
              PartialTranslOptColl &out,
              TranslationOptionCollection *toc,
              bool adhereTableLimit) const
{
  if (in.GetTargetPhrase().GetSize() == 0) {
    // word deletion
    out.Add(new TranslationOption(in));
    return;
  }

  // normal trans step
  Range const& srcRange = in.GetSourceWordsRange();
  InputPath const& inputPath = in.GetInputPath();
  PhraseDictionary const* pdict  = decodeStep.GetPhraseDictionaryFeature();
  TargetPhrase const& inPhrase = in.GetTargetPhrase();
  size_t const currSize = inPhrase.GetSize();
  size_t const tableLimit = pdict->GetTableLimit();

  TargetPhraseCollectionWithSourcePhrase::shared_ptr phraseColl
  = pdict->GetTargetPhraseCollectionLEGACY(toc->GetSource(),srcRange);

  if (phraseColl != NULL) {
    TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
    iterEnd = ((adhereTableLimit && tableLimit && phraseColl->GetSize() >= tableLimit)
               ? phraseColl->begin() + tableLimit : phraseColl->end());

    for (iterTargetPhrase = phraseColl->begin();
         iterTargetPhrase != iterEnd;
         ++iterTargetPhrase) {
      TargetPhrase const& targetPhrase = **iterTargetPhrase;
      if (targetPhrase.GetSize() != currSize ||
          (IsFilteringStep() && !in.IsCompatible(targetPhrase, m_conflictFactors)))
        continue;

      TargetPhrase outPhrase(inPhrase);
      outPhrase.Merge(targetPhrase, m_newOutputFactors);
      outPhrase.EvaluateInIsolation(inputPath.GetPhrase(), m_featuresToApply); // need to do this as all non-transcores would be screwed up

      TranslationOption *newTransOpt = new TranslationOption(srcRange, outPhrase);
      assert(newTransOpt != NULL);

      newTransOpt->SetInputPath(inputPath);

      out.Add(newTransOpt);

    }
  }
}
}


text:
[![Build Status](https://travis-ci.org/zensend/zensend_csharp_api.svg?branch=master)](https://travis-ci.org/zensend/zensend_csharp_api)

# ZenSend DotNet Bindings

ZenSend DotNet bindings for sending SMS messages and performing operator lookups. You can sign up for an account at https://zensend.io/

## Installation

To install ZenSend API, run the following command in the [Package Manager Console](http://docs.nuget.org/consume/package-manager-console)

    PM> Install-Package ZenSend

## Sending SMS

    using ZenSend;

    var client = new Client("api_key");
    var result = client.SendSms(originator: "SPINTOWIN", body: "Welcome to spin to win", numbers: new string[]{"4477111222333", "4477222333444"});

    // with all the options

    result = client.SendSms(originator: "SPINTOWIN", body: "Welcome to spin to win", numbers: new string[]{"4477111222333", "4477222333444"}, originatorType: OriginatorType.Alphanumeric, timeToLiveInMinutes: 100, encoding: SmsEncoding.GSM);

    Console.WriteLine(result.Numbers); // => 2
    Console.WriteLine(result.SmsParts); // => 1
    Console.WriteLine(result.Encoding); // => "gsm"
    Console.WriteLine(result.TxGuid); // => "7CDEB38F-4370-18FD-D7CE-329F21B99209"
    Console.WriteLine(result.CostInPence); // => 2.3
    Console.WriteLine(result.NewBalanceInPence); // => 500.0

    // handling errors

    try {
      client.SendSms(originator: "SPINTOWIN", body: "Welcome to spin to win", numbers: new string[]{"4477111222333", "4477222333444"});
    } catch (System.Net.WebException e) {
      Console.WriteLine(e); // see https://msdn.microsoft.com/en-us/library/system.net.webexception(v=vs.110).aspx
    } catch (ZenSendException e) {
      Console.WriteLine(e.HttpStatus); // => http status code
      Console.WriteLine(e.FailCode); // => zensend error code (might be null)
      Console.WriteLine(e.Parameter); // => the parameter the failcode is related to (might be null)
    }

## Operator Lookup

    using ZenSend;

    var client = new Client("api_key");
    var response = client.LookupOperator("441234567890");

    Console.WriteLine(response.MNC) // => "34"
    Console.WriteLine(response.MCC) // => "234"
    Console.WriteLine(response.Operator) // => "eeora-uk"
    Console.WriteLine(response.CostInPence) // => 2.0
    Console.WriteLine(response.NewBalanceInPence) // => 190.006

## SMS Prices

    using ZenSend;

    var client = new Client("api_key");
    var prices = client.GetPrices();

    Console.WriteLine(prices) // => System.Collections.Generic.Dictionary`2[System.String,System.Decimal]
    Console.WriteLine(string.Join(";", prices.Select(x => x.Key + "=" + x.Value))) // => GB=100.0 (price in pence)

## Check Balance

    using ZenSend;

    var client = new Client("api_key");
    var balance = client.CheckBalance();

    Console.WriteLine(balance) // => 500.0 (balance in pence)

## Developing

### OSX

Install [DotNetCore](https://www.microsoft.com/net/core#macos)

## Building
(currently we can only do the full build on a Windows machine. Requires dotnet 4.5.1 and 4.6.2 retargetting packages)

    dotnet restore
    cd projects/ZenSend
    dotnet pack

## Example

    csharp -r:bin/Debug/dnx451/ZenSend.dll -r:$HOME/.dnx/packages/Newtonsoft.Json/6.0.8/lib/net45/Newtonsoft.Json.dll

    using ZenSend;
    var client = new Client("h5IDtEL05ky6FWqc9MCA0g", "http://localhost:8084");
    var result = client.SendSms(originator: "originator", body: "BODY", numbers: new string[]{"447796354848"});

    Console.WriteLine(result.Numbers);
    => 1
    Console.WriteLine(result.SmsParts);
    => 1
    Console.WriteLine(result.Encoding);
    => gsm
    Console.WriteLine(result.TxGuid);
    => d5486bc8-a88a-4e3b-9c56-2d14f68d5f29

## Tests

    cd projects/ZenSendTest
    dotnet test

## Release

1. Edit projects/ZenSend/ZenSend.csproj
2. Tag
3. `dotnet pack`
4. Upload to NUGet

redpajama_set_name: RedPajamaGithub


text:
[![travis][travis-image]][travis-url]
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)
[![dependency status](https://david-dm.org/jsconfuy/site-2015.svg?theme=shields.io)](https://david-dm.org/jsconfuy/site-2015)
[![devDependency status](https://david-dm.org/jsconfuy/site-2015/dev-status.svg?theme=shields.io)](https://david-dm.org/jsconfuy/site-2015#info=devDependencies)
[![gitter](https://img.shields.io/badge/gitter-jsconfuy-brightgreen.svg?style=flat)](https://gitter.im/jsconfuy/asap)

[travis-image]: https://img.shields.io/travis/jsconfuy/site-2015.svg?style=flat
[travis-url]: https://travis-ci.org/jsconfuy/site-2015

## 2Checkout Test:
Sample Test Data:

```
Card Authorization Success: 4000000000000002
Card Authorization Success: 4222222222222220
Card Authorization Decline: 4333433343334333

Buyer Information
Use this buyer to receive a 'wait' Fraud response.
Joe Flagster
123 Main Street
Townsville, Ohio 43206
USA
```


text:
angular.module("services")

    .factory("SongInfo", ["$stateParams", "GetAlbum", function ($stateParams, GetAlbum) {
    "use strict";

        var collection = GetAlbum.collection;

        return {
            currentAlbum: null,
            currentAlbumDeferred: null,
            //currentAlbum: null,
            currentlyPlayingSongNumber: null,
            currentSongFromAlbum: null,
            isPlaying: false,
            currentSoundFile: null,
            currentSoundFileDeferred: null,
            //currentSongDurations: [],
            //currentSongDuration: null,
            currentVolume: 10
        };
    }]);


text:
static NSUInteger const kTotalPagesUndefined = NSUIntegerMax;

@implementation TAFavoritesMoviesFacade {
    NSUInteger _totalPages;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        _totalPages = kTotalPagesUndefined;
    }
    return self;
}

- (void)getMoviesOnPage:(NSUInteger)page success:(ta_facade_favorites_success_block)success failure:(ta_facade_favorites_failure_block)failure
{
    if (_totalPages != kTotalPagesUndefined && page >= _totalPages) {
        BLOCK_EXEC(success, nil)
        return;
    }

    if (self.serviceProvider.reachabilityManager.isReachable) {
        TAFavoriteListRequestParametersModel *parameters = [TAFavoriteListRequestParametersModel new];
        parameters.page = page;
        [self.serviceProvider getFavoriteMoviesWithParameters:parameters withSuccess:^(TAListResponseObject *response) {
            _totalPages = response.totalPages;

            ta_dispatch_async(^{
                RLMRealm *storage = [RLMRealm defaultRealm];
                TAUserProfile *user = self.loginFacade.user;
                [storage beginWriteTransaction];
                [user.watchedList addObjects:response.results];
                [TAUserProfile createOrUpdateInRealm:storage withValue:user];
                [storage commitWriteTransaction];
            });

            BLOCK_EXEC(success, response.results);
        } andError:^(NSError *error) {
            //todo: handle service unavailable situation
            NSError *facadeError = [NSError errorWithUnderlyingError:error domain:TAMakeAppDomain(TAFavoritesMoviesFacadeError) code:1 userInfo:nil];
            BLOCK_EXEC(failure, facadeError)
        }];
    } else {
        ta_dispatch_main_queue(^{
            RLMRealm *storage = [RLMRealm defaultRealm];
            TAUserProfile *user = [TAUserProfile objectInRealm:storage forPrimaryKey:self.loginFacade.user.username];
            RLMArray *favorites = user.favoritesList;
            NSArray *paginatedResults = [TACollectionPaginator collectionArray:favorites atPage:page size:self.pageSize];
            BLOCK_EXEC(success, paginatedResults);
        });
    }
}

@end


text:
package org.apache.flink.runtime.client;

import org.apache.flink.api.common.JobID;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.core.fs.Path;
import org.apache.flink.runtime.blob.BlobClient;
import org.apache.flink.runtime.blob.PermanentBlobKey;
import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.util.FlinkException;
import org.apache.flink.util.function.SupplierWithException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;

/**
 * Contains utility methods for clients.
 */
public enum ClientUtils {
	;

	/**
	 * Extracts all files required for the execution from the given {@link JobGraph} and uploads them using the {@link BlobClient}
	 * from the given {@link Supplier}.
	 *
	 * @param jobGraph jobgraph requiring files
	 * @param clientSupplier supplier of blob client to upload files with
	 * @throws FlinkException if the upload fails
	 */
	public static void extractAndUploadJobGraphFiles(JobGraph jobGraph, SupplierWithException<BlobClient, IOException> clientSupplier) throws FlinkException {
		List<Path> userJars = jobGraph.getUserJars();
		Collection<Tuple2<String, Path>> userArtifacts = jobGraph.getUserArtifacts().entrySet().stream()
			.map(entry -> Tuple2.of(entry.getKey(), new Path(entry.getValue().filePath)))
			.collect(Collectors.toList());

		uploadJobGraphFiles(jobGraph, userJars, userArtifacts, clientSupplier);
	}

	/**
	 * Uploads the given jars and artifacts required for the execution of the given {@link JobGraph} using the {@link BlobClient} from
	 * the given {@link Supplier}.
	 *
	 * @param jobGraph jobgraph requiring files
	 * @param userJars jars to upload
	 * @param userArtifacts artifacts to upload
	 * @param clientSupplier supplier of blob client to upload files with
	 * @throws FlinkException if the upload fails
	 */
	public static void uploadJobGraphFiles(
			JobGraph jobGraph,
			Collection<Path> userJars,
			Collection<Tuple2<String, org.apache.flink.core.fs.Path>> userArtifacts,
			SupplierWithException<BlobClient, IOException> clientSupplier) throws FlinkException {
		if (!userJars.isEmpty() || !userArtifacts.isEmpty()) {
			try (BlobClient client = clientSupplier.get()) {
				uploadAndSetUserJars(jobGraph, userJars, client);
				uploadAndSetUserArtifacts(jobGraph, userArtifacts, client);
			} catch (IOException ioe) {
				throw new FlinkException("Could not upload job files.", ioe);
			}
		}
		jobGraph.writeUserArtifactEntriesToConfiguration();
	}

	/**
	 * Uploads the given user jars using the given {@link BlobClient}, and sets the appropriate blobkeys on the given {@link JobGraph}.
	 *
	 * @param jobGraph jobgraph requiring user jars
	 * @param userJars jars to upload
	 * @param blobClient client to upload jars with
	 * @throws IOException if the upload fails
	 */
	private static void uploadAndSetUserJars(JobGraph jobGraph, Collection<Path> userJars, BlobClient blobClient) throws IOException {
		Collection<PermanentBlobKey> blobKeys = uploadUserJars(jobGraph.getJobID(), userJars, blobClient);
		setUserJarBlobKeys(blobKeys, jobGraph);
	}

	private static Collection<PermanentBlobKey> uploadUserJars(JobID jobId, Collection<Path> userJars, BlobClient blobClient) throws IOException {
		Collection<PermanentBlobKey> blobKeys = new ArrayList<>(userJars.size());
		for (Path jar : userJars) {
			final PermanentBlobKey blobKey = blobClient.uploadFile(jobId, jar);
			blobKeys.add(blobKey);
		}
		return blobKeys;
	}

	private static void setUserJarBlobKeys(Collection<PermanentBlobKey> blobKeys, JobGraph jobGraph) {
		blobKeys.forEach(jobGraph::addUserJarBlobKey);
	}

	/**
	 * Uploads the given user artifacts using the given {@link BlobClient}, and sets the appropriate blobkeys on the given {@link JobGraph}.
	 *
	 * @param jobGraph jobgraph requiring user artifacts
	 * @param artifactPaths artifacts to upload
	 * @param blobClient client to upload artifacts with
	 * @throws IOException if the upload fails
	 */
	private static void uploadAndSetUserArtifacts(JobGraph jobGraph, Collection<Tuple2<String, Path>> artifactPaths, BlobClient blobClient) throws IOException {
		Collection<Tuple2<String, PermanentBlobKey>> blobKeys = uploadUserArtifacts(jobGraph.getJobID(), artifactPaths, blobClient);
		setUserArtifactBlobKeys(jobGraph, blobKeys);
	}

	private static Collection<Tuple2<String, PermanentBlobKey>> uploadUserArtifacts(JobID jobID, Collection<Tuple2<String, Path>> userArtifacts, BlobClient blobClient) throws IOException {
		Collection<Tuple2<String, PermanentBlobKey>> blobKeys = new ArrayList<>(userArtifacts.size());
		for (Tuple2<String, Path> userArtifact : userArtifacts) {
			// only upload local files
			if (!userArtifact.f1.getFileSystem().isDistributedFS()) {
				final PermanentBlobKey blobKey = blobClient.uploadFile(jobID, userArtifact.f1);
				blobKeys.add(Tuple2.of(userArtifact.f0, blobKey));
			}
		}
		return blobKeys;
	}

	private static void setUserArtifactBlobKeys(JobGraph jobGraph, Collection<Tuple2<String, PermanentBlobKey>> blobKeys) throws IOException {
		for (Tuple2<String, PermanentBlobKey> blobKey : blobKeys) {
			jobGraph.setUserArtifactBlobKey(blobKey.f0, blobKey.f1);
		}
	}
}


text:
package ro.ase.cts.proiect.test;

import ro.ase.cts.proiect.flyweight.StadiuConstructie;
import junit.framework.TestCase;

public class TestProgresStadiuConstructie extends TestCase {

	public TestProgresStadiuConstructie(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testSetProgresValoriNegative(){

		StadiuConstructie stadiu = new StadiuConstructie(60, "12.02.2016");

		int valoareNegativa = -70;

		try{
			stadiu.setProgres(valoareNegativa);
			fail("Metoda nu arunca exceptie pe valori negative");
		}
		catch(Exception ex){

		}

	}

}


text:
import {IFactoryResource} from './IFactoryResource';

export class FactoryResource<T> implements IFactoryResource<T> {

    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties

    private _Type: T;
    private _PropertyDescriptor: PropertyDescriptorMap;

    constructor(type: T, propertyDescriptor: PropertyDescriptorMap) {
        this._Type = type;
        this._PropertyDescriptor = propertyDescriptor;
    }

    GetInstance(): T  {
        return Object.create(this._Type, this._PropertyDescriptor);
    }

    GetType(): T {
        return this._Type;
    }
}


text:
module Ruroku
  # Public: Represents the Set of Processes.
  class ProcessSet < NestedResourceSet
    resource_class Process
    collection_api_selector :get_ps

    # Map API methods to collection methods.
    #
    # Examples
    #
    #   processes.run 'rake task'
    #   processes.restart
    #   processes.scale 'web', 10
    #   processes.stop 'ps' => 'web.1'
    #   processes.stop 'type' => 'web'
    map_api run: :post_ps,
      restart: :post_ps_restart,
      scale: :ps_scale,
      stop: :post_ps_stop

    # Public: Find either a process when specified full process name,
    # or a collection of processes, if specified a process type.
    #
    # Examples
    #
    #   processes['web.1']
    #   processes['web']
    #
    # Returns the ProcessSet object if process type was passed, the
    # Process object otherwise.
    def [](process_name)
      if process_name.include? '.'
        select { |process| process.type == process_name }
      else
        select { |process| process.process == process_name }.first
      end
    end
  end
end


text:
using OpenLiveWriter.Api;
using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.Extensibility.ImageEditing;

namespace OpenLiveWriter.PostEditor.PostHtmlEditing.ImageEditing.Decorators
{
    /// <summary>
    /// Summary description for Decorator.
    /// </summary>
    public class HtmlAlignDecorator : IImageDecorator, IImageDecoratorDefaultSettingsCustomizer
    {
        public readonly static string Id = "HtmlAlign";
        public HtmlAlignDecorator()
        {
        }

        public void Decorate(ImageDecoratorContext context)
        {
            if (context.InvocationSource == ImageDecoratorInvocationSource.Reset ||
                context.InvocationSource == ImageDecoratorInvocationSource.InitialInsert)
            {
                //set the default HTML for this decorator.
                HtmlAlignDecoratorSettings settings = new HtmlAlignDecoratorSettings(context.Settings, context.ImgElement, context.InvocationSource);
                settings.Alignment = settings.DefaultAlignment;
            }
            //Note: all other times, this decorator is applied directly by the editor.
        }

        public ImageDecoratorEditor CreateEditor(CommandManager commandManager)
        {
            return new HtmlAlignEditor(commandManager);
        }

        void IImageDecoratorDefaultSettingsCustomizer.CustomizeDefaultSettingsBeforeSave(ImageDecoratorEditorContext context, IProperties defaultSettings)
        {
            HtmlAlignDecoratorSettings settings = new HtmlAlignDecoratorSettings(defaultSettings, context.ImgElement);
            settings.DefaultAlignment = settings.Alignment;
        }
    }
}


text:
class Queens
  attr_reader :white, :black

  def initialize(positions = { white: [0, 3], black: [7, 3] })
    raise ArgumentError if positions[:white] == positions[:black]
    @white = positions[:white]
    @black = positions[:black]
    @board = Array.new(8) { Array.new(8, '_') }
  end

  def to_s
    @board[white.first][white.last] = 'W'
    @board[black.first][black.last] = 'B'
    @board.map { |line| line.join(' ') }.join("\n")
  end

  def attack?
    row_or_column? || diagonal?
  end

  private

  def row_or_column?
    (white + black).uniq.size < 4
  end

  def diagonal?
    (white.first - black.first).abs == (white.last - black.last).abs
  end
end


text:
@interface LessonTwoView : UIView <UITableViewDataSource>

@property (strong, nonatomic) IBOutlet UITableView *resultsTable;

- (IBAction)sendRequest:(id)sender;

@end


text:
'use strict';

/**
 * Requirements
 */
const ViewModelRepository = require(ES_SOURCE + '/model/viewmodel/ViewModelRepository.js').ViewModelRepository;
const ViewModelImportPlugin = require(ES_SOURCE + '/model/viewmodel/plugin/ViewModelImportPlugin.js').ViewModelImportPlugin;
const viewModelPluginSpec = require('../ViewModelPluginShared.js').spec;
const projectFixture = require(ES_FIXTURES + '/project/index.js');
const co = require('co');

/**
 * Spec
 */
describe(ViewModelImportPlugin.className, function()
{
    /**
     * Base Test
     */
    viewModelPluginSpec(ViewModelImportPlugin, 'model.viewmodel.plugin/ViewModelImportPlugin');

    /**
     * ViewModelLipsumPlugin Test
     */
    beforeEach(function()
    {
        global.fixtures = projectFixture.createStatic();
        global.fixtures.viewModelRepository = new ViewModelRepository(global.fixtures.entitiesRepository, global.fixtures.pathesConfiguration);
    });

    describe('#execute', function()
    {
        it('should return undefined if name does not match', function()
        {
            const promise = co(function*()
            {
                const testee = new ViewModelImportPlugin();
                const result = yield testee.execute(global.fixtures.viewModelRepository,
                    global.fixtures.siteBase,
                    {},
                    'foo',
                    '');
                expect(result).to.be.not.ok;
            });
            return promise;
        });

        it('should allow to load another json in place via @import:e-image/default', function()
        {
            const promise = co(function*()
            {
                const testee = new ViewModelImportPlugin();
                const result = yield testee.execute(global.fixtures.viewModelRepository,
                    global.fixtures.siteBase,
                    {},
                    'import',
                    'e-image/default');
                expect(result).to.be.ok;
                expect(result.image).to.be.ok;
                expect(result.alt).to.be.ok;
            });
            return promise;
        });
    });
});


text:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<!--
Automatically created by Apache Tomcat JspC.
-->
<web-app>

    <servlet>
        <servlet-name>org.jivesoftware.openfire.plugin.subscription.subscription_002dplugin_002dproperties_jsp</servlet-name>
        <servlet-class>org.jivesoftware.openfire.plugin.subscription.subscription_002dplugin_002dproperties_jsp</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>org.jivesoftware.openfire.plugin.subscription.subscription_002dplugin_002dproperties_jsp</servlet-name>
        <url-pattern>/subscription-plugin-properties.jsp</url-pattern>
    </servlet-mapping>

</web-app>