当前位置: 首页>>代码示例>>Java>>正文


Java IDatatype类代码示例

本文整理汇总了Java中net.ssehub.easy.varModel.model.datatypes.IDatatype的典型用法代码示例。如果您正苦于以下问题:Java IDatatype类的具体用法?Java IDatatype怎么用?Java IDatatype使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IDatatype类属于net.ssehub.easy.varModel.model.datatypes包,在下文中一共展示了IDatatype类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findCharacterizer

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Finds the frozen state prefix for <code>type</code>, also taking refined types into account.
 * 
 * @param type the type
 * @return the prefix (may be <b>null</b> if there is none)
 */
public static final TypeCharacterizer findCharacterizer(IDatatype type) {
    TypeCharacterizer result = null;
    do {
        result = TYPE_PREFIX.get(type.getName());
        if (null == result) {
            if (type instanceof Compound) {
                Compound cType = (Compound) type;
                if (cType.getRefinesCount() > 0) {
                    type = cType.getRefines(0); // legacy, consider just the first
                } else {
                    type = null;
                }
            } else if (type instanceof Reference) {
                type = Reference.dereference(type);
            } else {
                // Not handled by the TypeMapper -> stop loop
                type = null;
            }
        }
    } while (null == result && null != type);
    return result;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:29,代码来源:TypeMapper.java

示例2: createStreams

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Creates the streams for <code>common</code>.
 * 
 * @param procs already known processors
 * @param originName the name of the origin processor
 * @param common the common instance to create streams for
 * @param cfg configuration
 * @param hwAlgType the hardware algorithm type
 * @param mapping the name mapping
 */
private static void createStreams(Map<String, StormProcessor> procs, String originName, 
    ComponentCommon common, Configuration cfg, IDatatype hwAlgType, INameMapping mapping) {
    StormProcessor target = getProcessor(procs, originName);
    if (null != target) {
        for (Map.Entry<GlobalStreamId, Grouping> grouping : common.get_inputs().entrySet()) {
            GlobalStreamId id = grouping.getKey();
            StormProcessor origin = getProcessor(procs, mapName(mapping, id.get_componentId()));
            if (null != origin) {
                if (!leaveOutConnection(mapping, origin, cfg, hwAlgType) && !origin.hasOutputTo(target)) {
                    Stream stream = new Stream(id.get_streamId(), origin, target);
                    origin.addOutput(stream);
                    target.addInput(stream);
                }
            }
        }
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:28,代码来源:Utils.java

示例3: getCompoundNameAndType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Returns a map which key is the variable name, value is the variable type.
 * 
 * @param decisionDeclaration
 *            the compound decisionVariable
 * @return a map with variableName and variableType
 */
public static Map<String, IDatatype> getCompoundNameAndType(AbstractVariable decisionDeclaration) {

    String compoundName = null;
    Map<String, IDatatype> map = new HashMap<String, IDatatype>();
    Compound compoundType = (Compound) decisionDeclaration.getType();
    for (int i = 0; i < compoundType.getInheritedElementCount(); i++) {
        DecisionVariableDeclaration nestedDecl = compoundType.getInheritedElement(i);
        compoundName = nestedDecl.getName();
        IDatatype type = nestedDecl.getType();
        if (type instanceof Reference) {
            Reference refType = (Reference) type;
            map.put(compoundName, refType);
        } else {
            map.put(compoundName, type);

        }
    }
    return map;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:27,代码来源:BasicIVMLModelOperations.java

示例4: isSavingEnabled

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
@Override
protected boolean isSavingEnabled(Project destProject, IDecisionVariable var) {
    // avoid that all imported config is saved over and over again
    // role separation
    boolean enabled;
    AbstractVariable decl = var.getDeclaration();
    IDatatype type = decl.getType();
    // QualiMaster convention
    if (ConstraintType.isConstraint(type)) {
        enabled = false;
    } else if (var.getParent() instanceof Configuration) {
        String decisionNamespace = var.getDeclaration().getNameSpace();
        String dstProjectNamespace = destProject.getName();
        enabled = dstProjectNamespace.equals(decisionNamespace);

        if (!enabled && dstProjectNamespace.endsWith(QmConstants.CFG_POSTFIX)) {
            String defProjectNamespace = dstProjectNamespace.substring(0, 
                dstProjectNamespace.length() - QmConstants.CFG_POSTFIX.length());
            enabled = defProjectNamespace.equals(decisionNamespace);
        }
    } else {
        enabled = true;
    }
    return enabled;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:26,代码来源:QualiMasterConfigurationSaver.java

示例5: createVariableMapping

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Creates a runtime variable mapping for <code>configuration</code>.
 * 
 * @param config the configuration
 * @return the runtime variable mapping
 * @throws ModelQueryException in case of problems accessing model elements
 */
@Invisible
public static RuntimeVariableMapping createVariableMapping(
    net.ssehub.easy.varModel.confModel.Configuration config) throws ModelQueryException {
    Project project = config.getProject();
    Compound sourceType = findCompound(project, TYPE_SOURCE);
    Compound familyElementType = findCompound(project, TYPE_FAMILYELEMENT);
    Compound sinkType = findCompound(project, TYPE_SINK);
    RuntimeVariableMapping result = new RuntimeVariableMapping();
    Iterator<IDecisionVariable> iter = config.iterator();
    while (iter.hasNext()) {
        IDecisionVariable var = iter.next();
        IDatatype type = var.getDeclaration().getType();
        if (sourceType.isAssignableFrom(type) || sinkType.isAssignableFrom(type)
            || familyElementType.isAssignableFrom(type)) {
            addVariableMapping(var, SLOT_AVAILABLE, result);
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:27,代码来源:ConfigurationInitializer.java

示例6: obtainPipeline

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Returns the pipeline decision for the given pipeline <code>element</code>.
 * 
 * @param configuration the configuration for the lookup
 * @param element the pipeline element (may be <b>null</b>, leads to <b>null</b>)
 * @return the pipeline, may be <b>null</b> if the pipeline was not found
 * @throws ModelQueryException if accessing type information fails
 */
@Invisible
public static IDecisionVariable obtainPipeline(net.ssehub.easy.varModel.confModel.Configuration configuration, 
    IDecisionVariable element) throws ModelQueryException {
    IDecisionVariable result = null;
    if (null != element) {
        AbstractVariable elementDecl = element.getDeclaration();
        IDatatype elementType = elementDecl.getType();
        IModelElement par = elementDecl.getTopLevelParent();
        if (par instanceof Project) {
            Project prj = (Project) par;
            IDatatype pipelineElementType = ModelQuery.findType(prj, QmConstants.TYPE_PIPELINE_ELEMENT, null);
            if (null != pipelineElementType && pipelineElementType.isAssignableFrom(elementType)) {
                IDatatype pipelineType = ModelQuery.findType(prj, QmConstants.TYPE_PIPELINE, null);
                if (null != pipelineType) {
                    result = searchScope(configuration, prj, pipelineType);
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:30,代码来源:PipelineHelper.java

示例7: isHardwareAlgorithm

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Returns whether <code>var</code> is a hardware algorithm.
 * 
 * @param var the variable to check
 * @return <code>true</code> for hardware algorithm, <code>false</code> else
 */
@QMInternal
public static boolean isHardwareAlgorithm(IDecisionVariable var) {
    boolean result = false;
    if (null != var) {
        try {
            IDatatype hwAlgType = ModelQuery.findType(var.getConfiguration().getProject(), 
                QmConstants.TYPE_HARDWARE_ALGORITHM, null);
            if (null != hwAlgType) {
                result = hwAlgType.isAssignableFrom(var.getDeclaration().getType());
            }
        } catch (ModelQueryException e) {
            // -> result = null
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:23,代码来源:PipelineHelper.java

示例8: ContainerInitializer

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Creates a new container initializer. 
 * 
 * @param type the type of the compound
 * @param expressions the initializing expressions (in sequence for containers which support sequences)
 * @throws CSTSemanticException in case that the initialization fails, element type mismatch
 */
public ContainerInitializer(Container type, ConstraintSyntaxTree[] expressions) throws CSTSemanticException {
    this.type = type;
    this.expressions = expressions;
    if (null == expressions) {
        throw new CSTSemanticException("expressions is null", CSTSemanticException.INTERNAL);
    }
    IDatatype containedType = type.getContainedType();
    for (int e = 0; e < expressions.length; e++) {
        IDatatype eType = expressions[e].inferDatatype();
        if (!containedType.isAssignableFrom(eType)) {
            throw new CSTSemanticException("value " + e + " in initializer is of type '" 
                + IvmlDatatypeVisitor.getQualifiedType(eType) + "' but not of expected type '" 
                + IvmlDatatypeVisitor.getQualifiedType(containedType) + "'", CSTSemanticException.TYPE_MISMATCH);
        }
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ContainerInitializer.java

示例9: testCopyDerivedTypeDependingOnDeclaration

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Tests whether a {@link DerivedDatatype}, depending on a declaration can be copied.
 * @throws CSTSemanticException If a boolean equality constraint cannot be created
 */
@Test
public void testCopyDerivedTypeDependingOnDeclaration() throws CSTSemanticException {
    Project original = new Project("testCopyDerivedTypeDependingOnDeclaration");
    IDatatype basisType = BooleanType.TYPE;
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", basisType, original);
    DerivedDatatype dType = new DerivedDatatype("bType", basisType, original);
    Constraint constraint = new Constraint(dType);
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(dType.getTypeDeclaration()), OclKeyWords.EQUALS,
        new Variable(decl));
    constraint.setConsSyntax(equality);
    dType.setConstraints(new Constraint[] {constraint});
    original.add(dType);
    original.add(decl);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copy = copyProject(original, copiedProjects);
    DerivedDatatype copiedType = (DerivedDatatype) copy.getElement(0);
    assertDerivedType(dType, copiedType, copy, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:ProjectCopyVisitorTest.java

示例10: testCopyDerivedType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Tests whether a simple {@link DerivedDatatype} without any dependencies can be copied.
 * @throws CSTSemanticException If <tt>true</tt>  cannot be created as constraint for a boolean type
 */
@Test
public void testCopyDerivedType() throws CSTSemanticException {
    Project original = new Project("testCopyDerivedType");
    IDatatype basisType = BooleanType.TYPE;
    DerivedDatatype dType = new DerivedDatatype("posType", basisType, original);
    Constraint constraint = new Constraint(dType);
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(dType.getTypeDeclaration()), OclKeyWords.EQUALS,
            new ConstantValue(BooleanValue.TRUE));
    constraint.setConsSyntax(equality);
    dType.setConstraints(new Constraint[] {constraint});
    original.add(dType);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copy = copyProject(original, copiedProjects);
    DerivedDatatype copiedType = (DerivedDatatype) copy.getElement(0);
    assertDerivedType(dType, copiedType, copy, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:ProjectCopyVisitorTest.java

示例11: testSimpleConstraintCopy

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Copies a constraint, which has no outstanding dependencies.
 * @throws ValueDoesNotMatchTypeException If String values cannot be created.
 * @throws CSTSemanticException If a string constraint cannot be created
 */
@Test
public void testSimpleConstraintCopy() throws ValueDoesNotMatchTypeException, CSTSemanticException {
    Project original = new Project("testSimpleConstraintCopy");
    IDatatype basisType = StringType.TYPE;
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", basisType, original);
    original.add(decl);
    Constraint constraint = new Constraint(original);
    ConstantValue helloWorldVal = new ConstantValue(ValueFactory.createValue(basisType, "Hello World"));
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(decl), OclKeyWords.EQUALS, helloWorldVal);
    constraint.setConsSyntax(equality);
    original.add(constraint);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copy = copyProject(original, copiedProjects);
    Constraint copiedConstraint = (Constraint) copy.getElement(1);
    assertConstraint(constraint, copiedConstraint, copy, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:ProjectCopyVisitorTest.java

示例12: inferType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Returns the IVML type for <code>vale</code>.
 * 
 * @param value the value to return the type for
 * @param model the node representing the ECore Xtext model
 * @param cmpDef the containing type definition (may be <b>null</b> for project)
 * @return the inferred type or <b>null</b> if no type is available
 */
private IDatatype inferType(Value value, EObject model, TypedefCompound cmpDef) {
    IDatatype type = null;
    if (null != value.getNValue()) {
        String tmp = value.getNValue().getVal();
        if (tmp.indexOf('.') >= 0) {
            type = RealType.TYPE;
        } else {
            type = IntegerType.TYPE;
        }
    } else if (null != value.getBValue()) {
        type = BooleanType.TYPE;
    } else if (null != value.getSelf()) {
        type = findType(model, cmpDef, null);
    } else if (null != value.getSValue()) {
        type = BooleanType.TYPE;
    } else if (null != value.getVersion()) {
        type = VersionType.TYPE;
    } else if (null != value.getQValue()) {
        String qName = Utils.getQualifiedNameString(value.getQValue());
        type = findType(model, cmpDef, qName);
    } else if (null != value.getNullValue()) {
        type = AnyType.TYPE;
    }
    return type;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:34,代码来源:ExpressionProposalProvider.java

示例13: testIsAssignable

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Tests whether {@link NullValue}s can be assigned to all kind of variables. 
 */
@Test
public void testIsAssignable() {
    int variablesChecked = 0;
    for (IDecisionVariable variable : config) {
        //checkstyle: stop exception type check 
        try {
            variable.setValue(NullValue.INSTANCE, AssignmentState.ASSIGNED);
            variablesChecked++;
        } catch (Exception e) {
            IDatatype type = variable.getDeclaration().getType();
            Assert.fail("Error: Could not assign NullValue to a " + type + " variable.");
        }
        //checkstyle: resume exception type check
    }
    Assert.assertEquals("Error: More or less variables were tested than expected.", nOfVariables, variablesChecked);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:20,代码来源:NullValueTest.java

示例14: determineReturnType

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Determines the VIL/VTL return type for the given IVML <code>type</code>.
 * @param type the IVML type
 * @param registry the actual type registry (may be <b>null</b>, result is 
 *   then {@link IvmlTypes#decisionVariableType()}
 * @param specific resolve for the specific IVML type or for IVML specific dynamic type descriptors
 * @return the return type
 * @throws VilException in case that creating the type fails
 */
protected static TypeDescriptor<?> determineReturnType(IDatatype type, TypeRegistry registry, boolean specific) 
    throws VilException {
    TypeDescriptor<?> result;
    type = DerivedDatatype.resolveToBasis(type);
    if (Set.TYPE.isAssignableFrom(type)) {
        result = TypeRegistry.getSetType(determineGenerics(type, registry, specific));
    } else if (Sequence.TYPE.isAssignableFrom(type)) {
        result = TypeRegistry.getSequenceType(determineGenerics(type, registry, specific));
    } else { // no map in IVML
        result = null;
        if (specific && null != registry) { // typically given
            // TODO move out
            if (!ConstraintType.TYPE.isAssignableFrom(type)) {
                result = registry.getType(Reference.dereference(type));
            }
        }
        if (null == result) {
            result = IvmlTypes.decisionVariableType();
        }
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:32,代码来源:Utils.java

示例15: translateDerivedDatatypeConstraints

import net.ssehub.easy.varModel.model.datatypes.IDatatype; //导入依赖的package包/类
/**
 * Extracts, translates and collects the internal constraints of <code>type</code> and stores them 
 * in {@link #derivedTypeConstraints}.
 * 
 * @param decl VariableDeclaration of <code>DerivedDatatype</code>
 * @param type the type to translate, nothing happens if <code>type</code> is not a {@link DerivedDatatype}
 */
private void translateDerivedDatatypeConstraints(AbstractVariable decl, IDatatype type) {
    if (type instanceof DerivedDatatype) {
        DerivedDatatype dType = (DerivedDatatype) type;
        ConstraintSyntaxTree[] cst = createDerivedDatatypeExpressions(decl, dType);
        if (null != cst) {
            IModelElement topLevelParent = decl.getTopLevelParent();
            for (int c = 0; c < cst.length; c++) {
                // Should be in same project as the declaration belongs to
                try { // derivedTypeConstraints
                    ConstraintSyntaxTree tmp = substituteVariables(cst[c], null);
                    addConstraint(topLevelConstraints, new Constraint(tmp, topLevelParent), true);
                } catch (CSTSemanticException e) {
                    LOGGER.exception(e);
                }
            }
        }
        translateDerivedDatatypeConstraints(decl, dType.getBasisType());
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:27,代码来源:Resolver.java


注:本文中的net.ssehub.easy.varModel.model.datatypes.IDatatype类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。