text:
#include "vice.h"

#include <stdio.h>

#include "drive.h"
#include "iec-c64exp.h"
#include "iec.h"
#include "iecieee.h"
#include "ieee.h"
#include "machine.h"
#include "machine-drive.h"
#include "types.h"

int machine_drive_resources_init(void)
{
    int drive_8_type = (machine_class == VICE_MACHINE_VSID) ? DRIVE_TYPE_NONE : DRIVE_TYPE_1541II;

    return drive_resources_type_init(drive_8_type) | iec_drive_resources_init() | iec_c64exp_resources_init() | ieee_drive_resources_init();
}

void machine_drive_resources_shutdown(void)
{
    iec_drive_resources_shutdown();
    iec_c64exp_resources_shutdown();
    ieee_drive_resources_shutdown();
}

int machine_drive_cmdline_options_init(void)
{
    return iec_drive_cmdline_options_init() | iec_c64exp_cmdline_options_init() | ieee_drive_cmdline_options_init();
}

void machine_drive_init(struct drive_context_s *drv)
{
    iec_drive_init(drv);
    iecieee_drive_init(drv);
    iec_c64exp_init(drv);
    ieee_drive_init(drv);
}

void machine_drive_shutdown(struct drive_context_s *drv)
{
    iec_drive_shutdown(drv);
    iecieee_drive_shutdown(drv);
    ieee_drive_shutdown(drv);
}

void machine_drive_reset(struct drive_context_s *drv)
{
    iec_drive_reset(drv);
    iecieee_drive_reset(drv);
    iec_c64exp_reset(drv);
    ieee_drive_reset(drv);
}

void machine_drive_mem_init(struct drive_context_s *drv, unsigned int type)
{
    iec_drive_mem_init(drv, type);
    iec_c64exp_mem_init(drv, type);
    ieee_drive_mem_init(drv, type);
}

void machine_drive_setup_context(struct drive_context_s *drv)
{
    iec_drive_setup_context(drv);
    iecieee_drive_setup_context(drv);
    ieee_drive_setup_context(drv);
}

void machine_drive_idling_method(unsigned int dnr)
{
    iec_drive_idling_method(dnr);
}

void machine_drive_rom_load(void)
{
    iec_drive_rom_load();
    ieee_drive_rom_load();
}

void machine_drive_rom_setup_image(unsigned int dnr)
{
    iec_drive_rom_setup_image(dnr);
    ieee_drive_rom_setup_image(dnr);
}

int machine_drive_rom_read(unsigned int type, WORD addr, BYTE *data)
{
    if (iec_drive_rom_read(type, addr, data) == 0) {
        return 0;
    }

    if (ieee_drive_rom_read(type, addr, data) == 0) {
        return 0;
    }

    return -1;
}

int machine_drive_rom_check_loaded(unsigned int type)
{
    if (iec_drive_rom_check_loaded(type) == 0) {
        return 0;
    }
    if (ieee_drive_rom_check_loaded(type) == 0) {
        return 0;
    }

    return -1;
}

void machine_drive_rom_do_checksum(unsigned int dnr)
{
    iec_drive_rom_do_checksum(dnr);
    ieee_drive_rom_do_checksum(dnr);
}

int machine_drive_snapshot_read(struct drive_context_s *ctxptr, struct snapshot_s *s)
{
    if (iec_drive_snapshot_read(ctxptr, s) < 0) {
        return -1;
    }
    if (iecieee_drive_snapshot_read(ctxptr, s) < 0) {
        return -1;
    }
    if (ieee_drive_snapshot_read(ctxptr, s) < 0) {
        return -1;
    }

    return 0;
}

int machine_drive_snapshot_write(struct drive_context_s *ctxptr, struct snapshot_s *s)
{
    if (iec_drive_snapshot_write(ctxptr, s) < 0) {
        return -1;
    }
    if (iecieee_drive_snapshot_write(ctxptr, s) < 0) {
        return -1;
    }
    if (ieee_drive_snapshot_write(ctxptr, s) < 0) {
        return -1;
    }

    return 0;
}

int machine_drive_image_attach(struct disk_image_s *image, unsigned int unit)
{
    return iec_drive_image_attach(image, unit) & ieee_drive_image_attach(image, unit);
}

int machine_drive_image_detach(struct disk_image_s *image, unsigned int unit)
{
    return iec_drive_image_detach(image, unit) & ieee_drive_image_detach(image, unit);
}

void machine_drive_port_default(struct drive_context_s *drv)
{
    iec_drive_port_default(drv);
}

void machine_drive_flush(void)
{
    drive_gcr_data_writeback_all();
}

void machine_drive_stub(void)
{
}


text:
/*
 * Generated by XDoclet - Do not edit!
 */
package org.dcm4chex.archive.ejb.entity;

/**
 * CMP layer for HPDefinition.
 * @xdoclet-generated at ${TODAY}
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version 2.19.0-SNAPSHOT
 */
public abstract class HPDefinitionCMP
   extends org.dcm4chex.archive.ejb.entity.HPDefinitionBean
   implements javax.ejb.EntityBean
{

   public void ejbLoad()
   {
   }

   public void ejbStore()
   {
   }

   public void ejbActivate()
   {
   }

   public void ejbPassivate()
   {

   }

   public void setEntityContext(javax.ejb.EntityContext ctx)
   {
      super.setEntityContext(ctx);
   }

   public void unsetEntityContext()
   {
      super.unsetEntityContext();
   }

   public void ejbRemove() throws javax.ejb.RemoveException
   {
      super.ejbRemove();

   }

   public abstract java.lang.Long getPk() ;

   public abstract void setPk( java.lang.Long pk ) ;

   public abstract java.lang.String getModality() ;

   public abstract void setModality( java.lang.String modality ) ;

   public abstract java.lang.String getLaterality() ;

   public abstract void setLaterality( java.lang.String laterality ) ;

}

redpajama_set_name: RedPajamaGithub


text:
rantechnology
=============

ran technology is a leading mobile application company in Delhi


text:
void andyMenkmanPng::setup(){

    bender.setup("scenes/andyMenkmanPng/images/", "png", 50);

    // setup pramaters
    numberOfLines.set("numberOfLines", 1, 0, bender.lineCount);
    startLine.set("startLine", 50, 0, bender.lineCount);
    debounce.set("debounce", 2, 0, 100);
    parameters.add(numberOfLines);
    parameters.add(startLine);
    parameters.add(debounce);

    ofBackground(0);
    ofSetColor(255);

    setAuthor("Andy Dayton");
    setOriginalArtist("Rosa Menkman");
    loadCode("scenes/andyMenkmanPng/exampleCode.cpp");
}

void andyMenkmanPng::update(){
    bender.setDebounce(debounce);
    bender.update(startLine, numberOfLines, true);
}

void andyMenkmanPng::draw(){
    bender.draw(0, 0, dimensions.getWidth(), dimensions.getHeight());
}


text:
import { EventBuilder } from "./EventBuilder";

/**
 * Order Status Events Builder class reference
 */
export class OrderStatusEventBuilder extends EventBuilder {
  public state: any = {};

  constructor() {
    super("AMAZON.OrderStatus.Updated");
  }

  public setStatus(status: ORDER_STATUS, expectedArrival?: string, enterTimestamp?: string): OrderStatusEventBuilder {
    this.state = { status, enterTimestamp };

    if (expectedArrival) {
      this.state.deliveryDetails = { expectedArrival };
    }

    return this;
  }

  public getPayload(): any {
    return {
      order: {
        seller: {
          name: "localizedattribute:sellerName",
        },
      },
      state: this.state,
    };
  }
}

export enum ORDER_STATUS {
  ORDER_DELIVERED = "ORDER_DELIVERED",
  ORDER_OUT_FOR_DELIVERY = "ORDER_OUT_FOR_DELIVERY",
  ORDER_PREPARING = "ORDER_PREPARING",
  ORDER_RECEIVED = "ORDER_RECEIVED",
  ORDER_SHIPPED = "ORDER_SHIPPED",
  PREORDER_RECEIVED = "PREORDER_RECEIVED",
}


text:
import React, { useCallback, useMemo, useState } from 'react';

import { styled } from '@storybook/theming';

import { ActionBar, Icons, ScrollArea } from '@storybook/components';

import { AxeResults } from 'axe-core';
import { useChannel, useParameter, useStorybookState } from '@storybook/api';
import { Report } from './Report';
import { Tabs } from './Tabs';

import { useA11yContext } from './A11yContext';
import { EVENTS } from '../constants';
import { A11yParameters } from '../params';

export enum RuleType {
  VIOLATION,
  PASS,
  INCOMPLETION,
}

const Icon = styled(Icons)({
  height: 12,
  width: 12,
  marginRight: 4,
});

const RotatingIcon = styled(Icon)<{}>(({ theme }) => ({
  animation: `${theme.animation.rotate360} 1s linear infinite;`,
}));

const Passes = styled.span<{}>(({ theme }) => ({
  color: theme.color.positive,
}));

const Violations = styled.span<{}>(({ theme }) => ({
  color: theme.color.negative,
}));

const Incomplete = styled.span<{}>(({ theme }) => ({
  color: theme.color.warning,
}));

const Centered = styled.span<{}>({
  display: 'flex',
  alignItems: 'center',
  justifyContent: 'center',
  height: '100%',
});

type Status = 'initial' | 'manual' | 'running' | 'error' | 'ran' | 'ready';

export const A11YPanel: React.FC = () => {
  const { manual } = useParameter<Pick<A11yParameters, 'manual'>>('a11y', {
    manual: false,
  });
  const [status, setStatus] = useState<Status>(manual ? 'manual' : 'initial');
  const [error, setError] = React.useState<unknown>(undefined);
  const { setResults, results } = useA11yContext();
  const { storyId } = useStorybookState();

  React.useEffect(() => {
    setStatus(manual ? 'manual' : 'initial');
  }, [manual]);

  const handleResult = (axeResults: AxeResults) => {
    setStatus('ran');
    setResults(axeResults);

    setTimeout(() => {
      if (status === 'ran') {
        setStatus('ready');
      }
    }, 900);
  };

  const handleRun = useCallback(() => {
    setStatus('running');
  }, []);

  const handleError = useCallback((err: unknown) => {
    setStatus('error');
    setError(err);
  }, []);

  const emit = useChannel({
    [EVENTS.RUNNING]: handleRun,
    [EVENTS.RESULT]: handleResult,
    [EVENTS.ERROR]: handleError,
  });

  const handleManual = useCallback(() => {
    setStatus('running');
    emit(EVENTS.MANUAL, storyId);
  }, [storyId]);

  const manualActionItems = useMemo(() => [{ title: 'Run test', onClick: handleManual }], [
    handleManual,
  ]);
  const readyActionItems = useMemo(
    () => [
      {
        title:
          status === 'ready' ? (
            'Rerun tests'
          ) : (
            <>
              <Icon inline icon="check" /> Tests completed
            </>
          ),
        onClick: handleManual,
      },
    ],
    [status, handleManual]
  );
  const tabs = useMemo(() => {
    const { passes, incomplete, violations } = results;
    return [
      {
        label: <Violations>{violations.length} Violations</Violations>,
        panel: (
          <Report
            items={violations}
            type={RuleType.VIOLATION}
            empty="No accessibility violations found."
          />
        ),
        items: violations,
        type: RuleType.VIOLATION,
      },
      {
        label: <Passes>{passes.length} Passes</Passes>,
        panel: (
          <Report items={passes} type={RuleType.PASS} empty="No accessibility checks passed." />
        ),
        items: passes,
        type: RuleType.PASS,
      },
      {
        label: <Incomplete>{incomplete.length} Incomplete</Incomplete>,
        panel: (
          <Report
            items={incomplete}
            type={RuleType.INCOMPLETION}
            empty="No accessibility checks incomplete."
          />
        ),
        items: incomplete,
        type: RuleType.INCOMPLETION,
      },
    ];
  }, [results]);
  return (
    <>
      {status === 'initial' && <Centered>Initializing...</Centered>}
      {status === 'manual' && (
        <>
          <Centered>Manually run the accessibility scan.</Centered>
          <ActionBar key="actionbar" actionItems={manualActionItems} />
        </>
      )}
      {status === 'running' && (
        <Centered>
          <RotatingIcon inline icon="sync" /> Please wait while the accessibility scan is running
          ...
        </Centered>
      )}
      {(status === 'ready' || status === 'ran') && (
        <>
          <ScrollArea vertical horizontal>
            <Tabs key="tabs" tabs={tabs} />
          </ScrollArea>
          <ActionBar key="actionbar" actionItems={readyActionItems} />
        </>
      )}
      {status === 'error' && (
        <Centered>
          The accessibility scan encountered an error.
          <br />
          {typeof error === 'string' ? error : JSON.stringify(error)}
        </Centered>
      )}
    </>
  );
};


text:
package io.iohk.ethereum.vm

import akka.util.ByteString
import io.iohk.ethereum.crypto
import io.iohk.ethereum.crypto._
import io.iohk.ethereum.domain.SignedTransaction.{FirstByteOfAddress, LastByteOfAddress}
import io.iohk.ethereum.security.SecureRandomBuilder
import io.iohk.ethereum.vm.utils.EvmTestEnv
import org.bouncycastle.crypto.params.ECPublicKeyParameters
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

class PrecompiledContractsSpecEvm extends AnyFunSuite with Matchers with SecureRandomBuilder {

  test("Precompiled Contracts") {
    val keyPair = generateKeyPair(secureRandom)
    val bytes: Array[Byte] = crypto.kec256(ByteString("aabbccdd").toArray[Byte])
    val signature = ECDSASignature.sign(bytes, keyPair)
    val pubKey = keyPair.getPublic.asInstanceOf[ECPublicKeyParameters].getQ.getEncoded(false)
    val address = crypto.kec256(pubKey.tail).slice(FirstByteOfAddress, LastByteOfAddress)
    val expectedOutput = ripemd160(sha256(address))

    new EvmTestEnv {
      val (_, contract) = deployContract("PrecompiledContracts")
      val result = contract.usePrecompiledContracts(bytes, signature.v, signature.r, signature.s).call()

      // even though contract specifies bytes20 as the return type, 32-byte (right zero padded) value is returned
      result.returnData.take(20) shouldEqual expectedOutput
    }
  }
}


text:
using System;
using System.Threading.Tasks;
using WebSocketSharp;

namespace RavenAdminLogsCollectionTool.Services
{
    public interface IRavenDbCommunicationService
    {
        Task<string> ConnectAsync(string databaseUrl, EventHandler onOpen,
            EventHandler<CloseEventArgs> onClose, EventHandler<MessageEventArgs> onMessage,
            EventHandler<ErrorEventArgs> onError);

        void Disconnect();
    }
}


text:
package moe.lymia.princess

import moe.lymia.princess.core.state.GuiContext
import moe.lymia.princess.views.exportcards.{ExportCardsDialogMulti, ExportFormat}
import moe.lymia.princess.views.editor.{EditorTab, EditorTabData}
import moe.lymia.princess.views.frontend.{GameSelectorDialog, SplashScreen}
import moe.lymia.princess.views.mainframe.{AboutDialog, MainFrame}
import org.eclipse.jface.window.Window
import org.eclipse.swt.program.Program
import rx.Rx

class NativeImageGenConfig(ctx: GuiContext) {
  private val logger = DefaultLogger.bind("NativeImageGenConfig")

  private def executeForMs(duration: Long): Unit = {
    val end = System.currentTimeMillis() + duration
    while (System.currentTimeMillis() < end) {
      ctx.display.readAndDispatch
    }
  }
  private def openForPeriod(w: Window): Unit = {
    w.setBlockOnOpen(false)
    logger.info(s"Opening window of type '${w.getClass.getSimpleName}'")
    w.open()
    logger.info(s"(Done!)")
    executeForMs(750)
    logger.info(s"(Closing!)")
    w.close()
  }

  def execute(): Unit = {
    // frontend
    openForPeriod(new SplashScreen(ctx))
    openForPeriod(new GameSelectorDialog(null, ctx))

    // initial mainframe
    val (mainFrame, mainFrameState) = MainFrame.openForGenConfig(ctx)
    mainFrame.setBlockOnOpen(false)
    mainFrame.open()

    openForPeriod(new AboutDialog(null, mainFrameState))

    // test cards
    val (viewUuid, testCards) = ctx.syncLuaExec {
      val viewUuid = mainFrameState.project.views.create()._1
      val testCards = (0 until 10).map(_ => {
        val uuid = mainFrameState.project.cards.create()._1
        mainFrameState.project.allViews.now(viewUuid).addCard(uuid)
        uuid
      })
      logger.info(s"Created test cards: $testCards")
      (viewUuid, testCards)
    }
    mainFrame.tabFolder.clearTabs()
    val editorApi = mainFrameState.openTab(EditorTab, new EditorTabData(viewUuid))
    mainFrame.tabFolder.updateTabItems()
    executeForMs(500)
    editorApi.setSelectedCards(testCards : _*)
    executeForMs(500)

    // test export dialog
    val multiDialog = new ExportCardsDialogMulti(mainFrameState, ctx.syncLuaExec {
      Rx.unsafe {
        testCards.map(uuid => {
          val full = mainFrameState.project.views.get(viewUuid).get.getFullCard(uuid).get
          (uuid, full)
        })
      }.now
    })
    multiDialog.setBlockOnOpen(false)
    multiDialog.open()
    executeForMs(500)
    multiDialog.setFormat(ExportFormat.JPEG)
    executeForMs(500)
    multiDialog.close()

    // close mainframe
    mainFrame.close()
  }
}


text:
// This file is part of the dune-gdt project:
//   http://users.dune-project.org/projects/dune-gdt
// Copyright holders: Felix Schindler
// License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)

#ifndef DUNE_GDT_SPACES_CG_PDELAB_HH
#define DUNE_GDT_SPACES_CG_PDELAB_HH

#include <memory>

#include <dune/common/fvector.hh>
#include <dune/common/deprecated.hh>

#include <dune/geometry/genericgeometry/topologytypes.hh>

#if HAVE_DUNE_ISTL
# include <dune/istl/paamg/pinfo.hh>
# include <dune/stuff/la/solver/istl_amg.hh>
#endif

#if HAVE_DUNE_PDELAB
# include <dune/pdelab/finiteelementmap/pkfem.hh>
# include <dune/pdelab/finiteelementmap/qkfem.hh>
# include <dune/pdelab/gridfunctionspace/gridfunctionspace.hh>
# include <dune/pdelab/gridfunctionspace/vectorgridfunctionspace.hh>
# include <dune/pdelab/constraints/conforming.hh>
#endif // HAVE_DUNE_PDELAB

#include <dune/stuff/common/type_utils.hh>

#include <dune/gdt/spaces/parallel.hh>

#include "../../mapper/pdelab.hh"
#include "../../basefunctionset/pdelab.hh"

#include "interface.hh"

namespace Dune {

namespace GDT {
namespace Spaces {
namespace CG {

#if HAVE_DUNE_PDELAB

// forward, to be used in the traits and to allow for specialization
template< class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1 >
class PdelabBased
{
  static_assert(Dune::AlwaysFalse< GridViewImp >::value, "Untested for this combination of dimensions!");
};

template< class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1 >
class PdelabBasedTraits
{
public:
  typedef PdelabBased< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols > derived_type;
  typedef GridViewImp                   GridViewType;
  static const int                      polOrder = polynomialOrder;
  static_assert(polOrder >= 1, "Wrong polOrder given!");
private:
  typedef typename GridViewType::ctype  DomainFieldType;
  static const size_t                   dimDomain = GridViewType::dimension;
public:
  typedef RangeFieldImp                 RangeFieldType;
private:
  template< class G, bool single_geom, bool is_simplex, bool is_cube >
  struct FeMap
  {
    static_assert(Dune::AlwaysFalse< G >::value,
                  "This space is only implemented for either fully simplicial or fully cubic grids!");
  };
  template< class G >
  struct FeMap< G, true, true, false >
  {
    typedef PDELab::PkLocalFiniteElementMap < GridViewType, DomainFieldType, RangeFieldType, polOrder> Type;
  };
  template< class G >
  struct FeMap< G, true, false, true >
  {
    typedef PDELab::QkLocalFiniteElementMap < GridViewType, DomainFieldType, RangeFieldType, polOrder> Type;
  };
  typedef typename GridViewType::Grid GridType;
  static const bool single_geom_ = Dune::Capabilities::hasSingleGeometryType< GridType >::v;
  static const bool simplicial_ = (Dune::Capabilities::hasSingleGeometryType< GridType >::topologyId
                                   == GenericGeometry::SimplexTopology< dimDomain >::type::id);
  static const bool cubic_ = (Dune::Capabilities::hasSingleGeometryType< GridType >::topologyId
                              == GenericGeometry::CubeTopology< dimDomain >::type::id);
  typedef typename FeMap< GridType, single_geom_, simplicial_, cubic_ >::Type FEMapType;
public:
  template< class G, size_t dimRange >
  struct BackendMapper
  {
    typedef PDELab::VectorGridFunctionSpace< GridViewType, FEMapType, dimRange, PDELab::ISTLVectorBackend<>,
                                             PDELab::ISTLVectorBackend<>, PDELab::OverlappingConformingDirichletConstraints > Type;
    typedef Mapper::ContinuousPowerPdelabWrapper< Type > MapType;
  };
  template< class G >
  struct BackendMapper< G, 1 >
  {
    typedef PDELab::GridFunctionSpace< GridViewType, FEMapType, PDELab::OverlappingConformingDirichletConstraints > Type;
    typedef Mapper::ContinuousPdelabWrapper< Type > MapType;
  };
  typedef typename BackendMapper< GridType, rangeDim >::Type    BackendType;
  typedef typename BackendMapper< GridType, rangeDim >::MapType MapperType;
  typedef typename GridViewType::template Codim< 0 >::Entity    EntityType;
  typedef BaseFunctionSet::PdelabWrapper< BackendType, EntityType, DomainFieldType, dimDomain, RangeFieldType, rangeDim, rangeDimCols > BaseFunctionSetType;
  static const Stuff::Grid::ChoosePartView part_view_type = Stuff::Grid::ChoosePartView::view;
  static const bool needs_grid_view = true;

  typedef typename CommunicationChooser<GridViewType>::Type CommunicatorType;
private:
  friend class PdelabBased< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols >;
}; // class PdelabBasedTraits

template< class GridViewImp, int polynomialOrder, class RangeFieldImp >
class PdelabBased< GridViewImp, polynomialOrder, RangeFieldImp, 1, 1 >
  : public Spaces::CGInterface< PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, 1, 1 >,
                                GridViewImp::dimension, 1, 1 >
{
  typedef Spaces::CGInterface< PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, 1, 1 >,
                               GridViewImp::dimension, 1, 1 >                    BaseType;
  typedef PdelabBased< GridViewImp, polynomialOrder, RangeFieldImp, 1, 1 >       ThisType;
public:
  typedef PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, 1, 1 > Traits;

  static const int    polOrder = Traits::polOrder;
  static const size_t dimDomain = BaseType::dimDomain;
  static const size_t dimRange = BaseType::dimRange;
  static const size_t dimRangeCols = BaseType::dimRangeCols;

  typedef typename Traits::GridViewType         GridViewType;
  typedef typename Traits::RangeFieldType       RangeFieldType;
  typedef typename Traits::BackendType          BackendType;
  typedef typename Traits::MapperType           MapperType;
  typedef typename Traits::BaseFunctionSetType  BaseFunctionSetType;

  typedef typename GridViewType::ctype              DomainFieldType;
  typedef FieldVector< DomainFieldType, dimDomain > DomainType;
  typedef CommunicationChooser< GridViewType >      CommunicationChooserType;
  typedef typename CommunicationChooserType::Type   CommunicatorType;

private:
  typedef typename Traits::FEMapType FEMapType;

public:
  typedef typename BaseType::IntersectionType  IntersectionType;
  typedef typename BaseType::EntityType        EntityType;
  typedef typename BaseType::PatternType       PatternType;
  typedef typename BaseType::BoundaryInfoType  BoundaryInfoType;

  explicit PdelabBased(GridViewType gV)
    : gridView_(gV)
    , fe_map_(gridView_)
    , backend_(gridView_, fe_map_)
    , mapper_(backend_)
    , communicator_(CommunicationChooser< GridViewImp >::create(gridView_))
    , communicator_prepared_(false)
  {}

  /**
   * \brief Copy ctor.
   * \note  Manually implemented bc of the std::mutex + communicator_ unique_ptr
   */
  PdelabBased(const ThisType& other)
    : gridView_(other.gridView_)
    , fe_map_(gridView_)
    , backend_(gridView_, fe_map_)
    , mapper_(backend_)
    , communicator_(CommunicationChooser< GridViewImp >::create(gridView_))
    , communicator_prepared_(false)
  {
    // make sure our new communicator is prepared if other's was
    if (other.communicator_prepared_)
      const auto& DUNE_UNUSED(comm) = this->communicator();
  }

  /**
   * \brief Move ctor.
   * \note  Manually implemented bc of the std::mutex.
   */
  PdelabBased(ThisType&& source)
    : gridView_(source.gridView_)
    , fe_map_(source.fe_map_)
    , backend_(source.backend_)
    , mapper_(source.mapper_)
    , communicator_(std::move(source.communicator_))
    , communicator_prepared_(source.communicator_prepared_)
  {}

  ThisType& operator=(const ThisType& other) = delete;

  ThisType& operator=(ThisType&& source) = delete;

  const GridViewType& grid_view() const
  {
    return gridView_;
  }

  const BackendType& backend() const
  {
    return backend_;
  }

  const MapperType& mapper() const
  {
    return mapper_;
  }

  std::vector< DomainType > lagrange_points(const EntityType& entity) const
  {
    return BaseType::lagrange_points_order_1(entity);
  }

  std::set< size_t > local_dirichlet_DoFs(const EntityType& entity,
                                          const BoundaryInfoType& boundaryInfo) const
  {
    return BaseType::local_dirichlet_DoFs_order_1(entity, boundaryInfo);
  }

  BaseFunctionSetType base_function_set(const EntityType& entity) const
  {
    return BaseFunctionSetType(backend_, entity);
  }

  CommunicatorType& communicator() const
  {
    std::lock_guard< std::mutex > DUNE_UNUSED(gg)(communicator_mutex_);
    if (!communicator_prepared_)
      communicator_prepared_ = CommunicationChooserType::prepare(*this, *communicator_);
    return *communicator_;
  } // ... communicator(...)

private:
  GridViewType gridView_;
  const FEMapType fe_map_;
  const BackendType backend_;
  const MapperType mapper_;
  mutable std::unique_ptr<CommunicatorType> communicator_;
  mutable bool communicator_prepared_;
  mutable std::mutex communicator_mutex_;
}; // class PdelabBased< ..., 1 >

template< class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim >
class PdelabBased< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1 >
  : public Spaces::CGInterface< PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1 >,
                                GridViewImp::dimension, rangeDim, 1 >
{
  typedef Spaces::CGInterface< PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1 >,
                               GridViewImp::dimension, rangeDim, 1 >              BaseType;
  typedef Spaces::CGInterface< PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, 1, 1 >,
                               GridViewImp::dimension, 1, 1 >                     ScalarBaseType;
  typedef PdelabBased< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1 > ThisType;
public:
  typedef PdelabBasedTraits< GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1 > Traits;

  static const int    polOrder = Traits::polOrder;
  static const size_t dimDomain = BaseType::dimDomain;
  static const size_t dimRange = BaseType::dimRange;
  static const size_t dimRangeCols = BaseType::dimRangeCols;

  typedef typename Traits::GridViewType         GridViewType;
  typedef typename Traits::RangeFieldType       RangeFieldType;
  typedef typename Traits::BackendType          BackendType;
  typedef typename Traits::MapperType           MapperType;
  typedef typename Traits::BaseFunctionSetType  BaseFunctionSetType;

  typedef typename GridViewType::ctype              DomainFieldType;
  typedef FieldVector< DomainFieldType, dimDomain > DomainType;
  typedef CommunicationChooser< GridViewType >      CommunicationChooserType;
  typedef typename CommunicationChooserType::Type   CommunicatorType;

private:
  typedef typename Traits::FEMapType FEMapType;

public:
  typedef typename BaseType::IntersectionType  IntersectionType;
  typedef typename BaseType::EntityType        EntityType;
  typedef typename BaseType::PatternType       PatternType;
  typedef typename BaseType::BoundaryInfoType  BoundaryInfoType;

  explicit PdelabBased(GridViewType gV)
    : gridView_(gV)
    , fe_map_(gridView_)
    , backend_(gridView_, fe_map_)
    , mapper_(backend_)
    , communicator_(CommunicationChooser< GridViewImp >::create(gridView_))
    , communicator_prepared_(false)
  {}

  /**
   * \brief Copy ctor.
   * \note  Manually implemented bc of the std::mutex + communicator_ unique_ptr
   */
  PdelabBased(const ThisType& other)
    : gridView_(other.gridView_)
    , fe_map_(gridView_)
    , backend_(gridView_, fe_map_)
    , mapper_(backend_)
    , communicator_(CommunicationChooser< GridViewImp >::create(gridView_))
    , communicator_prepared_(false)
  {
    // make sure our new communicator is prepared if other's was
    if (other.communicator_prepared_)
      const auto& DUNE_UNUSED(comm) = this->communicator();
  }

  /**
   * \brief Move ctor.
   * \note  Manually implemented bc of the std::mutex.
   */
  PdelabBased(ThisType&& source)
    : gridView_(source.gridView_)
    , fe_map_(source.fe_map_)
    , backend_(source.backend_)
    , mapper_(source.mapper_)
    , communicator_(std::move(source.communicator_))
    , communicator_prepared_(source.communicator_prepared_)
  {}

  ThisType& operator=(const ThisType& other) = delete;

  ThisType& operator=(ThisType&& source) = delete;

  const GridViewType& grid_view() const
  {
    return gridView_;
  }

  const BackendType& backend() const
  {
    return backend_;
  }

  const MapperType& mapper() const
  {
    return mapper_;
  }

  std::vector< DomainType > lagrange_points(const EntityType& entity) const
  {
    return ScalarBaseType::lagrange_points_order_1(entity);  //should do the right thing
  }

  std::set< size_t > local_dirichlet_DoFs(const EntityType& entity,
                                          const BoundaryInfoType& boundaryInfo) const
  {
    return BaseType::local_dirichlet_DoFs_order_1(entity, boundaryInfo);  //throws a Dune_Not_Implemented atm
  }

  BaseFunctionSetType base_function_set(const EntityType& entity) const
  {
    return BaseFunctionSetType(backend_, entity);
  }

  CommunicatorType& communicator() const
  {
    std::lock_guard< std::mutex > DUNE_UNUSED(gg)(communicator_mutex_);
    if (!communicator_prepared_)
      communicator_prepared_ = CommunicationChooserType::prepare(*this, *communicator_);
    return *communicator_;
  } // ... communicator(...)

private:
  GridViewType gridView_;
  const FEMapType fe_map_;
  const BackendType backend_;
  const MapperType mapper_;
  mutable std::unique_ptr<CommunicatorType> communicator_;
  mutable bool communicator_prepared_;
  mutable std::mutex communicator_mutex_;
}; // class PdelabBased< ..., dimRange, 1 >

#else // HAVE_DUNE_PDELAB

template< class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1 >
class PdelabBased
{
  static_assert(Dune::AlwaysFalse< GridViewImp >::value, "You are missing dune-pdelab!");
};

#endif // HAVE_DUNE_PDELAB

} // namespace CG
} // namespace Spaces
} // namespace GDT
} // namespace Dune

#endif // DUNE_GDT_SPACES_CG_PDELAB_HH


text:
package pl.dobosz.shoppingapi.models;

/**
 * Created by dobosz on 2/1/16.
 */
public class CartItemStatus {
  private long id;

  public CartItemStatus(long id) {
    this.id = id;
  }

  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }
}


text:
'use strict';

const menu = require('./menu.js');

const menuMap = [
  {
    text: 'Subjects',
    children: [
            { text: 'Enter a New Subject' },
            { text: 'Enroll an Existing Subject' },
            { text: 'Merge Subjects' },
            { text: 'Look Up a Subject' },
            { text: 'Import Participants' },
    ],
  },
  {
    text: 'Studies',
    children: [
            { text: 'List Studies' },
            { text: 'Add New Study' },
    ],
  },
  {
    text: 'Data Exchange',
    children: [
            { text: 'Browse Available Data' },
    ],
  },
];

module.exports = client => menu(client, menuMap);


text:
package aws_enemy

import (
	"fmt"
	"net/http"

	"github.com/rosenhouse/awsfaker"
)

type EC2 struct{}

func (EC2) CreateKeyPair_AlreadyExistsError(keypairName string) *awsfaker.ErrorResponse {
	return &awsfaker.ErrorResponse{
		HTTPStatusCode:  http.StatusBadRequest,
		AWSErrorCode:    "InvalidKeyPair.Duplicate",
		AWSErrorMessage: fmt.Sprintf("The keypair '%s' already exists.", keypairName),
	}
}

type CloudFormation struct{}

func (CloudFormation) UpdateStack_StackMissingError(stackName string) *awsfaker.ErrorResponse {
	return &awsfaker.ErrorResponse{
		HTTPStatusCode:  http.StatusBadRequest,
		AWSErrorCode:    "ValidationError",
		AWSErrorMessage: fmt.Sprintf("Stack [%s] does not exist", stackName),
	}
}

func (CloudFormation) UpdateStack_NoChangesError() *awsfaker.ErrorResponse {
	return &awsfaker.ErrorResponse{
		HTTPStatusCode:  http.StatusBadRequest,
		AWSErrorCode:    "ValidationError",
		AWSErrorMessage: "No updates are to be performed.",
	}
}

func (CloudFormation) CreateStack_AlreadyExistsError(stackName string) *awsfaker.ErrorResponse {
	return &awsfaker.ErrorResponse{
		HTTPStatusCode:  http.StatusBadRequest,
		AWSErrorCode:    "AlreadyExistsException",
		AWSErrorMessage: fmt.Sprintf("Stack [%s] already exists", stackName),
	}
}

func (CloudFormation) DescribeStacks_StackMissingError(stackName string) *awsfaker.ErrorResponse {
	return &awsfaker.ErrorResponse{
		HTTPStatusCode:  http.StatusBadRequest,
		AWSErrorCode:    "ValidationError",
		AWSErrorMessage: fmt.Sprintf("Stack with id %s does not exist", stackName),
	}
}

func (CloudFormation) DescribeStackResources_StackMissingError(stackName string) *awsfaker.ErrorResponse {
	return &awsfaker.ErrorResponse{
		HTTPStatusCode:  http.StatusBadRequest,
		AWSErrorCode:    "ValidationError",
		AWSErrorMessage: fmt.Sprintf("Stack with id %s does not exist", stackName),
	}
}


text:
using namespace BloombergLP;
using namespace bsl;

// ============================================================================
//                             TEST PLAN
// ----------------------------------------------------------------------------
//
//                              Overview
//                              --------
// The component under test defines a type trait for use in marking an
// enumeration type as eligible to participate in the '<system_error>'
// facility.
//
// ----------------------------------------------------------------------------
//
// TRAITS
// [ 1] is_error_code_enum<TYPE>::value
// [ 1] BSL_IS_ERROR_CODE_ENUM_NAMESPACE
// ----------------------------------------------------------------------------
// [ 2] USAGE EXAMPLE

// ============================================================================
//                     STANDARD BSL ASSERT TEST FUNCTION
// ----------------------------------------------------------------------------

namespace {

int testStatus = 0;

void aSsErT(bool condition, const char *message, int line)
{
    if (condition) {
        printf("Error " __FILE__ "(%d): %s    (failed)\n", line, message);

        if (0 <= testStatus && testStatus <= 100) {
            ++testStatus;
        }
    }
}

}  // close unnamed namespace

// ============================================================================
//               STANDARD BSL TEST DRIVER MACRO ABBREVIATIONS
// ----------------------------------------------------------------------------

#define ASSERT       BSLS_BSLTESTUTIL_ASSERT
#define ASSERTV      BSLS_BSLTESTUTIL_ASSERTV

#define LOOP_ASSERT  BSLS_BSLTESTUTIL_LOOP_ASSERT
#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT
#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT
#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT
#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT
#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT
#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT
#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT

#define Q            BSLS_BSLTESTUTIL_Q   // Quote identifier literally.
#define P            BSLS_BSLTESTUTIL_P   // Print identifier and value.
#define P_           BSLS_BSLTESTUTIL_P_  // P(X) without '\n'.
#define T_           BSLS_BSLTESTUTIL_T_  // Print a tab (w/o newline).
#define L_           BSLS_BSLTESTUTIL_L_  // current Line number

//=============================================================================
//            GLOBAL TYPEDEFS/CONSTANTS/FUNCTIONS FOR TESTING
//-----------------------------------------------------------------------------

namespace ErrorValues {
enum Eligible         { e_eligible          = 1 };
enum Ineligible       { e_ineligible        = 2 };
enum MarkedIneligible { e_marked_ineligible = 3 };
}  // close namespace ErrorValues

// BDE_VERIFY pragma: -NT01  // namespace comment depends on macro

#ifdef BSL_OVERRIDES_STD
#undef std
#endif
namespace BSL_IS_ERROR_CODE_ENUM_NAMESPACE {
template <>
struct is_error_code_enum<ErrorValues::Eligible> : bsl::true_type
    // Specialize trait to mark 'Eligible' as an error code.
{
};

template struct is_error_code_enum<ErrorValues::Ineligible>;
    // Use the default trait to see whether 'Ineligible' is an error code.

template <>
struct is_error_code_enum<ErrorValues::MarkedIneligible> : bsl::false_type
    // Specialize trait to mark 'MarkedIneligible' as not an error code.
{
};
}  // close namespace BSL_IS_ERROR_CODE_ENUM_NAMESPACE
#ifdef BSL_OVERRIDES_STD
#define std bsl
#endif

//=============================================================================
//                                USAGE EXAMPLE
//-----------------------------------------------------------------------------

///Usage
///-----
// In this section we show intended use of this component.
//
///Example 1: Dedicated Error Values
///- - - - - - - - - - - - - - - - -
// Suppose we have a dedicated system with a set of possible errors, and we
// want to be able to throw descriptive exceptions when an error occurs.  We
// need to work with the '<system_error>' facility to support this, starting by
// marking the enumeration type that defines the error literals as eligible to
// participate.  We can use 'bsl::is_error_code_enum' to do this.
//
// First, we define the set of error values for our system.
//..
    struct CarError {
        // TYPES
        enum Enum {
            k_CAR_WHEELS_CAME_OFF = 1,
            k_CAR_ENGINE_FELL_OUT = 2
        };
    };
//..
// Then, we enable the trait marking this as an error code.  (Note that if this
// code is intended to be used with 'BSL_OVERRIDES_STD' and C++11, it is
// necessary to bracket it as shown, or it will not compile.)
//..
    namespace BSL_IS_ERROR_CODE_ENUM_NAMESPACE {
    template <>
    struct is_error_code_enum<CarError::Enum>
    : public bsl::true_type { };
    }  // close namespace BSL_IS_ERROR_CODE_ENUM_NAMESPACE
//..

// BDE_VERIFY pragma: +NT01  // namespace comment depends on macro

//=============================================================================
//                      GLOBAL HELPER FUNCTIONS FOR TESTING
//-----------------------------------------------------------------------------

//=============================================================================
//                              MAIN PROGRAM
//-----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
    int test                = argc > 1 ? atoi(argv[1]) : 0;
    int verbose             = argc > 2;
    int veryVerbose         = argc > 3; (void)veryVerbose;
    int veryVeryVerbose     = argc > 4; (void)veryVeryVerbose;
    int veryVeryVeryVerbose = argc > 5; (void)veryVeryVeryVerbose;

    printf("TEST " __FILE__ " CASE %d\n", test);

    switch (test) { case 0:  // Zero is always the leading case.
      case 2: {
        // --------------------------------------------------------------------
        // USAGE EXAMPLE
        //
        // Concerns:
        //: 1 The usage example provided in the component header file compiles,
        //:   links, and runs as shown.
        //
        // Plan:
        //: 1 Incorporate usage example from header into test driver, remove
        //:   leading comment characters, and replace 'assert' with 'ASSERT'.
        //:   (C-1)
        //
        // Testing:
        //   USAGE EXAMPLE
        // --------------------------------------------------------------------

        if (verbose) printf("\nUSAGE EXAMPLE"
                            "\n=============\n");

// Finally, we verify that the trait marks our type as eligible.
//..
    ASSERT(is_error_code_enum<CarError::Enum>::value);
//..
      } break;
      case 1: {
        // --------------------------------------------------------------------
        // TESTING 'is_error_code_enum<TYPE>'
        //   Verify that the code identification traits are set correctly.
        //
        // Concerns:
        //: 1 A type marked as a code reports that it is.
        //: 2 By default types do not report as codes.
        //: 3 A type marked as not a code reports that it is not.
        //: 4 Specializing in BSL_IS_ERROR_CODE_ENUM_NAMESPACE works.
        //
        // Plan:
        //: 1 Create an enum with the trait specialized as true and test that
        //:   the trait reports as true.  (C-1,4)
        //:
        //: 2 Create an enum without specializing the trait and test that the
        //:   trait reports as false.  (C-2)
        //:
        //: 3 Create an enum with the trait specialized as false and test that
        //:   the trait reports as false.  (C-3,4)
        //
        // Testing:
        //   is_error_code_enum<TYPE>::value
        //   BSL_IS_ERROR_CODE_ENUM_NAMESPACE
        // --------------------------------------------------------------------

        if (verbose) printf("\nTESTING 'is_error_code_enum<TYPE>'"
                            "\n==================================\n");

        using namespace ErrorValues;
#ifdef BSL_OVERRIDES_STD
#undef std
#endif
        using namespace BSL_IS_ERROR_CODE_ENUM_NAMESPACE;
#ifdef BSL_OVERRIDES_STD
#define std bsl;
#endif

        if (veryVerbose) {
            P(is_error_code_enum<Eligible>::value)
            P(is_error_code_enum<Ineligible>::value)
            P(is_error_code_enum<MarkedIneligible>::value)
        }

        ASSERT(is_error_code_enum<Eligible>::value);
        ASSERT(!is_error_code_enum<Ineligible>::value);
        ASSERT(!is_error_code_enum<MarkedIneligible>::value);
      } break;
      default: {
        fprintf(stderr, "WARNING: CASE `%d' NOT FOUND.\n", test);
        testStatus = -1;
      }
    }

    if (testStatus > 0) {
        fprintf(stderr, "Error, non-zero test status = %d.\n", testStatus);
    }

    return testStatus;
}

// ----------------------------------------------------------------------------
// Copyright 2019 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------


text:
[Clipper](https://sourceforge.net/projects/jsclipper/) abstraction layer (simplified API)

Target of this library is to remove complexity and create an overall cleaner, JavaScript idiomatic API for Clipper.

When using this API one class, Shape, is used. Shape is a collection of paths that are all collectively closed or open. Shapes with holes are defined as multiple closed paths where the outlines are clockwise and the holes are counter-clockwise. Shapes has multiple functions that can be used to for instance compute complex boolean operations from one just call.

The next two code examples show a simple Boolean operation in clipper and in ClipperJS. Both use two predefined paths

```javascript
const subjectPaths = [[{ X: 30, Y: 30 }, { X: 10, Y: 30 }, { X: 10, Y: 10 }, { X: 30, Y: 10 }]];
const clipPaths = [[{ X: 20, Y: 20 }, { X: 0, Y: 20 }, { X: 0, Y:0 }, { X: 20, Y: 0 }]];
```

A boolean intersect operation in clipper looks like this
```javascript
const result = new ClipperLib.Paths();
const clipper = new ClipperLib.Clipper();
clipper.AddPaths(subjectPaths, ClipperLib.PolyType.ptSubject, true);
clipper.AddPaths(clipPaths, ClipperLib.PolyType.ptClip, true);
clipper.Execute(ClipperLib.ClipType.ctIntersection, result);

// result = [[{ X: 20, Y: 20 }, { X: 10, Y: 20 }, { X: 10, Y: 10 }, { X: 20, Y: 10 }]]
```

In ClipperJS
```javascript
const subject = new Shape(subjectPaths, true);
const clip = new Shape(subjectPaths, true);

const result = subject.intersect(clip);

// result = { closed: true, paths: [[{ X: 20, Y: 20 }, { X: 10, Y: 20 }, { X: 10, Y: 10 }, { X: 20, Y: 10 }]] }
```

# Usage

### Using JSPM (ECMAScript / ES6 Module)

Install the library.

```
jspm install github:Doodle3D/clipper-js
```

Include the library.

```javascript
import Shape from 'Doodle3D/clipper-js';
```

### Using NPM (CommonJS module)

Install the library.

```
npm install @doodle3d/clipper-js --save
```

Include the library.

```javascript
var Shape = require('clipper-js');
```

# API

**Shape**

Shape accepts 3 optional arguments, `paths`, `closed` and `capitalConversion`. `paths` can be be devined with both upper case and lower case. Clipper only uses uppercase properties, when input is given with lower case `captalConversion` needs to be set to `true`.
```javascript
new Shape([ paths = [], closed = true, capitalConversion = false, integerConversion = false, removeDuplicates = false ])

paths = [...[...{ X: Number, Y: Number }] || [...[...{ x: Number, y: Number }]
paths = Array
closed = Bool
capitalConversion = Bool
integerConversion = Bool
removeDuplicates = Bool
```
  - paths: the paths that make up the shape
  - closed: Shape is a polygon or line
  - capitalConversion: converts lower case x and y to uppercase X and Y
  - integerConversion: clipper only works with intergers, sometimes when input is in floats clipper fails
  - removeDuplicates: clipper sometimes fails when there are duplicate points in the data set, this argument filters out all the duplicate points

`Note: due to the nature of Clipper, some functions are destructive and some are non-destructive.`

**[Boolean operation: Union](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperexecute)**
```javascript
Shape = Shape.union( clipShape: Shape )
```
  - clipShape: clip of the boolean operation

**[Boolean operation: Difference](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperexecute)**
```javascript
Shape = Shape.difference( clipShape: Shape )
```
  - clipShape: clip of the boolean operation

**[Boolean operation: Intersect](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperexecute)**
```javascript
Shape = Shape.intersect( clipShape: Shape )
```
  - clipShape: clip of the boolean operation

**[Boolean operation: Xor](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperexecute)**
```javascript
Shape = Shape.xor( clipShape: Shape )
```
  - clipShape: clip of the boolean operation

**[Offset](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperoffset)**
```javascript
Shape = Shape.offset( offset: Number, options: {
  jointType = 'jtSquare',
  endType = 'etClosedPolygon',
  miterLimit = 2.0,
  roundPrecision = 0.25
} )
```
  - offset: clip off the boolean operation
  - options: optional arguments with default values
    - [jointType](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjointype): join type of the offset
    - [endType](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibendtype): end type of the offset
    - [mitterLimit](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperoffsetmiterlimit): mitter limit
    - [roundPrecision](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperoffsetarctolerance): arc tolerance

offsets the shape along its normal.

**[Scale Up](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjsscaleuppaths)**
```javascript
Shape.scaleUp( factor: Number )
```
scale up with factor.

`Note: destructive`

**[Scale Down](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjsscaledownpaths)**
```javascript
Shape.scaleDown( factor: Number )
```
scale up with factor.

`Note: destructive`

**First Point**
```javascript
{ X: Number, Y: Number } || { x: Number, y: Number } = Shape.firstPoint([ capitalConversion: false ])
```
- capitalConversion: converts uppercase X and Y to lowercase x and y.

returns position of the first point.

**Last Point**
```javascript
{ X: Number, Y: Number } || { x: Number, y: Number } = Shape.lastPoint([ capitalConversion: false ])
```
- capitalConversion: converts uppercase X and Y to lowercase x and y.

returns position of the last point.

**Total Area**
```javascript
Number = Shape.totalArea()
```
returns total area of the shape.

**[Area](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperarea)**
```javascript
Number = Shape.area( index: Int )
```
  - index: index of the sub shape

returns area of the sub shape (negative if counter-clock wise).

**Areas**
```javascript
[...Number] = Shape.areas()
```
returns array of areas of all sub shapes.

**Total Perimeter**
```javascript
Number = Shape.totalPerimeter()
```
returns total perimeter of the shape.

**[Perimeter](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjsperimeterofpath)**
```javascript
Number = Shape.perimeter( index: Int )
```
  - index: index of the sub shape

returns perimeter of the sub shape.

**Perimeters**
```javascript
[...Number] = Shape.perimeters()
```
returns array of perimeters of all sub shapes.

**[Reverse](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperreversepaths)**
```javascript
Shape.reverse()
```
reverses the order of all sub shapes.

**Treshold Area**
```javascript
Shape.tresholdArea( minArea: Number )
```
  - minArea: minimal size of area

removes all sub shapes from shape which are smaller then min area.

**Join**
```javascript
Shape.join( shape )
```
joins shape with given shape.

`Note: destructive`

**[Clone](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjsclone)**
```javascript
Shape = Shape.clone()
```
returns copy of shape.

**[Shape Bounds](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjsboundsofpaths)**
```javascript
{
  left: Int,
  right: Int,
  top: Int,
  bottom: Int,
  width: Int,
  height: Int,
  size: Int
} = Shape.shapeBounds()
```
returns bounding box of shape.

**[Path Bounds](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibjsboundsofpath)**
```javascript
{
  left: Int,
  right: Int,
  top: Int,
  bottom: Int,
  width: Int,
  height: Int,
  size: Int
} = Shape.pathBounds( index: Int )
```
returns bounding box of sub shape.

**[Clean](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclippercleanpolygons)**
```javascript
Shape = Shape.clean( cleanDelta: Number )
```

**[Orientation](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperorientation)**
```javascript
Bool = Shape.orientation( index: Int )
```
returns orientation of the sub shape. True if clockwise, false if counter clock wise.

**Point In Shape**
```javascript
Bool = Shape.pointInShape( { X: Number, Y: Number }, [ capitalConversion = false, integerConversion = false ] )
```
  - point: position used for hit detection
  - capitalConversion: converts lower case x and y to uppercase X and Y
  - integerConversion: converts point to intpoint

returns if point is in shape.

**[Point In Path](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclipperpointinpolygon)**
```javascript
Bool = Shape.pointInPath( index: Int, { X: Number, Y: Number }, [ capitalConversion = false, integerConversion = false ] )
```
  - point: position used for hit detection
  - index: index of sub shape
  - capitalConversion: converts lower case x and y to uppercase X and Y
  - integerConversion: converts point to intpoint

returns if point is in sub shape.

**Fix Orientation**
```javascript
Shape.fixOrientation()
```
when given path with holes, outline must be clockwise and holes must be counter-clockwise. Tries to fix the orientation.

`Note: destructive`

**[Simplify](https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibclippersimplifypolygons)**
```javascript
Shape = Shape.simplify(fillType: String)
```
Simplifies shape using filltype. Only works for closed shapes.

**Separate Shapes**
```javascript
[...Shape] = Shape.separateShapes()
```
when using union operations multiple shapes can be created. Separate Shapes splits these shapes into separate instances. All shapes keep their holes.

**Round**
```javascript
Shape = Shape.round()
```
Returns new instance of Shape with all points rounded to Integers.

**Remove Duplicates**
```javascript
Shape = Shape.removeDuplicates()
```
Returns new instance of Shape with all duplicate points removed.

**Map To Lower**
```javascript
[...[...{ x: Number, y: Number }]] = Shape.mapToLower()
```
returns paths array with lower case x and y.


text:
package org.la4j.io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public abstract class AbstractStream implements MatrixStream, VectorStream {

    protected BufferedReader reader;
    protected BufferedWriter writer;

    public AbstractStream(InputStream in) {
        if (in == null) {
            throw new IllegalArgumentException();
        }

        this.reader = new BufferedReader(new InputStreamReader(in));
    }

    public AbstractStream(OutputStream out) {
        if (out == null) {
            throw new IllegalArgumentException();
        }

        this.writer = new BufferedWriter(new OutputStreamWriter(out));
    }

    protected void ensureReaderInitialized() {
        if (reader == null) {
            throw new IllegalStateException();
        }
    }

    protected void ensureWriterInitialized() {
        if (writer == null) {
            throw new IllegalStateException();
        }
    }

    protected void closeWriter() throws IOException {
        writer.flush();
        writer.close();
    }

    protected void closeReader() throws IOException {
        reader.close();
    }
}


text:
require 'spec_helper'
require 'timecop' # for  Timecop.freeze

# How it works
#
# The test records http response using +vcr+ as fixtures which are
# stored under spec/fixtures/vcr directory. After the response is
# stored as fixtures, vcr will start replaying those requests when
# same url is accessed by faraday.
#
# To deal with the cache expiry, the cache_store is set to in-memory so
# that the first fetch will be missed and handled by vcr. Time is
# frozen to 2016 which makes the cache valid/fresh after it is
# fetched/played once by vcr.

# NOTE: disable webmock to record a new test
# WebMock.disable!

# returns http cache status for all http calls made
# using faraday in the +&block+ passed
def record_cache_access(&block)
  cache_access = []
  record_status = lambda do |*args|
    event = ActiveSupport::Notifications::Event.new(*args)
    cache_access << event.payload[:cache_status]
  end
  ActiveSupport::Notifications.subscribed(record_status, 'http_cache.faraday', &block)
  cache_access
end

describe 'Caching' do
  before do
    @old_config = PDC.config
    config = @old_config.clone
    config.disable_caching = false
    config.cache_store = ActiveSupport::Cache.lookup_store(:memory_store)

    PDC.config = config

    VCR.insert_cassette fixture_name
    Timecop.travel(Time.local(2016)) #   based on fixtures
  end

  after do
    Timecop.return
    VCR.eject_cassette
    PDC.config = @old_config
  end

  it 'caches response without query' do
    cache = record_cache_access { PDC::V1::Release.scoped.contents! }
    cache.must_equal [:miss]

    cache = record_cache_access { PDC::V1::Release.scoped.contents! }
    cache.must_equal [:fresh]

    cache = record_cache_access { PDC::V1::Release.scoped.contents! }
    cache.must_equal [:fresh]
  end

  it 'caches response with a query' do
    cache = record_cache_access { PDC::V1::Release.page(2).contents! }
    cache.must_equal [:miss]

    cache = record_cache_access { PDC::V1::Release.page(2).contents! }
    cache.must_equal [:fresh]
  end

  it 'caches response with multiple query' do
    cache = record_cache_access do
      PDC::V1::Release.page(2).page_size(30).contents!
      PDC::V1::Release.page(2).page_size(30).contents!
    end
    cache.must_equal %i[miss fresh]
  end

  it 'caches multiple response' do
    cache = record_cache_access { PDC::V1::Release.where(active: true).all }

    # must paginate so at least 2 pages
    cache.length.must_be :>=, 2
    cache.must_equal [:miss] * cache.length

    second_time = record_cache_access { PDC::V1::Release.where(active: true).all }
    second_time.must_equal [:fresh] * cache.length
  end
end


text:
from __future__ import print_function

import unittest
import numpy as np
from paddle.fluid.tests.unittests.op_test import OpTest

class TestDeQuantizeOp(OpTest):
    def setUp(self):
        self.op_type = 'dequantize'
        self.scale = 2.0
        self.input_size = [1, 1, 5, 5]  #Naive nChw16c
        self.data_type = 'int8'
        self.set_scale()
        self.set_data_type()

        if self.data_type == 'int8':
            input = (np.random.randint(0, 100, self.input_size) - 50
                     ).astype(self.data_type)
            output = (input * (1 / self.scale)).astype('float')
        else:
            input = (np.random.randint(0, 100,
                                       self.input_size)).astype(self.data_type)
            output = (input * (1 / self.scale)).astype('float')

        self.inputs = {'Input': OpTest.np_dtype_to_fluid_dtype(input)}

        self.outputs = {'Output': output}

        self.attrs = {'Scale': self.scale, }

    def test_check_output(self):
        self.check_output()

    def set_scale(self):
        pass

    def set_data_type(OpTest):
        pass

class TestDeQuantizeOp1(TestDeQuantizeOp):
    def set_scale(self):
        self.scale = 1.5

    def set_data_type(self):
        self.data_type = 'int8'

class TestDeQuantizeOp2(TestDeQuantizeOp):
    def set_scale(self):
        self.scale = 0.8

    def set_data_type(self):
        self.data_type = 'uint8'

if __name__ == '__main__':
    unittest.main()


text:
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Escudos Fútbol</title>
	<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,700" rel="stylesheet" type="text/css">
	<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	{!! HTML::style('/lib/bootstrap-table/bootstrap-table.min.css') !!}
	{!! HTML::style('/css/escudos.css') !!}
	@include('layouts.social')
</head>

<body>
	@include('layouts.nav')
	<div class="contenidoPagina">
		@yield('content')
	</div>
	@include('layouts.footer')
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	{!! HTML::script('/lib/bootstrap-table/bootstrap-table.min.js') !!}
	{!! HTML::script('/lib/bootstrap-table/bootstrap-table-es-ES.js') !!}
	@include('layouts.analyticstracking')
</body>
</html>


text:
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         stopOnFailure="true">
    <testsuites>
        <testsuite name="TwoFactorAuth test suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>
</phpunit>


text:
<?php

namespace app\modules\test_task;

class TestTask extends \yii\base\Module
{
    public $controllerNamespace = 'app\modules\test_task\controllers';
    public $defaultRoute = 'grid';

    public function init()
    {
        parent::init();

        // custom initialization code goes here
    }
}


text:
// Done by TheTutor

/*
	This tutorial is all about the keyword "extern".  So for starters, what does the "extern"
	keyword do?  The extern keyword actually can mean two different things depending on the
	context of where/how it is used.  The first usage of the extern keyword declares
	a variable or function to have external linkage (naturally %).  This means that the
	variable or function is "visible" from files other than the one in which it is defined.
	It is VERY IMPORANT to note that just because a variable is "externed" it does not
	necessarily work like a "global variable".  For every file the variable is in, it can
	have a unique value(s).  However, if it's only given a value in one file, it will
	be shared across all files.

	The second usage of the extern keyword is to specify that the linkage conventions of
	another language are being used for the declarator(s).  To better explain this example
	lets think about C and C++ code.  Lets suppose you have this code that you want to compile
	and act just like it's in a .c file.  However, you will be putting this code in a .cpp file.
	We know that .c and .cpp files compile differently (i.e. you can only declare variables at
	the top of a function in a .c file) so it would seem that there is no way we could
	have .c code work EXACTLY like .c code in a .cpp file.  But, by using the "extern" keyword
	you can specify certain code to use linkage conventions of a different language.  An
	example of what code using extern in this context might look like is this:

		extern "C"
		{
			char DrawSprite(int which); // Draws "which" sprite
			void ProcessSprite(int which); // Processes "which" sprite
		}

	In practice, you more than likely will NOT have to deal with the second usage of
	the keyword "extern".  However if you're writing portable, very large projects, or hyper
	robust code you may run across it.

	This tutorial is going to focus on the first usage of the keyword "extern", and that
	is making it easy to access variable(s) across many files.  In this tutorial we are
	going to create a dead simple point struct and two functions to access it's data.  Then
	we'll declare a externed SPoint and demonstrate how to use it.  So off to the code...

*/

#include <iostream>
using namespace std;

#include "point.h"

int main()
{
	// *** ADD CODE FROM BELOW HERE ***
	// (Read the comments under main and you'll understand %)

	// What do you expect this to print?  Well, we defined "externedPoint" in point.cpp
	// so it will print out the values we assigned to it there.  Notice that if we DID NOT
	// define "externedPoint" anywhere (besides point.h) we'd get a compiler error.
	cout << "Extern Point = (" << GetX(externedPoint) << "," << GetY(externedPoint) << ")";
	cout << endl << endl;

	// Here we show that yes, we can change the value of our externed point
	externedPoint.x = 50;
	externedPoint.y = 40;

	// Display the new values of "externedPoint" so we know that they did change
	cout << "Extern Point = (" << GetX(externedPoint) << "," << GetY(externedPoint) << ")";
	cout << endl << endl;
	return 0;
}

// X-turn...

/*
	The "extern" keyword is something that can be difficult to wrap your brain around.
	It is very important that if you are going to use it, you fully understand how it
	works, or you could cause yourself headaches for weeks.  Remember when you
	declare a variable as an extern:

		extern int some_variable; // This JUST says, "Here is a variable name you can
								  // use and should know about, but the data will (must)
								  // be filled in by some other file(s)".

	Assuming "some_variable" (from directly above) is declared in a header file, all other
	files that #include that header file will be able to create a int of some_variable AND
	if you wanted to you could change the value of "some_variable" and have it be different
	for EVERY PLACE you declared it in other files.  Is that a mouthful or what!?!

	So to demonstrate this fact, in main() you'll see a comment line that reads:

		// *** ADD CODE FROM BELOW HERE ***

	Directly underneath this comment line, cut the following line of code
	and paste it in:

		SPoint externedPoint = { 22.2f, 222.2f };

	Pay close attention to the output with and without this line of code.  By looking
	at this example (as many times as it takes) you should learn the fundamental concept
	of the keyword "extern".

*/

// Questions???  If so direct 'em to the forums at www.GameTutorials.com

/*-------------------------*\
|  Programmed by:  TheTutor	|
|  ©2006 GameTutorials, LLC	|
\*-------------------------*/


text:
require "spec_helper"

module Dato
  module Utils
    module MetaTags
      describe Robots do
        include_context "items repo"

        subject(:builder) { described_class.new(item, site) }

        describe "#build" do
          let(:result) { builder.build }

          context "with site noIndex set" do
            let(:no_index) { true }

            it "returns robots meta tag" do
              expect(result[:attributes][:content]).to eq("noindex")
            end
          end

          context "with site noIndex not set" do
            it "returns no tags" do
              expect(result).to be_nil
            end
          end
        end
      end
    end
  end
end


text:
'use strict';

/**
 * Module dependencies.
 */

var path = require('path');
var objectAssign = require('object-assign');

/**
 * Expose options.
 */

module.exports = function(options) {

  var defaultOptions = {
    relativeAssets: true,
    projectPath: './dist',
    httpPath: '/',
    cssDir: 'css',
    imagesDir: 'images',
    fontsDir: 'css/fonts'
    // TODO: Fix case when images and css are in the same directory.
  };

  options = objectAssign({}, options);

  var projectPath = options['projectPath'] || defaultOptions['projectPath'];
  var httpPath = options['httpPath'] || defaultOptions['httpPath'];
  var cssDir = options['cssDir'] || defaultOptions['cssDir'];
  var imagesDir = options['imagesDir'] || defaultOptions['imagesDir'];
  var fontsDir = options['fontsDir'] || defaultOptions['fontsDir'];

  var mergedOptions = objectAssign({}, defaultOptions, {
    projectPath: path.resolve(projectPath),
    cssPath: path.resolve(projectPath, cssDir),
    httpCssPath: path.join(httpPath, cssDir),
    imagesPath: path.resolve(projectPath, imagesDir),
    httpImagesPath: path.join(httpPath, imagesDir),
    fontsPath: path.resolve(projectPath, fontsDir),
    httpFontsPath: path.join(httpPath, fontsDir)
  }, options);

  return {options: mergedOptions}
};


text:
package com.vxml.tag;

import org.w3c.dom.Node;

import com.vxml.core.browser.VxmlBrowser;

public class ElseIfTag extends AbstractTag {

	public ElseIfTag(Node node) {
		super(node);
	}

	@Override
	public void startTag() {
	    String cond = getAttribute("cond");
        Boolean elseIfCondition = (Boolean) VxmlBrowser.getContext().executeScript(cond);
        boolean isIfCondition = (Boolean) VxmlBrowser.getContext().executeScript("_vxmlExecutionContext.ifCondition");

        if(elseIfCondition && !isIfCondition) {
            setSkipExecute(false);
            //Just to skip else tag
            VxmlBrowser.getContext().executeScript("_vxmlExecutionContext.ifCondition=true");
        } else  if(!elseIfCondition && !isIfCondition){
            setSkipExecute(true);
        }
	}
	@Override
	public void execute() {

	}

}


text:
package cruise.umple.compiler;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;
import java.io.File;

import org.junit.*;
import cruise.umple.parser.ErrorTypeSingleton;
import cruise.umple.parser.ParseResult;

import cruise.umple.parser.analysis.RuleBasedParser;
import cruise.umple.util.SampleFileWriter;

public class FilterTest
{

  UmpleFile uFile;
  UmpleModel model;
  String pathToInput;
  String umpleParserName;
  UmpleParser parser;
  @Before
  public void setUp()
  {
    SampleFileWriter.createFile("model.ump", "class Student {}");
    uFile = new UmpleFile("model.ump");
    model = new UmpleModel(new UmpleFile("model.ump"));
    umpleParserName = "cruise.umple.compiler.UmpleInternalParser";
    pathToInput = SampleFileWriter.rationalize("test/cruise/umple/compiler");
  }

  @After
  public void tearDown()
  {
    SampleFileWriter.destroy("model.ump");
  }

  @Test
  public void byDefaultNoFilterPresent()
  {
    assertEquals(0, model.getFilters().size());
  }

  @Test
  public void getFilter_defaultsToNull()
  {
    assertEquals(null, model.getFilter("aaa"));
  }

  @Test
  public void getFilterTest()
  {
    model = parse("601_simpleFilter.ump");
    assertEquals(1, model.getFilters().size());
    assertNotNull(model.getFilter("roles"));
  }

  @Test
  public void isSettableInModel()
  {
    Filter f = new Filter("aaa");
    model.addFilter(f);
    model.getFilter("aaa").addValue("Student");
    model.getFilter("aaa").addValue("Mentor");
    assertEquals(f, model.getFilter("aaa"));
    assertEquals("aaa", model.getFilter("aaa").getName());
    assertEquals("Student",model.getFilter("aaa").getValue(0));
    assertEquals("Mentor",model.getFilter("aaa").getValue(1));
  }

  @Test
  public void hasAssociationTest()
  {
    Filter f = new Filter("aaa");
    assertEquals(false, f.hasAssociation());
    f.setAssociationCount(-2);
    assertEquals(false, f.hasAssociation());
    f.setAssociationCount(0);
    assertEquals(false, f.hasAssociation());
    f.setAssociationCount(1);
    assertEquals(true, f.hasAssociation());
  }

  @Test
  public void hasSuperTest()
  {
    Filter f = new Filter("aaa");
    assertEquals(false, f.hasSuper());
    f.setSuperCount(-1);
    assertEquals(false, f.hasSuper());
    f.setSuperCount(1);
    assertEquals(true, f.hasSuper());
  }

  @Test
  public void hasSubTest()
  {
    Filter f = new Filter("aaa");
    assertEquals(false, f.hasSub());
    f.setSubCount(0);
    assertEquals(false, f.hasSub());
    f.setSubCount(1);
    assertEquals(true, f.hasSub());
    f.setSubCount(-1);
    assertEquals(false, f.hasSub());
  }

  @Test
  public void hasNestedFilter()
  {
    Filter f = new Filter("aaa");
    assertEquals(false, f.hasNestedFilter());
    f.addFilterValue("bbb");
    assertEquals(true, f.hasNestedFilter());
  }

  @Test
  public void isIncluded()
  {
    Filter f = new Filter("aaa");

    f.addValue("Student");
    f.addValue("Mentor");

    Assert.assertEquals(true, f.isIncluded("Student"));
    Assert.assertEquals(false, f.isIncluded("Blah"));
    Assert.assertEquals(false, f.isIncluded((String)null));

    Assert.assertEquals(true, f.isIncluded(new UmpleClass("Student")));
    Assert.assertEquals(false, f.isIncluded(new UmpleClass("Blah")));
    Assert.assertEquals(false, f.isIncluded((UmpleClass)null));
  }

  @Test
  public void isEmpty_hasNothing()
  {
    Filter f = new Filter("bbb");
    Assert.assertEquals(true, f.isEmpty());
  }

  @Test
  public void isEmpty_handlesNull()
  {
    Filter f = new Filter("bbb");
    f.addValue(null);
    Assert.assertEquals(false, f.isEmpty());
  }

  @Test
  public void isEmpty_hasValues()
  {
    Filter f = new Filter("bbb");
    f.addValue("abc");
    Assert.assertEquals(false, f.isEmpty());
  }

  @Test
  public void applyFilter_OnlyKeepListedClasses()
  {
    model = parse("601_simpleFilter.ump");
    model.applyFilter("roles");
    Assert.assertEquals(2, model.numberOfUmpleClasses());
  }

  @Test
  public void applyFilter_Association()
  {
    model = parse("601_simpleFilter.ump");
    model.applyFilter("roles");
    Assert.assertEquals(1, model.numberOfAssociations());
  }

  @Test
  public void applyFilter_Empty()
  {
    model = parse("603_defaultFilter.ump");
    Assert.assertEquals(3, model.numberOfUmpleClasses());
    model.applyFilter(null);
    Assert.assertEquals(3, model.numberOfUmpleClasses());
  }

  @Test
  public void applyFilter_IncludeAll()
  {
    model = parse("603_defaultFilter.ump");
    Filter f = new Filter("includeAll");
    f.addValue("*");
    model.applyFilter("includeAll");
    Assert.assertEquals(3, model.numberOfUmpleClasses());
  }

  @Test
  public void applyFilter_NullCheck()
  {
    Filter f = new Filter("aaa");
    model.addUmpleClass("Mentor");
    model.addUmpleClass("Student");
    model.addFilter(f);
    model.getFilter("aaa").addValue(null);
    model.applyFilter("aaa");
    Assert.assertEquals(0, model.numberOfUmpleClasses());
  }

  @Test
  public void oneAssociationHop()
  {
    model = parse("602_associationFilter.ump");
    Filter f = new Filter("association_one");
    f.setAssociationCount(1);
    f.addValue("X");
    model.addFilter(f);
    model.applyFilter("association_one");
    Assert.assertEquals(2, model.numberOfUmpleClasses());
    ArrayList<String> names = new ArrayList<String>();
    names.add("X");
    names.add("Y");
    assertFiltered(names, model.getUmpleClasses());
  }

  @Test
  public void multipleAssociationHops()
  {
    model = parse("602_associationFilter.ump");
    Filter f = new Filter("association_multiple");
    f.setAssociationCount(2);
    f.addValue("X");
    model.addFilter(f);
    model.applyFilter("association_multiple");
    Assert.assertEquals(3, model.numberOfUmpleClasses());
    ArrayList<String> names = new ArrayList<String>();
    names.add("X");
    names.add("Y");
    names.add("Z");
    assertFiltered(names, model.getUmpleClasses());

    model = parse("602_associationFilter.ump");
    f.setAssociationCount(3);
    model.addFilter(f);
    model.applyFilter("association_multiple");
    Assert.assertEquals(4, model.numberOfUmpleClasses());
    names.add("P");
    assertFiltered(names, model.getUmpleClasses());

    model = parse("602_associationFilter.ump");
    f.setAssociationCount(4);
    model.addFilter(f);
    model.applyFilter("association_multiple");
    Assert.assertEquals(5, model.numberOfUmpleClasses());
    names.add("Q");
    assertFiltered(names, model.getUmpleClasses());
  }

  @Test
  public void applyFilter_includeAllSuperClass()
  {
    model = parse("604_inheritanceFilter.ump");
    Filter f = new Filter("inheritance");
    model.addFilter(f);
    model.getFilter("inheritance").addValue("Y");
    model.applyFilter("inheritance");
    ArrayList<String> names = new ArrayList<String>();
    names.add("Y");
    names.add("Z");
    names.add("P");
    names.add("Q");
    Assert.assertEquals(4, model.numberOfUmpleClasses());
    assertFiltered(names, model.getUmpleClasses());
  }

  @Test
  public void applyFilter_overWriteSuper()
  {
    model = parse("604_inheritanceFilter.ump");
    Filter f = new Filter("inheritance");
    f.setSuperCount(2);
    model.addFilter(f);
    model.getFilter("inheritance").addValue("Y");
    model.applyFilter("inheritance");
    ArrayList<String> names = new ArrayList<String>();
    names.add("Y");
    names.add("Z");
    names.add("P");
    Assert.assertEquals(3, model.numberOfUmpleClasses());
    assertFiltered(names, model.getUmpleClasses());

    model = parse("604_inheritanceFilter.ump");
    f.setSuperCount(0);
    model.addFilter(f);
    model.applyFilter("inheritance");
    names = new ArrayList<String>();
    names.add("Y");
    Assert.assertEquals(1, model.numberOfUmpleClasses());
    assertFiltered(names, model.getUmpleClasses());
  }

  @Test
  public void applyFilter_defaultSub()
  {
    model = parse("604_inheritanceFilter.ump");
    Filter f = new Filter("inheritance");
    model.addFilter(f);
    model.getFilter("inheritance").addValue("P");
    model.applyFilter("inheritance");
    ArrayList<String> names = new ArrayList<String>();
    names.add("P");
    names.add("Q");
    Assert.assertEquals(2, model.numberOfUmpleClasses());
    assertFiltered(names, model.getUmpleClasses());
  }

  @Test
  public void applyFilter_overWriteSub()
  {
    model = parse("604_inheritanceFilter.ump");
    Filter f = new Filter("inheritance");
    f.setSubCount(2);
    model.addFilter(f);
    model.getFilter("inheritance").addValue("P");
    model.applyFilter("inheritance");
    ArrayList<String> names = new ArrayList<String>();
    names.add("Y");
    names.add("Z");
    names.add("P");
    names.add("Q");
    Assert.assertEquals(4, model.numberOfUmpleClasses());
    assertFiltered(names, model.getUmpleClasses());
  }

  @Test
  public void applyFilter_NestedFilter()
  {
    model = parse("601_simpleFilter.ump");
    Filter nf = new Filter("nestedFilter");
    nf.addFilterValue("StudentFilter");
    nf.addFilterValue("MentorFilter");
    model.addFilter(nf);
    Filter sf = new Filter("StudentFilter");
    sf.addValue("Student");
    model.addFilter(sf);
    Filter mf = new Filter("MentorFilter");
    mf.addValue("Mentor");
    model.addFilter(mf);
    model.applyFilter("nestedFilter");
    ArrayList<String> names = new ArrayList<String>();
    names.add("Student");
    names.add("Mentor");
    Assert.assertEquals(2, model.numberOfUmpleClasses());
    assertFiltered(names, model.getUmpleClasses());
  }

  private void assertFiltered(ArrayList<String> names, List<UmpleClass> list)
  {
    ArrayList<String> className = new ArrayList<String>();
    for(UmpleClass c : list)
    {
      className.add(c.getName());
    }
    Assert.assertEquals(names, className);
  }

  public UmpleModel parse(String filename)
  {
    //String input = SampleFileWriter.readContent(new File(pathToInput, filename));
    File file = new File(pathToInput,filename);
    ErrorTypeSingleton.getInstance().reset();
    model = new UmpleModel(new UmpleFile(pathToInput,filename));
    model.setShouldGenerate(false);
    RuleBasedParser rbp = new RuleBasedParser();
    parser = new UmpleInternalParser(umpleParserName,model,rbp);
    ParseResult result = rbp.parse(file);
    model.setLastResult(result);
    boolean answer = result.getWasSuccess();
    if (answer)
    {
      parser.analyze(false).getWasSuccess();
    }
    else
    {
      Assert.fail("Unable to parse " + filename);
    }
    return model;
  }

}


text:
PYTHON=${PYTHON:-python}

usage()
{
    echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests]"
    echo "BuildArch can be: x64, x86, arm, arm64"
    echo "BuildType can be: Debug, Checked, Release"
    echo "clean - optional argument to force a clean build."
    echo "verbose - optional argument to enable verbose build output."
    echo "coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
    echo "ninja - target ninja instead of GNU make"
    echo "clangx.y - optional argument to build using clang version x.y."
    echo "cross - optional argument to signify cross compilation,"
    echo "      - will use ROOTFS_DIR environment variable if set."
    echo "configureonly - do not perform any builds; just configure the build."
    echo "skipconfigure - skip build configuration."
    echo "skipnative - do not build native components."
    echo "skipmscorlib - do not build mscorlib.dll even if mono is installed."
    echo "skiptests - skip the tests in the 'tests' subdirectory."

    exit 1
}

setup_dirs()
{
    echo Setting up directories for build

    mkdir -p "$__RootBinDir"
    mkdir -p "$__BinDir"
    mkdir -p "$__LogsDir"
    mkdir -p "$__IntermediatesDir"
}

# Performs "clean build" type actions (deleting and remaking directories)

clean()
{
    echo Cleaning previous output for the selected configuration
    rm -rf "$__BinDir"
    rm -rf "$__IntermediatesDir"

    rm -rf "$__TestWorkingDir"
    rm -rf "$__TestIntermediatesDir"

    rm -rf "$__LogsDir/*_$__BuildOS__$__BuildArch__$__BuildType.*"
}

# Check the system to ensure the right prereqs are in place

check_prereqs()
{
    echo "Checking prerequisites..."

    # Check presence of CMake on the path
    hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }

    # Check for clang
    hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null ||  hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null ||  hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; }

}

build_coreclr()
{

# Event Logging Infrastructure
   __GeneratedIntermediate="$__IntermediatesDir/Generated"
   __GeneratedIntermediateEventProvider="$__GeneratedIntermediate/eventprovider_new"
    if [[ -d "$__GeneratedIntermediateEventProvider" ]]; then
        rm -rf  "$__GeneratedIntermediateEventProvider"
    fi

    if [[ ! -d "$__GeneratedIntermediate/eventprovider" ]]; then
        mkdir -p "$__GeneratedIntermediate/eventprovider"
    fi

    mkdir -p "$__GeneratedIntermediateEventProvider"
    if [[ $__SkipCoreCLR == 0 || $__ConfigureOnly == 1 ]]; then
        echo "Laying out dynamically generated files consumed by the build system "
        echo "Laying out dynamically generated Event Logging Test files"
        $PYTHON -B -Wall -Werror "$__ProjectRoot/src/scripts/genXplatEventing.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --exc "$__ProjectRoot/src/vm/ClrEtwAllMeta.lst" --testdir "$__GeneratedIntermediateEventProvider/tests"

        if  [[ $? != 0 ]]; then
            exit
        fi

        #determine the logging system
        case $__BuildOS in
            Linux)
                echo "Laying out dynamically generated Event Logging Implementation of Lttng"
                $PYTHON -B -Wall -Werror "$__ProjectRoot/src/scripts/genXplatLttng.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__GeneratedIntermediateEventProvider"
                if  [[ $? != 0 ]]; then
                    exit
                fi
                ;;
            *)
                ;;
        esac
    fi

    echo "Cleaning the temp folder of dynamically generated Event Logging files"
    $PYTHON -B -Wall -Werror -c "import sys;sys.path.insert(0,\"$__ProjectRoot/src/scripts\"); from Utilities import *;UpdateDirectory(\"$__GeneratedIntermediate/eventprovider\",\"$__GeneratedIntermediateEventProvider\")"
    if  [[ $? != 0 ]]; then
        exit
    fi

    rm -rf "$__GeneratedIntermediateEventProvider"

    # All set to commence the build

    echo "Commencing build of native components for $__BuildOS.$__BuildArch.$__BuildType in $__IntermediatesDir"

    cd "$__IntermediatesDir"

    generator=""
    buildFile="Makefile"
    buildTool="make"
    if [ $__UseNinja == 1 ]; then
        generator="ninja"
        buildFile="build.ninja"
        buildTool="ninja"
    fi

    if [ $__SkipConfigure == 0 ]; then
        # Regenerate the CMake solution
        echo "Invoking \"$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh\" \"$__ProjectRoot\" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator"
        "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType $__CodeCoverage $__IncludeTests $generator
    fi

    if [ $__SkipCoreCLR == 1 ]; then
        echo "Skipping CoreCLR build."
        return
    fi

    # Check that the makefiles were created.

    if [ ! -f "$__IntermediatesDir/$buildFile" ]; then
        echo "Failed to generate native component build project!"
        exit 1
    fi

    # Get the number of processors available to the scheduler
    # Other techniques such as `nproc` only get the number of
    # processors available to a single process.
    if [ `uname` = "FreeBSD" ]; then
        NumProc=`sysctl hw.ncpu | awk '{ print $2+1 }'`
    elif [ `uname` = "NetBSD" ]; then
        NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
    else
        NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
    fi

    # Build CoreCLR

    echo "Executing $buildTool install -j $NumProc $__UnprocessedBuildArgs"

    $buildTool install -j $NumProc $__UnprocessedBuildArgs
    if [ $? != 0 ]; then
        echo "Failed to build coreclr components."
        exit 1
    fi
}

build_mscorlib()
{
    hash mono 2> /dev/null || { echo >&2 "Skipping mscorlib.dll build since Mono is not installed."; return; }

    if [ $__SkipMSCorLib == 1 ]; then
        echo "Skipping mscorlib.dll build."
        return
    fi

    # Temporary hack to make dnu restore more reliable. This is specifically for dnu beta 5 since this issue should already be addressed in later versions of dnu.
    export MONO_THREADS_PER_CPU=2000

    echo "Commencing build of mscorlib components for $__BuildOS.$__BuildArch.$__BuildType"

    # Pull NuGet.exe down if we don't have it already
    if [ ! -e "$__NuGetPath" ]; then
        hash curl 2>/dev/null || hash wget 2>/dev/null || { echo >&2 echo "cURL or wget is required to build mscorlib." ; exit 1; }

        echo "Restoring NuGet.exe..."

        # curl has HTTPS CA trust-issues less often than wget, so lets try that first.
        which curl > /dev/null 2> /dev/null
        if [ $? -ne 0 ]; then
           mkdir -p $__PackagesDir
           wget -q -O $__NuGetPath https://api.nuget.org/downloads/nuget.exe
        else
           curl -sSL --create-dirs -o $__NuGetPath https://api.nuget.org/downloads/nuget.exe
        fi

        if [ $? -ne 0 ]; then
            echo "Failed to restore NuGet.exe."
            exit 1
        fi
    fi

    # Grab the MSBuild package if we don't have it already
    if [ ! -e "$__MSBuildPath" ]; then
        echo "Restoring MSBuild..."
        mono "$__NuGetPath" install $__MSBuildPackageId -Version $__MSBuildPackageVersion -source "https://www.myget.org/F/dotnet-buildtools/" -OutputDirectory "$__PackagesDir"
        if [ $? -ne 0 ]; then
            echo "Failed to restore MSBuild."
            exit 1
        fi
    fi

    # Set _ToolNugetRuntimeId
    case $__BuildOS in
        Linux)
            _ToolNugetRuntimeId=ubuntu.14.04-x64
            ;;
        OSX)
            _ToolNugetRuntimeId=osx.10.10-x64
            ;;
        *)
            _ToolNugetRuntimeId=ubuntu.14.04-x64
            ;;
    esac

    # Invoke MSBuild
    mono "$__MSBuildPath" /nologo "$__ProjectRoot/build.proj" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/MSCorLib_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:UseRoslynCompiler=true /p:BuildNugetPackage=false /p:ToolNugetRuntimeId=$_ToolNugetRuntimeId

    if [ $? -ne 0 ]; then
        echo "Failed to build mscorlib."
        exit 1
    fi
}

echo "Commencing CoreCLR Repo build"

# Argument types supported by this script:
#
# Build architecture - valid values are: x64, ARM.
# Build Type         - valid values are: Debug, Checked, Release
#
# Set the default arguments for build

# Obtain the location of the bash script to figure out where the root of the repo is.
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Use uname to determine what the CPU is.
CPUName=$(uname -p)
case $CPUName in
    i686)
        echo "Unsupported CPU $CPUName detected, build might not succeed!"
        __BuildArch=x86
        ;;

    x86_64)
        __BuildArch=x64
        ;;

    armv7l)
        echo "Unsupported CPU $CPUName detected, build might not succeed!"
        __BuildArch=arm
        ;;

    aarch64)
        echo "Unsupported CPU $CPUName detected, build might not succeed!"
        __BuildArch=arm64
        ;;

    *)
        echo "Unknown CPU $CPUName detected, configuring as if for x64"
        __BuildArch=x64
        ;;
esac

# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
    Linux)
        __BuildOS=Linux
        ;;

    Darwin)
        __BuildOS=OSX
        ;;

    FreeBSD)
        __BuildOS=FreeBSD
        ;;

    OpenBSD)
        __BuildOS=OpenBSD
        ;;

    NetBSD)
        __BuildOS=NetBSD
        ;;

    SunOS)
        __BuildOS=SunOS
        ;;

    *)
        echo "Unsupported OS $OSName detected, configuring as if for Linux"
        __BuildOS=Linux
        ;;
esac

__BuildType=Debug
__CodeCoverage=
__IncludeTests=Include_Tests

# Set the various build properties here so that CMake and MSBuild can pick them up
__ProjectDir="$__ProjectRoot"
__SourceDir="$__ProjectDir/src"
__PackagesDir="$__ProjectDir/packages"
__RootBinDir="$__ProjectDir/bin"
__LogsDir="$__RootBinDir/Logs"
__UnprocessedBuildArgs=
__MSBCleanBuildArgs=
__UseNinja=0
__ConfigureOnly=0
__SkipConfigure=0
__SkipCoreCLR=0
__SkipMSCorLib=0
__CleanBuild=0
__VerboseBuild=0
__CrossBuild=0
__ClangMajorVersion=3
__ClangMinorVersion=5
__MSBuildPackageId="Microsoft.Build.Mono.Debug"
__MSBuildPackageVersion="14.1.0.0-prerelease"
__MSBuildPath="$__PackagesDir/$__MSBuildPackageId.$__MSBuildPackageVersion/lib/MSBuild.exe"
__NuGetPath="$__PackagesDir/NuGet.exe"

for i in "$@"
do
    lowerI="$(echo $i | awk '{print tolower($0)}')"
    case $lowerI in
        -\?|-h|--help)
            usage
            exit 1
            ;;

        x86)
            __BuildArch=x86
            ;;

        x64)
            __BuildArch=x64
            ;;

        arm)
            __BuildArch=arm
            ;;

        arm64)
            __BuildArch=arm64
            ;;

        debug)
            __BuildType=Debug
            ;;

        checked)
            __BuildType=Checked
            ;;

        release)
            __BuildType=Release
            ;;

        coverage)
            __CodeCoverage=Coverage
            ;;

        clean)
            __CleanBuild=1
            ;;

        verbose)
            __VerboseBuild=1
            ;;

        cross)
            __CrossBuild=1
            ;;

        clang3.5)
            __ClangMajorVersion=3
            __ClangMinorVersion=5
            ;;

        clang3.6)
            __ClangMajorVersion=3
            __ClangMinorVersion=6
            ;;

        clang3.7)
            __ClangMajorVersion=3
            __ClangMinorVersion=7
            ;;

        ninja)
            __UseNinja=1
            ;;

        configureonly)
            __ConfigureOnly=1
            __SkipCoreCLR=1
            __SkipMSCorLib=1
            __IncludeTests=
            ;;

        skipconfigure)
            __SkipConfigure=1
            ;;

        skipnative)
            # Use "skipnative" to use the same option name as build.cmd.
            __SkipCoreCLR=1
            ;;

        skipcoreclr)
            # Accept "skipcoreclr" for backwards-compatibility.
            __SkipCoreCLR=1
            ;;

        skipmscorlib)
            __SkipMSCorLib=1
            ;;

        includetests)
            ;;

        skiptests)
            __IncludeTests=
            ;;

        *)
            __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
            ;;
    esac
done

if [[ $__ConfigureOnly == 1 && $__SkipConfigure == 1 ]]; then
    echo "configureonly and skipconfigure are mutually exclusive!"
    exit 1
fi

# Set the remaining variables based upon the determined build configuration
__BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType"
__PackagesBinDir="$__BinDir/.nuget"
__ToolsDir="$__RootBinDir/tools"
__TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType"
export __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType"
__TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType"

# Specify path to be set for CMAKE_INSTALL_PREFIX.
# This is where all built CoreClr libraries will copied to.
export __CMakeBinDir="$__BinDir"

# Configure environment if we are doing a clean build.
if [ $__CleanBuild == 1 ]; then
    clean
fi

# Configure environment if we are doing a verbose build
if [ $__VerboseBuild == 1 ]; then
    export VERBOSE=1
fi

# Configure environment if we are doing a cross compile.
if [ $__CrossBuild == 1 ]; then
    export CROSSCOMPILE=1
    if ! [[ -n "$ROOTFS_DIR" ]]; then
        export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
    fi
fi

# Make the directories necessary for build if they don't exist

setup_dirs

# Check prereqs.

check_prereqs

# Build the coreclr (native) components.

build_coreclr

# Build mscorlib.

build_mscorlib

# Build complete

echo "Repo successfully built."
echo "Product binaries are available at $__BinDir"
exit 0


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

namespace Elders.Pandora.Box
{
    public interface IValueObject<T> : IEqualityComparer<T>, IEquatable<T>
    {

    }
    /// <summary>
    /// The class which implements ValueObject<T> have to be marked with sealed keyword.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public abstract class ValueObject<T> : IValueObject<T> where T : ValueObject<T>
    {
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            return Equals(obj as T);
        }

        public override int GetHashCode()
        {
            FieldInfo[] fields = GetAllFields(GetType()).ToArray();

            int startValue = 23;
            int multiplier = 77;

            int hashCode = startValue;

            foreach (FieldInfo field in fields)
            {
                object value = field.GetValue(this);

                if (value != null)
                    hashCode = hashCode * multiplier ^ value.GetHashCode();
            }
            return hashCode;
        }

        public static IEnumerable<FieldInfo> GetAllFields(Type t)
        {
            if (t == null)
                return Enumerable.Empty<FieldInfo>();

            BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly;
            return t.GetFields(flags).Concat(GetAllFields(t.BaseType));
        }

        public virtual bool Equals(T other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;

            var t = GetType();
            if (t != other.GetType())
                return false;

            FieldInfo[] fields = GetAllFields(t).ToArray();

            foreach (FieldInfo field in fields)
            {
                object value1 = field.GetValue(other);
                object value2 = field.GetValue(this);

                if (ReferenceEquals(null, value1))
                {
                    if (!ReferenceEquals(null, value2))
                        return false;
                }
                else if (!value1.Equals(value2))
                    return false;
            }
            return true;
        }

        public static bool operator ==(ValueObject<T> left, ValueObject<T> right)
        {
            if (ReferenceEquals(null, left) && ReferenceEquals(null, right)) return true;
            if (ReferenceEquals(null, left))
                return false;
            else
                return left.Equals(right);
        }

        public static bool operator !=(ValueObject<T> left, ValueObject<T> right)
        {
            return !(left == right);

        }

        public bool Equals(T left, T right)
        {
            if (ReferenceEquals(null, left) && ReferenceEquals(null, right)) return true;
            if (ReferenceEquals(null, left))
                return false;
            else
                return left.Equals(right);
        }

        public int GetHashCode(T obj)
        {
            return obj.GetHashCode();
        }
    }
}


text:
package ca.ualberta.CMPUT301W15T06;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import android.util.Log;

/**
 * This ClaimantEditClaimController is a controller class
 * of Claim. By calling this class, user(claimant) can edit
 * the detail information of a Claim.
 *
 * @author CMPUT301W15T06
 * @version 04/07/2015
 * @see java.text.DateFormat
 * @see java.text.ParseException
 * @see java.text.SimpleDateFormat
 * @see java.util.Date
 * @see java.util.Locale
 * @see android.util.Log
 */
public class ClaimantEditClaimController {

	/**
	 * Set a Claim object claim with a default value
	 * as null
	 */
	private Claim claim=null;

	/**
	 * General construction. This method will create a Claim object
	 * currentClaim for other classes and methods to use.
	 *
	 * @param currentClaim  which represented the currently claim that the user is working on
	 */
	public ClaimantEditClaimController(Claim currentClaim) {
		// TODO Auto-generated constructor stub
		claim=currentClaim;
	}

	/**
	 * This class will allows claimants edit the end date. It will
	 * also checks warnings to prevent crush.
	 *
	 * @param end  the end date of the travel (like "31-Mar-2015")
	 * @throws StatusException
	 * @throws WrongEndDateException
	 * @throws NetWorkException
	 * @see java.text.DateFormat
	 * @see java.text.ParseException
	 * @see java.text.SimpleDateFormat
	 * @see java.util.Date
	 */
	public void editEnd(String end) throws StatusException, WrongEndDateException, NetWorkException {

		Date endDate = null;

		try {
			endDate = AppSingleton.getDateFormat().parse(end);
		} catch (ParseException e) {
			endDate=null;
		}

		claim.setEndDate(endDate);

	}

	/**
	 * This class will allows claimants edit the begin date. It will
	 * also checks warnings to prevent crush.
	 *
	 * @param begin  the begin date of the travel (like "15-Mar-2015")
	 * @throws StatusException
	 * @throws WrongEndDateException
	 * @throws NetWorkException
	 */
	public void editBegin(String begin) throws StatusException, WrongEndDateException, NetWorkException {
		// TODO Auto-generated method stub
		Date beginDate = null;
		try {
			beginDate = AppSingleton.getDateFormat().parse(begin);
		} catch (ParseException e) {
			beginDate=null;
		}
		claim.setBeginDate(beginDate);
	}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>TapeCell</title>
<meta name="date" content="2015-09-11">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

turingMachine.fxgui

Class TapeCell<T>

java.lang.Object

<any>

turingMachine.fxgui.TapeCell<T>

 class TapeCell<T>
extends <any>

Constructor Summary

Constructors

Constructor and Description

TapeCell()

Method Summary

Methods

Modifier and Type
Method and Description

protected void
updateItem(T item,
          boolean empty)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

TapeCell

public TapeCell()

Method Detail

updateItem

protected void updateItem(T item,
              boolean empty)

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
module CommandHelpers
  def configuration_double(stubs = {})
    double("ThinkingSphinx::Configuration", {:settings => {}}.merge(stubs))
  end
end

RSpec.configure do |config|
  config.include CommandHelpers
end