本文整理汇总了Java中prefuse.data.Node.getColumnIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getColumnIndex方法的具体用法?Java Node.getColumnIndex怎么用?Java Node.getColumnIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.data.Node
的用法示例。
在下文中一共展示了Node.getColumnIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInstanceToClass
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Add [howManyToAdd] instances to a given class [className].
* Individuals, enumerations (e.g. owl:oneOf)
*
* @param className the class name
* @param howManyToAdd the count of instances that will be added
*/
public void addInstanceToClass(String className, int howManyToAdd) {
for (int i = 0; i < GraphStorage.getGraph(viewManagerID).getNodeCount(); i++) {
Node n = GraphStorage.getGraph(viewManagerID).getNode(i);
int nameIndex = n.getColumnIndex(ColumnNames.FULL_NAME);
try {
String name = (String) n.get(nameIndex);
if (name.equals(className)) {
helperIncreaseClassSizeAfterAddingInstances(n, howManyToAdd);
helperUpdateShortName(n);
}
} catch (NullPointerException npe) {
// no class name? -> nothing to do
logger.warn("possible mistake found: node without full name");
}
}
}
示例2: removeInstanceFromClass
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Removes [howManyToRemove] instances from a given class [classID].
* Individuals, enumerations (e.g. owl:oneOf)
*
* @param id the id of the class
* @param howManyToRemove the cound if instances that will be removed
*/
public void removeInstanceFromClass(int id, int howManyToRemove) {
for (int i = 0; i < GraphStorage.getGraph(viewManagerID).getNodeCount(); i++) {
Node n = GraphStorage.getGraph(viewManagerID).getNode(i);
int idIndex = n.getColumnIndex(ColumnNames.ID);
try {
int idOfNode = (Integer) n.get(idIndex);
if (idOfNode == id) {
// node(class) found
helperDecreaseClassSizeAfterRemovingInstances(n, howManyToRemove);
helperUpdateShortName(n);
}
} catch (NullPointerException npe) {
// no class name? -> nothing to do
logger.warn("possible mistake found: node without an id");
}
}
}
示例3: findClass
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Finds a class with a given class name and class type.
*
* @param className the class name
* @param classType the class type
* @return classID the id of the found class
*/
public int findClass(String className, String classType) {
for (int i = 0; i < GraphStorage.getGraph(viewManagerID).getNodeCount(); i++) {
Node n = GraphStorage.getGraph(viewManagerID).getNode(i);
int nameIndex = n.getColumnIndex(ColumnNames.FULL_NAME);
int vowlTypeIndex = n.getColumnIndex(ColumnNames.NODE_VOWL_TYPE);
int idIndex = n.getColumnIndex(ColumnNames.ID);
try {
String name = (String) n.get(nameIndex);
String vowlType = (String) n.get(vowlTypeIndex);
if (className.equals(name) && classType.equals(vowlType)) {
return (Integer) n.get(idIndex);
}
} catch (NullPointerException npe) {
// no class name? -> nothing to do
logger.warn("possible mistake found: node without name or id or vowl type attribute");
logger.error("findClass SearchCriterias : ClassName: " + className + " ClassType: " + classType);
}
}
return -1;
}
示例4: findNode
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Finds a node with the given id.
*
* @param id the id of the node
* @return the found node or null
*/
public Node findNode(int id) {
for (int i = 0; i < GraphStorage.getGraph(viewManagerID).getNodeCount(); i++) {
Node n = GraphStorage.getGraph(viewManagerID).getNode(i);
int nodeIDIndex = n.getColumnIndex(ColumnNames.ID);
try {
int nodeID = (Integer) n.get(nodeIDIndex);
if (id == nodeID) {
return n;
}
} catch (NullPointerException npe) {
logger.warn("possible error found: node without id attribute");
}
}
return null;
}
示例5: helperDecreaseClassSizeAfterRemovingInstances
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Decreases the visual size of a node after instances have been removed.
*
* @param n the node
* @param howManyToRemove the count of instances that will be removed
*/
private void helperDecreaseClassSizeAfterRemovingInstances(Node n, int howManyToRemove) {
try {
int instancesIndex = n.getColumnIndex(ColumnNames.CLASS_INSTANCE_COUNT);
int instanceCount = (Integer) n.get(instancesIndex);
int heightIndex = n.getColumnIndex(ColumnNames.NODE_HEIGHT);
int widhtIndex = n.getColumnIndex(ColumnNames.NODE_WIDTH);
int height = (Integer) n.get(heightIndex);
int width = (Integer) n.get(widhtIndex);
instanceCount = instanceCount - howManyToRemove;
n.set(ColumnNames.CLASS_INSTANCE_COUNT, instanceCount);
n.set(ColumnNames.NODE_HEIGHT, height - (int) Math.log(CLASS_INSTANCES_STEPS * howManyToRemove));
n.set(ColumnNames.NODE_WIDTH, width - (int) Math.log(CLASS_INSTANCES_STEPS * howManyToRemove));
} catch (NullPointerException npe) {
logger.error("missing important data, wrong class : " + n.toString());
}
}
示例6: helperIncreaseClassSizeAfterAddingInstances
import prefuse.data.Node; //导入方法依赖的package包/类
/**
* Increases the visual size of a node after instances have been removed.
*
* @param n the node
* @param howManyToAdd the count of instances that will be added
*/
private void helperIncreaseClassSizeAfterAddingInstances(Node n, int howManyToAdd) {
try {
int instancesIndex = n.getColumnIndex(ColumnNames.CLASS_INSTANCE_COUNT);
int instanceCount = (Integer) n.get(instancesIndex);
int heightIndex = n.getColumnIndex(ColumnNames.NODE_HEIGHT);
int widhtIndex = n.getColumnIndex(ColumnNames.NODE_WIDTH);
int height = (Integer) n.get(heightIndex);
int width = (Integer) n.get(widhtIndex);
instanceCount = instanceCount + howManyToAdd;
n.set(ColumnNames.CLASS_INSTANCE_COUNT, instanceCount);
// n.set(ColumnNames.NODE_HEIGHT, height + (int) Math.log(howManyToAdd * CLASS_INSTANCES_STEPS));
// n.set(ColumnNames.NODE_WIDTH, width + (int) Math.log(howManyToAdd * CLASS_INSTANCES_STEPS));
n.set(ColumnNames.NODE_HEIGHT, height + (howManyToAdd * CLASS_INSTANCES_STEPS));
n.set(ColumnNames.NODE_WIDTH, width + (howManyToAdd * CLASS_INSTANCES_STEPS));
} catch (NullPointerException npe) {
logger.error("missing important data, wrong class : " + n.toString());
}
}