本文整理汇总了Java中org.javarosa.core.model.trace.EvaluationTrace类的典型用法代码示例。如果您正苦于以下问题:Java EvaluationTrace类的具体用法?Java EvaluationTrace怎么用?Java EvaluationTrace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EvaluationTrace类属于org.javarosa.core.model.trace包,在下文中一共展示了EvaluationTrace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadProfileMatches
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
@Override
public List<Integer> loadProfileMatches(IndexedValueLookup querySet, QueryContext context) {
String indexName = querySet.getKey().substring(Case.INDEX_CASE_INDEX_PRE.length());
String value = (String)querySet.value;
Cache cache = context.getQueryCache(Cache.class);
if(!cache.currentlyFetchedIndexKeys.contains(indexName)) {
if(context.getScope() < BULK_LOAD_THRESHOLD) {
return null;
}
EvaluationTrace trace = new EvaluationTrace("Index Bulk Prefetch [" + indexName + "]");
int indexFetchSize = mCaseIndexTable.loadIntoIndexTable(cache.indexCache, indexName);
trace.setOutcome("Loaded: " + indexFetchSize);
context.reportTrace(trace);
cache.currentlyFetchedIndexKeys.add(indexName);
}
String cacheKey = indexName + "|" + value;
return cache.indexCache.get(cacheKey);
}
示例2: loadModelQuerySet
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
@Override
protected ModelQuerySet loadModelQuerySet(QueryContext queryContext) {
EvaluationTrace trace = new EvaluationTrace("Load Query Set Transform[" +
getRootLookup().getCurrentQuerySetId() + "]=>[" +
this.getCurrentQuerySetId()+ "]");
Set<Integer> querySetBody = getRootLookup().getLookupSetBody(queryContext);
DualTableSingleMatchModelQuerySet ret = table.bulkReadIndexToCaseIdMatch(indexName, querySetBody);
cacheCaseModelQuerySet(queryContext, ret);
trace.setOutcome("Loaded: " + ret.getSetBody().size());
queryContext.reportTrace(trace);
return ret;
}
示例3: loadProfileMatches
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
@Override
public List<Integer> loadProfileMatches(ModelQueryLookup getLookupKey, QueryContext queryContext) {
QuerySetLookup lookup = getLookupKey.getSetLookup();
EvaluationTrace trace = new EvaluationTrace("QuerySetLookup|" + lookup.getCurrentQuerySetId());
List<Integer> lookupData = lookup.
performSetLookup(getLookupKey.getRootLookupRef(), queryContext);
if (lookupData != null) {
trace.setOutcome("Results: " +lookupData.size());
queryContext.reportTrace(trace);
}
return lookupData;
}
示例4: populateMetaDataCacheAndReadForRecord
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
private String[] populateMetaDataCacheAndReadForRecord(RecordSetResultCache recordSetCache,
String recordSetKey,
RecordObjectCache<String[]> recordObjectCache,
String recordObjectKey,
String[] metaFields,
QueryContext context) {
Pair<String, LinkedHashSet<Integer>> tranche =
recordSetCache.getRecordSetForRecordId(recordSetKey, recordId);
EvaluationTrace loadTrace =
new EvaluationTrace(String.format("Model [%s]: Limited Scope Partial Bulk Load [%s}",
recordObjectKey,tranche.first));
LinkedHashSet<Integer> body = tranche.second;
parent.getStorage().bulkReadMetadata(body, metaFields, recordObjectCache.getLoadedCaseMap(recordObjectKey));
loadTrace.setOutcome("Loaded: " + body.size());
context.reportTrace(loadTrace);
return recordObjectCache.getLoadedRecordObject(recordObjectKey, recordId);
}
示例5: printAndClearTraces
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Prints out traces (if any exist) from the provided reporter with a description into sysout
*/
public static void printAndClearTraces(EvaluationTraceReporter reporter, String description) {
if (reporter != null) {
if (reporter.wereTracesReported()) {
System.out.println(description);
}
StringEvaluationTraceSerializer serializer = new StringEvaluationTraceSerializer();
for (EvaluationTrace trace : reporter.getCollectedTraces()) {
System.out.println(trace.getExpression() + ": " + trace.getValue());
System.out.print(serializer.serializeEvaluationLevels(trace));
}
reporter.reset();
}
}
示例6: collectAndClearTraces
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Prints out traces (if any exist) from the provided reporter with a description into sysout
*/
public static String collectAndClearTraces(EvaluationTraceReporter reporter, String description) {
String returnValue = "";
if (reporter != null) {
if (reporter.wereTracesReported()) {
returnValue += description + "\n";
}
StringEvaluationTraceSerializer serializer = new StringEvaluationTraceSerializer();
for (EvaluationTrace trace : reporter.getCollectedTraces()) {
returnValue += trace.getExpression() + ": " + trace.getValue() + "\n";
returnValue += serializer.serializeEvaluationLevels(trace);
}
reporter.reset();
}
return returnValue;
}
示例7: reportBulkTraceResults
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Creates a record that we are going to attempt to expand a set of bulk lookup predicates
*/
private void reportBulkTraceResults(Vector<XPathExpression> startingSet,
Vector<XPathExpression> finalSet,
Collection<TreeReference> childSet) {
if (mAccumulateExprs) {
if (!(mDebugCore.mCurrentTraceLevel instanceof BulkEvaluationTrace)) {
throw new RuntimeException("Predicate tree mismatch");
}
BulkEvaluationTrace trace = (BulkEvaluationTrace)mDebugCore.mCurrentTraceLevel;
trace.setEvaluatedPredicates(startingSet, finalSet, childSet);
if (!(trace.isBulkEvaluationSucceeded())) {
EvaluationTrace parentTrace = trace.getParent();
if (parentTrace == null){
trace.markClosed();
//no need to remove from the parent context if it doens't exist
return;
}
Vector<EvaluationTrace> traces = trace.getParent().getSubTraces();
synchronized (traces){
traces.remove(trace);
}
}
}
}
示例8: getDebugTraceMap
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Aggregates a map of evaluation traces collected by the form's
* triggerables.
*
* @return A mapping from TreeReferences to a set of evaluation traces. The
* traces are separated out by triggerable category (calculate, relevant,
* etc) and represent the execution of the last expression that was
* executed for that trigger.
* @throws IllegalStateException If debugging has not been enabled.
*/
public Hashtable<TreeReference, Hashtable<String, EvaluationTrace>> getDebugTraceMap()
throws IllegalStateException {
if (!mDebugModeEnabled) {
throw new IllegalStateException("Debugging is not enabled");
}
// TODO: sure would be nice to be able to cache this at some point, but
// will have to have a way to invalidate by trigger or something
Hashtable<TreeReference, Hashtable<String, EvaluationTrace>> debugInfo =
new Hashtable<TreeReference, Hashtable<String, EvaluationTrace>>();
for (int i = 0; i < triggerables.size(); i++) {
Triggerable t = triggerables.elementAt(i);
Hashtable<TreeReference, EvaluationTrace> triggerOutputs = t.getEvaluationTraces();
for (Enumeration e = triggerOutputs.keys(); e.hasMoreElements(); ) {
TreeReference elementRef = (TreeReference)e.nextElement();
String label = t.getDebugLabel();
Hashtable<String, EvaluationTrace> traces = debugInfo.get(elementRef);
if (traces == null) {
traces = new Hashtable<String, EvaluationTrace>();
}
traces.put(label, triggerOutputs.get(elementRef));
debugInfo.put(elementRef, traces);
}
}
return debugInfo;
}
示例9: openTrace
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Creates a record that an expression is about to be evaluated.
*
* @param xPathExpression the expression being evaluated
*/
public void openTrace(XPathExpression xPathExpression) {
if (mAccumulateExprs) {
String expressionString = xPathExpression.toPrettyString();
EvaluationTrace newLevel = new EvaluationTrace(expressionString,
mDebugCore.mCurrentTraceLevel);
if (mDebugCore.mCurrentTraceLevel != null) {
mDebugCore.mCurrentTraceLevel.addSubTrace(newLevel);
}
mDebugCore.mCurrentTraceLevel = newLevel;
}
}
示例10: setDebug
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* @param mDebugMode Whether this triggerable should be collecting trace information
* during execution.
*/
public void setDebug(boolean mDebugMode) {
this.mIsDebugOn = mDebugMode;
if (mIsDebugOn) {
mTriggerDebugs = new Hashtable<TreeReference, EvaluationTrace>();
} else {
mTriggerDebugs = null;
}
}
示例11: getEvaluationTraces
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Retrieves evaluation traces collected during execution of this
* triggerable in debug mode.
*
* @return A mapping from tree refernences impacted by this triggerable, to
* the root of the evaluation trace that was triggered.
* @throws IllegalStateException If debugging has not been enabled.
*/
public Hashtable<TreeReference, EvaluationTrace> getEvaluationTraces() throws IllegalStateException {
if (!mIsDebugOn) {
throw new IllegalStateException("Evaluation traces requested from triggerable not in debug mode.");
}
if (mTriggerDebugs == null) {
return new Hashtable<TreeReference, EvaluationTrace>();
}
return this.mTriggerDebugs;
}
示例12: getElement
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
protected Model getElement(int recordId, QueryContext context) {
if (context == null || getStorageCacheName() == null) {
return getElementSingular(recordId, context);
}
RecordSetResultCache recordSetCache = context.getQueryCacheOrNull(RecordSetResultCache.class);
String storageCacheKey = getStorageCacheName();
RecordObjectCache<Model> recordObjectCache = getRecordObjectCacheIfRelevant(context);
if(recordObjectCache != null) {
if (recordObjectCache.isLoaded(storageCacheKey, recordId)) {
return recordObjectCache.getLoadedRecordObject(storageCacheKey, recordId);
}
if (canLoadRecordFromGroup(recordSetCache, getStorageCacheName(), recordId)) {
Pair<String, LinkedHashSet<Integer>> tranche =
recordSetCache.getRecordSetForRecordId(storageCacheKey, recordId);
EvaluationTrace loadTrace =
new EvaluationTrace(String.format("Model [%s]: Bulk Load [%s}",
this.getStorageCacheName(),tranche.first));
LinkedHashSet<Integer> body = tranche.second;
storage.bulkRead(body, recordObjectCache.getLoadedCaseMap(storageCacheKey));
loadTrace.setOutcome("Loaded: " + body.size());
context.reportTrace(loadTrace);
return recordObjectCache.getLoadedRecordObject(storageCacheKey, recordId);
}
}
return getElementSingular(recordId, context);
}
示例13: getElementSingular
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Retrieves a model for the provided record ID using a guaranteed singular lookup from
* storage. This is the "Safe" fallback behavior for lookups.
*/
protected Model getElementSingular(int recordId, QueryContext context) {
EvaluationTrace trace = new EvaluationTrace(String.format("Model [%s]: Singular Load", getStorageCacheName()));
Model m = storage.read(recordId);
trace.setOutcome(String.valueOf(recordId));
if(context!= null) {
context.reportTrace(trace);
}
return m;
}
示例14: getDebugTraceMap
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Aggregates a map of evaluation traces collected by the form's
* triggerables.
*
* @return A mapping from TreeReferences to a set of evaluation traces. The
* traces are separated out by triggerable category (calculate, relevant,
* etc) and represent the execution of the last expression that was
* executed for that trigger.
* @throws IllegalStateException If debugging has not been enabled.
*/
public Hashtable<TreeReference, Hashtable<String, EvaluationTrace>> getDebugTraceMap()
throws IllegalStateException {
if (!mDebugModeEnabled) {
throw new IllegalStateException("Debugging is not enabled");
}
// TODO: sure would be nice to be able to cache this at some point, but
// will have to have a way to invalidate by trigger or something
Hashtable<TreeReference, Hashtable<String, EvaluationTrace>> debugInfo =
new Hashtable<>();
for (Triggerable t : triggerables) {
Hashtable<TreeReference, EvaluationTrace> triggerOutputs = t.getEvaluationTraces();
for (Enumeration e = triggerOutputs.keys(); e.hasMoreElements(); ) {
TreeReference elementRef = (TreeReference)e.nextElement();
String label = t.getDebugLabel();
Hashtable<String, EvaluationTrace> traces = debugInfo.get(elementRef);
if (traces == null) {
traces = new Hashtable<>();
}
traces.put(label, triggerOutputs.get(elementRef));
debugInfo.put(elementRef, traces);
}
}
return debugInfo;
}
示例15: openTrace
import org.javarosa.core.model.trace.EvaluationTrace; //导入依赖的package包/类
/**
* Creates a record that an expression is about to be evaluated.
*
* @param xPathExpression the expression being evaluated
*/
public void openTrace(XPathExpression xPathExpression) {
if (mAccumulateExprs) {
String expressionString = xPathExpression.toPrettyString();
EvaluationTrace newLevel = new EvaluationTrace(expressionString);
openTrace(newLevel);
}
}