| 1 | package cz.vutbr.feec.packets.rtcp; |
| 2 | |
| 3 | import java.util.Vector; |
| 4 | import org.apache.commons.lang.builder.EqualsBuilder; |
| 5 | import org.apache.commons.lang.builder.HashCodeBuilder; |
| 6 | |
| 7 | public abstract class ReportPacket extends GeneralRTCPHeader { |
| 8 | |
| 9 | protected Vector<ReportBlock> reportBlockList = new Vector<ReportBlock>(); |
| 10 | |
| 11 | public ReportPacket() { |
| 12 | super(); |
| 13 | } |
| 14 | |
| 15 | public void addReportBlock(ReportBlock block) { |
| 16 | reportBlockList.add(block); |
| 17 | } |
| 18 | |
| 19 | @Override |
| 20 | protected void setReportCount(int reportCount) { |
| 21 | super.setReportCount(reportCount); |
| 22 | // throw new RuntimeException("Do not use this method. This metod is set " |
| 23 | // + "automaticaly according to number of added chunks."); |
| 24 | } |
| 25 | |
| 26 | @Override |
| 27 | public int getReportCount() { |
| 28 | return reportBlockList.size(); |
| 29 | } |
| 30 | |
| 31 | public ReportBlock getReportBlock(int index) { |
| 32 | return reportBlockList.get(index); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * @see java.lang.Object#equals(Object) |
| 37 | */ |
| 38 | public boolean equals(Object object) { |
| 39 | if (!(object instanceof ReportPacket)) { |
| 40 | return false; |
| 41 | } |
| 42 | ReportPacket rhs = (ReportPacket) object; |
| 43 | return new EqualsBuilder().appendSuper(super.equals(object)).append( |
| 44 | this.reportBlockList, rhs.reportBlockList).isEquals(); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * @see java.lang.Object#hashCode() |
| 49 | */ |
| 50 | public int hashCode() { |
| 51 | return new HashCodeBuilder(300235697, 2041011175).append(this.reportCount).append( |
| 52 | this.reportBlockList).toHashCode(); |
| 53 | } |
| 54 | |
| 55 | } |