edu.umich.eecs.tac.props
Class AdLink

java.lang.Object
  extended by edu.umich.eecs.tac.props.AbstractTransportable
      extended by edu.umich.eecs.tac.props.AdLink
All Implemented Interfaces:
java.io.Serializable, se.sics.isl.transport.Transportable

public class AdLink
extends AbstractTransportable

This class represents an ad link. It contains an Ad as well as a string for the advertiser's address. Note that ad links are created by the publisher from ads specified in an advertisers bid bundle and thus are not directly used by the advertiser.

Author:
Lee Callender, Patrick Jordan
See Also:
Serialized Form

Constructor Summary
AdLink()
          Creates a generic ad link.
AdLink(Ad ad, java.lang.String advertiser)
          Creates an ad link from a given ad and advertiser.
AdLink(Product product, java.lang.String advertiser)
          Creates an ad link with the supplied Product and advertiser.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if the object is an AdLink and has the same ad and advertiser.
 Ad getAd()
          Returns the ad backing the ad link.
 java.lang.String getAdvertiser()
          Returns the advertiser's address.
 int hashCode()
          Returns a hash code based on the contained ad and advertiser.
protected  void readWithLock(se.sics.isl.transport.TransportReader reader)
          Reads the advertiser's address and ad from the reader.
 void setAd(Ad ad)
          Sets the ad backing the ad link.
 void setAdvertiser(java.lang.String advertiser)
          Specify and advertiser's address for this ad link.
 java.lang.String toString()
          Returns a string representation of the ad link.
protected  void writeWithLock(se.sics.isl.transport.TransportWriter writer)
          Writes the advertiser's address and ad to the writer.
 
Methods inherited from class edu.umich.eecs.tac.props.AbstractTransportable
getTransportName, isLocked, lock, lockCheck, read, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdLink

public AdLink()
Creates a generic ad link. Advertiser's address is initialized to null and a null ad.


AdLink

public AdLink(Product product,
              java.lang.String advertiser)
Creates an ad link with the supplied Product and advertiser. An Ad with the given product is created.

Parameters:
product - the product.
advertiser - the advertiser address.

AdLink

public AdLink(Ad ad,
              java.lang.String advertiser)
Creates an ad link from a given ad and advertiser.

Parameters:
ad - the ad.
advertiser - the advertiser.
Method Detail

getAdvertiser

public final java.lang.String getAdvertiser()
Returns the advertiser's address.

Returns:
the advertiser's address.

getAd

public final Ad getAd()
Returns the ad backing the ad link.

Returns:
the ad.

setAd

public final void setAd(Ad ad)
Sets the ad backing the ad link.

Parameters:
ad - the ad.

setAdvertiser

public final void setAdvertiser(java.lang.String advertiser)
                         throws java.lang.IllegalStateException
Specify and advertiser's address for this ad link.

Parameters:
advertiser - the advertiser's address contained in the ad link.
Throws:
java.lang.IllegalStateException - if the ad link is locked.

readWithLock

protected final void readWithLock(se.sics.isl.transport.TransportReader reader)
                           throws java.text.ParseException
Reads the advertiser's address and ad from the reader.

Specified by:
readWithLock in class AbstractTransportable
Parameters:
reader - the reader to read data from.
Throws:
java.text.ParseException - if an exception occured reading the advertiser and ad.

writeWithLock

protected final void writeWithLock(se.sics.isl.transport.TransportWriter writer)
Writes the advertiser's address and ad to the writer.

Specified by:
writeWithLock in class AbstractTransportable
Parameters:
writer - the writer to write data to.

equals

public final boolean equals(java.lang.Object o)
Returns true if the object is an AdLink and has the same ad and advertiser.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare.
Returns:
true if the object is an AdLink and has the same ad and advertiser.

hashCode

public final int hashCode()
Returns a hash code based on the contained ad and advertiser.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code based on the contained ad and advertiser.

toString

public final java.lang.String toString()
Returns a string representation of the ad link.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the ad link.


Copyright © 2007-2009 Association for Trading Agent Research. All Rights Reserved.