1 18 19 package org.objectweb.jac.ide; 20 21 import org.objectweb.jac.core.ObjectRepository; 22 import org.objectweb.jac.core.rtti.ClassRepository; 23 import java.util.Collection ; 24 25 public class RelationLink extends Link { 26 27 public RelationLink() { 28 } 29 30 public RelationLink(Class start, Class end) { 31 initRoles(); 32 setStart(start); 33 setEnd(end); 34 } 35 36 39 public void initRoles() { 40 startRole = new RelationRole(this); 41 endRole = new RelationRole(this); 42 } 43 44 public RelationRole startRole() { 45 return (RelationRole)startRole; 46 } 47 48 public RelationRole endRole() { 49 return (RelationRole)endRole; 50 } 51 52 public static final int ORIENTATION_BOTH = 0; 53 public static final int ORIENTATION_STRAIGHT = 1; 54 public static final int ORIENTATION_REVERSE = -1; 55 56 int orientation = ORIENTATION_BOTH; 57 58 62 public int getOrientation() { 63 return orientation; 64 } 65 69 public void setOrientation(int v) { 70 this.orientation = v; 71 } 72 73 boolean aggregation; 74 78 public boolean isAggregation() { 79 return aggregation; 80 } 81 85 public void setAggregation(boolean v) { 86 this.aggregation = v; 87 } 88 89 boolean calculated; 90 94 public boolean isCalculated() { 95 return calculated; 96 } 97 101 public void setCalculated(boolean v) { 102 this.calculated = v; 103 } 104 105 public static Collection endChoices(Object substance) { 106 return ObjectRepository.getObjects(ClassRepository.get().getClass(Class .class)); 107 } 108 109 112 public void reverse() { 113 RelationRole start = (RelationRole)startRole; 114 RelationRole end = (RelationRole)endRole; 115 startRole = end; 116 endRole = start; 117 } 118 } 119 | Popular Tags |