text:
Clause::Clause():
	depth(0), number(0), inputstring(""),
	type(Unknown), setOfSupport(0), partOfConclusion(0),
	positiveClause(), negativeClause()
{
	// do nothing
}

Clause::Clause(const Clause &src):
	depth(src.depth), number(src.number),
	inputstring(src.inputstring),
	type(src.type), setOfSupport(src.setOfSupport),
	partOfConclusion(src.partOfConclusion),
	positiveClause(src.positiveClause),
	negativeClause(src.negativeClause)
{
	// do nothing
}

Clause::Clause(const List<String> &list):
	depth(0), number(0), inputstring(""),
	type(Unknown), setOfSupport(0), partOfConclusion(0),
	positiveClause(), negativeClause()
{
	MustBeTrue(parse(list) == OK);
}

Clause::~Clause()
{
	clear();
}

// parse input string
int
Clause::parse(const List<String> &list)
{
	// set defaults values
	clear();

	// check if list is empty
	if (list.isEmpty())
	{
		// nothing to parse
		type = Empty;
		return(OK);
	}

	// list is not empty, get options.
	ListIterator<String> listIter(list);
	String options = listIter();

	// parse options
	StringMatcher conclusionopt(options, String("CONCLUSION"));
	if (!conclusionopt.done())
		partOfConclusion = 1;
	StringMatcher setofsupportopt(options, String("SET-OF-SUPPORT"));
	if (!setofsupportopt.done())
		setOfSupport = 1;

	// scan list of literal strings
	for (listIter++; !listIter.done(); listIter++)
	{
		// insert literal into clause; will set type.
		Literal literal(listIter());
		if (insert(literal) != OK)
			return(NOTOK);
	}

	// convert to a string
	convertToString(inputstring);

	// all done
	return(OK);
}

// assignment
Clause &
Clause::operator=(const Clause &rhs)
{
	// check of self-assignment
	if (this == &rhs)
		return(*this);

	// clear old data
	clear();

	// copy new data
	depth = rhs.depth;
	number = rhs.number;
	inputstring = rhs.inputstring;
	type = rhs.type;
	setOfSupport = rhs.setOfSupport;
	partOfConclusion = rhs.partOfConclusion;
	positiveClause = rhs.positiveClause;
	negativeClause = rhs.negativeClause;

	// all done
	return(*this);
}

Clause &
Clause::operator=(const List<String> &rhs)
{
	MustBeTrue(parse(rhs) == OK);
	return(*this);
}

// update the clause type
void
Clause::updateType()
{
	if (!negativeClause.isEmpty() && !positiveClause.isEmpty())
		type = Mixed;
	else if (!negativeClause.isEmpty() && positiveClause.isEmpty())
		type = Negative;
	else if (negativeClause.isEmpty() && !positiveClause.isEmpty())
		type = Positive;
	else
		type = Empty;
	return;
}

// comparison operators - can only compare up to the equivalent classes.
// with two clauses (negative and positive) to compare, it becomes a
// little bit tricky.
//
int
Clause::compare(const BinaryTree<Tuple<Literal, List<Literal> > > &cl1,
	const BinaryTree<Tuple<Literal, List<Literal> > > &cl2) const
{
	// are they the same?
	if (&cl1 == &cl2)
		return(0);

	// compare clauses
	BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
		cl1Iter(cl1), cl2Iter(cl2);
	for ( ; !cl1Iter.done() && !cl2Iter.done(); cl1Iter++, cl2Iter++)
	{
		if (cl1Iter().key < cl2Iter().key)
			return(-1);
		else if (cl1Iter().key > cl2Iter().key)
			return(1);
	}
	if (cl1Iter.done() && !cl2Iter.done())
		return(-1);
	else if (!cl1Iter.done() && cl2Iter.done())
		return(1);
	else
		return(0);
}

int
Clause::operator==(const Clause &rhs) const
{
	// check of clauses are the same
	if (compare(positiveClause, rhs.positiveClause) != 0)
		return(0);
	else if (compare(negativeClause, rhs.negativeClause) != 0)
		return(0);
	else
		return(1);
}

int
Clause::operator!=(const Clause &rhs) const
{
	// check of clauses are not the same
	if (compare(positiveClause, rhs.positiveClause) != 0)
		return(1);
	else if (compare(negativeClause, rhs.negativeClause) != 0)
		return(1);
	else
		return(0);
}

int
Clause::operator<(const Clause &rhs) const
{
	// compare positive clause
	int status = compare(positiveClause, rhs.positiveClause);
	if (status < 0)
		return(1);
	else if (status > 0)
		return(0);

	// compare negative clause
	status = compare(negativeClause, rhs.negativeClause);
	if (status < 0)
		return(1);
	else
		return(0);
}

int
Clause::operator>(const Clause &rhs) const
{
	// compare positive clause
	int status = compare(positiveClause, rhs.positiveClause);
	if (status > 0)
		return(1);
	else if (status < 0)
		return(0);

	// compare negative clause
	status = compare(negativeClause, rhs.negativeClause);
	if (status > 0)
		return(1);
	else
		return(0);
}

int
Clause::operator<=(const Clause &rhs) const
{
	// compare positive clause
	int status = compare(positiveClause, rhs.positiveClause);
	if (status < 0)
		return(1);
	else if (status > 0)
		return(0);

	// compare negative clause
	status = compare(negativeClause, rhs.negativeClause);
	if (status <= 0)
		return(1);
	else
		return(0);
}

int
Clause::operator>=(const Clause &rhs) const
{
	// compare positive clause
	int status = compare(positiveClause, rhs.positiveClause);
	if (status > 0)
		return(1);
	else if (status < 0)
		return(0);

	// compare negative clause
	status = compare(negativeClause, rhs.negativeClause);
	if (status >= 0)
		return(1);
	else
		return(0);
}

// access operations
int
Clause::insert(const Literal &key)
{
	// check if the key is negated
	if (key.isNegated())
		return(insert(key, negativeClause));
	else
		return(insert(key, positiveClause));
}

int
Clause::retrieve(Literal &key, int idx) const
{
	// check if the key is negated
	if (key.isNegated())
		return(retrieve(key, idx, negativeClause));
	else
		return(retrieve(key, idx, positiveClause));
}

int
Clause::update(const Literal &key, int idx)
{
	// check if the key is negated
	if (key.isNegated())
		return(update(key, idx, negativeClause));
	else
		return(update(key, idx, positiveClause));
}

int
Clause::remove(Literal &key, int idx)
{
	// check if the key is negated
	if (key.isNegated())
		return(remove(key, idx, negativeClause));
	else
		return(remove(key, idx, positiveClause));
}

int
Clause::insert(const Literal &key,
	BinaryTree<Tuple<Literal, List<Literal> > > &clause)
{
	// check if a class already exists
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	int status = clause.retrieve(tuple);
	if (status == OK)
	{
		if ((status = tuple.data.insertAtEnd(key)) != OK)
			return(status);
		if ((status = clause.update(tuple)) != OK)
			return(status);
	}
	else if (status == NOMATCH)
	{
		if ((status = tuple.data.insertAtEnd(key)) != OK)
			return(status);
		if ((status = clause.insert(tuple)) != OK)
			return(status);
	}
	else
		return(status);

	// update the type
	updateType();

	// all done
	return(OK);
}

int
Clause::retrieve(Literal &key, int idx,
	const BinaryTree<Tuple<Literal, List<Literal> > > &clause) const
{
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	int status = clause.retrieve(tuple);
	if (status != OK)
		return(status);
	else
		return(tuple.data.retrieveNth(idx, key));
}

int
Clause::update(const Literal &key, int idx,
	BinaryTree<Tuple<Literal, List<Literal> > > &clause)
{
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	int status = clause.retrieve(tuple);
	if (status != OK)
		return(status);
	status = tuple.data.updateNth(idx, key);
	if (status != OK)
		return(status);
	return(clause.update(tuple));
}

int
Clause::remove(Literal &key, int idx,
	BinaryTree<Tuple<Literal, List<Literal> > > &clause)
{
	// delete literal from the clause
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	int status = clause.retrieve(tuple);
	if (status != OK)
		return(status);
	status = tuple.data.removeNth(idx, key);
	if (status != OK)
		return(status);
	if (tuple.data.isEmpty())
	{
		// remove class, we just removed the last member
		status = clause.remove(tuple);
		if (status != OK)
			return(status);
	}

	// update the type
	updateType();

	// all done
	return(OK);
}

int
Clause::insertEqSet(const Literal &key, const List<Literal> &data)
{
	int status;

	// insert tuple
	Tuple<Literal, List<Literal> > tuple(key, data);
	if (key.isNegated())
	{
		if ((status = negativeClause.insert(tuple)) != OK)
			return(status);
	}
	else
	{
		if ((status = positiveClause.insert(tuple)) != OK)
			return(status);
	}

	// update the type
	updateType();

	// all done
	return(OK);
}

int
Clause::retrieveEqSet(const Literal &key, List<Literal> &data) const
{
	int status;
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	if (key.isNegated())
		status = negativeClause.retrieve(tuple);
	else
		status = positiveClause.retrieve(tuple);
	if (status == OK)
		data = tuple.data;
	return(status);
}

int
Clause::updateEqSet(const Literal &key, const List<Literal> &data)
{
	Tuple<Literal, List<Literal> > tuple(key, data);
	if (key.isNegated())
		return(negativeClause.update(tuple));
	else
		return(positiveClause.update(tuple));
}

int
Clause::removeEqSet(Literal &key, List<Literal> &data)
{
	int status;
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	if (key.isNegated())
		status = negativeClause.remove(tuple);
	else
		status = positiveClause.remove(tuple);
	if (status == OK)
	{
		updateType();
		data = tuple.data;
	}
	return(status);
}

int
Clause::isInClause(const Literal &key) const
{
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	if (key.isNegated())
		return(negativeClause.retrieve(tuple) == OK);
	else
		return(positiveClause.retrieve(tuple) == OK);
}

int
Clause::isEmpty() const
{
	return(negativeClause.isEmpty() && positiveClause.isEmpty());
}

// return the number of classes and total members
int
Clause::getTotalMembers() const
{
	int memberno = 0;
	for (ClauseIterator thisIter(*this); !thisIter.done(); thisIter++)
	{
		memberno += thisIter().data.getCount();
	}
	return(memberno);
}

int
Clause::getTotalSets() const
{
	int setno = 0;
	for (ClauseIterator thisIter(*this); !thisIter.done(); thisIter++)
	{
		setno += 1;
	}
	return(setno);
}

int
Clause::getMembersInSet(const Literal &key) const
{
	int status;
	Tuple<Literal, List<Literal> > tuple(key, List<Literal>());
	if (key.isNegated())
		status = negativeClause.retrieve(tuple);
	else
		status = positiveClause.retrieve(tuple);
	if (status == OK)
		return(tuple.data.getCount());
	else
		return(0);
}

// remove all entries in the clause
void
Clause::clear()
{
	// clear types
	depth = number = 0;
	type = Unknown;
	inputstring = String("");
	setOfSupport = 0;
	partOfConclusion = 0;

	// now delete tree nodes
	positiveClause.clear();
	negativeClause.clear();

	// all done
	return;
}

// rename variables in clause
int
Clause::renameVariables()
{
	Clause newcl;
	Map<String, String> nvs;

	// rename variables in positive clause
	BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
		pclIter(positiveClause);
	for ( ; !pclIter.done(); pclIter++)
	{
		ListIterator<Literal> dataIter(pclIter().data);
		for ( ; !dataIter.done(); dataIter++)
		{
			Literal literal(dataIter());
			if (literal.renameVariables(nvs) != OK)
				return(NOTOK);
			if (newcl.insert(literal) != OK)
				return(NOTOK);
		}
	}

	// rename variables in negative clause
	BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
		nclIter(negativeClause);
	for ( ; !nclIter.done(); nclIter++)
	{
		ListIterator<Literal> dataIter(nclIter().data);
		for ( ; !dataIter.done(); dataIter++)
		{
			Literal literal(dataIter());
			if (literal.renameVariables(nvs) != OK)
				return(NOTOK);
			if (newcl.insert(literal) != OK)
				return(NOTOK);
		}
	}

	// overwrite existing clauses
	*this = newcl;

	// all done
	return(OK);
}

// convert term to a string
String
Clause::convertToString(String &s) const
{
	// clear string
	s = String("");

	// convert literals to strings
	BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
		pclIter(positiveClause);
	for ( ; !pclIter.done(); pclIter++)
	{
		ListIterator<Literal> dataIter(pclIter().data);
		for (int first=1; !dataIter.done(); dataIter++)
		{
			if (!first)
				s += String("|| ");
			else
				first = 0;
			s += (String)dataIter() + String(" ");
		}
	}
	BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
		nclIter(negativeClause);
	for ( ; !nclIter.done(); nclIter++)
	{
		ListIterator<Literal> dataIter(nclIter().data);
		for (int first=1; !dataIter.done(); dataIter++)
		{
			if (!first)
				s += String("|| ");
			else
				first = 0;
			s += (String)dataIter() + String(" ");
		}
	}

	// return the new string
	return(s);
}

String
Clause::operator String() const
{
	String tmp;
	return(convertToString(tmp));
}

String
Clause::operator String()
{
	return(convertToString(inputstring));
}

// get maximal set or literal for a clause
int
Clause::getMaximalSet(Literal &key, List<Literal> &data) const
{
	// check if there any literals
	if (!positiveClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			pclIter(positiveClause);
		key = pclIter().key;
		data = pclIter().data;
	}
	else if (!negativeClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			nclIter(negativeClause);
		key = nclIter().key;
		data = nclIter().data;
	}
	else
		return(NOMATCH);

	// all done
	return(OK);
}

int
Clause::getMaximalPositiveSet(Literal &key, List<Literal> &data) const
{
	// check if there any literals
	if (!positiveClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			pclIter(positiveClause);
		key = pclIter().key;
		data = pclIter().data;
		return(OK);
	}
	else
		return(NOMATCH);
}

int
Clause::getMaximalNegativeSet(Literal &key, List<Literal> &data) const
{
	// check if there any literals
	if (!negativeClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			nclIter(negativeClause);
		key = nclIter().key;
		data = nclIter().data;
		return(OK);
	}
	else
		return(NOMATCH);
}

int
Clause::getMaximalLiteral(Literal &data) const
{
	// check if there any literals
	if (!positiveClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			pclIter(positiveClause);
		if (pclIter().data.retrieveAtFront(data) != OK)
			return(NOTOK);
	}
	else if (!negativeClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			nclIter(negativeClause);
		if (nclIter().data.retrieveAtFront(data) != OK)
			return(NOTOK);
	}
	else
		return(NOMATCH);

	// all done
	return(OK);
}

int
Clause::getMaximalPositiveLiteral(Literal &data) const
{
	// check if there any literals
	if (!positiveClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			pclIter(positiveClause);
		if (pclIter().data.retrieveAtFront(data) != OK)
			return(NOTOK);
		return(OK);
	}
	else
		return(NOMATCH);
}

int
Clause::getMaximalNegativeLiteral(Literal &data) const
{
	// check if there any literals
	if (!negativeClause.isEmpty())
	{
		// return first equivalent set
		BinaryTreeIterator_InOrder<Tuple<Literal, List<Literal> > >
			nclIter(negativeClause);
		if (nclIter().data.retrieveAtFront(data) != OK)
			return(NOTOK);
		return(OK);
	}
	else
		return(NOMATCH);
}

// combine two clauses
Clause
operator+(const Clause &cl1, const Clause &cl2)
{
	Clause newcl(cl1);
	ClauseIterator cl2Iter(cl2);
	for ( ; !cl2Iter.done(); cl2Iter++)
	{
		ListIterator<Literal> dataIter(cl2Iter.data());
		for ( ; !dataIter.done(); dataIter++)
		{
			MustBeTrue(newcl.insert(dataIter()) == OK);
		}
	}
DUMP(newcl);
	newcl.updateType();
DUMP(newcl);
	return(newcl);
}

// print clause literals
ostream &
operator<<(ostream &os, const Clause &c)
{
	os << "Type: ";
	switch (c.type)
	{
	case Clause::Positive:
		os << "Positive";
		break;
	case Clause::Negative:
		os << "Negative";
		break;
	case Clause::Mixed:
		os << "Mixed";
		break;
	case Clause::Unknown:
		os << "Unknown";
		break;
	case Clause::Empty:
		os << "Empty";
		break;
	default:
		MustBeTrue(0);
		break;

	}
	os << endl;
	os << "Clause Depth: " << c.depth << endl;
	os << "Clause Number: " << c.number << endl;
	if (c.setOfSupport)
		os << "Set-of-Support: Yes" << endl;
	else
		os << "Set-of-Support: No" << endl;
	if (c.partOfConclusion)
		os << "Part-of-Conclusion: Yes" << endl;
	else
		os << "Part-of-Conclusion: No" << endl;

	// os << "Clause: " << c.clause << endl;
	ClauseIterator cIter(c);
	for ( ; !cIter.done(); cIter++)
	{
		Literal key = cIter.key();
		List<Literal> data = cIter.data();
		os << "equivalence class key literal: " << key << endl;
		ListIterator<Literal> dataIter(data);
		for ( ; !dataIter.done(); dataIter++)
		{
			os << "equivalence class data literal: " << dataIter() << endl;
		}
	}
	return(os);
}

// ordered set iterator constructors and destructor
ClauseIterator::ClauseIterator(const ClauseIterator &src):
		pclIter(src.pclIter), nclIter(src.nclIter)
{
	// do nothing
}

ClauseIterator::ClauseIterator(const Clause &c):
		pclIter(c.positiveClause), nclIter(c.negativeClause)
{
	// do nothing
}

ClauseIterator::~ClauseIterator()
{
	// do nothing
}

// reset iterator to beginning
void
ClauseIterator::reset()
{
	pclIter.reset();
	nclIter.reset();
	return;
}

// is list empty
int
ClauseIterator::done() const
{
	return(pclIter.done() && nclIter.done());
}

// return current data
Tuple<Literal, List<Literal> >
ClauseIterator::operator()()
{
	if (!pclIter.done())
		return(pclIter());
	else if (!nclIter.done())
		return(nclIter());
	else
		MustBeTrue(0);
}

Literal
ClauseIterator::key()
{
	if (!pclIter.done())
		return(pclIter().key);
	else if (!nclIter.done())
		return(nclIter().key);
	else
		MustBeTrue(0);
}

List<Literal>
ClauseIterator::data()
{
	if (!pclIter.done())
		return(pclIter().data);
	else if (!nclIter.done())
		return(nclIter().data);
	else
		MustBeTrue(0);
}

// increment to next data item in list
int
ClauseIterator::operator++(int)
{
	if (!pclIter.done())
		return(pclIter++);
	else if (!nclIter.done())
		return(nclIter++);
	else
		MustBeTrue(0);
}

// clause iterator constructors and destructor
PositiveClauseIterator::PositiveClauseIterator(
		const PositiveClauseIterator &src):
		clauseIter(src.clauseIter)
{
	// do nothing
}

PositiveClauseIterator::PositiveClauseIterator(const Clause &c):
		clauseIter(c.positiveClause)
{
	// do nothing
}

PositiveClauseIterator::~PositiveClauseIterator()
{
	// do nothing
}

// reset iterator to beginning
void
PositiveClauseIterator::reset()
{
	clauseIter.reset();
	return;
}

// is list empty
int
PositiveClauseIterator::done() const
{
	return(clauseIter.done());
}

// return current data
Tuple<Literal, List<Literal> >
PositiveClauseIterator::operator()()
{
	return(clauseIter());
}

Literal
PositiveClauseIterator::key()
{
	return(clauseIter().key);
}

List<Literal>
PositiveClauseIterator::data()
{
	return(clauseIter().data);
}

// increment to next data item in list
int
PositiveClauseIterator::operator++(int)
{
	return(clauseIter++);
}

// clause iterator constructors and destructor
NegativeClauseIterator::NegativeClauseIterator(
		const NegativeClauseIterator &src):
		clauseIter(src.clauseIter)
{
	// do nothing
}

NegativeClauseIterator::NegativeClauseIterator(const Clause &c):
		clauseIter(c.negativeClause)
{
	// do nothing
}

NegativeClauseIterator::~NegativeClauseIterator()
{
	// do nothing
}

// reset iterator to beginning
void
NegativeClauseIterator::reset()
{
	clauseIter.reset();
	return;
}

// is list empty
int
NegativeClauseIterator::done() const
{
	return(clauseIter.done());
}

// return current data
Tuple<Literal, List<Literal> >
NegativeClauseIterator::operator()()
{
	return(clauseIter());
}

Literal
NegativeClauseIterator::key()
{
	return(clauseIter().key);
}

List<Literal>
NegativeClauseIterator::data()
{
	return(clauseIter().data);
}

// increment to next data item in list
int
NegativeClauseIterator::operator++(int)
{
	return(clauseIter++);
}


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

    <item
        android:id="@+id/action_create"
        android:icon="@drawable/ic_action_create"
        android:title="@string/action_create"
        android:orderInCategory="99999"
        app:showAsAction="always"/>

</menu>

redpajama_set_name: RedPajamaGithub


text:
package com.google.cloud.tpu.v1.samples;

// [START tpu_v1_generated_tpuclient_listacceleratortypes_sync]
import com.google.cloud.tpu.v1.AcceleratorType;
import com.google.cloud.tpu.v1.AcceleratorTypeName;
import com.google.cloud.tpu.v1.ListAcceleratorTypesRequest;
import com.google.cloud.tpu.v1.TpuClient;

public class SyncListAcceleratorTypes {

  public static void main(String[] args) throws Exception {
    syncListAcceleratorTypes();
  }

  public static void syncListAcceleratorTypes() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (TpuClient tpuClient = TpuClient.create()) {
      ListAcceleratorTypesRequest request =
          ListAcceleratorTypesRequest.newBuilder()
              .setParent(
                  AcceleratorTypeName.of("[PROJECT]", "[LOCATION]", "[ACCELERATOR_TYPE]")
                      .toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .build();
      for (AcceleratorType element : tpuClient.listAcceleratorTypes(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}
// [END tpu_v1_generated_tpuclient_listacceleratortypes_sync]


text:
import test from 'ava';

const uuid = require('../../src/util/uuid');

test('Should return a string', (t) => {
    t.is(typeof uuid() === 'string', true);
});


text:
copyright:
  years: 2014, 2016
lastupdated: "2016-12-06"

---
{:new_window: target="_blank"}
{:shortdesc: .shortdesc}

# Desvinculando e desprovisionando sua instância do {{site.data.keyword.objectstorageshort}} {: #deprovisioning-object-storage}

Se você tiver vinculado o {{site.data.keyword.objectstorageshort}} a um aplicativo Cloud Foundry e não tiver mais necessidade de armazenamento, será possível desvincular e desprover sua instância.
{: shortdesc}

## Desvinculando sua instância
Se você não tiver mais necessidade do {{site.data.keyword.objectstorageshort}} em seu app Cloud Foundry, mas desejar manter seus dados salvos, será possível desvincular a instância do serviço de seu app.

**Atenção**: se você desvincular uma instância do
{{site.data.keyword.objectstorageshort}} de um aplicativo
{{site.data.keyword.Bluemix_notm}} ou excluir a chave de serviço, todas as suas
credenciais para essa instância serão excluídas e não poderão ser restauradas. A conta do {{site.data.keyword.objectstorageshort}} não será excluída até que a instância do {{site.data.keyword.objectstorageshort}} seja desprovida. É possível gerar novas credenciais de nuvem religando ou criando uma nova chave de serviço.

1. Para ver os serviços que estão vinculados ao seu app, clique na guia Conexões no aplicativo Cloud Foundry.
2. Localize o serviço que deseja desvincular e clique no botão do menu no tile do serviço.
3. Selecione **Desvincular serviço**.
4. Limpe a caixa **Excluir instância de serviço** e clique em **OK**.
5. Clique em **Remontar** para que sua mudança entre em vigor.

## Desprovisionando sua instância

Se você tiver uma instância do {{site.data.keyword.objectstorageshort}} que não é mais necessária, será possível excluí-la.

**Atenção**: ao desprover uma instância do {{site.data.keyword.objectstorageshort}}, o projeto em nuvem e a conta Swift serão excluídos. Todos
os contêineres e objetos na instância desprovisionada serão excluídos e não
poderão ser restaurados.

1. Para ver os serviços que estão vinculados ao seu app, clique na guia Conexões no aplicativo Cloud Foundry.
2. Localize o serviço que deseja desvincular e clique no botão do menu no tile do serviço.
3. Selecione **Excluir serviço**.
4. Clique em **Excluir** para confirmar.
5. Clique em **Remontar** para que sua mudança entre em vigor.


text:
/* @flow */

"use strict";

var _interopRequireDefault = require("babel-runtime/helpers/interop-require-default")["default"];

exports.__esModule = true;

var _xhtml = require("./xhtml");

var _xhtml2 = _interopRequireDefault(_xhtml);

var _tokenizerTypes = require("../../tokenizer/types");

var _tokenizerContext = require("../../tokenizer/context");

var _parser = require("../../parser");

var _parser2 = _interopRequireDefault(_parser);

var _utilIdentifier = require("../../util/identifier");

var _utilWhitespace = require("../../util/whitespace");

var HEX_NUMBER = /^[\da-fA-F]+$/;
var DECIMAL_NUMBER = /^\d+$/;

_tokenizerContext.types.j_oTag = new _tokenizerContext.TokContext("<tag", false);
_tokenizerContext.types.j_cTag = new _tokenizerContext.TokContext("</tag", false);
_tokenizerContext.types.j_expr = new _tokenizerContext.TokContext("<tag>...</tag>", true, true);

_tokenizerTypes.types.jsxName = new _tokenizerTypes.TokenType("jsxName");
_tokenizerTypes.types.jsxText = new _tokenizerTypes.TokenType("jsxText", { beforeExpr: true });
_tokenizerTypes.types.jsxTagStart = new _tokenizerTypes.TokenType("jsxTagStart");
_tokenizerTypes.types.jsxTagEnd = new _tokenizerTypes.TokenType("jsxTagEnd");

_tokenizerTypes.types.jsxTagStart.updateContext = function () {
  this.state.context.push(_tokenizerContext.types.j_expr); // treat as beginning of JSX expression
  this.state.context.push(_tokenizerContext.types.j_oTag); // start opening tag context
  this.state.exprAllowed = false;
};

_tokenizerTypes.types.jsxTagEnd.updateContext = function (prevType) {
  var out = this.state.context.pop();
  if (out === _tokenizerContext.types.j_oTag && prevType === _tokenizerTypes.types.slash || out === _tokenizerContext.types.j_cTag) {
    this.state.context.pop();
    this.state.exprAllowed = this.curContext() === _tokenizerContext.types.j_expr;
  } else {
    this.state.exprAllowed = true;
  }
};

var pp = _parser2["default"].prototype;

// Reads inline JSX contents token.

pp.jsxReadToken = function () {
  var out = "";
  var chunkStart = this.state.pos;
  for (;;) {
    if (this.state.pos >= this.input.length) {
      this.raise(this.state.start, "Unterminated JSX contents");
    }

    var ch = this.input.charCodeAt(this.state.pos);

    switch (ch) {
      case 60: // "<"
      case 123:
        // "{"
        if (this.state.pos === this.state.start) {
          if (ch === 60 && this.state.exprAllowed) {
            ++this.state.pos;
            return this.finishToken(_tokenizerTypes.types.jsxTagStart);
          }
          return this.getTokenFromCode(ch);
        }
        out += this.input.slice(chunkStart, this.state.pos);
        return this.finishToken(_tokenizerTypes.types.jsxText, out);

      case 38:
        // "&"
        out += this.input.slice(chunkStart, this.state.pos);
        out += this.jsxReadEntity();
        chunkStart = this.state.pos;
        break;

      default:
        if (_utilWhitespace.isNewLine(ch)) {
          out += this.input.slice(chunkStart, this.state.pos);
          out += this.jsxReadNewLine(true);
          chunkStart = this.state.pos;
        } else {
          ++this.state.pos;
        }
    }
  }
};

pp.jsxReadNewLine = function (normalizeCRLF) {
  var ch = this.input.charCodeAt(this.state.pos);
  var out = undefined;
  ++this.state.pos;
  if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
    ++this.state.pos;
    out = normalizeCRLF ? "\n" : "\r\n";
  } else {
    out = String.fromCharCode(ch);
  }
  ++this.state.curLine;
  this.state.lineStart = this.state.pos;

  return out;
};

pp.jsxReadString = function (quote) {
  var out = "";
  var chunkStart = ++this.state.pos;
  for (;;) {
    if (this.state.pos >= this.input.length) {
      this.raise(this.state.start, "Unterminated string constant");
    }

    var ch = this.input.charCodeAt(this.state.pos);
    if (ch === quote) break;
    if (ch === 38) {
      // "&"
      out += this.input.slice(chunkStart, this.state.pos);
      out += this.jsxReadEntity();
      chunkStart = this.state.pos;
    } else if (_utilWhitespace.isNewLine(ch)) {
      out += this.input.slice(chunkStart, this.state.pos);
      out += this.jsxReadNewLine(false);
      chunkStart = this.state.pos;
    } else {
      ++this.state.pos;
    }
  }
  out += this.input.slice(chunkStart, this.state.pos++);
  return this.finishToken(_tokenizerTypes.types.string, out);
};

pp.jsxReadEntity = function () {
  var str = "";
  var count = 0;
  var entity = undefined;
  var ch = this.input[this.state.pos];

  var startPos = ++this.state.pos;
  while (this.state.pos < this.input.length && count++ < 10) {
    ch = this.input[this.state.pos++];
    if (ch === ";") {
      if (str[0] === "#") {
        if (str[1] === "x") {
          str = str.substr(2);
          if (HEX_NUMBER.test(str)) entity = String.fromCharCode(parseInt(str, 16));
        } else {
          str = str.substr(1);
          if (DECIMAL_NUMBER.test(str)) entity = String.fromCharCode(parseInt(str, 10));
        }
      } else {
        entity = _xhtml2["default"][str];
      }
      break;
    }
    str += ch;
  }
  if (!entity) {
    this.state.pos = startPos;
    return "&";
  }
  return entity;
};

// Read a JSX identifier (valid tag or attribute name).
//
// Optimized version since JSX identifiers can"t contain
// escape characters and so can be read as single slice.
// Also assumes that first character was already checked
// by isIdentifierStart in readToken.

pp.jsxReadWord = function () {
  var ch = undefined;
  var start = this.state.pos;
  do {
    ch = this.input.charCodeAt(++this.state.pos);
  } while (_utilIdentifier.isIdentifierChar(ch) || ch === 45); // "-"
  return this.finishToken(_tokenizerTypes.types.jsxName, this.input.slice(start, this.state.pos));
};

// Transforms JSX element name to string.

function getQualifiedJSXName(object) {
  if (object.type === "JSXIdentifier") {
    return object.name;
  }

  if (object.type === "JSXNamespacedName") {
    return object.namespace.name + ":" + object.name.name;
  }

  if (object.type === "JSXMemberExpression") {
    return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
  }
}

// Parse next token as JSX identifier

pp.jsxParseIdentifier = function () {
  var node = this.startNode();
  if (this.match(_tokenizerTypes.types.jsxName)) {
    node.name = this.state.value;
  } else if (this.state.type.keyword) {
    node.name = this.state.type.keyword;
  } else {
    this.unexpected();
  }
  this.next();
  return this.finishNode(node, "JSXIdentifier");
};

// Parse namespaced identifier.

pp.jsxParseNamespacedName = function () {
  var startPos = this.state.start,
      startLoc = this.state.startLoc;
  var name = this.jsxParseIdentifier();
  if (!this.eat(_tokenizerTypes.types.colon)) return name;

  var node = this.startNodeAt(startPos, startLoc);
  node.namespace = name;
  node.name = this.jsxParseIdentifier();
  return this.finishNode(node, "JSXNamespacedName");
};

// Parses element name in any form - namespaced, member
// or single identifier.

pp.jsxParseElementName = function () {
  var startPos = this.state.start,
      startLoc = this.state.startLoc;
  var node = this.jsxParseNamespacedName();
  while (this.eat(_tokenizerTypes.types.dot)) {
    var newNode = this.startNodeAt(startPos, startLoc);
    newNode.object = node;
    newNode.property = this.jsxParseIdentifier();
    node = this.finishNode(newNode, "JSXMemberExpression");
  }
  return node;
};

// Parses any type of JSX attribute value.

pp.jsxParseAttributeValue = function () {
  var node = undefined;
  switch (this.state.type) {
    case _tokenizerTypes.types.braceL:
      node = this.jsxParseExpressionContainer();
      if (node.expression.type === "JSXEmptyExpression") {
        this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
      } else {
        return node;
      }

    case _tokenizerTypes.types.jsxTagStart:
    case _tokenizerTypes.types.string:
      node = this.parseExprAtom();
      node.extra = null;
      return node;

    default:
      this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
  }
};

// JSXEmptyExpression is unique type since it doesn't actually parse anything,
// and so it should start at the end of last read token (left brace) and finish
// at the beginning of the next one (right brace).

pp.jsxParseEmptyExpression = function () {
  var node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
  return this.finishNodeAt(node, "JSXEmptyExpression", this.start, this.startLoc);
};

// Parses JSX expression enclosed into curly brackets.

pp.jsxParseExpressionContainer = function () {
  var node = this.startNode();
  this.next();
  if (this.match(_tokenizerTypes.types.braceR)) {
    node.expression = this.jsxParseEmptyExpression();
  } else {
    node.expression = this.parseExpression();
  }
  this.expect(_tokenizerTypes.types.braceR);
  return this.finishNode(node, "JSXExpressionContainer");
};

// Parses following JSX attribute name-value pair.

pp.jsxParseAttribute = function () {
  var node = this.startNode();
  if (this.eat(_tokenizerTypes.types.braceL)) {
    this.expect(_tokenizerTypes.types.ellipsis);
    node.argument = this.parseMaybeAssign();
    this.expect(_tokenizerTypes.types.braceR);
    return this.finishNode(node, "JSXSpreadAttribute");
  }
  node.name = this.jsxParseNamespacedName();
  node.value = this.eat(_tokenizerTypes.types.eq) ? this.jsxParseAttributeValue() : null;
  return this.finishNode(node, "JSXAttribute");
};

// Parses JSX opening tag starting after "<".

pp.jsxParseOpeningElementAt = function (startPos, startLoc) {
  var node = this.startNodeAt(startPos, startLoc);
  node.attributes = [];
  node.name = this.jsxParseElementName();
  while (!this.match(_tokenizerTypes.types.slash) && !this.match(_tokenizerTypes.types.jsxTagEnd)) {
    node.attributes.push(this.jsxParseAttribute());
  }
  node.selfClosing = this.eat(_tokenizerTypes.types.slash);
  this.expect(_tokenizerTypes.types.jsxTagEnd);
  return this.finishNode(node, "JSXOpeningElement");
};

// Parses JSX closing tag starting after "</".

pp.jsxParseClosingElementAt = function (startPos, startLoc) {
  var node = this.startNodeAt(startPos, startLoc);
  node.name = this.jsxParseElementName();
  this.expect(_tokenizerTypes.types.jsxTagEnd);
  return this.finishNode(node, "JSXClosingElement");
};

// Parses entire JSX element, including it"s opening tag
// (starting after "<"), attributes, contents and closing tag.

pp.jsxParseElementAt = function (startPos, startLoc) {
  var node = this.startNodeAt(startPos, startLoc);
  var children = [];
  var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
  var closingElement = null;

  if (!openingElement.selfClosing) {
    contents: for (;;) {
      switch (this.state.type) {
        case _tokenizerTypes.types.jsxTagStart:
          startPos = this.state.start;startLoc = this.state.startLoc;
          this.next();
          if (this.eat(_tokenizerTypes.types.slash)) {
            closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
            break contents;
          }
          children.push(this.jsxParseElementAt(startPos, startLoc));
          break;

        case _tokenizerTypes.types.jsxText:
          children.push(this.parseExprAtom());
          break;

        case _tokenizerTypes.types.braceL:
          children.push(this.jsxParseExpressionContainer());
          break;

        default:
          this.unexpected();
      }
    }

    if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
      this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
    }
  }

  node.openingElement = openingElement;
  node.closingElement = closingElement;
  node.children = children;
  if (this.match(_tokenizerTypes.types.relational) && this.state.value === "<") {
    this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
  }
  return this.finishNode(node, "JSXElement");
};

// Parses entire JSX element from current position.

pp.jsxParseElement = function () {
  var startPos = this.state.start,
      startLoc = this.state.startLoc;
  this.next();
  return this.jsxParseElementAt(startPos, startLoc);
};

exports["default"] = function (instance) {
  instance.extend("parseExprAtom", function (inner) {
    return function (refShortHandDefaultPos) {
      if (this.match(_tokenizerTypes.types.jsxText)) {
        var node = this.parseLiteral(this.state.value, "JSXText");
        // https://github.com/babel/babel/issues/2078
        node.extra = null;
        return node;
      } else if (this.match(_tokenizerTypes.types.jsxTagStart)) {
        return this.jsxParseElement();
      } else {
        return inner.call(this, refShortHandDefaultPos);
      }
    };
  });

  instance.extend("readToken", function (inner) {
    return function (code) {
      var context = this.curContext();

      if (context === _tokenizerContext.types.j_expr) {
        return this.jsxReadToken();
      }

      if (context === _tokenizerContext.types.j_oTag || context === _tokenizerContext.types.j_cTag) {
        if (_utilIdentifier.isIdentifierStart(code)) {
          return this.jsxReadWord();
        }

        if (code === 62) {
          ++this.state.pos;
          return this.finishToken(_tokenizerTypes.types.jsxTagEnd);
        }

        if ((code === 34 || code === 39) && context === _tokenizerContext.types.j_oTag) {
          return this.jsxReadString(code);
        }
      }

      if (code === 60 && this.state.exprAllowed) {
        ++this.state.pos;
        return this.finishToken(_tokenizerTypes.types.jsxTagStart);
      }

      return inner.call(this, code);
    };
  });

  instance.extend("updateContext", function (inner) {
    return function (prevType) {
      if (this.match(_tokenizerTypes.types.braceL)) {
        var curContext = this.curContext();
        if (curContext === _tokenizerContext.types.j_oTag) {
          this.state.context.push(_tokenizerContext.types.b_expr);
        } else if (curContext === _tokenizerContext.types.j_expr) {
          this.state.context.push(_tokenizerContext.types.b_tmpl);
        } else {
          inner.call(this, prevType);
        }
        this.state.exprAllowed = true;
      } else if (this.match(_tokenizerTypes.types.slash) && prevType === _tokenizerTypes.types.jsxTagStart) {
        this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
        this.state.context.push(_tokenizerContext.types.j_cTag); // reconsider as closing tag context
        this.state.exprAllowed = false;
      } else {
        return inner.call(this, prevType);
      }
    };
  });
};

module.exports = exports["default"];


text:
{% extends "templates/partials/base.html" %}

{% block title %}{% parent %} - {{ cms.about.name }}{% endblock %}

{% block content %}

Our Story

        {{ cms.about.story|safe|striptags }}

Our People

      {% set management = cms.leadershipcategories[0] %}
      {% for person in management.leadership_category|sort('order') %}

{{ person.name }}

{{ person.title }}

{{ person.credentials }}

      {% endfor %}

Scientific Advisory Board

      {% set management = cms.leadershipcategories[1] %}
      {% for person in management.leadership_category %}

{{ person.name }}

{{ person.title }}

{{ person.credentials }}

      {% endfor %}

Join our Team

        We welcome you to learn more about joining us! We offer a fast-paced and dynamic team-based work environment.

      Learn More →

Media

      {% for item in cms.pressreleases|slice(0,3) %}

{{ item.publish_date|date('M j Y') }}

{{ item.name }}

{{ item.description }}

          Read More →

      {% endfor %}

      View all news →

Events

      {% for item in cms.events|sort("start_date")|slice(0,3) %}

{{ item.start_date|date('M j') }}{% if item.end_date %} – {{ item.end_date|date('j') }}{% endif %}, {{ item.end_date|date('Y') }}

{{ item.name }}

{{ item.location }}

      {% endfor %}

      View all events →

  {% include 'templates/partials/partners.html' %}

  {% include 'templates/partials/cta.html' %}

{% endblock %}


text:
<?php

namespace People\Entity;

use Doctrine\ORM\Mapping AS ORM;
use Application\Entity\User;

/**
 * @ORM\Entity @ORM\Table(name="organization_members")
 *
 */
class OrganizationMembership
{
	const ROLE_ADMIN = "admin";
	const ROLE_MEMBER = "member";

	/**
	 * @ORM\Column(type="string")
	 * @var string
	 */
	private $role;

	/**
	 * @ORM\Id
	 * @ORM\ManyToOne(targetEntity="Application\Entity\User", inversedBy="memberships")
	 * @ORM\JoinColumn(name="member_id", referencedColumnName="id", onDelete="CASCADE")
	 * @var User
	 */
	protected $member;

	/**
	 * @ORM\Id
	 * @ORM\ManyToOne(targetEntity="Organization", fetch="EAGER")
	 * @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="CASCADE")
	 * @var Organization
	 */
	protected $organization;

	/**
	 * @ORM\Column(type="datetime")
	 * @var \DateTime
	 */
	protected $createdAt;

	/**
	 * @ORM\ManyToOne(targetEntity="Application\Entity\User")
	 * @ORM\JoinColumn(name="createdBy_id", referencedColumnName="id")
	 * @var User
	 */
	protected $createdBy;

	/**
	 * @ORM\Column(type="datetime")
	 * @var \DateTime
	 */
	protected $mostRecentEditAt;

	/**
	 * @ORM\ManyToOne(targetEntity="Application\Entity\User")
	 * @ORM\JoinColumn(name="mostRecentEditBy_id", referencedColumnName="id")
	 * @var User
	 */
	protected $mostRecentEditBy;

	public function __construct(User $user, Organization $organization, $role = self::ROLE_MEMBER)
	{
		$this->member = $user;
		$this->organization = $organization;
		$this->role = $role;
		$this->createdAt = $this->mostRecentEditAt = new \DateTime();
	}

	public function setRole($role)
	{
		$this->role = $role;
		return $this;
	}

	public function getRole()
	{
		return $this->role;
	}

	public function getMember()
	{
		return $this->member;
	}

	public function getOrganization()
	{
		return $this->organization;
	}

	public function getCreatedAt() {
		return $this->createdAt;
	}

	public function setCreatedAt(\DateTime $when) {
		$this->createdAt = $when;
		return $this;
	}

	public function getCreatedBy() {
		return $this->createdBy;
	}

	public function setCreatedBy(User $user) {
		$this->createdBy = $user;
		return $this;
	}

	public function getMostRecentEditAt() {
		return $this->mostRecentEditAt;
	}

	public function setMostRecentEditAt(\DateTime $when) {
		$this->mostRecentEditAt = $when;
		return $this;
	}

	public function getMostRecentEditBy() {
		return $this->mostRecentEditBy;
	}

	public function setMostRecentEditBy(User $user) {
		$this->mostRecentEditBy = $user;
		return $this;
	}
}


text:
package com.alibaba.weex.constants;

public class Constants {

//  public static final String BUNDLE_URL = "http://t.cn?_wx_tpl=http://h5.waptest.taobao.com/app/weextc031/build/TC__Home.js";
 public static final String BUNDLE_URL = "http://h5.m.taobao.com?_wx_tpl=http://g.tbcdn.cn/weex/weex-tc/0.1.2/build/TC__Home.js";
  public static final String WEEX_SAMPLES_KEY = "?weex-samples";
  public static final String WEEX_TPL_KEY = "_wx_tpl";

  //hot refresh
  public static final int HOT_REFRESH_CONNECT = 0x111;
  public static final int HOT_REFRESH_DISCONNECT = HOT_REFRESH_CONNECT + 1;
  public static final int HOT_REFRESH_REFRESH = HOT_REFRESH_DISCONNECT + 1;
  public static final int HOT_REFRESH_CONNECT_ERROR = HOT_REFRESH_REFRESH + 1;
}


text:
goog.module('measurementLibrary.testing.eventProcessor.GoogleAnalyticsEventProcessor.processEvent');
goog.setTestOnly();

const GoogleAnalyticsEventProcessor = goog.require('measurementLibrary.eventProcessor.GoogleAnalyticsEventProcessor');
const logging = goog.require('measurementLibrary.logging');
const {MockStorage, MockModelInterface} = goog.require('measurementLibrary.testing.mocks');

describe('The `processEvent` method ' +
    'of GoogleAnalyticsEventProcessor', () => {
  const currentDebug = logging.DEBUG;
  let eventProcessor;
  const emptyStorage = new MockStorage();
  const emptyModel = new MockModelInterface({});

  describe('when debug mode is enabled', () => {
    beforeEach(() => {
      logging.DEBUG = true;
      eventProcessor = new GoogleAnalyticsEventProcessor();
      eventProcessor.buildRequestUrl_ = () => 'mock_request_url';
      eventProcessor.getClientId_ = () => 'mock_client_id';

      jasmine.Ajax.install();
    });

    it('logs request response to console', () => {
      spyOn(logging, 'log');
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      jasmine.Ajax.requests.mostRecent().respondWith({
        responseText: 'test response',
      });

      expect(logging.log).toHaveBeenCalledTimes(1);
      expect(logging.log)
          .toHaveBeenCalledWith('test response', logging.LogLevel.INFO);
    });

    afterEach(() => {
      logging.DEBUG = currentDebug;
      jasmine.Ajax.uninstall();
    });
  });

  describe('the XMLHttpRequest request', () => {
    beforeEach(() => {
      eventProcessor = new GoogleAnalyticsEventProcessor({
        automatic_params: ['added_param', 'non_personalized_ads'],
      });
      eventProcessor.buildRequestUrl_ = () => 'mock_request_url';
      eventProcessor.getClientId_ = () => 'mock_client_id';

      jasmine.Ajax.install();
      jasmine.Ajax.addCustomParamParser({
        test: () => true,
        parse: (data) => {
          return JSON.parse(data);
        },
      });
    });

    it('sends via POST', () => {
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST');
    });

    it('has the request url built by the event processor', () => {
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().url).toBe('mock_request_url');
    });

    it('includes the client ID retrieved by event processor', () => {
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().data().clientId)
          .toBe('mock_client_id');
    });

    it('creates a single event within the events array', () => {
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().data().events.length)
          .toBe(1);
    });

    it('adds the event name to the single event', () => {
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().data().events[0].name)
          .toBe('test');
    });

    it('has no event parameters when both model and eventOptions ' +
        'are empty', () => {
      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().data().events[0].params)
          .toEqual({});
    });

    it('has all event parameters passed in via eventOptions ' +
        'that are defined', () => {
      const expectedEventOptions = {
        param_one: 1,
        param_two: '2',
        param_three: null,
        param_four: {
          param_five: true,
        },
        param_six: ['test'],
        param_seven: false,
      };

      const arrayOfUndefined = new Array(1);
      const eventOptions = {
        param_one: 1,
        param_two: '2',
        param_three: null,
        param_four: {
          param_five: true,
        },
        param_six: ['test'],
        param_seven: false,
        param_eight: undefined,
        param_nine: arrayOfUndefined[0],
      };

      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        eventOptions);

      expect(jasmine.Ajax.requests.mostRecent().data().events[0].params)
          .toEqual(expectedEventOptions);
    });

    it('has event level global values when key is defined in model and ' +
        'is included in default automatic parameter list', () => {
      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          page_path: 'model_page_path',
        }),
        'test',
        {});

      expect(
        jasmine.Ajax.requests.mostRecent().data().events[0].params.page_path
      ).toBe('model_page_path');
    });

    it('has event level global values when key is defined in model and ' +
        'is added to automatic parameter list', () => {
      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          added_param: 'model_added_param',
          not_added_param: 'model_not_added_param',
        }),
        'test',
        {});

      expect(
        jasmine.Ajax.requests.mostRecent().data().events[0].params.added_param
      ).toBe('model_added_param');

      expect(jasmine.Ajax.requests.mostRecent().data().events[0]
          .params.not_added_param).toBe(undefined);
    });

    it('has top level global values when key is defined in model and ' +
        'is included in default automatic parameter list', () => {
      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          user_id: 'model_user_id',
        }),
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().data().userId)
          .toBe('model_user_id');
    });

    it('has top level global values when key is defined in model and ' +
        'is added to automatic parameter list', () => {
      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          non_personalized_ads: 'model_non_personalized_ads',
        }),
        'test',
        {});

      expect(jasmine.Ajax.requests.mostRecent().data().nonPersonalizedAds)
          .toBe('model_non_personalized_ads');
    });

    it('overrides event level global values when key is defined ' +
        'in eventOptions', () => {
      const eventOptions = {
        page_path: 'overriden_page_path',
      };

      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          page_path: 'model_page_path',
        }),
        'test',
        eventOptions);

      expect(
        jasmine.Ajax.requests.mostRecent().data().events[0].params.page_path
      ).toBe('overriden_page_path');
    });

    it('does not override event level global value if key is undefined ' +
        'in eventOptions', () => {
      const eventOptions = {
        page_path: undefined,
      };

      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          page_path: 'model_page_path',
        }),
        'test',
        eventOptions);

      expect(
        jasmine.Ajax.requests.mostRecent().data().events[0].params.page_path
      ).toBe('model_page_path');
    });

    it('overrides top level global values when key is defined ' +
        'in eventOptions', () => {
      const eventOptions = {
        user_id: 'overriden_user_id',
      };

      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          user_id: 'model_user_id',
        }),
        'test',
        eventOptions);

      expect(jasmine.Ajax.requests.mostRecent().data().userId)
          .toBe('overriden_user_id');
    });

    it('does not override top level global value if key is undefined ' +
        'in eventOptions', () => {
      const eventOptions = {
        user_id: undefined,
      };

      eventProcessor.processEvent(
        emptyStorage,
        new MockModelInterface({
          user_id: 'model_user_id',
        }),
        'test',
        eventOptions);

      expect(jasmine.Ajax.requests.mostRecent().data().userId)
          .toBe('model_user_id');
    });

    it('overrides client ID when defined in eventOptions', () => {
      const eventOptions = {
        client_id: 'overriden_client_id',
      };

      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        eventOptions);

      expect(jasmine.Ajax.requests.mostRecent().data().clientId)
          .toBe('overriden_client_id');
    });

    it('does not override client ID when undefined in eventOptions', () => {
      const eventOptions = {
        client_id: undefined,
      };

      eventProcessor.processEvent(
        emptyStorage,
        emptyModel,
        'test',
        eventOptions);

      expect(jasmine.Ajax.requests.mostRecent().data().clientId)
          .toBe('mock_client_id');
    });

    afterEach(() => {
      jasmine.Ajax.uninstall();
    });
  });
});


text:
using System;
using Anotar.Custom;

public class ClassWithMultipleLoggingCalls
{
    public void LogNoArgs()
    {
        LogTo.Debug("Debug");
        LogTo.Information("Info");
        LogTo.Warning("Warn");
    }

    public void LogWithArgs()
    {
        var args = new object[] { 1 };

        LogTo.Debug("Debug", args);
        LogTo.Information("Info", args);
        LogTo.Warning("Warn", args);
    }

    public void LogErrors()
    {
        LogTo.Debug(new Exception(), "Debug");
        LogTo.Information(new Exception(), "Info");
        LogTo.Warning(new Exception(), "Warn");
    }

    public void LogThrowLog(bool doThrow)
    {
        LogTo.Information("Doing something");

        if (doThrow)
            throw new Exception();

        LogTo.Information("Doing something");
    }
}


text:
package co.cask.cdap.internal.app.services.http.handlers;

import co.cask.cdap.internal.app.services.http.AppFabricTestBase;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.gson.reflect.TypeToken;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.apache.tephra.Transaction;
import org.apache.tephra.TransactionSystemClient;
import org.junit.Assert;
import org.junit.Test;

import java.lang.reflect.Type;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * Tests for Transaction handlers.
 */
public class TransactionHttpHandlerTest extends AppFabricTestBase {

  private static final Type STRING_INT_TYPE = new TypeToken<Map<String, Integer>>() { }.getType();

  /**
   * Tests invalidating a transaction.
   * @throws Exception
   */
  @Test
  public void testInvalidateTx() throws Exception {
    TransactionSystemClient txClient = getTxClient();

    Transaction tx1 = txClient.startShort();
    HttpResponse response = doPost("/v3/transactions/" + tx1.getWritePointer() + "/invalidate");
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Transaction tx2 = txClient.startShort();
    txClient.commit(tx2);
    response = doPost("/v3/transactions/" + tx2.getWritePointer() + "/invalidate");
    Assert.assertEquals(409, response.getStatusLine().getStatusCode());

    Assert.assertEquals(400,
                        doPost("/v3/transactions/foobar/invalidate").getStatusLine().getStatusCode());
  }

  @Test
  public void testResetTxManagerState() throws Exception {
    HttpResponse response = doPost("/v3/transactions/state");
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());
  }

  @Test
  public void testTruncateInvalidTx() throws Exception {
    TransactionSystemClient txClient = getTxClient();
    // Reset state, and assert no invalid transactions are present
    txClient.resetState();
    Assert.assertEquals(0, txClient.getInvalidSize());

    // Start few transactions and invalidate them
    Transaction tx1 = txClient.startShort();
    Transaction tx2 = txClient.startLong();
    Transaction tx3 = txClient.startLong();

    Assert.assertTrue(txClient.invalidate(tx1.getWritePointer()));
    Assert.assertTrue(txClient.invalidate(tx2.getWritePointer()));
    Assert.assertTrue(txClient.invalidate(tx3.getWritePointer()));

    Assert.assertEquals(3, txClient.getInvalidSize());

    // Remove tx1 and tx3 from invalid list
    HttpResponse response =
      doPost("/v3/transactions/invalid/remove/ids",
             GSON.toJson(ImmutableMap.of("ids", ImmutableSet.of(tx1.getWritePointer(), tx3.getWritePointer()))));
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Assert.assertEquals(1, txClient.getInvalidSize());
  }

  @Test
  public void testTruncateInvalidTxBefore() throws Exception {
    TransactionSystemClient txClient = getTxClient();
    // Reset state, and assert no invalid transactions are present
    txClient.resetState();
    Assert.assertEquals(0, txClient.getInvalidSize());

    // Start few transactions and invalidate them
    Transaction tx1 = txClient.startShort();
    Transaction tx2 = txClient.startLong();
    // Sleep so that transaction ids get generated a millisecond apart for assertion
    // TEPHRA-63 should eliminate the need to sleep
    TimeUnit.MILLISECONDS.sleep(1);
    long beforeTx3 = System.currentTimeMillis();
    Transaction tx3 = txClient.startLong();

    Assert.assertTrue(txClient.invalidate(tx1.getWritePointer()));
    Assert.assertTrue(txClient.invalidate(tx2.getWritePointer()));
    Assert.assertTrue(txClient.invalidate(tx3.getWritePointer()));

    Assert.assertEquals(3, txClient.getInvalidSize());

    // Remove all transactions in invalid list beforeTx3
    HttpResponse response =
      doPost("/v3/transactions/invalid/remove/until",
             GSON.toJson(ImmutableMap.of("time", beforeTx3)));
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());

    Assert.assertEquals(1, txClient.getInvalidSize());
  }

  @Test
  public void testGetInvalidSize() throws Exception {
    TransactionSystemClient txClient = getTxClient();
    // Reset state, and assert no invalid transactions are present
    txClient.resetState();
    Assert.assertEquals(0, txClient.getInvalidSize());

    // Start few transactions and invalidate them
    Transaction tx1 = txClient.startShort();
    Transaction tx2 = txClient.startLong();
    Transaction tx3 = txClient.startLong();

    Assert.assertTrue(txClient.invalidate(tx1.getWritePointer()));
    Assert.assertTrue(txClient.invalidate(tx2.getWritePointer()));
    Assert.assertTrue(txClient.invalidate(tx3.getWritePointer()));

    Assert.assertEquals(3, txClient.getInvalidSize());

    // Assert through REST API
    HttpResponse response = doGet("/v3/transactions/invalid/size");
    Assert.assertEquals(200, response.getStatusLine().getStatusCode());
    Map<String, Integer> resultMap = GSON.fromJson(EntityUtils.toString(response.getEntity()), STRING_INT_TYPE);
    Assert.assertNotNull(resultMap);
    Assert.assertEquals(3, (int) resultMap.get("size"));
  }
}


text:
<!DOCTYPE html>
<order-test name="e04"></order-test>
<link rel="import" href="nr4-i4.html">
<order-test name="e08"></order-test>


text:
/*
SDLEngine
Matt Hoyle
*/
#pragma once

#include "kernel/base_types.h"
#include <string>

namespace Render
{
	enum class ShaderType : uint32_t
	{
		VertexShader,
		FragmentShader
	};

	// This represents a single compiled shader. It can be vertex, fragment, hull, whatever
	// Shaders must be linked in a ShaderProgram to be usable for rendering
	class ShaderBinary
	{
	public:
		ShaderBinary();
		~ShaderBinary();

		bool CompileFromBuffer(ShaderType type, const std::string& source, std::string& resultText);
		bool CompileFromFile(ShaderType type, const char* srcLocation, std::string& resultText);
		void Destroy();

		inline uint32_t GetHandle() const { return m_handle; }
		inline ShaderType GetType() const { return m_type; }

	private:
		bool CompileSource(ShaderType type, const std::string& src, std::string& resultText);
		uint32_t TranslateShaderType(ShaderType type) const;

		uint32_t m_handle;
		ShaderType m_type;
	};
}


text:
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Embedding, Flatten, Dense
from tensorflow.keras.layers import Concatenate, Dropout
from tensorflow.keras.regularizers import l2

class MLP(layers.Layer):
    def __init__(self, n_hidden=1, hidden_size=64, dropout=0.,
                 l2_reg=None):
        super().__init__()

        self.layers = [Dropout(dropout)]

        for _ in range(n_hidden):
            self.layers.append(Dense(hidden_size, activation="relu",
                                     kernel_regularizer=l2_reg))
            self.layers.append(Dropout(dropout))

        self.layers.append(Dense(1, activation="relu",
                                 kernel_regularizer=l2_reg))

    def call(self, x, training=False):
        for layer in self.layers:
            if isinstance(layer, Dropout):
                x = layer(x, training=training)
            else:
                x = layer(x)
        return x

class DeepTripletModel(Model):
    def __init__(self, n_users, n_items, user_dim=32, item_dim=64, margin=1.,
                 n_hidden=1, hidden_size=64, dropout=0, l2_reg=None):
        super().__init__()

        l2_reg = None if l2_reg == 0 else l2(l2_reg)

        self.user_layer = Embedding(n_users, user_dim,
                                    input_length=1,
                                    input_shape=(1,),
                                    name='user_embedding',
                                    embeddings_regularizer=l2_reg)
        self.item_layer = Embedding(n_items, item_dim,
                                    input_length=1,
                                    name="item_embedding",
                                    embeddings_regularizer=l2_reg)

        self.flatten = Flatten()
        self.concat = Concatenate()

        self.mlp = MLP(n_hidden, hidden_size, dropout, l2_reg)

        self.margin_loss = MarginLoss(margin)

    def call(self, inputs, training=False):
        user_input = inputs[0]
        pos_item_input = inputs[1]
        neg_item_input = inputs[2]

        user_embedding = self.user_layer(user_input)
        user_embedding = self.flatten(user_embedding)
        pos_item_embedding = self.item_layer(pos_item_input)
        pos_item_embedding = self.flatten(pos_item_embedding)
        neg_item_embedding = self.item_layer(neg_item_input)
        neg_item_embedding = self.flatten(neg_item_embedding)

        # Similarity computation between embeddings
        pos_embeddings_pair = self.concat([user_embedding,
                                           pos_item_embedding])
        neg_embeddings_pair = self.concat([user_embedding,
                                           neg_item_embedding])

        pos_similarity = self.mlp(pos_embeddings_pair)
        neg_similarity = self.mlp(neg_embeddings_pair)

        return self.margin_loss([pos_similarity, neg_similarity])

class DeepMatchModel(Model):
    def __init__(self, user_layer, item_layer, mlp):
        super().__init__(name="MatchModel")

        self.user_layer = user_layer
        self.item_layer = item_layer
        self.mlp = mlp

        self.flatten = Flatten()
        self.concat = Concatenate()

    def call(self, inputs):
        user_input = inputs[0]
        pos_item_input = inputs[1]

        user_embedding = self.flatten(self.user_layer(user_input))
        pos_item_embedding = self.flatten(self.item_layer(pos_item_input))

        pos_embeddings_pair = self.concat([user_embedding, pos_item_embedding])
        pos_similarity = self.mlp(pos_embeddings_pair)

        return pos_similarity

hyper_parameters = dict(
    user_dim=32,
    item_dim=64,
    n_hidden=1,
    hidden_size=128,
    dropout=0.1,
    l2_reg=0.,
)
deep_triplet_model = DeepTripletModel(n_users, n_items,
                                      **hyper_parameters)
deep_match_model = DeepMatchModel(deep_triplet_model.user_layer,
                                  deep_triplet_model.item_layer,
                                  deep_triplet_model.mlp)

deep_triplet_model.compile(loss=identity_loss, optimizer='adam')
fake_y = np.ones_like(pos_data_train['user_id'])

n_epochs = 20

for i in range(n_epochs):
    # Sample new negatives to build different triplets at each epoch
    triplet_inputs = sample_triplets(pos_data_train, max_item_id,
                                     random_seed=i)

    # Fit the model incrementally by doing a single pass over the
    # sampled triplets.
    deep_triplet_model.fit(triplet_inputs, fake_y, shuffle=True,
                           batch_size=64, epochs=1)

# Monitor the convergence of the model
test_auc = average_roc_auc(
    deep_match_model, pos_data_train, pos_data_test)
print("Epoch %d/%d: test ROC AUC: %0.4f"
      % (i + 1, n_epochs, test_auc))


text:
Installing for development
============================

You'll have an easier time if you are on a current Ubuntu. On Ubuntu, the
key dependencies can be installed with:

::

    sudo apt-get install postgresql binutils postgis gdal-bin libproj-dev
    libgeoip1 graphviz libgraphviz-dev

**You may need to install distribution specific packages** e.g on Ubuntu 14.04
with the default PosgreSQL 9.3:

::

    sudo apt-get install postgresql-9.3-postgis-2.1

In order to build some of the Python dependencies in the `virtualenv`, some
libraries will need to be in place. Again, if you are on a recent Ubuntu, you
can get them at once with:

::

    sudo apt-get build-dep python-shapely python-numpy cython python-psycopg2
    libxml2-dev libxslt1-dev libffi-dev

.. _virtualenv: https://virtualenv.pypa.io/en/latest/

.. note::

    You must ensure that ElasticSearch is running. In a typical Ubuntu install
    ( from the `.deb` supplied by ElasticSearch ), the search server is not
    started by default.

Getting started
----------------
**A: Running the system from source code**

1. Create a virtualenv

2. Activate the created vitualenv and run ``pip install -r requirements.``

3. Run ``fab setup``
    Running this command will do the following:

    * Create the database.

    * Run migrations.

    * Load demo data if the project **DEBUG** attribute in settings is set to true .

**B: Installing the system**

2. Activate the virtualenv and run ``python setup.py install`` while in the project folder.

.. toctree::
    :maxdepth: 2


text:
@if(isset($list) && $list)
    {{-- list display here --}}
    {!! $value !!}
@else
    {{-- edit form display here --}}
    {!! FormGroup::textarea($name, ['value' => $value, 'disabled' => !$editable]) !!}

    @section('scripts')
    <script type="text/javascript">
        // CK Editor overloads
        var CKEDITOR_BASEPATH = '/js/ckeditor/';
    </script>
    <script src="/js/ckeditor/ckeditor.js"></script>
    <script>
        $(document).ready(function(){
            CKEDITOR.replace({{ $name }});
        });
    </script>
    @append
@endif


text:
@interface LYRootViewController ()

@end

@implementation LYRootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (IBAction)showLuckyCardViewBtnClick:(id)sender {
    LYLuckyCardView *luckyCardView = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([LYLuckyCardView class]) owner:nil options:nil] firstObject];
    [self.view addSubview:luckyCardView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end


text:
<!DOCTYPE html>

    <link rel="stylesheet" type="text/css" href="styles/style.css"/>
    <meta charset="UTF-8">
    <title>Registration Form</title>

<form method="post" action="pesho.php">

            Last name

                <input type="text" id="last-name" required="required" />

            First name

                <input type="text" id="first-name" required="required" />

            Address

                <textarea rows="4" cols="25" id="address" r></textarea>

            City

                <input type="text" id="city"/>
                State
                <input type="text" id="state"/>

            Zip/Postal/Copy
            <input type="text" id="zip">

            Country

                <select name="country-name" id="country">
                    <option value="Bulgaria" selected="selected">Bulgaria</option>
                    <option value="USA">USA</option>
                    <option value="Canada">Canada</option>
                </select>

                Phone(country code, area code, number)

                (+<input type="text" id="country-code"/>)<input type="text" id="code"/><input type="text" id="phone"/>

                E-mail

                <input type="email" id="email" required="required" pattern="[^@]+@[^@]+\.[a-zA-Z]{2,6}"/>

                Birth date

                <input type="date" id="birth-date" placeholder="дд. мм. гггг г."/>

                Gender

                <select name="Gender" id="gender">
                    <option value="Male" selected="selected">Male</option>
                    <option value="Female">Female</option>
                </select>

            Starting date

                <input type="radio" name="date" value="Spring 2015"/>Spring 2015
                <input type="radio" name="date" value="Summer 2015"/>Summer 2015

            Comments/Questions

                <textarea rows="5" cols="25" id="comments"></textarea>

                <input type="submit" value="Submit"/>
                <input type="reset" value="Clea the form"/>

</form>


text:
namespace mfem
{

FiniteElementSpaceHierarchy::FiniteElementSpaceHierarchy(Mesh* mesh,
                                                         FiniteElementSpace* fespace,
                                                         bool ownM, bool ownFES)
{
   meshes.Append(mesh);
   fespaces.Append(fespace);
   ownedMeshes.Append(ownM);
   ownedFES.Append(ownFES);
}

FiniteElementSpaceHierarchy::~FiniteElementSpaceHierarchy()
{
   for (int i = 0; i < meshes.Size(); ++i)
   {
      if (ownedFES[i])
      {
         delete fespaces[i];
      }
      if (ownedMeshes[i])
      {
         delete meshes[i];
      }
   }

   for (int i = 0; i < prolongations.Size(); ++i)
   {
      if (ownedProlongations[i])
      {
         delete prolongations[i];
      }
   }

   fespaces.DeleteAll();
   meshes.DeleteAll();
   prolongations.DeleteAll();
}

int FiniteElementSpaceHierarchy::GetNumLevels() const { return meshes.Size(); }

int FiniteElementSpaceHierarchy::GetFinestLevelIndex() const { return GetNumLevels() - 1; }

void FiniteElementSpaceHierarchy::AddLevel(Mesh* mesh,
                                           FiniteElementSpace* fespace,
                                           Operator* prolongation,
                                           bool ownM, bool ownFES,
                                           bool ownP)
{
   meshes.Append(mesh);
   fespaces.Append(fespace);
   prolongations.Append(prolongation);
   ownedMeshes.Append(ownM);
   ownedFES.Append(ownFES);
   ownedProlongations.Append(ownP);
}

void FiniteElementSpaceHierarchy::AddUniformlyRefinedLevel(int dim,
                                                           int ordering)
{
   MFEM_VERIFY(GetNumLevels() > 0, "There is no level which can be refined");
   Mesh* mesh = new Mesh(*GetFinestFESpace().GetMesh());
   mesh->UniformRefinement();
   FiniteElementSpace& coarseFEspace = GetFinestFESpace();
   FiniteElementSpace* fineFEspace =
      new FiniteElementSpace(mesh, coarseFEspace.FEColl(), dim, ordering);
   Operator* P = new TransferOperator(coarseFEspace, *fineFEspace);
   AddLevel(mesh, fineFEspace, P, true, true, true);
}

void FiniteElementSpaceHierarchy::AddOrderRefinedLevel(FiniteElementCollection*
                                                       fec, int dim,
                                                       int ordering)
{
   MFEM_VERIFY(GetNumLevels() > 0, "There is no level which can be refined");
   Mesh* mesh = GetFinestFESpace().GetMesh();
   FiniteElementSpace* newFEspace =
      new FiniteElementSpace(mesh, fec, dim, ordering);
   Operator* P = new TransferOperator(GetFinestFESpace(), *newFEspace);
   AddLevel(mesh, newFEspace, P, false, true, true);
}

const FiniteElementSpace& FiniteElementSpaceHierarchy::GetFESpaceAtLevel(
   int level) const
{
   MFEM_ASSERT(level < fespaces.Size(),
               "FE space at given level does not exist.");
   return *fespaces[level];
}

FiniteElementSpace& FiniteElementSpaceHierarchy::GetFESpaceAtLevel(int level)
{
   MFEM_ASSERT(level < fespaces.Size(),
               "FE space at given level does not exist.");
   return *fespaces[level];
}

const FiniteElementSpace& FiniteElementSpaceHierarchy::GetFinestFESpace() const
{
   return GetFESpaceAtLevel(GetFinestLevelIndex());
}

FiniteElementSpace& FiniteElementSpaceHierarchy::GetFinestFESpace()
{
   return GetFESpaceAtLevel(GetFinestLevelIndex());
}

Operator* FiniteElementSpaceHierarchy::GetProlongationAtLevel(int level) const
{
   MFEM_ASSERT(level < prolongations.Size(),
               "Prolongation at given level does not exist.");
   return prolongations[level];
}

#ifdef MFEM_USE_MPI

ParFiniteElementSpaceHierarchy::ParFiniteElementSpaceHierarchy(ParMesh* mesh,
                                                               ParFiniteElementSpace* fespace,
                                                               bool ownM,
                                                               bool ownFES)
   : FiniteElementSpaceHierarchy(mesh, fespace, ownM, ownFES)
{
}

void ParFiniteElementSpaceHierarchy::AddUniformlyRefinedLevel(int dim,
                                                              int ordering)
{
   ParMesh* mesh = new ParMesh(*GetFinestFESpace().GetParMesh());
   mesh->UniformRefinement();
   ParFiniteElementSpace& coarseFEspace = GetFinestFESpace();
   ParFiniteElementSpace* fineFEspace =
      new ParFiniteElementSpace(mesh, coarseFEspace.FEColl(), dim, ordering);
   Operator* P = new TrueTransferOperator(coarseFEspace, *fineFEspace);
   AddLevel(mesh, fineFEspace, P, true, true, true);
}

void ParFiniteElementSpaceHierarchy::AddOrderRefinedLevel(
   FiniteElementCollection* fec,
   int dim, int ordering)
{
   ParMesh* mesh = GetFinestFESpace().GetParMesh();
   ParFiniteElementSpace* newFEspace =
      new ParFiniteElementSpace(mesh, fec, dim, ordering);
   Operator* P = new TrueTransferOperator(GetFinestFESpace(), *newFEspace);
   AddLevel(mesh, newFEspace, P, false, true, true);
}

const ParFiniteElementSpace&
ParFiniteElementSpaceHierarchy::GetFESpaceAtLevel(int level) const
{
   return static_cast<const ParFiniteElementSpace&>(
             FiniteElementSpaceHierarchy::GetFESpaceAtLevel(level));
}

ParFiniteElementSpace& ParFiniteElementSpaceHierarchy::GetFESpaceAtLevel(
   int level)
{
   return static_cast<ParFiniteElementSpace&>(
             FiniteElementSpaceHierarchy::GetFESpaceAtLevel(level));
}

const ParFiniteElementSpace& ParFiniteElementSpaceHierarchy::GetFinestFESpace()
const
{
   return GetFESpaceAtLevel(GetFinestLevelIndex());
}

ParFiniteElementSpace& ParFiniteElementSpaceHierarchy::GetFinestFESpace()
{
   return GetFESpaceAtLevel(GetFinestLevelIndex());
}
#endif

} // namespace mfem


text:
class VersionUI : public web::WebUIIOSController {
 public:
  explicit VersionUI(web::WebUIIOS* web_ui);
  ~VersionUI() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(VersionUI);
};

#endif  // IOS_CHROME_BROWSER_UI_WEBUI_VERSION_UI_H_


text:
package org.maera.plugin.loaders;

import org.dom4j.Element;
import org.maera.plugin.PluginParseException;
import org.maera.plugin.Resources;
import org.maera.plugin.elements.ResourceDescriptor;

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

public class LoaderUtils {
    /**
     * @deprecated use {@link org.maera.plugin.Resources#fromXml}
     */
    @Deprecated
    public static List<ResourceDescriptor> getResourceDescriptors(final Element element) throws PluginParseException {
        return Resources.fromXml(element).getResourceDescriptors();
    }

    public static Map<String, String> getParams(final Element element) {
        @SuppressWarnings("unchecked")
        final List<Element> elements = element.elements("param");

        final Map<String, String> params = new HashMap<String, String>(elements.size());

        for (final Element paramEl : elements) {
            final String name = paramEl.attributeValue("name");
            String value = paramEl.attributeValue("value");

            if ((value == null) && (paramEl.getTextTrim() != null) && !"".equals(paramEl.getTextTrim())) {
                value = paramEl.getTextTrim();
            }

            params.put(name, value);
        }

        return params;
    }
}


text:
const webpack = require("webpack");
const FileChanger = require("webpack-file-changer");
const Utility = require("./util/Utility");
const path = require("path");
const package = require("../package.json");

/**
 * import common webpack settings
 */
/**
 * import common webpack settings
 */
const settings = require("./webpack.config.common.js")("/site", "/docs", undefined , "/src");

/**
 * @link https://github.com/webpack/docs/wiki/optimization#deduplication
 * @type DedupePlugin
 */
settings.webpack.plugins.push(new webpack.optimize.UglifyJsPlugin());
/**
 * @link https://github.com/webpack/docs/wiki/optimization#minimize
 * @type OccurenceOrderPlugin
 */
settings.webpack.plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
/**
 * https://github.com/webpack/docs/wiki/optimization#chunks
 * @type LimitChunkCountPlugin
 */
settings.webpack.plugins.push(new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 15 }));
/**
 * @link https://github.com/webpack/docs/wiki/optimization#chunks
 * @type MinChunkSizePlugin
 */
settings.webpack.plugins.push(new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 10000 }));

/**
 *
 * @type {{root: *[]}}
 */
settings.webpack.entry = {
    site: "../site/index.js"
};

/**
 * @link https://webpack.github.io/docs/configuration.html#devtool
 * Choose a developer tool to enhance debugging.
 * source-map - A SourceMap is emitted. See also output.sourceMapFilename.
 * @type {string}
 */
settings.webpack.devtool = "source-map";

settings.webpack.output = {
    path: settings.paths.build,
    filename: "bundle.[hash].js"
    // chunkFilename: "[id].bundle.js"
};

settings.webpack.resolve.alias = {
    "robe-react-ui/lib": settings.paths.lib,
    "robe-react-ui": settings.paths.lib + "/index"
};

const fileChanger = new FileChanger({
    move: [{
        from: path.join(Utility.projectDir, "static"),
        to: path.join(Utility.projectDir, "./docs")
    }
    ],
    change: [{
        file: "./index.html",
        parameters: {
            "\\$VERSION": package.version,
            "\\$BUILD_TIME": new Date(),
            "bundle\\.js": "bundle.[hash].js"
        }
    }
    ]
});
settings.webpack.plugins.push(fileChanger);

/* Use production parameter for hiding warnings which are coming from React library. */
settings.webpack.plugins.push(new webpack.DefinePlugin({
    "process.env": {
        NODE_ENV: JSON.stringify("production")
    }
}));

module.exports = settings.webpack;


text:
Guild supports running an operation without specifying a model
provided the operation is run on a guildfile that contains at least
one more (i.e. we can reasonably infer a model).

If there is no default model, Guild prints an error message and exits.

    >>> run("guild run train")
    guild: cannot find operation train
    You may need to include a model in the form MODEL:OPERATION.
    Try 'guild operations' for a list of available operations.
    <exit 1>


text:
module.livebots.cc
==================

livebots module


text:
ActiveRecord::Schema.define(:version => 3) do

  create_table "photos", :force => true do |t|
    t.text     "flickr_response"
    t.string   "flickr_id"
    t.datetime "added_at"
    t.string   "owner"
    t.datetime "created_at",                         :null => false
    t.datetime "updated_at",                         :null => false
    t.boolean  "rejected",        :default => false
    t.text     "comment"
  end

  add_index "photos", ["added_at"], :name => "index_photos_on_added_at"
  add_index "photos", ["flickr_id"], :name => "index_photos_on_flickr_id"
  add_index "photos", ["owner", "added_at"], :name => "index_photos_on_owner_and_added_at"

end


text:
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using Microsoft.Azure.Documents.Linq;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace NoRepo
{
    public class DocumentDbRepo : IRepository
    {
        private DocumentCollection collection { get; set; }
        private Uri collectionUri { get; set; }
        private DocumentClient DocumentClient { get; set; }
        private string dbName { get; set; }
        private string collectionName { get; set; }

        public DocumentDbRepo(string dbName, string collectionName, DocumentClient client)
        {
            if (String.IsNullOrWhiteSpace(dbName))
                throw new ArgumentException("dbName");

            if (String.IsNullOrWhiteSpace(collectionName))
                throw new ArgumentException("collectionName");

            if (client == null)
                throw new ArgumentNullException("client", "A DocumentClient instance is required.");

            this.dbName = dbName;
            this.collectionName = collectionName;
            this.DocumentClient = client;
            collectionUri = UriFactory.CreateDocumentCollectionUri(dbName, collectionName);
            collection = DocumentClient.ReadDocumentCollectionAsync(collectionUri).Result;
        }

        public DocumentDbRepo(string endpoint, string key, string dbName, string collectionName)
        {
            if (String.IsNullOrWhiteSpace(endpoint))
                throw new ArgumentException("endpoint");

            if (String.IsNullOrWhiteSpace(key))
                throw new ArgumentException("key");

            if (!RepoContext.DocumentClients.ContainsKey(endpoint))
                RepoContext.DocumentClients.Add(endpoint, RepoContext.CreateClient(endpoint, key));

            this.dbName = dbName;
            this.collectionName = collectionName;
            this.DocumentClient = RepoContext.DocumentClients[endpoint];
            collectionUri = UriFactory.CreateDocumentCollectionUri(dbName, collectionName);
            collection = DocumentClient.ReadDocumentCollectionAsync(collectionUri).Result;
        }

        public bool IsPartitioned
        {
            get { return collection.PartitionKey.Paths.Count > 0; }
        }

        public async Task<string> Create<T>(T instance) where T : class
        {
            var resp = await DocumentClient.CreateDocumentAsync(collectionUri, instance);
            return resp.Resource.Id;
        }

        public async Task<T> Get<T>(string id) where T : class
        {
            var uri = UriFactory.CreateDocumentUri(dbName, collectionName, id);

            RequestOptions options = null;

            var resp = await DocumentClient.ReadDocumentAsync(uri, options);
            return JsonConvert.DeserializeObject<T>(resp.Resource.ToString());
        }

        public async Task<T> Get<T>(string id, string partitionKey) where T : class
        {
            var uri = UriFactory.CreateDocumentUri(dbName, collectionName, id);

            RequestOptions options = null;
            if (this.IsPartitioned)
                options = new RequestOptions() { PartitionKey = new PartitionKey(partitionKey) };

            var resp = await DocumentClient.ReadDocumentAsync(uri, options);
            return JsonConvert.DeserializeObject<T>(resp.Resource.ToString());
        }

        public async Task<IEnumerable<T>> Where<T>(Expression<Func<T, bool>> predicate) where T : class
        {
            var query = DocumentClient.CreateDocumentQuery<T>(collectionUri).Where(predicate).AsDocumentQuery();
            return await query.ExecuteNextAsync<T>();
        }

        public async Task<IEnumerable<T>> Take<T>(Expression<Func<T, bool>> predicate, int count) where T : class
        {
            var query = DocumentClient.CreateDocumentQuery<T>(collectionUri).Where(predicate).Take(count).AsDocumentQuery();
            return await query.ExecuteNextAsync<T>();
        }

        public async Task<T> FirstOrDefault<T>(Expression<Func<T, bool>> predicate) where T : class
        {
            var query = DocumentClient.CreateDocumentQuery<T>(collectionUri).Where(predicate).AsDocumentQuery();
            var result = await query.ExecuteNextAsync<T>();
            return result.FirstOrDefault<T>();
        }
        public async Task<T> First<T>(Expression<Func<T, bool>> predicate) where T : class
        {
            var query = DocumentClient.CreateDocumentQuery<T>(collectionUri).Where(predicate).AsDocumentQuery();
            var result = await query.ExecuteNextAsync<T>();
            return result.First<T>();
        }

        public async Task Remove(string id)
        {
            var uri = UriFactory.CreateDocumentUri(dbName, collectionName, id);
            await DocumentClient.DeleteDocumentAsync(uri);
        }

        public async Task Remove(string id, string partitionKey)
        {
            var uri = UriFactory.CreateDocumentUri(dbName, collectionName, id);

            RequestOptions options = null;
            if (this.IsPartitioned)
                options = new RequestOptions() { PartitionKey = new PartitionKey(partitionKey) };

            await DocumentClient.DeleteDocumentAsync(uri, options);
        }

        public async Task<string> Upsert<T>(string id, T instance) where T : class
        {
            var uri = UriFactory.CreateDocumentCollectionUri(dbName, collectionName);

            var resp = await DocumentClient.UpsertDocumentAsync(uri, instance);
            return resp.Resource.Id;
        }

        public async Task<string> Upsert<T>(string id, string partitionKey, T instance) where T : class
        {
            var uri = UriFactory.CreateDocumentCollectionUri(dbName, collectionName);

            RequestOptions options = null;

            if (this.IsPartitioned)
                options = new RequestOptions() { PartitionKey = new PartitionKey(id) };

            var resp = await DocumentClient.UpsertDocumentAsync(uri, instance, options);
            return resp.Resource.Id;
        }

        public async Task<IEnumerable<T>> Query<T>(string queryExpression, IDictionary<string, object> parameters = null) where T : class
        {
            var paramsCol = new SqlParameterCollection();

            if (parameters != null)
                foreach (var parameter in parameters)
                    paramsCol.Add(new SqlParameter(parameter.Key, parameter.Value));

            var querySpec = new SqlQuerySpec(queryExpression, paramsCol);

            var query = DocumentClient.CreateDocumentQuery<T>(collectionUri, querySpec, null).AsDocumentQuery<T>();

            var batches = new List<IEnumerable<T>>();

            do
            {
                batches.Add(await query.ExecuteNextAsync<T>());
            }
            while (query.HasMoreResults);

            return batches.SelectMany(b => b);
        }

        public async Task<IEnumerable<dynamic>> Query(string queryExpression, IDictionary<string, object> parameters = null)
        {
            var paramsCol = new SqlParameterCollection();

            if (parameters != null)
                foreach (var parameter in parameters)
                    paramsCol.Add(new SqlParameter(parameter.Key, parameter.Value));

            var querySpec = new SqlQuerySpec(queryExpression, paramsCol);

            var query = DocumentClient.CreateDocumentQuery(collectionUri, querySpec, null).AsDocumentQuery();

            var batches = new List<IEnumerable<dynamic>>();

            do
            {
                batches.Add(await query.ExecuteNextAsync());
            }
            while (query.HasMoreResults);

            return batches.SelectMany(b => b);
        }

    }

    public sealed class DocumentDbRepo<T> : IRepository<T> where T : class
    {
        private IRepository Repo { get; set; }

        public DocumentDbRepo(IRepository repo)
        {
            Repo = repo;
        }

        public DocumentDbRepo(string dbName, string collectionName, DocumentClient client)
        {
            Repo = new DocumentDbRepo(dbName, collectionName, client);
        }
        public DocumentDbRepo(string endpoint, string key, string dbName, string collectionName)
        {
            Repo = new DocumentDbRepo(endpoint, key, dbName, collectionName);
        }

        public bool IsPartitioned
        {
            get { return Repo.IsPartitioned; }
        }

        public async Task<string> Create(T instance)
        {
            return await Repo.Create<T>(instance);
        }

        public async Task<T> Get(string id)
        {
            return await Repo.Get<T>(id);
        }

        public async Task<T> Get(string id, string partitionKey)
        {
            return await Repo.Get<T>(id, partitionKey);
        }

        public async Task<IEnumerable<T>> Where(Expression<Func<T, bool>> predicate)
        {
            return await Repo.Where<T>(predicate);
        }

        public async Task<IEnumerable<T>> Take(Expression<Func<T, bool>> predicate, int count)
        {
            return await Repo.Take<T>(predicate, count);
        }

        public async Task<T> FirstOrDefault(Expression<Func<T, bool>> predicate)
        {
            return await Repo.FirstOrDefault<T>(predicate);
        }

        public async Task<T> First(Expression<Func<T, bool>> predicate)
        {
            return await Repo.First<T>(predicate);
        }

        public async Task Remove(string id)
        {
            await Repo.Remove(id);
        }
        public async Task Remove(string id, string partitionKey)
        {
            await Repo.Remove(id, partitionKey);
        }
        public async Task<string> Upsert(string id, T instance)
        {
            return await Repo.Upsert<T>(id, instance);
        }

        public async Task<string> Upsert(string id, string partitionKey, T instance)
        {
            return await Repo.Upsert<T>(id, partitionKey, instance);
        }

        public async Task<IEnumerable<T>> Query(string queryExpression, IDictionary<string, object> parameters = null)
        {
            return await Repo.Query<T>(queryExpression, parameters);
        }

    }

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>uno.informatics.common</groupId>
    <artifactId>informatics-data</artifactId>
    <version>1.3.0</version>
  </parent>
  <artifactId>informatics-data-api</artifactId>
  <packaging>jar</packaging>

  <name>Informatics Data API</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
  </dependencies>
</project>


text:
\page comms_http_client Example: comms_http_client

Example output:

~~~~~~~~~~~~~
Retrieving http://www.google.es/...
Ok: 14160 bytes of type: text/html; charset=ISO-8859-1
~~~~~~~~~~~~~

C++ example source code:
\include comms_http_client/test.cpp


text:
"use strict";

var murmurhash = require('./index');

module.exports = function(promise) {
  if (!promise) {
    promise = global.Promise;
  }

  if ('function' !== typeof promise) {
    throw new Error("Promise constructor required");
  }

  var promisify = function(object) {
    var value, hash = {};

    for(var name in object) {
      if (object.hasOwnProperty(name)) {
        if (!!(value = object[name])) {
          switch(typeof value) {
            case 'function':
              hash[name + 'Async'] = wrap(promise, value);
              break;
            case 'object':
              hash[name] = promisify(value);
              break;
          }
        }
      }
    }
    return hash;
  };

  return promisify(murmurhash);
};

function wrap(promise, fn) {
  return new Function('Promise', 'slice', 'fn',
    'return function ' + fn.name + 'Async() {               \
      var cb, args = slice.call(arguments);                 \
      var promise = new Promise(function(resolve, reject) { \
        cb = function(err, res) {                           \
          if (err) reject(err); else {                      \
            resolve(res);                                   \
          }                                                 \
        };                                                  \
      });                                                   \
      args.push(cb);                                        \
      fn.apply(this, args);                                 \
      return promise;                                       \
    }')(promise, Array.prototype.slice, fn);
}


text:
package co.ecso.dacato.database.cache;

import co.ecso.dacato.database.query.Updater;
import co.ecso.dacato.database.querywrapper.SingleColumnUpdateQuery;

import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * CachedUpdater.
 *
 * @param <T> Type of update -> type of query.
 * @author Christian Scharmach (cs@e-cs.co)
 * @version $Id:$
 * @since 19.09.16
 */
public interface CachedUpdater<T> extends Updater<T>, CacheGetter {

    @Override
    default CompletableFuture<Integer> update(final SingleColumnUpdateQuery<T> query,
                                              final Callable<AtomicBoolean> validityCheck) {
        cache().keySet().stream()
                .filter(k -> k.hasKey(query.tableName()))
                .forEach(k -> cache().invalidate(k));
        return Updater.super.update(query, validityCheck);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;

namespace Frankfort.Threading.Internal
{
    public class ThreadWorkStatePackage
    {
        public bool safeMode = true;
        //public bool safeModeErrorFound;
        //public List<string> safeModeErrorLog = new List<string>();

        public bool started;
        public bool running;
        public bool finishedWorking;
        public bool eventFired;

        public IThreadWorkerObject workerObject;
        public AutoResetEvent waitHandle;

        public void ExecuteThreadWork(object obj)
        {
            running = true;

            if (workerObject == null || waitHandle == null)
                return;

            //Thread.CurrentThread.Priority = System.Threading.ThreadPriority.AboveNormal;

            if (safeMode)
            {
                try
                {
                    workerObject.ExecuteThreadedWork();
                }
                catch (Exception e)
                {
                    //safeModeErrorFound = true;
                    //safeModeErrorLog.Add(e.Message + e.StackTrace);
                    Loom.DispatchToMainThread(() => Debug.LogError(e.Message + e.StackTrace + "\n\n"), true);
                }
            }
            else
            {
                workerObject.ExecuteThreadedWork();
            }

            running = false;
            finishedWorking = true;
            waitHandle.Set(); //Fire back to the MainThread!
        }
    }

    /// <summary>
    /// Used as packaged set of variables to be fed to the WorkProvider-Thread.
    /// </summary>
    public class ASyncThreadWorkData
    {
        public ThreadWorkStatePackage[] workerPackages;
        public int maxWorkingThreads;

        public ASyncThreadWorkData(IThreadWorkerObject[] workerObjects, bool safeMode, int maxWorkingThreads = -1)
        {
            if (workerObjects == null)
                return;

            workerPackages = new ThreadWorkStatePackage[workerObjects.Length];

            int i = workerObjects.Length;
            while (--i > -1)
            {
                ThreadWorkStatePackage package = new ThreadWorkStatePackage();
                package.waitHandle = new AutoResetEvent(false);
                package.workerObject = workerObjects[i];
                package.safeMode = safeMode;
                workerPackages[i] = package;
            }

            if (maxWorkingThreads <= 0)
            {
                maxWorkingThreads = Mathf.Max(SystemInfo.processorCount - 1, 1);
            }
            else
            {
                this.maxWorkingThreads = maxWorkingThreads;
            }
        }

        public void Dispose()
        {
            if (workerPackages != null)
            {
                foreach (ThreadWorkStatePackage package in workerPackages)
                {
                    if (package.waitHandle != null)
                        package.waitHandle.Close();

                    package.waitHandle = null;
                    package.workerObject = null;
                }
            }
            workerPackages = null;
        }
    }
}


text:
/*eslint-env node, mocha*/
/*global inject*/

'use strict';

describe('Service: GPSService', function () {
	var GPSService;

	beforeEach(module('phoenixeye'));

	beforeEach(module(function ($urlRouterProvider) {
		$urlRouterProvider.deferIntercept();
	}));

	beforeEach(inject(function ($injector) {
		GPSService = $injector.get('GPSService');
	}));

	describe('prototype.getCoords', function () {
		it('should return false if unsuitable params', function () {
			var result = GPSService.getCoords({});

			result.should.be.false;
		});

		it('should convert GPS strings to lat/lng and return {lat, lng}', function () {
			var gpsInfo = {
				GPSVersionID: '0.0.2.2',
				GPSLatitudeRef: 'South',
				GPSLatitude: '33deg 51\' 21.910" ',
				GPSLongitudeRef: 'East',
				GPSLongitude: '151deg 13\' 11.730" ',
				GPSAltitudeRef: 'Above sea level',
				GPSAltitude: '0 m'
			};

			var result = GPSService.getCoords(gpsInfo);

			result.should.have.property('lat');
			result.should.have.property('lng');

			result.lat.should.be.equal(-33.85608611111111);
			result.lng.should.be.equal(151.219925);
		});
	});
});