| Line | Hits | Source |
|---|---|---|
| 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 Task implements ProcessChainNode, DemetrixPropertiesHolder { | |
| 43 | private Graph subGraph; | |
| 44 | protected DemetrixPropertiesStorage properties; | |
| 45 | 57 | public Task() { |
| 46 | 57 | StringProperty nameProperty = null; |
| 47 | 57 | properties = new DemetrixPropertiesStorage(); |
| 48 | 57 | nameProperty = new StringProperty(); |
| 49 | 57 | nameProperty.setName("name"); |
| 50 | 57 | nameProperty.setValue("task"); |
| 51 | 57 | this.addProperty(nameProperty); |
| 52 | 57 | } |
| 53 | /* (non-Javadoc) | |
| 54 | * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#addProperty(net.sourceforge.demetrix.properties.DemetrixProperty) | |
| 55 | */ | |
| 56 | public void addProperty(DemetrixProperty property) { | |
| 57 | 55 | this.properties.addProperty(property); |
| 58 | 55 | } |
| 59 | /* (non-Javadoc) | |
| 60 | * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getAllProperties() | |
| 61 | */ | |
| 62 | public Iterator getAllProperties() { | |
| 63 | 18 | 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) { | |
| 69 | 106 | return this.properties.getProperty(name); |
| 70 | } | |
| 71 | /* (non-Javadoc) | |
| 72 | * @see java.lang.Object#toString() | |
| 73 | */ | |
| 74 | public String toString() { | |
| 75 | 36 | StringProperty nameProperty = null; |
| 76 | 36 | nameProperty = (StringProperty) this.getProperty("name"); |
| 77 | 36 | if (nameProperty != null) { |
| 78 | 36 | return (String) nameProperty.getValue(); |
| 79 | } else { | |
| 80 | 0 | return ""; |
| 81 | } | |
| 82 | } | |
| 83 | /* (non-Javadoc) | |
| 84 | * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getAllPropertyNames() | |
| 85 | */ | |
| 86 | public Enumeration getAllPropertyNames() { | |
| 87 | 0 | return this.properties.getAllPropertyNames(); |
| 88 | } | |
| 89 | /* (non-Javadoc) | |
| 90 | * @see net.sourceforge.demetrix.properties.DemetrixPropertiesHolder#getPropertiesStorage() | |
| 91 | */ | |
| 92 | public DemetrixPropertiesHolder getPropertiesStorage() { | |
| 93 | 580 | return this.properties; |
| 94 | } | |
| 95 | /* (non-Javadoc) | |
| 96 | * @see java.lang.Object#equals(java.lang.Object) | |
| 97 | */ | |
| 98 | public boolean equals(Object anotherObject) { | |
| 99 | 303 | DemetrixPropertiesHolder demetrixPropertiesHolder = null; |
| 100 | 303 | if (anotherObject == null) { |
| 101 | 1 | return false; |
| 102 | } | |
| 103 | 302 | if (anotherObject instanceof DemetrixPropertiesHolder) { |
| 104 | 302 | demetrixPropertiesHolder = (DemetrixPropertiesHolder) anotherObject; |
| 105 | 302 | return this.getPropertiesStorage().equals( |
| 106 | demetrixPropertiesHolder.getPropertiesStorage()); | |
| 107 | } else { | |
| 108 | 0 | return false; |
| 109 | } | |
| 110 | } | |
| 111 | /* (non-Javadoc) | |
| 112 | * @see net.sourceforge.demetrix.model.ProcessChainNode#getSubGraph() | |
| 113 | */ | |
| 114 | public Graph getSubGraph() { | |
| 115 | 72 | return this.subGraph; |
| 116 | } | |
| 117 | /* (non-Javadoc) | |
| 118 | * @see net.sourceforge.demetrix.model.ProcessChainNode#setSubGraph(org._3pq.jgrapht.graph.Subgraph) | |
| 119 | */ | |
| 120 | public void setSubGraph(Graph subGraph) { | |
| 121 | 20 | this.subGraph = subGraph; |
| 122 | 20 | } |
| 123 | /* (non-Javadoc) | |
| 124 | * @see java.lang.Object#hashCode() | |
| 125 | */ | |
| 126 | public int hashCode() { | |
| 127 | 354 | int hashCode = 0; |
| 128 | 354 | if (this.subGraph != null) { |
| 129 | 48 | hashCode += this.subGraph.hashCode(); |
| 130 | } | |
| 131 | 354 | hashCode += this.properties.hashCode(); |
| 132 | 354 | return hashCode; |
| 133 | } | |
| 134 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |