Coverage details for net.sourceforge.demetrix.model.Resource

LineHitsSource
1 /*******************************************************************************
2  * Demetrix process modelling system
3  *
4  * Copyright (c) 2003, 2004 Dimitri A. Pissarenko
5  *
6  * This file is part of Demetrix.
7  *
8  * Demetrix is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * Demetrix is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Demetrix; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * For further information you may
23  *
24  * - send an e-mail in Russian, German or English to dimitri.pissarenko@gmx.net
25  * - look at http://sourceforge.net/projects/demetrix/
26  * - look at http://demetrix.sourceforge.net/
27  * - look at http://members.inode.at/d.pissarenko/
28  *
29  *****************************************************************************/
30 package net.sourceforge.demetrix.model;
31 import java.util.Enumeration;
32 import java.util.Iterator;
33 import org._3pq.jgrapht.Graph;
34 import net.sourceforge.demetrix.properties.DemetrixPropertiesHolder;
35 import net.sourceforge.demetrix.properties.DemetrixPropertiesStorage;
36 import net.sourceforge.demetrix.properties.DemetrixProperty;
37 import net.sourceforge.demetrix.properties.StringProperty;
38 /**
39  * @author Dimitri Pissarenko
40  *
41  */
42 public class Resource implements ProcessChainNode, DemetrixPropertiesHolder {
43     private Graph subGraph;
44     private DemetrixPropertiesStorage properties;
4532    public Resource() {
4632        StringProperty nameProperty = null;
4732        properties = new DemetrixPropertiesStorage();
4832        nameProperty = new StringProperty();
4932        nameProperty.setName("name");
5032        nameProperty.setValue("resource");
5132        this.addProperty(nameProperty);
5232    }
53     /* (non-Javadoc)
54      * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#addProperty(net.sourceforge.demetrix.properties.DemetrixProperty)
55      */
56     public void addProperty(DemetrixProperty property) {
5729        this.properties.addProperty(property);
5829    }
59     /* (non-Javadoc)
60      * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getAllProperties()
61      */
62     public Iterator getAllProperties() {
634        return this.properties.getAllProperties();
64     }
65     /* (non-Javadoc)
66      * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getProperty(java.lang.String)
67      */
68     public DemetrixProperty getProperty(String name) {
6962        return this.properties.getProperty(name);
70     }
71     /* (non-Javadoc)
72      * @see java.lang.Object#toString()
73      */
74     public String toString() {
759        StringProperty nameProperty = null;
769        nameProperty = (StringProperty) this.getProperty("name");
779        if (nameProperty != null) {
789            return (String) nameProperty.getValue();
79         } else {
800            return "";
81         }
82     }
83     /* (non-Javadoc)
84      * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getAllPropertyNames()
85      */
86     public Enumeration getAllPropertyNames() {
870        return this.properties.getAllPropertyNames();
88     }
89     /* (non-Javadoc)
90      * @see java.lang.Object#equals(java.lang.Object)
91      */
92     public boolean equals(Object anotherObject) {
9390        DemetrixPropertiesHolder demetrixPropertiesHolder = null;
9490        if (anotherObject == null) {
951            return false;
96         }
9789        if (anotherObject instanceof DemetrixPropertiesHolder) {
9888            demetrixPropertiesHolder = (DemetrixPropertiesHolder) anotherObject;
99             
10088            return this.getPropertiesStorage().equals(
101                 demetrixPropertiesHolder.getPropertiesStorage());
102         } else {
1031            return false;
104         }
105     }
106     /* (non-Javadoc)
107      * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getPropertiesStorage()
108      */
109     public DemetrixPropertiesHolder getPropertiesStorage() {
110192        return this.properties;
111     }
112     /* (non-Javadoc)
113      * @see net.sourceforge.demetrix.model.ProcessChainNode#getSubGraph()
114      */
115     public Graph getSubGraph() {
1160        return this.subGraph;
117     }
118     /* (non-Javadoc)
119      * @see net.sourceforge.demetrix.model.ProcessChainNode#setSubGraph(org._3pq.jgrapht.graph.Subgraph)
120      */
121     public void setSubGraph(Graph subGraph) {
1221        this.subGraph = subGraph;
1231    }
124     
125     /* (non-Javadoc)
126      * @see java.lang.Object#hashCode()
127      */
128     public int hashCode() {
129150        int hashCode=0;
130150        if (this.subGraph!=null)
131         {
1320            hashCode+=this.subGraph.hashCode();
133         }
134150        hashCode+=this.properties.hashCode();
135150        return hashCode;
136     }
137  
138 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.