InteractionChain

public class InteractionChain implements ChainSyncStorage

Class InteractionChain. Provides interactionchain functionality for the Hytale server.

java.lang.Object > InteractionChain

Field Summary

baseType

private InteractionType baseType

Field baseType.

chainId

private int chainId

Field chainId.

predicted

private boolean predicted

Field predicted.

rootInteraction

private RootInteraction rootInteraction

Field rootInteraction.

operationCounter

private int operationCounter

Field operationCounter.

simulatedCallStack

private int simulatedCallStack

Field simulatedCallStack.

simulatedOperationCounter

private int simulatedOperationCounter

Field simulatedOperationCounter.

simulatedRootInteraction

private RootInteraction simulatedRootInteraction

Field simulatedRootInteraction.

operationIndex

private int operationIndex

Field operationIndex.

operationIndexOffset

private int operationIndexOffset

Field operationIndexOffset.

clientOperationIndex

private int clientOperationIndex

Field clientOperationIndex.

tempSyncDataOffset

private int tempSyncDataOffset

Field tempSyncDataOffset.

timestamp

private long timestamp

Field timestamp.

waitingForServerFinished

private long waitingForServerFinished

Field waitingForServerFinished.

waitingForClientFinished

private long waitingForClientFinished

Field waitingForClientFinished.

clientState

private InteractionState clientState

Field clientState.

serverState

private InteractionState serverState

Field serverState.

finalState

private InteractionState finalState

Field finalState.

onCompletion

private Runnable onCompletion

Field onCompletion.

sentInitial

private boolean sentInitial

Field sentInitial.

desynced

private boolean desynced

Field desynced.

timeShift

private float timeShift

Field timeShift.

firstRun

private boolean firstRun

Field firstRun.

isFirstRun

private boolean isFirstRun

Field isFirstRun.

completed

private boolean completed

Field completed.

preTicked

private boolean preTicked

Field preTicked.

altId

final long altId

Field altId.

entry

final InteractionEntry entry

Field entry.

rootId

final int rootId

Field rootId.

opCounter

final int opCounter

Field opCounter.

root

final RootInteraction root

Field root.

op

final Operation op

Field op.

found

final TempChain found

Field found.

iEntry

final InteractionEntry iEntry

Field iEntry.

it

final ObjectIterator> it

Field it.

tempChain

final TempChain tempChain

Field tempChain.

entryId

final int entryId

Field entryId.

chain

final InteractionChain chain

Field chain.

state

final CallState state

Field state.

diff

final long diff

Field diff.

cooldown

final InteractionCooldown cooldown

Field cooldown.

cooldownTracker

final CooldownHandler.Cooldown cooldownTracker

Field cooldownTracker.

oIndex

final int oIndex

Field oIndex.

tempIdx

final int tempIdx

Field tempIdx.

idx

final int idx

Field idx.

fork

final InteractionChain fork

Field fork.

temp

final TempChain temp

Field temp.

tempForkedChainData

final Long2ObjectMap tempForkedChainData

Field tempForkedChainData.

tempSyncData

final List tempSyncData

Field tempSyncData.

Method Detail

InteractionChain

public public InteractionChain (final InteractionType type, final InteractionContext context, final InteractionChainData chainData, @Nonnull final RootInteraction rootInteraction, @Nullable final Runnable onCompletion, final boolean requiresClient)

Method InteractionChain.

Parameters:
final InteractionType type
final InteractionContext context
final InteractionChainData chainData
@Nonnull final RootInteraction rootInteraction
@Nullable final Runnable onCompletion
final boolean requiresClient

getType

public InteractionType getType ()

Method getType.

getChainId

public int getChainId ()

Method getChainId.

getForkedChainId

public ForkedChainId getForkedChainId ()

Method getForkedChainId.

getBaseForkedChainId

public ForkedChainId getBaseForkedChainId ()

Method getBaseForkedChainId.

getInitialRootInteraction

public RootInteraction getInitialRootInteraction ()

Method getInitialRootInteraction.

isPredicted

public boolean isPredicted ()

Method isPredicted.

getContext

public InteractionContext getContext ()

Method getContext.

getChainData

public InteractionChainData getChainData ()

Method getChainData.

getServerState

public InteractionState getServerState ()

Method getServerState.

requiresClient

public boolean requiresClient ()

Method requiresClient.

getRootInteraction

public RootInteraction getRootInteraction ()

Method getRootInteraction.

getSimulatedRootInteraction

public RootInteraction getSimulatedRootInteraction ()

Method getSimulatedRootInteraction.

getOperationCounter

public int getOperationCounter ()

Method getOperationCounter.

setOperationCounter

public void setOperationCounter (final int operationCounter)

Method setOperationCounter.

Parameters:
final int operationCounter

getSimulatedOperationCounter

public int getSimulatedOperationCounter ()

Method getSimulatedOperationCounter.

setSimulatedOperationCounter

public void setSimulatedOperationCounter (final int simulatedOperationCounter)

Method setSimulatedOperationCounter.

Parameters:
final int simulatedOperationCounter

wasPreTicked

public boolean wasPreTicked ()

Method wasPreTicked.

setPreTicked

public void setPreTicked (final boolean preTicked)

Method setPreTicked.

Parameters:
final boolean preTicked

getOperationIndex

public int getOperationIndex ()

Method getOperationIndex.

nextOperationIndex

public void nextOperationIndex ()

Method nextOperationIndex.

getClientOperationIndex

public int getClientOperationIndex ()

Method getClientOperationIndex.

findForkedChain

Method findForkedChain.

Parameters:
@Nonnull final ForkedChainId chainId
@Nullable final InteractionChainData data

getForkedChain

public InteractionChain getForkedChain (@Nonnull final ForkedChainId chainId)

Method getForkedChain.

Parameters:
@Nonnull final ForkedChainId chainId

putForkedChain

public void putForkedChain (@Nonnull final ForkedChainId chainId, @Nonnull final InteractionChain chain)

Method putForkedChain.

Parameters:
@Nonnull final ForkedChainId chainId
@Nonnull final InteractionChain chain

getTempForkedChain

public TempChain getTempForkedChain (@Nonnull final ForkedChainId chainId)

Method getTempForkedChain.

Parameters:
@Nonnull final ForkedChainId chainId

if

public else if (chainId.entryIndex < this.operationIndexOffset)

Method if.

Parameters:
chainId.entryIndex < this.operationIndexOffset

TempChain

public new TempChain ()

Method TempChain.

removeTempForkedChain

public TempChain removeTempForkedChain (@Nonnull final ForkedChainId chainId, final InteractionChain forkChain)

Method removeTempForkedChain.

Parameters:
@Nonnull final ForkedChainId chainId
final InteractionChain forkChain

hasSentInitial

public boolean hasSentInitial ()

Method hasSentInitial.

setSentInitial

public void setSentInitial (final boolean sentInitial)

Method setSentInitial.

Parameters:
final boolean sentInitial

getTimeShift

public float getTimeShift ()

Method getTimeShift.

setTimeShift

public void setTimeShift (final float timeShift)

Method setTimeShift.

Parameters:
final float timeShift

consumeFirstRun

public boolean consumeFirstRun ()

Method consumeFirstRun.

isFirstRun

public boolean isFirstRun ()

Method isFirstRun.

setFirstRun

public void setFirstRun (final boolean firstRun)

Method setFirstRun.

Parameters:
final boolean firstRun

getCallDepth

public int getCallDepth ()

Method getCallDepth.

getSimulatedCallDepth

public int getSimulatedCallDepth ()

Method getSimulatedCallDepth.

pushRoot

public void pushRoot (final RootInteraction nextInteraction, final boolean simulate)

Method pushRoot.

Parameters:
final RootInteraction nextInteraction
final boolean simulate

CallState

public new CallState (this.rootInteraction, this.operationCounter)

Method CallState.

Parameters:
this.rootInteraction this.rootInteraction
this.operationCounter this.operationCounter

popRoot

public void popRoot ()

Method popRoot.

getTimeInSeconds

public float getTimeInSeconds ()

Method getTimeInSeconds.

setOnCompletion

public void setOnCompletion (final Runnable onCompletion)

Method setOnCompletion.

Parameters:
final Runnable onCompletion

onCompletion

public void onCompletion (final CooldownHandler cooldownHandler, final boolean isRemote)

Method onCompletion.

Parameters:
final CooldownHandler cooldownHandler
final boolean isRemote

updateServerState

public void updateServerState ()

Method updateServerState.

updateSimulatedState

public void updateSimulatedState ()

Method updateSimulatedState.

getClientState

public InteractionState getClientState ()

Method getClientState.

setClientState

public void setClientState (final InteractionState state)

Method setClientState.

Parameters:
final InteractionState state

getOrCreateInteractionEntry

public InteractionEntry getOrCreateInteractionEntry (final int index)

Method getOrCreateInteractionEntry.

Parameters:
final int index

InteractionEntry

public new InteractionEntry (index, this.operationCounter, RootInteraction.getRootInteractionIdOrUnknown(this.rootInteraction.getId()

Method InteractionEntry.

Parameters:
index index
this.operationCounter this.operationCounter
RootInteraction.getRootInteractionIdOrUnknown(this.rootInteraction.getId( RootInteraction.getRootInteractionIdOrUnknown(this.rootInteraction.getId(

getInteraction

public InteractionEntry getInteraction (int index)

Method getInteraction.

Parameters:
int index

removeInteractionEntry

public void removeInteractionEntry (@Nonnull final InteractionManager interactionManager, final int index)

Method removeInteractionEntry.

Parameters:
@Nonnull final InteractionManager interactionManager
final int index

putInteractionSyncData

public void putInteractionSyncData (int index, final InteractionSyncData data)

Method putInteractionSyncData.

Parameters:
int index
final InteractionSyncData data

clearInteractionSyncData

public void clearInteractionSyncData (final int operationIndex)

Method clearInteractionSyncData.

Parameters:
final int operationIndex

removeInteractionSyncData

public InteractionSyncData removeInteractionSyncData (int index)

Method removeInteractionSyncData.

Parameters:
int index

updateSyncPosition

public void updateSyncPosition (final int index)

Method updateSyncPosition.

Parameters:
final int index

isSyncDataOutOfOrder

public boolean isSyncDataOutOfOrder (final int index)

Method isSyncDataOutOfOrder.

Parameters:
final int index

copyTempFrom

public void copyTempFrom (@Nonnull final TempChain temp)

Method copyTempFrom.

Parameters:
@Nonnull final TempChain temp

forkedIdToIndex

static long forkedIdToIndex (@Nonnull final ForkedChainId chainId)

Method forkedIdToIndex.

Parameters:
@Nonnull final ForkedChainId chainId

setChainId

public void setChainId (final int chainId)

Method setChainId.

Parameters:
final int chainId

getBaseType

public InteractionType getBaseType ()

Method getBaseType.

setBaseType

public void setBaseType (final InteractionType baseType)

Method setBaseType.

Parameters:
final InteractionType baseType

getForkedChains

public Long2ObjectMap getForkedChains ()

Method getForkedChains.

getTempForkedChainData

public Long2ObjectMap getTempForkedChainData ()

Method getTempForkedChainData.

getTimestamp

public long getTimestamp ()

Method getTimestamp.

setTimestamp

public void setTimestamp (final long timestamp)

Method setTimestamp.

Parameters:
final long timestamp

getWaitingForServerFinished

public long getWaitingForServerFinished ()

Method getWaitingForServerFinished.

setWaitingForServerFinished

public void setWaitingForServerFinished (final long waitingForServerFinished)

Method setWaitingForServerFinished.

Parameters:
final long waitingForServerFinished

getWaitingForClientFinished

public long getWaitingForClientFinished ()

Method getWaitingForClientFinished.

setWaitingForClientFinished

public void setWaitingForClientFinished (final long waitingForClientFinished)

Method setWaitingForClientFinished.

Parameters:
final long waitingForClientFinished

setServerState

public void setServerState (final InteractionState serverState)

Method setServerState.

Parameters:
final InteractionState serverState

getFinalState

public InteractionState getFinalState ()

Method getFinalState.

setFinalState

public void setFinalState (final InteractionState finalState)

Method setFinalState.

Parameters:
final InteractionState finalState

setPredicted

public void setPredicted (final boolean predicted)

Method setPredicted.

Parameters:
final boolean predicted

flagDesync

public void flagDesync ()

Method flagDesync.

isDesynced

public boolean isDesynced ()

Method isDesynced.

getNewForks

public List getNewForks ()

Method getNewForks.

toString

public String toString ()

Method toString.

ForkedChainId

public new ForkedChainId (-1, Integer.MAX_VALUE, null)

Method ForkedChainId.

Parameters:
-1 -1
Integer.MAX_VALUE Integer.MAX_VALUE
null null

getOrCreateTempForkedChain

public TempChain getOrCreateTempForkedChain (@Nonnull final ForkedChainId chainId)

Method getOrCreateTempForkedChain.

Parameters:
@Nonnull final ForkedChainId chainId

setChainData

public void setChainData (final InteractionChainData chainData)

Method setChainData.

Parameters:
final InteractionChainData chainData

setBaseForkedChainId

public void setBaseForkedChainId (final ForkedChainId baseForkedChainId)

Method setBaseForkedChainId.

Parameters:
final ForkedChainId baseForkedChainId

setForkedChainId

public void setForkedChainId (final ForkedChainId forkedChainId)

Method setForkedChainId.

Parameters:
final ForkedChainId forkedChainId