Package nl.tue.astar.impl
Class DijkstraTail
- java.lang.Object
-
- nl.tue.astar.impl.DijkstraTail
-
- All Implemented Interfaces:
TailInflater<DijkstraTail>,Tail,Deflater<DijkstraTail>,Inflater<DijkstraTail>
public final class DijkstraTail extends java.lang.Object implements Tail, TailInflater<DijkstraTail>, Deflater<DijkstraTail>
Implementation of the tail that implements the Dijkstra estimate for the AStar, i.e. the estimate 0;- Author:
- bfvdonge
-
-
Field Summary
Fields Modifier and Type Field Description static DijkstraTailEMPTY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanComplete()returns true if and only if the replay can finish according to this tail, i.e.voiddeflate(DijkstraTail object, java.io.OutputStream stream)deflate the given object into the provided stream.intgetEstimatedCosts(Delegate<? extends Head,? extends Tail> d, Head head)get an estimate of the remaining distance to the target state in the search.intgetMaxByteCount()the method is called before each call to deflate.TailgetNextTail(Delegate<? extends Head,? extends Tail> d, Head oldHead, int modelMove, int logMove, int activity)constructs the new tail based on the two operations from the old head.<S> TailgetNextTailFromStorage(Delegate<? extends Head,? extends Tail> d, CompressedStore<S> store, long index, int modelMove, int logMove, int activity)constructs the new tail based on the two operations from the old state, which is stored in the given store at the given index.DijkstraTailinflate(java.io.InputStream stream)read an object from a stream.<H extends Head>
intinflateEstimate(StorageAwareDelegate<H,DijkstraTail> delegate, H head, java.io.InputStream stream)
-
-
-
Field Detail
-
EMPTY
public static final DijkstraTail EMPTY
-
-
Method Detail
-
getNextTail
public Tail getNextTail(Delegate<? extends Head,? extends Tail> d, Head oldHead, int modelMove, int logMove, int activity)
Description copied from interface:Tailconstructs the new tail based on the two operations from the old head. Preferably, the code to compute the new tail is kept as lightweight as possible.- Specified by:
getNextTailin interfaceTail- Returns:
-
getNextTailFromStorage
public <S> Tail getNextTailFromStorage(Delegate<? extends Head,? extends Tail> d, CompressedStore<S> store, long index, int modelMove, int logMove, int activity) throws java.io.IOException
Description copied from interface:Tailconstructs the new tail based on the two operations from the old state, which is stored in the given store at the given index. Preferably, the code to compute the new tail is kept as lightweight as possible.- Specified by:
getNextTailFromStoragein interfaceTail- Returns:
- Throws:
java.io.IOException
-
getEstimatedCosts
public int getEstimatedCosts(Delegate<? extends Head,? extends Tail> d, Head head)
Description copied from interface:Tailget an estimate of the remaining distance to the target state in the search.- Specified by:
getEstimatedCostsin interfaceTail- Returns:
-
canComplete
public boolean canComplete()
Description copied from interface:Tailreturns true if and only if the replay can finish according to this tail, i.e. for the case- Specified by:
canCompletein interfaceTail- Returns:
-
deflate
public void deflate(DijkstraTail object, java.io.OutputStream stream) throws java.io.IOException
Description copied from interface:Deflaterdeflate the given object into the provided stream. This method should NOT close the stream.- Specified by:
deflatein interfaceDeflater<DijkstraTail>- Throws:
java.io.IOException
-
inflate
public DijkstraTail inflate(java.io.InputStream stream) throws java.io.IOException
Description copied from interface:Inflaterread an object from a stream. The inflater should know when to stop reading and should NOT close the stream;- Specified by:
inflatein interfaceInflater<DijkstraTail>- Returns:
- Throws:
java.io.IOException
-
getMaxByteCount
public int getMaxByteCount()
Description copied from interface:Deflaterthe method is called before each call to deflate. The call to deflate should not write more than the number of bytes returned by this method! It may write less. If a negative value is returned, then a resizeable buffer is used- Specified by:
getMaxByteCountin interfaceDeflater<DijkstraTail>- Returns:
-
inflateEstimate
public <H extends Head> int inflateEstimate(StorageAwareDelegate<H,DijkstraTail> delegate, H head, java.io.InputStream stream) throws java.io.IOException
- Specified by:
inflateEstimatein interfaceTailInflater<DijkstraTail>- Throws:
java.io.IOException
-
-