CPD Results
The following document contains the results of PMD's CPD 7.17.0.
Duplications
| File |
Line |
| nl/tudelft/simulation/dsol/formalisms/flow/Entity.java |
95 |
| nl/tudelft/simulation/dsol/formalisms/flow/FlowBlock.java |
174 |
}
/**
* Add an object as an attribute to the entity.
* @param key the key of the attribute
* @param value the value to store
*/
public void setAttribute(final String key, final Object value)
{
if (this.attributes == null)
this.attributes = new LinkedHashMap<>();
this.attributes.put(key, value);
}
/**
* Retrieve a typed object attribute value.
* @param key the id of the attribute
* @param clazz Class<VT> the class of the object to return
* @return the stored value
* @param <VT> the class of the attribute value to return
*/
@SuppressWarnings("unchecked")
public <VT> VT getAttribute(final String key, final Class<VT> clazz)
{
if (this.attributes == null)
return null;
return (VT) this.attributes.get(key);
}
/**
* Retrieve an object attribute value.
* @param key the id of the attribute
* @return the stored value
*/
public Object getAttribute(final String key)
{
return getAttribute(key, Object.class);
}
/**
* Add a String as an attribute to the entity.
* @param key the key of the attribute
* @param value the value to store
*/
public void setStringAttribute(final String key, final String value)
{
setAttribute(key, value);
}
/**
* Retrieve a stored String attribute value.
* @param key the id of the attribute
* @return the stored value
*/
public String getStringAttribute(final String key)
{
if (this.attributes == null)
return null;
return this.attributes.get(key).toString();
}
/**
* Add a Number as an attribute to the entity.
* @param key the key of the attribute
* @param value the value to store
*/
public void setNumberAttribute(final String key, final Number value)
{
setAttribute(key, value);
}
/**
* Retrieve a stored Number attribute value.
* @param key the id of the attribute
* @return the stored value
*/
public Number getNumberAttribute(final String key)
{
return getAttribute(key, Number.class);
}
/**
* Return the creation time.
* @return the creation time
*/
public T getCreationTime() |
| File |
Line |
| nl/tudelft/simulation/dsol/formalisms/flow/Seize.java |
233 |
| nl/tudelft/simulation/dsol/formalisms/flow/Seize.java |
358 |
final Resource.DoubleCapacity<T> resource)
{
for (StoredEntity<T> storedEntity : this.storage)
{
if (storedEntity.entity().equals(entity))
{
synchronized (this.storage)
{
this.storage.remove(storedEntity);
}
this.fireTimedEvent(Seize.NUMBER_STORED_EVENT, this.storage.size(), getSimulator().getSimulatorTime());
T delay = SimTime.minus(getSimulator().getSimulatorTime(), storedEntity.storeTime());
this.fireTimedEvent(Seize.STORAGE_TIME_EVENT, delay.doubleValue(), getSimulator().getSimulatorTime());
this.releaseEntity(storedEntity.entity());
return;
}
}
}
} |