=====================================================================
Found a 120 line (579 tokens) duplication in the following files:
Starting at line 68 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/TableSorter.java
Starting at line 71 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/topology/TableSorter.java
}
private int compareRowsByColumn(int row1, int row2, int column) {
Class type = model.getColumnClass(column);
TableModel data = model;
// Check for nulls
Object o1 = data.getValueAt(row1, column);
Object o2 = data.getValueAt(row2, column);
// If both values are null return 0
if (o1 == null && o2 == null) {
return 0;
}
else if (o1 == null) { // Define null less than everything.
return -1;
}
else if (o2 == null) {
return 1;
}
/* We copy all returned values from the getValue call in case
an optimised model is reusing one object to return many values.
The Number subclasses in the JDK are immutable and so will not be used in
this way but other subclasses of Number might want to do this to save
space and avoid unnecessary heap allocation.
*/
if (type.getSuperclass() == java.lang.Number.class)
{
Number n1 = (Number)data.getValueAt(row1, column);
double d1 = n1.doubleValue();
Number n2 = (Number)data.getValueAt(row2, column);
double d2 = n2.doubleValue();
if (d1 < d2)
return -1;
else if (d1 > d2)
return 1;
else
return 0;
}
else if (type == java.util.Date.class)
{
Date d1 = (Date)data.getValueAt(row1, column);
long n1 = d1.getTime();
Date d2 = (Date)data.getValueAt(row2, column);
long n2 = d2.getTime();
if (n1 < n2)
return -1;
else if (n1 > n2)
return 1;
else return 0;
}
else if (type == String.class)
{
String s1 = (String)data.getValueAt(row1, column);
String s2 = (String)data.getValueAt(row2, column);
int result = s1.compareTo(s2);
if (result < 0)
return -1;
else if (result > 0)
return 1;
else return 0;
}
else if (type == Boolean.class)
{
Boolean bool1 = (Boolean)data.getValueAt(row1, column);
boolean b1 = bool1.booleanValue();
Boolean bool2 = (Boolean)data.getValueAt(row2, column);
boolean b2 = bool2.booleanValue();
if (b1 == b2)
return 0;
else if (b1) // Define false < true
return 1;
else
return -1;
}
else
{
Object v1 = data.getValueAt(row1, column);
String s1 = v1.toString();
Object v2 = data.getValueAt(row2, column);
String s2 = v2.toString();
int result = s1.compareTo(s2);
if (result < 0)
return -1;
else if (result > 0)
return 1;
else return 0;
}
}
private int compare(int row1, int row2) {
compares++;
for(int level = 0; level < sortingColumns.size(); level++)
{
Integer column = (Integer)sortingColumns.elementAt(level);
int result = compareRowsByColumn(row1, row2, column.intValue());
if (result != 0)
return ascending ? result : -result;
}
return 0;
}
private void reallocateIndexes() {
int rowCount = model.getRowCount();
// Set up a new array of indexes with the right number of elements
// for the new data model.
indexes = new int[rowCount];
// Initialise with the identity mapping.
for(int row = 0; row < rowCount; row++)
indexes[row] = row;
}
=====================================================================
Found a 44 line (309 tokens) duplication in the following files:
Starting at line 162 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AssetDBComponent.java
Starting at line 103 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ui/AssetUIComponent.java
rData.setRole((String)rel.getProperty(RelationshipBase.PROP_ROLE).getValue());
rData.setItemId((String)rel.getProperty(RelationshipBase.PROP_ITEM).getValue());
rData.setTypeId((String)rel.getProperty(RelationshipBase.PROP_TYPEID).getValue());
rData.setSupported((String)rel.getProperty(RelationshipBase.PROP_SUPPORTED).getValue());
DateFormat df = DateFormat.getInstance();
try {
Date start = df.parse((String)rel.getProperty(RelationshipBase.PROP_STARTTIME).getValue());
Date end = df.parse((String)rel.getProperty(RelationshipBase.PROP_STOPTIME).getValue());
rData.setStartTime(start.getTime());
rData.setEndTime(end.getTime());
} catch(ParseException pe) {
if(log.isErrorEnabled()) {
log.error("Caught Exception parsing Date, using default dates.", pe);
}
rData.setStartTime(TimeSpan.MIN_VALUE);
rData.setEndTime(TimeSpan.MAX_VALUE);
}
assetData.addRelationship(rData);
}
}
}
// FIXME: Perhaps check that ClusterPG (MessageAddress),
// ItemIdentificationPG (ItemIdentifiation), TypeIdentificationPG (TypeIdentification)
// are, at a minimum, among those filled in?
// What would I do though if they're not?
// Add Property Groups.
iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Property Groups")) {
for(int i=0; i < container.getChildCount(); i++) {
PropGroupBase pg = (PropGroupBase)container.getChild(i);
assetData.addPropertyGroup(pg.getPropGroupData());
}
}
}
data.addAgentAssetData(assetData);
return data;
}
=====================================================================
Found a 69 line (270 tokens) duplication in the following files:
Starting at line 203 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/TableSorter.java
Starting at line 202 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/topology/TableSorter.java
}
}
private void sort(Object sender) {
checkModel();
compares = 0;
shuttlesort((int[])indexes.clone(), indexes, 0, indexes.length);
}
// This is a home-grown implementation which we have not had time
// to research - it may perform poorly in some circumstances. It
// requires twice the space of an in-place algorithm and makes
// NlogN assigments shuttling the values between the two
// arrays. The number of compares appears to vary between N-1 and
// NlogN depending on the initial order but the main reason for
// using it here is that, unlike qsort, it is stable.
private void shuttlesort(int from[], int to[], int low, int high) {
if (high - low < 2) {
return;
}
int middle = (low + high)/2;
shuttlesort(to, from, low, middle);
shuttlesort(to, from, middle, high);
int p = low;
int q = middle;
/* This is an optional short-cut; at each recursive call,
check to see if the elements in this subset are already
ordered. If so, no further comparisons are needed; the
sub-array can just be copied. The array must be copied rather
than assigned otherwise sister calls in the recursion might
get out of sinc. When the number of elements is three they
are partitioned so that the first set, [low, mid), has one
element and and the second, [mid, high), has two. We skip the
optimisation when the number of elements is three or less as
the first compare in the normal merge will produce the same
sequence of steps. This optimisation seems to be worthwhile
for partially ordered lists but some analysis is needed to
find out how the performance drops to Nlog(N) as the initial
order diminishes - it may drop very quickly. */
if (high - low >= 4 && compare(from[middle-1], from[middle]) <= 0) {
for (int i = low; i < high; i++) {
to[i] = from[i];
}
return;
}
// A normal merge.
for(int i = low; i < high; i++) {
if (q >= high || (p < middle && compare(from[p], from[q]) <= 0)) {
to[i] = from[p++];
}
else {
to[i] = from[q++];
}
}
}
private void sortByColumn(int column, boolean ascending) {
this.ascending = ascending;
sortingColumns.removeAllElements();
sortingColumns.addElement(new Integer(column));
sort(this);
fireTableChanged(new TableModelEvent(this));
}
=====================================================================
Found a 29 line (255 tokens) duplication in the following files:
Starting at line 163 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AssetDBComponent.java
Starting at line 182 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/file/AssetFileComponent.java
rData.setItemId((String)rel.getProperty(RelationshipBase.PROP_ITEM).getValue());
rData.setTypeId((String)rel.getProperty(RelationshipBase.PROP_TYPEID).getValue());
rData.setSupported((String)rel.getProperty(RelationshipBase.PROP_SUPPORTED).getValue());
DateFormat df = DateFormat.getInstance();
try {
Date start = df.parse((String)rel.getProperty(RelationshipBase.PROP_STARTTIME).getValue());
Date end = df.parse((String)rel.getProperty(RelationshipBase.PROP_STOPTIME).getValue());
rData.setStartTime(start.getTime());
rData.setEndTime(end.getTime());
} catch(ParseException pe) {
if(log.isErrorEnabled()) {
log.error("Caught Exception parsing Date, using default dates.", pe);
}
rData.setStartTime(TimeSpan.MIN_VALUE);
rData.setEndTime(TimeSpan.MAX_VALUE);
}
assetData.addRelationship(rData);
}
}
}
// Add Property Groups.
iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Property Groups")) {
for(int i=0; i < container.getChildCount(); i++) {
=====================================================================
Found a 26 line (246 tokens) duplication in the following files:
Starting at line 528 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/console/NodeModel.java
Starting at line 141 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/AgentInfoPanel.java
StringBuffer sb = new StringBuffer();
if (agentChildren[i].getType().equals(ComponentData.AGENTBINDER)) {
sb.append(PluginManager.INSERTION_POINT + ".Binder");
} else if (agentChildren[i].getType().equals(ComponentData.NODEBINDER)) {
sb.append(AgentManager.INSERTION_POINT + ".Binder");
} else {
sb.append(agentChildren[i].getType());
}
if(ComponentDescription.parsePriority(agentChildren[i].getPriority()) !=
ComponentDescription.PRIORITY_COMPONENT) {
sb.append("(" + agentChildren[i].getPriority() + ")");
}
sb.append(" = ");
sb.append(agentChildren[i].getClassName());
if (agentChildren[i].parameterCount() != 0) {
sb.append("(");
Object[] params = agentChildren[i].getParameters();
sb.append(params[0].toString());
for (int j = 1; j < agentChildren[i].parameterCount(); j++) {
sb.append(",");
sb.append(params[j].toString());
}
sb.append(")");
}
entries.add(sb.toString());
}
=====================================================================
Found a 63 line (236 tokens) duplication in the following files:
Starting at line 143 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ComponentBase.java
Starting at line 241 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ComponentBase.java
}
// Create a new componentdata
// set the type, etc appropriately
// set self as the owner
// set data as the parent
// add self to data
ComponentData self = new GenericComponentData();
// We don't try to translate the component type here
// because that might cause a modification,
// which isn't the intent at this point
self.setType(getComponentType());
self.setOwner(this);
self.setParent(data);
self.setClassName(getComponentClassName());
self.setPriority(getPriority());
self.setAlibID(getAlibID());
self.setLibID(getLibID());
Iterator names = getSortedLocalPropertyNames();
while (names.hasNext()) {
CompositeName cname = (CompositeName) names.next();
String name = cname.toString();
// if (log.isDebugEnabled()) {
// log.debug("Looking at property " + name);
// }
if (name.indexOf(PROP_PARAM) != -1) {
if (log.isDebugEnabled()) {
log.debug("Found parameter " + name);
}
self.addParameter(getProperty(cname).getValue());
}
}
if (GenericComponentData.alreadyAdded(data, self)) {
if (log.isDebugEnabled()) {
log.debug(data.getName() + " already has component " + self);
}
return data;
}
if(getAlibID() != null) {
self.setName(getAlibID());
self.setName(GenericComponentData.getSubComponentUniqueName(data, self));
} else {
self.setName(GenericComponentData.getSubComponentUniqueName(data, self));
}
data.addChildDefaultLoc(self);
// if (log.isDebugEnabled()) {
// log.warn("CompBase moded comp " + self);
// log.warn("CompBase says type is " + getComponentType());
// }
return data;
}
public String getFolderLabel() {
=====================================================================
Found a 28 line (231 tokens) duplication in the following files:
Starting at line 164 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 156 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AssetDBComponent.java
log.error("Please report seeing Bug 1304: Using CSMART " + CSMART.writeDebug() + " had Null Relationship type for relationship at child spot #" + i + " out of " + container.getChildCount() + " for Agent " + agentName + " in assembly " + assemblyID + " where relationship role=" + rel.getProperty(RelationshipBase.PROP_ROLE) + ", and ItemID=" + rel.getProperty(RelationshipBase.PROP_ITEM) + ", and supported=" + rel.getProperty(RelationshipBase.PROP_SUPPORTED), new Throwable());
}
} else {
// Bug 1304 is an NPE in the next line
rData.setType((String)rel.getProperty(RelationshipBase.PROP_TYPE).getValue());
}
rData.setRole((String)rel.getProperty(RelationshipBase.PROP_ROLE).getValue());
rData.setItemId((String)rel.getProperty(RelationshipBase.PROP_ITEM).getValue());
// AMH: This line was missing? 7/2/02
rData.setTypeId((String)rel.getProperty(RelationshipBase.PROP_TYPEID).getValue());
rData.setSupported((String)rel.getProperty(RelationshipBase.PROP_SUPPORTED).getValue());
DateFormat df = DateFormat.getInstance();
try {
Date start = df.parse((String)rel.getProperty(RelationshipBase.PROP_STARTTIME).getValue());
Date end = df.parse((String)rel.getProperty(RelationshipBase.PROP_STOPTIME).getValue());
rData.setStartTime(start.getTime());
rData.setEndTime(end.getTime());
} catch(ParseException pe) {
if(log.isErrorEnabled()) {
log.error("Caught Exception parsing Date, using default dates.", pe);
}
rData.setStartTime(TimeSpan.MIN_VALUE);
rData.setEndTime(TimeSpan.MAX_VALUE);
}
assetData.addRelationship(rData);
}
=====================================================================
Found a 39 line (229 tokens) duplication in the following files:
Starting at line 809 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/cdata/GenericComponentData.java
Starting at line 344 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ComponentBase.java
}
if (type.equalsIgnoreCase(Agent.INSERTION_POINT))
type = ComponentData.AGENT;
else if (type.equalsIgnoreCase(AgentManager.INSERTION_POINT + ".Binder"))
type = ComponentData.NODEBINDER;
else if (type.equalsIgnoreCase(PluginManager.INSERTION_POINT + ".Binder"))
type = ComponentData.AGENTBINDER;
else if (type.equalsIgnoreCase(org.cougaar.core.plugin.PluginBase.INSERTION_POINT))
type = ComponentData.PLUGIN;
else if (type.equalsIgnoreCase("binder"))
type = ComponentData.AGENTBINDER;
else if (type.equalsIgnoreCase("nodebinder"))
type = ComponentData.NODEBINDER;
else if (type.equalsIgnoreCase("agentbinder"))
type = ComponentData.AGENTBINDER;
else if (type.equalsIgnoreCase("domain"))
type = ComponentData.DOMAIN;
else if (type.equalsIgnoreCase(ComponentData.NODEBINDER))
type = ComponentData.NODEBINDER;
else if (type.equalsIgnoreCase(ComponentData.AGENTBINDER))
type = ComponentData.AGENTBINDER;
else if (type.equalsIgnoreCase(ComponentData.PLUGIN))
type = ComponentData.PLUGIN;
else if (type.equalsIgnoreCase(ComponentData.AGENT))
type = ComponentData.AGENT;
else if (type.equalsIgnoreCase(ComponentData.DOMAIN))
type = ComponentData.DOMAIN;
return type;
}
/**
* Allow outside users to set the Component type to one of the
* values in the constants in ComponentData.
*
* @param type a String binder type
*/
public void setComponentType(String type) {
=====================================================================
Found a 63 line (217 tokens) duplication in the following files:
Starting at line 63 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/community/ULCommunityTableModel.java
Starting at line 120 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/plan/ULPlanTableModel.java
makePrettyNames();
}
private void createLogger() {
log = CSMART.createLogger(this.getClass().getName());
}
public int getColumnCount() {
return 2;
}
public int getRowCount() {
return names.size();
}
public String getColumnName(int col) {
if (col == 0)
return "Name";
else if (col == 1)
return "Value";
return "";
}
public Object getValueAt(int row, int col) {
if (col == 0)
return names.elementAt(row);
else if (col == 1)
return values.elementAt(row);
return "";
}
/**
* Modify the names by substituting spaces for underlines.
*/
private void makePrettyNames() {
for (int i = 0; i < names.size(); i++) {
String name = (String)names.elementAt(i);
name = name.replace('_', ' ');
names.setElementAt(name, i);
}
}
private void addAttribute(String name) {
Attribute a = node.getLocalAttribute(name);
if (a == null) {
// Bug 1921: Just too verbose? Or interesting?
// if(log.isDebugEnabled()) {
// log.debug("ULPlanTableModel: attribute not found: " +
// name);
// }
return;
}
names.addElement(name);
values.addElement(a.getValue());
}
/**
* Add a prefixed asset property; dropping the prefix and index.
* Prefixes are of the form: prefix_index_
*/
private void addAssetPropertyAttribute(String name, String prefix) {
=====================================================================
Found a 56 line (216 tokens) duplication in the following files:
Starting at line 120 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/plan/ULPlanTableModel.java
Starting at line 87 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/society/ULSocietyTableModel.java
makePrettyNames();
}
private void createLogger() {
log = CSMART.createLogger(this.getClass().getName());
}
public int getColumnCount() {
return 2;
}
public int getRowCount() {
return names.size();
}
public String getColumnName(int col) {
if (col == 0)
return "Name";
else if (col == 1)
return "Value";
return "";
}
public Object getValueAt(int row, int col) {
if (col == 0)
return names.elementAt(row);
else if (col == 1)
return values.elementAt(row);
return "";
}
/**
* Modify the names by substituting spaces for underlines.
*/
private void makePrettyNames() {
for (int i = 0; i < names.size(); i++) {
String name = (String)names.elementAt(i);
name = name.replace('_', ' ');
names.setElementAt(name, i);
}
}
private void addAttribute(String name) {
Attribute a = node.getLocalAttribute(name);
if (a == null) {
// Bug 1921: Just too verbose
// if(log.isDebugEnabled()) {
// log.debug("ULSocietyTableModel: attribute not found: " +
// name);
// }
return;
}
names.addElement(name);
values.addElement(a.getValue());
}
=====================================================================
Found a 56 line (215 tokens) duplication in the following files:
Starting at line 63 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/community/ULCommunityTableModel.java
Starting at line 87 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/society/ULSocietyTableModel.java
makePrettyNames();
}
private void createLogger() {
log = CSMART.createLogger(this.getClass().getName());
}
public int getColumnCount() {
return 2;
}
public int getRowCount() {
return names.size();
}
public String getColumnName(int col) {
if (col == 0)
return "Name";
else if (col == 1)
return "Value";
return "";
}
public Object getValueAt(int row, int col) {
if (col == 0)
return names.elementAt(row);
else if (col == 1)
return values.elementAt(row);
return "";
}
/**
* Modify the names by substituting spaces for underlines.
*/
private void makePrettyNames() {
for (int i = 0; i < names.size(); i++) {
String name = (String)names.elementAt(i);
name = name.replace('_', ' ');
names.setElementAt(name, i);
}
}
private void addAttribute(String name) {
Attribute a = node.getLocalAttribute(name);
if (a == null) {
// Bug 1921: Just too verbose
// if(log.isDebugEnabled()) {
// log.debug("ULSocietyTableModel: attribute not found: " +
// name);
// }
return;
}
names.addElement(name);
values.addElement(a.getValue());
}
=====================================================================
Found a 20 line (205 tokens) duplication in the following files:
Starting at line 169 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 103 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ui/AssetUIComponent.java
rData.setRole((String)rel.getProperty(RelationshipBase.PROP_ROLE).getValue());
rData.setItemId((String)rel.getProperty(RelationshipBase.PROP_ITEM).getValue());
rData.setTypeId((String)rel.getProperty(RelationshipBase.PROP_TYPEID).getValue());
rData.setSupported((String)rel.getProperty(RelationshipBase.PROP_SUPPORTED).getValue());
DateFormat df = DateFormat.getInstance();
try {
Date start = df.parse((String)rel.getProperty(RelationshipBase.PROP_STARTTIME).getValue());
Date end = df.parse((String)rel.getProperty(RelationshipBase.PROP_STOPTIME).getValue());
rData.setStartTime(start.getTime());
rData.setEndTime(end.getTime());
} catch(ParseException pe) {
if(log.isErrorEnabled()) {
log.error("Caught Exception parsing Date, using default dates.", pe);
}
rData.setStartTime(TimeSpan.MIN_VALUE);
rData.setEndTime(TimeSpan.MAX_VALUE);
}
assetData.addRelationship(rData);
}
=====================================================================
Found a 31 line (204 tokens) duplication in the following files:
Starting at line 507 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/util/PrototypeParser.java
Starting at line 537 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/util/PrototypeParser.java
private Object parseE(String type, String arg) {
int i;
type = type.trim();
arg = arg.trim();
if ((i = type.indexOf("<")) >= 0) {
int j = type.lastIndexOf(">");
String ctype = type.substring(0, i).trim();
String etype = type.substring(i + 1, j).trim();
Collection c = null;
if (ctype.equals("Collection") || ctype.equals("List")) {
c = new ArrayList();
} else {
throw new RuntimeException("Unparsable collection type: "+type);
}
Vector l = org.cougaar.util.StringUtility.parseCSV(arg);
for (Iterator it = l.iterator(); it.hasNext();) {
c.add((String)parseE(etype, (String)it.next()));
}
return c;
} else if ((i = type.indexOf("/")) >= 0) {
// Measure Object. How should we handle this?
return arg;
} else {
return arg;
}
}
private String getType(String type) {
=====================================================================
Found a 43 line (192 tokens) duplication in the following files:
Starting at line 277 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/TableSorter.java
Starting at line 275 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/topology/TableSorter.java
public void addMouseListenerToHeaderInTable(JTable table) {
final TableSorter sorter = this;
final JTable tableView = table;
tableView.setColumnSelectionAllowed(false);
MouseAdapter listMouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
TableColumnModel columnModel = tableView.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = tableView.convertColumnIndexToModel(viewColumn);
if(e.getClickCount() == 1 && column != -1) {
int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
boolean ascending = (shiftPressed == 0);
sorter.sortByColumn(column, ascending);
}
}
};
JTableHeader th = tableView.getTableHeader();
th.addMouseListener(listMouseListener);
}
/**
* Pass through methods for table model.
*/
public int getRowCount() {
checkModel();
return model.getRowCount();
}
public int getColumnCount() {
checkModel();
return model.getColumnCount();
}
// The mapping only affects the contents of the data rows.
// Pass all requests to these rows through the mapping array: "indexes".
public Object getValueAt(int aRow, int aColumn) {
checkModel();
return model.getValueAt(indexes[aRow], aColumn);
}
public void sortByColumn(int column) {
=====================================================================
Found a 84 line (190 tokens) duplication in the following files:
Starting at line 597 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/CommunityPanel.java
Starting at line 759 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/HostConfigurationBuilder.java
agentToNode.put(agentComponent, nodeComponent);
}
}
}
// In general, agent names from built in societies are complex
// and those from the db are short
// The complex ones should be compared in full,
// while the DB ones should only be compared in short versions
// And Nodes are also short only
// Failing to compare only the short names when using DB societies
// results in agents erroneously appearing 2x, once unassigned
private static Comparator dbBaseComponentComparator = new Comparator() {
public int compare(Object o1, Object o2) {
BaseComponent c1 = (BaseComponent) o1;
BaseComponent c2 = (BaseComponent) o2;
// System.out.println("dbBaseComponentComparator:" +
// c1.getShortName() + ";" +
// c2.getShortName() + ";" +
// c1.getShortName().compareTo(c2.getShortName()));
return c1.getShortName().compareTo(c2.getShortName());
}
};
// private static Comparator builtInBaseComponentComparator = new Comparator() {
// public int compare(Object o1, Object o2) {
// BaseComponent c1 = (BaseComponent) o1;
// BaseComponent c2 = (BaseComponent) o2;
// if (c1 instanceof NodeComponent || c2 instanceof NodeComponent)
// return c1.getShortName().compareTo(c2.getShortName());
// else // agent name comparison
// return c1.getFullName().compareTo(c2.getFullName());
// }
// };
/**
* Add unassigned agents to unassigned agents tree.
*/
private void addUnassignedAgentsFromExperiment() {
// // get all agents in the experiment and put them in unassigned list
// AgentComponent[] agents = experiment.getAgents();
// ArrayList unassignedAgentNames = new ArrayList();
// ArrayList unassignedAgents = new ArrayList();
// unassignedAgents.addAll(Arrays.asList(agents));
// for (int i = 0; i < agents.length; i++) {
// System.out.println("Adding:" + agents[i].getShortName() + ".");
// unassignedAgentNames.add(agents[i].getShortName());
// }
// NodeComponent[] nodes = experiment.getNodes();
// // get agents in each node and take them out of the unassigned list
// for (int i = 0; i < nodes.length; i++) {
// AgentComponent[] agentsInNodes = nodes[i].getAgents();
// for (int j = 0; j < agentsInNodes.length; j++) {
// BaseComponent agentInNode = agentsInNodes[j];
// System.out.println("Checking:" + agentInNode.getShortName() + ".");
// int index = unassignedAgentNames.indexOf(agentInNode.getShortName());
// if (index != -1) {
// System.out.println("Removing");
// unassignedAgentNames.remove(index);
// unassignedAgents.remove(index);
// }
// }
// }
Set unassignedAgents;
unassignedAgents = new TreeSet(dbBaseComponentComparator);
AgentComponent[] agents = experiment.getAgents();
// This will do a Node/Agent comparison
NodeComponent[] nodes = experiment.getNodeComponents();
// this must then do a lot of agent name comparisons
unassignedAgents.addAll(Arrays.asList(agents));
for (int i = 0; i < nodes.length; i++) {
// System.out.println("Remove all in: " + nodes[i].getShortName() +
// nodes[i].getAgents().length);
List assignedAgents = Arrays.asList(nodes[i].getAgents());
// this too does a lot of agent name comparisons
unassignedAgents.removeAll(assignedAgents);
}
DefaultTreeModel model = (DefaultTreeModel)agentTree.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode)model.getRoot();
Iterator iter = unassignedAgents.iterator();
while (iter.hasNext()) {
AgentComponent agentComponent = (AgentComponent)iter.next();
=====================================================================
Found a 19 line (185 tokens) duplication in the following files:
Starting at line 170 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 182 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/file/AssetFileComponent.java
rData.setItemId((String)rel.getProperty(RelationshipBase.PROP_ITEM).getValue());
rData.setTypeId((String)rel.getProperty(RelationshipBase.PROP_TYPEID).getValue());
rData.setSupported((String)rel.getProperty(RelationshipBase.PROP_SUPPORTED).getValue());
DateFormat df = DateFormat.getInstance();
try {
Date start = df.parse((String)rel.getProperty(RelationshipBase.PROP_STARTTIME).getValue());
Date end = df.parse((String)rel.getProperty(RelationshipBase.PROP_STOPTIME).getValue());
rData.setStartTime(start.getTime());
rData.setEndTime(end.getTime());
} catch(ParseException pe) {
if(log.isErrorEnabled()) {
log.error("Caught Exception parsing Date, using default dates.", pe);
}
rData.setStartTime(TimeSpan.MIN_VALUE);
rData.setEndTime(TimeSpan.MAX_VALUE);
}
assetData.addRelationship(rData);
}
=====================================================================
Found a 32 line (181 tokens) duplication in the following files:
Starting at line 424 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/generic/CSMARTGraph.java
Starting at line 503 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/generic/CSMARTGraph.java
Node tailNode = (Node)newNodes.get(thisEdge.getTail().getName());
Node headNode = (Node)newNodes.get(thisEdge.getHead().getName());
if (tailNode == null || headNode == null) {
if(log.isWarnEnabled()) {
log.warn("WARNING: null node");
}
}
Edge edge = new Edge(this, tailNode, headNode);
Enumeration attributes = thisEdge.getAttributePairs();
while (attributes.hasMoreElements()) {
Attribute thisAttribute = (Attribute)attributes.nextElement();
edge.setAttribute(thisAttribute.getName(),
thisAttribute.getValue());
}
}
// preserve graph type
Attribute a = graphToCopy.getAttribute(GRAPH_TYPE);
if (a != null)
setAttribute(GRAPH_TYPE, a.getStringValue());
// preserve layout
a = graphToCopy.getAttribute(LACKS_LAYOUT);
if (a != null)
setAttribute(LACKS_LAYOUT, a.getStringValue());
customizeGraph(); // set direction, font, etc.
}
/**
* Create a new graph containing the selected nodes and ALL their edges.
* @return the new graph
*/
public CSMARTGraph newGraphFromSelection() {
=====================================================================
Found a 27 line (177 tokens) duplication in the following files:
Starting at line 129 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/community/ULCommunityFrame.java
Starting at line 407 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/society/ULSocietyFrame.java
agentPanel.setBorder(new TitledBorder("Society"));
agentPanel.setLayout(new BoxLayout(agentPanel, BoxLayout.Y_AXIS));
JComboBox cb =
new JComboBox(new LegendComboBoxModel(graph.getNodeColors()));
cb.setRenderer(new LegendRenderer());
cb.setSelectedIndex(0);
agentPanel.add(cb);
JPanel buttonPanel = new JPanel();
JButton OKButton = new JButton("OK");
OKButton.setFocusPainted(false);
OKButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
legendDialog.setVisible(false);
}
});
buttonPanel.add(OKButton);
legendDialog.getContentPane().setLayout(new BorderLayout());
legendDialog.getContentPane().add(agentPanel, BorderLayout.CENTER);
legendDialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
legendDialog.pack();
legendDialog.setSize(legendDialog.getWidth(),legendDialog.getHeight()+100);
legendDialog.show();
}
}
=====================================================================
Found a 31 line (175 tokens) duplication in the following files:
Starting at line 313 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AgentDBComponent.java
Starting at line 392 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AgentDBComponent.java
ComponentBase binder = new ComponentBase(binderName, binderClassName, priority, type);
binder.initProperties();
// binder.setComponentType(rs.getString(5));
String alibId = rs.getString(2);
String libId = rs.getString(3);
binder.setAlibID(alibId);
binder.setLibID(libId);
substitutions.put(":comp_alib_id", alibId);
substitutions.put(":comp_id", rs.getString(3));
Statement stmt2 = conn.createStatement();
String query2 = dbp.getQuery(QUERY_PLUGIN_ARGS, substitutions);
ResultSet rs2 = stmt2.executeQuery(query2);
while (rs2.next()) {
String arg = rs2.getString(1);
binder.addParameter(arg);
}
rs2.close();
stmt2.close();
container.addChild(binder);
} // end of loop over binders to add
rs.close();
stmt.close();
} finally {
conn.close();
}
} catch (Exception e) {
if(log.isErrorEnabled()) {
log.error("Exception: ", e);
}
throw new RuntimeException("Error: " + e);
=====================================================================
Found a 27 line (167 tokens) duplication in the following files:
Starting at line 133 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 124 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AssetDBComponent.java
addRelationships(getRelationshipData()); // add relationships from database
}
/**
* Add component data for asset properties, relationships,
* and property groups.
* TODO: same as AssetFileComponent: should this be moved to a base class?
*/
public ComponentData addComponentData(ComponentData data) {
AgentAssetData assetData = new AgentAssetData((AgentComponentData)data);
// assetData.setType(((Integer)propAssetType.getValue()).intValue());
assetData.setAssetClass((String)propAssetClass.getValue());
assetData.setUniqueID((String)propUniqueID.getValue());
assetData.setUnitName((String)propUnitName.getValue());
assetData.setUIC((String)propUIC.getValue());
// Add Relationships.
Iterator iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Relationships")) {
for(int i=0; i < container.getChildCount(); i++) {
RelationshipBase rel = (RelationshipBase) container.getChild(i);
RelationshipData rData = new RelationshipData();
if (rel == null) {
=====================================================================
Found a 26 line (166 tokens) duplication in the following files:
Starting at line 249 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/experiment/ExperimentINIWriter.java
Starting at line 378 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/experiment/LeafOnlyConfigWriter.java
}
/**
* @deprecated
*/
private void writeLeafData(File configDir, ComponentData me) throws IOException {
if (me.leafCount() < 1)
return;
LeafComponentData[] leaves = me.getLeafComponents();
for (int i = 0; i < me.leafCount(); i++) {
LeafComponentData leaf = leaves[i];
if (leaf == null)
continue;
if (!leaf.getType().equals(LeafComponentData.FILE)) {
if(log.isErrorEnabled()) {
log.error("Got unknown LeafComponent type: " + leaf.getType());
}
continue;
}
PrintWriter writer = new PrintWriter(new FileWriter(new File(configDir, leaf.getName())));
try {
writer.println(leaf.getValue().toString());
} catch (Exception e) {
if(log.isErrorEnabled()) {
log.error("Error writing config file: " + e);
=====================================================================
Found a 25 line (161 tokens) duplication in the following files:
Starting at line 159 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/file/AssetFileComponent.java
Starting at line 78 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ui/AssetUIComponent.java
AgentAssetData assetData = new AgentAssetData((AgentComponentData)data);
// String agent = data.getName();
// FIXME: IF asset class is null or empty, perhaps abort? Or
// fill in the agent name inside these?
// Of course, doing it in the addComponentData is bad,
// cause it modifies the Component
// assetData.setType(((Integer)propAssetType.getValue()).intValue());
assetData.setAssetClass((String)propAssetClass.getValue());
assetData.setUniqueID((String)propUniqueID.getValue());
assetData.setUnitName((String)propUnitName.getValue());
assetData.setUIC((String)propUIC.getValue());
// Add Relationships.
Iterator iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Relationships")) {
for(int i=0; i < container.getChildCount(); i++) {
RelationshipBase rel = (RelationshipBase) container.getChild(i);
RelationshipData rData = new RelationshipData();
rData.setType((String)rel.getProperty(RelationshipBase.PROP_TYPE).getValue());
=====================================================================
Found a 32 line (161 tokens) duplication in the following files:
Starting at line 133 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 70 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ui/AssetUIComponent.java
propUIC.setToolTip(PROP_UIC_DESC);
}
/**
* Add component data for asset properties, relationships,
* and property groups.
*/
public ComponentData addComponentData(ComponentData data) {
AgentAssetData assetData = new AgentAssetData((AgentComponentData)data);
// String agent = data.getName();
// FIXME: IF asset class is null or empty, perhaps abort? Or
// fill in the agent name inside these?
// Of course, doing it in the addComponentData is bad,
// cause it modifies the Component
// assetData.setType(((Integer)propAssetType.getValue()).intValue());
assetData.setAssetClass((String)propAssetClass.getValue());
assetData.setUniqueID((String)propUniqueID.getValue());
assetData.setUnitName((String)propUnitName.getValue());
assetData.setUIC((String)propUIC.getValue());
// Add Relationships.
Iterator iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Relationships")) {
for(int i=0; i < container.getChildCount(); i++) {
RelationshipBase rel = (RelationshipBase) container.getChild(i);
RelationshipData rData = new RelationshipData();
=====================================================================
Found a 52 line (159 tokens) duplication in the following files:
Starting at line 211 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/AgentBase.java
Starting at line 456 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ComponentBase.java
}
/**
* Has this Component been modified, such that a save would do something.
*
* @return a boolean, false if no save necessary
*/
public boolean isModified() {
return modified;
}
/**
* Set the internal modified flag (returned by isModified)
* and fire a modification event.
*/
public void fireModification() {
modified = true;
super.fireModification();
}
private void installListeners() {
addPropertiesListener(this);
for (Iterator i = getPropertyNames(); i.hasNext(); ) {
Property p = getProperty((CompositeName)i.next());
p.addPropertyListener(myPropertyListener);
}
}
public void propertyAdded(PropertyEvent e) {
Property addedProperty = e.getProperty();
setPropertyVisible(addedProperty, true);
addedProperty.addPropertyListener(myPropertyListener);
fireModification();
}
public void propertyRemoved(PropertyEvent e) {
e.getProperty().removePropertyListener(myPropertyListener);
fireModification();
}
PropertyListener myPropertyListener =
new PropertyListener() {
public void propertyValueChanged(PropertyEvent e) {
fireModification();
}
public void propertyOtherChanged(PropertyEvent e) {
fireModification();
}
};
=====================================================================
Found a 27 line (155 tokens) duplication in the following files:
Starting at line 181 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/cdata/AssetDataCallbackImpl.java
Starting at line 526 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/util/PrototypeParser.java
c.add((String)parseE(etype, (String)it.next()));
}
return c;
} else if ((i = type.indexOf("/")) >= 0) {
// Handle Measure Object Here.
return arg;
} else {
return arg;
}
}
private Object parseE(String type, String arg) {
int i;
type = type.trim();
arg = arg.trim();
if ((i = type.indexOf("<")) >= 0) {
int j = type.lastIndexOf(">");
String ctype = type.substring(0, i).trim();
String etype = type.substring(i + 1, j).trim();
Collection c = null;
if (ctype.equals("Collection") || ctype.equals("List")) {
c = new ArrayList();
} else {
throw new RuntimeException("Unparsable collection type: "+type);
}
=====================================================================
Found a 20 line (153 tokens) duplication in the following files:
Starting at line 161 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/cdata/AssetDataCallbackImpl.java
Starting at line 193 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/cdata/AssetDataCallbackImpl.java
private Object parseE(String type, String arg) {
int i;
type = type.trim();
arg = arg.trim();
if ((i = type.indexOf("<")) >= 0) {
int j = type.lastIndexOf(">");
String ctype = type.substring(0, i).trim();
String etype = type.substring(i + 1, j).trim();
Collection c = null;
if (ctype.equals("Collection") || ctype.equals("List")) {
c = new ArrayList();
} else {
throw new RuntimeException("Unparsable collection type: "+type);
}
List coll = org.cougaar.util.CSVUtility.parseToList(arg);
for (Iterator iterator = coll.iterator(); iterator.hasNext();) {
String o = (String) iterator.next();
=====================================================================
Found a 27 line (148 tokens) duplication in the following files:
Starting at line 1106 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/configbuilder/PropertyEditorPanel.java
Starting at line 1168 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/configbuilder/PropertyEditorPanel.java
String value =
(String)JOptionPane.showInputDialog(this, "Enter Parameter Value",
"Parameter Value",
JOptionPane.QUESTION_MESSAGE,
null, null, "");
if (value == null) return;
value = value.trim(); // trim white space
if (value.length() == 0) return;
// Allow lists
Object realValue = null;
if (value.startsWith("[") && value.endsWith("]")) {
realValue = PropertyHelper.convertStringToArrayList(value);
} else if (value.startsWith("{") && value.endsWith("}")) {
realValue = PropertyHelper.convertStringToArray(value);
} else {
realValue = value;
}
if (getName) {
cc.addProperty(name, realValue);
} else {
cc.addProperty(generateName((ConfigurableComponent)cc), realValue);
}
}
private void addTarget() {
=====================================================================
Found a 28 line (148 tokens) duplication in the following files:
Starting at line 206 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 211 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/file/AssetFileComponent.java
PropGroupComponent pg = (PropGroupComponent)container.getChild(i);
assetData.addPropertyGroup(pg.getPropGroupData());
}
}
}
data.addAgentAssetData(assetData);
return data;
}
private void addRelationships(RelationshipData[] rel) {
ContainerBase relContainer = new ContainerBase("Relationships");
relContainer.initProperties();
addChild(relContainer);
for(int i=0; i < rel.length; i++) {
RelationshipBase newR = new RelationshipBase(rel[i]);
newR.initProperties();
relContainer.addChild(newR);
}
}
private void addPropGroups(AgentAssetData aad) {
ContainerBase pgContainer = new ContainerBase("Property Groups");
pgContainer.initProperties();
addChild(pgContainer);
Iterator iter = aad.getPropGroupsIterator();
while(iter.hasNext()) {
PropGroupData pgd = (PropGroupData)iter.next();
=====================================================================
Found a 15 line (141 tokens) duplication in the following files:
Starting at line 145 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 159 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/file/AssetFileComponent.java
assetData.setIniFormat(this.iniFormat);
assetData.setAssetClass((String)propAssetClass.getValue());
assetData.setUniqueID((String)propUniqueID.getValue());
assetData.setUnitName((String)propUnitName.getValue());
assetData.setUIC((String)propUIC.getValue());
// Add Relationships.
Iterator iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Relationships")) {
for(int i=0; i < container.getChildCount(); i++) {
RelationshipBase rel = (RelationshipBase) container.getChild(i);
RelationshipData rData = new RelationshipData();
=====================================================================
Found a 35 line (138 tokens) duplication in the following files:
Starting at line 1000 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/db/DBUtils.java
Starting at line 1033 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/db/DBUtils.java
substitutions.put(":societyName", societyName);
String dbQuery = DBUtils.getQuery(EXPERIMENT_QUERY, substitutions);
Logger log = CSMART.createLogger("org.cougaar.tools.csmart.core.db.DBUtils");
Set s = new HashSet();
try {
Connection conn = DBUtils.getConnection();
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(dbQuery);
while (rs.next()) {s.add(rs.getString(1));}
rs.close();
stmt.close();
} finally {
conn.close();
}
} catch (Exception e) {
if(log.isErrorEnabled()) {
log.error("querySet: "+dbQuery, e);
}
throw new RuntimeException("Error" + e);
}
return s;
}
/**
* Does the given experiment have a CMT assembly
* as part of its configuration definition. Used to decide
* whether to allow the user to modify the selection when loading
* from the database, and when deciding whether to display the
* Threads pane in the Experiment builder.
*
* @param experimentId a String experiment ID in the database
* @return a boolean, true if the experiment uses a CMT society
*/
public static final boolean containsCMTAssembly(String experimentId) {
=====================================================================
Found a 23 line (134 tokens) duplication in the following files:
Starting at line 55 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/CommunityTableMouseAdapter.java
Starting at line 292 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/configbuilder/PropertyTable.java
public MyMouseAdapter(JTable table) {
super();
this.table = table;
menu = new JPopupMenu();
for (int i = 0; i < actions.length; i++)
menu.add(actions[i]);
}
public void mouseClicked(MouseEvent e) {
if (e.isPopupTrigger()) doPopup(e);
}
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) doPopup(e);
}
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) doPopup(e);
}
private void doPopup(MouseEvent e) {
row = table.rowAtPoint(e.getPoint());
if (row == -1) return;
=====================================================================
Found a 59 line (133 tokens) duplication in the following files:
Starting at line 69 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/community/ULCommunityNode.java
Starting at line 171 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/xml/XMLNode.java
}
public String getUID() {
return UID;
}
public String getLabel() {
return label;
}
public String getToolTip() {
return toolTip;
}
public String getColor() {
return color;
}
public String getBorderColor() {
return null;
}
public String getFontStyle() {
return "normal";
}
public String getShape() {
return shape;
}
public String getSides() {
return sides;
}
public String getDistortion() {
return distortion;
}
public String getOrientation() {
return orientation;
}
public PropertyTree getProperties() {
return properties;
}
public Vector getIncomingLinks() {
return null;
}
public Vector getOutgoingLinks() {
return outgoingLinks;
}
public Vector getBidirectionalLinks() {
return null;
}
private void setNodeShapeParameters() {
=====================================================================
Found a 23 line (132 tokens) duplication in the following files:
Starting at line 88 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/CommunityDNDTree.java
Starting at line 78 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/EntityDNDTree.java
public EntityDNDTree(DefaultTreeModel model) {
super(model);
setToolTipText("");
createLogger();
}
private void createLogger() {
log = CSMART.createLogger(this.getClass().getName());
}
public String getToolTipText(MouseEvent evt) {
if (getRowForLocation(evt.getX(), evt.getY()) == -1) return null;
TreePath path = getPathForLocation(evt.getX(), evt.getY());
DefaultMutableTreeNode node =
(DefaultMutableTreeNode)path.getLastPathComponent();
Object o = node.getUserObject();
if (o != null && o instanceof CommunityTreeObject)
return ((CommunityTreeObject)o).getToolTip();
else
return "";
}
protected boolean supportsMultiDrag() {
=====================================================================
Found a 16 line (124 tokens) duplication in the following files:
Starting at line 152 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/HostConfigurationBuilder.java
Starting at line 362 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/HostConfigurationBuilder.java
DefaultCellEditor nodeEditor = new DefaultCellEditor(new JTextField()) {
public boolean isCellEditable(EventObject e) {
if (super.isCellEditable(e) && e instanceof MouseEvent) {
TreePath path = hostTree.getPathForLocation(((MouseEvent)e).getX(),
((MouseEvent)e).getY());
if (path == null)
return false;
Object o = path.getLastPathComponent();
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode)o;
if (treeNode.isRoot() ||
((ConsoleTreeObject)treeNode.getUserObject()).isAgent())
return false;
}
return super.isCellEditable(e);
}
public boolean stopCellEditing() {
=====================================================================
Found a 16 line (120 tokens) duplication in the following files:
Starting at line 161 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/cdata/AssetDataCallbackImpl.java
Starting at line 507 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/util/PrototypeParser.java
protected Object parseArgs(String type, String arg) {
int i;
type = type.trim();
arg = arg.trim();
if ((i = type.indexOf("<")) >= 0) {
int j = type.lastIndexOf(">");
String ctype = type.substring(0, i).trim();
String etype = type.substring(i + 1, j).trim();
Collection c = null;
if (ctype.equals("Collection") || ctype.equals("List")) {
c = new ArrayList();
} else {
throw new RuntimeException("Unparsable collection type: "+type);
}
=====================================================================
Found a 25 line (119 tokens) duplication in the following files:
Starting at line 254 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/OrganizerHelper.java
Starting at line 280 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/OrganizerHelper.java
log.debug("createExpt got null orig ExptId when loading expt " + experimentId);
}
// just re-loading an experiment
// get its comm ASB
PopulateDb pdbc = null;
String commAsb = null;
try {
pdbc = new PopulateDb(experimentId, trialId);
commAsb = pdbc.getCommAsbForExpt(experimentId, trialId);
} catch (SQLException sqle) {
log.error("createExperiment couldnt get commAsb for expt " + experimentId, sqle);
} catch (IOException ioe) {
log.error("createExperiment couldnt get commAsb for expt " + experimentId, ioe);
} finally {
try {
if (pdbc != null)
pdbc.close();
} catch (SQLException se) {}
}
experiment.setCommAsbID(commAsb);
if (log.isDebugEnabled()) {
log.debug("createExpt got comm asb for expt " + experimentId + " of " + commAsb);
}
}
=====================================================================
Found a 27 line (118 tokens) duplication in the following files:
Starting at line 573 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/ComplexRecipeBase.java
Starting at line 235 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/SocietyBase.java
for(int i=0; i < children.length; i++) {
ComponentData child = children[i];
// for each child component data, if it's an agent's component data
if (child.getType() == ComponentData.AGENT) {
// get all my agent components
Iterator iter =
((Collection)getDescendentsOfClass(AgentComponent.class)).iterator();
while(iter.hasNext()) {
AgentComponent agent = (AgentComponent)iter.next();
// if the component data name matches the agent name
if (child.getName().equals(agent.getShortName().toString())) {
// then set me as the owner of the component data
child.setOwner(this);
// and add the component data
agent.addComponentData(child);
// child.resetModified();
// Dont do above cause it leaves the HNA open, but it
// would at least ensure that if other recipe snuck in earlier,
// this worked OK.
}
}
} else {
// FIXME!! Will we support other top-level components?
// Process children of component data
addComponentData(child);
}
}
=====================================================================
Found a 15 line (114 tokens) duplication in the following files:
Starting at line 225 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/RecipeBase.java
Starting at line 438 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/SocietyBase.java
}
PropertyListener myPropertyListener =
new PropertyListener() {
public void propertyValueChanged(PropertyEvent e) {
if (e == null || e.getProperty() == null)
return;
if (e.getProperty().getValue() == null) {
if (e.getPreviousValue() == null)
return;
else
fireModification();
} else if (e.getPreviousValue() == null) {
fireModification();
} else if (! e.getProperty().getValue().toString().trim().equals(e.getPreviousValue().toString()))
=====================================================================
Found a 23 line (114 tokens) duplication in the following files:
Starting at line 98 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/CompleteAgentRecipe.java
Starting at line 223 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/SocietyBase.java
}
/**
* Adds any relevent ComponentData for this component.
* This method does not modify any existing ComponentData
*
* @see ComponentData
* @param data Pointer to the global ComponentData
* @return an updated ComponentData object
*/
public ComponentData addComponentData(ComponentData data) {
ComponentData[] children = data.getChildren();
for(int i=0; i < children.length; i++) {
ComponentData child = children[i];
// for each child component data, if it's an agent's component data
if (child.getType() == ComponentData.AGENT) {
// get all my agent components
Iterator iter =
((Collection)getDescendentsOfClass(AgentComponent.class)).iterator();
while(iter.hasNext()) {
AgentComponent agent = (AgentComponent)iter.next();
// if the component data name matches the agent name
if (child.getName().equals(agent.getShortName().toString())) {
=====================================================================
Found a 19 line (113 tokens) duplication in the following files:
Starting at line 208 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/ExperimentTree.java
Starting at line 274 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/OrganizerTree.java
Object data = null;
try {
data = t.getTransferData(flavors[0]);
} catch (Exception e) {
if(log.isErrorEnabled()) {
log.error("Exception adding dropped element:", e);
return DnDConstants.ACTION_NONE;
}
}
if (data == null) {
if(log.isErrorEnabled()) {
log.error("Attempting to add null dropped element");
}
return DnDConstants.ACTION_NONE;
}
if (data instanceof DMTNArray) {
DMTNArray nodes = (DMTNArray) data;
for (int i = 0; i < nodes.nodes.length; i++)
addElement(nodes.nodes[i], target, before);
=====================================================================
Found a 21 line (113 tokens) duplication in the following files:
Starting at line 125 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/experiment/ExperimentINIWriter.java
Starting at line 358 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/experiment/LeafOnlyConfigWriter.java
theSoc.addChild(nc);
addAgents(nodesToWrite[i], nc);
}
}
/**
* @deprecated
*/
private void addAgents(NodeComponent node, ComponentData nc) {
AgentComponent[] agents = node.getAgents();
if (agents == null || agents.length == 0)
return;
for (int i = 0; i < agents.length; i++) {
AgentComponentData ac = new AgentComponentData();
ac.setName(agents[i].getFullName().toString());
// FIXME!!
ac.setOwner(null); // the society that contains this agent FIXME!!!
ac.setParent(nc);
nc.addChild((ComponentData)ac);
}
}
=====================================================================
Found a 18 line (112 tokens) duplication in the following files:
Starting at line 122 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/ThreadBuilder.java
Starting at line 160 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/CMTDialog.java
bottomPanel.add(new JLabel("Select Organization Groups:"),
new GridBagConstraints(x, y++, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST,
GridBagConstraints.NONE,
new Insets(0, leftIndent, 0, 0),
0, 0));
leftIndent = leftIndent + 5;
for (int i = 0; i < nGroupNames; i++) {
String groupName = (String)groupNames[i];
JCheckBox groupCB = new JCheckBox(groupName);
// if (DBUtils.isMySQL())
// groupCB.setEnabled(false); // MySQL DB
boolean sel = ExperimentDB.isGroupSelected(trialId, groupName);
groupCheckBoxes.add(groupCB);
originalGroupSelected.add(new Boolean(sel));
groupCB.setSelected(sel);
=====================================================================
Found a 17 line (110 tokens) duplication in the following files:
Starting at line 1122 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/db/DBUtils.java
Starting at line 1145 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/db/DBUtils.java
private static Set dbGetPluginOrBinderClasses(String dbQuery) {
Logger log = CSMART.createLogger("org.cougaar.tools.csmart.core.db.DBUtils");
Set s = new HashSet();
try {
Connection conn = DBUtils.getConnection();
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(dbQuery);
while (rs.next()) {s.add(rs.getString(1));}
rs.close();
stmt.close();
} finally {
conn.close();
}
} catch (Exception e) {
if(log.isErrorEnabled()) {
log.error("dbGetPluginOrBinderClasses error using query: " + dbQuery, e);
=====================================================================
Found a 49 line (108 tokens) duplication in the following files:
Starting at line 71 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/society/ULSocietyNode.java
Starting at line 170 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/xml/XMLNode.java
properties.putAll(newProperties);
}
public String getUID() {
return UID;
}
public String getLabel() {
return label;
}
public String getToolTip() {
return toolTip;
}
public String getColor() {
return color;
}
public String getBorderColor() {
return null;
}
public String getFontStyle() {
return "normal";
}
public String getShape() {
return shape;
}
public String getSides() {
return sides;
}
public String getDistortion() {
return distortion;
}
public String getOrientation() {
return orientation;
}
public PropertyTree getProperties() {
return properties;
}
public Vector getIncomingLinks() {
return null;
=====================================================================
Found a 54 line (107 tokens) duplication in the following files:
Starting at line 69 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/community/ULCommunityNode.java
Starting at line 72 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/society/ULSocietyNode.java
}
public String getUID() {
return UID;
}
/**
* Force quotations at start and end of label, otherwise dot
* mis-interprets labels that start with a digit.
*/
public String getLabel() {
// return "\"" + label + "\"";
return label;
}
public String getToolTip() {
return toolTip;
}
public String getColor() {
return color;
}
public String getBorderColor() {
return null;
}
public String getFontStyle() {
return "normal";
}
public String getShape() {
return shape;
}
public String getSides() {
return sides;
}
public String getDistortion() {
return distortion;
}
public String getOrientation() {
return orientation;
}
public PropertyTree getProperties() {
return properties;
}
public Vector getIncomingLinks() {
return incomingLinks;
=====================================================================
Found a 22 line (107 tokens) duplication in the following files:
Starting at line 195 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 183 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/AssetDBComponent.java
}
}
}
// Add Property Groups.
iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Property Groups")) {
for(int i=0; i < container.getChildCount(); i++) {
PropGroupBase pg = (PropGroupBase)container.getChild(i);
assetData.addPropertyGroup(pg.getPropGroupData());
}
}
}
data.addAgentAssetData(assetData);
return data;
}
private void getAssemblies() {
=====================================================================
Found a 16 line (106 tokens) duplication in the following files:
Starting at line 1028 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/CSMART.java
Starting at line 1060 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/CSMART.java
result.append("Based on Cougaar core ");
if (version == null) {
result.append("(unknown version)\n");
} else {
result.append(version+" built on "+((buildtime > 0) ? (new Date(buildtime)).toString() : "(unknown time)") + "\n");
// add repositoryTag, repositoryModified, repositoryTime?
result.append("Repository: "+
((repositoryTag != null) ?
(repositoryTag +
(repositoryModified ? " (modified)" : "")) :
"(unknown tag)")+
" on "+
((repositoryTime > 0) ?
((new Date(repositoryTime)).toString()) :
"(unknown time)") + "\n");
}
=====================================================================
Found a 19 line (106 tokens) duplication in the following files:
Starting at line 240 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/metrics/CSMARTMetrics.java
Starting at line 1166 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/viewer/CSMARTUL.java
getObjectsFromServlet(ClientServletUtil.METRICS_SERVLET);
if (objectsFromServlet == null)
return;
if(log.isInfoEnabled()) {
log.info("Received metrics: " + objectsFromServlet.size());
}
ArrayList names = new ArrayList();
ArrayList data = new ArrayList();
Iterator iter = objectsFromServlet.iterator();
while(iter.hasNext()) {
Object obj = iter.next();
if(obj instanceof String) {
names.add(obj);
} else if (obj instanceof Integer[]) {
data.add(obj);
}
}
=====================================================================
Found a 22 line (105 tokens) duplication in the following files:
Starting at line 1073 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/configbuilder/PropertyEditorPanel.java
Starting at line 1138 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/configbuilder/PropertyEditorPanel.java
private void addPropGroupParameter(boolean getName) {
DefaultMutableTreeNode selNode =
(DefaultMutableTreeNode)tree.getSelectionPath().getLastPathComponent();
ModifiableComponent cc =
(ModifiableComponent)nodeToComponent.get(selNode);
if (cc instanceof MiscComponent)
getName = false;
String name = "";
if (getName) {
name =
(String)JOptionPane.showInputDialog(this, "Enter Parameter Name",
"Parameter Name",
JOptionPane.QUESTION_MESSAGE,
null, null, name);
if (name == null) return;
name = name.trim(); // trim white space
if (name.length() == 0) return;
}
String type = "";
=====================================================================
Found a 25 line (105 tokens) duplication in the following files:
Starting at line 195 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/cdata/AssetCDataComponent.java
Starting at line 122 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/ui/AssetUIComponent.java
}
}
}
// FIXME: Perhaps check that ClusterPG (MessageAddress),
// ItemIdentificationPG (ItemIdentifiation), TypeIdentificationPG (TypeIdentification)
// are, at a minimum, among those filled in?
// What would I do though if they're not?
// Add Property Groups.
iter =
((Collection)getDescendentsOfClass(ContainerBase.class)).iterator();
while(iter.hasNext()) {
ContainerBase container = (ContainerBase)iter.next();
if(container.getShortName().equals("Property Groups")) {
for(int i=0; i < container.getChildCount(); i++) {
PropGroupBase pg = (PropGroupBase)container.getChild(i);
assetData.addPropertyGroup(pg.getPropGroupData());
}
}
}
data.addAgentAssetData(assetData);
return data;
}
=====================================================================
Found a 29 line (105 tokens) duplication in the following files:
Starting at line 242 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/RecipeBase.java
Starting at line 454 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/SocietyBase.java
}
public void propertyOtherChanged(PropertyEvent e) {
fireModification();
}
};
ModificationListener myModificationListener = new MyModificationListener();
public int addChild(ComposableComponent c) {
((ModifiableConfigurableComponent)c).addModificationListener(myModificationListener);
fireModification();
return super.addChild(c);
}
public void removeChild(ComposableComponent c) {
((ModifiableConfigurableComponent)c).removeModificationListener(myModificationListener);
fireModification();
super.removeChild(c);
}
class MyModificationListener implements ModificationListener, ConfigurableComponentListener {
public void modified(ModificationEvent e) {
// don't propagate modifications when we're saving
if (!saveInProgress)
fireModification();
}
}
=====================================================================
Found a 16 line (105 tokens) duplication in the following files:
Starting at line 1002 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/db/DBUtils.java
Starting at line 1123 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/core/db/DBUtils.java
Logger log = CSMART.createLogger("org.cougaar.tools.csmart.core.db.DBUtils");
Set s = new HashSet();
try {
Connection conn = DBUtils.getConnection();
try {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(dbQuery);
while (rs.next()) {s.add(rs.getString(1));}
rs.close();
stmt.close();
} finally {
conn.close();
}
} catch (Exception e) {
if(log.isErrorEnabled()) {
log.error("dbGetAgentNames error using query: " + dbQuery, e);
=====================================================================
Found a 14 line (104 tokens) duplication in the following files:
Starting at line 1015 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/CSMART.java
Starting at line 1047 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/CSMART.java
Class vc = Class.forName("org.cougaar.Version");
Field vf = vc.getField("version");
Field bf = vc.getField("buildTime");
version = (String) vf.get(null);
buildtime = bf.getLong(null);
Field tf = vc.getField("repositoryTag");
Field rmf = vc.getField("repositoryModified");
Field rtf = vc.getField("repositoryTime");
repositoryTag = (String) tf.get(null);
repositoryModified = rmf.getBoolean(null);
repositoryTime = rtf.getLong(null);
} catch (Exception e) {}
result.append("Based on Cougaar core ");
=====================================================================
Found a 17 line (104 tokens) duplication in the following files:
Starting at line 1670 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/plan/ULPlanFinder.java
Starting at line 1742 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/plan/ULPlanFinder.java
long value) {
Vector selectedNodes = new Vector(nodes.size());
long nodeValue;
for (int i = 0; i < nodes.size(); i++) {
Node node = (Node)nodes.elementAt(i);
String s = (String)node.getAttributeValue(attributeName);
if (s == null)
continue;
try {
nodeValue = Long.parseLong(s);
} catch (NumberFormatException e) {
if(log.isErrorEnabled()) {
log.error("ULPlanFinder: ", e);
}
continue;
}
if (nodeValue == value)
=====================================================================
Found a 17 line (104 tokens) duplication in the following files:
Starting at line 1646 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/plan/ULPlanFinder.java
Starting at line 1718 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/monitor/plan/ULPlanFinder.java
float value) {
Vector selectedNodes = new Vector(nodes.size());
float nodeValue;
for (int i = 0; i < nodes.size(); i++) {
Node node = (Node)nodes.elementAt(i);
String s = (String)node.getAttributeValue(attributeName);
if (s == null)
continue;
try {
nodeValue = Float.parseFloat(s);
} catch (NumberFormatException e) {
if(log.isErrorEnabled()) {
log.error("ULPlanFinder: ", e);
}
continue;
}
if (nodeValue == value)
=====================================================================
Found a 27 line (103 tokens) duplication in the following files:
Starting at line 557 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/ComplexRecipeBase.java
Starting at line 140 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/ComponentCollectionRecipe.java
return getClass().getResource(DESCRIPTION_RESOURCE_NAME);
}
/**
* Adds any new data to the global ComponentData tree.
* No existing data is modified in this method.
* Warning: Assumes it is handed a ComponentData which contains
* all Agents below it.
*
* @param data Pointer to the Global ComponentData tree
* @return an updated ComponentData value
*/
public ComponentData addComponentData(ComponentData data) {
ComponentData[] children = data.getChildren();
if (children == null)
return data;
for(int i=0; i < children.length; i++) {
ComponentData child = children[i];
// for each child component data, if it's an agent's component data
if (child.getType() == ComponentData.AGENT) {
// get all my agent components
Iterator iter =
((Collection)getDescendentsOfClass(AgentComponent.class)).iterator();
while(iter.hasNext()) {
AgentComponent agent = (AgentComponent)iter.next();
// Do not process Recipe Agents here, only in modify.
if(!child.getName().equals(RECIPE_AGENT)) {
=====================================================================
Found a 19 line (102 tokens) duplication in the following files:
Starting at line 103 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/ThreadBuilder.java
Starting at line 141 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/viewer/CMTDialog.java
bottomPanel.add(cb,
new GridBagConstraints(x, y++, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST,
GridBagConstraints.NONE,
new Insets(0, leftIndent, 5, 0),
0, 0));
}
/////////////////////////
// Now the multiplier groups
Map groupNameToId = ExperimentDB.getOrganizationGroups(experimentId);
Set groups = groupNameToId.keySet();
groupNames = (String[])groups.toArray(new String[groups.size()]);
int nGroupNames = groupNames.length;
// Only bother if there are any groups
if (nGroupNames > 0) {
leftIndent = leftIndent - 5;
=====================================================================
Found a 21 line (102 tokens) duplication in the following files:
Starting at line 183 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/community/CommunityDNDTree.java
Starting at line 131 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/ui/experiment/ExperimentTree.java
}
private int testFlavors(DataFlavor[] possibleFlavors, CSMARTDataFlavor testFlavor) {
for (int i = 0; i < possibleFlavors.length; i++) {
DataFlavor flavor = possibleFlavors[i];
if (flavor instanceof CSMARTDataFlavor) {
CSMARTDataFlavor cflavor = (CSMARTDataFlavor) flavor;
if (cflavor.equals(testFlavor)) {
if (getClass().getName()
.equals(cflavor.getSourceClassName())) {
return DnDConstants.ACTION_MOVE;
} else {
return DnDConstants.ACTION_COPY;
}
}
}
}
return DnDConstants.ACTION_NONE;
}
public int isDroppable(DataFlavor[] possibleFlavors,
=====================================================================
Found a 18 line (102 tokens) duplication in the following files:
Starting at line 291 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/recipe/ComplexRecipeBase.java
Starting at line 77 of /usr/local/dashboard/working/csmart/src/org/cougaar/tools/csmart/society/db/SocietyDBComponent.java
public void initProperties() {
Map substitutions = new HashMap();
if (assemblyId != null) {
substitutions.put(":assemblyMatch", DBUtils.getListMatch(assemblyId));
substitutions.put(":insertion_point", Agent.INSERTION_POINT);
// FIXME:
// It would be really nice to be able to handle Binders and other non-Agent
// top-level things
try {
Connection conn = DBUtils.getConnection();
try {
Statement stmt = conn.createStatement();
String query = DBUtils.getQuery(QUERY_AGENT_NAMES, substitutions);
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String agentName = DBUtils.getNonNullString(rs, 1, query);