View Javadoc

1   /*
2    * Copyright (c) 2008, the JUNG Project and the Regents of the University
3    * of California
4    * All rights reserved.
5    *
6    * This software is open-source under the BSD license; see either
7    * "license.txt" or
8    * http://jung.sourceforge.net/license.txt for a description.
9    */
10  
11  package edu.uci.ics.jung.io.graphml;
12  
13  import java.util.HashMap;
14  import java.util.Map;
15  
16  /**
17   * Abstract base class for metadata - implements the property functionality
18   * 
19   * @author Nathan Mittler - nathan.mittler@gmail.com
20   */
21  public abstract class AbstractMetadata implements Metadata {
22  
23      final private Map<String,String> properties = new HashMap<String, String>();
24      
25      public Map<String, String> getProperties() {
26          return properties;
27      }
28      
29      public String getProperty(String key) {
30          return properties.get(key);
31      }
32      
33      public String setProperty(String key, String value) {
34          return properties.put(key, value);
35      }
36      
37      public void addData(DataMetadata data) {
38          properties.put(data.getKey(), data.getValue());
39      }
40  }