public final void setVelocity(final Vec2D velocity) {
   moveData.velocity = velocity;
 }
Exemplo n.º 2
0
  /** Prints very pretty version of modifications */
  @Override
  public String toString() {
    StringBuffer sb =
        new StringBuffer(
            "Differences(num=" + differences.size() + ",cost=" + getDifferenceCost() + "\n");

    int lcv = 1;
    for (Difference d : differences.values()) {
      BaseHK2JAXBBean source = d.getSource();

      String xmlPath = source._getXmlPath();
      String instanceName = source._getInstanceName();

      List<PropertyChangeEvent> events = d.getNonChildChanges();
      sb.append(
          lcv + ". Modified Bean sourcePath=" + xmlPath + " sourceInstance=" + instanceName + "\n");

      for (PropertyChangeEvent event : events) {
        sb.append(
            "\tCHANGED: "
                + event.getPropertyName()
                + " from "
                + event.getOldValue()
                + " to "
                + event.getNewValue()
                + "\n");
      }

      Map<String, AddRemoveMoveDifference> childChanges = d.getChildChanges();

      for (Map.Entry<String, AddRemoveMoveDifference> childEntry : childChanges.entrySet()) {
        String propertyName = childEntry.getKey();

        sb.append("  CHANGED CHILD: " + propertyName + "\n");
        AddRemoveMoveDifference arm = childEntry.getValue();

        for (AddData ad : arm.getAdds()) {
          BaseHK2JAXBBean added = ad.getToAdd();
          int index = ad.getIndex();

          String addedXmlPath = added._getXmlPath();
          String addedInstanceName = added._getInstanceName();

          sb.append(
              "    ADDED: addedPath="
                  + addedXmlPath
                  + " addedInstanceName="
                  + addedInstanceName
                  + " addedIndex="
                  + index
                  + "\n");
        }

        for (RemoveData rd : arm.getRemoves()) {
          String removedXmlPath = rd.getChild()._getXmlPath();
          String removedInstanceName = rd.getChild()._getInstanceName();

          sb.append(
              "    REMOVED: removedPath="
                  + removedXmlPath
                  + " removedInstanceName="
                  + removedInstanceName
                  + "\n");
        }

        for (MoveData md : arm.getMoves()) {
          sb.append(
              "    MOVED: oldIndex=" + md.getOldIndex() + " newIndex=" + md.getNewIndex() + "\n");
        }
      }

      lcv++;
    }

    return sb.toString() + "\n," + System.identityHashCode(this) + ")";
  }
 protected final void setRect(
     final double x, final double y, final double width, final double height) {
   moveData.collisionBox = new CollisionBox(x, y, width, height);
 }