|
From: Carlos <ma...@us...> - 2007-11-07 23:40:47
|
Update of /cvsroot/tail/Tail/src/java/net/sf/tail In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21707/src/java/net/sf/tail Modified Files: Tick.java TimeSeries.java Log Message: Refatoracao necessaria para o Forex... Index: Tick.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/Tick.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Tick.java 24 Sep 2007 18:14:29 -0000 1.20 --- Tick.java 7 Nov 2007 23:40:48 -0000 1.21 *************** *** 3,147 **** import org.joda.time.DateTime; ! /** ! * Contém todos os possÃveis atributos registrados de uma detrminada ação em um ! * único perÃodo de tempo. ! * ! * @author Marcio ! * ! */ ! public class Tick { ! ! private DateTime date; ! ! private double openPrice; ! ! private double closePrice; ! ! private double maxPrice; ! ! private double minPrice; ! ! private double variation; ! ! private double previousPrice; ! ! private double amount; ! ! private double volume; ! ! private int trades; ! ! public Tick(double closePrice) { ! super(); ! this.closePrice = closePrice; ! } ! ! public Tick(DateTime data, double closePrice) { ! super(); ! this.closePrice = closePrice; ! this.date = data; ! } ! ! public Tick(DateTime data, double openPrice, double closePrice, double maxPrice, double minPrice, double variation, ! double previousPrice, double amount, double volume, int trades) { ! super(); ! this.date = data; ! this.openPrice = openPrice; ! this.closePrice = closePrice; ! this.maxPrice = maxPrice; ! this.minPrice = minPrice; ! this.variation = variation; ! this.previousPrice = previousPrice; ! this.amount = amount; ! this.volume = volume; ! this.trades = trades; ! } ! ! public Tick(double openPrice, double closePrice, double maxPrice, double minPrice) { ! super(); ! this.openPrice = openPrice; ! this.closePrice = closePrice; ! this.maxPrice = maxPrice; ! this.minPrice = minPrice; ! } ! ! public Tick(double d, DateTime dateTime) { ! this.closePrice = d; ! this.date = dateTime; ! } ! ! public double getClosePrice() { ! return closePrice; ! } ! ! public double getOpenPrice() { ! return openPrice; ! } ! ! public int getTrades() { ! return trades; ! } ! ! public double getMaxPrice() { ! return maxPrice; ! } ! ! public double getAmount() { ! return amount; ! } ! ! public double getVolume() { ! return volume; ! } ! ! @Override ! public boolean equals(Object obj) { ! if (obj instanceof Tick) { ! Tick tick = (Tick) obj; ! return (hashCode() == tick.hashCode() && (variation == tick.getVariation()) && (closePrice == tick ! .getClosePrice())) ! && (date.equals(tick.getDate())) ! && (maxPrice == tick.getMaxPrice()) ! && (minPrice == tick.getMinPrice()) ! && (openPrice == tick.getOpenPrice()) ! && (previousPrice == getPreviousPrice()) ! && (trades == tick.getTrades()) ! && (amount == tick.getAmount()) && (volume == tick.getVolume()); ! } ! return false; ! } ! ! @Override ! public int hashCode() { ! return 7 * date.hashCode(); ! } ! ! public double getVariation() { ! return variation; ! } ! ! public double getMinPrice() { ! return minPrice; ! } ! ! public double getPreviousPrice() { ! return previousPrice; ! } ! ! public DateTime getDate() { ! return date; ! } ! ! @Override ! public String toString() { ! return String.format("[time: %1$td/%1$tm/%1$tY %1$tH:%1$tM:%1$tS, close price: %2$f]", date ! .toGregorianCalendar(), closePrice); ! } ! public String getDateName() { ! return this.date.toString("hh:mm dd/MM/yyyy"); ! } ! public String getSimpleDateName() { ! return this.date.toString("dd/MM/yyyy"); ! } ! } --- 3,18 ---- import org.joda.time.DateTime; ! public interface Tick { ! public DateTime getDate(); ! public String getDateName(); ! public String getSimpleDateName(); ! public double getClosePrice(); ! public double getOpenPrice(); ! public int getTrades(); ! public double getMaxPrice(); ! public double getAmount(); ! public double getVolume(); ! public double getVariation(); ! public double getMinPrice(); ! public double getPreviousPrice(); } Index: TimeSeries.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/TimeSeries.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TimeSeries.java 17 Oct 2007 23:23:35 -0000 1.11 --- TimeSeries.java 7 Nov 2007 23:40:48 -0000 1.12 *************** *** 1,9 **** package net.sf.tail; import org.joda.time.Period; /** ! * Time Series é um conjunto de {@link Tick} ordenados por um determinado * perÃodo temporal. * --- 1,11 ---- package net.sf.tail; + import net.sf.tail.tick.DefaultTick; + import org.joda.time.Period; /** ! * Time Series é um conjunto de {@link DefaultTick} ordenados por um determinado * perÃodo temporal. * |