本文整理了Java中com.addthis.bundle.core.Bundle
类的一些代码示例,展示了Bundle
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle
类的具体详情如下:
包路径:com.addthis.bundle.core.Bundle
类名称:Bundle
暂无
代码示例来源:origin: addthis/hydra
protected void mergeBundles(Bundle orig, Bundle nBundle) {
for (BundleField bf : nBundle) {
orig.setValue(orig.getFormat().getField(bf.getName()), nBundle.getValue(bf));
}
}
代码示例来源:origin: addthis/hydra
private static void compareBundles(Bundle expect, Bundle got) {
for (BundleField field : expect.getFormat()) {
ValueObject v1 = expect.getValue(field);
ValueObject v2 = got.getValue(field);
assertEquals(v1, v2);
}
assertEquals("column count mismatch", expect.getCount(), got.getCount());
}
代码示例来源:origin: addthis/hydra
private static Bundle cloneBundle(Bundle input) {
Bundle output = input.createBundle();
Iterator<BundleField> fieldIterator = input.getFormat().iterator();
while (fieldIterator.hasNext()) {
BundleField field = fieldIterator.next();
output.setValue(field, input.getValue(field));
}
return output;
}
代码示例来源:origin: addthis/hydra
private void estimateRow(Bundle row) {
for (BundleField f : row.getFormat()) {
ValueObject qv = row.getValue(f);
if (qv != null) {
cells++;
}
}
if (memTip > 0) {
estMem += MemoryCounter.estimateSize(row);
}
}
代码示例来源:origin: addthis/hydra
public Bundle createBundle(BundleFactory factory) {
Bundle bundle = factory.createBundle();
for (FieldValue fv : list) {
bundle.setValue(bundle.getFormat().getField(fv.field.getName()), fv.value);
}
return bundle;
}
代码示例来源:origin: addthis/hydra
public boolean updateBundleWithListAppend(Bundle bundle) {
for (FieldValue fv : list) {
ValueObject oldValue = bundle.getValue(fv.field);
ValueArray newValue;
if (oldValue == null) {
newValue = ValueFactory.createArray(1);
} else if (oldValue instanceof ValueArray) {
newValue = (ValueArray) oldValue;
} else {
newValue = ValueFactory.createArray(2);
newValue.add(oldValue);
}
newValue.add(fv.value);
bundle.setValue(fv.field, newValue);
}
return !list.isEmpty();
}
代码示例来源:origin: addthis/hydra
@Override
public void setValue(BundleField field, ValueObject value) throws BundleException {
mergedBundle.setValue(field, value);
}
代码示例来源:origin: addthis/hydra
@Override
public ValueObject getValue(BundleField field) throws BundleException {
return mergedBundle.getValue(field);
}
代码示例来源:origin: addthis/hydra
deckBinder = new BundleColumnBinder(onDeck);
keyColumns = rowBinder.getFields();
valueColumn = row.getFormat().getField(Integer.toString(valueIndex));
freqColumn = row.getFormat().getField(Integer.toString(freqIndex));
boolean eqCol = equalColumnKeys(keyColumns, onDeck, row);
recentFTable.update(ValueUtil.asNumberOrParseLong(row.getValue(valueColumn), 10).asLong().getLong(),
ValueUtil.asNumberOrParseLong(row.getValue(freqColumn), 10).asLong().getLong());
onDeck.removeValue(valueColumn);
onDeck.removeValue(freqColumn);
if (appendTotal) {
deckBinder.appendColumn(onDeck, ValueFactory.create(recentFTable.getTotalEntries()));
if (onDeck != row) {
recentFTable = new FTable();
recentFTable.update(ValueUtil.asNumberOrParseLong(row.getValue(valueColumn), 10).asLong().getLong(),
ValueUtil.asNumberOrParseLong(row.getValue(freqColumn), 10).asLong().getLong());
onDeck.removeValue(valueColumn);
onDeck.removeValue(freqColumn);
if (appendTotal) {
deckBinder.appendColumn(onDeck, ValueFactory.create(recentFTable.getTotalEntries()));
代码示例来源:origin: addthis/hydra
@Override
public BundleFormat getFormat() {
return mergedBundle.getFormat();
}
代码示例来源:origin: addthis/hydra
@Override
public void send(Bundle row) {
ValueArray rowView = row.asValueArray();
ValueObject rowKey = rowView.get(0);
if (columns == null) {
Bundle newrow = format.createBundle();
if (rowcol != null) {
newrow.setValue(rowField, rowKey);
newrow.setValue(colField, col);
if (valcol != null && row.getCount() > pos) {
newrow.setValue(valField, rowView.get(pos));
newrow.setValue(extraField, rowView.get(rowView.size() - 1));
代码示例来源:origin: addthis/hydra
@Override
public void send(Bundle row) throws DataChannelError {
if (sentTitle.compareAndSet(false, true)) {
Bundle title = row.createBundle();
if (header.size() > 0) {
for (Iterator<ValueObject> iter = header.iterator(); iter.hasNext(); ) {
getSourceColumnBinder(row).appendColumn(title, iter.next());
}
} else {
for (BundleField field : row) {
title.setValue(field, ValueFactory.create(field.getName()));
}
}
getNext().send(title);
}
getNext().send(row);
}
代码示例来源:origin: addthis/hydra
@Override
public int getCount() {
return wrap.getCount();
}
代码示例来源:origin: addthis/hydra
@Override
public Bundle createBundle() {
return mergedBundle.createBundle();
}
代码示例来源:origin: addthis/hydra
@Override
public void removeValue(BundleField field) throws BundleException {
wrap.removeValue(field);
}
代码示例来源:origin: addthis/hydra
@Override
public void appendBundleToString(Bundle row, StringBuilder stringBuilder) {
stringBuilder.append("<tr>");
for (BundleField field : row.getFormat()) {
ValueObject o = row.getValue(field);
stringBuilder.append("<td>").append(o).append("</td>");
}
stringBuilder.append("</tr>\n");
}
代码示例来源:origin: addthis/hydra
@Override
public Bundle next() throws IOException {
if (reader.hasNext()) {
JsonObject nextElement = parser.parse(reader).getAsJsonObject();
Bundle next = factory.createBundle();
BundleFormat format = next.getFormat();
for (Map.Entry<String, JsonElement> entry : nextElement.entrySet()) {
next.setValue(format.getField(entry.getKey()), fromGson(entry.getValue()));
}
return next;
} else {
return null;
}
}
};
代码示例来源:origin: addthis/hydra
@Override
public Bundle rowOp(Bundle row) {
Bundle next = new ListBundle(format);
if (mapIn == null) {
mapIn = new BundleColumnBinder(row, fields);
mapOut = new BundleColumnBinder(next, fields);
}
BundleField[] fieldsIn = mapIn.getFields();
BundleField[] fieldsOut = mapOut.getFields();
for (int i = 0; i < fields.length; i++) {
next.setValue(fieldsOut[i], row.getValue(fieldsIn[i]));
}
return next;
}
}
代码示例来源:origin: addthis/hydra
@Override
public void setValue(BundleField field, ValueObject value) throws BundleException {
wrap.setValue(field, value);
}
代码示例来源:origin: addthis/hydra
@Override
public ValueObject getValue(BundleField field) throws BundleException {
return wrap.getValue(field);
}
内容来源于网络,如有侵权,请联系作者删除!