Examples of AttributeType


Examples of org.gephi.data.attributes.api.AttributeType

            throw new IllegalArgumentException("Source and target columns can't be equal");
        }

        final int sourceColumnIndex = sourceColumn.getIndex();
        final int targetColumnIndex = targetColumn.getIndex();
        AttributeType targetType = targetColumn.getType();
        if (targetType != sourceColumn.getType()) {
            Object value;
            for (Attributes row : getTableAttributeRows(table)) {
                value = row.getValue(sourceColumnIndex);
                setAttributeValue(value, row, targetColumn);
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

            }
        }
    }

    public boolean isNumberColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        if (type == AttributeType.DOUBLE
                || type == AttributeType.FLOAT
                || type == AttributeType.INT
                || type == AttributeType.LONG) {
            return true;
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

        }
        return false;
    }

    public boolean isStringColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        if (type == AttributeType.STRING) {
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

        AttributeTable edgeTable = container.getAttributeModel().getEdgeTable();
        for (AttributeColumn column : nodeTable.getColumns()) {
            AttributeColumn existingCol = attributeModel.getNodeTable().getColumn(column.getTitle());
            if (existingCol == null) {
                if (!column.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    AttributeType dynamicType = TypeConvertor.getDynamicType(column.getType());
                    if (dynamicType != null && !column.getType().isDynamicType()) {
                        attributeModel.getNodeTable().addColumn(column.getId(), column.getTitle(), dynamicType, column.getOrigin(), null);
                    } else {
                        attributeModel.getNodeTable().addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
                    }
                }
            }

        }
        for (AttributeColumn column : edgeTable.getColumns()) {
            AttributeColumn existingCol = attributeModel.getEdgeTable().getColumn(column.getTitle());
            if (existingCol == null) {
                if (!column.getOrigin().equals(AttributeOrigin.PROPERTY)) {
                    AttributeType dynamicType = TypeConvertor.getDynamicType(column.getType());
                    if (dynamicType != null && !column.getType().isDynamicType()) {
                        attributeModel.getEdgeTable().addColumn(column.getId(), column.getTitle(), dynamicType, column.getOrigin(), null);
                    } else {
                        attributeModel.getEdgeTable().addColumn(column.getId(), column.getTitle(), column.getType(), column.getOrigin(), column.getDefaultValue());
                    }
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

        setMinMax(ranking, graph);
        return ranking.hash != hash;
    }

    public static boolean isNumberColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        if (type == AttributeType.DOUBLE
                || type == AttributeType.FLOAT
                || type == AttributeType.INT
                || type == AttributeType.LONG
                || type == AttributeType.BYTE
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

        }
        return false;
    }

    public static boolean isDynamicNumberColumn(AttributeColumn column) {
        AttributeType type = column.getType();
        AttributeUtils.getDefault().isDynamicNumberColumn(column);
        if (type == AttributeType.DYNAMIC_BIGDECIMAL
                || type == AttributeType.DYNAMIC_BIGINTEGER
                || type == AttributeType.DYNAMIC_BYTE
                || type == AttributeType.DYNAMIC_DOUBLE
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, "listchar");
                        } else {
                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, col.getType().getTypeString().toLowerCase().replace("_", ""));
                        }
                    } else if (col.getType().isDynamicType()) {
                        AttributeType staticType = TypeConvertor.getStaticType(col.getType());
                        if (staticType.equals(AttributeType.INT)) {
                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, "integer");
                        } else {
                            xmlWriter.writeAttribute(ATTRIBUTE_TYPE, staticType.getTypeString().toLowerCase());
                        }
                    } else {
                        xmlWriter.writeAttribute(ATTRIBUTE_TYPE, col.getType().getTypeString().toLowerCase());
                    }
                    if (col.getDefaultValue() != null) {
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

        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();
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

                case XMLStreamReader.END_ELEMENT:
                    if (ELEMENT_NODE_ROW.equalsIgnoreCase(reader.getLocalName()) || ELEMENT_EDGE_ROW.equalsIgnoreCase(reader.getLocalName())) {
                        end = true;
                    }
                    if (!value.isEmpty() && col != null) {
                        AttributeType type = col.getType();
                        Object v = type.parse(value);
                        v = model.getManagedValue(v, type);
                        row.setValue(col, value);
                    }
                    value = "";
                    col = null;
View Full Code Here

Examples of org.gephi.data.attributes.api.AttributeType

    public void readColumn(XMLStreamReader reader, AttributeTableImpl table) throws XMLStreamException {

        int index = 0;
        String id = "";
        String title = "";
        AttributeType type = AttributeType.STRING;
        AttributeOrigin origin = AttributeOrigin.DATA;
        String defaultValue = "";

        boolean end = false;
        String name = null;
        while (reader.hasNext() && !end) {
            int t = reader.next();

            switch (t) {
                case XMLStreamReader.START_ELEMENT:
                    name = reader.getLocalName();
                    break;
                case XMLStreamReader.CHARACTERS:
                    if (!reader.isWhiteSpace()) {
                        if (ELEMENT_COLUMN_INDEX.equalsIgnoreCase(name)) {
                            index = Integer.parseInt(reader.getText());
                        } else if (ELEMENT_COLUMN_ID.equalsIgnoreCase(name)) {
                            id += reader.getText();
                        } else if (ELEMENT_COLUMN_TITLE.equalsIgnoreCase(name)) {
                            title += reader.getText();
                        } else if (ELEMENT_COLUMN_TYPE.equalsIgnoreCase(name)) {
                            type = AttributeType.valueOf(reader.getText());
                        } else if (ELEMENT_COLUMN_ORIGIN.equalsIgnoreCase(name)) {
                            origin = AttributeOrigin.valueOf(reader.getText());
                        } else if (ELEMENT_COLUMN_DEFAULT.equalsIgnoreCase(name)) {
                            if (!reader.getText().isEmpty()) {
                                defaultValue += reader.getText();
                            }
                        }
                    }
                    break;
                case XMLStreamReader.END_ELEMENT:
                    if (ELEMENT_COLUMN.equalsIgnoreCase(reader.getLocalName())) {
                        end = true;
                    }
                    break;
            }
        }
        Object defaultVal = !defaultValue.isEmpty() ? type.parse(defaultValue) : null;
        if (!table.hasColumn(title)) {
            table.addColumn(id, title, type, origin, defaultVal);
        } else {
            table.replaceColumn(table.getColumn(title), id, title, type, origin, defaultVal);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.