All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.storage.mock.EigenProcessor Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package com.arextest.storage.mock;

import com.arextest.diff.model.eigen.EigenOptions;
import com.arextest.diff.model.eigen.EigenResult;
import com.arextest.diff.sdk.EigenSDK;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Calculates the eigen value of the body.
 * created by xinyuan_wang on 2023/11/10
 */
public class EigenProcessor {

  private static final EigenSDK eigenSDK = new EigenSDK();

  public static Map calculateEigen(String body, String categoryName,
      Collection> exclusions,
      Collection ignoreNodes) {
    EigenOptions options = EigenOptions.options();
    options.putCategoryType(categoryName);
    if (CollectionUtils.isNotEmpty(exclusions)) {
      options.putExclusions(exclusions);
    }
    if (CollectionUtils.isNotEmpty(ignoreNodes)) {
      options.putIgnoreNodes(ignoreNodes);
    }
    EigenResult eigenResult = eigenSDK.calculateEigen(body, options);
    if (eigenResult == null) {
      return null;
    }
    return eigenResult.getEigenMap();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy