本文整理汇总了Java中prefuse.data.io.DataIOException类的典型用法代码示例。如果您正苦于以下问题:Java DataIOException类的具体用法?Java DataIOException怎么用?Java DataIOException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataIOException类属于prefuse.data.io包,在下文中一共展示了DataIOException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: run
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* @see java.lang.Runnable#run()
*/
public void run() {
while ( true ) {
Entry e = null;
synchronized ( s_queue ) {
if ( s_queue.size() > 0 )
e = (Entry)s_queue.remove(0);
}
if ( e != null ) {
try {
if ( e.listener != null ) e.listener.preQuery(e);
e.ds.getData(e.table, e.query, e.keyField, e.lock);
if ( e.listener != null ) e.listener.postQuery(e);
} catch ( DataIOException dre ) {
s_logger.warning(dre.getMessage() + "\n"
+ StringLib.getStackTrace(dre));
}
} else {
// nothing to do, chill out until notified
try {
synchronized (this) { wait(); }
} catch (InterruptedException ex) { }
}
}
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:29,代码来源:DataSourceWorker.java
示例2: readGraph
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* @see prefuse.data.io.GraphReader#readGraph(java.io.InputStream)
*/
@Override
public Graph readGraph(InputStream is) throws DataIOException {
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
GraphMLHandler handler = new GraphMLHandler();
saxParser.parse(is, handler);
return handler.getGraph();
} catch ( Exception e ) {
if ( e instanceof DataIOException ) {
throw (DataIOException)e;
} else {
throw new DataIOException(e);
}
}
}
开发者ID:renespeck,项目名称:Cugar,代码行数:22,代码来源:GraphMLReaderMod.java
示例3: main
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* @param args
* @throws TemporalDataException
*/
public static void main(String[] args) throws TemporalDataException {
Locale.setDefault(Locale.US);
TemporalDataset events = null;
TemporalDataset patterns = null;
try {
GraphMLTemporalDatasetReader gmltdr = new GraphMLTemporalDatasetReader();
events = gmltdr.readData("data/cardiovascular_events.graphml.gz");
DebugHelper.printTemporalDatasetTable(System.out, events,"label","class",TemporalObject.ID);
patterns = gmltdr.readData("data/cardiovascular_patterns.graphml.gz");
//DebugHelper.printTemporalDatasetForest(System.out,patterns, "label",TemporalObject.ID);
} catch (DataIOException e) {
e.printStackTrace();
}
DataHelper.printMetadata(System.out, events.getNodeTable());
DataHelper.printMetadata(System.out, patterns.getNodeTable());
createVisualization(patterns,events);
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:27,代码来源:ArcDiagramDemo.java
示例4: readData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
@Override
public TemporalDataset readData(InputStream is) throws DataIOException,
TemporalDataException {
TemporalDataColumnSpecification spec = (this.spec != null) ? this.spec
: new TemporalDataColumnSpecification();
TableReader tableReader = spec.getTableFormat().getTableReader();
// XXX hack to handle prefuse String -> Date conversion in UTC
TimeZone oldDefault = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
Table table = tableReader.readTable(is);
TimeZone.setDefault(oldDefault);
if (logger.isInfoEnabled()) {
logger.info("Metadata of raw table:");
DataHelper.printMetadata(System.out, table);
}
if (this.spec == null)
scanTableForSpecification(table, spec);
TemporalDataset tmpds = new TemporalDataset();
importTable(table, tmpds, spec);
table = null;
return tmpds;
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:27,代码来源:TextTableTemporalDatasetReader.java
示例5: write
import prefuse.data.io.DataIOException; //导入依赖的package包/类
private void write(final IScope scope, final Graph prefuseGraph, final GraphWriter writer, final String filename) {
try {
writer.writeGraph(prefuseGraph, filename);
} catch (final DataIOException e) {
throw GamaRuntimeException.error(
"error during the exportation of the graph with a prefuse exporter: " + e.getMessage(), scope);
}
}
开发者ID:gama-platform,项目名称:gama,代码行数:11,代码来源:PrefuseWriterAbstract.java
示例6: getEdgeListToTable
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/** reads a delimited file to table*/
public Table getEdgeListToTable(){
DelimitedTextTableReader dttr = new DelimitedTextTableReader(getSeparatorToExtension(m_openFile));
dttr.setHasHeader(false);
try{
return dttr.readTable(m_openFile);
}catch(DataIOException e){
e.printStackTrace();
return null;
}
}
开发者ID:renespeck,项目名称:Cugar,代码行数:12,代码来源:Model.java
示例7: saveFile
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/** clusters to file*/
public void saveFile(File p_file){
if(m_clusterTable != null)
try{
new DelimitedTextTableWriter().writeTable(m_clusterTable, p_file);
}catch(DataIOException e){
e.printStackTrace();
}
}
开发者ID:renespeck,项目名称:Cugar,代码行数:10,代码来源:Model.java
示例8: readGraph
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
*
* Reads an edge list to a {@link prefuse.data.Graph} instance.
*
* @param file
* @param p_directed
* @return a Graph instance
*/
public Graph readGraph(File file, boolean p_directed ){
directed = p_directed;
try {
return readGraph(file);
}catch(DataIOException e){
e.printStackTrace();
}
return null;
}
开发者ID:renespeck,项目名称:Cugar,代码行数:19,代码来源:EdgeListGraphReader.java
示例9: demo
import prefuse.data.io.DataIOException; //导入依赖的package包/类
public static JFrame demo(String table) throws DataIOException,
TemporalDataException, IOException, JAXBException {
// TemporalDataColumnSpecification spec = new
// TemporalDataColumnSpecification();
// spec.setCalendar(CalendarManagerFactory.getSingleton(
// CalendarManagers.JavaDate).getDefaultCalendar());
// spec.setTableFormat(new TextTableFormat(Method.REGEX, true, true,
// "\t"));
// TemporalObjectEncoding enc = new DateInstantEncoding("", "Date");
// String[] dataCols = {"AvgTemp", "MaxTemp", "MinTemp",
// "Precipitation", "RelHumidity", "CloudCover", "SunshineDuration",
// "AirPressure", "Wind", "VaporContent"};
// enc.setDataColumns(dataCols);
// spec.addEncoding(enc);
// JaxbMarshaller.save(CLIMATE_DATA_SPEC, spec);
TextTableTemporalDatasetReader reader = new TextTableTemporalDatasetReader(
CLIMATE_DATA_SPEC);
TemporalDataset tmpds = reader.readData(table);
// ieg.prefuse.data.DataHelper.printTable(System.out, tmpds.getNodeTable());
ClimateDemo cd = new ClimateDemo(tmpds);
JFrame frame = new JFrame("TimeBench | climate");
frame.add(new ViewMenu(cd.timeScale), BorderLayout.EAST);
frame.add(cd, BorderLayout.CENTER);
TimeScaleHeader tsh = new TimeScaleHeader(cd.timeScale);
frame.add(tsh, BorderLayout.NORTH);
TimeScaleStatusBar statusBar = new TimeScaleStatusBar(cd.timeScale);
// Mac-Workaround: GrowBox hides Label
statusBar.add(Box.createHorizontalStrut(20));
frame.add(statusBar, BorderLayout.SOUTH);
frame.pack();
frame.setLocationRelativeTo(null);
return frame;
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:41,代码来源:ClimateDemo.java
示例10: readData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
@Override
public TemporalDataset readData(String location) throws DataIOException,
TemporalDataException {
try {
InputStream is = IOLib.streamFromString(location);
if (is == null)
throw new DataIOException("Couldn't find " + location
+ ". Not a valid file, URL, or resource locator.");
return readData(is);
} catch (IOException e) {
throw new DataIOException(e);
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:14,代码来源:AbstractTemporalDatasetReader.java
示例11: parseNode
import prefuse.data.io.DataIOException; //导入依赖的package包/类
private void parseNode(XMLStreamReader reader, TemporalDataset tmpds,
HashMap<String, String> attributeIdToName)
throws XMLStreamException, DataIOException {
String graphMLId = reader.getAttributeValue(null, Tokens.ID);
// hashMap that temporarily stores the data of a node, gathers as the
// necessary values to add it to the TMDS
HashMap<String, String> dataMap = new HashMap<String, String>();
while (reader.hasNext()) {
switch (reader.next()) {
case XMLEvent.START_ELEMENT:
if (Tokens.DATA.equals(reader.getLocalName())) {
Pair<String, String> data = parseData(reader,
attributeIdToName);
dataMap.put(data.getKey(), data.getValue());
}
break;
case XMLEvent.END_ELEMENT:
if (Tokens.NODE.equals(reader.getLocalName())) {
// node parsing complete
// ignore root node
if (!ROOT.equals(graphMLId)) {
long id = Long.parseLong(graphMLId.substring(1));
if (NodeType.OBJECT == NodeType.byPrefix(graphMLId)) {
createTemporalObject(tmpds, id, dataMap);
} else if (NodeType.ELEMENT == NodeType
.byPrefix(graphMLId)) {
createTemporalElement(tmpds, id, dataMap);
}
}
return;
}
}
}
throw new IllegalStateException(
"GraphML document ended prematurely in <node>.");
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:39,代码来源:GraphMLTemporalDatasetReader.java
示例12: parseEdge
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* reads XML content until the edge element ends and adds it to the cache.
* @param reader
* @param edgeCache
* @param attributeIdToName
* @throws XMLStreamException
* @throws DataIOException
*/
private void parseEdge(XMLStreamReader reader, Table edgeCache,
HashMap<String, String> attributeIdToName)
throws XMLStreamException, DataIOException {
// we assume that reader is on a <edge> element
Tuple edge = edgeCache.getTuple(edgeCache.addRow());
// parse source and target from attributes -> cache
edge.set(EDGE_SOURCE, reader.getAttributeValue(null, Tokens.SOURCE));
edge.set(EDGE_TARGET, reader.getAttributeValue(null, Tokens.TARGET));
while (reader.hasNext()) {
switch (reader.next()) {
case XMLEvent.START_ELEMENT:
if (Tokens.DATA.equals(reader.getLocalName())) {
Pair<String, String> data = parseData(reader,
attributeIdToName);
if (edge.getColumnIndex(data.getKey()) >= 0) {
edge.setString(data.getKey(), data.getValue());
} else {
throw new DataIOException("Unknown attribute key "
+ data.getKey() + " with value "
+ data.getValue());
}
}
break;
case XMLEvent.END_ELEMENT:
if (Tokens.EDGE.equals(reader.getLocalName())) {
// edge parsing complete
return;
}
}
}
throw new IllegalStateException(
"GraphML document ended prematurely in <edge>.");
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:43,代码来源:GraphMLTemporalDatasetReader.java
示例13: parseData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
private Pair<String, String> parseData(XMLStreamReader reader,
HashMap<String, String> attributeIdToName)
throws XMLStreamException, DataIOException {
// we assume that reader is on a <data> element
String key = reader.getAttributeValue(null, Tokens.KEY);
if (key == null) {
throw new DataIOException("<data> element without key.");
}
// build string from possibly multiple characters events
StringBuilder value = new StringBuilder();
// keep track of nested elements
int depth = 0;
while (reader.hasNext()) {
switch (reader.next()) {
case XMLEvent.CHARACTERS:
if (depth == 0) {
value.append(reader.getText());
}
break;
case XMLEvent.START_ELEMENT:
depth++;
break;
case XMLEvent.END_ELEMENT:
if (depth == 0 && Tokens.DATA.equals(reader.getLocalName())) {
// <data> parsing complete
String attName = attributeIdToName.get(key);
return new ImmutablePair<String, String>(attName,
value.toString());
} else {
depth--;
}
}
}
throw new DataIOException(
"GraphML document ended prematurely in <data>.");
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:40,代码来源:GraphMLTemporalDatasetReader.java
示例14: readData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
@Override
public TemporalDataset readData(InputStream is) throws DataIOException,
TemporalDataException {
Calendar calender = null;
// Building a calendar object from the given FileStream
try {
calender = new CalendarBuilder().build(is);
} catch (Exception e) {
e.printStackTrace();
throw new DataIOException("Calendar could not be instantiated!");
}
if (calender.getCalendarScale() != null
&& calender.getCalendarScale() != CalScale.GREGORIAN) {
throw new TemporalDataException("Calendar is not gregorian!");
}
// Extracting only those components which match
// the previously specified componentType
ComponentList componentList = calender.getComponents(m_componentType);
return readComponent(componentList);
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:27,代码来源:ICalenderTemporalDatasetReader.java
示例15: writeData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
@Override
public void writeData(TemporalDataset tmpds, File f) throws DataIOException {
try {
writeData(tmpds, new FileOutputStream(f));
} catch (FileNotFoundException e) {
throw new DataIOException(e);
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:9,代码来源:AbstractTemporalDatasetWriter.java
示例16: main
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* @param args
* @throws TemporalDataException
*/
public static void main(String[] args) throws TemporalDataException {
Locale.setDefault(Locale.US);
TemporalDataset events = null;
TemporalDataset patterns = null;
TemporalDataset flatPatterns = null;
TemporalDataset countedPatterns = null;
try {
GraphMLTemporalDatasetReader gmltdr = new GraphMLTemporalDatasetReader();
events = gmltdr.readData("data/events.graphml.gz");
//DebugHelper.printTemporalDatasetTable(System.out, events,"label","class",TemporalObject.ID);
patterns = gmltdr.readData("data/patterns.graphml.gz");
//DebugHelper.printTemporalDatasetForest(System.out,patterns, "label",TemporalObject.ID);
} catch (DataIOException e) {
e.printStackTrace();
}
//DataHelper.printMetadata(System.out, events.getNodeTable());
//DataHelper.printMetadata(System.out, patterns.getNodeTable());
TreeDebundlingAction action = new TreeDebundlingAction(patterns);
action.run(0);
flatPatterns = action.getTemporalDataset();
classes = action.getClasses();
System.out.println(flatPatterns.getNodeCount());
//DebugHelper.printTemporalDatasetTable(System.out, flatPatterns,"label","class",TemporalObject.ID);
PatternCountAction action2 = new PatternCountAction(flatPatterns);
action2.run(0);
countedPatterns = action2.getTemporalDataset();
//DebugHelper.printTemporalDatasetTable(System.out, countedPatterns);
Hashtable<String,Integer> patternCount = action2.getPatterns();
// System.out.println(patternCount.size());
// Enumeration<String> e = patternCount.keys();
// while(e.hasMoreElements()) {
// String pattern = e.nextElement();
// System.out.println(pattern+": "+patternCount.get(pattern));
// }
//System.out.println(flatPatterns.getNodeCount());
//DataHelper.printTable(System.out,countedPatterns.getTemporalObjectTable());
//try {
//DataHelper.printTable(new PrintStream("test.txt"),countedPatterns.getTemporalObjectTable());
//} catch (FileNotFoundException e) {e.printStackTrace();}
createVisualization(patterns,events,flatPatterns,countedPatterns);
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:57,代码来源:POTSBLITZDemo.java
示例17: writeData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
@Override
public void writeData(TemporalDataset tmpds, OutputStream os)
throws DataIOException {
writeData(tmpds, new StreamResult(os));
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:6,代码来源:GraphMLTemporalDatasetWriter.java
示例18: createRoots
import prefuse.data.io.DataIOException; //导入依赖的package包/类
private void createRoots(TemporalDataset tds, ArrayList<Long> rootList) throws DataIOException {
for (Long rootId : rootList) {
TemporalObject obj = tds.getTemporalObject(rootId);
obj.setRoot(true);
}
}
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:7,代码来源:GraphMLTemporalDatasetReader.java
示例19: getData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* Executes a query and returns the results in a Table instance.
* @param t the Table to store the results in. If this value is null, a
* new table will automatically be created.
* @param query the text SQL query to execute
* @param keyField used to determine if the row already exists in the table
* @param lock an optional Object to use as a lock when performing data
* processing. This lock will be synchronized on whenever the Table is
* modified.
* @return a Table of the query results
* @throws DataIOException if an error occurs while executing the query
* or adding the query results in a prefuse Table.
*/
public synchronized Table getData(Table t, String query,
String keyField, Object lock)
throws DataIOException
{
ResultSet rs;
try {
rs = executeQuery(query);
} catch ( SQLException e ) {
throw new DataIOException(e);
}
return process(t, rs, keyField, lock);
}
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:26,代码来源:DatabaseDataSource.java
示例20: writeData
import prefuse.data.io.DataIOException; //导入依赖的package包/类
/**
* Write a {@link TemporalDataset} to the file with the given filename.
*
* @param tmpds
* the {@link TemporalDataset} to write
* @param filename
* the file to write the temporal dataset to
* @throws DataIOException
*/
public void writeData(TemporalDataset tmpds, String filename)
throws DataIOException;
开发者ID:ieg-vienna,项目名称:TimeBench,代码行数:12,代码来源:TemporalDatasetWriter.java
注:本文中的prefuse.data.io.DataIOException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论