X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fdatamodel%2Fmapping%2FMapResource.java;fp=dol%2Fsrc%2Fdol%2Fdatamodel%2Fmapping%2FMapResource.java;h=2aa9cf8e6d2c299146348691f8a38c577f2443be;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/datamodel/mapping/MapResource.java b/dol/src/dol/datamodel/mapping/MapResource.java new file mode 100644 index 0000000..2aa9cf8 --- /dev/null +++ b/dol/src/dol/datamodel/mapping/MapResource.java @@ -0,0 +1,116 @@ +package dol.datamodel.mapping; + +import dol.visitor.MapVisitor; + +/** + * This class is the basic class which abstracts a mapping resource. + */ +public class MapResource implements Cloneable { + /** + * Constructor to create a mapping resource with a name. + */ + public MapResource(String name) { + _name = name; + _basename = name; + } + + /** + * Accept a Visitor + * + * @param x visitor object + */ + public void accept(MapVisitor x) { + x.visitComponent(this); + } + + /** + * Clone this mapping resource. + * + * @return new instance of the mapping resource. + */ + public Object clone() { + try { + MapResource newObj = (MapResource) super.clone(); + newObj.setName(_name); + newObj.setBasename(_basename); + return (newObj); + } catch (CloneNotSupportedException e) { + System.out.println("Error Clone not Supported"); + } + return null; + } + + /** + * Get the name of this mapping resource. + * + * @return name of the mapping resource + */ + public String getName() { + return _name; + } + + /** + * Set the name of this mapping resource. + * + * @param name name of the mapping resource + */ + public void setName(String name) { + _name = name; + } + + /** + * Get the basename of this mapping resource. + * + * @return basename of the mapping resource + */ + public String getBasename() { + return _basename; + } + + /** + * Set the basename of this mapping resource. + * + * @param basename name of the mapping resource + */ + public void setBasename(String basename) { + _basename = basename; + } + + /** + * Get the hierarchical parent of this mapping resource. + * + * @return parent of this mapping resource + */ + public MapResource getParentResource() { + return _parentResource; + } + + /** + * Set the hierarchical parent of this mapping resource. + * + * @param parentResource new parent + */ + public void setParentResource(MapResource parentResource) { + _parentResource = parentResource; + } + + /** + * Return a string representation of the architectural resource. + * + * @return string representation of the architectural resource + */ + public String toString() { + return "MapResource: " + _name; + } + + /** name of the architectural resource */ + protected String _name = null; + + /** basename of the architectural resource, if no basename, store the name */ + protected String _basename = null; + + /** + * parent resource of this architectural resource in a hierarchical architecture network + */ + protected MapResource _parentResource = null; +}