# Class DragEvent

java.lang.Object
com.sparshui.common.messages.events.DragEvent

All Implemented Interfaces:
  `Event, Serializable`

public class DragEvent extends Object implements Event

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`DragEvent()`
`DragEvent(byte[] data)`
Constructs a dragEvent from a complete serialized version of the drag event.
`DragEvent(float dx, float dy, int nPoints, long time)`

## Method Summary

Modifier and Type
Method
Description
`float`
`getDx()`
`float`
`getDy()`
`int`
`getEventType()`
Returns the integer value of this event type.
`int`
`getNPoints()`
`long`
`getTime()`
`byte[]`
`serialize()`
Constructs the data packet with this event data.
`void`
`setDx(float dx)`
`void`
`setDy(float dy)`
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DragEvent

public DragEvent()

### DragEvent

public DragEvent(float dx, float dy, int nPoints, long time)

### DragEvent

public DragEvent(byte[] data)
Constructs a dragEvent from a complete serialized version of the drag event. - 4 bytes : dx - 4 bytes : dy - 1 byte: nPoints - 8 bytes : time -17 bytes total

Parameters:
  `data` - The byte array that represents a serialized Drag Event.

## Method Details

### getTime

public long getTime()

### getNPoints

public int getNPoints()

### getDx

public float getDx()

### getDy

public float getDy()

### setDx

public void setDx(float dx)

### setDy

public void setDy(float dy)

### getEventType

public int getEventType()
Description copied from interface: `Event`
Returns the integer value of this event type. Event type values are defined in the enumeration com.sparshui.common.messages.events.EventType.java

Specified by:
  `getEventType` in interface `Event`
Returns:
  The event type

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### serialize

public byte[] serialize()
Constructs the data packet with this event data. Message format for this event: - 4 bytes : EventType - 4 bytes : dx - 4 bytes : dy - 1 byte : nPoints - 8 bytes : time - 21 bytes total

Specified by:
  `serialize` in interface `Event`
Returns:
  serialized data