001/*
002 * Copyright (c) 2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: riddle $'
006 * '$Date: 2010-06-28 19:16:46 +0000 (Mon, 28 Jun 2010) $' 
007 * '$Revision: 25036 $'
008 * 
009 * Permission is hereby granted, without written agreement and without
010 * license or royalty fees, to use, copy, modify, and distribute this
011 * software and its documentation for any purpose, provided that the above
012 * copyright notice and the following two paragraphs appear in all copies
013 * of this software.
014 *
015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
019 * SUCH DAMAGE.
020 *
021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
026 * ENHANCEMENTS, OR MODIFICATIONS.
027 *
028 */
029
030package org.kepler.moml;
031
032import java.util.HashMap;
033import java.util.Map;
034import java.util.Vector;
035
036import org.kepler.objectmanager.lsid.KeplerLSID;
037
038/**
039 * A Class to hold the Kepler Actor Metadata for an Actor described in MoML.
040 * 
041 * @author Aaron Schultz
042 */
043public class KeplerActorMetadata {
044
045        /**
046         * The Name of the Actor.
047         */
048        private String _name;
049        
050        /**
051         * The LSID of the Actor as found in the NamedObjId attribute.
052         */
053        private KeplerLSID _lsid;
054
055        /**
056         * Semantic Types assigned to this actor.
057         */
058        private Vector<String> _semanticTypes;
059
060        /**
061         * The Class Name of this actor.
062         */
063        private String _className;
064
065        /**
066         * The root name (i.e. the name of the root xml node) for this actor.
067         */
068        private String _rootName;
069        
070        /**
071         * The full String representation of the MoML for this actor.
072         */
073        private String _actorString;
074
075        
076        public KeplerActorMetadata() {
077                _semanticTypes = new Vector<String>();
078        }
079        
080        public String getName() {
081                return _name;
082        }
083
084        public void setName(String name) {
085                _name = name;
086        }
087
088        public KeplerLSID getLsid() {
089                return _lsid;
090        }
091
092        public void setLsid(KeplerLSID lsid) {
093                _lsid = lsid;
094        }
095
096        public Vector<String> getSemanticTypes() {
097                return _semanticTypes;
098        }
099        
100        public void addSemanticType(String semanticType) {
101                _semanticTypes.add(semanticType);
102        }
103        
104        public void removeSemanticType(String semanticType) {
105                _semanticTypes.remove(semanticType);
106        }
107
108        public void setSemanticTypes(Vector<String> semanticTypes) {
109                _semanticTypes = semanticTypes;
110        }
111
112        public String getClassName() {
113                return _className;
114        }
115
116        public void setClassName(String className) {
117                _className = className;
118        }
119
120        public String getRootName() {
121                return _rootName;
122        }
123
124        public void setRootName(String rootName) {
125                _rootName = rootName;
126        }
127
128        public String getActorString() {
129                return _actorString;
130        }
131
132        public void setActorString(String actorString) {
133                _actorString = actorString;
134        }
135        
136        public void addAttribute(String name, String value) {
137                if (_attributes == null) {
138                        _attributes = new HashMap<String, String>();
139                }
140                _attributes.put(name, value);
141        }
142        
143        public String getAttribute(String name) {
144                return _attributes.get(name);
145        }
146        
147        public Map<String, String> getAttributes() {
148                return _attributes;
149        }
150
151        public String debugString() {
152                String d = "";
153                d += "Name: " + getName() + "\n";
154                d += "ClassName: " + getClassName() + "\n";
155                d += "LSID: " + getLsid() + "\n";
156                d += "RootName: " + getRootName() + "\n";
157                for (String st : getSemanticTypes()) {
158                        d += "SemanticType: " + st + "\n";
159                }
160                //d += "ACTORSTRING: " + getActorString() + "\n";
161                return d;
162        }
163
164        private Map<String, String> _attributes = null;
165}