KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > dependencies > Dependency


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.internal.dependencies;
12
13 public class Dependency {
14     private int changedMark;
15     private Object JavaDoc requiredObjectId;
16     private IMatchRule matchRule;
17     private boolean optional;
18     private Object JavaDoc resolvedVersionId;
19     private Object JavaDoc userObject;
20
21     public Dependency(Object JavaDoc requiredObjectId, IMatchRule matchRule, boolean optional, Object JavaDoc userObject) {
22         Assert.isNotNull(requiredObjectId);
23         Assert.isNotNull(matchRule);
24         this.requiredObjectId = requiredObjectId;
25         this.matchRule = matchRule;
26         this.optional = optional;
27         this.userObject = userObject;
28     }
29
30     /**
31      * @see IDependency#getMatchRule()
32      */

33     public IMatchRule getMatchRule() {
34         return this.matchRule;
35     }
36
37     /**
38      * @see IDependency#getRequiredObjectId()
39      */

40     public Object JavaDoc getRequiredObjectId() {
41         return this.requiredObjectId;
42     }
43
44     /**
45      * @see IDependency#isOptional()
46      */

47     public boolean isOptional() {
48         return this.optional;
49     }
50
51     /**
52      * @see IDependency#getResolvedVersionId()
53      */

54     public Object JavaDoc getResolvedVersionId() {
55         return resolvedVersionId;
56     }
57
58     public void resolve(Object JavaDoc resolvedVersionId, int changedMark) {
59         if ((resolvedVersionId == null && this.resolvedVersionId == null) || (resolvedVersionId != null && resolvedVersionId.equals(this.resolvedVersionId)))
60             return;
61         this.resolvedVersionId = resolvedVersionId;
62         this.changedMark = changedMark;
63     }
64
65     public int getChangedMark() {
66         return changedMark;
67     }
68
69     public String JavaDoc toString() {
70         return " -> " + getUserObject() + " (" + getMatchRule() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
71
}
72
73     public Object JavaDoc getUserObject() {
74         return userObject;
75     }
76
77 }
Popular Tags