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


Java TBoolean类代码示例

本文整理汇总了Java中nl.vu.cs.ajira.data.types.TBoolean的典型用法代码示例。如果您正苦于以下问题:Java TBoolean类的具体用法?Java TBoolean怎么用?Java TBoolean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: process

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
@Override
public void process(Tuple inputTuple, ActionContext context,
		ActionOutput output) throws Exception {

	long a = ((RDFTerm) inputTuple.get(0)).getValue();
	long b = ((RDFTerm) inputTuple.get(1)).getValue();
	long c = ((RDFTerm) inputTuple.get(2)).getValue();

	if (!isUpdated && ((TBoolean) inputTuple.get(3)).getValue()) {
		isUpdated = true;
	}

	if (input == null
			|| !input.containsTriple(a, b, c)) {

		buffer.add(a, b, c);
		output.output(inputTuple);
		if (isUpdated) {
			((Tree) context.getObjectFromCache("tree")).getQuery(
					queryId).setUpdated();
		}
	}
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:24,代码来源:AddIntermediateTriples.java

示例2: getSize

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
private static final int getSize(Tuple tuple) {
  int count = 1; // One byte for the number of elements
  for (int i = 0; i < tuple.getNElements(); i++) {
    SimpleData val = tuple.get(i);
    if (val instanceof TString) {
      count += getSize((TString) val);
    } else if (val instanceof TInt) {
      count += getSize((TInt) val);
    } else if (val instanceof TLong) {
      count += getSize((TLong) val);
    } else if (val instanceof TBoolean) {
      count += getSize((TBoolean) val);
    }
  }
  return count;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:17,代码来源:TupleSerializer.java

示例3: encodeTuple

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public static final byte[] encodeTuple(Tuple tuple) {
  int size = getSize(tuple);
  int numElements = tuple.getNElements();
  int start = 0;
  byte[] bytes = new byte[size];
  bytes[start++] = (byte) numElements;
  for (int i = 0; i < numElements; i++) {
    SimpleData val = tuple.get(i);
    if (val instanceof TInt) {
      start = encodeInt(bytes, start, (TInt) val);
    } else if (val instanceof TLong) {
      start = encodeLong(bytes, start, (TLong) val);
    } else if (val instanceof TString) {
      start = encodeString(bytes, start, (TString) val);
    } else if (val instanceof TBoolean) {
      start = encodeBoolean(bytes, start, (TBoolean) val);
    }
  }
  return bytes;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:21,代码来源:TupleSerializer.java

示例4: getTuple

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public void getTuple(Tuple tuple) {
  SimpleData[] content = new SimpleData[data.size() * 2];
  int pos = 0;
  for (String name : data.keySet()) {
    content[pos++] = new TString(name);
    NetworkTupleValue value = data.get(name);
    switch (value.getType()) {
    case STRING:
      content[pos++] = new TString(value.getStringVal());
      break;
    case INT:
      content[pos++] = new TInt(value.getIntVal());
      break;
    case LONG:
      content[pos++] = new TLong(value.getLongVal());
      break;
    case BOOLEAN:
      content[pos++] = new TBoolean(value.getBooleanVal());
      break;
    }
  }
  tuple.set(content);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:24,代码来源:NetworkTuple.java

示例5: process

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
@Override
public void process(Tuple tuple, ActionContext context,
		ActionOutput actionOutput) throws Exception {
	boolean derived = ((TBoolean) tuple.get(3)).getValue();
	if ((!derived && !filter)
			|| outputContainer.addTriple((RDFTerm) tuple.get(0),
					(RDFTerm) tuple.get(1), (RDFTerm) tuple.get(2),
					existingDerivation)) {
		actionOutput.output(tuple);
	}
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:12,代码来源:QSQEvaluateQuery.java

示例6: applyTo

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public static void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		boolean explicit, int typeRules, long iteration,
		ActionSequence actions) throws ActionNotConfiguredException {

	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	c = ActionFactory.getActionConf(ExpandQuery.class);
	c.setParamBoolean(ExpandQuery.B_EXPLICIT, explicit);
	c.setParamInt(ExpandQuery.I_TYPE_RULES, typeRules);
	actions.add(c);

	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName(), TBoolean.class.getName());
	c.setParamBoolean(CollectToNode.B_SORT, true);
	actions.add(c);

	actions.add(ActionFactory.getActionConf(RemoveDuplicates.class));

	c = ActionFactory.getActionConf(OptimalBCAlgo.class);
	c.setParamLong(OptimalBCAlgo.L_FIELD1, v1.getValue());
	c.setParamLong(OptimalBCAlgo.L_FIELD2, v2.getValue());
	c.setParamLong(OptimalBCAlgo.L_FIELD3, v3.getValue());
	c.setParamBoolean(OptimalBCAlgo.B_EXPLICIT, explicit);
	c.setParamLong(OptimalBCAlgo.L_ITERATION, iteration);
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:36,代码来源:OptimalBCAlgo.java

示例7: applyTo

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public static ActionSequence applyTo(ActionContext context, Tuple tuple,
		ActionSequence chain) throws ActionNotConfiguredException {
	boolean incomplete = false;
	if (tuple != null && tuple.getNElements() > 0) {
		incomplete = ((TBoolean) tuple.get(0)).getValue();
	}
	ActionConf c = ActionFactory.getActionConf(CalculateClosure.class);
	c.setParamInt(I_CURRENT_QUERY, -1);
	c.setParamBoolean(B_NEW_DERIVED, false);
	c.setParamInt(I_CURRENT_ITERATION, 0);
	c.setParamBoolean(B_WRITE_TO_DISK, false);
	c.setParamBoolean(B_INCOMPLETE, incomplete);
	chain.add(c);
	return chain;
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:16,代码来源:CalculateClosure.java

示例8: applyTo

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public static void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		boolean explicit, ActionSequence actions)
				throws ActionNotConfiguredException {

	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	c = ActionFactory.getActionConf(ExpandQuery.class);
	c.setParamBoolean(ExpandQuery.B_EXPLICIT, explicit);
	c.setParamBoolean(ExpandQuery.B_FORCERESTART, true);
	actions.add(c);

	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName(), TBoolean.class.getName());
	actions.add(c);

	// AddIntermediateTriples.applyTo(v1.getValue(), v2.getValue(),
	// v3.getValue(), actions);

	c = ActionFactory.getActionConf(RuleBCAlgo.class);
	c.setParamLong(L_FIELD1, v1.getValue());
	c.setParamLong(L_FIELD2, v2.getValue());
	c.setParamLong(L_FIELD3, v3.getValue());
	c.setParamBoolean(B_EXPLICIT, explicit);
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:35,代码来源:RuleBCAlgo.java

示例9: applyTo

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public static final void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		int posSet, long nameSet, ActionSequence actions)
				throws ActionNotConfiguredException {

	// Get the query
	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	// Expand it in incremental fashion
	c = ActionFactory.getActionConf(ExpandQuery.class);
	c.setParamBoolean(ExpandQuery.B_EXPLICIT, true);
	c.setParamInt(ExpandQuery.I_TYPE_RULES, TreeExpander.ONLY_FIRST_SECOND);
	c.setParamBoolean(ExpandQuery.B_ALLOWRECURSION, false);
	actions.add(c);

	// Collect to node
	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName(), TBoolean.class.getName());
	actions.add(c);

	// Check whether we should repeat the process
	c = ActionFactory.getActionConf(IncrRuleBCAlgo.class);
	c.setParamLong(L_NAMESET, nameSet);
	c.setParamInt(I_POSSET, posSet);
	c.setParamLong(L_FIELD1, v1.getValue());
	c.setParamLong(L_FIELD2, v2.getValue());
	c.setParamLong(L_FIELD3, v3.getValue());
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:38,代码来源:IncrRuleBCAlgo.java

示例10: compare

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
private int compare(Tuple tuple1, Tuple tuple2) {
  SimpleData first = ordering == Ordering.ASCENDING ? tuple1.get(position) : tuple2.get(position);
  SimpleData second = ordering == Ordering.ASCENDING ? tuple2.get(position) : tuple1.get(position);
  if (first instanceof TInt) {
    return ((TInt) first).compareTo(second);
  } else if (first instanceof TLong) {
    return ((TLong) first).compareTo(second);
  } else if (first instanceof TString) {
    return ((TString) first).compareTo(second);
  } else if (first instanceof TBoolean) {
    return ((TBoolean) first).compareTo(second);
  } else {
    return first.compareTo(second);
  }
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:16,代码来源:SortHelper.java

示例11: groupBy

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
private static void groupBy(ActionSequence actions)
		throws ActionNotConfiguredException {
	ActionConf c = ActionFactory.getActionConf(GroupBy.class);
	c.setParamByteArray(GroupBy.BA_FIELDS_TO_GROUP, (byte) 0);
	c.setParamStringArray(GroupBy.SA_TUPLE_FIELDS,
			TByteArray.class.getName(), TBoolean.class.getName(),
			TByte.class.getName(), TLong.class.getName());
	c.setParamInt(GroupBy.I_NPARTITIONS_PER_NODE,
			nl.vu.cs.dynamite.reasoner.support.Consts.GROUP_BY_NUM_THREADS);
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:12,代码来源:ActionsHelper.java

示例12: RuleExecutor1

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
public RuleExecutor1() {
	inferredTriple[0] = triple[0];
	inferredTriple[1] = triple[1];
	inferredTriple[2] = triple[2];
	inferredTriple[3] = new TBoolean(true);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:7,代码来源:RuleExecutor1.java

示例13: getBoolean

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
private static final TBoolean getBoolean(byte[] bytes, int start) {
  return new TBoolean(bytes[start] == 0);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:4,代码来源:TupleSerializer.java

示例14: encodeBoolean

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
private static final int encodeBoolean(byte[] bytes, int start, TBoolean value) {
  return encodeBoolean(bytes, start, value.getValue());
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:4,代码来源:TupleSerializer.java

示例15: process

import nl.vu.cs.ajira.data.types.TBoolean; //导入依赖的package包/类
@Override
public void process(Tuple tuple, ActionContext context,
		ActionOutput actionOutput) throws Exception {
	duplicates.clear();
	TByteArray key = (TByteArray) tuple.get(0);

	// Perform the join between the "value" part of the triple and the
	// pre-computed tuples. Notice that this works only if there is one
	// element to join.
	TBag values = (TBag) tuple.get(tuple.getNElements() - 1);

	int currentRule = -1;
	long currentJoinValue = -1;
	for (Tuple t : values) {
		TBoolean valid = (TBoolean) t.get(0);
		TByte rule = (TByte) t.get(1);
		TLong elementToJoin = (TLong) t.get(2);

		if (currentRule != rule.getValue()) {
			currentRule = rule.getValue();
			// First copy the "key" in the output triple.
			for (int i = 0; i < pos_gen_head[currentRule].length; ++i) {
				((TLong) outputTuples[currentRule][pos_gen_head[currentRule][i][1]])
						.setValue(Utils.decodeLong(key.getArray(), 8 * i));
			}
		}

		currentJoinValue = elementToJoin.getValue();
		Collection<Row> set = precompTuples[currentRule].get(
				pos_gen_precomps[currentRule][0][1], currentJoinValue);
		if (set != null) {
			for (Row row : set) {
				if (log.isTraceEnabled()) {
					long k = Utils.decodeLong(key.getArray(), 0);
					log.trace("Rule " + currentRule
							+ " can derive the triple "
							+ outputTuples[currentRule][0] + " "
							+ outputTuples[currentRule][1] + " "
							+ outputTuples[currentRule][2] + " JP="
							+ elementToJoin.getValue() + " SS="
							+ set.size() + " currentStep=" + row.getStep()
							+ " minStep=" + minimumStep + " valid="
							+ valid.getValue() + " key=" + k + " kl="
							+ key.getArray().length);
				}

				// Only if the step is ok
				if (!valid.getValue() && row.getStep() < minimumStep) {
					continue;
				}
				// Get current values
				for (int i = 0; i < pos_head_precomps[currentRule].length; ++i) {
					((TLong) outputTuples[currentRule][pos_head_precomps[currentRule][i][0]])
							.setValue(row.getValue(
									pos_head_precomps[currentRule][i][1])
									.getValue());
				}
				supportTuple.set(outputTuples[currentRule]);

				if (isUsingCount || duplicates.add(supportTuple)) {
					supportTuple = TupleFactory.newTuple();
					actionOutput.output(outputTuples[currentRule]);
					counters[currentRule]++;

					if (log.isTraceEnabled()) {
						log.trace("Rule " + currentRule
								+ " has derived the triple "
								+ outputTuples[currentRule][0] + " "
								+ outputTuples[currentRule][1] + " "
								+ outputTuples[currentRule][2] + " JP="
								+ elementToJoin.getValue());
					}
				}
			}
		}
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:78,代码来源:PrecompGenericReduce.java


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