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


Java ArrayUtils.add方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.ArrayUtils.add方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.add方法的具体用法?Java ArrayUtils.add怎么用?Java ArrayUtils.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.ArrayUtils的用法示例。


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

示例1: GameSettings

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public GameSettings(Minecraft mcIn, File p_i46326_2_)
{
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar));
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
    this.mc = mcIn;
    this.optionsFile = new File(p_i46326_2_, "options.txt");
    this.optionsFileOF = new File(p_i46326_2_, "optionsof.txt");
    this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
    this.ofKeyBindZoom = new KeyBinding("of.key.zoom", 46, "key.categories.misc");
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.add(this.keyBindings, this.ofKeyBindZoom));
    GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    this.renderDistanceChunks = 8;
    this.loadOptions();
    Config.initGameSettings(this);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:GameSettings.java

示例2: GameSettings

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public GameSettings(Minecraft mcIn, File p_i46326_2_)
{
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar));
    this.difficulty = EnumDifficulty.NORMAL;
    this.lastServer = "";
    this.fovSetting = 70.0F;
    this.language = "en_US";
    this.forceUnicodeFont = false;
    this.mc = mcIn;
    this.optionsFile = new File(p_i46326_2_, "options.txt");
    this.optionsFileOF = new File(p_i46326_2_, "optionsof.txt");
    this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
    this.ofKeyBindZoom = new KeyBinding("Zoom", 46, "key.categories.misc");
    this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.add(this.keyBindings, this.ofKeyBindZoom));
    GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F);
    this.renderDistanceChunks = 8;
    this.loadOptions();
    Config.initGameSettings(this);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:GameSettings.java

示例3: _cubicToQuad

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public double[] _cubicToQuad(double p1x, double p1y, double c1x, double c1y, double c2x, double c2y, double p2x,
		double p2y, double errorBound) {
	Point p1 = new Point(p1x, p1y);
	Point c1 = new Point(c1x, c1y);
	Point c2 = new Point(c2x, c2y);
	Point p2 = new Point(p2x, p2y);
	Point[] pc = calcPowerCoefficients(p1, c1, c2, p2);
	Point a = pc[0], b = pc[1], c = pc[2], d = pc[3];

	Point[][] approximation = new Point[][] {};
	for (int segmentsCount = 1; segmentsCount <= 8; segmentsCount++) {
		approximation = new Point[][] {};
		for (double t = 0.0; t < 1; t += 1.0 / segmentsCount) {
			approximation = ArrayUtils.add(approximation, processSegment(a, b, c, d, t, t + 1 / segmentsCount));
		}
		if (segmentsCount == 1 && (approximation[0][1].sub(p1).dot(c1.sub(p1)) < 0
				|| approximation[0][1].sub(p2).dot(c2.sub(p2)) < 0)) {
			// approximation concave, while the curve is convex (or vice versa)
			continue;
		}
		if (_isApproximationClose(a, b, c, d, approximation, errorBound)) {
			break;
		}
	}
	return toFlatArray(approximation);
}
 
开发者ID:icaoweiwei,项目名称:otf2ttf,代码行数:27,代码来源:CubicToQuad.java

示例4: main

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static void main(String[] args)
{
	String[] array = ArrayUtils.toArray("one", "two", "three");	
	System.out.println(ArrayUtils.toString(array));
	
	array = ArrayUtils.add(array, "four");
	System.out.println(ArrayUtils.toString(array));
	
	if(ArrayUtils.contains(array,"two"))
	{
		System.out.println("found \"two\" in the array.");
	}
	
	ArrayUtils.reverse(array);
	System.out.println(ArrayUtils.toString(array));
}
 
开发者ID:teiniker,项目名称:teiniker-lectures-configurationmanagement,代码行数:17,代码来源:ArrayExample.java

示例5: linearConvolutionMatlabValid

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Convolution U(m)=Sum( H(m)X(n-m) )    0<=m=<(size(H)-1) n=size(H)
 * 
 * This function reproduce the matlab conv function with shape='valid'
 * 
 * @param a
 * @param b
 * @return
 */
public static double[] linearConvolutionMatlabValid(double a[],double b[]){
	//size of the array result without zero padd values
	int sizeResult=a.length+b.length-1;
	int matlabSizeResult=a.length-b.length+1;
	
	b=ArrayUtils.add(b,0);
	
	double[] u=new double[sizeResult];
	int idU=0;
	for(int n=0;n<sizeResult;n++){
		double val=0;

		for(int m=0;m<=n;m++){
			int idx1=m;
			int idx2=n-m;
			
			if(idx2>=0&&idx1>=0&&idx2<b.length-1&&idx1<a.length){
				val=val+a[idx1]*b[idx2];
			}	
		}
		u[idU]=val;
		idU++;
	}
	int diff=(sizeResult-matlabSizeResult);
	int idxStart=diff/2+diff%2;
	int idxEnd=u.length-diff/2;
	u=ArrayUtils.subarray(u, idxStart, idxEnd);
	
	
	return u; 
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:41,代码来源:MathUtil.java

示例6: linearConvolutionMatlabValid

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * Convolution U(m)=Sum( H(m)X(n-m) )    0<=m=<(size(H)-1) n=size(H)
 * 
 * This function reproduce the matlab conv function with shape='valid'
 * 
 * @param a
 * @param b
 * @return
 */
public static double[] linearConvolutionMatlabValid(double a[],double b[]){
	//size of the array result without zero padd values
	int sizeResult=a.length+b.length-1;
	int matlabSizeResult=a.length-b.length+1;
	
	b=ArrayUtils.add(b,0);
	List<Integer> idxPadded=new ArrayList<Integer>();
	
	double[] u=new double[sizeResult];
	int idU=0;
	for(int n=0;n<sizeResult;n++){
		double val=0;
		
		
		for(int m=0;m<=n;m++){
			
			int idx1=m;
			int idx2=n-m;
			
			if(idx2>=0&&idx1>=0&&idx2<b.length-1&&idx1<a.length){
				val=val+a[idx1]*b[idx2];
			}	
		}

		u[idU]=val;
		idU++;
	}
	int diff=(sizeResult-matlabSizeResult);
	int idxStart=diff/2+diff%2;
	int idxEnd=u.length-diff/2;
	u=ArrayUtils.subarray(u, idxStart, idxEnd);
	
	
	return u; 
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:45,代码来源:TestJavaConvolution.java

示例7: getTagsForProperty

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public String[] getTagsForProperty(String propertyName) {
	if (propertyName.equals("eventName")) {
		String[] attrEvents = EnumUtils.toNames(AttrEvent.class);
		if (parent != null && parent instanceof UIDynamicElement) {
			String[] eventNames = ((UIDynamicElement)parent).getEventNames();
    		if (eventNames.length > 0) {
    			eventNames = ArrayUtils.add(eventNames, "");
    		}
			return ArrayUtils.addAll(eventNames, attrEvents);
		}
		return attrEvents;
	}
	return new String[0];
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:16,代码来源:UIControlEvent.java

示例8: translate

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
/**
 * @param texts
 * @return
 */
private List<Translation> translate(List<String> texts) {
    TranslateOption[] translateOptions = new TranslateOption[] {};
    if (srcLang != null) {
        translateOptions = ArrayUtils.add(translateOptions, srcLang);
    }
    if (model != null) {
        translateOptions = ArrayUtils.add(translateOptions, model);
    }
    return translate.translate(texts, translateOptions);
}
 
开发者ID:toyama0919,项目名称:embulk-filter-google_translate_api,代码行数:15,代码来源:GoogleTranslateApiPageOutput.java

示例9: handle

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public double[] handle(Contour z1, Contour z2, Contour z3, Contour z4, Double splitAtX, Double splitAtY,
		double err) {
	double[][] segs = getSplitAtXY(z1.x, z1.y, z2.x, z2.y, z3.x, z3.y, z4.x, z4.y, splitAtX, splitAtY);
	double[] ss = new double[] {};
	for (double[] s : segs) {
		double[] a = cubicToQuad(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], err);
		for (int j = ss.length != 0 ? 2 : 0; j < a.length; j++) {
			ss = ArrayUtils.add(ss, a[j]);
		}
	}
	return ss;
}
 
开发者ID:icaoweiwei,项目名称:otf2ttf,代码行数:13,代码来源:CTQ.java

示例10: main

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	String[] localArgs = args;
	if (ArrayUtils.isEmpty(localArgs)) {
		localArgs = (String[])ArrayUtils.add(localArgs, "server");
		localArgs = (String[])ArrayUtils.add(localArgs, "admin-ui.yml");
	}
	new AdminUIApplication().run(localArgs );
	
}
 
开发者ID:arityllc,项目名称:referenceapp,代码行数:10,代码来源:AdminUIApplication.java

示例11: keyTyped

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
protected void keyTyped(char par1, int par2) throws IOException {
    if (par2 == Keyboard.KEY_ESCAPE) {
        NetworkHandler.sendToServer(new PacketAphorismTileUpdate(tile));
    } else if (par2 == Keyboard.KEY_LEFT || par2 == Keyboard.KEY_UP) {
        cursorY--;
        if (cursorY < 0) cursorY = textLines.length - 1;
    } else if (par2 == Keyboard.KEY_DOWN || par2 == Keyboard.KEY_NUMPADENTER) {
        cursorY++;
        if (cursorY >= textLines.length) cursorY = 0;
    } else if (par2 == Keyboard.KEY_RETURN) {
        cursorY++;
        textLines = ArrayUtils.add(textLines, cursorY, "");
    } else if (par2 == Keyboard.KEY_BACK) {
        if (textLines[cursorY].length() > 0) {
            textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
            if (textLines[cursorY].endsWith("\u00a7")) {
                textLines[cursorY] = textLines[cursorY].substring(0, textLines[cursorY].length() - 1);
            }
        } else if (textLines.length > 1) {
            textLines = ArrayUtils.remove(textLines, cursorY);
            cursorY--;
            if (cursorY < 0) cursorY = 0;
        }
    } else if (par2 == Keyboard.KEY_DELETE) {
        if (GuiScreen.isShiftKeyDown()) {
            textLines = new String[1];
            textLines[0] = "";
            cursorY = 0;
        } else {
            if (textLines.length > 1) {
                textLines = ArrayUtils.remove(textLines, cursorY);
                if (cursorY > textLines.length - 1)
                    cursorY = textLines.length - 1;
            }
        }
    } else if (ChatAllowedCharacters.isAllowedCharacter(par1)) {
        if (GuiScreen.isAltKeyDown()) {
            if (par1 >= 'a' && par1 <= 'f' || par1 >= 'l' && par1 <= 'o' || par1 == 'r' || par1 >= '0' && par1 <= '9') {
                textLines[cursorY] = textLines[cursorY] + "\u00a7" + par1;
            }
        } else {
            textLines[cursorY] = textLines[cursorY] + par1;
        }
    }
    tile.setTextLines(textLines);
    super.keyTyped(par1, par2);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:49,代码来源:GuiAphorismTile.java

示例12: registerKeys

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
@Override
public void registerKeys()
{
    openGuiKey = new KeyBinding("minetogether.key.friends", Keyboard.KEY_M, "minetogether.keys");
    Minecraft.getMinecraft().gameSettings.keyBindings = ArrayUtils.add(Minecraft.getMinecraft().gameSettings.keyBindings, openGuiKey);
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:7,代码来源:Client.java

示例13: cloneWithChild

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public TypedFieldId cloneWithChild(int id) {
  int[] fieldIds = ArrayUtils.add(this.fieldIds, id);
  return new TypedFieldId(intermediateType, secondaryFinal, finalType, isHyperReader, remainder, fieldIds);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:5,代码来源:TypedFieldId.java

示例14: registerKeyBinding

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public static void registerKeyBinding(KeyBinding key)
{
    Minecraft.getMinecraft().gameSettings.keyBindings = ArrayUtils.add(Minecraft.getMinecraft().gameSettings.keyBindings, key);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:ClientRegistry.java

示例15: addVectors

import org.apache.commons.lang3.ArrayUtils; //导入方法依赖的package包/类
public void addVectors(ValueVector[] vv) {
  vectors = (T[]) ArrayUtils.add(vectors, vv);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:HyperVectorWrapper.java


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