Package org.miaixz.bus.core.center.map
Class TripleTable<L,M,R>
java.lang.Object
org.miaixz.bus.core.center.map.TripleTable<L,M,R>
- Type Parameters:
L- 左值类型M- 中值类型R- 右值类型
- All Implemented Interfaces:
Serializable
三值表结构,可重复
用于提供三种值相互查找操作
查找方式为indexOf方式遍历查找,数据越多越慢。
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionTripleTable<L, M, R> clear()清空booleancontainLeft(L left) 是否含有指定左元素booleancontainMiddle(M middle) 是否含有指定中元素booleancontainRight(R right) 是否含有指定右元素通过左值查找三元组(所有值)getByMiddle(M mValue) 通过中值查找三元组(所有值)getByRight(R rValue) 通过右值查找三元组(所有值)getLeft(int index) 获取指定index对应的左值getLeftByMiddle(M mValue) 通过中间值,查找左边值 如果有多个重复值,只返回找到的第一个值getLeftByRight(R rValue) 通过右值,查找左边值 如果有多个重复值,只返回找到的第一个值getLefts()获取左列表,不可修改getMiddle(int index) 获取指定index对应的中值getMiddleByLeft(L lValue) 通过左值,查找中值 如果有多个重复值,只返回找到的第一个值getMiddleByRight(R rValue) 通过右值,查找中值 如果有多个重复值,只返回找到的第一个值获取中列表,不可修改getRight(int index) 获取指定index对应的右值getRightByLeft(L lValue) 通过左值,查找右值 如果有多个重复值,只返回找到的第一个值getRightByMiddle(M mValue) 通过中间值,查找右值 如果有多个重复值,只返回找到的第一个值获取右列表,不可修改intindexOfLeft(L left) 获取指定左元素的索引intindexOfMiddle(M middle) 获取指定中元素的索引intindexOfRight(R right) 获取指定右元素的索引TripleTable<L, M, R> 加入值TripleTable<L, M, R> remove(int index) 移除值TripleTable<L, M, R> 修改指定index对应的左值TripleTable<L, M, R> 修改指定index对应的中值TripleTable<L, M, R> 修改指定index对应的右值intsize()长度
-
Constructor Details
-
TripleTable
构造- Parameters:
triples- 三元组列表
-
TripleTable
public TripleTable(int size) 构造- Parameters:
size- 初始容量
-
TripleTable
- Parameters:
lefts- 左列表middles- 中列表rights- 右列表
-
-
Method Details
-
getLeftByMiddle
通过中间值,查找左边值 如果有多个重复值,只返回找到的第一个值- Parameters:
mValue- 中间值- Returns:
- 左边值,未找到返回
null
-
getLeftByRight
通过右值,查找左边值 如果有多个重复值,只返回找到的第一个值- Parameters:
rValue- 右值- Returns:
- 左边值,未找到返回
null
-
getMiddleByLeft
通过左值,查找中值 如果有多个重复值,只返回找到的第一个值- Parameters:
lValue- 左值- Returns:
- 中值,未找到返回
null
-
getMiddleByRight
通过右值,查找中值 如果有多个重复值,只返回找到的第一个值- Parameters:
rValue- 右值- Returns:
- 中值,未找到返回
null
-
getLeft
获取指定index对应的左值- Parameters:
index- 索引- Returns:
- 左值
-
getMiddle
获取指定index对应的中值- Parameters:
index- 索引- Returns:
- 中值
-
getRight
获取指定index对应的右值- Parameters:
index- 索引- Returns:
- 右值
-
getRightByLeft
通过左值,查找右值 如果有多个重复值,只返回找到的第一个值- Parameters:
lValue- 左值- Returns:
- 右值,未找到返回
null
-
getRightByMiddle
通过中间值,查找右值 如果有多个重复值,只返回找到的第一个值- Parameters:
mValue- 中间值- Returns:
- 右值,未找到返回
null
-
containLeft
是否含有指定左元素- Parameters:
left- 左元素- Returns:
- 是否含有
-
containMiddle
是否含有指定中元素- Parameters:
middle- 中元素- Returns:
- 是否含有
-
containRight
是否含有指定右元素- Parameters:
right- 右元素- Returns:
- 是否含有
-
indexOfLeft
获取指定左元素的索引- Parameters:
left- 左元素- Returns:
- 索引,未找到返回-1
-
indexOfMiddle
获取指定中元素的索引- Parameters:
middle- 中元素- Returns:
- 索引,未找到返回-1
-
indexOfRight
获取指定右元素的索引- Parameters:
right- 右元素- Returns:
- 索引,未找到返回-1
-
getByLeft
通过左值查找三元组(所有值)- Parameters:
lValue- 左值- Returns:
- 三元组(所有值)
-
getByMiddle
通过中值查找三元组(所有值)- Parameters:
mValue- 中值- Returns:
- 三元组(所有值)
-
getByRight
通过右值查找三元组(所有值)- Parameters:
rValue- 右值- Returns:
- 三元组(所有值)
-
getLefts
获取左列表,不可修改- Returns:
- 左列表
-
getMiddles
获取中列表,不可修改- Returns:
- 中列表
-
getRights
获取右列表,不可修改- Returns:
- 右列表
-
size
public int size()长度- Returns:
- this
-
put
加入值- Parameters:
lValue- 左值mValue- 中值rValue- 右值- Returns:
- this
-
setLeft
修改指定index对应的左值- Parameters:
index- 索引lValue- 左值- Returns:
- this
-
setMiddle
修改指定index对应的中值- Parameters:
index- 索引mValue- 中值- Returns:
- this
-
setRight
修改指定index对应的右值- Parameters:
index- 索引rValue- 左值- Returns:
- this
-
clear
清空- Returns:
- this
-
remove
移除值- Parameters:
index- 序号- Returns:
- this
-