ilog.cpl.graphic.views
Class IlpShelfItemPosition

java.lang.Object
  extended by ilog.cpl.graphic.views.IlpShelfItemPosition
All Implemented Interfaces:
IlpPosition, Cloneable
Direct Known Subclasses:
IltShelfItemPosition

public class IlpShelfItemPosition
extends Object
implements IlpPosition, Cloneable

Implements the relative position of a card item within a shelf in the network or equipment component.

Since:
JTGO 3.0

Constructor Summary
IlpShelfItemPosition()
          Creates a new position.
IlpShelfItemPosition(IlpShelfItemPosition pos)
          Copies a position.
IlpShelfItemPosition(IlvRect rect)
          Creates a new position by copying an existing one.
IlpShelfItemPosition(int slotX, int slotY)
          Creates a new position with a default span.
IlpShelfItemPosition(int slotX, int slotY, float spanX, float spanY)
          Creates a new position based on given information.
 
Method Summary
 Object clone()
          Creates and returns a copy of a given IlpShelfItemPosition object.
 boolean equals(Object pos)
          Compares the position to the given object.
 int getSlotIndex()
          Deprecated. Please use getXIndex instead.
 float getSlotSpan()
          Deprecated. Please use getXSpan instead.
 int getXIndex()
          Retrieves the xIndex attribute.
 float getXSpan()
          Retrieves the xSpan attribute.
 int getYIndex()
          Retrieves the yIndex attribute.
 float getYSpan()
          Retrieves the ySpan attribute.
 int hashCode()
           
 void setXIndex(int index)
          Sets the xIndex attribute.
 void setXSpan(float span)
          Sets the xSpan attribute.
 void setYIndex(int index)
          Sets the yIndex attribute.
 void setYSpan(float span)
          Sets the ySpan attribute.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlpShelfItemPosition

public IlpShelfItemPosition()
Creates a new position. The position is (0,0) and the spanX and spanY are 1.


IlpShelfItemPosition

public IlpShelfItemPosition(IlpShelfItemPosition pos)
Copies a position.

Parameters:
pos - The position to be copied.

IlpShelfItemPosition

public IlpShelfItemPosition(int slotX,
                            int slotY)
Creates a new position with a default span.

. The spanX and spanY are 1.

Parameters:
slotX - The slot index for the X axis.
slotY - The slot index for the Y axis.

IlpShelfItemPosition

public IlpShelfItemPosition(int slotX,
                            int slotY,
                            float spanX,
                            float spanY)
Creates a new position based on given information.

A shelf is composed of a matrix of slots. When a shelf item occupies a part of a slot or more than one slot, it can be positioned by reference to the matrix. The shelf item position gives the indexes for the matrix and how many slots are occupied through X and Y axes.

For example, if spanX == 1, the shelf item occupies one slot only along the X axis. If spanY == 2, the shelf item occupies 2 slots along the Y axis. Using these parameters, you could also position an item to occupy half a slot.

Parameters:
slotX - The slot index for the X axis.
slotY - The slot index for the Y axis.
spanX - The span in the matrix in the X orientation of the slots.
spanY - The span in the matrix in the Y orientation of the slots.

IlpShelfItemPosition

public IlpShelfItemPosition(IlvRect rect)
Creates a new position by copying an existing one.

The position to be copied is given in a rectangle where the x coordinate corresponds to slotX; the y coordinate corresponds to slotY; the width corresponds to spanX and the height corresponds to spanY.

Parameters:
rect - The copied position.
Method Detail

getXIndex

public int getXIndex()
Retrieves the xIndex attribute.

Returns:
The xIndex attribute.

setXIndex

public void setXIndex(int index)
Sets the xIndex attribute.

Parameters:
index - The new value for the xIndex attribute.

getYIndex

public int getYIndex()
Retrieves the yIndex attribute.

Returns:
The yIndex attribute.

setYIndex

public void setYIndex(int index)
Sets the yIndex attribute.

Parameters:
index - The new value for the yIndex attribute.

getXSpan

public float getXSpan()
Retrieves the xSpan attribute.

Returns:
The xSpan attribute.

setXSpan

public void setXSpan(float span)
Sets the xSpan attribute.

Parameters:
span - The new value for xSpan attribute.

getYSpan

public float getYSpan()
Retrieves the ySpan attribute.

Returns:
The ySpan attribute.

setYSpan

public void setYSpan(float span)
Sets the ySpan attribute.

Parameters:
span - The new value for the ySpan attribute.

clone

public Object clone()
Creates and returns a copy of a given IlpShelfItemPosition object.

Overrides:
clone in class Object
Returns:
A new instance of IlpShelfItemPosition that represents the same shelf item position as the given object.

equals

public boolean equals(Object pos)
Compares the position to the given object.

The result is true only if the argument is not null and is an IlpShelfItemPosition or an IlvRect object that represents the same shelf position as this object.

Overrides:
equals in class Object
Parameters:
pos - The object to compare IlpShelfItemPosition against.
Returns:
true if the positions are equal; otherwise, false.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getSlotIndex

public int getSlotIndex()
Deprecated. Please use getXIndex instead.

Returns the slot number indicating the position of an item in an IlpShelfItemContainer.

Deprecated Since:
JTGO 3.0

getSlotSpan

public float getSlotSpan()
Deprecated. Please use getXSpan instead.

Returns the float value representing the number of slots across which an item spans in an IlpShelfItemContainer.

Deprecated Since:
JTGO 3.0

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.