text:
<?php
/**
 * TOP API: taobao.app.subapp.apply request
 *
 * @author auto create
 * @since 1.0, 2011.08.25
 */
class AppSubappApplyRequest
{
	/**
	 * 子应用回调地址,主要用于获取SessionKey等回调参数。比如:http://taobao.com/api/test/callback_url.jsp
	 **/
	private $callbackUrl;

	/**
	 * 子应用图标,支持JPG,PNG,GIF格式,大小不超过100KB
	 **/
	private $logo;

	/**
	 * 子应用通知地址,主要用于接收TOP Notify API的调用,目前暂时还用不到。比如:http://taobao.com/api/test/notify_url.jsp
	 **/
	private $notifyUrl;

	/**
	 * 父应用的appkey
	 **/
	private $parentAppKey;

	/**
	 * 申请子应用需要用户开通的服务码。比如:APP_SERVICE_SHOPEX(ShopEx店掌柜独立网店系统)
	 **/
	private $serviceCode;

	/**
	 * 子应用的标题,最大长度为24个字节。比如:旺旺子应用
	 **/
	private $title;

	private $apiParas = array();

	public function setCallbackUrl($callbackUrl)
	{
		$this->callbackUrl = $callbackUrl;
		$this->apiParas["callback_url"] = $callbackUrl;
	}

	public function getCallbackUrl()
	{
		return $this->callbackUrl;
	}

	public function setLogo($logo)
	{
		$this->logo = $logo;
		$this->apiParas["logo"] = $logo;
	}

	public function getLogo()
	{
		return $this->logo;
	}

	public function setNotifyUrl($notifyUrl)
	{
		$this->notifyUrl = $notifyUrl;
		$this->apiParas["notify_url"] = $notifyUrl;
	}

	public function getNotifyUrl()
	{
		return $this->notifyUrl;
	}

	public function setParentAppKey($parentAppKey)
	{
		$this->parentAppKey = $parentAppKey;
		$this->apiParas["parent_app_key"] = $parentAppKey;
	}

	public function getParentAppKey()
	{
		return $this->parentAppKey;
	}

	public function setServiceCode($serviceCode)
	{
		$this->serviceCode = $serviceCode;
		$this->apiParas["service_code"] = $serviceCode;
	}

	public function getServiceCode()
	{
		return $this->serviceCode;
	}

	public function setTitle($title)
	{
		$this->title = $title;
		$this->apiParas["title"] = $title;
	}

	public function getTitle()
	{
		return $this->title;
	}

	public function getApiMethodName()
	{
		return "taobao.app.subapp.apply";
	}

	public function getApiParas()
	{
		return $this->apiParas;
	}

	public function check()
	{

		RequestCheckUtil::checkNotNull($this->callbackUrl,"callbackUrl");
		RequestCheckUtil::checkNotNull($this->parentAppKey,"parentAppKey");
		RequestCheckUtil::checkNotNull($this->title,"title");
	}

	public function putOtherTextParam($key, $value) {
		$this->apiParas[$key] = $value;
		$this->$key = $value;
	}
}

redpajama_set_name: RedPajamaGithub


text:
/*	SCCS Id: @(#)display.h	3.4	1999/11/30	*/
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990.					  */
/* NetHack may be freely redistributed.  See license for details. */

#ifndef DISPLAY_H
#define DISPLAY_H

#ifndef VISION_H
#include "vision.h"
#endif

#ifndef MONDATA_H
#include "mondata.h"	/* for mindless() */
#endif

#ifndef INVISIBLE_OBJECTS
#define vobj_at(x,y) (level.objects[x][y])
#endif

/*
 * sensemon()
 *
 * Returns true if the hero can sense the given monster.  This includes
 * monsters that are hiding or mimicing other monsters.
 */
#define tp_sensemon(mon) (	/* The hero can always sense a monster IF:  */\
    (!mindless(mon->data)) &&	/* 1. the monster has a brain to sense AND  */\
      ((Blind && Blind_telepat) ||	/* 2a. hero is blind and telepathic OR	    */\
				/* 2b. hero is using a telepathy inducing   */\
				/*	 object and in range		    */\
      (Unblind_telepat &&					      \
	(distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM))))		      \
)

#define sensemon(mon) (tp_sensemon(mon) || Detect_monsters || MATCH_WARN_OF_MON(mon))

/*
 * mon_warning() is used to warn of any dangerous monsters in your
 * vicinity, and a glyph representing the warning level is displayed.
 */

#define mon_warning(mon) (Warning && !(mon)->mpeaceful && 				\
			 (distu((mon)->mx, (mon)->my) < 100) &&				\
			 (((int) ((mon)->m_lev / 4)) >= flags.warnlevel))

/*
 * mon_visible()
 *
 * Returns true if the hero can see the monster.  It is assumed that the
 * hero can physically see the location of the monster.  The function
 * vobj_at() returns a pointer to an object that the hero can see there.
 * Infravision is not taken into account.
 */
#define mon_visible(mon) (		/* The hero can see the monster     */\
					/* IF the monster		    */\
    (!mon->minvis || See_invisible) &&	/* 1. is not invisible AND	    */\
    (!mon->mundetected) &&		/* 2. not an undetected hider	    */\
    (!(mon->mburied || u.uburied))	/* 3. neither you or it is buried   */\
)

/*
 * see_with_infrared()
 *
 * This function is true if the player can see a monster using infravision.
 * The caller must check for invisibility (invisible monsters are also
 * invisible to infravision), because this is usually called from within
 * canseemon() or canspotmon() which already check that.
 */
#define see_with_infrared(mon) (!Blind && Infravision && infravisible(mon->data) && couldsee(mon->mx, mon->my))

/*
 * canseemon()
 *
 * This is the globally used canseemon().  It is not called within the display
 * routines.  Like mon_visible(), but it checks to see if the hero sees the
 * location instead of assuming it.  (And also considers worms.)
 */
#define canseemon(mon) ((mon->wormno ? worm_known(mon) : \
	    (cansee(mon->mx, mon->my) || see_with_infrared(mon))) \
	&& mon_visible(mon))

/*
 * canspotmon(mon)
 *
 * This function checks whether you can either see a monster or sense it by
 * telepathy, and is what you usually call for monsters about which nothing is
 * known.
 */
#define canspotmon(mon) \
	(canseemon(mon) || sensemon(mon))

/* knowninvisible(mon)
 * This one checks to see if you know a monster is both there and invisible.
 * 1) If you can see the monster and have see invisible, it is assumed the
 * monster is transparent, but visible in some manner.	(Earlier versions of
 * Nethack were really inconsistent on this.)
 * 2) If you can't see the monster, but can see its location and you have
 * telepathy that works when you can see, you can tell that there is a
 * creature in an apparently empty spot.
 * Infravision is not relevant; we assume that invisible monsters are also
 * invisible to infravision.
 */
#define knowninvisible(mon) \
	(mtmp->minvis && \
	    ((cansee(mon->mx, mon->my) && (See_invisible || Detect_monsters)) || \
		(!Blind && (HTelepat & ~INTRINSIC) && \
		    distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM) \
		) \
	    ) \
	)

/*
 * is_safepet(mon)
 *
 * A special case check used in attack() and domove().	Placing the
 * definition here is convenient.
 */
#define is_safepet(mon) \
	(mon && mon->mtame && canspotmon(mon) && flags.safe_dog \
		&& !Confusion && !Hallucination && !Stunned)

/*
 * canseeself()
 * senseself()
 *
 * This returns true if the hero can see her/himself.
 *
 * The u.uswallow check assumes that you can see yourself even if you are
 * invisible.  If not, then we don't need the check.
 */
#define canseeself()	(Blind || u.uswallow || (!Invisible && !u.uundetected))
#define senseself()	(canseeself() || Unblind_telepat || Detect_monsters)

/*
 * random_monster()
 * random_object()
 * random_trap()
 *
 * Respectively return a random monster, object, or trap number.
 */
#define random_monster() rn2(NUMMONS)
#define random_object()  rn1(NUM_OBJECTS-1,1)
#define random_trap()	 rn1(TRAPNUM-1,1)

/*
 * what_obj()
 * what_mon()
 * what_trap()
 *
 * If hallucinating, choose a random object/monster, otherwise, use the one
 * given.
 */
#define what_obj(obj)	(Hallucination ? random_object()  : obj)
#define what_mon(mon)	(Hallucination ? random_monster() : mon)
#define what_trap(trp)	(Hallucination ? random_trap()	  : trp)

/*
 * covers_objects()
 * covers_traps()
 *
 * These routines are true if what is really at the given location will
 * "cover" any objects or traps that might be there.
 */
#define covers_objects(xx,yy)						      \
    ((is_pool(xx,yy) && !Underwater) || (levl[xx][yy].typ == LAVAPOOL))

#define covers_traps(xx,yy)	covers_objects(xx,yy)

/*
 * tmp_at() control calls.
 */
#define DISP_BEAM    (-1)  /* Keep all glyphs showing & clean up at end. */
#define DISP_FLASH   (-2)  /* Clean up each glyph before displaying new one. */
#define DISP_ALWAYS  (-3)  /* Like flash, but still displayed if not visible. */
#define DISP_CHANGE  (-4)  /* Change glyph. */
#define DISP_END     (-5)  /* Clean up. */
#define DISP_FREEMEM (-6)  /* Free all memory during exit only. */

/* Total number of cmap indices in the sheild_static[] array. */
#define SHIELD_COUNT 21

/*
 * display_self()
 *
 * Display the hero.  It is assumed that all checks necessary to determine
 * _if_ the hero can be seen have already been done.
 */
#ifdef STEED
#define maybe_display_usteed	(u.usteed && mon_visible(u.usteed)) ? \
					ridden_mon_to_glyph(u.usteed) :
#else
#define maybe_display_usteed	/* empty */
#endif

#define display_self()							\
    show_glyph(u.ux, u.uy,						\
	maybe_display_usteed			/* else */		\
	youmonst.m_ap_type == M_AP_NOTHING ?				\
				hero_glyph :				\
	youmonst.m_ap_type == M_AP_FURNITURE ?				\
				cmap_to_glyph(youmonst.mappearance) :	\
	youmonst.m_ap_type == M_AP_OBJECT ?				\
				objnum_to_glyph(youmonst.mappearance) : \
	/* else M_AP_MONSTER */ monnum_to_glyph(youmonst.mappearance))

/*
 * A glyph is an abstraction that represents a _unique_ monster, object,
 * dungeon part, or effect.  The uniqueness is important.  For example,
 * It is not enough to have four (one for each "direction") zap beam glyphs,
 * we need a set of four for each beam type.  Why go to so much trouble?
 * Because it is possible that any given window dependent display driver
 * [print_glyph()] can produce something different for each type of glyph.
 * That is, a beam of cold and a beam of fire would not only be different
 * colors, but would also be represented by different symbols.
 *
 * Glyphs are grouped for easy accessibility:
 *
 * monster	Represents all the wild (not tame) monsters.  Count: NUMMONS.
 *
 * pet		Represents all of the tame monsters.  Count: NUMMONS
 *
 * invisible	Invisible monster placeholder.	Count: 1
 *
 * detect	Represents all detected monsters.  Count: NUMMONS
 *
 * corpse	One for each monster.  Count: NUMMONS
 *
 * ridden	Represents all monsters being ridden.  Count: NUMMONS
 *
 * object	One for each object.  Count: NUM_OBJECTS
 *
 * cmap		One for each entry in the character map.  The character map
 *		is the dungeon features and other miscellaneous things.
 *		Count: MAXPCHARS
 *
 * explosions	A set of nine for each of the following seven explosion types:
 *                   dark, noxious, muddy, wet, magical, fiery, frosty.
 *              The nine positions represent those surrounding the hero.
 *		Count: MAXEXPCHARS * EXPL_MAX (EXPL_MAX is defined in hack.h)
 *
 * zap beam	A set of four (there are four directions) for each beam type.
 *		The beam type is shifted over 2 positions and the direction
 *		is stored in the lower 2 bits.	Count: NUM_ZAP << 2
 *
 * swallow	A set of eight for each monster.  The eight positions rep-
 *		resent those surrounding the hero.  The monster number is
 *		shifted over 3 positions and the swallow position is stored
 *		in the lower three bits.  Count: NUMMONS << 3
 *
 * warning	A set of six representing the different warning levels.
 *
 * The following are offsets used to convert to and from a glyph.
 */
#define NUM_ZAP 8	/* number of zap beam types */

#define GLYPH_MON_OFF		0
#define GLYPH_PET_OFF		(NUMMONS	+ GLYPH_MON_OFF)
#define GLYPH_INVIS_OFF		(NUMMONS	+ GLYPH_PET_OFF)
#define GLYPH_DETECT_OFF	(1		+ GLYPH_INVIS_OFF)
#define GLYPH_BODY_OFF		(NUMMONS	+ GLYPH_DETECT_OFF)
#define GLYPH_RIDDEN_OFF	(NUMMONS	+ GLYPH_BODY_OFF)
#define GLYPH_OBJ_OFF		(NUMMONS	+ GLYPH_RIDDEN_OFF)
#define GLYPH_CMAP_OFF		(NUM_OBJECTS	+ GLYPH_OBJ_OFF)
#define GLYPH_EXPLODE_OFF	((MAXPCHARS - MAXEXPCHARS) + GLYPH_CMAP_OFF)
#define GLYPH_ZAP_OFF		((MAXEXPCHARS * EXPL_MAX) + GLYPH_EXPLODE_OFF)
#define GLYPH_SWALLOW_OFF	((NUM_ZAP << 2) + GLYPH_ZAP_OFF)
#define GLYPH_WARNING_OFF	((NUMMONS << 3) + GLYPH_SWALLOW_OFF)
#define MAX_GLYPH		(WARNCOUNT      + GLYPH_WARNING_OFF)

#define NO_GLYPH MAX_GLYPH

#define GLYPH_INVISIBLE GLYPH_INVIS_OFF

#define warning_to_glyph(mwarnlev) ((mwarnlev)+GLYPH_WARNING_OFF)
#define mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_MON_OFF)
#define detected_mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_DETECT_OFF)
#define ridden_mon_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_RIDDEN_OFF)
#define pet_to_glyph(mon) ((int) what_mon(monsndx((mon)->data))+GLYPH_PET_OFF)

/* This has the unfortunate side effect of needing a global variable	*/
/* to store a result. 'otg_temp' is defined and declared in decl.{ch}.	*/
#define obj_to_glyph(obj)						      \
    (Hallucination ?							      \
	((otg_temp = random_object()) == CORPSE ?			      \
	    random_monster() + GLYPH_BODY_OFF :				      \
	    otg_temp + GLYPH_OBJ_OFF)	:				      \
	((obj)->otyp == CORPSE ?					      \
	    (int) (obj)->corpsenm + GLYPH_BODY_OFF :			      \
	    (int) (obj)->otyp + GLYPH_OBJ_OFF))

#define cmap_to_glyph(cmap_idx) ((int) (cmap_idx)   + GLYPH_CMAP_OFF)
#define explosion_to_glyph(expltype,idx)	\
		((((expltype) * MAXEXPCHARS) + ((idx) - S_explode1)) + GLYPH_EXPLODE_OFF)

#define trap_to_glyph(trap)	\
			cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp)))

/* Not affected by hallucination.  Gives a generic body for CORPSE */
#define objnum_to_glyph(onum)	((int) (onum) + GLYPH_OBJ_OFF)
#define monnum_to_glyph(mnum)	((int) (mnum) + GLYPH_MON_OFF)
#define detected_monnum_to_glyph(mnum)	((int) (mnum) + GLYPH_DETECT_OFF)
#define ridden_monnum_to_glyph(mnum)	((int) (mnum) + GLYPH_RIDDEN_OFF)
#define petnum_to_glyph(mnum)	((int) (mnum) + GLYPH_PET_OFF)

/* The hero's glyph when seen as a monster.
 */
#define hero_glyph \
	monnum_to_glyph((Upolyd || !iflags.showrace) ? u.umonnum : \
	                (flags.female && urace.femalenum != NON_PM) ? urace.femalenum : \
	                urace.malenum)

/*
 * Change the given glyph into it's given type.  Note:
 *	1) Pets, detected, and ridden monsters are animals and are converted
 *	   to the proper monster number.
 *	2) Bodies are all mapped into the generic CORPSE object
 *	3) If handed a glyph out of range for the type, these functions
 *	   will return NO_GLYPH (see exception below)
 *	4) glyph_to_swallow() does not return a showsyms[] index, but an
 *	   offset from the first swallow symbol.  If handed something
 *	   out of range, it will return zero (for lack of anything better
 *	   to return).
 */
#define glyph_to_mon(glyph)						\
	(glyph_is_normal_monster(glyph) ? ((glyph)-GLYPH_MON_OFF) :	\
	glyph_is_pet(glyph) ? ((glyph)-GLYPH_PET_OFF) :			\
	glyph_is_detected_monster(glyph) ? ((glyph)-GLYPH_DETECT_OFF) :	\
	glyph_is_ridden_monster(glyph) ? ((glyph)-GLYPH_RIDDEN_OFF) :	\
	NO_GLYPH)
#define glyph_to_obj(glyph)						\
	(glyph_is_body(glyph) ? CORPSE :				\
	glyph_is_normal_object(glyph) ? ((glyph)-GLYPH_OBJ_OFF) :	\
	NO_GLYPH)
#define glyph_to_trap(glyph)						\
	(glyph_is_trap(glyph) ?						\
		((int) defsym_to_trap((glyph) - GLYPH_CMAP_OFF)) :	\
	NO_GLYPH)
#define glyph_to_cmap(glyph)						\
	(glyph_is_cmap(glyph) ? ((glyph) - GLYPH_CMAP_OFF) :		\
	NO_GLYPH)
#define glyph_to_swallow(glyph)						\
	(glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : \
	0)
#define glyph_to_warning(glyph)						\
	(glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) :	\
	NO_GLYPH);

/*
 * Return true if the given glyph is what we want.  Note that bodies are
 * considered objects.
 */
#define glyph_is_monster(glyph)						\
		(glyph_is_normal_monster(glyph)				\
		|| glyph_is_pet(glyph)					\
		|| glyph_is_ridden_monster(glyph)			\
		|| glyph_is_detected_monster(glyph))
#define glyph_is_normal_monster(glyph)					\
    ((glyph) >= GLYPH_MON_OFF && (glyph) < (GLYPH_MON_OFF+NUMMONS))
#define glyph_is_pet(glyph)						\
    ((glyph) >= GLYPH_PET_OFF && (glyph) < (GLYPH_PET_OFF+NUMMONS))
#define glyph_is_body(glyph)						\
    ((glyph) >= GLYPH_BODY_OFF && (glyph) < (GLYPH_BODY_OFF+NUMMONS))
#define glyph_is_ridden_monster(glyph)					\
    ((glyph) >= GLYPH_RIDDEN_OFF && (glyph) < (GLYPH_RIDDEN_OFF+NUMMONS))
#define glyph_is_detected_monster(glyph)				\
    ((glyph) >= GLYPH_DETECT_OFF && (glyph) < (GLYPH_DETECT_OFF+NUMMONS))
#define glyph_is_invisible(glyph) ((glyph) == GLYPH_INVISIBLE)
#define glyph_is_normal_object(glyph)					\
    ((glyph) >= GLYPH_OBJ_OFF && (glyph) < (GLYPH_OBJ_OFF+NUM_OBJECTS))
#define glyph_is_object(glyph)						\
		(glyph_is_normal_object(glyph)				\
		|| glyph_is_body(glyph))
#define glyph_is_trap(glyph)						\
    ((glyph) >= (GLYPH_CMAP_OFF+trap_to_defsym(1)) &&			\
     (glyph) <	(GLYPH_CMAP_OFF+trap_to_defsym(1)+TRAPNUM))
#define glyph_is_cmap(glyph)						\
    ((glyph) >= GLYPH_CMAP_OFF && (glyph) < (GLYPH_CMAP_OFF+MAXPCHARS))
#define glyph_is_swallow(glyph) \
    ((glyph) >= GLYPH_SWALLOW_OFF && (glyph) < (GLYPH_SWALLOW_OFF+(NUMMONS << 3)))
#define glyph_is_warning(glyph)	\
    ((glyph) >= GLYPH_WARNING_OFF && (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT))
#endif /* DISPLAY_H */


text:
/* No explicit types on Javascript */
/* You have to use Typescript instead */
var explicitDouble = 70;


text: Just playing around with Netty. Check `io.netty.example.*` for official examples.


text:
import sys

PY2 = sys.version_info[0] == 2

def with_metaclass(meta, *bases):
    class metaclass(meta):
        __call__ = type.__call__
        __init__ = type.__init__
        def __new__(cls, name, this_bases, d):
            if this_bases is None:
                return type.__new__(cls, name, (), d)
            return meta(name, bases, d)
    return metaclass('temporary_class', None, {})

if not PY2:
    integer_types = (int,)
else:
    integer_types = (int, long)


text:
package org.dcache.nfs.v4;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.dcache.nfs.ChimeraNFSException;
import org.dcache.nfs.v4.xdr.nfs4_prot;
import org.dcache.nfs.v4.xdr.sessionid4;
import org.dcache.nfs.v4.xdr.nfs_resop4;
import org.dcache.nfs.status.BadSlotException;
import org.dcache.utils.Bytes;

public class NFSv41Session {

    /**
     * Unique session identifier. 16 bytes long.
     *
     * |0 - client id - 7|8 - reserved - 11 | 12 - sequence id - 15|
     */
    private final sessionid4 _session;
    /**
     * Session reply slots.
     */
    private final SessionSlot[] _slots;
    private final NFS4Client _client;
    private final int _maxOps;
    private final int _maxCbOps;

    private final int _cbReplyCacheSize;
    private final int _sequence;

    private final Set<SessionConnection> _boundConnections;

    public NFSv41Session(NFS4Client client, int sequence, int replyCacheSize, int cbReplyCacheSize, int maxOps, int maxCbOps) {
        _client = client;
        _sequence = sequence;
        _slots = new SessionSlot[replyCacheSize];
        byte[] id  = new byte[nfs4_prot.NFS4_SESSIONID_SIZE];

        Bytes.putLong(id, 0, client.getId());
        Bytes.putInt(id, 12, sequence);
        _session = new sessionid4(id);
	_maxOps = maxOps;
	_maxCbOps = maxCbOps;
        _cbReplyCacheSize = cbReplyCacheSize;
        _boundConnections = new HashSet<>();
    }

    public sessionid4 id() {
        return _session;
    }

    public NFS4Client getClient() {
        return _client;
    }

    /**
     * Get maximum slot id.
     * @return max slot id.
     */
    public int getHighestSlot() {
        return _slots.length - 1;
    }

    public int getCbHighestSlot() {
        // FIXME: currently we do not support call-backs, but have to keep client happy
        return _cbReplyCacheSize - 1;
    }

    /**
     * Get highest slot id used.
     * @return slot id or -1 if there are no sloths have been used yet
     */
    public int getHighestUsedSlot() {
        int id;
        for(id = getHighestSlot(); id >= 0 && _slots[id] == null; id--) {
           /*
            * NOP. We only move pointer
            */
        }
        return id;
    }

    public List<nfs_resop4> checkCacheSlot(int slot, int sequence, boolean checkCache)
            throws ChimeraNFSException {
        return getSlot(slot).checkSlotSequence(sequence, checkCache);
    }

    /**
     * Get cache slot for given id.
     * @param i
     * @return cache slot.
     * @throws ChimeraNFSException
     */
    private SessionSlot getSlot(int slot) throws ChimeraNFSException {

        if (slot < 0 || slot > getHighestSlot()) {
            throw new BadSlotException("slot id overflow");
        }

        if (_slots[slot] == null) {
            _slots[slot] = new SessionSlot();
        }

        return _slots[slot];
    }

    public int getSequence() {
        return _sequence;
    }

    /**
     * Get maximal number of operations server will accept for this session.
     * @return number of operations
     */
    public int getMaxOps() {
	return _maxOps;
    }

    /**
     * Get maximal number of call-back operations client will accept for this session.
     *
     * @return number of operations
     */
    public int getMaxCbOps() {
	return _maxCbOps;
    }

    @Override
    public String toString() {
        return _client.getRemoteAddress() + " : " + Bytes.toHexString(_session.value);
    }

    public void updateSlotCache(int slot, List<nfs_resop4> reply) throws ChimeraNFSException {
        getSlot(slot).update(reply);
    }

    /**
     * Binds the session to a given {@link SessionConnection} on if session
     * has no bindings,
     * @param connection to bind
     */
    public synchronized void bindIfNeeded(SessionConnection connection) {
        if (_boundConnections.isEmpty()) {
            bindToConnection(connection);
        }
    }

    /**
     * Binds the session to a given {@link SessionConnection}
     * @param connection to bind
     */
    public synchronized void bindToConnection(SessionConnection connection) {
        _boundConnections.add(connection);
    }

    /**
     * Check if session can be destroyed by client on a given connection.
     * @param connection
     * @return true, if session has no bindings or is bound to given connection.
     */
    public synchronized boolean isReleasableBy(SessionConnection connection) {
        return _boundConnections.isEmpty() || _boundConnections.contains(connection);
    }
}


text:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<!--
	Licensed to the Apache Software Foundation (ASF) under one
	or more contributor license agreements. See the NOTICE file
	distributed with this work for additional information
	regarding copyright ownership. The ASF licenses this file
	to you under the Apache License, Version 2.0 (the
	"License"); you may not use this file except in compliance
	with the License. You may obtain a copy of the License at

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

	Unless required by applicable law or agreed to in writing,
	software distributed under the License is distributed on an
	"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
	KIND, either express or implied. See the License for the
	specific language governing permissions and limitations
	under the License.
-->
<!-- START SNIPPET: webxml -->
<web-app>
<web-app>
  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
    <init-param>
    <param-name>jaxrs.serviceClasses</param-name>
      <param-value>
        org.drools.guvnor.server.jaxrs.PackageResource
        org.drools.guvnor.server.jaxrs.CategoryResource
      </param-value>
    </init-param>
    <init-param>
      <param-name>jaxrs.providers</param-name>
        <param-value>
          org.apache.cxf.jaxrs.provider.AtomEntryProvider
          org.apache.cxf.jaxrs.provider.AtomFeedProvider
          org.drools.guvnor.server.jaxrs.CXFAuthenticationHandler
        </param-value>
    </init-param>
    <!-- Use per-request life-cycle-->
    <init-param>
      <param-name>jaxrs.scope</param-name>
        <param-value>prototype</param-value>
    </init-param>
  </servlet>

 <servlet-mapping>
   <servlet-name>CXFServlet</servlet-name>
   <url-pattern>/*</url-pattern>
 </servlet-mapping>
</web-app>
<!-- END SNIPPET: webxml -->


text:
package org.hl7.rim.decorators;

import org.hl7.rim.Attachment;
import org.hl7.rim.decorators.InfrastructureRootDecorator;
import org.hl7.types.II;
import org.hl7.types.ED;

import org.hl7.rim.Transmission;
import org.hl7.types.impl.IInull;
import org.hl7.types.impl.EDnull;
import /*org.hl7.rim.AssociationSet*/java.util.List;
import java.util.Collections;

/** Implementation of org.hl7.rim.Attachment as an abstract decorator, i.e., a class that returns NULL/NA or nothing for all property accessprs amd that raises UnsupportedOperationExceptions for all mutators. This is used to adapt custom application classes to the RIM class interfaces and only bother about mapping those properties that actually apply to the application class. This can be done in one of two ways: (1) the client class can extend the decorator directly, and implement the applicable properties, or (2) the abstract decorator can be extend to a concrete decorator, which would hold a reference to the client object and method bodies to delegate and adapt the applicable properties.
 @see org.hl7.rim.Attachment
  */
public abstract class AttachmentDecorator extends org.hl7.rim.decorators.InfrastructureRootDecorator implements Attachment {
  /** Property accessor, returns NULL/NA if not overloaded.id.
      @see org.hl7.rim.Attachment#getId
  */
  public II getId() { return IInull.NI; /* should be NA, but that causes trouble for string-literal hibernated properties. */ }
  /** Property mutator, does nothing if not overloaded.id.
      @see org.hl7.rim.Attachment#setId
  */
  public void setId(II id) { /*throw new UnsupportedOperationException();*/ }
  /** Property accessor, returns NULL/NA if not overloaded.text.
      @see org.hl7.rim.Attachment#getText
  */
  public ED getText() { return EDnull.NI; /* should be NA, but that causes trouble for string-literal hibernated properties. */ }
  /** Property mutator, does nothing if not overloaded.text.
      @see org.hl7.rim.Attachment#setText
  */
  public void setText(ED text) { /*throw new UnsupportedOperationException();*/ }
  /** Property accessor, returns null if not overloaded.transmission.
      @see org.hl7.rim.Attachment#getTransmission
  */
  public org.hl7.rim.Transmission getTransmission() { return null; }
  /** Property mutator, does nothing if not overloaded.transmission.
      @see org.hl7.rim.Attachment#setTransmission
  */
  public void setTransmission(org.hl7.rim.Transmission transmission) { /* throw new UnsupportedOperationException(); */ }
}


text:
#include "RGPInterop.h"
#include <QApplication>
#include <QTcpServer>
#include <QTcpSocket>

bool RGPInterop::RGPSupportsInterop(const QString &RGPPath)
{
  uint32_t majorVersion = 0;
  uint32_t minorVersion = 0;

  const char *searchString = "RGPVersion=";
  const int searchStringLength = (int)strlen(searchString);

  // look for an embedded string in the exe
  QFile f(RGPPath);
  if(f.open(QIODevice::ReadOnly))
  {
    QByteArray contents = f.readAll();

    int search = 0;
    do
    {
      int needle = contents.indexOf("RGPVersion=", search);

      if(needle == -1)
        break;

      search = needle + searchStringLength;

      // bail if there isn't enough room for the string plus X.Y
      if(contents.size() - needle < searchStringLength + 3)
        break;

      // get the major version number
      const char *major = contents.data() + search;

      const char *sep = major;

      // find the separator
      while(*sep >= '0' && *sep <= '9')
        sep++;

      // get the minor version number
      const char *minor = sep + 1;

      const char *end = minor;

      // find the end
      while(*end >= '0' && *end <= '9')
        end++;

      // convert the strings to integers
      QByteArray majorStr(major, sep - major);
      QByteArray minorStr(minor, end - minor);

      bool ok = false;
      majorVersion = majorStr.toUInt(&ok);

      if(!ok)
      {
        majorVersion = 0;
        continue;
      }

      minorVersion = minorStr.toUInt(&ok);

      if(!ok)
      {
        majorVersion = minorVersion = 0;
        continue;
      }

      // found the version
      break;

    } while(search >= 0);
  }

  // interop supported in RGP V1.2 and higher
  if(majorVersion > 1 || (majorVersion == 1 && minorVersion > 1))
  {
    return true;
  }

  return false;
}

template <>
rdcstr DoStringise(const RGPCommand &el)
{
  BEGIN_ENUM_STRINGISE(RGPCommand);
  {
    STRINGISE_ENUM_CLASS_NAMED(Initialize, "initialize");
    STRINGISE_ENUM_CLASS_NAMED(SetEvent, "set_event");
    STRINGISE_ENUM_CLASS_NAMED(Terminate, "terminate");
  }
  END_ENUM_STRINGISE();
}

RGPInterop::RGPInterop(ICaptureContext &ctx) : m_Ctx(ctx)
{
  m_Server = new QTcpServer(NULL);
  m_Server->listen(QHostAddress::Any, Port);

  QObject::connect(m_Server, &QTcpServer::newConnection, [this]() {
    if(m_Socket == NULL)
    {
      m_Socket = m_Server->nextPendingConnection();
      ConnectionEstablished();
    }
    else
    {
      // close any other connections while we already have one
      delete m_Server->nextPendingConnection();
    }
  });
}

RGPInterop::~RGPInterop()
{
  RGPInteropTerminate terminate;
  QString encoded = EncodeCommand(RGPCommand::Terminate, terminate.toParams(m_Version));

  if(m_Socket)
  {
    m_Socket->write(encoded.trimmed().toUtf8().data());
    m_Socket->waitForBytesWritten();
  }

  m_Server->close();
  delete m_Server;
}

void RGPInterop::InitializeRGP()
{
  RGPInteropInit init;

  init.interop_version = 1;
  init.interop_name = lit("RenderDoc");

  QString encoded = EncodeCommand(RGPCommand::Initialize, init.toParams(m_Version));

  if(m_Socket)
  {
    m_Socket->write(encoded.trimmed().toUtf8().data());
  }
}

bool RGPInterop::HasRGPEvent(uint32_t eventId)
{
  if(m_Version == 0)
    return false;

  if(m_Socket == NULL)
    return false;

  return m_Event2RGP[eventId].interoplinearid != 0;
}

bool RGPInterop::SelectRGPEvent(uint32_t eventId)
{
  if(m_Version == 0)
    return false;

  RGPInteropEvent ev = m_Event2RGP[eventId];

  if(ev.interoplinearid == 0)
    return false;

  QString encoded = EncodeCommand(RGPCommand::SetEvent, ev.toParams(m_Version));

  if(m_Socket)
  {
    m_Socket->write(encoded.trimmed().toUtf8().data());
    return true;
  }

  return false;
}

void RGPInterop::EventSelected(RGPInteropEvent event)
{
  uint32_t eventId = m_RGP2Event[event.interoplinearid];

  if(eventId == 0)
  {
    qWarning() << "RGP Event " << event.interoplinearid << event.cmdbufid << event.eventname
               << " did not correspond to a known eventId";
    return;
  }

  const ActionDescription *action = m_Ctx.GetAction(eventId);

  const SDFile &file = m_Ctx.GetStructuredFile();

  if(action && QString(file.chunks[action->events.back().chunkIndex]->name) != event.eventname)
    qWarning() << "Action name mismatch. Expected " << event.eventname << " but got "
               << QString(file.chunks[action->events.back().chunkIndex]->name);

  m_Ctx.SetEventID({}, eventId, eventId);

  BringToForeground(m_Ctx.GetMainWindow()->Widget());
}

void RGPInterop::ConnectionEstablished()
{
  QObject::connect(m_Socket, &QAbstractSocket::disconnected, [this]() {
    m_Socket->deleteLater();
    m_Socket = NULL;
  });

  // initial handshake and protocol version
  InitializeRGP();

  // TODO: negotiate mapping version
  uint32_t version = 1;
  CreateMapping(version);

  // add a handler that appends all data to the read buffer and processes each time more comes in.
  QObject::connect(m_Socket, &QIODevice::readyRead, [this]() {
    // append all available data
    m_ReadBuffer += m_Socket->readAll();

    // process the read buffer
    ProcessReadBuffer();
  });
}

void RGPInterop::CreateMapping(const rdcarray<ActionDescription> &actions)
{
  const SDFile &file = m_Ctx.GetStructuredFile();

  for(const ActionDescription &action : actions)
  {
    for(const APIEvent &ev : action.events)
    {
      if(ev.chunkIndex == 0 || ev.chunkIndex == APIEvent::NoChunk ||
         ev.chunkIndex >= file.chunks.size())
        continue;

      const SDChunk *chunk = file.chunks[ev.chunkIndex];

      if(m_EventNames.contains(chunk->name, Qt::CaseSensitive))
      {
        m_Event2RGP[ev.eventId].interoplinearid = (uint32_t)m_RGP2Event.size();
        rdcstr n = chunk->name;
        if(n.contains(':'))
          n.erase(0, n.find_last_of(":") + 1);
        n += "(";
        bool first = true;
        for(size_t i = 0; i < chunk->NumChildren(); i++)
        {
          const SDObject *o = chunk->GetChild(i);
          if(o->type.flags & SDTypeFlags::Important)
          {
            if(!first)
              n += ", ";
            first = false;
            n += ToStr(o->AsUInt32());
          }
        }
        n += ")";

        m_Event2RGP[ev.eventId].eventname = n;

        m_RGP2Event.push_back(ev.eventId);
      }
    }

    // if we have children, step into them first before going to our next sibling
    if(!action.children.empty())
      CreateMapping(action.children);
  }
}

void RGPInterop::CreateMapping(uint32_t version)
{
  m_Version = version;

  if(m_Ctx.APIProps().pipelineType == GraphicsAPI::Vulkan)
  {
    if(version == 1)
    {
      m_EventNames << lit("vkCmdDispatch") << lit("vkCmdDraw") << lit("vkCmdDrawIndexed");
    }
  }
  else if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D12)
  {
    // these names must match those in DoStringise(const D3D12Chunk &el) for the chunks

    if(version == 1)
    {
      m_EventNames << lit("ID3D12GraphicsCommandList::Dispatch")
                   << lit("ID3D12GraphicsCommandList::DrawInstanced")
                   << lit("ID3D12GraphicsCommandList::DrawIndexedInstanced");
    }
  }

  // if we don't have any event names, this API doesn't have a mapping or this was an unrecognised
  // version.
  if(m_EventNames.isEmpty())
    return;

  m_Event2RGP.resize(m_Ctx.GetLastAction()->eventId + 1);

  // linearId 0 is invalid, so map to eventId 0.
  // the first real event will be linearId 1
  m_RGP2Event.push_back(0);

  CreateMapping(m_Ctx.CurRootActions());
}

QString RGPInterop::EncodeCommand(RGPCommand command, QVariantList params)
{
  QString ret;

  QString cmd = ToQStr(command);

  ret += lit("command=%1\n").arg(cmd);

  // iterate params in pair, name and value
  for(int i = 0; i + 1 < params.count(); i += 2)
    ret += QFormatStr("%1.%2=%3\n").arg(cmd).arg(params[i].toString()).arg(params[i + 1].toString());

  ret += lit("endcommand=%1\n").arg(cmd);

  return ret;
}

bool RGPInterop::DecodeCommand(QString command)
{
  QStringList lines = command.trimmed().split(QLatin1Char('\n'));

  if(lines[0].indexOf(lit("command=")) != 0 || lines.last().indexOf(lit("endcommand=")) != 0)
  {
    qWarning() << "Malformed RGP command:\n" << command;
    return false;
  }

  QString commandName = lines[0].split(QLatin1Char('='))[1];

  if(lines.last().split(QLatin1Char('='))[1] != commandName)
  {
    qWarning() << "Mismatch between command and endcommand:\n" << command;
    return false;
  }

  lines.pop_front();
  lines.pop_back();

  QVariantList params;

  QString prefix = commandName + lit(".");

  for(QString &param : lines)
  {
    int eq = param.indexOf(QLatin1Char('='));

    if(eq < 0)
    {
      qWarning() << "Malformed param: " << param;
      continue;
    }

    QString key = param.left(eq);
    QString value = param.mid(eq + 1);

    if(!key.startsWith(prefix))
    {
      qWarning() << "Malformed param key for" << commandName << ": " << key;
      continue;
    }

    key = key.mid(prefix.count());

    params << key << value;
  }

  if(commandName == ToQStr(RGPCommand::SetEvent))
  {
    RGPInteropEvent ev;
    ev.fromParams(m_Version, params);

    EventSelected(ev);

    return true;
  }
  else if(commandName == ToQStr(RGPCommand::Initialize))
  {
    RGPInteropInit init;
    init.fromParams(m_Version, params);

    // TODO: decode the params here. This will contain the interop
    // version and the name of the tool connected to RenderDoc

    return true;
  }
  else if(commandName == ToQStr(RGPCommand::Terminate))
  {
    // RGP has shut down so disconnect the socket etc
    emit m_Socket->disconnected();
    return true;
  }
  else
  {
    qWarning() << "Unrecognised command: " << commandName;
  }

  return false;
}

void RGPInterop::ProcessReadBuffer()
{
  // we might have partial data, so wait until we have a full command
  do
  {
    int idx = m_ReadBuffer.indexOf("endcommand=");

    // if we don't have endcommand= yet, we don't have a full command
    if(idx < 0)
      return;

    idx = m_ReadBuffer.indexOf('\n', idx);

    // also break if we don't have the full line yet including newline.
    if(idx < 0)
      return;

    // extract the command and decode as UTF-8
    QString command = QString::fromUtf8(m_ReadBuffer.data(), idx + 1);

    // remove the command from our buffer, to retain any partial subsequent command we might have
    m_ReadBuffer.remove(0, idx + 1);

    // process this command
    DecodeCommand(command);

    // loop again - we might have read multiple commands
  } while(true);
}


text:
using System;
using System.Runtime.InteropServices;
#if NUNITY
using Vector3 = org.critterai.Vector3;
#else
using Vector3 = UnityEngine.Vector3;
#endif

namespace org.critterai.nmgen.rcn
{
    internal static class NMGenEx
    {
        [DllImport(InteropUtil.PLATFORM_DLL)]
        public static extern void nmgMarkWalkableTriangles(IntPtr ctx
            , float walkableSlopeAngle
            , [In] Vector3[] verts
            , int nv
            , [In] int[] tris
            , int nt
            , [In, Out] byte[] areas);

        [DllImport(InteropUtil.PLATFORM_DLL)]
        public static extern void nmgClearUnwalkableTriangles(IntPtr ctx
            , float walkableSlopeAngle
            , [In] Vector3[] verts
            , int nv
            , [In] int[] tris
            , int nt
            , [In, Out] byte[] areas);

        [DllImport(InteropUtil.PLATFORM_DLL)]
        public static extern void nmgFreeSerializationData(ref IntPtr data);
    }
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Frontiers in Basidiomycote Mycology 177 (2004)

#### Original name
Leucogloea R. Kirschner

### Remarks
null


text:
var resourceLoader;
var digits;

App.onLaunch = function(options) {
  var javascriptFiles = [
    `${options.BASEURL}js/ResourceLoader.js`,
    `${options.BASEURL}js/Presenter.js`,
    `${options.BASEURL}js/ajax.js`
  ];

  evaluateScripts(javascriptFiles, function(success) {
    if(success) {
      resourceLoader = new ResourceLoader(options.BASEURL);
      digits = resourceLoader.returnDigits(null, function(response) {
        return response;
      });
      resourceLoader.getGifs(null, function (response) {
        resourceLoader.loadResource(`${options.BASEURL}templates/initialGifDisplay.xml.js`,
          response.results.map(function (gif) {
            var gifObject = {
              media: gif.media[0].gif,
              tags: gif.tags,
              id: gif.id
            }
            return gifObject
          }),
          function (resource) {
            var doc = Presenter.makeDocument(resource);
            doc.addEventListener("select", Presenter.load.bind(Presenter));
            Presenter.pushDocument(doc);
          }
        );
      })
    } else {
      var errorDoc = Presenter.createAlert("Evaluate Scripts Error", "Error attempting to evaluate external JavaScript files.");
      navigationDocument.presentModal(errorDoc);
    }
  });

};


text:
namespace content {

bool IsPinchToZoomEnabled();

} // namespace content

#endif  // CONTENT_COMMON_CONTENT_SWITCHES_INTERNAL_H_


text:
/* */
export default {
  type: 'object',
  properties: {
    password: {
      type: 'string',
      inputType: 'password',
      placeholder: 'components.form.placeholder.password',
      label: 'components.form.label.password'
    }
  },
  required: ['password'],
  buttons: [{
    label: 'actions.submit',
    action: 'submit',
    showErrors: true,
    clear: false,
    disableInvalid: false
  }]
};


text:
// deepcopy-gen is a tool for auto-generating DeepCopy functions.
//
// Structs in the input directories with the below line in their comments
// will be ignored during generation.
// // +gencopy=false
package main

import (
	"k8s.io/kubernetes/cmd/libs/go2idl/args"
	"k8s.io/kubernetes/cmd/libs/go2idl/deepcopy-gen/generators"

	"github.com/golang/glog"
)

func main() {
	arguments := args.Default()

	// Override defaults. These are Kubernetes specific input locations.
	arguments.InputDirs = []string{
		"k8s.io/kubernetes/pkg/api",
		"k8s.io/kubernetes/pkg/api/v1",
		"k8s.io/kubernetes/pkg/apis/authentication.k8s.io",
		"k8s.io/kubernetes/pkg/apis/authentication.k8s.io/v1beta1",
		"k8s.io/kubernetes/pkg/apis/authorization",
		"k8s.io/kubernetes/pkg/apis/authorization/v1beta1",
		"k8s.io/kubernetes/pkg/apis/autoscaling",
		"k8s.io/kubernetes/pkg/apis/autoscaling/v1",
		"k8s.io/kubernetes/pkg/apis/batch",
		"k8s.io/kubernetes/pkg/apis/batch/v1",
		"k8s.io/kubernetes/pkg/apis/batch/v2alpha1",
		"k8s.io/kubernetes/pkg/apis/apps",
		"k8s.io/kubernetes/pkg/apis/apps/v1alpha1",
		"k8s.io/kubernetes/pkg/apis/componentconfig",
		"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1",
		"k8s.io/kubernetes/pkg/apis/policy",
		"k8s.io/kubernetes/pkg/apis/policy/v1alpha1",
		"k8s.io/kubernetes/pkg/apis/extensions",
		"k8s.io/kubernetes/pkg/apis/extensions/v1beta1",
		"k8s.io/kubernetes/pkg/apis/metrics",
		"k8s.io/kubernetes/pkg/apis/metrics/v1alpha1",
		"k8s.io/kubernetes/pkg/apis/rbac",
		"k8s.io/kubernetes/pkg/apis/rbac/v1alpha1",
		"k8s.io/kubernetes/federation/apis/federation",
		"k8s.io/kubernetes/federation/apis/federation/v1alpha1",
	}

	if err := arguments.Execute(
		generators.NameSystems(),
		generators.DefaultNameSystem(),
		generators.Packages,
	); err != nil {
		glog.Fatalf("Error: %v", err)
	}
	glog.Info("Completed successfully.")
}


text:
#ifndef MBED_PORTOUT_H
#define MBED_PORTOUT_H

#include "platform.h"

#if DEVICE_PORTOUT

#include "port_api.h"
#include "critical.h"

namespace mbed {
/** A multiple pin digital out
 *
 * @Note Synchronization level: Interrupt safe
 *
 * Example:
 * @code
 * // Toggle all four LEDs
 *
 * #include "mbed.h"
 *
 * // LED1 = P1.18  LED2 = P1.20  LED3 = P1.21  LED4 = P1.23
 * #define LED_MASK 0x00B40000
 *
 * PortOut ledport(Port1, LED_MASK);
 *
 * int main() {
 *     while(1) {
 *         ledport = LED_MASK;
 *         wait(1);
 *         ledport = 0;
 *         wait(1);
 *     }
 * }
 * @endcode
 */
class PortOut {
public:

    /** Create an PortOut, connected to the specified port
     *
     *  @param port Port to connect to (Port0-Port5)
     *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
     */
    PortOut(PortName port, int mask = 0xFFFFFFFF) {
        core_util_critical_section_enter();
        port_init(&_port, port, mask, PIN_OUTPUT);
        core_util_critical_section_exit();
    }

    /** Write the value to the output port
     *
     *  @param value An integer specifying a bit to write for every corresponding PortOut pin
     */
    void write(int value) {
        port_write(&_port, value);
    }

    /** Read the value currently output on the port
     *
     *  @returns
     *    An integer with each bit corresponding to associated PortOut pin setting
     */
    int read() {
        return port_read(&_port);
    }

    /** A shorthand for write()
     */
    PortOut& operator= (int value) {
        write(value);
        return *this;
    }

    PortOut& operator= (PortOut& rhs) {
        write(rhs.read());
        return *this;
    }

    /** A shorthand for read()
     */
    operator int() {
        return read();
    }

private:
    port_t _port;
};

} // namespace mbed

#endif

#endif


text:
<?php
  //This is displayAdvertisementPage.php.
  require_once('mainHeader.php');
  session_start();

  if (!isset($_GET['aggeliaID']))
    displayProblemPage('Δεν έχει επιλεγεί αγγελία για προβολή.');
  else {
    $aggeliaID = $_GET['aggeliaID'];
    if ( !is_string($aggeliaID) || !ctype_digit($aggeliaID) )
      displayProblemPage('Μη έγκυρος κωδικός αγγελίας προς προβολή.');
  }

  try {
    $userKind = getUserKind();
    doHtmlHeader('Σπιτικές Αγγελίες: Προβολή αγγελίας', $userKind, 'displayAdPage.js', true);
    displayAdvertisement($aggeliaID, $userKind);
    doHtmlFooter();
  }
  catch (Exception $e) {
    echo '
'.$e->getMessage().'
';
  }

?>

<?php

function displayAdvertisement($aggeliaID, $userKind='guest')
// Displays all information related to the advertisement with id $aggeliaID.
{
  $searchOptions = array();
  $searchOptions['aggeliaID'] = $aggeliaID;
  $aggeliaInfo = searchAds($searchOptions, 'full');
  if (!$aggeliaInfo)
    throw new Exception('Μη έγκυρος κωδικός αγγελίας.');
  else if (count($aggeliaInfo) != 1)
    throw new Exception('Πρόβλημα στη βάση! Βρέθηκαν περισσότερες από μία '
                               .'αγγελίες με τον ίδιο κωδικό.');
  else {
    $aggeliaInfo = $aggeliaInfo[0];
    if (is_array($aggeliaInfo['eidosParoxis']))
      sort($aggeliaInfo['eidosParoxis']);
  }

  if ($userKind === 'admin')
    $isAdmin = true;
  else
    $isAdmin = false;

  // Don't let users see non-approved ads.
  if (!$isAdmin && !$aggeliaInfo['approved'])
    throw new Exception('Η αγγελία που ζητήσατε προς το παρόν δεν είναι εγκεκριμένη '
                               .'από κάποιον διαχειριστή.');

  if ($isAdmin) {
    $eidiParoxwn = getParoxes();
    if (!$eidiParoxwn)
      $eidiParoxwn = array();
  }

  if ($userKind != 'guest') {
    $favorites = getFavorites($_SESSION['validUser'], 'idsOnly');
    if (!$favorites)
      $favorites = array();
  }

  $str = createMainAdInfo($aggeliaInfo);

  echo '
';
  echo '

';
  // --- Approve or disapprove (admin only) ---
  if ($isAdmin) {
    echo '';
    if ( !in_array($aggeliaID, $favorites) ) {
      echo '<input type="button" id="addToFavoritesButton" class="button" '
             .'value="Προσθήκη στα αγαπημένα" '
             .'onclick="addToFavorites(\''.$_SESSION['validUser'].'\', \''.$aggeliaID.'\')" />';
    }
    echo '';
    echo '<input type="button" class="button" value="Διαγραφή αγγελίας" '
           .' onclick="deleteAd('.$aggeliaID.')" />';
    echo '	';
    if (!$aggeliaInfo['approved']) {
      echo '<input type="button" class="button" value="Έγκριση αγγελίας!" '
            .'id="approvalButton" '
            .'onclick="changeApproved('.$aggeliaID.')" />';
    }
    else {
      echo '<input type="button" class="button" value="Σήμανση ως μη εγκεκριμένη!" '
            .'id="approvalButton" '
            .'onclick="changeApproved('.$aggeliaID.')" />';
    }
    echo '

';
  }
  else if ( isset($_SESSION['validUser']) ) {
    echo '
';
    if (!in_array($aggeliaID, $favorites)) {
      echo '';
      echo '<input type="button"  id="addToFavoritesButton" class="button" '
             .'value="Προσθήκη στα αγαπημένα" '
             .'onclick="addToFavorites(\''.$_SESSION['validUser'].'\', \''.$aggeliaID.'\')" />';
      echo '';
    }
    if ($_SESSION['validUser'] == $aggeliaInfo['username'] ) {
      echo '<input type="button" class="button" value="Διαγραφή αγγελίας" '
            .' onclick="deleteAd('.$aggeliaID.')" />';
    }
    echo '

';
  }
  // --- Main info ---
  echo '';
  echo '
Περιγραφή:
';
  echo '
'.$str.'

';
  echo '	';
  if ($isAdmin) {
    echo '';
    echo '';
    echo '
';
    echo '<input type="button" value="Αλλαγή!" id="allagiButton" class="button" '
           .'onclick="changeInfo('.$aggeliaID.')" />';
    echo '
';
    echo '	';
  }
  echo '

';
  // --- Paroxes ---
  echo '';
  echo '
Παροχές:
';
  echo '
';
  if ($aggeliaInfo['eidosParoxis']) {
    foreach ($aggeliaInfo['eidosParoxis'] as $paroxi)
      echo '
'.$paroxi.'
';
  }
  else {
    echo '
Δεν βρέθηκαν παροχές.
';
  }
  echo '

';
  echo '	';
  if ($isAdmin) {
    echo '';
    echo 'Προσθήκη παροχής:
';
    echo '<select name="addParoxi" onchange="addParoxi('.$aggeliaID.', this.value)">'
           .'<option selected="selected" value="false">Καμία</option>';
    foreach ($eidiParoxwn as $key => $value)
      if (!in_array($key, $aggeliaInfo['eidosParoxis']))
        echo '<option value="'.$key.'">'.$key.'</option>';
    echo '</select>

';
    echo 'Αφαίρεση παροχής:
';
    echo '<select name="removeParoxi" onchange="removeParoxi('.$aggeliaID.', this.value)">'
           .'<option selected="selected" value="false">Καμία</option>';
    foreach ($aggeliaInfo['eidosParoxis'] as $paroxi)
      echo '<option value="'.$paroxi.'">'.$paroxi.'</option>';
    echo '</select>
';
    echo '	';
  }
  echo '

';
  // --- Telephones ---
  echo '';
  echo '
Τηλέφωνα επικοινωνίας:

';
  if ($aggeliaInfo['telephone']) {
    foreach ($aggeliaInfo['telephone'] as $telephone)
      echo '
'.$telephone.'
';
  }
  else {
    echo '
Δεν βρέθηκαν τηλέφωνα επικοινωνίας.
';
  }
  echo '

';
  echo '	';
  if ($isAdmin) {
    echo '';
    echo 'Προσθήκη/Αφαίρεση τηλεφώνου:
';
    echo '<input type="text" id="newTelephone" name="newTelephone" size="11" maxlength="10" /> ';
    echo '<input type="button" value=" + " name="addTelephone" '
           .'onclick="addTelephone(\''.$aggeliaInfo['username'].'\')" />';
    echo ' <input type="button" value=" - " name="removeTelephone" '
           .'onclick="removeTelephone(\''.$aggeliaInfo['username'].'\')" />
';
    echo '	';
  }
  echo '

';
  // --- Map ---
  echo '';
  echo '
Χάρτης:

';
  echo 'Απαιτείται η Javascript για να μπορέσετε να δείτε τον χάρτη.';
  echo '

	';
  echo '

';
  // --- Photos ---
  echo '';
  echo '
Φωτογραφίες:

';
  if ($aggeliaInfo['photoPath']) {
    foreach ($aggeliaInfo['photoPath'] as $path)
      echo '

';
  }
  else {
    echo '
Δεν βρέθηκαν φωτογραφίες.
';
  }
  echo '
';
  echo '	';
  echo '

';

  echo '
'.$aggeliaInfo['latitude'].'';
  echo '
'.$aggeliaInfo['longitude'].'';

  // Increase the timesViewed counter of this ad by one.
  viewedAd($aggeliaID);

}

?>


text:
package example.springdata.geode.client.transactions.server;

import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

/**
 * @author Patrick Johnson
 */
@SpringBootApplication
public class TransactionalServer {

	public static void main(String[] args) {
		new SpringApplicationBuilder(TransactionalServer.class).web(WebApplicationType.NONE).build().run(args);
	}

}


text:
from __future__ import absolute_import
import os
import ming
from ming import Session
from ming.odm import ThreadLocalODMSession
from ming import create_datastore
from depot.fields.ming import DepotExtension

mainsession = Session()
DBSession = ThreadLocalODMSession(mainsession, extensions=(DepotExtension, ))

database_setup = False
datastore = None

def setup_database():
    global datastore, database_setup
    if not database_setup:
        datastore = create_datastore(os.environ.get('MONGOURL', 'mim:///depottest'))
        mainsession.bind = datastore
        ming.odm.Mapper.compile_all()

def clear_database():
    global datastore, database_setup
    if not database_setup:
        setup_database()

    try:
        # On MIM drop all data
        datastore.conn.drop_all()
    except TypeError:
        # On MongoDB drop database
        datastore.conn.drop_database(datastore.db)


text:
import sys
from django.conf import settings

if not settings.configured:
    settings.configure(
        DATABASE_ENGINE='sqlite3',

        # Uncomment below to run tests with mysql
        #DATABASE_ENGINE='django.db.backends.mysql',
        #DATABASE_NAME='readonly_test',
        #DATABASE_USER='readonly_test',
        #DATABASE_HOST='/var/mysql/mysql.sock',
        INSTALLED_APPS=[
            'readonly',
        ],
        ROOT_URLCONF='',
        DEBUG=False,
        SITE_READ_ONLY=True,
    )

def runtests(*test_args):
    from django.test.runner import DiscoverRunner
    failures = DiscoverRunner(
        verbosity=1, interactive=True, failfast=False).run_tests(test_args)
    sys.exit(failures)

if __name__ == '__main__':
    runtests(*sys.argv[1:])


text:
#ifndef MBED_DEVICE_H
#define MBED_DEVICE_H

#define NUMBER_OF_GPIO_INTS    8

#define LPADC_VREF_SOURCE      kLPADC_ReferenceVoltageAlt2
#define LPADC_DO_OFFSET_CALIBRATION false
#define LPADC_OFFSET_VALUE_A        10U
#define LPADC_OFFSET_VALUE_B        10U

#define APP_EXCLUDE_FROM_DEEPSLEEP (kPDRUNCFG_PD_DCDC | kPDRUNCFG_PD_FRO192M | kPDRUNCFG_PD_FRO32K)

/* Defines used by the sleep code */
#define LPC_CLOCK_INTERNAL_IRC BOARD_BootClockFRO12M()
#define LPC_CLOCK_RUN          BOARD_BootClockFROHF96M()

#define DEVICE_ID_LENGTH       24

#include "objects.h"

#endif


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Dynamic.Utils;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace System.Linq.Expressions
{
    /// <summary>
    /// Represents a constructor call.
    /// </summary>
    [DebuggerTypeProxy(typeof(Expression.NewExpressionProxy))]
    public class NewExpression : Expression, IArgumentProvider
    {
        private readonly ConstructorInfo _constructor;
        private IList<Expression> _arguments;
        private readonly ReadOnlyCollection<MemberInfo> _members;

        internal NewExpression(ConstructorInfo constructor, IList<Expression> arguments, ReadOnlyCollection<MemberInfo> members)
        {
            _constructor = constructor;
            _arguments = arguments;
            _members = members;
        }

        /// <summary>
        /// Gets the static type of the expression that this <see cref="Expression" /> represents. (Inherited from <see cref="Expression"/>.)
        /// </summary>
        /// <returns>The <see cref="Type"/> that represents the static type of the expression.</returns>
        public override Type Type
        {
            get { return _constructor.DeclaringType; }
        }

        /// <summary>
        /// Returns the node type of this <see cref="Expression" />. (Inherited from <see cref="Expression" />.)
        /// </summary>
        /// <returns>The <see cref="ExpressionType"/> that represents this expression.</returns>
        public sealed override ExpressionType NodeType
        {
            get { return ExpressionType.New; }
        }

        /// <summary>
        /// Gets the called constructor.
        /// </summary>
        public ConstructorInfo Constructor
        {
            get { return _constructor; }
        }

        /// <summary>
        /// Gets the arguments to the constructor.
        /// </summary>
        public ReadOnlyCollection<Expression> Arguments
        {
            get { return ReturnReadOnly(ref _arguments); }
        }

        public Expression GetArgument(int index)
        {
            return _arguments[index];
        }

        public int ArgumentCount
        {
            get
            {
                return _arguments.Count;
            }
        }

        /// <summary>
        /// Gets the members that can retrieve the values of the fields that were initialized with constructor arguments.
        /// </summary>
        public ReadOnlyCollection<MemberInfo> Members
        {
            get { return _members; }
        }

        /// <summary>
        /// Dispatches to the specific visit method for this node type.
        /// </summary>
        protected internal override Expression Accept(ExpressionVisitor visitor)
        {
            return visitor.VisitNew(this);
        }

        /// <summary>
        /// Creates a new expression that is like this one, but using the
        /// supplied children. If all of the children are the same, it will
        /// return this expression.
        /// </summary>
        /// <param name="arguments">The <see cref="Arguments" /> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public NewExpression Update(IEnumerable<Expression> arguments)
        {
            if (arguments == Arguments)
            {
                return this;
            }
            if (Members != null)
            {
                return Expression.New(Constructor, arguments, Members);
            }
            return Expression.New(Constructor, arguments);
        }
    }

    internal class NewValueTypeExpression : NewExpression
    {
        private readonly Type _valueType;

        internal NewValueTypeExpression(Type type, ReadOnlyCollection<Expression> arguments, ReadOnlyCollection<MemberInfo> members)
            : base(null, arguments, members)
        {
            _valueType = type;
        }

        public sealed override Type Type
        {
            get { return _valueType; }
        }
    }

    public partial class Expression
    {
        /// <summary>
        /// Creates a new <see cref="NewExpression"/> that represents calling the specified constructor that takes no arguments.
        /// </summary>
        /// <param name="constructor">The <see cref="ConstructorInfo"/> to set the <see cref="P:Constructor"/> property equal to.</param>
        /// <returns>A <see cref="NewExpression"/> that has the <see cref="NodeType"/> property equal to <see cref="P:New"/> and the <see cref="P:Constructor"/> property set to the specified value.</returns>
        public static NewExpression New(ConstructorInfo constructor)
        {
            return New(constructor, (IEnumerable<Expression>)null);
        }

        /// <summary>
        /// Creates a new <see cref="NewExpression"/> that represents calling the specified constructor that takes no arguments.
        /// </summary>
        /// <param name="constructor">The <see cref="ConstructorInfo"/> to set the <see cref="P:Constructor"/> property equal to.</param>
        /// <param name="arguments">An array of <see cref="Expression"/> objects to use to populate the Arguments collection.</param>
        /// <returns>A <see cref="NewExpression"/> that has the <see cref="NodeType"/> property equal to <see cref="P:New"/> and the <see cref="P:Constructor"/> and <see cref="P:Arguments"/> properties set to the specified value.</returns>
        public static NewExpression New(ConstructorInfo constructor, params Expression[] arguments)
        {
            return New(constructor, (IEnumerable<Expression>)arguments);
        }

        /// <summary>
        /// Creates a new <see cref="NewExpression"/> that represents calling the specified constructor that takes no arguments.
        /// </summary>
        /// <param name="constructor">The <see cref="ConstructorInfo"/> to set the <see cref="P:Constructor"/> property equal to.</param>
        /// <param name="arguments">An <see cref="IEnumerable{T}"/> of <see cref="Expression"/> objects to use to populate the Arguments collection.</param>
        /// <returns>A <see cref="NewExpression"/> that has the <see cref="NodeType"/> property equal to <see cref="P:New"/> and the <see cref="P:Constructor"/> and <see cref="P:Arguments"/> properties set to the specified value.</returns>
        public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments)
        {
            ContractUtils.RequiresNotNull(constructor, "constructor");
            ContractUtils.RequiresNotNull(constructor.DeclaringType, "constructor.DeclaringType");
            TypeUtils.ValidateType(constructor.DeclaringType);
            ValidateConstructor(constructor);
            var argList = arguments.ToReadOnly();
            ValidateArgumentTypes(constructor, ExpressionType.New, ref argList);

            return new NewExpression(constructor, argList, null);
        }

        /// <summary>
        /// Creates a new <see cref="NewExpression"/> that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified.
        /// </summary>
        /// <param name="constructor">The <see cref="ConstructorInfo"/> to set the <see cref="P:Constructor"/> property equal to.</param>
        /// <param name="arguments">An <see cref="IEnumerable{T}"/> of <see cref="Expression"/> objects to use to populate the Arguments collection.</param>
        /// <param name="members">An <see cref="IEnumerable{T}"/> of <see cref="MemberInfo"/> objects to use to populate the Members collection.</param>
        /// <returns>A <see cref="NewExpression"/> that has the <see cref="NodeType"/> property equal to <see cref="P:New"/> and the <see cref="P:Constructor"/>, <see cref="P:Arguments"/> and <see cref="P:Members"/> properties set to the specified value.</returns>
        public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
        {
            ContractUtils.RequiresNotNull(constructor, "constructor");
            ValidateConstructor(constructor);
            var memberList = members.ToReadOnly();
            var argList = arguments.ToReadOnly();
            ValidateNewArgs(constructor, ref argList, ref memberList);
            return new NewExpression(constructor, argList, memberList);
        }

        /// <summary>
        /// Creates a new <see cref="NewExpression"/> that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified.
        /// </summary>
        /// <param name="constructor">The <see cref="ConstructorInfo"/> to set the <see cref="P:Constructor"/> property equal to.</param>
        /// <param name="arguments">An <see cref="IEnumerable{T}"/> of <see cref="Expression"/> objects to use to populate the Arguments collection.</param>
        /// <param name="members">An Array of <see cref="MemberInfo"/> objects to use to populate the Members collection.</param>
        /// <returns>A <see cref="NewExpression"/> that has the <see cref="NodeType"/> property equal to <see cref="P:New"/> and the <see cref="P:Constructor"/>, <see cref="P:Arguments"/> and <see cref="P:Members"/> properties set to the specified value.</returns>
        public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, params MemberInfo[] members)
        {
            return New(constructor, arguments, (IEnumerable<MemberInfo>)members);
        }

        /// <summary>
        /// Creates a <see cref="NewExpression"/> that represents calling the parameterless constructor of the specified type.
        /// </summary>
        /// <param name="type">A <see cref="Type"/> that has a constructor that takes no arguments. </param>
        /// <returns>A <see cref="NewExpression"/> that has the <see cref="NodeType"/> property equal to New and the Constructor property set to the ConstructorInfo that represents the parameterless constructor of the specified type.</returns>
        public static NewExpression New(Type type)
        {
            ContractUtils.RequiresNotNull(type, "type");
            if (type == typeof(void))
            {
                throw Error.ArgumentCannotBeOfTypeVoid();
            }
            ConstructorInfo ci = null;
            if (!type.GetTypeInfo().IsValueType)
            {
                ci = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Where(c => c.GetParameters().Length == 0).SingleOrDefault();
                if (ci == null)
                {
                    throw Error.TypeMissingDefaultConstructor(type);
                }
                return New(ci);
            }
            return new NewValueTypeExpression(type, EmptyReadOnlyCollection<Expression>.Instance, null);
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
        private static void ValidateNewArgs(ConstructorInfo constructor, ref ReadOnlyCollection<Expression> arguments, ref ReadOnlyCollection<MemberInfo> members)
        {
            ParameterInfo[] pis;
            if ((pis = constructor.GetParametersCached()).Length > 0)
            {
                if (arguments.Count != pis.Length)
                {
                    throw Error.IncorrectNumberOfConstructorArguments();
                }
                if (arguments.Count != members.Count)
                {
                    throw Error.IncorrectNumberOfArgumentsForMembers();
                }
                Expression[] newArguments = null;
                MemberInfo[] newMembers = null;
                for (int i = 0, n = arguments.Count; i < n; i++)
                {
                    Expression arg = arguments[i];
                    RequiresCanRead(arg, "argument");
                    MemberInfo member = members[i];
                    ContractUtils.RequiresNotNull(member, "member");
                    if (!TypeUtils.AreEquivalent(member.DeclaringType, constructor.DeclaringType))
                    {
                        throw Error.ArgumentMemberNotDeclOnType(member.Name, constructor.DeclaringType.Name);
                    }
                    Type memberType;
                    ValidateAnonymousTypeMember(ref member, out memberType);
                    if (!TypeUtils.AreReferenceAssignable(memberType, arg.Type))
                    {
                        if (!TryQuote(memberType, ref arg))
                        {
                            throw Error.ArgumentTypeDoesNotMatchMember(arg.Type, memberType);
                        }
                    }
                    ParameterInfo pi = pis[i];
                    Type pType = pi.ParameterType;
                    if (pType.IsByRef)
                    {
                        pType = pType.GetElementType();
                    }
                    if (!TypeUtils.AreReferenceAssignable(pType, arg.Type))
                    {
                        if (!TryQuote(pType, ref arg))
                        {
                            throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arg.Type, pType);
                        }
                    }
                    if (newArguments == null && arg != arguments[i])
                    {
                        newArguments = new Expression[arguments.Count];
                        for (int j = 0; j < i; j++)
                        {
                            newArguments[j] = arguments[j];
                        }
                    }
                    if (newArguments != null)
                    {
                        newArguments[i] = arg;
                    }

                    if (newMembers == null && member != members[i])
                    {
                        newMembers = new MemberInfo[members.Count];
                        for (int j = 0; j < i; j++)
                        {
                            newMembers[j] = members[j];
                        }
                    }
                    if (newMembers != null)
                    {
                        newMembers[i] = member;
                    }
                }
                if (newArguments != null)
                {
                    arguments = new TrueReadOnlyCollection<Expression>(newArguments);
                }
                if (newMembers != null)
                {
                    members = new TrueReadOnlyCollection<MemberInfo>(newMembers);
                }
            }
            else if (arguments != null && arguments.Count > 0)
            {
                throw Error.IncorrectNumberOfConstructorArguments();
            }
            else if (members != null && members.Count > 0)
            {
                throw Error.IncorrectNumberOfMembersForGivenConstructor();
            }
        }

        private static void ValidateAnonymousTypeMember(ref MemberInfo member, out Type memberType)
        {
            FieldInfo field = member as FieldInfo;
            if (field != null)
            {
                if (field.IsStatic)
                {
                    throw Error.ArgumentMustBeInstanceMember();
                }
                memberType = field.FieldType;
                return;
            }

            PropertyInfo pi = member as PropertyInfo;
            if (pi != null)
            {
                if (!pi.CanRead)
                {
                    throw Error.PropertyDoesNotHaveGetter(pi);
                }
                if (pi.GetGetMethod().IsStatic)
                {
                    throw Error.ArgumentMustBeInstanceMember();
                }
                memberType = pi.PropertyType;
                return;
            }

            MethodInfo method = member as MethodInfo;
            if (method != null)
            {
                if (method.IsStatic)
                {
                    throw Error.ArgumentMustBeInstanceMember();
                }

                PropertyInfo prop = GetProperty(method);
                member = prop;
                memberType = prop.PropertyType;
                return;
            }
            throw Error.ArgumentMustBeFieldInfoOrPropertyInfoOrMethod();
        }

        private static void ValidateConstructor(ConstructorInfo constructor)
        {
            if (constructor.IsStatic)
                throw Error.NonStaticConstructorRequired();
        }
    }
}


text:
<?php

declare(strict_types=1);

namespace Respect\Validation\Exceptions;

/**
 * @author Henrique Moody <henriquemoody@gmail.com>
 * @author Moritz Fromm <moritzgitfromm@gmail.com>
 */
final class IsbnException extends ValidationException
{
    /**
     * {@inheritDoc}
     */
    protected $defaultTemplates = [
        self::MODE_DEFAULT => [
            self::STANDARD => '{{name}} must be a ISBN',
        ],
        self::MODE_NEGATIVE => [
            self::STANDARD => '{{name}} must not be a ISBN',
        ],
    ];
}


text:
package org.apache.geode.tools.pulse.internal;

import static org.mockito.Mockito.*;

import javax.servlet.ServletContextEvent;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.RestoreSystemProperties;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestRule;

import org.apache.geode.test.junit.categories.UnitTest;
import org.apache.geode.tools.pulse.internal.data.PulseConstants;
import org.apache.geode.tools.pulse.internal.data.Repository;

@Category(UnitTest.class)
public class PulseAppListenerTest {
  private Repository repository;
  private PulseAppListener appListener;

  @Rule
  public final TestRule restoreSystemProperties = new RestoreSystemProperties();

  @Before
  public void setUp() {
    repository = Repository.get();
    appListener = new PulseAppListener();
  }

  @Test
  public void embeddedModeDefaultPropertiesRepositoryInitializationTest() {
    System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_EMBEDDED, "true");
    appListener.contextInitialized(mock(ServletContextEvent.class));

    Assert.assertEquals(false, repository.getJmxUseLocator());
    Assert.assertEquals(false, repository.isUseSSLManager());
    Assert.assertEquals(false, repository.isUseSSLLocator());
    Assert.assertEquals(PulseConstants.GEMFIRE_DEFAULT_PORT, repository.getPort());
    Assert.assertEquals(PulseConstants.GEMFIRE_DEFAULT_HOST, repository.getHost());

  }

  @Test
  public void embeddedModeNonDefaultPropertiesRepositoryInitializationTest() {
    System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_EMBEDDED, "true");
    System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_PORT, "9999");
    System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_HOST, "nonDefaultBindAddress");
    System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_MANAGER,
        Boolean.TRUE.toString());
    System.setProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_LOCATOR,
        Boolean.TRUE.toString());

    appListener.contextInitialized(mock(ServletContextEvent.class));

    Assert.assertEquals(false, repository.getJmxUseLocator());
    Assert.assertEquals(true, repository.isUseSSLManager());
    Assert.assertEquals(true, repository.isUseSSLLocator());
    Assert.assertEquals("9999", repository.getPort());
    Assert.assertEquals("nonDefaultBindAddress", repository.getHost());
  }

  @After
  public void tearDown() {
    if (repository != null) {
      repository.setPort(null);
      repository.setHost(null);
      repository.setJmxUseLocator(false);
      repository.setUseSSLManager(false);
      repository.removeAllClusters();
    }
  }
}


text:
package alien4cloud.rest.wizard.model;

import lombok.Getter;
import lombok.Setter;
import org.alien4cloud.tosca.model.types.NodeType;

import java.util.List;

/**
 * A topology is composed of nodes. A node has a given type.
 * A module is a node of a topology that has some meanings for the user.
 */
@Getter
@Setter
public class ApplicationModule {

    private String nodeName;

    /**
     * A short readable name for the module (without package).
     */
    private NodeType nodeType;

    /**
     * The meta properties related to the application. Key is the human readable name of the meta-property.
     */
    private List<MetaProperty> namedMetaProperties;

}


text:
package hello;

public class HelloWorld {
	public static void main(String[] args) {
		Message message = new Message();
		System.out.println(message.sayHello());
	}
}


text:
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace RLBotDotNet.Server
{
    /// <summary>
    /// Used for running a server to get bot data from Python clients.<br/>
    /// E.g. Will receive "add MyBot 1 3 ", which means "Add a bot called MyBot to team 1 with index 3".
    /// </summary>
    public class BotManagerServer
    {
        private TcpListener listener;
        public event Action<string> BotReceivedEvent;

        /// <summary>
        /// Event that gets raised whenever a message is received from the Python client.
        /// </summary>
        protected virtual void OnBotReceived(string message)
        {
            if (!string.IsNullOrEmpty(message))
                BotReceivedEvent?.Invoke(message);
        }

        /// <summary>
        /// Starts the server, which continuously listens for clients until it is stopped.
        /// </summary>
        /// <param name="port">The port to run the server on.</param>
        public void Start(int port)
        {
            if (listener != null)
            {
                Console.WriteLine("Cannot start the server as it is already running!");
                return;
            }

            listener = new TcpListener(IPAddress.Parse("127.0.0.1"), port);
            listener.Start();

            Console.WriteLine($"Listening for clients on 127.0.0.1 on port {port}...");

            while (true)
            {
                TcpClient client = listener.AcceptTcpClient();
                NetworkStream stream = client.GetStream();
                byte[] buffer = new byte[client.ReceiveBufferSize];
                int bytes = stream.Read(buffer, 0, client.ReceiveBufferSize);

                string receivedString = Encoding.ASCII.GetString(buffer, 0, bytes);
                OnBotReceived(receivedString);

                // TODO: Do some verification to know that the data was sent correctly.
                // E.g. Echo check

                client.Close();
            }
        }

        /// <summary>
        /// Stops the server if it is running.
        /// </summary>
        public void Stop()
        {
            if (listener == null)
            {
                Console.WriteLine("Cannot stop the server as it is not running!");
                return;
            }

            listener.Stop();
            listener = null;
        }
    }
}


text:
require 'looks/command/base'
require 'looks/gravatar'

require 'launchy'

module Looks
  module Command
    class Open < Base

      def initialize(config)
        super

        @display = false
      end

      def arguments
        ['<address>']
      end

      def configure(opts)
        super

        opts.on('-u', '--url', "Only display the URL of the uploaded image") do
          @display = true
        end
      end

      def execute(args)
        super

        address = args.first

        url = Gravatar.download_url(address)

        if @display
          puts url
        else
          begin
            Launchy.open(url)
          rescue Launchy::Error
            puts url
          end
        end
      end

    end
  end
end


text:
FROM jpetazzo/dind:latest
MAINTAINER fernando@tutum.co

RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose

ADD build.sh /

CMD ["/build.sh"]


text:
var h = require('mercury').h;
var hg = require('mercury');
var scroll = require('../../event-handlers/scroll');
var click = require('../../event-handlers/click');
var followHook = require('./follow-hook');
var log = require('../log');
var format = require('format');
var debug = require('debug')('components:results:render');

module.exports = render;

function render(state, channels) {
  debug('update %o', state);

  channels = channels || state.channels;

  return h('.results', {
    className: state.open ? 'opened' : 'closed'
  },
  [
    hg.partial(controls, state, channels),
    hg.partial(terminal, state, channels)
  ]);
}

function controls(state, channels) {
  var onOrOff = (state.debug ? 'on' : 'off');
  var title = format('Toggle debug console output %s.', onOrOff);
  var text = format(' Debug: %s', onOrOff);

  return h('.results-controls', [
    h('a.toggle-display', {
      href: '#',
      title: (state.open ? 'Close' : 'Open') + ' the results console.',
      'ev-click': click(channels.toggle),
    }),
    h('.title', 'Results'),
    h('a.debug-button', {
      href: '#',
      'ev-click': click(channels.debug, { debug: ! state.debug }),
      title: title
    }, text),
  ]);
}

function terminal(state, channels) {
  return h('.results-console', {
    className: state.debug ? 'debug' : ''
  }, [
    h('.scroller', {
      'ev-scroll': scroll(channels.follow, { scrolling: true }),
      'follow-console': followHook(state.follow)
    }, state.logs.map(log.render))
  ]);
}


text:
Description
===========

This is a short-and-simple cookbook to provide a user_ulimit resource for overriding various ulimit settings. It places configured templates into /etc/security/limits.d/, named for the user the ulimit applies to.

It also provides a helper recipe (default.rb) for allowing ulimit overrides with the 'su' command on Ubuntu, which is disabled by default for some reason.

Requirements
============

Add to your repo, then depend upon this cookbook from wherever you need to override ulimits.

Attributes
==========

* `node['ulimit']['pam_su_template_cookbook'] - Defaults to nil (current cookbook).  Determines what cookbook the su pam.d template is taken from

Usage
=====

Consume the user_ulimit resource like so:

    user_ulimit "tomcat" do
      filehandle_limit 8192 # optional
      process_limit 61504 # optional
      memory_limit 1024 # optional
      core_limit 2048 # optional
    end


text:
Now that we have functions, we need a way to combine small functions together to make larger functions that can handle complex tasks, without having to rewrite the same functions over and over again.

## Example

```eta
add :: Int -> Int
add x y = x + y

multiply :: Int -> Int -> Int
multiply x y = x * y

f :: Int -> Int
f x = 2 * x + 1
```

Note that `f` is a function that multiplies its argument by 2 followed by incrementing it by 1. Note that instead of reusing the existing `add` and `multiply` functions, we had declared an entirely new function.

## Composition

Suppose we had two functions `f :: Int -> Char` and `g :: Char -> Double`. Can we generate a function `h :: Int -> Double` that applies `f` and `g` one after another? Yes, we can, using the composition operator defined below.

```eta
(.) :: (b -> c) -> (a -> b) -> (a -> c)
(.) f g = \x -> f (g x)
```

## Rewriting the Example

We can now rewrite the example using the existing functions, using the currying concept from the last section.

```eta
f = add 1 . multiply 2
```

Note that you should read composition pipelines from right-to-left.

## Next Section

We will then proceed to re-using function application.


text:
package org.apache.flink.metrics.datadog;

import org.apache.flink.metrics.Gauge;

import java.util.List;

/**
 * Mapping of gauge between Flink and Datadog
 * */
public class DGauge extends DMetric {
	private final Gauge<Number> gauge;

	public DGauge(Gauge<Number> g, String metricName, String host, List<String> tags) {
		super(MetricType.gauge, metricName, host, tags);
		gauge = g;
	}

	/**
	 * Visibility of this method must not be changed
	 * since we deliberately not map it to json object in a Datadog-defined format
	 * */
	@Override
	public Number getMetricValue() {
		return gauge.getValue();
	}
}


text:
<?php

$s3_config = array();

/**
 * Whether to store images thumbnails locally (faster; save traffic and requests)
 * @var string|null
 */
$s3_config['s3']['localThumbsPath'] = 'userfilesS3';

/**
 * Whether to perform bulk operations on "folders" (rename/move/copy)
 * NOTE: S3 is not a filesystem, it operates with "objects" and it has no such thing as "folder".
 * When you are performing operation like delete/rename/move/copy on "directory" the plugin actually performs
 * multiple operations for each object prefixed with the "directory" name in the background. The more objects you have
 * in your "directory", the more requests will be sent to simulate the "recursive mode".
 * DELETE requests are not charged so they are not restricted with with option.
 *
 * Links with some explanations:
 * http://stackoverflow.com/a/12523414/1789808
 * http://stackoverflow.com/questions/33363254/aws-s3-rename-directory-object
 * http://stackoverflow.com/questions/33000329/cost-of-renaming-a-folder-in-aws-s3-bucket
 *
 * @var boolean
 */
$s3_config['s3']['allowBulk'] = true;

/*******************************************************************************
 * S3 SETTINGS
 * Check options description: https://github.com/frostealth/yii2-aws-s3
 ******************************************************************************/

$s3_config['s3']['settings'] = array(
    'region' => 'your region',
    'bucket' => 'your aws s3 bucket',
    'credentials' => array( // Aws\Credentials\CredentialsInterface|array|callable
        'key' => 'your aws s3 key',
        'secret' => 'your aws s3 secret',
    ),
    'defaultAcl' => '',
    //'cdnHostname' => 'http://example.cloudfront.net',
    'debug' => false, // bool|array
);

return $s3_config;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Data;
using System.Data.Common;
using Database;

namespace RichoM.Data
{
    public class DatabaseTransaction<TConnection> : DatabaseContext<TConnection> where TConnection : DbConnection, new()
    {
        private TConnection connection;
        private DbTransaction transaction;
        private bool completed;

        internal DatabaseTransaction(TConnection connection, IsolationLevel? isolationLevel)
        {
            this.connection = connection;

            if (isolationLevel.HasValue)
            {
                transaction = connection.BeginTransaction(isolationLevel.Value);
            }
            else
            {
                transaction = connection.BeginTransaction();
            }
        }

        /// <summary>
        /// <para>Actual <c>DbConnection</c> instance.</para>
        ///
        /// <para>IMPORTANT: Do not mess with this object if you don't know what you're doing.</para>
        /// </summary>
        public TConnection Connection { get { return connection; } }

        /// <summary>
        /// <para>Actual <c>DbTransaction</c> instance.</para>
        ///
        /// <para>IMPORTANT: Do not mess with this object if you don't know what you're doing.</para>
        /// </summary>
        public DbTransaction Transaction { get { return transaction; } }

        /// <summary>
        /// A flag that tells you if this transaction has already been commited/rollbacked.
        /// If this flag is set, then attempting to operate with this transaction will throw
        /// a <c>DatabaseTransactionException</c>.
        /// </summary>
        public bool Completed { get { return completed; } }

        /// <summary>
        /// <para>
        /// Commits the database transaction.
        /// </para>
        /// <para>
        /// IMPORTANT: You do not need to call this method explicitly. Once execution leaves
        /// the top-level transaction context this method will be called automatically.
        /// </para>
        /// </summary>
        public void Commit()
        {
            if (completed) { throw new DatabaseTransactionException(); }

            transaction.Commit();
            completed = true;
        }

        /// <summary>
        /// <para>
        /// Rolls back the database transaction.
        /// </para>
        /// <para>
        /// IMPORTANT: You do not need to call this method explicitly. If an exception happens
        /// inside a transaction context, this method will be called automatically.
        /// </para>
        /// </summary>
        public void Rollback()
        {
            if (completed) { throw new DatabaseTransactionException(); }

            transaction.Rollback();
            completed = true;
        }

        internal override T CommandDo<T>(Func<DbCommand, T> function)
        {
            if (completed) { throw new DatabaseTransactionException(); }

            using (DbCommand cmd = connection.CreateCommand())
            {
                cmd.Transaction = transaction;
                return function(cmd);
            }
        }

        /// <summary>
        /// <para>
        /// Allows to group multiple commands in a nested transaction. If any of the commands fails with an exception
        /// the transaction will be rolled back.
        /// </para>
        /// <para>
        /// IMPORTANT: Please note that, since SqlConnection does not support nested transactions, this implementation
        /// will reuse the same top-level <c>DbTransaction</c> for all nested transactions. The commit will only happen
        /// at the top-level (inner transaction commits will have no effect) and a rollback (at any level) will rollback
        /// everything. Although we know it's not ideal, this implementation allows us to use the same interface for both
        /// <c>DatabaseTransaction</c> and <c>Database</c>.
        /// </para>
        /// </summary>
        /// <param name="action">A closure whose parameter is the <c>DatabaseTransaction</c> instance
        /// used as context for the commands.</param>
        public override void TransactionDo(Action<DatabaseTransaction<TConnection>> action)
        {
            Do(action, commit: false);
        }

        internal void Do(Action<DatabaseTransaction<TConnection>> action, bool commit = true)
        {
            try
            {
                action(this);
                if (commit && !completed)
                {
                    Commit();
                }
            }
            catch
            {
                if (!completed)
                {
                    Rollback();
                }
                throw;
            }
            finally
            {
                if (commit || completed)
                {
                    transaction.Dispose();
                }
            }
        }
    }
}


text:
/**
 * create by 朱施健
 */
package com.flower.tables;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.apache.commons.lang3.StringUtils;
import org.guyou.util.StringUtil;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import com.flower.enums.CityEnum;

/**
 * @author 朱施健
 * 商品模板
 */
@Entity
@DynamicUpdate
@DynamicInsert
public class GoodsTemplate {
	public int id;
	public CityEnum city;
	public int curPrice;
	public int oldPrice;
	public String name;
	//是否是特价商品1是0否
	public boolean isBargain;
	//运费
	public int delivery;
	//评分
	public float grade;
	//月销量
	public int monthSales;
	//花模板数据
	public FlowerTemplate flower;
	//细分类
	public String[] detailClassify=new String[]{"官方标配"};
	//标签集合(便于查找)
    public String [] labels ;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
	@Column(nullable=false,updatable=false)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	@Column(length=5,nullable=false)
	public String getCity() {
		return city.area;
	}
	public void setCity(String city) {
		this.city = CityEnum.getEnum(city);
	}

	@Column(nullable=false)
	public int getCurPrice() {
		return curPrice;
	}
	public void setCurPrice(int curPrice) {
		this.curPrice = curPrice;
	}

	@Column(nullable=false)
	public int getOldPrice() {
		return oldPrice;
	}
	public void setOldPrice(int oldPrice) {
		this.oldPrice = oldPrice;
	}
	@Column(length=50,nullable=false)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column
	public boolean isBargain() {
		return isBargain;
	}
	public void setBargain(boolean isBargain) {
		this.isBargain = isBargain;
	}

	@Column
	public int getDelivery() {
		return delivery;
	}
	public void setDelivery(int delivery) {
		this.delivery = delivery;
	}

	@Column(nullable=false,columnDefinition="float(11,1) not null default 0")
	public float getGrade() {
		return grade;
	}
	public void setGrade(float grade) {
		this.grade = grade;
	}

	@Column
	public int getMonthSales() {
		return monthSales;
	}
	public void setMonthSales(int monthSales) {
		this.monthSales = monthSales;
	}

	@Cache(usage=CacheConcurrencyStrategy.READ_ONLY)
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name ="flowerid",nullable=false)
	public FlowerTemplate getFlower() {
		return flower;
	}
	public void setFlower(FlowerTemplate flower) {
		this.flower = flower;
	}

	@Column
	public String getDetailClassify() {
		return StringUtils.join(detailClassify, ",");
	}
	public void setDetailClassify(String detailClassify) {
		if(!StringUtil.isNullValue(detailClassify)){
			this.labels = StringUtil.toStringArray(detailClassify, ",");
		}
	}

	@Column
	public String getLabels() {
		return StringUtils.join(labels, ",");
	}
	public void setLabels(String labels) {
		if(!StringUtil.isNullValue(labels)){
			this.labels = StringUtil.toStringArray(labels, ",");
		}
	}

}


text:
package com.jetbrains.python.findUsages;

import com.intellij.lang.cacheBuilder.DefaultWordsScanner;
import com.intellij.lang.cacheBuilder.VersionedWordsScanner;
import com.intellij.lang.cacheBuilder.WordOccurrence;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.Processor;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.lexer.PythonLexer;
import org.jetbrains.annotations.NotNull;

class PyWordsScanner extends VersionedWordsScanner {
  private volatile DefaultWordsScanner myDelegate;

  @Override
  public void processWords(@NotNull CharSequence fileText, @NotNull Processor<? super WordOccurrence> processor) {
    DefaultWordsScanner delegate = myDelegate;
    if (delegate == null) {
      myDelegate = delegate = new DefaultWordsScanner(new PythonLexer(),
                                         TokenSet.create(PyTokenTypes.IDENTIFIER),
                                         TokenSet.create(PyTokenTypes.END_OF_LINE_COMMENT),
                                         PyTokenTypes.STRING_NODES);
    }
    delegate.processWords(fileText, processor);
  }

  @Override
  public int getVersion() {
    return super.getVersion() + 1;
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <security-domain>VocloudSecurityDomain</security-domain>
</jboss-web>


text:
(function(global) {

  'use strict';

  var fabric  = global.fabric || (global.fabric = { }),
      filters = fabric.Image.filters,
      createClass = fabric.util.createClass;

  /**
   * A container class that knows how to apply a sequence of filters to an input image.
   */
  filters.Composed = createClass(filters.BaseFilter, /** @lends fabric.Image.filters.Composed.prototype */ {

    type: 'Composed',

    /**
     * A non sparse array of filters to apply
     */
    subFilters: [],

    /**
     * Constructor
     * @param {Object} [options] Options object
     */
    initialize: function(options) {
      this.callSuper('initialize', options);
      // create a new array instead mutating the prototype with push
      this.subFilters = this.subFilters.slice(0);
    },

    /**
     * Apply this container's filters to the input image provided.
     *
     * @param {Object} options
     * @param {Number} options.passes The number of filters remaining to be applied.
     */
    applyTo: function(options) {
      options.passes += this.subFilters.length - 1;
      this.subFilters.forEach(function(filter) {
        filter.applyTo(options);
      });
    },

    /**
     * Serialize this filter into JSON.
     *
     * @returns {Object} A JSON representation of this filter.
     */
    toObject: function() {
      return fabric.util.object.extend(this.callSuper('toObject'), {
        subFilters: this.subFilters.map(function(filter) { return filter.toObject(); }),
      });
    },
  });

  /**
   * Deserialize a JSON definition of a ComposedFilter into a concrete instance.
   */
  fabric.Image.filters.Composed.fromObject = function(object, callback) {
    var filters = object.subFilters || [],
        subFilters = filters.map(function(filter) {
          return new fabric.Image.filters[filter.type](filter);
        }),
        instance = new fabric.Image.filters.Composed({ subFilters: subFilters });
    callback && callback(instance);
    return instance;
  };
})(typeof exports !== 'undefined' ? exports : this);


text:
	<title>Will Mellor's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Will Mellor's panel show appearances

Will Mellor (born 1976-04-03[ref]) has appeared in 22 episodes between 2003-2018.  Will Mellor on IMDB. Will Mellor on Wikipedia.

2003

2004

2005

2006

2007

2008

2009

2010

2011

2012

2013

2014

2015

2016

2017

2018

2018-10-04 / Celebrity Juice

2018-05-17 / Celebrity Juice

2017-11-09 / Celebrity Juice

2017-10-05 / Celebrity Juice

2017-03-30 / Celebrity Juice

2016-12-27 / Virtually Famous

2016-12-22 / Celebrity Juice

2016-12-15 / Celebrity Juice

2016-10-06 / Celebrity Juice

2016-04-07 / Celebrity Juice

2016-03-09 / Virtually Famous

2015-04-02 / Celebrity Juice

2013-03-18 / Loose Women

2011-12-22 / Loose Women

2011-03-22 / Loose Women

2009-09-24 / Loose Women

2009-01-19 / Loose Women

2008-09-22 / Loose Women

2007-06-18 / Loose Women

2006-11-22 / Loose Women

2004-09-07 / Loose Women

2003-08-04 / Loose Women


text:
package org.durid.sql.dialect.mysql.ast.expr;

import org.durid.sql.ast.SQLExpr;
import org.durid.sql.ast.SQLExprImpl;
import org.durid.sql.dialect.mysql.visitor.MySqlASTVisitor;
import org.durid.sql.visitor.SQLASTVisitor;

public class MySqlIntervalExpr extends SQLExprImpl implements MySqlExpr {

    private static final long serialVersionUID = 1L;

    private SQLExpr           value;
    private MySqlIntervalUnit unit;

    public MySqlIntervalExpr(){
    }

    public SQLExpr getValue() {
        return value;
    }

    public void setValue(SQLExpr value) {
        this.value = value;
    }

    public MySqlIntervalUnit getUnit() {
        return unit;
    }

    public void setUnit(MySqlIntervalUnit unit) {
        this.unit = unit;
    }

    @Override
    public void output(StringBuffer buf) {
        value.output(buf);
        buf.append(' ');
        buf.append(unit.name());
    }

    protected void accept0(SQLASTVisitor visitor) {
        MySqlASTVisitor mysqlVisitor = (MySqlASTVisitor) visitor;
        if (mysqlVisitor.visit(this)) {
            acceptChild(visitor, this.value);
        }
        mysqlVisitor.endVisit(this);
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((unit == null) ? 0 : unit.hashCode());
        result = prime * result + ((value == null) ? 0 : value.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        MySqlIntervalExpr other = (MySqlIntervalExpr) obj;
        if (unit != other.unit) {
            return false;
        }
        if (value == null) {
            if (other.value != null) {
                return false;
            }
        } else if (!value.equals(other.value)) {
            return false;
        }
        return true;
    }

}