medisyn
Class X2XProxy

java.lang.Object
  extended by main.MapComponent
      extended by main.Node
          extended by medisyn.X2XProxy
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<X2XProxy>

public class X2XProxy
extends Node
implements java.lang.Cloneable, java.lang.Comparable<X2XProxy>

Represents one proxy which can be used in scenarios and experiments

Author:
Leo Bosnjak

Field Summary
private  java.lang.String hostName
           
private  int[] ipIntArr
           
private  boolean isLeader
           
private  int nrOfFiles
           
private  ProxyGroup proxyGroup
           
private  java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles
           
private  java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles2
           
 
Fields inherited from class main.Node
defaultColor, sizeSmall, SLICE_NODE_PREFIX
 
Constructor Summary
X2XProxy()
          construct a new X2XProxy
X2XProxy(Node n)
          construct a new X2XProxy with the values of a Node
 
Method Summary
 double calcAbsCategoryFreq(FileCategory cat)
          calculates the absolute frequency of files of the FileCategory cat on this proxy TODO: change this according to formula in X2X-paper (playbackTime)
 double calcCategoryFreq(FileCategory cat)
          calculates the relative frequency of files of the FileCategory cat on this proxy TODO: change this according to formula in X2X-paper (playbackTime)
 X2XProxy clone()
          clones the object
 X2XProxy clone2()
          clones the object without the videoFiles2
 int compareTo(X2XProxy other)
          Compares this instance of X2XProxy with the specified instance.
 boolean equals(Node other)
          is other Node equal to this one?
 boolean equals(java.lang.Object other)
          is other Object equal to this one?
 boolean equals(X2XProxy other)
          is other X2XProxy equal to this one?
 FileCategory getBestCat(java.util.Vector<FileCategory> fileCategories)
          find out the best semantic category for this proxy
 java.lang.String getHostName()
           
 int[] getIpIntArr()
           
 int getNrOfFiles()
           
 ProxyGroup getProxyGroup()
           
 java.util.Hashtable<java.lang.Integer,VideoFile> getVideoFiles()
           
 java.util.Hashtable<java.lang.Integer,VideoFile> getVideoFiles2()
           
 boolean isLeader()
           
 void setHostName(java.lang.String hostName)
          sets the hostname of this X2XProxy and of the parent object (Node)
 void setIpIntArr(int[] ip)
           
 void setLeader(boolean isLeader)
           
 void setNrOfFiles(int nrOfFiles)
           
 void setProxyGroup(ProxyGroup proxyGroup)
           
 void setVideoFiles(java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles)
           
 void setVideoFiles2(java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles2)
           
 java.lang.String toString()
          return String-representation of object
 void updateNodeData(Node n)
          update the data of this proxy according to the given node
 
Methods inherited from class main.Node
copyValuesToNode, getCity, getColor, getCountry, getHostname, getId, getIp, getPosition, getRegion, getSize, isSliceNode, setCity, setColor, setCountry, setHostname, setId, setIp, setPosition, setRegion, setSize, setSliceNode
 
Methods inherited from class main.MapComponent
getWeightColor, getWeightSize, setWeightColor, setWeightSize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ipIntArr

private int[] ipIntArr

hostName

private java.lang.String hostName

nrOfFiles

private int nrOfFiles

videoFiles

private java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles

videoFiles2

private java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles2

proxyGroup

private ProxyGroup proxyGroup

isLeader

private boolean isLeader
Constructor Detail

X2XProxy

public X2XProxy()
construct a new X2XProxy


X2XProxy

public X2XProxy(Node n)
construct a new X2XProxy with the values of a Node

Parameters:
n - - the node to take the values from
Method Detail

getIpIntArr

public int[] getIpIntArr()
Returns:
the ipIntArr - four integers containing the ip-address of the node

setIpIntArr

public void setIpIntArr(int[] ip)
Parameters:
ip - - the ipIntArr to set

getNrOfFiles

public int getNrOfFiles()
Returns:
the nrOfFiles

setNrOfFiles

public void setNrOfFiles(int nrOfFiles)
Parameters:
nrOfFiles - the nrOfFiles to set

toString

public java.lang.String toString()
return String-representation of object

Overrides:
toString in class Node
Returns:
a string representation of this Node

updateNodeData

public void updateNodeData(Node n)
update the data of this proxy according to the given node

Parameters:
n - - Node to take the data from

calcCategoryFreq

public double calcCategoryFreq(FileCategory cat)
calculates the relative frequency of files of the FileCategory cat on this proxy TODO: change this according to formula in X2X-paper (playbackTime)


getBestCat

public FileCategory getBestCat(java.util.Vector<FileCategory> fileCategories)
                        throws java.lang.Exception
find out the best semantic category for this proxy

Returns:
FileCategory - the proxies semantic file category
Throws:
java.lang.Exception

calcAbsCategoryFreq

public double calcAbsCategoryFreq(FileCategory cat)
calculates the absolute frequency of files of the FileCategory cat on this proxy TODO: change this according to formula in X2X-paper (playbackTime)


clone

public X2XProxy clone()
               throws java.lang.CloneNotSupportedException
clones the object

Overrides:
clone in class Node
Throws:
java.lang.CloneNotSupportedException

clone2

public X2XProxy clone2()
                throws java.lang.CloneNotSupportedException
clones the object without the videoFiles2

Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(X2XProxy other)
is other X2XProxy equal to this one?

Parameters:
other -
Returns:
true if they are equal

equals

public boolean equals(java.lang.Object other)
is other Object equal to this one?

Overrides:
equals in class Node
Parameters:
other -
Returns:
true if they are equal

equals

public boolean equals(Node other)
is other Node equal to this one?

Parameters:
other -
Returns:
true if they are equal

compareTo

public int compareTo(X2XProxy other)
Compares this instance of X2XProxy with the specified instance. Returns a negative integer if this instance comes first in a natural ordering, a positive integer if the specified instance comes first in a natural ordering, or zero if they're equal. Note that comparison is done only by comparing the two hostnames. TODO: Additionaly get the positions of the two instances and compare region, state and city --> nice sorting possible

Specified by:
compareTo in interface java.lang.Comparable<X2XProxy>
Parameters:
other - another instance of X2XProxy
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

getHostName

public java.lang.String getHostName()
Returns:
the hostName

setHostName

public void setHostName(java.lang.String hostName)
sets the hostname of this X2XProxy and of the parent object (Node)

Parameters:
hostName - the hostName to set

getProxyGroup

public ProxyGroup getProxyGroup()
Returns:
the proxyGroup

setProxyGroup

public void setProxyGroup(ProxyGroup proxyGroup)
Parameters:
proxyGroup - the proxyGroup to set

getVideoFiles

public java.util.Hashtable<java.lang.Integer,VideoFile> getVideoFiles()
Returns:
the videoFiles

setVideoFiles

public void setVideoFiles(java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles)
Parameters:
videoFiles - the videoFiles to set

isLeader

public boolean isLeader()
Returns:
the isLeader

setLeader

public void setLeader(boolean isLeader)
Parameters:
isLeader - the isLeader to set

getVideoFiles2

public java.util.Hashtable<java.lang.Integer,VideoFile> getVideoFiles2()

setVideoFiles2

public void setVideoFiles2(java.util.Hashtable<java.lang.Integer,VideoFile> videoFiles2)