===================================================================== Found a 539 line (2769 tokens) duplication in the following files: Starting at line 88 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/generic/NewUniversalExpanderPlugin.java Starting at line 88 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/generic/UniversalExpanderPlugin.java public void load() { super.load(); //get a domain service domainService = (DomainService) getServiceBroker().getService( this, DomainService.class, new ServiceRevokedListener() { public void serviceRevoked(ServiceRevokedEvent re) { if (DomainService.class.equals(re.getService())) { domainService = null; } } }); // parse the parameters Collection params = getParameters(); Iterator param_iter = params.iterator(); while (param_iter.hasNext()) { String aParam = (String) param_iter.next(); if (aParam.startsWith("flat=")) { // this assumes no spaces ... flat=true or flat=false if (aParam.endsWith("false")) { flat = false; } else if (aParam.endsWith("true")){ flat = true; } else { throw new IllegalArgumentException("\n UNIVERSALEXPANDERPLUGIN received an " + "illegal plugin argument to flat='value'. " + "The value should either be 'true' or 'false'."); } } else { // assume its a verb expansionVerbs.add(aParam); } } //System.err.println("\n UniversalExpanderPlugin Flat flag is: "+flat); } public void unload() { super.unload(); if (domainService != null) { getServiceBroker().releaseService(this, DomainService.class, domainService); } } public void setupSubscriptions() { //System.out.println("In UniversalExpanderPlugin.setupSubscriptions"); interestingTasks = (IncrementalSubscription) getBlackboardService().subscribe( VerbTasksPredicate(expansionVerbs)); myExpansions = (IncrementalSubscription) getBlackboardService().subscribe( VerbExpansionsPredicate(expansionVerbs)); theFactory = ((PlanningFactory)domainService.getFactory("planning")); } public void execute() { //System.out.println("In UniversalExpanderPlugin.execute"); if (flat) { for(Enumeration e = interestingTasks.getAddedList();e.hasMoreElements();) { Task task = (Task)e.nextElement(); Collection subtasks = findSubTasks(task); NewWorkflow wf = theFactory.newWorkflow(); wf.setParentTask(task); Iterator stiter = subtasks.iterator(); while (stiter.hasNext()) { NewTask subtask = (NewTask) stiter.next(); subtask.setWorkflow(wf); wf.addTask(subtask); getBlackboardService().publishAdd(subtask); } // create the Expansion ... Expansion newexpansion = theFactory.createExpansion( theFactory.getRealityPlan(), task, wf, null); getBlackboardService().publishAdd(newexpansion); } //end of for } else { Enumeration tree_enum = interestingTasks.getAddedList(); while(tree_enum.hasMoreElements()) { Task t = (Task)tree_enum.nextElement(); treeExpand(t); } } for(Enumeration exp = myExpansions.getChangedList();exp.hasMoreElements();) { Expansion myexp = (Expansion)exp.nextElement(); if (PluginHelper.updatePlanElement(myexp)) { getBlackboardService().publishChange(myexp); } } } //end of execute /** Gather expansion/subtask information from our database to use * in creating our subtasks and workflow. * @param task The parent task to expand * @return Collection of subtasks **/ private Collection findSubTasks(Task task) { Collection subtasks = new ArrayList(); try { // Load the driver String rawdb = Parameters.replaceParameters("${generic.database.expander.database}"); int colonIndex1 = rawdb.indexOf(':'); int colonIndex2 = rawdb.indexOf(':', colonIndex1+1); String dbType = rawdb.substring(colonIndex1+1, colonIndex2); //WAN added String driverName = Parameters.findParameter("driver."+dbType); Class.forName(driverName); Connection conn = null; ResultSet rset = null; try { // Connect to the database // You must put a database name after the @ sign in the connection URL. // You can use either the fully specified SQL*net syntax or a short cut // syntax as ::. The example uses the short cut syntax. // get the db info out of the cougaarrc file String dbinfo = Parameters.replaceParameters(rawdb); String rawuser = "${generic.database.expander.user}"; String dbuser = Parameters.replaceParameters(rawuser); String rawpasswd = "${generic.database.expander.password}"; String dbpasswd = Parameters.replaceParameters(rawpasswd); String exptable = "${generic.database.expander.expansion_table}"; String dbexptable = Parameters.replaceParameters(exptable); conn = DriverManager.getConnection (dbinfo, dbuser, dbpasswd ); String parentverb = task.getVerb().toString(); // Create a Statement Statement stmt = conn.createStatement (); //define a base query that we can use StringBuffer basequery = new StringBuffer( "select IS_LEAF_TASK, TIME_OFFSET, SUBTASK_NAME, DURATION, " + "PREPOSITION, PHRASE, DO_CLASS, DO_TYPE_ID, " + "DO_NOMENCLATURE, QUANTITY, SHIPMENTS from "+dbexptable); StringBuffer firstlevelquery = new StringBuffer(basequery + " where ROOT_TASK_NAME = '" + parentverb + "'"); //System.out.println("\n About to execute query: "+ firstlevelquery); rset = stmt.executeQuery(firstlevelquery.toString()); //check to make sure we get something back from the query - resultset //api show's no easy way to check this - statement api says resultset will //never be null. boolean gotresult = false; while (rset.next ()) { gotresult = true; //check to see if we have a leaf task or not and if this is //not a flat expansion only do the initial expansion if ((rset.getInt(1) == 1) || (!flat)) { //System.out.println("\n Got a result set for immediate Leafs!"); ArrayList subtasksToAdd = parseRow(task, rset, rset.getInt(2)); Iterator substoadd_iter = subtasksToAdd.iterator(); while(substoadd_iter.hasNext()) { Task aNewSubTask = (Task) substoadd_iter.next(); subtasks.add(aNewSubTask); } } else { //System.out.println("\n Got a result set for NON immediate leafs!"); ArrayList outstanding = new ArrayList(); ArrayList newoutstanding = new ArrayList(); NonLeaf newNonLeaf = new NonLeaf(rset.getInt(2), rset.getString(3)); Statement stmt2 = conn.createStatement(); outstanding.add(newNonLeaf); while (! outstanding.isEmpty()) { Iterator out_iter = outstanding.iterator(); while (out_iter.hasNext()) { boolean foundsub = false; NonLeaf check = (NonLeaf) out_iter.next(); //create another statement for more queries so we don't //loose the result set from the first query and statement. StringBuffer anotherquery = new StringBuffer(basequery + " where ROOT_TASK_NAME = '" + check.getSubTaskName() + "'"); ResultSet rset2 = stmt2.executeQuery(anotherquery.toString()); while (rset2.next()) { foundsub = true; if (rset2.getInt(1) == 1) { //process this row if it is a leaf //get the parent offset to add to each one. int newoffset = check.getOffset() + rset2.getInt(2); ArrayList moreToAdd = parseRow(task, rset2, newoffset); Iterator more_iter = moreToAdd.iterator(); while (more_iter.hasNext()) { Task anotherTask = (Task) more_iter.next(); subtasks.add(anotherTask); } } else { //if we did not get a leaf again - set up for another //round of queries - but don't forget to accumulate the offsets int anotheroffset = check.getOffset() + rset.getInt(2); NonLeaf anotherNonLeaf = new NonLeaf(anotheroffset, rset2.getString(3)); newoutstanding.add(anotherNonLeaf); } } //close the while for rset2 if (! foundsub) { System.err.println("\n UNIVERSALEXPANDERPLUGIN COULD NOT FIND A SUBTASK"+ " FOR "+check.getSubTaskName()+" IN DB TABLE "+ dbexptable+". PLEASE CHECK THE DB TABLE!!!"); Thread.dumpStack(); } } //close while outstanding has next //clear out outstanding list and and any new outstanding //entries to it to query again. outstanding.clear(); if (! newoutstanding.isEmpty()) { outstanding.addAll(newoutstanding); newoutstanding.clear(); } } //close outstanding is empty //close the second+ round of queries stmt2.close(); } // close of else } // close of rset.next if ((! gotresult) && (flat)) { //this is only an error for a flat expansion as the tree expansion //is not keeping track of is_leaf_task System.err.println("\n UNIVERSALEXPANDERPLUGIN GOT NO RESULTS FOR THE QUERY: "+ firstlevelquery +". THIS MEANS THE "+parentverb+ " TASK CAN NOT BE EXPANDED. PLEASE CEHCK THE DB TABLE."); Thread.dumpStack(); } // close the first round of queries stmt.close(); } catch (SQLException e) { System.err.println("UNIVERSAL EXPANDER PLUGIN Query failed: "+e); } finally { if (conn != null) conn.close(); } } catch (Exception e) { System.err.println("Caught exception while executing a query: "+e); e.printStackTrace(); } //System.out.println("\n UniversalExpanderPlugin About to return: " + subtasks.size() + "Subtasks for Workflow"); return subtasks; } // parse the row - but take the time offset value as an arg instead of // from the resultset in case it is an accumulated offset from many levels private ArrayList parseRow(Task parent, ResultSet rset, int timeoffset) throws SQLException { ArrayList results = new ArrayList(); boolean multipleshipments = false; try { String st_name = rset.getString(3); int duration = rset.getInt(4); NewTask newsubtask = createSubTask(parent, st_name, timeoffset, duration); String preposition = rset.getString(5); if (! rset.wasNull()) { Enumeration newphrases = createPrepositionalPhrase(newsubtask, preposition, rset.getString(6)); newsubtask.setPrepositionalPhrases(newphrases); } String do_class = rset.getString(7); if (! rset.wasNull()) { Asset directObject = createDirectObject(do_class, rset.getString(8), rset.getString(9)); newsubtask.setDirectObject(directObject); int qty = rset.getInt(10); // create quantity preference AspectValue qtyAV = AspectValue.newAspectValue(AspectType.QUANTITY, qty); ScoringFunction qtySF = ScoringFunction.createPreferredAtValue(qtyAV, 2); Preference qtyPref = theFactory.newPreference(AspectType.QUANTITY, qtySF); newsubtask.addPreference(qtyPref); int shipments = rset.getInt(11); if ((! rset.wasNull()) && (shipments > 1)) { multipleshipments = true; ArrayList newsubtasks = createMultipleShipments(newsubtask, shipments, duration); return newsubtasks; } } results.add(newsubtask); } catch (SQLException se) { throw new SQLException("Exception in parserow..." + se); } return results; } /** Create a simple subtask out of the database * @param parent - parent task * @param st_name - new subtask's verb from db * @param offset new subtask's offset time from parent's start time * @param duration new subtask's duration * @return NewTask - The new subtask **/ private NewTask createSubTask(Task parent, String st_verb, int offset, int duration) { NewTask subtask = theFactory.newTask(); subtask.setParentTaskUID(parent.getUID()); subtask.setVerb(Verb.get(st_verb)); subtask.setPlan(parent.getPlan()); subtask.setContext(parent.getContext()); // pass along parent's prep phrases for now. A new one can be added also. subtask.setPrepositionalPhrases(parent.getPrepositionalPhrases()); //set up preferences - first find the start time of the parent task Date childST = null; Date childET = null; Enumeration parentprefs = parent.getPreferences(); while (parentprefs.hasMoreElements()) { Preference apref = (Preference)parentprefs.nextElement(); if (apref.getAspectType() == AspectType.START_TIME) { Date parentstarttime = new Date( (long)apref.getScoringFunction().getBest().getValue()); Calendar cal = Calendar.getInstance(); cal.setTime(parentstarttime); cal.add(Calendar.DATE, offset); childST = cal.getTime(); cal.add(Calendar.DATE, duration); childET = cal.getTime(); } break; } Vector prefs = new Vector(); //make a start and end as usual - note that for generic purposes //even if this is a supply task, it may end up with a start and end time //pref that are equal AspectValue startAV = AspectValue.newAspectValue(AspectType.START_TIME, childST.getTime()); ScoringFunction startSF = ScoringFunction.createPreferredAtValue(startAV, 2); Preference startPref = theFactory.newPreference(AspectType.START_TIME, startSF); prefs.addElement(startPref); AspectValue endAV = AspectValue.newAspectValue(AspectType.END_TIME, childET.getTime()); ScoringFunction endSF = ScoringFunction.createPreferredAtValue(endAV, 2); Preference endPref = theFactory.newPreference(AspectType.END_TIME, endSF); prefs.addElement(endPref); subtask.setPreferences(prefs.elements()); return subtask; } private Enumeration createPrepositionalPhrase(Task subtask, String preposition, String phrase) { // for now just make the phrase a string. NewPrepositionalPhrase newpp = theFactory.newPrepositionalPhrase(); newpp.setPreposition(preposition); newpp.setIndirectObject(phrase); Vector phrases = new Vector(); phrases.add(newpp); //keep the phrases from the parent task Enumeration oldpp = subtask.getPrepositionalPhrases(); while (oldpp.hasMoreElements()) { PrepositionalPhrase app = (PrepositionalPhrase) oldpp.nextElement(); phrases.add(app); } return phrases.elements(); } private Asset createDirectObject(String assetclass, String typeid, String nomenclature) { Asset theAsset = null; // try { // theAsset = // (Asset)theFactory.createPrototype(Class.forName(assetclass), typeid, nomenclature); theAsset = (Asset)theFactory.createPrototype(assetclass, typeid, nomenclature); // } catch (ClassNotFoundException cnfe) { // System.err.println("\n UniversalExpanderPlugin Caught exception while trying to create an asset: "+cnfe); // cnfe.printStackTrace(); // } //need this for supply tasks... NewSupplyClassPG pg = (NewSupplyClassPG)org.cougaar.glm.ldm.asset.PropertyGroupFactory.newSupplyClassPG(); pg.setSupplyClass(assetclass); pg.setSupplyType(assetclass); theAsset.setPropertyGroup(pg); return theAsset; } private ArrayList createMultipleShipments(Task subtask, int shipments, int duration) { //get some starting preference info int shipmentoffset = duration / shipments; Date startofshipments = null; double qtypershipment = 0; Enumeration taskprefs = subtask.getPreferences(); while (taskprefs.hasMoreElements()) { Preference asubtaskpref = (Preference) taskprefs.nextElement(); if (asubtaskpref.getAspectType() == AspectType.START_TIME) { startofshipments = new Date((long)asubtaskpref.getScoringFunction().getBest().getValue()); } else if (asubtaskpref.getAspectType() == AspectType.QUANTITY) { double totalqty = asubtaskpref.getScoringFunction().getBest().getValue(); qtypershipment = totalqty / shipments; } } Calendar shipmentcal = Calendar.getInstance(); // set initial time shipmentcal.setTime(startofshipments); //begin creating tasks ArrayList shipmenttasks = new ArrayList(); for (int i = 0; i < shipments; i++) { NewTask mstask = theFactory.newTask(); mstask.setParentTaskUID(subtask.getParentTaskUID()); mstask.setVerb(subtask.getVerb()); mstask.setDirectObject(subtask.getDirectObject()); mstask.setPrepositionalPhrases(subtask.getPrepositionalPhrases()); mstask.setPlan(subtask.getPlan()); mstask.setContext(subtask.getContext()); //make the preferences for the multiple shipments //note that multiple shipments are assumed to be Supply or similar //tasks for which start time is meaningless. End time should be used //to define when the customer expects the shipment to arrive Date shipmentET = null; //only add in the shipmentoffset if this is not the first shipment if (i != 0) { // for each shipment after the first keep adding the offset // for a cumulative offset affect. shipmentcal.add(Calendar.DATE, shipmentoffset); } shipmentET = shipmentcal.getTime(); Vector prefs = new Vector(); AspectValue shipmentAV = AspectValue.newAspectValue(AspectType.END_TIME, shipmentET.getTime()); ScoringFunction shipmentSF = ScoringFunction.createPreferredAtValue(shipmentAV, 2); Preference shipmentPref = theFactory.newPreference(AspectType.END_TIME, shipmentSF); prefs.addElement(shipmentPref); AspectValue qtyAV = AspectValue.newAspectValue(AspectType.QUANTITY, qtypershipment); ScoringFunction qtySF = ScoringFunction.createPreferredAtValue(qtyAV, 2); Preference qtyPref = theFactory.newPreference(AspectType.QUANTITY, qtySF); prefs.addElement(qtyPref); mstask.setPreferences(prefs.elements()); shipmenttasks.add(mstask); } return shipmenttasks; } //expand this as a multi-level expansion instead of a flat(single expansion) private void treeExpand(Task t) { // list to expand ArrayList toexpand = new ArrayList(); // add the top level parent toexpand.add(t); //temporary holding list to expand while we recurse ArrayList nexttoexpand = new ArrayList(); while (!toexpand.isEmpty()) { Iterator te_iter = toexpand.iterator(); while (te_iter.hasNext()) { Task aTask = (Task) te_iter.next(); //since the tree expand does not pay attention to is_leaf_task //check to see if this returns an empty collection meaning we are //at the end of the road Collection subs = findSubTasks(aTask); if (!subs.isEmpty()) { NewWorkflow wf = theFactory.newWorkflow(); wf.setParentTask(aTask); Iterator siter = subs.iterator(); while (siter.hasNext()) { NewTask subtask = (NewTask) siter.next(); subtask.setWorkflow(wf); wf.addTask(subtask); //keep this subtask to expand next nexttoexpand.add(subtask); getBlackboardService().publishAdd(subtask); } // create the Expansion ... Expansion newexpansion = theFactory.createExpansion( theFactory.getRealityPlan(), aTask, wf, null); getBlackboardService().publishAdd(newexpansion); } } //clear out toexpand since we've been through the list toexpand.clear(); if (!nexttoexpand.isEmpty()) { //move all of the next to expands into to expand toexpand.addAll(nexttoexpand); //reset next to expand nexttoexpand.clear(); } } } // // Predicates // protected static UnaryPredicate VerbTasksPredicate(final Collection verbs) { return new UnaryPredicate() { public boolean execute(Object o) { if (o instanceof Task) { Task task = (Task)o; String taskVerb = task.getVerb().toString(); Iterator verbs_iter = verbs.iterator(); while (verbs_iter.hasNext()) { String interestingVerb = (String)verbs_iter.next(); if (interestingVerb.equals(taskVerb)) { return true; } } } return false; } }; } protected static UnaryPredicate VerbExpansionsPredicate(final Collection verbs) { return new UnaryPredicate() { public boolean execute(Object o) { if (o instanceof Expansion) { Task task = ((Expansion)o).getTask(); String taskVerb = task.getVerb().toString(); Iterator verbs_iter = verbs.iterator(); while (verbs_iter.hasNext()) { String interestingVerb = (String)verbs_iter.next(); if (interestingVerb.equals(taskVerb)) { return true; } } } return false; } }; } // //inner classes // // inner class to hold some outstanding non leaf row info public class NonLeaf { private int theOffset; private String theSubTaskName; public NonLeaf(int offset, String subtask) { this.theOffset = offset; this.theSubTaskName = subtask; } public int getOffset() { return theOffset; } public String getSubTaskName() { return theSubTaskName; } } } ===================================================================== Found a 256 line (1573 tokens) duplication in the following files: Starting at line 566 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgRTDataPlugin.java Starting at line 726 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgTPRTDataPlugin.java } private Object parseExpr(String type, String arg) { int i; if ((i = type.indexOf("<")) >= 0) { int j = type.lastIndexOf(">"); String ctype = type.substring(0,i); String etype = type.substring(i+1, j); 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(parseExpr(etype,(String) it.next())); } return c; } else if ((i = type.indexOf("/")) >= 0) { String m = type.substring(0,i); String mt = type.substring(i+1); double qty = Double.valueOf(arg).doubleValue(); return createMeasureObject(m, qty, mt); } else { Class cl = findClass(type); try { if (cl.isInterface()) { // interface means try the COF return parseWithCOF(cl, arg); } else { Class ac = getArgClass(cl); Object[] args = {arg}; Constructor cons = Reflect.getConstructor(ac,stringArgSpec); if (cons != null) { // found a constructor - use it return cons.newInstance(args); } else { Method fm = Reflect.getMethod(ac, "create", stringArgSpec); if (fm == null) { String n = ac.getName(); // remove the package prefix n = n.substring(n.lastIndexOf('.')+1); fm = Reflect.getMethod(ac, "create"+n, stringArgSpec); if (fm == null) fm = Reflect.getMethod(ac, "get"+n, stringArgSpec); } if (fm == null) { throw new RuntimeException("Couldn't figure out how to construct "+type); } return fm.invoke(null,args); } } } catch (Exception e) { System.err.println("OrgRTDataPlugin: Exception constructing "+type+" from \""+arg+"\":"); e.printStackTrace(); throw new RuntimeException("Construction problem "+e); } } } private static Class[] stringArgSpec = {String.class}; private static Class[][] argClasses = {{Integer.TYPE, Integer.class}, {Double.TYPE, Double.class}, {Boolean.TYPE, Boolean.class}, {Float.TYPE, Float.class}, {Long.TYPE, Long.class}, {Short.TYPE, Short.class}, {Byte.TYPE, Byte.class}, {Character.TYPE, Character.class}}; private static Class getArgClass(Class c) { if (! c.isPrimitive()) return c; for (int i = 0; i < argClasses.length; i++) { if (c == argClasses[i][0]) return argClasses[i][1]; } throw new IllegalArgumentException("Class "+c+" is an unknown primitive."); } private String getType(String type) { int i; if ((i = type.indexOf("<")) > -1) { // deal with collections int j = type.lastIndexOf(">"); return getType(type.substring(0,i)); // deal with measures } else if ((i= type.indexOf("/")) > -1) { return getType(type.substring(0,i)); } else { return type; } } protected Object parseWithCOF(Class cl, String val) { String name = cl.getName(); int dot = name.lastIndexOf('.'); if (dot != -1) name = name.substring(dot+1); try { // lookup method on ldmf Object o = callFactoryMethod(name); Vector svs = org.cougaar.util.StringUtility.parseCSV(val); // svs should be a set of strings like "slot=value" or "slot=type value" for (Enumeration sp = svs.elements(); sp.hasMoreElements();) { String ss = (String) sp.nextElement(); int eq = ss.indexOf('='); String slotname = ss.substring(0, eq); String vspec = ss.substring(eq+1); int spi = vspec.indexOf(' '); Object v; if (spi == -1) { v = vspec; } else { String st = vspec.substring(0, spi); String sv = vspec.substring(spi+1); v = parseExpr(st, sv); } callSetMethod(o, slotname, v); } return o; } catch (Exception e) { e.printStackTrace(); return null; } } private Object callFactoryMethod(String ifcname) { // look up a zero-arg factory method in the ldmf String newname = "new"+ifcname; // try the COUGAAR factory try { Class ldmfc = aldmf.getClass(); Method fm = ldmfc.getMethod(newname,nullClassList); return fm.invoke(aldmf, nullArgList); } catch (Exception e) { e.printStackTrace(); } // try the main factory try { Class ldmfc = getFactory().getClass(); Method fm = ldmfc.getMethod(newname,nullClassList); return fm.invoke(getFactory(), nullArgList); } catch (Exception e) { } throw new RuntimeException ("Couldn't find a factory method for "+ifcname); } private static final Class nullClassList[] = {}; private static final Object nullArgList[] = {}; private void callSetMethod(Object o, String slotname, Object value) { Class oc = o.getClass(); String setname = "set"+slotname; Class vc = value.getClass(); try { Method ms[] = Reflect.getMethods(oc); for (int i = 0; i{;[]..[]}* * ...optional minus, verb, and zero or more date ranges. The * start or end of a date range may be omitted signifying min or * max respectively. The initial minus signifies that the default * is to fail the allocations. The date ranges specify exceptions * to the default. So, for example: * Supply;9/7/2005..10/3/2005 * would fail in the time period from September 7, 2005 to October * 3, 2005. **/ private void parseParams() { StringBuffer assetName = new StringBuffer(); assetName.append("UniversalSink"); for (Enumeration e = getParameters().elements();e.hasMoreElements();) { String param = (String) e.nextElement(); Filter filter = new Filter(); ScheduleElement el; Schedule schedule = new ScheduleImpl(); boolean defaultIsFailure = param.startsWith("-"); if (defaultIsFailure) param = param.substring(1); StringTokenizer tokens = new StringTokenizer(param, ";"); String verbPattern = tokens.nextToken(); int slashPos = verbPattern.indexOf('/'); if (slashPos >= 0) { filter.verb = Verb.get(verbPattern.substring(0, slashPos)); filter.regex = Pattern.compile(verbPattern.substring(slashPos + 1)); } else { filter.verb = Verb.get(verbPattern); filter.regex = null; } while (tokens.hasMoreTokens()) { String token = tokens.nextToken(); String sub; int dotdot = token.indexOf(".."); long from = TimeSpan.MIN_VALUE; long to = TimeSpan.MAX_VALUE; if (dotdot < 0) { from = Date.parse(token); } else { sub = token.substring(0, dotdot); if (sub.length() > 0) { from = Date.parse(sub); } sub = token.substring(dotdot + 2); if (sub.length() > 0) { to = Date.parse(sub); } } el = new ScheduleElementImpl(from, to); schedule.add(el); } if (defaultIsFailure) { /* We built a schedule of exceptions to failure (a success schedule). It must be converted to a failure schedule. */ long startTime = TimeSpan.MIN_VALUE; filter.schedule = new ScheduleImpl(); for (ListIterator i = schedule.listIterator(); i.hasNext(); ) { ScheduleElement el2 = (ScheduleElement) i.next(); el = new ScheduleElementImpl(startTime, el2.getStartTime()); filter.schedule.add(el); startTime = el2.getEndTime(); } el = new ScheduleElementImpl(startTime, TimeSpan.MAX_VALUE); filter.schedule.add(el); } else { /* We build a schedule of exceptions to success (a failure schedule) and that is exactly what we need */ filter.schedule = schedule; } verbMap.put(filter.verb, filter); ===================================================================== Found a 79 line (362 tokens) duplication in the following files: Starting at line 57 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ContainPGImpl.java Starting at line 70 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/DeckPGImpl.java } private Distance theMaximumLength; public Distance getMaximumLength(){ return theMaximumLength; } public void setMaximumLength(Distance maximum_length) { theMaximumLength=maximum_length; } private Distance theMaximumWidth; public Distance getMaximumWidth(){ return theMaximumWidth; } public void setMaximumWidth(Distance maximum_width) { theMaximumWidth=maximum_width; } private Distance theMaximumHeight; public Distance getMaximumHeight(){ return theMaximumHeight; } public void setMaximumHeight(Distance maximum_height) { theMaximumHeight=maximum_height; } private Volume theMaximumVolume; public Volume getMaximumVolume(){ return theMaximumVolume; } public void setMaximumVolume(Volume maximum_volume) { theMaximumVolume=maximum_volume; } private Area theMaximumFootprintArea; public Area getMaximumFootprintArea(){ return theMaximumFootprintArea; } public void setMaximumFootprintArea(Area maximum_footprint_area) { theMaximumFootprintArea=maximum_footprint_area; } private Mass theMaximumWeight; public Mass getMaximumWeight(){ return theMaximumWeight; } public void setMaximumWeight(Mass maximum_weight) { theMaximumWeight=maximum_weight; } private long theMaximumPassengers; public long getMaximumPassengers(){ return theMaximumPassengers; } public void setMaximumPassengers(long maximum_passengers) { theMaximumPassengers=maximum_passengers; } private boolean theRefrigeration; public boolean getRefrigeration(){ return theRefrigeration; } public void setRefrigeration(boolean refrigeration) { theRefrigeration=refrigeration; } private Duration theTimeToLoad; public Duration getTimeToLoad(){ return theTimeToLoad; } public void setTimeToLoad(Duration time_to_load) { theTimeToLoad=time_to_load; } private Duration theTimeToUnload; public Duration getTimeToUnload(){ return theTimeToUnload; } public void setTimeToUnload(Duration time_to_unload) { theTimeToUnload=time_to_unload; } private Duration theTimeToRefuel; public Duration getTimeToRefuel(){ return theTimeToRefuel; } public void setTimeToRefuel(Duration time_to_refuel) { theTimeToRefuel=time_to_refuel; } private long theMaximumContainers; public long getMaximumContainers(){ return theMaximumContainers; } public void setMaximumContainers(long maximum_containers) { theMaximumContainers=maximum_containers; } private boolean theIsPrepositioned; public boolean getIsPrepositioned(){ return theIsPrepositioned; } public void setIsPrepositioned(boolean is_prepositioned) { theIsPrepositioned=is_prepositioned; } private String theCargoRestrictions; public String getCargoRestrictions(){ return theCargoRestrictions; } public void setCargoRestrictions(String cargo_restrictions) { theCargoRestrictions=cargo_restrictions; } private String thePermittedCargoCategoryCodes; public String getPermittedCargoCategoryCodes(){ return thePermittedCargoCategoryCodes; } public void setPermittedCargoCategoryCodes(String permitted_cargo_category_codes) { thePermittedCargoCategoryCodes=permitted_cargo_category_codes; } public DeckPGImpl(DeckPG original) { ===================================================================== Found a 76 line (347 tokens) duplication in the following files: Starting at line 121 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ContainPG.java Starting at line 132 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/DeckPG.java public Distance getMaximumLength() { waitForFinalize(); return _real.getMaximumLength(); } public Distance getMaximumWidth() { waitForFinalize(); return _real.getMaximumWidth(); } public Distance getMaximumHeight() { waitForFinalize(); return _real.getMaximumHeight(); } public Volume getMaximumVolume() { waitForFinalize(); return _real.getMaximumVolume(); } public Area getMaximumFootprintArea() { waitForFinalize(); return _real.getMaximumFootprintArea(); } public Mass getMaximumWeight() { waitForFinalize(); return _real.getMaximumWeight(); } public long getMaximumPassengers() { waitForFinalize(); return _real.getMaximumPassengers(); } public boolean getRefrigeration() { waitForFinalize(); return _real.getRefrigeration(); } public Duration getTimeToLoad() { waitForFinalize(); return _real.getTimeToLoad(); } public Duration getTimeToUnload() { waitForFinalize(); return _real.getTimeToUnload(); } public Duration getTimeToRefuel() { waitForFinalize(); return _real.getTimeToRefuel(); } public long getMaximumContainers() { waitForFinalize(); return _real.getMaximumContainers(); } public boolean getIsPrepositioned() { waitForFinalize(); return _real.getIsPrepositioned(); } public String getCargoRestrictions() { waitForFinalize(); return _real.getCargoRestrictions(); } public String getPermittedCargoCategoryCodes() { waitForFinalize(); return _real.getPermittedCargoCategoryCodes(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return DeckPGImpl.class; ===================================================================== Found a 56 line (303 tokens) duplication in the following files: Starting at line 182 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/MultipleOutStandingPlugin.java Starting at line 182 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/OneTaskAddAndRescindPlugin.java } } breakFromLoop(count, MAXCOUNT); } //lastReceived = received; } protected void setPreference ( Task t, int aspectType, int sequenceOfTask){ startTime = new Date(); // Add a start_time and end_time strict preference aspectVal = AspectValue.newAspectValue(aspectType, sequenceOfTask); ScoringFunction scorefcn = ScoringFunction.createStrictlyAtValue(aspectVal); Preference pref = theLDMF.newPreference(aspectType, scorefcn); ((NewTask) t).setPreference(pref); } /** * Create a CODE task. * @param what the direct object of the task */ protected Task makeTask(Asset what, String verb) { NewTask new_task = theLDMF.newTask(); new_task.setVerb(Verb.get(verb));// Set the verb as given new_task.setPlan(theLDMF.getRealityPlan());// Set the reality plan for the task new_task.setDirectObject(what); NewPrepositionalPhrase npp = theLDMF.newPrepositionalPhrase(); npp.setPreposition("USING_LANGUAGE"); if (MESSAGESIZE == -1) npp.setIndirectObject(alterMessageSize(0)); else npp.setIndirectObject(alterMessageSize(MESSAGESIZE)); new_task.setPrepositionalPhrases(npp); return new_task; } protected void changeTasks(Task t){ if(CPUCONSUME != -1) //i.e. cpuconsume passed to plugin as a arg consumeCPU(CPUCONSUME); startTime = new Date(); if (t.getVerb().equals(VERB)) sequenceNum++; setPreference(t, AspectType._ASPECT_COUNT, sequenceNum); //debug(DEBUG, FILENAME, fw,"\nManagerPlugin::Changing task " + t.getVerb() + " with num " // +t.getPreferredValue(AspectType._ASPECT_COUNT )); publishChange(t); } protected void printTheChange(){ Date endTime = new Date(); long delta = endTime.getTime() - startTime.getTime(); if (count == 1) minDelta = delta; else minDelta = Math.min(minDelta, delta); int taskCount = (int)t.getPreferredValue(AspectType._ASPECT_COUNT); String msg=t.getVerb() +"=>"+taskCount+","+delta+","+ minDelta; ===================================================================== Found a 34 line (300 tokens) duplication in the following files: Starting at line 175 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirConditionPGImpl.java Starting at line 249 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirLiftPGImpl.java Starting at line 141 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirLinkPGImpl.java Starting at line 211 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirSelfPropulsionPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirTransportationPGImpl.java Starting at line 185 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirVehiclePGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirportPGImpl.java Starting at line 147 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AmmunitionPGImpl.java Starting at line 110 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AssetConsumptionRatePGImpl.java Starting at line 131 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AssignedPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AssignmentPGImpl.java Starting at line 95 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/BulkSolidPGImpl.java Starting at line 131 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/CSSCapabilityPGImpl.java Starting at line 133 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/CargoFacilityPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ConditionPGImpl.java Starting at line 137 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ConsumablePGImpl.java Starting at line 279 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ContainPGImpl.java Starting at line 269 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ContentsPGImpl.java Starting at line 109 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/CostPGImpl.java Starting at line 303 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/DeckPGImpl.java Starting at line 113 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/DetailKeyPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/DetailedScheduledContentPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/EquipmentOHReadinessPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/EquipmentStatusReadinessPGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ExplosivePGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/FacilityPGImpl.java Starting at line 133 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/FoodPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ForUnitPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/FromBasePGImpl.java Starting at line 109 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/FuelPGImpl.java Starting at line 155 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/FuelSupplyPGImpl.java Starting at line 197 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/GroundSelfPropulsionPGImpl.java Starting at line 137 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/GroundVehiclePGImpl.java Starting at line 127 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/InventoryLevelsPGImpl.java Starting at line 252 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/InventoryPGImpl.java Starting at line 185 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/LandConditionPGImpl.java Starting at line 127 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/LiftPGImpl.java Starting at line 125 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/LiquidPGImpl.java Starting at line 141 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/LiquidSupplyPGImpl.java Starting at line 109 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MEIPGImpl.java Starting at line 119 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MaintenancePGImpl.java Starting at line 95 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ManagedAssetPGImpl.java Starting at line 113 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MidAirRefuelPGImpl.java Starting at line 207 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MilitaryOrgPGImpl.java Starting at line 127 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MilitaryPersonPGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MissileLauncherPGImpl.java Starting at line 109 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/MovabilityPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OffRoadTransportationPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OnRoadTransportationPGImpl.java Starting at line 159 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OrganizationPGImpl.java Starting at line 193 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/PackagePGImpl.java Starting at line 159 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/PersonPGImpl.java Starting at line 95 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/PersonSustainmentPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/PersonnelReadinessPGImpl.java Starting at line 169 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/PhysicalPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/PositionPGImpl.java Starting at line 241 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailLinkPGImpl.java Starting at line 183 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailSelfPropulsionPGImpl.java Starting at line 105 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailTerminalPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailTransportationPGImpl.java Starting at line 137 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailVehiclePGImpl.java Starting at line 95 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RepairDepotPGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RepairabilityPGImpl.java Starting at line 137 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RepairablePGImpl.java Starting at line 119 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ReportSchedulePGImpl.java Starting at line 331 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RoadLinkPGImpl.java Starting at line 113 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ScheduledContentPGImpl.java Starting at line 185 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SeaConditionPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SeaLinkPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SeaTransportationPGImpl.java Starting at line 199 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SeaportPGImpl.java Starting at line 95 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ShipConfigurationPGImpl.java Starting at line 113 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SupplyClassPGImpl.java Starting at line 123 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SupplyDepotPGImpl.java Starting at line 197 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SupplyPGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SupportPGImpl.java Starting at line 127 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/TowPGImpl.java Starting at line 99 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/TrainingReadinessPGImpl.java Starting at line 161 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/TransportationPGImpl.java Starting at line 105 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/TruckTerminalPGImpl.java Starting at line 109 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/VehiclePropertyGroupsImpl.java Starting at line 127 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/VolumetricStockagePGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WarheadPGImpl.java Starting at line 95 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterPGImpl.java Starting at line 183 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterSelfPropulsionPGImpl.java Starting at line 141 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterSupplyPGImpl.java Starting at line 193 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterVehiclePGImpl.java Starting at line 85 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WeaponPGImpl.java Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/assets/LanguagePGImpl.java Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/assets/SkillsPGImpl.java public DQ(SkillsPG original) { super(original); } public Object clone() { return new DQ(this); } private transient org.cougaar.planning.ldm.dq.DataQuality _dq = null; public boolean hasDataQuality() { return (_dq!=null); } public org.cougaar.planning.ldm.dq.DataQuality getDataQuality() { return _dq; } public void setDataQuality(org.cougaar.planning.ldm.dq.DataQuality dq) { _dq=dq; } private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); if (out instanceof org.cougaar.core.persist.PersistenceOutputStream) out.writeObject(_dq); } private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { in.defaultReadObject(); if (in instanceof org.cougaar.core.persist.PersistenceInputStream) _dq=(org.cougaar.planning.ldm.dq.DataQuality)in.readObject(); } private final static PropertyDescriptor properties[]=new PropertyDescriptor[1]; static { try { properties[0]= new PropertyDescriptor("dataQuality", DQ.class, "getDataQuality", null); } catch (Exception e) { e.printStackTrace(); } } public PropertyDescriptor[] getPropertyDescriptors() { PropertyDescriptor[] pds = super.properties; PropertyDescriptor[] ps = new PropertyDescriptor[pds.length+properties.length]; System.arraycopy(pds, 0, ps, 0, pds.length); System.arraycopy(properties, 0, ps, pds.length, properties.length); return ps; } } private transient SkillsPG _locked = null; ===================================================================== Found a 28 line (282 tokens) duplication in the following files: Starting at line 83 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ContainPG.java Starting at line 86 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/DeckPG.java public Distance getMaximumLength() { throw new UndefinedValueException(); } public Distance getMaximumWidth() { throw new UndefinedValueException(); } public Distance getMaximumHeight() { throw new UndefinedValueException(); } public Volume getMaximumVolume() { throw new UndefinedValueException(); } public Area getMaximumFootprintArea() { throw new UndefinedValueException(); } public Mass getMaximumWeight() { throw new UndefinedValueException(); } public long getMaximumPassengers() { throw new UndefinedValueException(); } public boolean getRefrigeration() { throw new UndefinedValueException(); } public Duration getTimeToLoad() { throw new UndefinedValueException(); } public Duration getTimeToUnload() { throw new UndefinedValueException(); } public Duration getTimeToRefuel() { throw new UndefinedValueException(); } public long getMaximumContainers() { throw new UndefinedValueException(); } public boolean getIsPrepositioned() { throw new UndefinedValueException(); } public String getCargoRestrictions() { throw new UndefinedValueException(); } public String getPermittedCargoCategoryCodes() { throw new UndefinedValueException(); } public boolean equals(Object object) { throw new UndefinedValueException(); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return DeckPGImpl.class; ===================================================================== Found a 61 line (263 tokens) duplication in the following files: Starting at line 349 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgRTDataPlugin.java Starting at line 413 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgTPRTDataPlugin.java } //create the RFS task to be sent to myself which will result in an asset transfer // of the copyofmyself being sent to the agent I am supporting. protected NewTask createReportTask(Organization reportingOrg, OrganizationAdapter sendto, Collection roles, long startTime, long endTime) { NewTask reportTask = getFactory().newTask(); reportTask.setDirectObject(reportingOrg); Vector prepPhrases = new Vector(2); NewPrepositionalPhrase newpp = getFactory().newPrepositionalPhrase(); newpp.setPreposition(Constants.Preposition.FOR); newpp.setIndirectObject(sendto); prepPhrases.add(newpp); newpp = getFactory().newPrepositionalPhrase(); newpp.setPreposition(Constants.Preposition.AS); newpp.setIndirectObject(roles); prepPhrases.add(newpp); reportTask.setPrepositionalPhrases(prepPhrases.elements()); reportTask.setPlan(getFactory().getRealityPlan()); reportTask.setSource(getMessageAddress()); AspectValue startTAV = TimeAspectValue.create(AspectType.START_TIME, startTime); ScoringFunction startScoreFunc = ScoringFunction.createStrictlyAtValue(startTAV); Preference startPreference = getFactory().newPreference(AspectType.START_TIME, startScoreFunc); AspectValue endTAV = TimeAspectValue.create(AspectType.END_TIME, endTime); ScoringFunction endScoreFunc = ScoringFunction.createStrictlyAtValue(endTAV); Preference endPreference = getFactory().newPreference(AspectType.END_TIME, endScoreFunc ); Vector preferenceVector = new Vector(2); preferenceVector.addElement(startPreference); preferenceVector.addElement(endPreference); reportTask.setPreferences(preferenceVector.elements()); return reportTask; } private void publish(Object o) { publishAdd(o); } /** * */ protected void ParsePrototypeFile(String agentId, String relationship) { ===================================================================== Found a 67 line (258 tokens) duplication in the following files: Starting at line 55 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/MultipleOutStandingPlugin.java Starting at line 53 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/OneTaskAddAndRescindPlugin.java public class OneTaskAddAndRescindPlugin extends CommonUtilPlugin { // Two assets to use as direct objects for the CODE tasks protected Asset what_to_code; protected IncrementalSubscription allocations; // My allocations protected IncrementalSubscription forceExecute; // My allocations protected int CPUCONSUME; protected int MESSAGESIZE; protected String FILENAME; protected int MAXCOUNT; protected int MYCOUNT=1; protected int OUTSTANDING_MESSAGES; protected boolean DEBUG = false; protected boolean LOG = false; protected int BURST_TIME=0; protected String VERB;//="CODE1"; private Date startTime; private Task t, changedMind; private int sequenceNum=1; private AspectValue aspectVal; private int count = 1; private long minDelta; private FileWriter fw; // private double lastReceived=0; private int wakeUpCount, taskAllocationCount; /** * parsing the plugIn arguments and setting the values for CPUCONSUME and MESSAGESIZE */ protected void parseParameter(){ Vector p = getParameters(); CPUCONSUME=getParameterIntValue(p, "CPUCONSUME"); MESSAGESIZE=getParameterIntValue(p, "MESSAGESIZE"); FILENAME=getParameterValue(p, "FILENAME"); MAXCOUNT=getParameterIntValue(p, "MAXCOUNT"); OUTSTANDING_MESSAGES =getParameterIntValue(p, "OUTSTANDING_MESSAGES"); DEBUG=getParameterBooleanValue(p, "DEBUG"); LOG=getParameterBooleanValue(p, "LOG"); BURST_TIME=getParameterIntValue(p, "BURST_TIME"); VERB=getParameterValue(p, "VERB"); } public UnaryPredicate myAllocationPredicate = new UnaryPredicate() { public boolean execute(Object o) { if (o instanceof Allocation) { Task t = ((Allocation)o).getTask(); return (t != null) && (t.getVerb().equals(Verb.get(VERB))); } return false; } }; /** * Using setupSubscriptions to create the initial CODE tasks */ protected void setupSubscriptions() { parseParameter(); //read the plugIn arguments for(int i = 0; i < OUTSTANDING_MESSAGES; i++) { //System.out.println("enetring loop"); addTask(); ===================================================================== Found a 28 line (234 tokens) duplication in the following files: Starting at line 115 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/util/AllocatorHelper.java Starting at line 187 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/strategictransport/StrategicTransportAllocatorPlugin.java private AllocationResult createEstimatedAllocationResult(Task t) { Enumeration preferences = t.getPreferences(); if ( preferences != null && preferences.hasMoreElements() ) { // do something really simple for now. Vector aspects = new Vector(); Vector results = new Vector(); while (preferences.hasMoreElements()) { Preference pref = (Preference) preferences.nextElement(); int at = pref.getAspectType(); aspects.addElement(new Integer(at)); ScoringFunction sf = pref.getScoringFunction(); // allocate as if you can do it at the "Best" point double myresult = ((AspectScorePoint)sf.getBest()).getValue(); results.addElement(new Double(myresult)); } int[] aspectarray = new int[aspects.size()]; double[] resultsarray = new double[results.size()]; for (int i = 0; i < aspectarray.length; i++) aspectarray[i] = (int) ((Integer)aspects.elementAt(i)).intValue(); for (int j = 0; j < resultsarray.length; j++ ) resultsarray[j] = (double) ((Double)results.elementAt(j)).doubleValue(); AllocationResult myestimate = ldmf.newAllocationResult(0.0, true, aspectarray, resultsarray); return myestimate; } // if there were no preferences...return a null estimate for the allocation result (for now) return null; } ===================================================================== Found a 53 line (233 tokens) duplication in the following files: Starting at line 513 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgRTDataPlugin.java Starting at line 566 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgTPRTDataPlugin.java System.out.println("OrgRTDataPlugin Incorrect token: " + dataItem); } } else { throw new RuntimeException("Format error in \""+filename+"\"."); } } // For each organization, the following code sets // CapableRoles and Relationship slots for the // AssignedPG property // It adds the property to the organization and // adds the organization to ccv2 collections NewAssignedPG assignedCap = (NewAssignedPG)getFactory().createPropertyGroup(AssignedPGImpl.class); Collection roles = org.getOrganizationPG().getRoles(); if (roles != null) { assignedCap.setRoles(new ArrayList(roles)); } org.setAssignedPG(assignedCap); // set up this asset's available schedule myCalendar.set(1990, 0, 1, 0, 0, 0); Date start = myCalendar.getTime(); // set the end date of the available schedule to 01/01/2010 myCalendar.set(2010, 0, 1, 0, 0, 0); Date end = myCalendar.getTime(); NewSchedule availsched = getFactory().newSimpleSchedule(start, end); // set the available schedule ((NewRoleSchedule)org.getRoleSchedule()).setAvailableSchedule(availsched); if (relationship.equals(GLMRelationship.SELF)) { Relationship selfRelationship = getFactory().newRelationship(Constants.Role.SELF, org, org, ETERNITY); org.getRelationshipSchedule().add(selfRelationship); org.setLocal(true); publish(org); selfOrg = org; } // Closing BufferedReader if (input != null) input.close(); //only generates a NoSuchMethodException for AssetSkeleton because of a coding error //if we are successul in creating it here it then the AssetSkeletomn will end up with two copies //the add/search criteria in AssetSkeleton is for a Vecotr and does not gurantee only one instance of //each class. Thus the Org allocator plugin fails to recognixe the correct set of cpabilities. } catch (Exception e) { e.printStackTrace(); } } ===================================================================== Found a 39 line (228 tokens) duplication in the following files: Starting at line 62 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AssignedPGImpl.java Starting at line 72 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OrganizationPGImpl.java public Collection getRoles(){ return theRoles; } public boolean inRoles(Role _element) { return (theRoles==null)?false:(theRoles.contains(_element)); } public Role[] getRolesAsArray() { if (theRoles == null) return new Role[0]; int l = theRoles.size(); Role[] v = new Role[l]; int i=0; for (Iterator n=theRoles.iterator(); n.hasNext(); ) { v[i]=(Role) n.next(); i++; } return v; } public Role getIndexedRoles(int _index) { if (theRoles == null) return null; for (Iterator _i = theRoles.iterator(); _i.hasNext();) { Role _e = (Role) _i.next(); if (_index == 0) return _e; _index--; } return null; } public void setRoles(Collection roles) { theRoles=roles; } public void clearRoles() { theRoles.clear(); } public boolean removeFromRoles(Role _element) { return theRoles.remove(_element); } public boolean addToRoles(Role _element) { return theRoles.add(_element); } public OrganizationPGImpl(OrganizationPG original) { ===================================================================== Found a 46 line (224 tokens) duplication in the following files: Starting at line 180 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/OneTaskAddAndRescindPlugin.java Starting at line 185 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/SimpleAddRescindPlugin.java publishRemove(t); } } breakFromLoop(count, MAXCOUNT); } //lastReceived = received; } protected void setPreference ( Task t, int aspectType, int sequenceOfTask){ startTime = new Date(); // Add a start_time and end_time strict preference aspectVal = AspectValue.newAspectValue(aspectType, sequenceOfTask); ScoringFunction scorefcn = ScoringFunction.createStrictlyAtValue(aspectVal); Preference pref = theLDMF.newPreference(aspectType, scorefcn); ((NewTask) t).setPreference(pref); } /** * Create a CODE task. * @param what the direct object of the task */ protected Task makeTask(Asset what, String verb) { NewTask new_task = theLDMF.newTask(); new_task.setVerb(Verb.get(verb));// Set the verb as given new_task.setPlan(theLDMF.getRealityPlan());// Set the reality plan for the task new_task.setDirectObject(what); NewPrepositionalPhrase npp = theLDMF.newPrepositionalPhrase(); npp.setPreposition("USING_LANGUAGE"); if (MESSAGESIZE == -1) npp.setIndirectObject(alterMessageSize(0)); else npp.setIndirectObject(alterMessageSize(MESSAGESIZE)); new_task.setPrepositionalPhrases(npp); return new_task; } protected void changeTasks(Task t){ if(CPUCONSUME != -1) //i.e. cpuconsume passed to plugin as a arg consumeCPU(CPUCONSUME); startTime = new Date(); if (t.getVerb().equals(VERB)) sequenceNum++; setPreference(t, AspectType._ASPECT_COUNT, sequenceNum); //debug(DEBUG, FILENAME, fw,"\nManagerPlugin::Changing task " + t.getVerb() + " with num " // +t.getPreferredValue(AspectType._ASPECT_COUNT )); publishChange(t); ===================================================================== Found a 25 line (223 tokens) duplication in the following files: Starting at line 185 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/strategictransport/StrategicTransportAllocatorPlugin.java Starting at line 210 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/strategictransport/TaskStrategicTransportAllocatorPlugin.java } private AllocationResult createEstimatedAllocationResult(Task t) { Enumeration preferences = t.getPreferences(); if ( preferences != null && preferences.hasMoreElements() ) { // do something really simple for now. Vector aspects = new Vector(); Vector results = new Vector(); while (preferences.hasMoreElements()) { Preference pref = (Preference) preferences.nextElement(); int at = pref.getAspectType(); aspects.addElement(new Integer(at)); ScoringFunction sf = pref.getScoringFunction(); // allocate as if you can do it at the "Best" point double myresult = ((AspectScorePoint)sf.getBest()).getValue(); results.addElement(new Double(myresult)); } int[] aspectarray = new int[aspects.size()]; double[] resultsarray = new double[results.size()]; for (int i = 0; i < aspectarray.length; i++) aspectarray[i] = (int) ((Integer)aspects.elementAt(i)).intValue(); for (int j = 0; j < resultsarray.length; j++ ) resultsarray[j] = (double) ((Double)results.elementAt(j)).doubleValue(); AllocationResult myestimate = theLDMF.newAllocationResult(0.0, true, aspectarray, resultsarray); ===================================================================== Found a 45 line (221 tokens) duplication in the following files: Starting at line 182 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/MultipleOutStandingPlugin.java Starting at line 186 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/SimpleAddRescindPlugin.java } } breakFromLoop(count, MAXCOUNT); } //lastReceived = received; } protected void setPreference ( Task t, int aspectType, int sequenceOfTask){ startTime = new Date(); // Add a start_time and end_time strict preference aspectVal = AspectValue.newAspectValue(aspectType, sequenceOfTask); ScoringFunction scorefcn = ScoringFunction.createStrictlyAtValue(aspectVal); Preference pref = theLDMF.newPreference(aspectType, scorefcn); ((NewTask) t).setPreference(pref); } /** * Create a CODE task. * @param what the direct object of the task */ protected Task makeTask(Asset what, String verb) { NewTask new_task = theLDMF.newTask(); new_task.setVerb(Verb.get(verb));// Set the verb as given new_task.setPlan(theLDMF.getRealityPlan());// Set the reality plan for the task new_task.setDirectObject(what); NewPrepositionalPhrase npp = theLDMF.newPrepositionalPhrase(); npp.setPreposition("USING_LANGUAGE"); if (MESSAGESIZE == -1) npp.setIndirectObject(alterMessageSize(0)); else npp.setIndirectObject(alterMessageSize(MESSAGESIZE)); new_task.setPrepositionalPhrases(npp); return new_task; } protected void changeTasks(Task t){ if(CPUCONSUME != -1) //i.e. cpuconsume passed to plugin as a arg consumeCPU(CPUCONSUME); startTime = new Date(); if (t.getVerb().equals(VERB)) sequenceNum++; setPreference(t, AspectType._ASPECT_COUNT, sequenceNum); //debug(DEBUG, FILENAME, fw,"\nManagerPlugin::Changing task " + t.getVerb() + " with num " // +t.getPreferredValue(AspectType._ASPECT_COUNT )); publishChange(t); ===================================================================== Found a 37 line (220 tokens) duplication in the following files: Starting at line 424 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgRTDataPlugin.java Starting at line 489 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgTPRTDataPlugin.java new InputStreamReader(ConfigFinder.getInstance().open(filename)); input = new BufferedReader(fileStream); StreamTokenizer tokens = new StreamTokenizer(input); tokens.commentChar('#'); tokens.wordChars('[', ']'); tokens.wordChars('_', '_'); tokens.wordChars('<', '>'); tokens.wordChars('/', '/'); tokens.ordinaryChars('0', '9'); tokens.wordChars('0', '9'); newVal = tokens.nextToken(); // Parse the prototype-ini file while (newVal != StreamTokenizer.TT_EOF) { if (tokens.ttype == StreamTokenizer.TT_WORD) { dataItem = tokens.sval; if (dataItem.equals("[Prototype]")) { tokens.nextToken(); className = tokens.sval; newVal = tokens.nextToken(); } else if (dataItem.equals("[UniqueId]")) { tokens.nextToken(); // Dont use unique-id as domain name anymore, just skip it //utc = tokens.sval; newVal = tokens.nextToken(); } else if (dataItem.equals("[UnitName]")) { // This field is optional tokens.nextToken(); unitName = tokens.sval; newVal = tokens.nextToken(); } else if (dataItem.equals("[UIC]")) { if (className != null) { tokens.nextToken(); uic = tokens.sval; // This is a silly fix to a dumb bug if (!uic.startsWith("UIC/")) { ===================================================================== Found a 44 line (219 tokens) duplication in the following files: Starting at line 112 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/GroundSelfPropulsionPG.java Starting at line 105 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailSelfPropulsionPG.java public Volume getFuelConsumptionPerMile() { waitForFinalize(); return _real.getFuelConsumptionPerMile(); } public String getEngineType() { waitForFinalize(); return _real.getEngineType(); } public String getFuelType() { waitForFinalize(); return _real.getFuelType(); } public Speed getMaximumSpeed() { waitForFinalize(); return _real.getMaximumSpeed(); } public Speed getCruiseSpeed() { waitForFinalize(); return _real.getCruiseSpeed(); } public Distance getFullPayloadRange() { waitForFinalize(); return _real.getFullPayloadRange(); } public Distance getEmptyPayloadRange() { waitForFinalize(); return _real.getEmptyPayloadRange(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return RailSelfPropulsionPGImpl.class; ===================================================================== Found a 44 line (219 tokens) duplication in the following files: Starting at line 119 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirSelfPropulsionPG.java Starting at line 105 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterSelfPropulsionPG.java public FlowRate getFuelConsumptionRate() { waitForFinalize(); return _real.getFuelConsumptionRate(); } public String getEngineType() { waitForFinalize(); return _real.getEngineType(); } public String getFuelType() { waitForFinalize(); return _real.getFuelType(); } public Speed getMaximumSpeed() { waitForFinalize(); return _real.getMaximumSpeed(); } public Speed getCruiseSpeed() { waitForFinalize(); return _real.getCruiseSpeed(); } public Distance getFullPayloadRange() { waitForFinalize(); return _real.getFullPayloadRange(); } public Distance getEmptyPayloadRange() { waitForFinalize(); return _real.getEmptyPayloadRange(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return WaterSelfPropulsionPGImpl.class; ===================================================================== Found a 44 line (218 tokens) duplication in the following files: Starting at line 249 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgRTDataPlugin.java Starting at line 235 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgTPRTDataPlugin.java System.err.println("OrgRTDataPlugin: selfOrg is null in cloneMe"); return; } // clone the selfOrg Organization clone = (Organization)getFactory().cloneInstance(selfOrg); Organization client = createOrganization(sendto); if (client == null) { System.err.println("OrgRTDataPlugin: Unable to create client " + sendto); return; } //To assist in debugging, I've broken the assignement into chunks NewAssignedPG cloneCapability; if (!clone.hasAssignedPG()) { cloneCapability = (NewAssignedPG)getFactory().createPropertyGroup(AssignedPGImpl.class); } else { cloneCapability = (NewAssignedPG)clone.getAssignedPG().copy(); } //To assist in debugging, I've broken the assignement into chunks NewAssignedPG clientCapability; if (!client.hasAssignedPG()) { clientCapability = (NewAssignedPG)getFactory().createPropertyGroup(AssignedPGImpl.class); } else { clientCapability = (NewAssignedPG)(client.getAssignedPG().copy()); } Vector rolestrs= org.cougaar.util.StringUtility.parseCSV(caproles); Collection roles = new ArrayList(); for (Iterator i = rolestrs.iterator(); i.hasNext();) { Role role = Role.getRole((String)i.next()); roles.add(role); } cloneCapability.setRoles(roles); clone.setAssignedPG(cloneCapability); publish(createRFS(client, clone, roles, startTimeStr, endTimeStr)); ===================================================================== Found a 23 line (216 tokens) duplication in the following files: Starting at line 115 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/util/AllocatorHelper.java Starting at line 212 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/strategictransport/TaskStrategicTransportAllocatorPlugin.java private AllocationResult createEstimatedAllocationResult(Task t) { Enumeration preferences = t.getPreferences(); if ( preferences != null && preferences.hasMoreElements() ) { // do something really simple for now. Vector aspects = new Vector(); Vector results = new Vector(); while (preferences.hasMoreElements()) { Preference pref = (Preference) preferences.nextElement(); int at = pref.getAspectType(); aspects.addElement(new Integer(at)); ScoringFunction sf = pref.getScoringFunction(); // allocate as if you can do it at the "Best" point double myresult = ((AspectScorePoint)sf.getBest()).getValue(); results.addElement(new Double(myresult)); } int[] aspectarray = new int[aspects.size()]; double[] resultsarray = new double[results.size()]; for (int i = 0; i < aspectarray.length; i++) aspectarray[i] = (int) ((Integer)aspects.elementAt(i)).intValue(); for (int j = 0; j < resultsarray.length; j++ ) resultsarray[j] = (double) ((Double)results.elementAt(j)).doubleValue(); AllocationResult myestimate = theLDMF.newAllocationResult(0.0, true, aspectarray, resultsarray); ===================================================================== Found a 43 line (213 tokens) duplication in the following files: Starting at line 88 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/OneTaskAddAndRescindPlugin.java Starting at line 91 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/SimpleAddRescindPlugin.java protected void parseParameter(){ Vector p = getParameters(); CPUCONSUME=getParameterIntValue(p, "CPUCONSUME"); MESSAGESIZE=getParameterIntValue(p, "MESSAGESIZE"); FILENAME=getParameterValue(p, "FILENAME"); MAXCOUNT=getParameterIntValue(p, "MAXCOUNT"); OUTSTANDING_MESSAGES =getParameterIntValue(p, "OUTSTANDING_MESSAGES"); DEBUG=getParameterBooleanValue(p, "DEBUG"); LOG=getParameterBooleanValue(p, "LOG"); BURST_TIME=getParameterIntValue(p, "BURST_TIME"); VERB=getParameterValue(p, "VERB"); } public UnaryPredicate myAllocationPredicate = new UnaryPredicate() { public boolean execute(Object o) { if (o instanceof Allocation) { Task t = ((Allocation)o).getTask(); return (t != null) && (t.getVerb().equals(Verb.get(VERB))); } return false; } }; /** * Using setupSubscriptions to create the initial CODE tasks */ protected void setupSubscriptions() { parseParameter(); //read the plugIn arguments for(int i = 0; i < OUTSTANDING_MESSAGES; i++) { // System.out.println("enetring loop"); addTask(); } allocations = (IncrementalSubscription)subscribe(myAllocationPredicate); } /** * This Plugin has no subscriptions so this method does nothing */ protected void execute () { wakeUpCount++; System.out.println("....Wokenup @"+ System.currentTimeMillis() + " wakeUpcount: " + wakeUpCount); ===================================================================== Found a 38 line (208 tokens) duplication in the following files: Starting at line 197 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgRTDataPlugin.java Starting at line 189 of /usr/local/dashboard/working/glm/src/org/cougaar/mlm/plugin/organization/OrgTPRTDataPlugin.java Organization superiorOrg = createOrganization(sup); if (superiorOrg == null) { throw new RuntimeException("OrgRTDataPlugin: Unable to create superior org asset " + sup); } else if (selfOrg == null) { throw new RuntimeException("OrgRTDataPlugin: selfOrg is null in createSuperior"); } NewAssignedPG superiorCapability; if (!superiorOrg.hasAssignedPG()) { superiorCapability = (NewAssignedPG)getFactory().createPropertyGroup(AssignedPGImpl.class); } else { superiorCapability = (NewAssignedPG)superiorOrg.getAssignedPG().copy(); } ArrayList roles = new ArrayList(1); roles.add(Constants.Role.ADMINISTRATIVESUPERIOR); superiorCapability.setRoles(roles); superiorOrg.setAssignedPG(superiorCapability); // clone the selfOrg Organization clone = (Organization)getFactory().cloneInstance(selfOrg); NewAssignedPG cloneCapability; if (!clone.hasAssignedPG()) { cloneCapability = (NewAssignedPG)getFactory().createPropertyGroup(AssignedPGImpl.class); } else { cloneCapability = (NewAssignedPG)clone.getAssignedPG().copy(); } roles.clear(); roles.add(Constants.Role.ADMINISTRATIVESUBORDINATE); cloneCapability.setRoles(roles); clone.setAssignedPG(cloneCapability); publish(createRFD(superiorOrg, clone, roles, startTimeStr, endTimeStr)); ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailTransportationPG.java Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SeaTransportationPG.java Starting at line 106 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/TransportationPG.java implements TransportationPG, Future_PG { public long getContainerCount() { waitForFinalize(); return _real.getContainerCount(); } public Volume getNonContainerCapacity() { waitForFinalize(); return _real.getNonContainerCapacity(); } public Volume getWaterCapacity() { waitForFinalize(); return _real.getWaterCapacity(); } public Volume getPetroleumCapacity() { waitForFinalize(); return _real.getPetroleumCapacity(); } public Mass getAmmunitionCapacity() { waitForFinalize(); return _real.getAmmunitionCapacity(); } public long getPassengerCapacity() { waitForFinalize(); return _real.getPassengerCapacity(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return TransportationPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 107 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailSelfPropulsionPG.java Starting at line 107 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterSelfPropulsionPG.java return _real.getFuelConsumptionRate(); } public String getEngineType() { waitForFinalize(); return _real.getEngineType(); } public String getFuelType() { waitForFinalize(); return _real.getFuelType(); } public Speed getMaximumSpeed() { waitForFinalize(); return _real.getMaximumSpeed(); } public Speed getCruiseSpeed() { waitForFinalize(); return _real.getCruiseSpeed(); } public Distance getFullPayloadRange() { waitForFinalize(); return _real.getFullPayloadRange(); } public Distance getEmptyPayloadRange() { waitForFinalize(); return _real.getEmptyPayloadRange(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return WaterSelfPropulsionPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OffRoadTransportationPG.java Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OnRoadTransportationPG.java Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailTransportationPG.java implements RailTransportationPG, Future_PG { public long getContainerCount() { waitForFinalize(); return _real.getContainerCount(); } public Volume getNonContainerCapacity() { waitForFinalize(); return _real.getNonContainerCapacity(); } public Volume getWaterCapacity() { waitForFinalize(); return _real.getWaterCapacity(); } public Volume getPetroleumCapacity() { waitForFinalize(); return _real.getPetroleumCapacity(); } public Mass getAmmunitionCapacity() { waitForFinalize(); return _real.getAmmunitionCapacity(); } public long getPassengerCapacity() { waitForFinalize(); return _real.getPassengerCapacity(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return RailTransportationPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 112 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/LandConditionPG.java Starting at line 112 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/SeaConditionPG.java return _real.getSurfaceTemperature(); } public Speed getWindSpeed() { waitForFinalize(); return _real.getWindSpeed(); } public Temperature getTemperature() { waitForFinalize(); return _real.getTemperature(); } public double getPrecipitationRate() { waitForFinalize(); return _real.getPrecipitationRate(); } public Heading getWindHeading() { waitForFinalize(); return _real.getWindHeading(); } public Distance getVisibility() { waitForFinalize(); return _real.getVisibility(); } public double getBarometricPressure() { waitForFinalize(); return _real.getBarometricPressure(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return SeaConditionPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 114 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/GroundSelfPropulsionPG.java Starting at line 107 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/WaterSelfPropulsionPG.java return _real.getFuelConsumptionRate(); } public String getEngineType() { waitForFinalize(); return _real.getEngineType(); } public String getFuelType() { waitForFinalize(); return _real.getFuelType(); } public Speed getMaximumSpeed() { waitForFinalize(); return _real.getMaximumSpeed(); } public Speed getCruiseSpeed() { waitForFinalize(); return _real.getCruiseSpeed(); } public Distance getFullPayloadRange() { waitForFinalize(); return _real.getFullPayloadRange(); } public Distance getEmptyPayloadRange() { waitForFinalize(); return _real.getEmptyPayloadRange(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return WaterSelfPropulsionPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirTransportationPG.java Starting at line 100 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/OffRoadTransportationPG.java implements OffRoadTransportationPG, Future_PG { public long getContainerCount() { waitForFinalize(); return _real.getContainerCount(); } public Volume getNonContainerCapacity() { waitForFinalize(); return _real.getNonContainerCapacity(); } public Volume getWaterCapacity() { waitForFinalize(); return _real.getWaterCapacity(); } public Volume getPetroleumCapacity() { waitForFinalize(); return _real.getPetroleumCapacity(); } public Mass getAmmunitionCapacity() { waitForFinalize(); return _real.getAmmunitionCapacity(); } public long getPassengerCapacity() { waitForFinalize(); return _real.getPassengerCapacity(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return OffRoadTransportationPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 121 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirSelfPropulsionPG.java Starting at line 114 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/GroundSelfPropulsionPG.java return _real.getFuelConsumptionPerMile(); } public String getEngineType() { waitForFinalize(); return _real.getEngineType(); } public String getFuelType() { waitForFinalize(); return _real.getFuelType(); } public Speed getMaximumSpeed() { waitForFinalize(); return _real.getMaximumSpeed(); } public Speed getCruiseSpeed() { waitForFinalize(); return _real.getCruiseSpeed(); } public Distance getFullPayloadRange() { waitForFinalize(); return _real.getFullPayloadRange(); } public Distance getEmptyPayloadRange() { waitForFinalize(); return _real.getEmptyPayloadRange(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return GroundSelfPropulsionPGImpl.class; ===================================================================== Found a 42 line (206 tokens) duplication in the following files: Starting at line 107 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/AirConditionPG.java Starting at line 112 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/LandConditionPG.java return _real.getSnowDepth(); } public Speed getWindSpeed() { waitForFinalize(); return _real.getWindSpeed(); } public Temperature getTemperature() { waitForFinalize(); return _real.getTemperature(); } public double getPrecipitationRate() { waitForFinalize(); return _real.getPrecipitationRate(); } public Heading getWindHeading() { waitForFinalize(); return _real.getWindHeading(); } public Distance getVisibility() { waitForFinalize(); return _real.getVisibility(); } public double getBarometricPressure() { waitForFinalize(); return _real.getBarometricPressure(); } public boolean equals(Object object) { waitForFinalize(); return _real.equals(object); } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public NewPropertyGroup unlock(Object key) { return null; } public PropertyGroup lock(Object key) { return null; } public PropertyGroup lock() { return null; } public PropertyGroup copy() { return null; } public Class getPrimaryClass(){return primaryClass;} public String getAssetGetMethod() {return assetGetter;} public String getAssetSetMethod() {return assetSetter;} public Class getIntrospectionClass() { return LandConditionPGImpl.class; ===================================================================== Found a 40 line (196 tokens) duplication in the following files: Starting at line 93 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/ClientOrganization.java Starting at line 191 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/Organization.java } private transient RelationshipPG myRelationshipPG; public RelationshipSchedule getRelationshipSchedule() { return getRelationshipPG().getRelationshipSchedule(); } public void setRelationshipSchedule(RelationshipSchedule schedule) { NewRelationshipPG _argRelationshipPG = (NewRelationshipPG) getRelationshipPG().copy(); _argRelationshipPG.setRelationshipSchedule(schedule); setRelationshipPG(_argRelationshipPG); } public boolean isLocal() { return getRelationshipPG().getLocal(); } public void setLocal(boolean localFlag) { NewRelationshipPG _argRelationshipPG = (NewRelationshipPG) getRelationshipPG().copy(); _argRelationshipPG.setLocal(localFlag); setRelationshipPG(_argRelationshipPG); } public boolean isSelf() { return getRelationshipPG().getLocal(); } public RelationshipPG getRelationshipPG() { RelationshipPG _tmp = (myRelationshipPG != null) ? myRelationshipPG : (RelationshipPG)resolvePG(RelationshipPG.class); return (_tmp == RelationshipPG.nullPG)?null:_tmp; } public void setRelationshipPG(PropertyGroup arg_RelationshipPG) { if (!(arg_RelationshipPG instanceof RelationshipPG)) throw new IllegalArgumentException("setRelationshipPG requires a RelationshipPG argument."); myRelationshipPG = (RelationshipPG) arg_RelationshipPG; } // generic search methods public PropertyGroup getLocalPG(Class c, long t) { if (ManagedAssetPG.class.equals(c)) { ===================================================================== Found a 42 line (191 tokens) duplication in the following files: Starting at line 132 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/OneTaskAddAndRescindPlugin.java Starting at line 133 of /usr/local/dashboard/working/glm/src/org/cougaar/lib/quo/performance/SimpleAddRescindPlugin.java System.out.println("....Wokenup @"+ System.currentTimeMillis() + " wakeUpcount: " + wakeUpCount); //publishRemove(t); allocateChangedtasks(allocations.getChangedList()); // Process changed allocations } protected void addTask() { publishAsset(what_to_code, "The next Killer App", "e something java"); t = makeTask(what_to_code, VERB); setPreference(t, AspectType._ASPECT_COUNT, sequenceNum); publishAdd(t); } public void publishAsset(Asset asset, String nameOfAsset, String itemIdentification){ asset = theLDMF.createPrototype("AbstractAsset", nameOfAsset); NewItemIdentificationPG iipg = (NewItemIdentificationPG)theLDMF.createPropertyGroup("ItemIdentificationPG"); iipg.setItemIdentification(itemIdentification); asset.setItemIdentificationPG(iipg); publishAdd(asset); } protected void allocateChangedtasks(Enumeration allo_enum){ AllocationResult est, rep; double val=0; //double arr[] = null; //double received = 0; while (allo_enum.hasMoreElements()) { taskAllocationCount++; int taskCount = (int)t.getPreferredValue(AspectType._ASPECT_COUNT); debug(DEBUG,"ManagerPlugin:allocateChangedTasks ....taskAllocationCount.." + taskAllocationCount + " for task# " + taskCount); Allocation alloc = (Allocation)allo_enum.nextElement() ; est=null; rep=null; est = alloc.getEstimatedResult(); rep = alloc.getReportedResult(); if (rep!=null){ ===================================================================== Found a 20 line (186 tokens) duplication in the following files: Starting at line 78 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/GroundSelfPropulsionPG.java Starting at line 75 of /usr/local/dashboard/working/glm/src/org/cougaar/glm/ldm/asset/RailSelfPropulsionPG.java public Volume getFuelConsumptionPerMile() { throw new UndefinedValueException(); } public String getEngineType() { throw new UndefinedValueException(); } public String getFuelType() {