本文整理汇总了Java中org.apache.uima.jcas.cas.StringArray.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java StringArray.toArray方法的具体用法?Java StringArray.toArray怎么用?Java StringArray.toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.jcas.cas.StringArray
的用法示例。
在下文中一共展示了StringArray.toArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeFieldToDb
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
static void writeFieldToDb(String range, BasicDBObject o, Annotation a,
String dbKey, Feature f) {
if (range.equals("String")) {
o.put(dbKey, a.getStringValue(f));
} else if (range.equals("StringArray")) {
StringArray sa = (StringArray) a.getFeatureValue(f);
if (sa != null) {
String[] vals = sa.toArray();
o.put(dbKey, Lists.newArrayList(vals));
}
} else if (range.equals("Integer")) {
o.put(dbKey, a.getIntValue(f));
} else if (range.equals("Float")) {
o.put(dbKey, a.getFloatValue(f));
} else if (range.equals("Boolean")) {
o.put(dbKey, a.getBooleanValue(f));
} else {
LOG.warn("range not supported " + range);
}
}
示例2: buildCssStyle
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
/**
* Create a CSS style string for the style annotation
*
* @param s
* the style
* @return the string
*/
private String buildCssStyle(final Style s) {
final String color = s.getColor();
final StringArray decorations = s.getDecoration();
final String font = s.getFont();
// If no style info stop
if (Strings.isNullOrEmpty(color) && Strings.isNullOrEmpty(font)
&& (decorations == null || decorations.size() == 0)) {
return null;
}
final StringBuilder sb = new StringBuilder();
// This is very naive, it a passthrough of the original formats values
// Effectively we are just hoping the browser knows what to do.
if (!Strings.isNullOrEmpty(color)) {
sb.append(String.format("color:%s; ", color));
}
if (!Strings.isNullOrEmpty(font)) {
sb.append(String.format("font-family:\"%s\"; ", color));
}
if (decorations != null && decorations.size() > 0) {
final String[] array = decorations.toArray();
for (final String a : array) {
switch (a.toUpperCase()) {
case "UNDERLINE":
sb.append("text-decoration:underline; ");
break;
case "BOLD":
sb.append("font-weight:bold; ");
break;
case "ITALIC":
case "ITALICS":
sb.append("font-style:italic; ");
break;
case "STRIKE":
case "STRIKETHROUGH":
sb.append("text-decoration: line-through; ");
break;
case "SUPERSCRIPT":
sb.append("font-size: .7em; vertical-align: super; ");
break;
case "SUBSCRIPT":
sb.append("font-size: .7em; vertical-align: sub; ");
break;
case "BIG":
sb.append("font-size: 1.2em; ");
break;
case "SMALL":
sb.append("font-size: .9em; ");
break;
case "highlighted":
sb.append("background-color:#ffffe0; ");
break;
default:
// No nothing - we don't know what it means
break;
}
}
}
return sb.toString();
}
示例3: toArray
import org.apache.uima.jcas.cas.StringArray; //导入方法依赖的package包/类
/**
* Create a new string array from a stringarray
*
* @param jCas
* the jCas which will own the StringArray
* @param stringarray
* the string aray
* @return the string array (non-null)
*/
public static String[] toArray(StringArray array) {
if (array == null) {
return new String[0];
} else {
return array.toArray();
}
}