Creates a new segment.
436426
JournalSegment<E> createSegment(JournalSegmentDescriptor descriptor) {
    File segmentFile = JournalSegmentFile.createSegmentFile(name, directory, descriptor.id());

    RandomAccessFile raf;
    FileChannel channel;
    try {
      raf = new RandomAccessFile(segmentFile, "rw");
      raf.setLength(descriptor.maxSegmentSize());
      channel =  raf.getChannel();
    } catch (IOException e) {
      throw new StorageException(e);
    }

    ByteBuffer buffer = ByteBuffer.allocate(JournalSegmentDescriptor.BYTES);
    descriptor.copyTo(buffer);
    buffer.flip();
    try {
      channel.write(buffer);
    } catch (IOException e) {
      throw new StorageException(e);
    } finally {
      try {
        channel.close();
        raf.close();
      } catch (IOException e) {
      }
    }
    JournalSegment<E> segment = newSegment(new JournalSegmentFile(segmentFile), descriptor);
    log.debug("Created segment: {}", segment);
    return segment;
  }
400387
def begin_segment(name, trace_id: nil, parent_id: nil, sampled: nil)
      seg_name = name || config.name
      raise SegmentNameMissingError if seg_name.to_s.empty?

      # sampling decision comes from outside has higher precedence.
      sample = sampled.nil? ? config.sample? : sampled
      if sample
        segment = Segment.new name: seg_name, trace_id: trace_id, parent_id: parent_id
        populate_runtime_context(segment, sample)
      else
        segment = DummySegment.new name: seg_name, trace_id: trace_id, parent_id: parent_id
      end
      context.store_entity entity: segment
      segment
    end
303297
private void addFirstSegment(int x, int y) {
		Point2D_I32 p = queuePoints.grow();
		p.set(x,y);
		EdgeSegment s = new EdgeSegment();
		s.points.add(p);
		s.index = 0;
		s.parent = s.parentPixel = -1;
		e.segments.add(s);
		open.add(s);
	}
627572
@SuppressWarnings("static-method")
	public Point1dfx newPoint(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
		return new Point1dfx(segment, x, y);
	}
1219142
def write_segment(self, objects):
        
        segment = TdmsSegment(objects)
        segment.write(self._file)
883907
public static function create(string $segmentId, string $passengerId, string $seat, string $seatType): self
    {
        return new static($segmentId, $passengerId, $seat, $seatType);
    }
1217306
public Segment createSegment(RemoteBase remoteBase) throws SQLException, IOException {
		
		if (connection == null&&entryDAOUtils==null)
			return null;
		else
		{
			if (remoteBase != null)
			{
				String accession = remoteBase.getAccession() + (remoteBase.getVersion() == null ? "" : ("." + remoteBase.getVersion().toString()));
				if(entryDAOUtils==null)
				{
					setEntryDAOUtils(new EntryDAOUtilsImpl(connection));
				}
				byte[] subSequence=entryDAOUtils.getSubSequence(accession, remoteBase.getBeginPosition(), (remoteBase.getEndPosition()-remoteBase.getBeginPosition())+1);
				
				if(subSequence==null)
				{
					throw new SQLException("Invalid Accession "+accession+" , which does not exist in database");
				}
				
				if(remoteBase.getLength()!=subSequence.length)
				{
					StringBuilder lcoationString=new StringBuilder();
					LocationToStringCoverter.renderLocation(lcoationString, remoteBase, false, false);
					throw new SQLException("invalid Remote Base:"+ lcoationString.toString() +", not within the entry \""+ remoteBase.getAccession()+"\" sequence length");
				}
				if(remoteBase.isComplement())
				{
					ReverseComplementer reversecomplementer=new ReverseComplementer();
					return new Segment(remoteBase,reversecomplementer.reverseComplementByte(subSequence));
				}
				return new Segment(
						remoteBase,subSequence);

			}
		}
		return null;	
	}
374917
private Segment nextSegment(boolean newOnly) throws IOException {
        int index;
        Segment seg;

        if (newOnly) {
            index = _segList.size();
        } else {
            if (_recycleList.size() > 0) {
                seg = _recycleList.remove();
                seg.reinit();

                _segList.set(seg.getSegmentId(), seg);
                _log.info("reinit Segment " + seg.getSegmentId());
                return seg;
            }

            for (index = 0; index < _segList.size(); index++) {
                if (_segList.get(index) == null)
                    break;
            }
        }

        // Always create next segment as READ_WRITE
        File segFile = getSegmentFile(index);
        seg = getSegmentFactory().createSegment(index, segFile, _segFileSizeMB, Segment.Mode.READ_WRITE);

        if (index < _segList.size())
            _segList.set(index, seg);
        else
            _segList.add(seg);

        return seg;
    }
1222575
def add_subsegment(self, subsegment):
        
        super(Subsegment, self).add_subsegment(subsegment)
        self.parent_segment.increment()
543487
public void addSegment(Segment segment, boolean bStartNewPath) {
		mergeVertexDescription(segment.getDescription());
		if (segment.getType() == Type.Line) {
			Point point = new Point();
			if (bStartNewPath || isEmpty()) {
				segment.queryStart(point);
				startPath(point);
			}

			segment.queryEnd(point);
			lineTo(point);
		} else {
			throw GeometryException.GeometryInternalError();
		}
	}
1176111
@Override
	protected MemorySegment nextSegment(MemorySegment current, int positionInCurrent) throws EOFException
	{	
		final MemorySegment next = this.memorySource.nextSegment();
		if (next != null) {
			this.fullSegments.add(next);
			this.segmentNum++;
			return next;
		} else {
			throw new EOFException();
		}
	}
719128
function (segment) {		
		var series = this,
			segmentPath = [],
			step = series.options.step;
			
		// build the segment line
		each(segment, function (point, i) {
			
			var plotX = point.plotX,
				plotY = point.plotY,
				lastPoint;

			if (series.getPointSpline) { // generate the spline as defined in the SplineSeries object
				segmentPath.push.apply(segmentPath, series.getPointSpline(segment, point, i));

			} else {

				// moveTo or lineTo
				segmentPath.push(i ? L : M);

				// step line?
				if (step && i) {
					lastPoint = segment[i - 1];
					if (step === 'right') {
						segmentPath.push(
							lastPoint.plotX,
							plotY
						);
						
					} else if (step === 'center') {
						segmentPath.push(
							(lastPoint.plotX + plotX) / 2,
							lastPoint.plotY,
							(lastPoint.plotX + plotX) / 2,
							plotY
						);
						
					} else {
						segmentPath.push(
							plotX,
							lastPoint.plotY
						);
					}
				}

				// normal line to next point
				segmentPath.push(
					point.plotX,
					point.plotY
				);
			}
		});
		
		return segmentPath;
	}
235618
def setStartSegment(self, segment):
        
        segments = self.segments
        if not isinstance(segment, int):
            segmentIndex = segments.index(segment)
        else:
            segmentIndex = segment
        if len(self.segments) < 2:
            return
        if segmentIndex == 0:
            return
        if segmentIndex >= len(segments):
            raise ValueError(("The contour does not contain a segment "
                              "at index %d" % segmentIndex))
        self._setStartSegment(segmentIndex)
1166489
public synchronized Segment nextSegment() {
    assertOpen();
    Segment lastSegment = lastSegment();
    SegmentDescriptor descriptor = SegmentDescriptor.builder()
      .withId(lastSegment != null ? lastSegment.descriptor().id() + 1 : 1)
      .withVersion(1)
      .withIndex(currentSegment.lastIndex() + 1)
      .withMaxSegmentSize(storage.maxSegmentSize())
      .withMaxEntries(storage.maxEntriesPerSegment())
      .build();
    descriptor.lock();

    currentSegment = createSegment(descriptor);

    segments.put(descriptor.index(), currentSegment);
    return currentSegment;
  }
540590
function(segment) {

            var previousSegment = segment.previousSegment; // may be null
            while (segment && !segment.isSubpathStart) {

                // assign previous segment's subpath start segment to this segment
                if (previousSegment) segment.subpathStartSegment = previousSegment.subpathStartSegment; // may be null
                else segment.subpathStartSegment = null; // if segment had no previous segment, assign null - creates an invalid path!

                previousSegment = segment;
                segment = segment.nextSegment; // move on to the segment after etc.
            }
        }
1265785
def createSections(self):
        """"""
        self.soma = h.Section(name='soma', cell=self)
        self.dend = h.Section(name='dend', cell=self)
413476
Segment writableSegment(int minimumCapacity) {
    if (minimumCapacity < 1 || minimumCapacity > Segment.SIZE) throw new IllegalArgumentException();

    if (head == null) {
      head = SegmentPool.take(); // Acquire a first segment.
      return head.next = head.prev = head;
    }

    Segment tail = head.prev;
    if (tail.limit + minimumCapacity > Segment.SIZE || !tail.owner) {
      tail = tail.push(SegmentPool.take()); // Append a new empty segment to fill up.
    }
    return tail;
  }