return false; } else if (!dateType.equals(other.dateType)) { return false;
@Override public int hashCode() { final int prime = 223; int result = 1; result = prime * result + ((colvis == null) ? 0 : colvis.hashCode()); result = prime * result + (deleted ? 1231 : 1237); result = prime * result + ((format == null) ? 0 : format.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((sinkData == null) ? 0 : sinkData.hashCode()); result = prime * result + ((sinkRelationship == null) ? 0 : sinkRelationship.hashCode()); result = prime * result + ((sinkAttribute1 == null) ? 0 : sinkAttribute1.hashCode()); result = prime * result + ((sourceData == null) ? 0 : sourceData.hashCode()); result = prime * result + ((sourceRelationship == null) ? 0 : sourceRelationship.hashCode()); result = prime * result + ((sourceAttribute1 == null) ? 0 : sourceAttribute1.hashCode()); result = prime * result + ((statsType == null) ? 0 : statsType.hashCode()); result = prime * result + (int) (timestamp ^ (timestamp >>> 32)); result = prime * result + ((attribute3 == null) ? 0 : attribute3.hashCode()); result = prime * result + ((attribute2 == null) ? 0 : attribute2.hashCode()); result = prime * result + ((yyyymmdd == null) ? 0 : yyyymmdd.hashCode()); result = prime * result + ((dateType == null) ? 0 : dateType.hashCode()); return result; }
public static DATE_TYPE parse(String dateType) { for (DATE_TYPE dType : DATE_TYPE.values()) { if (dType.abbreviation.equals(dateType)) { return dType; } } return null; // default is unidirectional }
builder.setDateType(DATE_TYPE.parse(parts.get(version.getDateTypeIndex())));
return false; } else if (!dateType.equals(other.dateType)) { return false;
parts.set(version.getDateTypeIndex(), this.getDateType().toString());
@Override public int hashCode() { final int prime = 223; int result = 1; result = prime * result + ((colvis == null) ? 0 : colvis.hashCode()); result = prime * result + (deleted ? 1231 : 1237); result = prime * result + ((format == null) ? 0 : format.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((sinkData == null) ? 0 : sinkData.hashCode()); result = prime * result + ((sinkRelationship == null) ? 0 : sinkRelationship.hashCode()); result = prime * result + ((sinkAttribute1 == null) ? 0 : sinkAttribute1.hashCode()); result = prime * result + ((sourceData == null) ? 0 : sourceData.hashCode()); result = prime * result + ((sourceRelationship == null) ? 0 : sourceRelationship.hashCode()); result = prime * result + ((sourceAttribute1 == null) ? 0 : sourceAttribute1.hashCode()); result = prime * result + ((statsType == null) ? 0 : statsType.hashCode()); result = prime * result + (int) (timestamp ^ (timestamp >>> 32)); result = prime * result + ((attribute3 == null) ? 0 : attribute3.hashCode()); result = prime * result + ((attribute2 == null) ? 0 : attribute2.hashCode()); result = prime * result + ((yyyymmdd == null) ? 0 : yyyymmdd.hashCode()); result = prime * result + ((dateType == null) ? 0 : dateType.hashCode()); return result; }
/** * Determine as fast as possible the date type of an edge key without having to decode into and EdgeKey * * @param key * @return the date type of this accumulo edge key */ public static DATE_TYPE getDateType(Key key) { EdgeColumnParts parts = new EdgeColumnParts(key); EDGE_VERSION version = EDGE_VERSION.getEdgeVersion(parts); if (version == EDGE_VERSION.DATE_STATS_PROTOBUF) { return DATE_TYPE.parse(parts.get(8)); } else if (version == EDGE_VERSION.DATE_PROTOBUF) { return DATE_TYPE.parse(parts.get(6)); } else { return DATE_TYPE.OLD_EVENT; } } }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws java.io.IOException { super.init(source, options, env); initOptions(options); // Pre compute a state transition table so that the accept method can be as fast as possible state = new boolean[4]; for (int i = 0; i < state.length; i++) { state[i] = true; } if (dateType == EdgeQueryConfiguration.dateType.EVENT) { state[EdgeKey.DATE_TYPE.ACTIVITY_ONLY.ordinal()] = false; } else if (dateType == EdgeQueryConfiguration.dateType.ACTIVITY) { state[EdgeKey.DATE_TYPE.EVENT_ONLY.ordinal()] = false; state[EdgeKey.DATE_TYPE.OLD_EVENT.ordinal()] = false; } }
/** * Determines if the edge key matches the desired date type.<br> * <strong>note:</strong> Some edges qualify as both an event and an activity edge. Hence, can't simply negate the return value of isEventEdge or * isActivityEdge. * * @param k * @param V * @return boolean - true if it is a match. */ @Override public boolean accept(Key k, Value V) { return (state[EdgeKey.getDateType(k).ordinal()]); }