org.eclipse.core.runtime.Path.isUNC()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中org.eclipse.core.runtime.Path.isUNC()方法的一些代码示例,展示了Path.isUNC()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.isUNC()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Path
类名称:Path
方法名:isUNC

Path.isUNC介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.equinox/common

public IPath makeUNC(boolean toUNC) {
  // if we are already in the right form then just return
  if (!(toUNC ^ isUNC()))
    return this;
  int newSeparators = this.separators;
  if (toUNC) {
    newSeparators |= HAS_LEADING | IS_UNC;
  } else {
    //mask out the UNC bit
    newSeparators &= HAS_LEADING | HAS_TRAILING;
  }
  return new Path(toUNC ? null : device, segments, newSeparators);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.equinox.common

public IPath makeUNC(boolean toUNC) {
  // if we are already in the right form then just return
  if (!(toUNC ^ isUNC()))
    return this;
  int newSeparators = this.separators;
  if (toUNC) {
    newSeparators |= HAS_LEADING | IS_UNC;
  } else {
    //mask out the UNC bit
    newSeparators &= HAS_LEADING | HAS_TRAILING;
  }
  return new Path(toUNC ? null : device, segments, newSeparators);
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.common

@Override
public IPath makeUNC(boolean toUNC) {
  // if we are already in the right form then just return
  if (!(toUNC ^ isUNC()))
    return this;
  int newSeparators = this.flags;
  if (toUNC) {
    newSeparators |= HAS_LEADING | IS_UNC;
  } else {
    //mask out the UNC bit
    newSeparators &= HAS_LEADING | HAS_TRAILING | IS_FOR_WINDOWS;
  }
  return new Path(toUNC ? null : device, segments, newSeparators);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.equinox.common

@Override
public IPath makeUNC(boolean toUNC) {
  // if we are already in the right form then just return
  if (!(toUNC ^ isUNC()))
    return this;
  int newSeparators = this.flags;
  if (toUNC) {
    newSeparators |= HAS_LEADING | IS_UNC;
  } else {
    //mask out the UNC bit
    newSeparators &= HAS_LEADING | HAS_TRAILING | IS_FOR_WINDOWS;
  }
  return new Path(toUNC ? null : device, segments, newSeparators);
}

代码示例来源:origin: org.eclipse.equinox/common

public IPath append(IPath tail) {
  //optimize some easy cases
  if (tail == null || tail.segmentCount() == 0)
    return this;
  //these call chains look expensive, but in most cases they are no-ops
  if (this.isEmpty())
    return tail.setDevice(device).makeRelative().makeUNC(isUNC());
  if (this.isRoot())
    return tail.setDevice(device).makeAbsolute().makeUNC(isUNC());
  //concatenate the two segment arrays
  int myLen = segments.length;
  int tailLen = tail.segmentCount();
  String[] newSegments = new String[myLen + tailLen];
  System.arraycopy(segments, 0, newSegments, 0, myLen);
  for (int i = 0; i < tailLen; i++) {
    newSegments[myLen + i] = tail.segment(i);
  }
  //use my leading separators and the tail's trailing separator
  Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
  String tailFirstSegment = newSegments[myLen];
  if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
    result.canonicalize();
  }
  return result;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.equinox.common

public IPath append(IPath tail) {
  //optimize some easy cases
  if (tail == null || tail.segmentCount() == 0)
    return this;
  //these call chains look expensive, but in most cases they are no-ops
  if (this.isEmpty())
    return tail.setDevice(device).makeRelative().makeUNC(isUNC());
  if (this.isRoot())
    return tail.setDevice(device).makeAbsolute().makeUNC(isUNC());
  //concatenate the two segment arrays
  int myLen = segments.length;
  int tailLen = tail.segmentCount();
  String[] newSegments = new String[myLen + tailLen];
  System.arraycopy(segments, 0, newSegments, 0, myLen);
  for (int i = 0; i < tailLen; i++) {
    newSegments[myLen + i] = tail.segment(i);
  }
  //use my leading separators and the tail's trailing separator
  Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
  String tailFirstSegment = newSegments[myLen];
  if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
    result.canonicalize();
  }
  return result;
}

代码示例来源:origin: com.github.veithen.cosmos.bootstrap/org.eclipse.equinox.common

@Override
public IPath append(IPath tail) {
  //optimize some easy cases
  if (tail == null || tail.segmentCount() == 0)
    return this;
  //these call chains look expensive, but in most cases they are no-ops
  //the tail must be for the same platform as this instance
  if (this.isEmpty() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$
    return tail.setDevice(device).makeRelative().makeUNC(isUNC());
  if (this.isRoot() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$
    return tail.setDevice(device).makeAbsolute().makeUNC(isUNC());
  //concatenate the two segment arrays
  int myLen = segments.length;
  int tailLen = tail.segmentCount();
  String[] newSegments = new String[myLen + tailLen];
  System.arraycopy(segments, 0, newSegments, 0, myLen);
  for (int i = 0; i < tailLen; i++) {
    newSegments[myLen + i] = tail.segment(i);
  }
  //use my leading separators and the tail's trailing separator
  Path result = new Path(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
  String tailFirstSegment = newSegments[myLen];
  if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
    result.canonicalize();
  }
  return result;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.equinox.common

@Override
public IPath append(IPath tail) {
  //optimize some easy cases
  if (tail == null || tail.segmentCount() == 0)
    return this;
  //these call chains look expensive, but in most cases they are no-ops
  //the tail must be for the same platform as this instance
  if (this.isEmpty() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$
    return tail.setDevice(device).makeRelative().makeUNC(isUNC());
  if (this.isRoot() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$
    return tail.setDevice(device).makeAbsolute().makeUNC(isUNC());
  //concatenate the two segment arrays
  int myLen = segments.length;
  int tailLen = tail.segmentCount();
  String[] newSegments = new String[myLen + tailLen];
  System.arraycopy(segments, 0, newSegments, 0, myLen);
  for (int i = 0; i < tailLen; i++) {
    newSegments[myLen + i] = tail.segment(i);
  }
  //use my leading separators and the tail's trailing separator
  Path result = new Path(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0));
  String tailFirstSegment = newSegments[myLen];
  if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$
    result.canonicalize();
  }
  return result;
}

相关文章