Class TSPLIBImporter.Node

  • Enclosing class:
    TSPLIBImporter<V,​E>

    public static class TSPLIBImporter.Node
    extends java.lang.Object
    A node imported from the NODE_COORD_SECTION of a TSPLIB95-file.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double[] coordinates
      The coordinates of this node.
      private int number
      The one based number of this node.
    • Constructor Summary

      Constructors 
      Constructor Description
      Node​(int number, double[] coordinates)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double[] getCoordinates()
      Returns a copy of the coordinates of this node.
      int getCoordinatesLength()
      Returns the number of elements the coordinates of this node have (either two or three).
      double getCoordinateValue​(int i)
      Returns the value of the coordinate element with zero-based index i of this node.
      int getNumber()
      Returns the number of this node as specified in the source TSPLIB95-file.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • number

        private final int number
        The one based number of this node.
      • coordinates

        private final double[] coordinates
        The coordinates of this node.
    • Constructor Detail

      • Node

        Node​(int number,
             double[] coordinates)
    • Method Detail

      • getNumber

        public int getNumber()
        Returns the number of this node as specified in the source TSPLIB95-file.
        Returns:
        the number of this node
      • getCoordinatesLength

        public int getCoordinatesLength()
        Returns the number of elements the coordinates of this node have (either two or three).
        Returns:
        the number of coordinate elements of this node
      • getCoordinateValue

        public double getCoordinateValue​(int i)
        Returns the value of the coordinate element with zero-based index i of this node.
        Parameters:
        i - the index of the coordinate element
        Returns:
        the value of the i-th coordinate element
      • getCoordinates

        public double[] getCoordinates()
        Returns a copy of the coordinates of this node.
        Returns:
        the coordinates of this node
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object