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


Java PlanningSolution类代码示例

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


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

示例1: loadDataObjectPlanningSolution

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void loadDataObjectPlanningSolution() {
    DataObject dataObject = context.getDataObject();
    dataObject.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(PlanningSolution.class,
                                                                           null,
                                                                           null));

    PlannerDataObjectEditor objectEditor = createObjectEditor();
    objectEditor.onContextChange(context);

    verify(view,
           times(1)).enablePlanningSolutionCheckBox(true);
    verify(view,
           times(1)).showPlanningSolutionHelpIcon(false);

    verify(assetsUsageService,
           never()).getAssetUsages(anyString(),
                                   any(),
                                   any(Path.class));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:21,代码来源:PlannerDataObjectEditorTest.java

示例2: checkPlanningSolutionOtherExists

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void checkPlanningSolutionOtherExists() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    Path dataObjectPath = mock(Path.class);
    Path otherDataObjectPath = mock(Path.class);
    when(assetsUsageService.getAssetUsages(PlanningSolution.class.getName(),
                                           ResourceType.JAVA,
                                           dataObjectPath)).thenReturn(Arrays.asList(otherDataObjectPath));

    Collection<ValidationMessage> result = saveValidator.validate(dataObjectPath,
                                                                  dataObject);
    assertEquals(1,
                 result.size());

    ValidationMessage message = result.iterator().next();
    assertTrue(message instanceof PlanningSolutionToBeDuplicatedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:21,代码来源:PlanningSolutionSaveValidatorTest.java

示例3: validateIsAPlanningScore

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void validateIsAPlanningScore() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "PlanningSolution");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    ObjectProperty objectProperty = new ObjectPropertyImpl("score",
                                                           HardSoftScore.class.getName(),
                                                           false);
    objectProperty.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class)));
    objectProperty.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(Generated.class)));

    Collection<ValidationMessage> result = deleteValidator.validate(dataObject,
                                                                    objectProperty);
    assertEquals(1,
                 result.size());
    assertTrue(result.iterator().next() instanceof PlanningScoreToBeDeletedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:19,代码来源:PlanningScoreDeleteValidatorTest.java

示例4: createPlanningSolution

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
private DataObject createPlanningSolution() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "TestSolution");

    AnnotationImpl planningSolutionAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class));
    dataObject.addAnnotation(planningSolutionAnnotation);

    ObjectProperty scoreObjectProperty = new ObjectPropertyImpl("score",
                                                                BendableScore.class.getName(),
                                                                false);
    dataObject.addProperty(scoreObjectProperty);

    AnnotationImpl planningScoreAnnotation = new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningScore.class));
    planningScoreAnnotation.setValue("bendableHardLevelsSize",
                                     1);
    planningScoreAnnotation.setValue("bendableSoftLevelsSize",
                                     2);
    scoreObjectProperty.addAnnotation(planningScoreAnnotation);

    return dataObject;
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:22,代码来源:ScoreHolderServiceImplTest.java

示例5: loadDataObjectWithBendableScoreType

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void loadDataObjectWithBendableScoreType() {
    PlannerDataObjectEditor objectEditor = createObjectEditor();

    DataObject dataObject = context.getDataObject();

    dataObject.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(PlanningSolution.class,
                                                                           null,
                                                                           null));

    ObjectProperty scoreObjectProperty = new ObjectPropertyImpl("score",
                                                                BendableScore.class.getName(),
                                                                false);
    dataObject.addProperty(scoreObjectProperty);

    scoreObjectProperty.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(PlanningScore.class,
                                                                                    new Pair("bendableHardLevelsSize",
                                                                                             5),
                                                                                    new Pair("bendableSoftLevelsSize",
                                                                                             10)));
    scoreObjectProperty.addAnnotation(DataModelerEditorsTestHelper.createAnnotation(Generated.class,
                                                                                    null,
                                                                                    null));

    objectEditor.onContextChange(context);

    verify(view,
           times(1)).setPlanningSolutionBendableScoreHardLevelsSize(5);
    verify(view,
           times(1)).setPlanningSolutionBendableScoreSoftLevelsSize(10);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:32,代码来源:PlannerDataObjectEditorTest.java

示例6: getPlannerAnnotations

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
public static Map<String, AnnotationDefinition> getPlannerAnnotations() {
    HashMap<String, AnnotationDefinition> annotations = new HashMap<String, AnnotationDefinition>();

    annotations.put(PlanningEntity.class.getName(),
                    DriverUtils.buildAnnotationDefinition(PlanningEntity.class));
    annotations.put(PlanningSolution.class.getName(),
                    DriverUtils.buildAnnotationDefinition(PlanningSolution.class));
    annotations.put(PlanningVariable.class.getName(),
                    DriverUtils.buildAnnotationDefinition(PlanningVariable.class));
    annotations.put(ValueRangeProvider.class.getName(),
                    DriverUtils.buildAnnotationDefinition(ValueRangeProvider.class));

    return annotations;
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:15,代码来源:PlannerTestUtil.java

示例7: planningSolutionSettings

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void planningSolutionSettings() {

    PlannerDataObjectFieldEditor fieldEditor = createFieldEditor();

    //first configure the DataObject as a PlanningSolution
    DataObject dataObject = context.getDataObject();
    dataObject.addAnnotation(new AnnotationImpl(context.getAnnotationDefinition(PlanningSolution.class.getName())));
    dataObject.addProperty("score",
                           HardSoftScore.class.getName());

    ObjectProperty field1 = dataObject.getProperty("field1");
    //emulates the selection of field1
    context.setObjectProperty(field1);

    //The domain editors typically reacts upon DataModelerContext changes.
    //when the context changes the editor will typically be reloaded.
    fieldEditor.onContextChange(context);

    when(view.getValueRangeProviderValue()).thenReturn(true);
    when(view.getValueRangeProviderIdValue()).thenReturn("valueRangeProviderIdValue");

    //emulate the user input
    fieldEditor.onValueRangeProviderChange();
    fieldEditor.onValueRangeProviderIdChange();

    assertNotNull(field1.getAnnotation(ValueRangeProvider.class.getName()));
    assertEquals("valueRangeProviderIdValue",
                 AnnotationValueHandler.getStringValue(field1,
                                                       ValueRangeProvider.class.getName(),
                                                       "id"));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:33,代码来源:PlannerDataObjectFieldEditorTest.java

示例8: validate

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Override
public Collection<ValidationMessage> validate(final DataObject dataObject,
                                              final ObjectProperty objectProperty) {
    final boolean isGeneratedPlanningScoreField =
            dataObject != null
                    && dataObject.getAnnotation(PlanningSolution.class.getName()) != null
                    && objectProperty != null
                    && "score".equals(objectProperty.getName())
                    && objectProperty.getAnnotation(PlanningScore.class.getName()) != null
                    && objectProperty.getAnnotation(Generated.class.getName()) != null;
    return isGeneratedPlanningScoreField ? Arrays.asList(new PlanningScoreToBeDeletedMessage()) : Collections.emptyList();
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:13,代码来源:PlanningScoreDeleteValidator.java

示例9: extractScoreTypeFqn

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
public String extractScoreTypeFqn(final DataObject dataObject) {
    if (dataObject.getAnnotation(PlanningSolution.class.getName()) != null) {
        final ObjectProperty scoreObjectProperty = dataObject.getProperty("score");
        if (scoreObjectProperty != null) {
            return scoreObjectProperty.getClassName();
        }
    }
    return null;
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:10,代码来源:ScoreHolderUtils.java

示例10: checkPlanningSolutionNoOtherExists

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void checkPlanningSolutionNoOtherExists() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    Path dataObjectPath = mock(Path.class);
    when(assetsUsageService.getAssetUsages(PlanningSolution.class.getName(),
                                           ResourceType.JAVA,
                                           dataObjectPath)).thenReturn(Arrays.asList(dataObjectPath));

    Collection<ValidationMessage> result = saveValidator.validate(dataObjectPath,
                                                                  dataObject);
    assertTrue(result.isEmpty());
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:16,代码来源:PlanningSolutionSaveValidatorTest.java

示例11: postProcess

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void postProcess() {
    Path sourcePath = PathFactory.newPath("TestSource.java",
                                          "file:///dataObjects");

    when(ioService.readAllString(Paths.convert(sourcePath))).thenReturn("test source");

    DataObject dataObject = new DataObjectImpl("test",
                                               "TestSource");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
    GenerationResult generationResult = new GenerationResult();
    generationResult.setDataObject(dataObject);
    when(dataModelerService.loadDataObject(any(),
                                           anyString(),
                                           any())).thenReturn(generationResult);

    Package _package = mock(Package.class);
    when(_package.getPackageMainResourcesPath()).thenReturn(PathFactory.newPath("dataObjects",
                                                                                "file:///dataObjects"));
    when(kieProjectService.resolvePackage(sourcePath)).thenReturn(_package);

    when(ioService.exists(any())).thenReturn(true);

    deleteHelper.postProcess(sourcePath);

    verify(ioService,
           times(1)).deleteIfExists(any(org.uberfire.java.nio.file.Path.class));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:29,代码来源:PlanningSolutionDeleteHelperTest.java

示例12: postProcess

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void postProcess() {
    Path sourcePath = PathFactory.newPath("TestSource.java",
                                          "file:///dataObjects");
    Path destinationPath = PathFactory.newPath("TestDestination.java",
                                               "file:///dataObjects");

    when(ioService.readAllString(Paths.convert(sourcePath))).thenReturn("test source");

    DataObject dataObject = new DataObjectImpl("test",
                                               "TestSource");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
    GenerationResult generationResult = new GenerationResult();
    generationResult.setDataObject(dataObject);
    when(dataModelerService.loadDataObject(any(),
                                           anyString(),
                                           any())).thenReturn(generationResult);

    Package _package = mock(Package.class);
    when(_package.getPackageMainResourcesPath()).thenReturn(PathFactory.newPath("dataObjects",
                                                                                "file:///dataObjects"));
    when(kieProjectService.resolvePackage(sourcePath)).thenReturn(_package);

    when(ioService.exists(any())).thenReturn(true);

    copyHelper.postProcess(sourcePath,
                           destinationPath);

    verify(ioService,
           times(1)).copy(any(org.uberfire.java.nio.file.Path.class),
                          any(org.uberfire.java.nio.file.Path.class));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:33,代码来源:PlanningSolutionCopyHelperTest.java

示例13: postProcess

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void postProcess() {
    Path sourcePath = PathFactory.newPath("TestSource.java",
                                          "file:///dataObjects");
    Path destinationPath = PathFactory.newPath("TestDestination.java",
                                               "file:///dataObjects");

    when(ioService.readAllString(Paths.convert(sourcePath))).thenReturn("test source");

    DataObject dataObject = new DataObjectImpl("test",
                                               "TestSource");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
    GenerationResult generationResult = new GenerationResult();
    generationResult.setDataObject(dataObject);
    when(dataModelerService.loadDataObject(any(),
                                           anyString(),
                                           any())).thenReturn(generationResult);

    Package _package = mock(Package.class);
    when(_package.getPackageMainResourcesPath()).thenReturn(PathFactory.newPath("dataObjects",
                                                                                "file:///dataObjects"));
    when(kieProjectService.resolvePackage(sourcePath)).thenReturn(_package);

    when(ioService.exists(any())).thenReturn(true);

    renameHelper.postProcess(sourcePath,
                             destinationPath);

    verify(ioService,
           times(1)).move(any(org.uberfire.java.nio.file.Path.class),
                          any(org.uberfire.java.nio.file.Path.class));
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:33,代码来源:PlanningSolutionRenameHelperTest.java

示例14: extractScoreTypeFqn

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void extractScoreTypeFqn() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));
    dataObject.addProperty("score",
                           HardSoftScore.class.getName());

    String result = scoreHolderUtils.extractScoreTypeFqn(dataObject);

    assertEquals(HardSoftScore.class.getName(),
                 result);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:14,代码来源:ScoreHolderUtilsTest.java

示例15: checkDataObjectIsAPlanningSolution

import org.optaplanner.core.api.domain.solution.PlanningSolution; //导入依赖的package包/类
@Test
public void checkDataObjectIsAPlanningSolution() {
    DataObject dataObject = new DataObjectImpl("test",
                                               "Test");
    dataObject.addAnnotation(new AnnotationImpl(DriverUtils.buildAnnotationDefinition(PlanningSolution.class)));

    Collection<ValidationMessage> result = copyValidator.validate(mock(Path.class),
                                                                  dataObject);
    assertEquals(1,
                 result.size());

    ValidationMessage message = result.iterator().next();
    assertTrue(message instanceof PlanningSolutionToBeDuplicatedMessage);
}
 
开发者ID:kiegroup,项目名称:optaplanner-wb,代码行数:15,代码来源:PlanningSolutionCopyValidatorTest.java


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