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


Java TLong类代码示例

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


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

示例1: process

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
@Override
public void process(Tuple tuple, ActionContext context,
		ActionOutput actionOutput) throws Exception {
	if (!sumMode) {
		// Ask the iterator to do an estimation
		TripleIterator itr = (TripleIterator) context.getInputIterator();
		long card = itr.estimateRecords();
		actionOutput.output(new TInt(id), new TLong(card));
		itr.stopReading();
		sumModeEmitted = true;
	} else {
		count += ((TLong) tuple.get(1)).getValue();
		if (count > Integer.MAX_VALUE) {
			count = Integer.MAX_VALUE;
		}
	}

}
 
开发者ID:jrbn,项目名称:querypie,代码行数:19,代码来源:EstimateCardinality.java

示例2: main

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
if (args.length == 0 || args[0].equals("--help")) {
    System.out.println("Usage: term [-d dictionaryHost]");
    return;
}

String term = args[0];
Query q = new Query();
q.dictionaryHost = "localhost";

TLong[] req = new TLong[1];
req[0] = new TLong();
req[0].setValue(Long.valueOf(term));
String[] res = q.getText(req);
for (String r : res) {
    System.out.println(r);
}
   }
 
开发者ID:jrbn,项目名称:querypie,代码行数:19,代码来源:QueryDict.java

示例3: isSatisfiedBy

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
public boolean isSatisfiedBy(StreamTuple tuple) {
  SimpleData tupleSimpleDataValue = tuple.getValueFor(name);
  if (tupleSimpleDataValue == null) return false;
  switch (type) {
  case NUMERIC:
    long tupleNumVal = 0;
    if (tupleSimpleDataValue instanceof TInt) {
      tupleNumVal = ((TInt) tupleSimpleDataValue).getValue();
    } else if (tupleSimpleDataValue instanceof TLong) {
      tupleNumVal = ((TLong) tupleSimpleDataValue).getValue();
    } else {
      return false;
    }
    return (op == Op.EQ && tupleNumVal == numericVal) || (op == Op.GT && tupleNumVal > numericVal) || (op == Op.LT && tupleNumVal < numericVal) || (op == Op.DF && tupleNumVal != numericVal);
  case STRING:
    if (!(tupleSimpleDataValue instanceof TString)) return false;
    String tupleStringVal = ((TString) tupleSimpleDataValue).getValue();
    return (op == Op.EQ && tupleStringVal.equals(stringValue)) || (op == Op.PF && tupleStringVal.startsWith(stringValue)) || (op == Op.IN && tupleStringVal.contains(stringValue)) || (op == Op.DF && !tupleStringVal.equals(stringValue));
  }
  return false;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:22,代码来源:Constraint.java

示例4: getSize

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的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

示例5: encodeTuple

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的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

示例6: getAggrValue

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
TLong getAggrValue() {
  switch (function) {
  case MIN:
    return new TLong(min);
  case MAX:
    return new TLong(max);
  case COUNT:
    return new TLong(tuples.size());
  case AVG:
    return tuples.isEmpty() ? new TLong(0) : new TLong(sum / tuples.size());
  case SUM:
    return new TLong(sum);
  default:
    return new TLong(0);
  }
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:17,代码来源:AggregateHelper.java

示例7: isSatisfiedBy

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
boolean isSatisfiedBy(Tuple tuple) {
  if (position == -1) return false;
  SimpleData tupleSimpleDataValue = tuple.get(position);
  switch (type) {
  case NUMERIC:
    long tupleNumVal = 0;
    if (tupleSimpleDataValue instanceof TInt) {
      tupleNumVal = ((TInt) tupleSimpleDataValue).getValue();
    } else if (tupleSimpleDataValue instanceof TLong) {
      tupleNumVal = ((TLong) tupleSimpleDataValue).getValue();
    } else {
      return false;
    }
    return (op == Op.EQ && tupleNumVal == numericVal) || (op == Op.GT && tupleNumVal > numericVal) || (op == Op.LT && tupleNumVal < numericVal) || (op == Op.DF && tupleNumVal != numericVal);
  case STRING:
    if (!(tupleSimpleDataValue instanceof TString)) return false;
    String tupleStringVal = ((TString) tupleSimpleDataValue).getValue();
    return (op == Op.EQ && tupleStringVal.equals(stringValue)) || (op == Op.PF && tupleStringVal.startsWith(stringValue)) || (op == Op.IN && tupleStringVal.contains(stringValue)) || (op == Op.DF && !tupleStringVal.equals(stringValue));
  }
  return false;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:22,代码来源:FilterHelper.java

示例8: push

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
@Override
public List<Tuple> push(Tuple tuple) {
  int channelId = getChannelId(tuple);
  initSupportVariables(tuple, channelId);

  int attrPosInTuple = (channelId == channelId1) ? attrPos1 : attrPos2;
  Queue<Tuple> queue = (channelId == channelId1) ? queue1 : queue2;
  Map<Long, List<Tuple>> map = (channelId == channelId1) ? map1 : map2;
  Map<Long, List<Tuple>> mapToJoin = (channelId == channelId1) ? map2 : map1;

  SimpleData value = tuple.get(attrPosInTuple);
  long numValue = (value instanceof TInt) ? ((TInt) value).getValue() : ((TLong) value).getValue();

  addTuple(tuple, queue, map, attrPosInTuple, numValue);

  return joinTuples(channelId, tuple, mapToJoin, numValue);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:18,代码来源:WindowJoinHelper.java

示例9: addTuple

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
private void addTuple(Tuple tuple, Queue<Tuple> queue, Map<Long, List<Tuple>> map, int pos, long tupleVal) {
  while (queue.size() >= size) {
    Tuple t = queue.remove();
    SimpleData data = t.get(pos);
    long val = (data instanceof TInt) ? ((TInt) data).getValue() : ((TLong) data).getValue();
    List<Tuple> storedTuple = map.get(val);
    storedTuple.remove(t);
    if (storedTuple.isEmpty()) {
      map.remove(val);
    }
  }
  List<Tuple> list = map.get(tupleVal);
  if (list == null) {
    list = new ArrayList<Tuple>();
    map.put(tupleVal, list);
  }
  list.add(tuple);
  queue.add(tuple);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:20,代码来源:WindowJoinHelper.java

示例10: joinTuples

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
private List<Tuple> joinTuples(Tuple tuple, int channelId) {
  if (first1 || first2) return null;

  int attrPosInTuple = (channelId == channelId1) ? attrPos2 : attrPos1;
  SimpleData value = tuple.get(attrPosInTuple);
  long numValue = (value instanceof TInt) ? ((TInt) value).getValue() : ((TLong) value).getValue();

  // Remove tuples that are too old to join and determine the tuples to join
  List<Tuple> tuplesToJoin = null;
  if (channelId == channelId1) {
    removeOldTuplesFrom(channelId2, numValue);
    tuplesToJoin = map2.get(numValue);
  } else {
    removeOldTuplesFrom(channelId1, numValue);
    tuplesToJoin = map1.get(numValue);
  }
  if (tuplesToJoin == null) return null;

  // Perform join and return results
  List<Tuple> results = new ArrayList<Tuple>();
  for (Tuple tupleToJoin : tuplesToJoin) {
    Tuple result = (channelId == channelId1) ? join(tupleToJoin, tuple) : join(tuple, tupleToJoin);
    results.add(result);
  }
  return results;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:27,代码来源:AuroraJoinHelper.java

示例11: getTuple

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的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

示例12: process

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
@Override
public void process(Tuple inputTuple, ActionContext context,
		ActionOutput output) throws Exception {
	TByte index = (TByte) inputTuple.get(0);
	actualCounter++;

	if (actualIndexValue != index.getValue()) {
		partitions.add(actualIndexValue, actualIndexPartition
				.toArray(new TLong[actualIndexPartition.size()][]));
		actualCounter = 0;
		actualIndexPartition = new ArrayList<TLong[]>();
		actualIndexValue = index.getValue();
	} else {
		if (actualCounter > triplesPerPartition
				&& actualIndexPartition.size() < numberPartitions - 1) {
			TLong[] newTriple = { new TLong(), new TLong(), new TLong() };
			((TLong) inputTuple.get(1)).copyTo(newTriple[0]);
			((TLong) inputTuple.get(2)).copyTo(newTriple[1]);
			((TLong) inputTuple.get(3)).copyTo(newTriple[2]);
			actualIndexPartition.add(newTriple);
			actualCounter = 0;
		}
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:25,代码来源:ConstructPartitionTable.java

示例13: process

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void process(Tuple inputTuple, ActionContext context,
		ActionOutput output) throws Exception {
	if (!checked) {
		commonValues = (Set<Long>) context
				.getObjectFromCache("popularURIs");
		checked = true;
	}

	if (commonValues != null) {
		TLong numberValue = (TLong) inputTuple.get(0);
		if (commonValues.contains(numberValue.getValue())) {
			output.output(inputTuple);
		}
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:18,代码来源:ExtractTextFromPopularURIs.java

示例14: process

import nl.vu.cs.ajira.data.types.TLong; //导入依赖的package包/类
@Override
public void process(Tuple inputTuple, ActionContext context,
		ActionOutput output) throws Exception {
	// Read the triple
	triple[0] = (TLong) inputTuple.get(0);
	triple[1] = (TLong) inputTuple.get(1);
	triple[2] = (TLong) inputTuple.get(2);

	if (!predefinedValues.containsKey(triple[0].getValue())) {
		inputTuple.set(triple[0]);
		output.output(inputTuple);
	}

	if (!predefinedValues.containsKey(triple[1].getValue())) {
		inputTuple.set(triple[1]);
		output.output(inputTuple);
	}

	if (!predefinedValues.containsKey(triple[2].getValue())) {
		inputTuple.set(triple[2]);
		output.output(inputTuple);
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:24,代码来源:DeconstructSampleTriples.java

示例15: process

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

	TLong uri = (TLong) inputTuple.get(0);

	if (currentURI == -1) {
		currentURI = uri.getValue();
	} else {
		if (uri.getValue() != currentURI) {
			if (counter >= samplingThreshold) {
				popularURIs.add(currentURI);
			}
			counter = 0;
			currentURI = uri.getValue();
		}
	}

	// Count the popular URIs
	counter++;
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:22,代码来源:ProcessCommonURIs.java


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