private void initColumnsNeedIndex() { int[] tmp = new int[100]; int x = 0; for (int i = 0, n = rowkeyColumns.length; i < n; i++) { if ("true".equalsIgnoreCase(rowkeyColumns[i].getIndex()) && rowkeyColumns[i].isUsingDictionary()) { tmp[x] = i; x++; } } columnsNeedIndex = ArrayUtils.subarray(tmp, 0, x); }
if(args[args.length-1] instanceof Closure) { if(args.length-1 != 1) { Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length-1); filterGStringReferences(constructorArgs); if(name.equals(ANONYMOUS_BEAN)) Object[] constructorArgs = ArrayUtils.subarray(args, 1, args.length); filterGStringReferences(constructorArgs); if(name.equals(ANONYMOUS_BEAN)) Object[] constructorArgs; if(args[args.length-1] instanceof Closure) { constructorArgs= ArrayUtils.subarray(args, 0, args.length-1); constructorArgs= ArrayUtils.subarray(args, 0, args.length);
(String[]) ArrayUtils.addAll(replacementCmd, ArrayUtils.subarray(argv, 1, argv.length)); return run(replacementArgv);
public String readLengthCodedString(byte[] data) throws IOException { byte[] lengthBytes = ByteHelper.readBinaryCodedLengthBytes(data, getIndex()); long length = ByteHelper.readLengthCodedBinary(data, getIndex()); setIndex(getIndex() + lengthBytes.length); if (ByteHelper.NULL_LENGTH == length) { return null; } try { return new String(ArrayUtils.subarray(data, getIndex(), (int) (getIndex() + length)), encoding == null ? CODE_PAGE_1252 : encoding); } finally { setIndex((int) (getIndex() + length)); } }
int numberOfLeftUnitFrames = phone.getNumberOfLeftUnitFrames(); int f0TargetMidIndex = f0TargetStartIndex + numberOfLeftUnitFrames; double[] leftF0Targets = ArrayUtils.subarray(f0Targets, f0TargetStartIndex, f0TargetMidIndex); phone.setLeftTargetF0Values(leftF0Targets); double[] rightF0Targets = ArrayUtils.subarray(f0Targets, f0TargetMidIndex, f0TargetEndIndex); phone.setRightTargetF0Values(rightF0Targets);
pageNumber = 1; } else if (NumberUtils.isDigits(args[args.length - 1])) { command = StringUtils.join(ArrayUtils.subarray(args, 0, args.length - 1), " "); try { pageNumber = NumberUtils.createInteger(args[args.length - 1]);
int numberOfLeftUnitFrames = phone.getNumberOfLeftUnitFrames(); int f0TargetMidIndex = f0TargetStartIndex + numberOfLeftUnitFrames; double[] leftF0Targets = ArrayUtils.subarray(f0Targets, f0TargetStartIndex, f0TargetMidIndex); phone.setLeftTargetF0Values(leftF0Targets); double[] rightF0Targets = ArrayUtils.subarray(f0Targets, f0TargetMidIndex, f0TargetEndIndex); phone.setRightTargetF0Values(rightF0Targets);
private void assertValue(String type, ColumnVector childVector, boolean isDictionaryEncoding, int valueIndex, int position) { if ("int".equals(type)) { assertEquals(getIntValue(isDictionaryEncoding, valueIndex), ((LongColumnVector)childVector).vector[position]); } else if ("long".equals(type)) { assertEquals(getLongValue(isDictionaryEncoding, valueIndex), ((LongColumnVector)childVector).vector[position]); } else if ("double".equals(type)) { assertEquals(getDoubleValue(isDictionaryEncoding, valueIndex), ((DoubleColumnVector)childVector).vector[position], 0); } else if ("float".equals(type)) { assertEquals(getFloatValue(isDictionaryEncoding, valueIndex), ((DoubleColumnVector)childVector).vector[position], 0); } else if ("boolean".equals(type)) { assertEquals((getBooleanValue(valueIndex) ? 1 : 0), ((LongColumnVector)childVector).vector[position]); } else if ("binary".equals(type)) { String actual = new String(ArrayUtils .subarray(((BytesColumnVector)childVector).vector[position], ((BytesColumnVector)childVector).start[position], ((BytesColumnVector)childVector).start[position] + ((BytesColumnVector)childVector).length[position])); assertEquals(getStr(isDictionaryEncoding, valueIndex), actual); } else if ("decimal".equals(type)) { assertEquals(getDecimal(isDictionaryEncoding, valueIndex), ((DecimalColumnVector)childVector).vector[position].getHiveDecimal()); } else { throw new RuntimeException("Unsupported type for TestVectorizedListColumnReader!"); } }
private void assertValue(String type, ColumnVector childVector, boolean isDictionaryEncoding, int valueIndex, int position) { if ("int".equals(type)) { assertEquals(getIntValue(isDictionaryEncoding, valueIndex), ((LongColumnVector)childVector).vector[position]); } else if ("long".equals(type)) { assertEquals(getLongValue(isDictionaryEncoding, valueIndex), ((LongColumnVector)childVector).vector[position]); } else if ("double".equals(type)) { assertEquals(getDoubleValue(isDictionaryEncoding, valueIndex), ((DoubleColumnVector)childVector).vector[position], 0); } else if ("float".equals(type)) { assertEquals(getFloatValue(isDictionaryEncoding, valueIndex), ((DoubleColumnVector)childVector).vector[position], 0); } else if ("binary".equals(type) || "multipleLevel".equals(type)) { String actual = new String(ArrayUtils .subarray(((BytesColumnVector)childVector).vector[position], ((BytesColumnVector)childVector).start[position], ((BytesColumnVector)childVector).start[position] + ((BytesColumnVector)childVector).length[position])); assertEquals(getStr(isDictionaryEncoding, valueIndex), actual); } else if ("decimal".equals(type)) { assertEquals(getDecimal(isDictionaryEncoding, valueIndex), ((DecimalColumnVector)childVector).vector[position].getHiveDecimal()); } else { throw new RuntimeException("Unsupported type for TestVectorizedMapColumnReader!"); } } }
if (!vector.isNull[i]) { actual = new String(ArrayUtils .subarray(vector.vector[i], vector.start[i], vector.start[i] + vector.length[i])); assertEquals("failed at " + c, getStr(isDictionaryEncoding, c), actual); } else {
String displayName = null; if (args.length > 4) { displayName = StringUtils.join(ArrayUtils.subarray(args, 4, args.length), ' '); if (displayName.length() > 32) { sender.sendMessage(ChatColor.RED + "The name '" + displayName + "' is too long for an objective, it can be at most 32 characters long"); String displayName = null; if (args.length > 3) { displayName = StringUtils.join(ArrayUtils.subarray(args, 3, args.length), ' '); if (displayName.length() > 32) { sender.sendMessage(ChatColor.RED + "The display name '" + displayName + "' is too long for a team, it can be at most 32 characters long");
public static RealMatrix createHankelMatrix(RealMatrix data, int windowSize) { int n = data.getRowDimension(); int m = data.getColumnDimension(); int k = n - windowSize + 1; RealMatrix res = MatrixUtils.createRealMatrix(k, m * windowSize); double[] buffer = {}; for (int i = 0; i < n; ++i) { double[] row = data.getRow(i); buffer = ArrayUtils.addAll(buffer, row); if (i >= windowSize - 1) { RealMatrix mat = MatrixUtils.createRowRealMatrix(buffer); res.setRowMatrix(i - windowSize + 1, mat); buffer = ArrayUtils.subarray(buffer, m, buffer.length); } } return res; }
public TcpFrame(final byte[] data, final int off, final int len) { // TODO: Figure out a more efficient way of doing this? Possibly // using ByteBuffers internally, something like that? this.m_data = ArrayUtils.subarray(data, off, len); }
/** * @return UTF-8 byte array for the input string. */ public static byte[] getUtf8Bytes(String s) { if (s == null) { return ArrayUtils.EMPTY_BYTE_ARRAY; } ByteBuffer bb = Charsets.UTF_8.encode(s); return ArrayUtils.subarray(bb.array(), 0, bb.limit()); } }
/** * Returns a path to the parent of the current object * * @return */ public ArchiveObjectPath getParent() { if (path.length > 0) { return new ArchiveObjectPath(rootId, (String[]) ArrayUtils .subarray(path, 0, path.length - 1)); } else return null; }
private void initColumnsNeedIndex() { int[] tmp = new int[100]; int x = 0; for (int i = 0, n = rowkeyColumns.length; i < n; i++) { if ("true".equalsIgnoreCase(rowkeyColumns[i].getIndex()) && rowkeyColumns[i].isUsingDictionary()) { tmp[x] = i; x++; } } columnsNeedIndex = ArrayUtils.subarray(tmp, 0, x); }
@Override public boolean handleResponse(ZWaveController zController, SerialMessage lastSentMessage, SerialMessage incomingMessage) { ZWaveLibraryType = incomingMessage.getMessagePayloadByte(12); zWaveVersion = new String(ArrayUtils.subarray(incomingMessage.getMessagePayload(), 0, 11)); logger.debug(String.format("Got MessageGetVersion response. Version = %s, Library Type = 0x%02X", zWaveVersion, ZWaveLibraryType)); checkTransactionComplete(lastSentMessage, incomingMessage); return true; }
@Override public boolean handleResponse(ZWaveController zController, ZWaveTransaction transaction, SerialMessage incomingMessage) throws ZWaveSerialMessageException { ZWaveLibraryType = incomingMessage.getMessagePayloadByte(12); zWaveVersion = new String(ArrayUtils.subarray(incomingMessage.getMessagePayload(), 0, 11)); logger.debug("Got MessageGetVersion response. Version={}, Library Type={}", zWaveVersion, ZWaveLibraryType); transaction.setTransactionComplete(); return true; }
public MessagePreview create(Message message) { byte[] content = converter.convert(message); final boolean truncated = (content.length > maxMessagePreviewLength); if (truncated) { return new MessagePreview(ArrayUtils.subarray(content, 0, maxMessagePreviewLength), true); } else { return new MessagePreview(content); } } }
private double[] bandPassInOnePass(final BandPassActivityProfile profile, final double[] activeProbArray) { final double[] bandPassProbArray = new double[activeProbArray.length]; // apply the band pass filter for activeProbArray into filteredProbArray final double[] GaussianKernel = profile.getKernel(); for( int iii = 0; iii < activeProbArray.length; iii++ ) { final double[] kernel = ArrayUtils.subarray(GaussianKernel, Math.max(profile.getFilteredSize() - iii, 0), Math.min(GaussianKernel.length, profile.getFilteredSize() + activeProbArray.length - iii)); final double[] activeProbSubArray = ArrayUtils.subarray(activeProbArray, Math.max(0,iii - profile.getFilteredSize()), Math.min(activeProbArray.length,iii + profile.getFilteredSize() + 1)); bandPassProbArray[iii] = dotProduct(activeProbSubArray, kernel); } return bandPassProbArray; }