当前位置: 首页>>代码示例>>Java>>正文


Java SimpleLiteral类代码示例

本文整理汇总了Java中ch.njol.skript.lang.util.SimpleLiteral的典型用法代码示例。如果您正苦于以下问题:Java SimpleLiteral类的具体用法?Java SimpleLiteral怎么用?Java SimpleLiteral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleLiteral类属于ch.njol.skript.lang.util包,在下文中一共展示了SimpleLiteral类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simplify

import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
public Expression<? extends Number> simplify() {
	if (first instanceof Literal && second instanceof Literal)
		return new SimpleLiteral<Number>(getArray(null), Number.class, false);
	return this;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:8,代码来源:ExprArithmetic.java

示例2: init

import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "null"})
@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
	start = matchedPattern == 0 ? (Expression<Number>) exprs[0] : new SimpleLiteral<Number>(1, false);
	end = (Expression<Number>) exprs[1 - matchedPattern];
	integer = parseResult.mark == 1 || matchedPattern == 1;
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:9,代码来源:ExprNumbers.java

示例3: init

import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "null"})
@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
	if (matchedPattern == 0)
		line = (Expression<Number>) exprs[0];
	else
		line = new SimpleLiteral<Number>(parseResult.mark, false);
	block = (Expression<Block>) exprs[exprs.length - 1];
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:11,代码来源:ExprSignText.java

示例4: simplify

import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@Override
public Expression<T> simplify() {
	boolean isSimpleList = true;
	for (int i = 0; i < expressions.length; i++)
		isSimpleList &= expressions[i].isSingle();
	if (isSimpleList) {
		@SuppressWarnings("unchecked")
		final T[] values = (T[]) Array.newInstance(getReturnType(), expressions.length);
		for (int i = 0; i < values.length; i++)
			values[i] = ((Literal<? extends T>) expressions[i]).getSingle();
		return new SimpleLiteral<T>(values, getReturnType(), and);
	}
	return this;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:15,代码来源:LiteralList.java

示例5: newInstance

import ch.njol.skript.lang.util.SimpleLiteral; //导入依赖的package包/类
@SuppressWarnings("unchecked")
	@Nullable
	public static <T> Parameter<T> newInstance(final String name, final ClassInfo<T> type, final boolean single, final @Nullable String def) {
		if (!Variable.isValidVariableName(name, false, false)) {
			Skript.error("An argument's name must be a valid variable name, and cannot be a list variable.");
			return null;
		}
		Expression<? extends T> d = null;
		if (def != null) {
//			if (def.startsWith("%") && def.endsWith("%")) {
//				final RetainingLogHandler log = SkriptLogger.startRetainingLog();
//				try {
//					d = new SkriptParser("" + def.substring(1, def.length() - 1), SkriptParser.PARSE_EXPRESSIONS, ParseContext.FUNCTION_DEFAULT).parseExpression(type.getC());
//					if (d == null) {
//						log.printErrors("Can't understand this expression: " + def + "");
//						return null;
//					}
//					log.printLog();
//				} finally {
//					log.stop();
//				}
//			} else {
			final RetainingLogHandler log = SkriptLogger.startRetainingLog();
			try {
				if (type.getC() == String.class) {
					if (def.startsWith("\"") && def.endsWith("\""))
						d = (Expression<? extends T>) VariableString.newInstance("" + def.substring(1, def.length() - 1));
					else
						d = (Expression<? extends T>) new SimpleLiteral<String>(def, false);
				} else {
					d = new SkriptParser(def, SkriptParser.PARSE_LITERALS, ParseContext.DEFAULT).parseExpression(type.getC());
				}
				if (d == null) {
					log.printErrors("'" + def + "' is not " + type.getName().withIndefiniteArticle());
					return null;
				}
				log.printLog();
			} finally {
				log.stop();
			}
//			}
		}
		return new Parameter<T>(name, type, single, d);
	}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:45,代码来源:Parameter.java


注:本文中的ch.njol.skript.lang.util.SimpleLiteral类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。