text:
package com.github.dynamicextensionsalfresco.webscripts.arguments;

import java.lang.annotation.Annotation;
import java.lang.reflect.Array;

import com.github.dynamicextensionsalfresco.webscripts.annotations.RequestParam;

import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

/**
 * {@link ArgumentResolver} that handles parameters annotated with {@link RequestParam}.
 *
 * @author Laurens Fridael
 */
public class RequestParamArgumentResolver implements ArgumentResolver<Object, RequestParam> {

	/* Dependencies */

	private final StringValueConverter stringValueConverter;

	/* Main operations */

	RequestParamArgumentResolver(final StringValueConverter stringValueConverter) {
		Assert.notNull(stringValueConverter);
		this.stringValueConverter = stringValueConverter;
	}

	@Override
	public boolean supports(Class<?> parameterType, final Class<? extends Annotation> annotationType) {
		if (parameterType.isArray()) {
			parameterType = parameterType.getComponentType();
		}
		return getStringValueConverter().isSupportedType(parameterType) && RequestParam.class.equals(annotationType);
	}

	@Override
	public Object resolveArgument(final Class<?> parameterType, final RequestParam requestParam, final String name,
			final WebScriptRequest request, final WebScriptResponse response) {
		Assert.notNull(requestParam, "RequestParam annotation cannot be null.");
		String parameterName = requestParam.value();
		if (StringUtils.hasText(parameterName) == false) {
			parameterName = name;
		}
		if (StringUtils.hasText(parameterName) == false) {
			throw new RuntimeException(
					"Cannot determine name of request parameter. Specify the name using the @RequestParam annotation.");
		}
		final Object parameter;
		if (parameterType.isArray() == false) {
			parameter = handleSingleParameter(parameterType, requestParam, request, parameterName);
		} else if (StringUtils.hasText(requestParam.delimiter())) {
			parameter = handleDelimitedParameter(parameterType, requestParam, request, parameterName);
		} else {
			parameter = handleMultipleParameters(parameterType, requestParam, request, parameterName);

		}
		return parameter;
	}

	/* Utility operations */

	private Object handleSingleParameter(final Class<?> parameterType, final RequestParam requestParam,
			final WebScriptRequest request, final String parameterName) {
		final String parameterValue = request.getParameter(parameterName);
		Object value = null;
		if (parameterValue != null) {
			value = getStringValueConverter().convertStringValue(parameterType, parameterValue);
		} else {
			if (StringUtils.hasText(requestParam.defaultValue())) {
				value = getStringValueConverter().convertStringValue(parameterType, requestParam.defaultValue());
			}
			if (value == null) {
				throwMissingParameterIfMandatory(requestParam, parameterName);
			}
		}
		return value;
	}

	private Object handleDelimitedParameter(final Class<?> parameterType, final RequestParam requestParam,
			final WebScriptRequest request, final String parameterName) {
		String parameterValue = request.getParameter(parameterName);
		if (parameterValue == null) {
			if (StringUtils.hasText(requestParam.defaultValue())) {
				parameterValue = requestParam.defaultValue();
			} else {
				throwMissingParameterIfMandatory(requestParam, parameterName);
			}
		}
        if (parameterValue != null) {
            final String[] parameterValues = parameterValue.split(requestParam.delimiter());
            return convertToArray(parameterType.getComponentType(), parameterValues);
        } else {
            return null;
        }
    }

	private Object handleMultipleParameters(final Class<?> parameterType, final RequestParam requestParam,
			final WebScriptRequest request, final String parameterName) {
		String[] parameterValues = request.getParameterValues(parameterName);
		if (parameterValues == null) {
			throwMissingParameterIfMandatory(requestParam, parameterName);
			parameterValues = new String[] { requestParam.defaultValue() };
		}
		return convertToArray(parameterType.getComponentType(), parameterValues);
	}

	private void throwMissingParameterIfMandatory(RequestParam requestParam, String parameterName) {
		if(requestParam.required()) {
			throw new WebScriptException(
					requestParam.missingParameterHttpStatusCode(),
					String.format("Request parameter not available: %s", parameterName)
			);
		}
	}

	private Object[] convertToArray(final Class<?> arrayComponentType, final String[] parameterValues) {
		final Object[] values = (Object[]) Array.newInstance(arrayComponentType, parameterValues.length);
		for (int i = 0; i < parameterValues.length; i++) {
			values[i] = getStringValueConverter().convertStringValue(arrayComponentType, parameterValues[i]);
		}
		return values;
	}

	/* Dependencies */

	protected StringValueConverter getStringValueConverter() {
		return stringValueConverter;
	}

}


text:
package com.hazelcast.map.impl.record;

import com.hazelcast.config.MapConfig;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.spi.serialization.SerializationService;

public class ObjectRecordFactory implements RecordFactory<Object> {

    private final SerializationService serializationService;
    private final boolean statisticsEnabled;

    public ObjectRecordFactory(MapConfig config, SerializationService serializationService) {
        this.serializationService = serializationService;
        this.statisticsEnabled = config.isStatisticsEnabled();
    }

    @Override
    public Record<Object> newRecord(Object value) {
        assert value != null : "value can not be null";

        Object objectValue = serializationService.toObject(value);
        return statisticsEnabled ? new ObjectRecordWithStats(objectValue) : new ObjectRecord(objectValue);
    }

    @Override
    public void setValue(Record<Object> record, Object value) {
        assert value != null : "value can not be null";

        Object v = value;
        if (value instanceof Data) {
            v = serializationService.toObject(value);
        }
        record.setValue(v);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>JetLoan</title>
  <link rel="shortcut icon" href="https://quickblox.com/favicon.ico">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="css/style.css">

Robby's Resolutions

Hosted on Heroku for the work to see

    Resolutions
      JetLoan
      QB Database
      Q-municate

JetLoan Database Access

Powered by QuickBlox

User Sign Up

          <form class="form-horizontal" role="form">

              Login:

                <input type="text" class="form-control" id="usr_sgn_p_lgn" placeholder="Enter login">

              Password:

                <input type="password" class="form-control" id="usr_sgn_p_pwd" placeholder="Enter password">

                <button type="button" class="btn btn-primary" id="sign_up" data-toggle="modal" data-target="#progressModal">Try</button>

          </form>

User Sign In

      <form action="/action_page.php">

    <form class="register-form">
      <input type="text" placeholder="name" />
      <input type="password" placeholder="password" />
      <input type="text" placeholder="email address" />
      <button>create</button>

Already registered? Sign In

    </form>
    <form class="login-form">
      <input type="text" placeholder="username" />
      <input type="password" placeholder="password" />
      <button>login</button>

Not registered? Create an account

    </form>

</form>

User Sign Out

          <form class="form-horizontal" role="form">

                <button type="button" class="btn btn-primary" id="sign_out" data-toggle="modal" data-target="#progressModal">Try</button>

          </form>

Get users

          <form class="form-horizontal" role="form">

              Select filter:

                <select class="form-control" id="sel_filter_for_users">
                  <option value="1" selected="selected">all users, no filters</option>
                  <option value="2">by id</option>
                  <option value="3">by login</option>
                  <option value="4">by fullname</option>
                  <option value="5">by facebook id</option>
                  <option value="6">by twitter id</option>
                  <option value="7">by email</option>
                  <option value="8">by tags</option>
                  <option value="9">by external id</option>
                  <option value="10">custom filters (check src code how to use)</option>
                </select>

              Filter value:

                <input type="text" class="form-control" id="usrs_get_by_filter" placeholder="Enter a value for filter:">

                <button type="button" class="btn btn-primary" id="get_by" data-toggle="modal" data-target="#progressModal">Try</button>

          </form>

Reset password

          <form class="form-horizontal" role="form">

              User email:

                <input type="text" class="form-control" id="usr_rst_email" placeholder="Enter email to reset a password:">

                <button type="button" class="btn btn-primary" id="reset" data-toggle="modal" data-target="#progressModal">Try</button>

          </form>

Output

        <textarea readonly class="form-control" rows="7" id="output_place"></textarea>

            <button type="button" class="close" data-dismiss="modal">×</button>

Processing

performing request...

    View source on GitHub


text:
package org.apache.shindig.gadgets.oauth2.handler;

import javax.servlet.http.HttpServletRequest;

import org.apache.shindig.gadgets.http.HttpResponse;
import org.apache.shindig.gadgets.oauth2.OAuth2Accessor;
import org.apache.shindig.gadgets.servlet.OAuth2CallbackServlet;

/**
 * When an AuthorizationEndpointResponseHandler is injected into the system it
 * will be called on every response from the authorization server that it claims
 * to handle.
 *
 * It may not make sense for a single handler to support both requests and
 * responses but it must support at least one.
 *
 * See {@link http://tools.ietf.org/html/draft-ietf-oauth-v2-21#section-4}
 *
 * By default shindig has handlers for the Authorization Code and Client
 * Credential flows.
 *
 */
public interface AuthorizationEndpointResponseHandler {
  /**
   * Let the handler do it's magic including any accessor/store updates.
   *
   *
   * If the handler is executed and encountered an error that should stop the
   * authorization process it should return the appropriate
   * {@link OAuth2HandlerError}.
   *
   * Applies in particular to the Authorization Code flow redirect.
   *
   * See {@link http://tools.ietf.org/html/draft-ietf-oauth-v2-21#section-4.1.2}
   *
   * @param accessor
   * @param response
   * @return see above
   */
  public OAuth2HandlerError handleRequest(OAuth2Accessor accessor, HttpServletRequest request);

  /**
   * Let the handler do it's magic including any accessor/store updates.
   *
   *
   * If the handler is executed and encountered an error that should stop the
   * authorization process it should return the appropriate
   * {@link OAuth2HandlerError}.
   *
   *
   * Applies in particular to the client_credentials flow.
   *
   * See {@link http://tools.ietf.org/html/draft-ietf-oauth-v2-21#section-4.4.1}
   *
   * @param accessor
   * @param response
   * @return see above
   */
  public OAuth2HandlerError handleResponse(OAuth2Accessor accessor, HttpResponse response);

  /**
   * Does the handler support this {@link OAuth2Accessor} /
   * {@link HttpServletRequest} response? The presumably has come from the
   * {@link OAuth2CallbackServlet} or somewhere similar.
   *
   * @param accessor
   * @param request
   * @return true if handleRequest() should be invoked
   */
  public boolean handlesRequest(OAuth2Accessor accessor, HttpServletRequest request);

  /**
   * Does the handler support this{@link OAuth2Accessor} / {@link HttpResponse}
   * response?
   *
   * @param accessor
   * @param response
   * @return true if handleRequest() should be invoked
   */
  public boolean handlesResponse(OAuth2Accessor accessor, HttpResponse response);
}


text:
本文讲解如何使用mybatis反向工程,生成mapper。使用环境如下:

* idea
* maven

## 操作步骤

* 新建maven 项目

* pom.xml文件

```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sxhome</groupId>
    <artifactId>mybatis-generator</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>mybatis-generator Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <build>
        <finalName>zsxt</finalName>
        <plugins>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
                    <overwrite>true</overwrite>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
```

* ``../src/main/resources/generatorConfig.xml ``
  * classPathEntry中驱动路径根据使用电脑的实际路径配置;
  * targetPackage和targetProject,根据实际情况配置。

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
    <classPathEntry location="/Users/fangle/.m2/repository/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar"/>
    <!--<classPathEntry location="C:\Users\xx\.m2\repository\mysql\mysql-connector-java\5.1.35\mysql-connector-java-5.1.35.jar"/>-->
    <context id="DB2Tables" targetRuntime="MyBatis3">
        <commentGenerator>
            <property name="suppressDate" value="true"/>
            <!-- 是否去除自动生成的注释 true:是 : false:否 -->
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>
        <!--数据库链接URL,用户名、密码 -->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/test" userId="root" password="123456">
        </jdbcConnection>
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>
        <!-- 生成模型的包名和位置-->
        <javaModelGenerator targetPackage="com.info.statistics.model" targetProject="src/main/java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>
        <!-- 生成映射文件的包名和位置-->
        <sqlMapGenerator targetPackage="com.info.statistics.mapping" targetProject="src/main/java">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>
        <!-- 生成DAO的包名和位置-->
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.info.statistics.dao" targetProject="src/main/java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>
        <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
        <table tableName="account" domainObjectName="Account" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
        <!--<table tableName="tel_bill_record" domainObjectName="DSTelBillRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->

    </context>
</generatorConfiguration>
```

* 运行配置,新建maven,如下:working directory:``/Users/fangle/Desktop/work/projects/mybatisgen``是项目路径,Command line: ``mybatis-generator:generate -e``

![](./assets/2019-04-02-13-51-28.png)

* 运行生成模型、mapper以及dao文件。


text:
This work is licensed under the Creative Commons CC0 License

---

# In the properties tab for class view, move prefix name and prefix type together
### xtUML Project Analysis Note

### 1. Abstract

This note describes the analysis for allowing the properties view to be sorted for Attributes, specifically the prefix mode attribute of the O_ATTR class, even when a parent is selected.

### 2. Document References

2.1 [BridgePoint DEI #9565](https://github.com/travislondon/bridgepoint/blob/master/doc-bridgepoint/notes/9565_%20Move_Prefix_name_and_Prefix_type/9565_%20Move_Prefix_name_and_Prefix_type.md) Move_Prefix_name_and_Prefix_type design note.
2.2 [BridgePoint DEI #9721](https://support.onefact.net/issues/9721) Move of prefix mode in properties is incomplete
2.3 SRS-SAABSpring2017Issues-9501-v1.3

### 3. Background

This issue was raised due to the fact that attributes cannot be ordered if a parent is selected.  The original requirements only specified selecting an attribute.

### 4. Requirements

4.1 Order shall match the following even if a parent of the Attribute class is selected.

- Array Dimensions
- Attribute Name
- Attribute Name Prefix
- Prefix Mode
- Attribute Root Name

### 5. Analysis
The work done for [[2.1]](2.1) looks at the current model selection to enable a specific sorter for the given property entries. The selection in this case must be an Attribute.

We get a list of property sheet entries which only have "Display Name" to check against.  This can allow us to check the count of property sheet entries or the display name to determine if the attribute sorter should do something.  The "Display Name" property can match other entries, which will cause the attribute sorter to break the order.  Consider "Description" as the display name.  A good number of elements have that attribute and "Display Name" property.  The count is likely not a good check either as many other ooaofooa classes may equal that count.

5.1 Options

5.1.1 Two approaches that we could use are detailed in the initial issues analysis.  They are sections 5.1.1 and 5.1.2.2 of [[2.1]](#2.1).  Those approaches allow us to just control the O_ATTR attributes.  In the 5.1.1 section we simply adjust the Pfx_Mode UI attribute name which allows the alpha-numeric sorter to put the entry in the correct place.  In the 5.1.2.2 section we would actually reorder the meta-model attribute for Pfx_Mode and not use the alpha-numeric ordering.
5.1.2 We could determine a way to take control of property sheet entry creation.  If we can take over creation of the IPropertySheetEntry classes we can simply store the root element for the entries.  This will let us check for an Attribute_c root and use the sorter appropriately.
5.1.3 Each individual "Display Name" value could be considered, and if they match we could just initiate the attribute entry sorter always.  This needs a good amount of consideration put to the effect on performance.

5.2 Suggestion

After analysis it is believed that option [[5.1.1]](#5.1.1) will be the best.  The chosen option [[5.1.1]](#5.1.1) was discounted in the prior analysis because the thinking was that introducing a new sorting mechanism would be flexible and allow further sorting with other elements. However, the prior analysis did not consider the parent selection. This approach resolves the parent selection issue called out by this analysis.

### 6. Work Required

6.1 Change description for the O_ATTR class to use the name Attribute Prefix Mode
6.2 Add automated tests for acceptance tests.
6.3 Adjust expected property name and assure original tests from [[2.1]](#2.1) pass.

### 7. Acceptance Test

7.1 For each of the following selections (paths to model elements):

* System
* System::Package
* System::Package::ModelClass
* System::Package::ModelClass::Attribute
* System::Package::ImportedClass

7.1.1 Result ordering for the attribute shall match that stated in the Requirement section
7.2 Run properties tests
7.2.1 Result is there are no failures

### End


text:
Disrings-cpp
------------

A RingBuffer Library like disruptor (written by C/C++).


text:
package com.webbiko.pontointeligente.api;

import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
public abstract class BaseTest {

}


text:
module Superlogger
  class ActionViewLogSubscriber < ActiveSupport::LogSubscriber
    def render_template(event)
      payload = event.payload

      logger.debug view: payload[:identifier].split('/').last, duration: event.duration.round(1)
    end
    alias :render_partial :render_template
    alias :render_collection :render_template
  end
end

Superlogger::ActionViewLogSubscriber.attach_to :action_view


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

public class DeletePrefixFromTextFile
{
    internal static void Main()
    {
        const string GivenStr = "start";

        string inputName = "input.txt";
        ////string outputName = "output.txt";

        StringBuilder myReadBuilder = new StringBuilder();
        StringBuilder myWriteBuilder = new StringBuilder();

        if (!File.Exists(inputName))
        {
            string createText = "startMovie" + " " + "startAudio" + Environment.NewLine +
                                "softStart" + " " + "ebasiMamata" + Environment.NewLine +
                                "start" + Environment.NewLine +
                                "startstart" + Environment.NewLine;

            File.WriteAllText(inputName, createText);
        }

        using (StreamReader myReader = new StreamReader(inputName))
        {
            for (string readLine = myReader.ReadLine(); readLine != null; readLine = myReader.ReadLine())
            {
                for (int i = 0; i < readLine.Length; i++)
                {
                    myReadBuilder.Append(readLine[i]);

                    if ((!char.IsLetter(readLine[i]) && !char.IsDigit(readLine[i])) || i == readLine.Length - 1)
                    {
                        if (!myReadBuilder.ToString().StartsWith(GivenStr))
                        {
                            myWriteBuilder.Append(myReadBuilder);
                            myReadBuilder.Clear();
                        }
                        else
                        {
                            myReadBuilder.Clear();
                        }
                    }
                }

                if (myWriteBuilder.ToString() != string.Empty)
                {
                    myWriteBuilder.Append(Environment.NewLine);
                }
            }
        }

        using (StreamWriter myWriter = new StreamWriter(inputName))
        {
            myWriter.WriteLine(myWriteBuilder);
        }

        ////using(StreamReader myReader = new StreamReader(inputName))
        ////{
        ////    while (!myReader.EndOfStream)
        ////    {
        ////        string readLine = myReader.ReadLine();
        ////        string[] separatedWords = readLine
        ////            .Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries)
        ////            .Where(x => !x.StartsWith("start", StringComparison.OrdinalIgnoreCase))
        ////            .ToArray();

        ////        if (separatedWords.Length != 0)
        ////        {
        ////            myWriteBuilder.AppendLine(String.Join(" ", separatedWords));
        ////        }
        ////    }
        ////}

        ////using (StreamWriter myWriter = new StreamWriter(outputName))
        ////{
        ////    myWriter.Write(myWriteBuilder);
        ////}
    }
}


text:
//   Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
//
// 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.

#pragma once

#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/framework/tensor.h"

#ifdef PADDLE_WITH_MKLML
#include "paddle/fluid/platform/dynload/mklml.h"
#endif

#ifdef PADDLE_WITH_LIBXSMM
#include <libxsmm.h>
#endif

#ifdef PADDLE_USE_OPENBLAS
#include <cblas.h>
#endif

namespace paddle {
namespace operators {
namespace math {

/**
 * Matrix Descriptor of a memory buffer.
 *
 * It is used for Blas::MatMul. MatMul operator can be batched.
 * if Mat A is [BatchSize, H, W], Mat B is [BatchSize, H, W]. It will be a
 * `batch_size` times of GEMM. The batched GEMM could be faster base on the
 * implementation of the blas library. The batch size could be zero. If any
 * matrix of `matmul` has a batch size, the will be a batched GEMM, too. e.g.,
 * Mat A is [BatchSize, H1, W2], and Mat B [H2, W2], The result matrix wil be
 * [BatchSize, H1, W2]
 *
 * The boolean flag, `trans`, describe the memory is the transpose of matrix or
 * not. If the trans is true, the last two dims of matrix are transposed. The
 * memory layout of the matrix is [Width, Height] or [BatchSize, Width, Height].
 *
 * The MatDescriptor is not only the dimension or shape of a matrix, it also
 * contains the layout, stride of matrix. It is clearer to have a structure than
 * reuse `DDim`.
 */
struct MatDescriptor {
  int64_t height_;
  int64_t width_;
  int64_t stride_{0};
  int64_t batch_size_{0};
  bool trans_;
};

/**
 * Create Matrix Descriptor from a tensor dim, num_flatten_cols, and transpose
 * flag
 *
 * @param tensor_dim: The dimension of the tensor. The rank of this dimension
 * must larger than 1.
 *
 * @param num_flatten_cols:  Reshape a tensor to a matrix. The matrix's first
 * dimension(column length) will be the product of tensor's first `num_col_dims`
 * dimensions. If num_flatten_cols is zero, the first N-2 dimension will be the
 * batch_size of descriptor.
 *
 * @param trans: True if the matrix is transposed.
 */
extern MatDescriptor CreateMatrixDescriptor(const framework::DDim& tensor_dim,
                                            int num_flatten_cols, bool trans);

template <typename DeviceContext>
class Blas {
 public:
  explicit Blas(const DeviceContext& context) : context_(context) {}

  template <typename T>
  void GEMM(CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB, int M, int N, int K,
            T alpha, const T* A, const T* B, T beta, T* C) const;

  template <typename T>
  void GEMM(bool transA, bool transB, int M, int N, int K, T alpha, const T* A,
            int lda, const T* B, int ldb, T beta, T* C, int ldc) const;

  template <typename T>
  void MatMul(const framework::Tensor& mat_a, bool trans_a,
              const framework::Tensor& mat_b, bool trans_b, T alpha,
              framework::Tensor* mat_out, T beta) const;

  template <typename T>
  void MatMul(const framework::Tensor& mat_a, bool trans_a,
              const framework::Tensor& mat_b, bool trans_b,
              framework::Tensor* mat_out) const {
    MatMul(mat_a, trans_a, mat_b, trans_b, static_cast<T>(1.0), mat_out,
           static_cast<T>(0.0));
  }

  template <typename T>
  void MatMul(const framework::Tensor& mat_a, const framework::Tensor& mat_b,
              framework::Tensor* mat_out) const {
    this->template MatMul<T>(mat_a, false, mat_b, false, mat_out);
  }

  template <typename T>
  void AXPY(int n, T alpha, const T* x, T* y) const;

  template <typename T>
  void VADD(int n, const T* x, const T* y, T* z) const;

  template <typename T>
  void VCOPY(int n, const T* x, T* y) const;

  template <typename T>
  void GEMV(bool trans_a, int M, int N, T alpha, const T* A, const T* B, T beta,
            T* C) const;

  template <typename T>
  void BatchedGEMM(CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB, int M, int N,
                   int K, T alpha, const T* A, const T* B, T beta, T* C,
                   int batchCount, int64_t strideA, int64_t strideB) const;

  template <typename T>
  void MatMul(const framework::Tensor& mat_a, const MatDescriptor& dim_a,
              const framework::Tensor& mat_b, const MatDescriptor& dim_b,
              T alpha, framework::Tensor* mat_out, T beta) const;

 private:
  const DeviceContext& context_;
};

template <typename DeviceContext, typename T>
class BlasT : private Blas<DeviceContext> {
 public:
  using Blas<DeviceContext>::Blas;

  template <typename... ARGS>
  void GEMM(ARGS... args) const {
    Base()->template GEMM<T>(args...);
  }

  template <typename... ARGS>
  void MatMul(ARGS... args) const {
    Base()->template MatMul<T>(args...);
  }

  template <typename... ARGS>
  void AXPY(ARGS... args) const {
    Base()->template AXPY<T>(args...);
  }

  template <typename... ARGS>
  void VADD(ARGS... args) const {
    Base()->template VADD<T>(args...);
  }

  template <typename... ARGS>
  void VCOPY(ARGS... args) const {
    Base()->template VCOPY<T>(args...);
  }

  template <typename... ARGS>
  void GEMV(ARGS... args) const {
    Base()->template GEMV<T>(args...);
  }

  template <typename... ARGS>
  void BatchedGEMM(ARGS... args) const {
    Base()->template BatchedGEMM<T>(args...);
  }

 private:
  const Blas<DeviceContext>* Base() const {
    return static_cast<const Blas<DeviceContext>*>(this);
  }
};

template <typename DeviceContext, typename T>
inline BlasT<DeviceContext, T> GetBlas(
    const framework::ExecutionContext& exe_ctx) {
  return BlasT<DeviceContext, T>(
      exe_ctx.template device_context<DeviceContext>());
}

template <typename DeviceContext, typename T>
inline BlasT<DeviceContext, T> GetBlas(const DeviceContext& dev_ctx) {
  return BlasT<DeviceContext, T>(dev_ctx);
}

}  // namespace math
}  // namespace operators
}  // namespace paddle

#include "paddle/fluid/operators/math/blas_impl.h"
#ifdef PADDLE_WITH_CUDA
#include "paddle/fluid/operators/math/blas_impl.cu.h"
#endif


text:
Coordinator::Coordinator(JSONParser& courseRepo, Config& _options) {
    catalog = courseRepo.getCatalog();
    options = _options;
}

Coordinator::~Coordinator() {
    catalog.clear();
}

vector<Schedule> Coordinator::buildSchedules() {
    cout << "\n\n*** BUILDING SCHEDULES ***\n\n";
    vector<Schedule> scheduleOptions;
    vector<CourseID> courseList = options.getCourseList();

    sortCourseList(courseList);

    for(int i=0; i<courseList.size(); ++i) {
        cout << "adding " << courseList[i].getDept() << " " << courseList[i].getCourse() << " sections..." << endl;
        if(i == 0)
            insertInitialCourse(courseList[0], scheduleOptions);
        else
            insertNthCourse(courseList[i], scheduleOptions);
    }

    return scheduleOptions;
}

void Coordinator::sortCourseList(vector<CourseID>& courseList){
    sort(courseList.begin(), courseList.end(), [&](const CourseID& a, CourseID& b) -> bool{
        int sizeA = catalog[a.getDept()][a.getCourse()].size();
        int sizeB = catalog[b.getDept()][b.getCourse()].size();
        return sizeA < sizeB;
    });
}

void Coordinator::insertNthCourse(CourseID& id, vector<Schedule>& scheduleOptions) {
    string deptKey = id.getDept();
    string crseKey = id.getCourse();
    json sections = catalog[deptKey][crseKey];

    vector<Schedule> tempContainer;
    for(Schedule current : scheduleOptions) {
        for(json::iterator it = sections.begin(); it != sections.end(); ++it){
            Course c (it.value());

            if(meetsNthCourseCriteria(current, c)) {
                Schedule copy(current);
                copy.add(c);
                tempContainer.push_back(copy);
            }
        }
    }
    scheduleOptions = tempContainer;
}

void Coordinator::insertInitialCourse(CourseID& id, vector<Schedule>& scheduleOptions) {
    string deptKey = id.getDept();
    string crseKey = id.getCourse();
    json sections = catalog[deptKey][crseKey];

    for(json::iterator it = sections.begin(); it != sections.end(); ++it){
        Schedule s;
        Course c (it.value());

        if(meetsInitialCourseCriteria(c)){
            s.add(c);
            scheduleOptions.push_back(s);
        }
    }
}

bool Coordinator::meetsInitialCourseCriteria(Course& c) {
    bool result = capacityIsPositive(c)
               && meetsHonorsCriteria(c)
               && meetsMinTimeCriteria(c)
               && meetsMaxTimeCriteria(c)
               && meetsDaysDesiredCriteria(c)
               && meetsRealisticFilterCriteria(c);

    return result;
}

bool Coordinator::meetsNthCourseCriteria(Schedule& s, Course& c) {
    bool result = meetsInitialCourseCriteria(c)
               && s.concursWith(c);

    return result;
}

bool Coordinator::capacityIsPositive(Course& c) {
    return c.getCap() > 0;
}

bool Coordinator::meetsHonorsCriteria(Course& c) {
    bool honorsFlag = options.getHonorsFlag();
    bool isHonors = c.isHonors();

    return (honorsFlag || !isHonors) ? true : false;
}

bool Coordinator::meetsMinTimeCriteria(Course& c) {
    Moment min = options.getMinTime();

    if(min == Moment("12:00 am"))
        return true;
    else {
        vector<Meeting> times = c.getMeetingTimes();

        for(Meeting m : times) {
            if(m.getStartTime() < min)
                return false;
        }
        return true;
    }
}

bool Coordinator::meetsMaxTimeCriteria(Course& c) {
    Moment max = options.getMaxTime();

    if(max == Moment("12:00 am"))
        return true;
    else {
        vector<Meeting> times = c.getMeetingTimes();

        for(Meeting m : times) {
            if(max < m.getEndTime())
                return false;
        }
        return true;
    }
}

bool Coordinator::meetsDaysDesiredCriteria(Course& c) {
    string desiredDays = options.getDesiredDays();

    if(desiredDays == "MTWRF")
        return true;
    else {
        vector<Meeting> times = c.getMeetingTimes();

        for(Meeting m : times) {
            if(desiredDays.find(m.getDay()) == string::npos)
                return false;
        }
        return true;
    }
}

bool Coordinator::meetsRealisticFilterCriteria(Course& c) {
    bool filterFlag = options.getFilterByCapacityFlag();

    if(!filterFlag)
        return true;
    else
        return (c.getRem() <= 0) ? false : true;
}


text:
#include "BundleManifest.h"

#include "jsoncpp.h"

#include <stdexcept>

namespace cppmicroservices {

namespace {

typedef std::map<std::string, Any> AnyOrderedMap;
typedef std::vector<Any> AnyVector;

void ParseJsonObject(const Json::Value& jsonObject, AnyMap& anyMap);
void ParseJsonObject(const Json::Value& jsonObject, AnyOrderedMap& anyMap);
void ParseJsonArray(const Json::Value& jsonArray, AnyVector& anyVector, bool ci);

Any ParseJsonValue(const Json::Value& jsonValue, bool ci)
{
  if (jsonValue.isObject())
  {
    if (ci)
    {
      Any any = AnyMap(AnyMap::UNORDERED_MAP_CASEINSENSITIVE_KEYS);
      ParseJsonObject(jsonValue, ref_any_cast<AnyMap>(any));
      return any;
    }
    else
    {
      Any any = AnyOrderedMap();
      ParseJsonObject(jsonValue, ref_any_cast<AnyOrderedMap>(any));
      return any;
    }
  }
  else if (jsonValue.isArray())
  {
    Any any = AnyVector();
    ParseJsonArray(jsonValue, ref_any_cast<AnyVector>(any), ci);
    return any;
  }
  else if (jsonValue.isString())
  {
    // We do not support attribute localization yet, so we just
    // always remove the leading '%' character.
    std::string val = jsonValue.asString();
    if (!val.empty() && val[0] == '%')
      val = val.substr(1);

    return Any(val);
  }
  else if (jsonValue.isBool())
  {
    return Any(jsonValue.asBool());
  }
  else if (jsonValue.isDouble())
  {
    return Any(jsonValue.asDouble());
  }
  else if (jsonValue.isIntegral())
  {
    return Any(jsonValue.asInt());
  }

  return Any();
}

void ParseJsonObject(const Json::Value& jsonObject, AnyOrderedMap& anyMap)
{
  for (Json::Value::const_iterator it = jsonObject.begin();
       it != jsonObject.end(); ++it)
  {
    const Json::Value& jsonValue = *it;
    Any anyValue = ParseJsonValue(jsonValue, false);
    if (!anyValue.Empty())
    {
      anyMap.insert(std::make_pair(it.memberName(), anyValue));
    }
  }
}

void ParseJsonObject(const Json::Value& jsonObject, AnyMap& anyMap)
{
  for (Json::Value::const_iterator it = jsonObject.begin();
       it != jsonObject.end(); ++it)
  {
    const Json::Value& jsonValue = *it;
    Any anyValue = ParseJsonValue(jsonValue, true);
    if (!anyValue.Empty())
    {
      anyMap.insert(std::make_pair(it.memberName(), anyValue));
    }
  }
}

void ParseJsonArray(const Json::Value& jsonArray, AnyVector& anyVector,
                    bool ci)
{
  for (Json::Value::const_iterator it = jsonArray.begin();
       it != jsonArray.end(); ++it)
  {
    const Json::Value& jsonValue = *it;
    Any anyValue = ParseJsonValue(jsonValue, ci);
    if (!anyValue.Empty())
    {
      anyVector.push_back(anyValue);
    }
  }
}

}

BundleManifest::BundleManifest()
  : m_Headers(AnyMap::UNORDERED_MAP_CASEINSENSITIVE_KEYS)
{
}

void BundleManifest::Parse(std::istream& is)
{
  Json::Value root;
  Json::Reader jsonReader(Json::Features::strictMode());
  if (!jsonReader.parse(is, root, false))
  {
    throw std::runtime_error(jsonReader.getFormattedErrorMessages());
  }

  if (!root.isObject())
  {
    throw std::runtime_error("The Json root element must be an object.");
  }

  // This is deprecated in 3.0
  ParseJsonObject(root, m_PropertiesDeprecated);

  ParseJsonObject(root, m_Headers);
}

AnyMap BundleManifest::GetHeaders() const
{
  return m_Headers;
}

bool BundleManifest::Contains(const std::string& key) const
{
  return m_Headers.count(key) > 0;
}

Any BundleManifest::GetValue(const std::string& key) const
{
  auto iter = m_Headers.find(key);
  if (iter != m_Headers.end())
  {
    return iter->second;
  }
  return Any();
}

Any BundleManifest::GetValueDeprecated(const std::string& key) const
{
  auto iter = m_PropertiesDeprecated.find(key);
  if (iter != m_PropertiesDeprecated.end())
  {
    return iter->second;
  }
  return Any();
}

std::vector<std::string> BundleManifest::GetKeysDeprecated() const
{
  std::vector<std::string> keys;
  for (AnyMap::const_iterator iter = m_PropertiesDeprecated.begin();
       iter != m_PropertiesDeprecated.end(); ++iter)
  {
    keys.push_back(iter->first);
  }
  return keys;
}

std::map<std::string, Any> BundleManifest::GetPropertiesDeprecated() const
{
  return m_PropertiesDeprecated;
}

}


text:
package org.plasma.sdo.access.provider.common;

import java.util.List;

import org.plasma.sdo.PlasmaDataObject;

public interface CommitCollector {
  public List<PlasmaDataObject> getResult();
}


text:
remoteApiRule.fieldNamingMapping = function() {
  return { // empty means no conversion at all parts
  };
}

// test of suffix hell e.g. result result headache
remoteApiRule.nestClassName = function(api, className) {
  // For example, remote side uses Spring Framework
  return className.replace(/(Part|Model|Bean)$/, '') + 'Part';
}


text:
package org.apache.ivyde.internal.eclipse.ui.preferences;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashSet;
import java.util.Set;

/**
 * Constant definitions for plug-in preferences
 */
public final class PreferenceConstants {

    private PreferenceConstants() {
        // utility class
    }

    public static final String IVYSETTINGS_PATH = "ivy_conf_path";

    public static final String ORGANISATION = "ivy_org";

    public static final String ORGANISATION_URL = "ivy_org_url";

    public static final String ACCEPTED_TYPES = "acceptedTypes";

    public static final String SOURCES_TYPES = "sourceTypes";

    public static final String SOURCES_SUFFIXES = "sourceSuffixes";

    public static final String JAVADOC_TYPES = "javadocTypes";

    public static final String JAVADOC_SUFFIXES = "javadocSuffixes";

    public static final String P_BOOLEAN = "booleanPreference";

    public static final String P_CHOICE = "choicePreference";

    public static final String P_STRING = "stringPreference";

    public static final String DO_RETRIEVE_DEPRECATED = "do.retreive";

    public static final String RETRIEVE_PATTERN_DEPRECATED = "retreive.pattern";

    public static final String DO_RETRIEVE = "do.retrieve";

    public static final String RETRIEVE_PATTERN = "retrieve.pattern";

    public static final String RETRIEVE_SYNC = "retrieve.sync";

    public static final String RETRIEVE_CONFS = "retrieve.confs";

    public static final String RETRIEVE_TYPES = "retrieve.types";

    public static final String ALPHABETICAL_ORDER = "order.alphabetical";

    public static final String RESOLVE_IN_WORKSPACE = "resolveInWorkspace";

    public static final String TRANSITIVE_RESOLVE = "transitiveResolve";

    public static final String READ_OSGI_METADATA = "readOSGIMetadata";

    public static final String RESOLVE_BEFORE_LAUNCH = "resolveBeforeLaunch";

    public static final String USE_EXTENDED_RESOLVE_ID = "useExtendedResolveId";

    public static final String PROPERTY_FILES = "propertyFiles";

    public static final String IVY_USER_DIR = "ivuUserDir";

    public static final String LOAD_SETTINGS_ON_DEMAND = "loadSettingsOnDemand";

    public static final String RESOLVE_ON_STARTUP = "resolveOnStartup";

    public static final String AUTO_RESOLVE_ON_OPEN = "autoResolve.open";

    public static final String AUTO_RESOLVE_ON_CLOSE = "autoResolve.close";

    public static final String AUTO_RESOLVE_ON_CHANGE = "autoResolve.change";

    public static final String IVY_CONSOLE_LOG_LEVEL = "ivyConsole.logLevel";

    public static final String IVY_CONSOLE_IVYDE_LOG_LEVEL = "ivyConsole.ivyDELogLevel";

    public static final String OPEN_IVY_CONSOLE_ON_STARTUP = "ivyConsole.openOnStartup";

    public static final String IGNORE_BRANCH_ON_WORKSPACE_PROJECTS
        = "workspaceResolver.ignoreBranch";

    public static final String IGNORE_VERSION_ON_WORKSPACE_PROJECTS
        = "workspaceResolver.ignoreVersion";

    public static final String EDITOR_COLOR_XML_COMMENT = "editor.color.xmlComment";

    public static final String EDITOR_COLOR_PROC_INSTR = "editor.color.procInstr";

    public static final String EDITOR_COLOR_STRING = "editor.color.string";

    public static final String EDITOR_COLOR_DEFAULT = "editor.color.default";

    public static final String EDITOR_COLOR_TAG = "editor.color.tag";

    public static final String RETRIEVED_CLASSPATH = "retrievedClasspath";

    public static final String RETRIEVED_CLASSPATH_PATTERN = "retrievedClasspath.pattern";

    public static final String RETRIEVED_CLASSPATH_SYNC = "retrievedClasspath.sync";

    public static final String RETRIEVED_CLASSPATH_TYPES = "retrievedClasspath.types";

    public static final String MAP_IF_ONLY_ONE_SOURCE = "mapIfOnlyOneSource";

    public static final String MAP_IF_ONLY_ONE_JAVADOC = "mapIfOnlyOneJavadoc";

    public static final String OFFLINE = "offline";

    public static final String ERROR_POPUP = "error.popup";

    public static final Set/*<String>*/ ALL = new HashSet();

    static {
        Field[] fields = PreferenceConstants.class.getFields();
        for (int i = 0; i < fields.length; i++) {
            if (Modifier.isStatic(fields[i].getModifiers())) {
                try {
                    ALL.add(fields[i].get(null));
                } catch (IllegalArgumentException e) {
                    throw new RuntimeException(e);
                } catch (IllegalAccessException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}


text:
from __future__ import print_function
from sys import stderr
import argparse
import os.path
from fqread import read_fastq, split_fastq_path, create_compressed_outfile

def trim_fastq(outdir, files, start, end, length, compression):
    """
    """
    if len(files) == 0:
        print("Error: no files provided", file=stderr)
        return

    elif length is not None:
        length_mode = True
        if start is not None and end is not None:
            if (end - start + 1) != length:
                print("Error: start/end/length do not agree", file=stderr)
                return
        elif end is not None: # start is None, so length should equal end
            if length != end:
                print("Error: length/end do not agree", file=stderr)
                return
        elif start is None:
            start = 1
    else:
        length_mode = False
        if start is None:
            start = 1

    for f in files:
        # open the output file
        _, base, ext, _ = split_fastq_path(f)
        outname = base + ".trim" + ext
        outname = os.path.join(outdir, outname)
        handle = create_compressed_outfile(outname, compression)

        # trim the reads and write them
        for read in read_fastq(f):
            if length_mode:
                read.trim_length(length, start)
            else:
                read.trim(start, end)
            print(read, file=handle)

        handle.close()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Trim reads in FASTQ files.")
    parser.add_argument("files", metavar="FQ", nargs="+",
                        help="FASTQ files to trim")
    parser.add_argument("-s", "--start", metavar="N",
                        help="start of trim region", type=int)
    parser.add_argument("-e", "--end", metavar="N",
                        help="end of trim region", type=int)
    parser.add_argument("-l", "--length", metavar="N",
                        help="length of trim region", type=int)
    parser.add_argument("-o", "--output", default=".", metavar="DIR",
                        help="output directory")
    parser.add_argument("--bz2", dest="compression", action="store_const",
                        const="bz2", default=None,
                        help="compress output with bzip2")
    parser.add_argument("--gz", dest="compression", action="store_const",
                        const="gz", default=None,
                        help="compress output with gzip")

    args = parser.parse_args()

    trim_fastq(args.output, args.files, args.start, args.end, args.length, args.compression)


text:
package ${package}.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

public class IdMapLoader<T> implements Loader<T> {
  private final Loader<T> innerLoader;
  private final String mapSubject;
  private final String mapPredicate;

  public IdMapLoader(
      final Loader<T> innerLoader, final String mapSubject, final String mapPredicate) {
    this.innerLoader = innerLoader;
    this.mapSubject = mapSubject;
    this.mapPredicate = mapPredicate;
  }

  public T load(
      final Object doc_,
      final String baseUri,
      final LoadingOptions loadingOptions,
      final String docRoot) {
    Object doc = doc_;
    if (doc instanceof Map) {
      final Map<String, Object> docMap = (Map<String, Object>) doc;
      final List<Object> asList = new ArrayList();
      final TreeSet<String> sortedKeys = new TreeSet<String>();
      sortedKeys.addAll(docMap.keySet());
      for (final String key : sortedKeys) {
        final Object el = docMap.get(key);
        if (el instanceof Map) {
          final Map<String, Object> v2 = new HashMap<String, Object>((Map<String, Object>) el);
          v2.put(this.mapSubject, key);
          asList.add(v2);
        } else {
          if (this.mapPredicate != null) {
            final Map<String, Object> v3 = new HashMap<String, Object>();
            v3.put(this.mapPredicate, el);
            v3.put(this.mapSubject, key);
            asList.add(v3);
          } else {
            throw new ValidationException("No mapPredicate");
          }
        }
      }
      doc = asList;
    }
    return this.innerLoader.load(doc, baseUri, loadingOptions);
  }
}


text:
'use strict';

/**
 * @ngdoc function
 * @name form2fileApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * Controller of the form2fileApp
 */
angular.module('form2fileApp')
  .controller('MainCtrl', ['$scope', function ($scope)
  {
  	$scope.formData = {};
  	$scope.file = {};
    $scope.processForm = function()
    {
      var form2File = new Blob([JSON.stringify($scope.formData)], {type: "text/plain;charset=utf-8"});

      //give a default filename and extension if none was typed in
      if($scope.file.name == undefined)
      {
        $scope.file.name = "form2file";
      }

      if($scope.file.extension == undefined)
      {
        $scope.file.extension = "txt";
      }

      saveAs(form2File, $scope.file.name + '.' + $scope.file.extension);
    };
  }]);


text:
/*--------------------------------------------------*/
/*                                                  */
/* The MIT License (MIT)                            */
/*                                                  */
/* Copyright (c) 2014 Mobily TEAM                   */
/*                                                  */
/* Permission is hereby granted, free of charge,    */
/* to any person obtaining a copy of this software  */
/* and associated documentation files               */
/* (the "Software"), to deal in the Software        */
/* without restriction, including without           */
/* limitation the rights to use, copy, modify,      */
/* merge, publish, distribute, sublicense,          */
/* and/or sell copies of the Software, and to       */
/* permit persons to whom the Software is furnished */
/* to do so, subject to the following conditions:   */
/*                                                  */
/* The above copyright notice and this permission   */
/* notice shall be included in all copies or        */
/* substantial portions of the Software.            */
/*                                                  */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT        */
/* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,        */
/* INCLUDING BUT NOT LIMITED TO THE WARRANTIES      */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR     */
/* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   */
/* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR   */
/* ANY CLAIM, DAMAGES OR OTHER LIABILITY,           */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR        */
/* OTHERWISE, ARISING FROM, OUT OF OR IN            */
/* CONNECTION WITH THE SOFTWARE OR THE USE OR       */
/* OTHER DEALINGS IN THE SOFTWARE.                  */
/*                                                  */
/*--------------------------------------------------*/
#define MOBILY_SOURCE
/*--------------------------------------------------*/

#import <MobilyCore/MobilyDataContainer+Private.h>

/*--------------------------------------------------*/

@implementation MobilyDataContainerSectionsList

#pragma mark Synthesize

@synthesize orientation = _orientation;
@synthesize margin = _margin;
@synthesize spacing = _spacing;
@synthesize pagingEnabled = _pagingEnabled;
@synthesize currentSection = _currentSection;

#pragma mark Init / Free

+ (instancetype)containerWithOrientation:(MobilyDataContainerOrientation)orientation {
    return [[self alloc] initWithOrientation:orientation];
}

- (instancetype)initWithOrientation:(MobilyDataContainerOrientation)orientation {
    self = [super init];
    if(self != nil) {
        _orientation = orientation;
    }
    return self;
}

- (void)setup {
    [super setup];

    _margin = UIEdgeInsetsZero;
    _spacing = UIOffsetZero;
}

#pragma mark Property

- (void)setAllowAutoAlign:(BOOL)allowAutoAlign {
    if(_allowAutoAlign != allowAutoAlign) {
        [super setAllowAutoAlign:allowAutoAlign];
        if(_pagingEnabled == YES) {
            self.pagingEnabled = NO;
        }
    }
}

- (void)setOrientation:(MobilyDataContainerOrientation)orientation {
    if(_orientation != orientation) {
        _orientation = orientation;
        if(_view != nil) {
            [_view setNeedValidateLayout];
        }
    }
}

- (void)setMargin:(UIEdgeInsets)margin {
    if(UIEdgeInsetsEqualToEdgeInsets(_margin, margin) == NO) {
        _margin = margin;
        if(_view != nil) {
            [_view setNeedValidateLayout];
        }
    }
}

- (void)setSpacing:(UIOffset)spacing {
    if(UIOffsetEqualToOffset(_spacing, spacing) == NO) {
        _spacing = spacing;
        if(_view != nil) {
            [_view setNeedValidateLayout];
        }
    }
}

- (void)setPagingEnabled:(BOOL)pagingEnabled {
    if(_pagingEnabled != pagingEnabled) {
        if(_pagingEnabled == YES) {
            _currentSection = nil;
        }
        _pagingEnabled = pagingEnabled;
        _allowAutoAlign = _pagingEnabled;
        if(_pagingEnabled == YES) {
            [self align];
        }
    }
}

- (void)setCurrentSectionIndex:(NSUInteger)currentSectionIndex {
    [self setCurrentSection:_sections[currentSectionIndex] animated:NO];
}

- (void)setCurrentSectionIndex:(NSUInteger)currentSectionIndex animated:(BOOL)animated {
    [self setCurrentSection:_sections[currentSectionIndex] animated:animated];
}

- (NSUInteger)currentSectionIndex {
    return [_sections indexOfObjectIdenticalTo:_currentSection];
}

- (void)setCurrentSection:(MobilyDataContainer*)currentSection {
    [self setCurrentSection:currentSection animated:NO];
}

- (void)setCurrentSection:(MobilyDataContainer*)currentSection animated:(BOOL)animated {
    if(_currentSection != currentSection) {
        _currentSection = currentSection;
        if((_pagingEnabled == YES) && (_currentSection != nil)) {
            [self scrollToSection:_currentSection scrollPosition:(MobilyDataViewPosition)_alignPosition animated:animated];
        }
    }
}

#pragma mark Public override

- (void)replaceOriginSection:(MobilyDataContainer*)originSection withSection:(MobilyDataContainer*)section {
    if((_pagingEnabled == YES) && (_currentSection == originSection)) {
        _currentSection = section;
    }
    [super replaceOriginSection:originSection withSection:section];
}

- (void)deleteSection:(MobilyDataContainer*)section {
    if((_pagingEnabled == YES) && (_currentSection == section)) {
        _currentSection = [_sections moNextObjectOfObject:_currentSection];
    }
    [super deleteSection:section];
}

- (void)deleteAllSections {
    if(_pagingEnabled == YES) {
        _currentSection = nil;
    }
    [super deleteAllSections];
}

#pragma mark Private override

- (void)_didEndDraggingWillDecelerate:(BOOL __unused)decelerate {
    [super _didEndDraggingWillDecelerate:decelerate];

    if((_pagingEnabled == YES) && (decelerate == NO)) {
        CGPoint alignPoint = [self alignPoint];
        for(MobilyDataContainer* section in _sections) {
            if(CGRectContainsPoint(section.frame, alignPoint) == YES) {
                _currentSection = section;
                [self fireEventForKey:MobilyDataContainerCurrentSectionChanged byObject:_currentSection];
                break;
            }
        }
    }
}

- (void)_didEndDecelerating {
    [super _didEndDecelerating];

    if(_pagingEnabled == YES) {
        CGPoint alignPoint = [self alignPoint];
        for(MobilyDataContainer* section in _sections) {
            if(CGRectContainsPoint(section.frame, alignPoint) == YES) {
                _currentSection = section;
                [self fireEventForKey:MobilyDataContainerCurrentSectionChanged byObject:_currentSection];
                break;
            }
        }
    }
}

- (void)_didEndUpdateAnimated:(BOOL)animated {
    [super _didEndUpdateAnimated:animated];

    if((_pagingEnabled == YES) && (_currentSection != nil)) {
        [self scrollToSection:_currentSection scrollPosition:(MobilyDataViewPosition)_alignPosition animated:animated];
    }
}

- (CGRect)_validateSectionsForAvailableFrame:(CGRect)frame {
    CGPoint offset = CGPointMake(frame.origin.x + _margin.left, frame.origin.y + _margin.top);
    CGSize restriction = CGSizeMake(frame.size.width - (_margin.left + _margin.right), frame.size.height - (_margin.left + _margin.right));
    CGSize cumulative = CGSizeZero;
    switch(_orientation) {
        case MobilyDataContainerOrientationVertical: {
            for(MobilyDataContainer* container in _sections) {
                CGRect containerFrame = [container _validateLayoutForAvailableFrame:CGRectMake(offset.x, offset.y, restriction.width, restriction.height)];
                if((CGRectIsNull(containerFrame) == NO) && (container.hidden == NO)) {
                    offset.y = (containerFrame.origin.y + containerFrame.size.height) + _spacing.vertical;
                    cumulative.width = MAX(containerFrame.size.width, restriction.width);
                    cumulative.height += containerFrame.size.height + _spacing.vertical;
                }
            }
            cumulative.height -= _spacing.vertical;
            break;
        }
        case MobilyDataContainerOrientationHorizontal: {
            for(MobilyDataContainer* container in _sections) {
                CGRect containerFrame = [container _validateLayoutForAvailableFrame:CGRectMake(offset.x, offset.y, restriction.width, restriction.height)];
                if((CGRectIsNull(containerFrame) == NO) && (container.hidden == NO)) {
                    offset.x = (containerFrame.origin.x + containerFrame.size.width) + _spacing.horizontal;
                    cumulative.width += containerFrame.size.width + _spacing.horizontal;
                    cumulative.height = MAX(containerFrame.size.height, restriction.height);
                }
            }
            cumulative.width -= _spacing.horizontal;
            break;
        }
    }
    return CGRectMake(frame.origin.x, frame.origin.y, _margin.left + cumulative.width + _margin.right, _margin.top + cumulative.height + _margin.bottom);
}

@end

/*--------------------------------------------------*/

NSString* MobilyDataContainerCurrentSectionChanged = @"MobilyDataContainerCurrentSectionChanged";

/*--------------------------------------------------*/


text:
import networkx as nx
from load_data import *
from compute_metrics_multiplex import *

def numNodes(g):
    return g.number_of_nodes()

def numEdges(g):
    return g.number_of_edges()

def avgDeg(g):
    return g.number_of_edges()*1.0/g.number_of_nodes()

def getGiantComponent(g):
    return g.subgraph(max([key for key in nx.strongly_connected_components(g)],key=len))

def diameter(g):
    return nx.diameter(getGiantComponent(g))

def avgPathLen(g):
    return nx.average_shortest_path_length(getGiantComponent(g))

def nodesInGiantComponent(g):
    return getGiantComponent(g).number_of_nodes()

def edgesInGiantComponent(g):
    return getGiantComponent(g).number_of_edges()

def assortativity(g):
    return nx.degree_assortativity_coefficient(g,x="in",y="in")

stats = { "# nodes":numNodes, "# edges":numEdges, "Avg. degree":avgDeg , "Diameter":diameter,"Avg. path length":avgPathLen,\
 "# Nodes in GC":nodesInGiantComponent,"# Edges in GC":edgesInGiantComponent,\
          "Assortativity":assortativity}

def getHeader():
    res = "\t"
    for stat in stats:
        res += ","+stat
    return res

def getStatsForGraph(g):
    res = g.graph["title"][4:]
    for stat in stats:
        res += ","+str(stats[stat](g))
    return res

def getGlobalStatsFromAttribute(graphs,graph_combinations=[],metrics=[]):
    res = graphs[0].graph["title"][:3]
    for metric in metrics:
        res += ","+metric

    for i,k in graph_combinations:
        gi,gk = graphs[i],graphs[k]
        if i == k:
            res += "\n"+gi.graph["title"][4:]
        else:
            res += "\n"+gi.graph["title"][4:]+"->"+gk.graph["title"][4:]
        for metric in metrics:
            attribute_name = "Global "+getMetricString(metric,gi,gk)
            res += ",{0:.3f}".format(gi.graph[attribute_name])
    return res

def getStatsDistributionFromAttribute(graphs,graph_combinations=[],metrics=[]):
    res = graphs[0].graph["title"][:3]+"\n"

    for i,k in graph_combinations:
        g = graphs[i]
        res += "\n"+g.graph["title"][4:]+"\nid"
        for metric in metrics:
            res += ","+metric
        res += ",#out_edges,#in_edges\n"
        for node in range(g.number_of_nodes()):
            res += str(node)+","
            for metric in metrics:
                attribute_name = getMetricString(metric,g,g)
                value = g.graph[attribute_name][node]
                res += '{0:.3f}'.format(value)+","
            res +=  str(len(g.out_edges(node)))+","+str(len(g.in_edges(node)))+"\n"
    return res

def getStasForDataset(dataset="wan"):
    graphs,node_mapping = load_4_layers(dataset)
    #metrics = metrics_dict_multiplex.copy()
    #del metrics["Overlapping Index"]
    metrics = {"Reciprocity":reciprocity,"tp1":tp1,"tp2":tp2,\
    "tc1":tc1,"tc2":tc2}
    temp = [(i,i) for i in range(len(graphs))]
    addMetricsAsAttributesMultiplex(graphs,temp,metrics)
    res = getGlobalStatsFromAttribute(graphs,temp,metrics)
    res += "\n"
    res += "\n"

    #res += "Multiplex"
    #res += "\n"
    #res += "\n"
    #metrics = metrics_dict_multiplex.copy()
    #temp = graph_combinations+[(k,i) for i,k in graph_combinations]
    #addMetricsAsAttributesMultiplex(graphs,temp,metrics)
    #res += getGlobalStatsFromAttribute(graphs,temp,metrics)

    return res

def getSingleStatsForDataset(dataset="wan"):
    graphs,node_mapping = load_4_layers(dataset)
    temp = [(i,i) for i in range(len(graphs))]
    metrics = {"Reciprocity":reciprocity,"tp1":tp1,"tp2":tp2,\
    "tc1":tc1,"tc2":tc2}
    addMetricsAsAttributesMultiplex(graphs,temp,metrics)
    res = getStatsDistributionFromAttribute(graphs,temp,metrics)
    return res

from csv_to_latex_table import *

def main():
    with open("wan_table_56.csv","w") as pout:
        pout.write(get56TablesForDataset("wan"))
    with open("bms_table_56.csv","w") as pout:
        pout.write(get56TablesForDataset("bms"))

    table_from_csv("wan_table_56.txt","wan_table_56.csv")
    table_from_csv("bms_table_56.txt","bms_table_56.csv")

if __name__ == "__main__":
    main()


text:
#ifndef h2o__http2__casper_h
#define h2o__http2__casper_h

#include <stddef.h>
#include <stdlib.h>
#include "h2o/memory.h"

typedef struct st_h2o_http2_casper_t h2o_http2_casper_t;

/**
 * creates an object with provided parameters
 */
h2o_http2_casper_t *h2o_http2_casper_create(unsigned capacity_bits, unsigned remainder_bits);
/**
 * destroys the object and resources associated to it
 */
void h2o_http2_casper_destroy(h2o_http2_casper_t *casper);
/**
 * returns the number of keys stored
 */
size_t h2o_http2_casper_num_entries(h2o_http2_casper_t *casper);
/**
 * checks if a key is (was) marked as cached at the moment the fuction is invoked
 */
int h2o_http2_casper_lookup(h2o_http2_casper_t *casper, const char *path, size_t path_len, const char *etag, size_t etag_len,
                            int set);
/**
 * consumes the `Cookie` headers in requests and updates the structure
 */
void h2o_http2_casper_consume_cookie(h2o_http2_casper_t *casper, const char *cookie, size_t cookie_len);
/**
 * returns the value of the `Set-Cookie` header that should be sent to the client
 */
h2o_iovec_t h2o_http2_casper_get_cookie(h2o_http2_casper_t *casper);

#endif


text:
static uint32_t nums[256];

// These are all the incomplete operations
static std::map<int64_t, hyperclient_returncode*> incompleteops;

static const char* space = "replication";
static const char* host = "127.0.0.1";
static po6::net::ipaddr coord(host);
static long port = 1234;
static long prefix = 3;

static void
find_hashes();

static void
test0(hyperclient* cl);
static void
test1(hyperclient* cl);
static void
test2(hyperclient* cl);
static void
test3(hyperclient* cl);
static void
test4(hyperclient* cl);

class generator
{
    public:
        static uint32_t end()
        {
            bool looped = false;
            uint32_t ret = 0;

            for (generator i; i.has_next(); i.next())
            {
                looped = true;
                ret = i;
            }

            assert(looped);
            return ret;
        }

    public:
        generator() : m_i(0) {}

    public:
        bool has_next() const { return m_i < 256; }

    public:
        void next()
        {
            uint32_t current = (m_i >> (8 - prefix));

            while (m_i < 256 && current == (m_i >> (8 - prefix)))
            {
                ++ m_i;
            }
        }

    public:
        operator uint32_t () const { return nums[m_i]; }

    private:
        uint32_t m_i;
};

extern "C"
{

static struct poptOption popts[] = {
    POPT_AUTOHELP
    {"prefix", 'P', POPT_ARG_LONG, &prefix, 'P',
        "the size of the prefix used when creating the space",
        "number"},
    {"space", 's', POPT_ARG_STRING, &space, 's',
        "the HyperDex space to use",
        "space"},
    {"host", 'h', POPT_ARG_STRING, &host, 'h',
        "the IP address of the coordinator",
        "IP"},
    {"port", 'p', POPT_ARG_LONG, &port, 'p',
        "the port number of the coordinator",
        "port"},
    POPT_TABLEEND
};

} // extern "C"

int
main(int argc, const char* argv[])
{
    poptContext poptcon;
    poptcon = poptGetContext(NULL, argc, argv, popts, POPT_CONTEXT_POSIXMEHARDER);
    e::guard g = e::makeguard(poptFreeContext, poptcon);
    g.use_variable();
    int rc;

    while ((rc = poptGetNextOpt(poptcon)) != -1)
    {
        switch (rc)
        {
            case 'P':
                if (prefix < 0)
                {
                    std::cerr << "prefix must be >= 0" << std::endl;
                    return EXIT_FAILURE;
                }

                if (prefix > 64)
                {
                    std::cerr << "prefix must be <= 64" << std::endl;
                    return EXIT_FAILURE;
                }

                break;
            case 's':
                break;
            case 'h':
                try
                {
                    coord = po6::net::ipaddr(host);
                }
                catch (po6::error& e)
                {
                    std::cerr << "cannot parse coordinator address" << std::endl;
                    return EXIT_FAILURE;
                }
                catch (std::invalid_argument& e)
                {
                    std::cerr << "cannot parse coordinator address" << std::endl;
                    return EXIT_FAILURE;
                }

                break;
            case 'p':
                if (port < 0 || port >= (1 << 16))
                {
                    std::cerr << "port number out of range for TCP" << std::endl;
                    return EXIT_FAILURE;
                }

                break;
            case POPT_ERROR_NOARG:
            case POPT_ERROR_BADOPT:
            case POPT_ERROR_BADNUMBER:
            case POPT_ERROR_OVERFLOW:
                std::cerr << poptStrerror(rc) << " " << poptBadOption(poptcon, 0) << std::endl;
                return EXIT_FAILURE;
            case POPT_ERROR_OPTSTOODEEP:
            case POPT_ERROR_BADQUOTE:
            case POPT_ERROR_ERRNO:
            default:
                std::cerr << "logic error in argument parsing" << std::endl;
                return EXIT_FAILURE;
        }
    }

    find_hashes();

    try
    {
        hyperclient cl(host, port);

        test0(&cl);
        test1(&cl);
        test2(&cl);
        test3(&cl);
        test4(&cl);
    }
    catch (po6::error& e)
    {
        std::cerr << "There was a system error:  " << e.what();
        return EXIT_FAILURE;
    }
    catch (std::runtime_error& e)
    {
        std::cerr << "There was a runtime error:  " << e.what();
        return EXIT_FAILURE;
    }
    catch (std::bad_alloc& e)
    {
        std::cerr << "There was a memory allocation error:  " << e.what();
        return EXIT_FAILURE;
    }
    catch (std::exception& e)
    {
        std::cerr << "There was a generic error:  " << e.what();
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}

static void
find_hashes()
{
    bool found[256];
    size_t complete = 0;

    for (size_t i = 0; i < 256; ++i)
    {
        found[i] = false;
    }

    std::vector<hyperspacehashing::hash_t> hashes(1, hyperspacehashing::EQUALITY);
    hyperspacehashing::prefix::hasher hasher(hashes);

    for (uint32_t value = 0; complete < 256; ++value)
    {
        e::slice key(&value, sizeof(uint32_t));
        uint64_t hash = hasher.hash(key).point;
        unsigned high_byte = (hash >> 56) & 0xff;

        if (!found[high_byte])
        {
            found[high_byte] = true;
            nums[high_byte] = value;
            ++complete;
        }
    }

    const char* terminator = "";
    const char* sep;
    std::cout << "Hashes turn out to be:\n";

    for (size_t i = 0; i < 256; ++i)
    {
        if (i % 16 == 0)
        {
            std::cout << terminator << std::setw(4) << i;
            sep = " [";
            terminator = "]\n";
        }

        std::cout << sep << std::setw(4) << nums[i];
        sep = ", ";
    }

    std::cout << "]\n" << std::endl;
}

static void
success(int testno)
{
    std::cout << "Test " << testno << ":  [\x1b[32mOK\x1b[0m]\n";
}

#define FAIL(TESTNO, REASON) \
    do { \
    std::cout << "Test " << TESTNO << ":  [\x1b[31mFAIL\x1b[0m]\n" \
              << "location: " << __FILE__ << ":" << __LINE__ << "\n" \
              << "reason:  " << REASON << "\n"; \
    abort(); \
    } while (0)

static void
put(int testno,
    hyperclient* cl,
    uint32_t A, uint32_t B, uint32_t C)
{
    hyperclient_attribute attrs[2];
    attrs[0].attr = "B";
    attrs[0].value = reinterpret_cast<const char*>(&B);
    attrs[0].value_sz = sizeof(uint32_t);
    attrs[0].datatype = HYPERDATATYPE_STRING;
    attrs[1].attr = "C";
    attrs[1].value = reinterpret_cast<const char*>(&C);
    attrs[1].value_sz = sizeof(uint32_t);
    attrs[1].datatype = HYPERDATATYPE_STRING;
    hyperclient_returncode* status = new hyperclient_returncode();
    int64_t id = cl->put(space, reinterpret_cast<const char*>(&A), sizeof(uint32_t), attrs, 2, status);

    if (id < 0)
    {
        FAIL(testno, "put encountered error " << status);
    }

    std::pair<std::map<int64_t, hyperclient_returncode*>::iterator, bool> res;
    res = incompleteops.insert(std::make_pair(id, status));

    if (res.second != true)
    {
        FAIL(testno, "put could not insert into incompleteops");
    }
}

static void
del(int testno,
    hyperclient* cl,
    uint32_t A)
{
    hyperclient_returncode* status = new hyperclient_returncode();
    int64_t id = cl->del(space, reinterpret_cast<const char*>(&A), sizeof(uint32_t), status);

    if (id < 0)
    {
        FAIL(testno, "del encountered error " << status);
    }

    std::pair<std::map<int64_t, hyperclient_returncode*>::iterator, bool> res;
    res = incompleteops.insert(std::make_pair(id, status));

    if (res.second != true)
    {
        FAIL(testno, "del could not insert into incompleteops");
    }
}

static void
flush(int testno,
      hyperclient* cl)
{
    while (!incompleteops.empty())
    {
        hyperclient_returncode status;
        int64_t id = cl->loop(10000, &status);

        if (id < 0)
        {
            FAIL(testno, "loop returned error " << status);
        }
        else
        {
            std::map<int64_t, hyperclient_returncode*>::iterator incomplete;
            incomplete = incompleteops.find(id);

            if (incomplete == incompleteops.end())
            {
                FAIL(testno, "loop returned unknown id " << id);
            }

            if (*(incomplete->second) != HYPERCLIENT_SUCCESS)
            {
                FAIL(testno, "operation " << id << " returned " << *(incomplete->second));
            }

            delete incomplete->second;
            incompleteops.erase(incomplete);
        }
    }
}

static void
present(int testno,
        hyperclient* cl,
        uint32_t A, uint32_t B, uint32_t C)
{
    flush(testno, cl);

    hyperclient_returncode gstatus;
    hyperclient_returncode lstatus;
    hyperclient_attribute* attrs;
    size_t attrs_sz;
    int64_t gid = cl->get(space, reinterpret_cast<char*>(&A), sizeof(uint32_t), &gstatus, &attrs, &attrs_sz);

    if (gid < 0)
    {
        FAIL(testno, "get encountered error " << gstatus);
    }

    int64_t lid = cl->loop(10000, &lstatus);

    if (lid < 0)
    {
        FAIL(testno, "loop encountered error " << lstatus);
    }

    if (gid != lid)
    {
        FAIL(testno, "loop id (" << lid << ") does not match get id (" << gid << ")");
    }

    if (gstatus != HYPERCLIENT_SUCCESS)
    {
        FAIL(testno, "operation " << gid << " (a presence check) returned " << gstatus);
    }

    if (attrs_sz != 2)
    {
        FAIL(testno, "presence check: " << attrs_sz << " attributes instead of 2 attributes");
    }

    if (strcmp(attrs[0].attr, "B") != 0)
    {
        FAIL(testno, "presence check: first attribute is \"" << attrs[0].attr << "\" instead of \"B\"");
    }

    if (attrs[0].datatype != HYPERDATATYPE_STRING)
    {
        FAIL(testno, "presence check: first attribute is not of datatype \"string\"");
    }

    if (e::slice(attrs[0].value, attrs[0].value_sz) != e::slice(&B, sizeof(uint32_t)))
    {
        FAIL(testno, "presence check: first attribute does not match " << B);
    }

    if (strcmp(attrs[1].attr, "C") != 0)
    {
        FAIL(testno, "presence check: second attribute is \"" << attrs[1].attr << "\" instead of \"C\"");
    }

    if (attrs[1].datatype != HYPERDATATYPE_STRING)
    {
        FAIL(testno, "presence check: second attribute is not of datatype \"string\"");
    }

    if (e::slice(attrs[1].value, attrs[1].value_sz) != e::slice(&C, sizeof(uint32_t)))
    {
        FAIL(testno, "presence check: second attribute does not match " << C);
    }

    free(attrs);
}

static void
absent(int testno,
       hyperclient* cl,
       uint32_t A)
{
    flush(testno, cl);

    hyperclient_returncode gstatus;
    hyperclient_returncode lstatus;
    hyperclient_attribute* attrs = NULL;
    size_t attrs_sz = 0;
    int64_t gid = cl->get(space, reinterpret_cast<char*>(&A), sizeof(uint32_t), &gstatus, &attrs, &attrs_sz);

    if (gid < 0)
    {
        FAIL(testno, "get encountered error " << gstatus);
    }

    int64_t lid = cl->loop(10000, &lstatus);

    if (lid < 0)
    {
        FAIL(testno, "loop returned error " << lstatus);
    }

    if (gid != lid)
    {
        FAIL(testno, "loop id (" << lid << ") does not match get id (" << gid << ")");
    }

    if (gstatus != HYPERCLIENT_NOTFOUND)
    {
        FAIL(testno, "operation " << gid << " (an absence check) returned " << gstatus);
    }

    assert(!attrs && !attrs_sz);
}

// This test continually puts keys, ensuring that every way in which one could
// select regions from the subspaces is chosen.
void
test0(hyperclient* cl)
{
    for (generator A; A.has_next(); A.next())
    {
        absent(0, cl, A);

        for (generator B; B.has_next(); B.next())
        {
            for (generator C; C.has_next(); C.next())
            {
                put(0, cl, A, B, C);
            }
        }

        present(0, cl, A, generator::end(), generator::end());
        del(0, cl, A);
        absent(0, cl, A);
    }

    success(0);
}

// This test continually puts/deletes keys, ensuring that a [PUT, DEL] sequence
// of operations is run through every way in which one could select regions from
// the subspaces.  6 * 2**prefix requests will be performed.  This tests that
// delete plays nicely with the fresh bit.
void
test1(hyperclient* cl)
{
    for (generator A; A.has_next(); A.next())
    {
        absent(1, cl, A);

        for (generator B; B.has_next(); B.next())
        {
            for (generator C; C.has_next(); C.next())
            {
                put(1, cl, A, B, C);
                del(1, cl, A);
            }
        }

        absent(1, cl, A);
    }

    success(1);
}

// This test puts keys such that A and B are fixed, but every choice of C for
// a fixed A, B is exercised.  Keys are deleted when changing A or B.  This
// tests that CHAIN_SUBSPACE messages work.  This tests that CHAIN_SUBSPACE
// messages work correctly.
void
test2(hyperclient* cl)
{
    for (generator A; A.has_next(); A.next())
    {
        for (generator B; B.has_next(); B.next())
        {
            absent(2, cl, A);

            for (generator C; C.has_next(); C.next())
            {
                put(2, cl, A, B, C);
            }

            present(2, cl, A, B, generator::end());
            del(2, cl, A);
            absent(2, cl, A);
        }
    }

    success(2);
}

// This is isomorphic to test2 except that columns A and C are fixed.
void
test3(hyperclient* cl)
{
    for (generator A; A.has_next(); A.next())
    {
        for (generator C; C.has_next(); C.next())
        {
            absent(3, cl, A);

            for (generator B; B.has_next(); B.next())
            {
                put(3, cl, A, B, C);
            }

            present(3, cl, A, generator::end(), C);
            del(3, cl, A);
            absent(3, cl, A);
        }
    }

    success(3);
}

// This test stresses the interaction of CHAIN_SUBSPACE with DELETE messages.
// For each A, B, C pair, it creates a point.  It then issues a PUT which causes
// B and C to jump to another subspace.  It then issues a DEL to try to create a
// deferred update.
void
test4(hyperclient* cl)
{
    for (generator A; A.has_next(); A.next())
    {
        for (generator B; B.has_next(); B.next())
        {
            for (generator C; C.has_next(); C.next())
            {
                absent(4, cl, A);

                for (generator BP; BP.has_next(); BP.next())
                {
                    for (generator CP; CP.has_next(); CP.next())
                    {
                        if (B != BP && C != CP)
                        {
                            put(4, cl, A, B, C);
                            put(4, cl, A, BP, CP);
                            del(4, cl, A);
                        }
                    }
                }

                absent(4, cl, A);
            }
        }
    }

    success(4);
}


text:
package flash.swf.tools.as3;

import macromedia.asc.parser.*;
import macromedia.asc.semantics.Value;
import macromedia.asc.util.Context;
import flash.localization.LocalizationManager;

/**
 * An adapter for visiting the nodes of an ASC AST.
 *
 */
public abstract class EvaluatorAdapter implements Evaluator
{
	public void setLocalizationManager(LocalizationManager l10n)
	{
		this.l10n = l10n;
	}

	protected LocalizationManager l10n;

    /*
     * FIXME: check whether we need to change the current Context in certain evaulate methods.
     * FlowAnalyzer does this- do we use Context and need to do this as well?
     */
	public boolean checkFeature(Context cx, Node node)
	{
		return true;
	}

	// Base node

	public Value evaluate(Context cx, Node node)
	{
		return null;
	}

	// Expression evaluators

	public Value evaluate(Context cx, IdentifierNode node)
	{
		return null;
	}

	// Expression evaluators

	public Value evaluate(Context cx, IncrementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ThisExpressionNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, QualifiedIdentifierNode node)
	{
		if (node.qualifier != null)
		{
			node.qualifier.evaluate(cx, this);
		}
		return null;
	}

    public Value evaluate(Context cx, QualifiedExpressionNode node)
    {
        if( node.ref == null)
        {
            evaluate(cx,(QualifiedIdentifierNode)node);
            node.expr.evaluate(cx,this);
        }
        return node.ref;
    }

	public Value evaluate(Context cx, LiteralBooleanNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, LiteralNumberNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, LiteralStringNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, LiteralNullNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, LiteralRegExpNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, LiteralXMLNode node)
	{
		if (node.list != null)
		{
			node.list.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context unused_cx, FunctionCommonNode node)
	{
		Context cx = node.cx;

		if (node.signature != null)
		{
			node.signature.evaluate(cx, this);
		}
		if (node.body != null)
		{
			node.body.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ParenExpressionNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, ParenListExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, LiteralObjectNode node)
	{
		if (node.fieldlist != null)
		{
			node.fieldlist.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, LiteralFieldNode node)
	{
		if (node.name != null)
		{
			node.name.evaluate(cx, this);
		}
		if (node.value != null)
		{
			node.value.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, LiteralArrayNode node)
	{
		if (node.elementlist != null)
		{
			node.elementlist.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, LiteralVectorNode node)
	{
		node.type.evaluate(cx,this);

		if (node.elementlist != null)
		{
			node.elementlist.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, SuperExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, MemberExpressionNode node)
	{
		if (node.base != null)
		{
			node.base.evaluate(cx, this);
		}
		if (node.selector != null)
		{
			node.selector.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, InvokeNode node)
	{
		if (node.args != null)
		{
			node.args.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, CallExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		if (node.args != null)
		{
			node.args.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, DeleteExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, GetExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, SetExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		if (node.args != null)
		{
			node.args.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, UnaryExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, BinaryExpressionNode node)
	{
		if (node.lhs != null)
		{
			node.lhs.evaluate(cx, this);
		}
		if (node.rhs != null)
		{
			node.rhs.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ConditionalExpressionNode node)
	{
		if (node.condition != null)
		{
			node.condition.evaluate(cx, this);
		}
		if (node.thenexpr != null)
		{
			node.thenexpr.evaluate(cx, this);
		}
		if (node.elseexpr != null)
		{
			node.elseexpr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ArgumentListNode node)
	{
		// for (Node n : node.items)
		for (int i = 0, size = node.items.size(); i < size; i++)
		{
			Node n = node.items.get(i);
			n.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ListNode node)
	{
		// for (Node n : node.items)
		for (int i = 0, size = node.items.size(); i < size; i++)
		{
			Node n = node.items.get(i);
			n.evaluate(cx, this);
		}
		return null;
	}

	// Statements

	public Value evaluate(Context cx, StatementListNode node)
	{
		// Reevaluate the size for each iteration, because Nodes can
		// be added to "items" (See the NodeMagic.addImport() call in
		// flex2.compiler.as3.SyntaxTreeEvaluator.processResourceBundle())
		// and if the last Node is an IncludeDirectiveNode, we need to
		// be sure to evaluate it, so that in_this_include is turned
		// off.

		// for (Node n : node.items)
		for (int i = 0; i < node.items.size(); i++)
		{
			Node n = node.items.get(i);
			if (n != null)
			{
				n.evaluate(cx, this);
			}
		}

		return null;
	}

    public Value evaluate(Context cx, EmptyElementNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, EmptyStatementNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, ExpressionStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, SuperStatementNode node)
	{
		if (node.call.args != null)
		{
			node.call.args.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, LabeledStatementNode node)
	{
		if (node.label != null)
		{
			node.label.evaluate(cx, this);
		}
		if (node.statement != null)
		{
			node.statement.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, IfStatementNode node)
	{
		if (node.condition != null)
		{
			node.condition.evaluate(cx, this);
		}
		if (node.thenactions != null)
		{
			node.thenactions.evaluate(cx, this);
		}
		if (node.elseactions != null)
		{
			node.elseactions.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, SwitchStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, CaseLabelNode node)
	{
		if (node.label != null)
		{
			node.label.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, DoStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, WhileStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		if (node.statement != null)
		{
			node.statement.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ForStatementNode node)
	{
		if (node.initialize != null)
		{
			node.initialize.evaluate(cx, this);
		}
		if (node.test != null)
		{
			node.test.evaluate(cx, this);
		}
		if (node.increment != null)
		{
			node.increment.evaluate(cx, this);
		}
		if (node.statement != null)
		{
			node.statement.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, WithStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		if (node.statement != null)
		{
			node.statement.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ContinueStatementNode node)
	{
		if (node.id != null)
		{
			node.id.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, BreakStatementNode node)
	{
		if (node.id != null)
		{
			node.id.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ReturnStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ThrowStatementNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, TryStatementNode node)
	{
		if (node.tryblock != null)
		{
			node.tryblock.evaluate(cx, this);
		}
		if (node.catchlist != null)
		{
			node.catchlist.evaluate(cx, this);
		}
		if (node.finallyblock != null)
		{
			node.finallyblock.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, CatchClauseNode node)
	{
		if (node.parameter != null)
		{
			node.parameter.evaluate(cx, this);
		}
		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, FinallyClauseNode node)
	{
		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, UseDirectiveNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, IncludeDirectiveNode node)
	{
		if( !node.in_this_include )
        {
            node.in_this_include = true;
			node.prev_cx = new Context(cx.statics);
			node.prev_cx.switchToContext(cx);

            // DANGER: it may not be obvious that we are setting the
            // the context of the outer statementlistnode here
            cx.switchToContext(node.cx);
        }
        else
        {
            node.in_this_include = false;
            cx.switchToContext(node.prev_cx);   // restore prevailing context
            node.prev_cx = null;
        }

		return null;
	}

	// Definitions

	public Value evaluate(Context unused_cx, ImportDirectiveNode node)
	{
		Context cx = node.cx;

		if (node.attrs != null)
		{
			node.attrs.evaluate(cx, this);
		}
		if (node.name != null)
		{
			node.name.evaluate(cx, this);
		}

		return null;
	}

	public Value evaluate(Context cx, AttributeListNode node)
	{
		// for (Node n : node.items)
		for (int i = 0, size = node.items.size(); i < size; i++)
		{
			Node n = node.items.get(i);
			n.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, VariableDefinitionNode node)
	{
		if (node.attrs != null)
		{
			node.attrs.evaluate(cx, this);
		}
		if (node.list != null)
		{
			node.list.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, VariableBindingNode node)
	{
		if (node.variable != null)
		{
			node.variable.evaluate(cx, this);
		}
		if (node.initializer != null)
		{
			node.initializer.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, UntypedVariableBindingNode node)
	{
		if (node.identifier != null)
		{
			node.identifier.evaluate(cx, this);
		}
		if (node.initializer != null)
		{
			node.initializer.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, TypedIdentifierNode node)
	{
		if (node.identifier != null)
		{
			node.identifier.evaluate(cx, this);
		}
		if (node.type != null)
		{
			node.type.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, BinaryFunctionDefinitionNode node)
	{
		return evaluate(cx, (FunctionDefinitionNode) node);
	}

	public Value evaluate(Context unused_cx, FunctionDefinitionNode node)
	{
		Context cx = node.cx;

		if (node.attrs != null)
		{
			node.attrs.evaluate(cx, this);
		}
		if (node.name != null)
		{
			node.name.evaluate(cx, this);
		}
		if (node.fexpr != null)
		{
			node.fexpr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, FunctionNameNode node)
	{
		if (node.identifier != null)
		{
			node.identifier.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, FunctionSignatureNode node)
	{
		if (node.parameter != null)
		{
			node.parameter.evaluate(cx, this);
		}
		if (node.result != null)
		{
			node.result.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ParameterNode node)
	{
		if (node.identifier != null)
		{
			node.identifier.evaluate(cx, this);
		}
		if (node.type != null)
		{
			node.type.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, RestExpressionNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, RestParameterNode node)
	{
		if (node.parameter != null)
		{
			node.parameter.evaluate(cx, this);
		}
		return null;
	}

    public Value evaluate(Context cx, BinaryClassDefNode node)
    {
        return evaluate(cx, (ClassDefinitionNode)node);
    }

	public Value evaluate(Context cx, BinaryInterfaceDefinitionNode node)
	{
		return evaluate(cx, (BinaryClassDefNode) node);
	}

	public Value evaluate(Context unused_cx, ClassDefinitionNode node)
	{
		Context cx = node.cx;

		if (node.attrs != null)
		{
			node.attrs.evaluate(cx, this);
		}
		if (node.name != null)
		{
			node.name.evaluate(cx, this);
		}
		if (node.baseclass != null)
		{
			node.baseclass.evaluate(cx, this);
		}
		if (node.interfaces != null)
		{
			node.interfaces.evaluate(cx, this);
		}

		if (node.fexprs != null)
		{
			// for (FunctionCommonNode n : node.fexprs)
			for (int i = 0, size = node.fexprs.size(); i < size; i++)
			{
				FunctionCommonNode n = node.fexprs.get(i);
				n.evaluate(cx, this);
			}
		}

		if (node.staticfexprs != null)
		{
			// for (FunctionCommonNode n : node.staticfexprs)
			for (int i = 0, size = node.staticfexprs.size(); i < size; i++)
			{
				FunctionCommonNode n = node.staticfexprs.get(i);
				n.evaluate(cx, this);
			}
		}

		if (node.instanceinits != null)
		{
			// for (Node n : node.instanceinits)
			for (int i = 0, size = node.instanceinits.size(); i < size; i++)
			{
				Node n = node.instanceinits.get(i);
				n.evaluate(cx, this);
			}
		}

		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, InterfaceDefinitionNode node)
	{
		if (node.attrs != null)
		{
			node.attrs.evaluate(cx, this);
		}
		if (node.name != null)
		{
			node.name.evaluate(cx, this);
		}
		if (node.interfaces != null)
		{
			node.interfaces.evaluate(cx, this);
		}
		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ClassNameNode node)
	{
		if (node.pkgname != null)
		{
			node.pkgname.evaluate(cx, this);
		}
		if (node.ident != null)
		{
			node.ident.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, InheritanceNode node)
	{
		if (node.baseclass != null)
		{
			node.baseclass.evaluate(cx, this);
		}
		if (node.interfaces != null)
		{
			node.interfaces.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, NamespaceDefinitionNode node)
	{
		if (node.attrs != null)
		{
			node.attrs.evaluate(cx, this);
		}
		if (node.name != null)
		{
			node.name.evaluate(cx, this);
		}
		if (node.value != null)
		{
			node.value.evaluate(cx, this);
		}
		return null;
	}

    public Value evaluate(Context cx, ConfigNamespaceDefinitionNode node)
    {
        return null;
    }

	public Value evaluate(Context cx, PackageDefinitionNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, PackageIdentifiersNode node)
	{
		// for (IdentifierNode n : node.list)
		for (int i = 0, size = node.list.size(); i < size; i++)
		{
			IdentifierNode n = node.list.get(i);
			n.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, PackageNameNode node)
	{
		if (node.id != null)
		{
			node.id.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context unused_cx, ProgramNode node)
	{
		Context cx = node.cx;

		if (node.pkgdefs != null)
		{
			// for (PackageDefinitionNode n : node.pkgdefs)
			for (int i = 0, size = node.pkgdefs.size(); i < size; i++)
			{
				PackageDefinitionNode n = node.pkgdefs.get(i);
				n.evaluate(cx, this);
			}
		}

		if (node.statements != null)
		{
			node.statements.evaluate(cx, this);
		}

		if (node.fexprs != null)
		{
			// for (FunctionCommonNode n : node.fexprs)
			for (int i = 0, size = node.fexprs.size(); i < size; i++)
			{
				FunctionCommonNode n = node.fexprs.get(i);
				n.evaluate(cx, this);
			}
		}

		if (node.clsdefs != null)
		{
			// for (FunctionCommonNode n : node.clsdefs)
			for (int i = 0, size = node.clsdefs.size(); i < size; i++)
			{
				ClassDefinitionNode n = node.clsdefs.get(i);
				n.evaluate(cx, this);
			}
		}

		return null;
	}

	public Value evaluate(Context cx, ErrorNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, ToObjectNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, LoadRegisterNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, StoreRegisterNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, BoxNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, CoerceNode node)
	{
		if (node.expr != null)
		{
			node.expr.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, PragmaNode node)
	{
		if (node.list != null)
		{
			node.list.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, PragmaExpressionNode node)
	{
		if (node.identifier != null)
		{
			node.identifier.evaluate(cx, this);
		}
		return null;
	}

	public Value evaluate(Context cx, ParameterListNode node)
	{
		for (int i = 0, size = node.items.size(); i < size; i++)
		{
			// ParameterNode param = node.items.get(i);
			ParameterNode param = node.items.get(i);
			if (param != null)
			{
				param.evaluate(cx, this);
			}
		}
		return null;
	}

	public Value evaluate(Context cx, MetaDataNode node)
	{
		if (node.data != null)
		{
			MetaDataEvaluator mde = new MetaDataEvaluator();
			node.evaluate(cx, mde);
		}

		return null;
	}

	public Value evaluate(Context context, DefaultXMLNamespaceNode defaultXMLNamespaceNode)
	{
		return null;
	}

    public Value evaluate(Context cx, BinaryProgramNode node)
    {
        return evaluate(cx, (ProgramNode)node);
    }

	public Value evaluate(Context cx, DocCommentNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, ImportNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, RegisterNode node)
	{
		return null;
	}

	public Value evaluate(Context cx, HasNextNode node)
	{
		return null;
	}

    public Value evaluate(Context cx, TypeExpressionNode node)
    {
        return node.expr.evaluate(cx, this);
    }

    public Value evaluate(Context cx, ApplyTypeExprNode node)
    {
        if (node.expr != null)
        {
            node.expr.evaluate(cx, this);
        }

        if (node.typeArgs != null)
        {
            node.typeArgs.evaluate(cx, this);
        }

        return null;
    }

    public Value evaluate(Context cx, UseNumericNode node)
    {
    	return null;
    }

    public Value evaluate(Context cx, UsePrecisionNode node)
    {
    	return null;
    }

    public Value evaluate(Context cx, UseRoundingNode node)
    {
    	return null;
    }
}