com.graphhopper.reader.osm.pbf.PbfBlobResult Maven / Gradle / Ivy
// This software is released into the Public Domain. See copying.txt for details.
package com.graphhopper.reader.osm.pbf;
import com.graphhopper.reader.ReaderElement;
import java.util.List;
/**
* Stores the results for a decoded Blob.
*
*
* @author Brett Henderson
*/
public class PbfBlobResult {
private List entities;
private boolean complete;
private boolean success;
private Exception ex;
/**
* Creates a new instance.
*/
public PbfBlobResult() {
complete = false;
success = false;
ex = new RuntimeException("no success result stored");
}
/**
* Stores the results of a successful blob decoding operation.
*
*
* @param decodedEntities The entities from the blob.
*/
public void storeSuccessResult(List decodedEntities) {
entities = decodedEntities;
complete = true;
success = true;
}
/**
* Stores a failure result for a blob decoding operation.
*/
public void storeFailureResult(Exception ex) {
complete = true;
success = false;
this.ex = ex;
}
/**
* Gets the complete flag.
*
*
* @return True if complete.
*/
public boolean isComplete() {
return complete;
}
/**
* Gets the success flag. This is only valid after complete becomes true.
*
*
* @return True if successful.
*/
public boolean isSuccess() {
return success;
}
public Exception getException() {
return ex;
}
/**
* Gets the entities decoded from the blob. This is only valid after complete becomes true, and
* if success is true.
*
*
* @return The list of decoded entities.
*/
public List getEntities() {
return entities;
}
}