text:
package club.craftcoder.vicuna

import com.ecfront.ez.framework.service.jdbc._

import scala.beans.BeanProperty

@Entity("状态日志")
class Vic_status_log extends SecureModel with StatusModel {
  @UUID
  @BeanProperty var vic_status_uuid: String = _
  @Desc("流程编码", 200, 0)
  @Index
  @BeanProperty var flow_code: String = _
  @Desc("主体编码", 200, 0)
  @Index
  @BeanProperty var obj_code: String = _
  @Desc("状态", 200, 0)
  @Index
  @BeanProperty var status: String = _
  @Desc("添加时间", 0, 0)
  @Index
  @BeanProperty var add_time: Long = _
  @Desc("首付金额", 14, 2)
  @BeanProperty var down_payment: BigDecimal = _
  @Desc("尾款金额", 14, 2)
  @BeanProperty var final_payment: BigDecimal = _

}

object Vic_status_log extends SecureStorage[Vic_status_log] with StatusStorage[Vic_status_log]


text:
#include "editor/private/squareLine.h"

using namespace qReal;
using namespace qReal::gui::editor;

const qreal epsilon = 0.0001;
const qreal offset = 2 * kvadratik;

SquareLine::SquareLine(EdgeElement *edge)
		: LineHandler(edge)
		, mLayOutAction(tr("Lay out"), this)
{
	connectAction(&mLayOutAction, this, SLOT(minimize()));
}

void SquareLine::handleEdgeMove(const QPointF &pos)
{
	QPolygonF line = mEdge->line();

	if (mDragType == EdgeElement::noPort) {
		moveSegment(mDragStartPoint, pos);
		return;
	} else if ((mDragType == 0) || (mDragType == mSavedLine.size() - 1)) {
		line[mDragType] = pos;
		mEdge->setLine(line);
		adjustEndSegments();
	}
}

void SquareLine::adjust()
{
	LineHandler::adjust();
	if (!mEdge->isLoop()) {
		adjustEndSegments();
	}
}

void SquareLine::adjustEndSegments()
{
	if (mEdge->line().count() == 2) {
		squarize();
	} else {
		adjustStart();
		adjustEnd();
	}
}

void SquareLine::adjustStart()
{
	QPolygonF line = mEdge->line();

	if ((qAbs(line[0].x() - line[1].x()) < epsilon) || (qAbs(line[0].y() - line[1].y()) < epsilon)) {
		return;
	}

	if ((line[1] == line[2]) && (line.count() > 3)) {
		if (qAbs(line[2].x() - line[3].x()) < qAbs(line[2].y() - line[3].y())) {
			line[1].setX(line[0].x());
		} else {
			line[1].setY(line[0].y());
		}
	} else {
		if (qAbs(line[1].y() - line[2].y()) < qAbs(line[1].x() - line[2].x())) {
			line[1].setX(line[0].x());
		} else {
			line[1].setY(line[0].y());
		}
	}

	mEdge->setLine(line);
}

void SquareLine::adjustEnd()
{
	QPolygonF line = mEdge->line();

	if ((qAbs(line[line.count() - 1].x() - line[line.count() - 2].x()) < epsilon)
			|| qAbs(line[line.count() - 1].y() - line[line.count() - 2].y()) < epsilon)
	{
		return;
	}

	if ((line[line.count() - 2] == line[line.count() - 3]) && (line.count() > 3)) {
		if (qAbs(line[line.count() - 3].x() - line[line.count() - 4].x())
				< qAbs(line[line.count() - 3].y() - line[line.count() - 4].y()))
		{
			line[line.count() - 2].setX(line[line.count() - 1].x());
		} else {
			line[line.count() - 2].setY(line[line.count() - 1].y());
		}
	} else {
		if (qAbs(line[line.count() - 2].y() - line[line.count() - 3].y())
				< qAbs(line[line.count() - 2].x() - line[line.count() - 3].x()))
		{
			line[line.count() - 2].setX(line[line.count() - 1].x());
		} else {
			line[line.count() - 2].setY(line[line.count() - 1].y());
		}
	}

	mEdge->setLine(line);
}

void SquareLine::moveSegment(const QPointF &oldPos, const QPointF &newPos)
{
	const int segmentNumber = defineSegment(oldPos);
	if ((segmentNumber <= 0) || (segmentNumber >= mEdge->line().count() - 2)) {
		return;
	}

	QPolygonF line = mSavedLine;
	QLineF segment(line[segmentNumber], line[segmentNumber + 1]);
	QPointF offset(newPos - line[segmentNumber]);

	if (qAbs(segment.x1() - segment.x2()) < epsilon) {
		offset.setY(0);
	}

	if (qAbs(segment.y1() - segment.y2()) < epsilon) {
		offset.setX(0);
	}

	line[segmentNumber] += offset;
	line[segmentNumber + 1] += offset;
	mEdge->setLine(line);
}

void SquareLine::improveAppearance()
{
	if (needCorrect()) {
		squarize();
	}

	deleteLoops();
	deleteShortSegments();
}

void SquareLine::deleteShortSegments()
{
	QPolygonF line = mEdge->line();

	for (int i = 1; i < line.size() - 2; i++) {
		QLineF segment(line[i], line[i + 1]);
		if (segment.length() < epsilon) {
			line.remove(i, 2);
			i--;
		} else if (segment.length() < kvadratik * 2) {
			if (i != 1) {
				QLineF previousLine(line[i - 1], line[i]);
				if (qAbs(previousLine.x1() - previousLine.x2()) < epsilon) {
					line[i - 1] = QPointF(line[i + 1].x(), line[i - 1].y());
				} else {
					line[i - 1] = QPointF(line[i - 1].x(), line[i + 1].y());
				}

				line.remove(i, 2);
				i--;
			} else if (i != line.size() - 3) {
				QLineF nextLine(line[i + 1], line[i + 2]);
				if (qAbs(nextLine.x1() - nextLine.x2()) < epsilon) {
					line[i + 2] = QPointF(line[i].x(), line[i + 2].y());
				} else {
					line[i + 2] = QPointF(line[i + 2].x(), line[i].y());
				}

				line.remove(i, 2);
				i--;
			}
		}
	}

	mEdge->setLine(line);
}

bool SquareLine::needCorrect() const
{
	return needCorrectSrc() || needCorrectDst() || !isSquareLine();
}

bool SquareLine::needCorrectSrc() const
{
	if (!mEdge->src()) {
		return false;
	}

	QPolygonF line = mEdge->line();
	const int srcPoint = firstOutsidePoint(true);

	return ((srcPoint != 1) || intersects(QLineF(line[0], line[1]), mEdge->src()));
}

bool SquareLine::needCorrectDst() const
{
	if (!mEdge->dst()) {
		return false;
	}

	const QPolygonF line = mEdge->line();
	const int dstPoint = firstOutsidePoint(false);

	return ((dstPoint != line.count() - 2)
			|| intersects(QLineF(line[line.count() - 2], line[line.count() - 1]), mEdge->dst()));
}

bool SquareLine::intersects(const QLineF &line, NodeElement *node) const
{
	const bool isLineVertical = qAbs(line.x1() - line.x2()) < epsilon;
	const int side = mEdge->defineNodePortSide(node == mEdge->src());

	if ((isLineVertical && (side == EdgeElement::left || side == EdgeElement::right))
			|| (!isLineVertical && (side == EdgeElement::top || side == EdgeElement::bottom)))
	{
		return true;
	}

	QRectF rect(mEdge->mapFromItem(node, node->contentsRect()).boundingRect());

	QLineF firstLine(rect.topLeft(), isLineVertical ? rect.topRight() : rect.bottomLeft());
	QLineF secondLine(isLineVertical ? rect.bottomLeft() : rect.topRight(), rect.bottomRight());

	if ((side == EdgeElement::top) || (side == EdgeElement::left)) {
		return line.intersect(secondLine, 0) == QLineF::BoundedIntersection;
	} else {
		return line.intersect(firstLine, 0) == QLineF::BoundedIntersection;
	}
}

bool SquareLine::isSquareLine() const
{
	const QPolygonF line = mEdge->line();
	for (int i = 0; i < line.count() - 1; i++) {
		if ((qAbs(line[i].x() - line[i + 1].x()) > epsilon) && (qAbs(line[i].y() - line[i + 1].y()) > epsilon)) {
			return false;
		}
	}

	return true;
}

void SquareLine::squarize()
{
	QPolygonF line;
	line << mEdge->line().first() << mEdge->line().last();

	// we don't need to correct the already straight line
	if (line.first().x() == line.last().x() || line.first().y() == line.last().y()) {
		mEdge->setLine(line);
		return;
	}

	LineType type = defineType();

	switch (type) {
	case vertical:
		createVerticalLine(line);
		break;
	case horizontal:
		createHorizontalLine(line);
		break;
	case verticalTurn:
		verticalTurningSquareLine(line);
		mEdge->setLine(line);
		correctLine(line, needCorrectSrc(), needCorrectDst(), true);
		break;
	case horizontalTurn:
		horizontalTurningSquareLine(line);
		mEdge->setLine(line);
		correctLine(line, needCorrectSrc(), needCorrectDst(), false);
		break;
	}

	mEdge->setLine(line);
}

SquareLine::LineType SquareLine::defineType() const
{
	if (!(mEdge->src() && mEdge->dst())) {
		return horizontalTurn;
	}

	// defining type of square link by looking at sides of nodes which the link is connected to
	int startSide = mEdge->defineNodePortSide(true);
	int endSide = mEdge->defineNodePortSide(false);

	if (startSide == EdgeElement::top || startSide == EdgeElement::bottom) {
		if (endSide == EdgeElement::top || endSide == EdgeElement::bottom) {
			return vertical;
		} else {
			return verticalTurn;
		}
	} else if (endSide == EdgeElement::left || endSide == EdgeElement::right) {
		return horizontal;
	} else {
		return horizontalTurn;
	}
}

void SquareLine::createHorizontalLine(QPolygonF &line) const
{
	if (mEdge->defineNodePortSide(true) == mEdge->defineNodePortSide(false)) {
		horizontalSameSide(line, mEdge->defineNodePortSide(true) == EdgeElement::left);
	} else {
		horizontalSquareLine(line, (line.first().x() + line.last().x()) / 2);
	}
}

void SquareLine::createVerticalLine(QPolygonF &line) const
{
	if (mEdge->defineNodePortSide(true) == mEdge->defineNodePortSide(false)) {
		verticalSameSide(line, mEdge->defineNodePortSide(true) == EdgeElement::top);
	} else {
		verticalSquareLine(line, (line.first().y() + line.last().y()) / 2);
	}
}

void SquareLine::correctLine(QPolygonF &line, bool correctSrc, bool correctDst, bool isVertical) const
{
	if (!correctSrc && !correctDst) {
		return;
	}

	QPolygonF innerLine;
	innerLine.append(correctSrc ? outgoingPoint(true) : line.first());
	innerLine.append(correctDst ? outgoingPoint(false) : line.last());

	if (isVertical) {
		createVerticalInnerLine(innerLine, correctSrc, correctDst);
	} else {
		createHorizontalInnerLine(innerLine, correctSrc, correctDst);
	}

	if (correctSrc) {
		innerLine.insert(0, line.first());
	}
	if (correctDst) {
		innerLine.append(line.last());
	}

	line = innerLine;
}

void SquareLine::createHorizontalInnerLine(QPolygonF &line, bool correctSrc, bool correctDst) const
{
	if (correctSrc) {
		if (correctDst) {
			verticalTurningSquareLine(line);
		} else if (mEdge->dst()) {
			verticalInnerLine(line);
		}
	} else if (correctDst && mEdge->src()) {
		horizontalInnerLine(line);
	}

}

void SquareLine::createVerticalInnerLine(QPolygonF &line, bool correctSrc, bool correctDst) const
{
	if (correctSrc) {
		if (correctDst) {
			horizontalTurningSquareLine(line);
		} else if (mEdge->dst()) {
			horizontalInnerLine(line);
		}
	} else if (correctDst && mEdge->src()) {
		verticalInnerLine(line);
	}

}

void SquareLine::verticalInnerLine(QPolygonF &line) const
{
	QPair<qreal, qreal> const space = verticalIntermediateSpace();
	if (space.first < space.second) {
		verticalSquareLine(line, (space.first + space.second) / 2);
	} else {
		verticalSameSide(line, mEdge->defineNodePortSide(false) == EdgeElement::top);
	}
}

void SquareLine::horizontalInnerLine(QPolygonF &line) const
{
	QPair<qreal, qreal> const space = horizontalIntermediateSpace();
	if (space.first < space.second) {
		horizontalSquareLine(line, (space.first + space.second) / 2);
	} else {
		horizontalSameSide(line, mEdge->defineNodePortSide(false) == EdgeElement::left);
	}
}

void SquareLine::horizontalSquareLine(QPolygonF &line, qreal middleLine) const
{
	QPointF insertPoint1 = line.first();
	QPointF insertPoint2 = line.last();

	insertPoint1.setX(middleLine);
	insertPoint2.setX(insertPoint1.x());

	line.insert(1, insertPoint1);
	line.insert(2, insertPoint2);
}

void SquareLine::verticalSquareLine(QPolygonF &line, qreal middleLine) const
{
	QPointF insertPoint1 = line.first();
	QPointF insertPoint2 = line.last();

	insertPoint1.setY(middleLine);
	insertPoint2.setY(insertPoint1.y());

	line.insert(1, insertPoint1);
	line.insert(2, insertPoint2);
}

void SquareLine::horizontalTurningSquareLine(QPolygonF &line) const
{
	QPointF insertPoint = line.first();
	insertPoint.setX(line.last().x());
	line.insert(1, insertPoint);
}

void SquareLine::verticalTurningSquareLine(QPolygonF &line) const
{
	QPointF insertPoint = line.first();
	insertPoint.setY(line.last().y());
	line.insert(1, insertPoint);
}

void SquareLine::horizontalSameSide(QPolygonF &line, bool leftLoop) const
{
	const qreal loopLine = leftLoop ? qMin(srcRect().left(), dstRect().left()) - offset
			: qMax(srcRect().right(), dstRect().right()) + offset;
	horizontalSquareLine(line, loopLine);
}

void SquareLine::verticalSameSide(QPolygonF &line, bool topLoop) const
{
	const qreal loopLine = topLoop ? qMin(srcRect().top(), dstRect().top()) - offset
			: qMax(srcRect().bottom(), dstRect().bottom()) + offset;
	verticalSquareLine(line, loopLine);
}

QPair<qreal, qreal> SquareLine::horizontalIntermediateSpace() const
{
	if (srcRect().right() < dstRect().left()) {
		return qMakePair(srcRect().right(), dstRect().left());
	} else {
		return qMakePair(dstRect().right(), srcRect().left());
	}
}

QPair<qreal, qreal> SquareLine::verticalIntermediateSpace() const
{
	if (srcRect().bottom() < dstRect().top()) {
		return qMakePair(srcRect().bottom(), dstRect().top());
	} else {
		return qMakePair(dstRect().bottom(), srcRect().top());
	}
}

QPointF SquareLine::outgoingPoint(bool isStart) const
{
	const QPolygonF line = mEdge->line();
	const int side = mEdge->defineNodePortSide(isStart);

	QPointF outGoing = isStart ? line.first() : line.last();

	switch (side) {
	case EdgeElement::top:
		outGoing.setY(outGoing.y() - offset);
		break;
	case EdgeElement::bottom:
		outGoing.setY(outGoing.y() + offset);
		break;
	case EdgeElement::left:
		outGoing.setX(outGoing.x() - offset);
		break;
	case EdgeElement::right:
		outGoing.setX(outGoing.x() + offset);
		break;
	default:
		;
	}

	return outGoing;
}

QRectF SquareLine::srcRect() const
{
	return mEdge->mapFromItem(mEdge->src(), mEdge->src()->contentsRect()).boundingRect();
}

QRectF SquareLine::dstRect() const
{
	return mEdge->mapFromItem(mEdge->dst(), mEdge->dst()->contentsRect()).boundingRect();
}

EdgeArrangeCriteria SquareLine::arrangeCriteria(const NodeElement *node, const QLineF &portLine) const
{
	const QPointF portCenter = (portLine.p1() + portLine.p2()) / 2;
	const QPointF arrangePoint = portArrangePoint(node);
	QLineF arrangeLine(portCenter, arrangePoint);
	arrangeLine.setAngle(arrangeLine.angle() - portLine.angle());

	const bool turningLeft = arrangeLine.dx() < 0;
	const bool above = arrangeLine.dy() < 0;
	qreal yOffset = arrangeLine.dy();
	if ((turningLeft && above) || (!turningLeft && !above)) {
		yOffset = -yOffset;
	}
	return EdgeArrangeCriteria(turningLeft ? -1 : 1, yOffset, arrangeLine.dx());
}

QPointF SquareLine::portArrangePoint(const NodeElement *node) const
{
	QPolygonF line = mEdge->line();
	NodeElement *src = mEdge->src();
	NodeElement *dst = mEdge->dst();

	if (node == src) {
		return (line.count() == 2) ? mEdge->mapToItem(src, line[1]) : mEdge->mapToItem(src, line[2]);
	}
	if (node == dst) {
		return (line.count() == 2) ? mEdge->mapToItem(src, line[0]) : mEdge->mapToItem(dst, line[line.count() - 3]);
	}
	return QPointF();
}

QList<ContextMenuAction *> SquareLine::extraActions(const QPointF &pos)
{
	Q_UNUSED(pos)

	QList<ContextMenuAction *> result;
	if (!mEdge->isLoop()) {
		result << &mLayOutAction;
	}

	return result;
}

void SquareLine::drawPort(QPainter *painter, int portNumber)
{
	if ((portNumber == 0) || (portNumber == mEdge->line().count() - 1)) {
		LineHandler::drawPort(painter, portNumber);
	}
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.activemq.artemis.core.replication;

import org.apache.activemq.artemis.api.core.Message;

/**
 * {@link org.apache.activemq.artemis.core.server.LargeServerMessage} methods used by the {@link ReplicationEndpoint}.
 * <p>
 * In practice a subset of the methods necessary to have a {@link org.apache.activemq.artemis.core.server.LargeServerMessage}
 *
 * @see org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMessageInSync
 */
public interface ReplicatedLargeMessage {

   /**
    * @see org.apache.activemq.artemis.core.server.LargeServerMessage#setDurable(boolean)
    */
   Message setDurable(boolean b);

   /**
    * @see org.apache.activemq.artemis.core.server.LargeServerMessage#setMessageID(long)
    */
   Message setMessageID(long id);

   /**
    * @see org.apache.activemq.artemis.core.server.LargeServerMessage#releaseResources()
    */
   void releaseResources();

   /**
    * @see org.apache.activemq.artemis.core.server.LargeServerMessage#deleteFile()
    */
   void deleteFile() throws Exception;

   /**
    * @see org.apache.activemq.artemis.core.server.LargeServerMessage#addBytes(byte[])
    */
   void addBytes(byte[] body) throws Exception;

   void setPendingRecordID(long pendingRecordID);

   long getPendingRecordID();

}


text:
export default function pageHasText(context, text, message) {
  let matches = context.$().text().match(new RegExp(text));
  message = message || `page should contain "${text}"`;

  this.push(!!matches, matches, text, message);
}


text:
package net.sarvey.pos.lib.orm;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.*;
import org.hibernate.HibernateException;

public class HibernateUtil {

    private static SessionFactory sessionFactory;
    private static ServiceRegistry serviceRegistry;

    static{
        try {

        	configureSessionFactory();

        } catch (HibernateException e) {
            throw new ExceptionInInitializerError(e);
        }

    }

    private static SessionFactory configureSessionFactory() throws HibernateException {
	    Configuration configuration = new Configuration();
	    configuration.configure();
	    //configuration.configure("com/sarveyconsulting/pos/orm/hibernate.cfg.xml");
	    serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
	    sessionFactory = configuration.buildSessionFactory(serviceRegistry);
	    return sessionFactory;
	}

    public static SessionFactory getSessionFactory(){
        return sessionFactory;
    }

    public static void shutDown(){
        //closes caches and connections
        getSessionFactory().close();
    }
}


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

namespace wojilu.Web.Mvc.Routes {

    public class RouteOtherInfo {

        private String _name;
        public String getName() { return _name; }
        public void setName( String name ) { _name = name; }

        private Dictionary<String, String> _items;
        public Dictionary<String, String> getItems() { return _items; }
        public void setItems( Dictionary<String, String> dic ) { _items = dic; }

        public static DefaultRouteValue getDefaultValue( RouteOtherInfo info ) {

            Dictionary<String, String> values = info.getItems();

            DefaultRouteValue result = new DefaultRouteValue();

            if (values.ContainsKey( "ownertype" )) result.setOwnerType( values["ownertype"] );
            if (values.ContainsKey( "owner" )) result.setOwner( values["owner"] );
            if (values.ContainsKey( "ns" )) result.setNs( values["ns"] );
            if (values.ContainsKey( "controller" )) result.setController( values["controller"] );
            if (values.ContainsKey( "action" )) result.setAction( values["action"] );
            if (values.ContainsKey( "query" )) result.setQuery( values["query"] );
            if (values.ContainsKey( "id" )) result.setId( cvt.ToInt( values["id"] ) );
            if (values.ContainsKey( "page" )) result.setPage( cvt.ToInt( values["page"] ) );

            return result;
        }

        public static RouteOtherInfo Parse( String str ) {

            if (strUtil.IsNullOrEmpty( str )) return null;

            String[] arrItem = str.Split( ':' );
            if (arrItem.Length != 2) return null;

            String name = arrItem[0].Trim();
            String settingStr = arrItem[1].Trim();
            if (strUtil.IsNullOrEmpty( name ) || strUtil.IsNullOrEmpty( settingStr )) return null;
            settingStr = settingStr.TrimStart( '{' ).TrimEnd( '}' ).Trim();
            if (strUtil.IsNullOrEmpty( settingStr )) return null;

            //-----------------------------

            RouteOtherInfo result = new RouteOtherInfo();
            result.setName( name );

            String[] arrSettings = settingStr.Split( ',' );

            Dictionary<String, String> dic = new Dictionary<String, String>();
            foreach (String item in arrSettings) {

                if (strUtil.IsNullOrEmpty( item )) continue;

                String[] arrPair = item.Trim().Split( '=' );
                if (arrPair.Length != 2) continue;

                String key = arrPair[0].Trim();
                String val = arrPair[1].Trim();

                if (strUtil.IsNullOrEmpty( key ) ) continue;
                if (strUtil.IsNullOrEmpty( val )) val = "";
                dic.Add( key, val );

            }

            if (dic.Count == 0) return null;

            result.setItems( dic );

            return result;
        }

    }

}


text:
module Quotes
  class ServiceFactory < ServiceRegistration

    ServiceRegistration.register :quotes_backend do
      raise "\n\n~~~~~{[  No registration found for :quotes_backend  ]}~~~~~\n\n"
    end

    ServiceRegistration.register :publications_backend do
      raise "\n\n~~~~~{[  No registration found for :publications_backend  ]}~~~~~\n\n"
    end

  end
end


text:
import pushmanager.testing as T

from pushmanager.ui_methods import authorized_to_manage_request

class UIMethodTest(T.TestCase):

    def test_authorized_to_manage_request_random_user(self):
        request = {'user': 'testuser', 'watchers': None }
        T.assert_equal(False, authorized_to_manage_request(None, request, 'notme'))

    def test_authorized_to_manage_request_request_user(self):
        request = {'user': 'testuser', 'watchers': None }
        T.assert_equal(True, authorized_to_manage_request(None, request, 'testuser'))

    def test_authorized_to_manage_request_pushmaster(self):
        request = {'user': 'testuser', 'watchers': None }
        T.assert_equal(True, authorized_to_manage_request(None, request, 'notme', True))

    def test_authorized_to_manage_request_watcher(self):
        request = {'user': 'testuser', 'watchers': 'watcher1' }
        T.assert_equal(True, authorized_to_manage_request(None, request, 'watcher1'))

if __name__ == '__main__':
    T.run()


text:
package com.konkerlabs.platform.registry.business.model;

import com.konkerlabs.platform.registry.business.model.enumerations.FirmwareUpdateStatus;
import com.konkerlabs.platform.registry.business.model.enumerations.LogLevel;
import com.konkerlabs.platform.registry.business.model.validation.CommonValidations;
import lombok.Builder;
import lombok.Data;
import lombok.experimental.Tolerate;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.math.BigInteger;
import java.time.Instant;
import java.util.*;

@Data
@Builder
@Document(collection = "devicesFwUpdates")
public class DeviceFwUpdate {

	@Id
	private String id;
	@DBRef
	private Tenant tenant;
	@DBRef
	private Application application;
	private String deviceGuid;
	private FirmwareUpdateStatus status;
	@DBRef
	private DeviceFirmware deviceFirmware;
	private String version;
	private String guid;
	private Instant lastChange;

	public Optional<Map<String, Object[]>> applyValidations() {
		Map<String, Object[]> validations = new HashMap<>();

		return Optional.of(validations).filter(map -> !map.isEmpty());
	}

}


text:
<!DOCTYPE html>

    <title>ElongationCell Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

 Docs (78% documented)

         Reference

        ElongationCell Class Reference

            Classes

                ElongationCell

                ElongationDetailViewController

                ElongationHeader

                ElongationTransition

                ElongationViewController

                – State

                SwipableTableViewController

            Constructors

                init()

                init(_:)

                init(padding:sidePadding:)

                init(top:left:bottom:right:otherSides:)

            Enums

                State

            Extensions

                UICollectionView

                UIEdgeInsets

                UITableView

            Instance Methods

                animationController(forDismissed:)

                animationController(forPresented:presenting:source:)

                collapseCells(animated:)

                commonInit()

                dequeue(_:)

                dequeue(_:indexPath:)

                dim(_:animated:)

                expand(_:animated:)

                expand(viewController:animated:completion:)

                expandCell(at:)

                openDetailView(for:)

                register(_:)

                register(_:)

                registerNib(_:)

                registerNib(_:)

                scrollViewDidScroll(_:)

                scrollViewDidScroll(_:)

                tableView(_:willDisplay:forRowAt:)

            Instance Variables

                bottomView

                bottomView

                bottomViewHeight

                bottomViewHeightConstraint

                bottomViewOffset

                bottomViewTopConstraint

                bottomViewTopConstraint

                cellTouchAction

                contentView

                customSeparatorEnabled

                detailDismissingDuration

                detailPresetingDuration

                expandedIndexPath

                headerTouchAction

                headerView

                isExpanded

                isParallaxEnabled

                isSwipeGesturesEnabled

                parallaxFactor

                parallaxViewCenterConstraint

                parallaxViewHeightConstraint

                scalableView

                scalableView

                scaleViewScaleFactor

                separatorColor

                separatorHeight

                shouldExpand

                state

                topView

                topView

                topViewHeight

                topViewHeightConstraint

                topViewTopConstraint

            Static Variables

                shared

            Structs

                ElongationConfig

                – ExpandingBehaviour

                – CellTouchAction

                – HeaderTouchAction

ElongationCell

open class ElongationCell : UITableViewCell, Expandable

UITableViewCell subclass.

This cell used by ElongationViewController.
Cell can be expanded and used for transition to ElongationDetailViewController.

Can only be configured from ’.xib’ or Storyboard.

Public properties

                    isExpanded

Is this cell in expanded state.

Declaration

Swift

open var isExpanded: Bool

                    topView

View on top half of contentView.
Add here all the views which wont be scaled and must stay on their position.

Declaration

Swift

@IBOutlet public var topView: UIView!

                    topViewHeightConstraint

height constraint of topView.
This constraint will be changed according to ElongationConfig.

Declaration

Swift

@IBOutlet public var topViewHeightConstraint: NSLayoutConstraint!

                    topViewTopConstraint

top constraint of topView.
This constraint will be changed if ElongationConfig was configured for using custom separators.

Declaration

Swift

@IBOutlet public var topViewTopConstraint: NSLayoutConstraint!

                    scalableView

This is the front view which can be scaled if scaleFactor was configured in ElongationConfig.
Also to this view can be applied ‘parallax’ effect.

Declaration

Swift

@IBOutlet public var scalableView: UIView!

                    parallaxViewCenterConstraint

centerY constraint of view, to which must be applied parallax effect.

Declaration

Swift

@IBOutlet public var parallaxViewCenterConstraint: NSLayoutConstraint!

                    parallaxViewHeightConstraint

height constraint of view, to which must be applied parallax effect.

Declaration

Swift

@IBOutlet public var parallaxViewHeightConstraint: NSLayoutConstraint!

                    bottomView

The view which comes from behind the cell when you tap on the cell.

Declaration

Swift

@IBOutlet public var bottomView: UIView!

                    bottomViewHeightConstraint

height constraint of bottomView.

Declaration

Swift

@IBOutlet public var bottomViewHeightConstraint: NSLayoutConstraint!

                    bottomViewTopConstraint

top constraint of bottomView.

Declaration

Swift

@IBOutlet public var bottomViewTopConstraint: NSLayoutConstraint!

Constructor

                    init(style:reuseIdentifier:)

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

                    init(coder:)

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

                    hitTest(_:with:)

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

                    willMove(toSuperview:)

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

                    layoutSubviews()

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

                    configureCell()

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

Public

                    expand(_:animated:)

Expand or collapse the cell.

Declaration

Swift

open func expand(_ value: Bool, animated: Bool = default)

Parameters

                                value

true if the cell must be expanded

                                animated

should it be animated

                    dim(_:animated:)

Apply dark overlay above the cell.

Declaration

Swift

open func dim(_ value: Bool, animated: Bool = default)

Parameters

                                value

true if the cell must be dimmed

                                animated

should it be animated

                    encode(with:)

Undocumented

Declaration

Swift

open class ElongationCell : UITableViewCell, Expandable

© 2017 . All rights reserved. (Last updated: 2017-02-20)

Generated by jazzy ♪♫ v0.7.4, a Realm project.


text:
extern "Java"
{
  namespace gnu
  {
    namespace javax
    {
      namespace crypto
      {
        namespace jce
        {
          namespace cipher
          {
              class PBES2$HMacWhirlpool$Cast5;
          }
        }
      }
    }
  }
}

class gnu::javax::crypto::jce::cipher::PBES2$HMacWhirlpool$Cast5 : public ::gnu::javax::crypto::jce::cipher::PBES2$HMacWhirlpool
{

public:
  PBES2$HMacWhirlpool$Cast5();
  static ::java::lang::Class class$;
};

#endif // __gnu_javax_crypto_jce_cipher_PBES2$HMacWhirlpool$Cast5__


text:
package cloud

import (
	"fmt"

	bosherr "github.com/cloudfoundry/bosh-utils/errors"
	boshlog "github.com/cloudfoundry/bosh-utils/logger"
	biproperty "github.com/cloudfoundry/bosh-utils/property"
)

const MaxCpiApiVersionSupported = 2

// The agent on stemcells with version 2
// will avoid the registry IFF CPI and Director support CPI API v2 (above)
const StemcellNoRegistryAsOfVersion = 2
const DefaultCPIVersion = 1

type Cloud interface {
	CreateStemcell(imagePath string, cloudProperties biproperty.Map) (stemcellCID string, err error)
	DeleteStemcell(stemcellCID string) error
	HasVM(vmCID string) (bool, error)
	CreateVM(
		agentID string,
		stemcellCID string,
		cloudProperties biproperty.Map,
		networksInterfaces map[string]biproperty.Map,
		env biproperty.Map,
	) (vmCID string, err error)
	SetVMMetadata(cmCID string, metadata VMMetadata) error
	SetDiskMetadata(diskCID string, metadata DiskMetadata) error
	DeleteVM(vmCID string) error
	CreateDisk(size int, cloudProperties biproperty.Map, vmCID string) (diskCID string, err error)
	AttachDisk(vmCID, diskCID string) (interface{}, error)
	DetachDisk(vmCID, diskCID string) error
	DeleteDisk(diskCID string) error
	Info() (cpiInfo CpiInfo, err error)
	fmt.Stringer
}

type cloud struct {
	cpiCmdRunner CPICmdRunner
	context      CmdContext
	logger       boshlog.Logger
	logTag       string
}

type CpiInfo struct {
	StemcellFormats []string `json:"stemcell_formats"`
	ApiVersion      int      `json:"api_version,omitempty"`
}

type VMMetadata map[string]string

type DiskMetadata map[string]string

func NewCloud(
	cpiCmdRunner CPICmdRunner,
	directorID string,
	stemcellApiVersion int,
	logger boshlog.Logger,
) Cloud {

	cmdContext := CmdContext{
		DirectorID: directorID,
		Vm: &VM{
			Stemcell: &Stemcell{
				ApiVersion: stemcellApiVersion,
			},
		},
	}

	logger.Debug("cloud", "Init cloud with stemcell version: %v", stemcellApiVersion)

	return cloud{
		cpiCmdRunner: cpiCmdRunner,
		context:      cmdContext,
		logger:       logger,
		logTag:       "cloud",
	}
}

func (c cloud) CreateStemcell(imagePath string, cloudProperties biproperty.Map) (string, error) {
	c.logger.Debug(c.logTag, "Creating stemcell")

	cpiInfo, err := c.Info()
	if err != nil {
		return "", err
	}

	method := "create_stemcell"
	cmdOutput, err := c.cpiCmdRunner.Run(c.context, method, cpiInfo.ApiVersion, imagePath, cloudProperties)
	if err != nil {
		return "", err
	}

	if cmdOutput.Error != nil {
		return "", NewCPIError(method, *cmdOutput.Error)
	}

	// for create_stemcell, the result is a string of the stemcell cid
	cidString, ok := cmdOutput.Result.(string)
	if !ok {
		return "", bosherr.Errorf("Unexpected external CPI command result: '%#v'", cmdOutput.Result)
	}
	return cidString, nil
}

func (c cloud) DeleteStemcell(stemcellCID string) error {
	c.logger.Debug(c.logTag, "Deleting stemcell '%s'", stemcellCID)

	cpiInfo, err := c.Info()
	if err != nil {
		return err
	}

	method := "delete_stemcell"
	cmdOutput, err := c.cpiCmdRunner.Run(c.context, method, cpiInfo.ApiVersion, stemcellCID)
	if err != nil {
		return bosherr.WrapError(err, "Calling CPI 'delete_stemcell' method")
	}

	if cmdOutput.Error != nil {
		return NewCPIError(method, *cmdOutput.Error)
	}

	return nil
}

func (c cloud) HasVM(vmCID string) (bool, error) {
	cpiInfo, err := c.Info()
	if err != nil {
		return false, err
	}

	method := "has_vm"
	cmdOutput, err := c.cpiCmdRunner.Run(c.context, method, cpiInfo.ApiVersion, vmCID)
	if err != nil {
		return false, err
	}

	if cmdOutput.Error != nil {
		return false, NewCPIError(method, *cmdOutput.Error)
	}

	found, ok := cmdOutput.Result.(bool)
	if !ok {
		return false, bosherr.Errorf("Unexpected external CPI command result: '%#v'", cmdOutput.Result)
	}
	return found, nil
}

func (c cloud) CreateVM(
	agentID string,
	stemcellCID string,
	cloudProperties biproperty.Map,
	networksInterfaces map[string]biproperty.Map,
	env biproperty.Map,
) (string, error) {
	var (
		ok           bool
		cidString    string
		method       = "create_vm"
		diskLocality = []interface{}{} // not used with bosh-init
	)

	cpiInfo, err := c.Info()
	if err != nil {
		return "", err
	}

	cmdOutput, err := c.cpiCmdRunner.Run(
		c.context,
		method,
		cpiInfo.ApiVersion,
		agentID,
		stemcellCID,
		cloudProperties,
		networksInterfaces,
		diskLocality,
		env,
	)

	if err != nil {
		return "", err
	}

	if cmdOutput.Error != nil {
		return "", NewCPIError(method, *cmdOutput.Error)
	}

	if c.shouldInterpretV2Contract(cpiInfo.ApiVersion) {
		var result []interface{}
		if result, ok = cmdOutput.Result.([]interface{}); ok {
			cidString, ok = result[0].(string)
		}
	} else {
		cidString, ok = cmdOutput.Result.(string)
	}

	if !ok {
		return "", bosherr.Errorf("Unexpected external CPI command result: '%#v'", cmdOutput.Result)
	}

	return cidString, nil
}

func (c cloud) SetVMMetadata(vmCID string, metadata VMMetadata) error {
	cpiInfo, err := c.Info()
	if err != nil {
		return err
	}

	cmdOutput, err := c.cpiCmdRunner.Run(
		c.context,
		"set_vm_metadata",
		cpiInfo.ApiVersion,
		vmCID,
		metadata,
	)

	if err != nil {
		return err
	}

	if cmdOutput.Error != nil {
		return NewCPIError("set_vm_metadata", *cmdOutput.Error)
	}

	return nil
}

func (c cloud) SetDiskMetadata(diskCID string, metadata DiskMetadata) error {
	cpiInfo, err := c.Info()
	if err != nil {
		return err
	}

	cmdOutput, err := c.cpiCmdRunner.Run(
		c.context,
		"set_disk_metadata",
		cpiInfo.ApiVersion,
		diskCID,
		metadata,
	)

	if err != nil {
		return err
	}

	if cmdOutput.Error != nil {
		return NewCPIError("set_disk_metadata", *cmdOutput.Error)
	}

	return nil
}

func (c cloud) CreateDisk(size int, cloudProperties biproperty.Map, vmCID string) (string, error) {
	c.logger.Debug(c.logTag,
		"Creating disk with size %d, cloudProperties %#v, instanceID %s",
		size,
		cloudProperties,
		vmCID,
	)

	cpiInfo, err := c.Info()
	if err != nil {
		return "", err
	}

	method := "create_disk"
	cmdOutput, err := c.cpiCmdRunner.Run(
		c.context,
		method,
		cpiInfo.ApiVersion,
		size,
		cloudProperties,
		vmCID,
	)

	if err != nil {
		return "", err
	}

	if cmdOutput.Error != nil {
		return "", NewCPIError(method, *cmdOutput.Error)
	}

	cidString, ok := cmdOutput.Result.(string)
	if !ok {
		return "", bosherr.Errorf("Unexpected external CPI command result: '%#v'", cmdOutput.Result)
	}
	return cidString, nil
}

func (c cloud) AttachDisk(vmCID, diskCID string) (interface{}, error) {
	var (
		diskHint interface{}
		method   = "attach_disk"
	)
	c.logger.Debug(c.logTag, "Attaching disk '%s' to vm '%s'", diskCID, vmCID)

	cpiInfo, err := c.Info()
	if err != nil {
		return nil, err
	}

	cmdOutput, err := c.cpiCmdRunner.Run(
		c.context,
		method,
		cpiInfo.ApiVersion,
		vmCID,
		diskCID,
	)

	if err != nil {
		return diskHint, bosherr.WrapError(err, "Calling CPI 'attach_disk' method")
	}

	if cmdOutput.Error != nil {
		return diskHint, NewCPIError(method, *cmdOutput.Error)
	}

	if c.shouldInterpretV2Contract(cpiInfo.ApiVersion) {
		diskHint = cmdOutput.Result
	}

	return diskHint, nil
}

func (c cloud) DetachDisk(vmCID, diskCID string) error {
	c.logger.Debug(c.logTag, "Detaching disk '%s' from vm '%s'", diskCID, vmCID)

	cpiInfo, err := c.Info()
	if err != nil {
		return err
	}

	method := "detach_disk"
	cmdOutput, err := c.cpiCmdRunner.Run(
		c.context,
		method,
		cpiInfo.ApiVersion,
		vmCID,
		diskCID,
	)
	if err != nil {
		return bosherr.WrapError(err, "Calling CPI 'detach_disk' method")
	}

	if cmdOutput.Error != nil {
		return NewCPIError(method, *cmdOutput.Error)
	}

	return nil
}

func (c cloud) DeleteVM(vmCID string) error {
	c.logger.Debug(c.logTag, "Deleting vm '%s'", vmCID)

	cpiInfo, err := c.Info()
	if err != nil {
		return err
	}

	method := "delete_vm"
	cmdOutput, err := c.cpiCmdRunner.Run(c.context, method, cpiInfo.ApiVersion, vmCID)
	if err != nil {
		return bosherr.WrapError(err, "Calling CPI 'delete_vm' method")
	}

	if cmdOutput.Error != nil {
		return NewCPIError(method, *cmdOutput.Error)
	}

	return nil
}

func (c cloud) DeleteDisk(diskCID string) error {
	c.logger.Debug(c.logTag, "Deleting disk '%s'", diskCID)

	cpiInfo, err := c.Info()
	if err != nil {
		return err
	}

	method := "delete_disk"
	cmdOutput, err := c.cpiCmdRunner.Run(c.context, method, cpiInfo.ApiVersion, diskCID)
	if err != nil {
		return bosherr.WrapError(err, "Calling CPI 'delete_disk' method")
	}

	if cmdOutput.Error != nil {
		return NewCPIError(method, *cmdOutput.Error)
	}

	return nil
}

func (c cloud) Info() (cpiInfo CpiInfo, err error) {
	c.logger.Debug(c.logTag, "Info")

	method := "info"
	cmdOutput, err := c.cpiCmdRunner.Run(c.context, method, DefaultCPIVersion)
	if err != nil {
		return CpiInfo{}, err
	}
	if cmdOutput.Error != nil {
		cpiErr := NewCPIError("info", *cmdOutput.Error)
		if cpiErr.Type() != NotImplementedError {
			return CpiInfo{}, cpiErr
		}

		return CpiInfo{ApiVersion: DefaultCPIVersion}, nil
	}

	cpiInfo, err = c.infoParser(cmdOutput)
	if err != nil {
		c.logger.Debug(c.logTag, err.Error())
		return CpiInfo{}, err
	}

	c.logger.Info(c.logTag, "CPI Info resulted in %v", cpiInfo)

	return cpiInfo, err
}

func (c cloud) infoParser(cmdOutput CmdOutput) (cpiInfo CpiInfo, err error) {
	cpiInfo = CpiInfo{}

	data, ok := cmdOutput.Result.(map[string]interface{})
	if !ok {
		return c.raiseParsingError(fmt.Sprintf("%s", cmdOutput))
	}

	c.logger.Info(c.logTag, "CPI Info returned %v", data)

	if stemcellFormats, ok := data["stemcell_formats"].([]interface{}); ok {
		formats := []string{}
		for i := range stemcellFormats {
			formats = append(formats, stemcellFormats[i].(string))
		}
		cpiInfo.StemcellFormats = formats
	} else {
		return c.raiseParsingError(fmt.Sprintf("Extracting stemcell_formats %s", cmdOutput))
	}

	cpiInfo.ApiVersion = DefaultCPIVersion

	if apiVersion, ok := data["api_version"]; ok {
		if fltVersion, ok := apiVersion.(float64); ok {
			cpiInfo.ApiVersion = int(fltVersion)
		} else {
			return c.raiseParsingError(fmt.Sprintf("Extracting api_version %s", cmdOutput))
		}
	}

	if cpiInfo.ApiVersion > MaxCpiApiVersionSupported {
		cpiInfo.ApiVersion = MaxCpiApiVersionSupported
	}

	return cpiInfo, err
}

func (c cloud) raiseParsingError(cmdOutput string) (cpiInfo CpiInfo, err error) {
	msg := fmt.Sprintf("Unmarshalling 'info' method response failed. Result: %s", cmdOutput)
	return CpiInfo{}, bosherr.Error(msg)
}

func (c cloud) String() string {
	return fmt.Sprintf("Cloud{Context=%s}", c.context)
}

func (c cloud) shouldInterpretV2Contract(cpiApiVersion int) bool {
	return cpiApiVersion == MaxCpiApiVersionSupported
}


text:
#include <limits>

#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/experimental/kernels/gru_cell.h"
#include "tensorflow/lite/kernels/cpu_backend_context.h"
#include "tensorflow/lite/kernels/internal/tensor.h"
#include "tensorflow/lite/kernels/kernel_util.h"

namespace tflite {
namespace ops {
namespace experimental {
namespace unidirectional_sequence_gru {
namespace {

void GruImpl(const TfLiteTensor* input, const TfLiteTensor* input_state,
             const TfLiteTensor* gate_weight, const TfLiteTensor* gate_bias,
             const TfLiteTensor* candidate_weight,
             const TfLiteTensor* candidate_bias, TfLiteTensor* output,
             TfLiteTensor* output_state, TfLiteTensor* activation,
             TfLiteTensor* concat,
             tflite::CpuBackendContext* cpu_backend_context) {
  const int n_time = input->dims->data[0];
  const int n_batch = input->dims->data[1];
  const int n_input = input->dims->data[2];
  const int n_output = output->dims->data[2];
  const int n_batch_input = n_batch * n_input;
  const int n_batch_output = n_batch * n_output;
  const RuntimeShape input_shape({n_batch, n_input});
  const float* input_data = GetTensorData<float>(input);
  const RuntimeShape state_shape = GetTensorShape(input_state);
  const float* input_state_data = GetTensorData<float>(input_state);
  const RuntimeShape gate_weight_shape = GetTensorShape(gate_weight);
  const float* gate_weight_data = GetTensorData<float>(gate_weight);
  const RuntimeShape gate_bias_shape = GetTensorShape(gate_bias);
  const float* gate_bias_data = GetTensorData<float>(gate_bias);
  const RuntimeShape candidate_weight_shape = GetTensorShape(candidate_weight);
  const float* candidate_weight_data = GetTensorData<float>(candidate_weight);
  const RuntimeShape candidate_bias_shape = GetTensorShape(candidate_bias);
  const float* candidate_bias_data = GetTensorData<float>(candidate_bias);
  const RuntimeShape activation_shape = GetTensorShape(activation);
  const RuntimeShape output_shape = RuntimeShape({n_batch, n_output});
  float* output_data = GetTensorData<float>(output);
  float* output_state_data = GetTensorData<float>(output_state);
  float* activation_data = GetTensorData<float>(activation);
  const RuntimeShape concat_shape = GetTensorShape(concat);
  float* concat_data = GetTensorData<float>(concat);
  tflite::FullyConnectedParams fc_params;
  fc_params.float_activation_min = std::numeric_limits<float>::lowest();
  fc_params.float_activation_max = std::numeric_limits<float>::max();
  for (int i = 0; i < n_time; ++i) {
    gru_cell::GruCell(
        input_shape, input_data, state_shape, input_state_data,
        gate_weight_shape, gate_weight_data, gate_bias_shape, gate_bias_data,
        candidate_weight_shape, candidate_weight_data, candidate_bias_shape,
        candidate_bias_data, output_shape, output_data, output_state_data,
        activation_shape, activation_data, concat_shape, concat_data, fc_params,
        cpu_backend_context);
    input_data += n_batch_input;
    output_data += n_batch_output;
    input_state_data = output_state_data;
  }
}

}  // namespace

enum InputTensor {
  // Input tensor of size [n_time, n_batch, n_input]
  kInput = 0,
  // Input state tensor of size [n_batch, n_output]
  kInputState = 1,
  // Gate weight tensor of size [2*n_output, n_input+n_output]
  kGateWeight = 2,
  // Gate bias tensor of size [2*n_output]
  kGateBias = 3,
  // Candidate weight tensor of size [n_output, n_input+n_output]
  kCandidateWeight = 4,
  // Candidate bias tensor of size [n_output]
  kCandidateBias = 5,
  kInputNum = 6
};

enum OutputTensor {
  // Input tensor of size [n_time, n_batch, n_output]
  kOutput = 0,
  // Output state tensor of size [n_batch, n_output]
  kOutputState = 1,
  kOutputNum = 2
};

enum TemporaryTensor {
  // Scratch buffer for activation of size [n_batch, 2*n_output]
  kActivation = 0,
  // Scratch buffer for activation of size [n_batch, n_input+n_output]
  kConcat = 1,
  kTemporaryNum = 2
};

void* Init(TfLiteContext* context, const char* buffer, size_t length) {
  auto* scratch_tensor_index = new int;
  context->AddTensors(context, kTemporaryNum, scratch_tensor_index);
  return scratch_tensor_index;
}

void Free(TfLiteContext* context, void* buffer) {
  delete reinterpret_cast<int*>(buffer);
}

TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
  int* scratch_tensor_index = reinterpret_cast<int*>(node->user_data);

  TF_LITE_ENSURE_EQ(context, node->inputs->size, kInputNum);
  TF_LITE_ENSURE_EQ(context, node->outputs->size, kOutputNum);

  // input's dim = [n_time, n_batch, n_input]
  const TfLiteTensor* input = GetInput(context, node, kInput);
  TF_LITE_ENSURE_EQ(context, input->dims->size, 3);
  const int n_time = input->dims->data[0];
  const int n_batch = input->dims->data[1];
  const int n_input = input->dims->data[2];

  // input_state's dim = [n_batch, n_output]
  const TfLiteTensor* input_state = GetInput(context, node, kInputState);
  TF_LITE_ENSURE_EQ(context, input_state->dims->size, 2);
  TF_LITE_ENSURE_EQ(context, input_state->dims->data[0], n_batch);
  const int n_output = input_state->dims->data[1];

  // gate_weight' dim = [2 * n_output, n_input + n_output]
  const TfLiteTensor* gate_weight = GetInput(context, node, kGateWeight);
  TF_LITE_ENSURE_EQ(context, gate_weight->dims->size, 2);
  TF_LITE_ENSURE_EQ(context, gate_weight->dims->data[0], 2 * n_output);
  TF_LITE_ENSURE_EQ(context, gate_weight->dims->data[1], n_input + n_output);

  // gate_bias' dim = [2 * n_output]
  const TfLiteTensor* gate_bias = GetInput(context, node, kGateBias);
  TF_LITE_ENSURE_EQ(context, gate_bias->dims->size, 1);
  TF_LITE_ENSURE_EQ(context, gate_bias->dims->data[0], 2 * n_output);

  // candidate_weight' dim = [n_output, n_input + n_output]
  const TfLiteTensor* candidate_weight =
      GetInput(context, node, kCandidateWeight);
  TF_LITE_ENSURE_EQ(context, candidate_weight->dims->size, 2);
  TF_LITE_ENSURE_EQ(context, candidate_weight->dims->data[0], n_output);
  TF_LITE_ENSURE_EQ(context, candidate_weight->dims->data[1],
                    n_input + n_output);

  // candidate_bias' dim = [n_output]
  const TfLiteTensor* candidate_bias = GetInput(context, node, kCandidateBias);
  TF_LITE_ENSURE_EQ(context, candidate_bias->dims->size, 1);
  TF_LITE_ENSURE_EQ(context, candidate_bias->dims->data[0], n_output);

  // output's dim = [n_time, n_batch, n_output]
  TfLiteTensor* output = GetOutput(context, node, kOutput);
  TfLiteIntArray* output_size = TfLiteIntArrayCreate(3);
  output_size->data[0] = n_time;
  output_size->data[1] = n_batch;
  output_size->data[2] = n_output;
  TF_LITE_ENSURE_OK(context,
                    context->ResizeTensor(context, output, output_size));

  // output_state's dim = [n_batch, n_output]
  TfLiteTensor* output_state = GetOutput(context, node, kOutputState);
  TF_LITE_ENSURE_OK(
      context, context->ResizeTensor(context, output_state,
                                     TfLiteIntArrayCopy(input_state->dims)));

  TfLiteIntArrayFree(node->temporaries);
  node->temporaries = TfLiteIntArrayCreate(kTemporaryNum);

  // activation's dim = [n_batch, 2 * n_output]
  node->temporaries->data[kActivation] = *scratch_tensor_index;
  TfLiteTensor* activation = GetTemporary(context, node, kActivation);
  activation->type = input->type;
  activation->allocation_type = kTfLiteArenaRw;
  TfLiteIntArray* activation_size = TfLiteIntArrayCreate(2);
  activation_size->data[0] = n_batch;
  activation_size->data[1] = 2 * n_output;
  TF_LITE_ENSURE_OK(
      context, context->ResizeTensor(context, activation, activation_size));

  // concat's dim  = [n_batch, n_input + n_output]
  node->temporaries->data[kConcat] = (*scratch_tensor_index) + kConcat;
  TfLiteTensor* concat = GetTemporary(context, node, kConcat);
  concat->type = input->type;
  concat->allocation_type = kTfLiteArenaRw;
  TfLiteIntArray* concat_size = TfLiteIntArrayCreate(2);
  concat_size->data[0] = n_batch;
  concat_size->data[1] = n_input + n_output;
  TF_LITE_ENSURE_OK(context,
                    context->ResizeTensor(context, concat, concat_size));

  return kTfLiteOk;
}

TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
  const TfLiteTensor* input = GetInput(context, node, kInput);
  const TfLiteTensor* input_state = GetInput(context, node, kInputState);
  const TfLiteTensor* gate_weight = GetInput(context, node, kGateWeight);
  const TfLiteTensor* gate_bias = GetInput(context, node, kGateBias);
  const TfLiteTensor* candidate_weight =
      GetInput(context, node, kCandidateWeight);
  const TfLiteTensor* candidate_bias = GetInput(context, node, kCandidateBias);
  TfLiteTensor* output = GetOutput(context, node, kOutput);
  TfLiteTensor* output_state = GetOutput(context, node, kOutputState);
  TfLiteTensor* activation = GetTemporary(context, node, kActivation);
  TfLiteTensor* concat = GetTemporary(context, node, kConcat);
  auto cpu_backend_context = CpuBackendContext::GetFromContext(context);

  if (gate_weight->type == kTfLiteFloat32) {
    GruImpl(input, input_state, gate_weight, gate_bias, candidate_weight,
            candidate_bias, output, output_state, activation, concat,
            cpu_backend_context);
  } else {
    context->ReportError(context,
                         "Unsupported combination of data types for GruCell");
    return kTfLiteError;
  }

  return kTfLiteOk;
}

}  // namespace unidirectional_sequence_gru

TfLiteRegistration* Register_UNIDIRECTIONAL_SEQUENCE_GRU() {
  static TfLiteRegistration r = {
      unidirectional_sequence_gru::Init, unidirectional_sequence_gru::Free,
      unidirectional_sequence_gru::Prepare, unidirectional_sequence_gru::Eval};
  return &r;
}

}  // namespace experimental
}  // namespace ops
}  // namespace tflite


text:
from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

from . import movies
from . import politics
from . import weather

api = movies.add_resources(api)
api = politics.add_resources(api)
api = weather.add_resources(api)


text:
This module manages Oracle Java7.

This module has been tested against 3.0.1 on Ubuntu 12.04 and Debian 6.

Pull requests to add support for other operating systems are welcome.

*NOTE:* This module may only be used if you agree to the Oracle license: http://www.oracle.com/technetwork/java/javase/terms/license/

### Usage

    include java7

### Author
* Scott Smerchek <scott.smerchek@softekinc.com>

### Contributors:
* flosell: Added Debian 6 support


text:
using System;

namespace HomeMadeFood.Web.Common.Messaging
{
    [Serializable]
    public class ToastMessage
    {
        public string Title { get; set; }

        public string Message { get; set; }

        public ToastType ToastType { get; set; }

        public bool IsSticky { get; set; }
    }
}


text:
{% extends "siteTemplate.html" %} {% load staticfiles %}

{% block content %}

{{ content }}
{% endblock %}


text:
<?php

namespace DoctrineModuleTest\Validator\Adapter;

use stdClass;
use PHPUnit_Framework_TestCase as BaseTestCase;
use DoctrineModule\Validator\UniqueObject;

/**
 * Tests for the UniqueObject validator
 *
 * @license MIT
 * @link    http://www.doctrine-project.org/
 * @author  Oskar Bley <oskar@programming-php.net>
 */
class UniqueObjectTest extends BaseTestCase
{
    public function testCanValidateWithNotAvailableObjectInRepository()
    {
        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue(null));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey',
            )
        );
        $this->assertTrue($validator->isValid('matchValue'));
    }

    public function testCanValidateIfThereIsTheSameObjectInTheRepository()
    {
        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierFieldNames')
            ->will($this->returnValue(array('id')));
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierValues')
            ->with($match)
            ->will($this->returnValue(array('id' => 'identifier')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
                      ->method('getClassMetadata')
                      ->with('stdClass')
                      ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey'
            )
        );
        $this->assertTrue($validator->isValid(array('matchKey' => 'matchValue', 'id' => 'identifier')));
    }

    public function testCannotValidateIfThereIsAnotherObjectWithTheSameValueInTheRepository()
    {
        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierFieldNames')
            ->will($this->returnValue(array('id')));
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierValues')
            ->with($match)
            ->will($this->returnValue(array('id' => 'identifier')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
                      ->method('getClassMetadata')
                      ->with('stdClass')
                      ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey'
            )
        );
        $this->assertFalse($validator->isValid(array('matchKey' => 'matchValue', 'id' => 'another identifier')));
    }

    public function testCanFetchIdentifierFromContext()
    {
        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierFieldNames')
            ->will($this->returnValue(array('id')));
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierValues')
            ->with($match)
            ->will($this->returnValue(array('id' => 'identifier')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
                      ->method('getClassMetadata')
                      ->with('stdClass')
                      ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey',
                'use_context'       => true
            )
        );
        $this->assertTrue($validator->isValid('matchValue', array('id' => 'identifier')));
    }

    /**
     * @expectedException \Zend\Validator\Exception\RuntimeException
     * @expectedExceptionMessage Expected context to be an array but is null
     */
    public function testThrowsAnExceptionOnUsedButMissingContext()
    {
        $match = new stdClass();

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey',
                'use_context'       => true
            )
        );
        $validator->isValid('matchValue');
    }

    /**
     * @expectedException \Zend\Validator\Exception\RuntimeException
     * @expectedExceptionMessage Expected context to contain id
     */
    public function testThrowsAnExceptionOnMissingIdentifier()
    {
        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierFieldNames')
            ->will($this->returnValue(array('id')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
                      ->method('getClassMetadata')
                      ->with('stdClass')
                      ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey'
            )
        );
        $validator->isValid('matchValue');
    }

    /**
     * @expectedException \Zend\Validator\Exception\RuntimeException
     * @expectedExceptionMessage Expected context to contain id
     */
    public function testThrowsAnExceptionOnMissingIdentifierInContext()
    {
        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierFieldNames')
            ->will($this->returnValue(array('id')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
                      ->method('getClassMetadata')
                      ->with('stdClass')
                      ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey',
                'use_context'       => true
            )
        );
        $validator->isValid('matchValue', array());
    }

    /**
     * @expectedException \Zend\Validator\Exception\InvalidArgumentException
     * @expectedExceptionMessage Option "object_manager" is required and must be
     *                           an instance of Doctrine\Common\Persistence\ObjectManager, nothing given
     */
    public function testThrowsAnExceptionOnMissingObjectManager()
    {
        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');

        new UniqueObject(
            array(
                'object_repository' => $repository,
                'fields'            => 'matchKey'
            )
        );
    }

    /**
     * @expectedException \Zend\Validator\Exception\InvalidArgumentException
     * @expectedExceptionMessage Option "object_manager" is required and must be
     *                           an instance of Doctrine\Common\Persistence\ObjectManager, nothing given
     */
    public function testThrowsAnExceptionOnWrongObjectManager()
    {
        $objectManager = new stdClass();

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');

        new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey'
            )
        );
    }

    public function testCanValidateWithNotAvailableObjectInRepositoryByDateTimeObject()
    {
        $date       = new \DateTime("17 March 2014");
        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('date' => $date))
            ->will($this->returnValue(null));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'date',
            )
        );

        $this->assertTrue($validator->isValid($date));
    }

    public function testCanFetchIdentifierFromObjectContext()
    {
        $context     = new stdClass();
        $context->id = 'identifier';

        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->at(0))
            ->method('getIdentifierValues')
            ->with($context)
            ->will($this->returnValue(array('id' => 'identifier')));
        $classMetadata
            ->expects($this->at(1))
            ->method('getIdentifierValues')
            ->with($match)
            ->will($this->returnValue(array('id' => 'identifier')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
            ->method('getClassMetadata')
            ->with('stdClass')
            ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey',
                'use_context'       => true
            )
        );

        $this->assertTrue($validator->isValid('matchValue', $context));
    }

    public function testErrorMessageIsStringInsteadArray()
    {
        $match = new stdClass();

        $classMetadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata');
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierFieldNames')
            ->will($this->returnValue(array('id')));
        $classMetadata
            ->expects($this->once())
            ->method('getIdentifierValues')
            ->with($match)
            ->will($this->returnValue(array('id' => 'identifier')));

        $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager');
        $objectManager->expects($this->any())
                      ->method('getClassMetadata')
                      ->with('stdClass')
                      ->will($this->returnValue($classMetadata));

        $repository = $this->getMock('Doctrine\Common\Persistence\ObjectRepository');
        $repository
            ->expects($this->any())
            ->method('getClassName')
            ->will($this->returnValue('stdClass'));
        $repository
            ->expects($this->once())
            ->method('findOneBy')
            ->with(array('matchKey' => 'matchValue'))
            ->will($this->returnValue($match));

        $validator = new UniqueObject(
            array(
                'object_repository' => $repository,
                'object_manager'    => $objectManager,
                'fields'            => 'matchKey',
                'use_context'       => true
            )
        );
        $this->assertFalse(
            $validator->isValid(
                'matchValue',
                array('matchKey' => 'matchValue', 'id' => 'another identifier')
            )
        );
        $messageTemplates = $validator->getMessageTemplates();

        $expectedMessage = str_replace(
            '%value%',
            'matchValue',
            $messageTemplates[UniqueObject::ERROR_OBJECT_NOT_UNIQUE]
        );
        $messages        = $validator->getMessages();
        $receivedMessage = $messages[UniqueObject::ERROR_OBJECT_NOT_UNIQUE];
        $this->assertTrue($expectedMessage == $receivedMessage);

    }
}


text:
/*
 * Glue to code from fsck_msdosfs
 */

#include <err.h>
#include <sys/types.h>
#include "dosfs.h"

#define	FSOK		0		/* Check was OK */
#define	FSBOOTMOD	1		/* Boot block was modified */
#define	FSDIRMOD	2		/* Some directory was modified */
#define	FSFATMOD	4		/* The FAT was modified */
#define	FSERROR		8		/* Some unrecovered error remains */
#define	FSFATAL		16		/* Some unrecoverable error occured */
#define FSDIRTY		32		/* File system is dirty */
#define FSFIXFAT	64		/* Fix file system FAT */

int readboot(int fd, struct bootblock *boot);
int readfat(int fd, struct bootblock *boot, int no, struct fatEntry **fp);
void fat_addskip(struct bootblock *boot, int startcl, int ncl);
off_t fat_lseek(int fd, off_t off, int whence);
ssize_t devread(int fd, void *buf, size_t nbytes);

#define lseek(f,o,w)	fat_lseek((f), (o), (w))
#define read(f,b,s)	devread((f), (b), (s))
#define pfatal		warnx
#define pwarn		warnx

#ifndef __RCSID
#define __RCSID(s)
#endif


text:
class AddUserKeysToEvents < ActiveRecord::Migration[5.1]
  def change
    add_column :events, :user_id, :integer
    add_column :events, :location_id, :integer
    add_column :events, :type_id, :integer
  end
end


text:
package de.fau.cs.mad.fablab.android.view.fragments.productsearch;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.pedrogomez.renderers.Renderer;

import butterknife.Bind;
import butterknife.ButterKnife;
import de.fau.cs.mad.fablab.android.R;
import de.fau.cs.mad.fablab.android.view.common.binding.ViewCommandBinding;

public class ProductSearchViewModelRenderer extends Renderer<ProductSearchViewModel> {

    @Bind(R.id.product_name)
    TextView mProductName;
    @Bind(R.id.product_detail)
    TextView mProductDetail;
    @Bind(R.id.product_price)
    TextView mProductPrice;
    @Bind(R.id.product_unit)
    TextView mProductUnit;
    @Bind(R.id.product_per)
    TextView mProductPer;

    @Override
    protected void setUpView(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    protected void hookListeners(View view) {

    }

    @Override
    protected View inflate(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        return layoutInflater.inflate(R.layout.product_entry, viewGroup, false);
    }

    @Override
    public void render() {
        ProductSearchViewModel viewModel = getContent();

        new ViewCommandBinding().bind(getRootView(), viewModel.getShowDialogCommand());

        mProductName.setText(viewModel.getName());
        mProductDetail.setText(viewModel.getNameDetails());
        mProductPrice.setText(viewModel.getPrice());
        mProductUnit.setText(viewModel.getUnit());

        if(viewModel.isProductZeroPriced()){
            mProductName.setTextColor(mProductName.getResources().getColor(R.color
                    .primary_text_disabled_material_light));
            mProductDetail.setTextColor(mProductDetail.getResources().getColor(R.color
                    .primary_text_disabled_material_light));
            mProductPrice.setTextColor(mProductPrice.getResources().getColor(R.color
                    .primary_text_disabled_material_light));
            mProductPer.setTextColor(mProductPer.getResources().getColor(R.color
                    .primary_text_disabled_material_light));
            mProductUnit.setTextColor(mProductUnit.getResources().getColor(R.color
                    .primary_text_disabled_material_light));
        } else {
            mProductName.setTextColor(mProductName.getResources().getColor(R.color
                    .primary_text_default_material_light));
            mProductDetail.setTextColor(mProductDetail.getResources().getColor(R.color
                    .primary_text_default_material_light));
            mProductPrice.setTextColor(mProductPrice.getResources().getColor(R.color
                    .primary_text_default_material_light));
            mProductPer.setTextColor(mProductPer.getResources().getColor(R.color
                    .primary_text_default_material_light));
            mProductUnit.setTextColor(mProductUnit.getResources().getColor(R.color
                    .primary_text_default_material_light));
        }
    }
}


text:
package org.apache.ignite.internal.processors.query.h2;

import java.io.Serializable;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
import java.util.Objects;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;

/**
 * Tests queries against entities with JSR-310 Java 8 Date and Time API fields.
 */
public class CacheQueryEntityWithJsr310Java8DateTimeApiFieldsTest extends CacheQueryJsr310Java8DateTimeApiAbstractTest {
    /**
     * Entity containing JSR-310 fields.
     */
    private static class EntityWithJsr310Fields implements Serializable {

        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        /** ID. */
        @QuerySqlField(index = true)
        private Long id;

        /** {@link LocalTime} field. */
        @QuerySqlField(index = true)
        private LocalTime locTime;

        /** {@link LocalDate} field. */
        @QuerySqlField(index = true)
        private LocalDate locDate;

        /** {@link LocalDateTime} field. */
        @QuerySqlField(index = true)
        private LocalDateTime locDateTime;

        /**
         * Default constructor.
         */
        EntityWithJsr310Fields() {
        }

        /**
         * Copy constructor.
         *
         * @param entity Entity to copy from.
         */
        EntityWithJsr310Fields(EntityWithJsr310Fields entity) {
            id = entity.id;
            locTime = LocalTime.from(entity.locTime);
            locDate = LocalDate.from(entity.locDate);
            locDateTime = LocalDateTime.from(entity.locDateTime);
        }

        /**
         * Constructor.
         *
         * @param id ID.
         * @param locTime {@link LocalTime} value.
         * @param locDate {@link LocalDate} value.
         * @param locDateTime {@link LocalDateTime} value.
         */
        EntityWithJsr310Fields(Long id, LocalTime locTime, LocalDate locDate, LocalDateTime locDateTime) {
            this.id = id;
            this.locTime = locTime;
            this.locDate = locDate;
            this.locDateTime = locDateTime;
        }

        /**
         * Returns the ID.
         *
         * @return ID.
         */
        public Long getId() {
            return id;
        }

        /**
         * Sets the ID.
         *
         * @param id ID.
         */
        public void setId(Long id) {
            this.id = id;
        }

        /**
         * Returns the {@link LocalDateTime} field value
         *
         * @return {@link LocalDateTime} field value;
         */
        public LocalDateTime getLocalDateTime() {
            return locDateTime;
        }

        /**
         * Returns the {@link LocalDateTime} field value.
         *
         * @param locDateTime {@link LocalDateTime} value.
         */
        public void setLocalDateTime(LocalDateTime locDateTime) {
            this.locDateTime = locDateTime;
        }

        /**
         * Returns the {@link LocalDate} field value.
         *
         * @return {@link LocalDate} field value.
         */
        public LocalDate getLocalDate() {
            return locDate;
        }

        /**
         * Sets the {@link LocalDate} field value.
         *
         * @param locDate {@link LocalDate} value.
         */
        public void setLocalDate(LocalDate locDate) {
            this.locDate = locDate;
        }

        /**
         * Returns the {@link LocalTime} field value.
         *
         * @return {@link LocalTime} field value.
         */
        public LocalTime getLocalTime() {
            return locTime;
        }

        /**
         * Sets the {@link LocalTime} field value.
         *
         * @param locTime {@link LocalTime} value.
         */
        public void setLocalTime(LocalTime locTime) {
            this.locTime = locTime;
        }

        /** {@inheritDoc} */
        @Override public boolean equals(Object o) {
            if (this == o)
                return true;

            if (o == null || getClass() != o.getClass())
                return false;

            EntityWithJsr310Fields fields = (EntityWithJsr310Fields)o;

            return Objects.equals(id, fields.id) && Objects.equals(locDateTime, fields.locDateTime) &&
                Objects.equals(locDate, fields.locDate) && Objects.equals(locTime, fields.locTime);
        }

        /** {@inheritDoc} */
        @Override public int hashCode() {
            return Objects.hash(id, locDateTime, locDate, locTime);
        }

        /** {@inheritDoc} */
        @Override public String toString() {
            return "EntityWithJsr310Fields{" + "id=" + id + ", locDateTime=" + locDateTime + ", locDate=" + locDate +
                ", locTime=" + locTime + '}';
        }
    }

    /** Cache. */
    private IgniteCache<Long, EntityWithJsr310Fields> cache;

    /** Entity with JSR-310 fields instance. */
    private final EntityWithJsr310Fields entity =
        new EntityWithJsr310Fields(1L, LOCAL_TIME, LOCAL_DATE, LOCAL_DATE_TIME);

    /**
     * Creates a cache configuration.
     *
     * @return Cache configuration.
     */
    private static CacheConfiguration<Long, EntityWithJsr310Fields> createCacheConfig() {
        return createCacheConfig(
            "entityWithJava8DataTimeFields", Long.class, EntityWithJsr310Fields.class
        );
    }

    /** {@inheritDoc} */
    @Override protected void beforeTest() throws Exception {
        Ignite ignite = startGridsMultiThreaded(1, true);
        cache = ignite.getOrCreateCache(createCacheConfig());

        cache.put(entity.getId(), entity);
    }

    /**
     * Tests insertion of an entity.
     *
     * @throws Exception If failed.
     */
    public void testInsertEntityFields() throws Exception {
        cache.remove(entity.getId());

        assertEquals(0, cache.size());

        SqlFieldsQuery qry = new SqlFieldsQuery(
            "insert into EntityWithJsr310Fields(_key, id, locTime, locDate, locDateTime) values(?, ?, ?, ?, ?)"
        ).setArgs(
            entity.getId(), entity.getId(), entity.getLocalTime(), entity.getLocalDate(), entity.getLocalDateTime()
        );

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(1L, qryResults.get(0).get(0));
        assertEquals(1, cache.size());
        assertEquals(entity, cache.get(entity.getId()));
    }

    /**
     * Tests that DATEDIFF SQL function works for {@link LocalDateTime}
     * fields with the time part set to midnight.
     *
     * @throws Exception If failed.
     */
    public void testDateDiffForLocalDateTimeFieldAtMidnight() throws Exception {
        SqlFieldsQuery qry =
            new SqlFieldsQuery("select DATEDIFF('DAY', locDateTime, CURRENT_DATE ()) from EntityWithJsr310Fields");

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertTrue((Long)qryResults.get(0).get(0) >= DAYS_BEFORE_NOW);
    }

    /**
     * Tests that selection for a {@link LocalTime} field returns {@link Time}.
     *
     * @throws Exception If failed.
     */
    public void testSelectLocalTimeFieldReturnsTime() throws Exception {
        SqlFieldsQuery qry = new SqlFieldsQuery("select locTime from EntityWithJsr310Fields");

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(Time.class, qryResults.get(0).get(0).getClass());
    }

    /**
     * Tests that selection for a {@link LocalDate} field returns {@link Date}.
     *
     * @throws Exception If failed.
     */
    public void testSelectLocalDateFieldReturnsDate() throws Exception {
        SqlFieldsQuery qry = new SqlFieldsQuery("select locDate from EntityWithJsr310Fields");

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(Date.class, qryResults.get(0).get(0).getClass());
    }

    /**
     * Tests that selection for a {@link LocalDateTime} field returns {@link Timestamp}.
     *
     * @throws Exception If failed.
     */
    public void testSelectLocalDateTimeFieldReturnsTimestamp() throws Exception {
        SqlFieldsQuery qry = new SqlFieldsQuery("select locDateTime from EntityWithJsr310Fields");

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(Timestamp.class, qryResults.get(0).get(0).getClass());
    }

    /**
     * Tests selection of an entity by a {@link LocalTime} field.
     */
    public void testSelectByAllJsr310Fields() {
        SqlFieldsQuery qry = new SqlFieldsQuery(
            "select locDate from EntityWithJsr310Fields where locTime = ? and locDate = ? and locDateTime = ?"
        ).setArgs(entity.getLocalTime(), entity.getLocalDate(), entity.getLocalDateTime());

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(Date.valueOf(entity.getLocalDate()), qryResults.get(0).get(0));
    }

    /**
     * Tests updating of all JSR-310 fields.
     */
    public void testUpdateAllJsr310Fields() {
        EntityWithJsr310Fields expEntity = new EntityWithJsr310Fields(entity);

        expEntity.setLocalTime(expEntity.getLocalTime().plusHours(1));
        expEntity.setLocalDate(expEntity.getLocalDate().plusDays(1));
        expEntity.setLocalDateTime(LocalDateTime.of(expEntity.getLocalDate(), expEntity.getLocalTime()));

        SqlFieldsQuery qry = new SqlFieldsQuery(
            "update EntityWithJsr310Fields set locTime = ?, locDate = ?, locDateTime = ? where id = ?"
        ).setArgs(expEntity.getLocalTime(), expEntity.getLocalDate(), expEntity.getLocalDateTime(), entity.getId());

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(1L, qryResults.get(0).get(0));
        assertEquals(expEntity, cache.get(expEntity.getId()));
    }

    /**
     * Tests deleting by all JSR-310 fields.
     */
    public void testDeleteByAllJsr310Fields() {
        SqlFieldsQuery qry = new SqlFieldsQuery(
            "delete from EntityWithJsr310Fields where locTime = ? and locDate = ? and locDateTime = ?"
        ).setArgs(entity.getLocalTime(), entity.getLocalDate(), entity.getLocalDateTime());

        List<List<?>> qryResults = cache.query(qry).getAll();

        assertEquals(1, qryResults.size());
        assertEquals(1L, qryResults.get(0).get(0));
        assertEquals(0, cache.size());
    }
}


text:
<?php

namespace backend\modules\reclame_template\controllers;

use common\models\db\ReclameZone;
use Yii;
use backend\modules\reclame_template\models\ReclameTemplate;
use backend\modules\reclame_template\models\ReclameTemplateSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * Reclame_templateController implements the CRUD actions for ReclameTemplate model.
 */
class Reclame_templateController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

    /**
     * Lists all ReclameTemplate models.
     * @return mixed
     */
    public function actionIndex()
    {
        $searchModel = new ReclameTemplateSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

    /**
     * Displays a single ReclameTemplate model.
     * @param integer $id
     * @return mixed
     */
    public function actionView($id)
    {
        return $this->render('view', [
            'model' => $this->findModel($id),
        ]);
    }

    /**
     * Creates a new ReclameTemplate model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new ReclameTemplate();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['index']);
        } else {

            $zone = ReclameZone::find()->all();

            return $this->render('create', [
                'model' => $model,
                'zone' => $zone,
            ]);
        }
    }

    /**
     * Updates an existing ReclameTemplate model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
    public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['index']);
        } else {
            $zone = ReclameZone::find()->all();
            return $this->render('update', [
                'model' => $model,
                'zone' => $zone,
            ]);
        }
    }

    /**
     * Deletes an existing ReclameTemplate model.
     * If deletion is successful, the browser will be redirected to the 'index' page.
     * @param integer $id
     * @return mixed
     */
    public function actionDelete($id)
    {
        $this->findModel($id)->delete();

        return $this->redirect(['index']);
    }

    /**
     * Finds the ReclameTemplate model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param integer $id
     * @return ReclameTemplate the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    protected function findModel($id)
    {
        if (($model = ReclameTemplate::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
}


text:
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

const CONFIG_TYPE_TEXT = 0;
const CONFIG_TYPE_SELECT = 1;

const CONFIG_MAP_REFRESH_INTERVAL = 1;
const CONFIG_SNMP2_READ_COMM = 2;
const CONFIG_SNMP2_WRITE_COMM = 3;
const CONFIG_MAP_SOURCE = 4;

const CONFIG_MAP_SOURCE_ONLINE = 0;
const CONFIG_MAP_SOURCE_LOCAL = 1;

class CONFIG_MGR {

    private static $initialized = false;

    private static $cache ;

    public static function GET($config_id) {
        self::initialize();
        return self::$cache[$config_id];
    }

    public static function SET($config_id, $value) {
        self::initialize();
        self::$cache[$config_id] = $value;
    }

    private static function initialize() {
        if (self::$initialized)
            return;

        /*Init cache*/
        include("db_connect.php");
        self::$cache = array();
        $result = $mysqli->query("SELECT objid,p_value  FROM meta_config");
        while ($row = mysqli_fetch_array($result, MYSQL_ASSOC) ) {
            self::$cache[$row['objid']] = $row['p_value'];
        }
         mysqli_close($mysqli);

        self::$initialized = true;
        //place holder for constructor activities
    }

}

?>


text:
import { alias } from '@ember/object/computed';
import { get } from '@ember/object'
import Controller, { inject as controller } from '@ember/controller';

export default Controller.extend({
  projectController: controller('authenticated.project'),

  sortBy:       'name',
  headers: [
    {
      name:           'state',
      sort:           ['sortState', 'name', 'id'],
      translationKey: 'generic.state',
      width:          125,
    },
    {
      name:           'name',
      sort:           ['name', 'id'],
      translationKey: 'generic.name',
    },
    {
      name:           'cn',
      searchField:    ['cn'],
      sort:           ['cn', 'id'],
      translationKey: 'certificatesPage.domainNames.labelText',
    },
    {
      name:           'expires',
      sort:           ['expiresDate', 'id'],
      translationKey: 'certificatesPage.expires',
      width:          120,
    },
  ],

  group:        alias('projectController.group'),
  groupTableBy: alias('projectController.groupTableBy'),

  rows: function() {
    const proj = get(this, 'model.projectCerts').slice();
    const ns = get(this, 'model.namespacedCerts').slice();
    const out = proj.concat(ns);

    return out;
  }.property('model.projectCerts.[]', 'model.namespacedCerts.[]'),
});


text:
<!DOCTYPE HTML>

Test that a linked stylesheet with a crossorigin attribute does not load a cross-origin resource that isn't CORS enabled.

<link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/security/resources/green-background.css?1" onload="fail(this)" onerror="pass()">
<link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080/security/resources/green-background.css?2" onload="fail(this)" onerror="pass()">

<link crossorigin="anonymous" rel="stylesheet" href="http://localhost:8080/security/resources/green-background.css?1" onload="fail(this)" onerror="pass()">
<link crossorigin="use-credentials" rel="stylesheet" href="http://localhost:8080/security/resources/green-background.css?2" onload="fail(this)" onerror="pass()">

<link crossorigin="anonymous" rel="stylesheet" href="resources/green-background.css?3" onload="pass()" onerror="fail(this)">
<link crossorigin="use-credentials" rel="stylesheet" href="resources/green-background.css?4" onload="pass()" onerror="fail(this)">


text:
:mod:`smart_rider` Module
-------------------------

.. automodule:: transperth.smart_rider.smart_rider
    :members:
    :undoc-members:
    :show-inheritance:


text:
import collections

with_class = collections.namedtuple(
    'Person', 'name class age',
    rename=True)
print(with_class._fields)

two_ages = collections.namedtuple(
    'Person', 'name age age',
    rename=True)
print(two_ages._fields)


text:
//
// Library initialization file
//

#include "precomp.hpp"

IPP_INITIALIZER_AUTO

/* End of file. */


text:
module ActiveRecordExtension

  extend ActiveSupport::Concern

  # add your instance methods here
  # def foo
  #    "foo"
  # end

  # add your static(class) methods here
  module ClassMethods

    def icon
      'fa-pencil'
    end

    def protected_attributes
      ['id', 'created_at', 'updated_at']
    end

    def displayable_cols
      self.new.attributes.keys - protected_attributes
    end

    def editable_cols
      displayable_cols - ['created_at', 'updated_at']
    end

    def sortable_cols
      displayable_cols
    end

    def default_sort_cols
      # [[:id, 'ASC']]
      []
    end

    def hidden_cols
      []
    end

    def nested_cols
      res = ActiveSupport::OrderedHash.new

      cols = self.nested_attributes_options.keys.compact
      cols.each do |col|
        self.reflect_on_all_associations.each do |r|
          name = r.name.to_s
          col_name = col.to_s.gsub('_attributes', '')
          if name == col_name
            res[name] = (r.options[:class_name] ? r.options[:class_name] : col_name.to_s.singularize.camelize)
          end
        end
      end

      res
    end

    def all_associations(macro=nil)
      self.reflect_on_all_associations(macro)
    end

    def all_associations_names(macro=nil)
      all_associations(macro).collect(&:name)
    end

    def all_associations_ids(macro=nil)
      res = []
      all_associations(macro).each do |association|
        if association.options and association.options[:foreign_key]
          res << association.options[:foreign_key]
        else
          res << association.name.to_s.foreign_key.to_sym
        end
      end
      res
    end

    # DEPRECATED
    def belongs_to_associations
      self.reflect_on_all_associations(:belongs_to).collect(&:name)
    end

    # DEPRECATED
    def has_many_associations
      self.reflect_on_all_associations(:has_many).collect(&:name)
    end

  end
end

# include the extension
ActiveRecord::Base.send(:include, ActiveRecordExtension)


text:
function v = thermalDiffCoeffs(a)
% THERMALDIFFCOEFFS  Get the thermal diffusion coefficients.
% v = thermalDiffCoeffs(a)
% Object ``a`` must belong to a class derived from
% Transport, and that was constructed by specifying the ``'Multi'``
% option. If ``'Multi'`` was not specified, the returned values will
% all be zero.
%
% :param a:
%     Instance of class :mat:func:`Transport` (or another
%     object derived from Transport)
%     for which the thermal diffusion coefficients are desired.
% :return:
%     Vector of thermal diffusion coefficients of length nSpecies
%

v = trans_get(a.id, 12, nSpecies(a.th));


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Ejercicio2_11c</string>
    <string name="btnSalir">Salir</string>
    <string name="color">Elige un color...</string>
    <string name="rojo">Rojo</string>
    <string name="verde">Verde</string>
    <string name="azul">Azul</string>

</resources>


text:
<com.tle.beans.item.Item>
  <id>30131</id>
  <uuid>88068f6c-4c75-de8a-50f2-7028f2ba152b</uuid>
  <version>1</version>
  <owner>TLE_ADMINISTRATOR</owner>
  <dateModified class="sql-timestamp">2005-10-03 16:28:37.0</dateModified>
  <dateCreated class="sql-timestamp">2003-07-15 10:28:21.0</dateCreated>
  <dateForIndex class="sql-timestamp">1970-01-01 11:00:00.143</dateForIndex>
  <rating>-1.0</rating>
  <moderating>false</moderating>
  <status>LIVE</status>
  <attachments>
    <com.tle.beans.item.attachments.FileAttachment>
      <id>30143</id>
      <uuid>7b4a49e3-256a-48bf-8a7c-dd61d338f4c9</uuid>
      <url>titration1.gif</url>
      <description>titration1.gif</description>
      <value1>1</value1>
      <value2>false</value2>
      <preview>false</preview>
      <restricted>false</restricted>
    </com.tle.beans.item.attachments.FileAttachment>
  </attachments>
  <searchDetails/>
  <itemDefinition entityclass="com.tle.beans.entity.itemdef.ItemDefinition" uuid="01d4757e-b10e-788d-a713-176427d4f90c"/>
  <collaborators/>
  <referencedUrls/>
  <moderation>
    <id>30137</id>
    <start class="sql-timestamp">2011-09-20 10:58:39.013</start>
    <resumeModerating>false</resumeModerating>
    <unarchiveModerating>false</unarchiveModerating>
    <deletedModerating>false</deletedModerating>
    <needsReset>false</needsReset>
    <statuses/>
  </moderation>
  <history/>
  <comments/>
  <sharePasses/>
  <acceptances/>
  <treeNodes/>
  <notifications/>
  <name>
    <id>30139</id>
    <strings>
      <entry>
        <string>en</string>
        <com.tle.beans.entity.LanguageString>
          <id>30140</id>
          <locale>en</locale>
          <priority>1</priority>
          <text>titration1.gif</text>
          <bundle reference="../../../.."/>
        </com.tle.beans.entity.LanguageString>
      </entry>
    </strings>
  </name>
  <description>
    <id>30133</id>
    <strings>
      <entry>
        <string>en</string>
        <com.tle.beans.entity.LanguageString>
          <id>30134</id>
          <locale>en</locale>
          <priority>1</priority>
          <text>This item is used by Titration.</text>
          <bundle reference="../../../.."/>
        </com.tle.beans.entity.LanguageString>
      </entry>
    </strings>
  </description>
  <totalFileSize>36564</totalFileSize>
  <navigationSettings>
    <showNextPrev>false</showNextPrev>
    <showSplitOption>false</showSplitOption>
    <manualNavigation>false</manualNavigation>
  </navigationSettings>
  <thumb>initial</thumb>
</com.tle.beans.item.Item>


text:
package pro.redsoft.iframework.client.strategy;

/**
 * Strategy. Defines class-specific behaviour processing.
 *
 * @param <T>
 *          any type
 * @author alex oreshkevich
 * @version $Id: $Id
 */
public interface Strategy<T extends Object> {

  /**
   *
doAction.

   *
   * @param bean a T object.
   */
  void doAction(T bean);

  /**
   *
getBeanType.

   *
   * @return a {@link java.lang.Class} object.
   */
  Class<T> getBeanType();
}


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

namespace BookmarksManager
{
    public class BookmarkLink : IBookmarkLink
    {
        public string Title { get; set; }
        public string Url { get; set; }

        /// <summary>
        /// URL of RSS feed
        /// </summary>
        public string FeedUrl { get; set; }

        /// <summary>
        ///     favicon URL
        /// </summary>
        public string IconUrl { get; set; }

        /// <summary>
        ///     favicon content if it's embedded icon
        /// </summary>
        public byte[] IconData { get; set; }

        /// <summary>
        ///     favicon content type if it's embedded icon
        /// </summary>
        public string IconContentType { get; set; }

        public DateTime? LastVisit { get; set; }
        public DateTime? LastModified { get; set; }
        public DateTime? Added { get; set; }
        public string Description { get; set; }

        public IDictionary<string, string> Attributes = new Dictionary<string, string>();

        public BookmarkLink(string url = null, string title = null)
        {
            Url = url;
            Title = title;
        }

        public BookmarkLink(Uri url, string title = null)
        {
            if (url == null)
                throw new ArgumentNullException(nameof(url));
            Url = url.AbsoluteUri;
            Title = title;
        }

        public override string ToString()
        {
            return $"{Title} ({Url})";
        }
    }
}


text:
package org.apache.hadoop.tools.rumen;
import org.apache.hadoop.mapreduce.JobID;

/**
 * Event to record the change of status for a job
 *
 */
public class JobStatusChangedEvent implements HistoryEvent {
  private JobID jobId;
  private String jobStatus;

  /**
   * Create an event to record the change in the Job Status
   * @param id Job ID
   * @param jobStatus The new job status
   */
  public JobStatusChangedEvent(JobID id, String jobStatus) {
    this.jobId = id;
    this.jobStatus = jobStatus;
  }

  /** Get the Job Id */
  public JobID getJobId() { return jobId; }
  /** Get the event status */
  public String getStatus() { return jobStatus; }
  /** Get the event type */
  public EventType getEventType() {
    return EventType.JOB_STATUS_CHANGED;
  }

}