本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
示例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;
}
示例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];
}
示例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;
}
示例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 );
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例15: addVectors
import org.apache.commons.lang3.ArrayUtils; //導入方法依賴的package包/類
public void addVectors(ValueVector[] vv) {
vectors = (T[]) ArrayUtils.add(vectors, vv);
}