當前位置: 首頁>>代碼示例>>Java>>正文


Java ArrayUtils類代碼示例

本文整理匯總了Java中de.invation.code.toval.misc.ArrayUtils的典型用法代碼示例。如果您正苦於以下問題:Java ArrayUtils類的具體用法?Java ArrayUtils怎麽用?Java ArrayUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ArrayUtils類屬於de.invation.code.toval.misc包,在下文中一共展示了ArrayUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addRoutingConstraint

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Adds a routing constraint for an activity.
 * @param activity The name of the activity for which the constraint is added.
 * @param constraint The routing constraint to add.
 * @throws ParameterException if the given parameters are invalid.
 * @throws PropertyException if the given constraint cannot be added as a property.
 * @see #addConstraint(AbstractConstraint)
 * @see #addActivityWithConstraints(String)
 */
public void addRoutingConstraint(String activity, AbstractConstraint<?> constraint) throws PropertyException{
	Validate.notNull(activity);
	Validate.notEmpty(activity);
	Validate.notNull(constraint);
	
	//1. Add constraint itself
	//   This also adds the constraint to the list of constraints
	String propertyNameForNewConstraint = addConstraint(constraint);
	
	//2. Add constraint name to the list of constraints for this activity
	Set<String> currentConstraintNames = getConstraintNames(activity);
	currentConstraintNames.add(propertyNameForNewConstraint);
	if(currentConstraintNames.size() == 1){
		//Add the activity to the list of activities with routing constraints
		addActivityWithConstraints(activity);
	}
	props.setProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity), ArrayUtils.toString(currentConstraintNames.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:28,代碼來源:ConstraintContextProperties.java

示例2: setDataUsage

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
public void setDataUsage(String activity, Map<String, Set<DataUsage>> dataUsage) throws PropertyException {
      Validate.notNull(activity);
      Validate.notEmpty(activity);
      Validate.notNull(dataUsage);
      Validate.noNullElements(dataUsage.keySet());
      Validate.noNullElements(dataUsage.values());

//1. Add data usages
      //   This also adds the data usages to the list of data usages
      List<String> propertyNamesForDataUsages = new ArrayList<>();
      for (String attribute : dataUsage.keySet()) {
          propertyNamesForDataUsages.add(addDataUsage(attribute, dataUsage.get(attribute)));
      }

      //2. Add data usage names to the list of data usages for this activity
      addActivityWithDataUsage(activity);
      props.setProperty(String.format(ACTIVITY_DATA_USAGES_FORMAT, activity), ArrayUtils.toString(propertyNamesForDataUsages.toArray()));
  }
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:19,代碼來源:ProcessContextProperties.java

示例3: getDataUsageNames

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Returns the property-names of all data usages related to the given
 * activity.<br>
 * These names are required to extract data usage property-values.
 *
 * @param activity The name of the activity
 * @return A set of data usage property-names related to the given activity.
 * @throws ParameterException if the given activity name is <code>null</code or invalid.
 */
private Set<String> getDataUsageNames(String activity) {
    Validate.notNull(activity);
    Validate.notEmpty(activity);
    Set<String> result = new HashSet<>();
    String propertyValue = props.getProperty(String.format(ACTIVITY_DATA_USAGES_FORMAT, activity));
    if (propertyValue == null) {
        return result;
    }
    StringTokenizer subjectTokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
    while (subjectTokens.hasMoreTokens()) {
        String nextToken = subjectTokens.nextToken();
        result.add(nextToken);
    }
    return result;
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:25,代碼來源:ProcessContextProperties.java

示例4: getValidUsageModes

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
public Set<DataUsage> getValidUsageModes() throws PropertyException {
    String propertyValue = getProperty(ProcessContextProperty.VALID_USAGE_MODES);
    if (propertyValue == null) {
        throw new PropertyException(ACModelProperty.VALID_USAGE_MODES, propertyValue);
    }
    StringTokenizer tokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
    Set<DataUsage> result = new HashSet<>();
    while (tokens.hasMoreTokens()) {
        String nextToken = tokens.nextToken();
        if (nextToken.length() < 3) {
            throw new PropertyException(ACModelProperty.VALID_USAGE_MODES, propertyValue);
        }
        nextToken = nextToken.substring(1, nextToken.length() - 1);
        DataUsage nextUsage = null;
        try {
            nextUsage = DataUsage.parse(nextToken);
        } catch (Exception e) {
            throw new PropertyException(ACModelProperty.VALID_USAGE_MODES, nextToken, e);
        }
        result.add(nextUsage);
    }
    return result;
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:24,代碼來源:ProcessContextProperties.java

示例5: setObjectPermission

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
public void setObjectPermission(String subject, Map<String, Set<DataUsage>> permissions) throws PropertyException{
	validateStringValue(subject);
	Validate.notNull(permissions);
	if(permissions.isEmpty())
		return;
	validateStringCollection(permissions.keySet());
	Validate.noNullElements(permissions.values());
	
	//1. Add permissions
	//   This also adds the permissions to the list of permissions
	List<String> propertyNamesForPermissions = new ArrayList<String>();
	for(String object: permissions.keySet()){
		propertyNamesForPermissions.add(addObjectPermission(object, permissions.get(object)));
	}
	
	//2. Add permissions for this activity
	props.setProperty(String.format(SUBJECT_OBJECT_PERMISSION_FORMAT, subject), ArrayUtils.toString(propertyNamesForPermissions.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:19,代碼來源:ACLModelProperties.java

示例6: getValidUsageModes

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
public Set<DataUsage> getValidUsageModes() throws PropertyException {
    String propertyValue = getProperty(ACModelProperty.VALID_USAGE_MODES);
    if (propertyValue == null) {
        throw new PropertyException(ACModelProperty.VALID_USAGE_MODES, propertyValue);
    }
    StringTokenizer tokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
    Set<DataUsage> result = new HashSet<DataUsage>();
    while (tokens.hasMoreTokens()) {
        String nextToken = tokens.nextToken();
        if (nextToken.length() < 3) {
            throw new PropertyException(ACModelProperty.VALID_USAGE_MODES, propertyValue);
        }
        nextToken = nextToken.substring(1, nextToken.length() - 1);
        DataUsage nextUsage = null;
        try {
            nextUsage = DataUsage.parse(nextToken);
        } catch (Exception e) {
            throw new PropertyException(ACModelProperty.VALID_USAGE_MODES, nextToken);
        }
        result.add(nextUsage);
    }
    return result;
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:24,代碼來源:ACModelProperties.java

示例7: addActivityWithConstraints

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Adds an activity to the list of activities with routing constraints.
 * @param activity The name of the activity to add.
 * @throws ParameterException if the activity name is invalid.
 */
private void addActivityWithConstraints(String activity) {
	Validate.notNull(activity);
	Validate.notEmpty(activity);
	Set<String> currentActivities = getActivitiesWithRoutingConstraints();
	currentActivities.add(activity);
	setProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS, ArrayUtils.toString(currentActivities.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:13,代碼來源:ConstraintContextProperties.java

示例8: removeActivityWithConstraints

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Removes an activity from the list of activities with routing constraints.
 * @param activity The name of the activity to remove.
 * @throws ParameterException if the activity name is invalid.
 */
private void removeActivityWithConstraints(String activity) {
	Validate.notNull(activity);
	Validate.notEmpty(activity);
	Set<String> currentActivities = getActivitiesWithRoutingConstraints();
	currentActivities.remove(activity);
	setProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS, ArrayUtils.toString(currentActivities.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:13,代碼來源:ConstraintContextProperties.java

示例9: addConstraintNameToList

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Adds a new constraint property name to the list of constraint properties (CONSTRAINTS-field).
 * @param constraintName The name of the constraint-property to add (e.g. CONSTRAINT_5).
 * @throws ParameterException if the given property name is invalid.
 */
private void addConstraintNameToList(String constraintName) {
	validateStringValue(constraintName);
	Set<String> currentValues = getConstraintNameList();
	currentValues.add(constraintName);
	setProperty(ConstraintContextProperty.ALL_CONSTRAINTS, ArrayUtils.toString(currentValues.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:12,代碼來源:ConstraintContextProperties.java

示例10: removeConstraintNameFromList

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Removes the constraint property with the given name from the list of constraint properties (CONSTRAINTS-field).
 * @param constraintName The name of the constraint-property to remove (e.g. CONSTRAINT_5).
 * @throws ParameterException if the given property name is invalid.
 */
private void removeConstraintNameFromList(String constraintName) {
	validateStringValue(constraintName);
	Set<String> currentValues = getConstraintNameList();
	currentValues.remove(constraintName);
	setProperty(ConstraintContextProperty.ALL_CONSTRAINTS, ArrayUtils.toString(currentValues.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:12,代碼來源:ConstraintContextProperties.java

示例11: getConstraintNameList

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Returns all property names for routing constraints, <br>
 * i.e. the value of the context property CONSTRAINTS.
 * @return A set of all used property names for routing constraints.
 */
private Set<String> getConstraintNameList(){
	Set<String> result = new HashSet<>();
	String propertyValue = getProperty(ConstraintContextProperty.ALL_CONSTRAINTS);
	if(propertyValue == null)
		return result;
	StringTokenizer attributeTokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
	while(attributeTokens.hasMoreTokens()){
		String nextToken = attributeTokens.nextToken();
		result.add(nextToken);
	}
	return result;
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:18,代碼來源:ConstraintContextProperties.java

示例12: getConstraintNames

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Returns the property-names of all routing constraints related to the given activity.<br>
 * These names are required to extract constraint property-values.
 * @param activity The name of the activity
 * @return A set of constraint property-names related to the given activity.
 * @throws ParameterException if the given activity name is <code>null</code or invalid.
 */
private Set<String> getConstraintNames(String activity) {
	Validate.notNull(activity);
	Validate.notEmpty(activity);
	Set<String> result = new HashSet<>();
	String propertyValue = props.getProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity));
	if(propertyValue == null)
		return result;
	StringTokenizer subjectTokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
	while(subjectTokens.hasMoreTokens()){
		String nextToken = subjectTokens.nextToken();
		result.add(nextToken);
	}
	return result;
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:22,代碼來源:ConstraintContextProperties.java

示例13: removeRoutingConstraint

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
public void removeRoutingConstraint(String activity, AbstractConstraint<?> constraint) throws PropertyException{
	Validate.notNull(activity);
	Validate.notEmpty(activity);
	Validate.notNull(constraint);
	//Find name of the given constraint
	Set<String> propertyNamesForActivityConstraints = getConstraintNames(activity);
	if(propertyNamesForActivityConstraints.isEmpty()){
		//This activity has no constraints.
		return;
	}
	String propertyNameForConstraintToRemove = null;
	for(String propertyNameForActivityConstraint: propertyNamesForActivityConstraints){
		AbstractConstraint<?> activityConstraint = getConstraint(propertyNameForActivityConstraint);
		if(activityConstraint.equals(constraint)){
			propertyNameForConstraintToRemove = propertyNameForActivityConstraint;
			break;
		}
	}
	if(propertyNameForConstraintToRemove == null){
		//There is no stored reference to the given constraint to remove
		//-> Removal not necessary
		return;
	}
	
	//1. Remove the constraint itself
	props.remove(propertyNameForConstraintToRemove);
	
	//2. Remove the constraint from the list of constraints
	removeConstraintNameFromList(propertyNameForConstraintToRemove);
	
	//3. Remove the constraint from the activity constraint list.
	Set<String> currentConstraintNames = getConstraintNames(activity);
	currentConstraintNames.remove(propertyNameForConstraintToRemove);
	if(currentConstraintNames.isEmpty()){
		removeActivityWithConstraints(activity);
		props.remove(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity));
	} else {
		props.setProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity), ArrayUtils.toString(currentConstraintNames.toArray()));
	}
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:41,代碼來源:ConstraintContextProperties.java

示例14: addActivityWithDataUsage

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Adds an activity to the list of activities with data usage.
 *
 * @param activity The name of the activity to add.
 * @throws ParameterException if the activity name is invalid.
 */
private void addActivityWithDataUsage(String activity) {
    Validate.notNull(activity);
    Validate.notEmpty(activity);
    Set<String> currentActivities = getActivitiesWithDataUsage();
    currentActivities.add(activity);
    setProperty(ProcessContextProperty.ACTIVITIES_WITH_DATA_USAGE, ArrayUtils.toString(currentActivities.toArray()));
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:14,代碼來源:ProcessContextProperties.java

示例15: getDataUsageNameList

import de.invation.code.toval.misc.ArrayUtils; //導入依賴的package包/類
/**
 * Returns all property names for data usages, <br>
 * i.e. the value of the context property ACTIVITY_DATA_USAGES.
 *
 * @return A set of all used property names for data usages.
 */
private Set<String> getDataUsageNameList() {
    Set<String> result = new HashSet<>();
    String propertyValue = getProperty(ProcessContextProperty.ALL_DATA_USAGES);
    if (propertyValue == null) {
        return result;
    }
    StringTokenizer attributeTokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
    while (attributeTokens.hasMoreTokens()) {
        String nextToken = attributeTokens.nextToken();
        result.add(nextToken);
    }
    return result;
}
 
開發者ID:iig-uni-freiburg,項目名稱:SEWOL,代碼行數:20,代碼來源:ProcessContextProperties.java


注:本文中的de.invation.code.toval.misc.ArrayUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。