List of usage examples for org.apache.commons.lang ArrayUtils toObject
public static Boolean[] toObject(boolean[] array)
Converts an array of primitive booleans to objects.
From source file:com.cloudera.recordservice.tests.MiniClusterController.java
/** * Every node in the local minicluster runs in its own process. This method * returns a hashset of all the process ids of running nodes in the mini * cluster./*from w ww . j av a 2 s. c o m*/ */ public HashSet<Integer> getRunningMiniNodePids() { HashSet<Integer> pidSet = new HashSet<Integer>(); Collections.addAll(pidSet, ArrayUtils.toObject(GetRunningMiniNodePids())); return pidSet; }
From source file:com.opengamma.financial.analytics.model.equity.indexoption.EquityIndexOptionVegaMatrixFunction.java
@Override protected Object computeValues(EquityIndexOption derivative, StaticReplicationDataBundle market) { final NodalDoublesSurface vegaSurface = CALCULATOR.calcBlackVegaForEntireSurface(derivative, market, SHIFT); final Double[] xValues; final Double[] yValues; if (market.getVolatilitySurface() instanceof BlackVolatilitySurfaceMoneynessFcnBackedByGrid) { BlackVolatilitySurfaceMoneynessFcnBackedByGrid volDataBundle = (BlackVolatilitySurfaceMoneynessFcnBackedByGrid) market .getVolatilitySurface(); xValues = ArrayUtils.toObject(volDataBundle.getGridData().getExpiries()); double[][] strikes2d = volDataBundle.getGridData().getStrikes(); Set<Double> strikeSet = new HashSet<Double>(); for (int i = 0; i < strikes2d.length; i++) { strikeSet.addAll(Arrays.asList(ArrayUtils.toObject(strikes2d[i]))); }//ww w . ja va 2 s .com yValues = strikeSet.toArray(new Double[] {}); } else { xValues = vegaSurface.getXData(); yValues = vegaSurface.getYData(); } final Set<Double> xSet = new HashSet<Double>(Arrays.asList(xValues)); final Set<Double> ySet = new HashSet<Double>(Arrays.asList(yValues)); final Double[] uniqueX = xSet.toArray(new Double[0]); final Double[] uniqueY = ySet.toArray(new Double[0]); final double[][] values = new double[ySet.size()][xSet.size()]; int i = 0; for (final Double x : xSet) { int j = 0; for (final Double y : ySet) { double vega; try { vega = vegaSurface.getZValue(x, y); } catch (final IllegalArgumentException e) { vega = 0; } values[j++][i] = vega; } i++; } final DoubleLabelledMatrix2D matrix = new DoubleLabelledMatrix2D(uniqueX, uniqueY, values); return matrix; }
From source file:com.mg.merp.bpm.support.BusinessProccessManagerServiceBean.java
/** * ?? /*from www. ja v a2 s . c o m*/ * * @return ?? */ protected List<TaskInstance> doLoadTasks() { List<TaskInstance> taskList; JbpmContext context = BPMManagerLocator.locate().getCurrentBpmContext(); try { OrmTemplate tmpl = OrmTemplate.getInstance(); List<String> actorIds = tmpl.findByCriteria(OrmTemplate.createCriteria(Resource.class, "r") //$NON-NLS-1$ .setProjection(Projections.property("r.Key")) //$NON-NLS-1$ .add(Restrictions.eq("r.User.Id", ServerUtils.getUserProfile().getIdentificator()))); //$NON-NLS-1$ //? , ?? ? if (actorIds.size() == 0) { List<String> actorIdsByGroup = tmpl .findByCriteria(OrmTemplate.createCriteria(ResourceGroupLink.class, "l") //$NON-NLS-1$ .createAlias("l.Resource", "r") //$NON-NLS-1$ //$NON-NLS-2$ .setProjection(Projections.property("r.Key")) //$NON-NLS-1$ .add(Restrictions.in("l.Group.Id", //$NON-NLS-1$ (Object[]) ArrayUtils.toObject(ServerUtils.getUserProfile().getGroups())))); actorIds.addAll(actorIdsByGroup); } //? ??, if (actorIds.size() == 0) { taskList = new ArrayList<TaskInstance>(); } else { for (int i = 0; i < actorIds.size(); i++) actorIds.set(i, actorIds.get(i).toLowerCase()); // ?? taskList = context.getGroupTaskList(actorIds); taskList = MiscUtils.convertUncheckedList(TaskInstance.class, context.getGroupTaskList(actorIds)); // ?? for (String actor : actorIds) taskList.addAll(MiscUtils.convertUncheckedList(TaskInstance.class, context.getTaskList(actor))); } } finally { context.close(); } return taskList; }
From source file:msi.gama.util.GamaListFactory.java
public static IList<Integer> createWithoutCasting(final IType contentType, final int[] objects) { final IList<Integer> list = create(contentType, objects.length); list.addAll(Arrays.asList(ArrayUtils.toObject(objects))); return list;/* ww w. j a v a 2 s.c o m*/ }
From source file:gov.redhawk.datalist.ui.internal.DataCourier.java
private Number[][] convertToDataSet(Sample[] buffer) { Number[][] dataSet = new Number[buffer.length][]; for (int i = 0; i < dataSet.length; i++) { Object data = buffer[i].getData(); if (data instanceof Number[]) { dataSet[i] = (Number[]) buffer[i].getData(); } else if (data instanceof Number) { dataSet[i] = new Number[] { (Number) buffer[i].getData() }; } else if (data instanceof double[]) { dataSet[i] = ArrayUtils.toObject((double[]) data); } else if (data instanceof float[]) { dataSet[i] = ArrayUtils.toObject((float[]) data); } else if (data instanceof long[]) { dataSet[i] = ArrayUtils.toObject((long[]) data); } else if (data instanceof int[]) { dataSet[i] = ArrayUtils.toObject((int[]) data); } else if (data instanceof short[]) { dataSet[i] = ArrayUtils.toObject((short[]) data); } else if (data instanceof byte[]) { dataSet[i] = ArrayUtils.toObject((byte[]) data); } else if (data instanceof Object[]) { Object[] objArray = (Object[]) data; dataSet[i] = new Number[objArray.length]; for (int j = 0; j < objArray.length; j++) { dataSet[i][j] = (Number) objArray[j]; }//from w w w . ja va 2 s . c om } else { throw new IllegalStateException("Unsupported type: " + data.getClass()); } } // Transpose the result Number[][] retVal = new Number[dataSet[0].length][dataSet.length]; for (int i = 0; i < retVal.length; i++) { for (int j = 0; j < retVal[i].length; j++) { retVal[i][j] = dataSet[j][i]; } } return retVal; }
From source file:com.opengamma.util.timeseries.fast.longint.AbstractFastLongDoubleTimeSeries.java
@Override public Long[] timesArray() { return ArrayUtils.toObject(timesArrayFast()); }
From source file:hudson.plugins.timestamper.TimestamperBuildWrapperTest.java
/** * @throws Exception//from ww w .j a v a 2 s.c o m */ @Test public void testTimestampNoteSystemProperty() throws Exception { System.setProperty(TimestampNote.getSystemProperty(), "true"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); OutputStream decoratedOutputStream = buildWrapper.decorateLogger(build, outputStream); decoratedOutputStream.write(data); assertThat(ArrayUtils.toObject(outputStream.toByteArray()), is(arrayWithSize(greaterThan(data.length)))); }
From source file:com.opengamma.util.timeseries.fast.integer.AbstractFastIntDoubleTimeSeries.java
@Override public Integer[] timesArray() { return ArrayUtils.toObject(timesArrayFast()); }
From source file:com.mg.merp.baiengine.support.CustomActionManagerImpl.java
/** * ?? /*from www .j av a2s.c o m*/ * * @param code ?? * @return ? <code>null</code> ? ?? */ private CustomUserAction loadUserAction(String code) { return OrmTemplate.getInstance() .findUniqueByCriteria(OrmTemplate.createCriteria(CustomUserAction.class, "cua") .createAlias("cua.Permissions", "perm").add(Restrictions.eq("Code", code)) .add(Restrictions.eq("Active", true)) .add(Restrictions.in("perm.SecGroup.Id", (Object[]) ArrayUtils.toObject(ServerUtils.getUserProfile().getGroups()))) .setFlushMode(FlushMode.MANUAL)); }
From source file:com.opengamma.util.timeseries.fast.integer.AbstractFastIntDoubleTimeSeries.java
@Override public Double[] valuesArray() { return ArrayUtils.toObject(valuesArrayFast()); }