leaf-analysis/src/simulation/ContributionLink.java
/** Check if the relationship types are correct, then constructs a contribution link. 
	 * Note: Assume that N
	 * @param s	Source Intention
	 * @param d Destination Intention
	 * @param link Input link properties.
	 * @return creates a contribution link, but null if decomposition link, error if incorrect link.
	 */
Check if the relationship types are correct, then constructs a contribution link.
Note: Assume that N
@param s     Source Intention
@param d Destination Intention
@param link Input link properties.
@return creates a contribution link, but null if decomposition link, error if incorrect link.
Check if the relationship types are correct then constructs a contribution link . Note : Assume that N @param s Source Intention @param d Destination Intention @param link Input link properties . @return creates a contribution link but null if decomposition link error if incorrect link .
public static ContributionLink createConstributionLink(AbstractLinkableElement s, AbstractLinkableElement d, BILink link, String uniqueID) {
		String linkType = link.getLinkType();
		if (linkType.equals("NBT") || linkType.equals("NBD"))
			throw new IllegalArgumentException("NBT/NBD relation not filtered prior to contriubtion links.");
		if (link.getPostType() == null) {
			switch (linkType) {
				case "++":  case "+":  case "-":  case "--":
				case "++S": case "+S": case "-S": case "--S":
				case "++D": case "+D": case "-D": case "--D":
					return new ContributionLink(s, d, ContributionType.getByCode(linkType), uniqueID);
				case "and":
				case "or":
				case "AND":
				case "OR":
					return null;
				default:
					throw new IllegalArgumentException("(Simple) Invalid relationship type: " + linkType);
			}
		} else {
			String postType = link.getPostType();
			switch (linkType) {
				case "++":  case "+":  case "-":  case "--":
				case "++S": case "+S": case "-S": case "--S":
				case "++D": case "+D": case "-D": case "--D":
					switch (postType) {
						case "no": case "NO":
							return new ContributionLink(s, d, ContributionType.getByCode(linkType), ContributionType.getByCode("no"), link.getAbsTime(), uniqueID);
						case "++":  case "+":  case "-":  case "--":
						case "++S": case "+S": case "-S": case "--S":
						case "++D": case "+D": case "-D": case "--D":
							return new ContributionLink(s, d, ContributionType.getByCode(linkType), ContributionType.getByCode(postType), link.getAbsTime(), uniqueID);
						default:
							throw new IllegalArgumentException("Invalid relationship type (type 1): " + linkType);
					}
				case "and": case "or": case "AND": case "OR":
					return null;
				case "no": case "NO":
					switch (postType) {
						case "++":  case "+":  case "-":  case "--":
						case "++S": case "+S": case "-S": case "--S":
						case "++D": case "+D": case "-D": case "--D":
							return new ContributionLink(s, d, ContributionType.getByCode("no"), ContributionType.getByCode(postType), link.getAbsTime(), uniqueID);
						case "and": case "or": case "AND": case "OR":
							return null;
						default:
							throw new IllegalArgumentException("Invalid relationship type (type 2): " + linkType);
					}
				default:
					throw new IllegalArgumentException("Invalid relationship type (type 3): " + linkType);
			}
		}
	}
public static ContributionLink createConstributionLink ( AbstractLinkableElement s , AbstractLinkableElement d , BILink link , String uniqueID ) { String linkType = link . getLinkType ( ) ; if ( linkType . equals ( "NBT" ) || linkType . equals ( "NBD" ) ) throw new IllegalArgumentException ( "NBT/NBD relation not filtered prior to contriubtion links." ) ; if ( link . getPostType ( ) == null ) { switch ( linkType ) { case "++" : case "+" : case "-" : case "--" : case "++S" : case "+S" : case "-S" : case "--S" : case "++D" : case "+D" : case "-D" : case "--D" : return new ContributionLink ( s , d , ContributionType . getByCode ( linkType ) , uniqueID ) ; case "and" : case "or" : case "AND" : case "OR" : return null ; default : throw new IllegalArgumentException ( "(Simple) Invalid relationship type: " + linkType ) ; } } else { String postType = link . getPostType ( ) ; switch ( linkType ) { case "++" : case "+" : case "-" : case "--" : case "++S" : case "+S" : case "-S" : case "--S" : case "++D" : case "+D" : case "-D" : case "--D" : switch ( postType ) { case "no" : case "NO" : return new ContributionLink ( s , d , ContributionType . getByCode ( linkType ) , ContributionType . getByCode ( "no" ) , link . getAbsTime ( ) , uniqueID ) ; case "++" : case "+" : case "-" : case "--" : case "++S" : case "+S" : case "-S" : case "--S" : case "++D" : case "+D" : case "-D" : case "--D" : return new ContributionLink ( s , d , ContributionType . getByCode ( linkType ) , ContributionType . getByCode ( postType ) , link . getAbsTime ( ) , uniqueID ) ; default : throw new IllegalArgumentException ( "Invalid relationship type (type 1): " + linkType ) ; } case "and" : case "or" : case "AND" : case "OR" : return null ; case "no" : case "NO" : switch ( postType ) { case "++" : case "+" : case "-" : case "--" : case "++S" : case "+S" : case "-S" : case "--S" : case "++D" : case "+D" : case "-D" : case "--D" : return new ContributionLink ( s , d , ContributionType . getByCode ( "no" ) , ContributionType . getByCode ( postType ) , link . getAbsTime ( ) , uniqueID ) ; case "and" : case "or" : case "AND" : case "OR" : return null ; default : throw new IllegalArgumentException ( "Invalid relationship type (type 2): " + linkType ) ; } default : throw new IllegalArgumentException ( "Invalid relationship type (type 3): " + linkType ) ; } } }
Check if the relationship types are correct, then constructs a contribution link.
Check if the relationship types are correct then constructs a contribution link .
// Not Evolving Link // Evolving Link