本文整理汇总了Java中gnu.trove.set.hash.TLongHashSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java TLongHashSet.add方法的具体用法?Java TLongHashSet.add怎么用?Java TLongHashSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.set.hash.TLongHashSet
的用法示例。
在下文中一共展示了TLongHashSet.add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVisibleIds
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
@Override
public synchronized TLongHashSet getVisibleIds()
{
final TLongHashSet visibleIds = new TLongHashSet();
final int w = viewer.getWidth();
final int h = viewer.getHeight();
final AffineTransform3D viewerTransform = new AffineTransform3D();
viewer.getState().getViewerTransform( viewerTransform );
IntervalView< LabelMultisetType > screenLabels =
Views.interval(
Views.hyperSlice(
RealViews.affine( labels, viewerTransform ), 2, 0 ),
new FinalInterval( w, h ) );
for ( final LabelMultisetType pixel : Views.iterable( screenLabels ) )
{
for ( final Entry< Label > entry : pixel.entrySet() )
visibleIds.add( entry.getElement().id() );
}
return visibleIds;
}
示例2: registerHighway
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
private void registerHighway(final Way way, final TLongHashSet usedNodes, final TLongHashSet intersectionNodes) {
for (final Tag tg : way.getTags()) {
final String key = tg.getKey();
if (key.equals("highway")) {
final List<WayNode> nodes = way.getWayNodes();
for (final WayNode node : nodes) {
final long id = node.getNodeId();
if (usedNodes.contains(id)) {
intersectionNodes.add(id);
} else {
usedNodes.add(id);
}
}
if (nodes.size() > 2 && nodes.get(0) == nodes.get(nodes.size() - 1)) {
intersectionNodes.add(nodes.get(nodes.size() / 2).getNodeId());
}
}
}
}
示例3: find
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
@Override
public long[] find(int tableId, int col, Object value) {
TLongArrayList ret = new TLongArrayList();
TLongHashSet hashset = new TLongHashSet();
for(int dsIndex = 0; dsIndex<length;dsIndex++){
ODLTableReadOnly table = (ODLTableReadOnly)stores.get(dsIndex).getTableByImmutableId(tableId);
if(table!=null){
long[] result = table.find(col, value);
int n = result.length;
for(int i=0;i<n;i++){
long id = result[i];
if(hashset.contains(id)==false){
hashset.add(id);
ret.add(id);
}
}
}
}
return ret.toArray();
}
示例4: getVisibleIds
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
@Override
public synchronized TLongHashSet getVisibleIds()
{
final TLongHashSet visibleIds = new TLongHashSet();
final int w = viewer.getWidth();
final int h = viewer.getHeight();
final AffineTransform3D viewerTransform = new AffineTransform3D();
viewer.getState().getViewerTransform( viewerTransform );
final IntervalView< Pair< LabelMultisetType, LongType > > screenLabels =
Views.interval(
Views.hyperSlice(
RealViews.affine( labels, viewerTransform ), 2, 0 ),
new FinalInterval( w, h ) );
for ( final Pair< LabelMultisetType, LongType > pixel : Views.iterable( screenLabels ) )
{
final long b = pixel.getB().get();
if ( b == Label.TRANSPARENT )
{
final LabelMultisetType a = pixel.getA();
for ( final Entry< Label > entry : a.entrySet() )
visibleIds.add( entry.getElement().id() );
}
else
visibleIds.add( b );
}
return visibleIds;
}
示例5: loadLongSet
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
public static TLongHashSet loadLongSet(String setFile) throws IOException {
long time = System.currentTimeMillis();
TLongHashSet idSet = new TLongHashSet();
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream(new FileInputStream(setFile))));
String line;
String[] parts;
while ((line = br.readLine()) != null) {
parts = line.split(SEP);
idSet.add(Long.parseLong(parts[0]));
}
logger.info(((System.currentTimeMillis() - time) / 1000d) + "s");
return idSet;
}
示例6: setObjects
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
private void setObjects(BeanMappedObjects objs,ODLDatastore<? extends ODLTable> newMapDatastore) {
this.objs = objs;
mapDatastore = newMapDatastore;
updateObjectFiltering();
fireObjectsChangedListeners(MapApiImpl.this);
// Update selected ids. don't allow anything to be selected that's not in the active table,
// however we do allow filtered out objects to stay selected (needed for polygon editing plugin).
// We do this on the table instead of the drawableobjects, as the bean conversion to drawableobjects
// filters out anything with null geometry and long lats.
TLongHashSet newSelected = new TLongHashSet();
ODLTableReadOnly unfilteredActive = filtered.unfilteredTables.activeTable;
if(unfilteredActive!=null){
int n = unfilteredActive.getRowCount();
for(int i =0 ; i < n ; i++){
long rowid = unfilteredActive.getRowId(i);
if (selectionState.contains(rowid)) {
newSelected.add(rowid);
}
}
}
if (!selectionState.equals(newSelected)) {
setSelectedIds(newSelected.toArray());
}
}
示例7: buildGraph
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
private Graph buildGraph() {
Graph graph = new Graph();
LongIndex nodeIndex = createNodes(graph);
ProcessLinkSearchMap map = new ProcessLinkSearchMap(
productSystem.getProcessLinks());
long startId = productSystem.getReferenceProcess().getId();
TLongLinkedList queue = new TLongLinkedList();
queue.add(startId);
TLongHashSet handled = new TLongHashSet();
while (!queue.isEmpty()) {
long recipient = queue.removeAt(0);
handled.add(recipient);
int recipId = nodeIndex.getIndex(recipient);
for (ProcessLink link : map.getIncomingLinks(recipient)) {
long provider = link.providerId;
if (handled.contains(provider) || queue.contains(provider))
continue;
queue.add(provider);
int provId = nodeIndex.getIndex(provider);
Link lnk = new Link();
lnk.source = provId;
lnk.target = recipId;
graph.links.add(lnk);
}
}
return graph;
}
示例8: updateTables
import gnu.trove.set.hash.TLongHashSet; //导入方法依赖的package包/类
private void updateTables(){
// get all input row ids
TLongHashSet filtered = new TLongHashSet();
ODLTableReadOnly active = api.getMapDataApi().getUnfilteredActiveTable();
if(active!=null){
int n = active.getRowCount();
for(int i =0 ; i < n ; i++){
filtered.add(active.getRowId(i));
}
}
// update the filter datastore
tablesPanel.filteredDs.update(filtered, false);
// then the tabs
tablesPanel.updateTableTabs(true, new ODLGridTableFactory() {
@Override
public ODLGridTable createODLGridTable(int tableId) {
// to do add custom row style which shows a blue font for rows selected in the map...
RowStyler styler = new RowStyler() {
@Override
public Color getRowFontColour(long rowId) {
return api.isSelectedId(rowId) ? Color.BLUE : Color.BLACK;
}
};
ODLGridTable ret = new ODLGridTable(tablesPanel.filteredDs, tableId, true, styler, api.getMapDataApi().getGlobalDatastore(), new GridEditPermissions(false, false, false, false, false), preferredColumnWidths){
@Override
protected SelectionManager createSelectionManager(){
return new SelectionManager(this,true);
}
};
ret.setShowFilters(true);
return ret;
}
});
}