Package org.onosproject.ui.topo
Class LayoutLocation
- java.lang.Object
-
- org.onosproject.ui.topo.LayoutLocation
-
public final class LayoutLocation extends java.lang.ObjectRepresents a "node location" on a UI layout.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLayoutLocation.TypeDesignates the type of location; either geographic or logical grid.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.List<LayoutLocation>fromCompactListString(java.lang.String compactList)Returns a list of layout locations from a compact string representation.static LayoutLocationfromCompactString(java.lang.String s)Produces a layout location instance from a compact string representation.java.lang.Stringid()Returns the identifier associated with this location.booleanisOrigin()Returns true if the coordinates indicate the origin (0, 0) of the coordinate system; false otherwise.doublelatOrY()Returns the latitude (geo) or y-coord (grid) data value.static LayoutLocationlayoutLocation(java.lang.String id, java.lang.String locType, double latOrY, double longOrX)Creates an instance of a layout location.static LayoutLocationlayoutLocation(java.lang.String id, LayoutLocation.Type locType, double latOrY, double longOrX)Creates an instance of a layout location.LayoutLocation.TypelocType()Returns the location type (geo or grid), which indicates how the data is to be interpreted.doublelongOrX()Returns the longitude (geo) or x-coord (grid) data value.java.lang.StringtoCompactListString()Produces a compact string representation of this instance.static java.lang.StringtoCompactListString(java.util.List<LayoutLocation> locs)Produces a compact encoding of a list of layout locations.static java.lang.StringtoCompactListString(LayoutLocation... locs)Produces a compact encoding of a list of layout locations.java.lang.StringtoString()
-
-
-
Method Detail
-
isOrigin
public boolean isOrigin()
Returns true if the coordinates indicate the origin (0, 0) of the coordinate system; false otherwise.- Returns:
- true if geo-coordinates are set; false otherwise
-
id
public java.lang.String id()
Returns the identifier associated with this location.- Returns:
- the identifier
-
locType
public LayoutLocation.Type locType()
Returns the location type (geo or grid), which indicates how the data is to be interpreted.- Returns:
- location type
-
latOrY
public double latOrY()
Returns the latitude (geo) or y-coord (grid) data value.- Returns:
- geo latitude or grid y-coord
-
longOrX
public double longOrX()
Returns the longitude (geo) or x-coord (grid) data value.- Returns:
- geo longitude or grid x-coord
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toCompactListString
public java.lang.String toCompactListString()
Produces a compact string representation of this instance.- Returns:
- compact string rep
-
fromCompactString
public static LayoutLocation fromCompactString(java.lang.String s)
Produces a layout location instance from a compact string representation.- Parameters:
s- the compact string- Returns:
- a corresponding instance
-
toCompactListString
public static java.lang.String toCompactListString(LayoutLocation... locs)
Produces a compact encoding of a list of layout locations.- Parameters:
locs- array of layout location instances- Returns:
- string encoding
-
toCompactListString
public static java.lang.String toCompactListString(java.util.List<LayoutLocation> locs)
Produces a compact encoding of a list of layout locations.- Parameters:
locs- list of layout location instances- Returns:
- string encoding
-
fromCompactListString
public static java.util.List<LayoutLocation> fromCompactListString(java.lang.String compactList)
Returns a list of layout locations from a compact string representation.- Parameters:
compactList- string representation- Returns:
- corresponding list of layout locations
-
layoutLocation
public static LayoutLocation layoutLocation(java.lang.String id, LayoutLocation.Type locType, double latOrY, double longOrX)
Creates an instance of a layout location.- Parameters:
id- an identifier for the item at this locationlocType- the location typelatOrY- geo latitude / grid y-coordlongOrX- geo longitude / grid x-coord- Returns:
- layout location instance
-
layoutLocation
public static LayoutLocation layoutLocation(java.lang.String id, java.lang.String locType, double latOrY, double longOrX)
Creates an instance of a layout location.- Parameters:
id- an identifier for the item at this locationlocType- the location type ("geo" or "grid")latOrY- geo latitude / grid y-coordlongOrX- geo longitude / grid x-coord- Returns:
- layout location instance
- Throws:
java.lang.IllegalArgumentException- if the type is not "geo" or "grid"
-
-