nog
Class Participants

java.lang.Object
  |
  +--nog.Participants

public class Participants
extends java.lang.Object

Contains a number of participants.


Field Summary
 java.lang.String statistics_
           
 
Constructor Summary
Participants()
          Default constructor.
Participants(Participants p)
          Constructor wich creats a copy of the Participants.
Participants(java.lang.String filename)
          Constructor with the filename as a String as input.
 
Method Summary
 boolean addPart(java.lang.String pString)
          Adds a participant to Participants.
 void clearPart()
          Removes all the participants.
 java.lang.String get_filename()
          Returns the filename of the file.
 java.util.Hashtable get_ht()
          Returns the Harstable.
 int getCnt()
          Retrurn the number of participants in Participants.
 java.lang.String getFirstParticipant()
          Returns the participant with nr nr.
 java.lang.String getLastParticipant(java.lang.String nr)
          Returns the participant before nr nr.
 java.lang.String getNextParticipant(java.lang.String nr)
          Returns the Next participant after nr nr.
static void main(java.lang.String[] args)
          Main, opens the "part.txt" file and calculates statistics.
 void saveFile()
          Stores the file.
 void saveFile(java.lang.String filename)
          Stores the file with a new filename.
 void stat_all()
          Starts the calculation of the statistics.
 int stat_country(java.lang.String s)
          Returns the share of that specific country.
 double stat_female()
          Returns the share of female in %.
 double stat_height()
          Returns the average height.
 double stat_men()
          Returns the share of men in %.
 int stat_sport(java.lang.String s)
          Returns the share of that specific sport.
 double stat_weight()
          Returns the average weight.
 java.lang.String Stat()
          Calculates the statistics and returns it as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statistics_

public java.lang.String statistics_
Constructor Detail

Participants

public Participants()
Default constructor. Opens the "part.txt" file.

Participants

public Participants(Participants p)
Constructor wich creats a copy of the Participants.
Parameters:
p - the Participants to copy.

Participants

public Participants(java.lang.String filename)
Constructor with the filename as a String as input.
Parameters:
filename - the filename to open.
Method Detail

get_filename

public java.lang.String get_filename()
Returns the filename of the file.
Returns:
the filename.

get_ht

public java.util.Hashtable get_ht()
Returns the Harstable.
Returns:
the Harstable.

getFirstParticipant

public java.lang.String getFirstParticipant()
Returns the participant with nr nr.
Parameters:
nr - the Number of the participant.
Returns:
the participant as a String or null if it doesn't exists.

getNextParticipant

public java.lang.String getNextParticipant(java.lang.String nr)
Returns the Next participant after nr nr.
Parameters:
nr - the Number of the participant.
Returns:
the participant After nr as a String or null if it doesn't exists.

getLastParticipant

public java.lang.String getLastParticipant(java.lang.String nr)
Returns the participant before nr nr.
Parameters:
nr - the Number of the participant.
Returns:
the participant Before nr as a String or null if it doesn't exists.

stat_height

public double stat_height()
Returns the average height.
Returns:
the average height.

stat_weight

public double stat_weight()
Returns the average weight.
Returns:
the average weight.

stat_men

public double stat_men()
Returns the share of men in %.
Returns:
the share of men in %.

stat_female

public double stat_female()
Returns the share of female in %.
Returns:
the share of female in %.

stat_country

public int stat_country(java.lang.String s)
Returns the share of that specific country.
Parameters:
s - the country to get statistic about.
Returns:
the share of that specific country.

stat_sport

public int stat_sport(java.lang.String s)
Returns the share of that specific sport.
Parameters:
s - the sport to get statistic about.
Returns:
the share of that specific sport.

stat_all

public void stat_all()
Starts the calculation of the statistics.

Stat

public java.lang.String Stat()
Calculates the statistics and returns it as a String.
Returns:
the statistics as a String.

getCnt

public int getCnt()
Retrurn the number of participants in Participants.
Returns:
the number of participants.

addPart

public boolean addPart(java.lang.String pString)
Adds a participant to Participants.
Parameters:
pString - the informtaion about the participant.
Returns:
true if ok, false if something got wrong.

clearPart

public void clearPart()
Removes all the participants.

saveFile

public void saveFile(java.lang.String filename)
Stores the file with a new filename.
Parameters:
filename - the new filename.

saveFile

public void saveFile()
Stores the file.

main

public static void main(java.lang.String[] args)
Main, opens the "part.txt" file and calculates statistics.