001/* 002 * Copyright 2006 - 2013 003 * Stefan Balev <stefan.balev@graphstream-project.org> 004 * Julien Baudry <julien.baudry@graphstream-project.org> 005 * Antoine Dutot <antoine.dutot@graphstream-project.org> 006 * Yoann Pigné <yoann.pigne@graphstream-project.org> 007 * Guilhelm Savin <guilhelm.savin@graphstream-project.org> 008 * 009 * GraphStream is a library whose purpose is to handle static or dynamic 010 * graph, create them from scratch, file or any source and display them. 011 * 012 * This program is free software distributed under the terms of two licenses, the 013 * CeCILL-C license that fits European law, and the GNU Lesser General Public 014 * License. You can use, modify and/ or redistribute the software under the terms 015 * of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following 016 * URL <http://www.cecill.info> or under the terms of the GNU LGPL as published by 017 * the Free Software Foundation, either version 3 of the License, or (at your 018 * option) any later version. 019 * 020 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 022 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 023 * 024 * You should have received a copy of the GNU Lesser General Public License 025 * along with this program. If not, see <http://www.gnu.org/licenses/>. 026 * 027 * The fact that you are presently reading this means that you have had 028 * knowledge of the CeCILL-C and LGPL licenses and that you accept their terms. 029 */ 030package org.graphstream.stream.file.gexf; 031 032import java.text.DecimalFormat; 033import java.text.DecimalFormatSymbols; 034import java.text.Format; 035import java.text.SimpleDateFormat; 036import java.util.Locale; 037 038import javax.xml.stream.XMLStreamException; 039 040public interface GEXFElement { 041 public static enum Extension { 042 VIZ, DYNAMICS, DATA 043 } 044 045 public static enum TimeFormat { 046 INTEGER("integer", new DecimalFormat("#", new DecimalFormatSymbols( 047 Locale.ROOT))), DOUBLE("double", 048 new DecimalFormat("#.0###################", 049 new DecimalFormatSymbols(Locale.ROOT))), DATE("date", 050 new SimpleDateFormat("yyyy-MM-dd")), DATETIME("datetime", 051 new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ")); 052 String qname; 053 Format format; 054 055 TimeFormat(String qname, Format f) { 056 this.qname = qname; 057 this.format = f; 058 } 059 } 060 061 public static enum DefaultEdgeType { 062 UNDIRECTED("undirected"), DIRECTED("directed"), MUTUAL("mutual"); 063 064 final String qname; 065 066 DefaultEdgeType(String qname) { 067 this.qname = qname; 068 } 069 } 070 071 public static enum IDType { 072 INTEGER("integer"), STRING("string"); 073 074 final String qname; 075 076 IDType(String qname) { 077 this.qname = qname; 078 } 079 } 080 081 public static enum Mode { 082 STATIC("static"), DYNAMIC("dynamic"); 083 084 final String qname; 085 086 Mode(String qname) { 087 this.qname = qname; 088 } 089 } 090 091 public static enum ClassType { 092 NODE("node"), EDGE("edge"); 093 094 final String qname; 095 096 ClassType(String qname) { 097 this.qname = qname; 098 } 099 } 100 101 public static enum AttrType { 102 INTEGER("integer"), LONG("long"), DOUBLE("double"), FLOAT("float"), BOOLEAN( 103 "boolean"), LISTSTRING("liststring"), STRING("string"), ANYURI( 104 "anyURI"); 105 106 final String qname; 107 108 AttrType(String qname) { 109 this.qname = qname; 110 } 111 } 112 113 void export(SmartXMLWriter stream) throws XMLStreamException; 114}