001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/matrix/api/src/java/org/theospi/portfolio/matrix/model/Matrix.java $
003: * $Id:Matrix.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.theospi.portfolio.matrix.model;
021:
022: import java.util.HashSet;
023: import java.util.Set;
024:
025: import org.sakaiproject.metaobj.shared.mgt.ReadableObjectHome;
026: import org.sakaiproject.metaobj.shared.model.Agent;
027: import org.sakaiproject.metaobj.shared.model.Artifact;
028: import org.sakaiproject.metaobj.shared.model.Id;
029: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
030:
031: /**
032: * @author rpembry
033: */
034: public class Matrix extends IdentifiableObject implements Artifact {
035:
036: private Id id;
037: private Agent owner;
038: private Scaffolding scaffolding;
039: private Set cells = new HashSet();
040: private ReadableObjectHome home;
041:
042: /**
043: * @return Returns the cells.
044: */
045: public Set getCells() {
046: return cells;
047: }
048:
049: /**
050: * @param cells The cells to set.
051: */
052: public void setCells(Set cells) {
053: this .cells = cells;
054: }
055:
056: /**
057: * @return Returns the id.
058: */
059: public Id getId() {
060: return id;
061: }
062:
063: /**
064: * @param id The id to set.
065: */
066: public void setId(Id id) {
067: this .id = id;
068: }
069:
070: public void add(Cell cell) {
071: this .getCells().add(cell);
072: cell.setMatrix(this );
073: }
074:
075: /* (non-Javadoc)
076: * @see java.lang.Object#equals(java.lang.Object)
077: */
078: public boolean equals(Object other) {
079: if (other == this )
080: return true;
081: if (other == null || !(other instanceof Matrix))
082: return false;
083: //TODO need better equals method
084: return (this .getId().equals(((Matrix) other).getId()));
085:
086: }
087:
088: /* (non-Javadoc)
089: * @see java.lang.Object#hashCode()
090: */
091: public int hashCode() {
092: //TODO need better hashcode
093: Id id = this .getId();
094: if (id == null)
095: return 0;
096: return id.getValue().hashCode();
097: }
098:
099: /* (non-Javadoc)
100: * @see org.theospi.portfolio.shared.model.Artifact#getOwner()
101: */
102: public Agent getOwner() {
103: return owner;
104: }
105:
106: public void setOwner(Agent owner) {
107: this .owner = owner;
108: }
109:
110: /* (non-Javadoc)
111: * @see org.theospi.portfolio.shared.model.Artifact#getHome()
112: */
113: public ReadableObjectHome getHome() {
114: return home;
115: }
116:
117: /* (non-Javadoc)
118: * @see org.theospi.portfolio.shared.model.Artifact#setHome(org.theospi.portfolio.shared.mgt.ReadableObjectHome)
119: */
120: public void setHome(ReadableObjectHome home) {
121: this .home = home;
122:
123: }
124:
125: /* (non-Javadoc)
126: * @see org.theospi.portfolio.shared.model.Artifact#getDisplayName()
127: */
128: public String getDisplayName() {
129: return scaffolding.getTitle();
130: }
131:
132: public Scaffolding getScaffolding() {
133: return scaffolding;
134: }
135:
136: public void setScaffolding(Scaffolding scaffolding) {
137: this.scaffolding = scaffolding;
138: }
139: }
|