當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。