コード例 #1
0
 public void showValues(AttributeRow row) {
   System.out.print("Values: ");
   for (AttributeValue val : row.getValues()) {
     System.out.print("#" + val.getValue() + " ");
   }
   System.out.println();
 }
コード例 #2
0
ファイル: AttributeRowImpl.java プロジェクト: GccX11/gephi
 public Object getValue(AttributeColumn column) {
   if (column == null) {
     throw new NullPointerException();
   }
   updateColumns();
   int index = column.getIndex();
   if (checkIndexRange(index)) {
     AttributeValue val = values[index];
     if (val.getColumn() == column) {
       return val.getValue();
     }
   }
   return null;
 }
コード例 #3
0
ファイル: AttributeRowImpl.java プロジェクト: GccX11/gephi
  public void setValue(AttributeValue value) {
    AttributeColumn column = value.getColumn();
    if (attributeTable.getColumn(column.getIndex()) != column) {
      column = attributeTable.getColumn(column);
      if (column == null) {
        throw new IllegalArgumentException(
            "The "
                + attributeTable.getName()
                + " value column "
                + value.getColumn().getId()
                + " with index "
                + value.getColumn().getIndex()
                + " doesn't exist");
      }
      value = attributeTable.getFactory().newValue(column, value.getValue());
    }

    setValue(column.getIndex(), (AttributeValueImpl) value, true);
  }
コード例 #4
0
 private void writeAttValues(
     XMLStreamWriter xmlWriter, AttributeRow row, TimeInterval visibleInterval) throws Exception {
   xmlWriter.writeStartElement(ATTVALUES);
   for (AttributeValue val : row.getValues()) {
     AttributeColumn col = val.getColumn();
     if (!col.getOrigin().equals(AttributeOrigin.PROPERTY)
         || (exportDynamic
             && col.getOrigin().equals(AttributeOrigin.PROPERTY)
             && col.getIndex() == PropertiesColumn.EDGE_WEIGHT.getIndex())) {
       AttributeType type = col.getType();
       if (type.isDynamicType()) {
         DynamicType dynamicValue = (DynamicType) val.getValue();
         if (dynamicValue != null && visibleInterval != null && exportDynamic) {
           List<Interval<?>> intervals =
               dynamicValue.getIntervals(visibleInterval.getLow(), visibleInterval.getHigh());
           for (Interval<?> interval : intervals) {
             Object value = interval.getValue();
             if (value != null) {
               xmlWriter.writeStartElement(ATTVALUE);
               xmlWriter.writeAttribute(ATTVALUE_FOR, col.getId());
               xmlWriter.writeAttribute(ATTVALUE_VALUE, value.toString());
               if (!Double.isInfinite(interval.getLow())) {
                 String intervalLow = formatTime(interval.getLow());
                 xmlWriter.writeAttribute(
                     interval.isLowExcluded() ? START_OPEN : START, intervalLow);
               }
               if (!Double.isInfinite(interval.getHigh())) {
                 String intervalHigh = formatTime(interval.getHigh());
                 xmlWriter.writeAttribute(
                     interval.isHighExcluded() ? END_OPEN : END, intervalHigh);
               }
               xmlWriter.writeEndElement();
             }
           }
         } else if (dynamicValue != null) {
           TimeInterval interval = visibleInterval;
           if (interval == null) {
             interval = new TimeInterval();
           }
           Object value =
               DynamicUtilities.getDynamicValue(
                   dynamicValue, interval.getLow(), interval.getHigh());
           if (value != null) {
             xmlWriter.writeStartElement(ATTVALUE);
             xmlWriter.writeAttribute(ATTVALUE_FOR, val.getColumn().getId());
             xmlWriter.writeAttribute(ATTVALUE_VALUE, value.toString());
             xmlWriter.writeEndElement();
           }
         }
       } else {
         if (val.getValue() != null) {
           xmlWriter.writeStartElement(ATTVALUE);
           xmlWriter.writeAttribute(ATTVALUE_FOR, col.getId());
           xmlWriter.writeAttribute(ATTVALUE_VALUE, val.getValue().toString());
           xmlWriter.writeEndElement();
         }
       }
     }
   }
   xmlWriter.writeEndElement();
 }