public TLongArrayList getNodeIds() { if (nodeIds == null) { return new TLongArrayList(0); } return nodeIds; }
/** * Creates a new <code>TLongArrayStack</code> instance with the * specified capacity. * * @param capacity the initial depth of the stack */ public TLongArrayStack( int capacity ) { _list = new TLongArrayList( capacity ); }
/** * Creates a new <code>TLongArrayStack</code> instance with the * specified capacity. * * @param capacity the initial depth of the stack * @param no_entry_value value that represents null */ public TLongArrayStack( int capacity, long no_entry_value ) { _list = new TLongArrayList( capacity, no_entry_value ); }
/** * Creates a new <code>TLongArrayStack</code> instance that is * a copy of the instanced passed to us. * * @param stack the instance to copy */ public TLongArrayStack( TLongStack stack ) { if ( stack instanceof TLongArrayStack ) { TLongArrayStack array_stack = ( TLongArrayStack ) stack; this._list = new TLongArrayList( array_stack._list ); } else { throw new UnsupportedOperationException( "Only support TLongArrayStack" ); } }
public void addNode(long id) { if (nodeIds == null) { nodeIds = new TLongArrayList(); } nodeIds.add(id); }
public Way(Way w) { super(w.getId()); if (w.nodeIds != null) { nodeIds = new TLongArrayList(w.nodeIds); } if (w.nodes != null) { nodes = new ArrayList<Node>(w.nodes); } }
/** {@inheritDoc} */ public TLongList subList( int begin, int end ) { if ( end < begin ) { throw new IllegalArgumentException( "end index " + end + " greater than begin index " + begin ); } if ( begin < 0 ) { throw new IndexOutOfBoundsException( "begin index can not be < 0" ); } if ( end > _data.length ) { throw new IndexOutOfBoundsException( "end index < " + _data.length ); } TLongArrayList list = new TLongArrayList( end - begin ); for ( int i = begin; i < end; i++ ) { list.add( _data[ i ] ); } return list; }
public Way(long id, List<Node> nodes) { super(id); this.nodes = new ArrayList<Node>(nodes); nodeIds = new TLongArrayList(nodes.size()); for (Node n : nodes) { nodeIds.add(n.getId()); } }
public void addNode(Node n) { if (nodeIds == null) { nodeIds = new TLongArrayList(); } if (nodes == null) { nodes = new ArrayList<Node>(); } nodeIds.add(n.getId()); nodes.add(n); }
public void addNode(Node n, int index) { if (nodeIds == null) { nodeIds = new TLongArrayList(); } if (nodes == null) { nodes = new ArrayList<Node>(); } nodeIds.insert(index, n.getId()); nodes.add(index, n); }
@Override public TLongList getAsLongArray() { TLongList result = new TLongArrayList(size()); for (JsonElement element : array) { result.add(element.getAsLong()); } return result; }
public List<RouteDataObject> loadRouteRegionData(RouteSubregion rs) throws IOException { TLongArrayList idMap = new TLongArrayList(); TLongObjectHashMap<RestrictionInfo> restrictionMap = new TLongObjectHashMap<RestrictionInfo>(); if (rs.dataObjects == null) { codedIS.seek(rs.filePointer + rs.shiftToData); int limit = codedIS.readRawVarint32(); int oldLimit = codedIS.pushLimit(limit); readRouteTreeData(rs, idMap, restrictionMap); codedIS.popLimit(oldLimit); } List<RouteDataObject> res = rs.dataObjects; rs.dataObjects = null; return res; }
/** {@inheritDoc} */ public TLongList grep( TLongProcedure condition ) { TLongArrayList list = new TLongArrayList(); for ( int i = 0; i < _pos; i++ ) { if ( condition.execute( _data[ i ] ) ) { list.add( _data[ i ] ); } } return list; }
/** {@inheritDoc} */ public TLongList inverseGrep( TLongProcedure condition ) { TLongArrayList list = new TLongArrayList(); for ( int i = 0; i < _pos; i++ ) { if ( !condition.execute( _data[ i ] ) ) { list.add( _data[ i ] ); } } return list; }
public void loadRouteRegionData(List<RouteSubregion> toLoad, ResultMatcher<RouteDataObject> matcher) throws IOException { Collections.sort(toLoad, new Comparator<RouteSubregion>() { @Override public int compare(RouteSubregion o1, RouteSubregion o2) { int p1 = o1.filePointer + o1.shiftToData; int p2 = o2.filePointer + o2.shiftToData; return p1 == p2 ? 0 : (p1 < p2 ? -1 : 1); } }); TLongArrayList idMap = new TLongArrayList(); TLongObjectHashMap<RestrictionInfo> restrictionMap = new TLongObjectHashMap<RestrictionInfo>(); for (RouteSubregion rs : toLoad) { if (rs.dataObjects == null) { codedIS.seek(rs.filePointer + rs.shiftToData); int limit = codedIS.readRawVarint32(); int oldLimit = codedIS.pushLimit(limit); readRouteTreeData(rs, idMap, restrictionMap); codedIS.popLimit(oldLimit); } for (RouteDataObject ro : rs.dataObjects) { if (ro != null) { matcher.publish(ro); } } // free objects rs.dataObjects = null; } }
@Override public TLongList getAsLongArray() { if (data.getLongCount() > 0) { TLongList result = new TLongArrayList(data.getLongCount()); for (int i = 0; i < data.getLongCount(); ++i) { result.add(data.getLong(i)); } return result; } else { TLongList result = new TLongArrayList(data.getIntegerCount()); for (int i = 0; i < data.getIntegerCount(); ++i) { result.add(data.getInteger(i)); } return result; } }
@Override public PersistedData serializeCollection(Collection<EntityRef> value, SerializationContext context) { TLongList items = new TLongArrayList(); for (EntityRef ref : value) { if (!ref.exists()) { items.add(0L); } else { if (ref.isPersistent()) { items.add((ref).getId()); } else { items.add(0L); } } } return context.create(items.iterator()); }
HDTileData() { super(); this.pois = new TLongArrayList(); this.ways = new TLongArrayList(); }
TLongArrayList innerList = BaseTileBasedDataProcessor.this.outerToInnerMapping.get(outer.getId()); if (innerList == null) { innerList = new TLongArrayList(); BaseTileBasedDataProcessor.this.outerToInnerMapping.put(outer.getId(), innerList);
/** * Creates a new <code>TLongArrayStack</code> instance with the * specified capacity. * * @param capacity the initial depth of the stack */ public TLongArrayStack( int capacity ) { _list = new TLongArrayList( capacity ); }