View Javadoc
1 /*** 2 * Layer.java 3 * 4 * Project: Dependency Tool 5 * 6 * WHEN WHO WHAT 7 * 06.06.2003 pko initial public release 8 * 15.01.2003 pko modification 9 * 10.12.2002 pko creation 10 * 11 * Copyright 2003 ELCA Informatique SA 12 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland 13 * www.elca.ch 14 * 15 * This library is free software; you can redistribute it and/or 16 * modify it under the terms of the GNU Lesser General Public License 17 * as published by the Free Software Foundation; either version 2.1 of 18 * the License, or (at your option) any later version. 19 * 20 * This library is distributed in the hope that it will be useful, but 21 * WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 * Lesser General Public License for more details. 24 * 25 * You should have received a copy of the GNU Lesser General Public 26 * License along with this library; if not, write to the Free Software 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 28 * USA 29 */ 30 31 package ch.elca.dependency.graph; 32 33 import java.util.ArrayList; 34 35 /*** 36 * This class represents an architectural Layer withing analyzed 37 * software. It is used by the class <code>LayerOrder</code> to find 38 * packages and the Layers they belong to. 39 * 40 * @author Pawel Kowalski 41 * @version 1.0-beta 42 */ 43 public class Layer { 44 45 /*** 46 * A default Layer used for nodes not belonging to a particular Layer. 47 */ 48 public static final Layer UNASSIGNED = new Layer("unassigned"); 49 50 /*** 51 * A name associated with this <code>Layer</code>. 52 */ 53 private String m_name = ""; 54 55 /*** 56 * An <code>ArrayList</code> containing all packages associated 57 * with this <code>Layer</code>. 58 */ 59 private ArrayList m_packages = new ArrayList(); 60 61 /*** 62 * Creates a new <code>Layer</code> instance. 63 */ 64 public Layer() { 65 } 66 67 /*** 68 * Creates a new <code>Layer</code> instance. 69 * 70 * @param name a <code>String</code> value 71 */ 72 public Layer(String name) { 73 setName(name); 74 } 75 76 /*** 77 * Set the name of this <code>Layer</code>. 78 * 79 * @param name a <code>String</code> value 80 */ 81 public void setName(String name) { 82 m_name = name + "_layer"; 83 } 84 85 /*** 86 * Get the name of this <code>Layer</code>. 87 * 88 * @return a <code>String</code> value 89 */ 90 public String getName() { 91 return m_name; 92 } 93 94 /*** 95 * Add a new package name that belongs to this <code>Layer</code>. 96 * 97 * @param packageName a <code>String</code> value 98 */ 99 public void addPackage(String packageName) { 100 m_packages.add(packageName); 101 } 102 103 /*** 104 * Remove a package from this <code>Layer</code>. 105 * 106 * @param packageName a <code>String</code> value 107 */ 108 public void removePackage(String packageName) { 109 m_packages.remove(m_packages.indexOf(packageName)); 110 } 111 112 /*** 113 * Get a package associated with this <code>Layer</code>. 114 * 115 * @return a <code>String[]</code> value 116 */ 117 public String[] getPackages() { 118 return (String[])m_packages.toArray(new String[] {}); 119 } 120 121 /*** 122 * Set packages that belong to this <code>Layer</code>. 123 * 124 * @param packages a <code>String[]</code> value 125 */ 126 public void setPackages(String[] packages) { 127 m_packages = new ArrayList(); 128 for (int i = 0; i < packages.length; i++) { 129 m_packages.add(packages[i]); 130 } 131 } 132 133 /*** 134 * Returns the String representation of a Layer instance 135 * 136 * @return a <code>String</code> value 137 */ 138 public String toString() { 139 return m_name; 140 } 141 } 142

This page was automatically generated by Maven