本文整理汇总了Java中prefuse.data.Tuple.getString方法的典型用法代码示例。如果您正苦于以下问题:Java Tuple.getString方法的具体用法?Java Tuple.getString怎么用?Java Tuple.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.Tuple
的用法示例。
在下文中一共展示了Tuple.getString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preloadImages
import prefuse.data.Tuple; //导入方法依赖的package包/类
/**
* <p>Preloads images for use in a visualization. Images to load are
* determined by taking objects from the given iterator and retrieving
* the value of the specified field. The items in the iterator must
* be instances of the {@link prefuse.data.Tuple} class.</p>
*
* <p>Images are loaded in the order specified by the iterator until the
* the iterator is empty or the maximum image cache size is met. Thus
* higher priority images should appear sooner in the iteration.</p>
*
* @param iter an Iterator of {@link prefuse.data.Tuple} instances
* @param field the data field that contains the image location
*/
public void preloadImages(Iterator iter, String field) {
boolean synch = m_asynch;
m_asynch = false;
String loc = null;
while ( iter.hasNext() && imageCache.size() <= m_imageCacheSize ) {
// get the string describing the image location
Tuple t = (Tuple)iter.next();
loc = t.getString(field);
if ( loc != null ) {
getImage(loc);
}
}
m_asynch = synch;
}
示例2: search
import prefuse.data.Tuple; //导入方法依赖的package包/类
/**
* @see prefuse.data.search.SearchTupleSet#search(java.lang.String)
*/
public void search(String query) {
if ( query == null )
query = "";
if ( !m_caseSensitive )
query = query.toLowerCase();
if ( query.equals(m_query) )
return;
Pattern pattern = null;
try {
pattern = Pattern.compile(query);
} catch ( Exception e ) {
Logger logger = Logger.getLogger(this.getClass().getName());
logger.warning("Pattern compile failed."
+ "\n" + StringLib.getStackTrace(e));
return;
}
Tuple[] rem = clearInternal();
m_query = query;
Iterator fields = m_source.keySet().iterator();
while ( fields.hasNext() ) {
String field = (String)fields.next();
TupleSet ts = (TupleSet)m_source.get(field);
Iterator tuples = ts.tuples();
while ( tuples.hasNext() ) {
Tuple t = (Tuple)tuples.next();
String text = t.getString(field);
if ( !m_caseSensitive )
text = text.toLowerCase();
if ( pattern.matcher(text).matches() )
addInternal(t);
}
}
Tuple[] add = getTupleCount() > 0 ? toArray() : null;
fireTupleEvent(add, rem);
}
示例3: index
import prefuse.data.Tuple; //导入方法依赖的package包/类
/**
* Indexes the given field of the provided Tuple instance.
* @see prefuse.data.search.SearchTupleSet#index(prefuse.data.Tuple, java.lang.String)
*/
public void index(Tuple t, String field) {
String s;
if ( (s=t.getString(field)) == null ) return;
StringTokenizer st = new StringTokenizer(s,m_delim);
while ( st.hasMoreTokens() ) {
String tok = st.nextToken();
addString(tok, t);
}
}
示例4: unindex
import prefuse.data.Tuple; //导入方法依赖的package包/类
/**
* @see prefuse.data.search.SearchTupleSet#unindex(prefuse.data.Tuple, java.lang.String)
*/
public void unindex(Tuple t, String field) {
String s;
if ( (s=t.getString(field)) == null ) return;
StringTokenizer st = new StringTokenizer(s,m_delim);
while ( st.hasMoreTokens() ) {
String tok = st.nextToken();
removeString(tok, t);
}
}