com.threerings.whirled.spot.data

## Class Portal

- java.lang.Object
- - com.threerings.io.SimpleStreamableObject
  - - com.threerings.whirled.spot.data.Portal

All Implemented Interfaces:
  com.threerings.io.Streamable, Cloneable

Direct Known Subclasses:
  EditablePortal

    public class Portal
    extends com.threerings.io.SimpleStreamableObject
    implements Cloneable

Represents an exit to another scene. A body sprite would walk over to a portal's coordinates and then either proceed off of the edge of the display, or open a door and walk through it, or fizzle away in a Star Trekkian transporter style or whatever is appropriate for the game in question. It contains information on the scene to which the body exits when using this portal and the location at which the body sprite should appear in that target scene.

### Nested Class Summary

### Nested classes/interfaces inherited from interface com.threerings.io.Streamable

`com.threerings.io.Streamable.Closure`

### Field Summary

Fields
`Location` `loc` The location of the portal.
`short` `portalId` This portal's unique identifier.
`short` `targetPortalId` The portal identifier of the portal at which a body will enter the target scene when they "use" this portal, or -1 to specify that the body enters on the default portal, whatever id it is.
`int` `targetSceneId` The scene identifier of the scene to which a body will exit when they "use" this portal.

### Constructor Summary

Constructors
Constructor and Description
`Portal()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Portal` `clone()`
`boolean` `equals(Object other)` Portal equality is determined by portal id.
`Location` `getLocation()` Returns a location instance configured with the location and orientation of this portal.
`Location` `getOppLocation()` Returns a location instance configured with the location and opposite orientation of this portal.
`int` `hashCode()` Computes a reasonable hashcode for portal instances.
`boolean` `isValid()` Returns true if the portal has a potentially valid target scene and portal id (they are not guaranteed to exist, but they are at least potentially valid values rather than -1 or 0).

### Methods inherited from class com.threerings.io.SimpleStreamableObject

`toString`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### portalId

    public short portalId

This portal's unique identifier.

#### loc

    public Location loc

The location of the portal. This field is present on client and server, it is streamed specially.

#### targetSceneId

    public int targetSceneId

The scene identifier of the scene to which a body will exit when they "use" this portal.

#### targetPortalId

    public short targetPortalId

The portal identifier of the portal at which a body will enter the target scene when they "use" this portal, or -1 to specify that the body enters on the default portal, whatever id it is.

### Constructor Detail

#### Portal

    public Portal()

### Method Detail

#### getLocation

    public Location getLocation()

Returns a location instance configured with the location and orientation of this portal.

#### getOppLocation

    public Location getOppLocation()

Returns a location instance configured with the location and opposite orientation of this portal. This is useful for when a body is entering a scene at a portal and we want them to face the opposite direction (as they are entering via the portal rather than leaving, which is the natural "orientation" of a portal).

#### isValid

    public boolean isValid()

Returns true if the portal has a potentially valid target scene and portal id (they are not guaranteed to exist, but they are at least potentially valid values rather than -1 or 0).

#### clone

    public Portal clone()

Overrides:
  `clone` in class `Object`

#### equals

    public boolean equals(Object other)

Portal equality is determined by portal id.

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Computes a reasonable hashcode for portal instances.

Overrides:
  `hashCode` in class `Object`