/** * Returns true if this collector has errors. * * @return true if the collector has errors. */ public boolean hasErrors() { return ((throwables != null) && (!throwables.isEmpty())); } }
/** * 是否匹配成功 * * @return TRUE:匹配成功;FALSE:匹配失败; */ public boolean isMatched() { return !behaviorStructures.isEmpty(); }
/** * Caller must hold the rwLock. * * @return true if the queue contains objects */ boolean internalIsEmpty() { return this.idsAvailable.isEmpty(); }
private void findNextLowestFrequency() { while (lowestFrequency <= maxFrequency && frequencyList[lowestFrequency].isEmpty()) { lowestFrequency++; } if (lowestFrequency > maxFrequency) { lowestFrequency = 0; } }
@Override public boolean isEmpty() { return delegate.isEmpty(); }
/** * This method will throw if the list of throwables associated with this collector is not empty. * * @throws MultiException An exception with all the throwables found in this collector. */ public void throwIfErrors() throws MultiException { if (throwables == null || throwables.isEmpty()) { return; } throw new MultiException(new LinkedList<>(throwables)); }
@Override public String toString() { if (children.isEmpty()) { return ""; } StringBuilder buf = new StringBuilder(); for (Matcher m : children) { buf.append(m).append(" "); } buf.setLength(buf.length() - 1); return buf.toString(); }
private List collectRestoredListOfPatterns( List patterns, List originalPatterns, List originalInterpolatedPatterns ) { LinkedHashSet collectedPatterns = new LinkedHashSet(); collectedPatterns.addAll( originalPatterns ); for ( Iterator it = patterns.iterator(); it.hasNext(); ) { String pattern = (String) it.next(); if ( !originalInterpolatedPatterns.contains( pattern ) ) { collectedPatterns.add( pattern ); } } return collectedPatterns.isEmpty() ? Collections.EMPTY_LIST : new ArrayList( collectedPatterns ); }
public void forgetLastBug() { Data d = map.get(lastBug); if (d != null) { d.allSource.remove(lastSourceLine); if (d.allSource.isEmpty()) { map.remove(lastBug); hashes.remove(lastBug.getInstanceHash()); } } lastBug = null; lastSourceLine = null; }
private List<String> extractDependentImagesFor(Resolvable config) { LinkedHashSet<String> ret = new LinkedHashSet<>(config.getDependencies()); return ret.isEmpty() ? null : new ArrayList<>(ret); }
@Nullable public static VirtualFile getSDKSrcRoot(@NotNull Project project, @Nullable Module module) { LinkedHashSet<VirtualFile> sources = BallerinaSdkUtil.getSourcesPathsToLookup(project, module); if (sources.isEmpty()) { return null; } return ContainerUtil.getFirstItem(sources); }
private static ClassNode makeSelf(ClassNode trait) { ClassNode ret = trait; LinkedHashSet<ClassNode> selfTypes = new LinkedHashSet<ClassNode>(); Traits.collectSelfTypes(ret, selfTypes); if (!selfTypes.isEmpty()) { selfTypes.add(ret); ret = new UnionTypeClassNode(selfTypes.toArray(ClassNode.EMPTY_ARRAY)); } return ret; }
private void doEviction() { int currentlyDeleted = 0; float target = maxCacheSize * evictionFactor; while (currentlyDeleted < target) { LinkedHashSet<CacheNode<Key, Value>> nodes = frequencyList[lowestFrequency]; if (nodes.isEmpty()) { throw new IllegalStateException("Lowest frequency constraint violated!"); } else { Iterator<CacheNode<Key, Value>> it = nodes.iterator(); while (it.hasNext() && currentlyDeleted++ < target) { CacheNode<Key, Value> node = it.next(); it.remove(); cache.remove(node.k); } if (!it.hasNext()) { findNextLowestFrequency(); } } } }
/** * Remove the given value of the given attribute name. * * @param name the attribute name (must not be {@code null}) * @param value the value to remove (must not be {@code null}) * @return {@code true} if the value was present, or {@code false} otherwise */ public boolean removeAttributeValue(final String name, final AttributeValue value) { Assert.checkNotNullParam("name", name); Assert.checkNotNullParam("value", value); final LinkedHashSet<AttributeValue> set = attributes.get(name); if (set == null) { return false; } if (set.remove(value)) { if (set.isEmpty()) { attributes.remove(name, set); } return true; } return false; }
/** * Returns a new {@link JibContainerBuilder} using the parameters specified on the {@link * JavaContainerBuilder}. * * @return a new {@link JibContainerBuilder} using the parameters specified on the {@link * JavaContainerBuilder} */ public JibContainerBuilder toContainerBuilder() { if (mainClass == null) { throw new IllegalStateException( "mainClass is null on JavaContainerBuilder; specify the main class using " + "JavaContainerBuilder#setMainClass(String), or consider using a " + "jib.frontend.MainClassFinder to infer the main class"); } if (classpath.isEmpty()) { throw new IllegalStateException( "Failed to construct entrypoint because no files were added to the JavaContainerBuilder"); } jibContainerBuilder.setEntrypoint( JavaEntrypointConstructor.makeEntrypoint(new ArrayList<>(classpath), jvmFlags, mainClass)); jibContainerBuilder.setLayers(layerConfigurationsBuilder.build().getLayerConfigurations()); return jibContainerBuilder; }
/** * {@inheritDoc} */ public Entry<U> extendBy(MethodDescription methodDescription, Harmonizer<U> harmonizer) { Harmonized<U> key = this.key.extend(methodDescription.asDefined(), harmonizer); LinkedHashSet<MethodDescription> methodDescriptions = new LinkedHashSet<MethodDescription>(); TypeDescription declaringType = methodDescription.getDeclaringType().asErasure(); boolean bridge = methodDescription.isBridge(); Visibility visibility = this.visibility; for (MethodDescription extendedMethod : this.methodDescriptions) { if (extendedMethod.getDeclaringType().asErasure().equals(declaringType)) { if (extendedMethod.isBridge() ^ bridge) { methodDescriptions.add(bridge ? extendedMethod : methodDescription); } else { methodDescriptions.add(methodDescription); methodDescriptions.add(extendedMethod); } } visibility = visibility.expandTo(extendedMethod.getVisibility()); } if (methodDescriptions.isEmpty()) { return new Resolved<U>(key, methodDescription, visibility, bridge); } else if (methodDescriptions.size() == 1) { return new Resolved<U>(key, methodDescriptions.iterator().next(), visibility, Resolved.NOT_MADE_VISIBLE); } else { return new Ambiguous<U>(key, methodDescriptions, visibility); } }
@Override public MatchingResult matching(ClassStructure classStructure) { boolean isFirst = true; final MatchingResult result = new MatchingResult(); final LinkedHashSet<BehaviorStructure> found = new LinkedHashSet<BehaviorStructure>(); if (null == matcherArray) { return result; } for (final Matcher subMatcher : matcherArray) { final MatchingResult subResult = subMatcher.matching(classStructure); // 只要有一次匹配失败,剩下的是取交集运算,所以肯定也没戏,就不用花这个计算了 if (!subResult.isMatched()) { return result; } if (isFirst) { found.addAll(subResult.getBehaviorStructures()); isFirst = false; } else { found.retainAll(subResult.getBehaviorStructures()); } } if (!found.isEmpty()) { result.getBehaviorStructures().addAll(found); } return result; }
if (names.isEmpty()) { names.add(UniqueNameGenerator.generateUniqueName("i", usedNames));
@Test @TestForIssue( jiraKey = "HHH-10515" ) public void testNoJdbcMetadataDialectOverride() { final StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() .applySetting( "hibernate.temp.use_jdbc_metadata_defaults", "false" ) .applySetting( AvailableSettings.DIALECT, TestDialect.class.getName() ) .build(); JdbcEnvironment jdbcEnvironment = serviceRegistry.getService( JdbcEnvironment.class ); ExtractedDatabaseMetaData extractedDatabaseMetaData = jdbcEnvironment.getExtractedDatabaseMetaData(); assertNull( extractedDatabaseMetaData.getConnectionCatalogName() ); assertNull( extractedDatabaseMetaData.getConnectionSchemaName() ); assertTrue( extractedDatabaseMetaData.getTypeInfoSet().isEmpty() ); assertTrue( extractedDatabaseMetaData.getExtraKeywords().isEmpty() ); assertTrue( extractedDatabaseMetaData.supportsNamedParameters() ); assertFalse( extractedDatabaseMetaData.supportsRefCursors() ); assertFalse( extractedDatabaseMetaData.supportsScrollableResults() ); assertFalse( extractedDatabaseMetaData.supportsGetGeneratedKeys() ); assertFalse( extractedDatabaseMetaData.supportsBatchUpdates() ); assertFalse( extractedDatabaseMetaData.supportsDataDefinitionInTransaction() ); assertFalse( extractedDatabaseMetaData.doesDataDefinitionCauseTransactionCommit() ); assertNull( extractedDatabaseMetaData.getSqlStateType() ); assertFalse( extractedDatabaseMetaData.doesLobLocatorUpdateCopy() ); StandardServiceRegistryBuilder.destroy( serviceRegistry ); }
@Test @TestForIssue( jiraKey = "HHH-10515" ) public void testNoJdbcMetadataDefaultDialect() { final StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() .applySetting( "hibernate.temp.use_jdbc_metadata_defaults", "false" ) .build(); JdbcEnvironment jdbcEnvironment = serviceRegistry.getService( JdbcEnvironment.class ); ExtractedDatabaseMetaData extractedDatabaseMetaData = jdbcEnvironment.getExtractedDatabaseMetaData(); assertNull( extractedDatabaseMetaData.getConnectionCatalogName() ); assertNull( extractedDatabaseMetaData.getConnectionSchemaName() ); assertTrue( extractedDatabaseMetaData.getTypeInfoSet().isEmpty() ); assertTrue( extractedDatabaseMetaData.getExtraKeywords().isEmpty() ); assertFalse( extractedDatabaseMetaData.supportsNamedParameters() ); assertFalse( extractedDatabaseMetaData.supportsRefCursors() ); assertFalse( extractedDatabaseMetaData.supportsScrollableResults() ); assertFalse( extractedDatabaseMetaData.supportsGetGeneratedKeys() ); assertFalse( extractedDatabaseMetaData.supportsBatchUpdates() ); assertFalse( extractedDatabaseMetaData.supportsDataDefinitionInTransaction() ); assertFalse( extractedDatabaseMetaData.doesDataDefinitionCauseTransactionCommit() ); assertNull( extractedDatabaseMetaData.getSqlStateType() ); assertFalse( extractedDatabaseMetaData.doesLobLocatorUpdateCopy() ); StandardServiceRegistryBuilder.destroy( serviceRegistry ); }