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/05/06 20:56:00 UTC

svn commit: r1742629 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemConstants.java

Author: schor
Date: Fri May  6 20:56:00 2016
New Revision: 1742629

URL: http://svn.apache.org/viewvc?rev=1742629&view=rev
Log:
[UIMA-4673] reorg type systems constants into separate interface, which can then be added to any class to ref the values without prefix

Added:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemConstants.java

Added: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemConstants.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemConstants.java?rev=1742629&view=auto
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemConstants.java (added)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemConstants.java Fri May  6 20:56:00 2016
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.uima.cas.impl;
+
+import org.apache.uima.cas.CAS;
+
+/**
+ * This interface defines static final constants for Type Systems
+ *   For the built-in types and features:
+ *     - the type and feature codes
+ *     - the adjOffsets
+ *
+ */
+public interface TypeSystemConstants {
+
+  /******************************************
+   * built-in type codes
+   ******************************************/
+  // Code of root of hierarchy (will be 1 with current implementation)
+  static final int topTypeCode = 1;
+  static final int intTypeCode = 2;
+  static final int floatTypeCode = 3;
+  static final int stringTypeCode = 4;
+  static final int arrayBaseTypeCode = 5;
+  static final int fsArrayTypeCode = 6;
+  static final int floatArrayTypeCode = 7;
+  static final int intArrayTypeCode = 8;
+  static final int stringArrayTypeCode = 9;
+  // 10 list base
+  static final int fsListTypeCode = 11; // 11           fs list
+  static final int fsEListTypeCode = 12;// 12 empty     fs list
+  static final int fsNeListTypeCode = 13;// 13 non-empty fs list
+  static final int floatListTypeCode = 14; // 14           float list
+  static final int floatEListTypeCode = 15;// 15 empty     float list
+  static final int floatNeListTypeCode = 16;  // 16 non-empty float list
+  static final int intListTypeCode = 17; // 17           integer list
+  static final int intEListTypeCode = 18;  // 18 empty     integer list
+  static final int intNeListTypeCode = 19; // 19 non-empty integer list
+  static final int stringListTypeCode = 20;  // 20           string list
+  static final int stringEListTypeCode = 21;  // 21 empty     string list
+  static final int stringNeListTypeCode = 22;  // 22 non-empty string list
+
+  static final int booleanTypeCode = 23;
+  static final int byteTypeCode = 24;
+  static final int shortTypeCode = 25;
+  static final int longTypeCode = 26;
+  static final int doubleTypeCode = 27;
+  static final int booleanArrayTypeCode = 28;
+  static final int byteArrayTypeCode = 29;
+  static final int shortArrayTypeCode = 30;
+  static final int longArrayTypeCode = 31;
+  static final int doubleArrayTypeCode = 32;
+  static final int sofaTypeCode = 33;
+  static final int annotBaseTypeCode = 34;
+  static final int annotTypeCode = 35;
+  static final int docTypeCode = 36;  // DocumentAnnotation
+  static final int javaObjectTypeCode = 37;
+  static final int javaObjectArrayTypeCode = 38;
+
+  /**
+   * Static final constants for built-in features
+   */
+  static final int sofaNumFeatCode = 9;  // ref from another pkg
+  static final int sofaIdFeatCode = 10;
+  static final int sofaStringFeatCode = 13;
+  static final int sofaMimeFeatCode = 11;
+  static final int sofaUriFeatCode = 14;
+  static final int sofaArrayFeatCode = 12;
+  static final int annotBaseSofaFeatCode = 15; // ref from another pkg
+  static final int beginFeatCode = 16;
+  static final int endFeatCode = 17;
+  static final int langFeatCode = 18;
+
+  /**
+   * adjOffsets for builtin Features
+   */
+  static final TypeSystemImpl staticTsi = TypeSystemImpl.staticTsi;
+  static final int sofaNumFeatAdjOffset = staticTsi.sofaType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFANUM);  
+  static final int sofaIdFeatAdjOffset = staticTsi.sofaType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFAID);
+  static final int sofaStringFeatAdjOffset = staticTsi.sofaType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFASTRING);
+  static final int sofaMimeFeatAdjOffset = staticTsi.sofaType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFAMIME);
+  static final int sofaUriFeatAdjOffset = staticTsi.sofaType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFAURI);
+  static final int sofaArrayFeatAdjOffset = staticTsi.sofaType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFAARRAY);
+  static final int annotBaseSofaFeatAdjOffset = staticTsi.annotBaseType.getAdjOffset(CAS.FEATURE_BASE_NAME_SOFA);
+  static final int beginFeatAdjOffset = staticTsi.annotType.getAdjOffset(CAS.FEATURE_BASE_NAME_BEGIN);
+  static final int endFeatAdjOffset = staticTsi.annotType.getAdjOffset(CAS.FEATURE_BASE_NAME_END);
+  static final int langFeatAdjOffset = staticTsi.docType.getAdjOffset(CAS.FEATURE_BASE_NAME_LANGUAGE);
+}