25
25
import java.net.URL;
26
26
import java.util.List;
27
27
import javax.xml.datatype.DatatypeConfigurationException;
28
import org.gephi.data.attributes.api.AttributeColumn;
28
29
import org.gephi.data.attributes.api.AttributeType;
29
30
import org.gephi.data.attributes.api.AttributeValue;
31
import org.gephi.data.attributes.type.DynamicType;
30
32
import org.gephi.data.attributes.type.StringList;
31
33
import org.gephi.dynamic.DynamicUtilities;
32
34
import org.gephi.io.importer.api.Container;
135
137
assertNotNull(n7);
136
138
assertNotNull(n8);
137
139
assertNotNull(n9);
141
ContainerUnloader unloader = container.getUnloader();
142
AttributeColumn col0 = unloader.getAttributeModel().getNodeTable().getColumn("0");
143
AttributeColumn col1 = unloader.getAttributeModel().getNodeTable().getColumn("1");
144
AttributeColumn col2 = unloader.getAttributeModel().getNodeTable().getColumn("2");
145
AttributeColumn col3 = unloader.getAttributeModel().getNodeTable().getColumn("3");
146
AttributeColumn col4 = unloader.getAttributeModel().getNodeTable().getColumn("4");
139
149
assertEquals("Node 1", n1.getLabel());
140
150
assertEquals("2000-01-01", DynamicUtilities.getXMLDateStringFromDouble(n1.getTimeInterval().getValues().get(0)[0]));
141
151
assertEquals("2000-12-31", DynamicUtilities.getXMLDateStringFromDouble(n1.getTimeInterval().getValues().get(0)[1]));
143
153
AttributeValue[] values1 = n1.getAttributeRow().getValues();
144
assertEquals("0", values1[0].getColumn().getId());
145
assertEquals("3", values1[1].getColumn().getId());
146
assertEquals("Author", values1[0].getValue());
147
assertEquals(new Float(1), values1[1].getValue());
154
assertEquals("0", values1[col0.getIndex()].getColumn().getId());
155
assertEquals("3", values1[col3.getIndex()].getColumn().getId());
156
assertEquals("Author", ((DynamicType) values1[col0.getIndex()].getValue()).getValue());
157
assertEquals(new Float(1), ((DynamicType) values1[col3.getIndex()].getValue()).getValue());
149
159
AttributeValue[] values2 = n2.getAttributeRow().getValues();
150
assertEquals("0", values2[0].getColumn().getId());
151
assertEquals("2", values2[1].getColumn().getId());
152
assertEquals("Author", values2[0].getValue());
153
assertEquals(new StringList("String1, String2, String 3"), values2[1].getValue());
160
assertEquals("0", values2[col0.getIndex()].getColumn().getId());
161
assertEquals("2", values2[col2.getIndex()].getColumn().getId());
162
assertEquals("Author", ((DynamicType) values2[col0.getIndex()].getValue()).getValue());
163
assertEquals(new StringList("String1, String2, String 3"), values2[col2.getIndex()].getValue());
165
AttributeValue[] values3 = n3.getAttributeRow().getValues();
166
DynamicType val4 = (DynamicType) values3[col4.getIndex()].getValue();
167
double low = DynamicUtilities.getDoubleFromXMLDateString("2009-01-01");
168
double high = DynamicUtilities.getDoubleFromXMLDateString("2009-12-31");
169
assertEquals(new Float(3f), val4.getValue(low, high));
155
171
assertEquals("2000-01-01", DynamicUtilities.getXMLDateStringFromDouble(n3.getTimeInterval().getValues().get(0)[0]));
156
172
assertEquals("2000-01-15", DynamicUtilities.getXMLDateStringFromDouble(n3.getTimeInterval().getValues().get(0)[1]));