text:
package self.micromagic.eterna.model;

import java.io.StringReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.dom4j.Element;

import self.micromagic.cg.BeanTool;
import self.micromagic.cg.ClassGenerator;
import self.micromagic.eterna.dao.ResultRow;
import self.micromagic.eterna.share.EternaException;
import self.micromagic.expression.DynamicObject;
import self.micromagic.expression.ExprTool;
import self.micromagic.expression.Expression;
import self.micromagic.expression.antlr.ExprLexer;
import self.micromagic.expression.antlr.ExprParser;
import self.micromagic.expression.antlr.ExprTokenTypes;
import self.micromagic.util.StringAppender;
import self.micromagic.util.StringTool;
import self.micromagic.util.Utility;
import self.micromagic.util.container.ValueContainerMap;
import self.micromagic.util.ref.BooleanRef;
import self.micromagic.util.ref.StringRef;
import antlr.collections.AST;

/**
 * 数据处理者.
 */
public class DataHandler
		implements ExprTokenTypes, DynamicObject
{
	/**
	 * 配置中设置是否需要在日志中记录原始值的标识.
	 */
	public static final String LOG_OLD_VALUE_FLAG = "eterna.data.logOldValue";
	/**
	 * 配置中设置是否需要在日志中记录变量值变更信息的标识.
	 */
	public static final String LOG_VAR_CHANGED_FLAG = "eterna.data.logVarChanged";

	/**
	 * 无操作.
	 */
	private static final int OPT_TYPE_NONE = 0;
	/**
	 * 修改操作.
	 */
	private static final int OPT_TYPE_MODIFY = 1;
	/**
	 * 移除操作.
	 */
	private static final int OPT_TYPE_DELETE = 3;

	/**
	 * null的标识对象.
	 */
	public static final Object NULL_FLAG = new Object();

	/**
	 * 读取数据的配置.
	 */
	private String config;

	/**
	 * AppData中的map的获取工具.
	 */
	private MapGetter mapGetter;

	/**
	 * 读取/设置map中数据的名称.
	 */
	private Object[] subs;

	/**
	 * 从定义的变量中读取/设置数据.
	 */
	private VarCache.VarInfo varInfo;

	/**
	 * 在一个表达式对象中读取/设置数据.
	 */
	private Object exprObj;

	private boolean needMapDataName = true;
	private boolean readOnly = true;
	private String caption = "config";

	/**
	 * 是否需要在日志中记录原始值.
	 */
	private static boolean logOldValue;
	/**
	 * 是否需要在日志中记录变量值的变更.
	 */
	private static boolean logVarChanged;

	/**
	 * 存放名称与AppData中map索引值的对应表.
	 */
	private static final Map mapNameIndex = new HashMap();

	static
	{
		try
		{
			Utility.addFieldPropertyManager(LOG_OLD_VALUE_FLAG,
					DataHandler.class, "logOldValue");
			Utility.addFieldPropertyManager(LOG_VAR_CHANGED_FLAG,
					DataHandler.class, "logVarChanged");
		}
		catch (Exception ex) {}

		MapGetter paramGetter = new BaseMapGetter(AppData.REQUEST_PARAMETER_MAP);
		MapGetter attrGetter = new BaseMapGetter(AppData.REQUEST_ATTRIBUTE_MAP);
		MapGetter sessionGetter = new BaseMapGetter(AppData.SESSION_ATTRIBUTE_MAP);
		mapNameIndex.put(AppData.REQUEST_PARAMETER_MAP_NAME, paramGetter);
		mapNameIndex.put(AppData.REQUEST_ATTRIBUTE_MAP_NAME, attrGetter);
		mapNameIndex.put(AppData.SESSION_ATTRIBUTE_MAP_NAME, sessionGetter);
		mapNameIndex.put(AppData.DATA_MAP_NAME, new BaseMapGetter(AppData.DATA_MAP));
		mapNameIndex.put("param", paramGetter);
		mapNameIndex.put("attr", attrGetter);
		mapNameIndex.put("session", sessionGetter);
		mapNameIndex.put("RP", paramGetter);
		mapNameIndex.put("RA", attrGetter);
		mapNameIndex.put("SA", sessionGetter);
		mapNameIndex.put("header", new HeaderGetter());
		mapNameIndex.put("cookie", new CookieGetter());
	}

	/**
	 * @param caption           显示错误信息是使用的标题
	 * @param needMapDataName   当读取map数据时, 是否需要给出数据的名称
	 *                          当readOnly的值为false时, 此值会被强制设为true
	 * @param readOnly          是否为只读方式
	 */
	public DataHandler(String caption, boolean needMapDataName, boolean readOnly)
	{
		this.caption = caption;
		this.readOnly = readOnly;
		this.needMapDataName = !readOnly || needMapDataName;
	}

	/**
	 * 清空已有的配置
	 */
	private void clearConfig()
	{
		this.config = null;
		this.mapGetter = null;
		this.subs = null;
		this.exprObj = null;
		this.varInfo = null;
	}

	/**
	 * 获取处理配置.
	 */
	public String getConfig()
	{
		return this.config;
	}

	/**
	 * 判断给出的名称是否为有效的变量名主名称.
	 */
	public static boolean isValidMainName(String name)
	{
		if (name == null)
		{
			return false;
		}
		if (mapNameIndex.containsKey(name))
		{
			return true;
		}
		return name.startsWith("$");
	}

	/**
	 * 通过语法分析的节点设置配置.
	 */
	public void setConfig(AST node)
	{
		if (node.getType() != VAR)
		{
			throw new EternaException("The node's type isn't [VAR].");
		}
		if (this.config == null)
		{
			this.clearConfig();
			this.config = node.toStringTree();
		}
		List subs = new ArrayList();
		String mainName = this.parseConfig(node, subs);

		if (this.exprObj != null)
		{
			// 使用表达式对象
			if (!ExprTool.isConstObject(this.exprObj))
			{
				// 不是静态对象, 需要有个变量暂存结果
				this.varInfo = this.getVarCache().getVarInfo(
						"$", VarCache.VarInfo.STATUS_TYPE_INIT, null);
			}
			this.subs = subs.toArray(new Object[subs.size()]);
			return;
		}
		Object tObj = mapNameIndex.get(mainName);
		if (tObj != null)
		{
			MapGetter tmp = (MapGetter) tObj;
			if (tmp.needInit())
			{
				tmp = tmp.init();
			}
			this.mapGetter = tmp;
		}
		if (this.mapGetter != null)
		{
			if (!subs.isEmpty())
			{
				this.subs = subs.toArray(new Object[subs.size()]);
				return;
			}
			if (!this.needMapDataName)
			{
				// 子名称未设置并且不是必需时, 则退出不用抛出异常.
				return;
			}
		}
		else if (mainName.startsWith("$"))
		{
			// 变量定义
			StringRef err = new StringRef(null);
			int varStatusType = this.readOnly ? VarCache.VarInfo.STATUS_TYPE_READ
					: VarCache.VarInfo.STATUS_TYPE_WRITE;
			this.varInfo = this.getVarCache().getVarInfo(mainName, varStatusType, err);
			if (err.getString() != null)
			{
				AppData.log.error("Error " + this.caption + " [" + this.config + "], msg: "
						+ err.getString());
			}
			if (!subs.isEmpty())
			{
				this.subs = subs.toArray(new Object[subs.size()]);
			}
			return;
		}
		throw new EternaException("Error " + this.caption + " main name [" + mainName + "].");
	}

	/**
	 * 设置处理配置.
	 */
	public void setConfig(String config)
			throws EternaException
	{
		this.clearConfig();
		this.config = config;
		ExprLexer lex = new ExprLexer(new StringReader(config));
		ExprParser parser = new ExprParser(lex);
		try
		{
			parser.identVar();
		}
		catch (RuntimeException ex)
		{
			throw ex;
		}
		catch (Exception ex)
		{
			throw new EternaException(ex);
		}
		this.setConfig(parser.getAST());
	}

	private VarCache getVarCache()
	{
		AppData data = AppData.getCurrentData();
		if (data.varCache == null)
		{
			data.varCache = new VarCache();
		}
		return data.varCache;
	}

	public Object getResult(AppData data)
	{
		return this.getData(data, false);
	}

	/**
	 * 根据处理配置读取数据.
	 *
	 * @param data       AppData对象, 可从中获取数据
	 * @param remove     获取数据后, 是否将源头的数据移除
	 */
	public Object getData(AppData data, boolean remove)
			throws EternaException
	{
		int optType = remove ? OPT_TYPE_DELETE : OPT_TYPE_NONE;
		Object value = null;
		if (this.mapGetter != null)
		{
			Map tmpMap = this.mapGetter.getMap(data);
			if (this.subs != null)
			{
				if (this.subs.length == 1)
				{
					Object sub = getExprValue(this.subs[0], data, null);
					value = tmpMap.get(sub);
					if (remove)
					{
						tmpMap.remove(sub);
					}
				}
				else
				{
					value = this.dealValue(tmpMap, this.subs, data, optType, null);
				}
			}
			else
			{
				value = tmpMap;
			}
		}
		else if (this.exprObj != null)
		{
			Object tmp = this.getExprObj(data);
			value = this.dealValue(tmp, this.subs, data, optType, null);
		}
		else if (this.varInfo != null)
		{
			if (this.subs != null)
			{
				Object tmp = this.varInfo.getValue(data);
				value = this.dealValue(tmp, this.subs, data, optType, null);
			}
			else
			{
				value = this.varInfo.getValue(data);
				if (remove)
				{
					this.varInfo.setValue(data, null);
				}
			}
		}
		return value;
	}

	/**
	 * 根据处理配置设置数据.
	 *
	 * @return 原始数据
	 */
	public Object setData(AppData data, Object value)
			throws EternaException
	{
		if (this.readOnly)
		{
			throw new EternaException("The [" + this.caption + "] is read only, can't be setted.");
		}
		if (this.mapGetter != null)
		{
			Map tmpMap = this.mapGetter.getMap(data);
			if (this.subs.length == 1)
			{
				Object sub = getExprValue(this.subs[0], data, null);
				return tmpMap.put(sub, value);
			}
			else
			{
				return this.dealValue(tmpMap, this.subs, data, OPT_TYPE_MODIFY, value);
			}
		}
		else if (this.exprObj != null)
		{
			Object tmp = this.getExprObj(data);
			return this.dealValue(tmp, this.subs, data, OPT_TYPE_MODIFY, value);
		}
		else if (this.varInfo != null)
		{
			if (this.subs != null)
			{
				Object tmp = this.varInfo.getValue(data);
				if (tmp == null)
				{
					// 如果变量值为空, 初始化此变量
					BooleanRef nextInt = new BooleanRef();
					getExprValue(this.subs[0], data, nextInt);
					if (nextInt.value)
					{
						tmp = new ArrayList();
					}
					else
					{
						tmp = new HashMap();
					}
					this.varInfo.setValue(data, tmp);
				}
				return this.dealValue(tmp, this.subs, data, OPT_TYPE_MODIFY, value);
			}
			else
			{
				Object old = this.varInfo.getValue(data);
				this.varInfo.setValue(data, value);
				if (logVarChanged && data.getLogType() > 0)
				{
					Element nowNode = data.getCurrentNode();
					if (nowNode != null)
					{
						Element vNode = nowNode.addElement("set-var-value");
						vNode.addAttribute("name", this.varInfo.getName());
						if (logOldValue)
						{
							AppDataLogExecute.printObject(vNode.addElement("new-value"), value);
							AppDataLogExecute.printObject(vNode.addElement("old-value"), old);
						}
						else
						{
							AppDataLogExecute.printObject(vNode, value);
						}
					}
				}
				return old;
			}
		}
		else
		{
			return null;
		}
	}

	/**
	 * 深度处理map/array/list类型对象中的值.
	 *
	 * @param obj     需要处理的对象
	 * @param subs    需要处理的子名称列表
	 * @param remove  是否需要将原来的值移除
	 * @param newVal  需要设置的新值
	 * @return  obj中的原始值
	 */
	private Object dealValue(Object obj, Object[] subs, AppData data, int optType, Object newVal)
	{
		int dCount = subs.length;
		if (newVal != null || optType > OPT_TYPE_NONE)
		{
			dCount--;
		}
		Object currentVal = obj;
		for (int i = 0; i < dCount; i++)
		{
			if (currentVal == null)
			{
				return null;
			}
			BooleanRef isInt = new BooleanRef();
			Object sub = getExprValue(subs[i], data, isInt);
			Object nextValue;
			if (isInt.value)
			{
				if (currentVal instanceof List)
				{
					int index = ((Number) sub).intValue();
					List list = (List) currentVal;
					nextValue = list.size() > index ? list.get(index) : null;
				}
				else if (currentVal instanceof Collection)
				{
					int count = ((Number) sub).intValue();
					Iterator itr = ((Collection) currentVal).iterator();
					for (int j = 1; j < count; j++)
					{
						itr.next();
					}
					nextValue = itr.next();
				}
				else if (currentVal instanceof CharSequence)
				{
					int index = ((Number) sub).intValue();
					nextValue = new Character(((CharSequence) currentVal).charAt(index));
				}
				else if (ClassGenerator.isArray(currentVal.getClass()))
				{
					nextValue = Array.get(currentVal, ((Number) sub).intValue());
				}
				else
				{
					// 当前值不是list或array无法处理
					throw new EternaException(
							"The value type [" + obj.getClass() + "] can't trans to list or array.");
				}
			}
			else
			{
				nextValue = tran2Map(currentVal).get(sub);
			}
			if (nextValue == null && optType == OPT_TYPE_MODIFY)
			{
				BooleanRef nextInt = new BooleanRef();
				// 判断下一个对象的类型
				getExprValue(subs[i + 1], data, nextInt);
				// 如果是赋值操作, 需要生成对象
				if (nextInt.value)
				{
					nextValue = new ArrayList();
				}
				else
				{
					nextValue = new HashMap();
				}
				this.modifyValue(currentVal, sub, isInt.value, optType, nextValue);
			}
			currentVal = nextValue;
		}
		if (dCount == subs.length || currentVal == null)
		{
			// 如果没有特殊处理, 将当前值返回
			return currentVal;
		}
		BooleanRef isInt = new BooleanRef();
		Object sub = getExprValue(subs[subs.length - 1], data, isInt);
		return this.modifyValue(currentVal, sub, isInt.value, optType, newVal);
	}

	/**
	 * 修改对象中的值.
	 */
	private Object modifyValue(Object obj, Object sub, boolean isInt, int optType, Object newVal)
	{
		if (isInt)
		{
			int index = ((Number) sub).intValue();
			if (obj instanceof List)
			{
				List list = (List) obj;
				int size = list.size();
				if (size < 0 || size <= index)
				{
					if (size >= 0)
					{
						int count = index - list.size();
						for (int i = 0; i < count; i++)
						{
							list.add(null);
						}
					}
					list.add(newVal);
					return null;
				}
				else if (optType == OPT_TYPE_DELETE)
				{
					return list.remove(index);
				}
				else
				{
					return list.set(index, newVal);
				}
			}
			else if (ClassGenerator.isArray(obj.getClass()))
			{
				Object old = Array.get(obj, index);
				Array.set(obj, index, newVal);
				return old;
			}
			else
			{
				// 当前值不是list或array无法处理
				throw new EternaException(
						"The value type [" + obj.getClass() + "] can't trans to list or array.");
			}
		}
		else
		{
			Map tmpMap = tran2Map(obj);
			// 进行特殊处理, 移除或设置新值.
			if (optType == OPT_TYPE_DELETE)
			{
				return tmpMap.remove(sub);
			}
			else
			{
				return tmpMap.put(sub, newVal);
			}
		}
	}

	/**
	 * 将对象转换为map.
	 */
	private static Map tran2Map(Object obj)
	{
		if (obj instanceof Map)
		{
			return (Map) obj;
		}
		if (obj instanceof ResultRow)
		{
			return ValueContainerMap.createResultRowMap((ResultRow) obj);
		}
		if (BeanTool.checkBean(obj.getClass()))
		{
			return BeanTool.getBeanMap(obj);
		}
		throw new EternaException("The value type [" + obj.getClass() + "] can't trans to map.");
	}

	/**
	 * 从表达式对象中获取数据.
	 */
	private Object getExprObj(AppData data)
	{
		if (this.varInfo == null)
		{
			// 没有定义变量, 说明是个常数
			return this.exprObj;
		}
		Object tmp = this.varInfo.getValue(data);
		if (tmp == null)
		{
			tmp = getExprValue(this.exprObj, data, null);
			if (tmp == null)
			{
				tmp = NULL_FLAG;
			}
			this.varInfo.setValue(data, tmp);
		}
		return tmp == NULL_FLAG ? null : tmp;
	}

	/**
	 * 获取表达式对象的值.
	 */
	private static Object getExprValue(Object expr, AppData data, BooleanRef isInt)
	{
		Object r = null;
		if (expr instanceof DynamicObject)
		{
			r = ((DynamicObject) expr).getResult(data);
		}
		else
		{
			r = expr;
		}
		if (isInt != null)
		{
			// isInt不为null, 表示需要整型或字符串
			if (r instanceof Number)
			{
				isInt.value = true;
			}
			else if (r != null)
			{
				r = r.toString();
			}
		}
		return r;
	}

	/**
	 * 解析配置的语法分析节点.
	 */
	protected String parseConfig(AST node, List subs)
			throws EternaException
	{
		AST first = node.getFirstChild();
		String mainName = null;
		if (first.getType() == EXPR)
		{
			if (first.getNextSibling() == null)
			{
				throw new EternaException("Not found sub after expression.");
			}
			this.exprObj = this.parseNode(first);
		}
		else
		{
			mainName = first.getText();
		}
		AST tmp = first.getNextSibling();
		while (tmp != null)
		{
			if (tmp.getType() == DOT)
			{
				tmp = tmp.getNextSibling();
				subs.add(tmp.getText());
			}
			else if (tmp.getType() == LBRACK)
			{
				tmp = tmp.getNextSibling();
				subs.add(this.parseNode(tmp));
			}
			else
			{
				throw new EternaException("Error node type in data handler [" + node.getText() + "].");
			}
			tmp = tmp.getNextSibling();
		}
		return mainName;
	}
	/**
	 * 解析表达式节点对象.
	 */
	protected Object parseNode(AST node)
	{
		Object obj = ExprTool.parseExpNode(node);
		if (obj != null)
		{
			if (obj instanceof Number)
			{
				if (!(obj instanceof Integer))
				{
					obj = Utility.createInteger(((Number) obj).intValue());
				}
			}
			else if (obj instanceof Expression)
			{
				obj = ((Expression) obj).tryGetResult(null);
			}
			else if (!(obj instanceof DataHandler))
			{
				obj = obj.toString();
			}
		}
		return obj;
	}

	/**
	 * 将语法节点转换为字符串.
	 */
	private String transNode2Str(AST node)
	{
		StringAppender buf = StringTool.createStringAppender(32);
		AST first = node.getFirstChild();
		if (first.getType() == EXPR)
		{
			buf.append(first.toStringTree());
		}
		else
		{
			buf.append(first.getText());
		}
		AST tmp = first.getNextSibling();
		while (tmp != null)
		{
			if (tmp.getType() == DOT)
			{
				tmp = tmp.getNextSibling();
				buf.append('.');
				this.appendSub(tmp, buf);
			}
			else if (tmp.getType() == LBRACK)
			{
				tmp = tmp.getNextSibling();
				buf.append('[');
				this.appendSub(tmp, buf);
				buf.append(']');
			}
			tmp = tmp.getNextSibling();
		}
		return buf.toString();
	}
	private void appendSub(AST sub, StringAppender buf)
	{
		if (sub.getType() == VAR)
		{
			buf.append(this.transNode2Str(sub));
		}
		else
		{
			AST tmp = sub.getFirstChild();
			if (tmp != null)
			{
				buf.append(tmp.toStringList());
			}
		}
	}

	/**
	 * 注册一个AppData中各类map的获取工具.
	 *
	 * @param name    map的标识
	 * @param getter  map的获取工具
	 * @return  是否覆盖了现有的注册, 如果已有注册则返回true
	 */
	public static boolean registerMapGetter(String name, MapGetter getter)
	{
		if (name != null && getter != null)
		{
			return mapNameIndex.put(name, getter) != null;
		}
		return false;
	}

}


text:
package redis

import (
	"fmt"
	"strconv"
	"strings"
	"time"

	"github.com/adjust/bufio"
)

var (
	_ Cmder = (*Cmd)(nil)
	_ Cmder = (*SliceCmd)(nil)
	_ Cmder = (*StatusCmd)(nil)
	_ Cmder = (*IntCmd)(nil)
	_ Cmder = (*DurationCmd)(nil)
	_ Cmder = (*BoolCmd)(nil)
	_ Cmder = (*StringCmd)(nil)
	_ Cmder = (*FloatCmd)(nil)
	_ Cmder = (*StringSliceCmd)(nil)
	_ Cmder = (*BoolSliceCmd)(nil)
	_ Cmder = (*StringStringMapCmd)(nil)
	_ Cmder = (*ZSliceCmd)(nil)
	_ Cmder = (*ScanCmd)(nil)
)

type Cmder interface {
	args() []string
	parseReply(*bufio.Reader) error
	setErr(error)

	writeTimeout() *time.Duration
	readTimeout() *time.Duration

	Err() error
	String() string
}

func setCmdsErr(cmds []Cmder, e error) {
	for _, cmd := range cmds {
		cmd.setErr(e)
	}
}

func cmdString(cmd Cmder, val interface{}) string {
	s := strings.Join(cmd.args(), " ")
	if err := cmd.Err(); err != nil {
		return s + ": " + err.Error()
	}
	if val != nil {
		return s + ": " + fmt.Sprint(val)
	}
	return s

}

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

type baseCmd struct {
	_args []string

	err error

	_writeTimeout, _readTimeout *time.Duration
}

func newBaseCmd(args ...string) *baseCmd {
	return &baseCmd{
		_args: args,
	}
}

func (cmd *baseCmd) Err() error {
	if cmd.err != nil {
		return cmd.err
	}
	return nil
}

func (cmd *baseCmd) args() []string {
	return cmd._args
}

func (cmd *baseCmd) readTimeout() *time.Duration {
	return cmd._readTimeout
}

func (cmd *baseCmd) setReadTimeout(d time.Duration) {
	cmd._readTimeout = &d
}

func (cmd *baseCmd) writeTimeout() *time.Duration {
	return cmd._writeTimeout
}

func (cmd *baseCmd) setWriteTimeout(d time.Duration) {
	cmd._writeTimeout = &d
}

func (cmd *baseCmd) setErr(e error) {
	cmd.err = e
}

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

type Cmd struct {
	*baseCmd

	val interface{}
}

func NewCmd(args ...string) *Cmd {
	return &Cmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *Cmd) Val() interface{} {
	return cmd.val
}

func (cmd *Cmd) Result() (interface{}, error) {
	return cmd.val, cmd.err
}

func (cmd *Cmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *Cmd) parseReply(rd *bufio.Reader) error {
	cmd.val, cmd.err = parseReply(rd, parseSlice)
	return cmd.err
}

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

type SliceCmd struct {
	*baseCmd

	val []interface{}
}

func NewSliceCmd(args ...string) *SliceCmd {
	return &SliceCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *SliceCmd) Val() []interface{} {
	return cmd.val
}

func (cmd *SliceCmd) Result() ([]interface{}, error) {
	return cmd.val, cmd.err
}

func (cmd *SliceCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *SliceCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, parseSlice)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.([]interface{})
	return nil
}

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

type StatusCmd struct {
	*baseCmd

	val string
}

func NewStatusCmd(args ...string) *StatusCmd {
	return &StatusCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *StatusCmd) Val() string {
	return cmd.val
}

func (cmd *StatusCmd) Result() (string, error) {
	return cmd.val, cmd.err
}

func (cmd *StatusCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *StatusCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, nil)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.(string)
	return nil
}

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

type IntCmd struct {
	*baseCmd

	val int64
}

func NewIntCmd(args ...string) *IntCmd {
	return &IntCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *IntCmd) Val() int64 {
	return cmd.val
}

func (cmd *IntCmd) Result() (int64, error) {
	return cmd.val, cmd.err
}

func (cmd *IntCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *IntCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, nil)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.(int64)
	return nil
}

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

type DurationCmd struct {
	*baseCmd

	val       time.Duration
	precision time.Duration
}

func NewDurationCmd(precision time.Duration, args ...string) *DurationCmd {
	return &DurationCmd{
		baseCmd:   newBaseCmd(args...),
		precision: precision,
	}
}

func (cmd *DurationCmd) Val() time.Duration {
	return cmd.val
}

func (cmd *DurationCmd) Result() (time.Duration, error) {
	return cmd.val, cmd.err
}

func (cmd *DurationCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *DurationCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, nil)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = time.Duration(v.(int64)) * cmd.precision
	return nil
}

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

type BoolCmd struct {
	*baseCmd

	val bool
}

func NewBoolCmd(args ...string) *BoolCmd {
	return &BoolCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *BoolCmd) Val() bool {
	return cmd.val
}

func (cmd *BoolCmd) Result() (bool, error) {
	return cmd.val, cmd.err
}

func (cmd *BoolCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *BoolCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, nil)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.(int64) == 1
	return nil
}

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

type StringCmd struct {
	*baseCmd

	val string
}

func NewStringCmd(args ...string) *StringCmd {
	return &StringCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *StringCmd) Val() string {
	return cmd.val
}

func (cmd *StringCmd) Result() (string, error) {
	return cmd.val, cmd.err
}

func (cmd *StringCmd) Int64() (int64, error) {
	if cmd.err != nil {
		return 0, cmd.err
	}
	return strconv.ParseInt(cmd.val, 10, 64)
}

func (cmd *StringCmd) Uint64() (uint64, error) {
	if cmd.err != nil {
		return 0, cmd.err
	}
	return strconv.ParseUint(cmd.val, 10, 64)
}

func (cmd *StringCmd) Float64() (float64, error) {
	if cmd.err != nil {
		return 0, cmd.err
	}
	return strconv.ParseFloat(cmd.val, 64)
}

func (cmd *StringCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *StringCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, nil)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.(string)
	return nil
}

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

type FloatCmd struct {
	*baseCmd

	val float64
}

func NewFloatCmd(args ...string) *FloatCmd {
	return &FloatCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *FloatCmd) Val() float64 {
	return cmd.val
}

func (cmd *FloatCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *FloatCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, nil)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val, cmd.err = strconv.ParseFloat(v.(string), 64)
	return cmd.err
}

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

type StringSliceCmd struct {
	*baseCmd

	val []string
}

func NewStringSliceCmd(args ...string) *StringSliceCmd {
	return &StringSliceCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *StringSliceCmd) Val() []string {
	return cmd.val
}

func (cmd *StringSliceCmd) Result() ([]string, error) {
	return cmd.Val(), cmd.Err()
}

func (cmd *StringSliceCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *StringSliceCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, parseStringSlice)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.([]string)
	return nil
}

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

type BoolSliceCmd struct {
	*baseCmd

	val []bool
}

func NewBoolSliceCmd(args ...string) *BoolSliceCmd {
	return &BoolSliceCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *BoolSliceCmd) Val() []bool {
	return cmd.val
}

func (cmd *BoolSliceCmd) Result() ([]bool, error) {
	return cmd.val, cmd.err
}

func (cmd *BoolSliceCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *BoolSliceCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, parseBoolSlice)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.([]bool)
	return nil
}

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

type StringStringMapCmd struct {
	*baseCmd

	val map[string]string
}

func NewStringStringMapCmd(args ...string) *StringStringMapCmd {
	return &StringStringMapCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *StringStringMapCmd) Val() map[string]string {
	return cmd.val
}

func (cmd *StringStringMapCmd) Result() (map[string]string, error) {
	return cmd.val, cmd.err
}

func (cmd *StringStringMapCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *StringStringMapCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, parseStringStringMap)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.(map[string]string)
	return nil
}

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

type ZSliceCmd struct {
	*baseCmd

	val []Z
}

func NewZSliceCmd(args ...string) *ZSliceCmd {
	return &ZSliceCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *ZSliceCmd) Val() []Z {
	return cmd.val
}

func (cmd *ZSliceCmd) Result() ([]Z, error) {
	return cmd.val, cmd.err
}

func (cmd *ZSliceCmd) String() string {
	return cmdString(cmd, cmd.val)
}

func (cmd *ZSliceCmd) parseReply(rd *bufio.Reader) error {
	v, err := parseReply(rd, parseZSlice)
	if err != nil {
		cmd.err = err
		return err
	}
	cmd.val = v.([]Z)
	return nil
}

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

type ScanCmd struct {
	*baseCmd

	cursor int64
	keys   []string
}

func NewScanCmd(args ...string) *ScanCmd {
	return &ScanCmd{
		baseCmd: newBaseCmd(args...),
	}
}

func (cmd *ScanCmd) Val() (int64, []string) {
	return cmd.cursor, cmd.keys
}

func (cmd *ScanCmd) Result() (int64, []string, error) {
	return cmd.cursor, cmd.keys, cmd.err
}

func (cmd *ScanCmd) String() string {
	return cmdString(cmd, cmd.keys)
}

func (cmd *ScanCmd) parseReply(rd *bufio.Reader) error {
	vi, err := parseReply(rd, parseSlice)
	if err != nil {
		cmd.err = err
		return cmd.err
	}
	v := vi.([]interface{})

	cmd.cursor, cmd.err = strconv.ParseInt(v[0].(string), 10, 64)
	if cmd.err != nil {
		return cmd.err
	}

	keys := v[1].([]interface{})
	for _, keyi := range keys {
		cmd.keys = append(cmd.keys, keyi.(string))
	}

	return nil
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Number Protocol — Python 3.3.6 documentation</title>

    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 3.3.6 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 3.3.6 documentation" href="../index.html" />
    <link rel="up" title="Abstract Objects Layer" href="abstract.html" />
    <link rel="next" title="Sequence Protocol" href="sequence.html" />
    <link rel="prev" title="Object Protocol" href="object.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />

Navigation

          index

          modules |

          next |

          previous |

Python »

          3.3.6 Documentation »

Python/C API Reference Manual »

Abstract Objects Layer »

Number Protocol¶

int <tt class="descname">PyNumber_Check</tt><big>(</big>PyObject *o<big>)</big>¶

Returns <tt class="docutils literal">1</tt> if the object o provides numeric protocols, and false otherwise.
This function always succeeds.

PyObject* <tt class="descname">PyNumber_Add</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of adding o1 and o2, or NULL on failure.  This is the
equivalent of the Python expression <tt class="docutils literal">o1 + o2</tt>.

PyObject* <tt class="descname">PyNumber_Subtract</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of subtracting o2 from o1, or NULL on failure.  This is
the equivalent of the Python expression <tt class="docutils literal">o1 - o2</tt>.

PyObject* <tt class="descname">PyNumber_Multiply</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of multiplying o1 and o2, or NULL on failure.  This is
the equivalent of the Python expression <tt class="docutils literal">o1 * o2</tt>.

PyObject* <tt class="descname">PyNumber_FloorDivide</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Return the floor of o1 divided by o2, or NULL on failure.  This is
equivalent to the “classic” division of integers.

PyObject* <tt class="descname">PyNumber_TrueDivide</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Return a reasonable approximation for the mathematical value of o1 divided by
o2, or NULL on failure.  The return value is “approximate” because binary
floating point numbers are approximate; it is not possible to represent all real
numbers in base two.  This function can return a floating point value when
passed two integers.

PyObject* <tt class="descname">PyNumber_Remainder</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the remainder of dividing o1 by o2, or NULL on failure.  This is
the equivalent of the Python expression <tt class="docutils literal">o1 % o2</tt>.

PyObject* <tt class="descname">PyNumber_Divmod</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
See the built-in function <tt class="xref py py-func docutils literal">divmod()</tt>. Returns NULL on failure.  This is
the equivalent of the Python expression <tt class="docutils literal">divmod(o1, o2)</tt>.

PyObject* <tt class="descname">PyNumber_Power</tt><big>(</big>PyObject *o1, PyObject *o2, PyObject *o3<big>)</big>¶

Return value: New reference.
See the built-in function <tt class="xref py py-func docutils literal">pow()</tt>. Returns NULL on failure.  This is the
equivalent of the Python expression <tt class="docutils literal">pow(o1, o2, o3)</tt>, where o3 is optional.
If o3 is to be ignored, pass <tt class="xref c c-data docutils literal">Py_None</tt> in its place (passing NULL for
o3 would cause an illegal memory access).

PyObject* <tt class="descname">PyNumber_Negative</tt><big>(</big>PyObject *o<big>)</big>¶

Return value: New reference.
Returns the negation of o on success, or NULL on failure. This is the
equivalent of the Python expression <tt class="docutils literal">-o</tt>.

PyObject* <tt class="descname">PyNumber_Positive</tt><big>(</big>PyObject *o<big>)</big>¶

Return value: New reference.
Returns o on success, or NULL on failure.  This is the equivalent of the
Python expression <tt class="docutils literal">+o</tt>.

PyObject* <tt class="descname">PyNumber_Absolute</tt><big>(</big>PyObject *o<big>)</big>¶

Return value: New reference.
Returns the absolute value of o, or NULL on failure.  This is the equivalent
of the Python expression <tt class="docutils literal">abs(o)</tt>.

PyObject* <tt class="descname">PyNumber_Invert</tt><big>(</big>PyObject *o<big>)</big>¶

Return value: New reference.
Returns the bitwise negation of o on success, or NULL on failure.  This is
the equivalent of the Python expression <tt class="docutils literal">~o</tt>.

PyObject* <tt class="descname">PyNumber_Lshift</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of left shifting o1 by o2 on success, or NULL on
failure.  This is the equivalent of the Python expression <tt class="docutils literal">o1 << o2</tt>.

PyObject* <tt class="descname">PyNumber_Rshift</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of right shifting o1 by o2 on success, or NULL on
failure.  This is the equivalent of the Python expression <tt class="docutils literal">o1 >> o2</tt>.

PyObject* <tt class="descname">PyNumber_And</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the “bitwise and” of o1 and o2 on success and NULL on failure.
This is the equivalent of the Python expression <tt class="docutils literal">o1 & o2</tt>.

PyObject* <tt class="descname">PyNumber_Xor</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the “bitwise exclusive or” of o1 by o2 on success, or NULL on
failure.  This is the equivalent of the Python expression <tt class="docutils literal">o1 ^ o2</tt>.

PyObject* <tt class="descname">PyNumber_Or</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the “bitwise or” of o1 and o2 on success, or NULL on failure.
This is the equivalent of the Python expression <tt class="docutils literal">o1 | o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceAdd</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of adding o1 and o2, or NULL on failure.  The operation
is done in-place when o1 supports it.  This is the equivalent of the Python
statement <tt class="docutils literal">o1 += o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceSubtract</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of subtracting o2 from o1, or NULL on failure.  The
operation is done in-place when o1 supports it.  This is the equivalent of
the Python statement <tt class="docutils literal">o1 -= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceMultiply</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of multiplying o1 and o2, or NULL on failure.  The
operation is done in-place when o1 supports it.  This is the equivalent of
the Python statement <tt class="docutils literal">o1 *= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceFloorDivide</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the mathematical floor of dividing o1 by o2, or NULL on failure.
The operation is done in-place when o1 supports it.  This is the equivalent
of the Python statement <tt class="docutils literal">o1 //= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceTrueDivide</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Return a reasonable approximation for the mathematical value of o1 divided by
o2, or NULL on failure.  The return value is “approximate” because binary
floating point numbers are approximate; it is not possible to represent all real
numbers in base two.  This function can return a floating point value when
passed two integers.  The operation is done in-place when o1 supports it.

PyObject* <tt class="descname">PyNumber_InPlaceRemainder</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the remainder of dividing o1 by o2, or NULL on failure.  The
operation is done in-place when o1 supports it.  This is the equivalent of
the Python statement <tt class="docutils literal">o1 %= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlacePower</tt><big>(</big>PyObject *o1, PyObject *o2, PyObject *o3<big>)</big>¶

Return value: New reference.
See the built-in function <tt class="xref py py-func docutils literal">pow()</tt>. Returns NULL on failure.  The operation
is done in-place when o1 supports it.  This is the equivalent of the Python
statement <tt class="docutils literal">o1 **= o2</tt> when o3 is <tt class="xref c c-data docutils literal">Py_None</tt>, or an in-place variant of
<tt class="docutils literal">pow(o1, o2, o3)</tt> otherwise. If o3 is to be ignored, pass <tt class="xref c c-data docutils literal">Py_None</tt>
in its place (passing NULL for o3 would cause an illegal memory access).

PyObject* <tt class="descname">PyNumber_InPlaceLshift</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of left shifting o1 by o2 on success, or NULL on
failure.  The operation is done in-place when o1 supports it.  This is the
equivalent of the Python statement <tt class="docutils literal">o1 <<= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceRshift</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the result of right shifting o1 by o2 on success, or NULL on
failure.  The operation is done in-place when o1 supports it.  This is the
equivalent of the Python statement <tt class="docutils literal">o1 >>= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceAnd</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the “bitwise and” of o1 and o2 on success and NULL on failure. The
operation is done in-place when o1 supports it.  This is the equivalent of
the Python statement <tt class="docutils literal">o1 &= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceXor</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the “bitwise exclusive or” of o1 by o2 on success, or NULL on
failure.  The operation is done in-place when o1 supports it.  This is the
equivalent of the Python statement <tt class="docutils literal">o1 ^= o2</tt>.

PyObject* <tt class="descname">PyNumber_InPlaceOr</tt><big>(</big>PyObject *o1, PyObject *o2<big>)</big>¶

Return value: New reference.
Returns the “bitwise or” of o1 and o2 on success, or NULL on failure.  The
operation is done in-place when o1 supports it.  This is the equivalent of
the Python statement <tt class="docutils literal">o1 |= o2</tt>.

PyObject* <tt class="descname">PyNumber_Long</tt><big>(</big>PyObject *o<big>)</big>¶

Return value: New reference.
Returns the o converted to an integer object on success, or NULL on
failure.  This is the equivalent of the Python expression <tt class="docutils literal">int(o)</tt>.

PyObject* <tt class="descname">PyNumber_Float</tt><big>(</big>PyObject *o<big>)</big>¶

Return value: New reference.
Returns the o converted to a float object on success, or NULL on failure.
This is the equivalent of the Python expression <tt class="docutils literal">float(o)</tt>.

PyObject* <tt class="descname">PyNumber_Index</tt><big>(</big>PyObject *o<big>)</big>¶

Returns the o converted to a Python int on success or NULL with a
<tt class="xref py py-exc docutils literal">TypeError</tt> exception raised on failure.

PyObject* <tt class="descname">PyNumber_ToBase</tt><big>(</big>PyObject *n, int base<big>)</big>¶

Returns the integer n converted to base base as a string.  The base
argument must be one of 2, 8, 10, or 16.  For base 2, 8, or 16, the
returned string is prefixed with a base marker of <tt class="docutils literal">'0b'</tt>, <tt class="docutils literal">'0o'</tt>, or
<tt class="docutils literal">'0x'</tt>, respectively.  If n is not a Python int, it is converted with
<tt class="xref c c-func docutils literal">PyNumber_Index()</tt> first.

Py_ssize_t <tt class="descname">PyNumber_AsSsize_t</tt><big>(</big>PyObject *o, PyObject *exc<big>)</big>¶

Returns o converted to a Py_ssize_t value if o can be interpreted as an
integer.  If the call fails, an exception is raised and -1 is returned.

If o can be converted to a Python int but the attempt to
convert to a Py_ssize_t value would raise an <tt class="xref py py-exc docutils literal">OverflowError</tt>, then the
exc argument is the type of exception that will be raised (usually
<tt class="xref py py-exc docutils literal">IndexError</tt> or <tt class="xref py py-exc docutils literal">OverflowError</tt>).  If exc is NULL, then the
exception is cleared and the value is clipped to PY_SSIZE_T_MIN for a negative
integer or PY_SSIZE_T_MAX for a positive integer.

int <tt class="descname">PyIndex_Check</tt><big>(</big>PyObject *o<big>)</big>¶

Returns True if o is an index integer (has the nb_index slot of  the
tp_as_number structure filled in).

Previous topic

Object Protocol

Next topic

Sequence Protocol

This Page

Report a Bug

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

Python »

          3.3.6 Documentation »

Python/C API Reference Manual »

Abstract Objects Layer »

    © Copyright 1990-2014, Python Software Foundation.

    The Python Software Foundation is a non-profit corporation.
    Please donate.

    Last updated on Oct 12, 2014.
    Found a bug?

    Created using Sphinx 1.2.


text:
package com.tom.api.inventory;

import java.util.List;

public interface ITooltipSlot {
	boolean showTooltip();

	void getTooltip(List<String> tooltip);
}


text:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';

import { GatewaySharedModule } from '../../shared';
import {
    AddressService,
    AddressPopupService,
    AddressComponent,
    AddressDetailComponent,
    AddressDialogComponent,
    AddressPopupComponent,
    AddressDeletePopupComponent,
    AddressDeleteDialogComponent,
    addressRoute,
    addressPopupRoute,
} from './';

const ENTITY_STATES = [
    ...addressRoute,
    ...addressPopupRoute,
];

@NgModule({
    imports: [
        GatewaySharedModule,
        RouterModule.forRoot(ENTITY_STATES, { useHash: true })
    ],
    declarations: [
        AddressComponent,
        AddressDetailComponent,
        AddressDialogComponent,
        AddressDeleteDialogComponent,
        AddressPopupComponent,
        AddressDeletePopupComponent,
    ],
    entryComponents: [
        AddressComponent,
        AddressDialogComponent,
        AddressPopupComponent,
        AddressDeleteDialogComponent,
        AddressDeletePopupComponent,
    ],
    providers: [
        AddressService,
        AddressPopupService,
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class GatewayAddressModule {}


text:
var LOG = function(msg) {
    window.console.log(msg);
};

var startTest = function() {
  var webview = document.createElement('webview');
  var onLoadStop = function(e) {
    webview.contentWindow.postMessage(JSON.stringify(['connect']),'*');
  };

  webview.addEventListener('loadstop', onLoadStop);
  webview.addEventListener('consolemessage', function(e) {
    LOG('g: ' + e.message);
  });
  webview.partition = 'partition1';
  webview.style.width = '300px';
  webview.style.height = '200px';
  webview.style.margin = '0px';
  webview.style.padding = '0px';
  webview.style.position = 'absolute';
  webview.style.left = '50px';
  webview.style.top = '100px';
  webview.src = 'guest.html';
  document.querySelector('#webview-tag-container').appendChild(webview);
};

window.addEventListener('message', function(e) {
  var data = JSON.parse(e.data);
  LOG('data: ' + data);
    switch (data[0]) {
      case 'connected':
        chrome.test.sendMessage('WebViewTest.LAUNCHED');
        break;
      case 'overflow_is_hidden':
        chrome.test.sendMessage('overflow_is_hidden');
        break;
    }
});

if (chrome.test !== undefined) {
  chrome.test.getConfig(function(config) {
    startTest();
  });
} else {
  // Allow interactive debugging.
  // Need timeout to allow the WebView prototype to be setup.
  window.setTimeout(startTest, 100);
}


text:
id: extensions
title: Extensions
---

Enhance your chat with custom extensions and load just what you're going to use.

## How do I use?

Using on Browser

```html
<script src="//cdn.jsdelivr.net/npm/yve-bot@latest/web.js"></script>
<script src="//cdn.jsdelivr.net/npm/yve-bot@latest/ext/types/TypeName"></script>
```

From Node / React

```javascript
import YveBot from 'yve-bot/ui';
import 'yve-bot/ext/types/TypeName';
```

## Available extensions

[StringSearch](extensions-string-search.md) - Autocomplete-like for chat conversation.


text:
#ifndef QLINEEDIT_P_H
#define QLINEEDIT_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include "QtCore/qglobal.h"

#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
#include "QtWidgets/qlineedit.h"
#include "QtGui/qtextlayout.h"
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qbasictimer.h"
#include "QtWidgets/qcompleter.h"
#include "QtCore/qpointer.h"
#include "QtCore/qmimedata.h"

#include "private/qwidgetlinecontrol_p.h"

QT_BEGIN_NAMESPACE

class Q_AUTOTEST_EXPORT QLineEditPrivate : public QWidgetPrivate
{
    Q_DECLARE_PUBLIC(QLineEdit)
public:

    QLineEditPrivate()
        : control(0), frame(1), contextMenuEnabled(1), cursorVisible(0),
        dragEnabled(0), clickCausedFocus(0), hscroll(0), vscroll(0),
        alignment(Qt::AlignLeading | Qt::AlignVCenter),
        leftTextMargin(0), topTextMargin(0), rightTextMargin(0), bottomTextMargin(0)
    {
    }

    ~QLineEditPrivate()
    {
    }

    QWidgetLineControl *control;

#ifndef QT_NO_CONTEXTMENU
    QPointer<QAction> selectAllAction;
#endif
    void init(const QString&);

    QRect adjustedControlRect(const QRect &) const;

    int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const;
    QRect cursorRect() const;
    void setCursorVisible(bool visible);

    void updatePasswordEchoEditing(bool);

    void resetInputMethod();

    inline bool shouldEnableInputMethod() const
    {
        return !control->isReadOnly();
    }

    static inline QLineEditPrivate *get(QLineEdit *lineEdit) {
        return lineEdit->d_func();
    }

    QPoint tripleClick;
    QBasicTimer tripleClickTimer;
    uint frame : 1;
    uint contextMenuEnabled : 1;
    uint cursorVisible : 1;
    uint dragEnabled : 1;
    uint clickCausedFocus : 1;
    int hscroll;
    int vscroll;
    uint alignment;
    static const int verticalMargin;
    static const int horizontalMargin;

    bool sendMouseEventToInputContext(QMouseEvent *e);

    QRect adjustedContentsRect() const;

    void _q_handleWindowActivate();
    void _q_textEdited(const QString &);
    void _q_cursorPositionChanged(int, int);
#ifdef QT_KEYPAD_NAVIGATION
    void _q_editFocusChange(bool);
#endif
    void _q_selectionChanged();
    void _q_updateNeeded(const QRect &);
#ifndef QT_NO_COMPLETER
    void _q_completionHighlighted(QString);
#endif
    QPoint mousePressPos;
#ifndef QT_NO_DRAGANDDROP
    QBasicTimer dndTimer;
    void drag();
#endif

    int leftTextMargin;
    int topTextMargin;
    int rightTextMargin;
    int bottomTextMargin;

    QString placeholderText;
};

#endif // QT_NO_LINEEDIT

QT_END_NAMESPACE

#endif // QLINEEDIT_P_H


text:
import Ember from 'ember';

const { Helper } = Ember;

/**
 * Helper to return the semantic UI width class for a given number
 * @param params
 * @returns {*}
 */
export function uiGridNumber(params) {
  [params] = params;
  if (params < 1) {
    params = 1;
  }
  if (params > 16) {
    params = 16;
  }
  switch (params) {
    case 1:
      return 'one';
    case 2:
      return 'two';
    case 3:
      return 'three';
    case 4:
      return 'four';
    case 5:
      return 'five';
    case 6:
      return 'six';
    case 7:
      return 'seven';
    case 8:
      return 'eight';
    case 9:
      return 'nine';
    case 10:
      return 'ten';
    case 11:
      return 'eleven';
    case 12:
      return 'twelve';
    case 13:
      return 'thirteen';
    case 14:
      return 'fourteen';
    case 15:
      return 'fifteen';
    case 16:
      return 'sixteen';
  }
  return '';
}

export default Helper.helper(uiGridNumber);


text:
package com.intellij.openapi.vcs.ui;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.ex.CustomComponentAction;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.ClickListener;
import com.intellij.ui.IdeBorderFactory;
import consulo.awt.TargetAWT;
import consulo.ui.image.Image;

import javax.annotation.Nullable;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;

public abstract class TextFieldAction extends AnAction implements CustomComponentAction {
  protected JTextField myField;
  private final String myDescription;
  private final Image myIcon;

  protected TextFieldAction(String text, String description, Image icon, final int initSize) {
    super(text, description, icon);
    myDescription = description;
    myIcon = icon;
    myField = new JTextField(initSize);
    myField.addKeyListener(new KeyAdapter() {
      @Override
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
          e.consume();
          actionPerformed(null);
        }
      }
    });
  }

  @Override
  public abstract void actionPerformed(@Nullable AnActionEvent e);

  public JComponent createCustomComponent(Presentation presentation) {
    // honestly borrowed from SearchTextField

    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel label = new JLabel(TargetAWT.to(myIcon));
    label.setOpaque(true);
    label.setBackground(myField.getBackground());
    myField.setOpaque(true);
    panel.add(myField, BorderLayout.WEST);
    panel.add(label, BorderLayout.EAST);
    myField.setToolTipText(myDescription);
    label.setToolTipText(myDescription);
    final Border originalBorder;
    if (SystemInfo.isMac) {
      originalBorder = BorderFactory.createLoweredBevelBorder();
    }
    else {
      originalBorder = myField.getBorder();
    }

    panel.setBorder(new CompoundBorder(IdeBorderFactory.createEmptyBorder(4, 0, 4, 0), originalBorder));

    myField.setOpaque(true);
    myField.setBorder(IdeBorderFactory.createEmptyBorder(0, 5, 0, 5));

    new ClickListener() {
      @Override
      public boolean onClick(MouseEvent e, int clickCount) {
        actionPerformed(null);
        return true;
      }
    }.installOn(label);

    return panel;
  }
}


text:
<?php

class BaseZF_UnitTest_Item_Db extends BaseZF_Item_Db_Abstract
{
   /**
     * Get instance of allready contructed object
     *
     * @param void $id unique object id
     * @param string $class item className
     *
     * @return BaseZF_DbItem object instance
     */
    public static function getInstance($table, $id = null, $realtime = false, $class = __CLASS__)
    {
        return parent::getInstance($table, $id, $realtime, $class);
    }

    //
    // Cache and Db instance getter
    //

    /**
     * Retrieve the Zend_Db database conexion instance
     *
     * @return object Zend_Db instance
     */
    protected function _getDbInstance()
    {
        return BaseZF_UnitTest_Item_DbTest::$db;
    }

    /**
     * Retrieve the Zend_Cache instance
     *
     * @return object Zend_Cache instance
     */
    protected function _getCacheInstance()
    {
        return BaseZF_UnitTest_Item_DbTest::$cache;
    }

    /**
     * Retrieve the Zend_Log logger instance
     *
     * @return object Zend_log instance
     */
    protected function _getLogInstance()
    {
        return false;
    }

    /**
     * Retreive the schema, can be an array, Zend_config instance, Zend_Db instance or
     * a BaseZF_Item_Db_Schema_Abstract className
     *
     * @return mixed
     */
    protected function &_getDbChema()
    {
        static $inited = false;

        if($inited === false) {

             // require by BaseZF_Item_Db_Schema_Auto to get schema from database itseft
             BaseZF_Item_Db_Schema_Auto::loadSchemaFromDb(
                 $this->_getDbInstance(),
                 $this->_getCacheInstance()
             );

             $inited = true;
        }

        $dbSchemaClassName = 'BaseZF_Item_Db_Schema_Auto';

        return $dbSchemaClassName;
    }
}


text:
{% extends "theme_bootstrap/base.html" %}

{% load staticfiles %}
{% load metron_tags %}
{% load i18n %}
{% block nav %}

Creatures

        {% for grouping in groupings %}

            {{grouping.name}}

                        {% for group in grouping.creaturegroup_set.all %}

{{group}}

                        {% endfor %}

        {% endfor %}

{% endblock %}

{% block styles %}
    <link href="{% static "pinax/css/theme.css" %}" rel="stylesheet">
    <link href="{% static "css/site.css" %}" rel="stylesheet">
    <link href="{% static "css/pfss.css" %}" rel="stylesheet">
    <link href="{% static "css/ui-lightness/jquery-ui.min.css" %}" rel="stylesheet">
    <link href="{% static "css/ui-lightness/theme.css" %}" rel="stylesheet">
{% endblock %}

{% block extra_head_base %}
    <link rel="icon" href="{% static "pfss/icons/favicon.ico" %}" type="image/x-icon">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" rel="apple-touch-icon-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="72x72" rel="apple-touch-icon-72x72-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="76x76" rel="apple-touch-icon-76x76-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="114x114" rel="apple-touch-icon-114x114-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="120x120" rel="apple-touch-icon-120x120-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="144x144" rel="apple-touch-icon-144x144-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="152x152" rel="apple-touch-icon-152x152-precomposed.png">

    <link href="{% static "pfss/icons/apple-touch-icon-precomposed" %}" sizes="180x180" rel="apple-touch-icon-180x180-precomposed.png">

    <link rel="icon" sizes="192x192" href="{% static "pfss/icons/touch-icon-192x192.png" %}">

    <meta name="application-name" content="Pathfinder Summoner's Scribe"/>
    <meta name="msapplication-TileColor" content="#990011"/>
    <meta name="msapplication-square70x70logo" content="{% static "pfss/icons/metro_tile-70x70.png" %}"/>
    <meta name="msapplication-square150x150logo" content="{% static "pfss/icons/metro_tile-150x150.png" %}"/>
    <meta name="msapplication-square310x310logo" content="{% static "pfss/icons/metro_tile-310x310.png" %}"/>

    <meta property="og:title" content="Pathfinder Summoner's Scribe">
    <meta property="og:type" content="website">
    <meta property="og:url" content="/pfs/">
    <meta property="og:image" content="{% static "pfss/icons/touch-icon-192x192.png" %}">
    {% block extra_head %}{% endblock %}
{% endblock %}

{% block footer %}
    {% include "_footer.html" %}
{% endblock %}

{% block scripts %}

{% endblock %}
{% block extra_body_base %}
    {% analytics %}
    {% block extra_body %}{% endblock %}
{% endblock %}


text:
package com.sequenceiq.cloudbreak.util;

public class Version {

    private Version() {
    }

    /**
     * Compares two version strings.
     * <p>
     * Use this instead of String.compareTo() for a non-lexicographical
     * comparison that works for version strings. e.g. "1.10".compareTo("1.6").
     *
     * @param str1 a string of ordinal numbers separated by decimal points.
     * @param str2 a string of ordinal numbers separated by decimal points.
     * @return The result is a negative integer if str1 is _numerically_ less than str2.
     * The result is a positive integer if str1 is _numerically_ greater than str2.
     * The result is zero if the strings are _numerically_ equal.
     * It does not work if "1.10" is supposed to be equal to "1.10.0".
     */
    public static Integer versionCompare(String str1, String str2) {
        String[] vals1 = str1.split("\\.");
        String[] vals2 = str2.split("\\.");
        int i = 0;
        // set index to first non-equal ordinal or length of shortest version string
        while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) {
            i++;
        }
        // compare first non-equal ordinal number
        if (i < vals1.length && i < vals2.length) {
            int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i]));
            return Integer.signum(diff);
        } else {
            // the strings are equal or one string is a substring of the other
            // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4"
            return Integer.signum(vals1.length - vals2.length);
        }
    }
}


text:
<?php
/**
 * @package sfLucenePlugin
 * @subpackage Module
 * @author Carl Vondrick <carl@carlsoft.net>
 * @version SVN: $Id: searchNoResults.php 7108 2008-01-20 07:44:42Z Carl.Vondrick $
 */
?>

<?php use_helper('sfLucene', 'I18N') ?>

<?php echo __('No Results Found') ?>

<?php echo __('We could not find any results with the search term you provided.') ?>

    <?php //include_search_controls($form) ?>
    <?php //include_partial('sfLucene/controls', array('form' => $form, 'company' => $company)); ?>


text:
Kasun

Dilunika

            <button id="profile-dropdwn"
                    class="btn btn-default btn-sm dropdown-toggle"
                    data-toggle="dropdown"
                    aria-haspopup="true"
                    aria-expanded="true">

            </button>

Settings

Sign Out


text:
from __future__ import unicode_literals

from yepes.contrib.sitemaps.base import *

default_app_config = 'yepes.contrib.sitemaps.apps.SitemapsConfig'


text:
.. Licensed under the Apache License, Version 2.0 (the "License"); you may not
.. use this file except in compliance with the License. You may obtain a copy of
.. the License at
..
..   http://www.apache.org/licenses/LICENSE-2.0
..
.. Unless required by applicable law or agreed to in writing, software
.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
.. License for the specific language governing permissions and limitations under
.. the License.

.. default-domain:: config
.. highlight:: ini

==================
Base Configuration
==================

.. _config/couchdb:

Base CouchDB Options
====================

.. config:section:: couchdb :: Base CouchDB Options

    .. lint: ignore errors for the next 1 line

    .. config:option:: attachment_stream_buffer_size :: Attachment streaming buffer

        Higher values may result in better read performance due to fewer read
        operations and/or more OS page cache hits. However, they can also
        increase overall response time for writes when there are many
        attachment write requests in parallel. ::

            [couchdb]
            attachment_stream_buffer_size = 4096

    .. config:option:: database_dir :: Databases location directory

        Specifies location of CouchDB database files (``*.couch`` named). This
        location should be writable and readable for the user the CouchDB
        service runs as (``couchdb`` by default). ::

            [couchdb]
            database_dir = /var/lib/couchdb

    .. config:option:: delayed_commits :: Delayed commits

        When this config value is ``false`` the CouchDB provides a guarantee
        that `fsync` will be called before returning a :http:statuscode:`201`
        response on each document save. Setting this config value to ``true``
        may improve performance, at cost of some durability. For production use
        disabling this is strongly recommended::

            [couchdb]
            delayed_commits = false

        .. warning::
            Delayed commits are a feature of CouchDB that allows it to achieve
            better write performance for some workloads while sacrificing a
            small amount of durability. The setting causes CouchDB to wait up
            to a full second before committing new data after an update. If the
            server crashes before the header is written then any writes since
            the last commit are lost.

    .. config:option:: file_compression :: Compression method for documents

        .. versionchanged:: 1.2 Added `Google Snappy`_ compression algorithm.

        Method used to compress everything that is appended to database and
        view index files, except for attachments (see the
        :section:`attachments` section). Available methods are:

        * ``none``: no compression
        * ``snappy``: use Google Snappy, a very fast compressor/decompressor
        * ``deflate_N``: use zlib's deflate; ``N`` is the compression level
          which ranges from ``1`` (fastest, lowest compression ratio) to ``9``
          (slowest, highest compression ratio)

        ::

            [couchdb]
            file_compression = snappy

        .. _Google Snappy: http://code.google.com/p/snappy/

    .. config:option:: fsync_options :: Fsync options

        Specifies when to make `fsync` calls. `fsync` makes sure that the
        contents of any file system buffers kept by the operating system are
        flushed to disk. There is generally no need to modify this parameter. ::

            [couchdb]
            fsync_options = [before_header, after_header, on_file_open]

    .. config:option:: max_dbs_open :: Limit of simultaneously opened databases

        This option places an upper bound on the number of databases that can
        be open at once. CouchDB reference counts database accesses internally
        and will close idle databases as needed. Sometimes it is necessary to
        keep more than the default open at once, such as in deployments where
        many databases will be replicating continuously. ::

            [couchdb]
            max_dbs_open = 100

    .. config:option:: os_process_timeout :: External processes time limit

        If an external process, such as a query server or external process,
        runs for this amount of milliseconds without returning any results, it
        will be terminated. Keeping this value smaller ensures you get
        expedient errors, but you may want to tweak it for your specific
        needs. ::

            [couchdb]
            os_process_timeout = 5000 ; 5 sec

    .. config:option:: uri_file :: Discovery CouchDB help file

        This file contains the full `URI`_ that can be used to access this
        instance of CouchDB. It is used to help discover the port CouchDB is
        running on (if it was set to ``0`` (e.g. automatically assigned any
        free one). This file should be writable and readable for the user that
        runs the CouchDB service (``couchdb`` by default). ::

            [couchdb]
            uri_file = /var/run/couchdb/couchdb.uri

        .. _URI: http://en.wikipedia.org/wiki/URI

   .. config:option:: users_db_suffix :: Users database suffix

        Specifies the suffix (last component of a name) of the system database
        for storing CouchDB users. ::

            [couchdb]
            users_db_suffix = _users

        .. warning::
            If you change the database name, do not forget to remove or clean
            up the old database, since it will no longer be protected by
            CouchDB.

    .. config:option:: util_driver_dir :: CouchDB binary utility drivers

        Specifies location of binary drivers (`icu`, `ejson`, etc.). This
        location and its contents should be readable for the user that runs the
        CouchDB service. ::

            [couchdb]
            util_driver_dir = /usr/lib/couchdb/erlang/lib/couch-1.5.0/priv/lib

    .. config:option:: uuid :: CouchDB server UUID

        .. versionadded:: 1.3

        Unique identifier for this CouchDB server instance. ::

            [couchdb]
            uuid = 0a959b9b8227188afc2ac26ccdf345a6

    .. config:option:: view_index_dir :: View indexes location directory

        Specifies location of CouchDB view index files. This location should be
        writable and readable for the user that runs the CouchDB service
        (``couchdb`` by default). ::

            [couchdb]
            view_index_dir = /var/lib/couchdb

    .. config:option:: maintenance_mode :: Maintenance mode

        A CouchDB node may be put into two distinct maintenance modes by setting
        this configuration parameter.

        * ``true``: The node will not respond to clustered requests from other
          nodes and the /_up endpoint will return a 404 response.
        * ``nolb``: The /_up endpoint will return a 404 response.
        * ``false``: The node responds normally, /_up returns a 200 response.

        It is expected that the administrator has configured a load balancer
        in front of the CouchDB nodes in the cluster. This load balancer should
        use the /_up endpoint to determine whether or not to send HTTP requests
        to any particular node. For HAProxy, the following config is
        appropriate:

        .. code-block:: none

          http-check disable-on-404
          option httpchk GET /_up

    .. config:option:: max_document_size :: Limit maximum document body size

        .. versionchanged:: 2.1.0

        Limit maximum document body size. Size is calculated based on the
        serialized Erlang representation of the JSON document body, because
        that reflects more accurately the amount of storage consumed on disk.
        In particular, this limit does not include attachments.

        HTTP requests which create or update documents will fail with error
        code 413 if one or more documents is larger than this configuration
        value.

        In case of `_update` handlers, document size is checked after the
        transformation and right before being inserted into the database. ::

            [couchdb]
            max_document_size = 4294967296 ; 4 GB

        .. warning::
           Before version 2.1.0 this setting was implemented by simply checking
           http request body sizes. For individual document updates via `PUT`
           that approximation was close enough, however that is not the case
           for `_bulk_docs` endpoint. After 2.1.0 a separate configuration
           parameter was defined: :config:option:`httpd/max_http_request_size`,
           which can be used to limit maximum http request sizes. After upgrade,
           it is advisable to review those settings and adjust them accordingly.


text:
<?php
/**
 * Add and configure Shortcodes for this theme.
 * Relies on the implementation in ShortcodeBase.
 */

namespace SDES\ServicesTheme\Shortcodes;

use \StdClass;
use \Exception;
use \SimpleXMLElement;

require_once( get_stylesheet_directory() . '/functions/class-shortcodebase.php' );
	use SDES\Shortcodes\ShortcodeBase;

require_once( get_stylesheet_directory() . '/functions/class-sdes-static.php' );
	use SDES\SDES_Static as SDES_Static;

require_once( get_stylesheet_directory() . '/vendor/autoload.php' );
use Underscore\Types\Arrays;

/**
 * [row] - Wrap HTML in a Boostrap CSS row.
 *
 * @see https://github.com/UCF/Students-Theme/blob/d56183079c70836adfcfaa2ac7b02cb4c935237d/shortcodes.php#L454-L504
 */
class sc_row extends ShortcodeBase {
	public
	$name        = 'Row',
	$command     = 'row',
	$description = 'Wraps content in a bootstrap row.',
	$render      = false,
	$params      = array(
		array(
			'name'      => 'Add Container',
			'id'        => 'container',
			'help_text' => 'Wrap the row in a container div',
			'type'      => 'checkbox',
		),
		array(
			'name'      => 'Additional Classes',
			'id'        => 'class',
			'help_text' => 'Additional css classes',
			'type'      => 'text',
		),
		array(
			'name'      => 'Inline Styles',
			'id'        => 'style',
			'help_text' => 'Inline css styles',
			'type'      => 'text',
		),
	),
	$callback    = 'callback',
	$wysiwyg     = true;

	public static function callback( $attr, $content = '' ) {
		$attr = shortcode_atts(
			array(
				'container' => 'false',
				'class'     => '',
				'style'    => '',
			), $attr
		);

		ob_start();
		?>
		<?php if ( 'true' === $attr['container'] ) : ?>

		<?php endif; ?>
			<div class="row <?php echo $attr['class'] ? $attr['class'] : ''; ?>"<?php echo $attr['style'] ? ' style="' . $attr['style'] . '"' : '';?>>
				<?php echo apply_filters( 'the_content', $content ); ?>

		<?php if ( 'true' === $attr['container'] ) : ?>

		<?php endif; ?>
		<?php
		return ob_get_clean();
	}
}

/**
 * [column] - Wrap HTML in a Boostrap CSS column.
 *
 * @see https://github.com/UCF/Students-Theme/blob/d56183079c70836adfcfaa2ac7b02cb4c935237d/shortcodes.php#L506-L650
 */
class sc_column extends ShortcodeBase {
	public
	$name        = 'Column',
	$command     = 'column',
	$description = 'Wraps content in a bootstrap column',
	$render      = 'render',
	$params      = array(
		array(
			'name'      => 'Large Size',
			'id'        => 'lg',
			'help_text' => 'The size of the column when the screen is > 1200px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Medium Size',
			'id'        => 'md',
			'help_text' => 'The size of the column when the screen is between 992px and 1199px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Small Size',
			'id'        => 'sm',
			'help_text' => 'The size of the column when the screen is between 768px and 991px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Extra Small Size',
			'id'        => 'xs',
			'help_text' => 'The size of the column when the screen is < 767px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Large Offset',
			'id'        => 'lg_offset',
			'help_text' => 'The offset of the column when the screen is > 1200px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Medium Offset',
			'id'        => 'md_offset',
			'help_text' => 'The offset of the column when the screen is between 992px and 1199px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Small Offset',
			'id'        => 'sm_offset',
			'help_text' => 'The offset of the column when the screen is between 768px and 991px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Extra Small Offset',
			'id'        => 'xs_offset',
			'help_text' => 'The offset of the column when the screen is < 767px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Large Push',
			'id'        => 'lg_push',
			'help_text' => 'Pushes the column the specified number of column widths when the screen is > 1200px (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Medium Push',
			'id'        => 'md_push',
			'help_text' => 'Pushes the column the specified number of column widths when the screen is between 992px and 1199px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Small Push',
			'id'        => 'sm_push',
			'help_text' => 'Pushes the column the specified number of column widths when the screen is between 768px and 991px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Extra Small Push',
			'id'        => 'xs_push',
			'help_text' => 'Pushes the column the specified number of column widths when the screen is < 767px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Large Pull',
			'id'        => 'lg_pull',
			'help_text' => 'Pulls the column the specified number of column widths when the screen is > 1200px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Medium Offset Size',
			'id'        => 'md_pull',
			'help_text' => 'Pulls the column the specified number of column widths when the screen is between 992px and 1199px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Small Offset Size',
			'id'        => 'sm_pull',
			'help_text' => 'Pulls the column the specified number of column widths when the screen is between 768px and 991px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Extra Small Offset Size',
			'id'        => 'xs_pull',
			'help_text' => 'Pulls the column the specified number of column widths when the screen is < 767px wide (1-12)',
			'type'      => 'text',
		),
		array(
			'name'      => 'Additional Classes',
			'id'        => 'class',
			'help_text' => 'Any additional classes for the column',
			'type'      => 'text',
		),
		array(
			'style'     => 'Inline Styles',
			'id'        => 'style',
			'help_text' => 'Any additional inline styles for the column',
			'type'      => 'text',
		),
	),
	$callback    = 'callback',
	$wysiwig     = true;

	public static function callback( $attr, $content = '' ) {
		$attr = array_merge(
			$attr,
			array(
				'class' => '',
				'style' => '',
			)
		);

		// Size classes.
		$classes = array( $attr['class'] ? $attr['class'] : '' );

		$prefixes = array( 'xs', 'sm', 'md', 'lg' );
		$suffixes = array( '', '_offset', '_pull', '_push' );

		foreach ( $prefixes as $prefix ) {
			foreach ( $suffixes as $suffix ) {
				if ( array_key_exists( $prefix.$suffix, $attr ) ) {
					$suf = str_replace( '_', '-', $suffix );
					$classes[] = 'col-'.$prefix.$suf.'-'.$attr[ $prefix.$suffix ];
				}
			}
		}

		$ctxt['cls_str'] = esc_attr( implode( ' ', $classes ) );
		$ctxt['style'] = esc_attr( $attr['style'] );
		$ctxt['content'] = apply_filters( 'the_content', $content );
		return static::render( $ctxt );
	}

	public static function render( $ctxt ) {
		ob_start();
		?>
		<div class="<?= $ctxt['cls_str'] ?>" style="<?= $ctxt['style'] ?>">
		<?= $ctxt['content'] ?>

		<?php
		return ob_get_clean();
	}
}

require_once( get_stylesheet_directory() . '/custom-posttypes.php' );
	use SDES\ServicesTheme\PostTypes\IconLink;
/**
 * [icon_link] - Create a full-width box with icon_links centered inside.
 *
 * @see https://github.com/UCF/Students-Theme/blob/87dca3074cb48bef5d811789cf9a07c9eac55cd1/shortcodes.php#L410-L460
 * @see https://github.com/UCF/Students-Theme/blob/master/custom-post-types.php#L564-L615
 * @uses IconLink IconLink
 **/
class sc_icon_link extends ShortcodeBase {
	public
		$name        = 'Icon Link', // The name of the shortcode.
		$command     = 'icon_link', // The command used to call the shortcode.
		$description = 'Displays the specified icon link', // The description of the shortcode.
		$params      = array(
			array(
				'name'      => 'Icon Link',
				'id'        => 'icon_link_id',
				'help_text' => 'The icon link you want to display',
				'type'      => 'dropdown',
				'choices'   => array(),
			),
		), // The parameters used by the shortcode.
		$callback    = 'callback',
		$closing_tag = false,
		$wysiwyg     = true; // Whether to add it to the shortcode Wysiwyg modal.
		public function __construct() {
			$this->params[0]['choices'] = $this->get_choices();
		}
		private function get_choices() {
			$posts = get_posts( array( 'post_type' => 'icon_link' ) );
			$retval = array( array( 'name' => '-- Choose Icon Link --', 'value' => '' ) );
			foreach ( $posts as $post ) {
				$retval[] = array(
				'name'  => $post->post_title,
				'value' => $post->ID,
				);
			}
			return $retval;
		}
		public static function callback( $attr, $content = '' ) {
			$attr = shortcode_atts( array(
				'icon_link_id' => '',
				), $attr
			);
			if ( isset( $attr['icon_link_id'] ) ) {
				$post = get_post( $attr['icon_link_id'] );
				return IconLink::toHTML( $post );
			} else {
				return '';
			}
		}
}

/**
 * [callout] - A callout box to display colored text over a background color.
 *
 * @see https://github.com/UCF/Students-Theme/blob/87dca3074cb48bef5d811789cf9a07c9eac55cd1/shortcodes.php#L363-L408
 */
class sc_callout extends ShortcodeBase {
	public
		$name        = 'Callout', // The name of the shortcode.
		$command     = 'callout', // The command used to call the shortcode.
		$description = 'Creates a callout box', // The description of the shortcode.
		$params      = array(
			array(
				'name'      => 'Color',
				'id'        => 'color',
				'help_text' => 'The color of the callout box',
				'type'      => 'color',
				'default'   => '#ffcc00',
			),
			array(
				'name'      => 'Text',
				'id'        => 'text-color',
				'help_text' => 'The color of the text within the callout box',
				'type'      => 'color',
				'default'   => '#000000',
			),
			array(
				'name'      => 'Auto Paragraph',
				'id'        => 'wpautop',
				'help_text' => 'Add paragraph tags to the content (default: false).',
				'type'      => 'bool',
				'default'   => false,
			),
		), // The parameters used by the shortcode.
		$callback    = 'callback',
		$wysiwyg     = true; // Whether to add it to the shortcode Wysiwyg modal.
		public static function callback( $attr, $content = '' ) {
			$attr = shortcode_atts( array(
				'color' => '#ffcc00',
				'text-color' => '#000',
				'wpautop' => false,
				),
				$attr
			);
			$style = '';
			$style .= ! empty( $attr['color'] ) ? 'background: ' . $attr['color'] . ';' : '';
			$style .= ! empty( $attr['text-color'] ) ? ' color: ' . $attr['text-color'] . ';' : '';

			$restore_autop = has_filter( 'the_content', 'wpautop' );
			if ( false === $attr['wpautop'] ) { remove_filter( 'the_content', 'wpautop' ); }
			ob_start();
			?>
			<aside class="callout"<?php echo ! empty( $style ) ? ' style="' . $style . '"' : ''; ?>>

					<?php echo apply_filters( 'the_content', $content ); ?>

			<?php
			if ( $restore_autop ) { add_filter( 'the_content', 'wpautop' ); }
			return ob_get_clean();
		}
}

require_once( get_stylesheet_directory() . '/custom-posttypes.php' );
	use SDES\ServicesTheme\PostTypes\Campaign;
/**
 * [call_to_action] - A square "Call to Action" box (aka, Campaign).
 *
 * @see https://github.com/UCF/Students-Theme/blob/87dca3074cb48bef5d811789cf9a07c9eac55cd1/shortcodes.php#L113-160
 */
class sc_call_to_action extends ShortcodeBase {
	public
		$name        = 'Call to Action', // The name of the shortcode.
		$command     = 'call_to_action', // The command used to call the shortcode.
		$description = 'Displays a call to action image and text.', // The description of the shortcode.
		$params      = array(
			array(
				'name'      => 'Call to Action Object',
				'id'        => 'cta_id',
				'help_text' => 'Choose the call to action to display',
				'type'      => 'dropdown',
				'choices'   => array(),
			),
		), // The parameters used by the shortcode.
		$callback    = 'callback',
		$wysiwyg     = true; // Whether to add it to the shortcode Wysiwyg modal.
		public function __construct() {
			$this->params[0]['choices'] = $this->get_choices();
		}
		private function get_choices() {
			$posts = get_posts( array( 'post_type' => 'campaign' ) );
			$retval = array( array( 'name' => '--- Choose ---', 'value' => null ) );
			foreach ( $posts as $post ) {
				$retval[] = array(
				'name'  => $post->post_title,
				'value' => $post->ID,
				);
			}
			return $retval;
		}
		public static function callback( $attr, $content = '' ) {
			$attr = shortcode_atts( array(
				'cta_id' => null,
				), $attr
			);
			ob_start();
			if ( $attr['cta_id'] ) {
				$post = get_post( $attr['cta_id'] );
				echo Campaign::toHTML( $post );
			}
			return ob_get_clean();
		}
}

class sc_campaign extends ShortcodeBase {
	public
		$name        = 'Campaign', // The name of the shortcode.
		$command     = 'campaign', // The command used to call the shortcode.
		$description = 'Display a campaign.', // The description of the shortcode.
		$params      = array(
			array(
				'name'      => 'Campaign Object',
				'id'        => 'campaign_id',
				'help_text' => 'Choose the campaign to display.',
				'type'      => 'dropdown',
				'choices'   => array(),
			),
			array(
				'name'      => 'Image',
				'id'        => 'image_id',
				'help_text' => 'Choose an image to display.',
				'type'      => 'image',
			),
			array(
				'name'      => 'Link',
				'id'        => 'url',
				'help_text' => 'The url for this campaign.',
				'type'      => 'text',
			),
			array(
				'name'      => 'Title',
				'id'        => 'title',
				'help_text' => 'The title for this campaign.',
				'type'      => 'text',
			),
			array(
				'name'      => 'Long Text',
				'id'        => 'long',
				'help_text' => 'The long-form text for this campaign.',
				'type'      => 'text',
			),
			array(
				'name'      => 'Short Text',
				'id'        => 'short',
				'help_text' => 'The short-form text for this campaign.',
				'type'      => 'text',
			),
			array(
				'name'      => 'Button',
				'id'        => 'btn_text',
				'help_text' => 'The button text for this campaign.',
				'type'      => 'text',
			),
		), // The parameters used by the shortcode.
		$closing_tag = false,
		$callback    = 'callback',
		$wysiwyg     = true; // Whether to add it to the shortcode Wysiwyg modal.

		public function __construct() {
			$this->params[0]['choices'] = $this->get_choices();
		}

		private function get_choices() {
			$posts = get_posts( array( 'post_type' => 'campaign' ) );
			$retval = array( array( 'name' => '--- Choose ---', 'value' => null ) );
			foreach ( $posts as $post ) {
				$retval[] = array(
				'name'  => $post->post_title,
				'value' => $post->ID,
				);
			}
			return $retval;
		}

		public static function callback( $attr, $content = '' ) {
			$attr = shortcode_atts( array(
				'campaign_id' => null,
				'image_id' => '',
				'image_url' => '',
				'url' => '',
				'title' => '',
				'long' => '',
				'short' => '',
				'btn_text' => '',
				'layout' => 'rectangle',
				), $attr
			);
			$context = null;
			if ( ! SDES_Static::is_null_or_whitespace( $attr['campaign_id'] ) ) {
				$post = get_post( $attr['campaign_id'] );
				$context = (object) Campaign::get_render_context( $post );
			} else {
				$context = (object) array(
				'image_id' => $attr['image_id'],
				'image_url' => $attr['image_url'],
				'url' => $attr['url'],
				'title' => $attr['title'],
				'long' => $attr['long'],
				'short' => $attr['short'],
				'btn_text' => $attr['btn_text'],
				);
			}
				$context->image_url = ( ! SDES_Static::is_null_or_whitespace( $context->image_url ) )
				? $context->image_url
				: wp_get_attachment_image_src( $context->image_id, 'thumb' )[0];

			if ( ! static::shouldShow( $context ) ) { return ''; }
				ob_start();
			switch ( $attr['layout'] ) {
				case 'square':
					echo static::render_square( $context );
					break;
				case 'rectangle':
				default:
					echo static::render( $context );
					break;
			}
				return ob_get_clean();
		}

		public static function shouldShow( $ctxt ) {
			if ( '' == $ctxt->title || '' == $ctxt->btn_text ) { return false; }
			return true;
		}

		public static function render( $ctxt ) {
			ob_start();
			?>

						<img src="<?= $ctxt->image_url ?>">

							<a href="<?= $ctxt->url ?>"><?= $ctxt->title ?>

<?= $ctxt->long ?>

						<a href="<?= $ctxt->url ?>">

								<?= $ctxt->btn_text ?>

			<?php
			return ob_get_clean();
		}

		public static function render_square( $ctxt ) {
			ob_start();
			?>

						<a href="<?= $ctxt->url ?>"><?= $ctxt->title ?>

<?= $ctxt->short ?>

					<a href="<?= $ctxt->url ?>">

							<?= $ctxt->btn_text ?>

			<?php
			return ob_get_clean();
		}
}

function register_shortcodes() {
	ShortcodeBase::Register_Shortcodes(array(
		__NAMESPACE__.'\sc_row',
		__NAMESPACE__.'\sc_column',
		__NAMESPACE__.'\sc_icon_link',
		__NAMESPACE__.'\sc_callout',
		__NAMESPACE__.'\sc_call_to_action',
		__NAMESPACE__.'\sc_campaign',
	));
}
add_action( 'init', __NAMESPACE__.'\register_shortcodes' );


text:
import os

from setuptools import setup

def read_file(name):
    filepath = os.path.join(
        os.path.dirname(os.path.realpath(__file__)),
        name
    )
    data = open(filepath)
    try:
        return data.read()
    except IOError:
        print "could not read %r" % name
        data.close()

PROJECT = 'ec2stack'
VERSION = '0.8.1'
URL = 'https://git-wip-us.apache.org/repos/asf?p=cloudstack-ec2stack.git'
AUTHOR = 'Apache Software Foundation'
AUTHOR_EMAIL = 'dev@cloudstack.apache.org'
DESC = "EC2 compatibility interface for Apache Cloudstack"
LONG_DESC = read_file('README.md')
REQUIRES = [
    'Flask-SQLAlchemy', 'flask', 'requests', 'alembic'
]

setup(
    name=PROJECT,
    version=VERSION,
    description=DESC,
    long_description=LONG_DESC,
    author=AUTHOR,
    author_email=AUTHOR_EMAIL,
    url=URL,
    license='Apache License (2.0)',
    package_data={'ec2stack': ['templates/*.xml'],
                  'migrations': ['*.mako', 'versions/*']},
    packages=['ec2stack',
              'ec2stack.controllers',
              'ec2stack.providers',
              'ec2stack.models',
              'ec2stack.models.users',
              'ec2stack.providers.cloudstack',
              'migrations'],
    include_package_data=True,
    zip_safe=False,
    install_requires=REQUIRES,
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Environment :: Console',
        'Intended Audience :: System Administrators',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Utilities',
        'Programming Language :: Python :: 2.7',
    ],
    entry_points="""
        [console_scripts]
        ec2stack = ec2stack.__main__:main
        ec2stack-configure = ec2stack.configure:main
        ec2stack-register = ec2stack.secretkey_manager:register
        ec2stack-remove = ec2stack.secretkey_manager:remove
    """
)


text:
AmdHarness-amd-js5
==================

js5! AMD plugin for triggering compatibility shim script if ES5 methods not available.


text:
<?php

namespace App\Entity;

use Doctrine\ORM\EntityRepository;

class MediaCategoryRepository extends EntityRepository
{
	public function findAllAndPopulate()
	{
		return $this->_em->createQueryBuilder()
			->select('category', 'videos', 'images')
			->from('MediaCategory', 'category')
			->leftJoin('category.images', 'images')
			->leftJoin('category.videos', 'videos')
			->getQuery()
			->getResult();
    }

    public function getVideosFilterByCategory($category)
    {
        if ($category == '*') {
            return $this->_em
                ->getRepository('App:Video')
                ->findAll();
        }

        return $this->_em
            ->createQueryBuilder()
            ->select('v')
            ->from('App:Video', 'v')
            ->leftJoin('v.category', 'c')
            ->where('c.title = :category')
            ->setParameter('category', $category)
            ->getQuery()
            ->getResult();
    }

    public function getImagesFIlterByCategory($category)
    {
        if ($category == '*' ) {
            return $this->_em
                ->getRepository('App:Image')
                ->findAll();
        }

        return $this->_em
            ->createQueryBuilder()
            ->select('i')
            ->from('App:Image', 'i')
            ->leftJoin('i.category', 'c')
            ->where('c.title = :category')
            ->setParameter('category', $category)
            ->getQuery()
            ->getResult();
    }

    public function getImagesAndVideos($category, $type)
    {
        if ($type == '*') {
            return array_merge(
                $this->getVideosFilterByCategory($category),
                $this->getImagesFilterByCategory($category)
            );
        } else {
            if ($type == 'video') {
                return $this->getVideosFilterByCategory($category);
            } else {
                return $this->getImagesFilterByCategory($category);
            }
        }
    }
}


text:
@interface PodsDummy_Pods_TAPromotee_TAPromotee : NSObject
@end
@implementation PodsDummy_Pods_TAPromotee_TAPromotee
@end


text:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:textColor="#000000"
    android:textAppearance="?attr/myapp_textAppearanceListItemSmall"
    android:background="?attr/myapp_activatedBackgroundIndicator"
    android:minHeight="?attr/myapp_listPreferredItemHeightSmall"/>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Hedwigia 39: 81 (1900)

#### Original name
Pseudophacidium myrtacearum Rehm

### Remarks
null


text:
package org.drools.modelcompiler.util;

import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.LambdaExpr;
import com.github.javaparser.ast.nodeTypes.NodeWithOptionalScope;
import com.github.javaparser.ast.stmt.ExpressionStmt;
import org.drools.modelcompiler.builder.generator.DrlxParseUtil;

public class LambdaUtil {

    private LambdaUtil() {

    }

    public static Expression appendNewLambdaToOld(LambdaExpr l1, LambdaExpr l2) {
        ExpressionStmt l1ExprStmt = (ExpressionStmt) l1.getBody();
        ExpressionStmt l2ExprStmt = (ExpressionStmt) l2.getBody();

        DrlxParseUtil.RemoveRootNodeResult removeRootNodeResult = DrlxParseUtil.removeRootNode(l2ExprStmt.getExpression());

        NodeWithOptionalScope<?> newExpr = (NodeWithOptionalScope<?>) removeRootNodeResult.getFirstChild();

        newExpr.setScope(l1ExprStmt.getExpression());
        l1.setBody(new ExpressionStmt(removeRootNodeResult.getWithoutRootNode()));
        return l1;
    }
}


text:
using NewsSystem.Web.Services.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NewsSystem.Web.Models;
using NewsSystem.Web.Data.Repositories;

namespace NewsSystem.Web.Services
{
    public class CategoriesService : ICategoriesService
    {
        private IRepository<Category> categories;

        public CategoriesService(IRepository<Category> categories)
        {
            this.categories = categories;
        }

        public IQueryable<Category> All()
        {
            return categories.All();
        }
    }
}


text:
@font-face {
    font-family: 'sf_burlington_scriptBdIt';
    src: url('SF_Burlington_Script_Bold_Italic-webfont.eot');
    src: url('SF_Burlington_Script_Bold_Italic-webfont.eot?#iefix') format('embedded-opentype'),
         url('SF_Burlington_Script_Bold_Italic-webfont.woff') format('woff'),
         url('SF_Burlington_Script_Bold_Italic-webfont.ttf') format('truetype'),
         url('SF_Burlington_Script_Bold_Italic-webfont.svg#sf_burlington_scriptBdIt') format('svg');
    font-weight: normal;
    font-style: normal;

}