text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="roboto_calendar_padding">8dp</dimen>
    <dimen name="roboto_calendar_month_margin_bottom">8dp</dimen>
    <dimen name="roboto_calendar_week_margin_bottom">5dp</dimen>
    <dimen name="roboto_calendar_day_of_the_month_background_size">40dp</dimen>
    <dimen name="roboto_calendar_circle_size">4dp</dimen>
    <dimen name="roboto_calendar_ring_size">18dp</dimen>
    <dimen name="roboto_calendar_month_font">16sp</dimen>
    <dimen name="roboto_calendar_day_of_week_font">16sp</dimen>
    <dimen name="roboto_calendar_day_of_the_month_font">16sp</dimen>
</resources>


text:
var mat4 = {
    create: require('gl-mat4/create'),
    multiply: require('gl-mat4/multiply')
}

var tmpMat = mat4.create()

function Projector(opt) {
    opt = opt||{}
    this.combined = mat4.create()
    this.view = mat4.create
    this.invCombined = mat4.create()
}

Projector.prototype.build = function(projection, position, direction, up) {
    //build the view matrix
    mat4.add(tmpMat, position, direction)
    mat4.lookAt()
    tmpVec3.copy(this.position).add(this.direction);
    this.view.lookAt(this.position, tmpVec3, this.up);

    //projection * view matrix
    this.combined.copy(this.projection).mul(this.view);

    //invert combined matrix, used for unproject
    this.invProjectionView.copy(this.combined).invert();
}

function project(vec3d, out) {
    if (!out)
        out = new Vector4();

    var viewportWidth = this.viewportWidth,
        viewportHeight = this.viewportHeight,
        n = 1,
        f = 0;

    // for useful Z and W values we should do the usual steps...
    //    clip space -> NDC -> window coords

    //implicit 1.0 for w component
    tmpVec4.set(vec.x, vec.y, vec.z, 1.0);

    //transform into clip space
    tmpVec4.transformMat4(this.combined);

    //now into NDC
    tmpVec4.x = tmpVec4.x / tmpVec4.w;
    tmpVec4.y = tmpVec4.y / tmpVec4.w;
    tmpVec4.z = tmpVec4.z / tmpVec4.w;

    //and finally into window coordinates
    out.x = viewportWidth / 2 * tmpVec4.x + (0 + viewportWidth / 2);
    out.y = viewportHeight / 2 * tmpVec4.y + (0 + viewportHeight / 2);
    out.z = (f - n) / 2 * tmpVec4.z + (f + n) / 2;

    //if the out vector has a fourth component, we also store (1/clip.w)
    //same idea as gl_FragCoord.w
    if (out.w === 0 || out.w)
        out.w = 1 / tmpVec4.w;

    return out;
},

redpajama_set_name: RedPajamaGithub


text:
package org.springsource.loaded;

import org.objectweb.asm.ClassReader;

/**
 * Can be used to take a quick look in the bytecode for something. The various static get* methods are the things that
 * the quick visitor can discover.
 *
 * @author Andy Clement
 * @since 0.7.3
 */
public class QuickVisitor {

	public static String[] getImplementedInterfaces(byte[] bytes) {
		ClassReader fileReader = new ClassReader(bytes);
		QuickVisitor1 qv = new QuickVisitor1();
		try {
			fileReader.accept(qv, ClassReader.SKIP_FRAMES);// TODO more flags to skip other things?
		}
		catch (EarlyExitException eee) {
		}
		return qv.interfaces;
	}

	static class QuickVisitor1 extends EmptyClassVisitor {

		String[] interfaces;

		@Override
		public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
			this.interfaces = interfaces;
			// TODO is it truly easier to exit via exception than to visit the rest of it?
			throw new EarlyExitException();
		}
	}

	@SuppressWarnings("serial")
	private static class EarlyExitException extends RuntimeException {

	}

	//	public static int investigate(String slashedClassName, byte[] bytes) {
	//		ClassReader fileReader = new ClassReader(bytes);
	//		RewriteClassAdaptor classAdaptor = new RewriteClassAdaptor();
	//		fileReader.accept(classAdaptor, ClassReader.SKIP_FRAMES);
	//		return classAdaptor.hitCount;
	//	}
	//
	//	static class RewriteClassAdaptor extends ClassAdapter implements Constants {
	//
	//		int hitCount = 0;
	//		private ClassWriter cw;
	//		int bits = 0x0000;
	//		private String classname;
	//
	//		private static boolean isInterceptable(String owner, String methodName) {
	//			return MethodInvokerRewriter.RewriteClassAdaptor.intercepted.contains(owner + "." + methodName);
	//		}
	//
	//		public RewriteClassAdaptor() {
	//			// TODO should it also compute frames?
	//			super(new ClassWriter(ClassWriter.COMPUTE_MAXS));
	//			cw = (ClassWriter) cv;
	//		}
	//
	//		public byte[] getBytes() {
	//			byte[] bytes = cw.toByteArray();
	//			return bytes;
	//		}
	//
	//		public int getBits() {
	//			return bits;
	//		}
	//
	//		@Override
	//		public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
	//			super.visit(version, access, name, signature, superName, interfaces);
	//			this.classname = name;
	//		}
	//
	//		@Override
	//		public MethodVisitor visitMethod(int flags, String name, String descriptor, String signature, String[] exceptions) {
	//			MethodVisitor mv = super.visitMethod(flags, name, descriptor, signature, exceptions);
	//			return new RewritingMethodAdapter(mv);
	//		}
	//
	//		class RewritingMethodAdapter extends MethodAdapter implements Opcodes, Constants {
	//
	//			public RewritingMethodAdapter(MethodVisitor mv) {
	//				super(mv);
	//			}
	//
	//			private boolean interceptReflection(String owner, String name, String desc) {
	//				if (isInterceptable(owner, name)) {
	//					hitCount++;
	//					System.out.println("SystemClassReflectionInvestigator: " + classname + "  uses " + owner + "." + name + desc);
	//				}
	//				return false;
	//			}
	//
	//			int unitializedObjectsCount = 0;
	//
	//			@Override
	//			public void visitTypeInsn(final int opcode, final String type) {
	//				if (opcode == NEW) {
	//					unitializedObjectsCount++;
	//				}
	//				super.visitTypeInsn(opcode, type);
	//			}
	//
	//			@Override
	//			public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
	//				if (!GlobalConfiguration.interceptReflection || rewriteReflectiveCall(opcode, owner, name, desc)) {
	//					return;
	//				}
	//				if (opcode == INVOKESPECIAL) {
	//					unitializedObjectsCount--;
	//				}
	//				super.visitMethodInsn(opcode, owner, name, desc);
	//			}
	//
	//			/**
	//			 * Determine if a method call is a reflective call and an attempt should be made to rewrite it.
	//			 *
	//			 * @return true if the call was rewritten
	//			 */
	//			private boolean rewriteReflectiveCall(int opcode, String owner, String name, String desc) {
	//				if (owner.length() > 10 && owner.charAt(8) == 'g'
	//						&& (owner.startsWith("java/lang/reflect/") || owner.equals("java/lang/Class"))) {
	//					boolean rewritten = interceptReflection(owner, name, desc);
	//					if (rewritten) {
	//						return true;
	//					}
	//				}
	//				return false;
	//			}
	//
	//		}
	//	}
}


text:
Simulation system      {#simulation_system}
=================

The Chrono system contains all other objects being simulated, e.g.:
[bodies](@ref rigid_bodies), [links](@ref links), etc.
The system is the cornerstone of a Chrono simulation.

\tableofcontents

# ChSystem  {#manual_ChSystem}

A Chrono simulation system is an object of class ChSystem.
See @ref chrono::ChSystem for API details.

Note that ChSystem is an abstract class: you must instantiate one of its specializations. In detail you can use of these sublclasses:

- A @ref chrono::ChSystemNSC , for **Non Smooth Contacts** (NSC); in case of contacts a complementarity solver will take care of them using non smooth dynamics; this is very efficient even with large time steps.

- A @ref chrono::ChSystemSMC , for **SMooth Contacts** (SMC); with this system contacts are handled using penalty methods, i.e. contacts are deformable;

If there are no contacts or collisions in your system, it is indifferent to use ChSystemNSC or ChSystemSMC.

Example:
The following picture shows how mechanisms turn into a database of bodies
and links in a ChSystem:

![](http://www.projectchrono.org/assets/manual/pic_database.png)

- A @ref chrono::ChSystem contains all items that participate in a simulation: bodies, constraints, numerical integrator type, integration tolerances, etc.

- Use the ```Add()```, ```Remove()``` functions to add elements to a system object

Recommended way of dealing with system objects:

- Create a @ref chrono::ChSystemNSC  or a @ref chrono::ChSystemSMC
- Add [body](@ref rigid_bodies) objects into it, see @ref chrono::ChBody
- Add [link](@ref links) objects into it, see @ref chrono::ChLink
- Adjust parameters for the time integration
- Run a dynamics simulation of a certain length

Example: a slider-crank mechanism

~~~{.cpp}
// 1- Create a Chrono physical system: all bodies and constraints
//    will belong to and be handled by this ChSystemNSC object.
ChSystemNSC my_system;

// 2- Create the rigid bodies of the slider-crank
//   (a crank, a rod, a truss), possibly setting their position/mass/inertias attributes

// ..the truss
auto my_body_A = std::make_shared<ChBody>();
my_system.AddBody(my_body_A);
my_body_A->SetBodyFixed(true);  // the truss doesn't move

// ..the crank
auto my_body_B = std::make_shared<ChBody>();
my_system.AddBody(my_body_B);
my_body_B->SetPos(ChVector<>(1, 0, 0));  // position of COG of crank
my_body_B->SetMass(2);

// ..the connecting rod
auto my_body_C = std::make_shared<ChBody>();
my_system.AddBody(my_body_C);
my_body_C->SetPos(ChVector<>(4, 0, 0));  // position of COG of rod
my_body_C->SetMass(3);

// 3- Create constraints: the mechanical joints
//    between the rigid bodies.

// .. a revolute joint between the crank and rod
auto my_link_BC = std::make_shared<ChLinkLockRevolute>();
my_link_BC->Initialize(my_body_B, my_body_C, ChCoordsys<>(ChVector<>(2, 0, 0)));
my_system.AddLink(my_link_BC);

// .. a slider joint between the rod and truss
auto my_link_CA = std::make_shared<ChLinkLockPointLine>();
my_link_CA->Initialize(my_body_C, my_body_A, ChCoordsys<>(ChVector<>(6, 0, 0)));
my_system.AddLink(my_link_CA);

// .. an engine (motion generator) between the crank and truss
auto my_link_AB = std::make_shared<ChLinkEngine>();
my_link_AB->Initialize(my_body_A, my_body_B, ChCoordsys<>(ChVector<>(0, 0, 0)));
my_link_AB->Set_eng_mode(ChLinkEngine::ENG_MODE_SPEED);
if (auto mfun = std::dynamic_pointer_cast<ChFunction_Const>(my_link_AB->Get_spe_funct()))
	mfun->Set_yconst(CH_C_PI);  // speed w=3.145 rad/sec
my_system.AddLink(my_link_AB);

// 4- Adjust settings of the integrator (optional):
my_system.SetIntegrationType(ChSystem::INT_IMPLICIT_EULER)
my_system.SetSolverType(ChSystem::SOLVER_SOR);
my_system.SetMaxItersSolverSpeed(20);
my_system.SetMaxItersSolverStab(20);
my_system.SetMaxPenetrationRecoverySpeed(0.2);
my_system.SetMinBounceSpeed(0.1);

// 5- Run the simulation (basic example)

while( my_system.GetChTime() < 10 )
{
	// Chrono advances the state of the system via time integration
	// with a time step of 0.02
	my_system.StepDynamics(0.02);

	// Draw items on screen (lines, circles, etc.) or dump data to disk
	[..]
}
~~~

The default simulation settings are good for real-time
fast simulations with low requirements in terms of precision
and with similar sizes and inertia attributes.

Several system settings may be adjusted to simulate more challenging scenarios.
In most cases there are three areas to adjust:

- The **time stepper**; i.e., the time integration algorithm
- The **solver**; i.e., the algorithm that computes accelerations and reaction forces at each time step
- Other settings, for instance, the collision detection tolerances

A primer on tuning these parameters is provided below.

# Time steppers {#time_steppers}

Time steppers, also known as _time integrators_, are used to advance the simulation. They perform numerical integration; i.e., they advance the state of the system in time.

Technical and theoretical details on time integration are explained in several PDF documents
available on the [white papers page](http://projectchrono.org/whitepapers/). For example
[this PDF](http://projectchrono.org/assets/white_papers/integrator.pdf) explains how
implicit integrators are implemented in Chrono.

Time steppers can be changed in two ways:
- Using the ```my_system.SetTimestepperType(...)``` function, to choose a ready-to-use, pre-packaged time-stepper
- Using the ```my_system.SetTimestepper(...)``` function, to plug in a custom time-stepper, which is user-defined

Example: changing the time stepper to an implicit numerical integrator

~~~{.cpp}
my_system.SetTimestepperType(ChTimestepper::Type::IMPLICIT_EULER)
~~~

Summary of time-steppers:

- ```EULER_IMPLICIT_LINEARIZED```
	- Default time stepper in Chrono
	- Fast, no sub-iterations required
	- First order accuracy
	- Works for DVI contacts (hard contacts)
	- Delivers first order accuracy for FEA
	- Constraints kept closed using stabilization
- ```HHT```
	- Implicit integrator, based on the Hilber-Hughes-Taylor formula
	- Typically slower than the INT_EULER_IMPLICIT_LINEARIZED choice
	- Sub-iterations required
	- Second order accuracy, with adjustable numerical damping
	- Currently can't be used for systems that handle contacts in a DVI approach; i.e., for hard contacts
	- Delivers second order accuracy for FEA
	- Constraints kept closed _exactly_ because of inner iterations.
- ```NEWMARK```
    - Popular in the FEA community, similar properties as INT_HHT
	- With the exception of one particular choice of parameters (in which it becomes the trapezoidal integration rule) it delivers first order accuracy

	In the above, the meaning of 'first order' or 'second order' accuracy is that the global integration error goes to zero as the value of the time step (or square of the time step for a second order method).

Depending on the type of time-stepper used, there may be different parameters to adjust.
Example:

~~~{.cpp}
if (auto mystepper = std::dynamic_pointer_cast<ChTimestepperHHT>(my_system.GetTimestepper())) {
    mystepper->SetAlpha(-0.2);
    ...
}
~~~

See @ref chrono::ChTimestepper for API details.

# Solvers {#solvers}

A solver is called by a time stepper to compute
the unknown accelerations and unknown reaction forces at each time step of the simulation. Most often they represent
the biggest computational bottleneck of the entire simulation.

Solvers can be changed in two ways:
- Using the ```my_system.SetSolverType(...)``` function, to choose a ready-to-use, pre-packaged option
- Using the ```my_system.SetSolver(...)``` function, to plug in a custom time-stepper, which is user-defined

Example:

~~~{.cpp}
my_system.SetSolverType(ChSolver::Type::SOR);
~~~

We recommend using one of the following iterative solvers:

- ```SOR```
	- low precision: convergence might stall, especially with odd mass ratios
	- supports DVI (hard contacts, with complementarity)
	- used most often for small problems, solution accuracy is not particularly important

- ```APGD```
	- very good convergence, used most often for simulations in which high accuracy in results is desired
	- supports DVI (hard contacts, with complementarity)

- ```BARZILAIBORWEIN```
    - good convergence
	- supports DVI (hard contacts, with complementarity)
    - similar to ```APGD```, might be more robust when using large mass ratios

- ```MINRES```
    - good convergence
    - supports FEA problems
    - does nor support DVI (hard contacts, with complementarity) for the moment.

Most iterative solvers have a default value for the max number of iterations for convergence.

- When this number is higher, the solver has the chance to 'try harder', which might lead to longer simulation times

- When this value is low, the solver is faster but the solution at the end of the iterative process might be not fully converged

The max. number of iterations can be changed as follows:

~~~{.cpp}
// Change the max iterations for the solver
my_system.SetMaxItersSolverSpeed(20);
~~~

Depending on the type of integrator used, there may be different parameters to adjust.
Advanced settings are not accessible directly from @ref chrono::ChSystem,
for instance:

~~~{.cpp}
if (auto msolver = std::dynamic_pointer_cast<ChSolverMINRES>(my_system.GetSolver())) {
	msolver->SetDiagonalPreconditioning(true);
}
~~~

See @ref chrono::ChSolver for API for further details.

# Other parameters  {#other_simulation_parameters}

There are many integrator/solver settings that can affect the outcome of a simulation. For instance, see [collision tolerances](@ref collision_tolerances) to gain a better understanding of the interplay between the accuracy in the collision detection and robustness of a simulation. We focus below on two important settings related to handling collisions in a simulation in which bodies collide with each other and/or with the ground.

### Max. recovery speed

Bodies in contact that interpenetrate for various reasons, e.g., small numerical integration error, inconsistent initial conditions, etc., will not 'escape' this contact violation at a speed faster than this threshold. The recovery speed is in general problem dependent and is controlled by user as shown below.

~~~{.cpp}
my_system.SetMaxPenetrationRecoverySpeed(0.2);
~~~

- Larger values allow a more aggressive correction of the penetration, yet this can lead to scenarios in which bodies in contact pop out fast or in stacking problems the stack becoming jittery, noisy
- A small threshold increases the risk that objects _sink_ into one another when integrator precision is low, for instance, when the solver has a small max number of iterations

### Min. bounce speed

When objects collide, if their incoming speed is lower than
this threshold, a zero restitution coefficient is assumed.
This helps to achieve more stable simulations of stacked objects.

~~~{.cpp}
my_system.SetMinBounceSpeed(0.1);
~~~
- A higher value leads to more stable simulations but less physically realistic collisions

- Lower values lead to a more physically realistic time evolution but require small integration time steps otherwise objects may keep bounce erratically

# Theory

Additional information regarding the time integration strategies implemented
in Chrono can be found on the  [white papers page](http://projectchrono.org/whitepapers/).


text:
title: k
layout: dict_letter
morse: ‒ • ‒
pho: Kilo
---
> I wish to communicate with you.


text: export { default as GlimmerApp } from './broccoli/glimmer-app';


text:
d3.behavior.zoom = function() {
  var xyz = [0, 0, 0],
      event = d3.dispatch("zoom"),
      extent = d3_behavior_zoomInfiniteExtent;

  function zoom() {
    this
        .on("mousedown.zoom", mousedown)
        .on("mousewheel.zoom", mousewheel)
        .on("DOMMouseScroll.zoom", mousewheel)
        .on("dblclick.zoom", dblclick)
        .on("touchstart.zoom", touchstart);

    d3.select(window)
        .on("mousemove.zoom", d3_behavior_zoomMousemove)
        .on("mouseup.zoom", d3_behavior_zoomMouseup)
        .on("touchmove.zoom", d3_behavior_zoomTouchmove)
        .on("touchend.zoom", d3_behavior_zoomTouchup)
        .on("click.zoom", d3_behavior_zoomClick, true);
  }

  // snapshot the local context for subsequent dispatch
  function start() {
    d3_behavior_zoomXyz = xyz;
    d3_behavior_zoomExtent = extent;
    d3_behavior_zoomDispatch = event.zoom;
    d3_behavior_zoomEventTarget = d3.event.target;
    d3_behavior_zoomTarget = this;
    d3_behavior_zoomArguments = arguments;
  }

  function mousedown() {
    start.apply(this, arguments);
    d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
    d3_behavior_zoomMoved = 0;
    d3.event.preventDefault();
    window.focus();
  }

  // store starting mouse location
  function mousewheel() {
    start.apply(this, arguments);
    if (!d3_behavior_zoomZooming) d3_behavior_zoomZooming = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
    d3_behavior_zoomTo(d3_behavior_zoomDelta() + xyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomZooming);
  }

  function dblclick() {
    start.apply(this, arguments);
    var mouse = d3.svg.mouse(d3_behavior_zoomTarget);
    d3_behavior_zoomTo(d3.event.shiftKey ? Math.ceil(xyz[2] - 1) : Math.floor(xyz[2] + 1), mouse, d3_behavior_zoomLocation(mouse));
  }

  // doubletap detection
  function touchstart() {
    start.apply(this, arguments);
    var touches = d3_behavior_zoomTouchup(),
        touch,
        now = Date.now();
    if ((touches.length === 1) && (now - d3_behavior_zoomLast < 300)) {
      d3_behavior_zoomTo(1 + Math.floor(xyz[2]), touch = touches[0], d3_behavior_zoomLocations[touch.identifier]);
    }
    d3_behavior_zoomLast = now;
  }

  zoom.extent = function(x) {
    if (!arguments.length) return extent;
    extent = x == null ? d3_behavior_zoomInfiniteExtent : x;
    return zoom;
  };

  return d3.rebind(zoom, event, "on");
};

var d3_behavior_zoomDiv,
    d3_behavior_zoomPanning,
    d3_behavior_zoomZooming,
    d3_behavior_zoomLocations = {}, // identifier -> location
    d3_behavior_zoomLast = 0,
    d3_behavior_zoomXyz,
    d3_behavior_zoomExtent,
    d3_behavior_zoomDispatch,
    d3_behavior_zoomEventTarget,
    d3_behavior_zoomTarget,
    d3_behavior_zoomArguments,
    d3_behavior_zoomMoved;

function d3_behavior_zoomLocation(point) {
  return [
    point[0] - d3_behavior_zoomXyz[0],
    point[1] - d3_behavior_zoomXyz[1],
    d3_behavior_zoomXyz[2]
  ];
}

// detect the pixels that would be scrolled by this wheel event
function d3_behavior_zoomDelta() {

  // mousewheel events are totally broken!
  // https://bugs.webkit.org/show_bug.cgi?id=40441
  // not only that, but Chrome and Safari differ in re. to acceleration!
  if (!d3_behavior_zoomDiv) {
    d3_behavior_zoomDiv = d3.select("body").append("div")
        .style("visibility", "hidden")
        .style("top", 0)
        .style("height", 0)
        .style("width", 0)
        .style("overflow-y", "scroll")
      .append("div")
        .style("height", "2000px")
      .node().parentNode;
  }

  var e = d3.event, delta;
  try {
    d3_behavior_zoomDiv.scrollTop = 1000;
    d3_behavior_zoomDiv.dispatchEvent(e);
    delta = 1000 - d3_behavior_zoomDiv.scrollTop;
  } catch (error) {
    delta = e.wheelDelta || (-e.detail * 5);
  }

  return delta * .005;
}

// Note: Since we don't rotate, it's possible for the touches to become
// slightly detached from their original positions. Thus, we recompute the
// touch points on touchend as well as touchstart!
function d3_behavior_zoomTouchup() {
  var touches = d3.svg.touches(d3_behavior_zoomTarget),
      i = -1,
      n = touches.length,
      touch;
  while (++i < n) d3_behavior_zoomLocations[(touch = touches[i]).identifier] = d3_behavior_zoomLocation(touch);
  return touches;
}

function d3_behavior_zoomTouchmove() {
  var touches = d3.svg.touches(d3_behavior_zoomTarget);
  switch (touches.length) {

    // single-touch pan
    case 1: {
      var touch = touches[0];
      d3_behavior_zoomTo(d3_behavior_zoomXyz[2], touch, d3_behavior_zoomLocations[touch.identifier]);
      break;
    }

    // double-touch pan + zoom
    case 2: {
      var p0 = touches[0],
          p1 = touches[1],
          p2 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2],
          l0 = d3_behavior_zoomLocations[p0.identifier],
          l1 = d3_behavior_zoomLocations[p1.identifier],
          l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2, l0[2]];
      d3_behavior_zoomTo(Math.log(d3.event.scale) / Math.LN2 + l0[2], p2, l2);
      break;
    }
  }
}

function d3_behavior_zoomMousemove() {
  d3_behavior_zoomZooming = null;
  if (d3_behavior_zoomPanning) {
    d3_behavior_zoomMoved = 1;
    d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning);
  }
}

function d3_behavior_zoomMouseup() {
  if (d3_behavior_zoomPanning) {
    if (d3_behavior_zoomMoved) {
      d3_eventCancel();
      d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target;
    }

    d3_behavior_zoomXyz =
    d3_behavior_zoomExtent =
    d3_behavior_zoomDispatch =
    d3_behavior_zoomEventTarget =
    d3_behavior_zoomTarget =
    d3_behavior_zoomArguments =
    d3_behavior_zoomPanning = null;
  }
}

function d3_behavior_zoomClick() {
  if (d3_behavior_zoomMoved) {
    d3_eventCancel();
    d3_behavior_zoomMoved = 0;
  }
}

function d3_behavior_zoomTo(z, x0, x1) {
  z = d3_behavior_zoomExtentClamp(z, 2);
  var j = Math.pow(2, d3_behavior_zoomXyz[2]),
      k = Math.pow(2, z),
      K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]),
      x_ = d3_behavior_zoomXyz[0],
      y_ = d3_behavior_zoomXyz[1],
      x = d3_behavior_zoomXyz[0] = d3_behavior_zoomExtentClamp((x0[0] - x1[0] * K), 0, k),
      y = d3_behavior_zoomXyz[1] = d3_behavior_zoomExtentClamp((x0[1] - x1[1] * K), 1, k),
      o = d3.event; // Events can be reentrant (e.g., focus).

  d3.event = {
    scale: k,
    translate: [x, y],
    transform: function(sx, sy) {
      if (sx) transform(sx, x_, x);
      if (sy) transform(sy, y_, y);
    }
  };

  function transform(scale, a, b) {
    scale.domain(scale.range().map(function(v) { return scale.invert(((v - b) * j) / k + a); }));
  }

  try {
    d3_behavior_zoomDispatch.apply(d3_behavior_zoomTarget, d3_behavior_zoomArguments);
  } finally {
    d3.event = o;
  }

  o.preventDefault();
}

var d3_behavior_zoomInfiniteExtent = [
  [-Infinity, Infinity],
  [-Infinity, Infinity],
  [-Infinity, Infinity]
];

function d3_behavior_zoomExtentClamp(x, i, k) {
  var range = d3_behavior_zoomExtent[i],
      r0 = range[0],
      r1 = range[1];
  return arguments.length === 3
      ? Math.max(r1 * (r1 === Infinity ? -Infinity : 1 / k - 1),
        Math.min(r0 === -Infinity ? Infinity : r0, x / k)) * k
      : Math.max(r0, Math.min(r1, x));
}


text:
\hypertarget{structnn__fq}{}\section{nn\+\_\+fq Struct Reference}
\label{structnn__fq}\index{nn\+\_\+fq@{nn\+\_\+fq}}

{\ttfamily \#include $<$fq.\+h$>$}

Collaboration diagram for nn\+\_\+fq\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=550pt]{structnn__fq__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item
struct \hyperlink{structnn__priolist}{nn\+\_\+priolist} \hyperlink{structnn__fq_a5bce08b6089ff9f0ebaf17cf07a45184}{priolist}
\end{DoxyCompactItemize}

\subsection{Member Data Documentation}
\index{nn\+\_\+fq@{nn\+\_\+fq}!priolist@{priolist}}
\index{priolist@{priolist}!nn\+\_\+fq@{nn\+\_\+fq}}
\subsubsection[{priolist}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf nn\+\_\+priolist} nn\+\_\+fq\+::priolist}\hypertarget{structnn__fq_a5bce08b6089ff9f0ebaf17cf07a45184}{}\label{structnn__fq_a5bce08b6089ff9f0ebaf17cf07a45184}

The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize}
\item
src/protocols/utils/\hyperlink{fq_8h}{fq.\+h}\end{DoxyCompactItemize}


text:
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;

namespace Microsoft.Extensions.Testing.Abstractions
{
    internal static class MetadataExtensions
    {
        private static PropertyInfo s_methodInfoMethodTokenProperty = typeof(MethodInfo).GetProperty("MethodToken");

        internal static int GetMethodToken(this MethodInfo methodInfo)
        {
            return (int)s_methodInfoMethodTokenProperty.GetValue(methodInfo);
        }

        internal static MethodDebugInformationHandle GetMethodDebugInformationHandle(this MethodInfo methodInfo)
        {
            var methodToken = methodInfo.GetMethodToken();
            var handle = ((MethodDefinitionHandle)MetadataTokens.Handle(methodToken)).ToDebugInformationHandle();
            return handle;
        }
    }
}


text:
#ifndef PARTICLESYSTEM_H_
#define PARTICLESYSTEM_H_

#include "3d/C3DTransform.h"
#include "3d/C3DMesh.h"
#include "3d/C3DVector2.h"
#include "3d/C3DVector3.h"
#include "3d/C3DVector4.h"
#include "3d/C3DTexture.h"
#include "Rectangle.h"

#include "3d/C3DElementNode.h"
#include "cocos2d.h"
#include "3d/C3DNode.h"

namespace cocos3d
{

class Node;
class C3DElementNode;
class C3DParticleEmitter;
class C3DParticleRender;
class C3DParticleAction;
class C3DBaseParticleAction;
class C3DParticle;

/**
	C3DParticleSystem represents a 3D particle system. It is loaded from .particle files.
	A C3DParticleSystem is made up of C3DParticleEmitter, C3DParticleRender, and some C3DBaseParticleAction.
	usage:
	1.call load(particlename) load a particle
	2.call update() and draw() every frame
	3.control the particle system use start(), stop(), pause(), resume()
*/
class C3DParticleSystem : public C3DNode
{
	friend class  C3DParticleEmitter;
	friend class  C3DParticleRender;
	friend class  C3DScalerPSA;
	friend class  C3DTintPSA;
	friend class  C3DTransformPSA;
	friend class  C3DForcePSA;
public:

	/**
     * particle state.
     */
	enum ParticleState
	{
		STOP,
		RUNNING,
		PAUSE,
	};

	/**
     * constructor & destructor.
     */
	C3DParticleSystem(const char* id);
    ~C3DParticleSystem();

	/**
     * create method.
     */
	static C3DParticleSystem* create(const char* id);

	/**
     * class type inherit from C3DNode.
     */
	C3DNode::Type getType() const;

	/**
     * load & save particle system .particle.
     */
    bool load(const char* fileName);
	bool save(const char* szFile);

	/**
     * particle system control.
     */
    void start();
    void stop();
	void pause();
	void resume();

	/**
     * get particle state
     */
	ParticleState getParticleState() const { return _state; }

	/**
     * is particle system start ?
     */
    bool isStarted() const;

	/**
     * is particle active ?
     */
    bool isActive() const;

	/**
     * update routine
     */
    virtual void update(long elapsedTime);

	/**
     * particle system draw
     */
    void draw();

	/**
     * add action to particle system to affect particles movement
     */
	void addAction(C3DBaseParticleAction* action);

	/**
     * remove particle system action
     */
	void removeAction(C3DBaseParticleAction* action);

	/**
     * get particle emitter
     */
	C3DParticleEmitter* getParticleEmitter() { return _emitter; }

	/**
     * get particle actions
     */
	const std::vector<C3DBaseParticleAction*>& getParticleActions() { return _actions; }

	/**
     * get particle render
     */
	C3DParticleRender* getParticleRender() { return _render; }

	/**
     * clone method
     */
    virtual C3DParticleSystem* clone(CloneContext& context) const;

	/**
     * set particle system scale
     */
	virtual void setScale(float scale);

	/**
     * set & get particle system last time(ms)
     */
	void setTimeLast(long timelast)
	{
		_timeLast = timelast;
	}
	long getTimeLast() const { return _timeLast; }

	/**
     * set & get particle system start time(ms)
     */
	void setTimeStart(long timestart) { _timeStart = timestart; }
	long getTimeStart() const { return _timeStart; }

	/**
     * get last time after start(ms)
     */
	long getTimeRunning() const { return _timeRunning; }

	/**
     * get & set particle maximum count
     */
	int getParticleCountMax() const { return _particleCountMax; }
	void setParticleCountMax(int particleCountMax);

	/**
     * particle system call back, called when particle system state changed
     */
	void setStateChangeCallBack(void (*StateChanged)(const C3DParticleSystem* particle, ParticleState oldState, ParticleState newState));

protected:

	/**
     * copy method
     */
    virtual void copyFrom(const C3DTransform* other, CloneContext& context);

private:
	/**
     * load & save
     */
	bool load(C3DElementNode* psNode);
	void save(C3DElementNode* &psNode);

private:

	// particle system property

    int _particleCountMax;
    int _validParticleCount;

	C3DParticle* _p;
	C3DParticle** _particles;

	int _numTintAction;

    bool _started;

    long _timeLast; // particle system last time
    long _timeRunning; // particle system running time
	long _timeStart; // particle system start time

	C3DParticleEmitter* _emitter;
    C3DParticleRender* _render;
	std::vector<C3DBaseParticleAction*> _actions;

	ParticleState _state;

	void (*StateChanged)(const C3DParticleSystem* particle, ParticleState oldState, ParticleState newState);
};

}

#endif


text:
title: konferencje audio--
inshort: Niezdefiniowany
translator: Microsoft Cognitive Services
---


text:
/* */
'use strict';
Object.defineProperty(exports, "__esModule", {value: true});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _checkbox = require('../checkbox');
var _checkbox2 = _interopRequireDefault(_checkbox);
var _stylePropable = require('../mixins/style-propable');
var _stylePropable2 = _interopRequireDefault(_stylePropable);
var _tableHeaderColumn = require('./table-header-column');
var _tableHeaderColumn2 = _interopRequireDefault(_tableHeaderColumn);
var _getMuiTheme = require('../styles/getMuiTheme');
var _getMuiTheme2 = _interopRequireDefault(_getMuiTheme);
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {default: obj};
}
function _objectWithoutProperties(obj, keys) {
  var target = {};
  for (var i in obj) {
    if (keys.indexOf(i) >= 0)
      continue;
    if (!Object.prototype.hasOwnProperty.call(obj, i))
      continue;
    target[i] = obj[i];
  }
  return target;
}
var TableHeader = _react2.default.createClass({
  displayName: 'TableHeader',
  propTypes: {
    adjustForCheckbox: _react2.default.PropTypes.bool,
    children: _react2.default.PropTypes.node,
    className: _react2.default.PropTypes.string,
    displaySelectAll: _react2.default.PropTypes.bool,
    enableSelectAll: _react2.default.PropTypes.bool,
    onSelectAll: _react2.default.PropTypes.func,
    selectAllSelected: _react2.default.PropTypes.bool,
    style: _react2.default.PropTypes.object
  },
  contextTypes: {muiTheme: _react2.default.PropTypes.object},
  childContextTypes: {muiTheme: _react2.default.PropTypes.object},
  mixins: [_stylePropable2.default],
  getDefaultProps: function getDefaultProps() {
    return {
      adjustForCheckbox: true,
      displaySelectAll: true,
      enableSelectAll: true,
      selectAllSelected: false
    };
  },
  getInitialState: function getInitialState() {
    return {muiTheme: this.context.muiTheme || (0, _getMuiTheme2.default)()};
  },
  getChildContext: function getChildContext() {
    return {muiTheme: this.state.muiTheme};
  },
  componentWillReceiveProps: function componentWillReceiveProps(nextProps, nextContext) {
    var newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
    this.setState({muiTheme: newMuiTheme});
  },
  getTheme: function getTheme() {
    return this.state.muiTheme.tableHeader;
  },
  getStyles: function getStyles() {
    var styles = {root: {borderBottom: '1px solid ' + this.getTheme().borderColor}};
    return styles;
  },
  _createSuperHeaderRows: function _createSuperHeaderRows() {
    var numChildren = _react2.default.Children.count(this.props.children);
    if (numChildren === 1)
      return undefined;
    var superHeaders = [];
    for (var index = 0; index < numChildren - 1; index++) {
      var child = this.props.children[index];
      if (!_react2.default.isValidElement(child))
        continue;
      var props = {
        key: 'sh' + index,
        rowNumber: index
      };
      superHeaders.push(this._createSuperHeaderRow(child, props));
    }
    if (superHeaders.length)
      return superHeaders;
  },
  _createSuperHeaderRow: function _createSuperHeaderRow(child, props) {
    var children = [];
    if (this.props.adjustForCheckbox) {
      children.push(this._getCheckboxPlaceholder(props));
    }
    _react2.default.Children.forEach(child.props.children, function(child) {
      children.push(child);
    });
    return _react2.default.cloneElement(child, props, children);
  },
  _createBaseHeaderRow: function _createBaseHeaderRow() {
    var numChildren = _react2.default.Children.count(this.props.children);
    var child = numChildren === 1 ? this.props.children : this.props.children[numChildren - 1];
    var props = {
      key: 'h' + numChildren,
      rowNumber: numChildren
    };
    var children = [this._getSelectAllCheckboxColumn(props)];
    _react2.default.Children.forEach(child.props.children, function(child) {
      children.push(child);
    });
    return _react2.default.cloneElement(child, props, children);
  },
  _getCheckboxPlaceholder: function _getCheckboxPlaceholder(props) {
    if (!this.props.adjustForCheckbox)
      return null;
    var key = 'hpcb' + props.rowNumber;
    return _react2.default.createElement(_tableHeaderColumn2.default, {
      key: key,
      style: {width: 24}
    });
  },
  _getSelectAllCheckboxColumn: function _getSelectAllCheckboxColumn(props) {
    if (!this.props.displaySelectAll)
      return this._getCheckboxPlaceholder(props);
    var checkbox = _react2.default.createElement(_checkbox2.default, {
      key: 'selectallcb',
      name: 'selectallcb',
      value: 'selected',
      disabled: !this.props.enableSelectAll,
      checked: this.props.selectAllSelected,
      onCheck: this._onSelectAll
    });
    var key = 'hpcb' + props.rowNumber;
    return _react2.default.createElement(_tableHeaderColumn2.default, {
      key: key,
      style: {width: 24}
    }, checkbox);
  },
  _onSelectAll: function _onSelectAll(e, checked) {
    if (this.props.onSelectAll)
      this.props.onSelectAll(checked);
  },
  render: function render() {
    var _props = this.props;
    var className = _props.className;
    var style = _props.style;
    var other = _objectWithoutProperties(_props, ['className', 'style']);
    var superHeaderRows = this._createSuperHeaderRows();
    var baseHeaderRow = this._createBaseHeaderRow();
    return _react2.default.createElement('thead', {
      className: className,
      style: this.prepareStyles(this.getStyles().root, style)
    }, superHeaderRows, baseHeaderRow);
  }
});
exports.default = TableHeader;
module.exports = exports['default'];


text:
package jExif.core;

import java.util.Arrays;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ByteSequenceTests {

    private static final byte[] BYTES = new byte[] { (byte)0x19, (byte)0x07, (byte)0x84 };
    private static final byte[] REVERSED_BYTES = new byte[] { (byte)0x84, (byte)0x07, (byte)0x19 };

    private static final Endianness ENDIANNESS = Endianness.BIG_ENDIAN;
    private static final Endianness REVERSED_ENDIANNESS = Endianness.LITTLE_ENDIAN;

    private static final byte ASCII_A = (byte)0x41;
    private static final byte ASCII_B = (byte)0x42;
    private static final byte ASCII_C = (byte)0x43;

    private ByteSequence sequence;

    @Rule
    public final ExpectedException thrown = ExpectedException.none();

    @Before
    public void setUp() throws Exception {
        this.sequence = new ByteSequence(BYTES, ENDIANNESS);
    }

    @Test
    public void constructorCopiesByteArray() {
        byte[] bytes = new byte[] { (byte)0x00, (byte)0x01 };
        ByteSequence byteSequence = new ByteSequence(bytes, Endianness.BIG_ENDIAN);
        Assert.assertTrue(Arrays.equals(bytes, byteSequence.bytes()));
        bytes[0] = (byte)0xFF;
        Assert.assertFalse(Arrays.equals(bytes, byteSequence.bytes()));
    }

    @Test
    public void constructorThrowsOnNullArray() {
        this.thrown.expect(IllegalArgumentException.class);
        new ByteSequence(null, Endianness.BIG_ENDIAN);
    }

    @Test
    public void constructorThrowsOnNullEndianness() {
        this.thrown.expect(IllegalArgumentException.class);
        new ByteSequence(new byte[] {}, null);
    }

    @Test
    public void constructorSetsLength() {
        Assert.assertEquals(BYTES.length, this.sequence.length);
    }

    @Test
    public void constructorSetsEndianness() {
        Assert.assertEquals(ENDIANNESS, this.sequence.endianness);
    }

    @Test
    public void constructorDefaultsToBigEndian() {
        Assert.assertEquals(Endianness.BIG_ENDIAN, new ByteSequence(new byte[] {}).endianness);
    }

    @Test
    public void getterReturnsCorrectBytes() {
        Assert.assertArrayEquals(BYTES, this.sequence.bytes());
    }

    @Test
    public void getterCopiesByteArray() {
        byte[] bytes = this.sequence.bytes();
        Assert.assertTrue(Arrays.equals(bytes, this.sequence.bytes()));
        bytes[0] = (byte)0xFF;
        Assert.assertFalse(Arrays.equals(bytes, this.sequence.bytes()));
    }

    @Test
    public void toByteObjectsReturnsCorrectBytes() {
        Byte[] byteObjects = this.sequence.toByteObjects();
        Assert.assertEquals(BYTES.length, byteObjects.length);
        for (int i = 0; i < byteObjects.length; ++i) {
            Assert.assertEquals(BYTES[i], byteObjects[i].byteValue());
        }
    }

    @Test
    public void toReversedSequenceYieldsCorrectBytes() {
        Assert.assertArrayEquals(REVERSED_BYTES, this.sequence.toReversedSequence().bytes());
    }

    @Test
    public void toReversedSequenceYieldsCorrectEndianness() {
        Assert.assertEquals(REVERSED_ENDIANNESS, this.sequence.toReversedSequence().endianness);
    }

    @Test
    public void toSubsequenceRetainsEndianness() {
        Assert.assertEquals(this.sequence.endianness, this.sequence.toSubsequence(0, 1).endianness);
    }

    @Test
    public void toSubsequenceReturnsFirstByte() {
        Assert.assertArrayEquals(Arrays.copyOfRange(this.sequence.bytes(), 0, 1),
            this.sequence.toSubsequence(0, 1).bytes());
    }

    @Test
    public void toSubsequenceReturnsSecondAndThirdByte() {
        Assert.assertArrayEquals(Arrays.copyOfRange(this.sequence.bytes(), 1, 3),
            this.sequence.toSubsequence(1, 3).bytes());
    }

    @Test
    public void toSubsequenceReproducesOriginalSequence() {
        Assert.assertEquals(this.sequence, this.sequence.toSubsequence(0, this.sequence.length));
    }

    @Test
    public void toReversedSequenceYieldsOriginalSequenceOnDoubleInvocation() {
        Assert.assertEquals(this.sequence, this.sequence.toReversedSequence().toReversedSequence());
    }

    @Test
    public void toIntegerThrowsOnTooLongSequence() {
        this.thrown.expect(IllegalStateException.class);
        new ByteSequence(new byte[] { 1, 2, 3, 4, 5 }).toInteger();
    }

    @Test
    public void toIntegerReturnsCorrectNumberInBigEndian() {
        ByteSequence intSequence = new ByteSequence(new byte[] { 1, 2, 3 }, Endianness.BIG_ENDIAN);
        Assert.assertEquals(3 + 256 * (2 + 256 * 1), intSequence.toInteger());
    }

    @Test
    public void toIntegerReturnsCorrectNumberInLittleEndian() {
        ByteSequence intSequence = new ByteSequence(new byte[] { 1, 2, 3 }, Endianness.LITTLE_ENDIAN);
        Assert.assertEquals(1 + 256 * (2 + 256 * 3), intSequence.toInteger());
    }

    @Test
    public void toRationalThrowsOnUnevenLength() {
        this.thrown.expect(IllegalStateException.class);
        new ByteSequence( new byte[] { 1, 2, 3 }).toRational();
    }

    @Test
    public void toRationalThrowsOnTooLongSequence() {
        this.thrown.expect(IllegalStateException.class);
        new ByteSequence(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }).toRational();
    }

    @Test
    public void toRationalReturnsCorrectNumber() {
        ByteSequence rationalSequence = new ByteSequence(new byte[] { 1, 2, 3, 4 });
        Assert.assertEquals(new Rational(2 + 256 * 1, 4 + 256 * 3), rationalSequence.toRational());
    }

    @Test
    public void toAsciiStringReturnsCorrectStringInBigEndian() {
        ByteSequence asciiSequence = new ByteSequence(
            new byte[] { ASCII_A, ASCII_B, ASCII_C }, Endianness.BIG_ENDIAN);
        Assert.assertEquals("CBA", asciiSequence.toAsciiString());
    }

    @Test
    public void toAsciiStringReturnsCorrectStringInLittleEndian() {
        ByteSequence asciiSequence = new ByteSequence(
            new byte[] { ASCII_A, ASCII_B, ASCII_C }, Endianness.LITTLE_ENDIAN);
        Assert.assertEquals("ABC", asciiSequence.toAsciiString());
    }

    @Test
    public void equalsItself() {
        Assert.assertTrue(this.sequence.equals(this.sequence));
    }

    @Test
    public void doesNotEqualNull() {
        Assert.assertFalse(this.sequence.equals(null));
    }

    @Test
    public void doesNotEqualObjectOfAnotherClass() {
        Assert.assertFalse(this.sequence.equals(new Object()));
    }

    @Test
    public void equalsSequenceWithIdenticalBytesAndEndianness() {
        ByteSequence other = new ByteSequence(this.sequence.bytes(), this.sequence.endianness);
        Assert.assertTrue(this.sequence.equals(other));
    }

    @Test
    public void equalsSequenceWithReversedBytesAndEndianness() {
        ByteSequence other = new ByteSequence(REVERSED_BYTES, REVERSED_ENDIANNESS);
        Assert.assertTrue(this.sequence.equals(other));
    }

    @Test
    public void doesNotEqualSequenceWithReversedBytesAndIdenticalEndianness() {
        ByteSequence other = new ByteSequence(REVERSED_BYTES, ENDIANNESS);
        Assert.assertFalse(this.sequence.equals(other));
    }

    @Test
    public void doesNotEqualSequenceWithIdenticalBytesAndReversedEndianness() {
        ByteSequence other = new ByteSequence(BYTES, REVERSED_ENDIANNESS);
        Assert.assertFalse(this.sequence.equals(other));
    }

    @Test
    public void doesNotEqualSequenceWithDifferentLength() {
        ByteSequence other = new ByteSequence(new byte[] {}, ENDIANNESS);
        Assert.assertFalse(this.sequence.equals(other));
    }

    @Test
    public void emptySequencesWithIdenticalEndiannessAreEqual() {
        ByteSequence sequence1 = new ByteSequence(new byte[] {}, ENDIANNESS);
        ByteSequence sequence2 = new ByteSequence(new byte[] {}, ENDIANNESS);
        Assert.assertTrue(sequence1.equals(sequence2));
    }

    @Test
    public void emptySequencesWithReversedEndiannessAreEqual() {
        ByteSequence sequence1 = new ByteSequence(new byte[] {}, ENDIANNESS);
        ByteSequence sequence2 = new ByteSequence(new byte[] {}, REVERSED_ENDIANNESS);
        Assert.assertTrue(sequence1.equals(sequence2));
    }

}


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using TestStack.FluentMVCTesting;
using TravelAlbum.DataServices.Contracts;
using TravelAlbum.Models;
using TravelAlbum.Web.Controllers;
using TravelAlbum.Web.Utils;

namespace TravelAlbum.UnitTests.Controllers.ImagesControllerTests
{
    [TestClass]
    public class AddGet_Should
    {
        [TestMethod]
        public void ReturnView_CheckView()
        {
            var imageServiceMock = new Mock<IImageService>();
            var mountainsServiceMock = new Mock<IMountainsService>();
            var imageTranslationalInfoServiceMock = new Mock<IImageTranslationalInfoService>();
            var travelServiceMock = new Mock<ITravelService>();
            var utilsMock = new Mock<IUtils>();

            ImagesController imagesController = new ImagesController(imageServiceMock.Object, mountainsServiceMock.Object, imageTranslationalInfoServiceMock.Object, travelServiceMock.Object, utilsMock.Object);

            Mountain rila = new Mountain()
            {
                MountainId = Guid.NewGuid(),
                Name = "Rila"
            };

            Mountain vitosha = new Mountain()
            {
                MountainId = Guid.NewGuid(),
                Name = "Vitosha"
            };

            Mountain pirin = new Mountain()
            {
                MountainId = Guid.NewGuid(),
                Name = "Pirin"
            };

            MountainTranslationalInfo vitoshaBg = new MountainTranslationalInfo()
            {
                MountainTranslationalInfoId = Guid.NewGuid(),
                Mountain = vitosha,
                MountainId = vitosha.MountainId,
                Language = Language.Bulgarian,
                Name = "Витоша"
            };

            MountainTranslationalInfo vitoshaEn = new MountainTranslationalInfo()
            {
                MountainTranslationalInfoId = Guid.NewGuid(),
                Mountain = vitosha,
                MountainId = vitosha.MountainId,
                Language = Language.English,
                Name = "Vitosha"
            };

            MountainTranslationalInfo rilaBg = new MountainTranslationalInfo()
            {
                MountainTranslationalInfoId = Guid.NewGuid(),
                Mountain = rila,
                MountainId = rila.MountainId,
                Language = Language.Bulgarian,
                Name = "Рила"
            };

            MountainTranslationalInfo rilaEn = new MountainTranslationalInfo()
            {
                MountainTranslationalInfoId = Guid.NewGuid(),
                Mountain = rila,
                MountainId = rila.MountainId,
                Language = Language.English,
                Name = "Rila"
            };

            MountainTranslationalInfo pirinBg = new MountainTranslationalInfo()
            {
                MountainTranslationalInfoId = Guid.NewGuid(),
                Mountain = pirin,
                MountainId = pirin.MountainId,
                Language = Language.Bulgarian,
                Name = "Пирин"
            };

            MountainTranslationalInfo pirinEn = new MountainTranslationalInfo()
            {
                MountainTranslationalInfoId = Guid.NewGuid(),
                Mountain = pirin,
                MountainId = pirin.MountainId,
                Language = Language.English,
                Name = "Pirin"
            };

            rila.TranslatedInfoes.Add(rilaBg);
            rila.TranslatedInfoes.Add(rilaEn);
            vitosha.TranslatedInfoes.Add(vitoshaBg);
            vitosha.TranslatedInfoes.Add(vitoshaEn);
            pirin.TranslatedInfoes.Add(pirinBg);
            pirin.TranslatedInfoes.Add(pirinEn);
            mountainsServiceMock.Setup(
                m => m.All())
                .Returns((new List<Mountain>() { rila, pirin, vitosha }));

            HttpRequest httpRequest = new HttpRequest("", "http://localhost:56342/bg", "");
            StringWriter stringWriter = new StringWriter();
            HttpResponse httpResponse = new HttpResponse(stringWriter);
            HttpContext httpContextMock = new HttpContext(httpRequest, httpResponse);
            imagesController.ControllerContext = new ControllerContext(new HttpContextWrapper(httpContextMock), new RouteData(), imagesController);
            utilsMock.Setup(a => a.GetCurrentLanguage(imagesController)).Returns(2);
            imagesController.WithCallTo(
                b => b.Add()).ShouldRenderDefaultView();
        }
    }
}


text:
<!DOCTYPE html>

	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">

	    <title>${application.title}</title>

	    <link href="./pincushion.css" rel="stylesheet">

					<button type="button" class="navbar-toggle" data-toggle="collapse"
						data-target=".navbar-collapse">
						Toggle navigation
					</button>
					${application.title}

${pincushion.release}

Tunnels

Proxies

Modules


text:
layout: page
title: Growth Temple Motors Party
date: 2016-05-24
author: Danielle Fisher
tags: weekly links, java
status: published
summary: Fusce et placerat ligula, vitae viverra libero. Proin sed commodo.
banner: images/banner/leisure-04.jpg
booking:
  startDate: 08/10/2019
  endDate: 08/14/2019
  ctyhocn: RDUAWHX
  groupCode: GTMP
published: true
---
Donec vel accumsan magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras volutpat eros purus, a consectetur nisl tincidunt non. Vivamus eget turpis non velit luctus commodo. Sed egestas rutrum arcu, sed luctus est. Morbi nec efficitur velit. In pretium hendrerit ipsum. Curabitur elementum, est in feugiat sollicitudin, erat ante ornare orci, consectetur fermentum nisi lectus ac urna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse cursus dignissim dolor at ullamcorper. Praesent euismod eros ac placerat gravida. Etiam porttitor fringilla diam, at eleifend mauris efficitur ut. Donec vel augue feugiat, eleifend dolor eu, rhoncus massa. Nulla facilisi.

1 Quisque quis orci ultricies, cursus augue sit amet, aliquet tellus
1 Integer commodo turpis non mauris vestibulum, quis dictum nulla egestas
1 Integer lacinia eros nec justo feugiat, at pretium nibh finibus
1 Suspendisse porta nunc in condimentum aliquam
1 Pellentesque imperdiet velit et dui tempus placerat.

Aliquam finibus velit fermentum odio imperdiet, vel egestas lorem molestie. Sed a quam semper, ullamcorper odio ultricies, egestas velit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum et volutpat sem, sit amet molestie libero. Quisque dictum risus metus, egestas placerat diam luctus quis. Sed justo ligula, fermentum sit amet elit quis, interdum auctor ligula. Etiam vel felis dui. Phasellus purus lorem, euismod sed interdum ac, laoreet eu mauris. Quisque rhoncus a erat nec blandit. Fusce tempus dolor eu nibh sodales porta. Ut aliquet nunc vitae enim fringilla, sit amet lobortis enim mollis. Quisque nec lectus dui. Curabitur gravida eu enim quis vulputate. Nullam lectus ipsum, laoreet vitae velit in, tempus pellentesque sem. Sed vehicula nulla mauris, laoreet blandit quam lacinia a. Aenean enim ligula, egestas et sem id, congue facilisis erat.


text:
package org.apache.camel.component.cxf;

import org.apache.camel.FailedToStartRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;

/**
 * @version
 */
public class CxfMultipleConsumersSupportTest extends CamelTestSupport {

    protected static final String SIMPLE_ENDPOINT_ADDRESS = "http://localhost:28080/test";
    protected static final String SIMPLE_ENDPOINT_URI = "cxf://" + SIMPLE_ENDPOINT_ADDRESS
        + "?serviceClass=org.apache.camel.component.cxf.HelloService";

    protected static final String SIMPLE_OTHER_ADDRESS = "http://localhost:28081/test";
    protected static final String SIMPLE_OTHER_URI = "cxf://" + SIMPLE_OTHER_ADDRESS
        + "?serviceClass=org.apache.camel.component.cxf.HelloService";

    @Test
    public void testMultipleConsumersNotAllowed() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from(SIMPLE_ENDPOINT_URI).to("mock:a");

                from("direct:start").to("mock:result");

                from(SIMPLE_ENDPOINT_URI).to("mock:b");
            }
        });
        try {
            context.start();
            fail("Should have thrown an exception");
        } catch (FailedToStartRouteException e) {
            assertTrue(e.getMessage().endsWith(
                "Multiple consumers for the same endpoint is not allowed: Endpoint[cxf://http://localhost:28080/test?serviceClass=org.apache.camel.component.cxf.HelloService]"));
        }
    }

    @Test
    public void testNoMultipleConsumers() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from(SIMPLE_ENDPOINT_URI).to("mock:a");

                from("direct:start").to("mock:result");

                from(SIMPLE_OTHER_URI).to("mock:b");
            }
        });

        // is allowed
        context.start();

        getMockEndpoint("mock:result").expectedMessageCount(1);

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }

    @Override
    public boolean isUseRouteBuilder() {
        return false;
    }
}


text:
module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    class Affirm < Gateway
      self.supported_countries = %w(US)
      self.default_currency = 'USD'
      self.money_format = :cents

      def initialize(options = {})
          requires!(options, :api_key, :secret_key, :server)
          @api_key = options[:api_key]
          @secret_key = options[:secret_key]
          super
      end

      def set_charge(charge_id)
          @charge_id = charge_id
      end

      def authorize(money, affirm_source, options = {})
        result = commit(:post, "", {"checkout_token"=>affirm_source.token}, options, true)
        return result unless result.success?

        if amount(money).to_i != result.params["amount"].to_i
          return Response.new(false,
                              "Auth amount does not match charge amount",
                              result.params
                             )
        elsif result.params["pending"].to_s != "true"
          return Response.new(false,
                              "There was an error authorizing this Charge",
                              result.params
                             )
        end
        result
      end

      # To create a charge on a card or a token, call
      #
      #   purchase(money, card_hash_or_token, { ... })
      #
      # To create a charge on a customer, call
      #
      #   purchase(money, nil, { :customer => id, ... })
      def purchase(money, affirm_source, options = {})
          result = authorize(money, affirm_source, options)
          return result unless result.success?
          capture(money, @charge_id, options)
      end

      def capture(money, charge_source, options = {})
        post = {:amount => amount(money)}
        set_charge(charge_source)
        result = commit(:post, "#{@charge_id}/capture", post, options)
        return result unless result.success?

        if amount(money).to_i != result.params["amount"].to_i
          return Response.new(false,
                "Capture amount does not match charge amount",
                result.params
                )
        end
        result
      end

      def void(charge_source, options = {})
        set_charge(charge_source)
        commit(:post, "#{@charge_id}/void", {}, options)
      end

      def refund(money, charge_source, options = {})
        post = {:amount => amount(money)}
        set_charge(charge_source)
        commit(:post, "#{@charge_id}/refund", post, options)
      end

      def credit(money, charge_source, options = {})
          set_charge(charge_source)
          return Response.new(true ,
                       "Credited Zero amount",
                       {},
                       :authorization => @charge_id,
                      ) unless money > 0
          refund(money, charge_source, options)
      end

      def root_url
        "#{root_api_url}charges/"
      end

      def root_api_url
        "https://#{@options[:server]}/api/v2/"
      end

      def headers
          {
              "Content-Type" => "application/json",
              "Authorization" => "Basic " + Base64.encode64(@api_key.to_s + ":" + @secret_key.to_s).gsub(/\n/, '').strip,
              "User-Agent" => "Affirm/v1 ActiveMerchantBindings",
          }
      end

      def parse(body)
        JSON.parse(body)
      end

      def post_data(params)
        return nil unless params
        params.to_json
      end

      def response_error(raw_response)
        begin
          parse(raw_response)
        rescue JSON::ParserError
          json_error(raw_response)
        end
      end

      def json_error(raw_response)
        msg = 'Invalid response.  Please contact affirm if you continue to receive this message.'
        msg += "  (The raw response returned by the API was #{raw_response.inspect})"
        {
          "error" => {
            "message" => msg
          }
        }
      end

      def get_checkout(checkout_token)
        _url           = root_api_url + "checkout/#{checkout_token}"
        _raw_response  = ssl_request :get, _url, nil, headers

        parse(_raw_response)
      end

      def commit(method, url, parameters=nil, options = {}, ret_charge=false)
          raw_response = response = nil
          success = false
          begin
              raw_response = ssl_request(method, root_url + url, post_data(parameters), headers)
              response = parse(raw_response)
              success = !response.key?("status_code") && (!ret_charge || response.key?("id"))
          rescue ResponseError => e
              raw_response = e.response.body
              response = response_error(raw_response)
          rescue JSON::ParserError
              response = json_error(raw_response)
          end

          if success && ret_charge
              @charge_id = response["id"]
          end
          Response.new(success,
                       success ? "Transaction approved" : response["message"],
                       response,
                       :authorization => @charge_id,
                      )
      end
    end
  end
end


text:
module SectionsHelper
  def edit_section(section)
    if admin?
      link_to('Edit', edit_section_path(section))
    else
      ''
    end
  end
  def delete_section_link(section)
    if admin?
      link_to 'Delete section', section, method: 'delete'
    else
      ''
    end
  end
  def render_section_content(section)
    render_markdown(section.content).html_safe
  end
end


text:
'use strict';

var Parser = require('./parser'),
    Serializer = require('./serializer');

// Shorthands
exports.parse = function parse(html, options) {
    var parser = new Parser(options);

    return parser.parse(html);
};

exports.parseFragment = function parseFragment(fragmentContext, html, options) {
    if (typeof fragmentContext === 'string') {
        options = html;
        html = fragmentContext;
        fragmentContext = null;
    }

    var parser = new Parser(options);

    return parser.parseFragment(html, fragmentContext);
};

exports.serialize = function (node, options) {
    var serializer = new Serializer(node, options);

    return serializer.serialize();
};

// Tree adapters
exports.treeAdapters = {
    default: require('./tree_adapters/default'),
    htmlparser2: require('./tree_adapters/htmlparser2')
};

// Streaming
exports.ParserStream = require('./parser/parser_stream');
exports.PlainTextConversionStream = require('./parser/plain_text_conversion_stream');
exports.SerializerStream = require('./serializer/serializer_stream');
exports.SAXParser = require('./sax');


text:
//*****************************************************************************
//
//! \addtogroup peripheral_group
//! @{
//! \addtogroup event_api
//! @{
//
//*****************************************************************************

#ifndef __EVENT_H__
#define __EVENT_H__

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_types.h>
#include <inc/hw_memmap.h>
#include <inc/hw_event.h>
#include <driverlib/debug.h>

//*****************************************************************************
//
// API Functions and prototypes
//
//*****************************************************************************

//*****************************************************************************
//
//! \brief Connects an event to an event subscriber via Event Fabric.
//!
//! This function connects event sources to event subscribers.
//!
//! It is not possible to read event status in this module (except software events).
//! Event status must be read in the module that contains the event source. How a
//! specific event subscriber reacts to an event is configured and documented in
//! the respective modules.
//!
//! For a full list of configurable and constant mapped event sources to event
//! subscribers see the register descriptions for
//! Event Fabric.
//!
//! Defines for event subscriber argument (\c ui32EventSubscriber) have the format:
//! - \ti_code{EVENT_O_[subscriber_name]}
//!
//! Defines for event source argument (\c ui32EventSource) must have the
//! following format where valid \c event_enum values are found in the
//! register description :
//! - \ti_code{EVENT_[subscriber_name]_EV_[event_enum]}
//!
//! Examples of valid defines for \c ui32EventSource:
//! - EVENT_CPUIRQSEL30_EV_AUX_TDC_DONE
//! - EVENT_RFCSEL9_EV_AUX_COMPA
//! - EVENT_GPT0ACAPTSEL_EV_AON_RTC_UPD
//!
//! \note Each event subscriber can only receive a sub-set of the event sources!
//!
//! \note Switching the event source is not glitch free, so it is imperative
//! that the subscriber is disabled for interrupts when switching the event
//! source. The behavior is undefined if not disabled.
//!
//! \param ui32EventSubscriber is the \b configurable event subscriber to receive the event.
//! Click the event subscriber to see the list of valid event sources in the
//! register description.
//! - EVENT_O_CPUIRQSEL30  : System CPU interrupt 30
//! - EVENT_O_RFCSEL9      : RF Core event 9
//! - EVENT_O_GPT0ACAPTSEL : GPT 0A capture event
//! - EVENT_O_GPT0BCAPTSEL : GPT 0B capture event
//! - EVENT_O_GPT1ACAPTSEL : GPT 1A capture event
//! - EVENT_O_GPT1BCAPTSEL : GPT 1B capture event
//! - EVENT_O_GPT2ACAPTSEL : GPT 2A capture event
//! - EVENT_O_GPT2BCAPTSEL : GPT 2B capture event
//! - EVENT_O_GPT3ACAPTSEL : GPT 3A capture event
//! - EVENT_O_GPT3BCAPTSEL : GPT 3B capture event
//! - EVENT_O_UDMACH9SSEL  : uDMA channel 9 single request
//! - EVENT_O_UDMACH9BSEL  : uDMA channel 9 burst request
//! - EVENT_O_UDMACH10SSEL : uDMA channel 10 single request
//! - EVENT_O_UDMACH10BSEL : uDMA channel 10 burst request
//! - EVENT_O_UDMACH11SSEL : uDMA channel 11 single request
//! - EVENT_O_UDMACH11BSEL : uDMA channel 11 burst request
//! - EVENT_O_UDMACH12SSEL : uDMA channel 12 single request
//! - EVENT_O_UDMACH12BSEL : uDMA channel 12 burst request
//! - EVENT_O_UDMACH14BSEL : uDMA channel 14 single request
//! - EVENT_O_AUXSEL0      : AUX
//! - EVENT_O_I2SSTMPSEL0  : I2S
//! - EVENT_O_FRZSEL0      : Freeze modules (some modules can freeze on CPU Halt)
//! \param ui32EventSource is the specific event that must be acted upon.
//! - Format: \ti_code{EVENT_[subscriber_name]_EV_[event_enum]} (see explanation above)
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
EventRegister(uint32_t ui32EventSubscriber, uint32_t ui32EventSource)
{
    // Check the arguments.
    ASSERT(( ui32EventSubscriber == EVENT_O_CPUIRQSEL30  ) ||
           ( ui32EventSubscriber == EVENT_O_RFCSEL9      ) ||
           ( ui32EventSubscriber == EVENT_O_GPT0ACAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT0BCAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT1ACAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT1BCAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT2ACAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT2BCAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT3ACAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_GPT3BCAPTSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH9SSEL  ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH9BSEL  ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH10SSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH10BSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH11SSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH11BSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH12SSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH12BSEL ) ||
           ( ui32EventSubscriber == EVENT_O_UDMACH14BSEL ) ||
           ( ui32EventSubscriber == EVENT_O_AUXSEL0      ) ||
           ( ui32EventSubscriber == EVENT_O_I2SSTMPSEL0  ) ||
           ( ui32EventSubscriber == EVENT_O_FRZSEL0      ) );

    // Map the event source to the event subscriber
    HWREG(EVENT_BASE + ui32EventSubscriber) = ui32EventSource;
}

//*****************************************************************************
//
//! \brief Sets software event.
//!
//! Setting a software event triggers the event if the value was 0 before.
//!
//! \note The software event must be cleared manually after the event has
//! triggered the event subscriber.
//!
//! \param ui32SwEvent is the software event number.
//! - 0 : SW Event 0
//! - 1 : SW Event 1
//! - 2 : SW Event 2
//! - 3 : SW Event 3
//!
//! \return None
//!
//! \sa \ref EventSwEventClear()
//
//*****************************************************************************
__STATIC_INLINE void
EventSwEventSet(uint32_t ui32SwEvent)
{
    // Check the arguments.
    ASSERT( ui32SwEvent <= 3 );

    // Each software event is byte accessible
    HWREGB(EVENT_BASE + EVENT_O_SWEV + ui32SwEvent) = 1;
}

//*****************************************************************************
//
//! \brief Clears software event.
//!
//! \param ui32SwEvent is the software event number.
//! - 0 : SW Event 0
//! - 1 : SW Event 1
//! - 2 : SW Event 2
//! - 3 : SW Event 3
//!
//! \return None
//
//*****************************************************************************
__STATIC_INLINE void
EventSwEventClear(uint32_t ui32SwEvent)
{
    // Check the arguments.
    ASSERT( ui32SwEvent <= 3 );

    // Each software event is byte accessible
    HWREGB(EVENT_BASE + EVENT_O_SWEV + ui32SwEvent) = 0;
}

//*****************************************************************************
//
//! \brief Gets software event status.
//!
//! \param ui32SwEvent is the software event number.
//! - 0 : SW Event 0
//! - 1 : SW Event 1
//! - 2 : SW Event 2
//! - 3 : SW Event 3
//!
//! \return Returns current value of requested software event.
//! - 0 : Software event is de-asserted.
//! - 1 : Software event is asserted.
//
//*****************************************************************************
__STATIC_INLINE uint32_t
EventSwEventGet(uint32_t ui32SwEvent)
{
    // Check the arguments.
    ASSERT( ui32SwEvent <= 3 );

    // Each software event is byte accessible
    return( HWREGB(EVENT_BASE + EVENT_O_SWEV + ui32SwEvent));
}

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif // __EVENT_H__

//*****************************************************************************
//
//! Close the Doxygen group.
//! @}
//! @}
//
//*****************************************************************************


text:
package org.onosproject.bgp.controller;

import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessage;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Abstraction of an BGP controller. Serves as a one stop shop for obtaining BGP devices and (un)register listeners on
 * bgp events
 */
public interface BgpController {

    /**
     * Returns list of bgp peers connected to this BGP controller.
     *
     * @return Iterable of BGPPeer elements
     */
    Iterable<BgpPeer> getPeers();

    /**
     * Returns the actual bgp peer for the given ip address.
     *
     * @param bgpId the id of the bgp peer to fetch
     * @return the interface to this bgp peer
     */
    BgpPeer getPeer(BgpId bgpId);

    /**
     * Register a listener for BGP message events.
     *
     * @param listener the listener to notify
     */
    void addListener(BgpNodeListener listener);

    /**
     * Unregister a listener.
     *
     * @param listener the listener to unregister
     */
    void removeListener(BgpNodeListener listener);

    /**
     * Send a message to a particular bgp peer.
     *
     * @param bgpId the id of the peer to send message.
     * @param msg   the message to send
     */
    void writeMsg(BgpId bgpId, BgpMessage msg);

    /**
     * Process a message and notify the appropriate listeners.
     *
     * @param bgpId id of the peer the message arrived on
     * @param msg   the message to process.
     * @throws BgpParseException on data processing error
     */
    void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException;

    /**
     * Close all connected BGP peers.
     */
    void closeConnectedPeers();

    /**
     * Get the BGPConfig class to the caller.
     *
     * @return configuration object
     */
    BgpCfg getConfig();

    /**
     * Get the BGP connected peers to this controller.
     *
     * @return the integer number
     */
    int connectedPeerCount();

    /**
     * Return BGP local RIB instance with VPN.
     *
     * @return BGPLocalRibImpl local RIB with VPN
     */
    BgpLocalRib bgpLocalRibVpn();

    /**
     * Return BGP local RIB instance.
     *
     * @return BGPLocalRibImpl local RIB
     */
    BgpLocalRib bgpLocalRib();

    /**
     * Return BGP peer manager.
     *
     * @return BGPPeerManager peer manager instance
     */
    BgpPeerManager peerManager();

    /**
     * Return BGP connected peers.
     *
     * @return connectedPeers connected peers
     */
    Map<BgpId, BgpPeer> connectedPeers();

    /**
     * Return BGP node listener.
     *
     * @return node listener
     */
    Set<BgpNodeListener> listener();

    /**
     * Register a listener for BGP message events.
     *
     * @param listener the listener to notify
     */
    void addLinkListener(BgpLinkListener listener);

    /**
     * Unregister a listener.
     *
     * @param listener the listener to unregister
     */
    void removeLinkListener(BgpLinkListener listener);

    /**
     * Return BGP link listener.
     *
     * @return link listener
     */
    Set<BgpLinkListener> linkListener();

    /**
     * Stores the exceptions occurred during an active session.
     *
     * @param peerId BGP peer id
     * @param exception exceptions based on the peer id.
     */
    void activeSessionExceptionAdd(String peerId, String exception);

    /**
     * Stores the exceptions occurred during an closed session.
     *
     * @param peerId BGP peer id
     * @param exception exceptions based on the peer id
     */
    void closedSessionExceptionAdd(String peerId, String exception);

    /**
     * Return active session exceptions.
     *
     * @return activeSessionMap
     */
    Map<String, List<String>> activeSessionMap();

    /**
     * Return closed session exceptions.
     *
     * @return closedSessionMap
     */
    Map<String, List<String>> closedSessionMap();
    /**
     * Register a listener for BGP message events.
     *
     * @param listener the listener to notify
     */
    void addRouteListener(BgpRouteListener listener);

    /**
     * Unregister a listener.
     *
     * @param listener the listener to unregister
     */
    void removeRouteListener(BgpRouteListener listener);

    /**
     * Return BGP route listener.
     *
     * @return route listener
     */
    Set<BgpRouteListener> routeListener();

}


text:
#ifndef __PERF_SESSION_H
#define __PERF_SESSION_H

#include "trace-event.h"
#include "event.h"
#include "header.h"
#include "machine.h"
#include "symbol.h"
#include "thread.h"
#include "data.h"
#include "ordered-events.h"
#include <linux/rbtree.h>
#include <linux/perf_event.h>

struct ip_callchain;
struct thread;

struct auxtrace;
struct itrace_synth_opts;

struct perf_session {
	struct perf_header	header;
	struct machines		machines;
	struct perf_evlist	*evlist;
	struct auxtrace		*auxtrace;
	struct itrace_synth_opts *itrace_synth_opts;
	struct list_head	auxtrace_index;
	struct trace_event	tevent;
	bool			repipe;
	bool			one_mmap;
	void			*one_mmap_addr;
	u64			one_mmap_offset;
	struct ordered_events	ordered_events;
	struct perf_data_file	*file;
	struct perf_tool	*tool;
};

#define PRINT_IP_OPT_IP		(1<<0)
#define PRINT_IP_OPT_SYM		(1<<1)
#define PRINT_IP_OPT_DSO		(1<<2)
#define PRINT_IP_OPT_SYMOFFSET	(1<<3)
#define PRINT_IP_OPT_ONELINE	(1<<4)
#define PRINT_IP_OPT_SRCLINE	(1<<5)

struct perf_tool;

struct perf_session *perf_session__new(struct perf_data_file *file,
				       bool repipe, struct perf_tool *tool);
void perf_session__delete(struct perf_session *session);

void perf_event_header__bswap(struct perf_event_header *hdr);

int perf_session__peek_event(struct perf_session *session, off_t file_offset,
			     void *buf, size_t buf_sz,
			     union perf_event **event_ptr,
			     struct perf_sample *sample);

int perf_session__process_events(struct perf_session *session);

int perf_session__queue_event(struct perf_session *s, union perf_event *event,
			      struct perf_sample *sample, u64 file_offset);

void perf_tool__fill_defaults(struct perf_tool *tool);

int perf_session__resolve_callchain(struct perf_session *session,
				    struct perf_evsel *evsel,
				    struct thread *thread,
				    struct ip_callchain *chain,
				    struct symbol **parent);

bool perf_session__has_traces(struct perf_session *session, const char *msg);

void perf_event__attr_swap(struct perf_event_attr *attr);

int perf_session__create_kernel_maps(struct perf_session *session);

void perf_session__set_id_hdr_size(struct perf_session *session);

static inline
struct machine *perf_session__find_machine(struct perf_session *session, pid_t pid)
{
	return machines__find(&session->machines, pid);
}

static inline
struct machine *perf_session__findnew_machine(struct perf_session *session, pid_t pid)
{
	return machines__findnew(&session->machines, pid);
}

struct thread *perf_session__findnew(struct perf_session *session, pid_t pid);
size_t perf_session__fprintf(struct perf_session *session, FILE *fp);

size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp);

size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp,
					  bool (fn)(struct dso *dso, int parm), int parm);

size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);

struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
					    unsigned int type);

void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
			  struct addr_location *al,
			  unsigned int print_opts, unsigned int stack_depth);

int perf_session__cpu_bitmap(struct perf_session *session,
			     const char *cpu_list, unsigned long *cpu_bitmap);

void perf_session__fprintf_info(struct perf_session *s, FILE *fp, bool full);

struct perf_evsel_str_handler;

int __perf_session__set_tracepoints_handlers(struct perf_session *session,
					     const struct perf_evsel_str_handler *assocs,
					     size_t nr_assocs);

#define perf_session__set_tracepoints_handlers(session, array) \
	__perf_session__set_tracepoints_handlers(session, array, ARRAY_SIZE(array))

extern volatile int session_done;

#define session_done()	ACCESS_ONCE(session_done)

int perf_session__deliver_synth_event(struct perf_session *session,
				      union perf_event *event,
				      struct perf_sample *sample);

int perf_event__process_id_index(struct perf_tool *tool,
				 union perf_event *event,
				 struct perf_session *session);

int perf_event__synthesize_id_index(struct perf_tool *tool,
				    perf_event__handler_t process,
				    struct perf_evlist *evlist,
				    struct machine *machine);

#endif /* __PERF_SESSION_H */