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


Java Pointer.allocateInt方法代码示例

本文整理汇总了Java中org.bridj.Pointer.allocateInt方法的典型用法代码示例。如果您正苦于以下问题:Java Pointer.allocateInt方法的具体用法?Java Pointer.allocateInt怎么用?Java Pointer.allocateInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bridj.Pointer的用法示例。


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

示例1: solve

import org.bridj.Pointer; //导入方法依赖的package包/类
private static boolean solve(Pointer<Pointer<clingo_control>> ctrl) {
    Pointer<Integer> result = Pointer.allocateInt();
    Pointer<Pointer<clingo_solve_handle>> handle = Pointer.allocatePointer(clingo_solve_handle.class);
    Pointer<Pointer<clingo_model>> model = Pointer.allocatePointer(clingo_model.class);

    // get a solve handle        
    if (!LIB.clingo_control_solve(ctrl.get(), (int) clingo_solve_mode.clingo_solve_mode_yield.value, null, 0, null, null, handle)) {
        error(ctrl, "Error execute control solve");
    }

    // loop over all models
    boolean run = true;
    while (run) {

        if (!LIB.clingo_solve_handle_resume(handle.get())) {
            error(ctrl, "Error solve handle resume");
        }
        if (!LIB.clingo_solve_handle_model(handle.get(), model)) {
            error(ctrl, "Error solve handle model");
        }

        // print the model
        if (model.get() != null) {
            printModel(ctrl, model);
        } else {
            // stop if there are no more models
            run = false;
        }
    }

    // close the solve handle
    if (!LIB.clingo_solve_handle_get(handle.get(), result)) {
        error(ctrl, "Error solve handle get");
    }

    return LIB.clingo_solve_handle_close(handle.get());
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:38,代码来源:ControlTest.java

示例2: getVersion

import org.bridj.Pointer; //导入方法依赖的package包/类
public String getVersion() {
    Pointer<Integer> major = Pointer.allocateInt();
    Pointer<Integer> minor = Pointer.allocateInt();
    Pointer<Integer> revision = Pointer.allocateInt();
    LIB.clingo_version(major, minor, revision);
    return "" + major.getInt() + "." + minor.getInt() + "." + revision.getInt();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:8,代码来源:Clingo.java

示例3: getConfiguration

import org.bridj.Pointer; //导入方法依赖的package包/类
public Configuration getConfiguration() throws ClingoException {
    Pointer<Pointer<clingo_configuration>> config = Pointer.allocatePointer(clingo_configuration.class);
    handleError(LIB.clingo_control_configuration(pointer, config), "Error reading the configuration!");
    Pointer<Integer> key = Pointer.allocateInt();
    handleError(LIB.clingo_configuration_root(config.get(), key), "Error reading the configuration root key!");
    return new Configuration(config.get(), key.getInt());
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:8,代码来源:Clingo.java

示例4: getConditionId

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getConditionId() throws ClingoException {
    Pointer<Integer> ret = Pointer.allocateInt();
    handleError(LIB.clingo_theory_atoms_element_condition_id(pointer, id, ret), "Error reading the theory element condition id!");
    return ret.get();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:TheoryElement.java

示例5: getNumber

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getNumber() throws ClingoException {
    Pointer<Integer> number = Pointer.allocateInt();
    handleError(LIB.clingo_symbol_number(structObject, number), "Error reading the symbol number!");
    return number.get();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Symbol.java

示例6: getType

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getType() throws ClingoException {
    Pointer<Integer> tmp = Pointer.allocateInt();
    handleError(LIB.clingo_configuration_type(pointer, key, tmp), "Error reading the configuration type!");
    return tmp.getInt();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Configuration.java

示例7: addAtom

import org.bridj.Pointer; //导入方法依赖的package包/类
public int addAtom() throws ClingoException {
    Pointer<Integer> ret = Pointer.allocateInt();
    handleError(LIB.clingo_backend_add_atom(pointer, ret), "Error add the atom to the backend!");
    return ret.getInt();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Backend.java

示例8: getLevel

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getLevel(int lit) throws ClingoException {
    Pointer<Integer> ret = Pointer.allocateInt();
    handleError(LIB.clingo_assignment_level(pointer, lit, ret), "Error reading the assignment level!");
    return ret.getInt();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Assignment.java

示例9: getDecision

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getDecision(int level) throws ClingoException {
    Pointer<Integer> ret = Pointer.allocateInt();
    handleError(LIB.clingo_assignment_decision(pointer, level, ret), "Error reading the assignment decision!");
    return ret.getInt();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Assignment.java

示例10: getType

import org.bridj.Pointer; //导入方法依赖的package包/类
public StatisticsType getType() throws ClingoException {
    Pointer<Integer> value = Pointer.allocateInt();
    handleError(LIB.clingo_statistics_type(pointer, key, value), "Error reading the statistric type!");
    return EnumValue.valueOfInt(StatisticsType.class, value.getInt());
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Statistics.java

示例11: get

import org.bridj.Pointer; //导入方法依赖的package包/类
@Override
public Configuration get(int index) {
    Pointer<Integer> subkey = Pointer.allocateInt();
    handleRuntimeError(LIB.clingo_configuration_array_at(pointer, key, index, subkey), "Error reading the configuration item in array at " + index + " position!");
    return new Configuration(pointer, subkey.getInt());
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:7,代码来源:ConfigurationList.java

示例12: getType

import org.bridj.Pointer; //导入方法依赖的package包/类
public ModelType getType() throws ClingoException {
    Pointer<Integer> type = Pointer.allocateInt();
    handleError(LIB.clingo_model_type(pointer, type), "Error reading the model type");
    return EnumValue.valueOfInt(ModelType.class, type.get());
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Model.java

示例13: getThreadId

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getThreadId() throws ClingoException {
    Pointer<Integer> ret = Pointer.allocateInt();
    handleError(LIB.clingo_model_thread_id(pointer, ret), "Error reading the model thread id!");
    return ret.get();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:Model.java

示例14: addLiteral

import org.bridj.Pointer; //导入方法依赖的package包/类
public int addLiteral() throws ClingoException {
    Pointer<Integer> ret = Pointer.allocateInt();
    handleError(LIB.clingo_propagate_control_add_literal(pointer, ret), "Error add the literal to the propagate control!");
    return ret.getInt();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:PropagateControl.java

示例15: getLiteral

import org.bridj.Pointer; //导入方法依赖的package包/类
public int getLiteral() throws ClingoException {
    Pointer<Integer> literal = Pointer.allocateInt();
    handleError(LIB.clingo_symbolic_atoms_literal(pointer, iterator, literal), "Error reading the atoms litral!");
    return literal.get();
}
 
开发者ID:lorislab,项目名称:clingo4j,代码行数:6,代码来源:SymbolicAtom.java


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