use of com.google.common.base.Predicate in project selenium-tests by Wikia.
the class DeleteDialog method confirmAndWait.
public void confirmAndWait() {
super.clickConfirm();
new WebDriverWait(driver, DiscussionsConstants.TIMEOUT).until((Predicate<WebDriver>) input -> postList.stream().allMatch(p -> p.getAttribute("class").contains("is-deleted")));
}
use of com.google.common.base.Predicate in project core-java by SpineEventEngine.
the class Commands method wereAfter.
/**
* Creates a predicate for filtering commands created after the passed timestamp.
*/
public static Predicate<Command> wereAfter(final Timestamp from) {
checkNotNull(from);
return new Predicate<Command>() {
@Override
public boolean apply(@Nullable Command request) {
checkNotNull(request);
final Timestamp timestamp = getTimestamp(request);
return Timestamps2.isLaterThan(timestamp, from);
}
};
}
use of com.google.common.base.Predicate in project intellij-community by JetBrains.
the class RepositoryLibrarySupport method addSupport.
public void addSupport(@NotNull Module module, @NotNull final ModifiableRootModel rootModel, @NotNull ModifiableModelsProvider modifiableModelsProvider) {
LibraryTable.ModifiableModel modifiableModel = modifiableModelsProvider.getLibraryTableModifiableModel(module.getProject());
Library library = Iterables.find(Arrays.asList(modifiableModel.getLibraries()), new Predicate<Library>() {
@Override
public boolean apply(@Nullable Library library) {
return isLibraryEqualsToSelected(library);
}
}, null);
if (library == null) {
library = createNewLibrary(module, modifiableModel);
} else {
modifiableModelsProvider.disposeLibraryTableModifiableModel(modifiableModel);
}
final DependencyScope dependencyScope = LibraryDependencyScopeSuggester.getDefaultScope(library);
final ModifiableRootModel moduleModifiableModel = modifiableModelsProvider.getModuleModifiableModel(module);
LibraryOrderEntry foundEntry = (LibraryOrderEntry) Iterables.find(Arrays.asList(moduleModifiableModel.getOrderEntries()), new Predicate<OrderEntry>() {
@Override
public boolean apply(@Nullable OrderEntry entry) {
return entry instanceof LibraryOrderEntry && ((LibraryOrderEntry) entry).getScope() == dependencyScope && isLibraryEqualsToSelected(((LibraryOrderEntry) entry).getLibrary());
}
}, null);
modifiableModelsProvider.disposeModuleModifiableModel(moduleModifiableModel);
if (foundEntry == null) {
rootModel.addLibraryEntry(library).setScope(dependencyScope);
}
}
use of com.google.common.base.Predicate in project libresonic by Libresonic.
the class ITunesParser method parsePlaylists.
private List<ITunesPlaylist> parsePlaylists() throws Exception {
List<ITunesPlaylist> playlists = new ArrayList<ITunesPlaylist>();
InputStream in = new FileInputStream(iTunesXml);
try {
ITunesPlaylist playlist = null;
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(in);
while (streamReader.hasNext()) {
int code = streamReader.next();
if (code == XMLStreamReader.START_ELEMENT) {
String key = readKey(streamReader);
if ("Playlist ID".equals(key)) {
playlist = new ITunesPlaylist(readNextTag(streamReader));
playlists.add(playlist);
}
if (playlist != null) {
if ("Name".equals(key)) {
playlist.name = readNextTag(streamReader);
} else if ("Smart Info".equals(key)) {
playlist.smart = true;
} else if ("Visible".equals(key)) {
playlist.visible = false;
} else if ("Distinguished Kind".equals(key)) {
playlist.distinguishedKind = readNextTag(streamReader);
} else if ("Track ID".equals(key)) {
playlist.trackIds.add(readNextTag(streamReader));
}
}
}
}
} finally {
IOUtils.closeQuietly(in);
}
return Lists.newArrayList(Iterables.filter(playlists, new Predicate<ITunesPlaylist>() {
@Override
public boolean apply(ITunesPlaylist input) {
return input.isIncluded();
}
}));
}
use of com.google.common.base.Predicate in project aic-expresso by aic-sri-international.
the class Compilation method compile.
/**
* Compiles an expression to a normalized (decision-tree-like) expression.
* @param inputExpression
* @param mapFromVariableNameToTypeName
* @param mapFromCategoricalTypeNameToSizeString
* @param additionalTypes
* @param solverListener if not null, invoked on solver used for compilation, before and after compilation starts; returned solver on 'before' invocation is used (it may be the same one used as argument, of course).
* @return
*/
public static Expression compile(Expression inputExpression, Theory theory, Map<String, String> mapFromVariableNameToTypeName, Map<String, String> mapFromUniquelyNamedConstantToTypeName, Map<String, String> mapFromCategoricalTypeNameToSizeString, Collection<Type> additionalTypes, Function<MultiIndexQuantifierEliminator, MultiIndexQuantifierEliminator> solverListener) {
// the group actually does not matter, because we are not going to have any indices.
AssociativeCommutativeGroup group = new Max();
// The solver for the parameters above.
MultiIndexQuantifierEliminator solver = new SGDPLLT();
if (solverListener != null) {
solver = solverListener.apply(solver);
}
// We use the Prolog convention of small-letter initials for constants, but we need an exception for the random variables.
Predicate<Expression> isPrologConstant = new PrologConstantPredicate();
Predicate<Expression> isUniquelyNamedConstantPredicate = e -> isPrologConstant.apply(e) && !mapFromVariableNameToTypeName.containsKey(e);
Map<String, String> mapFromSymbolNameToTypeName = new LinkedHashMap<>(mapFromVariableNameToTypeName);
mapFromSymbolNameToTypeName.putAll(mapFromUniquelyNamedConstantToTypeName);
// Solve the problem.
// no indices; we want to keep all variables
List<Expression> indices = Util.list();
Expression result = solver.solve(group, inputExpression, indices, mapFromSymbolNameToTypeName, mapFromCategoricalTypeNameToSizeString, additionalTypes, isUniquelyNamedConstantPredicate, theory);
if (solverListener != null) {
solverListener.apply(null);
}
return result;
}
Aggregations