当前位置: 首页>>代码示例>>Java>>正文


Java ICompensation类代码示例

本文整理汇总了Java中eu.atos.sla.datamodel.ICompensation的典型用法代码示例。如果您正苦于以下问题:Java ICompensation类的具体用法?Java ICompensation怎么用?Java ICompensation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ICompensation类属于eu.atos.sla.datamodel包,在下文中一共展示了ICompensation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
/**
 * Evaluate violations and penalties for a given guarantee term and a list of metrics.
 * 
 * @param agreement that contains the term to evaluate
 * @param term guarantee term to evaluate
 * @param metrics list of metrics to evaluated if fulfill the service level of the term.
 * @param now the evaluation period ends at <code>now</code>.
 */
public GuaranteeTermEvaluationResult evaluate(
		IAgreement agreement, IGuaranteeTerm term, List<IMonitoringMetric> metrics, Date now) {

	/*
	 * throws NullPointerException if not property initialized 
	 */
	checkInitialized();
				
	logger.debug("evaluate(agreement={}, term={}, now={})", 
			agreement.getAgreementId(), term.getKpiName(), now);

	final List<IViolation> violations = serviceLevelEval.evaluate(agreement, term, metrics, now);
	logger.debug("Found " + violations.size() + " violations");
	final List<? extends ICompensation> compensations = businessEval.evaluate(agreement, term, violations, now);
	logger.debug("Found " + compensations.size() + " compensations");
	
	GuaranteeTermEvaluationResult result = new GuaranteeTermEvaluationResult(violations, compensations); 
	
	return result;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:29,代码来源:GuaranteeTermEvaluator.java

示例2: evaluateBusiness

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
/**
 * Evaluate penalties for a given guarantee term and a list of violations.
 * 
 * @param agreement that contains the term to evaluate
 * @param term guarantee term to evaluate
 * @param violations list of violations to evaluated if raise any compensation.
 * @param now the evaluation period ends at <code>now</code>.
 */
public GuaranteeTermEvaluationResult evaluateBusiness(
		IAgreement agreement, IGuaranteeTerm term, List<IViolation> violations, Date now) {
	
	/*
	 * throws NullPointerException if not property initialized 
	 */
	checkInitialized();
				
	logger.debug("evaluateBusiness(agreement={}, term={}, now={})", 
			agreement.getAgreementId(), term.getKpiName(), now);

	logger.debug("Found " + violations.size() + " violations");
	final List<? extends ICompensation> compensations = businessEval.evaluate(agreement, term, violations, now);
	logger.debug("Found " + compensations.size() + " compensations");
	
	GuaranteeTermEvaluationResult result = new GuaranteeTermEvaluationResult(violations, compensations); 
	
	return result;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:28,代码来源:GuaranteeTermEvaluator.java

示例3: onFinishEvaluation

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
@Override
	public void onFinishEvaluation(
			IAgreement agreement,
			Map<IGuaranteeTerm, GuaranteeTermEvaluationResult> guaranteeTermEvaluationMap) {

		if (this.resource == null) {
			return;
		}
		
		List<Object> data = new ArrayList<Object>();
		for (GuaranteeTermEvaluationResult o : guaranteeTermEvaluationMap.values()) {
			for (ICompensation compensation : o.getCompensations()) {
				Object item = serialize(compensation);
				data.add(item);
				send(item);
			}
		}
//		send(data);
	}
 
开发者ID:modaclouds,项目名称:modaclouds-sla-core,代码行数:20,代码来源:RestNotifier.java

示例4: evaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
/**
 * Evaluate violations and penalties for a given guarantee term and a list of metrics.
 * 
 * @param agreement that contains the term to evaluate
 * @param term guarantee term to evaluate
 * @param metrics list of metrics to evaluated if fulfill the service level of the term.
 * @param now the evaluation period ends at <code>now</code>.
 */
public GuaranteeTermEvaluationResult evaluate(
        IAgreement agreement, IGuaranteeTerm term, List<IMonitoringMetric> metrics, Date now) {

    /*
     * throws NullPointerException if not property initialized 
     */
    checkInitialized();
                
    logger.debug("evaluate(agreement={}, term={}, now={})", 
            agreement.getAgreementId(), term.getKpiName(), now);

    final List<IViolation> violations = serviceLevelEval.evaluate(agreement, term, metrics, now);
    logger.debug("Found " + violations.size() + " violations");
    final List<? extends ICompensation> compensations = businessEval.evaluate(agreement, term, violations, now);
    logger.debug("Found " + compensations.size() + " compensations");
    
    GuaranteeTermEvaluationResult result = new GuaranteeTermEvaluationResult(violations, compensations); 
    
    return result;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:29,代码来源:GuaranteeTermEvaluator.java

示例5: evaluateBusiness

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
/**
 * Evaluate penalties for a given guarantee term and a list of violations.
 * 
 * @param agreement that contains the term to evaluate
 * @param term guarantee term to evaluate
 * @param violations list of violations to evaluated if raise any compensation.
 * @param now the evaluation period ends at <code>now</code>.
 */
public GuaranteeTermEvaluationResult evaluateBusiness(
        IAgreement agreement, IGuaranteeTerm term, List<IViolation> violations, Date now) {
    
    /*
     * throws NullPointerException if not property initialized 
     */
    checkInitialized();
                
    logger.debug("evaluateBusiness(agreement={}, term={}, now={})", 
            agreement.getAgreementId(), term.getKpiName(), now);

    logger.debug("Found " + violations.size() + " violations");
    final List<? extends ICompensation> compensations = businessEval.evaluate(agreement, term, violations, now);
    logger.debug("Found " + compensations.size() + " compensations");
    
    GuaranteeTermEvaluationResult result = new GuaranteeTermEvaluationResult(violations, compensations); 
    
    return result;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:28,代码来源:GuaranteeTermEvaluator.java

示例6: evaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
@Override
public List<? extends ICompensation> evaluate(
		IAgreement agreement, IGuaranteeTerm term, List<IViolation> newViolations, Date now) {
	
	logger.debug("Evaluating business for {} new violations", newViolations.size());
	List<ICompensation> result = new ArrayList<ICompensation>();
	IBusinessValueList businessValues = term.getBusinessValueList();
	if (businessValues == null) {
		/*
		 * sanity check
		 */
		return Collections.emptyList();
	}
	for (IPenaltyDefinition penaltyDef : businessValues.getPenalties()) {
		if (penaltyDef.getKind() != CompensationKind.CUSTOM_PENALTY) {
			continue;
		}
		Date violationsBegin = new Date(now.getTime() - penaltyDef.getTimeInterval().getTime());
		/*
		 * TODO: violationsBegin should be max(violationsBegin, select last(penalty) where penalty.definition = def
		 */
		List<IViolation> oldViolations = 
				repository.getViolationsByTimeRange(agreement, term.getName(), violationsBegin, now);
		
		if (thereIsPenalty(penaltyDef, newViolations, oldViolations)) {
			
			IPenalty penalty = new Penalty(
					agreement.getAgreementId(),
					now,
					term.getKpiName(),
					penaltyDef, 
					getLastViolation(newViolations, oldViolations));
			result.add(penalty);
			logger.debug("Raised {}", penalty);
		}
	}
	return result;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:39,代码来源:SimpleBusinessValuesEvaluator.java

示例7: testEvaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
@Test
public void testEvaluate() {
	
	SimpleBusinessValuesEvaluator bvEval = new SimpleBusinessValuesEvaluator();
	bvEval.setCompensationRepository(new DummyViolationRepository(Arrays.asList(violations)));
	IGuaranteeTerm term = contract.getGuaranteeTerms().get(0);
	
	List<? extends ICompensation> compensations;
	
	for (int i = 0; i < times.length; i++) {
		Date now = new Date(i * 1000);
		
		List<IViolation> newViolations = (times[i] != 0)?
			Collections.singletonList(TestAgreementFactory.newViolation(contract, term, null, now)) :
			Collections.<IViolation>emptyList();

		compensations = bvEval.evaluate(
			contract, 
			term, 
			newViolations,
			now
		);

		for (IPenaltyDefinition def : contract.getGuaranteeTerms().get(0).getBusinessValueList().getPenalties()) {
			int count = def.getCount();
			int step = (int)def.getTimeInterval().getTime() / 1000;
			
			boolean expectedPenalty = sum(times, i - step, i) >= count;
			boolean actualPenalty = foundPenaltyDefinition(def, compensations);
			
			if (expectedPenalty != actualPenalty) {
				assertEquals(expectedPenalty, actualPenalty);
			}
			assertEquals(expectedPenalty, actualPenalty);
		}
	}
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:38,代码来源:SimpleBusinessValuesEvaluatorTest.java

示例8: foundPenaltyDefinition

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
private boolean foundPenaltyDefinition(IPenaltyDefinition def, List<? extends ICompensation> compensations) {
	for (ICompensation c : compensations) {
		if (c instanceof IPenalty) {
			IPenalty p = (IPenalty) c;
			if (p.getDefinition().equals(def)) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:12,代码来源:SimpleBusinessValuesEvaluatorTest.java

示例9: serialize

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
/**
 * Quick and easy serialization from a model compensation to a jaxb compensation
 * @param compensation model compensation to serialize from
 * @return corresponding jaxb object
 */
private Object serialize(ICompensation compensation) {
	Object result;
	if (compensation instanceof Penalty) {
		result = new eu.atos.sla.parser.data.Penalty((Penalty)compensation);
	}
	else {
		throw new UnsupportedOperationException("Not implemented");
	}
	return result;
}
 
开发者ID:modaclouds,项目名称:modaclouds-sla-core,代码行数:16,代码来源:RestNotifier.java

示例10: evaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
@Override
public List<? extends ICompensation> evaluate(
        IAgreement agreement, IGuaranteeTerm term, List<IViolation> newViolations, Date now) {
    
    logger.debug("Evaluating business for {} new violations", newViolations.size());
    List<ICompensation> result = new ArrayList<ICompensation>();
    IBusinessValueList businessValues = term.getBusinessValueList();
    if (businessValues == null) {
        /*
         * sanity check
         */
        return Collections.emptyList();
    }
    for (IPenaltyDefinition penaltyDef : businessValues.getPenalties()) {
        if (penaltyDef.getKind() != CompensationKind.CUSTOM_PENALTY) {
            continue;
        }
        Date violationsBegin = new Date(now.getTime() - penaltyDef.getTimeInterval().getTime());
        /*
         * TODO: violationsBegin should be max(violationsBegin, select last(penalty) where penalty.definition = def
         */
        List<IViolation> oldViolations = 
                repository.getViolationsByTimeRange(agreement, term.getName(), violationsBegin, now);
        
        if (thereIsPenalty(penaltyDef, newViolations, oldViolations)) {
            
            IPenalty penalty = new Penalty(
                    agreement.getAgreementId(),
                    now,
                    term.getKpiName(),
                    penaltyDef, 
                    getLastViolation(newViolations, oldViolations));
            result.add(penalty);
            logger.debug("Raised {}", penalty);
        }
    }
    return result;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:39,代码来源:SimpleBusinessValuesEvaluator.java

示例11: testEvaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
@Test
public void testEvaluate() {
    
    SimpleBusinessValuesEvaluator bvEval = new SimpleBusinessValuesEvaluator();
    bvEval.setCompensationRepository(new DummyViolationRepository(Arrays.asList(violations)));
    IGuaranteeTerm term = contract.getGuaranteeTerms().get(0);
    
    List<? extends ICompensation> compensations;
    
    for (int i = 0; i < times.length; i++) {
        Date now = new Date(i * 1000);
        
        List<IViolation> newViolations = (times[i] != 0)?
            Collections.singletonList(TestAgreementFactory.newViolation(contract, term, null, now)) :
            Collections.<IViolation>emptyList();

        compensations = bvEval.evaluate(
            contract, 
            term, 
            newViolations,
            now
        );

        for (IPenaltyDefinition def : contract.getGuaranteeTerms().get(0).getBusinessValueList().getPenalties()) {
            int count = def.getCount();
            int step = (int)def.getTimeInterval().getTime() / 1000;
            
            boolean expectedPenalty = sum(times, i - step, i) >= count;
            boolean actualPenalty = foundPenaltyDefinition(def, compensations);
            
            if (expectedPenalty != actualPenalty) {
                assertEquals(expectedPenalty, actualPenalty);
            }
            assertEquals(expectedPenalty, actualPenalty);
        }
    }
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:38,代码来源:SimpleBusinessValuesEvaluatorTest.java

示例12: foundPenaltyDefinition

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
private boolean foundPenaltyDefinition(IPenaltyDefinition def, List<? extends ICompensation> compensations) {
    for (ICompensation c : compensations) {
        if (c instanceof IPenalty) {
            IPenalty p = (IPenalty) c;
            if (p.getDefinition().equals(def)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:12,代码来源:SimpleBusinessValuesEvaluatorTest.java

示例13: GuaranteeTermEvaluationResult

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
public GuaranteeTermEvaluationResult(List<IViolation> violations,
		List<? extends ICompensation> compensations) {
	this.violations = violations;
	this.compensations = compensations;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:6,代码来源:GuaranteeTermEvaluator.java

示例14: getCompensations

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
public List<? extends ICompensation> getCompensations() {
	return compensations;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:4,代码来源:GuaranteeTermEvaluator.java

示例15: evaluate

import eu.atos.sla.datamodel.ICompensation; //导入依赖的package包/类
@Override
public List<ICompensation> evaluate(IAgreement agreement,
		IGuaranteeTerm term, List<IViolation> violations, Date now) {

	return Collections.emptyList();
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:7,代码来源:DummyBusinessValuesEvaluator.java


注:本文中的eu.atos.sla.datamodel.ICompensation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。