本文整理汇总了Java中org.apache.commons.collections4.bidimap.DualHashBidiMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java DualHashBidiMap.get方法的具体用法?Java DualHashBidiMap.get怎么用?Java DualHashBidiMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.bidimap.DualHashBidiMap
的用法示例。
在下文中一共展示了DualHashBidiMap.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: find
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入方法依赖的package包/类
/**
* Find.
*
* @param userid the userid
* @return the channel context
*/
public ChannelContext<SessionContext, P, R> find(String userid)
{
String key = userid;
Lock lock = map.getLock().readLock();
DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();
try
{
lock.lock();
return (ChannelContext<SessionContext, P, R>) m.get(key);
} catch (Exception e)
{
throw e;
} finally
{
lock.unlock();
}
}
示例2: find
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入方法依赖的package包/类
public ChannelContext<SessionContext, P, R> find(String key)
{
Lock lock = map.getLock().readLock();
DualHashBidiMap<String, ChannelContext<SessionContext, P, R>> m = map.getObj();
try
{
lock.lock();
return (ChannelContext<SessionContext, P, R>) m.get(key);
} catch (Exception e)
{
throw e;
} finally
{
lock.unlock();
}
}
示例3: fillArgumentFromChildNode
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入方法依赖的package包/类
/**
* Grab argument information from the (potentially argument-complete) subtree rooted on the child node
* that is attaching on the integration point of <code>arc</code>. We search through the dependencies
* we have already encountered.
* @param arc
* @param coveredNodes
* @param offsetNodeIdsOfShadowTree
* @param tree
* @param timestamp
* @return
*/
private boolean fillArgumentFromChildNode(DependencyArc arc, DualHashBidiMap<Integer, Integer> coveredNodes,
DualHashBidiMap<Short, Short> offsetNodeIdsOfShadowTree, ElementaryStringTree tree, String[] words, String[] origPosTags, int timestamp)
{
boolean filled = false;
if(arc.getArgument() != null) // TODO Investigate
{
int idOfArgOnPrefix = arc.getArgument().getId();
Short idOfArgOnShadow = offsetNodeIdsOfShadowTree.getKey((short)idOfArgOnPrefix);
if(idOfArgOnShadow != null)
{
Integer idOfArgOnVerif = coveredNodes.get((int)idOfArgOnShadow);
if(idOfArgOnVerif != null)
{
for(int childId : tree.getChildren(idOfArgOnVerif))
{
Integer childIdOnShadow = coveredNodes.getKey(childId);
if(childIdOnShadow != null)
{
Collection<DependencyArc> childArcs =
dependencies.getDependenciesByIntegPoint(new DepNode(
offsetNodeIdsOfShadowTree.get(childIdOnShadow.shortValue()), timestamp));
if(childArcs != null)
{
Iterator<DependencyArc> iterator = childArcs.iterator();
while(iterator.hasNext())
{
DependencyArc childArc = iterator.next();
if(!childArc.isArgumentIncomplete()) // make sure the dependency has argument information
{
setArgument(arc, childArc.getArgument(), iterator, words, origPosTags, "V", true, false);
filled = true;
}
} // if
} // for
}
} // for
} // if
}
} // if
return filled;
}
示例4: addNpSubstBelowSInFringe
import org.apache.commons.collections4.bidimap.DualHashBidiMap; //导入方法依赖的package包/类
private boolean addNpSubstBelowSInFringe(Fringe fringe, int futureFringePos, Node prefixNode,
boolean openRightEmpty, boolean verification, DualHashBidiMap<Short, Short> offsetNodeIdsOfShadowTree) // [][S]:NP
{
List<Node> openRight = fringe.getAdjNodesOpenRight();
Node lastAdjNode = fringe.getLastAdjNode();
Node elemSubst = fringe.getSubstNode();
if(lastAdjNode == null || elemSubst == null)
return false;
if( (!openRightEmpty || openRight.isEmpty()) && lastAdjNode.getCategory().equals("S") &&
elemSubst.getCategory().equals("NP")) // NP in subject position ( S NP! ...) case, i.e., fringe=[][S]:NP
{
if(verification) // check whether we verify the first two nodes in the stack
{
Short firstEl = offsetNodeIdsOfShadowTree.get(elemSubst.getNodeId());
Short secondEl = offsetNodeIdsOfShadowTree.get(lastAdjNode.getNodeId());
if(firstEl == null || secondEl == null)
return false;
return dependencies.twoFirstElementsEquals(firstEl, secondEl);
}
else
{
// treat S label
// copy-paste the identical Node on the prefix's fringe or future fringe
int futureFringeListSize = this.futureFringe.getFringe().size();
Fringe prefixFringe = futureFringePos == -1 || futureFringePos >= futureFringeListSize ? this.fringe : this.futureFringe.getFringe().get(futureFringePos);
if(prefixFringe.getLastAdjNode() != null && prefixFringe.getLastAdjNode().identical(fringe.getLastAdjNode()))
{
dependencies.pushNpHead(prefixFringe.getLastAdjNode());
}
else // as a last resort search for the identical node on the prefix fringe or future fringe
{
Node sNode = findIdenticalNodeInFringe(fringe.getLastAdjNode());
if(sNode != null)
dependencies.pushNpHead(sNode);
else
{
dependencies.pushNpHead(fringe.getLastAdjNode());
// System.out.println("identical S not found in prefix tree");
}
}
// treat NP label
// in case the tree is ( root S - NP! ...) and the prefixNode is also an NP, i.e.,
// adjoins to the leftmost NP! push the prefixNode in the stack (hopefully containing complete delta info)
Node npHead;
Node prefixSubstNode = prefixFringe.getSubstNode();
if(openRightEmpty && prefixNode.getCategory().equals("NP"))
{
npHead = prefixNode;
}
// copy-paste the identical Node on the prefix's fringe or future fringe
else if(prefixSubstNode != null && prefixSubstNode.identical(elemSubst))
{
npHead = prefixSubstNode;
}
else // as a last resort search for the identical node on the prefix fringe or future fringe
{ // TODO: check if it applies
Node npNode = findIdenticalSubstNodeInFringe(elemSubst);
if(npNode != null)
npHead = npNode;
else
{
npHead = elemSubst;
// System.out.println("identical NP not found in prefix tree");
}
}
dependencies.pushNpHead(npHead);
}
return true;
}
return false;
}