List of usage examples for com.google.common.primitives Longs asList
public static List<Long> asList(long... backingArray)
From source file:org.truth0.subjects.PrimitiveLongArraySubject.java
@Override public void isNotEqualTo(Object expected) { long[] actual = getSubject(); try {/*from w w w .j a v a2s.c o m*/ long[] expectedArray = (long[]) expected; if (actual == expected || Arrays.equals(actual, expectedArray)) { failWithRawMessage("%s unexpectedly equal to %s.", getDisplaySubject(), Longs.asList(expectedArray)); } } catch (ClassCastException ignored) { } }
From source file:com.aphysci.gravity.matlab.MATLABGravitySubscriber.java
static public List<Long> convertNumberArrayToNumberList(long[] array) { List<Long> list = Longs.asList(array); return list;/*from ww w . j a v a 2 s.c om*/ }
From source file:com.yammer.metrics.stats.CodableUniformSample.java
@Override public Snapshot getSnapshot() { return new Snapshot(Longs.asList(values)); }
From source file:com.example.basic.PublicMethodInvoker.java
public String invokeAllPublicArrayMethods(AllAccessMethods allAccessMethods) { StringBuilder result = new StringBuilder(); result.append(Joiner.on(':').join(allAccessMethods.publicStringArrayMethod(new String[] { "invoker" }))); result.append('-'); result.append(Joiner.on(':').join(Ints.asList(allAccessMethods.publicIntArrayMethod(new int[] { 5 })))); result.append('-'); result.append(Joiner.on(':').join(Longs.asList(allAccessMethods.publicLongArrayMethod(new long[] { 3 })))); result.append('-'); result.append(/*from ww w . j av a 2 s . c o m*/ Joiner.on(':').join(Chars.asList(allAccessMethods.publicCharArrayMethod(new char[] { 'a' })))); result.append('-'); result.append(Joiner.on(':') .join(Booleans.asList(allAccessMethods.publicBooleanArrayMethod(new boolean[] { false })))); result.append('-'); result.append( Joiner.on(':').join(Floats.asList(allAccessMethods.publicFloatArrayMethod(new float[] { 12f })))); result.append('-'); result.append(Joiner.on(':') .join(Doubles.asList(allAccessMethods.publicDoubleArrayMethod(new double[] { 56d })))); result.append('-'); result.append(myField); allAccessMethods.voidMethod(); return result.toString(); }
From source file:org.voltcore.agreement.maker.SiteFailureMessageMaker.java
public static Set<Long> sfmFailed(long... vals) { return ImmutableSet.copyOf(Longs.asList(vals)); }
From source file:org.voltcore.agreement.maker.SiteFailureMessageMaker.java
public static Set<Long> sfmSurvived(long... vals) { return ImmutableSet.copyOf(Longs.asList(vals)); }
From source file:org.voltcore.agreement.maker.SiteFailureMessageMaker.java
public static Set<Long> sfmDecided(long... vals) { return ImmutableSet.copyOf(Longs.asList(vals)); }
From source file:org.apache.hadoop.hdfs.protocol.HdfsBlocksMetadata.java
@Override public String toString() { return "Metadata for " + blockIds.length + " blocks in " + blockPoolId + ": " + Joiner.on(",").join(Longs.asList(blockIds)); }
From source file:org.voltdb.sysprocs.saverestore.StreamSnapshotWritePlan.java
protected boolean createSetupInternal(String file_path, String file_nonce, long txnId, Map<Integer, Long> partitionTransactionIds, JSONObject jsData, SystemProcedureExecutionContext context, String hostname, final VoltTable result, Map<String, Map<Integer, Pair<Long, Long>>> exportSequenceNumbers, SiteTracker tracker, long timestamp) throws IOException { assert (SnapshotSiteProcessor.ExecutionSitesCurrentlySnapshotting.isEmpty()); final StreamSnapshotRequestConfig config = new StreamSnapshotRequestConfig(jsData, context.getDatabase()); final List<StreamSnapshotRequestConfig.Stream> localStreams = filterRemoteStreams(config.streams, Longs.asList(tracker.getLocalSites())); final Map<Long, Integer> tokensToAdd = createTokensToAdd(localStreams); // Coalesce a truncation snapshot if shouldTruncate is true if (config.shouldTruncate) { /*//w ww . ja v a 2s . com * The snapshot will only contain existing partitions. Write the new partition count * down in the digest so that we can check if enough command log is collected on * replay. */ final int newPartitionCount = calculateNewPartitionCount(context.getNumberOfPartitions(), tokensToAdd); coalesceTruncationSnapshotPlan(file_path, file_nonce, txnId, partitionTransactionIds, jsData, context, hostname, result, exportSequenceNumbers, tracker, timestamp, newPartitionCount); } // Create post snapshot update hashinator work List<Integer> localPartitions = tracker.getPartitionsForHost(context.getHostId()); if (!tokensToAdd.isEmpty()) { createUpdateHashinatorTasksForSites(localPartitions, tokensToAdd, txnId); } // Mark snapshot start in registry final AtomicInteger numTables = new AtomicInteger(config.tables.length); final SnapshotRegistry.Snapshot snapshotRecord = SnapshotRegistry.startSnapshot(txnId, context.getHostId(), file_path, file_nonce, SnapshotFormat.STREAM, config.tables); // table schemas for all the tables we'll snapshot on this partition Map<Integer, byte[]> schemas = new HashMap<Integer, byte[]>(); for (final Table table : config.tables) { VoltTable schemaTable = CatalogUtil.getVoltTable(table); schemas.put(table.getRelativeIndex(), schemaTable.getSchemaBytes()); } List<DataTargetInfo> sdts = createDataTargets(localStreams, schemas); // Pick a pair of source to destination for each stream to ship the replicated table data. Multimap<Long, Long> replicatedSrcToDst = pickOnePairPerStream(config.streams); if (SNAP_LOG.isDebugEnabled()) { SNAP_LOG.debug("Picked the following sites to transfer replicated table: " + CoreUtils.hsIdEntriesToString(replicatedSrcToDst.entries())); } // If there's no work to do on this host, just claim success, return an empty plan, // and things will sort themselves out properly // For each table, create tasks where each task has a data target. for (final Table table : config.tables) { createTasksForTable(table, sdts, replicatedSrcToDst, numTables, snapshotRecord); result.addRow(context.getHostId(), hostname, table.getTypeName(), "SUCCESS", ""); } return false; }
From source file:org.dishevelled.bio.convert.BedRecordToFeature.java
@Override public Feature convert(final BedRecord bedRecord, final ConversionStringency stringency, final Logger logger) throws ConversionException { if (bedRecord == null) { warnOrThrow(bedRecord, "must not be null", null, stringency, logger); return null; }//from ww w .j a v a 2 s. c o m final Feature.Builder fb = Feature.newBuilder().setReferenceName(bedRecord.getChrom()) .setStart(bedRecord.getStart()).setEnd(bedRecord.getEnd()); if (bedRecord.getFormat().isAtLeastBED4() && !isMissingValue(bedRecord.getName())) { fb.setName(bedRecord.getName()); } if (bedRecord.getFormat().isAtLeastBED5() && !isMissingValue(bedRecord.getScore())) { try { fb.setScore(Double.valueOf(bedRecord.getScore())); } catch (NumberFormatException e) { warnOrThrow(bedRecord, "caught NumberFormatException", e, stringency, logger); } } if (bedRecord.getFormat().isAtLeastBED6()) { fb.setStrand(strandConverter.convert(bedRecord.getStrand(), stringency, logger)); } if (bedRecord.getFormat().isAtLeastBED12()) { Map<String, String> attributes = new HashMap<String, String>(); attributes.put("thickStart", String.valueOf(bedRecord.getThickStart())); attributes.put("thickEnd", String.valueOf(bedRecord.getThickEnd())); attributes.put("itemRgb", bedRecord.getItemRgb()); attributes.put("blockCount", String.valueOf(bedRecord.getBlockCount())); attributes.put("blockSizes", Joiner.on(",").join(Longs.asList(bedRecord.getBlockSizes()))); attributes.put("blockStarts", Joiner.on(",").join(Longs.asList(bedRecord.getBlockStarts()))); fb.setAttributes(attributes); } return fb.build(); }