text:
package com.ltdev.cc.parser;

import android.content.Context;
import android.content.res.XmlResourceParser;
import android.util.Log;

import com.ltdev.cc.Tile;
import com.ltdev.cc.ai.Node;
import com.ltdev.cc.ai.NodePath;
import com.ltdev.cc.entity.*;
import com.ltdev.cc.trigger.*;
import com.ltdev.trigger.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import javax.microedition.khronos.opengles.GL11;

import org.xmlpull.v1.XmlPullParserException;

public class Parser
{
    public static final int START_DOCUMENT = 0;
    public static final int END_DOCUMENT = 1;
    public static final int START_TAG = 2;
    public static final int END_TAG = 3;

	public ArrayList<EntityData> parsedList;
	public ArrayList<Entity> entList;
	public ArrayList<Trigger> triggerList;
	public ArrayList<Node> nodeList;
	public ArrayList<CauseData> causeDataList;
	public ArrayList<EffectData> effectDataList;
	public ArrayList<NodePath> nodePathList;

	public Tile[][] tileset;
	public Player player;

	public XmlResourceParser xrp;
	public HashMap<String, String> dataHM;

	public Parser(Context context, int res)
	{
		xrp = context.getResources().getXml(res);

		parsedList = new ArrayList<EntityData>();
		entList = new ArrayList<Entity>();
		triggerList = new ArrayList<Trigger>();
		nodeList = new ArrayList<Node>();
		causeDataList = new ArrayList<CauseData>();
		effectDataList = new ArrayList<EffectData>();
		nodePathList = new ArrayList<NodePath>();
	}

/***********************
 General parsing methods
 **********************/

	public void parseLevel(GL11 gl) throws XmlPullParserException, IOException
	{
		while (xrp.getEventType() != END_DOCUMENT)
		{
			if (xrp.getEventType() == START_TAG)
			{
				if (xrp.getName().equalsIgnoreCase("Entities"))
					parseEntities();
				else if (xrp.getName().equalsIgnoreCase("Tileset"))
					parseTileset(gl);
				else if (xrp.getName().equalsIgnoreCase("Triggers"))
					parseTriggers();
				else if (xrp.getName().equalsIgnoreCase("Nodes"))
					parseNodes();
				else if (xrp.getName().equalsIgnoreCase("NodeLinks"))
					parseNodeLinks();
				else if (xrp.getName().equalsIgnoreCase("TeleporterLinker"))
					parseTeleporterLinker();

			}

			xrp.next();
		}
	}

	public void parseEntities() throws XmlPullParserException, IOException
	{
		//xrp.next();
		while (!((xrp.getEventType() == END_TAG && xrp.getName().equals("Entities"))))
		{
			xrp.next();

			if (xrp.getEventType() == START_TAG)
			{
				dataHM = new HashMap<String, String>();
				if (xrp.getName().equalsIgnoreCase("Door"))
				{
					parseObj("Door");
					DoorData dd = new DoorData(dataHM);
					parsedList.add(dd);
					dd.createInst(entList);
				}
				else if (xrp.getName().equalsIgnoreCase("Button"))
				{
					parseObj("Button");
					ButtonData bd = new ButtonData(dataHM);
					parsedList.add(bd);
					bd.createInst(entList);
				}
				else if (xrp.getName().equalsIgnoreCase("PhysBlock"))
				{
					parseObj("PhysBlock");
					PhysBlockData pbd = new PhysBlockData(dataHM);
					parsedList.add(pbd);
					pbd.createInst(entList);
				}
				else if (xrp.getName().equalsIgnoreCase("PuzzleBox"))
				{
					parseObj("PuzzleBox");
					PuzzleBoxData pbd = new PuzzleBoxData(dataHM);
					parsedList.add(pbd);
					pbd.createInst(entList);
				}
				else if (xrp.getName().equalsIgnoreCase("PhysBall"))
				{
					parseObj("PhysBall");
					PhysBallData pbd = new PhysBallData(dataHM);
					parsedList.add(pbd);
					pbd.createInst(entList);
				}
				else if (xrp.getName().equalsIgnoreCase("Player"))
				{
					parseObj("Player");
					PlayerData pd = new PlayerData(dataHM);
					parsedList.add(pd);
					ArrayList<Entity> tempPlayerList = new ArrayList<Entity>();
					pd.createInst(tempPlayerList);
					player = (Player)tempPlayerList.get(0);
				}

				else if (xrp.getName().equalsIgnoreCase("Cannon"))
				{
					parseObj("Cannon");
					CannonData cd = new CannonData(dataHM);
					parsedList.add(cd);
					cd.createInst(entList);
				}
			}
		}
	}

	public HashMap<String, String> parseTag(HashMap<String, String> map) throws XmlPullParserException, IOException
	{
		String tagName = xrp.getName();
		xrp.next();
		map.put(tagName, xrp.getText());

		return map;
	}

	public HashMap<String, String> parseAttributes()
	{
		HashMap<String, String> map = new HashMap<String, String>();
		for (int i = 0; i < xrp.getAttributeCount(); i++)
		{
			map.put(xrp.getAttributeName(i), xrp.getAttributeValue(i));
		}

		return map;
	}

/****************
 Parse An Object
*****************/
	public void parseObj(String tn) throws XmlPullParserException, IOException
	{

		xrp.next();

		while (!(xrp.getEventType() == END_TAG && xrp.getName().equalsIgnoreCase(tn)))
		{
			if (xrp.getEventType() == START_TAG && xrp.getName().equalsIgnoreCase("renderMode"))
			{
				parseObj("renderMode");
				xrp.next();
			}
			else if (xrp.getEventType() == START_TAG && xrp.getName().equalsIgnoreCase("tileset"))
			{
				dataHM.put("tileset", "0");
				parseObj("tileset");
				xrp.next();
			}
			else if (xrp.getEventType() == START_TAG && xrp.getName().equalsIgnoreCase("texture"))
			{
				dataHM.put("texture", "0");
				parseObj("texture");
				xrp.next();
			}
			else
			{
				parseTag(dataHM);
				xrp.next();
				xrp.next();
			}
		}
	}

/***************
Parse A Tileset
***************/
	public void parseTileset(GL11 gl) throws XmlPullParserException, IOException
	{
		int x, y, curX, curY;

		HashMap<String, String> attributes = parseAttributes();

		x = Integer.parseInt(attributes.get("x"));
		y = Integer.parseInt(attributes.get("y"));

		TileData[][] tilesetData = new TileData[y][x];

		curX = 0;
		curY = 0;
		xrp.next();
		while (!(xrp.getEventType() == END_TAG && xrp.getName().equals("Tileset")))
		{
			if (curX == x)
			{
				curX = 0;
				curY++;
			}

			if (xrp.getName().equals("Tile"))
			{
				tilesetData[curY][curX] = new TileData(gl, xrp.getAttributeValue(0), curX, curY, x, y);
				curX++;

				xrp.next();
				xrp.next();
			}
		}

		tileset = new Tile[y][x];

		for (int i = 0; i < y; i++)
		{
			for (int j = 0; j < x; j++)
			{
				tileset[i][j] = tilesetData[i][j].getTile();
			}
		}
	}

	/******************
	 * Parse Triggers *
	 ******************/

	/**
	 * Parse a level file and store the associated data in this class.
	 * \todo return a Level!
	 * @throws XmlPullParserException Thrown when the XML file is not properly formatted.
	 * @throws IOException Thrown when there is an issue accessing the file.
	 */
	public void parseTriggers() throws XmlPullParserException, IOException
	{
		xrp.next();
		Log.d("LDS_Game", xrp.getName());
		while (!(xrp.getEventType() == END_TAG && xrp.getName().equals("Triggers")))
		{
			if (xrp.getName().equalsIgnoreCase("Cause"))
			{
				String causeId = xrp.getAttributeValue(0);
				String causeType = xrp.getAttributeValue(1);
				xrp.next();
				String[] causeParameters = xrp.getText().split(",");
				causeDataList.add(new CauseData(causeInitializer(causeType, causeParameters), causeId));
			}
			else if (xrp.getName().equalsIgnoreCase("Effect"))
			{
				String effectId = xrp.getAttributeValue(0);
				String effectType = xrp.getAttributeValue(1);
				xrp.next();
				String[] effectParameters;
				if (xrp.getText() != null)
					effectParameters = xrp.getText().split(",");
				else
				{
					effectParameters = new String[1];
					effectParameters[0] = "";
				}
				effectDataList.add(new EffectData(effectInitializer(effectType, effectParameters), effectId));
			}
			else if (xrp.getName().equalsIgnoreCase("Trigger"))
			{
				Cause cause = causeFromID(xrp.getAttributeValue(0));
				Effect effect = effectFromID(xrp.getAttributeValue(1));

				if (cause != null && effect != null)
				{
					triggerList.add(new Trigger(cause, effect));
				}
			}
			xrp.next();
			xrp.next();
		}
	}

	public Cause causeFromID(String causeID)
	{
		for (CauseData cd : causeDataList)
		{
			if (cd.getID().equalsIgnoreCase(causeID))
				return cd.getCause();
		}

		return null;
	}
	public Effect effectFromID(String effectID)
	{
		for (EffectData ed : effectDataList)
		{
			if (ed.getID().equalsIgnoreCase(effectID))
				return ed.getEffect();
		}

		return null;
	}

	public Cause causeInitializer(String type, String[] parameters)
	{
		Cause cause = null;
		if (type.equalsIgnoreCase("CauseNOT"))
		{
			cause = new CauseNOT(causeFromID(parameters[0]));
		}
		else if (type.equalsIgnoreCase("CauseAND"))
		{
			cause = new CauseAND(causeFromID(parameters[0]), causeFromID(parameters[1]));
		}
		else if (type.equalsIgnoreCase("CauseOR"))
		{
			cause = new CauseOR(causeFromID(parameters[0]), causeFromID(parameters[1]));
		}
		else if (type.equalsIgnoreCase("CauseXOR"))
		{
			cause = new CauseXOR(causeFromID(parameters[0]), causeFromID(parameters[1]));
		}
		else if (type.equalsIgnoreCase("CauseButton"))
		{
			cause = new CauseButton(this.<Button>stringToSubEntity(parameters[0]));
		}
		else if (type.equalsIgnoreCase("CauseEntityDestruction"))
		{
			cause = new CauseEntityDestruction(this.<Entity>stringToSubEntity(parameters[0]));
		}
		else if (type.equalsIgnoreCase("CauseLocation"))
		{
			cause = new CauseLocation(this.<Player>stringToSubEntity(parameters[0]),
					Float.parseFloat(parameters[1]),
					Float.parseFloat(parameters[2]),
					Float.parseFloat(parameters[3]),
					Float.parseFloat(parameters[4]));
		}

		else if (type.equalsIgnoreCase("CauseTimePassed"))
		{
			if (parameters.length == 2)
				cause = new CauseTimePassed(Integer.parseInt(parameters[0]), Boolean.parseBoolean(parameters[1]));
			else
				cause = new CauseTimePassed(Integer.parseInt(parameters[0]));
		}
		else if (type.equalsIgnoreCase("CauseOffScreen"))
		{
			cause = new CauseOffScreen(this.<Player>stringToSubEntity(parameters[0]), tileset);
		}

		return cause;
	}

	public Effect effectInitializer(String type, String[] parameters)
	{
		Effect effect = null;
		if (type.equalsIgnoreCase("EffectDoor"))
		{
			effect = new EffectDoor(this.<Door>stringToSubEntity(parameters[0]));
		}
		else if (type.equalsIgnoreCase("EffectEndGame"))
		{
			effect = new EffectEndGame(null, Boolean.parseBoolean(parameters[0]));
		}
		else if (type.equalsIgnoreCase("EffectRaiseBridge"))
		{
			effect = new EffectRaiseBridge(tileset[Integer.parseInt(parameters[1])][Integer.parseInt(parameters[0])]);  //\todo FIND OUT IF THIS WORKS!
		}
		else if (type.equalsIgnoreCase("EffectRemoveEntity"))
		{
			effect = new EffectRemoveEntity(this.<Entity>stringToSubEntity(parameters[0]));
		}
		else if (type.equalsIgnoreCase("EffectTriggerTimer"))
		{
			effect = new EffectTriggerTimer((CauseTimePassed)causeFromID(parameters[0]), false);
		}
		else if (type.equalsIgnoreCase("EffectAND"))
		{
			effect = new EffectAND(effectFromID(parameters[0]), effectFromID(parameters[1]));
		}

		return effect;
	}

	public <T> T stringToSubEntity(String id)
	{
		for (EntityData entD : parsedList)
		{
			if (entD.getID().equalsIgnoreCase(id))
			{
				return (T)entD.getEnt();
			}
		}
		return null;
	}

	/*********************
	Parse Nodes/Node Lists
	**********************/
	public void parseNodes() throws XmlPullParserException, IOException
	{
		xrp.next();
		String[] nodes = (xrp.getText()).split(";");

		for (String node : nodes)
		{
			String[] temp = node.split(",");
			nodeList.add(new Node(Float.parseFloat(temp[0]), Float.parseFloat(temp[1])));
		}

		xrp.next();
		xrp.next();
	}

	public void parseNodeLinks() throws XmlPullParserException, IOException
	{
		xrp.next();
		String[] nodeLinks = (xrp.getText()).split(";");

		for (String nodeLink : nodeLinks)
		{
			String[] temp = nodeLink.split(",");
			if (temp.length == 2)
				nodeList.get(Integer.parseInt(temp[0])).addNodeLink(nodeList.get(Integer.parseInt(temp[1])));
			else if (temp.length == 3)
				nodeList.get(Integer.parseInt(temp[0])).addNodeLink(nodeList.get(Integer.parseInt(temp[1])), Boolean.parseBoolean(temp[3]));
		}

		xrp.next();
		xrp.next();
	}

	public void parseNodePaths() throws XmlPullParserException, IOException
	{
		xrp.next();
		String[] nodePaths = (xrp.getText()).split(";");

		for (String nodePath : nodePaths)
		{
			NodePath np = new NodePath();
			String[] values = nodePath.split(",");
			np.setID(values[0]);
			for (int i = 1; i < values.length; i++)
			{
				np.add(nodeList.get(Integer.parseInt(values[i])));
			}
			nodePathList.add(np);
		}

		xrp.next();
		xrp.next();
	}

	/*********************
	 * TeleporterLinkers *
	 *********************/

	private void parseTeleporterLinker() throws XmlPullParserException, IOException //lol
	{
		Teleporter tp1 = this.<Teleporter>stringToSubEntity(xrp.getAttributeValue(0));
		Teleporter tp2 = this.<Teleporter>stringToSubEntity(xrp.getAttributeValue(1));
		boolean oneWay = Boolean.parseBoolean(xrp.getAttributeValue(2));
		TeleporterLinker tpLink = new TeleporterLinker(tp1, tp2, oneWay);

		xrp.next();
	}
}


text:
\hypertarget{classMyOption_1_1DigitalPutOption}{}\section{My\+Option\+:\+:Digital\+Put\+Option Class Reference}
\label{classMyOption_1_1DigitalPutOption}\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}

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

Inheritance diagram for My\+Option\+:\+:Digital\+Put\+Option\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=216pt]{classMyOption_1_1DigitalPutOption__inherit__graph}
\end{center}
\end{figure}

Collaboration diagram for My\+Option\+:\+:Digital\+Put\+Option\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=216pt]{classMyOption_1_1DigitalPutOption__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\hyperlink{classMyOption_1_1DigitalPutOption_a06d1c6c093b1bf2a1fcc24e46be8f06f}{Digital\+Put\+Option} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}, double \hyperlink{classMyOption_1_1Option_a3033c483588ce26b175280c7f9dee8d1}{Strike}, double \hyperlink{classMyOption_1_1Option_aa8cb250427dece65ea49255d4102cc8d}{r}, double \hyperlink{classMyOption_1_1Option_a500979f4b32262594d895c4a83b58d1d}{d}, double \hyperlink{classMyOption_1_1Option_a5d6002c14b335c782873bf1437113513}{Vol}, double \hyperlink{classMyOption_1_1Option_ac1adacb417fede41d151b9cda05bcb3d}{Expiry})
\item
virtual \hyperlink{classMyOption_1_1DigitalPutOption_af373736d79c052e94761072593e37648}{$\sim$\+Digital\+Put\+Option} ()
\item
virtual double \hyperlink{classMyOption_1_1DigitalPutOption_a4f51d8bdbdddfbebf428cea500c5edf0}{Get\+Value} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot})
\item
virtual double \hyperlink{classMyOption_1_1DigitalPutOption_a3d26c1e53753a199a35f0769672e94cf}{Get\+Value} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}, double \hyperlink{classMyOption_1_1Option_a5d6002c14b335c782873bf1437113513}{Vol}, double \hyperlink{classMyOption_1_1Option_ac1adacb417fede41d151b9cda05bcb3d}{Expiry})
\item
virtual double \hyperlink{classMyOption_1_1DigitalPutOption_ab55e215fef7a85bb06175a05548a3f77}{Get\+Value} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}, double \hyperlink{classMyOption_1_1Option_aa8cb250427dece65ea49255d4102cc8d}{r}, double \hyperlink{classMyOption_1_1Option_a5d6002c14b335c782873bf1437113513}{Vol}, double \hyperlink{classMyOption_1_1Option_ac1adacb417fede41d151b9cda05bcb3d}{Expiry})
\item
virtual double \hyperlink{classMyOption_1_1DigitalPutOption_a20e33b1b8a221ea2200fd08f3c691c4a}{Get\+Delta} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}, double \hyperlink{classMyOption_1_1Option_a5d6002c14b335c782873bf1437113513}{Vol}, double \hyperlink{classMyOption_1_1Option_ac1adacb417fede41d151b9cda05bcb3d}{Expiry})
\item
virtual double \hyperlink{classMyOption_1_1DigitalPutOption_a4eeb4d0c53f0075ee80e67270f4bd6a5}{Get\+Gamma} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}, double \hyperlink{classMyOption_1_1Option_a5d6002c14b335c782873bf1437113513}{Vol}, double \hyperlink{classMyOption_1_1Option_ac1adacb417fede41d151b9cda05bcb3d}{Expiry})
\item
virtual long \hyperlink{classMyOption_1_1DigitalPutOption_a6e38fdd2a8d6f6f959e5cdb0a66e4057}{Is\+Touched} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}) const
\item
virtual double \hyperlink{classMyOption_1_1DigitalPutOption_abadcbb78c02b4e6ee22d45da1c72f7b1}{Get\+Pay\+Off} (double \hyperlink{classMyOption_1_1Option_a6c6f01d75cde7e92d16a6d8d6f331a1d}{Spot}) const
\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classMyOption_1_1DigitalPutOption_a06d1c6c093b1bf2a1fcc24e46be8f06f}{}\label{classMyOption_1_1DigitalPutOption_a06d1c6c093b1bf2a1fcc24e46be8f06f}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Digital\+Put\+Option@{Digital\+Put\+Option}}
\index{Digital\+Put\+Option@{Digital\+Put\+Option}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Digital\+Put\+Option()}{DigitalPutOption()}}
{\footnotesize\ttfamily My\+Option\+::\+Digital\+Put\+Option\+::\+Digital\+Put\+Option (\begin{DoxyParamCaption}\item[{double}]{Spot,  }\item[{double}]{Strike,  }\item[{double}]{r,  }\item[{double}]{d,  }\item[{double}]{Vol,  }\item[{double}]{Expiry }\end{DoxyParamCaption})}

\hypertarget{classMyOption_1_1DigitalPutOption_af373736d79c052e94761072593e37648}{}\label{classMyOption_1_1DigitalPutOption_af373736d79c052e94761072593e37648}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!````~Digital\+Put\+Option@{$\sim$\+Digital\+Put\+Option}}
\index{````~Digital\+Put\+Option@{$\sim$\+Digital\+Put\+Option}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{$\sim$\+Digital\+Put\+Option()}{~DigitalPutOption()}}
{\footnotesize\ttfamily virtual My\+Option\+::\+Digital\+Put\+Option\+::$\sim$\+Digital\+Put\+Option (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [virtual]}}

\subsection{Member Function Documentation}
\hypertarget{classMyOption_1_1DigitalPutOption_a20e33b1b8a221ea2200fd08f3c691c4a}{}\label{classMyOption_1_1DigitalPutOption_a20e33b1b8a221ea2200fd08f3c691c4a}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Get\+Delta@{Get\+Delta}}
\index{Get\+Delta@{Get\+Delta}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Get\+Delta()}{GetDelta()}}
{\footnotesize\ttfamily virtual double My\+Option\+::\+Digital\+Put\+Option\+::\+Get\+Delta (\begin{DoxyParamCaption}\item[{double}]{Spot,  }\item[{double}]{Vol,  }\item[{double}]{Expiry }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_a4947bde99bb5e46b79aa0f36fd353d9b}{My\+Option\+::\+Option}.

\hypertarget{classMyOption_1_1DigitalPutOption_a4eeb4d0c53f0075ee80e67270f4bd6a5}{}\label{classMyOption_1_1DigitalPutOption_a4eeb4d0c53f0075ee80e67270f4bd6a5}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Get\+Gamma@{Get\+Gamma}}
\index{Get\+Gamma@{Get\+Gamma}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Get\+Gamma()}{GetGamma()}}
{\footnotesize\ttfamily virtual double My\+Option\+::\+Digital\+Put\+Option\+::\+Get\+Gamma (\begin{DoxyParamCaption}\item[{double}]{Spot,  }\item[{double}]{Vol,  }\item[{double}]{Expiry }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_a4416faa432b5004e449394056c7f1363}{My\+Option\+::\+Option}.

\hypertarget{classMyOption_1_1DigitalPutOption_abadcbb78c02b4e6ee22d45da1c72f7b1}{}\label{classMyOption_1_1DigitalPutOption_abadcbb78c02b4e6ee22d45da1c72f7b1}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Get\+Pay\+Off@{Get\+Pay\+Off}}
\index{Get\+Pay\+Off@{Get\+Pay\+Off}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Get\+Pay\+Off()}{GetPayOff()}}
{\footnotesize\ttfamily virtual double My\+Option\+::\+Digital\+Put\+Option\+::\+Get\+Pay\+Off (\begin{DoxyParamCaption}\item[{double}]{Spot }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_a4b6b84dc485153ffadfb32afa9bb52f3}{My\+Option\+::\+Option}.

\hypertarget{classMyOption_1_1DigitalPutOption_a4f51d8bdbdddfbebf428cea500c5edf0}{}\label{classMyOption_1_1DigitalPutOption_a4f51d8bdbdddfbebf428cea500c5edf0}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Get\+Value@{Get\+Value}}
\index{Get\+Value@{Get\+Value}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Get\+Value()}{GetValue()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily virtual double My\+Option\+::\+Digital\+Put\+Option\+::\+Get\+Value (\begin{DoxyParamCaption}\item[{double}]{Spot }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_aff32b402a5e44fca9e5a22a142fbbdd6}{My\+Option\+::\+Option}.

\hypertarget{classMyOption_1_1DigitalPutOption_a3d26c1e53753a199a35f0769672e94cf}{}\label{classMyOption_1_1DigitalPutOption_a3d26c1e53753a199a35f0769672e94cf}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Get\+Value@{Get\+Value}}
\index{Get\+Value@{Get\+Value}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Get\+Value()}{GetValue()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily virtual double My\+Option\+::\+Digital\+Put\+Option\+::\+Get\+Value (\begin{DoxyParamCaption}\item[{double}]{Spot,  }\item[{double}]{Vol,  }\item[{double}]{Expiry }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_a78fa248dcb939e0ebaefbb944d5d9cf8}{My\+Option\+::\+Option}.

\hypertarget{classMyOption_1_1DigitalPutOption_ab55e215fef7a85bb06175a05548a3f77}{}\label{classMyOption_1_1DigitalPutOption_ab55e215fef7a85bb06175a05548a3f77}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Get\+Value@{Get\+Value}}
\index{Get\+Value@{Get\+Value}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Get\+Value()}{GetValue()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily virtual double My\+Option\+::\+Digital\+Put\+Option\+::\+Get\+Value (\begin{DoxyParamCaption}\item[{double}]{Spot,  }\item[{double}]{r,  }\item[{double}]{Vol,  }\item[{double}]{Expiry }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_a62422d3dc60eabe65cfa94d2a452f5f8}{My\+Option\+::\+Option}.

\hypertarget{classMyOption_1_1DigitalPutOption_a6e38fdd2a8d6f6f959e5cdb0a66e4057}{}\label{classMyOption_1_1DigitalPutOption_a6e38fdd2a8d6f6f959e5cdb0a66e4057}
\index{My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}!Is\+Touched@{Is\+Touched}}
\index{Is\+Touched@{Is\+Touched}!My\+Option\+::\+Digital\+Put\+Option@{My\+Option\+::\+Digital\+Put\+Option}}
\subsubsection{\texorpdfstring{Is\+Touched()}{IsTouched()}}
{\footnotesize\ttfamily virtual long My\+Option\+::\+Digital\+Put\+Option\+::\+Is\+Touched (\begin{DoxyParamCaption}\item[{double}]{Spot }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [virtual]}}

Implements \hyperlink{classMyOption_1_1Option_ade57d2fcb9f22f3c2a57d75f55444c33}{My\+Option\+::\+Option}.

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
\hyperlink{options_8h}{options.\+h}\end{DoxyCompactItemize}

redpajama_set_name: RedPajamaGithub


text:
(function($) {
    // Make avatars selectable
    $('.selectable').selectable({
        selected: function( event, ui ) {
            var fileName = $(ui.selected).find('img').attr('src');
            $('#avatar').val(fileName);
        }
    });
})(jQuery);


text:
require('newrelic');

var Twit = require('twit');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
try {
	var config = require('./config');
} catch(e) {
	var config = {
		twitter: {
			consumer_key:         process.env.TWITTER_CONSUMER_KEY,
			consumer_secret:      process.env.TWITTER_CONSUMER_SECRET,
			access_token:         process.env.TWITTER_ACCESS_TOKEN,
			access_token_secret:  process.env.TWITTER_ACCESS_TOKEN_SECRET,

			lists: [
				{
					slug: "sa-journos-who-tweet", owner_screen_name: "rayjoe"
				},
				// {
				// 	slug: "a-brave-new-world", owner_screen_name: "rayjoe"
				// },
			],

			count: 200,
			interval: 120, //Seconds
		},
		mongodb: {
			connect_string: process.env.MONGOLAB_URI,
		},
	};
}

mongoose.connect(config.mongodb.connect_string);

var Tweet = mongoose.model('Tweet',
	{
		tweet: String,
		id: String,
		id_str: String,
		created_at: Date,
		text: String,
		source: String,
		user_id: Schema.Types.ObjectId,
		retweet_count: { type: Number, index: true },
		favorite_count: { type: Number, index: true },
		retweeted_status: Schema.Types.Mixed,
		user: Schema.Types.Mixed,
		list_slug: String,
		list_owner_screen_name: String,
		lists: Schema.Types.Mixed,
	}
);

var Tweeter = mongoose.model('Tweeter',
	{
		name: String,
		id: String,
		screen_name: String,
		location: String,
		description: String,
		followers_count: { type: Number, index: true },
		friends_count: Number,
		listed_count: { type: Number, index: true },
		favourites_count: { type: Number, index: true },
		created_at: Date,
		profile_image_url: String,
		list_slug: String,
		list_owner_screen_name: String,
	}
);

// var kitty = new Cat({ name: 'Zildjian' });
// kitty.save(function (err) {
//   if (err) // ...
//   console.log('meow');
// });

var T = new Twit({
	consumer_key:         config.twitter.consumer_key,
	consumer_secret:      config.twitter.consumer_secret,
	access_token:         config.twitter.access_token,
	access_token_secret:  config.twitter.access_token_secret,
});

var get_list = function(slug, owner_screen_name) {

	var remove_inc = function(o) {
		if (o.$inc) {
			delete o.$inc;
		}
	};

	T.get('lists/statuses', { slug: slug, owner_screen_name: owner_screen_name, count: config.twitter.count }, function(err, tweets, response) {
		if (err) {
			console.log("Twitter error", err);
			return;
		}
		var top_tweet = { retweet_count: 0 };
		tweets.forEach(function(tweet) {
			if (tweet.retweet_count > 5) {
				var user = tweet.user;
				user.lists = [];
				user.lists.push({ slug: slug, owner_screen_name: owner_screen_name });
				// tweet = tweet.retweeted_status;
				Tweeter.findOneAndUpdate({ id: tweet.user.id }, tweet.user, {upsert: true }, function(err, user) {
					if (err) {
						console.log("Tweeter Err", err);
					} else if (user) {
						remove_inc(tweet.user);
						tweet.user_id = user._id;
						tweet.list_slug = slug;
						tweet.list_owner_screen_name = owner_screen_name;
						Tweet.findOneAndUpdate({ id: tweet.id }, tweet, { upsert: true }, function(err, data) {
							if (err) {
								console.log("Tweet Err", err);
								// console.log(tweet);
							}
							// console.log(data);
						});
					}
				});

			}
			if (tweet.retweet_count > top_tweet.retweet_count) {
				top_tweet = tweet;
			}
		});
		console.log("Fetched list", owner_screen_name, slug);
		console.log("Top tweet", top_tweet.user.screen_name, top_tweet.text);
		// console.log(top_tweet);
	});
};

var list_queue = config.twitter.lists;

var get_next_list = function() {
	var item = list_queue.shift();
	get_list(item.slug, item.owner_screen_name);
	list_queue.push(item);
};

get_next_list();

setInterval(get_next_list, 1000 * config.twitter.interval);

//API Server
var restify = require('restify');

var server = restify.createServer();
server.use(restify.queryParser());
server.use(restify.CORS());

var timePeriod = function(t) {
	var periods = {
		n: 60,
		h: 60 * 60,
		d: 60 * 60 * 24,
		w: 60 * 60 * 24 * 7,
		m: 60 * 60 * 24 * 7 * 30,
		y: 60 * 60 * 24 * 7 * 365,
	};
	if (isNaN(t.charAt(t.length - 1))) {
		var p = t.slice(-1);
		if (p in periods) {
			t = periods[p] * parseInt(t);
		}
	}
	return new Date(new Date().getTime() - (t*1000));
};

var tweetQueryBuilder = function(req, res, next) {
	var find = {};
	if (req.params.list_slug) {
		find.list_slug = req.params.list_slug;
	}
	if (req.params.no_retweets) {
		find.retweeted_status = { $exists: false };
	}
	if (req.params.period) {
		find.created_at = { $gte:  timePeriod(req.params.period) };
	}
	var sort = "-created_at";
	if (req.params.sort) {
		sort = "-" + req.params.sort; //Always sort descending
	}
	var limit = 100;
	if (req.params.limit) {
		limit = req.params.limit;
	}
	req.mongodb_q = Tweet.find(find).sort(sort).limit(limit);
	next();
};

server.get("/tweets", tweetQueryBuilder, function(req, res, next) {
	req.mongodb_q.exec(function(err, tweets) {
		res.json(tweets);
		next();
	});
});

server.get("/tweeters", tweetQueryBuilder, function(req, res, next) {
	console.log(req.route.path);
	req.mongodb_q.exec(function(err, tweets) {
		res.json(tweets);
		next();
	});
});

server.get("/tweets/top/retweets/", function(req, res, next) {
	console.log(req.route.path);
	Tweet.find({ retweeted_status: { $exists: false }, list_slug: "sa-journos-who-tweet", created_at: { $gte: timePeriod("24h") }  }).sort({ retweet_count: -1 }).limit(10).exec(function(err, tweets) {
		res.json(tweets);
		next();
	});
});

server.get("/tweets/top/favourites/", function(req, res, next) {
	console.log(req.route.path);

	Tweet.find({ retweeted_status: { $exists: false }, list_slug: "sa-journos-who-tweet", created_at: { $gte: timePeriod("24h") } }).sort({ favorite_count: -1 }).limit(10).exec(function(err, tweets) {
		res.json(tweets);
		next();
	});
});

server.get("/tweeters/top/followers/", function(req, res, next) {
	console.log(req.route.path);
	Tweeter.find({ list_slug: "sa-journos-who-tweet" }).sort({ followers_count: -1 }).limit(10).exec(function(err, tweeters) {
		res.json(tweeters);
		next();
	});
});

server.get("/tweeters/top/listed/", function(req, res, next) {
	console.log(req.route.path);
	Tweeter.find({ list_slug: "sa-journos-who-tweet" }).sort({ listed_count: -1 }).limit(10).exec(function(err, tweeters) {
		res.json(tweeters);
		next();
	});
});

server.get("/tweeters/top/favourite/", function(req, res, next) {
	console.log(req.route.path);
	Tweeter.find({ list_slug: "sa-journos-who-tweet" }).sort({ favourites_count: -1 }).limit(10).exec(function(err, tweeters) {
		res.json(tweeters);
		next();
	});
});

server.listen(process.env.PORT || 8080, function() {
	console.log('%s listening at %s', server.name, server.url);
});


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <base data-ice="baseUrl" href="../../">
  <title data-ice="title">test/PolicyEngine.spec.js | Service Framework API Document</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">

  Home
  Manual
  Reference
  Source
  Test

    <input class="search-input">

bus
CBus

CMessageBus

CMiniBus

CPipeline

test/PolicyEngine.spec.js

import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';

chai.config.truncateThreshold = 0;

let expect = chai.expect;
chai.use(chaiAsPromised);

import AdvancedCondition from '../src/policy/conditions/AdvancedCondition';
import AllowOverrides from '../src/policy/combiningAlgorithms/AllowOverrides';
import Condition from '../src/policy/conditions/Condition';
import PEP from '../src/policy/PEP';
import Rule from '../src/policy/Rule';
import RuntimeCoreCtx from '../src/policy/context/RuntimeCoreCtx';
import Policy from '../src/policy/Policy';
import SubscriptionCondition from '../src/policy/conditions/SubscriptionCondition';
import { runtimeFactory } from './resources/runtimeFactory';

/********** CONDITIONS **********/
let simpleCondition = new Condition('source', 'equals', 'user1@domain1');
let andCondition = new AdvancedCondition(['and', new Condition('source', 'equals', 'user1@domain1'), new Condition('domain', 'equals', 'domain1')]);
let orCondition = new AdvancedCondition(['or', new Condition('source', 'equals', 'user1@domain1'), new Condition('domain', 'equals', 'domain1')]);
let notCondition = new AdvancedCondition(['not', new Condition('source', 'equals', 'user2@domain2')]);
let andNotCondition = new AdvancedCondition(['and', new Condition('source', 'equals', 'user1@domain1'), ['not', new Condition('domain', 'equals', 'domain1')]]);
let orNotCondition = new AdvancedCondition(['or', ['not', new Condition('domain', 'equals', 'domain1')], new Condition('source', 'equals', 'user1@domain1')]);

/********** RULES **********/
let simpleRule = new Rule(false, simpleCondition, 'global', 'global', 0);
let acceptAnySubscriptionRule = new Rule(true, new SubscriptionCondition('subscription', 'equals', '*'), 'global', 'global', 0);
let acceptPreAuthSubscriptionRule = new Rule(true, new SubscriptionCondition('subscription', 'in', 'preauthorised'), 'global', 'global', 0);
let blockAnySubscriptionRule = new Rule(false, new SubscriptionCondition('subscription', 'equals', '*'), 'global', 'global', 0);
let blockPreAuthSubscriptionRule = new Rule(false, new AdvancedCondition(['not', new SubscriptionCondition('subscription', 'in', 'preauthorised')]), 'global', 'global', 0);
let schemeRule = new Rule(false, new Condition('scheme', 'equals', 'comm'), 'global', 'global', 0);
let dateRule = new Rule(false, new Condition('date', 'equals', '01/01/2016'), 'global', 'global', 0);
let domainRule = new Rule(false, new Condition('domain', 'equals', 'blockedDomain'), 'global', 'global', 0);
let sourceRule = new Rule(false, new Condition('source', 'equals', 'user@blockedDomain'), 'global', 'global', 0);
let sourceRuleForConn = new Rule(false, new Condition('source', 'equals', 'user@blockedDomain'), 'hyperty', 'Connector', 0);
let sourceRuleForUser1 = new Rule(false, new Condition('source', 'equals', 'user@blockedDomain'), 'identity', 'user1@work,', 0);

/********** POLICIES **********/
let sourcePolicy = new Policy('HypertyChat', [simpleRule], [], 'allowOverrides');

/********** MESSAGES **********/
let messageFromChat = { body: { identity: { userProfile: { username: 'user@blockedDomain' } } }, id: 1, type: 'subscribe', from: 'hyperty://domain/hyperty-123', to: 'hyperty://domain/hyperty-456' };

let messageFromConn = { body: { identity: { userProfile: { username: 'user@blockedDomain' } } }, id: 1, type: 'subscribe', from: 'hyperty://domain/hyperty-012', to: 'hyperty://domain/hyperty-789' };

let messageFromUser1 = { body: { identity: { userProfile: { username: 'user1@domain1' } } }, id: 1, type: 'subscribe', from: 'scheme://domain/data-object-instance', to: 'comm://domain/data-object-instance' };

let messageFromUser2 = { body: { identity: { userProfile: { username: 'user2@domain2' } } }, id: 1, type: 'subscribe', from: 'scheme://domain/data-object-instance', to: 'comm://domain/data-object-instance' };

let noIdMessage = { from: 'hyperty://domain/hyperty-url', id: 1, to: 'comm://domain/hyperty-instance', type: 'subscribe' };

let message = { body: { auth: false, identity: { userProfile: { username: 'user@domain' } } }, from: 'hyperty://domain/hyperty-url', id: 1, to: 'comm://domain/hyperty-instance', type: 'subscribe' };

let messageFromBlocked = { body: { identity: { userProfile: { username: 'user@blockedDomain' } } }, id: 1, type: 'subscribe', from: 'comm://domain/data-object-instance', to: 'comm://domain/hyperty-instance' };

let subscribeMessage = { body: { identity: { userProfile: { username: 'user@domain' } }, subscriber: 'hyperty://domain/hyperty-instance' }, id: 1, type: 'subscribe', from: 'runtime://localhost/7600/sm', to: 'comm://domain/data-object-url/subscription' };

let allowedSubscribeMessage = { body: { auth: true, identity: { userProfile: { username: 'user@domain' } }, subscriber: 'hyperty://domain/hyperty-instance' }, id: 1, type: 'subscribe', from: 'runtime://localhost/7600/sm', to: 'comm://domain/data-object-url/subscription' };

let badSubscribeMessage = { body: { identity: { userProfile: { username: 'user@domain' } }, subscriber: 'hyperty://domain/not-preauthorised-hyperty-instance' }, id: 1, type: 'subscribe', from: 'runtime://localhost/7600/sm', to: 'comm://domain/data-object-url/subscription' };

/********** TESTS **********/
let runtimeCapabilities = {
  isAvailable: () => {
    return new Promise((resolve) => {
      resolve(false);
    });
  }
};

let runtimeCtx = new RuntimeCoreCtx();

describe('Policies management', () => {
  describe('conditions management', () => {
    it('creates a simple condition', () => {
      expect(simpleCondition.attribute).to.be.eql('source');
      expect(simpleCondition.operator).to.be.eql('equals');
      expect(simpleCondition.params).to.be.eql('user1@domain1');
    });
    it('returns condition is applicable', () => {
      expect(simpleCondition.isApplicable(runtimeCtx, messageFromUser1)).to.be.eql(true);
    });
    it('returns condition is not applicable', () => {
      expect(simpleCondition.isApplicable(runtimeCtx, messageFromUser2)).to.be.eql(false);
    });

    it('creates an advanced condition - "and"', () => {
      expect(andCondition.condition).to.be.eql(['and', new Condition('source', 'equals', 'user1@domain1'), new Condition('domain', 'equals', 'domain1')]);
      expect(andCondition.condition[0]).to.be.eql('and');
      expect(andCondition.condition[1]).to.be.eql(new Condition('source', 'equals', 'user1@domain1'));
      expect(andCondition.condition[2]).to.be.eql(new Condition('domain', 'equals', 'domain1'));
    });

    it('correctly returns "and" condition is applicable', () => {
      expect(andCondition.isApplicable(runtimeCtx, messageFromUser1)).to.be.eql(true);
    });

    it('correctly returns "and" condition is not applicable', () => {
      expect(andCondition.isApplicable(runtimeCtx, messageFromUser2)).to.be.eql(false);
    });

    it('creates an advanced condition - "or"', () => {
      expect(orCondition.condition).to.be.eql(['or', new Condition('source', 'equals', 'user1@domain1'), new Condition('domain', 'equals', 'domain1')]);
    });

    it('correctly returns "or" condition is applicable', () => {
      expect(orCondition.isApplicable(runtimeCtx, messageFromUser1)).to.be.eql(true);
    });

    it('correctly returns "or" condition is not applicable', () => {
      expect(orCondition.isApplicable(runtimeCtx, messageFromUser2)).to.be.eql(false);
    });

    it('creates an advanced condition - "not"', () => {
      expect(notCondition.condition).to.be.eql(['not', new Condition('source', 'equals', 'user2@domain2')]);
    });

    it('correctly returns "not" condition is applicable', () => {
      expect(notCondition.isApplicable(runtimeCtx, messageFromUser1)).to.be.eql(true);
    });

    it('correctly returns "not" condition is not applicable', () => {
      expect(notCondition.isApplicable(runtimeCtx, messageFromUser2)).to.be.eql(false);
    });

    it('correctly returns "and not" condition is not applicable', () => {
      expect(andNotCondition.isApplicable(runtimeCtx, messageFromUser1)).to.be.eql(false);
    });

    it('correctly returns "or not" condition is applicable', () => {
      expect(orNotCondition.isApplicable(runtimeCtx, messageFromUser1)).to.be.eql(true);
    });
  });

  describe('rules management', () => {
    it('creates a simple rule', () => {
      expect(simpleRule.decision).to.be.eql(false);
      expect(simpleRule.condition).to.be.eql(simpleCondition);
      expect(simpleRule.scope).to.be.eql('global');
      expect(simpleRule.target).to.be.eql('global');
    });
    it('evaluates a simple rule to false', () => {
      expect(simpleRule.evaluate(runtimeCtx, messageFromUser1)).to.be.eql(false);
    });
    it('evaluates a simple rule to "Not Applicable"', () => {
      expect(simpleRule.evaluate(runtimeCtx, messageFromUser2)).to.be.eql('Not Applicable');
    });
  });

  describe('policies management', () => {
    it('creates a service provider policy', () => {
      expect(sourcePolicy.key).to.be.eql('HypertyChat');
      expect(sourcePolicy.combiningAlgorithm).to.be.eql(new AllowOverrides());
      expect(sourcePolicy.rules).to.be.eql([simpleRule]);
    });
    it('evaluates a service provider policy to false', () => {
      expect(sourcePolicy.evaluateRules(runtimeCtx, messageFromUser1)).to.be.eql(false);
    });
    it('evaluates a service provider policy to "Not Applicable"', () => {
      expect(sourcePolicy.evaluateRules(runtimeCtx, messageFromUser2)).to.be.eql('Not Applicable');
    });
  });
});

describe('Policy Engine with Runtime Core context', () => {
  let runtimeRegistry = {
    isInterworkingProtoStub: () => {
      return false;
    },
    isLocal: () => {
      return true;
    },
    getPreAuthSubscribers: () => {
      return ['hyperty://domain/hyperty-instance'];
    },
    getHypertyName: (hypertyURL) => {
      if (hypertyURL === 'hyperty://domain/hyperty-123') {
        return 'HypertyChat';
      }
      if (hypertyURL === 'hyperty://domain/hyperty-789') {
        return 'Connector';
      }
    },
    getHypertyOwner: () => {
      return 'user://work/user2';
    },
    getReporterURLSynchonous: () => {
      return 'hyperty://domain/hyperty-url';
    },
    getUserEmailFromURL: () => {
      return 'user2@work';
    },
    isDataObjectURL: (dataObjectURL) => {
      let splitURL = dataObjectURL.split('://');
      return splitURL[0] === 'comm';
    },
    registerSubscribedDataObject: () => {},
    registerSubscriber: () => {},
    runtimeURL: 'runtime://localhost/7601'
  };

  let identityModule = {
    decryptMessage: (message) => {
      return new Promise((resolve) => {
        resolve(message);
      });
    },
    doMutualAuthentication: (message) => {
      return new Promise((resolve) => {
        resolve(message);
      });
    },
    encryptMessage: (message) => {
      return new Promise((resolve) => {
        resolve(message);
      });
    },
    getIdentity: () => {
      return new Promise((resolve) => {
        resolve({ userProfile: {username: 'user@domain' } });
      });
    },
    getToken: () => {
      return new Promise((resolve) => {
        resolve({ userProfile: {username: 'user@domain' } });
      });
    },
    _getHypertyFromDataObject: (dataObjectURL) => {
      return new Promise((resolve) => {
        if (dataObjectURL === 'comm://domain/data-object-url') {
          resolve('hyperty://domain/hyperty-url');
        }
      });
    }
  };
  let storageManager = runtimeFactory.storageManager();
  let policyEngine = new PEP(new RuntimeCoreCtx(identityModule, runtimeRegistry, storageManager, runtimeCapabilities));

  describe('initial filtering', () => {
    it('message that loads an hyperty should not be validated by policies', () => {
      let loadMessage = { id: 2, from: 'hyperty-runtime://sandbox/external', to: 'hyperty-runtime://sandbox/internal', type: 'create' };
      expect(policyEngine._isToVerify(loadMessage)).to.be.eql(false);
    });

    /*it('message of the "update" type must have the data object\'s reporter as source', (done) => {
      let updateMessage = { body: { source: 'hyperty://domain/hyperty-url', identity: 'identityToken' }, from: 'comm://domain/data-object-url', id: 3, to: 'comm://domain/data-object-url/changes', type: 'update' };
      expect(policyEngine.authorise(updateMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(updateMessage).and.notify(done);

      let badUpdateMessage = { body: { source: 'hyperty://domain/hyperty-url2', identity: 'identityToken' }, from: 'comm://domain/data-object-url', id: 3, to: 'comm://domain/data-object-url/changes', type: 'update' };
      expect(policyEngine.authorise(badUpdateMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });*/
  });

  describe('identity obtention', () => {
    it('should add an identity in the message body', (done) => {
      expect(policyEngine.authorise(noIdMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(message).and.notify(done);
    });

    it('should maintain the identity in the message body', (done) => {
      expect(policyEngine.authorise(message).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(message).and.notify(done);
    });
  });

  describe('policies management', () => {
    policyEngine.removePolicy('*');

    it('adds a service provider policy to the engine', () => {
      policyEngine.context.activeUserPolicy = undefined;
      policyEngine.addPolicy('SERVICE_PROVIDER', 'HypertyChat', sourcePolicy);
      console.log('policyEngine.context.serviceProviderPolicy');
      console.log(policyEngine.context.serviceProviderPolicy);
      expect(policyEngine.context.serviceProviderPolicy).to.be.eql({HypertyChat: new Policy('HypertyChat', [simpleRule], [])});
      expect(policyEngine.context.serviceProviderPolicy.HypertyChat).to.be.eql(new Policy('HypertyChat', [simpleRule], []));
      expect(policyEngine.context.serviceProviderPolicy.HypertyChat.actions).to.be.eql([]);
      expect(policyEngine.context.serviceProviderPolicy.HypertyChat.rules).to.be.eql([simpleRule]);
    });

    it('adds a user policy to the engine', () => {
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [dateRule], []));
      expect(policyEngine.context.userPolicies).to.be.eql({'My policy': new Policy('My policy', [dateRule], [])});
      expect(policyEngine.context.userPolicies['My policy']).to.be.eql(new Policy('My policy', [dateRule], []));
      expect(policyEngine.context.userPolicies['My policy'].actions).to.be.eql([]);
      expect(policyEngine.context.userPolicies['My policy'].rules).to.be.eql([dateRule]);
    });

    it('adds a second user policy to the engine', () => {
      policyEngine.addPolicy('USER', 'My second policy', new Policy('My second policy', [simpleRule], []));
      expect(policyEngine.context.userPolicies).to.be.eql({'My policy': new Policy('My policy', [dateRule], []), 'My second policy': new Policy('My second policy', [simpleRule], [])});
      expect(policyEngine.context.serviceProviderPolicy).to.be.eql({HypertyChat: new Policy('HypertyChat', [simpleRule], [])});
      expect(policyEngine.context.activeUserPolicy).to.be.eql(undefined);
    });

    it('removes an existing user policy', () => {
      policyEngine.removePolicy('USER', 'My policy');
      expect(policyEngine.context.serviceProviderPolicy).to.be.eql({HypertyChat: new Policy('HypertyChat', [simpleRule], [])});
      expect(policyEngine.context.userPolicies).to.be.eql({'My second policy': new Policy('My second policy', [simpleRule], [])});
      expect(policyEngine.context.activeUserPolicy).to.be.eql(undefined);
    });

    it('tries to remove a policy that does not exist', () => {
      policyEngine.removePolicy('USER', 'Vacations');
      expect(policyEngine.context.serviceProviderPolicy).to.be.eql({HypertyChat: new Policy('HypertyChat', [simpleRule], [])});
      expect(policyEngine.context.userPolicies).to.be.eql({'My second policy': new Policy('My second policy', [simpleRule], [])});
      expect(policyEngine.context.activeUserPolicy).to.be.eql(undefined);
    });

    it('removes all policies', () => {
      policyEngine.removePolicy('*');
      expect(policyEngine.context.serviceProviderPolicy).to.be.eql({});
      expect(policyEngine.context.userPolicies).to.be.eql({});
      expect(policyEngine.context.activeUserPolicy).to.be.eql(undefined);
    });

    it('does not apply rules as it is not its target', (done) => {
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [sourceRuleForConn], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromChat).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(messageFromChat).and.notify(done);

      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [sourceRuleForUser1], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromUser2).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(messageFromChat).and.notify(done);
    });

    it('applies a rule as it is its target', (done) => {
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [sourceRuleForConn], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromConn).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });
  });

  describe('functionality: scheme', () => {
    it('rejects the message as it is from a blocked scheme', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [schemeRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromBlocked).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });

    it('allows the message as it comes from a scheme that is not blocked', (done) => {
      expect(policyEngine.authorise(message).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(message).and.notify(done);
    });
  });

  describe('functionality: source', () => {
    let sourceRule2 = new Rule(false, new Condition('source', 'in', ['user@blockedDomain']));
    it('rejects the message as it comes from a blocked source', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [sourceRule2], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromBlocked).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });

    it('rejects the message as it comes from a blocked source', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [sourceRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromBlocked).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });

    it('allows the message as it comes from a source that is not blocked', (done) => {
      expect(policyEngine.authorise(message).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(message).and.notify(done);
    });
  });

  describe('functionality: domain', () => {
    it('rejects the message as it comes from a blocked domain', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [domainRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(messageFromBlocked).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });

    it('allows the message as it comes from a domain that is not blocked', (done) => {
      expect(policyEngine.authorise(message).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(message).and.notify(done);
    });
  });

  describe('data objects management', () => {
    it('rejects a subscription attempt, as the policy rejects all', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [blockAnySubscriptionRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(subscribeMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });

    it('accepts a subscription attempt, as the policy accepts all', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [acceptAnySubscriptionRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(subscribeMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(allowedSubscribeMessage).and.notify(done);
    });

    it('accepts a subscription attempt, as the policy accepts preauthorised subscribers and is preauthorised', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [acceptPreAuthSubscriptionRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(subscribeMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.fulfilled.and.eventually.eql(allowedSubscribeMessage).and.notify(done);
    });

    it('rejects a subscription attempt, as the policy rejects non-preauthorised subscriber and is not preauthorised', (done) => {
      policyEngine.removePolicy('*');
      policyEngine.addPolicy('USER', 'My policy', new Policy('My policy', [blockPreAuthSubscriptionRule], []));
      policyEngine.context.activeUserPolicy = 'My policy';
      expect(policyEngine.authorise(badSubscribeMessage).then((message) => {
        return message;
      }), (error) => {
        return error;
      }).to.be.rejected.and.notify(done);
    });
  });

  describe('groups management', () => {
    let groups = policyEngine.context.groups;
    for (let i in groups) {
      policyEngine.context.deleteGroup(i);
    }

    it('creates a group', () => {
      policyEngine.context.createGroup('groupA');
      expect(policyEngine.context.getGroupsNames()).to.be.eql(['groupA']);
    });

    it('creates a second group', () => {
      policyEngine.context.createGroup('groupB');
      expect(policyEngine.context.getGroupsNames()).to.be.eql(['groupA', 'groupB']);
    });

    it('adds an email to a group', () => {
      policyEngine.context.addToGroup('groupA', 'user1@domain');
      expect(policyEngine.context.getGroup('groupA')).to.be.eql(['user1@domain']);
    });

    it('adds a second email to a group', () => {
      policyEngine.context.addToGroup('groupA', 'user2@domain');
      expect(policyEngine.context.getGroup('groupA')).to.be.eql(['user1@domain', 'user2@domain']);
    });

    it('removes a user from a group', () => {
      policyEngine.context.removeFromGroup('groupA', 'user1@domain');
      expect(policyEngine.context.getGroup('groupA')).to.be.eql(['user2@domain']);
    });

    it('deletes a group', () => {
      policyEngine.context.deleteGroup('groupA');
      expect(policyEngine.context.getGroup('groupA')).to.be.eql([]);
      expect(policyEngine.context.getGroupsNames()).to.be.eql(['groupB']);
    });
  });
  policyEngine.removePolicy('*');

});

  Generated by ESDoc(0.5.2)


text:
@interface UIImage(AppCore)
+ (instancetype)ac_launchImage;

- (NSString *)ac_base64;
- (UIImage *)ac_resizeWithNewSize:(CGSize)newSize;
- (UIImage *)ac_resizeWithMinSide:(CGFloat)minSide;
- (UIImage *)ac_imageWithInsets:(UIEdgeInsets)insets;

- (UIImage *)ac_alwaysTemplate;
- (UIImage *)ac_alwaysOriginal;
@end

#define ACImageNamed(name) [UIImage imageNamed:name]


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<views xmlns="http://schemas.haulmont.com/cuba/view.xsd">
    <view entity="test$SeveralFetchGroups_TariffVersion"
          extends="_local"
          name="tariffVersion.withParent">
        <property name="parent" view="tariff-with-version"/>
    </view>

    <view entity="test$SeveralFetchGroups_Tariff"
          extends="_minimal"
          name="tariff-with-version">
        <property name="parent"
                  view="_minimal"/>
        <property name="activeVersion" view="_minimal"/>
    </view>

    <view entity="test$Many2Many_FetchSame1"
          extends="_local"
          name="Many2Many_FetchSame1-emptyCollection">
        <property name="many2"
                  view="_minimal">
            <property name="many1"
                      view="_minimal">
                <property name="many2"
                          view="_minimal"/>
            </property>
        </property>
    </view>

    <view entity="test$Many2Many_FetchSame1"
          extends="_local"
          name="Many2Many_FetchSame1-sameEntityTwice">
        <property name="oneToMany2"
                  view="_minimal">
            <property name="many3"
                      view="_minimal">
                <property name="oneToMany2"
                          view="_minimal"/>
            </property>
        </property>
    </view>

    <view entity="sales1$Order" name="with-customer" extends="_local">
        <property name="customer" view="_local"/>
    </view>

    <view entity="sales1$OrderLine" name="with-product" extends="_local">
        <property name="product" view="_local"/>
    </view>

    <view entity="test$CompositeOne"
          extends="_local"
          name="compositeOne-view">
        <property name="compositePropertyOne"
                  view="compositePropertyOne-view">
        </property>
    </view>

    <view entity="test$CompositePropertyOne"
          extends="_local"
          name="compositePropertyOne-view">
        <property name="compositeOne" view="_minimal"/>
        <property name="compositeTwo" view="compositeTwo-view"/>
    </view>

    <view entity="test$CompositeTwo"
          extends="_local"
          name="compositeTwo-view">
        <property name="compositePropertyTwo"
                  view="compositePropertyTwo-view"/>
    </view>

    <view entity="test$CompositePropertyTwo"
          extends="_local"
          name="compositePropertyTwo-view">
        <property name="compositeTwo" view="_minimal"/>
    </view>

    <view entity="test_SelfReferencedEntity" name="entityWithChildren" extends="_local">
        <property name="children" view="_local"/>
    </view>
</views>


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Form\Type\Product;

use Sylius\Bundle\MoneyBundle\Form\Type\MoneyType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Sylius\Component\Core\Model\ChannelInterface;
use Sylius\Component\Core\Model\ChannelPricingInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class ChannelPricingType extends AbstractResourceType
{
    private ?RepositoryInterface $channelPricingRepository;

    public function __construct(
        string $dataClass,
        array $validationGroups,
        ?RepositoryInterface $channelPricingRepository = null
    ) {
        parent::__construct($dataClass, $validationGroups);

        $this->channelPricingRepository = $channelPricingRepository;
    }

    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('price', MoneyType::class, [
                'label' => 'sylius.ui.price',
                'currency' => $options['channel']->getBaseCurrency()->getCode(),
            ])
            ->add('originalPrice', MoneyType::class, [
                'label' => 'sylius.ui.original_price',
                'required' => false,
                'currency' => $options['channel']->getBaseCurrency()->getCode(),
            ])
            ->add('minimumPrice', MoneyType::class, [
                'label' => 'sylius.ui.minimum_price',
                'required' => false,
                'currency' => $options['channel']->getBaseCurrency()->getCode(),
            ])
        ;

        $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use ($options): void {
            $channelPricing = $event->getData();

            if (!$channelPricing instanceof $this->dataClass || !$channelPricing instanceof ChannelPricingInterface) {
                $event->setData(null);

                return;
            }

            if ($channelPricing->getPrice() === null && $channelPricing->getOriginalPrice() === null) {
                $event->setData(null);

                if ($channelPricing->getId() !== null) {
                    $this->channelPricingRepository->remove($channelPricing);
                }

                return;
            }

            $channelPricing->setChannelCode($options['channel']->getCode());
            $channelPricing->setProductVariant($options['product_variant']);

            $event->setData($channelPricing);
        });
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        parent::configureOptions($resolver);

        $resolver
            ->setRequired('channel')
            ->setAllowedTypes('channel', [ChannelInterface::class])

            ->setDefined('product_variant')
            ->setAllowedTypes('product_variant', ['null', ProductVariantInterface::class])

            ->setDefaults([
                'label' => function (Options $options): string {
                    return $options['channel']->getName();
                },
            ])
        ;
    }

    public function getBlockPrefix(): string
    {
        return 'sylius_channel_pricing';
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <string name="exo_controls_show">Mostrar controlos do leitor</string>
  <string name="exo_controls_hide">Ocultar controlos do leitor</string>
  <string name="exo_controls_seek_bar_description">Progresso da reprodução</string>
  <string name="exo_controls_settings_description">Definições</string>
  <string name="exo_controls_overflow_hide_description">Ocultar definições adicionais</string>
  <string name="exo_controls_overflow_show_description">Mostrar definições adicionais</string>
  <string name="exo_controls_fullscreen_enter_description">Mudar para ecrã inteiro</string>
  <string name="exo_controls_fullscreen_exit_description">Sair do ecrã inteiro</string>
  <string name="exo_controls_previous_description">Anterior</string>
  <string name="exo_controls_next_description">Seguinte</string>
  <string name="exo_controls_pause_description">Pausar</string>
  <string name="exo_controls_play_description">Reproduzir</string>
  <string name="exo_controls_stop_description">Parar</string>
  <string name="exo_controls_rewind_description">Recuar</string>
  <plurals name="exo_controls_rewind_by_amount_description">
    <item quantity="one">Retroceder %d segundo</item>
    <item quantity="other">Retroceder %d segundos</item>
  </plurals>
  <string name="exo_controls_fastforward_description">Avançar</string>
  <plurals name="exo_controls_fastforward_by_amount_description">
    <item quantity="one">Avançar %d segundo</item>
    <item quantity="other">Avançar %d segundos</item>
  </plurals>
  <string name="exo_controls_repeat_off_description">Modo atual: não repetir. Ative/des. repetição.</string>
  <string name="exo_controls_repeat_one_description">Modo atual: repetir um. Ative/des. repetição.</string>
  <string name="exo_controls_repeat_all_description">Modo atual: repet. tudo. Ative/des. repetição.</string>
  <string name="exo_controls_shuffle_on_description">Desativar modo aleatório</string>
  <string name="exo_controls_shuffle_off_description">Ativar modo aleatório</string>
  <string name="exo_controls_vr_description">Modo de RV</string>
  <string name="exo_controls_cc_enabled_description">Desativar legendas</string>
  <string name="exo_controls_cc_disabled_description">Ativar legendas</string>
  <string name="exo_controls_playback_speed">Velocidade</string>
  <string-array name="exo_controls_playback_speeds">
    <item>0,25x</item>
    <item>0,5x</item>
    <item>0,75x</item>
    <item>Normal</item>
    <item>1,25x</item>
    <item>1,5x</item>
    <item>2x</item>
  </string-array>
  <string name="exo_track_selection_title_video">Vídeo</string>
  <string name="exo_track_selection_title_audio">Áudio</string>
  <string name="exo_track_selection_title_text">Texto</string>
  <string name="exo_track_selection_none">Nenhuma</string>
  <string name="exo_track_selection_auto">Automático</string>
  <string name="exo_track_unknown">Desconhecida</string>
  <string name="exo_track_resolution">%1$d × %2$d</string>
  <string name="exo_track_mono">Mono</string>
  <string name="exo_track_stereo">Estéreo</string>
  <string name="exo_track_surround">Som surround</string>
  <string name="exo_track_surround_5_point_1">Som surround 5.1</string>
  <string name="exo_track_surround_7_point_1">Som surround 7.1</string>
  <string name="exo_track_role_alternate">Alternativa</string>
  <string name="exo_track_role_supplementary">Suplementar</string>
  <string name="exo_track_role_commentary">Comentário</string>
  <string name="exo_track_role_closed_captions">Legendas</string>
  <string name="exo_track_bitrate">%1$.2f Mbps</string>
  <string name="exo_item_list">%1$s, %2$s</string>
</resources>


text:
#include "EvtGenBase/EvtPatches.hh"

// Point on a finite 1-D interval. isValid shows whether for a given specification,
// the coordinate _value is inside the interval defined by _min, _max.

#include <stdio.h>
#include "EvtGenBase/EvtPoint1D.hh"

EvtPoint1D::EvtPoint1D()
  : _min(0.), _max(-1.), _value(0.), _valid(false)
{}

EvtPoint1D::EvtPoint1D(double value)
  : _min(0.), _max(-1.), _value(value), _valid(true)
{}

EvtPoint1D::EvtPoint1D(double min, double max, double value)
  : _min(min), _max(max), _value(value), _valid((_min <= _value && _value <= _max) ? true : false)
{}

EvtPoint1D::~EvtPoint1D()
{}

void EvtPoint1D::print() const
{
  printf("%f (%f : %f)\n",_value,_min,_max);
}