List of usage examples for org.apache.commons.lang ArrayUtils remove
private static Object remove(Object array, int index)
Removes the element at the specified position from the specified array.
From source file:gda.device.scannable.DummyContinuouslyScannable.java
/** * For testing and simulation only.//from w w w . java2 s . co m * * @param detector */ public void removeObserver(final SimulatedBufferedDetector detector) { if (ArrayUtils.contains(observers, detector)) { int index = ArrayUtils.indexOf(observers, detector); observers = (SimulatedBufferedDetector[]) ArrayUtils.remove(observers, index); } }
From source file:com.predic8.membrane.core.CoreActivator.java
private String[] fixArguments(String[] args) { int i = ArrayUtils.indexOf(args, "-product"); if (i == -1)/* w w w .j ava2s. c o m*/ return args; return (String[]) ArrayUtils.remove((String[]) ArrayUtils.remove(args, i), i); }
From source file:com.aionemu.gameserver.restrictions.RestrictionsManager.java
public synchronized static void deactivate(Restrictions restriction) { for (RestrictionMode mode : RestrictionMode.VALUES) { Restrictions[] restrictions = RESTRICTIONS[mode.ordinal()]; for (int index; (index = ArrayUtils.indexOf(restrictions, restriction)) != -1;) { restrictions = (Restrictions[]) ArrayUtils.remove(restrictions, index); }/* w w w . java 2 s . c om*/ RESTRICTIONS[mode.ordinal()] = restrictions; } }
From source file:com.evolveum.midpoint.testing.longtest.TestOrgHierarchy.java
private void loadOrgStructure(String parentOid, int[] TREE_SIZE, int[] USER_SIZE, String oidPrefix, OperationResult result) throws Exception { if (TREE_SIZE.length == 0) { return;/* w w w . j a va2 s . co m*/ } for (int i = 0; i < TREE_SIZE[0]; i++) { String newOidPrefix = (TREE_SIZE[0] - i) + "a" + oidPrefix; PrismObject<OrgType> org = createOrg(parentOid, i, newOidPrefix); LOGGER.info("Creating {}, total {}", org, count); String oid = repositoryService.addObject(org, null, result); count++; for (int u = 0; u < USER_SIZE[0]; u++) { PrismObject<UserType> user = createUser(oid, i, u, newOidPrefix); LOGGER.info("Creating {}, total {}", user, count); repositoryService.addObject(user, null, result); count++; } loadOrgStructure(oid, ArrayUtils.remove(TREE_SIZE, 0), ArrayUtils.remove(USER_SIZE, 0), newOidPrefix + i, result); } }
From source file:edu.mayo.cts2.framework.plugin.service.bioportal.transform.TransformUtils.java
/** * Gets the named child with path./*from ww w .ja v a 2s.c o m*/ * * @param node the node * @param childNodes the child nodes * @return the named child with path */ public static Node getNamedChildWithPath(Node node, String[] childNodes) { if (childNodes.length == 1) { return getNamedChild(node, childNodes[0]); } String childNodeName = childNodes[0]; return getNamedChildWithPath(getNamedChild(node, childNodeName), (String[]) ArrayUtils.remove(childNodes, 0)); }
From source file:com.codeabovelab.dm.cluman.job.AbstractJobInstance.java
/** * Send message into job log which formatted as {@link MessageFormat#format(String, Object...)} * @param message message with/* w w w . j a v a 2 s .c o m*/ * @param args objects, also first find throwable will be extracted and passed into event as {@link JobEvent#getException()} */ @Override public void send(String message, Object... args) { Throwable throwable = null; if (!ArrayUtils.isEmpty(args)) { //find and extract throwable for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg instanceof Throwable) { throwable = (Throwable) arg; args = ArrayUtils.remove(args, i); break; } } if (message != null) { try { message = MessageFormat.format(message, args); } catch (Exception e) { LOG.error("Cannot format message: \"{}\"", message, e); } } } sendEvent(new JobEvent(getInfo(), message, throwable)); }
From source file:edu.mayo.cts2.framework.plugin.service.bioportal.transform.TransformUtils.java
/** * Gets the node list with path./*from w ww . j a va 2 s .c om*/ * * @param node the node * @param childNodes the child nodes * @return the node list with path */ public static List<Node> getNodeListWithPath(Node node, String[] childNodes) { if (childNodes.length == 1) { return getNodeList(node, childNodes[0]); } String childNodeName = childNodes[0]; return getNodeListWithPath(getNamedChild(node, childNodeName), (String[]) ArrayUtils.remove(childNodes, 0)); }
From source file:com.evolveum.midpoint.testing.longtest.TestGenericSynchronization.java
private int loadOpenDJ(int[] TREE_SIZE, int[] USER_COUNT, String dnSuffix, int count) throws IOException, LDIFException { if (TREE_SIZE.length == 0) { return count; }/*w w w .j av a 2 s.c o m*/ for (int i = 0; i < TREE_SIZE[0]; i++) { String ou = "L" + TREE_SIZE.length + "o" + i; String newSuffix = "ou=" + ou + ',' + dnSuffix; Entry org = createOrgEntry(ou, dnSuffix); logCreateEntry(org); ldapOrgCount++; openDJController.addEntry(org); count++; for (int u = 0; u < USER_COUNT[0]; u++) { // We have to make uid globally unique. Otherwise correlation takes place and it will // "collapse" several accounts into one user String uid = "L" + TREE_SIZE.length + "o" + i + "u" + u + "c" + ldapdUserCount; String sn = "Doe" + uid; Entry user = createUserEntry(uid, newSuffix, sn); logCreateEntry(user); openDJController.addEntry(user); ldapdUserCount++; count++; } count += loadOpenDJ(ArrayUtils.remove(TREE_SIZE, 0), ArrayUtils.remove(USER_COUNT, 0), newSuffix, 0); } return count; }
From source file:com.davidsoergel.stats.Multinomial.java
public synchronized void remove(T obj) throws DistributionException { Integer i = elementIndexes.get(obj); if (i == null) { //return 0; //return Double.NaN; throw new DistributionException("Can't remove nonexistent element: " + obj); }/* ww w .j a v a 2 s.c om*/ elementIndexes.remove(obj); dist.probs = ArrayUtils.remove(dist.probs, i); dist.normalize(); i++; while (i <= elementIndexes.size()) { T t = elementIndexes.inverse().get(i); elementIndexes.put(t, i - 1); i++; } /* for (Map.Entry<T, Integer> entry : elementIndexes.entrySet()) { Integer v = entry.getValue(); if (v > i) { entry.setValue(v - 1); } } */ }
From source file:com.blockwithme.hacktors.Mobile.java
/** * Removes some equipment to the mobile. */// w w w .j a va 2 s .c om public Item removeItem(final int index) { final Item result = equipment[index]; equipment = (Item[]) ArrayUtils.remove(equipment, index); controller.itemRemoved(result); return result; }