Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gui.utils.Host.java

Here you can find all the information about the file org.dgpf.gui.utils.Host.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Lado Kumsiashvili
 * 
 * E-Mail           : lado@student.uni-kassel.de
 * Creation Date    : Jul 22, 2006 2:54:04 PM
 * Original Filename: org.dgpf.gui.DGPFHost.java
 * Version          : 1.0
 * Last modification: Jul 22, 2006
 * Last modified by : Lado Kumsiashvili
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */


package org.dgpf.gui.utils;

/**
 * Represents a single Host with hostname, port number and description. It
 * cann also validate hostname number and port range.
 * 
 * @author Lado Kumsiashvili
 */

public class Host
  {

  /**
   * Hostname.
   */

  private String m_hostname;

  /**
   * Host port number.
   */

  private int    m_port;

  /**
   * Host description.
   */

  private String m_description;

  /**
   * Class constructor.
   * 
   * @param p_hostname
   *          hostname.
   * @param p_port
   *          port to set.
   * @param p_description
   *          description of host to set. can be null.
   */

  public Host(String p_hostname, int p_port, String p_description)
    {
    this.m_hostname = p_hostname;
    this.m_port = p_port;
    if(p_description != null)
      this.m_description = p_description;
    else
      this.m_description = "";
    }

  /**
   * Getter for description.
   * 
   * @return host description.
   */

  public String getDescription()
    {
    return this.m_description;
    }

  /**
   * Setter for description
   * 
   * @param p_description Description to set.
   */

  public void setDescription(String p_description)
    {
    this.m_description = p_description;
    }

  /**
   * Getter for hostname.
   * 
   * @return hostname
   */

  public String getHostname()
    {
    return this.m_hostname;
    }

  /**
   * Setter for hostname.
   * 
   * @param p_hostname
   *          The hostname to set.
   */

  public void setHostname(String p_hostname)
    {
    this.m_hostname = p_hostname;
    }

  /**
   * Getter for port.
   * 
   * @return port Port of the host.
   */

  public int getPort()
    {
    return this.m_port;
    }

  /**
   * Setter for port
   * 
   * @param p_port The Port to set.
   */

  public void setPort(int p_port)
    {
    this.m_port = p_port;
    }

  /**
   * Overrides toString method from Object. Return a host in this format
   * hostname:port [description] return host.
   * 
   * @see java.lang.Object#toString()
   */

  @Override
  public String toString()
    {
    String host = this.m_hostname + ":" + this.m_port;
    if(this.m_description.equals("") == false)
      host += " (" + this.m_description + ")";
    return host;
    }

  /**
   * Checks if both hosts are equal considering hostname and port.
   * 
   * @param p_host
   *          ist the other host to compare with.
   * @return <code>true</code> if the hosts are equal, else
   *         <code>false</code>.
   */

  public boolean equals(Host p_host)
    {
    if(this.m_hostname.equals(p_host.getHostname())
        && this.m_port == p_host.getPort())
      {
      return true;
      }
          return false;
     }

  }

File Information:

file name:Host.java
package:org.dgpf.gui.utils
qualified name:org.dgpf.gui.utils.Host.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gui/utils/Host.java
size:3.709 KB (3799 B)
uploaded: 2015-07-22 04:10:59 GMT+0000
last update: 2006-09-24 23:47:04 GMT+0000
last access: 2017-11-20 19:11:37 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2017-11-20 19:11:37 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo