You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/07/06 13:59:11 UTC
svn commit: r1751682 -
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/
Author: schor
Date: Wed Jul 6 13:59:11 2016
New Revision: 1751682
URL: http://svn.apache.org/viewvc?rev=1751682&view=rev
Log:
no Jira - comments improvement, variable renaming
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1751682&r1=1751681&r2=1751682&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Wed Jul 6 13:59:11 2016
@@ -294,7 +294,7 @@ public class CASImpl extends AbstractCas
// private final BitSet featureJiInIndexKeys = new BitSet(1024); // indexed by JCas Feature Index, not feature code.
// A map from SofaNumbers which are also view numbers to IndexRepositories.
- // these numbers are dense, and start with 1. 1 is the initial view. 0 is the base case
+ // these numbers are dense, and start with 1. 1 is the initial view. 0 is the base cas
private ArrayList<FSIndexRepositoryImpl> sofa2indexMap;
@@ -416,12 +416,14 @@ public class CASImpl extends AbstractCas
/**
* Created at startup time, lives as long as the CAS lives
+ * Serves to reference code for binary cas ser/des that used to live
+ * in this class, but was moved out
*/
private final BinaryCasSerDes bcsd;
/**
- * Created when doing binary or form4 non-delta serialization, used in subsequent delta deserialization
- * Created when doing binary or form4 non-delta deserialization, used in subsequent delta serialization
+ * Created when doing binary or form4 non-delta (de)serialization, used in subsequent delta ser/deserialization
+ * Created when doing binary or form4 non-delta ser/deserialization, used in subsequent delta (de)serialization
* Reset with CasReset or deltaMergesComplete API call
*/
private CommonSerDesSequential csds;
@@ -1265,6 +1267,7 @@ public class CASImpl extends AbstractCas
System.out.println("CAS Reset in thread " + Thread.currentThread().getName() +
" for CasId = " + getCasId() + ", new reset count = " + svd.casResets.get());
}
+
int numViews = this.getViewCount();
// Flush indexRepository for all views
for (int view = 1; view <= numViews; view++) {
@@ -1284,8 +1287,8 @@ public class CASImpl extends AbstractCas
}
this.svd.clearTrackingMarks();
-
- this.indexRepository.flush(); // for base view, other views flushed above
+ // safety : in case this public method is called on other than the base cas
+ this.getBaseCAS().indexRepository.flush(); // for base view, other views flushed above
this.svd.clearSofaInfo(); // but keep initial view, and other views
// because setting up the index infrastructure is expensive
this.svd.viewCount = 1; // initial view
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java?rev=1751682&r1=1751681&r2=1751682&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CasSerializerSupport.java Wed Jul 6 13:59:11 2016
@@ -350,12 +350,12 @@ public class CasSerializerSupport {
private final ErrorHandler errorHandler2;
- public TypeSystemImpl filterTypeSystem;
+ public TypeSystemImpl filterTypeSystem_inner;
// map to reduce string usage by reusing equal string representations; lives just for one serialize call
private final Map<String, String> uniqueStrings = new HashMap<String, String>();
- public final boolean isFormattedOutput;
+ public final boolean isFormattedOutput_inner;
private final CasSerializerSupportSerialize csss;
@@ -380,8 +380,8 @@ public class CasSerializerSupport {
this.sharedData = sharedData;
// copy outer class values into final inner ones, to keep the outer thread-safe
- filterTypeSystem = CasSerializerSupport.this.filterTypeSystem;
- isFormattedOutput = CasSerializerSupport.this.isFormattedOutput;
+ filterTypeSystem_inner = CasSerializerSupport.this.filterTypeSystem;
+ isFormattedOutput_inner = CasSerializerSupport.this.isFormattedOutput;
this.marker = marker;
errorHandler2 = CasSerializerSupport.this.errorHandler;
@@ -391,7 +391,7 @@ public class CasSerializerSupport {
// listUtils = new ListUtils(cas, logger, errorHandler);
typeUsed = new BitSet();
- isFiltering = filterTypeSystem != null && filterTypeSystem != tsi;
+ isFiltering = filterTypeSystem_inner != null && filterTypeSystem_inner != tsi;
if (marker != null && !marker.isValid()) {
throw new CASRuntimeException(CASRuntimeException.INVALID_MARKER, "Invalid Marker.");
}
@@ -625,6 +625,7 @@ public class CasSerializerSupport {
for (TOP fs : fss) {
if (marker.isModified(fs)) {
TOP encompassingFs = sharedData.getEncompassingFS(fs);
+ assert null != encompassingFs;
if (-1 != enqueueCommonWithoutDeltaAndFilteringCheck(encompassingFs)) { // only to set type used info and check if already enqueued
modifiedEmbeddedValueFSs.add(encompassingFs);
}
@@ -664,7 +665,26 @@ public class CasSerializerSupport {
}
private int enqueueCommon(TOP fs, boolean doDeltaAndFilteringCheck) {
+// // debug
+// if (null == fs) {
+// System.out.println("debug null fs");
+// new Throwable().printStackTrace();
+// int i = 0;
+// while (true) {
+// try {
+// Thread.sleep(10000);
+// } catch (InterruptedException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// i++;
+// if (i % 10 == 0) {
+// System.err.println("debug sleeping");
+// }
+// }
+// }
+
// final int typeCode = cas.getHeapValue(addr);
// assert(typeCode != 0);
if (doDeltaAndFilteringCheck) {
@@ -676,7 +696,7 @@ public class CasSerializerSupport {
if (isFiltering) {
String typeName = fs._getTypeImpl().getName();
- if (filterTypeSystem.getType(typeName) == null) {
+ if (filterTypeSystem_inner.getType(typeName) == null) {
return -1; // this type is not in the target type system
}
}
@@ -832,7 +852,7 @@ public class CasSerializerSupport {
for (TOP elem : theArray) {
if (isFiltering &&
- (null == filterTypeSystem.getType(elem._getTypeImpl().getName()))) {
+ (null == filterTypeSystem_inner.getType(elem._getTypeImpl().getName()))) {
continue; // skip because not in filter type system
}
if (elem != null) {
@@ -847,7 +867,7 @@ public class CasSerializerSupport {
boolean insideListNode = fs instanceof CommonList;
for (FeatureImpl fi : fs._getTypeImpl().getFeatureImpls()) {
- if (isFiltering && filterTypeSystem.getFeatureByFullName(fi.getName()) == null) {
+ if (isFiltering && filterTypeSystem_inner.getFeatureByFullName(fi.getName()) == null) {
// skip features that aren't in the target type system
continue;
}
@@ -1127,7 +1147,7 @@ public class CasSerializerSupport {
if (fs == null) {
return 0;
}
- if (isFiltering && null == filterTypeSystem.getType(fs._getTypeImpl().getName())) { // return as null any references to types not in target TS
+ if (isFiltering && null == filterTypeSystem_inner.getType(fs._getTypeImpl().getName())) { // return as null any references to types not in target TS
return 0;
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java?rev=1751682&r1=1751681&r2=1751682&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CommonSerDesSequential.java Wed Jul 6 13:59:11 2016
@@ -32,7 +32,7 @@ import org.apache.uima.jcas.cas.TOP;
/**
* Common de/serialization for plain binary and compressed binary form 4
- * which both walk the cas using the sequential, incrementing id approach
+ * which both used to walk the cas using the sequential, incrementing id approach
*
* Lifecycle:
* There is 0/1 instance per CAS, representing the FSs at some point in time in that CAS.
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1751682&r1=1751681&r2=1751682&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java Wed Jul 6 13:59:11 2016
@@ -267,6 +267,10 @@ public class FeatureStructureImplC imple
cas.removeFsFromIndexes(this);
}
+ /**
+ * remove this FS from indexes in a specific view, perhaps different from the view where this was created.
+ * @param cas the Cas
+ */
public void removeFromIndexes(JCas jcas) {
jcas.removeFsFromIndexes(this);
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java?rev=1751682&r1=1751681&r2=1751682&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java Wed Jul 6 13:59:11 2016
@@ -655,7 +655,7 @@ public class XmiCasSerializer {
isPastFirstElement = true;
}
sb.append(xmiId);
- if (cds.isFormattedOutput && (sb.length() > nextBreak)) {
+ if (cds.isFormattedOutput_inner && (sb.length() > nextBreak)) {
sb.append(SYSTEM_LINE_FEED);
nextBreak += CasSerializerSupport.PP_LINE_LENGTH;
}
@@ -883,7 +883,7 @@ public class XmiCasSerializer {
if (cds.isFiltering) {
// skip features that aren't in the target type system
String fullFeatName = fi.getName();
- if (cds.filterTypeSystem.getFeatureByFullName(fullFeatName) == null) {
+ if (cds.filterTypeSystem_inner.getFeatureByFullName(fullFeatName) == null) {
continue;
}
}
@@ -1051,7 +1051,7 @@ public class XmiCasSerializer {
String xmiId = cds.getXmiId(elemFS);
if (cds.isFiltering) { // return as null any references to types not in target TS
String typeName = elemFS._getTypeImpl().getName();
- if (cds.filterTypeSystem.getType(typeName) == null) {
+ if (cds.filterTypeSystem_inner.getType(typeName) == null) {
xmiId = "0";
}
}
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java?rev=1751682&r1=1751681&r2=1751682&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java Wed Jul 6 13:59:11 2016
@@ -65,7 +65,7 @@ public class XmiSerializationSharedData
/**
* V3: FSs have an id - use that. (Assumes id's are internal ones)
*
- * A map from FeatureStructure address to xmi:id. This is populated whenever
+ * A map from FeatureStructures to xmi:id. This is populated whenever
* an XMI element is serialized or deserialized. It is used by the
* getXmiId() method, which is done to ensure a consistent ID for each FS
* address across multiple serializations.
@@ -73,8 +73,6 @@ public class XmiSerializationSharedData
private Obj2IntIdentityHashMap<TOP> fsToXmiId = new Obj2IntIdentityHashMap<>(TOP.class, TOP.singleton);
/**
- * V3: use the cas's getFsFromId (Assumes id's are internal ones)
- *
* A map from xmi:id to FeatureStructure address. This is populated whenever
* an XMI element is serialized or deserialized. It is used by the
* getFsAddrForXmiId() method, necessary to support merging multiple XMI
@@ -118,7 +116,7 @@ public class XmiSerializationSharedData
/**
* V3: key is TOP, value is TOP
*
- * Map from FS address of a non-shared multi-valued (Array/List) FS to the
+ * Map from FS of a non-shared multi-valued (Array/List) FS to the
* FS address of the encompassing FS which has a feature whose value is this multi-valued FS.
* Used when deserializing a Delta CAS to find and serialize the encompassing FS when
* the non-shared array/list FS is modified.