edu.umich.eecs.tac.props
Class Ranking

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

public class Ranking
extends AbstractTransportable

Ranking represents the slots allocated to the advertisers' ad links in an auction.

Author:
Patrick Jordan
See Also:
TAC Documentation, Serialized Form

Nested Class Summary
static class Ranking.Slot
          The slot for the ranking.
 
Constructor Summary
Ranking()
          Create an empty ranking.
 
Method Summary
 void add(AdLink adLink)
          Adds the ad link to the alots and set its promoted status to false.
 void add(AdLink adLink, boolean promoted)
          Adds the ad link to the alots and set its promoted status.
protected  void add(Ranking.Slot slot)
          Adds the slot to the slot list.
 AdLink get(int position)
          Returns the ad link at the slot position.
 boolean isPromoted(int position)
          Returns the promoted status of the ad link at the slot position.
 int positionForAd(AdLink adLink)
          Returns the slot position for the ad link in question and -1 if the ad link is not in the ranking.
protected  void readWithLock(se.sics.isl.transport.TransportReader reader)
          Reads the slots from the reader.
 void set(int position, AdLink adLink, boolean promoted)
          Set the ad link and promoted status for the slot.
 int size()
          Returns the number of slots in the ranking.
 java.lang.String toString()
          Returns a string representation of the ranking.
protected  void writeWithLock(se.sics.isl.transport.TransportWriter writer)
          Writes the slots 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ranking

public Ranking()
Create an empty ranking.

Method Detail

add

public final void add(AdLink adLink,
                      boolean promoted)
               throws java.lang.IllegalStateException
Adds the ad link to the alots and set its promoted status.

Parameters:
adLink - the ad link
promoted - true if the ad link is promoted.
Throws:
java.lang.IllegalStateException - if the ranking is locked.
See Also:
TAC Documentation

add

public final void add(AdLink adLink)
               throws java.lang.IllegalStateException
Adds the ad link to the alots and set its promoted status to false.

Parameters:
adLink - the ad link.
Throws:
java.lang.IllegalStateException - if the ranking is locked.

add

protected final void add(Ranking.Slot slot)
                  throws java.lang.IllegalStateException
Adds the slot to the slot list.

Parameters:
slot - the slot to add.
Throws:
java.lang.IllegalStateException - if the ranking is locked.

set

public final void set(int position,
                      AdLink adLink,
                      boolean promoted)
               throws java.lang.IllegalStateException
Set the ad link and promoted status for the slot.

Parameters:
position - the slot position.
adLink - the ad link.
promoted - the promoted status.
Throws:
java.lang.IllegalStateException - if the ranking is locked.

get

public final AdLink get(int position)
Returns the ad link at the slot position.

Parameters:
position - the slot position.
Returns:
the ad link at the slot position.

isPromoted

public final boolean isPromoted(int position)
Returns the promoted status of the ad link at the slot position.

Parameters:
position - the slot position.
Returns:
the promoted status of the ad link at the slot position.

positionForAd

public final int positionForAd(AdLink adLink)
Returns the slot position for the ad link in question and -1 if the ad link is not in the ranking.

Parameters:
adLink - the ad link.
Returns:
the slot position for the ad link in question and -1 if the ad link is not in the ranking.

size

public final int size()
Returns the number of slots in the ranking.

Returns:
the number of slots in the ranking.

toString

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

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

readWithLock

protected final void readWithLock(se.sics.isl.transport.TransportReader reader)
                           throws java.text.ParseException
Reads the slots from the reader.

Specified by:
readWithLock in class AbstractTransportable
Parameters:
reader - the reader to read data from.
Throws:
java.text.ParseException - if an exception occurs while reading the slots.

writeWithLock

protected final void writeWithLock(se.sics.isl.transport.TransportWriter writer)
Writes the slots to the writer.

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


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