简体   繁体   中英

Overwrite derived column in prefuse

In a prefuse graph I have a derived column named "distance" created with Table.addColumn(String name, Expression expr) and a boolean runtime variable called normalize . Now I want to change the expression used to calculate the column value during runtime, depending on the value of normalize , but there is no such thing as replaceColumn() or deleteColumn() . When I try to overwrite the old column by calling addColumn() again, I get a 'Table already has column with name "distance"'.

Can I somehow programatically change the expression used to calculate the column value of distance or make it dependend from the runtime variable normalize ? I would rather not have two columns with different names, because the value is used from many places in the project and I would therefor have to implement a lot of case distinctions.

prefuse has an IfExpression so you can make the derived column depend on normalize .

Alternatively there is a method removeColumn(String) in Table .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM