text:
package robowars.shared.model;

import java.io.Serializable;

/**
*
* @author Alex Dinardo
*
*/
public abstract class GameEntity implements Serializable{

	private static final long serialVersionUID = 5016873544195577415L;
	protected Posture posture;
	protected Vector vertices[];
	protected Vector edges[];
	protected int id;

	public GameEntity(Posture posture, Vector vertices[], int id){
		this.id=id;
		this.posture = posture;
		if(vertices != null)
			setVertices(vertices);
	}

	//TODO: This is general polygon collision detection with support for
	//rotating structures, but an easy way to represent circles is still needed.
	//Perhaps a shape with one vertex to represent radius?
	public boolean checkCollision(GameEntity target){
		//System.out.print("Checking collide... ");
		Vector currentEdge;
		for (int i = 0; i < edges.length + target.getEdges().length; i++){
			if (i < edges.length) {
	            currentEdge = edges[i];
	        } else {
	            currentEdge = target.getEdges()[i - edges.length];
	        }
			Vector perpAxis = new Vector(-currentEdge.getY(), currentEdge.getX());
	        perpAxis.unitVector();

	        Vector intervalA = new Vector(0,0);
	        Vector intervalB = new Vector(0,0);
	        projectToAxis(perpAxis, this.vertices,  intervalA);
	        projectToAxis(perpAxis, target.getVertices(),  intervalB);
	        if (intervalDistance(intervalA, intervalB) > 0){
	        	//System.out.println("None.");
	            return false;
	        }

		}
		System.out.println("Collision between " + this.getId() + " and " + target.getId());
		return true;
	}

	public void setPosture(Posture Posture){
		float headingDiff = Posture.getHeading() - this.posture.getHeading();
		float xDiff = Posture.getX() - this.posture.getX();
		float yDiff = Posture.getY() - this.posture.getY();
		System.out.println("Entity movement diffs: (" + xDiff + "," + yDiff + "," + headingDiff + ")");
		this.posture = Posture;
		for (Vector v : vertices){
			v.setX(v.getX() + xDiff);
			v.setY(v.getY() + yDiff);
		}
		compensateForRotation(vertices, headingDiff);
		generateEdges();
	}

	public void setVertices(Vector vertices[]){
		this.vertices = vertices;
		for (Vector v : this.vertices){
			v.setX(v.getX() + posture.getX());
			v.setY(v.getY() + posture.getY());
		}
		compensateForRotation(this.vertices, posture.getHeading());
		generateEdges();
	}

	public void setVertex(int index, Vector vector){
		vertices[index] = vector;
	}

	public void getCoordArrays(int x[], int y[]){
		for(int i = 0; i < vertices.length; i++){
			x[i] = (int) vertices[i].getX();
			y[i] = (int) vertices[i].getY();
		}
	}

	public Posture clonePosture(){
		return new Posture(posture.getX(), posture.getY(), posture.getHeading());
	}

	public Posture getPosture(){
		return posture;
	}

	public Vector[] getVertices(){
		return vertices;
	}

	public Vector getVertex(int index){
		return vertices[index];
	}

	public int getId(){return id;}

	public Vector[] getEdges(){return edges;}

	private Vector[] generateEdges(){
		Vector p1;
		Vector p2;
		edges = new Vector[vertices.length];
		for (int i = 0; i < vertices.length; i++) {
			p1 = vertices[i];
			if (i + 1 >= vertices.length) {
				p2 = vertices[0];
			} else {
				p2 = vertices[i + 1];
			}
			edges[i] = new Vector(p2.getX() - p1.getX(), p2.getY() - p1.getY());
		}
		return edges;
	}

	private void projectToAxis(Vector perpAxis, Vector[] vertices, Vector interval) {

		float dotProduct = perpAxis.dotProduct(vertices[0]);
		interval.setX(dotProduct);
		interval.setY(dotProduct);
		for (int i = 0; i < vertices.length; i++) {
			dotProduct = vertices[i].dotProduct(perpAxis);
			if (dotProduct < interval.getX()) {
				interval.setX(dotProduct);
			} else {
				if (dotProduct > interval.getY()) {
					interval.setY(dotProduct);
				}
			}
		}
	}

	private float intervalDistance(Vector intervalA, Vector intervalB) {
	    if (intervalA.getX() < intervalB.getX()) {
	        return intervalB.getX() - intervalA.getY();
	    } else {
	        return intervalA.getX() - intervalB.getY();
	    }
	}

	protected void compensateForRotation(Vector points[], float angleDifference){
		for (Vector p : points){
			p.setX(p.getX() - posture.getX());
			p.setY(p.getY() - posture.getY());
			Vector.setPolarCoord(p);
			p.setTheta(p.getTheta() + angleDifference);
			Vector.setCartesianCoord(p);
			p.setX(p.getX() + posture.getX());
			p.setY(p.getY() + posture.getY());
		}
	}
}


text:
package iso20022

// Instrument that has or represents monetary value and is used to process a payment instruction.
type PaymentInstrument10 struct {

	// Currency associated with the payment instrument.
	SettlementCurrency *ActiveCurrencyCode `xml:"SttlmCcy"`

	// Choice of payment instruments.
	PaymentInstrument *PaymentInstrument16Choice `xml:"PmtInstrm"`

	// Percentage of the dividend payment not to be reinvested.
	DividendPercentage *PercentageBoundedRate `xml:"DvddPctg,omitempty"`
}

func (p *PaymentInstrument10) SetSettlementCurrency(value string) {
	p.SettlementCurrency = (*ActiveCurrencyCode)(&value)
}

func (p *PaymentInstrument10) AddPaymentInstrument() *PaymentInstrument16Choice {
	p.PaymentInstrument = new(PaymentInstrument16Choice)
	return p.PaymentInstrument
}

func (p *PaymentInstrument10) SetDividendPercentage(value string) {
	p.DividendPercentage = (*PercentageBoundedRate)(&value)
}

redpajama_set_name: RedPajamaGithub


text:
'''
Miscellaneous SiteCommand classes for simple commands
'''
from .gerritsite import SiteCommand
from .internal.cmdoptions import *  # noqa

class ProjectList(SiteCommand):
    '''
    Obtain a list of all(visible) projects on a site

    :param option_str: List of options to pass to the command

    '''

    __options = OptionSet(
        Option.valued('show-branch', 'b', repeatable=True),
        Option.flag('description', 'd', spec='>=2.5'),
        Option.flag('tree', 't'),
        Option.choice('type', choices=['code', 'permissions', 'all']),
        Option.flag('all', spec='>=2.5'),
        Option.valued('limit', spec='>=2.5'),
        Option.valued('has-acl-for', spec='>=2.6'),
        Option.choice('format',
                      choices=['text', 'json', 'json_compact'],
                      spec='>=2.5')
        )

    __supported_versions = '>=2.4'

    def __init__(self, option_str=''):
        super(ProjectList, self).__init__(ProjectList.__supported_versions,
                                          ProjectList.__options,
                                          option_str)

    def execute_on(self, the_site):
        '''
        :param the_site: A :class:`Site` representing the site to search
        :param list_all: Indicates whether to list all types of project

        :returns: A list of :class:`Review` objects
        '''
        self.check_support_for(the_site)
        raw = the_site.execute(' '.join(['ls-projects',
                                        str(self._parsed_options)]
                                        ).strip())
        self._results = [l for l in raw if l]
        return self._results

__all__ = ['ProjectList']


text:
//
//  Lexer.h
//  lut-lang
//
//  Created by Mehdi Kitane on 13/03/2015.
//  Copyright (c) 2015 H4314. All rights reserved.
//

#ifndef SRC_LEXER_H_
#define SRC_LEXER_H_

#include <stdio.h>
#include <regex>
#include <string>
#include "ASTTokenNode.h"

using std::string;

/**
 * @class
 * Defines an enumeration of variable declarations
 */
class Lexer {
 public:
  /**
   * @constructor
   * @param inString The string that will be parsed
   */
  explicit Lexer(string inString);

  /**
   * @return Returns true if there is something else to read in the string
   *
   */
  bool has_next();

  /**
   * @return the last token parsed
   *
   */
  ASTTokenNode* top();

  /**
   * Moves to the next token
   */
  void shift();

  int getLine();
  int getColumn();

 protected :
  int line;
  int column;
  int column_next_incrementation;
  std::string inputString;
  ASTTokenNode *currentToken;

  bool analyze(string s, std::smatch &m);
  int find_first_not_of(string str);
  string& ltrim(string& s);
};

#endif  // SRC_LEXER_H_


text:
<?php

namespace Zephir;

/**
 * CompiledExpression.
 *
 * This represent a compiled expression, the object can be used to check
 * if the expression type is able to be used in certain types of the application
 */
class CompiledExpression implements TypeAwareInterface
{
    protected $type;

    protected $code;

    protected $originalExpr;

    /**
     * @param string $type
     * @param string $code
     * @param array  $originalExpr
     */
    public function __construct($type, $code, $originalExpr)
    {
        $this->type = $type;
        $this->code = $code;
        $this->originalExpr = $originalExpr;
    }

    /**
     * Returns the type of the compiled expression.
     *
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * Returns the code produced by the compiled expression.
     *
     * @return string
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * Original AST code that produced the code.
     *
     * @return array
     */
    public function getOriginal()
    {
        return $this->originalExpr;
    }

    /**
     * Returns a C representation for a boolean constant.
     *
     * @return string
     */
    public function getBooleanCode()
    {
        if ($this->code && ('true' == $this->code || true === $this->code)) {
            return '1';
        } else {
            if ('false' == $this->code || false === $this->code) {
                return '0';
            }
        }

        return $this->code;
    }

    /**
     * Checks if the compiled expression is an integer or compatible type.
     *
     * @return bool
     */
    public function isIntCompatibleType()
    {
        switch ($this->type) {
            case 'int':
            case 'uint':
            case 'long':
            case 'ulong':
            case 'char':
            case 'uchar':
                return true;
        }

        return false;
    }

    /**
     * Checks if the compiled expression is a char or compatible type.
     *
     * @return bool
     */
    public function isCharCompatibleType()
    {
        switch ($this->type) {
            case 'char':
            case 'uchar':
                return true;
        }

        return false;
    }

    /**
     * Resolves an expression
     * Some code cannot be directly pushed into the generated source
     * because it's missing some bound parts, this method resolves the missing parts
     * returning the generated code.
     *
     * @param string             $result
     * @param CompilationContext $compilationContext
     *
     * @return string
     */
    public function resolve($result, CompilationContext $compilationContext)
    {
        if ($this->code instanceof \Closure) {
            $code = $this->code;
            if (!$result) {
                $tempVariable = $compilationContext->symbolTable->getTempVariableForWrite(
                    'variable',
                    $compilationContext
                );
                $compilationContext->codePrinter->output($code($tempVariable->getName()));
                $tempVariable->setIsInitialized(true, $compilationContext);

                return $tempVariable->getName();
            }

            return $code($result);
        }

        return $this->code;
    }
}


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/setting_cloudlet_ip"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        />

    <item
        android:id="@+id/setting_cloud_ip"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        />

</menu>


text:
package org.sablecc.sablecc.core;

import static org.sablecc.util.CamelCase.*;

import java.math.*;
import java.util.*;

import org.sablecc.exception.*;
import org.sablecc.sablecc.core.analysis.*;
import org.sablecc.sablecc.core.interfaces.*;
import org.sablecc.sablecc.core.transformation.*;
import org.sablecc.sablecc.syntax3.analysis.*;
import org.sablecc.sablecc.syntax3.node.*;
import org.sablecc.util.*;
import org.sablecc.util.interfaces.*;

public class Parser
        implements IVisitableGrammarPart {

    private final List<Investigator.ParserInvestigator> investigators = new LinkedList<Investigator.ParserInvestigator>();

    private final List<Selector.ParserSelector> selectors = new LinkedList<Selector.ParserSelector>();

    private final List<Parser.ParserProduction> productions = new LinkedList<Parser.ParserProduction>();

    private ARoot rootDeclaration;

    public Parser() {

    }

    public void addInvestigator(
            Investigator.ParserInvestigator investigator) {

        this.investigators.add(investigator);
    }

    public void addSelector(
            Selector.ParserSelector selector) {

        this.selectors.add(selector);
    }

    public void addProduction(
            Parser.ParserProduction production) {

        this.productions.add(production);
    }

    public void addRootDeclaration(
            ARoot rootDeclaration) {

        if (this.rootDeclaration != null) {
            throw new InternalException(
                    "A rootDeclaration as already been added");
        }

        this.rootDeclaration = rootDeclaration;
    }

    public ARoot getRootDeclaration() {

        return this.rootDeclaration;
    }

    public List<Investigator.ParserInvestigator> getInvestigators() {

        return this.investigators;
    }

    public List<Selector.ParserSelector> getSelectors() {

        return this.selectors;
    }

    public List<Parser.ParserProduction> getProductions() {

        return this.productions;
    }

    @Override
    public void apply(
            IGrammarVisitor visitor) {

        visitor.visitParser(this);

    }

    public static abstract class ParserProduction
            implements INameDeclaration, IReferencable, IVisitableGrammarPart {

        private final AParserProduction declaration;

        private final Grammar grammar;

        private final LocalNamespace namespace;

        private final Context context;

        private final LinkedList<ParserAlternative> alternatives = new LinkedList<ParserAlternative>();

        private final List<ParserPriority> priorities = new LinkedList<Parser.ParserPriority>();

        private ProductionTransformation transformation;

        private ParserProduction(
                AParserProduction declaration,
                Context context,
                Grammar grammar) {

            if (declaration == null) {
                throw new InternalException("declaration may not be null");
            }

            if (grammar == null) {
                throw new InternalException("grammar may not be null");
            }

            if (context == null) {
                throw new InternalException("context may not be null");
            }

            this.declaration = declaration;
            this.context = context;
            this.grammar = grammar;

            findAlternatives();
            findPriorities();

            // When there is only one alternative, it doesn't require an
            // implicit
            // name
            if (this.alternatives.size() == 1) {
                String explicitName = this.alternatives.get(0)
                        .getExplicitName();
                if (explicitName != null) {
                    this.alternatives.get(0).setName(explicitName);
                }
                else {
                    this.alternatives.get(0).setName("");
                }

                this.namespace = null;
            }
            else {
                this.namespace = new LocalNamespace(this.alternatives);
            }

        }

        public AParserProduction getDeclaration() {

            return this.declaration;
        }

        public Context getContext() {

            return this.context;
        }

        public LinkedList<ParserAlternative> getAlternatives() {

            return this.alternatives;
        }

        public List<ParserPriority> getPriorities() {

            return this.priorities;
        }

        public ParserAlternative getLocalReference(
                String reference) {

            if (this.namespace != null) {
                return this.namespace.get(reference);
            }
            else {
                Parser.ParserAlternative firstAlternative = this.alternatives
                        .get(0);
                if (firstAlternative.getName() != null
                        && firstAlternative.equals(reference)) {
                    return firstAlternative;
                }
                return null;
            }
        }

        public void addTransformation(
                ProductionTransformation transformation) {

            if (this.transformation == null) {
                this.transformation = transformation;
            }
            else {
                throw new InternalException(
                        "addTransformation shouldn't be used twice");
            }
        }

        public ProductionTransformation getTransformation() {

            return this.transformation;
        }

        @Override
        public TIdentifier getNameIdentifier() {

            return this.declaration.getName();
        }

        @Override
        public String getName() {

            return getNameIdentifier().getText();
        }

        @Override
        public Token getLocation() {

            return this.declaration.getName();
        }

        static ParserProduction newParserProduction(
                AParserProduction declaration,
                Context context,
                Grammar grammar) {

            if (declaration == null) {
                throw new InternalException("declaration may not be null");
            }

            if (grammar == null) {
                throw new InternalException("grammar may not be null");
            }

            if (declaration.getQualifier() == null) {
                return new NormalProduction(declaration, context, grammar);
            }

            if (declaration.getQualifier() instanceof ADanglingQualifier) {
                return new DanglingProduction(declaration, context, grammar);
            }

            if (declaration.getQualifier() instanceof ATokenQualifier) {
                return new TokenProduction(declaration, context, grammar);
            }

            throw new InternalException("unhandled case");
        }

        public static class NormalProduction
                extends ParserProduction {

            private NormalProduction(
                    AParserProduction declaration,
                    Context context,
                    Grammar grammar) {

                super(declaration, context, grammar);
            }

            @Override
            public String getNameType() {

                return "normal parser production";
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserNormalProduction(this);

            }

        }

        public static class DanglingProduction
                extends ParserProduction {

            private DanglingProduction(
                    AParserProduction declaration,
                    Context context,
                    Grammar grammar) {

                super(declaration, context, grammar);
            }

            @Override
            public String getNameType() {

                return "dangling parser production";
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserDanglingProduction(this);

            }

        }

        public static class TokenProduction
                extends ParserProduction
                implements INamedToken {

            private TokenProduction(
                    AParserProduction declaration,
                    Context context,
                    Grammar grammar) {

                super(declaration, context, grammar);
            }

            @Override
            public String getNameType() {

                return "token production";
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserTokenProduction(this);

            }

        }

        private void findAlternatives() {

            this.declaration.apply(new DepthFirstAdapter() {

                private final ParserProduction parserProduction = ParserProduction.this;

                private int nextIndex = 1;

                @Override
                public void inAParserAlternative(
                        AParserAlternative node) {

                    ParserAlternative alternative = ParserAlternative
                            .newParserAlternative(node,
                                    ParserProduction.this.grammar,
                                    this.parserProduction, this.nextIndex);

                    this.nextIndex += 1;

                    this.parserProduction.alternatives.add(alternative);

                }
            });

        }

        private void findPriorities() {

            this.declaration.apply(new DepthFirstAdapter() {

                private final ParserProduction parserProduction = ParserProduction.this;

                @Override
                public void inALeftParserPriority(
                        ALeftParserPriority node) {

                    ParserPriority.LeftPriority leftPriority = new ParserPriority.LeftPriority(
                            node, ParserProduction.this.grammar,
                            this.parserProduction);

                    ParserProduction.this.priorities.add(leftPriority);
                }

                @Override
                public void inARightParserPriority(
                        ARightParserPriority node) {

                    ParserPriority.RightPriority RightPriority = new ParserPriority.RightPriority(
                            node, ParserProduction.this.grammar,
                            this.parserProduction);

                    ParserProduction.this.priorities.add(RightPriority);
                }

                @Override
                public void inAUnaryParserPriority(
                        AUnaryParserPriority node) {

                    ParserPriority.UnaryPriority unaryPriority = new ParserPriority.UnaryPriority(
                            node, ParserProduction.this.grammar,
                            this.parserProduction);

                    ParserProduction.this.priorities.add(unaryPriority);
                }

            });
        }

        private static class LocalNamespace
                extends ImplicitExplicitNamespace<ParserAlternative> {

            public LocalNamespace(
                    final LinkedList<ParserAlternative> declarations) {

                super(declarations);
            }

            @Override
            protected void raiseDuplicateError(
                    ParserAlternative declaration,
                    ParserAlternative previousDeclaration) {

                throw SemanticException.duplicateAlternativeName(declaration,
                        previousDeclaration);

            }

        }

        public String getName_CamelCase() {

            return to_CamelCase(getName());
        }
    }

    public static abstract class ParserAlternative
            implements ImplicitExplicit, IReferencable, IVisitableGrammarPart {

        private final AParserAlternative declaration;

        private final Grammar grammar;

        private final ParserProduction production;

        private final LocalNamespace namespace;

        private int index;

        private Type.CompositeType type;

        private final LinkedList<ParserElement> elements = new LinkedList<ParserElement>();

        private AlternativeTransformation transformation;

        public ParserAlternative(
                AParserAlternative declaration,
                Grammar grammar,
                ParserProduction production,
                int index) {

            if (declaration == null) {
                throw new InternalException("declaration may not be null");
            }

            if (grammar == null) {
                throw new InternalException("grammar may not be null");
            }

            if (production == null) {
                throw new InternalException("production may not be null");
            }

            this.declaration = declaration;
            this.grammar = grammar;
            this.production = production;
            this.index = index;

            findElements();

            this.namespace = new LocalNamespace(this.elements);
        }

        static ParserAlternative newParserAlternative(
                AParserAlternative declaration,
                Grammar grammar,
                ParserProduction production,
                int index) {

            if (declaration == null) {
                throw new InternalException("declaration may not be null");
            }

            if (grammar == null) {
                throw new InternalException("grammar may not be null");
            }

            if (production == null) {
                throw new InternalException("production may not be null");
            }

            if (declaration.getDanglingElement() == null) {
                return new NormalAlternative(declaration, grammar, production,
                        index);
            }
            else {
                return new DanglingAlternative(declaration, grammar,
                        production, index);
            }
        }

        public ParserProduction getProduction() {

            return this.production;
        }

        public int getIndex() {

            return this.index;
        }

        public ParserElement getLocalReference(
                String reference) {

            return this.namespace.get(reference);
        }

        public void addTransformation(
                AlternativeTransformation transformation) {

            if (this.transformation == null) {
                this.transformation = transformation;
            }
            else {
                throw new InternalException(
                        "addTransformation shouldn't be used twice");
            }
        }

        public AlternativeTransformation getTransformation() {

            return this.transformation;
        }

        public AParserAlternative getDeclaration() {

            return this.declaration;
        }

        public LinkedList<ParserElement> getElements() {

            return this.elements;
        }

        public Type.CompositeType getType() {

            if (this.type == null) {
                LinkedList<Type> elementsType = new LinkedList<Type>();
                for (Parser.ParserElement element : getElements()) {
                    elementsType.add(element.getType());
                }

                this.type = new Type.CompositeType(elementsType);
            }

            return this.type;
        }

        @Override
        public Token getLocation() {

            if (this.declaration.getAlternativeName() != null) {
                return this.declaration.getAlternativeName();
            }
            else {
                // TODO Handle selector case
                return this.elements.get(0).getLocation();
            }
        }

        public abstract String getName();

        public abstract Token getNameToken();

        public static class NormalAlternative
                extends ParserAlternative {

            private String name;

            private Token token;

            public NormalAlternative(
                    AParserAlternative declaration,
                    Grammar grammar,
                    ParserProduction production,
                    int index) {

                super(declaration, grammar, production, index);
            }

            @Override
            public String getImplicitName() {

                String implicitName = null;

                if (getDeclaration().getElements().getFirst() instanceof ANormalElement) {
                    ANormalElement firstElement = (ANormalElement) getDeclaration()
                            .getElements().getFirst();

                    if (firstElement.getElementName() != null) {
                        implicitName = firstElement.getElementName().getText();
                        implicitName = implicitName.substring(1,
                                implicitName.length() - 2);
                    }
                    else if (firstElement.getUnit() instanceof ANameUnit
                            && (firstElement.getUnaryOperator() == null || firstElement
                                    .getUnaryOperator() instanceof AZeroOrOneUnaryOperator)) {
                        implicitName = ((ANameUnit) firstElement.getUnit())
                                .getIdentifier().getText();
                    }

                }
                else if (getDeclaration().getElements().getFirst() instanceof ASeparatedElement) {
                    ASeparatedElement firstElement = (ASeparatedElement) getDeclaration()
                            .getElements().getFirst();

                    if (firstElement.getElementName() != null) {
                        implicitName = firstElement.getElementName().getText();
                        implicitName = implicitName.substring(1,
                                implicitName.length() - 2);
                    }// else : separated element can't have an implicit name
                }
                else if (getDeclaration().getElements().getFirst() instanceof AAlternatedElement) {
                    AAlternatedElement firstElement = (AAlternatedElement) getDeclaration()
                            .getElements().getFirst();

                    if (firstElement.getElementName() != null) {
                        implicitName = firstElement.getElementName().getText();
                        implicitName = implicitName.substring(1,
                                implicitName.length() - 2);
                    }// else : alternated element can't have an implicit name
                }
                else {
                    throw new InternalException("Unhandled case");
                }

                return implicitName;
            }

            @Override
            public String getExplicitName() {

                String explicitName = null;

                if (getDeclaration().getAlternativeName() != null) {
                    explicitName = getDeclaration().getAlternativeName()
                            .getText();
                    explicitName = explicitName.substring(1,
                            explicitName.length() - 2);
                    return explicitName;
                }

                return explicitName;

            }

            @Override
            public void setName(
                    String name) {

                this.name = name;

            }

            @Override
            public String getName() {

                return this.name;
            }

            @Override
            public Token getNameToken() {

                if (this.token == null) {
                    if (getExplicitName() != null
                            && getExplicitName().equals(this.name)) {
                        this.token = getDeclaration().getAlternativeName();
                    }
                    else if (getImplicitName().equals(this.name)) {
                        ANormalElement firstElement = (ANormalElement) getDeclaration()
                                .getElements().getFirst();

                        this.token = ((ANameUnit) firstElement.getUnit())
                                .getIdentifier();
                    }
                }

                return this.token;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserNormalAlternative(this);

            }

        }

        public static class DanglingAlternative
                extends ParserAlternative {

            private String name;

            private Token token;

            public DanglingAlternative(
                    AParserAlternative declaration,
                    Grammar grammar,
                    ParserProduction production,
                    int index) {

                super(declaration, grammar, production, index);
            }

            @Override
            public String getImplicitName() {

                String implicitName = null;

                if (getDeclaration().getElements().getFirst() instanceof ANormalElement) {
                    ANormalElement firstElement = (ANormalElement) getDeclaration()
                            .getElements().getFirst();

                    if (firstElement.getElementName() != null) {
                        implicitName = firstElement.getElementName().getText();
                        implicitName = implicitName.substring(1,
                                implicitName.length() - 2);
                    }
                    else if (firstElement.getUnit() instanceof ANameUnit
                            && (firstElement.getUnaryOperator() == null || firstElement
                                    .getUnaryOperator() instanceof AZeroOrOneUnaryOperator)) {
                        implicitName = ((ANameUnit) firstElement.getUnit())
                                .getIdentifier().getText();
                    }

                }
                else if (getDeclaration().getElements().getFirst() instanceof ASeparatedElement) {
                    ASeparatedElement firstElement = (ASeparatedElement) getDeclaration()
                            .getElements().getFirst();

                    if (firstElement.getElementName() != null) {
                        implicitName = firstElement.getElementName().getText();
                        implicitName = implicitName.substring(1,
                                implicitName.length() - 2);
                    }// else : separated element can't have an implicit name
                }
                else if (getDeclaration().getElements().getFirst() instanceof AAlternatedElement) {
                    AAlternatedElement firstElement = (AAlternatedElement) getDeclaration()
                            .getElements().getFirst();

                    if (firstElement.getElementName() != null) {
                        implicitName = firstElement.getElementName().getText();
                        implicitName = implicitName.substring(1,
                                implicitName.length() - 2);
                    }// else : alternated element can't have an implicit name
                }
                else {
                    throw new InternalException("Unhandled case");
                }

                return implicitName;
            }

            @Override
            public String getExplicitName() {

                String explicitName = null;

                if (getDeclaration().getAlternativeName() != null) {
                    explicitName = getDeclaration().getAlternativeName()
                            .getText();
                    explicitName = explicitName.substring(1,
                            explicitName.length() - 2);
                    return explicitName;
                }

                return explicitName;

            }

            @Override
            public void setName(
                    String name) {

                this.name = name;

            }

            @Override
            public String getName() {

                return this.name;
            }

            @Override
            public Token getNameToken() {

                if (this.token == null) {
                    if (getExplicitName() != null
                            && getExplicitName().equals(this.name)) {
                        this.token = getDeclaration().getAlternativeName();
                    }
                    else if (getImplicitName().equals(this.name)) {
                        ANormalElement firstElement = (ANormalElement) getDeclaration()
                                .getElements().getFirst();

                        this.token = ((ANameUnit) firstElement.getUnit())
                                .getIdentifier();
                    }
                }

                return this.token;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserDanglingAlternative(this);

            }

        }

        private void findElements() {

            this.declaration.apply(new DepthFirstAdapter() {

                private final ParserAlternative parserAlternative = ParserAlternative.this;

                @Override
                public void inANormalElement(
                        ANormalElement node) {

                    ParserElement.NormalElement normalElement = new ParserElement.NormalElement(
                            node, ParserAlternative.this.grammar,
                            this.parserAlternative);

                    this.parserAlternative.elements.add(normalElement);

                }

                @Override
                public void inASeparatedElement(
                        ASeparatedElement node) {

                    ParserElement.SeparatedElement separatedElement = new ParserElement.SeparatedElement(
                            node, ParserAlternative.this.grammar,
                            this.parserAlternative);

                    this.parserAlternative.elements.add(separatedElement);
                }

                @Override
                public void inAAlternatedElement(
                        AAlternatedElement node) {

                    ParserElement.AlternatedElement alternatedElement = new ParserElement.AlternatedElement(
                            node, ParserAlternative.this.grammar,
                            this.parserAlternative);

                    this.parserAlternative.elements.add(alternatedElement);
                }

                @Override
                public void inADanglingElement(
                        ADanglingElement node) {

                    ParserElement.DanglingElement danglingElement = new ParserElement.DanglingElement(
                            node, ParserAlternative.this.grammar,
                            this.parserAlternative);

                    this.parserAlternative.elements.add(danglingElement);
                }

            });

        }

        private static class LocalNamespace
                extends ImplicitExplicitNamespace<ParserElement> {

            public LocalNamespace(
                    final LinkedList<ParserElement> declarations) {

                super(declarations);
            }

            @Override
            protected void raiseDuplicateError(
                    ParserElement declaration,
                    ParserElement previousDeclaration) {

                throw SemanticException.duplicateElementName(declaration,
                        previousDeclaration);

            }

        }

        public String getName_CamelCase() {

            String name = getName();
            return name == null ? null : to_CamelCase(name);
        }
    }

    public static abstract class ParserElement
            implements ImplicitExplicit, IReferencable, IVisitableGrammarPart {

        private final Grammar grammar;

        private final ParserAlternative alternative;

        public ParserElement(
                Grammar grammar,
                ParserAlternative alternative) {

            if (grammar == null) {
                throw new InternalException("grammar may not be null");
            }

            if (alternative == null) {
                throw new InternalException("alternative may not be null");
            }

            this.grammar = grammar;
            this.alternative = alternative;
        }

        public ParserAlternative getAlternative() {

            return this.alternative;
        }

        public int getIndex() {

            return this.alternative.getElements().indexOf(this);
        }

        public abstract String getName();

        public abstract Token getNameToken();

        public abstract String getNameType();

        public abstract String getElement();

        @Override
        public abstract Token getLocation();

        public abstract CardinalityInterval getCardinality();

        public abstract Type.SimpleType getType();

        public static class NormalElement
                extends ParserElement {

            private final ANormalElement declaration;

            private String name;

            private Token token;

            private IReferencable reference;

            private Token elementToken;

            private String element;

            private CardinalityInterval cardinality;

            private Type.SimpleType type;

            public NormalElement(
                    ANormalElement declaration,
                    Grammar grammar,
                    ParserAlternative alternative) {

                super(grammar, alternative);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;

                this.cardinality = new CardinalityInterval(
                        this.declaration.getUnaryOperator());

                this.element = new InformationExtractor(this)
                        .getReferenceText();

                constructType();
            }

            private void constructType() {

                Bound upperBound = this.cardinality.getUpperBound();

                if (this.cardinality.upperBoundIsInfinite()
                        || !upperBound.equals(this.cardinality.getLowerBound())) {
                    this.type = new Type.SimpleType.HomogeneousType(
                            this.element, this.cardinality);
                }
                else {
                    BigInteger upperBoundValue = upperBound.getValue();
                    Bound newCardinality;
                    CardinalityInterval newInterval;

                    if (upperBoundValue.mod(BigInteger.valueOf(2L)).compareTo(
                            BigInteger.ZERO) == 0) {

                        newCardinality = new Bound(
                                upperBoundValue.divide(BigInteger.valueOf(2L)));
                        newInterval = new CardinalityInterval(newCardinality,
                                newCardinality);
                        this.type = new Type.SimpleType.AlternatedType(
                                this.element, newInterval);
                    }
                    else {
                        if (upperBoundValue.compareTo(BigInteger.ONE) > 0) {

                            newCardinality = new Bound(upperBoundValue.divide(
                                    BigInteger.valueOf(2L)).add(BigInteger.ONE));
                        }
                        else {
                            newCardinality = upperBound;
                        }

                        newInterval = new CardinalityInterval(newCardinality,
                                newCardinality);
                        this.type = new Type.SimpleType.SeparatedType(
                                this.element, newInterval);
                    }

                }
            }

            public IReferencable getReference() {

                return this.reference;
            }

            public void addReference(
                    IReferencable reference) {

                if (this.reference == null) {
                    this.reference = reference;
                }
                else {
                    throw new InternalException(
                            "addReference shouldn't be used twice");
                }
            }

            public ANormalElement getDeclaration() {

                return this.declaration;
            }

            @Override
            public String getImplicitName() {

                String implicitName = null;

                if (this.declaration.getUnit() instanceof ANameUnit
                        && (this.declaration.getUnaryOperator() == null || this.declaration
                                .getUnaryOperator() instanceof AZeroOrOneUnaryOperator)) {

                    implicitName = ((ANameUnit) this.declaration.getUnit())
                            .getIdentifier().getText();
                }

                return implicitName;
            }

            @Override
            public String getExplicitName() {

                String explicitName = null;

                if (this.declaration.getElementName() != null) {
                    explicitName = this.declaration.getElementName().getText();
                    explicitName = explicitName.substring(1,
                            explicitName.length() - 2);
                }

                return explicitName;
            }

            @Override
            public void setName(
                    String name) {

                this.name = name;

            }

            @Override
            public String getName() {

                return this.name;
            }

            @Override
            public Token getNameToken() {

                if (this.token == null) {
                    if (getExplicitName() != null
                            && getExplicitName().equals(this.name)) {
                        this.token = this.declaration.getElementName();
                    }
                    else if (getImplicitName().equals(this.name)) {
                        if (!(this.declaration.getUnit() instanceof ANameUnit)) {
                            throw new InternalException("unit may not be a "
                                    + this.declaration.getUnit().getClass());
                        }
                        this.token = ((ANameUnit) this.declaration.getUnit())
                                .getIdentifier();
                    }
                }

                return this.token;
            }

            @Override
            public String getNameType() {

                return "parser normal element";
            }

            @Override
            public Token getLocation() {

                if (this.elementToken == null) {
                    this.elementToken = new InformationExtractor(this)
                            .getFirstToken();
                }

                return this.elementToken;
            }

            @Override
            public String getElement() {

                return this.element;
            }

            @Override
            public CardinalityInterval getCardinality() {

                return this.cardinality;
            }

            @Override
            public Type.SimpleType getType() {

                return this.type;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserNormalElement(this);

            }

        }

        public static class SeparatedElement
                extends ParserElement {

            private final ASeparatedElement declaration;

            private String name;

            private IReferencable leftReference;

            private IReferencable rightReference;

            private Token elementToken;

            private String element;

            private CardinalityInterval cardinality;

            private Type.SimpleType type;

            public SeparatedElement(
                    ASeparatedElement declaration,
                    Grammar grammar,
                    ParserAlternative alternative) {

                super(grammar, alternative);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;

                this.cardinality = new CardinalityInterval(
                        this.declaration.getManyOperator());

                constructType();
            }

            private void constructType() {

                InformationExtractor extractor = new InformationExtractor(this);

                this.type = new Type.SimpleType.SeparatedType(
                        extractor.getLeftText(), extractor.getRightText(),
                        this.cardinality);
            }

            public IReferencable getLeftReference() {

                return this.leftReference;
            }

            public void addLeftReference(
                    IReferencable leftReference) {

                if (this.leftReference == null) {
                    this.leftReference = leftReference;
                }
                else {
                    throw new InternalException(
                            "addReference shouldn't be used twice");
                }
            }

            public IReferencable getRightReference() {

                return this.rightReference;
            }

            public void addRightReference(
                    IReferencable rightReference) {

                if (this.rightReference == null) {
                    this.rightReference = rightReference;
                }
                else {
                    throw new InternalException(
                            "addReference shouldn't be used twice");
                }
            }

            public ASeparatedElement getDeclaration() {

                return this.declaration;
            }

            @Override
            public String getImplicitName() {

                return null;
            }

            @Override
            public String getExplicitName() {

                String explicitName = null;

                if (this.declaration.getElementName() != null) {
                    explicitName = this.declaration.getElementName().getText();
                    explicitName = explicitName.substring(1,
                            explicitName.length() - 2);
                }

                return explicitName;
            }

            @Override
            public void setName(
                    String name) {

                this.name = name;

            }

            @Override
            public String getName() {

                return this.name;
            }

            @Override
            public Token getNameToken() {

                return this.declaration.getElementName();
            }

            @Override
            public String getNameType() {

                return "parser separated element";
            }

            @Override
            public Token getLocation() {

                if (this.elementToken == null) {
                    this.elementToken = new InformationExtractor(this)
                            .getFirstToken();
                }

                return this.elementToken;
            }

            @Override
            public String getElement() {

                if (this.element == null) {
                    this.element = new InformationExtractor(this)
                            .getReferenceText();
                }

                return this.element;
            }

            @Override
            public CardinalityInterval getCardinality() {

                return this.cardinality;
            }

            @Override
            public Type.SimpleType getType() {

                return this.type;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserSeparatedElement(this);
            }

        }

        public static class AlternatedElement
                extends ParserElement {

            private final AAlternatedElement declaration;

            private String name;

            private IReferencable leftReference;

            private IReferencable rightReference;

            private Token elementToken;

            private String element;

            private CardinalityInterval cardinality;

            private Type.SimpleType type;

            public AlternatedElement(
                    AAlternatedElement declaration,
                    Grammar grammar,
                    ParserAlternative alternative) {

                super(grammar, alternative);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;

                this.cardinality = new CardinalityInterval(
                        this.declaration.getManyOperator());

                constructType();
            }

            private void constructType() {

                InformationExtractor extractor = new InformationExtractor(this);

                this.type = new Type.SimpleType.AlternatedType(
                        extractor.getLeftText(), extractor.getRightText(),
                        this.cardinality);
            }

            public AAlternatedElement getDeclaration() {

                return this.declaration;
            }

            public IReferencable getLeftReference() {

                return this.leftReference;
            }

            public void addLeftReference(
                    IReferencable leftReference) {

                if (this.leftReference == null) {
                    this.leftReference = leftReference;
                }
                else {
                    throw new InternalException(
                            "addReference shouldn't be used twice");
                }
            }

            public IReferencable getRightReference() {

                return this.rightReference;
            }

            public void addRightReference(
                    IReferencable rightReference) {

                if (this.rightReference == null) {
                    this.rightReference = rightReference;
                }
                else {
                    throw new InternalException(
                            "addReference shouldn't be used twice");
                }
            }

            @Override
            public String getImplicitName() {

                return null;
            }

            @Override
            public String getExplicitName() {

                String explicitName = null;

                if (this.declaration.getElementName() != null) {
                    explicitName = this.declaration.getElementName().getText();
                    explicitName = explicitName.substring(1,
                            explicitName.length() - 2);
                }

                return explicitName;
            }

            @Override
            public void setName(
                    String name) {

                this.name = name;
            }

            @Override
            public String getName() {

                return this.name;
            }

            @Override
            public Token getNameToken() {

                return this.declaration.getElementName();
            }

            @Override
            public String getNameType() {

                return "parser alternated element";
            }

            @Override
            public Token getLocation() {

                if (this.elementToken == null) {
                    this.elementToken = new InformationExtractor(this)
                            .getFirstToken();
                }

                return this.elementToken;
            }

            @Override
            public String getElement() {

                if (this.element == null) {
                    this.element = new InformationExtractor(this)
                            .getReferenceText();
                }

                return this.element;
            }

            @Override
            public CardinalityInterval getCardinality() {

                return this.cardinality;
            }

            @Override
            public Type.SimpleType getType() {

                return this.type;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserAlternatedELement(this);

            }

        }

        public static class DanglingElement
                extends ParserElement {

            private final ADanglingElement declaration;

            private String name;

            private Token nameToken;

            private Parser.ParserProduction.DanglingProduction reference;

            private Token elementToken;

            private String element;

            private CardinalityInterval cardinality;

            private Type.SimpleType type;

            public DanglingElement(
                    ADanglingElement declaration,
                    Grammar grammar,
                    ParserAlternative alternative) {

                super(grammar, alternative);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;

                this.element = new InformationExtractor(this)
                        .getReferenceText();

                this.cardinality = CardinalityInterval.ZERO_ONE;

                constructType();
            }

            private void constructType() {

                this.type = new Type.SimpleType.HomogeneousType(this.element,
                        this.cardinality);
            }

            public ADanglingElement getDeclaration() {

                return this.declaration;
            }

            public void addReference(
                    Parser.ParserProduction.DanglingProduction reference) {

                if (this.reference == null) {
                    this.reference = reference;
                }
                else {
                    throw new InternalException(
                            "addReference shouldn't be used twice");
                }
            }

            public Parser.ParserProduction.DanglingProduction getReference() {

                return this.reference;
            }

            @Override
            public String getImplicitName() {

                return this.declaration.getIdentifier().getText();
            }

            @Override
            public String getExplicitName() {

                String explicitName = null;

                if (this.declaration.getElementName() != null) {
                    explicitName = this.declaration.getElementName().getText();
                    explicitName = explicitName.substring(1,
                            explicitName.length() - 2);
                }

                return explicitName;
            }

            @Override
            public String getName() {

                return this.name;
            }

            @Override
            public void setName(
                    String name) {

                this.name = name;

            }

            @Override
            public Token getNameToken() {

                if (this.nameToken == null) {
                    if (getExplicitName() != null
                            && getExplicitName().equals(this.name)) {
                        this.nameToken = this.declaration.getElementName();
                    }
                    else if (getImplicitName().equals(this.name)) {
                        this.nameToken = this.declaration.getIdentifier();
                    }
                }

                return this.nameToken;
            }

            @Override
            public String getNameType() {

                return "parser dangling element";
            }

            @Override
            public Token getLocation() {

                if (this.elementToken == null) {
                    this.elementToken = new InformationExtractor(this)
                            .getFirstToken();
                }

                return this.elementToken;
            }

            @Override
            public String getElement() {

                return this.element;
            }

            @Override
            public CardinalityInterval getCardinality() {

                return this.cardinality;
            }

            @Override
            public Type.SimpleType getType() {

                return this.type;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitParserDanglingElement(this);

            }

        }

        private static class InformationExtractor
                extends DepthFirstAdapter {

            private String text = "";

            private String leftText = "";

            private String rightText = "";

            private Token token;

            public InformationExtractor(
                    Parser.ParserElement.NormalElement element) {

                element.getDeclaration().apply(this);
            }

            public InformationExtractor(
                    Parser.ParserElement.AlternatedElement element) {

                element.getDeclaration().apply(this);
            }

            public InformationExtractor(
                    Parser.ParserElement.SeparatedElement element) {

                element.getDeclaration().apply(this);
            }

            public InformationExtractor(
                    Parser.ParserElement.DanglingElement element) {

                element.getDeclaration().apply(this);
            }

            public String getReferenceText() {

                return this.text;
            }

            public Token getFirstToken() {

                return this.token;
            }

            public String getLeftText() {

                return this.leftText;
            }

            public String getRightText() {

                return this.rightText;
            }

            @Override
            public void caseADanglingElement(
                    ADanglingElement node) {

                this.text = node.getIdentifier().getText();
            }

            @Override
            public void caseANormalElement(
                    ANormalElement node) {

                node.getUnit().apply(this);
            }

            @Override
            public void caseAAlternatedElement(
                    AAlternatedElement node) {

                node.getLeft().apply(this);
                this.leftText = this.text;
                this.text = "";
                node.getRight().apply(this);
                this.rightText = this.text;
                this.text = "";
                this.text += "(" + this.leftText + " " + this.rightText + ")";
            }

            @Override
            public void caseASeparatedElement(
                    ASeparatedElement node) {

                node.getLeft().apply(this);
                this.leftText = this.text;
                this.text = "";
                node.getRight().apply(this);
                this.rightText = this.text;
                this.text = "";
                this.text += "(" + this.leftText + " Separtor "
                        + this.rightText + ")";
            }

            @Override
            public void caseANameUnit(
                    ANameUnit node) {

                if (this.token == null) {
                    this.token = node.getIdentifier();
                }

                this.text += node.getIdentifier().getText();
            }

            @Override
            public void caseAStringUnit(
                    AStringUnit node) {

                if (this.token == null) {
                    this.token = node.getString();
                }

                this.text += node.getString().getText();
            }

            @Override
            public void caseACharCharacter(
                    ACharCharacter node) {

                if (this.token == null) {
                    this.token = node.getChar();
                }

                this.text += node.getChar().getText();
            }

            @Override
            public void caseADecCharacter(
                    ADecCharacter node) {

                if (this.token == null) {
                    this.token = node.getDecChar();
                }

                this.text += node.getDecChar().getText();

            }

            @Override
            public void caseAHexCharacter(
                    AHexCharacter node) {

                if (this.token == null) {
                    this.token = node.getHexChar();
                }

                this.text += node.getHexChar().getText();
            }
        }

        public String getName_CamelCase() {

            String name = getName();
            return name == null ? null : to_CamelCase(name);
        }
    }

    public static abstract class ParserPriority
            implements IVisitableGrammarPart {

        private final Grammar grammar;

        private final ParserProduction production;

        public ParserPriority(
                Grammar grammar,
                ParserProduction production) {

            if (production == null) {
                throw new InternalException("production may not be null");
            }

            if (grammar == null) {
                throw new InternalException("grammar may not be null");
            }

            this.grammar = grammar;
            this.production = production;
        }

        public ParserProduction getProduction() {

            return this.production;
        }

        public static class LeftPriority
                extends ParserPriority {

            private final ALeftParserPriority declaration;

            public LeftPriority(
                    ALeftParserPriority declaration,
                    Grammar grammar,
                    ParserProduction production) {

                super(grammar, production);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;

            }

            public ALeftParserPriority getDeclaration() {

                return this.declaration;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitLeftParserPriority(this);

            }

        }

        public static class RightPriority
                extends ParserPriority {

            private final ARightParserPriority declaration;

            public RightPriority(
                    ARightParserPriority declaration,
                    Grammar grammar,
                    ParserProduction production) {

                super(grammar, production);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;
            }

            public ARightParserPriority getDeclaration() {

                return this.declaration;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitRightParserPriority(this);

            }

        }

        public static class UnaryPriority
                extends ParserPriority {

            private final AUnaryParserPriority declaration;

            public UnaryPriority(
                    AUnaryParserPriority declaration,
                    Grammar grammar,
                    ParserProduction production) {

                super(grammar, production);

                if (declaration == null) {
                    throw new InternalException("declaration may not be null");
                }

                this.declaration = declaration;
            }

            public AUnaryParserPriority getDeclaration() {

                return this.declaration;
            }

            @Override
            public void apply(
                    IGrammarVisitor visitor) {

                visitor.visitUnaryParserPriority(this);

            }

        }
    }
}


text:
`$ ab -n 100 -c 10 http://imdifakta.azurewebsites.net/api/v1/metadata/tables`
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient).....done

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/metadata/tables
Document Length:        1092 bytes

Concurrency Level:      10
Time taken for tests:   8.024 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      150600 bytes
HTML transferred:       109200 bytes
Requests per second:    12.46 [#/sec] (mean)
Time per request:       802.416 [ms] (mean)
Time per request:       80.242 [ms] (mean, across all concurrent requests)
Transfer rate:          18.33 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       31   42   8.0     38      57
Processing:   253  727 232.4    702    1681
Waiting:      252  726 232.7    702    1681
Total:        292  768 232.9    752    1732

Percentage of the requests served within a certain time (ms)
  50%    752
  66%    821
  75%    899
  80%    901
  90%   1052
  95%   1149
  98%   1510
  99%   1732
 100%   1732 (longest request)
```

# Header groups

## For table: arbledige_innvkat_land
`$ ab -n 100 -c 10 http://imdifakta.azurewebsites.net/api/v1/metadata/headergroups/arbledige_innvkat_land`
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient).....done

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/metadata/headergroups/arbledige_innvkat_land
Document Length:        4267 bytes

Concurrency Level:      10
Time taken for tests:   1.364 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      468100 bytes
HTML transferred:       426700 bytes
Requests per second:    73.33 [#/sec] (mean)
Time per request:       136.377 [ms] (mean)
Time per request:       13.638 [ms] (mean, across all concurrent requests)
Transfer rate:          335.20 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       33   42   8.7     39      62
Processing:    50   90  37.3     75     193
Waiting:       49   89  37.3     75     191
Total:         84  132  40.3    120     241

Percentage of the requests served within a certain time (ms)
  50%    120
  66%    152
  75%    157
  80%    166
  90%    190
  95%    221
  98%    240
  99%    241
 100%    241 (longest request)
```

## For table: befolkning_botid
`$ ab -n 100 -c 10 http://imdifakta.azurewebsites.net/api/v1/metadata/headergroups/befolkning_botid`
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient).....done

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/metadata/headergroups/befolkning_botid
Document Length:        4580 bytes

Concurrency Level:      10
Time taken for tests:   1.369 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      499400 bytes
HTML transferred:       458000 bytes
Requests per second:    73.03 [#/sec] (mean)
Time per request:       136.926 [ms] (mean)
Time per request:       13.693 [ms] (mean, across all concurrent requests)
Transfer rate:          356.17 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       32   38   6.0     35      58
Processing:    53   89  33.8     76     200
Waiting:       52   88  33.4     75     200
Total:         87  127  35.4    115     239

Percentage of the requests served within a certain time (ms)
  50%    115
  66%    138
  75%    148
  80%    152
  90%    179
  95%    196
  98%    233
  99%    239
 100%    239 (longest request)
```

## For table: barnehagedeltakelse
`$ ab -n 100 -c 10 http://imdifakta.azurewebsites.net/api/v1/metadata/headergroups/barnehagedeltakelse`
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient).....done

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/metadata/headergroups/barnehagedeltakelse
Document Length:        8599 bytes

Concurrency Level:      10
Time taken for tests:   1.624 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      901300 bytes
HTML transferred:       859900 bytes
Requests per second:    61.56 [#/sec] (mean)
Time per request:       162.440 [ms] (mean)
Time per request:       16.244 [ms] (mean, across all concurrent requests)
Transfer rate:          541.85 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       32   38   5.9     35      52
Processing:    87  117  32.4    106     289
Waiting:       53   80  30.4     70     238
Total:        120  155  35.6    145     340

Percentage of the requests served within a certain time (ms)
  50%    145
  66%    164
  75%    172
  80%    176
  90%    199
  95%    230
  98%    254
  99%    340
 100%    340 (longest request)
```

## For table: befolkning_innvandringsgrunn
`$ ab -n 100 -c 10 http://imdifakta.azurewebsites.net/api/v1/metadata/headergroups/befolkning_innvandringsgrunn`
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient).....done

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/metadata/headergroups/befolkning_innvandringsgrunn
Document Length:        4262 bytes

Concurrency Level:      10
Time taken for tests:   1.460 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      467600 bytes
HTML transferred:       426200 bytes
Requests per second:    68.48 [#/sec] (mean)
Time per request:       146.030 [ms] (mean)
Time per request:       14.603 [ms] (mean, across all concurrent requests)
Transfer rate:          312.70 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       29   38   6.4     36      54
Processing:    49  102  79.1     71     567
Waiting:       49  102  79.1     70     566
Total:         83  140  79.0    111     601

Percentage of the requests served within a certain time (ms)
  50%    111
  66%    135
  75%    153
  80%    163
  90%    222
  95%    328
  98%    443
  99%    601
 100%    601 (longest request)
```

# Queries
## Request payload (simple)
`$ ab -n 200 -c 10 -p test/benchmarks/queries/simple.json -T 'application/json' http://imdifakta.azurewebsites.net/api/v1/query`
```json
{
  "TableName": "befolkning_hovedgruppe",
  "Include": [
    "innvkat5",
    "kjonn",
    "kommuneNr",
    "enhet",
    "aar"
  ],
  "Conditions": {
    "innvkat5": [
      "innvandrere",
      "bef_u_innv_og_norskf",
      "norskfodte_m_innvf"
    ],
    "kjonn": [
      "alle"
    ],
    "kommuneNr": [
      "0301"
    ],
    "enhet": [
      "personer"
    ],
    "aar": [
      "2015"
    ]
  }
}
```
### Benchmark results
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient)

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/query
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   2.905 seconds
Complete requests:      200
Failed requests:        0
Total transferred:      61000 bytes
Total body sent:        114000
HTML transferred:       0 bytes
Requests per second:    68.86 [#/sec] (mean)
Time per request:       145.228 [ms] (mean)
Time per request:       14.523 [ms] (mean, across all concurrent requests)
Transfer rate:          20.51 [Kbytes/sec] received
                        38.33 kb/s sent
                        58.84 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       30   37   5.6     34      53
Processing:    39  106  51.9     86     269
Waiting:       39  106  51.9     86     269
Total:         76  143  53.3    128     319

Percentage of the requests served within a certain time (ms)
  50%    128
  66%    151
  75%    173
  80%    189
  90%    225
  95%    240
  98%    297
  99%    313
 100%    319 (longest request)
```
## Request payload (timeseries)
`$ ab -n 200 -c 10 -p test/benchmarks/queries/timeseries.json -T 'application/json' http://imdifakta.azurewebsites.net/api/v1/query`
```json
{
  "TableName": "befolkning_hovedgruppe",
  "Include": [
    "innvkat5",
    "kjonn",
    "kommuneNr",
    "enhet",
    "aar"
  ],
  "Conditions": {
    "innvkat5": [
      "innvandrere",
      "bef_u_innv_og_norskf",
      "norskfodte_m_innvf"
    ],
    "kjonn": [
      "alle"
    ],
    "kommuneNr": [
      "0301"
    ],
    "enhet": [
      "personer"
    ]
  }
}
```
### Benchmark results
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient)

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/query
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   2.225 seconds
Complete requests:      200
Failed requests:        0
Total transferred:      61000 bytes
Total body sent:        107400
HTML transferred:       0 bytes
Requests per second:    89.89 [#/sec] (mean)
Time per request:       111.249 [ms] (mean)
Time per request:       11.125 [ms] (mean, across all concurrent requests)
Transfer rate:          26.77 [Kbytes/sec] received
                        47.14 kb/s sent
                        73.91 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       31   37   5.7     34      52
Processing:    38   73  32.8     59     158
Waiting:       38   73  32.8     59     158
Total:         70  109  34.6     95     208

Percentage of the requests served within a certain time (ms)
  50%     95
  66%    112
  75%    124
  80%    138
  90%    171
  95%    187
  98%    199
  99%    207
 100%    208 (longest request)
```
## Request payload (timeseries-multi-region)
`$ ab -n 200 -c 10 -p test/benchmarks/queries/timeseries-multi-region.json -T 'application/json' http://imdifakta.azurewebsites.net/api/v1/query`
```json
{
  "TableName": "befolkning_hovedgruppe",
  "Include": [
    "innvkat5",
    "kjonn",
    "kommuneNr",
    "enhet",
    "aar"
  ],
  "Conditions": {
    "innvkat5": [
      "alle"
    ],
    "kjonn": [
      "alle"
    ],
    "kommuneNr": [
      "0301",
      "0104",
      "0105",
      "0106",
      "0219",
      "0220",
      "0228",
      "0235",
      "0230",
      "0602",
      "1001",
      "1102",
      "0231",
      "1601",
      "1201",
      "1103"
    ],
    "enhet": [
      "personer"
    ]
  }
}
```
### Benchmark results
```
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking imdikator-st.azurewebsites.net (be patient)

Server Software:        Microsoft-IIS/8.0
Server Hostname:        imdikator-st.azurewebsites.net
Server Port:            80

Document Path:          /api/v1/query
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   2.892 seconds
Complete requests:      200
Failed requests:        0
Total transferred:      61000 bytes
Total body sent:        136400
HTML transferred:       0 bytes
Requests per second:    69.15 [#/sec] (mean)
Time per request:       144.611 [ms] (mean)
Time per request:       14.461 [ms] (mean, across all concurrent requests)
Transfer rate:          20.60 [Kbytes/sec] received
                        46.06 kb/s sent
                        66.65 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       29   37   6.0     34      53
Processing:    39  104  54.9     96     277
Waiting:       39  104  54.9     96     277
Total:         71  141  55.2    131     328

Percentage of the requests served within a certain time (ms)
  50%    131
  66%    156
  75%    169
  80%    174
  90%    206
  95%    285
  98%    302
  99%    314
 100%    328 (longest request)
```


text:
package org.apache.hadoop.record.meta;

import java.io.IOException;

import org.apache.hadoop.record.RecordOutput;

/**
 * Represents typeID for vector.
 */
public class VectorTypeID extends TypeID {
	private TypeID typeIDElement;

	public VectorTypeID(TypeID typeIDElement) {
		super(RIOType.VECTOR);
		this.typeIDElement = typeIDElement;
	}

	public TypeID getElementTypeID() {
		return this.typeIDElement;
	}

	void write(RecordOutput rout, String tag) throws IOException {
		rout.writeByte(typeVal, tag);
		typeIDElement.write(rout, tag);
	}

	/**
	 * Two vector typeIDs are equal if their constituent elements have the same
	 * type
	 */
	public boolean equals(Object o) {
		if (!super.equals(o))
			return false;

		VectorTypeID vti = (VectorTypeID) o;
		return this.typeIDElement.equals(vti.typeIDElement);
	}

	/**
	 * We use a basic hashcode implementation, since this class will likely not
	 * be used as a hashmap key
	 */
	public int hashCode() {
		return 37 * 17 + typeIDElement.hashCode();
	}

}


text:
<?php echo $username;?>, изберeте програма, за която ще въвеждате данни

		<img src="<?php echo base_url('assets/img/heading_sep.png');?>" alt="Separator">

	<?php echo form_open('user/add_data_second');?>

		<?php

	//SELECT PROGRAMM TYPE

		foreach ($program_type as $program) {
			$program_options[$program['programm_type_id']] = $program['programm_type'];
		}

		$program_value = $this->input->post('program_type');
		echo form_dropdown('program_type', $program_options, set_value('program_type', ( ( !empty($program_value) ) ? "$program_value" : 0 ) ));
		?>

		<?php
//SUBMIT BUTTON
		$submit_button = array(
			'name' => 'submit',
			'value' => 'Избери'
			);

		echo form_submit($submit_button);
		?>

	<?php

	echo form_close();

	?>


text:
package com.slx.funstream.ui.user;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;

import com.google.gson.Gson;
import com.jakewharton.rxbinding2.view.RxView;
import com.slx.funstream.App;
import com.slx.funstream.R;
import com.slx.funstream.auth.UserStore;
import com.slx.funstream.model.SimpleToken;
import com.slx.funstream.rest.model.CurrentUser;
import com.slx.funstream.utils.PrefUtils;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import dagger.android.AndroidInjection;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subscribers.DisposableSubscriber;

public class UserActivity extends RxAppCompatActivity {
    private static final String TAG = "UserActivity";

    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.tvUserName)
    TextView tvUserName;
    @BindView(R.id.tvExpire)
    TextView tvExpire;

    @BindView(R.id.btLogOut)
    Button btLogOut;

    @Inject
    UserStore userStore;
    @Inject
    PrefUtils prefUtils;
    @Inject
    Gson gson;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        AndroidInjection.inject(this);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user);
        ButterKnife.bind(this);

        if (toolbar != null) {
            setSupportActionBar(toolbar);
        }

        RxView.clicks(btLogOut)
                .compose(bindToLifecycle())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(aVoid -> {
                    prefUtils.clearUser();
                    prefUtils.clearUserCode();
                    finish();
                });

        userStore.userObservable()
                .subscribeOn(Schedulers.io())
//                .map(user -> {
//                    api.userObservable(new ChatUser(user.getId()));
//                })
                .observeOn(AndroidSchedulers.mainThread())
                .compose(bindToLifecycle())
                .subscribe(new DisposableSubscriber<CurrentUser>() {
                    @Override
                    public void onNext(CurrentUser currentUser) {
                        Log.d(TAG, "UserStore->fetchUser->onNext " + currentUser);
                        tvUserName.setText(currentUser.getName());
                        SimpleToken simpleToken = UserStore.parseToken(currentUser.getToken(), gson);
                        if (simpleToken != null) {
                            Locale current = getResources().getConfiguration().locale;
                            SimpleDateFormat formatter = new SimpleDateFormat("dd-mm-yyyy", current);
                            Calendar calendar = Calendar.getInstance();
                            calendar.setTimeInMillis(simpleToken.getExp() * 1000);
                            tvExpire.setText(formatter.format(calendar.getTime()));
                        }
                    }

                    @Override
                    public void onError(Throwable t) {
                        t.printStackTrace();
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}


text:
package io.reactivex.netty.examples.http.interceptors.transformation;

import io.netty.handler.codec.http.DefaultHttpResponse;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;
import io.reactivex.netty.examples.ExamplesTestUtil;
import io.reactivex.netty.protocol.http.internal.HttpMessageFormatter;
import org.junit.Test;

import java.util.Queue;

import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;

public class TransformingInterceptorTest {

    @Test(timeout = 60000)
    public void testTransformingInterceptor() throws Exception {

        Queue<String> output = ExamplesTestUtil.runClientInMockedEnvironment(InterceptingClient.class);

        HttpResponse expectedHeader = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
        expectedHeader.headers().add(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
        String expectedHeaderString = HttpMessageFormatter.formatResponse(expectedHeader.protocolVersion(),
                                                                          expectedHeader.status(),
                                                                          expectedHeader.headers().iteratorCharSequence());

        assertThat("Unexpected number of messages echoed", output, hasSize(3));

        assertThat("Unexpected response.", output, contains(expectedHeaderString, "1", "2"));
    }
}