Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Christnowx
Gephi
提交
daafd56b
G
Gephi
项目概览
Christnowx
/
Gephi
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gephi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
daafd56b
编写于
11月 25, 2015
作者:
M
Mathieu Bastian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ability to set graph timestamp & interval in ImportAPI
上级
048ae20e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
98 addition
and
0 deletion
+98
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java
.../main/java/org/gephi/io/importer/api/ContainerLoader.java
+28
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java
...ain/java/org/gephi/io/importer/api/ContainerUnloader.java
+5
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ElementDraft.java
...src/main/java/org/gephi/io/importer/api/ElementDraft.java
+4
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ElementDraftImpl.java
...ain/java/org/gephi/io/importer/impl/ElementDraftImpl.java
+10
-0
modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerImpl.java
.../java/org/gephi/io/importer/impl/ImportContainerImpl.java
+47
-0
modules/ImportAPI/src/main/resources/org/gephi/io/importer/impl/Bundle.properties
...in/resources/org/gephi/io/importer/impl/Bundle.properties
+4
-0
未找到文件。
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java
浏览文件 @
daafd56b
...
...
@@ -41,6 +41,7 @@
*/
package
org.gephi.io.importer.api
;
import
org.gephi.graph.api.Interval
;
import
org.gephi.graph.api.TimeFormat
;
import
org.gephi.graph.api.TimeRepresentation
;
import
org.gephi.io.importer.spi.Importer
;
...
...
@@ -231,6 +232,24 @@ public interface ContainerLoader {
public
void
setTimeFormat
(
TimeFormat
timeFormat
);
/**
* Sets the timestamp for the entire graph. All elements and all dynamic
* columns will automatically receive this timestamp when the graph is
* processed.
*
* @param timestamp timestamp
*/
public
void
setTimestamp
(
String
timestamp
);
/**
* Sets the interval for the entire graph. All elements and all dynamic
* columns will automatically receive this interval when the graph is
* processed.
*
* @param start interval start
* @param end interval end
*/
public
void
setInterval
(
String
start
,
String
end
);
/**
* Sets the type of the id for elements.
*
...
...
@@ -238,6 +257,7 @@ public interface ContainerLoader {
*/
public
void
setElementIdType
(
ElementIdType
type
);
/**
* Sets the current time representation, either <code>TIMESTAMP</code> or
* <code>INTERVAL</code>.
* <p>
...
...
@@ -247,6 +267,14 @@ public interface ContainerLoader {
*/
public
void
setTimeRepresentation
(
TimeRepresentation
timeRepresentation
);
/**
* Gets the current time representation, either <code>TIMESTAMP</code> or
* <code>INTERVAL</code>.
* <p>
* @return time representation
*/
public
TimeRepresentation
getTimeRepresentation
();
/**
* Sets the time zone that is used to parse date and time.
* <p>
...
...
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java
浏览文件 @
daafd56b
...
...
@@ -41,6 +41,7 @@
*/
package
org.gephi.io.importer.api
;
import
org.gephi.graph.api.Interval
;
import
org.gephi.graph.api.TimeFormat
;
import
org.gephi.graph.api.TimeRepresentation
;
import
org.gephi.io.processor.spi.Processor
;
...
...
@@ -88,6 +89,10 @@ public interface ContainerUnloader {
public
Class
getEdgeTypeLabelClass
();
public
Double
getTimestamp
();
public
Interval
getInterval
();
public
ElementIdType
getElementIdType
();
//PARAMETERS GETTERS
...
...
modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ElementDraft.java
浏览文件 @
daafd56b
...
...
@@ -377,4 +377,8 @@ public interface ElementDraft {
public
TimeSet
getTimeSet
();
public
Iterable
<
ColumnDraft
>
getColumns
();
public
Double
getGraphTimestamp
();
public
Interval
getGraphInterval
();
}
modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ElementDraftImpl.java
浏览文件 @
daafd56b
...
...
@@ -85,6 +85,16 @@ public abstract class ElementDraftImpl implements ElementDraft {
abstract
ColumnDraft
getColumn
(
String
key
,
Class
type
);
@Override
public
Double
getGraphTimestamp
()
{
return
container
.
getTimestamp
();
}
@Override
public
Interval
getGraphInterval
()
{
return
container
.
getInterval
();
}
@Override
public
String
getId
()
{
return
id
;
...
...
modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerImpl.java
浏览文件 @
daafd56b
...
...
@@ -57,6 +57,7 @@ import java.util.Comparator;
import
java.util.Iterator
;
import
java.util.List
;
import
org.gephi.graph.api.AttributeUtils
;
import
org.gephi.graph.api.Interval
;
import
org.gephi.graph.api.TimeFormat
;
import
org.gephi.graph.api.TimeRepresentation
;
import
org.gephi.io.importer.api.ColumnDraft
;
...
...
@@ -114,6 +115,8 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
private
TimeFormat
timeFormat
=
TimeFormat
.
DOUBLE
;
private
TimeRepresentation
timeRepresentation
=
TimeRepresentation
.
INTERVAL
;
private
DateTimeZone
timeZone
=
DateTimeZone
.
getDefault
();
private
Double
timestamp
;
private
Interval
interval
;
//Report flag
private
boolean
reportedUnknownNode
;
private
boolean
reportedParallelEdges
;
...
...
@@ -528,6 +531,48 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
}
@Override
public
void
setTimestamp
(
String
timestamp
)
{
try
{
double
t
=
timeFormat
.
equals
(
TimeFormat
.
DOUBLE
)
?
Double
.
parseDouble
(
timestamp
)
:
AttributeUtils
.
parseDateTime
(
timestamp
);
this
.
timestamp
=
t
;
}
catch
(
Exception
e
)
{
report
.
logIssue
(
new
Issue
(
NbBundle
.
getMessage
(
ImportContainerImpl
.
class
,
"ImportContainerException_Timestamp_Parse_Error"
,
timestamp
),
Level
.
SEVERE
));
return
;
}
report
.
log
(
NbBundle
.
getMessage
(
ImportContainerImpl
.
class
,
"ImportContainerLog.GraphTimestamp"
,
timestamp
));
}
@Override
public
void
setInterval
(
String
startDateTime
,
String
endDateTime
)
{
try
{
double
start
,
end
;
if
(
startDateTime
==
null
||
startDateTime
.
isEmpty
()
||
"-inf"
.
equalsIgnoreCase
(
startDateTime
)
||
"-infinity"
.
equalsIgnoreCase
(
startDateTime
))
{
start
=
Double
.
NEGATIVE_INFINITY
;
}
else
{
start
=
timeFormat
.
equals
(
TimeFormat
.
DOUBLE
)
?
Double
.
parseDouble
(
startDateTime
)
:
AttributeUtils
.
parseDateTime
(
startDateTime
);
}
if
(
endDateTime
==
null
||
endDateTime
.
isEmpty
()
||
"inf"
.
equalsIgnoreCase
(
endDateTime
)
||
"infinity"
.
equalsIgnoreCase
(
endDateTime
))
{
end
=
Double
.
POSITIVE_INFINITY
;
}
else
{
end
=
timeFormat
.
equals
(
TimeFormat
.
DOUBLE
)
?
Double
.
parseDouble
(
endDateTime
)
:
AttributeUtils
.
parseDateTime
(
endDateTime
);
}
this
.
interval
=
new
Interval
(
start
,
end
);
}
catch
(
Exception
e
)
{
report
.
logIssue
(
new
Issue
(
NbBundle
.
getMessage
(
ImportContainerImpl
.
class
,
"ImportContainerException_Interval_Parse_Error"
,
timestamp
),
Level
.
SEVERE
));
return
;
}
report
.
log
(
NbBundle
.
getMessage
(
ImportContainerImpl
.
class
,
"ImportContainerLog.GraphInterval"
,
"["
+
startDateTime
+
","
+
endDateTime
+
"]"
));
}
@Override
public
Interval
getInterval
()
{
return
interval
;
}
@Override
public
Double
getTimestamp
()
{
return
timestamp
;
}
@Override
public
void
setElementIdType
(
ElementIdType
type
)
{
...
...
@@ -539,6 +584,8 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
public
ElementIdType
getElementIdType
()
{
return
elementIdType
;
}
@Override
public
boolean
verify
()
{
//Edge weight zero or negative
for
(
EdgeDraftImpl
edge
:
new
NullFilterIterable
<
EdgeDraftImpl
>(
edgeList
))
{
...
...
modules/ImportAPI/src/main/resources/org/gephi/io/importer/impl/Bundle.properties
浏览文件 @
daafd56b
...
...
@@ -8,6 +8,8 @@ ImportContainerLog.AddDynamicEdgeColumn = Edge column ''{0}'' (Dynamic {1})
ImportContainerLog.EdgeLabelType
=
Edge labels are of type ''{0}''
ImportContainerLog.TimeZone
=
Time zone is set at ''{0}''
ImportContainerLog.MultiGraphCount
=
Multi-graph with {0} different types
ImportContainerLog.GraphTimestamp
=
Graph timestamp set at ''{0}''
ImportContainerLog.GraphInterval
=
Graph interval set at ''{0}''
ImportContainerLog.ElementIdType
=
Element id type set at ''{0}''
ImportContainerException_nodeExist
=
Duplicated node id=''{0}''
...
...
@@ -28,6 +30,8 @@ ImportContainerException_Weight_Zero_Ignored = Edge weight is 0, the edge id=''{
ImportContainerException_ElementIdType_Parse_Error
=
The id type is configured to ''{0}'' but some elements id can't be parsed, defaulting to 'STRING'
ImportContainerException_Negative_Weight
=
Edge id=''{0}'' has a negative weight
ImportContainerException_Column_Type_Mismatch
=
A column ''{0}'' already exists but with a different type=''{1}''
ImportContainerException_Timestamp_Parse_Error
=
The graph timestamp ''{0}'' could not be parsed
ImportContainerException_Interval_Parse_Error
=
The graph interval ''{0}'' could not be parsed
ElementFactoryException_NullNodeId
=
Node id can't be null
ElementFactoryException_NullEdgeId
=
Edge id can't be null
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录