=====================================================================
Found a 59 line (231 tokens) duplication in the following files:
Starting at line 143 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/mobility/arch/DispatchRemoteHandler.java
Starting at line 160 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/mobility/arch/DispatchTestHandler.java
(!(mobileAgent.equals(id)))) {
throw new MobilityException(
"Move agent "+id+
" doesn't match ticket agent "+mobileAgent);
}
// check origin assertion
MessageAddress originNode = moveTicket.getOriginNode();
if ((originNode != null) &&
(!(originNode.equals(nodeId)))) {
throw new MobilityException(
"Move origin "+nodeId+" for "+id+
" doesn't match ticket origin "+originNode);
}
}
private void suspendAgent() {
if (log.isInfoEnabled()) {
log.info("Suspend agent "+id);
}
model.suspend();
if (log.isInfoEnabled()) {
log.info("Suspended agent "+id);
}
}
private Object getAgentState() {
// capture the agent state
if (stateProvider == null) {
if (log.isWarnEnabled()) {
log.warn("Agent "+id+" has no state?");
}
return null;
}
if (log.isInfoEnabled()) {
log.info("Capture state for agent "+id);
}
Object state;
try {
state = stateProvider.getState();
} catch (Exception e) {
// FIXME now what?
//
throw new MobilityException(
"Unable to capture state for agent "+id+
", will attempt resume", e);
}
if (log.isInfoEnabled()) {
// FIXME maybe not log this -- state may be very verbose!
log.info("Captured state for agent "+id+": "+state);
}
return state;
}
=====================================================================
Found a 27 line (151 tokens) duplication in the following files:
Starting at line 162 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/plugin/freeze/FreezeTargetPlugin.java
Starting at line 176 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/plugin/freeze/FreezeServlet.java
Thread currentThread = Thread.currentThread();
badGuys.remove(new BadGuy(schedulable, currentThread));
}
}
public void rightGiven(String consumer) {
}
public void rightReturned(String consumer) {
}
private void setThreadLimit() {
threadControlService.setQualifier(myThreadQualifier);
}
private void unsetThreadLimit() {
threadControlService.setQualifier(null);
}
public void setupSubscriptions() {
super.setupSubscriptions();
rules.addAllowRule(FreezePlugin.class);
// Hope this is a List cause order is important.
Collection params = getParameters();
for (Iterator i = params.iterator(); i.hasNext();) {
String ruleSpec = (String) i.next();
try {
rules.addRule(ruleSpec);
} catch (Exception e) {
=====================================================================
Found a 18 line (114 tokens) duplication in the following files:
Starting at line 99 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/wp/server/Server.java
Starting at line 162 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/wp/resolver/Resolver.java
specifyContainmentPoint());
int n = (descs == null ? 0 : descs.length);
for (int i = 0; i < n; i++) {
l.add(descs[i]);
}
} catch (ComponentInitializerService.InitializerException cise) {
if (logger.isInfoEnabled()) {
logger.info("\nUnable to add "+agentId+"'s components", cise);
}
} finally {
sb.releaseService(this, ComponentInitializerService.class, cis);
}
return new ComponentDescriptions(l);
}
public void load() {
if (logger.isDebugEnabled()) {
=====================================================================
Found a 16 line (106 tokens) duplication in the following files:
Starting at line 327 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/util/LocateAgentServlet.java
Starting at line 370 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/wp/WhitePagesServlet.java
return
"";
}
private static String input(String n, String v) {
return input(n, v, 40);
}
private static String input(String n, String v, int size) {
return
"";
}
=====================================================================
Found a 25 line (103 tokens) duplication in the following files:
Starting at line 403 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/mobility/ping/PingTimerPlugin.java
Starting at line 330 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/mobility/ping/PingAdderPlugin.java
private long expiresAt;
private boolean expired = false;
public WakeAlarm (long expirationTime) {
expiresAt = expirationTime;
}
public long getExpirationTime() {
return expiresAt;
}
public synchronized void expire() {
if (!expired) {
expired = true;
getBlackboardService().signalClientActivity();
}
}
public boolean hasExpired() {
return expired;
}
public synchronized boolean cancel() {
boolean was = expired;
expired = true;
return was;
}
public String toString() {
return "WakeAlarm "+expiresAt+
(expired?"(Expired) ":" ")+
=====================================================================
Found a 31 line (102 tokens) duplication in the following files:
Starting at line 173 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/thread/PercentageLoadSelector.java
Starting at line 236 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/thread/AgentLoadSensorPlugin.java
ConsumerRecord rec = null;
synchronized (records) {
rec = (ConsumerRecord) records.get(name);
if (rec == null) {
rec = new ConsumerRecord(name);
records.put(name, rec);
}
}
return rec;
}
// ThreadListener
public void threadQueued(Schedulable schedulable,
Object consumer)
{
}
public void threadDequeued(Schedulable schedulable,
Object consumer)
{
}
public void threadStarted(Schedulable schedulable,
Object consumer)
{
}
public void threadStopped(Schedulable schedulable,
Object consumer)
{
}
=====================================================================
Found a 15 line (102 tokens) duplication in the following files:
Starting at line 72 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/wp/ListAllAgents.java
Starting at line 59 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/wp/ListAllNodes.java
}
// recursive!
private static void recurse(
Set toSet,
WhitePagesService wps,
String suffix,
long timeout) throws Exception {
Set names = wps.list(suffix, timeout);
for (Iterator iter = names.iterator(); iter.hasNext(); ) {
String s = (String) iter.next();
if (s == null) {
} else if (s.length() > 0 && s.charAt(0) == '.') {
recurse(toSet, wps, s, timeout);
} else {
=====================================================================
Found a 13 line (101 tokens) duplication in the following files:
Starting at line 115 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/servlet/ServletUtil.java
Starting at line 77 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/servlet/ServletUtil.java
int slen = ((s != null) ? s.length() : 0);
StringBuffer sb = new StringBuffer((int)(1.10*(double)slen));
for (int i = 0; i < slen; i++) {
char ci = s.charAt(i);
switch (ci) {
default:
if ((ci >= ' ') && (ci <= '~')) {
sb.append(ci);
} else {
// unsupported?
sb.append("?");
}
break;
=====================================================================
Found a 48 line (100 tokens) duplication in the following files:
Starting at line 93 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/adaptivity/InterAgentOperatingMode.java
Starting at line 101 of /home/tom/data/cf-dashboard/working/core/src/org/cougaar/core/adaptivity/InterAgentCondition.java
}
// Relay.Source implementation
/**
* Get all the addresses of the target agents to which this Relay
* should be sent. For this implementation this is always a
* singleton set contain just one target.
**/
public Set getTargets() {
return targets;
}
/**
* Get an object representing the value of this Relay suitable
* for transmission. This implementation uses itself to represent
* its Content.
**/
public Object getContent() {
return this;
}
/**
* @return a factory to convert the content to a Relay Target.
**/
public Relay.TargetFactory getTargetFactory() {
return InterAgentConditionFactory.INSTANCE;
}
/**
* Set the response that was sent from a target. For LP use only.
* This implemenation does nothing because responses are not needed
* or used.
**/
public int updateResponse(MessageAddress target, Object response) {
// No response expected
return Relay.NO_CHANGE;
}
/**
* This factory creates a new InterAgentCondition.
**/
private static class InterAgentConditionFactory
implements Relay.TargetFactory, java.io.Serializable {
public static final InterAgentConditionFactory INSTANCE =
new InterAgentConditionFactory();
private InterAgentConditionFactory() { }
public Relay.Target create(
UID uid, MessageAddress source, Object content, Relay.Token owner) {