text:
import { ipcRenderer } from 'electron'
import React from 'react'
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts'
const run = require('../../../control/common/run')

export class Element extends React.Component {
  constructor(props) {
		super(props)
	}

  click = () => {
    // run onclick script if exists
    if( this.props.element.parameter.onClick ) {
      let script = this.props.parent.scripts[this.props.element.parameter.onClick]
      ipcRenderer.send("script.run", {
        script_id: script.id,
        element: this.props.element,
        source: this.props.source})
    }

    // sends out a message that a button is clicked
    ipcRenderer.send("element.clicked", this.props.element)
  }

  defaultFilterFunc = (type, element, arg) => { return arg  }

  render() {

    try {
      // get preRenderFilter
      let filterFunc = this.defaultFilterFunc
      if ( this.props.element.parameter && this.props.element.parameter.preRenderFilter ) {
        let script = this.props.parent.scripts[this.props.element.parameter.preRenderFilter]
        // run script
        let context = { filterFunc: null }
        run.run(script.script, context)
        // update filter func
        if( context.filterFunc ) filterFunc = context.filterFunc
      }

      let line_components = []
      // loop for each line def
      let lines = []
      if( this.props.element.parameter.lines )
        lines = this.props.element.parameter.lines
      lines.forEach( (l, i) => {
        line_components.push(
          <Line
            key={i}
            isAnimationActive={false}
            dataKey={l.dataKey}
            stroke={l.stroke}
          />
        )
      })

      let lineCharts = (
        <LineChart
            margin={this.props.element.parameter.margin}
            width={parseInt(this.props.element.parameter.width)}
            height={parseInt(this.props.element.parameter.height)}
            data={this.props.source.data}>
         <XAxis dataKey={this.props.element.parameter.xAxisKey} />
         <YAxis dataKey={this.props.element.parameter.yAxisKey} />
         <CartesianGrid strokeDasharray="3 3"/>
         <Tooltip/>
         <Legend />
         {line_components}
       </LineChart>
     )

    return (

            {this.props.element.parameter.header}

          {lineCharts}

      )

    } catch(err) {
      return (

          {this.props.element.id} - {err.message} - {err.stack}

      )
    }
  }

}


text:
#ifndef TUDAT_JSONINTERFACE_VALUEACCESS_H
#define TUDAT_JSONINTERFACE_VALUEACCESS_H

#include <unordered_map>
#include <set>
#include <functional>

#include <boost/core/demangle.hpp>
#include <memory>
#include <boost/make_shared.hpp>

#include "Tudat/InputOutput/basicInputOutput.h"
#include "Tudat/Mathematics/BasicMathematics/mathematicalConstants.h"
#include "Tudat/JsonInterface/Support/errorHandling.h"
#include "Tudat/JsonInterface/Support/keys.h"
#include "Tudat/JsonInterface/Support/utilities.h"

namespace tudat
{

namespace json_interface
{

// KEY ACCESS

//! Access/mutate a key of a `json` object or array.
/*!
 * Access/mutate a key of a `json` object or array. \p jsonObject is passed by reference and the returned value is a
 * reference, so this method can be used to mutate a \p jsonObject (e.g. `valueAt( jsonObject, myKey, true ) = newValue`).
 * This only works if the third argument is `true`. If it isn't, and the key does not exist, an error will be thrown.
 * Supports json arrays. If the field "key" does not exist, this function will try to convert it to integer and
 * access \p jsonObject at that index.
 * \param jsonObject The `json` object.
 * \param key The key to access.
 * \param mutator Whether to use mutator or accessor methods.
 * \return A reference to the value of the accessed key (will be a nullptr `json` if the key did not exist).
 */
nlohmann::json& valueAt( nlohmann::json& jsonObject, const std::string& key, const bool mutator = false );

//! Access a key path of a `json` object or array.
/*!
 * Access a key path of a `json` object or array. \p jsonObject is constant, so the returned value cannot be modified.
 * Supports json arrays. If the any key in \p keyPath does not exist, this function will try to convert it to integer
 * and access \p jsonObject at that index.
 * \param jsonObject The constant `json` object.
 * \param keyPath The key path to access.
 * \return The value at the accessed key path.
 */
nlohmann::json valueAt( nlohmann::json jsonObject, const KeyPath& keyPath );

//! Whether the key at \p keyPath is defined for \p jsonObject.
/*!
 * @copybrief isDefined
 * \param jsonObject The `json` object.
 * \param keyPath The key path specifying to key to be checked.
 * \return @copybrief isDefined
 */
bool isDefined( const nlohmann::json& jsonObject, const KeyPath& keyPath );

// SPECIAL KEYS ACCESS

//! Get the \p jsonObject at key SpecialKeys::rootObject.
/*!
 * copybrief getRootObject
 * \param jsonObject The `json` object.
 * \return JSON representation of the root object of \p jsonObject.
 * \throws UndefinedKeyError If the key SpecialKeys::rootObject is not defined for \p jsonObject.
 */
nlohmann::json getRootObject( const nlohmann::json& jsonObject );

//! Get the absolute key path from which \p jsonObject was retrieved.
/*!
 * copybrief getKeyPath
 * \param jsonObject The `json` object.
 * \return Absolute key path from which \p jsonObject was retrieved.
 * \throws UndefinedKeyError If the key SpecialKeys::keyPath is not defined for \p jsonObject.
 */
KeyPath getKeyPath( const nlohmann::json& jsonObject );

//! Get the key at which \p jsonObject was obtained.
/*!
 * copybrief getParentKey
 * \param jsonObject The `json` object.
 * \param errorMessage Error message to be printed if \p jsonObject has no key SpecialKeys::keyPath.
 * \return Key at which \p jsonObject was obtained.
 * \throws UndefinedKeyError If the key SpecialKeys::keyPath is not defined for \p jsonObject.
 */
std::string getParentKey( const nlohmann::json& jsonObject,
                          const std::string& errorMessage = "Could not determine parent key: context is missing." );

//! Get the response type to an event for a `json` object.
/*!
 * @copybrief getResponseToEvent
 * \param jsonObject The `json` object in which the type of response to the event is defined, or a `json` object with
 * a root object containing this information.
 * \param eventName The name of the event.
 * \param defaultResponse Default response if the response to the event is not defined. By default, continueSilently.
 * \return Response type to the event.
 */
ExceptionResponseType getResponseToEvent( const nlohmann::json& jsonObject, const std::string& eventName,
                                               const ExceptionResponseType defaultResponse = continueSilently );

// ACCESS HISTORY

//! Global variable containing all the key paths that were accessed since clearAccessHistory() was called for the
//! last time (or since this variable was initialized).
extern std::set< KeyPath > accessedKeyPaths;

//! Clear the global variable accessedKeyPaths.
/*!
 * @copybrief clearAccessHistory
 */
inline void clearAccessHistory( )
{
    accessedKeyPaths.clear( );
}

//! Check for key paths that are defined in \p jsonObject but not contained by the global variable accessedKeyPaths.
/*!
 * @copybrief checkUnusedKeys
 * \param jsonObject The `json` object.
 * \param response Response type when finding unused keys in \p jsonObject.
 * \throws std::runtime_error If \p response is set to ExceptionResponseType::throwError and at least one unsued key
 * was found in \p jsonObject.
 */
void checkUnusedKeys( const nlohmann::json& jsonObject, const ExceptionResponseType response );

// JSON ARRAY

//! Convert \p j to object if \p j is an array containing objects.
/*!
 * @copybrief convertToObjectIfContainsObjects This method does nothing if \p j is not an array, if \p j is empty, or if
 * the elements (and subelements) of \p j are not of type object.
 * \param j `json` object to be converted, or the original \p j.
 */
void convertToObjectIfContainsObjects( nlohmann::json& j );

//! Convert \p jsonObject to a json array.
/*!
 * Convert \p jsonObject to a json array. Does nothing if \p jsonObject is already an array.
 * If \p jsonObject is an object whose (non-special) keys are all convertible to unsigned int, the equivalent `json`
 * array will be returned. Otherise, the original \p jsonObject is returned.
 * \param jsonObject The `json` object to be converted.
 * \return \p jsonObject as a json array, or the original \p jsonObject if it is not convertible to array.
 */
nlohmann::json getAsArray( const nlohmann::json& jsonObject );

//! Whether \p j is convertible to a json array.
/*!
 * Whether \p j is convertible to a json array. True if \p j is an array or an object whose (non-special) keys are all
 * convertible to unsigned int.
 * \param j The `json` object to be checked.
 * \return Whether \p j is convertible to a json array.
 */
bool isConvertibleToArray( const nlohmann::json& j );

// GET FROM JSON

//! Get the value of \p jsonObject at \p keyPath.
/*!
 * Get the value of \p jsonObject at \p keyPath.
 * \param jsonObject The `json` object.
 * \param keyPath Key path from which to retrieve the value.
 * \return Value at the requested key path.
 * \throws UndefinedKeyError If the requested key path is not defined.
 * \throws UndefinedKeyError If some of the subkeys needed to create the shared pointer of `ValueType` are missing
 * (only when \p jsonObject at \p keyPath is of type object).
 * \throws IllegalValueError<ValueType> If the obtained value for the requested key path is not convertible to
 * `ValueType`.
 * \throws IllegalValueError<SubvalueType> If some of the subkeys needed to create the shared pointer of `ValueType`
 * are not convertible to `SubvalueType` (only when \p jsonObject at \p keyPath is of type object).
 */
template< typename ValueType >
ValueType getValue( const nlohmann::json& jsonObject, const KeyPath& keyPath )
{
    nlohmann::json rootObject;
    nlohmann::json currentObject = jsonObject;
    KeyPath currentKeyPath = keyPath;
    KeyPath canonicalKeyPath = keyPath;

    if ( ! contains( currentKeyPath, SpecialKeys::keyPath ) )
    {
        canonicalKeyPath = currentKeyPath.canonical( getKeyPath( currentObject ) );

        if ( ! contains( currentKeyPath, SpecialKeys::rootObject ) )
        {
            if ( isDefined( currentObject, SpecialKeys::rootObject ) )
            {
                rootObject = getValue< nlohmann::json >( currentObject, SpecialKeys::rootObject );
            }

            if ( currentKeyPath.size( ) > 0 )
            {
                if ( currentKeyPath.front( ) == SpecialKeys::root || contains( currentKeyPath, SpecialKeys::up ) )
                {
                    // Path is absolute or contains up-key

                    // Use absolute key path
                    currentKeyPath = canonicalKeyPath;

                    // Use jsonObject's root object instead
                    if ( rootObject.is_null( ) )
                    {
                        throw UndefinedKeyError( canonicalKeyPath );
                    }
                    currentObject = rootObject;
                }
            }
        }
    }

    if ( currentKeyPath.isAbsolute( ) )
    {
        // Remove "~"
        currentKeyPath.erase( currentKeyPath.begin( ) );
    }

    accessedKeyPaths.insert( canonicalKeyPath );

    try
    {
        currentObject = valueAt( currentObject, currentKeyPath );
    }
    catch ( ... )
    {
        // At least one of the keys was missing
        throw UndefinedKeyError( canonicalKeyPath );
    }

    if ( ! containsAnyOf( currentKeyPath, SpecialKeys::all ) )
    {
        // If jsonObject is an array containing objects, convert to object
        convertToObjectIfContainsObjects( currentObject );

        if ( currentObject.is_object( ) )
        {
            // Define keys rootObject and keyPath of jsonObject to be returned
            currentObject[ SpecialKeys::rootObject ] = rootObject.is_null( ) ? jsonObject : rootObject;
            currentObject[ SpecialKeys::keyPath ] = canonicalKeyPath;
        }
    }

    try
    {
        // Try to convert to the requested type
        const ValueType convertedObject = currentObject;
        return convertedObject;
    }
    catch ( const nlohmann::detail::type_error& )
    {
        // Could not convert to the requested type
        throw IllegalValueError( canonicalKeyPath, currentObject, typeid( ValueType ) );
    }
    catch ( const UnknownEnumError& )
    {
        std::cout<<"Test A"<<std::endl;
        // Could not convert string to enum
        throw IllegalValueError( canonicalKeyPath, currentObject, typeid( ValueType ) );
    }
    catch ( const UndefinedKeyError& error )
    {
        // Some of the keys needed during creation of object of type ValueType were missing
        throw error;
    }
    catch ( const IllegalValueError& error )
    {
        // Some of the values for the keys needed during creation of object of type ValueType were illegal
        throw error;
    }
}

//! Convert \p jsonObject to `ValueType`.
/*!
 * Convert \p jsonObject to `ValueType`.
 * \param jsonObject The `json` object.
 * \return \p jsonObject as `ValueType`.
 * \throws IllegalValueError<ValueType> If \p jsonObject is not convertible to `ValueType`.
 * \throws IllegalValueError<SubvalueType> If some of the subkeys needed to create the shared pointer of `ValueType`
 * are not convertible to `SubvalueType` (only when \p jsonObject at \p keyPath is of type object).
 */
template< typename ValueType >
ValueType getAs( const nlohmann::json& jsonObject )
{
    return getValue< ValueType >( jsonObject, { } );
}

//! Get the value of \p jsonObject at \p keyPath, or return \p optionalValue if not defined.
/*!
 * Get the value of \p jsonObject at \p keyPath, or return \p optionalValue if not defined.
 * \param jsonObject The `json` object.
 * \param keyPath Key path from which to retrieve the value.
 * \param defaultValue The default value to be returned if the key is not defined.
 * \return Value at the requested key path, or \p optionalValue if not defined.
 * \throws UndefinedKeyError If some of the subkeys needed to create the shared pointer of `ValueType` are missing
 * (only when \p jsonObject at \p keyPath is of type object).
 * \throws IllegalValueError<ValueType> If the obtained value for the requested key path is not convertible to
 * `ValueType`.
 * \throws IllegalValueError<SubvalueType> If some of the subkeys needed to create the shared pointer of `ValueType`
 * are not convertible to `SubvalueType` (only when \p jsonObject at \p keyPath is of type object).
 */
template< typename ValueType >
ValueType getValue( const nlohmann::json& jsonObject, const KeyPath& keyPath, const ValueType& defaultValue )
{
    try
    {
        return getValue< ValueType >( jsonObject, keyPath );
    }
    catch ( const UndefinedKeyError& error )
    {
        error.rethrowIfNotTriggeredByMissingValueAt( keyPath );
        error.handleUseOfDefaultValue( nlohmann::json( defaultValue ),
                                       getResponseToEvent( jsonObject, Keys::Options::defaultValueUsedForMissingKey ) );
        return defaultValue;
    }
}

//! Get the value of \p jsonObject at the first defined key path in \p keyPaths.
/*!
 * Get the value of \p jsonObject at the first defined key path in \p keyPaths.
 * \param jsonObject The `json` object.
 * \param keyPaths Vector of key paths from which the value can be retrieved.
 * \return Value at the first defined key path in \p keyPaths.
 * \throws UndefinedKeyError If all the key paths in \p keyPaths are not defined for \p jsonObject. The printed message
 * will indicate the key path corresponding to the last of \p keyPaths.
 * \throws UndefinedKeyError If some of the subkeys needed to create the shared pointer of `ValueType` are missing
 * (only when \p jsonObject at \p keyPaths is of type object).
 * \throws IllegalValueError<ValueType> If the obtained value for the requested key path is not convertible to
 * `ValueType`.
 * \throws IllegalValueError<SubvalueType> If some of the subkeys needed to create the shared pointer of `ValueType`
 * are not convertible to `SubvalueType` (only when \p jsonObject at \p keyPaths is of type object).
 */
template< typename ValueType >
ValueType getValue( const nlohmann::json& jsonObject, const std::vector< KeyPath >& keyPaths )
{
    for ( unsigned int i = 0; i < keyPaths.size( ); ++i )
    {
        try
        {
            return getValue< nlohmann::json >( jsonObject, keyPaths.at( i ) );
        }
        catch ( const UndefinedKeyError& error )
        {
            error.rethrowIfNotTriggeredByMissingValueAt( keyPaths.at( i ) );
            if ( i == keyPaths.size( ) - 1 )
            {
                throw error;
            }
        }
    }
    throw;  // silence warning may reach end of non-void function
}

// UPDATE FROM JSON

//! Set \p value to be the value of \p jsonObject at \p keyPath.
/*!
 * Set \p value to be the value of \p jsonObject at \p keyPath.
 * \param value The value to be updated (i.e. re-initialized).
 * \param jsonObject The `json` object.
 * \param keyPath Key path from which to retrieve the value.
 * \throws UndefinedKeyError If the requested key path is not defined.
 * \throws UndefinedKeyError If some of the subkeys needed to create the shared pointer of `ValueType` are missing
 * (only when \p jsonObject at \p keyPath is of type object).
 * \throws IllegalValueError<ValueType> If the obtained value for the requested key path is not convertible to
 * `ValueType`.
 * \throws IllegalValueError<SubvalueType> If some of the subkeys needed to create the shared pointer of `ValueType`
 * are not convertible to `SubvalueType` (only when \p jsonObject at \p keyPath is of type object).
 */
template< typename T >
void updateFromJSON( T& value, const nlohmann::json& jsonObject, const KeyPath& keyPath = { } )
{
    value = getValue< T >( jsonObject, keyPath );
}

//! Set \p value to be the value of \p jsonObject at \p keyPath if defined.
/*!
 * Set \p value to be the value of \p jsonObject at \p keyPath if defined.
 * \remark This function does nothing if \p jsonObject is not defined at \p keyPath.
 * \param value The value to be updated (i.e. re-initialized).
 * \param jsonObject The `json` object.
 * \param keyPath Key path from which to retrieve the value.
 * \throws UndefinedKeyError If some of the subkeys needed to create the shared pointer of `ValueType` are missing
 * (only when \p jsonObject at \p keyPath is of type object).
 * \throws IllegalValueError<ValueType> If the obtained value for the requested key path is not convertible to
 * `ValueType`.
 * \throws IllegalValueError<SubvalueType> If some of the subkeys needed to create the shared pointer of `ValueType`
 * are not convertible to `SubvalueType` (only when \p jsonObject at \p keyPath is of type object).
 */
template< typename T >
void updateFromJSONIfDefined( T& value, const nlohmann::json& jsonObject, const KeyPath& keyPath = { } )
{
    try
    {
        updateFromJSON( value, jsonObject, keyPath );
    }
    catch ( const UndefinedKeyError& error )
    {
        error.rethrowIfNotTriggeredByMissingValueAt( keyPath );
    }
}

// UPDATE JSON

//! Assign \p value to `jsonObject[ key ]` if \p value is not NaN.
/*!
 * @copybrief assignIfNotNaN
 * \remark This function does nothing if \p value is NaN.
 * \remark The comparison operator must be defined for `EquatableType`.
 * \param jsonObject The `json` object being updated.
 * \param key The key of \p jsonObject being updated.
 * \param value The value to be used for updating `jsonObject[ key ]`.
 */
template< typename EquatableType >
void assignIfNotNaN( nlohmann::json& jsonObject, const std::string& key, const EquatableType& value )
{
    if ( ! isNaN( value ) )
    {
        jsonObject[ key ] = value;
    }
}

//! Assign \p object to `jsonObject[ key ]` if \p object is not nullptr.
/*!
 * @copybrief assignIfNotnullptr
 * \remark This function does nothing if \p object is `nullptr`.
 * \param jsonObject The `json` object being updated.
 * \param key The key of \p jsonObject being updated.
 * \param object Shared pointer to the object that is being to be used to update `jsonObject[ key ]`.
 */
template< typename T >
void assignIfNotnullptr( nlohmann::json& jsonObject, const std::string& key, const std::shared_ptr< T >& object )
{
    if ( object )
    {
        jsonObject[ key ] = object;
    }
}

//! Assign \p object to `jsonObject[ key ]` if \p container is not empty.
/*!
 * @copybrief assignIfNotEmpty
 * \remark This function does nothing if \p container is empty.
 * \remark The method `empty()` must be defined for `ContainerType`.
 * \param jsonObject The `json` object being updated.
 * \param key The key of \p jsonObject being updated.
 * \param container Container (e.g. `std::vector`, `std::set`, `std::map` or `std::unordered_map`) that is being to be
 * used to update `jsonObject[ key ]`.
 */
template< typename ContainerType >
void assignIfNotEmpty( nlohmann::json& jsonObject, const std::string& key, const ContainerType& container )
{
    if ( ! container.empty( ) )
    {
        jsonObject[ key ] = container;
    }
}

// Typedefs for single-body and body-to-body maps.

template < typename T >
using SingleBodyMap = std::unordered_map< std::string, std::vector< std::shared_ptr< T > > >;

template< typename T >
using BodyToBodyMap = std::unordered_map< std::string, SingleBodyMap< T > >;

template< typename T >
using NoPointerSingleBodyMap = std::unordered_map< std::string, std::vector< T > >;

template< typename T >
using NoPointerBodyToBodyMap = std::unordered_map< std::string, NoPointerSingleBodyMap< T > >;

} // namespace json_interface

} // namespace tudat

#endif // TUDAT_JSONINTERFACE_VALUEACCESS_H

redpajama_set_name: RedPajamaGithub


text:
struct TRI_vocbase_t;

namespace arangodb {

class LogicalCollection;
struct ResourceMonitor;

namespace transaction {
class Methods;
}

namespace traverser {
class EdgeCollectionInfo;
}

namespace pregel {

template<typename T>
struct TypedBuffer;
class WorkerConfig;
template<typename V, typename E>
struct GraphFormat;

class PregelFeature;

////////////////////////////////////////////////////////////////////////////////
/// @brief carry graph data for a worker job. NOT THREAD SAFE ON DOCUMENT LOADS
////////////////////////////////////////////////////////////////////////////////
template<typename V, typename E>
class GraphStore final {
 public:
  GraphStore(PregelFeature& feature, TRI_vocbase_t& vocbase,
             uint64_t executionNumber, GraphFormat<V, E>* graphFormat);

  uint64_t numberVertexSegments() const { return _vertices.size(); }
  uint64_t localVertexCount() const { return _localVertexCount; }
  uint64_t localEdgeCount() const { return _localEdgeCount; }
  auto allocatedSize() -> size_t {
    auto total = size_t{0};

    for (auto&& vb : _vertices) {
      total += vb->capacity();
    }
    for (auto&& vb : _vertexKeys) {
      total += vb->capacity();
    }
    for (auto&& vb : _edges) {
      total += vb->capacity();
    }
    for (auto&& vb : _edgeKeys) {
      total += vb->capacity();
    }
    return total;
  }

  GraphStoreStatus status() const { return _observables.observe(); }

  GraphFormat<V, E> const* graphFormat() { return _graphFormat.get(); }

  // ====================== NOT THREAD SAFE ===========================
  void loadShards(WorkerConfig* config,
                  std::function<void()> const& statusUpdateCallback,
                  std::function<void()> const& finishedLoadingCallback);
  void loadDocument(WorkerConfig* config, std::string const& documentID);
  void loadDocument(WorkerConfig* config, PregelShard sourceShard,
                    std::string_view key);
  // ======================================================================

  // only thread safe if your threads coordinate access to memory locations
  RangeIterator<Vertex<V, E>> vertexIterator();
  /// j and j are the first and last index of vertex segments
  RangeIterator<Vertex<V, E>> vertexIterator(size_t i, size_t j);
  RangeIterator<Edge<E>> edgeIterator(Vertex<V, E> const* entry);

  /// Write results to database
  void storeResults(WorkerConfig* config, std::function<void()>,
                    std::function<void()> const& statusUpdateCallback);

  ReportManager* _reports;

 private:
  void loadVertices(ShardID const& vertexShard,
                    std::vector<ShardID> const& edgeShards,
                    std::function<void()> const& statusUpdateCallback);
  void loadEdges(transaction::Methods& trx, Vertex<V, E>& vertex,
                 ShardID const& edgeShard, std::string const& documentID,
                 std::vector<std::unique_ptr<TypedBuffer<Edge<E>>>>& edges,
                 std::vector<std::unique_ptr<TypedBuffer<char>>>& edgeKeys,
                 uint64_t numVertices, traverser::EdgeCollectionInfo& info);

  void storeVertices(std::vector<ShardID> const& globalShards,
                     RangeIterator<Vertex<V, E>>& it, size_t threadNumber,
                     std::function<void()> const& statusUpdateCallback);
  uint64_t determineVertexIdRangeStart(uint64_t numVertices);

  constexpr size_t vertexSegmentSize() const {
    return 64 * 1024 * 1024 / sizeof(Vertex<V, E>);
  }

  constexpr size_t edgeSegmentSize() const {
    return 64 * 1024 * 1024 / sizeof(Edge<E>);
  }

 private:
  PregelFeature& _feature;
  DatabaseGuard _vocbaseGuard;
  ResourceMonitor _resourceMonitor;
  uint64_t const _executionNumber;
  const std::unique_ptr<GraphFormat<V, E>> _graphFormat;
  WorkerConfig* _config = nullptr;

  std::atomic<uint64_t> _vertexIdRangeStart;

  /// Holds vertex keys, data and pointers to edges
  std::mutex _bufferMutex;
  std::vector<std::unique_ptr<TypedBuffer<Vertex<V, E>>>> _vertices;
  std::vector<std::unique_ptr<TypedBuffer<char>>> _vertexKeys;
  std::vector<std::unique_ptr<TypedBuffer<Edge<E>>>> _edges;
  std::vector<TypedBuffer<Edge<E>>*> _nextEdgeBuffer;
  std::vector<std::unique_ptr<TypedBuffer<char>>> _edgeKeys;

  GraphStoreObservables _observables;

  // cache the amount of vertices
  std::set<ShardID> _loadedShards;

  // actual count of loaded vertices / edges
  std::atomic<size_t> _localVertexCount;
  std::atomic<size_t> _localEdgeCount;
  std::atomic<uint32_t> _runningThreads;
};

}  // namespace pregel
}  // namespace arangodb


text:
#include "h_m_landmarks.h"
#include "../plugin.h"

static LandmarkGraphPlugin h_m_landmarks_graph_plugin(
    "lm_hm", HMLandmarks::create);

std::ostream & operator<<(std::ostream &os, const Fluent &p) {
    return os << "(" << p.first << ", " << p.second << ")";
}

std::ostream & operator<<(std::ostream &os, const FluentSet &fs) {
    FluentSet::const_iterator it;
    os << "[";
    for (it = fs.begin(); it != fs.end(); ++it) {
        os << *it << " ";
    }
    os << "]";
    return os;
}

template<typename T>
std::ostream & operator<<(std::ostream &os, const std::list<T> &alist) {
    typename std::list<T>::const_iterator it;

    os << "(";
    for (it = alist.begin(); it != alist.end(); ++it) {
        os << *it << " ";
    }
    os << ")";
    return os;
}

// alist = alist \cup other
template<typename T>
void union_with(std::list<T> &alist, const std::list<T> &other) {
    typename std::list<T>::iterator it1 = alist.begin();
    typename std::list<T>::const_iterator it2 = other.begin();

    while ((it1 != alist.end()) && (it2 != other.end())) {
        if (*it1 < *it2) {
            ++it1;
        } else if (*it1 > *it2) {
            alist.insert(it1, *it2);
            ++it2;
        } else {
            ++it1;
            ++it2;
        }
    }
    alist.insert(it1, it2, other.end());
}

// alist = alist \cap other
template<typename T>
void intersect_with(std::list<T> &alist, const std::list<T> &other) {
    typename std::list<T>::iterator it1 = alist.begin(), tmp;
    typename std::list<T>::const_iterator it2 = other.begin();

    while ((it1 != alist.end()) && (it2 != other.end())) {
        if (*it1 < *it2) {
            tmp = it1;
            ++tmp;
            alist.erase(it1);
            it1 = tmp;
        } else if (*it1 > *it2) {
            ++it2;
        } else {
            ++it1;
            ++it2;
        }
    }
    alist.erase(it1, alist.end());
}

// alist = alist \setminus other
template<typename T>
void set_minus(std::list<T> &alist, const std::list<T> &other) {
    typename std::list<T>::iterator it1 = alist.begin(), tmp;
    typename std::list<T>::const_iterator it2 = other.begin();

    while ((it1 != alist.end()) && (it2 != other.end())) {
        if (*it1 < *it2) {
            ++it1;
        } else if (*it1 > *it2) {
            ++it2;
        } else {
            tmp = it1;
            ++tmp;
            alist.erase(it1);
            it1 = tmp;
            ++it2;
        }
    }
}

// alist = alist \cup {val}
template<typename T>
void insert_into(std::list<T> &alist, const T &val) {
    typename std::list<T>::iterator it1 = alist.begin();

    while (it1 != alist.end()) {
        if (*it1 > val) {
            alist.insert(it1, val);
            return;
        } else if (*it1 < val) {
            ++it1;
        } else {
            return;
        }
    }
    alist.insert(it1, val);
}

template<typename T>
bool contains(std::list<T> &alist, const T &val) {
    typename std::list<T>::iterator it1 = alist.begin();

    for (; it1 != alist.end(); it1++) {
        if (*it1 == val) {
            return true;
        }
    }
    return false;
}

// find partial variable assignments with size m or less
// (look at all the variables in the problem)
void HMLandmarks::get_m_sets_(int m, int num_included, int current_var,
                              FluentSet &current,
                              std::vector<FluentSet > &subsets) {
    if (num_included == m) {
        subsets.push_back(current);
        return;
    }
    if (current_var == g_variable_domain.size()) {
        if (num_included != 0) {
            subsets.push_back(current);
        }
        return;
    }
    // include a value of current_var in the set
    for (int i = 0; i < g_variable_domain[current_var]; i++) {
        bool use_var = true;
        for (int j = 0; j < current.size(); j++) {
            if (!interesting(current_var, i, current[j].first, current[j].second)) {
                use_var = false;
                break;
            }
        }

        if (use_var) {
            current.push_back(std::make_pair(current_var, i));
            get_m_sets_(m, num_included + 1, current_var + 1, current, subsets);
            current.pop_back();
        }
    }
    // don't include a value of current_var in the set
    get_m_sets_(m, num_included, current_var + 1, current, subsets);
}

// find all size m or less subsets of superset
void HMLandmarks::get_m_sets_of_set_(int m, int num_included, int current_var_index,
                                     FluentSet &current,
                                     std::vector<FluentSet > &subsets,
                                     const FluentSet &superset) {
    if (num_included == m) {
        subsets.push_back(current);
        return;
    }

    if (current_var_index == superset.size()) {
        if (num_included != 0) {
            subsets.push_back(current);
        }
        return;
    }

    bool use_var = true;
    for (int i = 0; i < current.size(); i++) {
        if (!interesting(superset[current_var_index].first, superset[current_var_index].second,
                         current[i].first, current[i].second)) {
            use_var = false;
            break;
        }
    }

    if (use_var) {
        // include current fluent in the set
        current.push_back(superset[current_var_index]);
        get_m_sets_of_set_(m, num_included + 1, current_var_index + 1, current, subsets, superset);
        current.pop_back();
    }

    // don't include current fluent in set
    get_m_sets_of_set_(m, num_included, current_var_index + 1, current, subsets, superset);
}

// get subsets of superset1 \cup superset2 with size m or less,
// such that they have >= 1 elements from each set.
void HMLandmarks::get_split_m_sets_(
    int m, int ss1_num_included, int ss2_num_included,
    int ss1_var_index, int ss2_var_index,
    FluentSet &current, std::vector<FluentSet> &subsets,
    const FluentSet &superset1, const FluentSet &superset2) {
    /*
       if( ((ss1_var_index == superset1.size()) && (ss1_num_included == 0)) ||
        ((ss2_var_index == superset2.size()) && (ss2_num_included == 0)) ) {
       return;
       }
     */

    if (((ss1_num_included + ss2_num_included) == m) ||
        ((ss1_var_index == superset1.size()) && (ss2_var_index == superset2.size()))) {
        // if set is empty, don't have to include from it
        if (((ss1_num_included > 0) || (superset1.size() == 0)) &&
            ((ss2_num_included > 0) || (superset2.size() == 0))) {
            subsets.push_back(current);
        }
        return;
    }

    bool use_var = true;

    if ((ss1_var_index != superset1.size()) &&
        ((ss2_var_index == superset2.size()) ||
         (superset1[ss1_var_index] < superset2[ss2_var_index]))) {
        for (int i = 0; i < current.size(); i++) {
            if (!interesting(superset1[ss1_var_index].first, superset1[ss1_var_index].second,
                             current[i].first, current[i].second)) {
                use_var = false;
                break;
            }
        }

        if (use_var) {
            // include
            current.push_back(superset1[ss1_var_index]);
            get_split_m_sets_(m, ss1_num_included + 1, ss2_num_included,
                              ss1_var_index + 1, ss2_var_index,
                              current, subsets, superset1, superset2);
            current.pop_back();
        }

        // don't include
        get_split_m_sets_(m, ss1_num_included, ss2_num_included,
                          ss1_var_index + 1, ss2_var_index,
                          current, subsets, superset1, superset2);
    } else {
        for (int i = 0; i < current.size(); i++) {
            if (!interesting(superset2[ss2_var_index].first, superset2[ss2_var_index].second,
                             current[i].first, current[i].second)) {
                use_var = false;
                break;
            }
        }

        if (use_var) {
            // include
            current.push_back(superset2[ss2_var_index]);
            get_split_m_sets_(m, ss1_num_included, ss2_num_included + 1,
                              ss1_var_index, ss2_var_index + 1,
                              current, subsets, superset1, superset2);
            current.pop_back();
        }

        // don't include
        get_split_m_sets_(m, ss1_num_included, ss2_num_included,
                          ss1_var_index, ss2_var_index + 1,
                          current, subsets, superset1, superset2);
    }
}

// use together is method that determines whether the two variables are interesting together,
// e.g. we don't want to represent (truck1-loc x, truck2-loc y) type stuff

// get partial assignments of size <= m in the problem
void HMLandmarks::get_m_sets(int m, std::vector<FluentSet> &subsets) {
    FluentSet c;
    get_m_sets_(m, 0, 0, c, subsets);
}

// get subsets of superset with size <= m
void HMLandmarks::get_m_sets(int m, std::vector<FluentSet> &subsets, const FluentSet &superset) {
    FluentSet c;
    get_m_sets_of_set_(m, 0, 0, c, subsets, superset);
}

// second function to get subsets of size at most m that
// have at least one element in ss1 and same in ss2
// assume disjoint
void HMLandmarks::get_split_m_sets(
    int m, std::vector<FluentSet> &subsets,
    const FluentSet &superset1, const FluentSet &superset2) {
    FluentSet c;
    get_split_m_sets_(m, 0, 0, 0, 0, c, subsets, superset1, superset2);
}

// get subsets of state with size <= m
void HMLandmarks::get_m_sets(int m,
                             std::vector<FluentSet> &subsets,
                             const State &s) {
    FluentSet state_fluents;
    for (int i = 0; i < g_variable_domain.size(); i++) {
        state_fluents.push_back(std::make_pair(i, s[i]));
    }
    get_m_sets(m, subsets, state_fluents);
}

void get_operator_precondition(int op_index, FluentSet &pc) {
    Operator &op = g_operators[op_index];

    const std::vector<Prevail> &prevail = op.get_prevail();
    const std::vector<PrePost> &pre_post = op.get_pre_post();

    for (int i = 0; i < prevail.size(); i++) {
        pc.push_back(make_pair(prevail[i].var, prevail[i].prev));
    }

    for (int i = 0; i < pre_post.size(); i++) {
        if (pre_post[i].pre != -1) {
            pc.push_back(make_pair(pre_post[i].var, pre_post[i].pre));
        }
    }

    std::sort(pc.begin(), pc.end());
}

void get_operator_effect(int op_index, FluentSet &eff) {
    Operator &op = g_operators[op_index];

    const std::vector<PrePost> &pre_post = op.get_pre_post();
    const std::vector<Prevail> &prevail = op.get_prevail();

    for (int i = 0; i < prevail.size(); i++) {
        eff.push_back(make_pair(prevail[i].var, prevail[i].prev));
    }

    for (int i = 0; i < pre_post.size(); i++) {
        eff.push_back(make_pair(pre_post[i].var, pre_post[i].post));
    }

    std::sort(eff.begin(), eff.end());
}

void HMLandmarks::print_pm_op(const PMOp &op) {
    std::set<Fluent> pcs, effs, cond_pc, cond_eff;
    std::vector<std::pair<std::set<Fluent>, std::set<Fluent> > > conds;
    std::set<Fluent>::iterator it;

    std::vector<int>::const_iterator v_it;

    for (v_it = op.pc.begin(); v_it != op.pc.end(); v_it++) {
        for (int j = 0; j < h_m_table_[*v_it].fluents.size(); j++) {
            pcs.insert(h_m_table_[*v_it].fluents[j]);
        }
    }
    for (v_it = op.eff.begin(); v_it != op.eff.end(); v_it++) {
        for (int j = 0; j < h_m_table_[*v_it].fluents.size(); j++) {
            effs.insert(h_m_table_[*v_it].fluents[j]);
        }
    }
    for (int i = 0; i < op.cond_noops.size(); i++) {
        cond_pc.clear();
        cond_eff.clear();
        int pm_fluent, j;
        std::cout << "PC:" << std::endl;
        for (j = 0; (pm_fluent = op.cond_noops[i][j]) != -1; j++) {
            print_fluentset(h_m_table_[pm_fluent].fluents);
            std::cout << std::endl;

            for (int k = 0; k < h_m_table_[pm_fluent].fluents.size(); k++) {
                cond_pc.insert(h_m_table_[pm_fluent].fluents[k]);
            }
        }
        // advance to effects section
        std::cout << std::endl;
        j++;

        std::cout << "EFF:" << std::endl;
        for (; j < op.cond_noops[i].size(); j++) {
            int pm_fluent = op.cond_noops[i][j];

            print_fluentset(h_m_table_[pm_fluent].fluents);
            std::cout << std::endl;

            for (int k = 0; k < h_m_table_[pm_fluent].fluents.size(); k++) {
                cond_eff.insert(h_m_table_[pm_fluent].fluents[k]);
            }
        }
        conds.push_back(std::make_pair(cond_pc, cond_eff));
        std::cout << std::endl << std::endl << std::endl;
    }

    std::cout << "Action " << op.index << std::endl;
    std::cout << "Precondition: ";
    for (it = pcs.begin(); it != pcs.end(); it++) {
        print_proposition(*it);
        std::cout << " ";
    }

    std::cout << std::endl << "Effect: ";
    for (it = effs.begin(); it != effs.end(); it++) {
        print_proposition(*it);
        std::cout << " ";
    }
    std::cout << std::endl << "Conditionals: " << std::endl;
    for (int i = 0; i < conds.size(); i++) {
        std::cout << "Cond PC #" << i << ":" << std::endl << "\t";
        for (it = conds[i].first.begin(); it != conds[i].first.end(); it++) {
            print_proposition(*it);
            std::cout << " ";
        }
        std::cout << std::endl << "Cond Effect #" << i << ":" << std::endl << "\t";
        for (it = conds[i].second.begin(); it != conds[i].second.end(); it++) {
            print_proposition(*it);
            std::cout << " ";
        }
        std::cout << std::endl << std::endl;
    }
}

void HMLandmarks::print_fluentset(const FluentSet &fs) {
    FluentSet::const_iterator it;

    std::cout << "( ";
    for (it = fs.begin(); it != fs.end(); it++) {
        print_proposition(*it);
        std::cout << " ";
    }
    std::cout << ")";
}

// check whether fs2 is a possible noop set for action with fs1 as effect
// sets cannot be 1) defined on same variable, 2) otherwise mutex
bool HMLandmarks::possible_noop_set(const FluentSet &fs1, const FluentSet &fs2) {
    FluentSet::const_iterator fs1it = fs1.begin(), fs2it = fs2.begin();

    while (fs1it != fs1.end() && fs2it != fs2.end()) {
        if (fs1it->first == fs2it->first) {
            return false;
        } else if (fs1it->first < fs2it->first) {
            ++fs1it;
        } else {
            ++fs2it;
        }
    }

    for (fs1it = fs1.begin(); fs1it != fs1.end(); ++fs1it) {
        for (fs2it = fs2.begin(); fs2it != fs2.end(); ++fs2it) {
            if (inconsistent_facts[fs1it->first][fs1it->second].find(*fs2it) !=
                inconsistent_facts[fs1it->first][fs1it->second].end()) {
                return false;
            }
        }
    }

    return true;
}

// make the operators of the P_m problem
void HMLandmarks::build_pm_ops() {
    FluentSet pc, eff;
    std::vector<FluentSet> pc_subsets, eff_subsets, noop_pc_subsets, noop_eff_subsets;

    static int op_count = 0;
    int set_index, noop_index;

    pm_ops_.resize(g_operators.size());

    // set unsatisfied precondition counts, used in fixpoint calculation
    unsat_pc_count_.resize(g_operators.size());

    // transfer ops from original problem
    // represent noops as "conditional" effects
    for (int i = 0; i < g_operators.size(); i++) {
        PMOp &op = pm_ops_[i];
        op.index = op_count++;

        pc.clear();
        eff.clear();

        pc_subsets.clear();
        eff_subsets.clear();

        // preconditions of P_m op are all subsets of original pc
        get_operator_precondition(i, pc);
        get_m_sets(m_, pc_subsets, pc);
        op.pc.reserve(pc_subsets.size());

        // set unsatisfied pc count for op
        unsat_pc_count_[i].first = pc_subsets.size();

        for (int j = 0; j < pc_subsets.size(); j++) {
            assert(set_indices_.find(pc_subsets[j]) != set_indices_.end());
            set_index = set_indices_[pc_subsets[j]];
            op.pc.push_back(set_index);
            h_m_table_[set_index].pc_for.push_back(std::make_pair(i, -1));
        }

        // same for effects
        get_operator_effect(i, eff);
        get_m_sets(m_, eff_subsets, eff);
        op.eff.reserve(eff_subsets.size());

        for (int j = 0; j < eff_subsets.size(); j++) {
            assert(set_indices_.find(eff_subsets[j]) != set_indices_.end());
            set_index = set_indices_[eff_subsets[j]];
            op.eff.push_back(set_index);
        }

        noop_index = 0;

        // For all subsets used in the problem with size *<* m, check whether
        // they conflict with the effect of the operator (no need to check pc
        // because mvvs appearing in pc also appear in effect

        FluentSetToIntMap::const_iterator it = set_indices_.begin();
        while ((it->first.size() < m_) && (it != set_indices_.end())) {
            if (possible_noop_set(eff, it->first)) {
                // for each such set, add a "conditional effect" to the operator
                op.cond_noops.resize(op.cond_noops.size() + 1);

                std::vector<int> &this_cond_noop = op.cond_noops.back();

                noop_pc_subsets.clear();
                noop_eff_subsets.clear();

                // get the subsets that have >= 1 element in the pc (unless pc is empty)
                // and >= 1 element in the other set

                get_split_m_sets(m_, noop_pc_subsets, pc, it->first);
                get_split_m_sets(m_, noop_eff_subsets, eff, it->first);

                this_cond_noop.reserve(noop_pc_subsets.size() + noop_eff_subsets.size() + 1);

                unsat_pc_count_[i].second.push_back(noop_pc_subsets.size());

                // push back all noop preconditions
                for (int j = 0; j < noop_pc_subsets.size(); j++) {
                    assert(noop_pc_subsets[j].size() <= m_);
                    assert(set_indices_.find(noop_pc_subsets[j]) != set_indices_.end());

                    set_index = set_indices_[noop_pc_subsets[j]];
                    this_cond_noop.push_back(set_index);
                    // these facts are "conditional pcs" for this action
                    h_m_table_[set_index].pc_for.push_back(std::make_pair(i, noop_index));
                }

                // separator
                this_cond_noop.push_back(-1);

                // and the noop effects
                for (int j = 0; j < noop_eff_subsets.size(); j++) {
                    assert(noop_eff_subsets[j].size() <= m_);
                    assert(set_indices_.find(noop_eff_subsets[j]) != set_indices_.end());

                    set_index = set_indices_[noop_eff_subsets[j]];
                    this_cond_noop.push_back(set_index);
                }

                noop_index++;
            }
            ++it;
        }
        //    print_pm_op(pm_ops_[i]);
    }
}

bool HMLandmarks::interesting(int var1, int val1, int var2, int val2) {
    // mutexes can always be safely pruned
    return inconsistent_facts[var1][val1].find(
               std::make_pair(var2, val2)) ==
           inconsistent_facts[var1][val1].end();
}

HMLandmarks::HMLandmarks(LandmarkGraphOptions &options, Exploration *expl, int m)
    : LandmarksGraph(options, expl), m_(m) {
    std::cout << "H_m_Landmarks(" << m_ << ")" << std::endl;
    // need this to be able to print propositions for debugging
    // already called in global.cc
    //  read_external_inconsistencies();

    // moving all code from here to init(), this can be called in generate
    // we can then free all unneeded memory after computation is done.
}

void HMLandmarks::init() {
    // get all the m or less size subsets in the domain
    std::vector<std::vector<Fluent> > msets;
    get_m_sets(m_, msets);
    //  std::cout << "P^m index\tP fluents" << std::endl;

    // map each set to an integer
    for (int i = 0; i < msets.size(); i++) {
        h_m_table_.push_back(HMEntry());
        set_indices_[msets[i]] = i;
        h_m_table_[i].fluents = msets[i];
        /*
           std::cout << i << "\t";
           print_fluentset(h_m_table_[i].fluents);
           std::cout << std::endl;
         */
    }
    std::cout << "Using " << h_m_table_.size() << " P^m fluents."
    << std::endl;

    // unsatisfied pc counts are now in build pm ops

    build_pm_ops();
    //  std::cout << "Built P(m) ops, total: " << pm_ops_.size() << "." << std::endl;
}

void HMLandmarks::calc_achievers() {
    std::cout << "Calculating achievers." << std::endl;

    // first_achievers are already filled in by compute_h_m_landmarks
    // here only have to do possible_achievers
    for (std::set<LandmarkNode *>::iterator it = nodes.begin();
         it != nodes.end(); it++) {
        LandmarkNode &lmn = **it;

        std::set<int> candidates;
        // put all possible adders in candidates set
        for (int i = 0; i < lmn.vars.size(); i++) {
            const std::vector<int> &ops =
                get_operators_including_eff(std::make_pair(lmn.vars[i],
                                                           lmn.vals[i]));
            candidates.insert(ops.begin(), ops.end());
        }

        for (std::set<int>::iterator cands_it = candidates.begin();
             cands_it != candidates.end(); cands_it++) {
            int op = *cands_it;

            FluentSet eff, pc;
            get_operator_effect(op, eff);
            get_operator_precondition(op, pc);
            int j;
            for (j = 0; j < lmn.vars.size(); j++) {
                std::pair<int, int> lm_val = std::make_pair(lmn.vars[j], lmn.vals[j]);
                // action adds this element of lm as well
                if (std::find(eff.begin(), eff.end(), lm_val) != eff.end())
                    continue;
                int k;
                for (k = 0; k < eff.size(); k++) {
                    if (inconsistent(eff[k], lm_val)) {
                        break;
                    }
                }
                if (k != eff.size()) {
                    break;
                }
                for (k = 0; k < pc.size(); k++) {
                    // we know that lm_val is not added by the operator
                    // so if it incompatible with the pc, this can't be an achiever
                    if (inconsistent(pc[k], lm_val)) {
                        break;
                    }
                }
                if (k != pc.size()) {
                    break;
                }
            }
            if (j == lmn.vars.size()) {
                // not inconsistent with any of the other landmarks fluents
                lmn.possible_achievers.insert(op);
            }
        }
    }
}

void HMLandmarks::free_unneeded_memory() {
    std::vector<HMEntry>().swap(h_m_table_);
    std::vector<PMOp>().swap(pm_ops_);
    std::vector<std::vector<bool> >().swap(interesting_);
    std::vector<std::pair<int, std::vector<int> > >().swap(unsat_pc_count_);

    set_indices_.clear();
    lm_node_table_.clear();
}

// called when a fact is discovered or its landmarks change
// to trigger required actions at next level
// newly_discovered = first time fact becomes reachable
void HMLandmarks::propagate_pm_fact(int factindex, bool newly_discovered,
                                    TriggerSet &trigger) {
    // for each action/noop for which fact is a pc
    for (int i = 0; i < h_m_table_[factindex].pc_for.size(); i++) {
        std::pair<int, int> const &info = h_m_table_[factindex].pc_for[i];

        // a pc for the action itself
        if (info.second == -1) {
            if (newly_discovered) {
                unsat_pc_count_[info.first].first--;
            }
            // add to queue if unsatcount at 0
            if (unsat_pc_count_[info.first].first == 0) {
                // create empty set or clear prev entries -- signals do all possible noop effects
                trigger[info.first].clear();
            }
        }
        // a pc for a conditional noop
        else {
            if (newly_discovered) {
                unsat_pc_count_[info.first].second[info.second]--;
            }
            // if associated action is applicable, and effect has become applicable
            // (if associated action is not applicable, all noops will be used when it first does)
            if ((unsat_pc_count_[info.first].first == 0) &&
                (unsat_pc_count_[info.first].second[info.second] == 0)) {
                // if not already triggering all noops, add this one
                if ((trigger.find(info.first) == trigger.end()) ||
                    (!trigger[info.first].empty())) {
                    trigger[info.first].insert(info.second);
                }
            }
        }
    }
}

void HMLandmarks::compute_h_m_landmarks() {
    // get subsets of initial state
    std::vector<FluentSet> init_subsets;
    get_m_sets(m_, init_subsets, *g_initial_state);

    TriggerSet current_trigger, next_trigger;

    // for all of the initial state <= m subsets, mark level = 0
    for (int i = 0; i < init_subsets.size(); i++) {
        int index = set_indices_[init_subsets[i]];
        h_m_table_[index].level = 0;

        // set actions to be applied
        propagate_pm_fact(index, true, current_trigger);
    }

    std::vector<int>::iterator it;
    TriggerSet::iterator op_it;

    std::list<int> local_landmarks, cn_landmarks;
    std::list<int> local_necessary;

    int prev_size;

    int level = 1;

    // while we have actions to apply
    while (!current_trigger.empty()) {
        for (op_it = current_trigger.begin(); op_it != current_trigger.end(); ++op_it) {
            local_landmarks.clear();
            local_necessary.clear();

            int op_index = op_it->first;
            PMOp &action = pm_ops_[op_index];

            // gather landmarks for pcs
            // in the set of landmarks for each fact, the fact itself is not stored
            // (only landmarks preceding it)
            for (it = action.pc.begin(); it != action.pc.end(); ++it) {
                union_with(local_landmarks, h_m_table_[*it].landmarks);
                insert_into(local_landmarks, *it);

                if (!no_orders) {
                    insert_into(local_necessary, *it);
                }
            }

            for (it = action.eff.begin(); it != action.eff.end(); ++it) {
                if (h_m_table_[*it].level != -1) {
                    prev_size = h_m_table_[*it].landmarks.size();
                    intersect_with(h_m_table_[*it].landmarks, local_landmarks);

                    // if the add effect appears in local landmarks,
                    // fact is being achieved for >1st time
                    // no need to intersect for gn orderings
                    // or add op to first achievers
                    if (!contains(local_landmarks, *it)) {
                        insert_into(h_m_table_[*it].first_achievers, op_index);
                        if (!no_orders) {
                            intersect_with(h_m_table_[*it].necessary, local_necessary);
                        }
                    }

                    if (h_m_table_[*it].landmarks.size() != prev_size)
                        propagate_pm_fact(*it, false, next_trigger);
                } else {
                    h_m_table_[*it].level = level;
                    h_m_table_[*it].landmarks = local_landmarks;
                    if (!no_orders) {
                        h_m_table_[*it].necessary = local_necessary;
                    }
                    insert_into(h_m_table_[*it].first_achievers, op_index);
                    propagate_pm_fact(*it, true, next_trigger);
                }
            }

            // landmarks changed for action itself, have to recompute
            // landmarks for all noop effects
            if (op_it->second.empty()) {
                for (int i = 0; i < action.cond_noops.size(); i++) {
                    // actions pcs are satisfied, but cond. effects may still have
                    // unsatisfied pcs
                    if (unsat_pc_count_[op_index].second[i] == 0) {
                        compute_noop_landmarks(op_index, i,
                                               local_landmarks,
                                               local_necessary,
                                               level, next_trigger);
                    }
                }
            }
            // only recompute landmarks for conditions whose
            // landmarks have changed
            else {
                for (std::set<int>::iterator noop_it = op_it->second.begin();
                     noop_it != op_it->second.end(); ++noop_it) {
                    assert(unsat_pc_count_[op_index].second[*noop_it] == 0);

                    compute_noop_landmarks(op_index, *noop_it,
                                           local_landmarks,
                                           local_necessary,
                                           level, next_trigger);
                }
            }
        }
        current_trigger.swap(next_trigger);
        next_trigger.clear();

        std::cout << "Level " << level << " completed." << std::endl;
        level++;
    }
    std::cout << "h^m landmarks computed." << std::endl;
}

void HMLandmarks::compute_noop_landmarks(
    int op_index, int noop_index,
    std::list<int> const &local_landmarks,
    std::list<int> const &local_necessary,
    int level,
    TriggerSet &next_trigger) {
    std::list<int> cn_necessary, cn_landmarks;
    int prev_size;
    int pm_fluent;

    PMOp &action = pm_ops_[op_index];
    std::vector<int> &pc_eff_pair = action.cond_noops[noop_index];

    cn_landmarks.clear();

    cn_landmarks = local_landmarks;

    if (!no_orders) {
        cn_necessary.clear();
        cn_necessary = local_necessary;
    }

    int i;
    for (i = 0; (pm_fluent = pc_eff_pair[i]) != -1; i++) {
        union_with(cn_landmarks, h_m_table_[pm_fluent].landmarks);
        insert_into(cn_landmarks, pm_fluent);

        if (!no_orders) {
            insert_into(cn_necessary, pm_fluent);
        }
    }

    // go to the beginning of the effects section
    i++;

    for (; i < pc_eff_pair.size(); i++) {
        pm_fluent = pc_eff_pair[i];
        if (h_m_table_[pm_fluent].level != -1) {
            prev_size = h_m_table_[pm_fluent].landmarks.size();
            intersect_with(h_m_table_[pm_fluent].landmarks, cn_landmarks);

            // if the add effect appears in cn_landmarks,
            // fact is being achieved for >1st time
            // no need to intersect for gn orderings
            // or add op to first achievers
            if (!contains(cn_landmarks, pm_fluent)) {
                insert_into(h_m_table_[pm_fluent].first_achievers, op_index);
                if (!no_orders) {
                    intersect_with(h_m_table_[pm_fluent].necessary, cn_necessary);
                }
            }

            if (h_m_table_[pm_fluent].landmarks.size() != prev_size)
                propagate_pm_fact(pm_fluent, false, next_trigger);
        } else {
            h_m_table_[pm_fluent].level = level;
            h_m_table_[pm_fluent].landmarks = cn_landmarks;
            if (!no_orders) {
                h_m_table_[pm_fluent].necessary = cn_necessary;
            }
            insert_into(h_m_table_[pm_fluent].first_achievers, op_index);
            propagate_pm_fact(pm_fluent, true, next_trigger);
        }
    }
}

void HMLandmarks::add_lm_node(int set_index, bool goal) {
    std::vector<int> vars, vals;

    std::map<int, LandmarkNode *>::iterator it = lm_node_table_.find(set_index);

    if (it == lm_node_table_.end()) {
        vars.clear();
        vals.clear();
        for (FluentSet::iterator it = h_m_table_[set_index].fluents.begin();
             it != h_m_table_[set_index].fluents.end(); ++it) {
            vars.push_back(it->first);
            vals.push_back(it->second);
        }
        bool conj = (vars.size() > 1);
        LandmarkNode *to_add = new LandmarkNode(vars, vals, false, conj);
        to_add->in_goal = goal;
        to_add->first_achievers.insert(h_m_table_[set_index].first_achievers.begin(),
                                       h_m_table_[set_index].first_achievers.end());
        nodes.insert(to_add);
        landmarks_count++;
        if (conj) {
            conj_lms++;
        } else {
            simple_lms_to_nodes.insert(std::make_pair(h_m_table_[set_index].fluents[0],
                                                      to_add));
        }
        lm_node_table_[set_index] = to_add;
    }
}

void HMLandmarks::generate_landmarks() {
    int set_index;
    init();
    compute_h_m_landmarks();
    // now construct landmarks graph
    std::vector<FluentSet> goal_subsets;
    get_m_sets(m_, goal_subsets, g_goal);
    std::list<int> all_lms;
    for (int i = 0; i < goal_subsets.size(); i++) {
        /*
           std::cout << "Goal set: ";
           print_fluentset(goal_subsets[i]);
           std::cout << " -- ";
           for(unsigned j = 0; j < goal_subsets[i].size(); j++) {
           std::cout << goal_subsets[i][j] << " ";
           }
           std::cout << std::endl;
         */

        assert(set_indices_.find(goal_subsets[i]) != set_indices_.end());

        set_index = set_indices_[goal_subsets[i]];

        if (h_m_table_[set_index].level == -1) {
            std::cout << std::endl << std::endl << "Subset of goal not reachable !!." << std::endl << std::endl << std::endl;
            std::cout << "Subset is: ";
            print_fluentset(h_m_table_[set_index].fluents);
            std::cout << std::endl;
            //      exit(1);
        }

        // set up goals landmarks for processing
        union_with(all_lms, h_m_table_[set_index].landmarks);

        // the goal itself is also a lm
        insert_into(all_lms, set_index);

        // make a node for the goal, with in_goal = true;
        add_lm_node(set_index, true);
        /*
           std::cout << "Goal subset: ";
           print_fluentset(h_m_table_[set_index].fluents);
           std::cout << std::endl;
         */
    }
    // now make remaining lm nodes
    for (std::list<int>::iterator it = all_lms.begin(); it != all_lms.end(); ++it) {
        add_lm_node(*it, false);
    }
    if (!no_orders) {
        // do reduction of graph
        // if f2 is landmark for f1, subtract landmark set of f2 from that of f1
        for (std::list<int>::iterator f1 = all_lms.begin(); f1 != all_lms.end(); ++f1) {
            std::list<int> everything_to_remove;
            for (std::list<int>::iterator f2 = h_m_table_[*f1].landmarks.begin();
                 f2 != h_m_table_[*f1].landmarks.end(); ++f2) {
                union_with(everything_to_remove, h_m_table_[*f2].landmarks);
            }
            set_minus(h_m_table_[*f1].landmarks, everything_to_remove);
            // remove necessaries here, otherwise they will be overwritten
            // since we are writing them as greedy nec. orderings.
            if (!no_orders)
                set_minus(h_m_table_[*f1].landmarks, h_m_table_[*f1].necessary);
        }

        // and add the edges

        for (std::list<int>::iterator it = all_lms.begin(); it != all_lms.end(); ++it) {
            set_index = *it;
            for (std::list<int>::iterator lms_it = h_m_table_[set_index].landmarks.begin();
                 lms_it != h_m_table_[set_index].landmarks.end(); ++lms_it) {
                assert(lm_node_table_.find(*lms_it) != lm_node_table_.end());
                assert(lm_node_table_.find(set_index) != lm_node_table_.end());

                edge_add(*lm_node_table_[*lms_it], *lm_node_table_[set_index], natural);
            }
            if (!no_orders) {
                for (std::list<int>::iterator gn_it = h_m_table_[set_index].necessary.begin();
                     gn_it != h_m_table_[set_index].necessary.end(); ++gn_it) {
                    edge_add(*lm_node_table_[*gn_it], *lm_node_table_[set_index], greedy_necessary);
                }
            }
        }
    }
    free_unneeded_memory();
}

LandmarksGraph *HMLandmarks::create(
    const std::vector<string> &config, int start, int &end, bool dry_run) {
    LandmarksGraph::LandmarkGraphOptions common_options;

    int m = 2;

    if (config.size() > start + 2 && config[start + 1] == "(") {
        end = start + 2;
        if (config[end] != ")") {
            NamedOptionParser option_parser;
            common_options.add_option_to_parser(option_parser);

            option_parser.add_int_option("m", &m, "m (as in h^m)");

            option_parser.parse_options(config, end, end, dry_run);
            ++end;
        }
        if (config[end] != ")")
            throw ParseError(end);
    } else {
        end = start;
    }

    if (dry_run) {
        return 0;
    } else {
        LandmarksGraph *graph = new HMLandmarks(common_options,
                                                new Exploration(common_options.heuristic_options), m);
        LandmarksGraph::build_lm_graph(graph);
        return graph;
    }
}


text:
static NSString *const FBSDKLoginButtonTag = @"FBSDKLoginButton";
static NSString *const FBSDKShareButtonTag = @"FBSDKShareButton";
static NSString *const FBSDKLoginViewControllerTag = @"FBSDKLoginViewController";

static Class FBSDKDynamicallyLoadShareKitClassFromString(NSString *className)
{
  static NSMutableDictionary *classes;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    classes = [NSMutableDictionary dictionary];
  });
  if (!classes[className]) {
    classes[className] = NSClassFromString(className);
  }
  Class clazz = classes[className];
  if (clazz == nil) {
    NSString *message = [NSString stringWithFormat:@"Unable to load class %1$@. Did you link FBSDKShareKit.framework or add [%1$@ class] in your application delegate?", className];
    @throw [NSException exceptionWithName:NSInternalInconsistencyException
                                   reason:message
                                 userInfo:nil];
  }
  return clazz;
}

@implementation FBSDKTVInterfaceFactory {
  id<TVInterfaceCreating> _interfaceCreator;
}

- (instancetype)init {
  return [self initWithInterfaceCreator:nil];
}

- (instancetype)initWithInterfaceCreator:(id<TVInterfaceCreating>)interfaceCreator
{
  if ((self = [super init])) {
    _interfaceCreator = interfaceCreator;
  }
  return self;
}

+ (void)initialize
{
  [TVElementFactory registerViewElementClass:[FBSDKTVLoginButtonElement class] forElementName:FBSDKLoginButtonTag];
  [TVElementFactory registerViewElementClass:[FBSDKTVLoginViewControllerElement class] forElementName:FBSDKLoginViewControllerTag];
  [TVElementFactory registerViewElementClass:[FBSDKTVShareButtonElement class] forElementName:FBSDKShareButtonTag];
}

#pragma mark - TVInterfaceCreating

- (UIView *)viewForElement:(TVViewElement *)element
              existingView:(UIView *)existingView
{
  if ([element isKindOfClass:[FBSDKTVLoginButtonElement class]]) {
    FBSDKDeviceLoginButton *button = [[FBSDKDeviceLoginButton alloc] initWithFrame:CGRectZero];
    button.delegate = (FBSDKTVLoginButtonElement *)element;
    button.publishPermissions = [element.attributes[@"publishPermissions"] componentsSeparatedByString:@","];
    button.readPermissions = [element.attributes[@"readPermissions"] componentsSeparatedByString:@","];
    button.redirectURL = [NSURL URLWithString:element.attributes[@"redirectURL"]];
    return button;
  } else if ([element isKindOfClass:[FBSDKTVShareButtonElement class]]) {
    FBSDKDeviceShareButton *button = [[FBSDKDynamicallyLoadShareKitClassFromString(@"FBSDKDeviceShareButton") alloc] initWithFrame:CGRectZero];
    id<FBSDKSharingContent> content = nil;
    if (element.attributes[@"href"]) {
      content = [[FBSDKDynamicallyLoadShareKitClassFromString(@"FBSDKShareLinkContent") alloc] init];
      content.contentURL = [NSURL URLWithString:element.attributes[@"href"]];

    } else {
      NSString *actionType = element.attributes[@"action_type"];
      NSURL *url = [NSURL URLWithString:element.attributes[@"object_url"]];
      NSString *key = element.attributes[@"key"];
      if (actionType.length > 0 && url && key.length > 0) {
        FBSDKShareOpenGraphAction *action = [FBSDKDynamicallyLoadShareKitClassFromString(@"FBSDKShareOpenGraphAction") actionWithType:actionType objectURL:url key:key];
        content = [[FBSDKDynamicallyLoadShareKitClassFromString(@"FBSDKShareOpenGraphContent") alloc] init];
        ((FBSDKShareOpenGraphContent *)content).action = action;
      }
    }

    if (content) {
      button.shareContent = content;
      return button;
    } else {
      NSString *message = [NSString stringWithFormat:@"Invalid parameters for %@ (%@)", element.elementIdentifier, element.elementName];
      @throw [NSException exceptionWithName:NSInternalInconsistencyException
                                     reason:message
                                   userInfo:nil];
    }

  }
  if ([_interfaceCreator respondsToSelector:@selector(viewForElement:existingView:)]) {
    return [_interfaceCreator viewForElement:element existingView:existingView];
  }
  return nil;
}

- (UIViewController *)viewControllerForElement:(TVViewElement *)element existingViewController:(UIViewController *)existingViewController
{
  if ([element isKindOfClass:[FBSDKTVLoginViewControllerElement class]]) {
    FBSDKDeviceLoginViewController *vc = [[FBSDKDeviceLoginViewController alloc] init];
    vc.delegate = (FBSDKTVLoginViewControllerElement *)element;
    NSArray *publishPermissions = [element.attributes[@"publishPermissions"] componentsSeparatedByString:@","];
    vc.publishPermissions = publishPermissions;
    NSArray *readPermissions = [element.attributes[@"readPermissions"] componentsSeparatedByString:@","];
    vc.readPermissions = readPermissions;
    vc.redirectURL = [NSURL URLWithString:element.attributes[@"redirectURL"]];
    return vc;
  }
  if ([_interfaceCreator respondsToSelector:@selector(viewControllerForElement:existingViewController:)]) {
    return [_interfaceCreator viewControllerForElement:element existingViewController:existingViewController];
  }
  return nil;
}

- (NSURL *)URLForResource:(NSString *)resourceName
{
  if ([_interfaceCreator respondsToSelector:@selector(URLForResource:)]) {
    return [_interfaceCreator URLForResource:resourceName];
  }
  return nil;
}
@end


text:
using System;
using Newtonsoft.Json;
using Voucherify.Core.DataModel;

namespace Voucherify.DataModel
{
    [JsonObject]
    public class CustomerSystemMetadata
    {
        [JsonProperty(PropertyName = "consents")]
        public Json Consents { get; private set; }

        public override string ToString()
        {
            return string.Format("CustomerSystemMetadata(Consents={0})", this.Consents);
        }
    }
}


text:
package org.apache.asterix.app.function;

import org.apache.asterix.metadata.api.IDatasourceFunction;
import org.apache.asterix.metadata.declared.DataSourceId;
import org.apache.asterix.metadata.declared.FunctionDataSource;
import org.apache.asterix.metadata.declared.MetadataProvider;
import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;

public class PingDatasource extends FunctionDataSource {

    private static final DataSourceId PING_DATASOURCE_ID =
            new DataSourceId(PingRewriter.PING.getNamespace(), PingRewriter.PING.getName());

    public PingDatasource(INodeDomain domain) throws AlgebricksException {
        super(PING_DATASOURCE_ID, domain);
    }

    @Override
    protected IDatasourceFunction createFunction(MetadataProvider metadataProvider,
            AlgebricksAbsolutePartitionConstraint locations) {
        return new PingFunction(locations);
    }

}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
  ~ Copyright (c) 2016 Haulmont
  ~
  ~ 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.
  -->

<window xmlns="http://schemas.haulmont.com/cuba/screen/window.xsd"
        caption="msg://com.haulmont.timesheets.entity/TimeEntry.rejectionReason"
        messagesPack="com.haulmont.timesheets.gui.rejection">
    <actions>
        <action id="confirm" shortcut="CTRL-ENTER"/>
        <action id="cancel" caption="msg://cancel"/>
    </actions>
    <layout expand="rejectionReasonText" spacing="true">
        <textArea id="rejectionReasonText" width="100%"/>
        <buttonsPanel id="buttonsPanel">
            <button id="okButton" action="confirm" caption="OK" icon="icons/ok.png"/>
            <button id="cancelButton" action="cancel" caption="msg://cancel" icon="icons/cancel.png"/>
        </buttonsPanel>
    </layout>
</window>


text:
cask "blizz" do
  version "15.11.2"
  sha256 "1f7020033e670e7feb4f76090883628a5ad943be3179c4d94f7b312acfb649be"

  # dl.teamviewer.com/ was verified as official when first introduced to the cask
  url "https://dl.teamviewer.com/blizz/installer/mac/#{version}/Blizz.dmg"
  appcast "https://macupdater.net/cgi-bin/check_urls/check_url_redirect.cgi?url=https://download.teamviewer.com/blizz/mac"
  name "Blizz"
  homepage "https://www.blizz.com/"

  app "Blizz.app"
end


text:
package org.dspace.content;

import java.util.Locale;
import org.dspace.AbstractUnitTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.* ;
import static org.hamcrest.CoreMatchers.*;

/**
 * Tests DCLanguageTest class
 * @author pvillega
 */
public class DCLanguageTest extends AbstractUnitTest
{

    /**
     * Object to use in the tests
     */
    private DCLanguage dc;

    /**
     * This method will be run before every test as per @Before. It will
     * initialize resources required for the tests.
     *
     * Other methods can be annotated with @Before here or in subclasses
     * but no execution order is guaranteed
     */
    @Before
    @Override
    public void init()
    {
        super.init();
        dc = new DCLanguage("");
    }

    /**
     * This method will be run after every test as per @After. It will
     * clean resources initialized by the @Before methods.
     *
     * Other methods can be annotated with @After here or in subclasses
     * but no execution order is guaranteed
     */
    @After
    @Override
    public void destroy()
    {
        dc = null;
        super.destroy();
    }

    /**
     * Test of DCLanguage constructor, of class DCLanguage.
     */
    @Test
    public void testDCLanguage()
    {
        dc = new DCLanguage(null);
        assertThat("testDCLanguage 0", dc.toString(), equalTo(""));

        dc = new DCLanguage("");
        assertThat("testDCLanguage 1", dc.toString(), equalTo(""));

        dc = new DCLanguage("other");
        assertThat("testDCLanguage 2", dc.toString(), equalTo("other"));

        dc = new DCLanguage("12");
        assertThat("testDCLanguage 3", dc.toString(), equalTo("12"));

        dc = new DCLanguage("12345");
        assertThat("testDCLanguage 4", dc.toString(), equalTo("45_12"));

        dc = new DCLanguage("123456");
        assertThat("testDCLanguage 5", dc.toString(), equalTo(""));

        dc = new DCLanguage("1234567890");
        assertThat("testDCLanguage 6", dc.toString(), equalTo(""));
    }

    /**
     * Test of toString method, of class DCLanguage.
     */
    @Test
    public void testToString()
    {
        dc = new DCLanguage(null);
        assertThat("testToString 0", dc.toString(), equalTo(""));

        dc = new DCLanguage("");
        assertThat("testToString 1", dc.toString(), equalTo(""));

        dc = new DCLanguage("other");
        assertThat("testToString 2", dc.toString(), equalTo("other"));

        dc = new DCLanguage("12");
        assertThat("testToString 3", dc.toString(), equalTo("12"));

        dc = new DCLanguage("12345");
        assertThat("testToString 4", dc.toString(), equalTo("45_12"));

        dc = new DCLanguage("123456");
        assertThat("testToString 5", dc.toString(), equalTo(""));

        dc = new DCLanguage("1234567890");
        assertThat("testToString 6", dc.toString(), equalTo(""));
    }

    /**
     * Test of setLanguage method, of class DCLanguage.
     */
    @Test
    public void testSetLanguage()
    {
        dc = new DCLanguage(null);
        assertThat("testSetLanguage 0", dc.toString(), equalTo(""));

        dc = new DCLanguage("");
        assertThat("testSetLanguage 1", dc.toString(), equalTo(""));

        dc = new DCLanguage("other");
        assertThat("testSetLanguage 2", dc.toString(), equalTo("other"));

        dc = new DCLanguage("12");
        assertThat("testSetLanguage 3", dc.toString(), equalTo("12"));

        dc = new DCLanguage("12345");
        assertThat("testSetLanguage 4", dc.toString(), equalTo("45_12"));

        dc = new DCLanguage("123456");
        assertThat("testSetLanguage 5", dc.toString(), equalTo(""));

        dc = new DCLanguage("1234567890");
        assertThat("testSetLanguage 6", dc.toString(), equalTo(""));
    }

    /**
     * Test of getDisplayName method, of class DCLanguage.
     */
    @Test
    public void testGetDisplayName()
    {
        dc = new DCLanguage(null);
        assertThat("testGetDisplayName 0", dc.getDisplayName(), equalTo("N/A"));

        dc = new DCLanguage("");
        assertThat("testGetDisplayName 1", dc.getDisplayName(), equalTo("N/A"));

        dc = new DCLanguage("other");
        assertThat("testGetDisplayName 2", dc.getDisplayName(),
                equalTo("(Other)"));

        dc = new DCLanguage("en");
        assertThat("testGetDisplayName 3", dc.getDisplayName(),
                equalTo(new Locale("en","").getDisplayName()));

        dc = new DCLanguage("en_GB");
        assertThat("testGetDisplayName 4", dc.getDisplayName(),
                equalTo(new Locale("en","GB").getDisplayName()));
    }
}


text:
package de.zib.gndms.taskflows.filetransfer.client.tools;

import de.zib.gndms.common.model.gorfx.types.io.TaskResultWriter;

/**
 * @author  try ma ik jo rr a zib
 * @version  $Id$
 * <p/>
 * User: mjorra, Date: 13.10.2008, Time: 13:06:29
 */
public interface FileTransferResultWriter extends TaskResultWriter {

    public void writeFiles( String[] files );
}


text:
{% load i18n cms_tags menu_tags %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>{% page_attribute page_title %}</title>
    <meta name="description" content="{% page_attribute meta_description %}"/>
    <link href="{{ STATIC_URL }}css/style.css" media="all" rel="stylesheet" type="text/css" />

                Company name

                {% spaceless %}

                    {% language_chooser %}

                {% endspaceless %}

                {% spaceless %}

                     {% show_menu 0 0 100 100 %}

                {% endspaceless %}

            {% show_breadcrumb %}

              {% block content %}{% endblock content %}


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

namespace KelpNet
{
    [Serializable]
    public class MultiplyScale : SingleInputFunction
    {
        const string FUNCTION_NAME = "MultiplyScale";

        private int Axis;
        public NdArray Weight;
        public NdArray Bias;
        public bool BiasTerm = false;

        public MultiplyScale(int axis = 0, int[] wShape = null, bool biasTerm = false, Array initialW = null, Array initialb = null, string name = FUNCTION_NAME, string[] inputNames = null, string[] outputNames = null) : base(name, inputNames, outputNames)
        {
            this.Axis = axis;
            this.BiasTerm = biasTerm;

#if DEBUG
            if (wShape == null)
            {
                if (biasTerm)
                {
                    throw new Exception("Biasのみでの使用はAddBiasを使用してください");
                }
                else
                {
                    throw new Exception("パラメータの設定が正しくありません");
                }
            }
#endif
            this.Weight = new NdArray(wShape);
            this.Parameters = new NdArray[biasTerm ? 2 : 1];

            if (initialW == null)
            {
                this.Weight.Data = Enumerable.Repeat((Real)1.0, Weight.Data.Length).ToArray();
            }
            else
            {
                this.Weight.Data = Real.ToRealArray(initialW);
            }

            this.Parameters[0] = this.Weight;

            if (biasTerm)
            {
                this.Bias = new NdArray(wShape);

                if (initialb != null)
                {
                    this.Bias.Data = Real.ToRealArray(initialb);
                }

                this.Parameters[1] = this.Bias;
            }
        }

        public override NdArray SingleInputForward(NdArray x)
        {
            int[] inputShape = x.Shape;
            int[] outputShape = this.Weight.Shape;

            List<int> shapeList = new List<int>();

            for (int i = 0; i < this.Axis; i++)
            {
                shapeList.Add(1);
            }

            shapeList.AddRange(outputShape);

            for (int i = 0; i < inputShape.Length - this.Axis - outputShape.Length; i++)
            {
                shapeList.Add(1);
            }

            int[] preShape = shapeList.ToArray();

            NdArray y1 = new Reshape(preShape).Forward(this.Weight)[0];
            NdArray y2 = new Broadcast(inputShape).Forward(y1)[0];

            if (BiasTerm)
            {
                NdArray b1 = new Reshape(preShape).Forward(this.Bias)[0];
                NdArray b2 = new Broadcast(inputShape).Forward(b1)[0];

                return x * y2 + b2;
            }
            else
            {
                return x * y2;
            }
        }

        public override void SingleOutputBackward(NdArray y, NdArray x)
        {
            //MultiplyScaleとして必要な処理はない
        }
    }
}


text:
define(function (require) {
    var React = require('react/react');
    var WeatherIcon = require('./WeatherIcon');
    var WeatherTemperature = require('./WeatherTemperature');

    var WeatherForecast = React.createFactory(React.createClass({
        render: function() {
            var div = React.createFactory('div');

            var forecastProps = this.props;
            var forecastComponents = this.props.forecast.map(function(forecastItem) {
                return div({className: 'row weatherForecastRow', key: forecastItem.day},
                    div({className: 'col-xs-offset-4 col-xs-1'},
                        React.DOM.h3(null, forecastItem.day)
                    ),
                    div({className: 'col-xs-1'},
                        WeatherIcon({conditionCode: forecastItem.code, fontSize: '2em'})
                    ),
                    div({className: 'col-xs-1'},
                        WeatherTemperature({temperature: forecastItem.high, units: forecastProps.units, fontSize: '2em', weatherClassName: 'weatherTempHigh'})
                    ),
                    div({className: 'col-xs-1'},
                        WeatherTemperature({temperature: forecastItem.low, units: forecastProps.units, fontSize: '2em', weatherClassName: 'weatherTempLow'})
                    )
                );
            });

            return div({className: 'weatherForecast'},
                React.DOM.h3(null, '5 Day Forecast'),
                forecastComponents
            );
        }
    }));

    return WeatherForecast;
});