本文整理汇总了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);
}