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


Java Varargs类代码示例

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


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

示例1: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public Varargs invoke(int code, U target, Varargs varargs) {
    final int optcode = code - super.getAllFunctionNames().size();
    switch (optcode) {
        case 0:
            return delay(target, varargs);
        case 1:
            return repeat(target, varargs);
        case 2:
            return repeatCount(target, varargs);
        case 3:
            return interval(target, varargs);
        case 4:
            return start(target, varargs);
        case 5:
            return callback(target, varargs);
        case 6:
            return cancel(target, varargs);
    }
    return super.invoke(code, target, varargs);
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:22,代码来源:TimerMethodMapper.java

示例2: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
	LuaString s = args.checkstring(1);
	int l = s.m_length;
	int posi = posrelat( args.optint(2,1), l );
	int pose = posrelat( args.optint(3,posi), l );
	int n,i;
	if (posi <= 0) posi = 1;
	if (pose > l) pose = l;
	if (posi > pose) return NONE;  /* empty interval; return no values */
	n = (int)(pose -  posi + 1);
	if (posi + n <= pose)  /* overflow? */
	    error("string slice too long");
	LuaValue[] v = new LuaValue[n];
	for (i=0; i<n; i++)
		v[i] = valueOf(s.luaByte(posi+i-1));
	return varargsOf(v);
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:18,代码来源:StringLib.java

示例3: invokeBestMethod

import org.luaj.vm2.Varargs; //导入依赖的package包/类
private LuaValue invokeBestMethod(Object instance, Varargs args) {
	JavaMethod best = null;
	int score = CoerceLuaToJava.SCORE_UNCOERCIBLE;
	for ( int i=0; i<methods.length; i++ ) {
		int s = methods[i].score(args);
		if ( s < score ) {
			score = s;
			best = methods[i];
			if ( score == 0 )
				break;
		}
	}
	
	// any match? 
	if ( best == null )
		LuaValue.error("no coercible public method");
	
	// invoke it
	return best.invokeMethod(instance, args);
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:21,代码来源:JavaMethod.java

示例4: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public Varargs invoke(Varargs args) {
    if (args.narg() > 1) {
        return new UDNavigation.setLeft().invoke(args);
    } else {
        return new UDNavigation.getLeft().invoke(args);
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:9,代码来源:UDNavigation.java

示例5: getAlphaInt

import org.luaj.vm2.Varargs; //导入依赖的package包/类
public static Integer getAlphaInt(final Varargs varargs, Double defaultAlpha, int... poslist) {
    final Double alphaDouble = getDouble(varargs, poslist);
    if (alphaDouble != null) {
        return (int) (alphaDouble * 0xFF);
    } else if (defaultAlpha != null) {
        return (int) (defaultAlpha * 0xFF);
    } else {
        return null;
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:11,代码来源:LuaUtil.java

示例6: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public Varargs invoke(int code, U target, Varargs varargs) {
    final int optcode = code - super.getAllFunctionNames().size();
    switch (optcode) {
        case 0:
            return onDraw(target, varargs);
    }
    return super.invoke(code, target, varargs);
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:10,代码来源:UICustomViewMethodMapper.java

示例7: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
    LuaValue func = args.checkfunction(1);
    int up = args.checkint(2);
    LuaValue value = args.arg(3);
    if (func instanceof LuaClosure) {
        LuaClosure c = (LuaClosure) func;
        LuaString name = findupvalue(c, up);
        if (name != null) {
            c.upValues[up - 1].setValue(value);
            return name;
        }
    }
    return NIL;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:15,代码来源:DebugLib.java

示例8: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
	LuaTable t = args.checktable(1);
	switch (args.narg()) {
	case 1: return t.unpack();
	case 2: return t.unpack(args.checkint(2));
	default: return t.unpack(args.checkint(2), args.checkint(3));
	}
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:9,代码来源:TableLib.java

示例9: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		if ( c.upValues != null && up > 0 && up <= c.upValues.length ) {
			return valueOf(c.upValues[up-1].hashCode());
		}
	}
	return NIL;
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:12,代码来源:DebugLib.java

示例10: onCalled

import org.luaj.vm2.Varargs; //导入依赖的package包/类
@Override
public LuaValue onCalled(Varargs parameters) {
    String name = parameters.arg(1).tojstring();
    String version = parameters.arg(2).tojstring();
    String desc = parameters.arg(3).tojstring();
    LuaValue function = parameters.arg(4);
    LuaPlugin plugin = new LuaPlugin(name, version, desc, function);
    Environment.PLUGINS.add(plugin);
    return LuaValue.NIL;
}
 
开发者ID:LukkitPlus,项目名称:Lukkit,代码行数:11,代码来源:CentralPoint.java

示例11: instr

import org.luaj.vm2.Varargs; //导入依赖的package包/类
void instr(int pc, Varargs v, int top) {
    this.pc = pc;
    this.v = v;
    this.top = top;
    if (TRACE) {
        new LuaPrint().buildState(f.checkclosure(), pc, stack, top, v).print();
        //Print.printState(f.checkclosure(), pc, stack, top, v);
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:10,代码来源:DebugLib.java

示例12: invoke

import org.luaj.vm2.Varargs; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
	LuaString s = args.checkstring( 1 );
	int n = args.checkint( 2 );
	final byte[] bytes = new byte[ s.length() * n ];
	int len = s.length();
	for ( int offset = 0; offset < bytes.length; offset += len ) {
		s.copyInto( 0, bytes, offset, len );
	}
	return LuaString.valueUsing( bytes );
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:11,代码来源:StringLib.java

示例13: centerY

import org.luaj.vm2.Varargs; //导入依赖的package包/类
/**
 * 设置中心Y位置
 *
 * @param view
 * @param varargs
 * @return
 */
public LuaValue centerY(U view, Varargs varargs) {
    if (varargs.narg() > 1) {
        return setCenterY(view, varargs);
    } else {
        return getCenterY(view, varargs);
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:15,代码来源:UIViewMethodMapper.java

示例14: contentOffset

import org.luaj.vm2.Varargs; //导入依赖的package包/类
/**
 * 获取contentOffset大小
 *
 * @param view
 * @param varargs
 * @return
 */
@Deprecated
public LuaValue contentOffset(U view, Varargs varargs) {
    if (varargs.narg() > 1) {
        return setContentOffset(view, varargs);
    } else {
        return getContentOffset(view, varargs);
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:16,代码来源:UIBaseListOrRecyclerViewMethodMapper.java

示例15: instr

import org.luaj.vm2.Varargs; //导入依赖的package包/类
void instr(int pc, Varargs v, int top) {
	this.pc = pc;
	this.v = v;
	this.top = top;
	if (TRACE)
		Print.printState(f.checkclosure(), pc, stack, top, v);
}
 
开发者ID:nekocode,项目名称:Hubs,代码行数:8,代码来源:DebugLib.java


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