Commit d9b6b3a4 authored by Sudeep Kanav's avatar Sudeep Kanav
Browse files

deleted ContractUtils

parent 3688626d
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.specification.utils;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.getFirstConstrained;
import org.fortiss.af3.ocra.model.contract.ContractContainer;
import org.fortiss.af3.specification.constraint.ContractConstraint;
import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
import org.fortiss.tooling.kernel.service.IConstraintService;
/**
* Utility class for the contract analysis.
*
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 86947B062798D036B02399A8B305911E
*/
public class ContractUtils {
/** Returns the constraint instance for a contract. */
public static ConstraintInstance getConstraintInstance(ContractContainer tl) {
String tlCstrName = IConstraintService.getInstance().getName(ContractConstraint.class);
for(ConstraintInstance ci : tl.getConstraintInstances()) {
if(tlCstrName.equals(ci.getConstraintName())) {
// The component might be null if the method is called during
// construction/destruction.
if(getFirstConstrained(ci) != null) {
return ci;
}
}
}
return null;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment