match

package
v1.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineNode

type LineNode struct {
	ExpireTime int //过期截止时间 秒 *(!=0则会判断过期)*
	//---------
	Id          int //外部控制的唯一id,主键
	NeighborMax int // PLAYER=需要的最多邻居
	NeighborMin int // PLAYER=需要的最小邻居
	//多种类型|操作数值
	SubType int
	// contains filtered or unexported fields
}

func NewLineNode

func NewLineNode(point, baseRadius, incrPerSecond, maxWaitTime, insertTime int) *LineNode

* 构建线性自扩散的区间节点 point int //中心点 baseRadius int //初始半径 incrPerSecond int //每秒扩散的半径 maxWaitTime int //最大扩散时间 秒 insertTime int //插入时间戳

func (*LineNode) BaseRadius

func (nd *LineNode) BaseRadius() int

节点初始半径

func (*LineNode) CurrtRadius

func (nd *LineNode) CurrtRadius(secondOfNow int) int

根据传入的时间戳(秒),获取当前节点的半径

func (*LineNode) ExpireTimed

func (nd *LineNode) ExpireTimed(secondOfNow int) bool

根据传入的时间戳(秒),判断是否过期(主要用于房间锁定后或者人数满了)

func (*LineNode) IncrPerSecond

func (nd *LineNode) IncrPerSecond() int

节点每秒扩散的半径

func (*LineNode) InsertTime

func (nd *LineNode) InsertTime() int

节点初始时间

func (*LineNode) MaxRadius

func (nd *LineNode) MaxRadius() int

节点最大扩散半径

func (*LineNode) MaxWaitTime

func (nd *LineNode) MaxWaitTime() int

节点最大扩散时间 秒

func (*LineNode) Point

func (nd *LineNode) Point() int

节点中心点

func (*LineNode) WaitFull

func (nd *LineNode) WaitFull(secondOfNow int) bool

节点是否等待

type LineNodeList

type LineNodeList struct {
	// contains filtered or unexported fields
}

func NewLineNodeList

func NewLineNodeList() *LineNodeList

构建线性自扩散的区间节点列表(*非线程安全*,建议单线程使用)

func (*LineNodeList) AddNode

func (nd *LineNodeList) AddNode(node *LineNode)

func (*LineNodeList) FindNode

func (nd *LineNodeList) FindNode(find *LineNode) (bool, int)

* 根据节点查找所在列表中的下标(注意:该find节点必须在列表中存在,否则无法查找) bool:是否查找到 int: bool=true 表示真实下标

bool=false 表示可以插入的下标,int=[0,len]

func (*LineNodeList) Iterator

func (nd *LineNodeList) Iterator(startIndex int, cursor func(*LineNode, int) bool)

* 迭代列表中所有节点 startIndex:迭代开始下标 cursor:迭代回调函数

node :元素节点
crtIndex:node所在列表下标
continuz:是否继续迭代

func (*LineNodeList) Len

func (nd *LineNodeList) Len() int

func (*LineNodeList) RemoveNode

func (nd *LineNodeList) RemoveNode(node *LineNode) int

* 移除队列中的子节点,返回移除的节点的下标 -1:没找到,[0,len)

func (*LineNodeList) SearchNeighbor

func (nd *LineNodeList) SearchNeighbor(find *LineNode) int

* 根据节点查找开始遍历的邻居节点下标

func (*LineNodeList) SearchRange

func (nd *LineNodeList) SearchRange(secondOfNow int, cpoint *LineNode, needNum int) (neighbor []*LineNode)

* 迭代列表中所有节点

secondOfNow:当前时间 秒
cpoint:基础元素节点
needNum:最多需要的邻居数(>0表示找出指定所有,<=0有多少找多少)
return:
   neighbor:有交集的邻居节点

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL