public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }
public int hashCode() { int res = 0; if (signature != null) { for (int i = 0; i < signature.length / 4; i += 4) { res ^= (int)(signature[i] << 24 + signature[i+1] << 16 + signature[i+2] << 8 + signature[i+3]); } } if (metaData != null) { res ^= metaData.entrySet().hashCode(); } return res ^ status ^ ((int)fetchTime) ^ ((int)modifiedTime) ^ retries ^ fetchInterval ^ Float.floatToIntBits(score); }
private boolean metadataEquals(org.apache.hadoop.io.MapWritable otherMetaData) { if (metaData==null || metaData.size() ==0) { return otherMetaData == null || otherMetaData.size() == 0; } if (otherMetaData == null) { // we already know that the current object is not null or empty return false; } HashSet<Entry<Writable, Writable>> set1 = new HashSet<Entry<Writable,Writable>>(metaData.entrySet()); HashSet<Entry<Writable, Writable>> set2 = new HashSet<Entry<Writable,Writable>>(otherMetaData.entrySet()); return set1.equals(set2); }
builder.append(time); for (Map.Entry<Writable, Writable> e : partitionMap.entrySet()) { builder.append(" " + e.getKey() + "="); builder.append(e.getValue().toString());
/** Add all metadata from other CrawlDatum to this CrawlDatum. * * @param other CrawlDatum */ public void putAllMetaData(CrawlDatum other) { for (Entry<Writable, Writable> e : other.getMetaData().entrySet()) { getMetaData().put(e.getKey(), e.getValue()); } }
for (Map.Entry<Writable,Writable> entry : mapWritable.entrySet()) configs.put(entry.getKey().toString(), (org.apache.accumulo.core.client.mapreduce.InputTableConfig) entry.getValue());
public String toString() { StringBuilder buf = new StringBuilder(); buf.append("Version: " + CUR_VERSION + "\n"); buf.append("Status: " + getStatus() + " (" + getStatusName(getStatus()) + ")\n"); buf.append("Fetch time: " + new Date(getFetchTime()) + "\n"); buf.append("Modified time: " + new Date(getModifiedTime()) + "\n"); buf.append("Retries since fetch: " + getRetriesSinceFetch() + "\n"); buf.append("Retry interval: " + getFetchInterval() + " seconds (" + (getFetchInterval() / SECONDS_PER_DAY) + " days)\n"); buf.append("Score: " + getScore() + "\n"); buf.append("Signature: " + StringUtil.toHexString(getSignature()) + "\n"); buf.append("Metadata: "); if (metaData != null) { for (Entry<Writable, Writable> e : metaData.entrySet()) { buf.append(e.getKey()); buf.append(": "); buf.append(e.getValue()); } } buf.append('\n'); return buf.toString(); }
public Integer getSize() { return map.entrySet().size(); }
@Override protected void map(LongWritable key, MapWritable value, Context context) throws IOException, InterruptedException { for (java.util.Map.Entry<Writable, Writable> entry : value .entrySet()) { context.write((Text) entry.getKey(), (Text) entry.getValue()); } } }
@Override public void map(Object key, MapWritable value, Context context) throws IOException, InterruptedException { for (Map.Entry<Writable, Writable> entry : value.entrySet()) { word.set(entry.getValue().toString()); context.write(word, ONE); } } }
public static final Properties readProperties(DataInput in) throws IOException { Properties props = new Properties(); MapWritable propsWritable = new MapWritable(); propsWritable.readFields(in); for (Entry<Writable, Writable> prop : propsWritable.entrySet()) { String key = prop.getKey().toString(); String value = prop.getValue().toString(); props.put(key,value); } return props; }
public static final Properties readProperties(DataInput in) throws IOException { Properties props = new Properties(); MapWritable propsWritable = new MapWritable(); propsWritable.readFields(in); for (Entry<Writable, Writable> prop : propsWritable.entrySet()) { String key = prop.getKey().toString(); String value = prop.getValue().toString(); props.put(key,value); } return props; }
public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }
public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }
public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }
public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }
public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }
public void writeMap(MapWritable mw) throws IOException { out.writeMapHeader(mw.size()); for (Map.Entry<Writable, Writable> entry : mw.entrySet()) { write(entry.getKey()); write(entry.getValue()); } }