List of usage examples for org.apache.commons.lang3 ArrayUtils add
public static double[] add(final double[] array, final int index, final double element)
Inserts the specified element at the specified position in the array.
From source file:com.thoughtworks.go.domain.BuildCommand.java
public static BuildCommand echoWithPrefix(String format, Object... args) { return echo("[%s] " + format, (Object[]) ArrayUtils.add(args, 0, GoConstants.PRODUCT_NAME)); }
From source file:jease.cmf.web.node.constructor.NodeConstructor.java
public NodeConstructor() { setItemRenderer(new NodeConstructorRenderer()); setValues(ArrayUtils.add(JeaseSession.getConfig().newNodes(), 0, null)); }
From source file:moe.encode.airblock.commands.arguments.split.SimpleSplit.java
@Override public String[] split(String raw, boolean parseFlags) { String[] rawSplit = raw.split(" "); if (rawSplit.length == 0) { return new String[] { "" }; }/*from w ww . ja v a 2 s.com*/ if (parseFlags) { if (rawSplit[0].startsWith("-")) { rawSplit[0] = rawSplit[0].substring(1); } else { return ArrayUtils.add(rawSplit, 0, ""); } } return rawSplit; }
From source file:com.thinkbiganalytics.metadata.modeshape.security.role.JcrAbstractRoleMembership.java
public static <M extends JcrAbstractRoleMembership> M create(Node parentNode, Node roleNode, Class<M> memberClass, Object... args) { Object[] argsWithRole = ArrayUtils.add(args, 0, roleNode); // Returns the membership if it already exists in the SNS nodes; otherwise it creates it. return JcrUtil.getNodeList(parentNode, NODE_NAME).stream() .map(node -> JcrUtil.getJcrObject(node, memberClass, args)) .filter(memshp -> memshp.getRole().getSystemName().equals(JcrUtil.getName(roleNode))).findFirst() .orElseGet(() -> {//from ww w. j ava 2s . c o m return JcrUtil.addJcrObject(parentNode, NODE_NAME, NODE_TYPE, memberClass, argsWithRole); }); }
From source file:de.micromata.genome.gwiki.utils.IntArray.java
public void add(int index, int element) { if (index == length) { add(element);// ww w . j a v a 2 s.c o m } else { if (length >= data.length) { overflow(); } ArrayUtils.add(data, index, element); ++length; } }
From source file:fr.inria.atlanmod.neoemf.data.berkeleydb.store.DirectWriteBerkeleyDBCacheManyStore.java
@Override protected void addReference(PersistentEObject object, EReference eReference, int index, PersistentEObject value) {//from w w w . ja v a2s . c o m if (eReference.isMany()) { FeatureKey featureKey = FeatureKey.from(object, eReference); if (index == NO_INDEX) { /* * Handle NO_INDEX index, which represent direct-append feature. * The call to size should not cause an overhead because it would have been done in regular * addUnique() otherwise. */ index = size(object, eReference); } updateContainment(object, eReference, value); updateInstanceOf(value); Object[] array = (Object[]) getFromMap(featureKey); if (isNull(array)) { array = new Object[] {}; } checkPositionIndex(index, array.length, "Invalid add index " + index); array = ArrayUtils.add(array, index, value.id()); objectsCache.put(featureKey, array); persistenceBackend.storeValue(featureKey, array); persistentObjectsCache.put(value.id(), value); } else { super.addReference(object, eReference, index, value); } }
From source file:net.certiv.fluentmark.tables.TableModel.java
public void insertCol(int target) { numCols++;/* w w w . j av a 2 s . c o m*/ aligns = ArrayUtils.add(aligns, target, SWT.LEFT); for (Row row : rows) { if (row.row == formatRow) { row.data = ArrayUtils.add(row.data, target, ":---"); } else { row.data = ArrayUtils.add(row.data, target, ""); } } headers = rows.get(0).data; calcColWidths(); }
From source file:com.splicemachine.pipeline.constraint.ConstraintContext.java
public ConstraintContext withInsertedMessage(int index, String newMessage) { return new ConstraintContext((String[]) ArrayUtils.add(messageArgs, index, newMessage)); }
From source file:com.thoughtworks.go.config.ExecTask.java
@Override public String describe() { if (null != argList && !argList.isEmpty()) { return CommandUtils.shellJoin((String[]) ArrayUtils.add(argList.toStringArray(), 0, command)); }/*from w w w. j a v a 2 s .co m*/ if (null != args && !"".equals(args)) { return command + " " + args; } return command; }
From source file:com.lushapp.modules.sys.web.OrganController.java
/** * combogrid/*from www . j a v a2 s.com*/ * * @return * @throws Exception */ @RequestMapping(value = { "combogrid" }) @ResponseBody public Datagrid<Organ> combogrid(String nameOrCode, @RequestParam(value = "ids", required = false) List<Long> ids, Integer rows) throws Exception { Criterion statusCriterion = Restrictions.eq("status", StatusState.normal.getValue()); Criterion[] criterions = new Criterion[0]; criterions = (Criterion[]) ArrayUtils.add(criterions, 0, statusCriterion); Criterion criterion = null; if (Collections3.isNotEmpty(ids)) { //in? Criterion inCriterion = Restrictions.in("id", ids); if (StringUtils.isNotBlank(nameOrCode)) { Criterion nameCriterion = Restrictions.like("name", nameOrCode, MatchMode.ANYWHERE); Criterion codeCriterion = Restrictions.like("code", nameOrCode, MatchMode.ANYWHERE); Criterion criterion1 = Restrictions.or(nameCriterion, codeCriterion); criterion = Restrictions.or(inCriterion, criterion1); } else { criterion = inCriterion; } //?? criterions = (Criterion[]) ArrayUtils.add(criterions, 0, criterion); } else { if (StringUtils.isNotBlank(nameOrCode)) { Criterion nameCriterion = Restrictions.like("name", nameOrCode, MatchMode.ANYWHERE); Criterion codeCriterion = Restrictions.like("code", nameOrCode, MatchMode.ANYWHERE); criterion = Restrictions.or(nameCriterion, codeCriterion); //?? criterions = (Criterion[]) ArrayUtils.add(criterions, 0, criterion); } } // Page<Organ> p = new Page<Organ>(rows);// p = organManager.findByCriteria(p, criterions); Datagrid<Organ> dg = new Datagrid<Organ>(p.getTotalCount(), p.getResult()); return dg; }