本文整理汇总了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());
}
示例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();
}
示例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());
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
示例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();
}
示例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();
}
示例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();
}