项目:creacoinj
文件:BasicKeyChain.java
/** Returns a list of all ECKeys created after the given UNIX time. */
public List<ECKey> findKeysBefore(long timeSecs) {
lock.lock();
try {
List<ECKey> results = Lists.newLinkedList();
for (ECKey key : hashToKeys.values()) {
final long keyTime = key.getCreationTimeSeconds();
if (keyTime < timeSecs) {
results.add(key);
}
}
return results;
} finally {
lock.unlock();
}
}
/**
* Tests the select order by statement (with nulls last) against all {@linkplain sqlDialect}s
*
* @throws sqlException in case of error.
*/
@Test
public void testSelectOrderByNullsFirstAscNullsFirstDesc() throws sqlException {
SelectStatement selectOrderByNullsLastStat = select( field("field1"),field("field2")).from(tableRef("OrderByNullsLastTable")).orderBy(field("field1").nullsFirst(),field("field2").desc().nullsFirst());
String sql = convertStatementTosql(selectOrderByNullsLastStat);
sqlScriptExecutorProvider.get().executeQuery(sql,new ResultSetProcessor<Void>() {
@Override
public Void process(ResultSet resultSet) throws sqlException {
List<String> expectedResultField1 = Lists.newArrayList(null,null,"1","3","3");
List<String> expectedResultField2 = Lists.newArrayList(null,"2","4","3");
int count = 0;
while (resultSet.next()) {
assertEquals("count:"+count,expectedResultField1.get(count),resultSet.getString(1));
assertEquals("count:"+count,expectedResultField2.get(count),resultSet.getString(2));
count++;
}
return null;
};
});
}
项目:Equella
文件:RoleSelectorWebControl.java
@Override
public void doEdits(SectionInfo info)
{
final RoleSelectorWebControlModel model = getModel(info);
if( model.getSelectedRoles() != null )
{
final List<String> controlValues = storageControl.getValues();
controlValues.clear();
controlValues.addAll(Lists.transform(model.getSelectedRoles(),new Function<SelectedRole,String>()
{
@Override
public String apply(SelectedRole role)
{
return role.getUuid();
}
}));
}
}
项目:empiria.player
文件:CommutationEvaluatorJUnitTest.java
@Test
public void evaluateCorrect() {
// given
ExpressionBean bean = new ExpressionBean();
List<Response> responses = Lists.newArrayList(correctResponse(),correctResponse(),correctResponse());
bean.setTemplate("'0'+'2'+'3'='1'+'4'");
bean.getResponses().addAll(responses);
Multiset<Multiset<String>> correctAnswerMultiSet = HashMultiset.create(Lists.<Multiset<String>>newArrayList(
HashMultiset.create(Lists.newArrayList("answer_1","answer_4")),HashMultiset.create(Lists.newArrayList("answer_0","answer_2","answer_3")),"answer_3","answer_1","answer_4"))));
bean.setCorectResponses(correctAnswerMultiSet);
// when
boolean result = testObj.evaluate(bean);
// then
assertthat(result,equalTo(true));
}
private List<String> getPropCols(String propertyString,boolean lowercase) {
if (StringUtils.isEmpty(propertyString)) {
logger.warn("Property is empty. property name:" + propertyString);
return null;
}
List<String> propList = Lists.newArrayList();
String[] propCols = propertyString.split(",");
for (int i = 0; i < propCols.length; i++) {
String prop = propCols[i].split("/")[0].trim();
if (lowercase) {
prop = prop.toLowerCase();
}
propList.add(prop);
}
return propList;
}
项目:empiria.player
文件:BonusProviderTest.java
@Test
public void next_imageBonus_random() {
// given
final String asset1 = "bonus1";
final String asset2 = "bonus2.png";
final Size size = new Size(1,2);
BonusResource bonusResource = createBonus(asset2,size,IMAGE);
ArrayList<BonusResource> bonuses = Lists.newArrayList(createBonus(asset1,SWIFFY),bonusResource);
BonusAction action = createMockAction(bonuses);
when(bonusConfig.getActions()).thenReturn(Lists.newArrayList(action));
when(randomWrapper.nextInt(2)).thenReturn(1);
BonusWithAsset expected = mock(BonusWithAsset.class);
when(bonusFactory.createBonus(eq(bonusResource))).thenReturn(expected);
// when
Bonus result = bonusProvider.next();
// then
verify(bonusFactory).createBonus(bonusResource);
assertthat(result).isEqualTo(expected);
}
项目:mynlp
文件:WordnetTokenizer.java
@Override
public LinkedList<MynlpTerm> token(char[] text) {
// 处理为空的特殊情况
if (text.length == 0) {
return Lists.newLinkedList();
}
//构建一个空的Wordnet对象
final Wordnet wordnet = initEmptyWordNet(text);
wordnetinitializer.initialize(wordnet);
//选择一个路径出来(第一次不严谨的分词结果)
Wordpath wordpath = bestPathComputer.select(wordnet);
for (WordpathProcessor xProcessor : wordpathProcessors) {
wordpath = xProcessor.process(wordpath);
}
return path2Termlist(wordpath);
}
项目:flume-release-1.7.0
文件:ThriftSource.java
@Override
public Status appendBatch(List<ThriftFlumeEvent> events) throws TException {
sourceCounter.incrementAppendBatchReceivedCount();
sourceCounter.addToEventReceivedCount(events.size());
List<Event> flumeEvents = Lists.newArrayList();
for (ThriftFlumeEvent event : events) {
flumeEvents.add(EventBuilder.withBody(event.getBody(),event.getHeaders()));
}
try {
getChannelProcessor().processEventBatch(flumeEvents);
} catch (ChannelException ex) {
logger.warn("Thrift source %s Could not append events to the channel.",getName());
return Status.Failed;
}
sourceCounter.incrementAppendBatchAcceptedCount();
sourceCounter.addToEventAcceptedCount(events.size());
return Status.OK;
}
项目:pnc-repressurized
文件:CustomTrigger.java
/**
* Trigger.
*
* @param player the player
*/
public void trigger(EntityPlayerMP player) {
List<ICriterionTrigger.Listener<CustomTrigger.Instance>> list = null;
for (ICriterionTrigger.Listener<CustomTrigger.Instance> listener : this.listeners) {
if (listener.getCriterionInstance().test()) {
if (list == null) {
list = Lists.newArrayList();
}
list.add(listener);
}
}
if (list != null) {
for (ICriterionTrigger.Listener listener1 : list) {
listener1.grantCriterion(this.playerAdvancements);
}
}
}
项目:creacoinj
文件:DatabaseFullPrunedBlockStore.java
/**
* Create a new store for the given {@link org.creativecoinj.core.NetworkParameters}.
* @param params The network.
* @throws BlockStoreException If the store Couldn't be created.
*/
private void createNewStore(NetworkParameters params) throws BlockStoreException {
try {
// Set up the genesis block. When we start out fresh,it is by
// deFinition the top of the chain.
StoredBlock storedGenesisHeader = new StoredBlock(params.getGenesisBlock().cloneAsHeader(),params.getGenesisBlock().getWork(),0);
// The coinbase in the genesis block is not spendable. This is because of how Bitcoin Core inits
// its database - the genesis transaction isn't actually in the db so its spent flags can never be updated.
List<Transaction> genesisTransactions = Lists.newLinkedList();
StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(),genesisTransactions);
put(storedGenesisHeader,storedGenesis);
setChainHead(storedGenesisHeader);
setVerifiedChainHead(storedGenesisHeader);
} catch (VerificationException e) {
throw new RuntimeException(e); // Cannot happen.
}
}
@Test
public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception {
when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null);
when(releaseService.findLatestActiveRelease(someAppId,someClusterName,someNamespaceName)).thenReturn(null);
Release release = configServiceWithCache.findLatestActiveRelease(someAppId,someNamespaceName,someNotificationMessages);
Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId,someNotificationMessages);
int retryTimes = 100;
for (int i = 0; i < retryTimes; i++) {
configServiceWithCache.findLatestActiveRelease(someAppId,someNotificationMessages);
}
assertNull(release);
assertNull(anotherRelease);
verify(releaseMessageService,times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey));
verify(releaseService,times(1)).findLatestActiveRelease(someAppId,someNamespaceName);
}
项目:travny
文件:Codegen.java
private List<Map<String,Object>> getIdFields(RecordSchema schema) {
List<Map<String,Object>> list = Lists.newArrayList();
for (Field f : schema.getFields()) {
if (f.isRemoved()) {
continue;
}
boolean isIdField = SchemaNameUtils.isIdSchema(schema.getName()) || f.isIdField();
if (!isIdField) {
continue;
}
Map<String,Object> fm = Maps.newHashMap();
fm.put("name",f.getName());
fm.put("isIdField",isIdField);
list.add(fm);
}
return list;
}
项目:Reer
文件:RegexBackedCSourceParser.java
private List<Include> parseFile(File file) {
List<Include> includes = Lists.newArrayList();
try {
BufferedReader bf = new BufferedReader(new PreprocessingReader(new BufferedReader(new FileReader(file))));
try {
String line;
while ((line = bf.readLine()) != null) {
Matcher m = includePattern.matcher(line.trim());
if (m.matches()) {
boolean isImport = "import".equals(m.group(1));
String value = m.group(2);
includes.add(DefaultInclude.parse(value,isImport));
}
}
} finally {
IoUtils.closeQuietly(bf);
}
} catch (IOException e) {
throw new UncheckedioException(e);
}
return includes;
}
项目:NioSmtpClient
文件:SmtpSessionTest.java
private void assertResponsesMapped(int responsesExpected,CompletableFuture<SmtpClientResponse> future) throws Exception {
List<SmtpResponse> responses = Lists.newArrayList();
for (int i = 0; i < responsesExpected; i++) {
responses.add(new DefaultSmtpResponse(250 + i,"OK " + i));
}
responseFuture.complete(responses);
verify(responseHandler).createResponseFuture(eq(responsesExpected),any());
assertthat(future.isDone()).isTrue();
assertthat(future.get().getResponses().size()).isEqualTo(responses.size());
for (int i = 0; i < responsesExpected; i++) {
assertthat(future.get().getSession()).isEqualTo(session);
assertthat(future.get().getResponses().get(i).code()).isEqualTo(responses.get(i).code());
assertthat(future.get().getResponses().get(i).details()).isEqualTo(responses.get(i).details());
}
}
public Builder setLaunchables(Iterable<? extends Launchable> launchables) {
Set<String> taskPaths = new LinkedHashSet<String>();
List<InternalLaunchable> launchablesParams = Lists.newArrayList();
for (Launchable launchable : launchables) {
Object original = new ProtocolToModelAdapter().unpack(launchable);
if (original instanceof InternalLaunchable) {
// A launchable created by the provider - just hand it back
launchablesParams.add((InternalLaunchable) original);
} else if (original instanceof TaskListingLaunchable) {
// A launchable synthesized by the consumer - unpack it into a set of task names
taskPaths.addAll(((TaskListingLaunchable) original).getTaskNames());
} else if (launchable instanceof Task) {
// A task created by a provider that does not understand launchables
taskPaths.add(((Task) launchable).getPath());
} else {
throw new GradleException("Only Task or TaskSelector instances are supported: "
+ (launchable != null ? launchable.getClass() : "null"));
}
}
// Tasks are ignored by providers if launchables is not null
this.launchables = launchablesParams.isEmpty() ? null : launchablesParams;
tasks = Lists.newArrayList(taskPaths);
return this;
}
private String generateHtmlLessFunctionTable(List<StandardFunction> standardFunctions) {
StringBuilder html = new StringBuilder("<table style=\"border: 0;\">\n");
List<List<StandardFunction>> subLists = Lists.partition(standardFunctions,3);
for (List<StandardFunction> subList : subLists) {
html.append("<tr>");
for (StandardFunction standardCssFunction : subList) {
List<String> links = standardCssFunction.getLinks().stream().filter(f -> f.contains("lesscss.org")).collect(Collectors.toList());
html.append("<td style=\"border: 0; \">");
if (!links.isEmpty()) {
html.append("<a target=\"_blank\" href=\"").append(links.get(0)).append("\">");
}
html.append("<code>").append(standardCssFunction.getName()).append("</code>");
if (!links.isEmpty()) {
html.append("</a>");
}
html.append("</code>");
for (int i = 1; i < links.size(); i++) {
html.append(" <a target=\"_blank\" href=\"").append(links.get(i)).append("\">#").append(i + 1).append("</a>");
}
html.append("</td>\n");
}
html.append("</tr>");
}
html.append("</table>\n");
return html.toString();
}
项目:hadoop
文件:FSAclBaseTest.java
@Test
public void testRemoveAclOnlyDefault() throws IOException {
FileSystem.mkdirs(fs,path,FsPermission.createImmutable((short)0750));
List<AclEntry> aclSpec = Lists.newArrayList(
aclEntry(ACCESS,USER,ALL),aclEntry(ACCESS,GROUP,READ_EXECUTE),OTHER,NONE),aclEntry(DEFAULT,"foo",ALL));
fs.setAcl(path,aclSpec);
fs.removeAcl(path);
AclStatus s = fs.getAclStatus(path);
AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
assertArrayEquals(new AclEntry[] { },returned);
assertPermission((short)0750);
assertAclFeature(false);
}
项目:Elasticsearch
文件:PluginLoader.java
private List<CrateComponentLoader.OnModuleReference> loadModuleReferences(Plugin plugin) {
List<CrateComponentLoader.OnModuleReference> list = Lists.newArrayList();
for (Method method : plugin.getClass().getDeclaredMethods()) {
if (!method.getName().equals("onModule")) {
continue;
}
if (method.getParameterTypes().length == 0 || method.getParameterTypes().length > 1) {
logger.warn("Plugin: {} implementing onModule with no parameters or more than one parameter",plugin.name());
continue;
}
Class moduleClass = method.getParameterTypes()[0];
if (!Module.class.isAssignableFrom(moduleClass)) {
logger.warn("Plugin: {} implementing onModule by the type is not of Module type {}",plugin.name(),moduleClass);
continue;
}
method.setAccessible(true);
//noinspection unchecked
list.add(new CrateComponentLoader.OnModuleReference(moduleClass,method));
}
return list;
}
项目:appinventor-extensions
文件:ColorChoicepropertyeditor.java
/**
* Creates a new instance of the property editor.
*
* @param hexPrefix language specific hex number prefix
* @param colors colors to be shown in property editor - must not be
* {@code null} or empty
*/
public ColorChoicepropertyeditor(final Color[] colors,final String hexPrefix) {
this.hexPrefix = hexPrefix;
this.colors = colors;
// Initialize UI
List<DropDownItem> choices = Lists.newArrayList();
for (final Color color : colors) {
choices.add(new DropDownItem(WIDGET_NAME,color.getHtmlDescription(),new Command() {
@Override
public void execute() {
property.setValue(hexPrefix + color.alphaString + color.rgbString);
}
}));
}
selectedColorMenu = new DropDownButton(WIDGET_NAME,colors[0].getHtmlDescription(),choices,false,true,false);
selectedColorMenu.setStylePrimaryName("ode-ColorChoicepropertyeditor");
initWidget(selectedColorMenu);
}
private List<PlayerProfileCache.ProfileEntry> getEntriesWithLimit(int limitSize)
{
ArrayList<PlayerProfileCache.ProfileEntry> arraylist = Lists.<PlayerProfileCache.ProfileEntry>newArrayList();
for (GameProfile gameprofile : Lists.newArrayList(Iterators.limit(this.gameProfiles.iterator(),limitSize)))
{
PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = this.getByUUID(gameprofile.getId());
if (playerprofilecache$profileentry != null)
{
arraylist.add(playerprofilecache$profileentry);
}
}
return arraylist;
}
项目:dremio-oss
文件:TestArrowFileReader.java
/** Helper method to get the values in given range in colBit vector used in this test class. */
private static List<Boolean> getBitValues(VectorContainer container,int start,int end) {
FieldReader reader = container.getValueAccessorById(NullableBitVector.class,0).getValueVector().getReader();
List<Boolean> values = Lists.newArrayList();
for(int i=start; i<end; i++) {
reader.setPosition(i);
if (reader.isSet()) {
values.add(reader.readBoolean());
} else {
values.add(null);
}
}
return values;
}
项目:ditb
文件:RegionReplicaReplicationEndpoint.java
@Override
public WALEntryFilter getWALEntryfilter() {
WALEntryFilter superFilter = super.getWALEntryfilter();
WALEntryFilter skipReplayedEditsFilter = getSkipReplayedEditsFilter();
if (superFilter == null) {
return skipReplayedEditsFilter;
}
if (skipReplayedEditsFilter == null) {
return superFilter;
}
ArrayList<WALEntryFilter> filters = Lists.newArrayList();
filters.add(superFilter);
filters.add(skipReplayedEditsFilter);
return new ChainWALEntryFilter(filters);
}
项目:guava-mock
文件:CacheBuilderFactory.java
/**
* Sets.cartesianProduct doesn't allow sets that contain null,but we want null to mean
* "don't call the associated CacheBuilder method" - that is,get the default CacheBuilder
* behavior. This method wraps the elements in the input sets (which may contain null) as
* Optionals,calls Sets.cartesianProduct with those,then transforms the result to unwrap
* the Optionals.
*/
private Iterable<List<Object>> buildCartesianProduct(Set<?>... sets) {
List<Set<Optional<?>>> optionalSets = Lists.newArrayListWithExpectedSize(sets.length);
for (Set<?> set : sets) {
Set<Optional<?>> optionalSet =
Sets.newLinkedHashSet(Iterables.transform(set,NULLABLE_TO_OPTIONAL));
optionalSets.add(optionalSet);
}
Set<List<Optional<?>>> cartesianProduct = Sets.cartesianProduct(optionalSets);
return Iterables.transform(cartesianProduct,new Function<List<Optional<?>>,List<Object>>() {
@Override public List<Object> apply(List<Optional<?>> objs) {
return Lists.transform(objs,OPTIONAL_TO_NULLABLE);
}
});
}
项目:athena
文件:MastersListCommand.java
@Override
protected void execute() {
ClusterService service = get(ClusterService.class);
MastershipService mastershipService = get(MastershipService.class);
List<ControllerNode> nodes = newArrayList(service.getNodes());
Collections.sort(nodes,Comparators.NODE_COMParaTOR);
if (outputJson()) {
print("%s",json(service,mastershipService,nodes));
} else {
for (ControllerNode node : nodes) {
List<deviceid> ids = Lists.newArrayList(mastershipService.getDevicesOf(node.id()));
Collections.sort(ids,Comparators.ELEMENT_ID_COMParaTOR);
print("%s: %d devices",node.id(),ids.size());
for (deviceid deviceid : ids) {
print(" %s",deviceid);
}
}
}
}
项目:empiria.player
文件:BonusProviderTest.java
@Test
public void next_swiffyBonus() {
// given
final String asset = "swiffy0";
final Size size = new Size(1,2);
BonusResource bonusResource = createBonus(asset,SWIFFY);
BonusAction action = createMockAction(Lists.newArrayList(bonusResource));
when(bonusConfig.getActions()).thenReturn(Lists.newArrayList(action));
BonusWithAsset expected = mock(BonusWithAsset.class);
when(bonusFactory.createBonus(eq(bonusResource))).thenReturn(expected);
// when
Bonus result = bonusProvider.next();
// then
verify(bonusFactory).createBonus(bonusResource);
assertthat(result).isEqualTo(expected);
}
项目:oscm
文件:TriggerServiceWSTest.java
public static List<VOParameter> getVOParameters(
ParameterValueType valueType,String paramValue,String optionId) {
List<VOParameter> result = getVOParameters(valueType,paramValue);
VOParameterOption option = new VOParameterOption();
option.setoptionId(optionId);
result.get(0).getParameterDeFinition()
.setParameterOptions(Lists.newArrayList(option));
return result;
}
项目:monarch
文件:AReaderImpl.java
private static OrcProto.Metadata extractMetadata(ByteBuffer bb,int MetadataAbsPos,int MetadataSize,CompressionCodec codec,int bufferSize) throws IOException {
bb.position(MetadataAbsPos);
bb.limit(MetadataAbsPos + MetadataSize);
return OrcProto.Metadata.parseFrom(InStream.createCodedInputStream("Metadata",Lists.<diskRange>newArrayList(new BufferChunk(bb,0)),MetadataSize,codec,bufferSize));
}
项目:BaseClient
文件:PlayerSelector.java
private static List<Predicate<Entity>> func_179648_b(Map<String,String> p_179648_0_)
{
List<Predicate<Entity>> list = Lists.<Predicate<Entity>>newArrayList();
final int i = parseIntWithDefault(p_179648_0_,"lm",-1);
final int j = parseIntWithDefault(p_179648_0_,"l",-1);
if (i > -1 || j > -1)
{
list.add(new Predicate<Entity>()
{
public boolean apply(Entity p_apply_1_)
{
if (!(p_apply_1_ instanceof EntityPlayerMP))
{
return false;
}
else
{
EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_;
return (i <= -1 || entityplayermp.experienceLevel >= i) && (j <= -1 || entityplayermp.experienceLevel <= j);
}
}
});
}
return list;
}
项目:oneops
文件:Assembly.java
public List<Environment> getEnvironmentList() {
List<Environment> environmentList = Lists.newArrayList();
for (Entry<String,Environment> entry : environments.entrySet()) {
Environment environment = entry.getValue();
environment.setName(entry.getKey());
environmentList.add(environment);
}
return environmentList;
}
项目:NioSmtpClient
文件:SmtpSession.java
private CompletableFuture<SmtpClientResponse> sendAsChunked(String from,Collection<String> recipients,MessageContent content,Optional<SendInterceptor> sequenceInterceptor) {
if (ehloResponse.isSupported(Extension.PIPELINING)) {
List<Object> objects = Lists.newArrayListWithExpectedSize(3 + recipients.size());
objects.add(mailCommand(from,recipients));
objects.addAll(rpctCommands(recipients));
Iterator<ByteBuf> chunkIterator = content.getContentChunkIterator(channel.alloc());
ByteBuf firstChunk = chunkIterator.next();
if (firstChunk == null) {
throw new IllegalArgumentException("The MessageContent was empty; size is " +
(content.size().isPresent() ? Integer.toString(content.size().getAsInt()) : "not present"));
}
objects.add(getBdatRequestWithData(firstChunk,!chunkIterator.hasNext()));
return beginSequence(sequenceInterceptor,objects.size(),objects.toArray())
.thenSendInTurn(getBdatIterator(chunkIterator))
.toResponses();
} else {
SendSequence sequence = beginSequence(sequenceInterceptor,1,mailCommand(from,recipients));
for (String recipient : recipients) {
sequence.thenSend(SmtpRequests.rcpt(recipient));
}
return sequence
.thenSendInTurn(getBdatIterator(content.getContentChunkIterator(channel.alloc())))
.toResponses();
}
}
@Test
public void testRepeatingKVs() throws Exception {
List<keyvalue> kvs = Lists.newArrayList();
for (int i = 0; i < 400; i++) {
byte[] row = Bytes.toBytes("row" + (i % 10));
byte[] fam = Bytes.toBytes("fam" + (i % 127));
byte[] qual = Bytes.toBytes("qual" + (i % 128));
kvs.add(new keyvalue(row,fam,qual,12345L,VALUE));
}
runTestCycle(kvs);
}
项目:OneClient
文件:InstanceManager.java
public static ObservableList<Instance> getRecentInstances() {
loadRecent();
if (getInstances().isEmpty())
return FXCollections.emptyObservableList();
List<Instance> recent = Lists.newArrayList();
for (String name : RECENT_INSTANCES) {
if (INSTANCES_MAP.containsKey(name))
recent.add(INSTANCES_MAP.get(name));
}
if (recent.isEmpty()) {
int size = getInstances().size();
return FXCollections.observableArrayList(getInstances().subList(0,Math.min(size,MAX_RECENT)));
}
return FXCollections.observableArrayList(recent);
}
项目:Backmemed
文件:AnvilSaveConverter.java
public List<WorldSummary> getSaveList() throws AnvilConverterException
{
if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory())
{
List<WorldSummary> list = Lists.<WorldSummary>newArrayList();
File[] afile = this.savesDirectory.listFiles();
for (File file1 : afile)
{
if (file1.isDirectory())
{
String s = file1.getName();
WorldInfo worldinfo = this.getWorldInfo(s);
if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133))
{
boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion();
String s1 = worldinfo.getWorldName();
if (StringUtils.isEmpty(s1))
{
s1 = s;
}
long i = 0L;
list.add(new WorldSummary(worldinfo,s,s1,0L,flag));
}
}
}
return list;
}
else
{
throw new AnvilConverterException(I18n.translatetoLocal("selectWorld.load_folder_access"));
}
}
项目:CustomWorldGen
文件:FluidHandlerConcatenate.java
@Override
public IFluidTankProperties[] getTankProperties()
{
List<IFluidTankProperties> tanks = Lists.newArrayList();
for (IFluidHandler handler : subHandlers)
{
Collections.addAll(tanks,handler.getTankProperties());
}
return tanks.toArray(new IFluidTankProperties[tanks.size()]);
}
项目:CustomWorldGen
文件:StructureStrongholdPieces.java
/**
* sets up Arrays with the Structure pieces and their weights
*/
public static void prepareStructurePieces()
{
structurePieceList = Lists.<StructureStrongholdPieces.PieceWeight>newArrayList();
for (StructureStrongholdPieces.PieceWeight structurestrongholdpieces$pieceweight : PIECE_WEIGHTS)
{
structurestrongholdpieces$pieceweight.instancesspawned = 0;
structurePieceList.add(structurestrongholdpieces$pieceweight);
}
strongComponentType = null;
}
项目:crawling-framework
文件:EsHttpSourceTestOperations.java
public List<HttpSourceTest> all() {
BoolQueryBuilder filter = QueryBuilders.boolQuery()
.must(QueryBuilders.existsQuery("source_url"));
Client client = getConnection().getClient();
TimeValue keepAlive = TimeValue.timeValueMinutes(10);
SearchResponse response = client.prepareSearch(getIndex())
.setTypes(getType())
.setPostFilter(filter)
.setSize(100)
.setScroll(keepAlive)
.setFetchSource(true)
.setExplain(false)
.execute()
.actionGet();
List<HttpSourceTest> result = Lists.newArrayList();
do {
result.addAll(Arrays.stream(response.getHits().getHits())
.map(SearchHit::getSource)
.filter(Objects::nonNull)
.map(this::mapToHttpSourceTest)
.collect(Collectors.toList()));
response = client.prepareSearchScroll(response.getScrollId())
.setScroll(keepAlive)
.execute()
.actionGet();
} while (response.getHits().getHits().length != 0);
return result;
}
@Override
protected void visitDirectoryTree(Directoryfiletree directoryTree,List<DefaultFileDetails> filetreeElements) {
// Sort non-root elements as their order is not important
List<DefaultFileDetails> subElements = Lists.newArrayList();
super.visitDirectoryTree(directoryTree,subElements);
Collections.sort(subElements,FILE_DETAILS_COMParaTOR);
filetreeElements.addAll(subElements);
}
项目:OperatieBRP
文件:MeldingBepalerServiceImpl.java
@Override
public List<Melding> geefWaarschuwingen(final List<BijgehoudenPersoon> bijgehoudenPersoonList) {
final List<Melding> meldingList = Lists.newLinkedList();
bijgehoudenPersoonList.forEach(
persoon -> controleerVerstrekkingbeperkingOpPersoon(persoon.getPersoonslijst(),persoon.getCommunicatieId(),meldingList));
return meldingList;
}
项目:angit
文件:BeanValidators.java
/**
* 辅助方法,转换Set<ConstraintViolation>为List<message>
*
* @param constraintViolations the constraint violations
* @return the list
*/
@SuppressWarnings("rawtypes")
public static List<String> extractMessage(Set<? extends ConstraintViolation> constraintViolations) {
List<String> errorMessages = Lists.newArrayList();
errorMessages.addAll(constraintViolations.stream().map((Function<ConstraintViolation,String>) ConstraintViolation::getMessage).collect(Collectors.toList()));
return errorMessages;
}
项目:Pogamut3
文件:BspListDataStrategy.java
/** Split data
*
* See {@link IBspStrategy#splitData(Object,Object)}
*/
public SplitData<ArrayList<TElement>> splitData(TBoundary boundary,ArrayList<TElement> data) {
ArrayList<TElement> positiveData = Lists.newArrayList();
ArrayList<TElement> negativeData = Lists.newArrayList();
for (TElement element : data) {
BspOccupation occupation = determineElementOccupation(boundary,element);
if (occupation.intersectsPositive()) {
positiveData.add(element);
}
if (occupation.intersectsNegative()) {
negativeData.add(element);
}
}
if ( positiveData.isEmpty() ) {
positiveData = null;
}
if ( negativeData.isEmpty() ) {
negativeData = null;
}
return new SplitData<ArrayList<TElement>>( negativeData,positiveData );
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。