text:
using namespace fastbird;

fastbird::VectorMap<int, unsigned> LuaObject::sUsedCount;
fastbird::SpinLock<true, false> LuaObject::sUsedCountGuard;
void LuaObject::AddUsedCount(int ref)
{
	if (ref == LUA_NOREF)
		return;
	sUsedCountGuard.Lock();
	sUsedCount[ref]+=1;
	sUsedCountGuard.Unlock();
}
bool LuaObject::ReleaseUsedCount(int ref)
{
	if (ref == LUA_NOREF)
		return false;
	sUsedCountGuard.Lock();
	auto itFind = sUsedCount.Find(ref);
	assert(itFind != sUsedCount.end());
	if (--(itFind->second)==0)
	{
		sUsedCountGuard.Unlock();
		return true; // remove it
	}
	sUsedCountGuard.Unlock();

	return false; // still alive
}

LuaObject::LuaObject()
:LuaObject(0)
{

}

LuaObject::LuaObject(lua_State* L, int index, bool pop)
: LuaObject(L)
{
	// the vaile at index is not poped.
	if (!pop)
		lua_pushvalue(L, index);
	CheckType();
	mRef = luaL_ref(L, LUA_REGISTRYINDEX);
	AddUsedCount(mRef);
}

LuaObject::LuaObject(lua_State* L, const char* globalName)
: LuaObject(L)
{
	assert(globalName != 0);
	lua_getglobal(L, globalName);
	CheckType();
	mRef = luaL_ref(L, LUA_REGISTRYINDEX);
	AddUsedCount(mRef);
	mName = globalName;
}

LuaObject::LuaObject(const LuaObject& other)
:LuaObject(other.mL)
{
	if (ReleaseUsedCount(mRef))
		luaL_unref(mL, LUA_REGISTRYINDEX, mRef);

	mRef = other.mRef;
	mType = other.mType;
	AddUsedCount(mRef);
	mName = other.mName;
	if (other.mSelf)
	{
		mSelf = FB_NEW(LuaObject)(*other.mSelf);
	}
}

LuaObject& LuaObject::operator=(const LuaObject& other)
{
	mL = other.mL;
	mType = LUA_TNONE;
	mRef = LUA_NOREF;
	FB_SAFE_DEL(mSelf);

	if(ReleaseUsedCount(mRef))
		luaL_unref(mL, LUA_REGISTRYINDEX, mRef);

	mRef = other.mRef;
	mType = other.mType;
	AddUsedCount(mRef);
	mName = other.mName;
	if (other.mSelf)
	{
		mSelf = FB_NEW(LuaObject)(*other.mSelf);
	}
	return *this;
}

LuaObject::LuaObject(lua_State* L)
: mL(L)
, mType(LUA_TNONE)
, mRef(LUA_NOREF)
, mSelf(0)
{
}

LuaObject::~LuaObject()
{
	Clear();
}

void LuaObject::SetSelf(const LuaObject& other)
{
	assert(other.IsTable());
	FB_SAFE_DEL(mSelf);
	mSelf = FB_NEW(LuaObject)(other);
}

void LuaObject::FindFunction(lua_State* L, const char* funcName)
{
	if (ReleaseUsedCount(mRef))
		luaL_unref(mL, LUA_REGISTRYINDEX, mRef);

	auto splited = Split(funcName, ":");
	auto size = splited.size();
	const auto& last = splited[size - 1];
	auto f = splited[size - 1].find('(');
	if (f != std::string::npos)
	{
		splited[size - 1] = splited[size - 1].substr(0, f);
	}
	else
	{
		splited[size - 1] = splited[size - 1];
		//assert(0 && "You need to put () at the end of the function name.");
	}
	auto splited2 = Split(splited[0].c_str(), ".");
	size = splited2.size();
	LuaObject obj(L, splited2[0].c_str());
	if (!obj.IsValid())
		return;

	for (unsigned u = 1; u < size; ++u)
	{
		obj = obj.GetField(splited2[u].c_str());
	}
	FB_SAFE_DEL(mSelf);
	if (splited.size()==2)
	{
		*this = obj.GetField(splited[1].c_str());
		mSelf = FB_NEW(LuaObject)(obj);
	}
	else
	{
		*this = obj;
	}
	mName = funcName;
}

void LuaObject::NewTable(lua_State* L)
{
	if (ReleaseUsedCount(mRef))
		luaL_unref(mL, LUA_REGISTRYINDEX, mRef);

	mL = L;
	lua_newtable(L);
	CheckType();
	mRef = luaL_ref(L, LUA_REGISTRYINDEX);
	AddUsedCount(mRef);
}

bool LuaObject::IsValid(bool nilIsValid) const
{
	bool valid = mL != 0 && mRef != LUA_NOREF;
	if (!nilIsValid)
		valid = valid && mRef != LUA_REFNIL;
	return valid;
}

void LuaObject::SetGlobalName(lua_State* L, const char* globalName)
{
	ReleaseUsedCount(mRef);
	mRef = LUA_NOREF;

	mL = L;
	assert(globalName != 0);
	lua_getglobal(L, globalName);
	CheckType();
	mRef = luaL_ref(L, LUA_REGISTRYINDEX);
	AddUsedCount(mRef);
	mName = globalName;
}

void LuaObject::PushToStack() const
{
	if (IsValid()){
		lua_rawgeti(mL, LUA_REGISTRYINDEX, mRef);
		if (mSelf)
		{
			assert(IsFunction());
			mSelf->PushToStack();
		}
	}
}

bool LuaObject::Call()
{
	if (!IsFunction())
	{
		assert(0);
		return false;
	}
	PushToStack();
	LUA_PCALL_RET_FALSE(mL, IsMethod() ? 1 : 0, 0);
	return true;
}

// You need to push the function manually before call this function
// Push this LuaObject(Function) and then push args
bool LuaObject::CallWithManualArgs(unsigned numArgs, unsigned numRets)
{
	if (mSelf)
	{
		numArgs++; // for self.
	}
	LUA_PCALL_RET_FALSE(mL, numArgs, numRets);
	return true;
}

bool LuaObject::IsFunction() const
{
	return mType == LUA_TFUNCTION;
}

bool LuaObject::IsMethod() const
{
	return mSelf != 0;
}

bool LuaObject::IsTable() const
{
	return mType == LUA_TTABLE;
}

bool LuaObject::IsString() const
{
	return mType == LUA_TSTRING;
}

bool LuaObject::IsNumber() const
{
	return mType == LUA_TNUMBER;
}
bool LuaObject::IsBool() const
{
	return mType == LUA_TBOOLEAN;
}

bool LuaObject::IsNil() const
{
	return mType == LUA_TNIL;
}

void LuaObject::CheckType()
{
	mType = lua_type(mL, -1);
}

LuaObject LuaObject::GetField(const char* fieldName) const
{
	assert(mL);
	assert(IsTable());
	if (!IsTable())
	{
		return LuaObject();
	}
	LUA_STACK_WATCHER watcher(mL, "LuaObject LuaObject::GetField(const char* fieldName) const");
	PushToStack();

	lua_getfield(mL, -1, fieldName);
	LuaObject fieldObject(mL, -1);
	lua_pop(mL, 2);
	return fieldObject;
}

LuaTableIterator LuaObject::GetTableIterator() const
{
	return LuaTableIterator(*this);
}

LuaSequenceIterator LuaObject::GetSequenceIterator() const
{
	return LuaSequenceIterator(*this);
}

//----------------------------------------------------------------
LuaObject LuaObject::SetFieldTable(const char* fieldName)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "LuaObject LuaObject::SetFieldTable(const char* fieldName)");
	PushToStack();
	lua_newtable(mL);
	LuaObject ret(mL, -1);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
	return ret;
}

void LuaObject::SetField(const char* fieldName, double num)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, double num)");
	PushToStack();
	lua_pushnumber(mL, num);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, int num)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, int num)");
	PushToStack();
	lua_pushinteger(mL, num);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, unsigned num)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, unsigned num)");
	PushToStack();
	lua_pushunsigned(mL, num);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, bool b)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, bool b)");
	PushToStack();
	lua_pushboolean(mL, b);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, const char* str)
{
	assert(str); assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, const char* str)");
	PushToStack();
	lua_pushstring(mL, str);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, const Vec3& v)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, const Vec3& v)");
	PushToStack();
	luaU_push(mL, v);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, const Vec3I& v)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, const Vec3I& v)");
	PushToStack();
	luaU_push(mL, v);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, const Vec2& v)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, const Vec2& v)");
	PushToStack();
	luaU_push(mL, v);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, const Vec2I& v){
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, const Vec2& v)");
	PushToStack();
	luaU_push(mL, v);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

void LuaObject::SetField(const char* fieldName, const Transformation& t)
{
	assert(fieldName);
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetField(const char* fieldName, const Vec2& v)");
	PushToStack();
	luaU_push(mL, t);
	lua_setfield(mL, -2, fieldName);
	lua_pop(mL, 1);
}

LuaObject LuaObject::SetSeqTable(int n) const
{
	LUA_STACK_WATCHER w(mL, "LuaObject LuaObject::SetSeqTable(int n) const");
	PushToStack();
	lua_newtable(mL);
	LuaObject ret(mL, -1);
	lua_rawseti(mL, -2, n);
	lua_pop(mL, 1);
	return ret;
}

LuaObject LuaObject::GetSeqTable(int n)
{
	LUA_STACK_WATCHER w(mL, "LuaObject LuaObject::GetSeqTable(int n)");
	PushToStack();
	lua_rawgeti(mL, -1, n);
	LuaObject ret(mL, -1, true);
	lua_pop(mL, 1);
	return ret;
}

void LuaObject::SetSeq(int n, const char* str)
{
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetSeq(int n, const char* str)");
	PushToStack();
	lua_pushstring(mL, str);
	lua_rawseti(mL, -2, n);
	lua_pop(mL, 1);
}

void LuaObject::SetSeq(int n, char* str)
{
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetSeq(int n, char* str)");
	PushToStack();
	lua_pushstring(mL, str);
	lua_rawseti(mL, -2, n);
	lua_pop(mL, 1);
}

void LuaObject::SetSeq(int n, unsigned num)
{
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetSeq(int n, unsigned num)");
	PushToStack();
	lua_pushunsigned(mL, num);
	lua_rawseti(mL, -2, n);
	lua_pop(mL, 1);
}

void LuaObject::SetSeq(int n, float num)
{
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetSeq(int n, float num)");
	PushToStack();
	lua_pushnumber(mL, num);
	lua_rawseti(mL, -2, n);
	lua_pop(mL, 1);
}

void LuaObject::SetSeq(int n, const Vec4& val)
{
	LUA_STACK_WATCHER w(mL, "void LuaObject::SetSeq(int n, const Vec4& val)");
	PushToStack();
	luaU_push<Vec4>(mL, val);
	lua_rawseti(mL, -2, n);
	lua_pop(mL, 1);
}

double LuaObject::GetNumberAt(int index) const
{
	LUA_STACK_WATCHER watcher(mL, "double LuaObject::GetNumberAt(int index) const");
	PushToStack();
	lua_rawgeti(mL, -1, index);
	double number = lua_tonumber(mL, -1);
	lua_pop(mL, 2);
	return number;
}

unsigned LuaObject::GetUnsignedAt(int index) const
{
	LUA_STACK_WATCHER watcher(mL, "unsigned LuaObject::GetUnsignedAt(int index) const");
	PushToStack();
	lua_rawgeti(mL, -1, index);
	if_assert_pass(lua_isnumber(mL, -1))
	{
		unsigned v = lua_tounsigned(mL, -1);
		lua_pop(mL, 2);
		return v;
	}
	return 0;
}

LuaObject LuaObject::GetTableAt(int index) const
{
	LUA_STACK_WATCHER watcher(mL, "unsigned LuaObject::GetUnsignedAt(int index) const");
	PushToStack();
	lua_rawgeti(mL, -1, index);
	if(lua_istable(mL, -1))
	{
		LuaObject table(mL, -1);
		unsigned v = lua_tounsigned(mL, -1);
		lua_pop(mL, 2);
		return table;
	}
	lua_pop(mL, 2);
	return LuaObject();
}

//----------------------------------------------------------------
std::string LuaObject::GetString(std::string& def) const
{
	if(!IsString())
		return def;
	LUA_STACK_WATCHER watcher(mL, "std::string LuaObject::GetString(std::string& def) const");
	PushToStack();
	std::string ret;
	const char* sz = lua_tostring(mL, -1);
	if (sz)
		ret = sz;
	lua_pop(mL, 1);
	return ret;
}

std::string LuaObject::GetString(bool& success) const
{
	if (!IsString())
	{
		success = false;
		return std::string();
	}
	LUA_STACK_WATCHER watcher(mL, "std::string LuaObject::GetString(bool& success) const");
	PushToStack();
	std::string ret;
	const char* sz = lua_tostring(mL, -1);
	if (sz)
		ret = sz;
	lua_pop(mL, 1);
	success = true;
	return ret;
}

float	LuaObject::GetFloat(float def) const
{
	if(!IsNumber())
		return def;
	LUA_STACK_WATCHER watcher(mL, "float	LuaObject::GetFloat(float def) const");
	PushToStack();
	float f = (float)lua_tonumber(mL, -1);
	lua_pop(mL, 1);
	return f;
}

float LuaObject::GetFloat(bool& success) const
{
	if (!IsNumber())
	{
		success = false;
		return 0.f;
	}
	LUA_STACK_WATCHER watcher(mL, "float LuaObject::GetFloat(bool& success) const");
	PushToStack();
	float f = (float)lua_tonumber(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return f;
}

int LuaObject::GetInt(int def) const
{
	if(!IsNumber())
		return def;

	LUA_STACK_WATCHER watcher(mL, "int LuaObject::GetInt(int def) const");
	PushToStack();
	int i = lua_tointeger(mL, -1);
	lua_pop(mL, 1);
	return i;
}

int LuaObject::GetInt(bool& success) const
{
	if (!IsNumber())
	{
		success = false;
		return 0;
	}

	LUA_STACK_WATCHER watcher(mL, "int LuaObject::GetInt(bool& success) const");
	PushToStack();
	int i = lua_tointeger(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return i;
}

unsigned LuaObject::GetUnsigned(unsigned def) const
{
	if (!IsNumber())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "unsigned LuaObject::GetUnsigned(unsigned def) const");
	PushToStack();
	unsigned u = lua_tounsigned(mL, -1);
	lua_pop(mL, 1);
	return u;
}

unsigned LuaObject::GetUnsigned(bool& success) const
{
	if (!IsNumber())
	{
		success = false;
		return 0;
	}
	LUA_STACK_WATCHER watcher(mL, "unsigned LuaObject::GetUnsigned(bool& success) const");
	PushToStack();
	unsigned u = lua_tounsigned(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return u;
}

unsigned LuaObject::GetUnsignedFromString(unsigned def) const
{
	if (!IsString())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "unsigned LuaObject::GetUnsignedFromString(unsigned def) const");
	PushToStack();
	std::string ret;
	const char* sz = lua_tostring(mL, -1);
	if (sz)
		ret = sz;
	lua_pop(mL, 1);
	return StringConverter::parseUnsignedInt(ret.c_str(), def);
}

unsigned LuaObject::GetUnsignedFromString(bool& success) const
{
	if (!IsString())
	{
		success = false;
		return 0;
	}
	LUA_STACK_WATCHER watcher(mL, "unsigned LuaObject::GetUnsignedFromString(bool& success) const");
	PushToStack();
	std::string ret;
	const char* sz = lua_tostring(mL, -1);
	if (sz)
		ret = sz;
	lua_pop(mL, 1);
	success = true;
	return StringConverter::parseUnsignedInt(ret.c_str());
}

bool LuaObject::GetBoolWithDef(bool def) const
{
	if (!IsBool())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "bool LuaObject::GetBoolWithDef(bool def) const");
	PushToStack();
	bool b = lua_toboolean(mL, -1)!=0;
	lua_pop(mL, 1);
	return b;
}

bool LuaObject::GetBool(bool& success) const
{
	if (!IsBool())
	{
		success = false;
		return false;
	}
	LUA_STACK_WATCHER watcher(mL, "bool LuaObject::GetBool(bool& success) const");
	PushToStack();
	bool b = lua_toboolean(mL, -1) != 0;
	lua_pop(mL, 1);
	success = true;
	return b;
}

Vec3 LuaObject::GetVec3(const Vec3& def) const
{
	if (!IsTable())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec3 LuaObject::GetVec3(const Vec3& def) const");
	PushToStack();
	Vec3 ret = luaU_check<Vec3>(mL, -1);
	lua_pop(mL, 1);
	return ret;
}

Vec3 LuaObject::GetVec3(bool& success) const
{
	if (!IsTable())
	{
		success = false;
		return Vec3::ZERO;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec3 LuaObject::GetVec3(bool& success) const");
	PushToStack();
	Vec3 ret = luaU_check<Vec3>(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return ret;
}

Vec4 LuaObject::GetVec4(const Vec4& def) const
{
	if (!IsTable())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec4 LuaObject::GetVec4(const Vec4& def) const");
	PushToStack();
	Vec4 ret = luaU_check<Vec4>(mL, -1);
	lua_pop(mL, 1);
	return ret;
}

Vec4 LuaObject::GetVec4(bool& success) const
{
	if (!IsTable())
	{
		success = false;
		return Vec4::ZERO;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec4 LuaObject::GetVec4(bool& success) const");
	PushToStack();
	Vec4 ret = luaU_check<Vec4>(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return ret;
}

Vec3I LuaObject::GetVec3I(const Vec3I& def) const
{
	if (!IsTable())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec3I LuaObject::GetVec3I(const Vec3I& def) const");
	PushToStack();
	Vec3I ret = luaU_check<Vec3I>(mL, -1);
	lua_pop(mL, 1);
	return ret;
}

Vec3I LuaObject::GetVec3I(bool& success) const
{
	if (!IsTable())
	{
		success = false;
		return Vec3I::ZERO;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec3I LuaObject::GetVec3I(bool& success) const");
	PushToStack();
	Vec3I ret = luaU_check<Vec3I>(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return ret;
}

Vec2 LuaObject::GetVec2(const Vec2& def) const
{
	if (!IsTable())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec2 LuaObject::GetVec2(const Vec2& def) const");
	PushToStack();
	Vec2 ret = luaU_check<Vec2>(mL, -1);
	lua_pop(mL, 1);
	return ret;
}

Vec2 LuaObject::GetVec2(bool& success) const
{
	if (!IsTable())
	{
		success = false;
		return Vec2::ZERO;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec2 LuaObject::GetVec2(bool& success) const");
	PushToStack();
	Vec2 ret = luaU_check<Vec2>(mL, -1);
	lua_pop(mL, 1);
	success = true;
	return ret;
}

Vec2I LuaObject::GetVec2I(const Vec2I& def) const
{
	if (!IsTable())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec2I LuaObject::GetVec2I(const Vec2I& def) const");
	PushToStack();
	Vec2I ret = luaU_check<Vec2I>(mL, -1);
	lua_pop(mL, 1);

	return ret;
}

Vec2I LuaObject::GetVec2I(bool& success) const
{
	if (!IsTable())
	{
		success = false;
		return Vec2I::ZERO;
	}
	LUA_STACK_WATCHER watcher(mL, "Vec2I LuaObject::GetVec2I(bool& success) const");
	PushToStack();
	Vec2I ret = luaU_check<Vec2I>(mL, -1);
	lua_pop(mL, 1);
	success = true;

	return ret;
}

Quat LuaObject::GetQuat(const Quat& def) const
{
	if (!IsTable())
	{
		return def;
	}
	LUA_STACK_WATCHER watcher(mL, "Quat LuaObject::GetQuat(const Quat& def) const");
	PushToStack();
	Quat ret = luaU_check<Quat>(mL, -1);
	lua_pop(mL, 1);
	return ret;
}

Quat LuaObject::GetQuat(bool& success)const
{
	if (!IsTable())
	{
		success = false;
		return Quat();
	}
	LUA_STACK_WATCHER watcher(mL, "Quat LuaObject::GetQuat(bool& success)const");
	PushToStack();
	Quat ret = luaU_check<Quat>(mL, -1);
	lua_pop(mL, 1);
	success = true;

	return ret;
}

Transformation LuaObject::GetTransformation(bool& success) const
{
	if (!IsTable())
	{
		success = false;
		return Transformation();
	}
	LUA_STACK_WATCHER watcher(mL, "Transformation LuaObject::GetTransformation(bool& success) const");
	PushToStack();
	Transformation ret = luaU_check<Transformation>(mL, -1);
	lua_pop(mL, 1);
	success = true;

	return ret;
}

void LuaObject::Clear()
{
	if (ReleaseUsedCount(mRef))
		luaL_unref(mL, LUA_REGISTRYINDEX, mRef);

	FB_SAFE_DEL(mSelf);
}

unsigned LuaObject::GetLen() const
{
	LUA_STACK_CLIPPER w(mL);
	PushToStack();
	lua_len(mL, -1);
	unsigned len = luaL_checkunsigned(mL, -1);
	return len;
}

bool LuaObject::operator == (const LuaObject& other) const
{
	if (mRef == other.mRef && mType == other.mType)
	{
		return true;
	}
	if (mRef == LUA_NOREF || other.mRef == LUA_NOREF)
		return false;

	lua_rawgeti(mL, LUA_REGISTRYINDEX, mRef);
	lua_rawgeti(mL, LUA_REGISTRYINDEX, other.mRef);
	bool equal = lua_rawequal(mL, -1, -2) == 1;
	lua_pop(mL, 2);

	return equal;
}

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
LuaTableIterator::LuaTableIterator(const LuaObject& table)
{
	assert(table.IsTable());
	mL = table.GetLuaState();
	table.PushToStack();
	lua_pushnil(mL); // T, nil
}

LuaTableIterator::~LuaTableIterator()
{
	lua_pop(mL, 1); // remove table from the stack
}

bool LuaTableIterator::GetNext(KeyValue& outKeyValue)
{
	bool result = lua_next(mL, -2) != 0;
	if (result)
	{
		outKeyValue.first = LuaObject(mL, -2);
		outKeyValue.second = LuaObject(mL, -1);
		lua_pop(mL, 1);
	}

	return result;
}

//---------------------------------------------------------------------------
LuaSequenceIterator::LuaSequenceIterator(const LuaObject& sequence)
: mCurIdx(0)
{
	assert(sequence.IsTable());
	mL = sequence.GetLuaState();
	sequence.PushToStack();
	mLen = luaL_len(mL, -1);
}

LuaSequenceIterator::~LuaSequenceIterator()
{
	lua_pop(mL, 1); // remove sequence from the stack
}

bool LuaSequenceIterator::GetNext(LuaObject& out)
{
	++mCurIdx;
	if (mCurIdx > mLen)
		return false;

	lua_rawgeti(mL, -1, mCurIdx);
	out = LuaObject(mL, -1);
	lua_pop(mL, 1);
	return true;
}

//---------------------------------------------------------------------------------------------------------------------
fastbird::LuaObject fastbird::GetLuaVar(lua_State* L, const char* var, const char* file)
{
	if_assert_fail(var)
		return LuaObject();
	auto splitted = Split(var, ".");
	if (!CheckLuaGlobalExist(L, splitted[0].c_str()))
	{
		if (!file)
		{
			return LuaObject();
		}

		if (luaL_dofile(L, file))
		{
			Error(lua_tostring(L, -1));
			Error("Script error! %s", file);
			lua_pop(L, 1);
			return LuaObject();
		}
	}

	LuaObject ret(L, splitted[0].c_str());
	if (ret.IsValid())
	{
		auto depth = splitted.size();
		for (size_t i = 1; i < depth; i++)
		{
			ret = ret.GetField(splitted[i].c_str());
			if (!ret.IsValid())
				break;
		}
	}
	return ret;
}

bool LuaObject::HasFunction() const
{
	if (IsFunction())
		return true;

	if (!IsTable())
		return false;

	auto it = GetTableIterator();
	LuaTableIterator::KeyValue kv;
	while (it.GetNext(kv))
	{
		if (kv.first.IsFunction())
			return true;
		if (kv.second.IsFunction())
			return true;

		if (kv.first.IsTable())
		{
			bool has = kv.first.HasFunction();
			if (has)
				return true;
		}

		if (kv.second.IsTable())
		{
			bool has = kv.second.HasFunction();
			if (has)
				return true;
		}
	}
	return false;
}


text:
FlairGen
----------------------------

A tool that allows users of reddit's college football subreddit ([/r/cfb](http://reddit.com/r/cfb/)) to easily convert text into inline flair -- that is, each letter will display as a school logo somewhat resembling that letter. The result looks like a ransom note, but it's still pretty neat. The site also includes a sandbox mode that allows users to add specific flair to regular text.

[Try it here](http://rcfb-flairgen.rhcloud.com/)

![](http://i.imgur.com/vFYRCj4.png?1)

Feel free to use for whatever, or set up another site if the one above goes down.

redpajama_set_name: RedPajamaGithub


text:
package org.apache.ignite.internal;

import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteInClosure;
import org.jetbrains.annotations.Async;

/**
 * Extension for standard {@link Future} interface. It adds simplified exception handling,
 * functional programming support and ability to listen for future completion via functional
 * callback.
 * @param <R> Type of the result for the future.
 */
public interface IgniteInternalFuture<R> {
    /**
     * Synchronously waits for completion of the computation and
     * returns computation result.
     *
     * @return Computation result.
     * @throws IgniteInterruptedCheckedException Subclass of {@link IgniteCheckedException} thrown if the wait was interrupted.
     * @throws IgniteFutureCancelledCheckedException Subclass of {@link IgniteCheckedException} throws if computation was cancelled.
     * @throws IgniteCheckedException If computation failed.
     */
    public R get() throws IgniteCheckedException;

    /**
     * Synchronously waits for completion of the computation for
     * up to the timeout specified and returns computation result.
     * This method is equivalent to calling {@link #get(long, TimeUnit) get(long, TimeUnit.MILLISECONDS)}.
     *
     * @param timeout The maximum time to wait in milliseconds.
     * @return Computation result.
     * @throws IgniteInterruptedCheckedException Subclass of {@link IgniteCheckedException} thrown if the wait was interrupted.
     * @throws IgniteFutureTimeoutCheckedException Subclass of {@link IgniteCheckedException} thrown if the wait was timed out.
     * @throws IgniteFutureCancelledCheckedException Subclass of {@link IgniteCheckedException} throws if computation was cancelled.
     * @throws IgniteCheckedException If computation failed.
     */
    public R get(long timeout) throws IgniteCheckedException;

    /**
     * Synchronously waits for completion of the computation for
     * up to the timeout specified and returns computation result.
     *
     * @param timeout The maximum time to wait.
     * @param unit The time unit of the {@code timeout} argument.
     * @return Computation result.
     * @throws IgniteInterruptedCheckedException Subclass of {@link IgniteCheckedException} thrown if the wait was interrupted.
     * @throws IgniteFutureTimeoutCheckedException Subclass of {@link IgniteCheckedException} thrown if the wait was timed out.
     * @throws IgniteFutureCancelledCheckedException Subclass of {@link IgniteCheckedException} throws if computation was cancelled.
     * @throws IgniteCheckedException If computation failed.
     */
    public R get(long timeout, TimeUnit unit) throws IgniteCheckedException;

    /**
     * Synchronously waits for completion of the computation and returns computation result ignoring interrupts.
     *
     * @return Computation result.
     * @throws IgniteFutureCancelledCheckedException Subclass of {@link IgniteCheckedException} throws if computation
     *     was cancelled.
     * @throws IgniteCheckedException If computation failed.
     */
    public R getUninterruptibly() throws IgniteCheckedException;

    /**
     * Cancels this future.
     *
     * @return {@code True} if future was canceled (i.e. was not finished prior to this call).
     * @throws IgniteCheckedException If cancellation failed.
     */
    public boolean cancel() throws IgniteCheckedException;

    /**
     * Checks if computation is done.
     *
     * @return {@code True} if computation is done, {@code false} otherwise.
     */
    public boolean isDone();

    /**
     * Returns {@code true} if this computation was cancelled before it completed normally.
     *
     * @return {@code True} if this computation was cancelled before it completed normally.
     */
    public boolean isCancelled();

    /**
     * Registers listener closure to be asynchronously notified whenever future completes.
     *
     * @param lsnr Listener closure to register. If not provided - this method is no-op.
     */
    @Async.Schedule
    public void listen(IgniteInClosure<? super IgniteInternalFuture<R>> lsnr);

    /**
     * Make a chained future to convert result of this future (when complete) into a new format.
     * It is guaranteed that done callback will be called only ONCE.
     *
     * @param doneCb Done callback that is applied to this future when it finishes to produce chained future result.
     * @return Chained future that finishes after this future completes and done callback is called.
     */
    @Async.Schedule
    public <T> IgniteInternalFuture<T> chain(IgniteClosure<? super IgniteInternalFuture<R>, T> doneCb);

    /**
     * Make a chained future to convert result of this future (when complete) into a new format.
     * It is guaranteed that done callback will be called only ONCE.
     *
     * @param doneCb Done callback that is applied to this future when it finishes to produce chained future result.
     * @param exec Executor to run callback.
     * @return Chained future that finishes after this future completes and done callback is called.
     */
    @Async.Schedule
    public <T> IgniteInternalFuture<T> chain(IgniteClosure<? super IgniteInternalFuture<R>, T> doneCb, Executor exec);

    /**
     * @return Error value if future has already been completed with error.
     */
    public Throwable error();

    /**
     * @return Result value if future has already been completed normally.
     */
    public R result();
}


text:
#ifndef ASYLO_PLATFORM_SYSTEM_CALL_UNTRUSTED_INVOKE_H_
#define ASYLO_PLATFORM_SYSTEM_CALL_UNTRUSTED_INVOKE_H_

#include <vector>

#include "asylo/platform/primitives/extent.h"
#include "asylo/platform/primitives/primitive_status.h"

namespace asylo {
namespace system_call {

// Invokes the native Linux system call described by `request` and builds the
// response message in `response`. Return true on success, otherwise false if a
// serialization error occurred.
primitives::PrimitiveStatus UntrustedInvoke(primitives::Extent request,
                                            primitives::Extent *response);

}  // namespace system_call
}  // namespace asylo

#endif  // ASYLO_PLATFORM_SYSTEM_CALL_UNTRUSTED_INVOKE_H_


text:
package com.cubicb.ssm.util;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class BlockUtil {

    private static List<Material> airFoliageMaterials = new ArrayList<Material>();
    private static List<BlockFace> allBlocksFaces = new ArrayList<>();
    public static List<Byte> blockPassSet = new ArrayList<>();

    static{
        airFoliageMaterials.add(Material.AIR);
        airFoliageMaterials.add(Material.SAPLING);
        airFoliageMaterials.add(Material.LONG_GRASS);
        airFoliageMaterials.add(Material.DEAD_BUSH);
        airFoliageMaterials.add(Material.YELLOW_FLOWER);
        airFoliageMaterials.add(Material.RED_ROSE);
        airFoliageMaterials.add(Material.RED_MUSHROOM);
        airFoliageMaterials.add(Material.BROWN_MUSHROOM);
        airFoliageMaterials.add(Material.TORCH);
        airFoliageMaterials.add(Material.FIRE);
        airFoliageMaterials.add(Material.WHEAT);
        airFoliageMaterials.add(Material.SAPLING);
        airFoliageMaterials.add(Material.MELON_STEM);
        airFoliageMaterials.add(Material.NETHER_STALK);
        airFoliageMaterials.add(Material.CARROT);
        airFoliageMaterials.add(Material.DOUBLE_PLANT);
        airFoliageMaterials.add(Material.VINE);
        airFoliageMaterials.add(Material.SIGN);
        airFoliageMaterials.add(Material.SIGN_POST);
        airFoliageMaterials.add(Material.WALL_SIGN);
        airFoliageMaterials.add(Material.BANNER);
        airFoliageMaterials.add(Material.STANDING_BANNER);
        airFoliageMaterials.add(Material.WALL_BANNER);
        airFoliageMaterials.add(Material.CROPS);

        allBlocksFaces.add(BlockFace.NORTH);
        allBlocksFaces.add(BlockFace.EAST);
        allBlocksFaces.add(BlockFace.SOUTH);
        allBlocksFaces.add(BlockFace.WEST);
        allBlocksFaces.add(BlockFace.UP);
        allBlocksFaces.add(BlockFace.DOWN);
        allBlocksFaces.add(BlockFace.NORTH_EAST);
        allBlocksFaces.add(BlockFace.NORTH_WEST);
        allBlocksFaces.add(BlockFace.SOUTH_EAST);
        allBlocksFaces.add(BlockFace.SOUTH_WEST);
        allBlocksFaces.add(BlockFace.WEST_NORTH_WEST);
        allBlocksFaces.add(BlockFace.NORTH_NORTH_WEST);
        allBlocksFaces.add(BlockFace.NORTH_NORTH_EAST);
        allBlocksFaces.add(BlockFace.EAST_NORTH_EAST);
        allBlocksFaces.add(BlockFace.EAST_SOUTH_EAST);
        allBlocksFaces.add(BlockFace.SOUTH_SOUTH_EAST);
        allBlocksFaces.add(BlockFace.SOUTH_SOUTH_WEST);
        allBlocksFaces.add(BlockFace.WEST_SOUTH_WEST);
        allBlocksFaces.add(BlockFace.SELF);

        blockPassSet.add((byte)0);
        blockPassSet.add((byte)6);
        blockPassSet.add((byte)8);
        blockPassSet.add((byte)9);
        blockPassSet.add((byte)10);
        blockPassSet.add((byte)11);
        blockPassSet.add((byte)26);
        blockPassSet.add((byte)27);
        blockPassSet.add((byte)28);
        blockPassSet.add((byte)30);
        blockPassSet.add((byte)31);
        blockPassSet.add((byte)32);
        blockPassSet.add((byte)37);
        blockPassSet.add((byte)38);
        blockPassSet.add((byte)39);
        blockPassSet.add((byte)40);
        blockPassSet.add((byte)50);
        blockPassSet.add((byte)51);
        blockPassSet.add((byte)55);
        blockPassSet.add((byte)59);
        blockPassSet.add((byte)63);
        blockPassSet.add((byte)64);
        blockPassSet.add((byte)65);
        blockPassSet.add((byte)66);
        blockPassSet.add((byte)68);
        blockPassSet.add((byte)69);
        blockPassSet.add((byte)70);
        blockPassSet.add((byte)71);
        blockPassSet.add((byte)72);
        blockPassSet.add((byte)75);
        blockPassSet.add((byte)76);
        blockPassSet.add((byte)77);
        blockPassSet.add((byte)78);
        blockPassSet.add((byte)83);
        blockPassSet.add((byte)90);
        blockPassSet.add((byte)92);
        blockPassSet.add((byte)93);
        blockPassSet.add((byte)94);
        blockPassSet.add((byte)96);
        blockPassSet.add((byte)101);
        blockPassSet.add((byte)102);
        blockPassSet.add((byte)104);
        blockPassSet.add((byte)105);
        blockPassSet.add((byte)106);
        blockPassSet.add((byte)107);
        blockPassSet.add((byte)111);
        blockPassSet.add((byte)115);
        blockPassSet.add((byte)116);
        blockPassSet.add((byte)117);
        blockPassSet.add((byte)118);
        blockPassSet.add((byte)119);
        blockPassSet.add((byte)120);
        blockPassSet.add((byte)171);
    }

    public static boolean isAirOrFoliage(Block b){
        return airFoliageMaterials.contains(b.getType());
    }
    public static List<BlockFace> getAllBlocksFaces() {
        return allBlocksFaces;
    }

    public static boolean solid(Block block)
    {
        if (block == null) return false;
        return solid(block.getTypeId());
    }
    public static boolean solid(int block)
    {
        return solid((byte)block);
    }
    public static boolean solid(byte block)
    {
        return !blockPassSet.contains(block);
    }

    public static ArrayList<Block> getSurrounding(Block block, boolean diagonals)
    {
        ArrayList<Block> blocks = new ArrayList<Block>();

        if (diagonals)
        {
            for (int x=-1 ; x<= 1 ; x++)
                for (int y=-1 ; y<= 1 ; y++)
                    for (int z=-1 ; z<= 1 ; z++)
                    {
                        if (x == 0 && y == 0 && z == 0)
                            continue;

                        blocks.add(block.getRelative(x, y, z));
                    }
        }
        else
        {
            blocks.add(block.getRelative(BlockFace.UP));
            blocks.add(block.getRelative(BlockFace.DOWN));
            blocks.add(block.getRelative(BlockFace.NORTH));
            blocks.add(block.getRelative(BlockFace.SOUTH));
            blocks.add(block.getRelative(BlockFace.EAST));
            blocks.add(block.getRelative(BlockFace.WEST));
        }

        return blocks;
    }

    public static HashMap<Block, Double> getInRadius(Location loc, double dR)
    {
        return getInRadius(loc, dR, 9999);
    }

    public static HashMap<Block, Double> getInRadius(Location loc, double dR, double maxHeight)
    {
        HashMap<Block, Double> blockList = new HashMap<Block, Double>();
        int iR = (int)dR + 1;

        for (int x=-iR ; x <= iR ; x++)
            for (int z=-iR ; z <= iR ; z++)
                for (int y=-iR ; y <= iR ; y++)
                {
                    if (Math.abs(y) > maxHeight)
                        continue;

                    Block curBlock = loc.getWorld().getBlockAt((int)(loc.getX()+x), (int)(loc.getY()+y), (int)(loc.getZ()+z));

                    double offset = MathUtil.offset(loc, curBlock.getLocation().add(0.5, 0.5, 0.5));;

                    if (offset <= dR)
                        blockList.put(curBlock, 1 - (offset/dR));
                }

        return blockList;
    }

    public static HashMap<Block, Double> getInRadius(Block block, double dR)
    {
        return getInRadius(block, dR, false);
    }

    public static HashMap<Block, Double> getInRadius(Block block, double dR, boolean hollow)
    {
        HashMap<Block, Double> blockList = new HashMap<Block, Double>();
        int iR = (int)dR + 1;

        for (int x=-iR ; x <= iR ; x++)
            for (int z=-iR ; z <= iR ; z++)
                for (int y=-iR ; y <= iR ; y++)
                {
                    Block curBlock = block.getRelative(x, y, z);

                    double offset = MathUtil.offset(block.getLocation(), curBlock.getLocation());

                    if (offset <= dR && !(hollow && offset < dR - 1))
                    {
                        blockList.put(curBlock, 1 - (offset / dR));
                    }
                }

        return blockList;
    }

}


text:
package com.rashwan.reactive_popular_movies.feature.discoverMovies.nearbyMovies.di;

import com.rashwan.reactive_popular_movies.feature.discoverMovies.BrowseMoviesAdapter;

import dagger.Module;
import dagger.Provides;

/**
 * Created by rashwan on 3/15/17.
 */
@Module
public class NearbyMoviesModule {
    @Provides
    BrowseMoviesAdapter provideBrowseMoviesAdapter(){
        return new BrowseMoviesAdapter();
    }
}


text:
Complete, compliant and well tested module for implementing an OAuth2 Server/Provider with [resitfy](http://mcavage.me/node-restify/) in [node.js](http://nodejs.org/)

## Installation

```
npm install oauth2-server
```

## Quick Start

The module provides one middleware for authorization and routing, use it as you would any other middleware:

```js
var restify = require('restify'),
    oauthserver = require('oauth2-server-restify');

var server = restify.createServer();

server.use(restify.bodyParser({})); // REQUIRED

server.oauth = oauthserver({
  model: {}, // See below for specification
  grants: ['password'],
  debug: true
});

server.post('/oauth/token', server.oauth.grant());

server.get('/', server.oauth.authorise(), function (req, res, next) {
  res.send('Secret area');
  next();
});

server.listen(3000);
```

After running with node, visting http://127.0.0.1:3000 should present you with a json response saying your access token could not be found.

Note: As no model was actually implemented here, delving any deeper, i.e. passing an access token, will just cause a server error. See below for the specification of what's required from the model.

## Features

- Supports authorization_code, password, refresh_token, client_credentials and extension (custom) grant types
- Implicitly supports any form of storage e.g. PostgreSQL, MySQL, Mongo, Redis...
- Full test suite

## Options

- *string* **model**
 - Model object (see below)
- *array* **grants**
 - grant types you wish to support, currently the module supports `password` and `refresh_token`
  - Default: `[]`
- *function|boolean* **debug**
 - If `true` errors will be  logged to console. You may also pass a custom function, in which case that function will be called with the error as its first argument
  - Default: `false`
- *number* **accessTokenLifetime**
 - Life of access tokens in seconds
 - If `null`, tokens will considered to never expire
  - Default: `3600`
- *number* **refreshTokenLifetime**
 - Life of refresh tokens in seconds
 - If `null`, tokens will considered to never expire
  - Default: `1209600`
- *number* **authCodeLifetime**
 - Life of auth codes in seconds
  - Default: `30`
- *regexp* **clientIdRegex**
 - Regex to sanity check client id against before checking model. Note: the default just matches common `client_id` structures, change as needed
  - Default: `/^[a-z0-9-_]{3,40}$/i`
- *boolean* **passthroughErrors**
 - If true, **non grant** errors will not be handled internally (so you can ensure a consistent format with the rest of your api)
- *boolean* **continueAfterResponse**
 - If true, `next` will be called even if a response has been sent (you probably don't want this)

## Model Specification

The module requires a model object through which some aspects or storage, retrieval and custom validation are abstracted.
The last parameter of all methods is a callback of which the first parameter is always used to indicate an error.

Note: see https://github.com/thomseddon/node-oauth2-server/tree/master/examples/postgresql for a full model example using postgres.

### Always Required

#### getAccessToken (bearerToken, callback)
- *string* **bearerToken**
 - The bearer token (access token) that has been provided
- *function* **callback (error, accessToken)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *object* **accessToken**
     - The access token retrieved form storage or falsey to indicate invalid access token
     - Must contain the following keys:
         - *date* **expires**
             - The date when it expires
             - `null` to indicate the token **never expires**
         - *mixed* **user** *or* *string|number* **userId**
             - If a `user` key exists, this is saved as `req.user`
             - Otherwise a `userId` key must exist, which is saved in `req.user.id`

#### getClient (clientId, clientSecret, callback)
- *string* **clientId**
- *string|null* **clientSecret**
 - If null, omit from search query (only search by clientId)
- *function* **callback (error, client)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *object* **client**
     - The client retrieved from storage or falsey to indicate an invalid client
     - Saved in `req.client`
     - Must contain the following keys:
         - *string* **clientId**
         - *string* **redirectUri** (`authorization_code` grant type only)

#### grantTypeAllowed (clientId, grantType, callback)
- *string* **clientId**
- *string* **grantType**
- *function* **callback (error, allowed)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *boolean* **allowed**
     - Indicates whether the grantType is allowed for this clientId

#### saveAccessToken (accessToken, clientId, expires, user, callback)
- *string* **accessToken**
- *string* **clientId**
- *date* **expires**
- *object* **user**
- *function* **callback (error)**
 - *mixed* **error**
     - Truthy to indicate an error

### Required for `authorization_code` grant type

#### getAuthCode (authCode, callback)
- *string* **authCode**
- *function* **callback (error, authCode)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *object* **authCode**
     - The authorization code retrieved form storage or falsey to indicate invalid code
     - Must contain the following keys:
         - *string|number* **clientId**
             - client id associated with this auth code
         - *date* **expires**
             - The date when it expires
         - *string|number* **userId**
             - The userId

#### saveAuthCode (authCode, clientId, expires, user, callback)
- *string* **authCode**
- *string* **clientId**
- *date* **expires**
- *mixed* **user**
   - Whatever was passed as `user` to the codeGrant function (see example)
- *function* **callback (error)**
 - *mixed* **error**
     - Truthy to indicate an error

### Required for `password` grant type

#### getUser (username, password, callback)
- *string* **username**
- *string* **password**
- *function* **callback (error, user)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *object* **user**
     - The user retrieved from storage or falsey to indicate an invalid user
     - Saved in `req.user`
     - Must contain the following keys:
         - *string|number* **id**

### Required for `refresh_token` grant type

#### saveRefreshToken (refreshToken, clientId, expires, user, callback)
- *string* **refreshToken**
- *string* **clientId**
- *date* **expires**
- *object* **user**
- *function* **callback (error)**
 - *mixed* **error**
     - Truthy to indicate an error

#### getRefreshToken (refreshToken, callback)
- *string* **refreshToken**
 - The bearer token (refresh token) that has been provided
- *function* **callback (error, refreshToken)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *object* **refreshToken**
     - The refresh token retrieved form storage or falsey to indicate invalid refresh token
     - Must contain the following keys:
         - *string|number* **clientId**
             - client id associated with this token
         - *date* **expires**
             - The date when it expires
             - `null` to indicate the token **never expires**
         - *string|number* **userId**
             - The userId

### Optional for Refresh Token grant type

#### revokeRefreshToken (refreshToken, callback)
The spec does not actually require that you revoke the old token - hence this is optional (Last paragraph: http://tools.ietf.org/html/rfc6749#section-6)
- *string* **refreshToken**
- *function* **callback (error)**
 - *mixed* **error**
     - Truthy to indicate an error

### Required for [extension grant](#extension-grants) grant type

#### extendedGrant (grantType, req, callback)
- *string* **grantType**
 - The (custom) grant type
- *object* **req**
 - The raw request
- *function* **callback (error, supported, user)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *boolean* **supported**
     - Whether you support the grant type
 - *object* **user**
     - The user retrieved from storage or falsey to indicate an invalid user
     - Saved in `req.user`
     - Must contain the following keys:
         - *string|number* **id**

### Required for `client_credentials` grant type

#### getUserFromClient (clientId, clientSecret, callback)
- *string* **clientId**
- *string* **clientSecret**
- *function* **callback (error, user)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *object* **user**
     - The user retrieved from storage or falsey to indicate an invalid user
     - Saved in `req.user`
     - Must contain the following keys:
         - *string|number* **id**

### Optional

#### generateToken (type, req, callback)
- *string* **type**
 - `accessToken` or `refreshToken`
- *object* **req**
 - The current express request
- *function* **callback (error, token)**
 - *mixed* **error**
     - Truthy to indicate an error
 - *string|object|null* **token**
     - *string* indicates success
     - *null* indicates to revert to the default token generator
     - *object* indicates a reissue (i.e. will not be passed to saveAccessToken/saveRefreshToken)
         - Must contain the following keys (if object):
           - *string* **accessToken** OR **refreshToken** dependant on type

## Extension Grants
You can support extension/custom grants by implementing the extendedGrant method as outlined above.
Any grant type that is a valid URI will be passed to it for you to handle (as [defined in the spec](http://tools.ietf.org/html/rfc6749#section-4.5)).
You can access the grant type via the first argument and you should pass back supported as `false` if you do not support it to ensure a consistent (and compliant) response.

## Example using the `password` grant type

First you must insert client id/secret and user into storage. This is out of the scope of this example.

To obtain a token you should POST to `/oauth/token`. You should include your client credentials in
the Authorization header ("Basic " + client_id:client_secret base64'd), and then grant_type ("password"),
username and password in the request body, for example:

```
POST /oauth/token HTTP/1.1
Host: server.example.com
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
Content-Type: application/x-www-form-urlencoded

grant_type=password&username=johndoe&password=A3ddj3w
```
This will then call the following on your model (in this order):
 - getClient (clientId, clientSecret, callback)
 - grantTypeAllowed (clientId, grantType, callback)
 - getUser (username, password, callback)
 - saveAccessToken (accessToken, clientId, expires, user, callback)
 - saveRefreshToken (refreshToken, clientId, expires, user, callback) **(if using)**

Provided there weren't any errors, this will return the following (excluding the `refresh_token` if you've not enabled the refresh_token grant type):

```
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
  "access_token":"2YotnFZFEjr1zCsicMWpAA",
  "token_type":"bearer",
  "expires_in":3600,
  "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA"
}
```

## Changelog

See: https://github.com/thomseddon/node-oauth2-server/blob/master/Changelog.md

## Credits

Copyright (c) 2013 Thom Seddon & Marcos Sanz

## License

[Apache, Version 2.0](https://github.com/thomseddon/node-oauth2-server/blob/master/LICENSE)


text:
#include "rtbkit/plugins/exchange/http_exchange_connector.h"
#include <boost/any.hpp>

using namespace std;
using namespace RTBKIT;

struct DumpingExchangeConnector: public HttpExchangeConnector {

    DumpingExchangeConnector(const std::string & name,
                             std::shared_ptr<ServiceProxies> proxies)
        : HttpExchangeConnector(name, proxies)
    {
    }

    virtual std::string exchangeName() const
    {
        return "dumping";
    }

    virtual std::shared_ptr<BidRequest>
    parseBidRequest(HttpAuctionHandler & connection,
                    const HttpHeader & header,
                    const std::string & payload)
    {
        cerr << "got request" << endl << header << endl << payload << endl;
        return std::make_shared<BidRequest>();
    }

    virtual double
    getTimeAvailableMs(HttpAuctionHandler & connection,
                       const HttpHeader & header,
                       const std::string & payload)
    {
        return 10;
    }

    virtual double
    getRoundTripTimeMs(HttpAuctionHandler & connection,
                       const HttpHeader & header)
    {
        return 5;
    }

    virtual HttpResponse getResponse(const HttpAuctionHandler & connection,
                                     const HttpHeader & requestHeader,
                                     const Auction & auction) const
    {
        return HttpResponse(204, "", "");
    }

    virtual HttpResponse
    getDroppedAuctionResponse(const HttpAuctionHandler & connection,
                              const std::string & reason) const
    {
        return HttpResponse(204, "application/json", "{}");
    }

    virtual HttpResponse
    getErrorResponse(const HttpAuctionHandler & connection,
                     const std::string & errorMessage) const
    {
        return HttpResponse(400, "application/json", "{}");
    }
};

int main(int argc, char ** argv)
{
    std::shared_ptr<ServiceProxies> proxies(new ServiceProxies());

    DumpingExchangeConnector connector("connector", proxies);

    connector.configureHttp(1, 10002, "0.0.0.0");
    connector.start();
    connector.enableUntil(Date::positiveInfinity());

    for (;;) {
        sleep(10.0);
    }

    return 1;
}


text:
.. 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.

Multiple Subnets in Shared Network
----------------------------------

CloudStack provides you with the flexibility to add guest IP ranges from
different subnets in Basic zones and security groups-enabled Advanced
zones. For security groups-enabled Advanced zones, it implies multiple
subnets can be added to the same VLAN. With the addition of this
feature, you will be able to add IP address ranges from the same subnet
or from a different one when IP address are exhausted. This would in
turn allows you to employ higher number of subnets and thus reduce the
address management overhead. You can delete the IP ranges you have
added.

Prerequisites and Guidelines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-  This feature can only be implemented:

   -  on IPv4 addresses

   -  if virtual router is the DHCP provider

   -  on KVM, xenServer, and VMware hypervisors

-  Manually configure the gateway of the new subnet before adding the IP
   range.

-  CloudStack supports only one gateway for a subnet; overlapping
   subnets are not currently supported

Adding Multiple Subnets to a Shared Network
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Log in to the CloudStack UI as an administrator or end user.

#. In the left navigation, choose Infrastructure.

#. On Zones, click View More, then click the zone to which you want to
   work with..

#. Click Physical Network.

#. In the Guest node of the diagram, click Configure.

#. Click Networks.

#. Select the networks you want to work with.

#. Click View IP Ranges.

#. Click Add IP Range.

   The Add IP Range dialog is displayed, as follows:

   |add-ip-range.png|

#. Specify the following:

   All the fields are mandatory.

   -  **Gateway**: The gateway for the tier you create. Ensure that the
      gateway is within the Super CIDR range that you specified while
      creating the VPC, and is not overlapped with the CIDR of any
      existing tier within the VPC.

   -  **Netmask**: The netmask for the tier you create.

      For example, if the VPC CIDR is 10.0.0.0/16 and the network tier
      CIDR is 10.0.1.0/24, the gateway of the tier is 10.0.1.1, and the
      netmask of the tier is 255.255.255.0.

   -  **Start IP/ End IP**: A range of IP addresses that are accessible
      from the Internet and will be allocated to guest VMs. Enter the
      first and last IP addresses that define a range that CloudStack
      can assign to guest VMs .

#. Click OK.

.. |add-ip-range.png| image:: /_static/images/add-ip-range.png
   :alt: adding an IP range to a network.


text:
title: Configuring External DNS
menu:
  docs_{{ .version }}:
    identifier: dns-ingress
    name: DNS
    parent: ingress-guides
    weight: 30
menu_name: docs_{{ .version }}
---


text:
package com.opensymphony.xwork2.validator.validators;

import com.opensymphony.xwork2.validator.ValidationException;
import org.apache.commons.lang3.StringUtils;

/**
 *
 * Field Validator that checks if the double specified is within a certain range.
 *
 *
 *
 *
 *

 *
fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required

 *
minInclusive - the minimum inclusive value in FloatValue format specified by Java language (if none is specified, it will not be checked)

 *
maxInclusive - the maximum inclusive value in FloatValue format specified by Java language (if none is specified, it will not be checked)

 *
minExclusive - the minimum exclusive value in FloatValue format specified by Java language (if none is specified, it will not be checked)

 *
maxExclusive - the maximum exclusive value in FloatValue format specified by Java language (if none is specified, it will not be checked)

 *
minInclusiveExpression - the minimum inclusive value specified as a OGNL expression (if none is specified, it will not be checked)

 *
maxInclusiveExpression - the maximum inclusive value specified as a OGNL expression (if none is specified, it will not be checked)

 *
minExclusiveExpression - the minimum exclusive value specified as a OGNL expression (if none is specified, it will not be checked)

 *
maxExclusiveExpression - the maximum exclusive value specified as a OGNL expression (if none is specified, it will not be checked)

 *

 *
 * You can specify either minInclusive, maxInclusive, minExclusive and maxExclusive or minInclusiveExpression, maxInclusiveExpression,
 * minExclusiveExpression and maxExclusiveExpression as a OGNL expression, see example below. You can always try to mix params
 * but be aware that such behaviour was not tested.
 *
 *
 *
 *
 * Do not use ${minInclusiveExpression}, ${maxInclusiveExpression}, ${minExclusiveExpressionExpression} and ${maxExclusive}
 * as an expression as this will turn into infinitive loop!
 *
 *
 *
 *

 *
 * <validators>
 *     <!-- Plain Validator Syntax -->
 *         <validator type="double">
 *         <param name="fieldName">percentage</param>
 *         <param name="minInclusive">20.1</param>
 *         <param name="maxInclusive">50.1</param>
 *         <message>Age needs to be between ${minInclusive} and ${maxInclusive} (inclusive)</message>
 *     </validator>
 *
 *     <!-- Field Validator Syntax -->
 *     <field name="percentage">
 *         <field-validator type="double">
 *             <param name="minExclusive">0.123</param>
 *             <param name="maxExclusive">99.98</param>
 *             <message>Percentage needs to be between ${minExclusive} and ${maxExclusive} (exclusive)</message>
 *         </field-validator>
 *     </field>
 *
 *     <!-- Field Validator Syntax with expression -->
 *     <field name="percentage">
 *         <field-validator type="double">
 *             <param name="minExclusiveExpression">${minExclusiveValue}</param> <!-- will be evaluated as: Double getMinExclusiveValue() -->
 *             <param name="maxExclusiveExpression">${maxExclusiveValue}</param> <!-- will be evaluated as: Double getMaxExclusiveValue() -->
 *             <message>Percentage needs to be between ${minExclusive} and ${maxExclusive} (exclusive)</message>
 *         </field-validator>
 *     </field>
 * </validators>
 *
 *

 *
 * @author Rainer Hermanns
 * @author Rene Gielen
 *
 * @version $Id: DoubleRangeFieldValidator.java 1457672 2013-03-18 08:39:53Z lukaszlenart $
 */
public class DoubleRangeFieldValidator extends FieldValidatorSupport {

    private Double maxInclusive = null;
    private Double minInclusive = null;
    private Double minExclusive = null;
    private Double maxExclusive = null;

    private String minInclusiveExpression;
    private String maxInclusiveExpression;
    private String minExclusiveExpression;
    private String maxExclusiveExpression;

    public void validate(Object object) throws ValidationException {
        String fieldName = getFieldName();
        Double value;
        try {
            Object obj = this.getFieldValue(fieldName, object);
            if (obj == null) {
                return;
            }
            value = Double.valueOf(obj.toString());
        } catch (NumberFormatException e) {
            return;
        }

        Double maxInclusiveToUse = getMaxInclusive();
        Double minInclusiveToUse = getMinInclusive();
        Double maxExclusiveToUse = getMaxExclusive();
        Double minExclusiveToUse = getMinExclusive();

        if ((maxInclusiveToUse != null && value.compareTo(maxInclusiveToUse) > 0) ||
                (minInclusiveToUse != null && value.compareTo(minInclusiveToUse) < 0) ||
                (maxExclusiveToUse != null && value.compareTo(maxExclusiveToUse) >= 0) ||
                (minExclusiveToUse != null && value.compareTo(minExclusiveToUse) <= 0)) {
            addFieldError(fieldName, object);
        }
    }

    public void setMaxInclusive(Double maxInclusive) {
        this.maxInclusive = maxInclusive;
    }

    public Double getMaxInclusive() {
        if (maxInclusive != null) {
            return maxInclusive;
        } else if (StringUtils.isNotEmpty(maxInclusiveExpression)) {
            return (Double) parse(maxInclusiveExpression, Double.class);
        }
        return maxInclusive;
    }

    public void setMinInclusive(Double minInclusive) {
        this.minInclusive = minInclusive;
    }

    public Double getMinInclusive() {
        if (minInclusive != null) {
            return minInclusive;
        } else if (StringUtils.isNotEmpty(minInclusiveExpression)) {
            return (Double) parse(minInclusiveExpression, Double.class);
        }
        return null;
    }

    public void setMinExclusive(Double minExclusive) {
        this.minExclusive = minExclusive;
    }

    public Double getMinExclusive() {
        if (minExclusive != null) {
            return minExclusive;
        } else if (StringUtils.isNotEmpty(minExclusiveExpression)) {
            return (Double) parse(minExclusiveExpression, Double.class);
        }
        return null;
    }

    public void setMaxExclusive(Double maxExclusive) {
        this.maxExclusive = maxExclusive;
    }

    public Double getMaxExclusive() {
        if (maxExclusive != null) {
            return maxExclusive;
        } else if (StringUtils.isNotEmpty(maxExclusiveExpression)) {
            return (Double) parse(maxExclusiveExpression, Double.class);
        }
        return null;
    }

    public void setMinInclusiveExpression(String minInclusiveExpression) {
        this.minInclusiveExpression = minInclusiveExpression;
    }

    public void setMaxInclusiveExpression(String maxInclusiveExpression) {
        this.maxInclusiveExpression = maxInclusiveExpression;
    }

    public void setMinExclusiveExpression(String minExclusiveExpression) {
        this.minExclusiveExpression = minExclusiveExpression;
    }

    public void setMaxExclusiveExpression(String maxExclusiveExpression) {
        this.maxExclusiveExpression = maxExclusiveExpression;
    }

}


text:
package info.dgjones.st2x.transform.method.intra;

import java.util.List;

import info.dgjones.st2x.JavaMethod;
import info.dgjones.st2x.javatoken.JavaAssignment;
import info.dgjones.st2x.javatoken.JavaBlockEnd;
import info.dgjones.st2x.javatoken.JavaBlockStart;
import info.dgjones.st2x.javatoken.JavaCallEnd;
import info.dgjones.st2x.javatoken.JavaCallKeywordStart;
import info.dgjones.st2x.javatoken.JavaCallStart;
import info.dgjones.st2x.javatoken.JavaIdentifier;
import info.dgjones.st2x.javatoken.JavaKeyword;
import info.dgjones.st2x.javatoken.JavaStatementTerminator;
import info.dgjones.st2x.javatoken.JavaType;
import info.dgjones.st2x.transform.method.AbstractMethodBodyTransformation;
import info.dgjones.st2x.transform.tokenmatcher.TokenMatcher;
import info.dgjones.st2x.transform.tokenmatcher.TokenMatcherFactory;

public class TransformReanimate extends AbstractMethodBodyTransformation {

	public TransformReanimate() {
		super();
	}
	public TransformReanimate(TokenMatcherFactory factory) {
		super(factory);
	}

	protected TokenMatcher matchers(TokenMatcherFactory factory) {
		return factory.seq(
				factory.token(JavaCallKeywordStart.class, "reanimate"),
				factory.token(JavaBlockStart.class),
				factory.token(JavaType.class),
				factory.token(JavaIdentifier.class),
				factory.token(JavaStatementTerminator.class)
			);
	}

	protected int transform(JavaMethod javaMethod, List tokens, int i) {
		JavaType tempType = (JavaType)tokens.get(i+2);
		JavaIdentifier tempName = (JavaIdentifier)tokens.get(i+3);

		int expressionStart = javaMethod.methodBody.findStartOfExpression(i-1);
		int blockEnd = javaMethod.methodBody.findEndOfBlock(i+1);
		//TODO should check to ensure only one statement within this block

		javaMethod.methodBody.shouldMatch(blockEnd+1, JavaCallEnd.class);
		javaMethod.methodBody.shouldMatch(blockEnd+2, JavaStatementTerminator.class);

		tokens.remove(blockEnd+2);
		tokens.remove(blockEnd+1);

		tokens.add(blockEnd+1, new JavaKeyword("finally"));
		tokens.add(blockEnd+2, new JavaBlockStart());
		tokens.add(blockEnd+3, new JavaIdentifier("AboraBlockSupport"));
		tokens.add(blockEnd+4, new JavaCallStart("exitRecorderFossilReanimate"));
		tokens.add(blockEnd+5, new JavaCallEnd());
		tokens.add(blockEnd+6, new JavaStatementTerminator());
		tokens.add(blockEnd+7, new JavaBlockEnd());

		javaMethod.methodBody.removeShouldMatch(i+4, JavaStatementTerminator.class);
		javaMethod.methodBody.removeShouldMatch(i+3, JavaIdentifier.class);
		javaMethod.methodBody.removeShouldMatch(i+2, JavaType.class);
		javaMethod.methodBody.removeShouldMatch(i, JavaCallStart.class, "reanimate");

		tokens.add(i, new JavaCallEnd());
		tokens.add(i+1, new JavaStatementTerminator());
		tokens.add(i+2, new JavaKeyword("try"));

		tokens.add(expressionStart, new JavaType(tempType.value));
		tokens.add(expressionStart+1, new JavaIdentifier(tempName.value));
		tokens.add(expressionStart+2, new JavaAssignment());
		tokens.add(expressionStart+3, new JavaIdentifier("AboraBlockSupport"));
		tokens.add(expressionStart+4, new JavaCallKeywordStart("enterRecorderFossilReanimate"));

		return i;
	}
}


text:
// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using GraphQL.Types;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Infrastructure.Json.Objects;

namespace Squidex.Domain.Apps.Entities.Contents.GraphQL.Types.Contents;

internal sealed class NestedGraphType : ObjectGraphType<JsonObject>
{
    public NestedGraphType(Builder builder, FieldInfo fieldInfo)
    {
        // The name is used for equal comparison. Therefore it is important to treat it as readonly.
        Name = fieldInfo.NestedType;

        foreach (var nestedFieldInfo in fieldInfo.Fields)
        {
            if (nestedFieldInfo.Field.IsComponentLike())
            {
                AddField(new FieldType
                {
                    Name = nestedFieldInfo.FieldNameDynamic,
                    Arguments = ContentActions.Json.Arguments,
                    ResolvedType = Scalars.Json,
                    Resolver = FieldVisitor.JsonPath,
                    Description = nestedFieldInfo.Field.RawProperties.Hints
                }).WithSourceName(nestedFieldInfo);
            }

            var (resolvedType, resolver, args) = builder.GetGraphType(nestedFieldInfo);

            if (resolvedType != null && resolver != null)
            {
                AddField(new FieldType
                {
                    Name = nestedFieldInfo.FieldName,
                    Arguments = args,
                    ResolvedType = resolvedType,
                    Resolver = resolver,
                    Description = nestedFieldInfo.Field.RawProperties.Hints
                }).WithSourceName(nestedFieldInfo);
            }
        }

        Description = $"The structure of the {fieldInfo.DisplayName} nested schema.";
    }
}


text:
package com.lightbend.training.coffeehouse;

import akka.actor.AbstractLoggingActor;
import akka.actor.Props;
import akka.japi.pf.ReceiveBuilder;

public class CoffeeHouse extends AbstractLoggingActor {

    public CoffeeHouse() {
        log().debug("CoffeeHouse Open");

        receive(ReceiveBuilder.
                match(CreateGuest.class, createGuest ->
                        createGuest()
                ).
                matchAny(this::unhandled).build()
        );
    }

    public static Props props() {
        return Props.create(CoffeeHouse.class, CoffeeHouse::new);
    }

    protected void createGuest() {
        context().actorOf(Guest.props());
    }

    public static final class CreateGuest {

        public static final CreateGuest Instance =
                new CreateGuest();

        private CreateGuest() {
        }
    }
}


text:
@implementation NSString (BMUICore)

- (CGSize)bmSizeWithFont:(UIFont *)font {
    NSMutableDictionary *attributes = [NSMutableDictionary new];
    [attributes bmSafeSetObject:font forKey:NSFontAttributeName];
    return [self sizeWithAttributes:attributes];
}

- (CGSize)bmSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size {
    return [self bmSizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByWordWrapping];
}

- (CGSize)bmSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(NSLineBreakMode)lineBreakMode {
    NSMutableDictionary *attributes = [NSMutableDictionary new];
    [attributes bmSafeSetObject:font forKey:NSFontAttributeName];

    NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
    paragraphStyle.lineBreakMode = lineBreakMode;

    [attributes bmSafeSetObject:paragraphStyle forKey:NSParagraphStyleAttributeName];

    return [self bmSizeWithAttributes:attributes constrainedToSize:size];
}

- (CGSize)bmSizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode {
    return [self bmSizeWithFont:font constrainedToSize:CGSizeMake(width, font.lineHeight) lineBreakMode:lineBreakMode];
}

- (void)bmDrawInRect:(CGRect)rect
            withFont:(UIFont *)font
       lineBreakMode:(NSLineBreakMode)lineBreakMode
           textColor:(UIColor *)textColor
              shadow:(NSShadow *)shadow
          actualSize:(CGSize *)actualSize {
    [self bmDrawInRect:rect withFont:font lineBreakMode:lineBreakMode alignment:NSTextAlignmentLeft textColor:textColor shadow:shadow actualSize:actualSize];
}

- (void)bmDrawInRect:(CGRect)rect
            withFont:(UIFont *)font
       lineBreakMode:(NSLineBreakMode)lineBreakMode
           alignment:(NSTextAlignment)textAlignment
          actualSize:(CGSize *)actualSize {
    [self bmDrawInRect:rect withFont:font lineBreakMode:lineBreakMode alignment:textAlignment textColor:nil shadow:nil actualSize:actualSize];
}

- (void)bmDrawInRect:(CGRect)rect
            withFont:(UIFont *)font
       lineBreakMode:(NSLineBreakMode)lineBreakMode
           alignment:(NSTextAlignment)textAlignment
           textColor:(UIColor *)textColor
              shadow:(NSShadow *)shadow
            actualSize:(CGSize *)actualSize {
    NSMutableDictionary *attributes = [NSMutableDictionary new];

    NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
    paragraphStyle.lineBreakMode = lineBreakMode;
    paragraphStyle.alignment = textAlignment;

    [attributes bmSafeSetObject:font forKey:NSFontAttributeName];
    [attributes bmSafeSetObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
    [attributes bmSafeSetObject:textColor forKey:NSForegroundColorAttributeName];
    [attributes bmSafeSetObject:textColor forKey:NSStrokeColorAttributeName];
    [attributes bmSafeSetObject:shadow forKey:NSShadowAttributeName];

    // Make an integral frame, otherwise on iOS 8.3 and below, some texts are cut off after first character
    rect = CGRectIntegral(rect);

    [self drawInRect:rect withAttributes:attributes];

    if (actualSize) {
        *actualSize = [self bmSizeWithAttributes:attributes constrainedToSize:rect.size];
    }
}

- (void)bmDrawAtPoint:(CGPoint)point withFont:(UIFont *)font textColor:(UIColor *)textColor shadow:(NSShadow *)shadow actualSize:(CGSize *)actualSize {
    NSMutableDictionary *attributes = [NSMutableDictionary new];
    [attributes bmSafeSetObject:font forKey:NSFontAttributeName];
    [attributes bmSafeSetObject:textColor forKey:NSForegroundColorAttributeName];
    [attributes bmSafeSetObject:textColor forKey:NSStrokeColorAttributeName];
    [attributes bmSafeSetObject:shadow forKey:NSShadowAttributeName];
    [self drawAtPoint:point withAttributes:attributes];

    if (actualSize) {
        *actualSize = [self bmSizeWithAttributes:attributes constrainedToSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)];
    }
}

- (CGSize)bmSizeWithAttributes:(NSDictionary *)attributes constrainedToSize:(CGSize)constraintSize {
    CGRect textRect = [self boundingRectWithSize:constraintSize
                                         options:NSStringDrawingUsesLineFragmentOrigin
                                      attributes:attributes
                                         context:nil];
    textRect = CGRectIntegral(textRect);
    return textRect.size;
}

- (void)bmDrawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font lineBreakMode:(NSLineBreakMode)lineBreakMode actualSize:(CGSize *)actualSize {
    CGRect rect = CGRectMake(point.x, point.y, width, font.lineHeight);
    [self bmDrawInRect:rect withFont:font lineBreakMode:lineBreakMode alignment:NSTextAlignmentLeft actualSize:actualSize];
}

@end


text:
function love.conf(t)
  t.identity = "levels"
  t.window.title = "GDclone"
  t.window.width = 1000
  t.window.height = 600
  t.window.resizable = false
  t.window.icon = "assets/player.png"
end


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

namespace B2API
{
    /// <summary>
    /// B2 File
    /// </summary>
    internal class HideFileJSONRequest : JSONRequestBase
    {
        #region Public Properties

        public string bucketId { get; set; }
        public string fileName { get; set; }

        #endregion Public Properties
    }
}


text:
<!DOCTYPE html>

        <meta charset="UTF-8" />
        <meta name="robots" content="index, follow, all" />
        <title>Thelia\TaxEngine\TaxEngine | </title>
                    <link rel="stylesheet" type="text/css" href="../../stylesheet.css">

Classes

Namespaces

Interfaces

Traits

Index

Class

Thelia\TaxEngine\TaxEngine

    class
    TaxEngine

Class TaxEngine

Methods

                    __construct(Request $request)

                    addTaxTypeDirectory(string $namespace, string $path_to_tax_type_classes)

Add a directroy which contains tax types classes.

                    addTaxType(unknown $fullyQualifiedclassName)

Add a tax type to the current list.

                    getTaxTypeList()

                    null|TaxEngine

                    getDeliveryCountry()

Find Tax Country Id First look for a picked delivery address country Then look at the current customer default address country Else look at the default website country

Details

at line 38

                    public
    __construct(Request $request)

Parameters

                Request
                $request

at line 53

                    public
    addTaxTypeDirectory(string $namespace, string $path_to_tax_type_classes)

Add a directroy which contains tax types classes.

The tax engine
will scan this directory, and add all the tax type classes.

Parameters

                string
                $namespace
                the namespace of the classes in the directory

                string
                $path_to_tax_type_classes
                the path to the directory

at line 64

                    public
    addTaxType(unknown $fullyQualifiedclassName)

Add a tax type to the current list.

Parameters

                unknown
                $fullyQualifiedclassName
                the fully qualified classname, su chas MyTaxes\Taxes\MyTaxType

at line 69

                    public
    getTaxTypeList()

at line 117

                    public            null|TaxEngine
    getDeliveryCountry()

Find Tax Country Id First look for a picked delivery address country Then look at the current customer default address country Else look at the default website country

Return Value

            null|TaxEngine

        Generated by Sami, the API Documentation Generator.


text:
package de.lessvoid.nifty.screen;

import de.lessvoid.nifty.elements.Action;
import de.lessvoid.nifty.elements.Element;

public class EndOfScreenAction implements Action {

  public void perform(final Screen screen, final Element element) {
    screen.onEndScreenHasEnded();
  }
}


text:
class CreateSwProjectCustomerQnaxRoleAccessRights < ActiveRecord::Migration
  def change
    create_table :sw_project_customer_qnax_role_access_rights do |t|
      t.integer :user_role_id
      t.string :action
      t.string :resource
      t.string :brief_note
      t.integer :last_updated_by_id
      t.boolean :processed, :default => false

      t.timestamps
    end

    add_index :sw_project_customer_qnax_role_access_rights, :user_role_id
    add_index :sw_project_customer_qnax_role_access_rights, :action
    add_index :sw_project_customer_qnax_role_access_rights, :resource
    add_index :sw_project_customer_qnax_role_access_rights, :processed
  end
end


text:
package com.pivotal.gemfirexd.internal.engine.ddl.wan.messages;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Set;

import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.Operation;
import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueImpl;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.ReplyException;
import com.gemstone.gemfire.distributed.internal.ReplyMessage;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.DSFIDFactory;
import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisee;
import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.EnumListenerEvent;
import com.gemstone.gemfire.internal.cache.EventID;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
import com.pivotal.gemfirexd.internal.engine.GfxdConstants;
import com.pivotal.gemfirexd.internal.engine.Misc;
import com.pivotal.gemfirexd.internal.engine.distributed.GfxdMessage;
import com.pivotal.gemfirexd.internal.engine.distributed.utils.GemFireXDUtils;
import com.pivotal.gemfirexd.internal.engine.jdbc.GemFireXDRuntimeException;
import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.shared.common.sanity.SanityManager;
/**
 * @author Asif Shahid
 * @author Yogesh Mahajan
 *
 */
public abstract class AbstractDBSynchronizerMessage extends GfxdMessage {

  private transient EntryEventImpl event = null;

  // final private transient boolean remoteDistribution;
  final transient LocalRegion rgn;

  AbstractDBSynchronizerMessage() {
    this.rgn = null;
  }

  AbstractDBSynchronizerMessage(LocalRegion rgn) {
    final GemFireCacheImpl cache = rgn.getCache();
    final EventID eventId = new EventID(cache.getDistributedSystem());
    final DistributedMember member = cache.getMyId();
    this.initializeEvent(rgn, eventId, member);
    // this.remoteDistribution = remoteDistribution;
    this.rgn = rgn;
  }

  final void initializeEvent(LocalRegion rgn, EventID eventId,
      DistributedMember member) {
    this.event = EntryEventImpl.create(rgn, getOperation(), null, null, null,
        true, member);
    this.event.setEventId(eventId);
    // OFFHEAP: callers make sure event only has on heap values.
  }

  /**
   * Suranjan: This needs to be changed to do the distribute in parallel.
   */
  final void addToLocalDBSynchronizerConditionally(boolean isQueryNode) {
    final LocalRegion rgn = this.event.getRegion();
    final List<Integer> remoteDsIds = rgn.getRemoteDsIds(rgn
        .getAllGatewaySenderIds());
    boolean didLocalPublish = false;
    if (remoteDsIds != null && remoteDsIds.size() > 0) {
      // TODO: PERF: the distribute should be done in parallel
      // also same issue in GFE layer
      final Set<String> asyncQueueIds;
      if (!this.skipListeners()
          && (asyncQueueIds = rgn.getAsyncEventQueueIds()).size() > 0) {
        for (final Object q : rgn.getCache().getAsyncEventQueues()) {
          final AsyncEventQueueImpl asyncQueue = (AsyncEventQueueImpl)q;
          if (!asyncQueue.isParallel()
              && asyncQueueIds.contains(asyncQueue.getId())) {
            if (GemFireXDUtils.TraceDBSynchronizer) {
              SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_DB_SYNCHRONIZER,
                  "BaseActivation:addToLocalDBSynchronizerConditionally: "
                      + "adding EntryEventImpl to local AsyncEventQueue="
                      + asyncQueue.getId() + ": " + event);
            }
            asyncQueue.getSender().distribute(getListenerEvent(), event,
                remoteDsIds);
            didLocalPublish = true;
          }
        }
      }
      final Set<String> senderIds = rgn.getGatewaySenderIds();
      if (senderIds.size() > 0) {
        for (final Object s : rgn.getCache().getAllGatewaySenders()) {
          final AbstractGatewaySender sender = (AbstractGatewaySender)s;
          if (!sender.isForInternalUse() && !sender.isParallel()
              && senderIds.contains(sender.getId())) {
            if (GemFireXDUtils.TraceDBSynchronizer) {
              SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_DB_SYNCHRONIZER,
                  "BaseActivation:addToLocalDBSynchronizerConditionally: "
                      + "adding EntryEventImpl to local GatewaySender="
                      + sender.getId() + ": " + event);
            }
            sender.distribute(getListenerEvent(), event, remoteDsIds);
            didLocalPublish = true;
          }
        }
      }
    }
    if (!didLocalPublish && !isQueryNode && !skipListeners()) {
      throw new IllegalStateException("Unexpected AbstractDBSynchronizerMessage "
          + "received that was not applied anywhere " + toString());
    }
  }

  @Override
  public void toData(final DataOutput out) throws IOException {
    super.toData(out);
    try {
      // Write EventID
      DataSerializer.writeObject(this.event.getEventId(), out);
      ((InternalDistributedMember)event.getDistributedMember()).toData(out);
      // Write Region name
      DataSerializer.writeString(this.event.getRegion().getFullPath(), out);

    } catch (Exception e) {
      throw new IOException(e);
    }
  }

  public final EntryEventImpl getEntryEventImpl() {
    return this.event;
  }

  @Override
  protected void processMessage(DistributionManager dm) {
    if (this.event != null) {
      final LocalRegion rgn = this.event.getRegion();
      if (rgn != null) {
        rgn.waitOnInitialization();
      } else {
        Misc.checkIfCacheClosing(null);
      }
      if (GemFireXDUtils.TraceDBSynchronizer) {
        SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_DB_SYNCHRONIZER,
            "DBSynchronizerMessage: Executing with fields as: "
                + this.toString());
      }
      try {
        this.addToLocalDBSynchronizerConditionally(false);
        if (GemFireXDUtils.TraceDBSynchronizer) {
          SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_DB_SYNCHRONIZER,
              "DBSynchronizerMessage: Successfully executed "
                  + "message with fields: " + this.toString());
        }
      } catch (Exception ex) {
        // Log a severe log in case of an exception
        final LogWriter logger = this.event.getRegion().getCache().getLogger();
        if (logger.severeEnabled()) {
          logger.severe("DBSynchronizerMessage: SQL exception in "
              + "executing message with fields as " + this.toString(), ex);
        }
        if (dm == null) {
          throw new ReplyException(
              "Unexpected SQLException on member with no DM (going down?)", ex);
        } else if (this.processorId > 0) {
          throw new ReplyException("Unexpected SQLException on member "
              + dm.getDistributionManagerId(), ex);
        }
      }
    }
  }

  @Override
  protected void sendReply(ReplyException ex, DistributionManager dm) {
    ReplyMessage.send(getSender(), this.processorId, ex, dm, this);
  }

  @Override
  protected boolean waitForNodeInitialization() {
    return true;
  }

  @Override
  protected void appendFields(final StringBuilder sb) {
    super.appendFields(sb);
    sb.append("; entryEvent=").append(this.event);
  }

  @Override
  public void fromData(DataInput in)
      throws IOException, ClassNotFoundException {
    super.fromData(in);
    // Read EventID
    EventID eventID = DataSerializer.readObject(in);
    DistributedMember member = DSFIDFactory.readInternalDistributedMember(in);
    String regionName = DataSerializer.readString(in);
    final GemFireCacheImpl cache = Misc.getGemFireCacheNoThrow();
    final LocalRegion rgn = cache != null
        ? cache.getRegionByPathForProcessing(regionName) : null;
    // initialize event even if Region is null so that child classes can
    // proceed with their fromData
    this.initializeEvent(rgn, eventID, member);
  }

  public final void applyOperation() throws StandardException {
    // Distribute the message only in case of PR
    try {
      @SuppressWarnings("unchecked")
      Set<DistributedMember> members = ((CacheDistributionAdvisee)rgn)
          .getCacheDistributionAdvisor()
          .adviseSerialAsyncEventQueueOrGatewaySender();
      if (GemFireXDUtils.TraceDBSynchronizer) {
        SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_DB_SYNCHRONIZER,
            "BaseActivation: distributing bulk DML to remote nodes. "
                + "Message={" + this + "} to members=" + members);
      }
      this.send(this.rgn.getSystem(), members);

    } catch (SQLException sqle) {
      throw Misc.wrapSQLException(sqle, sqle);
    }
    addToLocalDBSynchronizerConditionally(true);
  }

  @Override
  protected void handleProcessorReplyException(String exPrefix,
      ReplyException replyEx) throws SQLException, StandardException {
    final Throwable t = replyEx.getCause();
    if (!GemFireXDUtils.retryToBeDone(t)) {
      if (GemFireXDUtils.TraceFunctionException) {
        SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_FUNCTION_EX, exPrefix
            + ": unexpected exception", replyEx);
      }
      try {
        GemFireXDRuntimeException.throwSQLOrRuntimeException(toString()
            + ": unexpected exception", t);
      } catch (SQLException sqle) {
        throw Misc.wrapRemoteSQLException(sqle, replyEx, replyEx.getSender());
      }
    }
  }

  abstract Operation getOperation();

  abstract EnumListenerEvent getListenerEvent();

  abstract boolean skipListeners();
}


text:
package cz.kramolis.mega.runtime.config.internal;

import cz.kramolis.mega.runtime.AbstractCdiIT;

import org.junit.Test;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;

public class TypesafeConfigDeltaSpikeConfigSourceIT extends AbstractCdiIT {

    @Test
    public void testExistingKey() {
        MyConfigBean myConfigBean = getCdi().select(MyConfigBean.class).get();
        assertThat(myConfigBean.getKey1(), is("value1"));
    }

    @Test
    public void testNotExistingKey() {
        MyConfigBean myConfigBean = getCdi().select(MyConfigBean.class).get();
        assertThat(myConfigBean.getUnknown(), is(nullValue()));
    }

}


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using ConfigServer.Core;
using System.Linq;

namespace ConfigServer.Server
{
    internal class SnapshotEndpoint : IEndpoint
    {
        readonly IHttpResponseFactory httpResponseFactory;
        readonly IConfigurationSnapshotRepository snapShotRepository;
        readonly ICommandBus commandBus;
        readonly IConfigurationClientService configurationClientService;
        public SnapshotEndpoint(IConfigurationSnapshotRepository snapShotRepository, ICommandBus commandBus, IConfigurationClientService configurationClientService, IHttpResponseFactory httpResponseFactory)
        {
            this.httpResponseFactory = httpResponseFactory;
            this.snapShotRepository = snapShotRepository;
            this.commandBus = commandBus;
            this.configurationClientService = configurationClientService;
        }

        public Task Handle(HttpContext context, ConfigServerOptions options)
        {
            // / POST Save snapshot
            // /{snapShotId}DELETE: Deletes snapShot
            // /Group/{clientGroupId} GET: Gets SnapshotIds for clientGroupId
            // /{snapShotId}/to/{clientId}

            if (!CheckMethodAndAuthentication(context, options))
                return Task.FromResult(true);
            var pathParams = context.ToPathParams();

            switch(pathParams.Length)
            {
                case 0:
                    return HandleSaveSnapshot(context, options);
                case 1:
                    return HandleDeleteSnapshot(context, pathParams[0], options);
                case 2:
                    return HandleGetSnapshotForGroup(context, pathParams, options);
                case 3:
                    return HandlePushSnapshotToClient(context, pathParams, options);
                default:
                    httpResponseFactory.BuildNotFoundStatusResponse(context);
                    return Task.FromResult(true);
            }
        }

        private async Task HandleSaveSnapshot(HttpContext context, ConfigServerOptions options)
        {
            if (context.Request.Method != "POST")
            {
                httpResponseFactory.BuildMethodNotAcceptedStatusResponse(context);
                return;
            }

            var command = await context.GetObjectFromJsonBodyAsync<CreateSnapshotCommand>();
            var commmandResult = await commandBus.SubmitAsync(command);
            await httpResponseFactory.BuildResponseFromCommandResult(context, commmandResult);
        }

        private async Task HandleDeleteSnapshot(HttpContext context, string snapshotId, ConfigServerOptions options)
        {
            if (context.Request.Method != "DELETE")
            {
                httpResponseFactory.BuildMethodNotAcceptedStatusResponse(context);
                return;
            }

            var command = new DeleteSnapshotCommand { SnapshotId = snapshotId };
            var commmandResult = await commandBus.SubmitAsync(command);
            await httpResponseFactory.BuildResponseFromCommandResult(context, commmandResult);
        }

        private async Task HandleGetSnapshotForGroup(HttpContext context,string[] pathParams, ConfigServerOptions options)
        {
            if(context.Request.Method != "GET")
            {
                httpResponseFactory.BuildMethodNotAcceptedStatusResponse(context);
                return;
            }

            if (pathParams[0].Equals("group", StringComparison.OrdinalIgnoreCase))
            {
                var info = await snapShotRepository.GetSnapshots();
                await httpResponseFactory.BuildJsonResponse(context, info.Where(w => string.Equals(w.GroupId, pathParams[1], StringComparison.OrdinalIgnoreCase)));
                return;
            }

            httpResponseFactory.BuildNotFoundStatusResponse(context);
        }

        private async Task HandlePushSnapshotToClient(HttpContext context, string[] pathParams, ConfigServerOptions options)
        {
            if (context.Request.Method != "POST")
            {
                httpResponseFactory.BuildMethodNotAcceptedStatusResponse(context);
                return;
            }
            var client = await configurationClientService.GetClientOrDefault(pathParams[2]);

            if (!context.ChallengeClientConfigurator(options, client, httpResponseFactory))
                return;

            var request = await context.GetObjectFromJsonBodyAsync<PushSnapshotToClientRequest>();
            if (client != null && request != null && pathParams[1].Equals("to", StringComparison.OrdinalIgnoreCase))
            {
                var command = new PushSnapshotToClientCommand { SnapshotId = pathParams[0], TargetClient = client, ConfigsToCopy =  request.ConfigsToCopy ?? new string[0]};
                var commmandResult = await commandBus.SubmitAsync(command);
                await httpResponseFactory.BuildResponseFromCommandResult(context, commmandResult);
                return;
            }

            httpResponseFactory.BuildNotFoundStatusResponse(context);
        }

        private bool CheckMethodAndAuthentication(HttpContext context, ConfigServerOptions options)
        {
            if (context.Request.Method == "GET"|| context.Request.Method == "POST" || context.Request.Method == "DELETE")
            {
                return context.ChallengeUser(options.ClientAdminClaimType, new HashSet<string>(new[] { ConfigServerConstants.AdminClaimValue, ConfigServerConstants.ConfiguratorClaimValue }, StringComparer.OrdinalIgnoreCase), options.AllowManagerAnomynousAccess, httpResponseFactory);
            }
            else
            {
                httpResponseFactory.BuildMethodNotAcceptedStatusResponse(context);
                return false; ;
            }
        }
    }
}


text:
<!DOCTYPE html>

		<meta charset="utf-8" />
		<base href="../../" />

		<link type="text/css" rel="stylesheet" href="page.css" />

		[page:Object3D] → [page:Light] →

[name]

			RectAreaLight emits light uniformly across the face a rectangular plane. This light type can be
			used to simulate light sources such as bright windows or strip lighting.

			RectAreaLight does not support shadows.

Examples

			[example:webgl_lights_rectarealight WebGL / rectarealight ]

var width = 10;
var height = 10;
var intensity = 1;
var rectLight = new THREE.RectAreaLight( 0xffffff, intensity,  width, height );
rectLight.position.set( 5, 5, 0 );
rectLight.lookAt( 0, 0, 0 );
scene.add( rectLight )

rectLightHelper = new THREE.RectAreaLightHelper( rectLight );
scene.add( rectLightHelper );

Constructor

[name]( [param:Integer color], [param:Float intensity], [param:Float width], [param:Float height] )

			[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).

			[page:Float intensity] - (optional) the light's intensity, or brightness. Default is 1.

			[page:Float width] - (optional) width of the light. Default is 10.

			[page:Float height] - (optional) height of the light. Default is 10.

			Creates a new [name].

Properties

			See the base [page:Light Light] class for common properties.

[property:Boolean isRectAreaLight]

			Used to check whether this or derived classes are RectAreaLights. Default is *true*.

			You should not change this, as it used internally for optimisation.

Methods

			See the base [page:Light Light] class for common methods.

[method:RectAreaLight copy]( [param:RectAreaLight source] )

		Copies value of all the properties from the [page:RectAreaLight source] to this
		RectAreaLight.

		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
DNSOutgoing.MessageOutputStream (JmDNS)
</TITLE>

<META NAME="date" CONTENT="2011-08-25">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

JmDNS 3.4.1

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

javax.jmdns.impl

Class DNSOutgoing.MessageOutputStream

java.lang.Object
  java.io.OutputStream
      java.io.ByteArrayOutputStream
          javax.jmdns.impl.DNSOutgoing.MessageOutputStream

All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

Enclosing class:
DNSOutgoing

public static class DNSOutgoing.MessageOutputStream
extends java.io.ByteArrayOutputStream

Field Summary

Fields inherited from class java.io.ByteArrayOutputStream

buf, count

Method Summary

Methods inherited from class java.io.ByteArrayOutputStream

close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo

Methods inherited from class java.io.OutputStream

flush, write

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

JmDNS 3.4.1

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD