java.util.Map#isEmpty ( )源码实例Demo

下面列出了java.util.Map#isEmpty ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dubbox   文件: InjvmProtocol.java
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) {
    Exporter<?> result = null;

    if (!key.getServiceKey().contains("*")) {
        result = map.get(key.getServiceKey());
    } else {
        if (map != null && !map.isEmpty()) {
            for (Exporter<?> exporter : map.values()) {
                if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) {
                    result = exporter;
                    break;
                }
            }
        }
    }

    if (result == null) {
        return null;
    } else if (ProtocolUtils.isGeneric(
        result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) {
        return null;
    } else {
        return result;
    }
}
 
源代码2 项目: disconf   文件: SpringRegistry.java
@Override
public <T> List<T> findByType(Class<T> type, boolean newInstance) {

    if (applicationContext == null) {
        LOGGER.error("Spring Context is null. Cannot autowire " + type.getCanonicalName());
        return new ArrayList<T>(0);
    }

    if (type == null) {
        return new ArrayList<T>(0);
    }

    Map<String, T> map = findByTypeWithName(type);
    if (map == null || map.isEmpty()) {
        if (newInstance) {
            LOGGER.debug("Not found from Spring IoC container for " + type.getSimpleName() + ", and try to init by "
                    + "calling newInstance.");
            return simpleRegistry.findByType(type, newInstance);
        }
    }

    return new ArrayList<T>(map.values());
}
 
源代码3 项目: Knowage-Server   文件: LovResultCacheManager.java
/**
 * This method finds out the cache to be used for lov's result cache. This key is composed mainly by the user identifier and the lov definition. Note that,
 * in case when the lov is a query and there is correlation, the executed statement if different from the original query (since correlation expression is
 * injected inside SQL query using in-line view construct), therefore we should consider the modified query.
 *
 * @param profile
 *            The user profile
 * @param lovDefinition
 *            The lov original definition
 * @param dependencies
 *            The dependencies to be considered (if any)
 * @param executionInstance
 *            The execution instance (it may be null, since a lov can be executed outside an execution instance context)
 * @return The key to be used in cache
 */
private String getCacheKey(IEngUserProfile profile, ILovDetail lovDefinition, List<ObjParuse> dependencies, ExecutionInstance executionInstance)
		throws Exception {
	logger.debug("IN");
	String toReturn = null;
	String userID = (String) ((UserProfile) profile).getUserId();
	if (lovDefinition instanceof QueryDetail) {
		QueryDetail queryDetail = (QueryDetail) lovDefinition;
		QueryDetail clone = queryDetail.clone();
		// clone.setQueryDefinition(queryDetail.getWrappedStatement(dependencies, executionInstance.getBIObject().getDrivers()));
		Map<String, String> parameters = queryDetail.getParametersNameToValueMap(executionInstance.getBIObject().getDrivers());
		String statement = queryDetail.getWrappedStatement(dependencies, executionInstance.getBIObject().getDrivers());
		statement = StringUtilities.substituteProfileAttributesInString(statement, profile);
		if (parameters != null && !parameters.isEmpty()) {
			Map<String, String> types = queryDetail.getParametersNameToTypeMap(executionInstance.getBIObject().getDrivers());
			statement = StringUtilities.substituteParametersInString(statement, parameters, types, false);
		}
		clone.setQueryDefinition(statement);
		toReturn = userID + ";" + clone.toXML();
	} else {
		toReturn = userID + ";" + lovDefinition.toXML();
	}
	logger.debug("OUT: returning [" + toReturn + "]");
	return toReturn;
}
 
源代码4 项目: scipio-erp   文件: ContactMechPurposeInfo.java
/**
 * Gets the values that have occurrences closest to given target count.
 * Above the count is always preferred to below the count, but exact is preferred to above.
 * TODO: VERIFY this works.
 */
static Set<String> getClosestValuesByCount(Map<String, Integer> counts, int targetCount) {
    Map<Integer, Set<String>> countMechs = makeCountValueMap(counts);
    if (countMechs.isEmpty()) {
        return Collections.emptySet();
    }
    List<Integer> highToLowCounts = new ArrayList<>(countMechs.keySet());
    Collections.sort(highToLowCounts, Collections.reverseOrder());

    ListIterator<Integer> it = highToLowCounts.listIterator();
    int count = it.next();
    while(it.hasNext() && (count = it.next()) >= targetCount) {
        ;
    }
    if (count >= targetCount) {
        return countMechs.get(count);
    } else {
        it.previous(); // discard to go back one
        if (it.hasPrevious()) {
            return countMechs.get(it.previous());
        } else {
            return countMechs.get(count);
        }
    }
}
 
源代码5 项目: JglTF   文件: Technique.java
/**
 * Remove the given attributes. The attributes of this instance will be 
 * replaced with a map that contains all previous mappings, except for 
 * the one with the given key.<br> 
 * If this new map would be empty, then it will be set to 
 * <code>null</code>. 
 * 
 * @param key The key
 * @throws NullPointerException If the given key is <code>null</code>
 * 
 */
public void removeAttributes(String key) {
    if (key == null) {
        throw new NullPointerException("The key may not be null");
    }
    Map<String, String> oldMap = this.attributes;
    Map<String, String> newMap = new LinkedHashMap<String, String>();
    if (oldMap!= null) {
        newMap.putAll(oldMap);
    }
    newMap.remove(key);
    if (newMap.isEmpty()) {
        this.attributes = null;
    } else {
        this.attributes = newMap;
    }
}
 
源代码6 项目: bazel   文件: PostAnalysisQueryEnvironment.java
@Override
public Collection<T> getReverseDeps(Iterable<T> targets, QueryExpressionContext<T> context)
    throws InterruptedException {
  Map<SkyKey, T> targetsByKey = Maps.newHashMapWithExpectedSize(Iterables.size(targets));
  for (T target : targets) {
    targetsByKey.put(getSkyKey(target), target);
  }
  Map<SkyKey, ImmutableList<ClassifiedDependency<T>>> reverseDepsByKey =
      targetifyValues(targetsByKey, graph.getReverseDeps(targetsByKey.keySet()));
  if (targetsByKey.size() != reverseDepsByKey.size()) {
    Iterable<ConfiguredTargetKey> missingTargets =
        Sets.difference(targetsByKey.keySet(), reverseDepsByKey.keySet()).stream()
            .map(SKYKEY_TO_CTKEY)
            .collect(Collectors.toList());
    eventHandler.handle(Event.warn("Targets were missing from graph: " + missingTargets));
  }
  Map<T, ImmutableList<ClassifiedDependency<T>>> reverseDepsByCT = new HashMap<>();
  for (Map.Entry<SkyKey, ImmutableList<ClassifiedDependency<T>>> entry :
      reverseDepsByKey.entrySet()) {
    reverseDepsByCT.put(targetsByKey.get(entry.getKey()), entry.getValue());
  }
  return reverseDepsByCT.isEmpty() ? Collections.emptyList() : filterReverseDeps(reverseDepsByCT);
}
 
源代码7 项目: lucene-solr   文件: OpenNLPChunkerFilterFactory.java
public OpenNLPChunkerFilterFactory(Map<String,String> args) {
  super(args);
  chunkerModelFile = get(args, CHUNKER_MODEL);
  if (!args.isEmpty()) {
    throw new IllegalArgumentException("Unknown parameters: " + args);
  }
}
 
源代码8 项目: dubbox   文件: RegistryProtocol.java
private static String[] getFilteredKeys(URL url) {
    Map<String, String> params = url.getParameters();
    if (params != null && !params.isEmpty()) {
        List<String> filteredKeys = new ArrayList<String>();
        for (Map.Entry<String, String> entry : params.entrySet()) {
            if (entry != null && entry.getKey() != null && entry.getKey().startsWith(Constants.HIDE_KEY_PREFIX)) {
                filteredKeys.add(entry.getKey());
            }
        }
        return filteredKeys.toArray(new String[filteredKeys.size()]);
    } else {
        return new String[] {};
    }
}
 
源代码9 项目: Openfire   文件: ProfiledConnection.java
/**
 * Returns an array of sorted queries (as ProfiledConnectionEntry objects) by type
 *
 * @param type       the type of query to check
 * @param sortByTime sort the resulting list by Time if true,
 *                   otherwise sort by count if false (default)
 * @return an array of ProfiledConnectionEntry objects
 */
public static ProfiledConnectionEntry[] getSortedQueries(Type type, boolean sortByTime) {
    Map<String, ProfiledConnectionEntry> queries;

    switch (type) {
        case select:
            queries = selectQueries;
            break;
        case update:
            queries = updateQueries;
            break;
        case insert:
            queries = insertQueries;
            break;
        case delete:
            queries = deleteQueries;
            break;
        default:
            throw new IllegalArgumentException("Invalid type");
    }

    // No queries, return null
    if (queries.isEmpty()) {
        return null;
    }

    ProfiledConnectionEntry [] result = queries.values().toArray(
            new ProfiledConnectionEntry[queries.size()]);

    quickSort(result, sortByTime, 0, result.length - 1);
    return result;
}
 
private void validateErrorEventData(Map<String, Object> edata, List<String> missingFields) {
  if (edata == null || edata.isEmpty()) {
    missingFields.add("edata");
  } else {
    if (StringUtils.isBlank((String) edata.get(JsonKey.ERROR))) {
      missingFields.add(JsonKey.ERROR);
    }
    if (StringUtils.isBlank((String) edata.get(JsonKey.ERR_TYPE))) {
      missingFields.add(JsonKey.ERR_TYPE);
    }
    if (StringUtils.isBlank((String) edata.get(JsonKey.STACKTRACE))) {
      missingFields.add(JsonKey.STACKTRACE);
    }
  }
}
 
源代码11 项目: timely   文件: TagListParser.java
/**
 * An alternative combiner for a map of string to string instead of a list of
 * tags
 * 
 * @return string representation
 */
public String combine(Map<String, String> tags) {
    StringBuilder builder = new StringBuilder();
    if (!tags.isEmpty()) {
        tags.forEach((k, v) -> builder.append(tagParser.combine(new Tag(k, v))).append(','));
        builder.setLength(builder.length() - 1);
    }
    return builder.toString();
}
 
源代码12 项目: bjnetwork   文件: BJNetRequestManager.java
/**
 * 构建网络请求
 *
 * @param method
 * @param requestBody
 * @param url
 * @param cacheTimeSeconds
 * @param headers
 * @return
 */
protected Request buildRequest(HttpMethod method, RequestBody requestBody, String url, int cacheTimeSeconds,
    Map<String, String> headers) {

    if (TextUtils.isEmpty(url))
        throw new IllegalArgumentException("url is empty!!");

    Request.Builder builder = new Request.Builder();
    builder.method(method.getMethod(), requestBody);
    builder.url(url);
    if (cacheTimeSeconds > 0) {
        CacheControl cacheControl = new CacheControl.Builder()
                .maxAge(cacheTimeSeconds, TimeUnit.SECONDS)
                .build();
        builder.cacheControl(cacheControl);
    }

    if (headers != null && !headers.isEmpty()) {
        Iterator<String> iterator = headers.keySet().iterator();
        while (iterator.hasNext()) {
            String key = iterator.next();
            String value = headers.get(key);
            builder.addHeader(key, value);
        }
    }

    // 增加一个 tag 对象, 用于和 callback 建立标识.
    builder.tag(new Object());

    return builder.build();
}
 
源代码13 项目: connect-utils   文件: GenericAssertions.java
private void writeEntries(BufferedWriter writer, String header, Map<?, ?> entries) throws IOException {
  if (!entries.isEmpty()) {
    writer.append(header);
    writer.newLine();

    for (Map.Entry<?, ?> kvp : entries.entrySet()) {
      writer.append("  ");
      writer.append(kvp.getKey().toString());
      writer.append(": ");
      writer.append(kvp.getValue().toString());
      writer.newLine();
    }
    writer.newLine();
  }
}
 
源代码14 项目: ranger   文件: TestJSONUtil.java
@Test
public void testJsonToMapIsEmpty() {
	String jsonStr = "";
	Map<String, String> dbMap = jsonUtil.jsonToMap(jsonStr);
	boolean isEmpty = dbMap.isEmpty();
	Assert.assertTrue(isEmpty);
}
 
源代码15 项目: Knowage-Server   文件: DataSetResource.java
@GET
@Path("/mydatanoparams")
@Produces(MediaType.APPLICATION_JSON)
@UserConstraint(functionalities = { SpagoBIConstants.SELF_SERVICE_DATASET_MANAGEMENT })
public String getMyDataDataSetWithoutParameters(@QueryParam("typeDoc") String typeDoc) {
	logger.debug("IN");
	try {
		List<IDataSet> dataSets;
		List<IDataSet> dataSetsNoParams = new ArrayList<IDataSet>(0);
		if (UserUtilities.isAdministrator(getUserProfile())) {
			dataSets = getDatasetManagementAPI().getAllDataSet();
		} else {
			dataSets = getDatasetManagementAPI().getMyDataDataSet();
		}

		if (dataSets != null) {
			for (Iterator iterator = dataSets.iterator(); iterator.hasNext();) {
				IDataSet iDataSet = (IDataSet) iterator.next();
				Map params = iDataSet.getParamsMap();
				if (params == null || params.isEmpty()) {
					dataSetsNoParams.add(iDataSet);
				}
			}
		}

		return serializeDataSets(dataSetsNoParams, typeDoc);
	} catch (Throwable t) {
		throw new SpagoBIServiceException(this.request.getPathInfo(), "An unexpected error occured while executing service", t);
	} finally {
		logger.debug("OUT");
	}
}
 
源代码16 项目: rpi   文件: AliyunWebUtils.java
public static String buildQuery(Map<String, String> params, String charset) throws IOException {
    if (params == null || params.isEmpty()) {
        return null;
    }

    StringBuilder query = new StringBuilder();
    Set<Entry<String, String>> entries = params.entrySet();
    boolean hasParam = false;

    for (Entry<String, String> entry : entries) {
        String name = entry.getKey();
        String value = entry.getValue();
        // 忽略参数名或参数值为空的参数
        if (name == null || value == null || name.trim().length() == 0
            || value.trim().length() == 0) {
            continue;
        }
        if (hasParam) {
            query.append("&");
        } else {
            hasParam = true;
        }

        query.append(name).append("=").append(URLEncoder.encode(value, charset));
    }

    return query.toString();
}
 
@ApiOperation(value = "Create new variables on a task", tags = { "Tasks", "Task Variables" },
        notes = "This endpoint can be used in 2 ways: By passing a JSON Body (RestVariable or an Array of RestVariable) or by passing a multipart/form-data Object.\n"
                + "It is possible to create simple (non-binary) variable or list of variables or new binary variable \n"
                + "Any number of variables can be passed into the request body array.\n"
                + "NB: Swagger V2 specification does not support this use case that is why this endpoint might be buggy/incomplete if used with other tools.")
@ApiImplicitParams({
        @ApiImplicitParam(name = "body", type = "org.flowable.rest.service.api.engine.variable.RestVariable", value = "Create a variable on a task", paramType = "body", example = "{\n" +
                "    \"name\":\"intProcVar\"\n" +
                "    \"type\":\"integer\"\n" +
                "    \"value\":123,\n" +
                " }"),
        @ApiImplicitParam(name = "name", value = "Required name of the variable", dataType = "string", paramType = "form", example = "Simple content item"),
        @ApiImplicitParam(name = "type", value = "Type of variable that is created. If omitted, reverts to raw JSON-value type (string, boolean, integer or double)",dataType = "string", paramType = "form", example = "integer"),
        @ApiImplicitParam(name = "scope",value = "Scope of variable that is created. If omitted, local is assumed.", dataType = "string",  paramType = "form", example = "local")
})
@ApiResponses(value = {
        @ApiResponse(code = 201, message = "Indicates the variables were created and the result is returned."),
        @ApiResponse(code = 400, message = "Indicates the name of a variable to create was missing or that an attempt is done to create a variable on a standalone task (without a process associated) with scope global or an empty array of variables was included in the request or request did not contain an array of variables. Status message provides additional information."),
        @ApiResponse(code = 404, message = "Indicates the requested task was not found."),
        @ApiResponse(code = 409, message = "Indicates the task already has a variable with the given name. Use the PUT method to update the task variable instead."),
        @ApiResponse(code = 415, message = "Indicates the serializable data contains an object for which no class is present in the JVM running the Flowable engine and therefore cannot be deserialized.")
})
@PostMapping(value = "/runtime/tasks/{taskId}/variables", produces = "application/json", consumes = {"application/json", "multipart/form-data"})
public Object createTaskVariable(@ApiParam(name = "taskId") @PathVariable String taskId, HttpServletRequest request, HttpServletResponse response) {

    Task task = getTaskFromRequest(taskId);

    Object result = null;
    if (request instanceof MultipartHttpServletRequest) {
        result = setBinaryVariable((MultipartHttpServletRequest) request, task, true);
    } else {

        List<RestVariable> inputVariables = new ArrayList<>();
        List<RestVariable> resultVariables = new ArrayList<>();
        result = resultVariables;

        try {
            @SuppressWarnings("unchecked")
            List<Object> variableObjects = (List<Object>) objectMapper.readValue(request.getInputStream(), List.class);
            for (Object restObject : variableObjects) {
                RestVariable restVariable = objectMapper.convertValue(restObject, RestVariable.class);
                inputVariables.add(restVariable);
            }
        } catch (Exception e) {
            throw new FlowableIllegalArgumentException("Failed to serialize to a RestVariable instance", e);
        }

        if (inputVariables == null || inputVariables.size() == 0) {
            throw new FlowableIllegalArgumentException("Request did not contain a list of variables to create.");
        }

        RestVariableScope sharedScope = null;
        RestVariableScope varScope = null;
        Map<String, Object> variablesToSet = new HashMap<>();

        for (RestVariable var : inputVariables) {
            // Validate if scopes match
            varScope = var.getVariableScope();
            if (var.getName() == null) {
                throw new FlowableIllegalArgumentException("Variable name is required");
            }

            if (varScope == null) {
                varScope = RestVariableScope.LOCAL;
            }
            if (sharedScope == null) {
                sharedScope = varScope;
            }
            if (varScope != sharedScope) {
                throw new FlowableIllegalArgumentException("Only allowed to update multiple variables in the same scope.");
            }

            if (hasVariableOnScope(task, var.getName(), varScope)) {
                throw new FlowableConflictException("Variable '" + var.getName() + "' is already present on task '" + task.getId() + "'.");
            }

            Object actualVariableValue = restResponseFactory.getVariableValue(var);
            variablesToSet.put(var.getName(), actualVariableValue);
            resultVariables.add(restResponseFactory.createRestVariable(var.getName(), actualVariableValue, varScope, task.getId(), RestResponseFactory.VARIABLE_TASK, false));
        }

        if (!variablesToSet.isEmpty()) {
            if (sharedScope == RestVariableScope.LOCAL) {
                taskService.setVariablesLocal(task.getId(), variablesToSet);
            } else {
                if (task.getExecutionId() != null) {
                    // Explicitly set on execution, setting non-local
                    // variables on task will override local-variables if
                    // exists
                    runtimeService.setVariables(task.getExecutionId(), variablesToSet);
                } else {
                    // Standalone task, no global variables possible
                    throw new FlowableIllegalArgumentException("Cannot set global variables on task '" + task.getId() + "', task is not part of process.");
                }
            }
        }
    }

    response.setStatus(HttpStatus.CREATED.value());
    return result;
}
 
源代码18 项目: database   文件: AST2BOpFilters.java
/**
 * The RTO requires that we do not reorder solutions. This means that it
 * must use an un-conditional approach to variable materialization for
 * constraints with SOMETIMES materialization requirements. This has two
 * practical impacts:
 * <p>
 * 1. We can not attach a filter with SOMETIMES requirements to a JOIN and
 * wrap it with a {@link TryBeforeMaterializationConstraint} since this
 * requires a {@link ConditionalRoutingOp} with an altSink and that will
 * reorder solutions.
 * <p>
 * 2. We can not use a pattern which involves an {@link InlineMaterializeOp}
 * followed by a {@link ConditionalRoutingOp} with an altSink followed by a
 * {@link PipelineJoin} against the lexicon. This also reorders the
 * solutions (primarily because of the {@link ConditionalRoutingOp} since we
 * can force the {@link PipelineJoin} to not reorder solutions).
 * <p>
 * The code below uses the {@link ChunkedMaterializationOp}. This does not
 * reorder the solutions. It can also materialize inline IVs giving us a
 * single operator that prepare the solutions for filter evaluation.
 */
@SuppressWarnings("rawtypes")
protected static PipelineOp addNonConditionalMaterializationSteps(//
        PipelineOp left,//
        final Set<IVariable<?>> doneSet,//
        final Map<IConstraint, Set<IVariable<IV>>> needsMaterialization,
        final Long cutoffLimit,//
        final Properties queryHints,//
        final AST2BOpContext ctx//
        ) {
    
    if (needsMaterialization.isEmpty()) {
     
        // No filters.
        return left;
        
    }

    // Collect variables that require materialization.
    final Set<IVariable<IV>> matvars = new LinkedHashSet<IVariable<IV>>();

    for (Map.Entry<IConstraint, Set<IVariable<IV>>> e : needsMaterialization
            .entrySet()) {

        matvars.addAll(e.getValue());

    }

    if (!matvars.isEmpty()) {

        // Materialize those variables.
        left = addChunkedMaterializationStep(left, matvars,
                true/* materializeInlineIVs */, cutoffLimit, queryHints,
                ctx);

        // Add them to the doneSet.
        doneSet.addAll(matvars);

    }

    // Attach all constraints.
    for(IConstraint c : needsMaterialization.keySet()) {
    
        /*
         * Note: While this is using a ConditionalRoutingOp, it is NOT
         * use the altSink. All solutions flow through the default sink.
         * This use does not cause the solutions to be reordered.
         * Parallel evaluation is also disabled.
         */

        left = applyQueryHints(//
            new ConditionalRoutingOp(leftOrEmpty(left),//
                new NV(BOp.Annotations.BOP_ID, ctx.nextId()),//
                new NV(PipelineOp.Annotations.MAX_PARALLEL, 1),//
                // disallow reordering of solutions by the query engine.
                new NV(PipelineJoin.Annotations.REORDER_SOLUTIONS, Boolean.FALSE),//
                new NV(ConditionalRoutingOp.Annotations.CONDITION, c)//
            ), queryHints, ctx);
    
    }
    
    return left;

}
 
源代码19 项目: metanome-algorithms   文件: BINDER.java
private Map<AttributeCombination, List<AttributeCombination>> generateNPlusOneAryCandidates(Map<AttributeCombination, List<AttributeCombination>> naryDep2ref) {
		Map<AttributeCombination, List<AttributeCombination>> nPlusOneAryDep2ref = new HashMap<AttributeCombination, List<AttributeCombination>>();
		
		if ((naryDep2ref == null) || (naryDep2ref.isEmpty()))
			return nPlusOneAryDep2ref;
		
		int previousSize = naryDep2ref.keySet().iterator().next().size();
		
//if (previousSize >= 3)
//	return nPlusOneAryDep2ref;
//System.out.println("apriori-gen level: " + (previousSize + 1));
		
		List<AttributeCombination> deps = new ArrayList<>(naryDep2ref.keySet());
		for (int i = 0; i < deps.size() - 1; i++) {
			AttributeCombination depPivot = deps.get(i);
			for (int j = i + 1; j < deps.size(); j++) { // if INDs of the form AA<CD should be discovered as well, remove + 1
				AttributeCombination depExtension = deps.get(j);
				
				// Ensure same tables
				if (depPivot.getTable() != depExtension.getTable())
					continue;
				
				// Ensure same prefix
				if (!this.samePrefix(depPivot, depExtension))
					continue;
				
				int depPivotAttr = depPivot.getAttributes()[previousSize - 1];
				int depExtensionAttr = depExtension.getAttributes()[previousSize - 1];
				
				// Ensure non-empty attribute extension
				if ((previousSize == 1) && ((this.columnSizes.getLong(depPivotAttr) == 0) || (this.columnSizes.getLong(depExtensionAttr) == 0)))
					continue;
				
				for (AttributeCombination refPivot : naryDep2ref.get(depPivot)) {
					for (AttributeCombination refExtension : naryDep2ref.get(depExtension)) {
						
						// Ensure same tables
						if (refPivot.getTable() != refExtension.getTable())
							continue;
						
						// Ensure same prefix
						if (!this.samePrefix(refPivot, refExtension))
							continue;
						
						int refPivotAttr = refPivot.getAttributes()[previousSize - 1];
						int refExtensionAttr = refExtension.getAttributes()[previousSize - 1];
						
						// Ensure that the extension attribute is different from the pivot attribute; remove check if INDs of the form AB<CC should be discovered as well
						if (refPivotAttr == refExtensionAttr)
							continue;
						
						// We want the lhs and rhs to be disjunct, because INDs with non-disjunct sides usually don't have practical relevance; remove this check if INDs with overlapping sides are of interest
						if ((depPivotAttr == refExtensionAttr) || (depExtensionAttr == refPivotAttr))
							continue;
						//if (nPlusOneDep.contains(nPlusOneRef.getAttributes()[previousSize - 1]) ||
						//	nPlusOneRef.contains(nPlusOneDep.getAttributes()[previousSize - 1]))
						//	continue;
						
						// The new candidate was created with two lhs and their rhs that share the same prefix; but other subsets of the lhs and rhs must also exist if the new candidate is larger than two attributes
						// TODO: Test if the other subsets exist as well (because this test is expensive, same prefix of two INDs might be a strong enough filter for now)

						// Merge the dep attributes and ref attributes, respectively
						AttributeCombination nPlusOneDep = new AttributeCombination(depPivot.getTable(), depPivot.getAttributes(), depExtensionAttr);
						AttributeCombination nPlusOneRef = new AttributeCombination(refPivot.getTable(), refPivot.getAttributes(), refExtensionAttr);
						
						// Store the new candidate
						if (!nPlusOneAryDep2ref.containsKey(nPlusOneDep))
							nPlusOneAryDep2ref.put(nPlusOneDep, new LinkedList<AttributeCombination>());
						nPlusOneAryDep2ref.get(nPlusOneDep).add(nPlusOneRef);
						
//System.out.println(CollectionUtils.concat(nPlusOneDep.getAttributes(), ",") + "c" + CollectionUtils.concat(nPlusOneRef.getAttributes(), ","));
					}
				}
			}
		}
		return nPlusOneAryDep2ref;
	}
 
源代码20 项目: LuckyFrameWeb   文件: StringUtils.java
/**
 * * 判断一个Map是否为空
 * 
 * @param map 要判断的Map
 * @return true:为空 false:非空
 */
public static boolean isEmpty(Map<?, ?> map)
{
    return isNull(map) || map.isEmpty();
}