Examples of Transform


Examples of org.spout.api.geo.discrete.Transform

   * Drops the item specified into the direction the player looks, with slight randomness
   *
   * @param item to drop
   */
  public void dropItem(ItemStack item) {
    final Transform dropFrom;
    EntityHead head = getHead();
    if (head != null) {
      dropFrom = head.getHeadTransform();
    } else {
      dropFrom = getOwner().getPhysics().getTransform();
    }
    // Some constants
    final double impulseForce = 0.3;
    final float maxXZForce = 0.02f;
    final float maxYForce = 0.1f;

    // Create a velocity vector using the transform, apply (random) force
    Vector3f impulse = dropFrom.getRotation().getDirection().mul(impulseForce);

    // Random rotational offset to avoid dropping at the same position
    Random rand = GenericMath.getRandom();
    float xzLength = maxXZForce * rand.nextFloat();
    float yLength = maxYForce * (rand.nextFloat() - rand.nextFloat());
    impulse = impulse.add(Vector2f.createRandomDirection(rand).mul(xzLength).toVector3(yLength));

    // Slightly dropping upwards
    impulse = impulse.add(0.0, 0.1, 0.0);

    // Conversion factor, some sort of unit problem
    //TODO: This needs an actual value and this value might change when gravity changes!
    impulse = impulse.mul(100);

    // Finally drop using a 4 second pickup delay
    Item spawnedItem = Item.drop(dropFrom.getPosition(), item, impulse);
    spawnedItem.setUncollectableDelay(4000);
  }
View Full Code Here

Examples of org.springframework.xd.test.fixtures.Transform

   * Construct a new Transform fixture.
   *
   * @return a Transform instance
   */
  public Transform transform() {
    return new Transform();
  }
View Full Code Here

Examples of org.teiid.core.types.Transform

            }
        }       
    }
   
    @Test public void testObjectToAnyTransformFailure() {
        Transform transform = DataTypeManager.getTransform(DefaultDataClasses.OBJECT, DefaultDataClasses.TIME);
        try {
            transform.transform("1"); //$NON-NLS-1$
            fail("expected exception"); //$NON-NLS-1$
        } catch (TransformationException e) {
            assertEquals("Error Code:ERR.003.029.0025 Message:Invalid conversion from type class java.lang.Object with value '1' to type class java.sql.Time", e.getMessage()); //$NON-NLS-1$
        }
    }
View Full Code Here

Examples of org.teiid.core.types.Transform

* @since 4.2
*/
public class TestTransforms {
   
    private static void helpTestTransform(Object value, Object expectedValue) throws TransformationException {
        Transform transform = DataTypeManager.getTransform(value.getClass(), expectedValue.getClass());
        Object result = transform.transform(value);
        assertEquals(expectedValue, result);
    }
View Full Code Here

Examples of org.teiid.core.types.Transform

        assertEquals(expectedValue, result);
    }
   
    private static void validateTransform(String src, Object value, String target, Object expectedValue) throws TransformationException {
        try {                       
            Transform transform = DataTypeManager.getTransform(DataTypeManager.getDataTypeClass(src), expectedValue.getClass());
            Object result = transform.transform(value);
          assertTrue(expectedValue.getClass().isAssignableFrom(result.getClass()));
            assertFalse("Expected exception for " +src+ " to " + target, //$NON-NLS-1$ //$NON-NLS-2$           
                isException(DataTypeManager.getDataTypeName(value.getClass()), target,value));
        } catch (TransformationException e) {
            if (!isException(DataTypeManager.getDataTypeName(value.getClass()), target,value)) {
View Full Code Here

Examples of org.teiid.core.types.Transform

        }
    }   

    private static void helpTransformException(Object value, Class<?> target, String msg) {
        try {
            Transform transform = DataTypeManager.getTransform(value.getClass(), target);
            transform.transform(value);
            fail("Expected to get an exception during the transformation"); //$NON-NLS-1$
        } catch (TransformationException e) {
          if (msg != null) {
            assertEquals(msg, e.getMessage());
          }
View Full Code Here

Examples of org.teiid.core.types.Transform

    public Object transformDirect(Object value) throws TransformationException {
        if(targetClass.isAssignableFrom(value.getClass())) {
            return value;
        }
       
        Transform transform = DataTypeManager.getTransform(value.getClass(), getTargetType());
       
        if (transform == null || transform instanceof ObjectToAnyTransform) {
            Object[] params = new Object[] { getSourceType(), targetClass, value};
            throw new TransformationException(CorePlugin.Util.getString("ObjectToAnyTransform.Invalid_value", params)); //$NON-NLS-1$
        }
       
        try {
            return transform.transform(value);   
        } catch (TransformationException e) {
            Object[] params = new Object[] { getSourceType(), targetClass, value};
            throw new TransformationException(e, CorePlugin.Util.getString("ObjectToAnyTransform.Invalid_value", params)); //$NON-NLS-1$
        }
    }
View Full Code Here

Examples of org.xith3d.scenegraph.Transform

         */
        Texture nuages = ResBag.getTexture(ResourceNames.NUAGES);
        this.addChild(new RectBillboard(nuages, 8f * 15f,
                6f * 15f, ZeroPointLocation.CENTER_CENTER, -30f));
        Texture soleil = ResBag.getTexture(ResourceNames.SOLEIL);
        this.addChild(new Transform(new RectBillboard(soleil,
                8f * 2f, 6f * 2f, ZeroPointLocation.BOTTOM_CENTER, -25f))
                .setTranslationZ(13f));
       
        /*
         * Terrain
 
View Full Code Here

Examples of soot.Transform

        }
      }
     
      if(!registeredTransformation) {
        registeredTransformation=true;
        PackManager.v().getPack("wjap").add(new Transform("wjap.guards",new SceneTransformer() {
         
          @Override
          protected void internalTransform(String phaseName, Map options) {
            for (Guard g : guards) {
              insertGuard(g);
View Full Code Here

Examples of us.b3k.kafka.ws.transforms.Transform

    private final ExecutorService executorService = Executors.newCachedThreadPool();
    private final Properties configProps;
    private final Transform outputTransform;

    static public KafkaConsumerFactory create(Properties configProps, Class outputTransformClass) throws IllegalAccessException, InstantiationException {
        Transform outputTransform = (Transform)outputTransformClass.newInstance();
        outputTransform.initialize();
        return new KafkaConsumerFactory(configProps, outputTransform);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.