Project

General

Profile

Bug #5627

List all possible port types in actor Types drop down list

Added by Derik Barseghian almost 7 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Normal
Category:
actors
Target version:
Start date:
06/15/2012
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5627

Description

It would be nice if on an actor's port Type drop down list, all possible types were listed. If this list were automatically generated, then we'd be covered. Kepler has a date token, so the list would have to account for Ptolemy and Kepler types.

History

#1 Updated by Christopher Brooks almost 7 years ago

I modified
ptolemy/actor/gui/PortConfigurerDialog.java
so that it gets the types from the TypeLattice. The code is:

/** Generate a combo box based on the type names. */
private JComboBox _createPortTypeComboBox() {
JComboBox jComboBox = _createComboBox();

// // Add the types from data.expr.Constants
// TreeMap typeMap = Constants.types();
// Iterator types = typeMap.keySet().iterator();

// while (types.hasNext()) {
// String type = (String) (types.next());
// jComboBox.addItem(type);
// }

// Get the types from the TypeLattice.                                                     
// http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5627
Object [] types = ((DirectedAcyclicGraph)TypeLattice.basicLattice()).topologicalSort();
List<String> typeList = new LinkedList<String>();
for (int i = 0; i < types.length; i++) {
typeList.add(types[i].toString());
}
// Add some common types
typeList.add("arrayType(int)");
typeList.add("arrayType(int,5)");
typeList.add("{x=double, y=double}");
Collections.sort(typeList);
for (String typeName : typeList) {
jComboBox.addItem(typeName);
}
return jComboBox;
}

The types that are now listed are:
Actor
[boolean]
[complex]
[double]
[fixedpoint]
[int]
[long]
arrayBottom
arrayType(int)
arrayType(int,5)
arrayType(unknown)
boolean
complex
double
event
fixedpoint
fixedpoint(0,0)
float
general
int
long
matrix
niltype
object(null)
petite
scalar
short
string
unknown
unsignedByte
xmltoken {x=double, y=double} {||} {}

I'm not sure if this is useful or better or what, but I thought we
would try it. Note that {||} is a Union type and {} is an empty Record.

Is the Kepler Date type in the type lattice somehow?

If the Date type is not in the type lattice, then I don't think there
is a way to list all the standalone types like
ptolemy.actor.lib.security.KeyToken$KeyType
We could add a registry somewhere so that these standalone types get
recorded.

To really close this bug, we would need to set up a way to register types
that are not in the type lattice and then find all the types and register them.

#2 Updated by Redmine Admin about 6 years ago

Original Bugzilla ID was 5627

Also available in: Atom PDF