Exemplo n.º 1
0
  @Test
  public void testAnimationBuilder() {
    FloatValue floatValue1 = new FloatValue(0f);
    FloatValue floatValue2 = new FloatValue(0f);

    TimelineAnimation timelineAnimation =
        Builders.animation( //
                Builders.timeline() //
                    .value(
                        Builders.timelineValue(floatValue1, new FloatValueConverter()) //
                            .keyFrame(0f, new FloatValue(500f)) //
                            .keyFrame(0.5f, new FloatValue(12500f)) //
                            .keyFrame(1f, new FloatValue(500f)) //
                        ) //
                    .value(
                        Builders.timelineValue(floatValue2, new FloatValueConverter()) //
                            .keyFrame(0f, new FloatValue(3f)) //
                            .keyFrame(0.5f, new FloatValue(10f)) //
                            .keyFrame(1f, new FloatValue(50f)) //
                        )) //
            .speed(2f) //
            .delay(0.2f) //
            .started(true) //
            .build();
    assertThat(timelineAnimation.getDelay(), IsEqual.equalTo(0.2f));
    assertThat(timelineAnimation.getDuration(), IsEqual.equalTo(1.2f));
    assertThat(timelineAnimation.isStarted(), IsEqual.equalTo(false));
  }
Exemplo n.º 2
0
 @Test
 public void bugAnimationShouldNotBeStarted() {
   TimelineAnimation timelineAnimation =
       Builders.animation( //
               Builders.timeline() //
                   .value(
                       Builders.timelineValue(new FloatValueConverter()) //
                           .keyFrame(0f, new FloatValue(500f)) //
                           .keyFrame(0.5f, new FloatValue(12500f)) //
                           .keyFrame(1f, new FloatValue(500f)) //
                       )) //
           .build();
   assertThat(timelineAnimation.isStarted(), IsEqual.equalTo(false));
 }
 public List<ManyToManyABarBuilder> manyToManyABars() {
   List<ManyToManyABarBuilder> b = new ArrayList<ManyToManyABarBuilder>();
   for (ManyToManyABar e : get().getManyToManyABars()) {
     b.add(Builders.existing(e));
   }
   return b;
 }
 @Override
 protected DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode>
     createBuilder(final PathArgument currentArg) {
   final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder =
       Builders.mapEntryBuilder().withNodeIdentifier((NodeIdentifierWithPredicates) currentArg);
   for (final Map.Entry<QName, Object> keyValue :
       ((NodeIdentifierWithPredicates) currentArg).getKeyValues().entrySet()) {
     builder.addChild(
         Builders.leafBuilder()
             //
             .withNodeIdentifier(new NodeIdentifier(keyValue.getKey()))
             .withValue(keyValue.getValue())
             .build());
   }
   return builder;
 }
Exemplo n.º 5
0
  @Test
  public void testBuildAnimationWithNoMutableObjects() {
    FloatValue floatValue1 = new FloatValue(0f);

    TimelineAnimation timelineAnimation =
        Builders.animation( //
                Builders.timeline() //
                    .value(
                        Builders.timelineValue(new FloatValueConverter()) //
                            .keyFrame(0f, new FloatValue(500f)) //
                            .keyFrame(0.5f, new FloatValue(12500f)) //
                            .keyFrame(1f, new FloatValue(500f)) //
                        )) //
            .delay(0.2f) //
            .started(true) //
            .build();

    assertNotNull(timelineAnimation);
    timelineAnimation.getTimeline().getTimeLineValue(0).setObject(floatValue1);
    timelineAnimation.update(1.2f);

    assertThat(floatValue1.value, IsEqual.equalTo(500f));
  }
 public ManyToManyABarBuilder manyToManyABar(int i) {
   return Builders.existing(get().getManyToManyABars().get(i));
 }
 @Override
 protected DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> createBuilder(
     final PathArgument compositeNode) {
   return Builders.choiceBuilder().withNodeIdentifier(getIdentifier());
 }
 @Override
 protected CollectionNodeBuilder<MapEntryNode, OrderedMapNode> createBuilder(
     final PathArgument compositeNode) {
   return Builders.orderedMapBuilder().withNodeIdentifier(getIdentifier());
 }
 @Override
 protected DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> createBuilder(
     final PathArgument compositeNode) {
   return Builders.augmentationBuilder().withNodeIdentifier(getIdentifier());
 }
 @Override
 protected ListNodeBuilder<?, ?> createBuilder(final PathArgument compositeNode) {
   return Builders.leafSetBuilder().withNodeIdentifier(getIdentifier());
 }
 @Override
 protected DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> createBuilder(
     final PathArgument compositeNode) {
   return Builders.unkeyedListEntryBuilder().withNodeIdentifier(getIdentifier());
 }
Exemplo n.º 12
0
 /** {@inheritDoc} */
 @Override
 public <T> Wave add(final WaveItem<T> waveItem, final T value) {
   final WaveData<T> waveData = Builders.waveData(waveItem, value);
   addDatas(waveData);
   return this;
 }