Class AbstractHighwayMatrix
java.lang.Object
com._1c.g5.v8.dt.common.gef.drow2d.AbstractHighwayMatrix
- All Implemented Interfaces:
IHighwayMatrix
- Direct Known Subclasses:
HighwayMatrix
,HighwayMatrixWave
Base implemention of the
IHighwayMatrix
. Do not contain the search logic.
Uses the List
as collection of the highways and position on list as identifier.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractHighwayMatrix
(List<Highway> highways) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
addHighway
(Highway highway) Creates new HighwayPtr using specifiedhighway
and adds it to the end of highway pointers list.getHighway
(int index) Returns the highway at the specified position in list.protected AbstractHighwayMatrix.HighwayPtr
getHighwayPtr
(int index) Returns the highway pointer at the specified position in list.Gets the highways iteratorint
getIdentifier
(Highway highway) Returns the index of the specifiedhighway
, or -1 if highways list does not contain the element.protected int
getIndex
(AbstractHighwayMatrix.HighwayPtr highway) Returns the index of the specifiedhighway
pointerprotected org.eclipse.draw2d.geometry.PointList
getPoints
(int[] path, org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end) Creates the points list using specifiedpath
.protected int
getSize()
Gets the size of the highways listremoveHighway
(int index) Removes the highway pointer at the specified position in the highway pointers listMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com._1c.g5.v8.dt.common.gef.drow2d.IHighwayMatrix
getPath
-
Constructor Details
-
AbstractHighwayMatrix
Constructor. Creates the instance using list of the highways.- Parameters:
highways
- - highways list- See Also:
-
-
Method Details
-
addHighway
Creates new HighwayPtr using specifiedhighway
and adds it to the end of highway pointers list.- Specified by:
addHighway
in interfaceIHighwayMatrix
- Parameters:
highway
- - the highway to be added to this matrix- Returns:
- the index of the highway to be added
-
removeHighway
Removes the highway pointer at the specified position in the highway pointers list- Specified by:
removeHighway
in interfaceIHighwayMatrix
- Parameters:
index
- - the index of the highway to be removed- Returns:
- the highway that was removed from the matrix
-
getPoints
protected org.eclipse.draw2d.geometry.PointList getPoints(int[] path, org.eclipse.draw2d.geometry.Point start, org.eclipse.draw2d.geometry.Point end) Creates the points list using specifiedpath
.- Parameters:
path
- - array of the highways indexesstart
- - start point (first element on the returned points list)end
- - end point (last element on the returned points list)- Returns:
- the points list
-
getHighways
Gets the highways iterator- Specified by:
getHighways
in interfaceIHighwayMatrix
- Returns:
- the highways iterator
-
getSize
protected int getSize()Gets the size of the highways list- Returns:
- the size of the highways list
-
getHighway
Returns the highway at the specified position in list.- Specified by:
getHighway
in interfaceIHighwayMatrix
- Parameters:
index
- - index of the highway to return- Returns:
- the highway at the specified position in this list
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getSize())
-
getIdentifier
Returns the index of the specifiedhighway
, or -1 if highways list does not contain the element.- Specified by:
getIdentifier
in interfaceIHighwayMatrix
- Parameters:
highway
- - element to search for- Returns:
- the index of the specified
highway
, or -1 if highways list does not contain the element. - Throws:
NullPointerException
- if the specified element isnull
-
getHighwayPtr
Returns the highway pointer at the specified position in list.- Parameters:
index
- - index of the highway to return- Returns:
- the highway pointer at the specified position in this list
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getSize())- See Also:
-
getIndex
Returns the index of the specifiedhighway
pointer- Parameters:
highway
- - element to search for- Returns:
- the index of the specified
highway
pointer - Throws:
NullPointerException
- if the specified element isnull
-