Update of /cvsroot/tail/Tail/src/java/net/sf/tail/strategy In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22072/src/java/net/sf/tail/strategy Modified Files: CombinedBuyAndSellStrategy.java MinValueStarterStrategy.java DistanceBetweenIndicatorsStrategy.java IndicatorOverIndicatorStrategy.java ResistanceStrategy.java StopGainStrategy.java StopLossStrategy.java AndStrategy.java OrStrategy.java IndicatorCrossedIndicatorStrategy.java FakeStrategy.java NotSoFastStrategy.java SupportStrategy.java PipeEnterStrategy.java ParabolicSarAndDMIStrategy.java JustBuyOnceStrategy.java Log Message: Refatoração nos scripts Index: ParabolicSarAndDMIStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/ParabolicSarAndDMIStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ParabolicSarAndDMIStrategy.java 26 Sep 2007 19:24:06 -0000 1.1 --- ParabolicSarAndDMIStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 23,25 **** --- 23,56 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dmiStrategy == null) ? 0 : dmiStrategy.hashCode()); + result = prime * result + ((parabolicStrategy == null) ? 0 : parabolicStrategy.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ParabolicSarAndDMIStrategy other = (ParabolicSarAndDMIStrategy) obj; + if (dmiStrategy == null) { + if (other.dmiStrategy != null) + return false; + } else if (!dmiStrategy.equals(other.dmiStrategy)) + return false; + if (parabolicStrategy == null) { + if (other.parabolicStrategy != null) + return false; + } else if (!parabolicStrategy.equals(other.parabolicStrategy)) + return false; + return true; + } + } Index: MinValueStarterStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/MinValueStarterStrategy.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MinValueStarterStrategy.java 25 Aug 2007 12:30:00 -0000 1.10 --- MinValueStarterStrategy.java 5 Dec 2007 23:22:45 -0000 1.11 *************** *** 37,39 **** --- 37,75 ---- return String.format("%s start: %i", this.getClass().getSimpleName(), start); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((indicator == null) ? 0 : indicator.hashCode()); + long temp; + temp = Double.doubleToLongBits(start); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final MinValueStarterStrategy other = (MinValueStarterStrategy) obj; + if (indicator == null) { + if (other.indicator != null) + return false; + } else if (!indicator.equals(other.indicator)) + return false; + if (Double.doubleToLongBits(start) != Double.doubleToLongBits(other.start)) + return false; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + return true; + } } Index: OrStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/OrStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrStrategy.java 25 Aug 2007 14:04:32 -0000 1.1 --- OrStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 28,30 **** --- 28,61 ---- return String.format("%s or %s",strategy.getName(),strategy2.getName()); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + result = prime * result + ((strategy2 == null) ? 0 : strategy2.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final OrStrategy other = (OrStrategy) obj; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + if (strategy2 == null) { + if (other.strategy2 != null) + return false; + } else if (!strategy2.equals(other.strategy2)) + return false; + return true; + } } Index: FakeStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/FakeStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FakeStrategy.java 7 Nov 2007 22:22:10 -0000 1.1 --- FakeStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- package net.sf.tail.strategy; + import java.util.Arrays; + import net.sf.tail.Operation; *************** *** 29,31 **** --- 31,58 ---- return false; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Arrays.hashCode(enter); + result = prime * result + Arrays.hashCode(exit); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final FakeStrategy other = (FakeStrategy) obj; + if (!Arrays.equals(enter, other.enter)) + return false; + if (!Arrays.equals(exit, other.exit)) + return false; + return true; + } } Index: IndicatorOverIndicatorStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/IndicatorOverIndicatorStrategy.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IndicatorOverIndicatorStrategy.java 25 Aug 2007 12:30:00 -0000 1.8 --- IndicatorOverIndicatorStrategy.java 5 Dec 2007 23:22:45 -0000 1.9 *************** *** 33,35 **** --- 33,66 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((first == null) ? 0 : first.hashCode()); + result = prime * result + ((second == null) ? 0 : second.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final IndicatorOverIndicatorStrategy other = (IndicatorOverIndicatorStrategy) obj; + if (first == null) { + if (other.first != null) + return false; + } else if (!first.equals(other.first)) + return false; + if (second == null) { + if (other.second != null) + return false; + } else if (!second.equals(other.second)) + return false; + return true; + } + } Index: DistanceBetweenIndicatorsStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/DistanceBetweenIndicatorsStrategy.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DistanceBetweenIndicatorsStrategy.java 25 Aug 2007 12:30:00 -0000 1.8 --- DistanceBetweenIndicatorsStrategy.java 5 Dec 2007 23:22:45 -0000 1.9 *************** *** 51,53 **** --- 51,94 ---- .getName()); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + long temp; + temp = Double.doubleToLongBits(difference); + result = prime * result + (int) (temp ^ (temp >>> 32)); + temp = Double.doubleToLongBits(distance); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((lower == null) ? 0 : lower.hashCode()); + result = prime * result + ((upper == null) ? 0 : upper.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final DistanceBetweenIndicatorsStrategy other = (DistanceBetweenIndicatorsStrategy) obj; + if (Double.doubleToLongBits(difference) != Double.doubleToLongBits(other.difference)) + return false; + if (Double.doubleToLongBits(distance) != Double.doubleToLongBits(other.distance)) + return false; + if (lower == null) { + if (other.lower != null) + return false; + } else if (!lower.equals(other.lower)) + return false; + if (upper == null) { + if (other.upper != null) + return false; + } else if (!upper.equals(other.upper)) + return false; + return true; + } + } Index: PipeEnterStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/PipeEnterStrategy.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PipeEnterStrategy.java 27 Aug 2007 13:03:34 -0000 1.10 --- PipeEnterStrategy.java 5 Dec 2007 23:22:45 -0000 1.11 *************** *** 42,44 **** --- 42,75 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((crossDown == null) ? 0 : crossDown.hashCode()); + result = prime * result + ((crossUp == null) ? 0 : crossUp.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final PipeEnterStrategy other = (PipeEnterStrategy) obj; + if (crossDown == null) { + if (other.crossDown != null) + return false; + } else if (!crossDown.equals(other.crossDown)) + return false; + if (crossUp == null) { + if (other.crossUp != null) + return false; + } else if (!crossUp.equals(other.crossUp)) + return false; + return true; + } + } Index: JustBuyOnceStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/JustBuyOnceStrategy.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** JustBuyOnceStrategy.java 25 Aug 2007 12:30:00 -0000 1.7 --- JustBuyOnceStrategy.java 5 Dec 2007 23:22:45 -0000 1.8 *************** *** 21,23 **** --- 21,45 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (operated ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final JustBuyOnceStrategy other = (JustBuyOnceStrategy) obj; + if (operated != other.operated) + return false; + return true; + } + } Index: CombinedBuyAndSellStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/CombinedBuyAndSellStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CombinedBuyAndSellStrategy.java 10 Oct 2007 20:03:29 -0000 1.1 --- CombinedBuyAndSellStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 27,29 **** --- 27,60 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((buyStrategy == null) ? 0 : buyStrategy.hashCode()); + result = prime * result + ((sellStrategy == null) ? 0 : sellStrategy.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final CombinedBuyAndSellStrategy other = (CombinedBuyAndSellStrategy) obj; + if (buyStrategy == null) { + if (other.buyStrategy != null) + return false; + } else if (!buyStrategy.equals(other.buyStrategy)) + return false; + if (sellStrategy == null) { + if (other.sellStrategy != null) + return false; + } else if (!sellStrategy.equals(other.sellStrategy)) + return false; + return true; + } + } Index: NotSoFastStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/NotSoFastStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NotSoFastStrategy.java 15 Oct 2007 22:14:56 -0000 1.1 --- NotSoFastStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 35,37 **** --- 35,65 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + numberOfTicks; + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final NotSoFastStrategy other = (NotSoFastStrategy) obj; + if (numberOfTicks != other.numberOfTicks) + return false; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + return true; + } + } Index: StopGainStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/StopGainStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StopGainStrategy.java 31 Oct 2007 17:08:56 -0000 1.1 --- StopGainStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 46,48 **** --- 46,88 ---- return String.format("%s stoper: %s over %s", this.getClass().getSimpleName(), ""+ loss, strategy.getName()); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((indicator == null) ? 0 : indicator.hashCode()); + long temp; + temp = Double.doubleToLongBits(loss); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + temp = Double.doubleToLongBits(value); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final StopGainStrategy other = (StopGainStrategy) obj; + if (indicator == null) { + if (other.indicator != null) + return false; + } else if (!indicator.equals(other.indicator)) + return false; + if (Double.doubleToLongBits(loss) != Double.doubleToLongBits(other.loss)) + return false; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + if (Double.doubleToLongBits(value) != Double.doubleToLongBits(other.value)) + return false; + return true; + } } Index: AndStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/AndStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AndStrategy.java 25 Aug 2007 14:04:32 -0000 1.1 --- AndStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 28,30 **** --- 28,62 ---- return String.format("%s and %s",strategy.getName(),strategy2.getName()); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + result = prime * result + ((strategy2 == null) ? 0 : strategy2.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final AndStrategy other = (AndStrategy) obj; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + if (strategy2 == null) { + if (other.strategy2 != null) + return false; + } else if (!strategy2.equals(other.strategy2)) + return false; + return true; + } + } Index: SupportStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/SupportStrategy.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SupportStrategy.java 25 Aug 2007 12:30:00 -0000 1.9 --- SupportStrategy.java 5 Dec 2007 23:22:45 -0000 1.10 *************** *** 39,41 **** --- 39,77 ---- .format("%s suport: %i strategy: %s", this.getClass().getSimpleName(), support, strategy.getName()); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((indicator == null) ? 0 : indicator.hashCode()); + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + long temp; + temp = Double.doubleToLongBits(support); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final SupportStrategy other = (SupportStrategy) obj; + if (indicator == null) { + if (other.indicator != null) + return false; + } else if (!indicator.equals(other.indicator)) + return false; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + if (Double.doubleToLongBits(support) != Double.doubleToLongBits(other.support)) + return false; + return true; + } } Index: StopLossStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/StopLossStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StopLossStrategy.java 31 Oct 2007 17:08:56 -0000 1.1 --- StopLossStrategy.java 5 Dec 2007 23:22:45 -0000 1.2 *************** *** 46,48 **** --- 46,88 ---- return String.format("%s stoper: %s over %s", this.getClass().getSimpleName(), ""+ loss, strategy.getName()); } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((indicator == null) ? 0 : indicator.hashCode()); + long temp; + temp = Double.doubleToLongBits(loss); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + temp = Double.doubleToLongBits(value); + result = prime * result + (int) (temp ^ (temp >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final StopLossStrategy other = (StopLossStrategy) obj; + if (indicator == null) { + if (other.indicator != null) + return false; + } else if (!indicator.equals(other.indicator)) + return false; + if (Double.doubleToLongBits(loss) != Double.doubleToLongBits(other.loss)) + return false; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + if (Double.doubleToLongBits(value) != Double.doubleToLongBits(other.value)) + return false; + return true; + } } Index: IndicatorCrossedIndicatorStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/IndicatorCrossedIndicatorStrategy.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** IndicatorCrossedIndicatorStrategy.java 25 Aug 2007 12:30:00 -0000 1.10 --- IndicatorCrossedIndicatorStrategy.java 5 Dec 2007 23:22:45 -0000 1.11 *************** *** 41,43 **** --- 41,86 ---- } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((crossDown == null) ? 0 : crossDown.hashCode()); + result = prime * result + ((crossUp == null) ? 0 : crossUp.hashCode()); + result = prime * result + ((lower == null) ? 0 : lower.hashCode()); + result = prime * result + ((upper == null) ? 0 : upper.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final IndicatorCrossedIndicatorStrategy other = (IndicatorCrossedIndicatorStrategy) obj; + if (crossDown == null) { + if (other.crossDown != null) + return false; + } else if (!crossDown.equals(other.crossDown)) + return false; + if (crossUp == null) { + if (other.crossUp != null) + return false; + } else if (!crossUp.equals(other.crossUp)) + return false; + if (lower == null) { + if (other.lower != null) + return false; + } else if (!lower.equals(other.lower)) + return false; + if (upper == null) { + if (other.upper != null) + return false; + } else if (!upper.equals(other.upper)) + return false; + return true; + } } Index: ResistanceStrategy.java =================================================================== RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/strategy/ResistanceStrategy.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ResistanceStrategy.java 25 Aug 2007 12:30:00 -0000 1.9 --- ResistanceStrategy.java 5 Dec 2007 23:22:45 -0000 1.10 *************** *** 41,43 **** --- 41,79 ---- } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((indicator == null) ? 0 : indicator.hashCode()); + long temp; + temp = Double.doubleToLongBits(resistance); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + ((strategy == null) ? 0 : strategy.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final ResistanceStrategy other = (ResistanceStrategy) obj; + if (indicator == null) { + if (other.indicator != null) + return false; + } else if (!indicator.equals(other.indicator)) + return false; + if (Double.doubleToLongBits(resistance) != Double.doubleToLongBits(other.resistance)) + return false; + if (strategy == null) { + if (other.strategy != null) + return false; + } else if (!strategy.equals(other.strategy)) + return false; + return true; + } + } |