View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: ModelInfo.java
13   * Created: 2009-03-18
14   * Author: bmilos
15   * $Id$
16   */
17  
18  package pl.edu.agh.cast.model;
19  
20  
21  /**
22   * Holds and maintains the information about a specific domain model.
23   *
24   * @author AGH CAST Team
25   */
26  public class ModelInfo implements Comparable<ModelInfo>{
27  
28  	private String modelId;
29  
30  	private String name;
31  
32  	/**
33  	 * The default constructor.
34  	 *
35  	 * @param modelId
36  	 *            the model identifier
37  	 * @param name
38  	 *            the model name
39  	 */
40  	public ModelInfo(String modelId, String name) {
41  		this.modelId = modelId;
42  		this.name = name;
43  	}
44  
45  	/**
46  	 * Constructor.
47  	 *
48  	 * @param modelId
49  	 *            the model identifier
50  	 */
51  	public ModelInfo(String modelId) {
52  		this(modelId, null);
53  	}
54  
55  	public String getName() {
56      	return name;
57      }
58  
59  	public String getModelId() {
60      	return modelId;
61      }
62  
63  	/**
64  	 * {@inheritDoc}
65  	 *
66  	 * @see java.lang.Comparable#compareTo(java.lang.Object)
67  	 */
68  	public int compareTo(ModelInfo that) {
69  		if (this == that) {
70  	    	return 0;
71  	    }
72  	    if (that == null) {
73  	    	return 1;
74  	    }
75  	    return this.getName().compareTo(that.getName());
76      }
77  }