List of usage examples for com.google.common.collect Multimap containsEntry
boolean containsEntry(@Nullable Object key, @Nullable Object value);
From source file:com.google.walkaround.wave.server.googleimport.ImportOverviewHandler.java
private List<ImportWaveletDisplayRecord> getWaves(CheckedTransaction tx, Multimap<Pair<SourceInstance, WaveletName>, ImportSharingMode> importsInProgress) throws RetryableFailure, PermanentFailure { ImmutableList.Builder<ImportWaveletDisplayRecord> out = ImmutableList.builder(); List<RemoteConvWavelet> wavelets = perUserTable.get().getAllWavelets(tx, userId); for (RemoteConvWavelet wavelet : wavelets) { WaveletName waveletName = WaveletName.of(WaveId.deserialise(wavelet.getDigest().getWaveId()), wavelet.getWaveletId()); out.add(new ImportWaveletDisplayRecord(wavelet.getSourceInstance(), waveletName, wavelet.getSourceInstance().getWaveLink(waveletName.waveId), // Let's assume that participant 0 is the creator even if that's not always true. // Participant lists can be empty. wavelet.getDigest().getParticipantSize() == 0 ? "<unknown>" : wavelet.getDigest().getParticipant(0), wavelet.getDigest().getTitle(), "" + new LocalDate(new Instant(wavelet.getDigest().getLastModifiedMillis())), importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.PRIVATE) || importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.PRIVATE_UNLESS_PARTICIPANT), wavelet.getPrivateLocalId() == null ? null : wavelet.getPrivateLocalId().getId(), wavelet.getPrivateLocalId() == null ? null : makeLocalWaveLink(wavelet.getPrivateLocalId()), importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.SHARED) || importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.PRIVATE_UNLESS_PARTICIPANT), wavelet.getSharedLocalId() == null ? null : wavelet.getSharedLocalId().getId(), wavelet.getSharedLocalId() == null ? null : makeLocalWaveLink(wavelet.getSharedLocalId()))); }/*from w ww . ja v a2 s.c o m*/ return out.build(); }
From source file:com.github.rinde.rinsim.central.arrays.ArraysSolverValidator.java
private static void validateCurrentSolutions(int v, int n, SolutionObject[] currentSolutions, int[] currentDestinations, Multimap<Integer, Integer> inventoriesMap, ImmutableBiMap<Integer, Integer> servicePairsMap) { checkArgument(currentSolutions.length == v, "The number of currentSolutions (%s) should equal the number of " + "vehicles (%s).", currentSolutions.length, v); for (int i = 0; i < currentSolutions.length; i++) { final List<Integer> route = ImmutableList.copyOf(Ints.asList(currentSolutions[i].route)); checkArgument(route.get(0) == 0, "First item in route should always be 0, it is %s.", route.get(0)); checkArgument(route.get(route.size() - 1) == n - 1, "Last item in route should always be depot (%s), it is %s.", n - 1, route.get(route.size() - 1)); if (currentDestinations[i] > 0) { // there is a current destination checkArgument(currentDestinations[i] == route.get(1), "The vehicle has a current destination (%s) but it is not the " + "first item in its route: %s.", currentDestinations[i], route); }// ww w .j av a2 s . c o m final Collection<Integer> inventory = inventoriesMap.get(i); checkArgument(ImmutableSet.copyOf(route).containsAll(inventory), "The route should contain all locations in its inventory. Vehicle " + "%s, route: %s, inventory: %s.", i, route, inventory); for (int j = 1; j < route.size() - 1; j++) { final Integer item = route.get(j); final int freq = Collections.frequency(route, item); checkArgument(freq == 1, "Vehicle %s: each location should occur only once, found %s " + "instances of location %s. Route: %s.", i, freq, item, route); if (!inventoriesMap.containsEntry(i, item)) { // not in cargo, so the pair should appear in the route if (servicePairsMap.containsKey(item)) { checkArgument(route.contains(servicePairsMap.get(item)), "Couldn't find %s in regular mapping.", item); } else { checkArgument(route.contains(servicePairsMap.inverse().get(item)), "Couldn't find %s in inverse mapping.", item); } } } } }
From source file:com.clarkparsia.sbol.editor.SBOLDesign.java
private Iterable<SequenceAnnotation> sortedAnnotations(List<SequenceAnnotation> annotations) { final Multimap<SequenceAnnotation, SequenceAnnotation> precedesTransitive = computePrecedesTransitive( annotations);//from ww w . j av a 2s . c om return new PartialOrder<SequenceAnnotation>(annotations, new PartialOrderComparator<SequenceAnnotation>() { @Override public PartialOrderRelation compare(SequenceAnnotation a, SequenceAnnotation b) { if (precedesTransitive.containsEntry(a, b)) { return PartialOrderRelation.LESS; } if (precedesTransitive.containsEntry(b, a)) { return PartialOrderRelation.GREATER; } if (a.getBioStart() != null && a.getBioEnd() != null && b.getBioStart() != null && b.getBioEnd() != null) { int cmpStart = Ints.compare(a.getBioStart(), b.getBioStart()); int cmpEnd = Ints.compare(a.getBioEnd(), b.getBioEnd()); if (cmpStart < 0) { return PartialOrderRelation.LESS; } else if (cmpStart > 0) { return PartialOrderRelation.GREATER; } else if (cmpEnd < 0) { return PartialOrderRelation.GREATER; } else if (cmpEnd > 0) { return PartialOrderRelation.LESS; } else { return PartialOrderRelation.EQUAL; } } return PartialOrderRelation.INCOMPARABLE; } }); }
From source file:org.apache.twill.yarn.YarnTwillRunnerService.java
/** * Creates a {@link Runnable} for renewing {@link SecureStore} for running applications. * * @param scheduler the schedule to schedule next renewal execution * @param renewer the {@link SecureStoreRenewer} to use for renewal * @param retryRuns if non-empty, only the given set of application name and run id that need to have * secure store renewed; if empty, renew all running applications * @param retryDelay the delay before retrying applications that are failed to have secure store renewed * @param timeUnit the unit for the {@code delay} and {@code failureDelay}. * @return a {@link Runnable}/*from ww w . jav a2s. c o m*/ */ private Runnable createSecureStoreUpdateRunnable(final ScheduledExecutorService scheduler, final SecureStoreRenewer renewer, final Multimap<String, RunId> retryRuns, final long retryDelay, final TimeUnit timeUnit) { return new Runnable() { @Override public void run() { // Collects the set of running application runs Table<String, RunId, YarnTwillController> liveApps; synchronized (YarnTwillRunnerService.this) { if (retryRuns.isEmpty()) { liveApps = HashBasedTable.create(controllers); } else { // If this is a renew retry, only renew the one in the retryRuns set liveApps = HashBasedTable.create(); for (Table.Cell<String, RunId, YarnTwillController> cell : controllers.cellSet()) { if (retryRuns.containsEntry(cell.getRowKey(), cell.getColumnKey())) { liveApps.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue()); } } } } Multimap<String, RunId> failureRenews = renewSecureStore(liveApps, renewer, false); if (!failureRenews.isEmpty()) { // If there are failure during the renewal, schedule a retry with a new Runnable. LOG.info("Schedule to retry on secure store renewal for applications {} in {} {}", failureRenews.keySet(), retryDelay, timeUnit.name().toLowerCase()); try { scheduler.schedule(createSecureStoreUpdateRunnable(scheduler, renewer, failureRenews, retryDelay, timeUnit), retryDelay, timeUnit); } catch (RejectedExecutionException e) { // If the renewal is stopped, the scheduler will be stopped, // hence this exception will be thrown and can be safely ignore. } } } }; }
From source file:io.redlink.sdk.impl.analysis.model.RDFStructureParser.java
private void setTopicAnnotationData(TopicAnnotation topicAnnotation, BindingSet result, RepositoryConnection conn, Multimap<Enhancement, String> relations) { if (!relations.containsKey(topicAnnotation)) { setEnhancementData(topicAnnotation, result); if (result.hasBinding("entityLabel")) { Binding entityLabel = result.getBinding("entityLabel"); topicAnnotation.setTopicLabel(entityLabel.getValue().stringValue()); if (!result.hasBinding("language") && (entityLabel.getValue() instanceof Literal)) topicAnnotation.setLanguage(((Literal) entityLabel.getValue()).getLanguage()); }/* ww w . j a v a 2 s. c o m*/ if (result.hasBinding("entityReference")) { topicAnnotation.setTopicReference(result.getBinding("entityReference").getValue().stringValue()); } if (result.hasBinding("relation")) { String nextRelationUri = result.getBinding("relation").getValue().stringValue(); relations.put(topicAnnotation, nextRelationUri); } if (result.hasBinding("site")) { topicAnnotation.setDataset(result.getBinding("site").getValue().stringValue()); } } else { if (result.hasBinding("relation")) { final String nextRelationUri = result.getBinding("relation").getValue().stringValue(); if (!relations.containsEntry(topicAnnotation, nextRelationUri)) relations.put(topicAnnotation, nextRelationUri); } } }
From source file:co.cask.cdap.internal.io.Schema.java
private boolean checkCompatible(Schema target, Multimap<String, String> recordCompared) { if (type.isSimpleType()) { if (type == target.getType()) { // Same simple type are always compatible return true; }// w w w .j ava 2s .c o m switch (target.getType()) { case LONG: return type == Type.INT; case FLOAT: return type == Type.INT || type == Type.LONG; case DOUBLE: return type == Type.INT || type == Type.LONG || type == Type.FLOAT; case STRING: return type != Type.NULL && type != Type.BYTES; case UNION: for (Schema targetSchema : target.unionSchemas) { if (checkCompatible(targetSchema, recordCompared)) { return true; } } } return false; } if (type == target.type) { switch (type) { case ENUM: return target.getEnumValues().containsAll(getEnumValues()); case ARRAY: // The component schema must be compatible return componentSchema.checkCompatible(target.getComponentSchema(), recordCompared); case MAP: // Both key and value schemas must be compatible return keySchema.checkCompatible(target.keySchema, recordCompared) && valueSchema.checkCompatible(target.valueSchema, recordCompared); case RECORD: // For every common field (by name), their schema must be compatible if (!recordCompared.containsEntry(recordName, target.recordName)) { recordCompared.put(recordName, target.recordName); for (Field field : fields) { Field targetField = target.getField(field.getName()); if (targetField == null) { continue; } if (!field.getSchema().checkCompatible(targetField.getSchema(), recordCompared)) { return false; } } } return true; case UNION: // Compare each source union to target union for (Schema sourceSchema : unionSchemas) { for (Schema targetSchema : target.unionSchemas) { if (sourceSchema.checkCompatible(targetSchema, recordCompared)) { return true; } } } return false; } } if (type == Type.UNION || target.type == Type.UNION) { List<Schema> unions = type == Type.UNION ? unionSchemas : target.unionSchemas; Schema checkSchema = type == Type.UNION ? target : this; for (Schema schema : unions) { if (schema.checkCompatible(checkSchema, recordCompared)) { return true; } } } return false; }
From source file:io.redlink.sdk.impl.analysis.model.RDFStructureParser.java
private void setEntityAnnotationData(EntityAnnotation entityAnnotation, BindingSet result, RepositoryConnection conn, Multimap<Enhancement, String> relations) throws RepositoryException, EnhancementParserException { if (!relations.containsKey(entityAnnotation)) { setEnhancementData(entityAnnotation, result); if (result.hasBinding("entityLabel")) { Binding entityLabel = result.getBinding("entityLabel"); entityAnnotation.setEntityLabel(entityLabel.getValue().stringValue()); if (!result.hasBinding("language") && (entityLabel.getValue() instanceof Literal)) entityAnnotation.setLanguage(((Literal) entityLabel.getValue()).getLanguage()); }/* w w w.j a va 2 s . c o m*/ if (result.hasBinding("site")) { entityAnnotation.setDataset(result.getBinding("site").getValue().stringValue()); } if (result.hasBinding("entityReference")) { entityAnnotation.setEntityReference( parseEntity(conn, result.getBinding("entityReference").getValue().stringValue(), entityAnnotation.getDataset())); } if (result.hasBinding("relation")) { String nextRelationUri = result.getBinding("relation").getValue().stringValue(); relations.put(entityAnnotation, nextRelationUri); } Collection<String> types = new HashSet<String>(); if (result.hasBinding("entityType")) { types.add(result.getBinding("entityType").getValue().stringValue()); } entityAnnotation.setEntityTypes(types); } else { if (result.hasBinding("relation")) { final String nextRelationUri = result.getBinding("relation").getValue().stringValue(); if (!relations.containsEntry(entityAnnotation, nextRelationUri)) relations.put(entityAnnotation, nextRelationUri); } if (result.hasBinding("entityType")) { final String entityType = result.getBinding("entityType").getValue().stringValue(); Collection<String> types = entityAnnotation.getEntityTypes(); Optional<String> eType = Iterables.tryFind(types, new Predicate<String>() { @Override public boolean apply(String arg0) { return arg0.equals(entityType); } }); if (!eType.isPresent()) types.add(entityType); } } }
From source file:org.sosy_lab.cpachecker.core.algorithm.precondition.PreconditionRefinerAlgorithm.java
private Pair<ARGPath, ARGPath> getTracesWithIntersectInAbstr(final ReachedSet pReachedSet, final CFANode pWpLoc, final Multimap<ARGPath, ARGPath> pCoveredPairs) throws NoTraceFoundException, SolverException, InterruptedException { Set<ARGState> violatingStates = getStatesAtLocation(pReachedSet, PreconditionHelper.IS_FROM_VIOLATING_PARTITION, pWpLoc); Set<ARGState> validStates = getStatesAtLocation(pReachedSet, PreconditionHelper.IS_FROM_VALID_PARTITION, pWpLoc);//from www. j a v a 2 s . co m // Get a pair of abstract states with an intersection in the abstraction for (ARGState violating : violatingStates) { PredicateAbstractState violatingAbstState = AbstractStates.extractStateByType(violating, PredicateAbstractState.class); for (ARGState valid : validStates) { PredicateAbstractState validAbstState = AbstractStates.extractStateByType(valid, PredicateAbstractState.class); Set<ARGPath> handledViolatingTraces = Sets.newHashSet(); Set<ARGPath> handledValidTraces = Sets.newHashSet(); // Some cases that have to be considered: // One trace to the ERROR location, more traces to the EXIT location if (!isDisjoint(violatingAbstState.getAbstractionFormula().asFormula(), validAbstState.getAbstractionFormula().asFormula())) { Optional<ARGPath> violatingTrace = Optional.absent(); Optional<ARGPath> validTrace = Optional.absent(); do { violatingTrace = ARGUtils.getOnePathTo(violating, handledViolatingTraces); if (!violatingTrace.isPresent()) { continue; } handledViolatingTraces.add(violatingTrace.get()); validTrace = ARGUtils.getOnePathTo(valid, pCoveredPairs.get(violatingTrace.get())); if (!validTrace.isPresent()) { continue; } handledValidTraces.add(validTrace.get()); if (!(pCoveredPairs.containsEntry(violatingTrace, validTrace))) { return Pair.of(violatingTrace.get(), validTrace.get()); } } while (violatingTrace.isPresent() && validTrace.isPresent()); } } } throw new NoTraceFoundException("No new pair of disjoint abstract traces found! " + "The choosen predicate abstraction method might be too imprecise!"); }
From source file:org.brooth.jeta.apt.processors.MetaInjectProcessor.java
private void buildInjectMethod(TypeSpec.Builder builder, RoundContext context, TypeElement masterElement, ClassName masterClassName, Boolean staticMeta, ArrayList<Element> unhandledElements) { MethodSpec.Builder methodBuilder;/* w w w . jav a 2s . c o m*/ if (staticMeta) { methodBuilder = MethodSpec.methodBuilder("injectStatic").addParameter(metaScopeTypeName, "scope", Modifier.FINAL); } else { methodBuilder = MethodSpec.methodBuilder("inject") .addParameter(metaScopeTypeName, "scope", Modifier.FINAL) .addParameter(masterClassName, "master", Modifier.FINAL); } methodBuilder.addAnnotation(Override.class).addModifiers(Modifier.PUBLIC).returns(void.class); Multimap<String, StatementSpec> statements = ArrayListMultimap.create(); for (TypeElement scopeElement : moduleScopes) { for (Element element : context.elements()) { if (element.getKind() == ElementKind.METHOD) { String methodStatement = null; if (staticMeta) { if (element.getModifiers().contains(Modifier.STATIC)) methodStatement = String.format("%1$s.%2$s", masterElement.getQualifiedName().toString(), element.getSimpleName().toString()); } else { if (!element.getModifiers().contains(Modifier.STATIC)) methodStatement = String.format("master.%1$s", element.getSimpleName().toString()); } if (methodStatement == null) continue; ExecutableElement methodElement = (ExecutableElement) element; List<? extends VariableElement> paramElements = methodElement.getParameters(); Multimap<String, StatementSpec> varStatements = HashMultimap.create(); for (VariableElement paramElement : paramElements) { StatementSpec statement = getResultStatement(scopeElement, paramElement.asType(), "", "getInstance()"); if (statement != null) { statement.element = paramElement; varStatements.put(statement.providerScopeStr, statement); } } if (!varStatements.isEmpty()) { for (String varScope : varStatements.keySet()) { Collection<StatementSpec> scopeVarStatements = varStatements.get(varScope); List<String> paramFormats = new ArrayList<>(paramElements.size()); List<Object> paramArgs = new ArrayList<>(paramElements.size()); for (final VariableElement paramElement : paramElements) { StatementSpec varStatement = Iterables.find(scopeVarStatements, new Predicate<StatementSpec>() { @Override public boolean apply(StatementSpec input) { return input.element == paramElement; } }, null); if (varStatement != null) { paramFormats.add(varStatement.format); paramArgs.addAll(Arrays.asList(varStatement.args)); } else { paramFormats.add("$L"); paramArgs.add("null"); } } StatementSpec methodStatementSpec = new StatementSpec(varScope, (methodStatement + '(' + Joiner.on(", ").join(paramFormats) + ')'), paramArgs.toArray(new Object[paramArgs.size()])); if (!statements.containsEntry(varScope, methodStatementSpec)) { statements.put(varScope, methodStatementSpec); unhandledElements.remove(element); } } } } else if (element.getKind() == ElementKind.FIELD) { String fieldStatement = null; if (staticMeta) { if (element.getModifiers().contains(Modifier.STATIC)) fieldStatement = String.format("%1$s.%2$s =\n", masterElement.getQualifiedName().toString(), element.getSimpleName().toString()); } else { if (!element.getModifiers().contains(Modifier.STATIC)) fieldStatement = String.format("master.%1$s = ", element.getSimpleName().toString()); } if (fieldStatement == null) continue; StatementSpec statement = getResultStatement(scopeElement, element.asType(), fieldStatement, "getInstance()"); if (statement != null) { statement.element = element; if (!statements.containsEntry(statement.providerScopeStr, statement)) { statements.put(statement.providerScopeStr, statement); unhandledElements.remove(element); } } } else { throw new ProcessingException("Unhandled injection element type " + element.getKind()); } } } if (!statements.isEmpty()) { List<String> scopes = new ArrayList<>(statements.keySet()); Collections.sort(scopes, new Comparator<String>() { @Override public int compare(String o1, String o2) { return isAssignableScope(o1, o2) ? 1 : -1; } }); for (String scopeElement : scopes) { ClassName scopeClassName = ClassName.bestGuess(scopeElement); ClassName scopeMetacodeClassName = ClassName.get(scopeClassName.packageName(), MetacodeUtils.toSimpleMetacodeName(scopeClassName.toString()), "MetaScopeImpl"); methodBuilder.beginControlFlow("if(scope.isAssignable($T.class))", scopeClassName) .addStatement("final $T s = ($T) scope", scopeMetacodeClassName, scopeMetacodeClassName); for (StatementSpec statement : statements.get(scopeElement)) methodBuilder.addStatement(statement.format, statement.args); methodBuilder.endControlFlow(); } } builder.addMethod(methodBuilder.build()); }
From source file:hu.bme.mit.incquery.querymetrics.QueryOnModelMetrics.java
/** * sajt query difficulty: ln(PROD<minden_felsorolhat_constraintre>(#illeszkedsek)) * korrekci: #illeszkedsek + 1 mindenhol * nevez csak akkor szerepel, ha relative == true * diszjunktv minta relative esetben tiltott, egybknt max body szmt * TODO filterRedundants minta + inference *///from w ww .j a v a2 s . c o m public static double calcGabenMetric(Pattern patt, IncQueryEngine engine, boolean relative, boolean filterRedundants) throws IncQueryException { final EList<PatternBody> bodies = patt.getBodies(); if (relative && bodies.size() > 1) throw new IllegalArgumentException(); double max = Double.MIN_VALUE; final NavigationHelper baseIndex = engine.getBaseIndex(); for (PatternBody patternBody : bodies) { double acc = 0.0; final Multimap<Variable, EClassifier> deferredClassifiers = HashMultimap.create(); final Multimap<Variable, EClassifier> inferredClassifiers = HashMultimap.create(); final EList<Constraint> constraints = patternBody.getConstraints(); for (Constraint constraint : constraints) { if (constraint instanceof PatternCompositionConstraint) { final PatternCompositionConstraint compo = (PatternCompositionConstraint) constraint; if (!compo.isNegative()) { final PatternCall call = compo.getCall(); final Pattern patternRef = call.getPatternRef(); if (!call.isTransitive()) { final int count = calcCountMatches(patternRef, engine); acc += Math.log(nonZero(count)); } else { throw new UnsupportedOperationException( "transitive closure estimate not supported yet"); } } } else if (constraint instanceof EClassifierConstraint) { final EClassifierConstraint classifierConstraint = (EClassifierConstraint) constraint; final Variable variable = classifierConstraint.getVar().getVariable(); final EntityType type = classifierConstraint.getType(); if (type instanceof ClassType) { final EClassifier classifier = ((ClassType) type).getClassname(); deferredClassifiers.put(variable, classifier); } else throw new UnsupportedOperationException("unknown entity type " + type.toString()); } else if (constraint instanceof PathExpressionConstraint) { final PathExpressionHead head = ((PathExpressionConstraint) constraint).getHead(); for (PathExpressionTail tail = head.getTail(); tail != null; tail = tail.getTail()) { final Type type = tail.getType(); if (type instanceof ReferenceType) { EStructuralFeature feature = ((ReferenceType) type).getRefname(); if (!baseIndex.isInWildcardMode()) baseIndex.registerEStructuralFeatures(Collections.singleton(feature)); int count = 0; final Collection<EObject> holders = baseIndex.getHoldersOfFeature(feature); for (EObject source : holders) { count += baseIndex.getFeatureTargets(source, feature).size(); } acc += Math.log(nonZero(count)); // inference if (tail == head.getTail()) { final Variable variable = head.getSrc().getVariable(); final EClass eContainingClass = feature.getEContainingClass(); inferredClassifiers.put(variable, eContainingClass); final EList<EClass> eAllSuperTypes = eContainingClass.getEAllSuperTypes(); for (EClass superType : eAllSuperTypes) { inferredClassifiers.put(variable, superType); } } if (tail.getTail() == null) { final ValueReference dst = head.getDst(); if (dst instanceof VariableReference) { final Variable variable = ((VariableReference) dst).getVariable(); final EClassifier eType = feature.getEType(); inferredClassifiers.put(variable, eType); if (eType instanceof EClass) for (EClass superType : ((EClass) eType).getEAllSuperTypes()) { inferredClassifiers.put(variable, superType); } } } } else throw new UnsupportedOperationException( "unknown path expression feature type: " + type.getClass().getSimpleName()); } } } for (Entry<Variable, EClassifier> entry : deferredClassifiers.entries()) { final Variable variable = entry.getKey(); final EClassifier classifier = entry.getValue(); if (filterRedundants && inferredClassifiers.containsEntry(variable, classifier)) continue; if (classifier instanceof EClass) { final EClass clazz = (EClass) classifier; if (!baseIndex.isInWildcardMode()) baseIndex.registerEClasses(Collections.singleton(clazz)); final int count = baseIndex.getAllInstances(clazz).size(); acc += Math.log(nonZero(count)); } else if (classifier instanceof EDataType) { final EDataType datatType = (EDataType) classifier; if (!baseIndex.isInWildcardMode()) baseIndex.registerEDataTypes(Collections.singleton(datatType)); final int count = baseIndex.getDataTypeInstances(datatType).size(); acc += Math.log(nonZero(count)); } else throw new UnsupportedOperationException( "unknown classifier type in ClassType: " + classifier.getClass().getSimpleName()); } if (max < acc) max = acc; } if (relative) { final int countMatches = calcCountMatches(patt, engine); double base = -Math.log(nonZero(countMatches)); return base + max; } else return max; }