Half-commit. Not finished.
package horaris;
public class Tempo
{
String s;
public int horoj;
public int minutoj;
public Tempo(String _komenco, String _fino, String _komencoloko,
String _finoloko, Vector komentoj)
{
fromStr(_s);
}
private void fromStr(String _s)
{
s = _s;
int colon = s.indexOf(':');
horoj = Integer.parseInt(s.substring(0,colon));
minutoj = Integer.parseInt(s.substring(colon+1));
}
/* 1: this later than t2
* 0: this equal to t2
* -1: this earlier than t2 */
public int compareTo(Tempo t2)
{
if (horoj > t2.horoj)
return 1;
else if (horoj == t2.horoj && minutoj > t2.minutoj)
return 1;
else if (horoj == t2.horoj && minutoj == t2.minutoj)
return 0;
else
return -1;
}
public String toString()
{
return s;
}
}