org.jdom2.Element.getContentSize()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(78)

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

Element.getContentSize介绍

暂无

代码示例

代码示例来源:origin: org.jdom/jdom

@Override
public List<Content> cloneContent() {
  final int size = getContentSize();
  final List<Content> list = new ArrayList<Content>(size);
  for (int i = 0; i < size; i++) {
    final Content child = getContent(i);
    list.add(child.clone());
  }
  return list;
}

代码示例来源:origin: org.jdom/jdom

if ((ret instanceof Element) && ((Element)ret).getContentSize() > 0) {

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @return The content size.
 * @see org.jdom2.Element#getContentSize()
 */
public int getContentSize()
{
  return element.getContentSize();
}

代码示例来源:origin: org.mycore/mycore-xeditor

public static MCRChangeData setBreakpoint(Element context, String label) {
  return new MCRChangeData("breakpoint", label, context.getContentSize(), context);
}

代码示例来源:origin: crosswire/jsword

public void updateOsisStack(Book book, Key key, LinkedList<Content> stack) {
    if (stack.isEmpty()) {
      DataPolice.report(book, key, "Ignoring end tag without corresponding start tag: " + getName());
      return;
    }
    Object pop = stack.removeFirst();
    if (!(pop instanceof Element)) {
      DataPolice.report(book, key, "expected to pop a Note, but found " + ClassUtil.getShortClassName(pop.getClass()));
      return;
    }
    Element note = (Element) pop;
    if (note.getContentSize() < 1) {
      Content top = stack.get(0);
      if (top instanceof Element) {
        Element ele = (Element) top;
        ele.removeContent(note);
      }
    }
  }
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an Algorithm from a JDOM representation of an algorithm element.
 * 
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param rc
 * @return an Algorithm, or null if the document doesn't contain an algorithm element.
 * @throws ObservationParsingException 
 */
protected Algorithm getAlgorithm(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("algorithm", parent, namespace, true);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  String name = getChildText("name", element, namespace, true);
  return new Algorithm(name);
}

代码示例来源:origin: org.opencadc/caom2

protected EnergyTransition getTransition(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("transition", parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  String species = getChildText("species", element, namespace, true);
  String transition = getChildText("transition", element, namespace, true);
  return new EnergyTransition(species, transition);
}

代码示例来源:origin: org.opencadc/caom2

/**
 * 
 * @param parent
 * @param namespace
 * @param rc
 * @return
 * @throws ObservationParsingException 
 */
protected Requirements getRequirements(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("requirements", parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  String flag = getChildText("flag", element, namespace, true);
  Requirements req = new Requirements(Status.toValue(flag));
  return req;
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an CoordRange2D from a JDOM representation of an element named name.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @return an CoordRange2D, or null if the document doesn't contain element named name.
 * @throws ObservationParsingException 
 */
protected CoordRange2D getCoordRange2D(String name, Element parent, Namespace namespace, boolean required)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, required);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  Coord2D start = getCoord2D("start", element, namespace, true);
  Coord2D end = getCoord2D("end", element, namespace, true);
  return new CoordRange2D(start, end);
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an Dimension2D from a JDOM representation of an element named name.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @return an Dimension2D, or null if the document doesn't contain element named name.
 * @throws ObservationParsingException 
 */
protected Dimension2D getDimension2D(String name, Element parent, Namespace namespace, boolean required)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  Long naxis1 = getChildTextAsLong("naxis1", element, namespace, true);
  Long naxis2 = getChildTextAsLong("naxis2", element, namespace, true);
  return new Dimension2D(naxis1, naxis2);
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an RefCoord from a JDOM representation of an element named name.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @return an RefCoord, or null if the document doesn't contain element named name.
 * @throws ObservationParsingException 
 */
protected RefCoord getRefCoord(String name, Element parent, Namespace namespace, boolean required)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  Double pix = getChildTextAsDouble("pix", element, namespace, true);
  Double val = getChildTextAsDouble("val", element, namespace, true);
  return new RefCoord(pix, val);
}

代码示例来源:origin: org.opencadc/caom2

/**
 * 
 * @param parent
 * @param namespace
 * @param rc
 * @return
 * @throws ObservationParsingException 
 */
protected DataQuality getQuality(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("quality", parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  String flag = getChildText("flag", element, namespace, true);
  DataQuality ret = new DataQuality(Quality.toValue(flag));
  
  return ret;
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an Coord2D from a JDOM representation of an element named name.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @return a Coord2D, or null if the document doesn't contain element named name.
 * @throws ObservationParsingException 
 */
protected Coord2D getCoord2D(String name, Element parent, Namespace namespace, boolean required)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, required);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  RefCoord coord1 = getRefCoord("coord1", element, namespace, true);
  RefCoord coord2 = getRefCoord("coord2", element, namespace, true);
  return new Coord2D(coord1, coord2);
}
/**

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an ObservableAxis from a JDOM representation of an observable element.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @param rc
 * @return an ObservableAxis, or null if the document doesn't contain an observable element.
 * @throws ObservationParsingException 
 */
protected ObservableAxis getObservableAxis(String name, Element parent, Namespace namespace, boolean required, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  Slice dependent = getSlice("dependent", element, namespace, true);        
  ObservableAxis observable = new ObservableAxis(dependent);
  observable.independent = getSlice("independent", element, namespace, false);
  return observable;
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an ValueCoord2D from a JDOM representation of an element named name.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @return a ValueCoord2D, or null if the document doesn't contain element named name.
 * @throws ObservationParsingException 
 */
protected ValueCoord2D getValueCoord2D(String name, Element parent, Namespace namespace, boolean required)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, required);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  
  double coord1 = getChildTextAsDouble("coord1", element, namespace, true);
  double coord2 = getChildTextAsDouble("coord2", element, namespace, true);
  return new ValueCoord2D(coord1, coord2);
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an CoordFunction1D from a JDOM representation of an element named name.
 * 
 * @param name the name of the Element.
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param required is the element expected to be found.
 * @return an CoordFunction1D, or null if the document doesn't contain element named name.
 * @throws ObservationParsingException 
 */
protected CoordFunction1D getCoordFunction1D(String name, Element parent, Namespace namespace, boolean required)
  throws ObservationParsingException
{
  Element element = getChildElement(name, parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  Long naxis = getChildTextAsLong("naxis", element, namespace, true);
  Double delta = getChildTextAsDouble("delta", element, namespace, true);
  RefCoord refCoord = getRefCoord("refCoord", element, namespace, true);
  return new CoordFunction1D(naxis, delta, refCoord);
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an Instrument from a JDOM representation of an instrument element.
 * 
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param rc
 * @return an Instrument, or null if the document doesn't contain an instrument element.
 * @throws ObservationParsingException 
 */
protected Instrument getInstrument(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("instrument", parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  String name = getChildText("name", element, namespace, true);
  Instrument instrument = new Instrument(name);
  
  addChildTextToStringList("keywords", instrument.getKeywords(), element, namespace, false);
  
  return instrument;
}

代码示例来源:origin: org.opencadc/caom2

protected Metrics getMetrics(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("metrics", parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  Metrics metrics = new Metrics();
  metrics.sourceNumberDensity = getChildTextAsDouble("sourceNumberDensity", element, namespace, false);
  metrics.background = getChildTextAsDouble("background", element, namespace, false);
  metrics.backgroundStddev = getChildTextAsDouble("backgroundStddev", element, namespace, false);
  metrics.fluxDensityLimit = getChildTextAsDouble("fluxDensityLimit", element, namespace, false);
  metrics.magLimit = getChildTextAsDouble("magLimit", element, namespace, false);
  return metrics;
}

代码示例来源:origin: org.opencadc/caom2

/**
 * Build an Telescope from a JDOM representation of an telescope element.
 * 
 * @param parent the parent Element.
 * @param namespace of the document.
 * @param rc
 * @return an TarTelescopeget, or null if the document doesn't contain an telescope element.
 * @throws ObservationParsingException 
 */
protected Telescope getTelescope(Element parent, Namespace namespace, ReadContext rc)
  throws ObservationParsingException
{
  Element element = getChildElement("telescope", parent, namespace, false);
  if (element == null || element.getContentSize() == 0)
    return null;
  
  String name = getChildText("name", element, namespace, true);
  Telescope telescope = new Telescope(name);
  telescope.geoLocationX =  getChildTextAsDouble("geoLocationX", element, namespace, false);
  telescope.geoLocationY =  getChildTextAsDouble("geoLocationY", element, namespace, false);
  telescope.geoLocationZ =  getChildTextAsDouble("geoLocationZ", element, namespace, false);
  addChildTextToStringList("keywords", telescope.getKeywords(), element, namespace, false);
  
  return telescope;
}

代码示例来源:origin: usethesource/rascal

private IConstructor convertElement(Element e, boolean trim) {
  IListWriter kids = vf.listWriter(Factory.Node);
  for (Object o: e.getAttributes()) {
    Attribute attr = (Attribute)o;
    IString key = vf.string(attr.getName());
    IString val = vf.string(attr.getValue());
    kids.insert(vf.constructor(Factory.Node_attribute, convertNamespace(attr.getNamespace()), key, val));
  }
  int len = e.getContentSize();
  for (int i = 0; i < len; i++) {
    try {
      kids.append(convertContent(e.getContent(i), trim));
    }
    catch (Skip c) { // Ugh, terrible, but I'm in hurry
      continue;
    }
  }
  
  IString name = vf.string(e.getName());
  return vf.constructor(Factory.Node_element, convertNamespace(e.getNamespace()), name, kids.done());
}

相关文章

微信公众号

最新文章

更多