Search in sources :

Example 1 with Wrapper

use of gov.sandia.n2a.backend.internal.Wrapper in project n2a by frothga.

the class Instance method path.

/**
 *        Return a unique name for this instance within the simulation.
 *        Name consists of the equation set name combined with the index of this part,
 *        prefixed by the path to the parent part. In the case of a connection, the name
 *        consists of the path to each of the connected parts.
 */
public String path() {
    // In general, container is never null, as that would only happen if this is the instance of Wrapper.
    boolean top = container instanceof Wrapper || container == null;
    String result;
    if (top)
        result = "";
    else
        result = equations.name;
    InternalBackendData bed = (InternalBackendData) equations.backendData;
    if (bed.index != null && !(this instanceof Population))
        result += get(bed.index);
    if (top)
        return result;
    String prefix = container.path();
    if (prefix.isEmpty())
        return result;
    return prefix + "." + result;
}
Also used : Wrapper(gov.sandia.n2a.backend.internal.Wrapper) Population(gov.sandia.n2a.backend.internal.Population) InternalBackendData(gov.sandia.n2a.backend.internal.InternalBackendData)

Aggregations

InternalBackendData (gov.sandia.n2a.backend.internal.InternalBackendData)1 Population (gov.sandia.n2a.backend.internal.Population)1 Wrapper (gov.sandia.n2a.backend.internal.Wrapper)1