java.util.Vector.set()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(130)

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

Vector.set介绍

[英]Replaces the element at the specified location in this vector with the specified object.
[中]用指定的对象替换此向量中指定位置的元素。

代码示例

代码示例来源:origin: marytts/marytts

private void interpolateSegments(Vector<Double> f0) {
  int i, n, interval;
  double slope;
  // check where there are zeros and interpolate
  int[] index = new int[2];
  double[] value = new double[2];
  index[0] = 0;
  value[0] = 0.0;
  for (i = 0; i < f0.size(); i++) {
    if (f0.get(i) > 0.0) {
      index[1] = i;
      value[1] = f0.get(i);
      interval = index[1] - index[0];
      if (interval > 1) {
        // System.out.format("Interval to interpolate index[0]=%d index[1]=%d\n",index[0],index[1]);
        slope = ((value[1] - value[0]) / interval);
        for (n = index[0]; n < index[1]; n++) {
          double newVal = (slope * (n - index[0])) + value[0];
          f0.set(n, newVal);
          // System.out.format(" n=%d value:%.1f\n",n,newVal);
        }
      }
      index[0] = index[1];
      value[0] = value[1];
    }
  }
}

代码示例来源:origin: javiersantos/PiracyChecker

public void setExpansionFileSize(int index, long size) {
  if (index >= mExpansionFileSizes.size()) {
    mExpansionFileSizes.setSize(index + 1);
  }
  mExpansionFileSizes.set(index, size);
}

代码示例来源:origin: javiersantos/PiracyChecker

public void setExpansionFileName(int index, String name) {
  if (index >= mExpansionFileNames.size()) {
    mExpansionFileNames.setSize(index + 1);
  }
  mExpansionFileNames.set(index, name);
}

代码示例来源:origin: marytts/marytts

private void interpolateSegments(Vector<Double> f0) {
  int i, n, interval;
  double slope;
  // check where there are zeros and interpolate
  int[] index = new int[2];
  double[] value = new double[2];
  index[0] = 0;
  value[0] = 0.0;
  for (i = 0; i < f0.size(); i++) {
    if (f0.get(i) > 0.0) {
      index[1] = i;
      value[1] = f0.get(i);
      interval = index[1] - index[0];
      if (interval > 1) {
        // System.out.format("Interval to interpolate index[0]=%d index[1]=%d\n",index[0],index[1]);
        slope = ((value[1] - value[0]) / interval);
        for (n = index[0]; n < index[1]; n++) {
          double newVal = (slope * (n - index[0])) + value[0];
          f0.set(n, newVal);
          // System.out.format(" n=%d value:%.1f\n",n,newVal);
        }
      }
      index[0] = index[1];
      value[0] = value[1];
    }
  }
}

代码示例来源:origin: javiersantos/PiracyChecker

/**
 * Sets the expansion URL. Expansion URL's are not committed to preferences, but are instead
 * intended to be stored when the license response is processed by the front-end.
 *
 * @param index
 *         the index of the expansion URL. This value will be either MAIN_FILE_URL_INDEX or
 *         PATCH_FILE_URL_INDEX
 * @param URL
 *         the URL to set
 */
public void setExpansionURL(int index, String URL) {
  if (index >= mExpansionURLs.size()) {
    mExpansionURLs.setSize(index + 1);
  }
  mExpansionURLs.set(index, URL);
}

代码示例来源:origin: xalan/xalan

private int partition(Vector templates, int p, int r) {
final Template x = (Template)templates.elementAt(p);
int i = p - 1;
int j = r + 1;
while (true) {
  while (x.compareTo((Template)templates.elementAt(--j)) > 0);
  while (x.compareTo((Template)templates.elementAt(++i)) < 0);
  if (i < j) {
  templates.set(j, templates.set(i, templates.elementAt(j)));
  }
  else {
  return j;
  }
}
}

代码示例来源:origin: linkedin/indextank-engine

/**
 * @param parameter zero-based parameter number
 */
public void addAnnotation(int parameter, Annotation annotation) {
  if (parameter >= mParameterAnnotations.size()) {
    mParameterAnnotations.setSize(parameter);
  }
  Vector<Annotation> annotations = mParameterAnnotations.get(parameter);
  if (annotations == null) {
    annotations = new Vector<Annotation>(2);
    mParameterAnnotations.set(parameter, annotations);
  }
  annotations.add(annotation);
}

代码示例来源:origin: smuyyh/BookReader

lines.set(lines.size() - 1, lines.get(lines.size() - 1) + "@");
if (strParagraph.length() != 0) {
  try {

代码示例来源:origin: linkedin/indextank-engine

/** 
 * Will only insert into the pool if the constant is not already in the
 * pool. 
 *
 * @return The actual constant in the pool.
 */
public ConstantInfo addConstant(ConstantInfo constant) {
  ConstantInfo info = mConstants.get(constant);
  if (info != null) {
    return info;
  }
  
  int entryCount = constant.getEntryCount();
  if (mIndexedConstants != null && mPreserveOrder) {
    int size = mIndexedConstants.size();
    mIndexedConstants.setSize(size + entryCount);
    mIndexedConstants.set(size, constant);
    constant.mIndex = size;
  }
  mConstants.put(constant, constant);
  mEntries += entryCount;
  return constant;
}

代码示例来源:origin: smuyyh/BookReader

lines.set(lines.size() - 1, lines.get(lines.size() - 1) + "@");

代码示例来源:origin: linkedin/indextank-engine

mLocals.setSize(index + 1);
local = mAssembler.createLocalVariable(null, type);
mLocals.set(index, local);
return local;
mLocals.set(index, local);
return local;
local = mAssembler.createLocalVariable(null, type);
locals.add(local);
mLocals.set(index, locals);
return local;

代码示例来源:origin: xalan/xalan

/**
 * Adds an attribute to the list
 */
public void add(String qname, String value) {
// Initialize the internal vectors at the first usage.
if (_attributes == null)
  alloc();

// Stuff the QName into the names vector & hashtable
Integer obj = (Integer)_attributes.get(qname);
if (obj == null) {
  _attributes.put(qname, obj = new Integer(_length++));
  _qnames.addElement(qname);
  _values.addElement(value);
  int col = qname.lastIndexOf(':');
  if (col > -1) {
  _uris.addElement(qname.substring(0,col));
  _names.addElement(qname.substring(col+1));
  }
  else {
  _uris.addElement(EMPTYSTRING);
  _names.addElement(qname);
  }
}
else {
  final int index = obj.intValue();
  _values.set(index, value);
}
}

代码示例来源:origin: marytts/marytts

dur.set(1, (dur.get(1) + dur.get(0)));
ph.set(0, "");
ph.set(0, "");
  phone.setAttribute("end", String.valueOf(totalDur));
  ph.set(index, "");
} else if (e.getTagName().contentEquals(MaryXML.BOUNDARY)) {
  int breakindex = 0;
    e.setAttribute("duration", String.valueOf(currentDur));
    ph.set(index, "");

代码示例来源:origin: marytts/marytts

dur.set(1, (dur.get(1) + dur.get(0)));
ph.set(0, "");
ph.set(0, "");
  phone.setAttribute("end", String.valueOf(totalDur));
  ph.set(index, "");
} else if (e.getTagName().contentEquals(MaryXML.BOUNDARY)) {
  int breakindex = 0;
    e.setAttribute("duration", String.valueOf(currentDur));
    ph.set(index, "");

代码示例来源:origin: marytts/marytts

dur.set(1, (dur.get(1) + dur.get(0)));
ph.set(0, "");
ph.set(0, "");
    phone.setAttribute("f0", currentF0);
  ph.set(index, "");
} else if (e.getTagName().contentEquals(MaryXML.BOUNDARY)) {
  int breakindex = 0;
    e.setAttribute("duration", String.valueOf(currentDur));
    ph.set(index, "");

代码示例来源:origin: marytts/marytts

dur.set(1, (dur.get(1) + dur.get(0)));
ph.set(0, "");
ph.set(0, "");
    phone.setAttribute("f0", currentF0);
  ph.set(index, "");
} else if (e.getTagName().contentEquals(MaryXML.BOUNDARY)) {
  int breakindex = 0;
    e.setAttribute("duration", String.valueOf(currentDur));
    ph.set(index, "");

代码示例来源:origin: org.apache.poi/poi

ensureFormatsSize(i);
    if (_formats.get(i) == null) {
      _formats.set(i, _builtinFormats[i]);
    } else {
_formats.set(index, format);
return index;

代码示例来源:origin: org.apache.poi/poi

/**
 * Constructs a new data formatter.  It takes a workbook to have
 * access to the workbooks format records.
 * @param workbook the workbook the formats are tied to.
 */
HSSFDataFormat(InternalWorkbook workbook) {
  _workbook = workbook;
  Iterator<FormatRecord> i = workbook.getFormats().iterator();
  while (i.hasNext()) {
    FormatRecord r = i.next();
    ensureFormatsSize(r.getIndexCode());
    _formats.set(r.getIndexCode(), r.getFormatString());
  }
}

代码示例来源:origin: Sable/soot

valueAfter.set(nodes.indexOf(s), afterFlow);

代码示例来源:origin: xalan/xalan

/**
 * When the parser realises that it is dealign with a simplified stylesheet
 * it will create an empty Stylesheet object with the root element of the
 * stylesheet (a LiteralElement object) as its only child. The Stylesheet
 * object will then create this Template object and invoke this method to
 * force some specific behaviour. What we need to do is:
 *  o) create a pattern matching on the root node
 *  o) add the LRE root node (the only child of the Stylesheet) as our
 *     only child node
 *  o) set the empty Stylesheet as our parent
 *  o) set this template as the Stylesheet's only child
 */
public void parseSimplified(Stylesheet stylesheet, Parser parser) {
_stylesheet = stylesheet;
setParent(stylesheet);
_name = null;
_mode = null;
_priority = Double.NaN;
_pattern = parser.parsePattern(this, "/");
final Vector contents = _stylesheet.getContents();
final SyntaxTreeNode root = (SyntaxTreeNode)contents.elementAt(0);
if (root instanceof LiteralElement) {
  addElement(root);
  root.setParent(this);
  contents.set(0, this);
  parser.setTemplate(this);
  root.parseContents(parser);
  parser.setTemplate(null);
}
}

相关文章